mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
- Coolie ghost function interface.
This commit is contained in:
parent
119d4393db
commit
7fc9ad1edb
4 changed files with 47 additions and 53 deletions
|
@ -39,6 +39,8 @@ BEGIN_SW_NS
|
||||||
|
|
||||||
ANIMATOR DoCoolgCircle,InitCoolgCircle;
|
ANIMATOR DoCoolgCircle,InitCoolgCircle;
|
||||||
|
|
||||||
|
enum { COOLG_BOB_AMT = (Z(8)) };
|
||||||
|
|
||||||
DECISION CoolgBattle[] =
|
DECISION CoolgBattle[] =
|
||||||
{
|
{
|
||||||
{50, InitCoolgCircle },
|
{50, InitCoolgCircle },
|
||||||
|
@ -495,14 +497,12 @@ ACTOR_ACTION_SET CoolgActionSet =
|
||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
int DoCoolgMatchPlayerZ(short SpriteNum);
|
int DoCoolgMatchPlayerZ(DSWActor* actor);
|
||||||
|
|
||||||
void
|
void CoolgCommon(DSWActor* actor)
|
||||||
CoolgCommon(short SpriteNum)
|
|
||||||
{
|
{
|
||||||
auto actor = &swActors[SpriteNum];
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
USERp u = actor->u();
|
||||||
USERp u = User[SpriteNum].Data();
|
|
||||||
|
|
||||||
sp->clipdist = (200) >> 2;
|
sp->clipdist = (200) >> 2;
|
||||||
//u->floor_dist = Z(5);
|
//u->floor_dist = Z(5);
|
||||||
|
@ -516,24 +516,19 @@ CoolgCommon(short SpriteNum)
|
||||||
SET(sp->extra, SPRX_PLAYER_OR_ENEMY);
|
SET(sp->extra, SPRX_PLAYER_OR_ENEMY);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int SetupCoolg(DSWActor* actor)
|
||||||
SetupCoolg(short SpriteNum)
|
|
||||||
{
|
{
|
||||||
auto actor = &swActors[SpriteNum];
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
|
||||||
USERp u;
|
USERp u;
|
||||||
ANIMATOR DoActorDecide;
|
ANIMATOR DoActorDecide;
|
||||||
|
int SpriteNum = actor->GetSpriteIndex();
|
||||||
|
|
||||||
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
|
if (!TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
|
||||||
{
|
{
|
||||||
u = User[SpriteNum].Data();
|
u = SpawnUser(actor,COOLG_RUN_R0,s_CoolgRun[0]);
|
||||||
ASSERT(u);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
u = SpawnUser(SpriteNum,COOLG_RUN_R0,s_CoolgRun[0]);
|
|
||||||
u->Health = HEALTH_COOLIE_GHOST;
|
u->Health = HEALTH_COOLIE_GHOST;
|
||||||
}
|
}
|
||||||
|
u = actor->u();
|
||||||
|
|
||||||
ChangeState(SpriteNum, s_CoolgRun[0]);
|
ChangeState(SpriteNum, s_CoolgRun[0]);
|
||||||
u->Attrib = &CoolgAttrib;
|
u->Attrib = &CoolgAttrib;
|
||||||
|
@ -545,29 +540,27 @@ SetupCoolg(short SpriteNum)
|
||||||
|
|
||||||
SET(u->Flags, SPR_NO_SCAREDZ|SPR_XFLIP_TOGGLE);
|
SET(u->Flags, SPR_NO_SCAREDZ|SPR_XFLIP_TOGGLE);
|
||||||
|
|
||||||
CoolgCommon(SpriteNum);
|
CoolgCommon(actor);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern short TotalKillable;
|
extern short TotalKillable;
|
||||||
|
|
||||||
int
|
int NewCoolg(DSWActor* actor)
|
||||||
NewCoolg(short SpriteNum)
|
|
||||||
{
|
{
|
||||||
USERp u = User[SpriteNum].Data();
|
USERp u = actor->u();
|
||||||
SPRITEp sp = User[SpriteNum]->SpriteP;
|
SPRITEp sp = &actor->s();
|
||||||
USERp nu;
|
USERp nu;
|
||||||
SPRITEp np;
|
SPRITEp np;
|
||||||
ANIMATOR DoActorDecide;
|
ANIMATOR DoActorDecide;
|
||||||
short New;
|
|
||||||
|
|
||||||
New = SpawnSprite(STAT_ENEMY, COOLG_RUN_R0, &s_CoolgBirth[0], sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 50);
|
auto actorNew = SpawnActor(STAT_ENEMY, COOLG_RUN_R0, &s_CoolgBirth[0], sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 50);
|
||||||
|
|
||||||
nu = User[New].Data();
|
nu = actorNew->u();
|
||||||
np = &sprite[New];
|
np = &actorNew->s();
|
||||||
|
|
||||||
ChangeState(New, &s_CoolgBirth[0]);
|
ChangeState(actorNew->GetSpriteIndex(), &s_CoolgBirth[0]);
|
||||||
nu->StateEnd = s_CoolgDie;
|
nu->StateEnd = s_CoolgDie;
|
||||||
nu->Rot = sg_CoolgRun;
|
nu->Rot = sg_CoolgRun;
|
||||||
np->pal = nu->spal = u->spal;
|
np->pal = nu->spal = u->spal;
|
||||||
|
@ -580,14 +573,13 @@ NewCoolg(short SpriteNum)
|
||||||
|
|
||||||
// special case
|
// special case
|
||||||
TotalKillable++;
|
TotalKillable++;
|
||||||
CoolgCommon(New);
|
CoolgCommon(actorNew);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int DoCoolgBirth(DSWActor* actor)
|
||||||
DoCoolgBirth(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int New = u->SpriteNum;
|
int New = u->SpriteNum;
|
||||||
|
@ -606,7 +598,7 @@ DoCoolgBirth(DSWActor* actor)
|
||||||
TotalKillable--;
|
TotalKillable--;
|
||||||
|
|
||||||
SET(u->Flags, SPR_NO_SCAREDZ|SPR_XFLIP_TOGGLE);
|
SET(u->Flags, SPR_NO_SCAREDZ|SPR_XFLIP_TOGGLE);
|
||||||
CoolgCommon(New);
|
CoolgCommon(actor);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -614,26 +606,23 @@ DoCoolgBirth(DSWActor* actor)
|
||||||
int NullCoolg(DSWActor* actor)
|
int NullCoolg(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
|
||||||
|
|
||||||
u->ShellNum -= ACTORMOVETICS;
|
u->ShellNum -= ACTORMOVETICS;
|
||||||
|
|
||||||
if (TEST(u->Flags,SPR_SLIDING))
|
if (TEST(u->Flags,SPR_SLIDING))
|
||||||
DoActorSlide(actor);
|
DoActorSlide(actor);
|
||||||
|
|
||||||
DoCoolgMatchPlayerZ(SpriteNum);
|
DoCoolgMatchPlayerZ(actor);
|
||||||
|
|
||||||
DoActorSectorDamage(actor);
|
DoActorSectorDamage(actor);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int DoCoolgMatchPlayerZ(short SpriteNum)
|
int DoCoolgMatchPlayerZ(DSWActor* actor)
|
||||||
{
|
{
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
int SpriteNum = actor->GetSpriteIndex();
|
||||||
USERp u = User[SpriteNum].Data();
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp tsp = User[SpriteNum]->tgt_sp();
|
USER* u = actor->u();
|
||||||
int zdiff,zdist;
|
int zdiff,zdist;
|
||||||
int loz,hiz;
|
int loz,hiz;
|
||||||
|
|
||||||
|
@ -650,7 +639,7 @@ int DoCoolgMatchPlayerZ(short SpriteNum)
|
||||||
|
|
||||||
// actor does a sine wave about u->sz - this is the z mid point
|
// actor does a sine wave about u->sz - this is the z mid point
|
||||||
|
|
||||||
zdiff = (SPRITEp_MID(tsp)) - u->sz;
|
zdiff = (ActorMid(u->targetActor)) - u->sz;
|
||||||
|
|
||||||
// check z diff of the player and the sprite
|
// check z diff of the player and the sprite
|
||||||
zdist = Z(20 + RandomRange(100)); // put a random amount
|
zdist = Z(20 + RandomRange(100)); // put a random amount
|
||||||
|
@ -663,8 +652,6 @@ int DoCoolgMatchPlayerZ(short SpriteNum)
|
||||||
u->sz -= 170 * ACTORMOVETICS;
|
u->sz -= 170 * ACTORMOVETICS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define COOLG_BOB_AMT (Z(8))
|
|
||||||
|
|
||||||
// save off lo and hi z
|
// save off lo and hi z
|
||||||
loz = u->loz;
|
loz = u->loz;
|
||||||
hiz = u->hiz;
|
hiz = u->hiz;
|
||||||
|
@ -715,7 +702,7 @@ int InitCoolgCircle(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
int SpriteNum = u->SpriteNum;
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
SPRITEp sp = &actor->s();
|
||||||
|
|
||||||
u->ActorActionFunc = DoCoolgCircle;
|
u->ActorActionFunc = DoCoolgCircle;
|
||||||
|
|
||||||
|
@ -748,7 +735,7 @@ int DoCoolgCircle(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
int SpriteNum = u->SpriteNum;
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
SPRITEp sp = &actor->s();
|
||||||
int nx,ny,bound;
|
int nx,ny,bound;
|
||||||
|
|
||||||
|
|
||||||
|
@ -787,12 +774,11 @@ int DoCoolgCircle(DSWActor* actor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int DoCoolgDeath(DSWActor* actor)
|
||||||
DoCoolgDeath(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
int SpriteNum = u->SpriteNum;
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
SPRITEp sp = &actor->s();
|
||||||
int nx, ny;
|
int nx, ny;
|
||||||
|
|
||||||
|
|
||||||
|
@ -838,7 +824,7 @@ int DoCoolgMove(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
int SpriteNum = u->SpriteNum;
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
SPRITEp sp = &actor->s();
|
||||||
|
|
||||||
if ((u->ShellNum -= ACTORMOVETICS) <= 0)
|
if ((u->ShellNum -= ACTORMOVETICS) <= 0)
|
||||||
{
|
{
|
||||||
|
@ -912,7 +898,7 @@ int DoCoolgMove(DSWActor* actor)
|
||||||
if (RANDOM_P2(1024) < 32 && !TEST(sp->cstat, CSTAT_SPRITE_INVISIBLE))
|
if (RANDOM_P2(1024) < 32 && !TEST(sp->cstat, CSTAT_SPRITE_INVISIBLE))
|
||||||
InitCoolgDrip(SpriteNum);
|
InitCoolgDrip(SpriteNum);
|
||||||
|
|
||||||
DoCoolgMatchPlayerZ(SpriteNum);
|
DoCoolgMatchPlayerZ(actor);
|
||||||
|
|
||||||
DoActorSectorDamage(actor);
|
DoActorSectorDamage(actor);
|
||||||
|
|
||||||
|
|
|
@ -558,7 +558,7 @@ SetupCoolie(short SpriteNum)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int NewCoolg(short);
|
int NewCoolg(DSWActor*);
|
||||||
int SpawnCoolg(DSWActor* actor)
|
int SpawnCoolg(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
|
@ -570,7 +570,7 @@ int SpawnCoolg(DSWActor* actor)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
NewCoolg(SpriteNum);
|
NewCoolg(actor);
|
||||||
|
|
||||||
PlaySpriteSound(SpriteNum,attr_extra1,v3df_follow);
|
PlaySpriteSound(SpriteNum,attr_extra1,v3df_follow);
|
||||||
|
|
||||||
|
|
|
@ -1863,6 +1863,7 @@ int NewStateGroup(short SpriteNum, STATEp SpriteGroup[]);
|
||||||
int NewStateGroup(USERp user, STATEp SpriteGroup[]);
|
int NewStateGroup(USERp user, STATEp SpriteGroup[]);
|
||||||
void SectorMidPoint(short sectnum, int *xmid, int *ymid, int *zmid);
|
void SectorMidPoint(short sectnum, int *xmid, int *ymid, int *zmid);
|
||||||
USERp SpawnUser(short SpriteNum, short id, STATEp state);
|
USERp SpawnUser(short SpriteNum, short id, STATEp state);
|
||||||
|
USERp SpawnUser(DSWActor* actor, short id, STATEp state);
|
||||||
|
|
||||||
short ActorFindTrack(short SpriteNum, int8_t player_dir, int track_type, short *track_point_num, short *track_dir);
|
short ActorFindTrack(short SpriteNum, int8_t player_dir, int track_type, short *track_point_num, short *track_dir);
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ BEGIN_SW_NS
|
||||||
int SetupCoolie(short);
|
int SetupCoolie(short);
|
||||||
int SetupNinja(short);
|
int SetupNinja(short);
|
||||||
int SetupGoro(short);
|
int SetupGoro(short);
|
||||||
int SetupCoolg(short);
|
int SetupCoolg(DSWActor*);
|
||||||
int SetupEel(short);
|
int SetupEel(short);
|
||||||
int SetupSumo(short);
|
int SetupSumo(short);
|
||||||
int SetupZilla(short);
|
int SetupZilla(short);
|
||||||
|
@ -930,6 +930,12 @@ SpawnUser(short SpriteNum, short id, STATEp state)
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
USERp
|
||||||
|
SpawnUser(DSWActor* actor, short id, STATEp state)
|
||||||
|
{
|
||||||
|
return SpawnUser(actor->GetSpriteIndex(), id, state);
|
||||||
|
}
|
||||||
|
|
||||||
SECT_USERp
|
SECT_USERp
|
||||||
GetSectUser(short sectnum)
|
GetSectUser(short sectnum)
|
||||||
{
|
{
|
||||||
|
@ -1148,6 +1154,7 @@ ActorSpawn(SPRITEp sp)
|
||||||
{
|
{
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
short SpriteNum = short(sp - sprite);
|
short SpriteNum = short(sp - sprite);
|
||||||
|
auto actor = &swActors[SpriteNum];
|
||||||
|
|
||||||
switch (sp->picnum)
|
switch (sp->picnum)
|
||||||
{
|
{
|
||||||
|
@ -1211,7 +1218,7 @@ ActorSpawn(SPRITEp sp)
|
||||||
}
|
}
|
||||||
|
|
||||||
PicAnimOff(sp->picnum);
|
PicAnimOff(sp->picnum);
|
||||||
SetupCoolg(SpriteNum);
|
SetupCoolg(actor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue