-
Notifications
You must be signed in to change notification settings - Fork 55
/
commonTypes.h
313 lines (272 loc) · 6.17 KB
/
commonTypes.h
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
#pragma once
#include "common.h"
#include "SpriteColors.h"
#include "df/enabler.h"
#include "df/graphic.h"
enum ShadeBy {
ShadeNone,
ShadeXml,
ShadeNamed,
ShadeMat,
ShadeLayer,
ShadeVein,
ShadeMatFore,
ShadeMatBack,
ShadeLayerFore,
ShadeLayerBack,
ShadeVeinFore,
ShadeVeinBack,
ShadeBodyPart,
ShadeJob,
ShadeBlood,
ShadeBuilding,
ShadeGrass,
ShadeItem,
ShadeEquip,
ShadeWood,
ShadeGrowth
} ;
enum hairstyles {
hairstyles_invalid = -1,
NEATLY_COMBED,
BRAIDED,
DOUBLE_BRAID,
PONY_TAILS,
CLEAN_SHAVEN,
hairstyles_end
};
enum hairtypes {
hairtypes_invalid = -1,
HAIR,
BEARD,
MOUSTACHE,
SIDEBURNS,
hairtypes_end
};
struct t_subSprite {
int32_t sheetIndex;
int32_t fileIndex;
ALLEGRO_COLOR shadeColor;
ShadeBy shadeBy;
char bodyPart[128];
uint8_t snowMin;
uint8_t snowMax;
} ;
struct t_SpriteWithOffset {
int32_t sheetIndex;
int16_t x;
int16_t y;
int32_t fileIndex;
uint8_t numVariations;
char animFrames;
ALLEGRO_COLOR shadeColor;
bool needOutline;
std::vector<t_subSprite> subSprites;
ShadeBy shadeBy;
char bodyPart[128];
uint8_t snowMin;
uint8_t snowMax;
} ;
typedef struct Crd2D {
int32_t x,y;
} Crd2D;
typedef struct Crd3D {
int32_t x,y,z;
} Crd3D;
class dfColors
{
public:
dfColors() {
memset(colors, 0, sizeof(colors));
update();
}
struct color {
uint8_t red;
uint8_t green;
uint8_t blue;
ALLEGRO_COLOR al;
void update() {
al = al_map_rgb(red,green,blue);
}
} colors[16];
enum color_name {
black,
blue,
green,
cyan,
red,
magenta,
brown,
lgray,
dgray,
lblue,
lgreen,
lcyan,
lred,
lmagenta,
yellow,
white
};
void update() {
for (int i = 0; i < 16; i++) {
colors[i].update();
}
}
color & operator [] (color_name col) {
return colors[col];
}
ALLEGRO_COLOR getDfColor(int color, bool useDfColors) {
if(color < 0 || color >= 16) {
return al_map_rgb(255,255,255);
}
if (useDfColors)
{
return al_map_rgb_f(df::global::gps->ccolor[color][0], df::global::gps->ccolor[color][1], df::global::gps->ccolor[color][2]);
}
return colors[ (color_name) color].al;
}
ALLEGRO_COLOR getDfColor(int color, int bright, bool useDfColors) {
return getDfColor(color + (bright * 8), useDfColors);
}
};
struct GameConfiguration {
bool overlay_mode;
bool show_zones;
bool show_stockpiles;
bool show_designations;
bool show_osd;
bool show_keybinds;
bool single_layer_view;
bool shade_hidden_tiles;
bool show_hidden_tiles;
bool show_creature_names;
bool names_use_nick;
bool names_use_species;
bool show_all_creatures;
bool load_ground_materials;
bool hide_outer_tiles;
bool debug_mode;
int lift_segment_offscreen_x;
int lift_segment_offscreen_y;
uint8_t truncate_walls;
bool verbose_logging;
int viewXoffset;
int viewYoffset;
int viewZoffset;
bool track_screen_center;
int automatic_reload_time;
int automatic_reload_step;
int animation_step;
int fontsize;
ALLEGRO_PATH * font;
bool Fullscreen;
bool show_intro;
ALLEGRO_COLOR fogcol;
ALLEGRO_COLOR backcol;
bool fogenable;
bool follow_DFcursor;
enum trackingmode : uint8_t {
TRACKING_NONE,
TRACKING_CENTER,
TRACKING_FOCUS,
TRACKING_INVALID
};
trackingmode track_mode;
bool invert_mouse_z;
int bitmapHolds;
bool saveImageCache;
bool cache_images;
int imageCacheSize;
bool useDfColors;
dfColors colors;
bool opengl;
bool directX;
bool software;
uint32_t menustate;
//DFHack::t_viewscreen viewscreen;
bool spriteIndexOverlay;
bool creditScreen;
int currentSpriteOverlay;
bool dayNightCycle;
bool show_creature_moods;
bool show_creature_jobs;
uint8_t show_creature_professions;
bool transparentScreenshots;
bool fog_of_war;
bool occlusion;
bool tile_count;
uint8_t bloodcutoff;
uint8_t poolcutoff;
//follows are anti-crash things
bool skipWorld;
bool skipCreatures;
bool skipCreatureTypes;
bool skipCreatureTypesEx;
bool skipDescriptorColors;
bool skipBuildings;
bool skipVegetation;
bool skipConstructions;
bool skipMaps;
bool skipInorganicMats;
bool skipOrganicMats;
//following are threading stuff
ALLEGRO_COND * readCond;
ALLEGRO_THREAD * readThread;
bool threadmade;
bool threadstarted;
bool threading_enable;
int platecount;
int zoom;
float scale;
};
struct GameState{
//properties of the currently viewed portion of the segment
Crd3D Position;
int Rotation;
//the size of the next segment to load, and the map region
Crd3D Size;
Crd3D RegionDim;
//position of the cursor
Crd3D dfCursor;
//position of the selection cursor
Crd3D dfSelection;
//the width and height of the stonesense window
int ScreenW;
int ScreenH;
};
struct FrameTimers{
float read_time;
float beautify_time;
float assembly_time;
float draw_time;
float overlay_time;
clock_t prev_frame_time;
float frame_total;
};
struct SS_Item {
DFHack::t_matglossPair item;
DFHack::t_matglossPair matt;
DFHack::t_matglossPair dyematt;
};
struct worn_item {
DFHack::t_matglossPair matt;
DFHack::t_matglossPair dyematt;
int8_t rating;
worn_item();
};
struct unit_inventory {
//[item_type][item_subtype][item_number]
std::vector<std::vector<std::vector<worn_item>>> item;
};
struct SS_Unit{
df::unit * origin;
uint16_t profession;
std::string custom_profession;
int32_t squad_leader_id;
uint32_t nbcolors;
uint32_t color[DFHack::Units::MAX_COLORS];
hairstyles hairstyle[hairtypes_end];
uint32_t hairlength[hairtypes_end];
bool isLegend;
std::unique_ptr<unit_inventory> inv;
};