mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-31 13:10:39 +00:00
- handle u-> in zilla.cpp and zombie.cpp
This commit is contained in:
parent
936febd505
commit
2ef7fc9bc2
2 changed files with 51 additions and 73 deletions
|
@ -640,28 +640,22 @@ ACTOR_ACTION_SET ZillaActionSet =
|
|||
|
||||
int SetupZilla(DSWActor* actor)
|
||||
{
|
||||
USERp u;
|
||||
ANIMATOR DoActorDecide;
|
||||
|
||||
if (TEST(actor->spr.cstat, CSTAT_SPRITE_RESTORE))
|
||||
if (!TEST(actor->spr.cstat, CSTAT_SPRITE_RESTORE))
|
||||
{
|
||||
u = actor->u();
|
||||
ASSERT(u);
|
||||
}
|
||||
else
|
||||
{
|
||||
u = SpawnUser(actor, ZILLA_RUN_R0, s_ZillaRun[0]);
|
||||
u->Health = 6000;
|
||||
SpawnUser(actor, ZILLA_RUN_R0, s_ZillaRun[0]);
|
||||
actor->user.Health = 6000;
|
||||
}
|
||||
|
||||
if (Skill == 0) u->Health = 2000;
|
||||
if (Skill == 1) u->Health = 4000;
|
||||
if (Skill == 0) actor->user.Health = 2000;
|
||||
if (Skill == 1) actor->user.Health = 4000;
|
||||
|
||||
ChangeState(actor,s_ZillaRun[0]);
|
||||
u->Attrib = &ZillaAttrib;
|
||||
actor->user.Attrib = &ZillaAttrib;
|
||||
DoActorSetSpeed(actor, NORM_SPEED);
|
||||
u->StateEnd = s_ZillaDie;
|
||||
u->Rot = sg_ZillaRun;
|
||||
actor->user.StateEnd = s_ZillaDie;
|
||||
actor->user.Rot = sg_ZillaRun;
|
||||
|
||||
EnemyDefaults(actor, &ZillaActionSet, &ZillaPersonality);
|
||||
|
||||
|
@ -674,24 +668,22 @@ int SetupZilla(DSWActor* actor)
|
|||
|
||||
int NullZilla(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
|
||||
#if 0
|
||||
if (u->State == s_ZillaDie)
|
||||
if (actor->user.State == s_ZillaDie)
|
||||
{
|
||||
getzsofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.y, &u->hiz, &u->loz);
|
||||
u->lo_sectp = actor->spr.sector();
|
||||
u->hi_sectp = actor->spr.sector();
|
||||
actor->spr.z = u->loz;
|
||||
getzsofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.y, &actor->user.hiz, &actor->user.loz);
|
||||
actor->user.lo_sectp = actor->spr.sector();
|
||||
actor->user.hi_sectp = actor->spr.sector();
|
||||
actor->spr.z = actor->user.loz;
|
||||
}
|
||||
#endif
|
||||
|
||||
getzsofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, &u->hiz, &u->loz);
|
||||
u->lo_sectp = actor->spr.sector();
|
||||
u->hi_sectp = actor->spr.sector();
|
||||
u->lowActor = nullptr;
|
||||
u->highActor = nullptr;
|
||||
actor->spr.pos.Z = u->loz;
|
||||
getzsofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, &actor->user.hiz, &actor->user.loz);
|
||||
actor->user.lo_sectp = actor->spr.sector();
|
||||
actor->user.hi_sectp = actor->spr.sector();
|
||||
actor->user.lowActor = nullptr;
|
||||
actor->user.highActor = nullptr;
|
||||
actor->spr.pos.Z = actor->user.loz;
|
||||
|
||||
DoActorSectorDamage(actor);
|
||||
|
||||
|
@ -700,7 +692,6 @@ int NullZilla(DSWActor* actor)
|
|||
|
||||
int DoZillaMove(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
short choose;
|
||||
|
||||
// Random Zilla taunts
|
||||
|
@ -718,10 +709,10 @@ int DoZillaMove(DSWActor* actor)
|
|||
}
|
||||
|
||||
|
||||
if (u->track >= 0)
|
||||
if (actor->user.track >= 0)
|
||||
ActorFollowTrack(actor, ACTORMOVETICS);
|
||||
else
|
||||
(*u->ActorActionFunc)(actor);
|
||||
(*actor->user.ActorActionFunc)(actor);
|
||||
|
||||
KeepActorOnFloor(actor);
|
||||
|
||||
|
@ -742,13 +733,11 @@ int DoZillaStomp(DSWActor* actor)
|
|||
|
||||
int DoZillaDeathMelt(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
|
||||
if (RandomRange(1000) > 800)
|
||||
SpawnGrenadeExp(actor);
|
||||
|
||||
u->ID = ZILLA_RUN_R0;
|
||||
RESET(u->Flags, SPR_JUMPING|SPR_FALLING|SPR_MOVED);
|
||||
actor->user.ID = ZILLA_RUN_R0;
|
||||
RESET(actor->user.Flags, SPR_JUMPING|SPR_FALLING|SPR_MOVED);
|
||||
|
||||
//DoMatchEverything(nullptr, actor->spr.lotag, ON);
|
||||
if (!SW_SHAREWARE)
|
||||
|
@ -758,12 +747,12 @@ int DoZillaDeathMelt(DSWActor* actor)
|
|||
}
|
||||
|
||||
//KeepActorOnFloor(actor);
|
||||
getzsofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, &u->hiz, &u->loz);
|
||||
u->lo_sectp = actor->spr.sector();
|
||||
u->hi_sectp = actor->spr.sector();
|
||||
u->lowActor = nullptr;
|
||||
u->highActor = nullptr;
|
||||
actor->spr.pos.Z = u->loz;
|
||||
getzsofslopeptr(actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, &actor->user.hiz, &actor->user.loz);
|
||||
actor->user.lo_sectp = actor->spr.sector();
|
||||
actor->user.hi_sectp = actor->spr.sector();
|
||||
actor->user.lowActor = nullptr;
|
||||
actor->user.highActor = nullptr;
|
||||
actor->spr.pos.Z = actor->user.loz;
|
||||
|
||||
BossSpriteNum[2] = nullptr;
|
||||
return 0;
|
||||
|
|
|
@ -749,23 +749,22 @@ ACTOR_ACTION_SET ZombieActionSet =
|
|||
|
||||
int SetupZombie(DSWActor* actor)
|
||||
{
|
||||
USERp u = actor->u();
|
||||
ANIMATOR DoActorDecide;
|
||||
|
||||
u->Health = 100;
|
||||
u->StateEnd = &s_ZombiePain[0][0];
|
||||
u->Rot = sg_ZombieRun;
|
||||
actor->user.Health = 100;
|
||||
actor->user.StateEnd = &s_ZombiePain[0][0];
|
||||
actor->user.Rot = sg_ZombieRun;
|
||||
actor->spr.xrepeat = PLAYER_NINJA_XREPEAT;
|
||||
actor->spr.yrepeat = PLAYER_NINJA_YREPEAT;
|
||||
|
||||
u->Attrib = &ZombieAttrib;
|
||||
actor->user.Attrib = &ZombieAttrib;
|
||||
EnemyDefaults(actor, &ZombieActionSet, &ZombiePersonality);
|
||||
|
||||
ChangeState(actor, s_ZombieRun[0]);
|
||||
DoActorSetSpeed(actor, NORM_SPEED);
|
||||
|
||||
u->Radius = 280;
|
||||
SET(u->Flags, SPR_XFLIP_TOGGLE);
|
||||
actor->user.Radius = 280;
|
||||
SET(actor->user.Flags, SPR_XFLIP_TOGGLE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -773,7 +772,6 @@ int SetupZombie(DSWActor* actor)
|
|||
void SpawnZombie(PLAYERp pp, DSWActor* weaponActor)
|
||||
{
|
||||
SPRITEp np;
|
||||
USERp nu;
|
||||
|
||||
auto ownerActor = GetOwner(weaponActor);
|
||||
|
||||
|
@ -781,7 +779,6 @@ void SpawnZombie(PLAYERp pp, DSWActor* weaponActor)
|
|||
return;
|
||||
|
||||
auto actorNew = SpawnActor(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursector, pp->pos.X, pp->pos.Y, pp->pos.Z, pp->angle.ang.asbuild(), 0);
|
||||
nu = actorNew->u();
|
||||
actorNew->spr.setsector(pp->cursector);
|
||||
SetOwner(actorNew, ownerActor);
|
||||
actorNew->spr.pal = actorNew->user.spal = ownerActor->user.spal;
|
||||
|
@ -806,7 +803,6 @@ void SpawnZombie(PLAYERp pp, DSWActor* weaponActor)
|
|||
void SpawnZombie2(DSWActor* actor)
|
||||
{
|
||||
SPRITEp np;
|
||||
USERp nu;
|
||||
auto sectu = actor->spr.sector();
|
||||
SECTORp sectp = actor->spr.sector();
|
||||
|
||||
|
@ -831,7 +827,6 @@ void SpawnZombie2(DSWActor* actor)
|
|||
|
||||
|
||||
auto actorNew = SpawnActor(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->spr.ang, 0);
|
||||
nu = actorNew->u();
|
||||
actorNew->user.Counter3 = 0;
|
||||
SetOwner(ownerActor, actorNew);
|
||||
actorNew->spr.pal = actorNew->user.spal = ownerActor->user.spal;
|
||||
|
@ -855,9 +850,7 @@ void SpawnZombie2(DSWActor* actor)
|
|||
|
||||
int DoZombieMove(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
|
||||
if (u->Counter3++ >= ZOMBIE_TIME_LIMIT)
|
||||
if (actor->user.Counter3++ >= ZOMBIE_TIME_LIMIT)
|
||||
{
|
||||
InitBloodSpray(actor,true,105);
|
||||
InitBloodSpray(actor,true,105);
|
||||
|
@ -866,7 +859,7 @@ int DoZombieMove(DSWActor* actor)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DSWActor* tActor = u->targetActor;
|
||||
DSWActor* tActor = actor->user.targetActor;
|
||||
if (tActor && tActor->hasU())
|
||||
{
|
||||
if (TEST(tActor->user.Flags, PF_DEAD))
|
||||
|
@ -874,28 +867,28 @@ int DoZombieMove(DSWActor* actor)
|
|||
}
|
||||
|
||||
// jumping and falling
|
||||
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
|
||||
if (TEST(actor->user.Flags, SPR_JUMPING | SPR_FALLING))
|
||||
{
|
||||
if (TEST(u->Flags, SPR_JUMPING))
|
||||
if (TEST(actor->user.Flags, SPR_JUMPING))
|
||||
DoActorJump(actor);
|
||||
else if (TEST(u->Flags, SPR_FALLING))
|
||||
else if (TEST(actor->user.Flags, SPR_FALLING))
|
||||
DoActorFall(actor);
|
||||
}
|
||||
|
||||
// sliding
|
||||
if (TEST(u->Flags, SPR_SLIDING))
|
||||
if (TEST(actor->user.Flags, SPR_SLIDING))
|
||||
DoActorSlide(actor);
|
||||
|
||||
// Do track or call current action function - such as DoActorMoveCloser()
|
||||
if (u->track >= 0)
|
||||
if (actor->user.track >= 0)
|
||||
ActorFollowTrack(actor, ACTORMOVETICS);
|
||||
else
|
||||
{
|
||||
(*u->ActorActionFunc)(actor);
|
||||
(*actor->user.ActorActionFunc)(actor);
|
||||
}
|
||||
|
||||
// stay on floor unless doing certain things
|
||||
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
|
||||
if (!TEST(actor->user.Flags, SPR_JUMPING | SPR_FALLING))
|
||||
{
|
||||
KeepActorOnFloor(actor);
|
||||
}
|
||||
|
@ -908,9 +901,7 @@ int DoZombieMove(DSWActor* actor)
|
|||
|
||||
int NullZombie(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
|
||||
if (u->Counter3++ >= ZOMBIE_TIME_LIMIT)
|
||||
if (actor->user.Counter3++ >= ZOMBIE_TIME_LIMIT)
|
||||
{
|
||||
InitBloodSpray(actor,true,105);
|
||||
InitBloodSpray(actor,true,105);
|
||||
|
@ -919,20 +910,20 @@ int NullZombie(DSWActor* actor)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DSWActor* tActor = u->targetActor;
|
||||
DSWActor* tActor = actor->user.targetActor;
|
||||
if (tActor && tActor->hasU())
|
||||
{
|
||||
if (TEST(tActor->user.Flags, PF_DEAD))
|
||||
DoActorPickClosePlayer(actor);
|
||||
}
|
||||
|
||||
if (u->WaitTics > 0)
|
||||
u->WaitTics -= ACTORMOVETICS;
|
||||
if (actor->user.WaitTics > 0)
|
||||
actor->user.WaitTics -= ACTORMOVETICS;
|
||||
|
||||
if (TEST(u->Flags, SPR_SLIDING) && !TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
|
||||
if (TEST(actor->user.Flags, SPR_SLIDING) && !TEST(actor->user.Flags, SPR_JUMPING|SPR_FALLING))
|
||||
DoActorSlide(actor);
|
||||
|
||||
if (!TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
|
||||
if (!TEST(actor->user.Flags, SPR_JUMPING|SPR_FALLING))
|
||||
KeepActorOnFloor(actor);
|
||||
|
||||
DoActorSectorDamage(actor);
|
||||
|
@ -943,11 +934,9 @@ int NullZombie(DSWActor* actor)
|
|||
|
||||
int DoZombiePain(DSWActor* actor)
|
||||
{
|
||||
USER* u = actor->u();
|
||||
|
||||
NullZombie(actor);
|
||||
|
||||
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
|
||||
if ((actor->user.WaitTics -= ACTORMOVETICS) <= 0)
|
||||
InitActorDecide(actor);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue