/
types.h
368 lines (292 loc) · 8.61 KB
/
types.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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
#pragma once
#include "coreactor.h"
#include "names.h"
#include "packet.h"
#include "d_net.h"
#include "gameinput.h"
BEGIN_DUKE_NS
// all the struct types from JFDuke's duke3d.h
struct STATUSBARTYPE
{
short frag[MAXPLAYERS], got_access, last_extra, shield_amount, curr_weapon;
short ammo_amount[MAX_WEAPONS];
uint8_t inven_icon, jetpack_on, heat_on;
short firstaid_amount, steroids_amount, holoduke_amount, jetpack_amount;
short heat_amount, scuba_amount, boot_amount;
short last_weapon, weapon_pos, kickback_pic;
bool gotweapon[MAX_WEAPONS];
};
struct FireProj
{
vec3_t pos, vel;
};
// Todo - put more state in here
struct ActorInfo
{
uint32_t scriptaddress;
EDukeFlags1 flags;
EDukeFlags2 flags2;
int aimoffset;
int falladjustz;
int gutsoffset;
};
class DDukeActor : public DCoreActor
{
DECLARE_CLASS(DDukeActor, DCoreActor)
HAS_OBJECT_POINTERS
public:
TObjPtr<DDukeActor*> ownerActor, hitOwnerActor;
uint8_t cgg;
uint8_t spriteextra; // moved here for easier maintenance. This was originally a hacked in field in the sprite structure called 'filler'.
short attackertype, hitang, hitextra, movflag;
short tempang, dispicnum, basepicnum;
short timetosleep;
vec2_t ovel;
int floorz, ceilingz;
union
{
int saved_ammo;
int palvals;
};
int temp_data[6];
// Some SE's stored indices in temp_data. For purposes of clarity avoid that. These variables are meant to store these elements now
walltype* temp_walls[2]; // SE20 + SE128
sectortype* temp_sect, *actorstayput;
TObjPtr<DDukeActor*> temp_actor, seek_actor;
TArray<GameVarValue> uservars;
EDukeFlags1 flags1;
EDukeFlags2 flags2;
// Todo: Once we start assigning subclasses to actors, this one needs to be moved to the proper FIREBALL subclass.
FireProj fproj;
DDukeActor() = default;
size_t PropagateMark() override;
const ActorInfo* actorInfo() const;
// This once was stored in the owner field of the sprite
inline DDukeActor* GetOwner()
{
return ownerActor;
}
inline void SetOwner(DDukeActor* a)
{
ownerActor = a;
}
inline DDukeActor* GetHitOwner()
{
return hitOwnerActor;
}
inline void SetHitOwner(DDukeActor* a)
{
hitOwnerActor = a;
}
inline bool IsActiveCrane()
{
return spr.owner == -2;
}
inline void SetActiveCrane(bool yes)
{
ownerActor = nullptr;
spr.owner = yes ? -2 : -1;
}
int PlayerIndex() const
{
// only valid for real players - just here to abstract yvel.
return spr.yvel;
}
bool isPlayer() const
{
return spr.picnum == TILE_APLAYER;
}
void Serialize(FSerializer& arc) override;
void ChangeType(PClass* newtype)
{
if (newtype->IsDescendantOf(RUNTIME_CLASS(DDukeActor)) && newtype->Size == RUNTIME_CLASS(DDukeActor)->Size && GetClass()->Size == RUNTIME_CLASS(DDukeActor)->Size)
{
// It sucks having to do this but the game heavily depends on being able to swap out the class type and often uses this to manage actor state.
// We'll allow this only for classes that do not add their own data, though.
SetClass(newtype);
}
}
};
// subclassed to add a game specific actor() method
using HitInfo = THitInfo<DDukeActor>;
using Collision = TCollision<DDukeActor>;
struct animwalltype
{
walltype* wall;
int tag;
};
// for now just flags not related to actors, may get more info later.
struct TileInfo
{
int flags;
int loadeventscriptptr;
};
struct user_defs
{
uint8_t god, cashman, eog;
uint8_t clipping;
uint8_t user_pals[MAXPLAYERS];
short from_bonus;
short last_level, secretlevel;
short bomb_tag;
int const_visibility;
int runkey_mode;
int shadows;
int coords, levelstats, m_coop, coop;
int wchoice[MAXPLAYERS][MAX_WEAPONS];
int respawn_monsters, respawn_items, respawn_inventory, recstat, monsters_off, brightness;
int m_respawn_items, m_respawn_monsters, m_respawn_inventory, m_recstat, m_monsters_off;
int m_ffire, ffire, m_player_skill, multimode;
int player_skill, marker;
TObjPtr<DDukeActor*> cameraactor;
};
struct player_orig
{
vec3_t opos;
short oa;
sectortype* os;
};
struct CraneDef
{
vec3_t pos;
vec2_t pole;
TObjPtr<DDukeActor*> poleactor;
};
struct player_struct
{
// This is basically the version from JFDuke but this first block contains a few changes to make it work with other parts of Raze.
// The sound code wants to read a vector out of this so we need to define one for the main coordinate.
vec3_t pos, opos, vel;
// player's horizon and angle structs.
PlayerHorizon horizon;
PlayerAngle angle;
uint16_t frags[MAXPLAYERS];
bool gotweapon[MAX_WEAPONS];
// Palette management uses indices into the engine's palette table now.
PalEntry pals;
// this was a global variable originally.
vec2_t fric, exit, loogie[64], bobpos;
// weapon drawer variables and their interpolation counterparts.
int weapon_sway;
int oweapon_sway;
short weapon_pos, kickback_pic, random_club_frame;
short oweapon_pos, okickback_pic, orandom_club_frame;
uint8_t hard_landing;
uint8_t ohard_landing;
int fistsign, ofistsign;
// Store current psectlotag as determined in processinput() for use with scaling angle aiming.
short psectlotag;
// From here on it is unaltered from JFDuke with the exception of a few fields that are no longer needed and were removed.
int numloogs, loogcnt;
int invdisptime;
int pyoff, opyoff;
int last_pissed_time, truefz, truecz;
int player_par, visibility;
int bobcounter;
int randomflamex, crack_time;
int aim_mode, ftt;
sectortype* cursector;
sectortype* one_parallax_sectnum; // wall + sector references. Make them pointers later?
walltype* access_wall;
DDukeActor* actor;
TObjPtr<DDukeActor*> actorsqu, wackedbyactor, on_crane, holoduke_on, somethingonplayer, access_spritenum, dummyplayersprite, newOwner;
short last_extra, subweapon;
short ammo_amount[MAX_WEAPONS], frag, fraggedself;
short curr_weapon, last_weapon, tipincs, wantweaponfire;
short holoduke_amount, hurt_delay, hbomb_hold_delay;
short jumping_counter, airleft, knee_incs, access_incs;
short ftq;
short got_access, weapon_ang, firstaid_amount;
short over_shoulder_on, fist_incs;
short cheat_phase;
short extra_extra8, quick_kick, last_quick_kick;
short heat_amount, timebeforeexit, customexitsound;
short weaprecs[256], weapreccnt;
unsigned int interface_toggle_flag;
short dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang
short scuba_amount, jetpack_amount, steroids_amount, shield_amount;
short pycount, frag_ps;
short transporter_hold, last_full_weapon, footprintshade, boot_amount;
uint8_t on_warping_sector, footprintcount;
uint8_t hbomb_on, jumping_toggle, rapid_fire_hold, on_ground;
char name[32];
uint8_t inven_icon, buttonpalette;
uint8_t jetpack_on, spritebridge, lastrandomspot;
uint8_t scuba_on, footprintpal, heat_on;
uint8_t holster_weapon;
uint8_t falling_counter;
uint8_t refresh_inventory;
uint8_t toggle_key_flag, knuckle_incs; // ,select_dir;
uint8_t walking_snd_toggle, palookup;
bool quick_kick_msg;
int max_secret_rooms, secret_rooms, max_actors_killed, actors_killed;
bool resurrected;
// Redneck Rampage additions. Those which did not have names in the reconstructed source got one from either RedneckGDX or RedNukem.
// Items were reordered by size.
int stairs;
int detonate_count; // at57e
vec2_t noise;
int noise_radius; // at286, at28a, at290
int drink_timer; // at58e
int eat_timer; // at592
int SlotWin;
short recoil;
short detonate_time; // at57c
short yehaa_timer;
short drink_amt, eat, drunkang, eatang;
uint8_t shotgun_state[2];
uint8_t donoise; // at28e
uint8_t keys[5];
// RRRA. The same as for the RR block applies.
int drug_aspect;
int drug_timer;
int SeaSick;
short MamaEnd; // raat609
short moto_drink;
float TiltStatus, oTiltStatus;
double VBumpNow, VBumpTarget;
short TurbCount;
short drug_stat[3]; // raat5f1..5
uint8_t DrugMode, lotag800kill;
uint8_t sea_sick_stat; // raat5dd
uint8_t hurt_delay2, nocheat;
uint8_t OnMotorcycle, OnBoat, moto_underwater, NotOnWater, MotoOnGround;
uint8_t moto_do_bump, moto_bump_fast, moto_on_oil, moto_on_mud;
double vehForwardScale, vehReverseScale, MotoSpeed;
bool vehTurnLeft, vehTurnRight, vehBraking;
TArray<GameVarValue> uservars;
// input stuff.
InputPacket sync;
DDukeActor* GetActor();
int GetPlayerNum();
void apply_seasick(double factor);
void backuppos(bool noclipping = false);
void backupweapon();
void checkhardlanding();
void playerweaponsway(int xvel);
float adjustavel(float avel)
{
return (psectlotag == ST_2_UNDERWATER)? avel * 0.875f : avel;
}
void setCursector(sectortype* sect)
{
cursector = sect;
}
bool insector() const
{
return cursector != nullptr;
}
};
struct Cycler
{
sectortype* sector;
int16_t lotag;
int16_t hitag;
int16_t shade1;
int16_t shade2;
bool state;
};
struct DukeLevel
{
};
END_DUKE_NS