1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
#include "StarEntityRenderingTypes.hpp"
#include "StarJsonExtra.hpp"
#include "StarLexicalCast.hpp"
namespace Star {
EntityRenderLayer parseRenderLayer(String renderLayer) {
static CaseInsensitiveStringMap<EntityRenderLayer> RenderLayerMap{
{"BackgroundOverlay", RenderLayerBackgroundOverlay},
{"BackgroundTile", RenderLayerBackgroundTile},
{"Platform", RenderLayerPlatform},
{"Plant", RenderLayerPlant},
{"PlantDrop", RenderLayerPlantDrop},
{"Object", RenderLayerObject},
{"PreviewObject", RenderLayerPreviewObject},
{"BackParticle", RenderLayerBackParticle},
{"Vehicle", RenderLayerVehicle},
{"Effect", RenderLayerEffect},
{"Projectile", RenderLayerProjectile},
{"Monster", RenderLayerMonster},
{"Npc", RenderLayerNpc},
{"Player", RenderLayerPlayer},
{"ItemDrop", RenderLayerItemDrop},
{"Liquid", RenderLayerLiquid},
{"MiddleParticle", RenderLayerMiddleParticle},
{"ForegroundTile", RenderLayerForegroundTile},
{"ForegroundEntity", RenderLayerForegroundEntity},
{"ForegroundOverlay", RenderLayerForegroundOverlay},
{"FrontParticle", RenderLayerFrontParticle},
{"Overlay", RenderLayerOverlay},
};
int offset = 0;
if (renderLayer.contains("+")) {
StringList parts = renderLayer.split("+", 1);
renderLayer = parts.at(0);
offset = lexicalCast<int>(parts.at(1));
} else if (renderLayer.contains("-")) {
StringList parts = renderLayer.split("-", 1);
renderLayer = parts.at(0);
offset = -lexicalCast<int>(parts.at(1));
}
return RenderLayerMap.get(renderLayer) + offset;
}
PreviewTile::PreviewTile()
: foreground(false),
liqId(EmptyLiquidId),
matId(NullMaterialId),
hueShift(0),
updateMatId(false),
colorVariant(DefaultMaterialColorVariant),
updateLight(false) {}
PreviewTile::PreviewTile(
Vec2I const& position, bool foreground, MaterialId matId, MaterialHue hueShift, bool updateMatId)
: position(position),
foreground(foreground),
liqId(EmptyLiquidId),
matId(matId),
hueShift(hueShift),
updateMatId(updateMatId),
colorVariant(DefaultMaterialColorVariant),
updateLight(false) {}
PreviewTile::PreviewTile(Vec2I const& position, bool foreground, Vec3B const& light, bool updateLight)
: position(position),
foreground(foreground),
liqId(EmptyLiquidId),
matId(NullMaterialId),
hueShift(0),
updateMatId(false),
colorVariant(DefaultMaterialColorVariant),
light(light),
updateLight(updateLight) {}
PreviewTile::PreviewTile(Vec2I const& position,
bool foreground,
MaterialId matId,
MaterialHue hueShift,
bool updateMatId,
Vec3B const& light,
bool updateLight,
MaterialColorVariant colorVariant)
: position(position),
foreground(foreground),
liqId(EmptyLiquidId),
matId(matId),
hueShift(hueShift),
updateMatId(updateMatId),
colorVariant(colorVariant),
light(light),
updateLight(updateLight) {}
PreviewTile::PreviewTile(Vec2I const& position, LiquidId liqId)
: position(position),
foreground(true),
liqId(liqId),
matId(NullMaterialId),
hueShift(0),
updateMatId(false),
colorVariant(DefaultMaterialColorVariant),
updateLight(false) {}
OverheadBar::OverheadBar() : percentage(0.0f), detailOnly(false) {}
OverheadBar::OverheadBar(Json const& json) {
entityPosition = json.opt("position").apply(jsonToVec2F).value();
icon = json.optString("icon");
percentage = json.getFloat("percentage");
color = jsonToColor(json.get("color"));
detailOnly = json.getBool("detailOnly", false);
}
OverheadBar::OverheadBar(Maybe<String> icon, float percentage, Color color, bool detailOnly)
: icon(std::move(icon)), percentage(percentage), color(std::move(color)), detailOnly(detailOnly) {}
EnumMap<EntityHighlightEffectType> const EntityHighlightEffectTypeNames{
{EntityHighlightEffectType::None, "none"},
{EntityHighlightEffectType::Interactive, "interactive"},
{EntityHighlightEffectType::Inspectable, "inspectable"},
{EntityHighlightEffectType::Interesting, "interesting"},
{EntityHighlightEffectType::Inspected, "inspected"}
};
}
|