/
exhumedactor.h
90 lines (67 loc) · 2 KB
/
exhumedactor.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
#pragma once
#include "coreactor.h"
BEGIN_PS_NS
class DExhumedActor;
enum
{
kHitAuxMask = 0x30000,
kHitAux1 = 0x10000,
kHitAux2 = 0x20000,
};
class DExhumedActor : public DCoreActor
{
DExhumedActor* base();
public:
DExhumedActor* pTarget;
int16_t nPhase;
int16_t nHealth;
int16_t nFrame;
int16_t nAction;
int16_t nCount;
int16_t nRun;
union { int16_t nIndex; int16_t nAngle; }; // angle is for wasp.
union { int16_t nIndex2; int16_t nAngle2; }; // index2 is for scorpion, angle2 is for wasp.
union { int16_t nChannel; int16_t nVel; }; // channel is for scorpion, vel is for wasp.
union { int16_t nDamage; int16_t nAction2; }; // nAction2 is for the queen.
// for the grenade.
int nTurn;
int x;
int y;
DExhumedActor()
{
index = (int(this - base()));
}
DExhumedActor& operator=(const DExhumedActor& other) = default;
void Clear()
{
}
};
extern DExhumedActor exhumedActors[MAXSPRITES];
inline DExhumedActor* DExhumedActor::base() { return exhumedActors; }
// subclassed to add a game specific actor() method
using HitInfo = THitInfo<DExhumedActor>;
using Collision = TCollision<DExhumedActor>;
using ExhumedStatIterator = TStatIterator<DExhumedActor>;
using ExhumedSectIterator = TSectIterator<DExhumedActor>;
using ExhumedSpriteIterator = TSpriteIterator<DExhumedActor>;
using ExhumedLinearSpriteIterator = TLinearSpriteIterator<DExhumedActor>;
inline FSerializer& Serialize(FSerializer& arc, const char* keyname, DExhumedActor*& w, DExhumedActor** def)
{
int index = w? int(w - exhumedActors) : -1;
Serialize(arc, keyname, index, nullptr);
if (arc.isReading()) w = index == -1? nullptr : &exhumedActors[index];
return arc;
}
inline void ChangeActorStat(DExhumedActor* actor, int stat)
{
changespritestat(actor->GetSpriteIndex(), stat);
}
inline void ChangeActorSect(DExhumedActor* actor, sectortype* stat)
{
changespritesect(actor->GetSpriteIndex(), sector.IndexOf(stat));
}
inline void setActorPos(DExhumedActor* actor, vec3_t* pos)
{
setsprite(actor->GetSpriteIndex(), pos);
}
END_BLD_NS