mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-09 15:31:03 +00:00
- refactored Anubis.
This now stores its data in the actor, not a static array.
This commit is contained in:
parent
fa8edc7493
commit
0ac449ab95
8 changed files with 113 additions and 118 deletions
|
@ -51,8 +51,7 @@ int BuildSplash(int nSprite, int nSector);
|
||||||
|
|
||||||
// anubis
|
// anubis
|
||||||
|
|
||||||
void InitAnubis();
|
void BuildAnubis(DExhumedActor* nSprite, int x, int y, int z, int nSector, int nAngle, uint8_t bIsDrummer);
|
||||||
void BuildAnubis(int nSprite, int x, int y, int z, int nSector, int nAngle, uint8_t bIsDrummer);
|
|
||||||
void FuncAnubis(int, int a, int b, int c);
|
void FuncAnubis(int, int a, int b, int c);
|
||||||
|
|
||||||
// bubbles
|
// bubbles
|
||||||
|
@ -93,6 +92,14 @@ void DestroyBullet(short nRun);
|
||||||
int MoveBullet(short nBullet);
|
int MoveBullet(short nBullet);
|
||||||
void SetBulletEnemy(short nBullet, short nEnemy);
|
void SetBulletEnemy(short nBullet, short nEnemy);
|
||||||
int BuildBullet(short nSprite, int nType, int ebx, int ecx, int val1, int nAngle, int val2, int val3);
|
int BuildBullet(short nSprite, int nType, int ebx, int ecx, int val1, int nAngle, int val2, int val3);
|
||||||
|
inline DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int val1, int nAngle, DExhumedActor* pTarget, int val3)
|
||||||
|
{
|
||||||
|
int v = BuildBullet(pActor->GetSpriteIndex(), nType, 0, 0, val1, nAngle, pTarget->GetSpriteIndex() + 10000, val3);
|
||||||
|
if (v < 0) return nullptr;
|
||||||
|
auto a = &exhumedActors[v & 0xffff];
|
||||||
|
a->nPhase = (v >> 16);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
void IgniteSprite(int nSprite);
|
void IgniteSprite(int nSprite);
|
||||||
void FuncBullet(int, int, int, int);
|
void FuncBullet(int, int, int, int);
|
||||||
void BackUpBullet(int *x, int *y, short nAngle);
|
void BackUpBullet(int *x, int *y, short nAngle);
|
||||||
|
|
|
@ -25,20 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_PS_NS
|
BEGIN_PS_NS
|
||||||
|
|
||||||
struct Anubis
|
static const actionSeq AnubisSeq[] = {
|
||||||
{
|
|
||||||
short nHealth;
|
|
||||||
short nFrame;
|
|
||||||
short nAction;
|
|
||||||
short nSprite;
|
|
||||||
short nTarget;
|
|
||||||
short nCount;
|
|
||||||
};
|
|
||||||
|
|
||||||
static TArray<Anubis> AnubisList;
|
|
||||||
static int nAnubisDrum = 0;
|
|
||||||
|
|
||||||
static actionSeq AnubisSeq[] = {
|
|
||||||
{ 0, 0 },
|
{ 0, 0 },
|
||||||
{ 8, 0 },
|
{ 8, 0 },
|
||||||
{ 16, 0 },
|
{ 16, 0 },
|
||||||
|
@ -56,48 +43,18 @@ static actionSeq AnubisSeq[] = {
|
||||||
{ 43, 1 },
|
{ 43, 1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
FSerializer& Serialize(FSerializer& arc, const char* keyname, Anubis& w, Anubis* def)
|
void BuildAnubis(DExhumedActor* ap, int x, int y, int z, int nSector, int nAngle, uint8_t bIsDrummer)
|
||||||
{
|
{
|
||||||
if (arc.BeginObject(keyname))
|
|
||||||
{
|
|
||||||
arc("health", w.nHealth)
|
|
||||||
("frame", w.nFrame)
|
|
||||||
("action", w.nAction)
|
|
||||||
("sprite", w.nSprite)
|
|
||||||
("target", w.nTarget)
|
|
||||||
("count", w.nCount)
|
|
||||||
.EndObject();
|
|
||||||
}
|
|
||||||
return arc;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SerializeAnubis(FSerializer& arc)
|
|
||||||
{
|
|
||||||
arc("anubis", AnubisList)
|
|
||||||
("anubisdrum", nAnubisDrum);
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitAnubis()
|
|
||||||
{
|
|
||||||
AnubisList.Clear();
|
|
||||||
nAnubisDrum = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildAnubis(int nSprite, int x, int y, int z, int nSector, int nAngle, uint8_t bIsDrummer)
|
|
||||||
{
|
|
||||||
auto nAnubis = AnubisList.Reserve(1);
|
|
||||||
auto ap = &AnubisList[nAnubis];
|
|
||||||
|
|
||||||
spritetype* sp;
|
spritetype* sp;
|
||||||
if (nSprite == -1)
|
if (ap == nullptr)
|
||||||
{
|
{
|
||||||
nSprite = insertsprite(nSector, 101);
|
ap = insertActor(nSector, 101);
|
||||||
sp = &sprite[nSprite];
|
sp = &ap->s();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
changespritestat(nSprite, 101);
|
ChangeActorStat(ap, 101);
|
||||||
sp = &sprite[nSprite];
|
sp = &ap->s();
|
||||||
|
|
||||||
x = sp->x;
|
x = sp->x;
|
||||||
y = sp->y;
|
y = sp->y;
|
||||||
|
@ -105,8 +62,6 @@ void BuildAnubis(int nSprite, int x, int y, int z, int nSector, int nAngle, uint
|
||||||
nAngle = sp->ang;
|
nAngle = sp->ang;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(nSprite >=0 && nSprite < kMaxSprites);
|
|
||||||
|
|
||||||
sp->x = x;
|
sp->x = x;
|
||||||
sp->y = y;
|
sp->y = y;
|
||||||
sp->z = z;
|
sp->z = z;
|
||||||
|
@ -131,6 +86,7 @@ void BuildAnubis(int nSprite, int x, int y, int z, int nSector, int nAngle, uint
|
||||||
|
|
||||||
if (bIsDrummer)
|
if (bIsDrummer)
|
||||||
{
|
{
|
||||||
|
auto& nAnubisDrum = Counters[kCountAnubisDrum];
|
||||||
ap->nAction = nAnubisDrum + 6;
|
ap->nAction = nAnubisDrum + 6;
|
||||||
nAnubisDrum++;
|
nAnubisDrum++;
|
||||||
|
|
||||||
|
@ -143,35 +99,33 @@ void BuildAnubis(int nSprite, int x, int y, int z, int nSector, int nAngle, uint
|
||||||
ap->nAction = 0;
|
ap->nAction = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ap->nPhase = Counters[kCountAnubis]++;
|
||||||
ap->nHealth = 540;
|
ap->nHealth = 540;
|
||||||
ap->nFrame = 0;
|
ap->nFrame = 0;
|
||||||
ap->nSprite = nSprite;
|
ap->pTarget = nullptr;
|
||||||
ap->nTarget = -1;
|
|
||||||
ap->nCount = 0;
|
ap->nCount = 0;
|
||||||
|
|
||||||
sp->owner = runlist_AddRunRec(sp->lotag - 1, nAnubis, 0x90000);
|
sp->owner = runlist_AddRunRec(sp->lotag - 1, ap, 0x90000);
|
||||||
|
|
||||||
runlist_AddRunRec(NewRun, nAnubis, 0x90000);
|
runlist_AddRunRec(NewRun, ap, 0x90000);
|
||||||
nCreaturesTotal++;
|
nCreaturesTotal++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AIAnubis::Tick(RunListEvent* ev)
|
void AIAnubis::Tick(RunListEvent* ev)
|
||||||
{
|
{
|
||||||
int nAnubis = RunData[ev->nRun].nObjIndex;
|
auto ap = ev->pObjActor;
|
||||||
auto ap = &AnubisList[nAnubis];
|
auto sp = &ap->s();
|
||||||
int nSprite = ap->nSprite;
|
|
||||||
auto sp = &sprite[nSprite];
|
|
||||||
int nAction = ap->nAction;
|
int nAction = ap->nAction;
|
||||||
|
|
||||||
bool bVal = false;
|
bool bVal = false;
|
||||||
|
|
||||||
if (nAction < 11) {
|
if (nAction < 11) {
|
||||||
Gravity(nSprite);
|
Gravity(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
short nSeq = SeqOffsets[kSeqAnubis] + AnubisSeq[nAction].a;
|
short nSeq = SeqOffsets[kSeqAnubis] + AnubisSeq[nAction].a;
|
||||||
|
|
||||||
seq_MoveSequence(nSprite, nSeq, ap->nFrame);
|
seq_MoveSequence(ap, nSeq, ap->nFrame);
|
||||||
|
|
||||||
sp->picnum = seq_GetSeqPicnum2(nSeq, ap->nFrame);
|
sp->picnum = seq_GetSeqPicnum2(nSeq, ap->nFrame);
|
||||||
|
|
||||||
|
@ -182,34 +136,33 @@ void AIAnubis::Tick(RunListEvent* ev)
|
||||||
bVal = true;
|
bVal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
short nTarget = ap->nTarget;
|
auto pTarget = ap->pTarget;
|
||||||
auto pTarget = nTarget < 0 ? nullptr : &sprite[nTarget];
|
|
||||||
|
|
||||||
short nFrame = SeqBase[nSeq] + ap->nFrame;
|
short nFrame = SeqBase[nSeq] + ap->nFrame;
|
||||||
short nFlag = FrameFlag[nFrame];
|
short nFlag = FrameFlag[nFrame];
|
||||||
|
|
||||||
int nMov = 0;
|
Collision move(0);
|
||||||
|
|
||||||
if (nAction > 0 && nAction < 11) {
|
if (nAction > 0 && nAction < 11) {
|
||||||
nMov = MoveCreatureWithCaution(nSprite);
|
move = MoveCreatureWithCaution(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (nAction)
|
switch (nAction)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((nAnubis & 0x1F) == (totalmoves & 0x1F))
|
if ((ap->nPhase & 0x1F) == (totalmoves & 0x1F))
|
||||||
{
|
{
|
||||||
if (nTarget < 0) {
|
if (pTarget == nullptr) {
|
||||||
nTarget = FindPlayer(nSprite, 100);
|
pTarget = FindPlayer(ap, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nTarget >= 0)
|
if (pTarget)
|
||||||
{
|
{
|
||||||
D3PlayFX(StaticSound[kSound8], nSprite);
|
D3PlayFX(StaticSound[kSound8], ap);
|
||||||
ap->nAction = 1;
|
ap->nAction = 1;
|
||||||
ap->nFrame = 0;
|
ap->nFrame = 0;
|
||||||
ap->nTarget = nTarget;
|
ap->pTarget = pTarget;
|
||||||
|
|
||||||
sp->xvel = bcos(sp->ang, -2);
|
sp->xvel = bcos(sp->ang, -2);
|
||||||
sp->yvel = bsin(sp->ang, -2);
|
sp->yvel = bsin(sp->ang, -2);
|
||||||
|
@ -219,22 +172,22 @@ void AIAnubis::Tick(RunListEvent* ev)
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if ((nAnubis & 0x1F) == (totalmoves & 0x1F))
|
if ((ap->nPhase & 0x1F) == (totalmoves & 0x1F) && pTarget)
|
||||||
{
|
{
|
||||||
PlotCourseToSprite(nSprite, nTarget);
|
PlotCourseToSprite(ap, pTarget);
|
||||||
|
|
||||||
int nAngle = sp->ang & 0xFFF8;
|
int nAngle = sp->ang & 0xFFF8;
|
||||||
sp->xvel = bcos(nAngle, -2);
|
sp->xvel = bcos(nAngle, -2);
|
||||||
sp->yvel = bsin(nAngle, -2);
|
sp->yvel = bsin(nAngle, -2);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (nMov & 0xC000)
|
switch (move.type)
|
||||||
{
|
{
|
||||||
case 0xC000:
|
case kHitSprite:
|
||||||
{
|
{
|
||||||
if ((nMov & 0x3FFF) == nTarget)
|
if (move.actor == pTarget)
|
||||||
{
|
{
|
||||||
int nAng = getangle(pTarget->x - sp->x, pTarget->y - sp->y);
|
int nAng = getangle(pTarget->s().x - sp->x, pTarget->s().y - sp->y);
|
||||||
int nAngDiff = AngleDiff(sp->ang, nAng);
|
int nAngDiff = AngleDiff(sp->ang, nAng);
|
||||||
|
|
||||||
if (nAngDiff < 64)
|
if (nAngDiff < 64)
|
||||||
|
@ -245,9 +198,9 @@ void AIAnubis::Tick(RunListEvent* ev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// else we fall through to 0x8000
|
// else we fall through to 0x8000
|
||||||
fallthrough__;
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
case 0x8000:
|
case kHitWall:
|
||||||
{
|
{
|
||||||
sp->ang = (sp->ang + 256) & kAngleMask;
|
sp->ang = (sp->ang + 256) & kAngleMask;
|
||||||
sp->xvel = bcos(sp->ang, -2);
|
sp->xvel = bcos(sp->ang, -2);
|
||||||
|
@ -265,14 +218,14 @@ void AIAnubis::Tick(RunListEvent* ev)
|
||||||
{
|
{
|
||||||
ap->nCount = 60;
|
ap->nCount = 60;
|
||||||
|
|
||||||
if (nTarget > -1) // NOTE: nTarget can be -1. this check wasn't in original code. TODO: demo compatiblity?
|
if (pTarget != nullptr) // NOTE: nTarget can be -1. this check wasn't in original code. TODO: demo compatiblity?
|
||||||
{
|
{
|
||||||
if (cansee(sp->x, sp->y, sp->z - GetSpriteHeight(nSprite), sp->sectnum,
|
if (cansee(sp->x, sp->y, sp->z - GetActorHeight(ap), sp->sectnum,
|
||||||
pTarget->x, pTarget->y, pTarget->z - GetSpriteHeight(nTarget), pTarget->sectnum))
|
pTarget->s().x, pTarget->s().y, pTarget->s().z - GetActorHeight(pTarget), pTarget->s().sectnum))
|
||||||
{
|
{
|
||||||
sp->xvel = 0;
|
sp->xvel = 0;
|
||||||
sp->yvel = 0;
|
sp->yvel = 0;
|
||||||
sp->ang = GetMyAngle(pTarget->x - sp->x, pTarget->y - sp->y);
|
sp->ang = GetMyAngle(pTarget->s().x - sp->x, pTarget->s().y - sp->y);
|
||||||
|
|
||||||
ap->nAction = 3;
|
ap->nAction = 3;
|
||||||
ap->nFrame = 0;
|
ap->nFrame = 0;
|
||||||
|
@ -286,14 +239,14 @@ void AIAnubis::Tick(RunListEvent* ev)
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
if (nTarget == -1)
|
if (pTarget == nullptr)
|
||||||
{
|
{
|
||||||
ap->nAction = 0;
|
ap->nAction = 0;
|
||||||
ap->nCount = 50;
|
ap->nCount = 50;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (PlotCourseToSprite(nSprite, nTarget) >= 768)
|
if (PlotCourseToSprite(ap, pTarget) >= 768)
|
||||||
{
|
{
|
||||||
ap->nAction = 1;
|
ap->nAction = 1;
|
||||||
}
|
}
|
||||||
|
@ -301,7 +254,7 @@ void AIAnubis::Tick(RunListEvent* ev)
|
||||||
{
|
{
|
||||||
if (nFlag & 0x80)
|
if (nFlag & 0x80)
|
||||||
{
|
{
|
||||||
runlist_DamageEnemy(nTarget, nSprite, 7);
|
runlist_DamageEnemy(pTarget, ap, 7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,7 +276,7 @@ void AIAnubis::Tick(RunListEvent* ev)
|
||||||
// loc_25718:
|
// loc_25718:
|
||||||
if (nFlag & 0x80)
|
if (nFlag & 0x80)
|
||||||
{
|
{
|
||||||
BuildBullet(nSprite, 8, 0, 0, -1, sp->ang, nTarget + 10000, 1);
|
BuildBullet(ap, 8, -1, sp->ang, pTarget, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,44 +333,45 @@ void AIAnubis::Tick(RunListEvent* ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
// loc_2564C:
|
// loc_2564C:
|
||||||
if (nAction && nTarget != -1)
|
if (nAction && pTarget != nullptr)
|
||||||
{
|
{
|
||||||
if (!(pTarget->cstat & 0x101))
|
if (!(pTarget->s().cstat & 0x101))
|
||||||
{
|
{
|
||||||
ap->nAction = 0;
|
ap->nAction = 0;
|
||||||
ap->nFrame = 0;
|
ap->nFrame = 0;
|
||||||
ap->nCount = 100;
|
ap->nCount = 100;
|
||||||
ap->nTarget = -1;
|
ap->pTarget = nullptr;
|
||||||
|
|
||||||
sp->xvel = 0;
|
sp->xvel = 0;
|
||||||
sp->yvel = 0;
|
sp->yvel = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AIAnubis::Draw(RunListEvent* ev)
|
void AIAnubis::Draw(RunListEvent* ev)
|
||||||
{
|
{
|
||||||
auto ap = &AnubisList[RunData[ev->nRun].nObjIndex];
|
auto ap = ev->pObjActor;
|
||||||
|
if (!ap) return;
|
||||||
|
|
||||||
seq_PlotSequence(ev->nParam, SeqOffsets[kSeqAnubis] + AnubisSeq[ap->nAction].a, ap->nFrame, AnubisSeq[ap->nAction].b);
|
seq_PlotSequence(ev->nParam, SeqOffsets[kSeqAnubis] + AnubisSeq[ap->nAction].a, ap->nFrame, AnubisSeq[ap->nAction].b);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AIAnubis::RadialDamage(RunListEvent* ev)
|
void AIAnubis::RadialDamage(RunListEvent* ev)
|
||||||
{
|
{
|
||||||
auto ap = &AnubisList[RunData[ev->nRun].nObjIndex];
|
auto ap = ev->pObjActor;
|
||||||
|
if (!ap) return;
|
||||||
if (ap->nAction < 11)
|
if (ap->nAction < 11)
|
||||||
{
|
{
|
||||||
ev->nDamage = runlist_CheckRadialDamage(ap->nSprite);
|
ev->nDamage = runlist_CheckRadialDamage(ap);
|
||||||
Damage(ev);
|
Damage(ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AIAnubis::Damage(RunListEvent* ev)
|
void AIAnubis::Damage(RunListEvent* ev)
|
||||||
{
|
{
|
||||||
auto ap = &AnubisList[RunData[ev->nRun].nObjIndex];
|
auto ap = ev->pObjActor;
|
||||||
int nSprite = ap->nSprite;
|
if (!ap) return;
|
||||||
auto sp = &sprite[nSprite];
|
auto sp = &ap->s();
|
||||||
int nAction = ap->nAction;
|
int nAction = ap->nAction;
|
||||||
int nDamage = ev->nDamage;
|
int nDamage = ev->nDamage;
|
||||||
|
|
||||||
|
@ -430,18 +384,16 @@ void AIAnubis::Damage(RunListEvent* ev)
|
||||||
|
|
||||||
if (ap->nHealth > 0)
|
if (ap->nHealth > 0)
|
||||||
{
|
{
|
||||||
int nTarget = ev->nParam;
|
|
||||||
|
|
||||||
// loc_258D6:
|
// loc_258D6:
|
||||||
if (nTarget < 0) {
|
if (ev->pOtherActor == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto pTarget = &sprite[nTarget];
|
auto pTarget = &ev->pOtherActor->s();
|
||||||
|
|
||||||
if (pTarget->statnum == 100 || pTarget->statnum < 199)
|
if (pTarget->statnum == 100 || pTarget->statnum < 199)
|
||||||
{
|
{
|
||||||
if (!RandomSize(5)) {
|
if (!RandomSize(5)) {
|
||||||
ap->nTarget = nTarget;
|
ap->pTarget = ev->pOtherActor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,8 +401,8 @@ void AIAnubis::Damage(RunListEvent* ev)
|
||||||
{
|
{
|
||||||
if (nAction >= 6 && nAction <= 10)
|
if (nAction >= 6 && nAction <= 10)
|
||||||
{
|
{
|
||||||
int nDrumSprite = insertsprite(sp->sectnum, kStatAnubisDrum);
|
auto pDrumActor = insertActor(sp->sectnum, kStatAnubisDrum);
|
||||||
auto pDrumSprite = &sprite[nDrumSprite];
|
auto pDrumSprite = &pDrumActor->s();
|
||||||
|
|
||||||
pDrumSprite->x = sp->x;
|
pDrumSprite->x = sp->x;
|
||||||
pDrumSprite->y = sp->y;
|
pDrumSprite->y = sp->y;
|
||||||
|
@ -459,16 +411,17 @@ void AIAnubis::Damage(RunListEvent* ev)
|
||||||
pDrumSprite->yrepeat = 40;
|
pDrumSprite->yrepeat = 40;
|
||||||
pDrumSprite->shade = -64;
|
pDrumSprite->shade = -64;
|
||||||
|
|
||||||
BuildObject(nDrumSprite, 2, 0);
|
BuildObject(pDrumActor->GetSpriteIndex(), 2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ap->pTarget = ev->pOtherActor;
|
||||||
ap->nAction = 4;
|
ap->nAction = 4;
|
||||||
ap->nFrame = 0;
|
ap->nFrame = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// loc_259B5:
|
// loc_259B5:
|
||||||
D3PlayFX(StaticSound[kSound39], nSprite);
|
D3PlayFX(StaticSound[kSound39], ap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -486,7 +439,7 @@ void AIAnubis::Damage(RunListEvent* ev)
|
||||||
|
|
||||||
if (nAction < 11)
|
if (nAction < 11)
|
||||||
{
|
{
|
||||||
DropMagic(nSprite);
|
DropMagic(ap);
|
||||||
ap->nAction = (ev->nMessage == EMessageType::RadialDamage) + 11;
|
ap->nAction = (ev->nMessage == EMessageType::RadialDamage) + 11;
|
||||||
ap->nFrame = 0;
|
ap->nFrame = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,16 @@ extern int movefifoend;
|
||||||
extern int movefifopos;
|
extern int movefifopos;
|
||||||
extern short nCurBodyGunNum;
|
extern short nCurBodyGunNum;
|
||||||
|
|
||||||
|
// all static counters combined in an array for easier maintenance.
|
||||||
|
enum ECounter
|
||||||
|
{
|
||||||
|
kCountAnubis,
|
||||||
|
kCountAnubisDrum,
|
||||||
|
|
||||||
|
kNumCounters
|
||||||
|
};
|
||||||
|
extern int Counters[kNumCounters];
|
||||||
|
|
||||||
void SnapSectors(short nSectorA, short nSectorB, short b);
|
void SnapSectors(short nSectorA, short nSectorB, short b);
|
||||||
|
|
||||||
extern short SectSound[];
|
extern short SectSound[];
|
||||||
|
|
|
@ -596,6 +596,21 @@ extern uint8_t* Worktile;
|
||||||
extern int lHeadStartClock;
|
extern int lHeadStartClock;
|
||||||
extern short* pPupData;
|
extern short* pPupData;
|
||||||
|
|
||||||
|
FSerializer& Serialize(FSerializer& arc, const char* keyname, DExhumedActor& w, DExhumedActor* def)
|
||||||
|
{
|
||||||
|
if (arc.BeginObject(keyname))
|
||||||
|
{
|
||||||
|
arc("phase", w.nPhase)
|
||||||
|
("health", w.nHealth)
|
||||||
|
("frame", w.nFrame)
|
||||||
|
("action", w.nAction)
|
||||||
|
("target", w.pTarget)
|
||||||
|
("count", w.nCount)
|
||||||
|
.EndObject();
|
||||||
|
}
|
||||||
|
return arc;
|
||||||
|
}
|
||||||
|
|
||||||
void SerializeState(FSerializer& arc)
|
void SerializeState(FSerializer& arc)
|
||||||
{
|
{
|
||||||
int loaded = 0;
|
int loaded = 0;
|
||||||
|
|
|
@ -85,6 +85,14 @@ class DExhumedActor
|
||||||
DExhumedActor* base();
|
DExhumedActor* base();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
DExhumedActor* pTarget;
|
||||||
|
|
||||||
|
short nPhase;
|
||||||
|
|
||||||
|
short nHealth;
|
||||||
|
short nFrame;
|
||||||
|
short nAction;
|
||||||
|
short nCount;
|
||||||
|
|
||||||
DExhumedActor() :index(int(this - base())) {}
|
DExhumedActor() :index(int(this - base())) {}
|
||||||
DExhumedActor& operator=(const DExhumedActor& other) = default;
|
DExhumedActor& operator=(const DExhumedActor& other) = default;
|
||||||
|
|
|
@ -60,6 +60,8 @@ short SectDamage[kMaxSectors] = { 0 };
|
||||||
short SectSpeed[kMaxSectors] = { 0 };
|
short SectSpeed[kMaxSectors] = { 0 };
|
||||||
int SectBelow[kMaxSectors] = { 0 };
|
int SectBelow[kMaxSectors] = { 0 };
|
||||||
|
|
||||||
|
int Counters[kNumCounters];
|
||||||
|
|
||||||
|
|
||||||
uint8_t bIsVersion6 = true;
|
uint8_t bIsVersion6 = true;
|
||||||
|
|
||||||
|
@ -88,6 +90,7 @@ uint8_t LoadLevel(MapRecord* map)
|
||||||
nFreeze = 0;
|
nFreeze = 0;
|
||||||
nSpiritSprite = -1;
|
nSpiritSprite = -1;
|
||||||
PlayClock = 0;
|
PlayClock = 0;
|
||||||
|
memset(Counters, 0, sizeof(Counters));
|
||||||
|
|
||||||
InitLion();
|
InitLion();
|
||||||
InitRexs();
|
InitRexs();
|
||||||
|
@ -108,7 +111,6 @@ uint8_t LoadLevel(MapRecord* map)
|
||||||
InitObjects();
|
InitObjects();
|
||||||
InitLava();
|
InitLava();
|
||||||
InitPushBlocks();
|
InitPushBlocks();
|
||||||
InitAnubis();
|
|
||||||
InitSpider();
|
InitSpider();
|
||||||
InitMummy();
|
InitMummy();
|
||||||
InitScorp();
|
InitScorp();
|
||||||
|
@ -331,7 +333,8 @@ void InitSectFlag()
|
||||||
|
|
||||||
void ProcessSpriteTag(short nSprite, short nLotag, short nHitag)
|
void ProcessSpriteTag(short nSprite, short nLotag, short nHitag)
|
||||||
{
|
{
|
||||||
auto pSprite = &sprite[nSprite];
|
auto pActor = &exhumedActors[nSprite];
|
||||||
|
auto pSprite = &pActor->s();
|
||||||
int nChannel = runlist_AllocChannel(nHitag % 1000);
|
int nChannel = runlist_AllocChannel(nHitag % 1000);
|
||||||
|
|
||||||
int nSpeed = nLotag / 1000;
|
int nSpeed = nLotag / 1000;
|
||||||
|
@ -506,7 +509,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildAnubis(nSprite, 0, 0, 0, 0, 0, 1);
|
BuildAnubis(pActor, 0, 0, 0, 0, 0, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 117:
|
case 117:
|
||||||
|
@ -636,7 +639,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildAnubis(nSprite, 0, 0, 0, 0, 0, 0);
|
BuildAnubis(pActor, 0, 0, 0, 0, 0, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 99: // underwater type 2
|
case 99: // underwater type 2
|
||||||
|
@ -926,6 +929,7 @@ void SerializeInit(FSerializer& arc)
|
||||||
.Array("sectdamage", SectDamage, numsectors)
|
.Array("sectdamage", SectDamage, numsectors)
|
||||||
.Array("sectspeed", SectSpeed, numsectors)
|
.Array("sectspeed", SectSpeed, numsectors)
|
||||||
.Array("sectbelow", SectBelow, numsectors)
|
.Array("sectbelow", SectBelow, numsectors)
|
||||||
|
.Array("counters", Counters, kNumCounters)
|
||||||
.EndObject();
|
.EndObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ static int osdcmd_spawn(CCmdFuncPtr parm)
|
||||||
if (parm->numparms != 1) return CCMD_SHOWHELP;
|
if (parm->numparms != 1) return CCMD_SHOWHELP;
|
||||||
auto c = parm->parms[0];
|
auto c = parm->parms[0];
|
||||||
|
|
||||||
if (!stricmp(c, "anubis")) BuildAnubis(-1, initx, inity, sector[initsect].floorz, initsect, inita, false);
|
if (!stricmp(c, "anubis")) BuildAnubis(nullptr, initx, inity, sector[initsect].floorz, initsect, inita, false);
|
||||||
else if (!stricmp(c, "spider")) BuildSpider(-1, initx, inity, sector[initsect].floorz, initsect, inita);
|
else if (!stricmp(c, "spider")) BuildSpider(-1, initx, inity, sector[initsect].floorz, initsect, inita);
|
||||||
else if (!stricmp(c, "mummy")) BuildMummy(-1, initx, inity, sector[initsect].floorz, initsect, inita);
|
else if (!stricmp(c, "mummy")) BuildMummy(-1, initx, inity, sector[initsect].floorz, initsect, inita);
|
||||||
else if (!stricmp(c, "fish")) BuildFish(-1, initx, inity, initz + eyelevel[nLocalPlayer], initsect, inita);
|
else if (!stricmp(c, "fish")) BuildFish(-1, initx, inity, initz + eyelevel[nLocalPlayer], initsect, inita);
|
||||||
|
|
|
@ -48,7 +48,6 @@ void SerializeSnake(FSerializer& arc);
|
||||||
void SerializeSwitch(FSerializer& arc);
|
void SerializeSwitch(FSerializer& arc);
|
||||||
void SerializeView(FSerializer& arc);
|
void SerializeView(FSerializer& arc);
|
||||||
|
|
||||||
void SerializeAnubis(FSerializer& arc);
|
|
||||||
void SerializeFish(FSerializer& arc);
|
void SerializeFish(FSerializer& arc);
|
||||||
void SerializeLavadude(FSerializer& arc);
|
void SerializeLavadude(FSerializer& arc);
|
||||||
void SerializeLion(FSerializer& arc);
|
void SerializeLion(FSerializer& arc);
|
||||||
|
@ -86,7 +85,6 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
||||||
SerializeSwitch(arc);
|
SerializeSwitch(arc);
|
||||||
SerializeView(arc);
|
SerializeView(arc);
|
||||||
|
|
||||||
SerializeAnubis(arc);
|
|
||||||
SerializeFish(arc);
|
SerializeFish(arc);
|
||||||
SerializeLavadude(arc);
|
SerializeLavadude(arc);
|
||||||
SerializeLion(arc);
|
SerializeLion(arc);
|
||||||
|
|
Loading…
Reference in a new issue