mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- most of ninja.cpp, except the player stuff.
This commit is contained in:
parent
5eca574bba
commit
b4d298874a
2 changed files with 39 additions and 73 deletions
|
@ -1816,10 +1816,9 @@ ACTOR_ACTION_SET PlayerNinjaActionSet =
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
SetupNinja(short SpriteNum)
|
SetupNinja(DSWActor* actor)
|
||||||
{
|
{
|
||||||
auto actor = &swActors[SpriteNum];
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
|
||||||
USERp u;
|
USERp u;
|
||||||
ANIMATOR DoActorDecide;
|
ANIMATOR DoActorDecide;
|
||||||
short pic = sp->picnum;
|
short pic = sp->picnum;
|
||||||
|
@ -1830,12 +1829,12 @@ SetupNinja(short SpriteNum)
|
||||||
|
|
||||||
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
|
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
|
||||||
{
|
{
|
||||||
u = User[SpriteNum].Data();
|
u = actor->u();
|
||||||
ASSERT(u);
|
ASSERT(u);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u = SpawnUser(SpriteNum, NINJA_RUN_R0, s_NinjaRun[0]);
|
u = SpawnUser(actor, NINJA_RUN_R0, s_NinjaRun[0]);
|
||||||
u->Health = HEALTH_NINJA;
|
u->Health = HEALTH_NINJA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1938,13 +1937,10 @@ SetupNinja(short SpriteNum)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int DoNinjaHariKari(DSWActor* actor)
|
||||||
DoNinjaHariKari(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = User[SpriteNum]->SpriteP;
|
|
||||||
short cnt,i;
|
|
||||||
|
|
||||||
UpdateSinglePlayKills(actor);
|
UpdateSinglePlayKills(actor);
|
||||||
change_actor_stat(actor, STAT_DEAD_ACTOR);
|
change_actor_stat(actor, STAT_DEAD_ACTOR);
|
||||||
|
@ -1962,19 +1958,17 @@ DoNinjaHariKari(DSWActor* actor)
|
||||||
|
|
||||||
SpawnBlood(actor, actor, -1, -1, -1, -1);
|
SpawnBlood(actor, actor, -1, -1, -1, -1);
|
||||||
|
|
||||||
cnt = RandomRange(4)+1;
|
int cnt = RandomRange(4)+1;
|
||||||
for (i=0; i<=cnt; i++)
|
for (int i=0; i<=cnt; i++)
|
||||||
InitBloodSpray(actor,true,-2);
|
InitBloodSpray(actor,true,-2);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int DoNinjaGrabThroat(DSWActor* actor)
|
||||||
DoNinjaGrabThroat(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = User[SpriteNum]->SpriteP;
|
|
||||||
|
|
||||||
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
|
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
|
||||||
{
|
{
|
||||||
|
@ -1982,7 +1976,7 @@ DoNinjaGrabThroat(DSWActor* actor)
|
||||||
RESET(u->Flags2, SPR2_DYING);
|
RESET(u->Flags2, SPR2_DYING);
|
||||||
RESET(sp->cstat, CSTAT_SPRITE_YFLIP);
|
RESET(sp->cstat, CSTAT_SPRITE_YFLIP);
|
||||||
change_actor_stat(actor, STAT_DEAD_ACTOR);
|
change_actor_stat(actor, STAT_DEAD_ACTOR);
|
||||||
RESET(sprite[SpriteNum].cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||||
SET(u->Flags, SPR_DEAD);
|
SET(u->Flags, SPR_DEAD);
|
||||||
RESET(u->Flags, SPR_FALLING | SPR_JUMPING);
|
RESET(u->Flags, SPR_FALLING | SPR_JUMPING);
|
||||||
u->floor_dist = Z(40);
|
u->floor_dist = Z(40);
|
||||||
|
@ -2009,11 +2003,9 @@ DoNinjaGrabThroat(DSWActor* actor)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int DoNinjaMove(DSWActor* actor)
|
||||||
DoNinjaMove(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
|
||||||
|
|
||||||
if (TEST(u->Flags2, SPR2_DYING))
|
if (TEST(u->Flags2, SPR2_DYING))
|
||||||
{
|
{
|
||||||
|
@ -2057,12 +2049,10 @@ DoNinjaMove(DSWActor* actor)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int NinjaJumpActionFunc(DSWActor* actor)
|
||||||
NinjaJumpActionFunc(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = User[SpriteNum]->SpriteP;
|
|
||||||
int nx, ny;
|
int nx, ny;
|
||||||
|
|
||||||
// Move while jumping
|
// Move while jumping
|
||||||
|
@ -2090,11 +2080,9 @@ NinjaJumpActionFunc(DSWActor* actor)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int NullNinja(DSWActor* actor)
|
||||||
NullNinja(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
|
||||||
|
|
||||||
if (u->WaitTics > 0) u->WaitTics -= ACTORMOVETICS;
|
if (u->WaitTics > 0) u->WaitTics -= ACTORMOVETICS;
|
||||||
|
|
||||||
|
@ -2113,7 +2101,6 @@ NullNinja(DSWActor* actor)
|
||||||
int DoNinjaPain(DSWActor* actor)
|
int DoNinjaPain(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
|
||||||
|
|
||||||
NullNinja(actor);
|
NullNinja(actor);
|
||||||
|
|
||||||
|
@ -2135,8 +2122,7 @@ int DoNinjaPain(DSWActor* actor)
|
||||||
int DoNinjaSpecial(DSWActor* actor)
|
int DoNinjaSpecial(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = &sprite[SpriteNum];
|
|
||||||
|
|
||||||
if (u->spal == PALETTE_PLAYER5)
|
if (u->spal == PALETTE_PLAYER5)
|
||||||
{
|
{
|
||||||
|
@ -2151,18 +2137,15 @@ int DoNinjaSpecial(DSWActor* actor)
|
||||||
int CheckFire(DSWActor* actor)
|
int CheckFire(DSWActor* actor)
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
|
||||||
if (!CanSeePlayer(actor))
|
if (!CanSeePlayer(actor))
|
||||||
InitActorDuck(actor);
|
InitActorDuck(actor);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int DoNinjaCeiling(DSWActor* actor)
|
||||||
DoNinjaCeiling(DSWActor* actor)
|
|
||||||
{
|
{
|
||||||
USER* u = actor->u();
|
USER* u = actor->u();
|
||||||
int SpriteNum = u->SpriteNum;
|
SPRITEp sp = &actor->s();
|
||||||
SPRITEp sp = User[SpriteNum]->SpriteP;
|
|
||||||
|
|
||||||
DoActorSectorDamage(actor);
|
DoActorSectorDamage(actor);
|
||||||
|
|
||||||
|
@ -2175,8 +2158,7 @@ DoNinjaCeiling(DSWActor* actor)
|
||||||
// too convienent to put it here.
|
// too convienent to put it here.
|
||||||
//
|
//
|
||||||
|
|
||||||
void
|
void InitAllPlayerSprites(void)
|
||||||
InitAllPlayerSprites(void)
|
|
||||||
{
|
{
|
||||||
short i;
|
short i;
|
||||||
|
|
||||||
|
@ -2187,11 +2169,10 @@ InitAllPlayerSprites(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void PlayerLevelReset(PLAYERp pp)
|
||||||
PlayerLevelReset(PLAYERp pp)
|
|
||||||
{
|
{
|
||||||
SPRITEp sp = &sprite[pp->PlayerSprite];
|
SPRITEp sp = &pp->Actor()->s();
|
||||||
USERp u = User[pp->PlayerSprite].Data();
|
USERp u = pp->Actor()->u();
|
||||||
|
|
||||||
if (gNet.MultiGameType == MULTI_GAME_COMMBAT)
|
if (gNet.MultiGameType == MULTI_GAME_COMMBAT)
|
||||||
{
|
{
|
||||||
|
@ -2228,11 +2209,10 @@ PlayerLevelReset(PLAYERp pp)
|
||||||
DamageData[u->WeaponNum].Init(pp);
|
DamageData[u->WeaponNum].Init(pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void PlayerDeathReset(PLAYERp pp)
|
||||||
PlayerDeathReset(PLAYERp pp)
|
|
||||||
{
|
{
|
||||||
SPRITEp sp = &sprite[pp->PlayerSprite];
|
SPRITEp sp = &pp->Actor()->s();
|
||||||
USERp u = User[pp->PlayerSprite].Data();
|
USERp u = pp->Actor()->u();
|
||||||
|
|
||||||
if (TEST(pp->Flags, PF_DIVING))
|
if (TEST(pp->Flags, PF_DIVING))
|
||||||
DoPlayerStopDiveNoWarp(pp);
|
DoPlayerStopDiveNoWarp(pp);
|
||||||
|
@ -2296,8 +2276,7 @@ PlayerDeathReset(PLAYERp pp)
|
||||||
DamageData[u->WeaponNum].Init(pp);
|
DamageData[u->WeaponNum].Init(pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void PlayerPanelSetup(void)
|
||||||
PlayerPanelSetup(void)
|
|
||||||
{
|
{
|
||||||
short pnum;
|
short pnum;
|
||||||
PLAYERp pp;
|
PLAYERp pp;
|
||||||
|
@ -2320,11 +2299,10 @@ PlayerPanelSetup(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void PlayerGameReset(PLAYERp pp)
|
||||||
PlayerGameReset(PLAYERp pp)
|
|
||||||
{
|
{
|
||||||
SPRITEp sp = &sprite[pp->PlayerSprite];
|
SPRITEp sp = &pp->Actor()->s();
|
||||||
USERp u = User[pp->PlayerSprite].Data();
|
USERp u = pp->Actor()->u();
|
||||||
|
|
||||||
COVER_SetReverb(0); // Turn off any echoing that may have been going before
|
COVER_SetReverb(0); // Turn off any echoing that may have been going before
|
||||||
pp->Reverb = 0;
|
pp->Reverb = 0;
|
||||||
|
@ -2381,19 +2359,7 @@ PlayerGameReset(PLAYERp pp)
|
||||||
|
|
||||||
extern ACTOR_ACTION_SET PlayerNinjaActionSet;
|
extern ACTOR_ACTION_SET PlayerNinjaActionSet;
|
||||||
|
|
||||||
void
|
void InitPlayerSprite(PLAYERp pp)
|
||||||
PlayerSpriteLoadLevel(short SpriteNum)
|
|
||||||
{
|
|
||||||
auto actor = &swActors[SpriteNum];
|
|
||||||
USERp u = actor->u();
|
|
||||||
|
|
||||||
ChangeState(actor, s_NinjaRun[0]);
|
|
||||||
u->Rot = sg_NinjaRun;
|
|
||||||
u->ActorActionSet = &PlayerNinjaActionSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
InitPlayerSprite(PLAYERp pp)
|
|
||||||
{
|
{
|
||||||
short sp_num;
|
short sp_num;
|
||||||
SPRITE *sp;
|
SPRITE *sp;
|
||||||
|
@ -2437,7 +2403,7 @@ InitPlayerSprite(PLAYERp pp)
|
||||||
sp->pal = PALETTE_PLAYER0 + pp->pnum;
|
sp->pal = PALETTE_PLAYER0 + pp->pnum;
|
||||||
u->spal = sp->pal;
|
u->spal = sp->pal;
|
||||||
|
|
||||||
NewStateGroup_(sp_num, u->ActorActionSet->Run);
|
NewStateGroup(pp->Actor(), u->ActorActionSet->Run);
|
||||||
|
|
||||||
pp->PlayerUnderSprite = -1;
|
pp->PlayerUnderSprite = -1;
|
||||||
pp->UnderSpriteP = nullptr;
|
pp->UnderSpriteP = nullptr;
|
||||||
|
@ -2468,11 +2434,11 @@ InitPlayerSprite(PLAYERp pp)
|
||||||
pp->DeathType = 0;
|
pp->DeathType = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void SpawnPlayerUnderSprite(PLAYERp pp)
|
||||||
SpawnPlayerUnderSprite(PLAYERp pp)
|
|
||||||
{
|
{
|
||||||
USERp pu = User[pp->PlayerSprite].Data(), u;
|
SPRITEp psp = &pp->Actor()->s();
|
||||||
SPRITEp psp = &sprite[pp->PlayerSprite];
|
USERp pu = pp->Actor()->u(), u;
|
||||||
|
|
||||||
SPRITEp sp;
|
SPRITEp sp;
|
||||||
int pnum = int(pp - Player), sp_num;
|
int pnum = int(pp - Player), sp_num;
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ BEGIN_SW_NS
|
||||||
|
|
||||||
|
|
||||||
int SetupCoolie(DSWActor*);
|
int SetupCoolie(DSWActor*);
|
||||||
int SetupNinja(short);
|
int SetupNinja(DSWActor*);
|
||||||
int SetupGoro(DSWActor*);
|
int SetupGoro(DSWActor*);
|
||||||
int SetupCoolg(DSWActor*);
|
int SetupCoolg(DSWActor*);
|
||||||
int SetupEel(DSWActor*);
|
int SetupEel(DSWActor*);
|
||||||
|
@ -1202,7 +1202,7 @@ ActorSpawn(SPRITEp sp)
|
||||||
}
|
}
|
||||||
|
|
||||||
PicAnimOff(sp->picnum);
|
PicAnimOff(sp->picnum);
|
||||||
SetupNinja(SpriteNum);
|
SetupNinja(actor);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue