- redid SW action interface to use a separate wrapper class from USER.

Turned out that not all sprites in the world have a USER, so we need something different to wrap the game's sprite data.
This commit is contained in:
Christoph Oelckers 2021-10-29 20:49:57 +02:00
parent 8bad95c7c6
commit 509124c1dd
36 changed files with 1514 additions and 1512 deletions

View file

@ -41,6 +41,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
DSWActor swActors[MAXSPRITES];
extern int jump_grav;
int SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, int hit_z);
@ -53,7 +55,7 @@ extern STATE s_NinjaDieSlicedHack[];
extern STATEp sg_NinjaGrabThroat[];
int DoActorStopFall(USERp SpriteNum);
int DoActorStopFall(DSWActor* actor);
int
@ -92,6 +94,7 @@ DoScaleSprite(short SpriteNum)
int
DoActorDie(short SpriteNum, short weapon)
{
auto actor = &swActors[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = &sprite[SpriteNum];
@ -168,7 +171,7 @@ DoActorDie(short SpriteNum, short weapon)
u->ActorActionFunc = nullptr;
sp->xvel = 200 + RandomRange(200);
u->jump_speed = -200 - RandomRange(250);
DoActorBeginJump(u);
DoActorBeginJump(actor);
sprite[SpriteNum].ang = sprite[weapon].ang;
}
}
@ -180,7 +183,7 @@ DoActorDie(short SpriteNum, short weapon)
ChangeState(SpriteNum, u->StateEnd);
sp->xvel = 0;
u->jump_speed = 0;
DoActorBeginJump(u);
DoActorBeginJump(actor);
}
u->RotNum = 0;
@ -212,13 +215,13 @@ DoActorDie(short SpriteNum, short weapon)
{
sp->xvel <<= 1;
u->jump_speed = -100 - RandomRange(250);
DoActorBeginJump(u);
DoActorBeginJump(actor);
}
else
{
sp->xvel = 0;
u->jump_speed = -10 - RandomRange(25);
DoActorBeginJump(u);
DoActorBeginJump(actor);
}
u->ActorActionFunc = nullptr;
// Get angle to player
@ -242,7 +245,7 @@ DoActorDie(short SpriteNum, short weapon)
sp->xvel = 100 + RandomRange(200);
u->jump_speed = -100 - RandomRange(250);
}
DoActorBeginJump(u);
DoActorBeginJump(actor);
u->ActorActionFunc = nullptr;
// Get angle to player
sp->ang = NORM_ANGLE(getangle(u->tgt_sp->x - sp->x, u->tgt_sp->y - sp->y) + 1024);
@ -271,7 +274,7 @@ DoActorDie(short SpriteNum, short weapon)
u->ActorActionFunc = nullptr;
sp->xvel = 300 + RandomRange(400);
u->jump_speed = -300 - RandomRange(350);
DoActorBeginJump(u);
DoActorBeginJump(actor);
sprite[SpriteNum].ang = sprite[weapon].ang;
break;
}
@ -326,8 +329,9 @@ DoDebrisCurrent(SPRITEp sp)
}
int
DoActorSectorDamage(USER* u)
DoActorSectorDamage(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
SECT_USERp sectu = SectUser[sp->sectnum].Data();
@ -408,8 +412,9 @@ move_debris(short SpriteNum, int xchange, int ychange, int zchange)
// current move with the current.
int
DoActorDebris(USER* u)
DoActorDebris(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
SECTORp sectp = &sector[sp->sectnum];
@ -472,8 +477,9 @@ DoActorDebris(USER* u)
int
DoFireFly(USER* u)
DoFireFly(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int nx, ny;
@ -627,7 +633,7 @@ DoActorBeginSlide(int SpriteNum, short ang, short vel, short dec)
u->slide_vel = vel;
u->slide_dec = dec;
//DoActorSlide(u);
//DoActorSlide(actor);
return 0;
}
@ -636,9 +642,10 @@ DoActorBeginSlide(int SpriteNum, short ang, short vel, short dec)
// Has its own set of variables
int
DoActorSlide(USER* u)
DoActorSlide(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
int nx, ny;
nx = MulScale(u->slide_vel, bcos(u->slide_ang), 14);
@ -663,9 +670,10 @@ DoActorSlide(USER* u)
// !AIC - Actor jumping and falling
int
DoActorBeginJump(USER* u)
DoActorBeginJump(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SET(u->Flags, SPR_JUMPING);
RESET(u->Flags, SPR_FALLING);
@ -687,15 +695,16 @@ DoActorBeginJump(USER* u)
//DO NOT CALL DoActorJump! DoActorStopFall can cause an infinite loop and
//stack overflow if it is called.
//DoActorJump(u);
//DoActorJump(actor);
return 0;
}
int
DoActorJump(USER* u)
DoActorJump(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
int jump_adj;
@ -711,7 +720,7 @@ DoActorJump(USER* u)
MONO_PRINT(ds);
// Start falling
DoActorBeginFall(u);
DoActorBeginFall(actor);
return 0;
}
@ -731,7 +740,7 @@ DoActorJump(USER* u)
MONO_PRINT(ds);
// Change sprites state to falling
DoActorBeginFall(u);
DoActorBeginFall(actor);
}
return 0;
@ -739,8 +748,9 @@ DoActorJump(USER* u)
int
DoActorBeginFall(USERp u)
DoActorBeginFall(DSWActor* actor)
{
USER* u = actor->u();
SET(u->Flags, SPR_FALLING);
RESET(u->Flags, SPR_JUMPING);
@ -762,15 +772,16 @@ DoActorBeginFall(USERp u)
}
}
DoActorFall(u);
DoActorFall(actor);
return 0;
}
int
DoActorFall(USERp u)
DoActorFall(DSWActor* actor)
{
USER* u = actor->u();
SPRITEp sp = u->s();
// adjust jump speed by gravity
@ -782,16 +793,17 @@ DoActorFall(USERp u)
// Stick like glue when you hit the ground
if (sp->z > u->loz)
{
DoActorStopFall(u);
DoActorStopFall(actor);
}
return 0;
}
int
DoActorStopFall(USER* u)
DoActorStopFall(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
sp->z = u->loz;
@ -810,7 +822,7 @@ DoActorStopFall(USER* u)
//DSPRINTF(ds,"StopFall: sp_num %d, sp->picnum %d, lo_num %d, lo_sp->picnum %d",SpriteNum, sp->picnum, u->lo_sp - sprite, u->lo_sp->picnum);
MONO_PRINT(ds);
DoActorBeginJump(u);
DoActorBeginJump(actor);
return 0;
}
@ -840,9 +852,10 @@ DoActorStopFall(USER* u)
}
int
DoActorDeathMove(USER* u)
DoActorDeathMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
@ -850,9 +863,9 @@ DoActorDeathMove(USER* u)
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
if (TEST(u->Flags, SPR_JUMPING))
DoActorJump(u);
DoActorJump(actor);
else
DoActorFall(u);
DoActorFall(actor);
}
nx = MulScale(sp->xvel, bcos(sp->ang), 14);

View file

@ -115,6 +115,7 @@ void DebugMoveHit(short SpriteNum)
bool ActorMoveHitReact(short SpriteNum)
{
auto actor = &swActors[SpriteNum];
USERp u = User[SpriteNum].Data();
// Should only return true if there is a reaction to what was hit that
@ -138,7 +139,7 @@ bool ActorMoveHitReact(short SpriteNum)
action = ChooseAction(u->Personality->TouchTarget);
if (action)
{
(*action)(u);
(*action)(actor);
return true;
}
}
@ -819,9 +820,10 @@ DoActorActionDecide(short SpriteNum)
int
InitActorDecide(USER* u)
InitActorDecide(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
// NOTE: It is possible to overflow the stack with too many calls to this
// routine
@ -833,15 +835,16 @@ InitActorDecide(USER* u)
u->ActorActionFunc = DoActorDecide;
DoActorDecide(u);
DoActorDecide(actor);
return 0;
}
int
DoActorDecide(USER* u)
DoActorDecide(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
ANIMATORp actor_action;
@ -875,7 +878,7 @@ DoActorDecide(USER* u)
if (actor_action != InitActorDecide)
{
// NOT staying put
(*actor_action)(u);
(*actor_action)(actor);
//CON_Message("DoActorDecide: NOT Staying put");
}
else
@ -895,9 +898,10 @@ int sw_snd_scratch = 0;
int
InitActorAlertNoise(USER* u)
InitActorAlertNoise(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
sw_snd_scratch = 1;
// MONO_PRINT(strcpy(ds,"Init Actor Threat Noise"));
@ -911,9 +915,10 @@ InitActorAlertNoise(USER* u)
int
InitActorAmbientNoise(USER* u)
InitActorAmbientNoise(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
sw_snd_scratch = 2;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -927,9 +932,10 @@ InitActorAmbientNoise(USER* u)
}
int
InitActorAttackNoise(USER* u)
InitActorAttackNoise(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
sw_snd_scratch = 3;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -943,9 +949,10 @@ InitActorAttackNoise(USER* u)
}
int
InitActorPainNoise(USER* u)
InitActorPainNoise(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
sw_snd_scratch = 4;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -959,9 +966,10 @@ InitActorPainNoise(USER* u)
}
int
InitActorDieNoise(USER* u)
InitActorDieNoise(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
sw_snd_scratch = 5;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -975,9 +983,10 @@ InitActorDieNoise(USER* u)
}
int
InitActorExtra1Noise(USER* u)
InitActorExtra1Noise(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
sw_snd_scratch = 6;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -990,9 +999,10 @@ InitActorExtra1Noise(USER* u)
}
int
InitActorExtra2Noise(USER* u)
InitActorExtra2Noise(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
sw_snd_scratch = 7;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -1005,9 +1015,10 @@ InitActorExtra2Noise(USER* u)
}
int
InitActorExtra3Noise(USER* u)
InitActorExtra3Noise(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
sw_snd_scratch = 8;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -1020,9 +1031,10 @@ InitActorExtra3Noise(USER* u)
}
int
InitActorExtra4Noise(USER* u)
InitActorExtra4Noise(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
sw_snd_scratch = 9;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -1035,9 +1047,10 @@ InitActorExtra4Noise(USER* u)
}
int
InitActorExtra5Noise(USER* u)
InitActorExtra5Noise(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
sw_snd_scratch = 10;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -1050,9 +1063,10 @@ InitActorExtra5Noise(USER* u)
}
int
InitActorExtra6Noise(USER* u)
InitActorExtra6Noise(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
sw_snd_scratch = 11;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -1070,9 +1084,10 @@ InitActorExtra6Noise(USER* u)
*/
int
InitActorMoveCloser(USER* u)
InitActorMoveCloser(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
//MONO_PRINT("Init Actor Move Closer\n");
@ -1081,15 +1096,16 @@ InitActorMoveCloser(USER* u)
if (u->Rot != u->ActorActionSet->Run)
NewStateGroup(SpriteNum, u->ActorActionSet->Run);
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
return 0;
}
int
DoActorCantMoveCloser(USER* u)
DoActorCantMoveCloser(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
//MONO_PRINT("Can't move closer\n");
@ -1112,15 +1128,16 @@ DoActorCantMoveCloser(USER* u)
// Try to move closer
//MONO_PRINT("Move Closer - Trying to move around\n");
InitActorReposition(u);
InitActorReposition(actor);
}
return 0;
}
int
DoActorMoveCloser(USER* u)
DoActorMoveCloser(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
@ -1135,7 +1152,7 @@ DoActorMoveCloser(USER* u)
if (ActorMoveHitReact(SpriteNum))
return 0;
DoActorCantMoveCloser(u);
DoActorCantMoveCloser(actor);
return 0;
}
@ -1166,7 +1183,7 @@ DoActorMoveCloser(USER* u)
if (!CanSeePlayer(SpriteNum))
{
// stay put and choose another option
InitActorDecide(u);
InitActorDecide(actor);
return 0;
}
else
@ -1179,7 +1196,7 @@ DoActorMoveCloser(USER* u)
// Should be a random value test
if (u->Dist > 512 * 3)
{
InitActorDecide(u);
InitActorDecide(actor);
}
return 0;
@ -1362,9 +1379,10 @@ FindWanderTrack(USERp u)
int
InitActorRunAway(USER* u)
InitActorRunAway(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
//MONO_PRINT("Init Actor RunAway\n");
@ -1384,7 +1402,7 @@ InitActorRunAway(USER* u)
else
{
SET(u->Flags, SPR_RUN_AWAY);
InitActorReposition(u);
InitActorReposition(actor);
////DSPRINTF(ds, "Actor RunAway\n");
//MONO_PRINT(ds);
}
@ -1393,16 +1411,17 @@ InitActorRunAway(USER* u)
}
int
InitActorRunToward(USER* u)
InitActorRunToward(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
//MONO_PRINT("InitActorRunToward\n");
u->ActorActionFunc = DoActorDecide;
NewStateGroup(SpriteNum, u->ActorActionSet->Run);
InitActorReposition(u);
InitActorReposition(actor);
DoActorSetSpeed(SpriteNum, FAST_SPEED);
return 0;
@ -1416,9 +1435,10 @@ InitActorRunToward(USER* u)
int
InitActorAttack(USER* u)
InitActorAttack(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
// zombie is attacking a player
@ -1435,7 +1455,7 @@ InitActorAttack(USER* u)
if (TEST(sprite[u->tgt_sp-sprite].cstat, CSTAT_SPRITE_TRANSLUCENT))
{
InitActorRunAway(u);
InitActorRunAway(actor);
return 0;
}
@ -1443,13 +1463,13 @@ InitActorAttack(USER* u)
User[u->tgt_sp-sprite]->Health <= 0)
{
DoActorPickClosePlayer(SpriteNum);
InitActorReposition(u);
InitActorReposition(actor);
return 0;
}
if (!CanHitPlayer(SpriteNum))
{
InitActorReposition(u);
InitActorReposition(actor);
return 0;
}
@ -1460,7 +1480,7 @@ InitActorAttack(USER* u)
TEST(User[u->tgt_sp-sprite]->PlayerP->Flags, PF_DEAD))
{
DoActorPickClosePlayer(SpriteNum);
InitActorReposition(u);
InitActorReposition(actor);
return 0;
}
@ -1475,7 +1495,7 @@ InitActorAttack(USER* u)
// If it's your own kind, lay off!
if (u->ID == User[u->tgt_sp - sprite]->ID && !User[u->tgt_sp - sprite]->PlayerP)
{
InitActorRunAway(u);
InitActorRunAway(actor);
return 0;
}
@ -1514,16 +1534,17 @@ InitActorAttack(USER* u)
}
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
return 0;
}
int
DoActorAttack(USER* u)
DoActorAttack(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
USERp pu;
SPRITEp sp = User[SpriteNum]->SpriteP;
short rand_num;
@ -1559,9 +1580,10 @@ DoActorAttack(USER* u)
}
int
InitActorEvade(USER* u)
InitActorEvade(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
//MONO_PRINT("Init Actor Evade\n");
@ -1587,9 +1609,10 @@ InitActorEvade(USER* u)
}
int
InitActorWanderAround(USER* u)
InitActorWanderAround(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
//DSPRINTF(ds, "InitActorWanderAround\n");
@ -1612,9 +1635,10 @@ InitActorWanderAround(USER* u)
}
int
InitActorFindPlayer(USER* u)
InitActorFindPlayer(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
int DoActorFindPlayer(short SpriteNum);
@ -1637,7 +1661,7 @@ InitActorFindPlayer(USER* u)
}
else
{
InitActorReposition(u);
InitActorReposition(actor);
}
@ -1645,9 +1669,10 @@ InitActorFindPlayer(USER* u)
}
int
InitActorDuck(USER* u)
InitActorDuck(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
short dist;
@ -1675,15 +1700,16 @@ InitActorDuck(USER* u)
}
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
return 0;
}
int
DoActorDuck(USER* u)
DoActorDuck(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if ((u->WaitTics -= ACTORMOVETICS) < 0)
{
@ -1697,9 +1723,10 @@ DoActorDuck(USER* u)
}
int
DoActorMoveJump(USER* u)
DoActorMoveJump(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
@ -1712,7 +1739,7 @@ DoActorMoveJump(USER* u)
if (!TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
{
InitActorDecide(u);
InitActorDecide(actor);
}
return 0;
@ -1923,13 +1950,11 @@ FindNewAngle(short SpriteNum, signed char dir, int DistToMove)
*/
#define REPOSITION 2
#if REPOSITION == 2
int
InitActorReposition(USER* u)
InitActorReposition(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
short ang;
int rnum;
@ -1985,7 +2010,7 @@ InitActorReposition(USER* u)
if (ang == -1)
{
u->Vis = 8;
InitActorPause(u);
InitActorPause(actor);
return 0;
}
@ -2006,7 +2031,7 @@ InitActorReposition(USER* u)
if (ang == -1)
{
u->Vis = 8;
InitActorPause(u);
InitActorPause(actor);
return 0;
}
}
@ -2027,15 +2052,16 @@ InitActorReposition(USER* u)
if (!TEST(u->Flags, SPR_SWIMMING))
NewStateGroup(SpriteNum, u->ActorActionSet->Run);
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
return 0;
}
int
DoActorReposition(USER* u)
DoActorReposition(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
@ -2049,14 +2075,14 @@ DoActorReposition(USER* u)
return 0;
u->Vis = 6;
InitActorPause(u);
InitActorPause(actor);
return 0;
}
// if close to target distance do a Decision again
if (u->TargetDist < 50)
{
InitActorDecide(u);
InitActorDecide(actor);
}
return 0;
@ -2064,9 +2090,10 @@ DoActorReposition(USER* u)
int
InitActorPause(USER* u)
InitActorPause(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
u->ActorActionFunc = DoActorPause;
@ -2074,14 +2101,15 @@ InitActorPause(USER* u)
//if (!TEST(u->Flags, SPR_SWIMMING))
//NewStateGroup(SpriteNum, u->ActorActionSet->Stand);
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
return 0;
}
int
DoActorPause(USER* u)
DoActorPause(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
// Using Vis instead of WaitTics, var name sucks, but it's the same type
@ -2094,85 +2122,7 @@ DoActorPause(USER* u)
return 0;
}
#endif
// not used - simplified version that is purely random that is easier to follow
// just leaving it here to look at
#if REPOSITION == 1
int
InitActorReposition(USER* u)
{
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
//MONO_PRINT("InitActorReposition\n");
u->WaitTics = 8;
sp->ang = RANDOM_P2(2048);
u->ActorActionFunc = DoActorReposition;
NewStateGroup(SpriteNum, u->ActorActionSet->Run);
(*u->ActorActionFunc)(u);
return 0;
}
int
DoActorReposition(USER* u)
{
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
ny = MulScale(sp->xvel, bsin(sp->ang), 14);
if (!move_actor(SpriteNum, nx, ny, 0L))
{
if (ActorMoveHitReact(SpriteNum))
return 0;
InitActorPause(u);
return 0;
}
return 0;
}
int
InitActorPause(USER* u)
{
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
//MONO_PRINT("InitActorPause\n");
u->ActorActionFunc = DoActorPause;
//NewStateGroup(SpriteNum, u->ActorActionSet->Stand);
(*u->ActorActionFunc)(u);
return 0;
}
int
DoActorPause(USER* u)
{
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
if ((u->WaitTics -= ACTORMOVETICS) < 0)
{
u->ActorActionFunc = DoActorDecide;
RESET(u->Flags, SPR_TARGETED);
}
return 0;
}
#endif
#include "saveable.h"

View file

@ -80,41 +80,41 @@ bool CanSeePlayer(short SpriteNum);
int CanHitPlayer(short SpriteNum);
int DoActorPickClosePlayer(short SpriteNum);
int CloseRangeDist(SPRITEp sp1,SPRITEp sp2);
int InitActorDecide(USER* SpriteNum);
int DoActorDecide(USER* SpriteNum);
int InitActorAlertNoise(USER* SpriteNum);
int InitActorAmbientNoise(USER* SpriteNum);
int InitActorAttackNoise(USER* SpriteNum);
int InitActorPainNoise(USER* SpriteNum);
int InitActorDieNoise(USER* SpriteNum);
int InitActorExtra1Noise(USER* SpriteNum);
int InitActorExtra2Noise(USER* SpriteNum);
int InitActorExtra3Noise(USER* SpriteNum);
int InitActorExtra4Noise(USER* SpriteNum);
int InitActorExtra5Noise(USER* SpriteNum);
int InitActorExtra6Noise(USER* SpriteNum);
int InitActorMoveCloser(USER* SpriteNum);
int DoActorCantMoveCloser(USER* SpriteNum);
int DoActorMoveCloser(USER* SpriteNum);
int InitActorDecide(DSWActor* actor);
int DoActorDecide(DSWActor* actor);
int InitActorAlertNoise(DSWActor* actor);
int InitActorAmbientNoise(DSWActor* actor);
int InitActorAttackNoise(DSWActor* actor);
int InitActorPainNoise(DSWActor* actor);
int InitActorDieNoise(DSWActor* actor);
int InitActorExtra1Noise(DSWActor* actor);
int InitActorExtra2Noise(DSWActor* actor);
int InitActorExtra3Noise(DSWActor* actor);
int InitActorExtra4Noise(DSWActor* actor);
int InitActorExtra5Noise(DSWActor* actor);
int InitActorExtra6Noise(DSWActor* actor);
int InitActorMoveCloser(DSWActor* actor);
int DoActorCantMoveCloser(DSWActor* actor);
int DoActorMoveCloser(DSWActor* actor);
short FindTrackToPlayer(USERp u);
short FindTrackAwayFromPlayer(USERp u);
short FindWanderTrack(USERp u);
int InitActorRunAway(USER* SpriteNum);
int InitActorRunToward(USER* SpriteNum);
int InitActorAttack(USER* SpriteNum);
int DoActorAttack(USER* SpriteNum);
int InitActorEvade(USER* SpriteNum);
int InitActorWanderAround(USER* SpriteNum);
int InitActorFindPlayer(USER* SpriteNum);
int InitActorDuck(USER* SpriteNum);
int DoActorDuck(USER* SpriteNum);
int DoActorMoveJump(USER* SpriteNum);
int InitActorRunAway(DSWActor* actor);
int InitActorRunToward(DSWActor* actor);
int InitActorAttack(DSWActor* actor);
int DoActorAttack(DSWActor* actor);
int InitActorEvade(DSWActor* actor);
int InitActorWanderAround(DSWActor* actor);
int InitActorFindPlayer(DSWActor* actor);
int InitActorDuck(DSWActor* actor);
int DoActorDuck(DSWActor* actor);
int DoActorMoveJump(DSWActor* actor);
int move_scan(short SpriteNum,short ang,int dist,int *stopx,int *stopy,int *stopz,short *stopsect);
int FindNewAngle(short SpriteNum,signed char dir,int DistToMove);
int InitActorReposition(USER* SpriteNum);
int DoActorReposition(USER* SpriteNum);
int InitActorPause(USER* SpriteNum);
int DoActorPause(USER* SpriteNum);
int InitActorReposition(DSWActor* actor);
int DoActorReposition(DSWActor* actor);
int InitActorPause(DSWActor* actor);
int DoActorPause(DSWActor* actor);
/*
ANIMATOR

View file

@ -537,7 +537,7 @@ STATEp sg_BunnyFall[] =
//////////////////////
#define BUNNY_JUMP_ATTACK_RATE 35
int DoBunnyBeginJumpAttack(USER* SpriteNum);
int DoBunnyBeginJumpAttack(DSWActor* actor);
STATE s_BunnyJumpAttack[5][6] =
{
@ -850,9 +850,10 @@ PickBunnyJumpSpeed(short SpriteNum, int pix_height)
//
int
DoBunnyBeginJumpAttack(USER* u)
DoBunnyBeginJumpAttack(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
SPRITEp psp = User[SpriteNum]->tgt_sp;
short tang;
@ -885,8 +886,9 @@ DoBunnyBeginJumpAttack(USER* u)
}
int
DoBunnyMoveJump(USERp u)
DoBunnyMoveJump(DSWActor* actor)
{
USER* u = actor->u();
SPRITEp sp = u->s();
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
@ -900,9 +902,9 @@ DoBunnyMoveJump(USERp u)
move_actor(u->SpriteNum, nx, ny, 0L);
if (TEST(u->Flags, SPR_JUMPING))
DoActorJump(u);
DoActorJump(actor);
else
DoActorFall(u);
DoActorFall(actor);
}
DoActorZrange(u->SpriteNum);
@ -912,7 +914,7 @@ DoBunnyMoveJump(USERp u)
// if (DoBunnyQuickJump(SpriteNum))
// return (0);
InitActorDecide(u);
InitActorDecide(actor);
}
return 0;
@ -959,9 +961,10 @@ DoPickCloseBunny(USERp u)
}
int
DoBunnyQuickJump(USER* u)
DoBunnyQuickJump(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if (u->spal != PALETTE_PLAYER8) return false;
@ -1095,16 +1098,17 @@ DoBunnyQuickJump(USER* u)
int
NullBunny(USER* u)
NullBunny(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
if (TEST(u->Flags, SPR_JUMPING))
DoActorJump(u);
DoActorJump(actor);
else
DoActorFall(u);
DoActorFall(actor);
}
// stay on floor unless doing certain things
@ -1112,28 +1116,30 @@ NullBunny(USER* u)
KeepActorOnFloor(SpriteNum);
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int DoBunnyPain(USER* u)
int DoBunnyPain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullBunny(u);
NullBunny(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
InitActorDecide(u);
InitActorDecide(actor);
return 0;
}
int DoBunnyRipHeart(USER* u)
int DoBunnyRipHeart(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
SPRITEp tsp = u->tgt_sp;
@ -1146,12 +1152,13 @@ int DoBunnyRipHeart(USER* u)
return 0;
}
int DoBunnyStandKill(USER* u)
int DoBunnyStandKill(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
NullBunny(u);
NullBunny(actor);
// Growl like the bad ass bunny you are!
if (RandomRange(1000) > 800)
@ -1178,6 +1185,7 @@ void BunnyHatch(short Weapon)
for (i = 0; i < MAX_BUNNYS; i++)
{
New = COVERinsertsprite(wp->sectnum, STAT_DEFAULT);
auto actorNew = &swActors[New];
np = &sprite[New];
memset(np,0,sizeof(SPRITE));
np->sectnum = wp->sectnum;
@ -1234,7 +1242,7 @@ void BunnyHatch(short Weapon)
// if I didn't do this here they get stuck in the air sometimes
DoActorZrange(New);
DoActorJump(nu);
DoActorJump(actorNew);
}
}
@ -1247,6 +1255,7 @@ int BunnyHatch2(short Weapon)
USERp nu;
New = COVERinsertsprite(wp->sectnum, STAT_DEFAULT);
auto actorNew = &swActors[New];
np = &sprite[New];
memset(np,0,sizeof(SPRITE));
np->sectnum = wp->sectnum;
@ -1304,15 +1313,16 @@ int BunnyHatch2(short Weapon)
// if I didn't do this here they get stuck in the air sometimes
DoActorZrange(New);
DoActorJump(nu);
DoActorJump(actorNew);
return New;
}
int
DoBunnyMove(USER* u)
DoBunnyMove(DSWActor* actor)
{
auto sp = u->s();
USER* u = actor->u();
auto sp = u->s();
int SpriteNum = u->SpriteNum;
// Parental lock crap
@ -1331,30 +1341,30 @@ DoBunnyMove(USER* u)
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
if (TEST(u->Flags, SPR_JUMPING))
DoActorJump(u);
DoActorJump(actor);
else
DoActorFall(u);
DoActorFall(actor);
}
// if on a player/enemy sprite jump quickly
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
DoBunnyQuickJump(u);
DoBunnyQuickJump(actor);
}
if (TEST(u->Flags, SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
// stay on floor unless doing certain things
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
if (RandomRange(1000) > 985 && sp->pal != PALETTE_PLAYER1 && u->track < 0)
{
@ -1375,7 +1385,7 @@ DoBunnyMove(USER* u)
default:
sp->ang = NORM_ANGLE(RandomRange(2048 << 6) >> 6);
u->jump_speed = -350;
DoActorBeginJump(u);
DoActorBeginJump(actor);
u->ActorActionFunc = DoActorMoveJump;
break;
}
@ -1385,43 +1395,45 @@ DoBunnyMove(USER* u)
}
int
BunnySpew(USER* u)
BunnySpew(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
//InitBloodSpray(SpriteNum,true,-1);
InitBloodSpray(SpriteNum,true,-1);
return 0;
}
int
DoBunnyEat(USER* u)
DoBunnyEat(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
if (TEST(u->Flags, SPR_JUMPING))
DoActorJump(u);
DoActorJump(actor);
else
DoActorFall(u);
DoActorFall(actor);
}
// if on a player/enemy sprite jump quickly
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
DoBunnyQuickJump(u);
DoBunnyQuickJump(actor);
}
if (TEST(u->Flags, SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
// stay on floor unless doing certain things
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
switch (sector[sp->sectnum].floorpicnum)
{
@ -1446,27 +1458,28 @@ DoBunnyEat(USER* u)
}
int
DoBunnyScrew(USER* u)
DoBunnyScrew(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
if (TEST(u->Flags, SPR_JUMPING))
DoActorJump(u);
DoActorJump(actor);
else
DoActorFall(u);
DoActorFall(actor);
}
if (TEST(u->Flags, SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
// stay on floor unless doing certain things
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
if (RandomRange(1000) > 990) // Bunny sex sounds
{
@ -1495,9 +1508,10 @@ DoBunnyScrew(USER* u)
}
int
DoBunnyGrowUp(USER* u)
DoBunnyGrowUp(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if (sp->pal == PALETTE_PLAYER1) return 0; // Don't bother white bunnies

View file

@ -124,7 +124,7 @@ ATTRIBUTE CoolgAttrib =
#define COOLG_RUN_RATE 40
ANIMATOR DoCoolgMove,NullAnimator,DoStayOnFloor, DoActorDebris, NullCoolg, DoCoolgBirth;
ANIMATOR DoCoolgMove,DoStayOnFloor, DoActorDebris, NullCoolg, DoCoolgBirth;
STATE s_CoolgRun[5][4] =
{
@ -585,9 +585,10 @@ NewCoolg(short SpriteNum)
int
DoCoolgBirth(USER* u)
DoCoolgBirth(DSWActor* actor)
{
int New = u->SpriteNum;
USER* u = actor->u();
int New = u->SpriteNum;
ANIMATOR DoActorDecide;
u->Health = HEALTH_COOLIE_GHOST;
@ -608,18 +609,19 @@ DoCoolgBirth(USER* u)
return 0;
}
int NullCoolg(USER* u)
int NullCoolg(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
u->ShellNum -= ACTORMOVETICS;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
DoCoolgMatchPlayerZ(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
@ -707,9 +709,10 @@ int DoCoolgMatchPlayerZ(short SpriteNum)
return 0;
}
int InitCoolgCircle(USER* u)
int InitCoolgCircle(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
u->ActorActionFunc = DoCoolgCircle;
@ -734,14 +737,15 @@ int InitCoolgCircle(USER* u)
u->WaitTics = (RandomRange(3)+1) * 120;
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
return 0;
}
int DoCoolgCircle(USER* u)
int DoCoolgCircle(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int nx,ny,bound;
@ -753,7 +757,7 @@ int DoCoolgCircle(USER* u)
if (!move_actor(SpriteNum, nx, ny, 0L))
{
InitActorReposition(u);
InitActorReposition(actor);
return 0;
}
@ -765,14 +769,14 @@ int DoCoolgCircle(USER* u)
{
// bumped something
u->sz = bound;
InitActorReposition(u);
InitActorReposition(actor);
return 0;
}
// time out
if ((u->WaitTics -= ACTORMOVETICS) < 0)
{
InitActorReposition(u);
InitActorReposition(actor);
u->WaitTics = 0;
return 0;
}
@ -782,9 +786,10 @@ int DoCoolgCircle(USER* u)
int
DoCoolgDeath(USER* u)
DoCoolgDeath(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int nx, ny;
@ -806,7 +811,7 @@ DoCoolgDeath(USER* u)
}
if (TEST(u->Flags, SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
// slide while falling
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
@ -827,9 +832,10 @@ DoCoolgDeath(USER* u)
return 0;
}
int DoCoolgMove(USER* u)
int DoCoolgMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if ((u->ShellNum -= ACTORMOVETICS) <= 0)
@ -892,13 +898,13 @@ int DoCoolgMove(USER* u)
}
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
{
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
}
if (RANDOM_P2(1024) < 32 && !TEST(sp->cstat, CSTAT_SPRITE_INVISIBLE))
@ -906,19 +912,20 @@ int DoCoolgMove(USER* u)
DoCoolgMatchPlayerZ(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int DoCoolgPain(USER* u)
int DoCoolgPain(DSWActor* actor)
{
NullCoolg(u);
USER* u = actor->u();
NullCoolg(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
InitActorDecide(u);
InitActorDecide(actor);
return 0;
}

View file

@ -558,9 +558,10 @@ SetupCoolie(short SpriteNum)
int NewCoolg(short);
int SpawnCoolg(USER* u)
int SpawnCoolg(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
// Don't do a ghost every time
if (RandomRange(1000) > 700 || Skill < MinEnemySkill - 1)
@ -575,55 +576,58 @@ int SpawnCoolg(USER* u)
return 0;
}
int CooliePain(USER* u)
int CooliePain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
InitActorDecide(u);
InitActorDecide(actor);
return 0;
}
int NullCoolie(USER* u)
int NullCoolie(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int DoCoolieMove(USER* u)
int DoCoolieMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
KeepActorOnFloor(SpriteNum);
if (DoActorSectorDamage(u))
if (DoActorSectorDamage(actor))
{
return 0;
}
@ -639,9 +643,10 @@ int DoCoolieMove(USER* u)
return 0;
}
int InitCoolieCharge(USER* u)
int InitCoolieCharge(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if (RANDOM_P2(1024) > 950)
@ -649,7 +654,7 @@ int InitCoolieCharge(USER* u)
DoActorSetSpeed(SpriteNum, FAST_SPEED);
InitActorMoveCloser(u);
InitActorMoveCloser(actor);
NewStateGroup(SpriteNum, sg_CoolieCharge);
@ -658,9 +663,10 @@ int InitCoolieCharge(USER* u)
int
DoCoolieWaitBirth(USER* u)
DoCoolieWaitBirth(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if ((u->Counter -= ACTORMOVETICS) <= 0)
{

View file

@ -118,7 +118,7 @@ ATTRIBUTE EelAttrib =
#define EEL_RUN_RATE 20
ANIMATOR DoEelMove,NullAnimator,DoStayOnFloor, DoActorDebris, NullEel;
ANIMATOR DoEelMove,DoStayOnFloor, DoActorDebris, NullEel;
STATE s_EelRun[5][4] =
{
@ -354,7 +354,7 @@ ACTOR_ACTION_SET EelActionSet =
nullptr
};
int DoEelMatchPlayerZ(USER* SpriteNum);
int DoEelMatchPlayerZ(DSWActor* actor);
void
@ -411,55 +411,26 @@ SetupEel(short SpriteNum)
return 0;
}
#if 0
int
NewEel(USER* u)
int NullEel(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
USERp nu;
SPRITEp np;
ANIMATOR DoActorDecide;
short New;
New = SpawnSprite(STAT_ENEMY, EEL_RUN_R0, &s_EelBirth, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 50);
nu = User[New].Data();
np = &sprite[New];
ChangeState(New, &s_EelBirth);
nu->StateEnd = s_EelDie;
nu->Rot = sg_EelRun;
np->pal = nu->spal = u->spal;
nu->ActorActionSet = &EelActionSet;
np->shade = sp->shade;
EelCommon(New);
return 0;
}
#endif
int NullEel(USER* u)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
DoEelMatchPlayerZ(u);
DoEelMatchPlayerZ(actor);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int DoEelMatchPlayerZ(USER* u)
int DoEelMatchPlayerZ(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
SPRITEp tsp = User[SpriteNum]->tgt_sp;
int zdiff,zdist;
@ -558,9 +529,10 @@ int DoEelMatchPlayerZ(USER* u)
}
int
DoEelDeath(USER* u)
DoEelDeath(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int nx, ny;
if (TEST(u->Flags, SPR_FALLING))
@ -575,7 +547,7 @@ DoEelDeath(USER* u)
}
if (TEST(u->Flags, SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
// slide while falling
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
@ -599,9 +571,10 @@ DoEelDeath(USER* u)
return 0;
}
int DoEelMove(USER* u)
int DoEelMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
ASSERT(u->Rot != nullptr);
@ -609,16 +582,16 @@ int DoEelMove(USER* u)
NewStateGroup(SpriteNum, u->ActorActionSet->CloseAttack[0]);
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
DoEelMatchPlayerZ(u);
DoEelMatchPlayerZ(actor);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;

View file

@ -527,8 +527,8 @@ typedef struct PANEL_SPRITEstruct PANEL_SPRITE, *PANEL_SPRITEp;
struct ANIMstruct;
typedef struct ANIMstruct ANIM, *ANIMp;
struct USER;
typedef int ANIMATOR (USER* SpriteNum);
class DSWActor;
typedef int ANIMATOR (DSWActor* actor);
typedef ANIMATOR *ANIMATORp;
typedef void pANIMATOR (PANEL_SPRITEp);
@ -567,7 +567,7 @@ struct STATEstruct
typedef enum {WATER_FOOT, BLOOD_FOOT} FOOT_TYPE;
extern FOOT_TYPE FootMode;
int QueueFloorBlood(USER* hit_sprite); // Weapon.c
ANIMATOR QueueFloorBlood; // Weapon.c
int QueueFootPrint(short hit_sprite); // Weapon.c
int QueueGeneric(short SpriteNum, short pic); // Weapon.c
int QueueLoWangs(short SpriteNum); // Weapon.c
@ -2225,5 +2225,8 @@ struct GameInterface : public ::GameInterface
END_SW_NS
#include "swactor.h"
#endif

View file

@ -750,29 +750,30 @@ SetupGirlNinja(short SpriteNum)
int
DoGirlNinjaMove(USER* u)
DoGirlNinjaMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
// jumping and falling
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING) && !TEST(u->Flags, SPR_CLIMBING))
{
if (TEST(u->Flags, SPR_JUMPING))
DoActorJump(u);
DoActorJump(actor);
else if (TEST(u->Flags, SPR_FALLING))
DoActorFall(u);
DoActorFall(actor);
}
// sliding
if (TEST(u->Flags, SPR_SLIDING) && !TEST(u->Flags, SPR_CLIMBING))
DoActorSlide(u);
DoActorSlide(actor);
// !AIC - do track or call current action function - such as DoActorMoveCloser()
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
{
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
}
// stay on floor unless doing certain things
@ -782,15 +783,16 @@ DoGirlNinjaMove(USER* u)
}
// take damage from environment
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int
GirlNinjaJumpActionFunc(USER* u)
GirlNinjaJumpActionFunc(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
@ -806,46 +808,49 @@ GirlNinjaJumpActionFunc(USER* u)
if (!TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
{
InitActorDecide(u);
InitActorDecide(actor);
}
return 0;
}
int
NullGirlNinja(USER* u)
NullGirlNinja(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (u->WaitTics > 0) u->WaitTics -= ACTORMOVETICS;
if (TEST(u->Flags, SPR_SLIDING) && !TEST(u->Flags, SPR_CLIMBING) && !TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
DoActorSlide(u);
DoActorSlide(actor);
if (!TEST(u->Flags, SPR_CLIMBING) && !TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int DoGirlNinjaPain(USER* u)
int DoGirlNinjaPain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullGirlNinja(u);
NullGirlNinja(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
InitActorDecide(u);
InitActorDecide(actor);
return 0;
}
int DoGirlNinjaSpecial(USER* u)
int DoGirlNinjaSpecial(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if (u->spal == PALETTE_PLAYER5)

View file

@ -118,7 +118,7 @@ ATTRIBUTE GoroAttrib =
#define GORO_RUN_RATE 18
ANIMATOR DoGoroMove,NullGoro,DoActorDebris,NullAnimator,InitEnemyFireball;
ANIMATOR DoGoroMove,NullGoro,DoActorDebris,InitEnemyFireball;
STATE s_GoroRun[5][4] =
{
@ -513,47 +513,49 @@ SetupGoro(short SpriteNum)
return 0;
}
int NullGoro(USER* u)
int NullGoro(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int DoGoroPain(USER* u)
int DoGoroPain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
NullGoro(u);
USER* u = actor->u();
NullGoro(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
InitActorDecide(u);
InitActorDecide(actor);
return 0;
}
int DoGoroMove(USER* u)
int DoGoroMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
ASSERT(User[SpriteNum].Data());
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}

View file

@ -332,16 +332,17 @@ SetupHornet(short SpriteNum)
return 0;
}
int NullHornet(USER* u)
int NullHornet(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
DoHornetMatchPlayerZ(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
@ -421,9 +422,10 @@ int DoHornetMatchPlayerZ(short SpriteNum)
return 0;
}
int InitHornetCircle(USER* u)
int InitHornetCircle(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
u->ActorActionFunc = DoHornetCircle;
@ -448,14 +450,15 @@ int InitHornetCircle(USER* u)
u->WaitTics = (RandomRange(3)+1) * 60;
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
return 0;
}
int DoHornetCircle(USER* u)
int DoHornetCircle(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int nx,ny,bound;
@ -476,7 +479,7 @@ int DoHornetCircle(USER* u)
if (!move_actor(SpriteNum, nx, ny, 0L))
{
InitActorReposition(u);
InitActorReposition(actor);
return 0;
}
}
@ -489,14 +492,14 @@ int DoHornetCircle(USER* u)
{
// bumped something
u->sz = bound;
InitActorReposition(u);
InitActorReposition(actor);
return 0;
}
// time out
if ((u->WaitTics -= ACTORMOVETICS) < 0)
{
InitActorReposition(u);
InitActorReposition(actor);
u->WaitTics = 0;
return 0;
}
@ -506,9 +509,10 @@ int DoHornetCircle(USER* u)
int
DoHornetDeath(USER* u)
DoHornetDeath(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int nx, ny;
@ -528,7 +532,7 @@ DoHornetDeath(USER* u)
}
if (TEST(u->Flags, SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
// slide while falling
nx = MulScale(sp->xvel, bcos(sp->ang), 14);
@ -550,9 +554,10 @@ DoHornetDeath(USER* u)
}
// Hornets can swarm around other hornets or whatever is tagged as swarm target
int DoCheckSwarm(USER* u)
int DoCheckSwarm(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
int i;
SPRITEp sp = &sprite[SpriteNum], tsp;
USERp tu;
@ -597,28 +602,29 @@ int DoCheckSwarm(USER* u)
}
int DoHornetMove(USER* u)
int DoHornetMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
// Check for swarming
// lotag of 1 = Swarm around lotags of 2
// lotag of 0 is normal
if (sp->hitag == TAG_SWARMSPOT && sp->lotag == 1)
DoCheckSwarm(u);
DoCheckSwarm(actor);
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
DoHornetMatchPlayerZ(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}

View file

@ -43,7 +43,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
ANIMATOR NullAnimator,DoSuicide;
ANIMATOR DoSuicide;
ANIMATOR DoBloodSpray;
int SpawnFlashBombOnActor(int16_t enemy);
@ -257,8 +257,9 @@ STATE s_BloodSprayDrip[] =
/////////////////////////////////////////////////////////////////////////////////////////////
int
DoWallBloodDrip(USER* u)
DoWallBloodDrip(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
@ -366,8 +367,9 @@ SpawnFloorSplash(short SpriteNum)
int
DoBloodSpray(USER* u)
DoBloodSpray(DSWActor* actor)
{
USER* u = actor->u();
int Weapon = u->SpriteNum;
SPRITEp sp = &sprite[Weapon];
int cz,fz;
@ -593,8 +595,9 @@ DoBloodSpray(USER* u)
int
DoPhosphorus(USER* u)
DoPhosphorus(DSWActor* actor)
{
USER* u = actor->u();
int Weapon = u->SpriteNum;
SPRITEp sp = &sprite[Weapon];
@ -817,8 +820,9 @@ DoPhosphorus(USER* u)
}
int
DoChemBomb(USER* u)
DoChemBomb(DSWActor* actor)
{
USER* u = actor->u();
int Weapon = u->SpriteNum;
SPRITEp sp = &sprite[Weapon];
@ -1063,8 +1067,9 @@ DoChemBomb(USER* u)
}
int
DoCaltropsStick(USER* u)
DoCaltropsStick(DSWActor* actor)
{
USER* u = actor->u();
int Weapon = u->SpriteNum;
u->Counter = !u->Counter;
@ -1076,8 +1081,9 @@ DoCaltropsStick(USER* u)
}
int
DoCaltrops(USER* u)
DoCaltrops(DSWActor* actor)
{
USER* u = actor->u();
int Weapon = u->SpriteNum;
SPRITEp sp = &sprite[Weapon];
@ -1332,8 +1338,9 @@ SpawnRadiationCloud(short SpriteNum)
}
int
DoRadiationCloud(USER* u)
DoRadiationCloud(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
@ -1642,8 +1649,9 @@ PlayerInitFlashBomb(PLAYERp pp)
}
int
InitFlashBomb(USER* u)
InitFlashBomb(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int i;
@ -2083,8 +2091,9 @@ InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity)
}
int
BloodSprayFall(USER* u)
BloodSprayFall(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
@ -2174,8 +2183,9 @@ DoFlagRangeTest(short Weapon, short range)
}
int
DoCarryFlag(USER* u)
DoCarryFlag(DSWActor* actor)
{
USER* u = actor->u();
int Weapon = u->SpriteNum;
SPRITEp sp = &sprite[Weapon];
@ -2329,8 +2339,9 @@ DoCarryFlag(USER* u)
}
int
DoCarryFlagNoDet(USER* u)
DoCarryFlagNoDet(DSWActor* actor)
{
USER* u = actor->u();
int Weapon = u->SpriteNum;
SPRITEp sp = &sprite[Weapon];
@ -2420,8 +2431,9 @@ SetCarryFlag(int16_t Weapon)
}
int
DoFlag(USER* u)
DoFlag(DSWActor* actor)
{
USER* u = actor->u();
int Weapon = u->SpriteNum;
SPRITEp sp = &sprite[Weapon];
int16_t hit_sprite = -1;

View file

@ -485,34 +485,36 @@ SetupLava(short SpriteNum)
return 0;
}
int NullLava(USER* u)
int NullLava(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int DoLavaMove(USER* u)
int DoLavaMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}

View file

@ -66,8 +66,8 @@ int DoJump(short SpriteNum);
int DoBeginFall(short SpriteNum);
int DoFall(short SpriteNum);
void KeepActorOnFloor(short SpriteNum);
int DoActorSlide(USERp SpriteNum);
int DoActorSectorDamage(USERp SpriteNum);
int DoActorSlide(DSWActor* actor);
int DoActorSectorDamage(DSWActor* actor);
int DoScaleSprite(short SpriteNum);
void InitPlayerSprite(PLAYERp pp);

View file

@ -149,9 +149,10 @@ SetupToiletGirl(short SpriteNum)
return 0;
}
int DoToiletGirl(USER* u)
int DoToiletGirl(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -201,15 +202,16 @@ int DoToiletGirl(USER* u)
}
// take damage from environment
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
sp->xvel = sp->yvel = sp->zvel = 0;
return 0;
}
int NullToiletGirl(USER* u)
int NullToiletGirl(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -239,9 +241,10 @@ int NullToiletGirl(USER* u)
return 0;
}
int ToiletGirlUzi(USER* u)
int ToiletGirlUzi(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
@ -256,11 +259,12 @@ int ToiletGirlUzi(USER* u)
return 0;
}
int ToiletGirlPain(USER* u)
int ToiletGirlPain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullToiletGirl(u);
NullToiletGirl(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
ChangeState(SpriteNum,s_ToiletGirlStand);
@ -388,9 +392,10 @@ SetupWashGirl(short SpriteNum)
return 0;
}
int DoWashGirl(USER* u)
int DoWashGirl(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -446,15 +451,16 @@ int DoWashGirl(USER* u)
}
// take damage from environment
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
sp->xvel = sp->yvel = sp->zvel = 0;
return 0;
}
int NullWashGirl(USER* u)
int NullWashGirl(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -484,9 +490,10 @@ int NullWashGirl(USER* u)
return 0;
}
int WashGirlUzi(USER* u)
int WashGirlUzi(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
@ -501,10 +508,11 @@ int WashGirlUzi(USER* u)
return 0;
}
int WashGirlPain(USER* u)
int WashGirlPain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
NullWashGirl(u);
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullWashGirl(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
ChangeState(SpriteNum,s_WashGirlStand);
@ -596,16 +604,17 @@ SetupTrashCan(short SpriteNum)
return 0;
}
int DoTrashCan(USER* u)
int DoTrashCan(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
//(*u->ActorActionFunc) (SpriteNum);
// stay on floor unless doing certain things
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING | SPR_CLIMBING))
{
@ -617,12 +626,13 @@ int DoTrashCan(USER* u)
return 0;
}
int TrashCanPain(USER* u)
int TrashCanPain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
@ -704,9 +714,10 @@ SetupPachinkoLight(short SpriteNum)
return 0;
}
int PachinkoLightOperate(USER* u)
int PachinkoLightOperate(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
@ -803,9 +814,10 @@ SetupPachinko1(short SpriteNum)
return 0;
}
int PachinkoCheckWin(USER* u)
int PachinkoCheckWin(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
u->WaitTics = 0; // Can operate it again now
@ -868,8 +880,9 @@ int PachinkoCheckWin(USER* u)
return 0;
}
int Pachinko1Operate(USER* u)
int Pachinko1Operate(DSWActor* actor)
{
USER* u = actor->u();
SPRITEp sp = u->s();
short rnd;
@ -1259,9 +1272,10 @@ SetupCarGirl(short SpriteNum)
return 0;
}
int DoCarGirl(USER* u)
int DoCarGirl(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -1302,15 +1316,16 @@ int DoCarGirl(USER* u)
}
// take damage from environment
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
sp->xvel = sp->yvel = sp->zvel = 0;
return 0;
}
int NullCarGirl(USER* u)
int NullCarGirl(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -1347,9 +1362,10 @@ int NullCarGirl(USER* u)
return 0;
}
int CarGirlUzi(USER* u)
int CarGirlUzi(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
@ -1364,10 +1380,11 @@ int CarGirlUzi(USER* u)
return 0;
}
int CarGirlPain(USER* u)
int CarGirlPain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
NullCarGirl(u);
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullCarGirl(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
ChangeState(SpriteNum,s_CarGirlStand);
@ -1477,9 +1494,10 @@ SetupMechanicGirl(short SpriteNum)
return 0;
}
int DoMechanicGirl(USER* u)
int DoMechanicGirl(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -1520,15 +1538,16 @@ int DoMechanicGirl(USER* u)
}
// take damage from environment
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
sp->xvel = sp->yvel = sp->zvel = 0;
return 0;
}
int NullMechanicGirl(USER* u)
int NullMechanicGirl(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -1565,9 +1584,10 @@ int NullMechanicGirl(USER* u)
return 0;
}
int MechanicGirlDrill(USER* u)
int MechanicGirlDrill(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
@ -1581,11 +1601,12 @@ int MechanicGirlDrill(USER* u)
return 0;
}
int MechanicGirlPain(USER* u)
int MechanicGirlPain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullMechanicGirl(u);
NullMechanicGirl(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
ChangeState(SpriteNum,s_MechanicGirlStand);
@ -1696,9 +1717,10 @@ SetupSailorGirl(short SpriteNum)
return 0;
}
int DoSailorGirl(USER* u)
int DoSailorGirl(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -1743,15 +1765,16 @@ int DoSailorGirl(USER* u)
}
// take damage from environment
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
sp->xvel = sp->yvel = sp->zvel = 0;
return 0;
}
int NullSailorGirl(USER* u)
int NullSailorGirl(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
static short alreadythrew = 0;
@ -1793,9 +1816,10 @@ int NullSailorGirl(USER* u)
return 0;
}
int SailorGirlThrow(USER* u)
int SailorGirlThrow(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
@ -1810,10 +1834,11 @@ int SailorGirlThrow(USER* u)
return 0;
}
int SailorGirlPain(USER* u)
int SailorGirlPain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
NullSailorGirl(u);
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullSailorGirl(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
ChangeState(SpriteNum,s_SailorGirlStand);
@ -1907,9 +1932,10 @@ SetupPruneGirl(short SpriteNum)
return 0;
}
int DoPruneGirl(USER* u)
int DoPruneGirl(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -1966,15 +1992,16 @@ int DoPruneGirl(USER* u)
}
// take damage from environment
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
sp->xvel = sp->yvel = sp->zvel = 0;
return 0;
}
int NullPruneGirl(USER* u)
int NullPruneGirl(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -2010,9 +2037,10 @@ int NullPruneGirl(USER* u)
return 0;
}
int PruneGirlUzi(USER* u)
int PruneGirlUzi(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
@ -2027,11 +2055,12 @@ int PruneGirlUzi(USER* u)
return 0;
}
int PruneGirlPain(USER* u)
int PruneGirlPain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullPruneGirl(u);
NullPruneGirl(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
ChangeState(SpriteNum,s_PruneGirlStand);

View file

@ -1939,9 +1939,10 @@ SetupNinja(short SpriteNum)
}
int
DoNinjaHariKari(USER* u)
DoNinjaHariKari(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
short cnt,i;
@ -1969,9 +1970,10 @@ DoNinjaHariKari(USER* u)
}
int
DoNinjaGrabThroat(USER* u)
DoNinjaGrabThroat(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
@ -1995,7 +1997,7 @@ DoNinjaGrabThroat(USER* u)
ChangeState(SpriteNum, u->StateEnd);
sp->xvel = 0;
//u->jump_speed = -300;
//DoActorBeginJump(u);
//DoActorBeginJump(actor);
PlaySound(DIGI_NINJASCREAM, sp, v3df_follow);
}
@ -2009,9 +2011,10 @@ DoNinjaGrabThroat(USER* u)
*/
int
DoNinjaMove(USER* u)
DoNinjaMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags2, SPR2_DYING))
{
@ -2026,21 +2029,21 @@ DoNinjaMove(USER* u)
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING) && !TEST(u->Flags, SPR_CLIMBING))
{
if (TEST(u->Flags, SPR_JUMPING))
DoActorJump(u);
DoActorJump(actor);
else if (TEST(u->Flags, SPR_FALLING))
DoActorFall(u);
DoActorFall(actor);
}
// sliding
if (TEST(u->Flags, SPR_SLIDING) && !TEST(u->Flags, SPR_CLIMBING))
DoActorSlide(u);
DoActorSlide(actor);
// !AIC - do track or call current action function - such as DoActorMoveCloser()
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
{
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
}
// stay on floor unless doing certain things
@ -2050,15 +2053,16 @@ DoNinjaMove(USER* u)
}
// take damage from environment
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int
NinjaJumpActionFunc(USER* u)
NinjaJumpActionFunc(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
@ -2074,7 +2078,7 @@ NinjaJumpActionFunc(USER* u)
if (!TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
{
InitActorDecide(u);
InitActorDecide(actor);
}
return 0;
@ -2088,29 +2092,31 @@ NinjaJumpActionFunc(USER* u)
*/
int
NullNinja(USER* u)
NullNinja(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (u->WaitTics > 0) u->WaitTics -= ACTORMOVETICS;
if (TEST(u->Flags, SPR_SLIDING) && !TEST(u->Flags, SPR_CLIMBING) && !TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
DoActorSlide(u);
DoActorSlide(actor);
if (!TEST(u->Flags, SPR_CLIMBING) && !TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int DoNinjaPain(USER* u)
int DoNinjaPain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullNinja(u);
NullNinja(actor);
if (TEST(u->Flags2, SPR2_DYING))
{
@ -2122,14 +2128,15 @@ int DoNinjaPain(USER* u)
}
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
InitActorDecide(u);
InitActorDecide(actor);
return 0;
}
int DoNinjaSpecial(USER* u)
int DoNinjaSpecial(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if (u->spal == PALETTE_PLAYER5)
@ -2142,21 +2149,23 @@ int DoNinjaSpecial(USER* u)
return 0;
}
int CheckFire(USER* u)
int CheckFire(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (!CanSeePlayer(SpriteNum))
InitActorDuck(u);
InitActorDuck(actor);
return 0;
}
int
DoNinjaCeiling(USER* u)
DoNinjaCeiling(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}

View file

@ -97,7 +97,6 @@ char UziRecoilYadj = 0;
extern short screenpeek;
ANIMATOR NullAnimator;
pANIMATOR pNullAnimator;
int InitStar(PLAYERp);
int ChangeWeapon(PLAYERp);
@ -105,7 +104,7 @@ int ChangeWeapon(PLAYERp);
ANIMATOR InitFire;
int
NullAnimator(USER*)
NullAnimator(DSWActor*)
{
return 0;
}

View file

@ -197,7 +197,7 @@ extern short target_ang;
#if 1
#define PLAYER_NINJA_RATE 14
int DoFootPrints(USERp SpriteNum);
int DoFootPrints(DSWActor* actor);
STATE s_PlayerNinjaRun[5][6] =
{
@ -360,7 +360,7 @@ STATEp sg_PlayerNinjaStand[] =
#define PLAYER_NINJA_STAR_RATE 12
extern STATEp sg_NinjaRun[];
int DoPlayerSpriteReset(USERp SpriteNum);
int DoPlayerSpriteReset(DSWActor* actor);
#if 0
STATE s_PlayerNinjaThrow[5][4] =
@ -1077,9 +1077,10 @@ DoPlayerSpriteThrow(PLAYERp pp)
}
int
DoPlayerSpriteReset(USER* u)
DoPlayerSpriteReset(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
PLAYERp pp;
if (!u->PlayerP)
@ -2620,6 +2621,7 @@ DriveCrush(PLAYERp pp, int *x, int *y)
StatIterator it2(STAT_ENEMY);
while ((i = it2.NextIndex()) >= 0)
{
auto actor = &swActors[i];
sp = &sprite[i];
auto u = User[i].Data();
@ -2633,7 +2635,7 @@ DriveCrush(PLAYERp pp, int *x, int *y)
if (vel < 9000)
{
DoActorBeginSlide(i, getangle(pp->xvect, pp->yvect), vel/8, 5);
if (DoActorSlide(u))
if (DoActorSlide(actor))
continue;
}
@ -6771,6 +6773,7 @@ PlayerStateControl(int16_t SpriteNum)
return;
// Convienience var
auto actor = &swActors[SpriteNum];
u = User[SpriteNum].Data();
if (u == nullptr)
@ -6793,7 +6796,7 @@ PlayerStateControl(int16_t SpriteNum)
while (TEST(u->State->Tics, SF_QUICK_CALL))
{
// Call it once and go to the next state
(*u->State->Animator)(u);
(*u->State->Animator)(actor);
// if still on the same QUICK_CALL should you
// go to the next state.
@ -6817,7 +6820,7 @@ PlayerStateControl(int16_t SpriteNum)
// Call the correct animator
if (TEST(u->State->Tics, SF_PLAYER_FUNC))
if (u->State->Animator)
(*u->State->Animator)(u);
(*u->State->Animator)(actor);
return;
}
@ -7474,8 +7477,9 @@ InitMultiPlayerInfo(void)
// If player stepped in something gooey, track it all over the place.
int
DoFootPrints(USER* u)
DoFootPrints(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (u->PlayerP)

View file

@ -39,7 +39,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
ANIMATOR InitRipperHang;
ANIMATOR DoActorMoveJump;
ANIMATOR DoRipperMoveJump;
ANIMATOR DoRipperHangJF;
ANIMATOR DoRipperQuickJump;
@ -553,7 +552,7 @@ STATEp sg_RipperFall[] =
//////////////////////
#define RIPPER_JUMP_ATTACK_RATE 35
int DoRipperBeginJumpAttack(USERp SpriteNum);
int DoRipperBeginJumpAttack(DSWActor* actor);
STATE s_RipperJumpAttack[5][6] =
{
@ -937,9 +936,10 @@ PickJumpMaxSpeed(short SpriteNum, short max_speed)
//
int
InitRipperHang(USER* u)
InitRipperHang(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int dist;
@ -976,7 +976,7 @@ InitRipperHang(USER* u)
if (!Found)
{
InitActorDecide(u);
InitActorDecide(actor);
return 0;
}
@ -999,9 +999,10 @@ InitRipperHang(USER* u)
}
int
DoRipperHang(USER* u)
DoRipperHang(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if ((u->WaitTics -= ACTORMOVETICS) > 0)
return 0;
@ -1013,9 +1014,10 @@ DoRipperHang(USER* u)
}
int
DoRipperMoveHang(USER* u)
DoRipperMoveHang(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int nx, ny;
@ -1053,9 +1055,10 @@ DoRipperMoveHang(USER* u)
int
DoRipperHangJF(USER* u)
DoRipperHangJF(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
@ -1067,13 +1070,13 @@ DoRipperHangJF(USER* u)
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
if (DoRipperQuickJump(u))
if (DoRipperQuickJump(actor))
return 0;
InitActorDecide(u);
InitActorDecide(actor);
}
DoRipperMoveHang(u);
DoRipperMoveHang(actor);
return 0;
@ -1084,9 +1087,10 @@ DoRipperHangJF(USER* u)
//
int
DoRipperBeginJumpAttack(USER* u)
DoRipperBeginJumpAttack(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
SPRITEp psp = User[SpriteNum]->tgt_sp;
short tang;
@ -1119,9 +1123,10 @@ DoRipperBeginJumpAttack(USER* u)
}
int
DoRipperMoveJump(USER* u)
DoRipperMoveJump(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
@ -1133,13 +1138,13 @@ DoRipperMoveJump(USER* u)
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
if (DoRipperQuickJump(u))
if (DoRipperQuickJump(actor))
return 0;
InitActorDecide(u);
InitActorDecide(actor);
}
DoRipperMoveHang(u);
DoRipperMoveHang(actor);
return 0;
}
@ -1148,9 +1153,10 @@ DoRipperMoveJump(USER* u)
//
int
DoRipperQuickJump(USER* u)
DoRipperQuickJump(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
// Tests to see if ripper is on top of a player/enemy and then immediatly
// does another jump
@ -1172,27 +1178,29 @@ DoRipperQuickJump(USER* u)
int
NullRipper(USER* u)
NullRipper(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int DoRipperPain(USER* u)
int DoRipperPain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullRipper(u);
NullRipper(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
InitActorDecide(u);
InitActorDecide(actor);
return 0;
}
@ -1217,11 +1225,12 @@ int DoRipperRipHeart(short SpriteNum)
//int DoRipperStandHeart(SpriteNum)
int DoRipperStandHeart(USER* u)
int DoRipperStandHeart(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullRipper(u);
NullRipper(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
NewStateGroup(SpriteNum, sg_RipperRun);
@ -1280,9 +1289,10 @@ void RipperHatch(short Weapon)
}
int
DoRipperMove(USER* u)
DoRipperMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (u->scale_speed)
{
@ -1300,21 +1310,21 @@ DoRipperMove(USER* u)
// if on a player/enemy sprite jump quickly
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
if (DoRipperQuickJump(u))
if (DoRipperQuickJump(actor))
return 0;
KeepActorOnFloor(SpriteNum);
}
if (TEST(u->Flags, SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}

View file

@ -38,7 +38,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
ANIMATOR InitRipper2Hang;
ANIMATOR DoActorMoveJump;
ANIMATOR DoRipper2MoveJump;
ANIMATOR DoRipper2HangJF;
ANIMATOR DoRipper2QuickJump;
@ -608,7 +607,7 @@ STATEp sg_Ripper2Fall[] =
//////////////////////
#define RIPPER2_JUMP_ATTACK_RATE 35
int DoRipper2BeginJumpAttack(USERp SpriteNum);
int DoRipper2BeginJumpAttack(DSWActor* actor);
STATE s_Ripper2JumpAttack[5][6] =
{
@ -935,9 +934,10 @@ SetupRipper2(short SpriteNum)
//
int
InitRipper2Hang(USER* u)
InitRipper2Hang(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int dist;
@ -973,7 +973,7 @@ InitRipper2Hang(USER* u)
if (!Found)
{
InitActorDecide(u);
InitActorDecide(actor);
return 0;
}
@ -996,9 +996,10 @@ InitRipper2Hang(USER* u)
}
int
DoRipper2Hang(USER* u)
DoRipper2Hang(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if ((u->WaitTics -= ACTORMOVETICS) > 0)
return 0;
@ -1011,9 +1012,10 @@ DoRipper2Hang(USER* u)
}
int
DoRipper2MoveHang(USER* u)
DoRipper2MoveHang(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int nx, ny;
@ -1058,9 +1060,10 @@ DoRipper2MoveHang(USER* u)
int
DoRipper2HangJF(USER* u)
DoRipper2HangJF(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
@ -1072,13 +1075,13 @@ DoRipper2HangJF(USER* u)
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
if (DoRipper2QuickJump(u))
if (DoRipper2QuickJump(actor))
return 0;
InitActorDecide(u);
InitActorDecide(actor);
}
DoRipper2MoveHang(u);
DoRipper2MoveHang(actor);
return 0;
@ -1089,9 +1092,10 @@ DoRipper2HangJF(USER* u)
//
int
DoRipper2BeginJumpAttack(USER* u)
DoRipper2BeginJumpAttack(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
SPRITEp psp = User[SpriteNum]->tgt_sp;
short tang;
@ -1131,9 +1135,10 @@ DoRipper2BeginJumpAttack(USER* u)
}
int
DoRipper2MoveJump(USER* u)
DoRipper2MoveJump(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
@ -1145,13 +1150,13 @@ DoRipper2MoveJump(USER* u)
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
if (DoRipper2QuickJump(u))
if (DoRipper2QuickJump(actor))
return 0;
InitActorDecide(u);
InitActorDecide(actor);
}
DoRipper2MoveHang(u);
DoRipper2MoveHang(actor);
return 0;
}
@ -1160,9 +1165,10 @@ DoRipper2MoveJump(USER* u)
//
int
DoRipper2QuickJump(USER* u)
DoRipper2QuickJump(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
// Tests to see if ripper2 is on top of a player/enemy and then immediatly
// does another jump
@ -1185,26 +1191,28 @@ DoRipper2QuickJump(USER* u)
int
NullRipper2(USER* u)
NullRipper2(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int DoRipper2Pain(USER* u)
int DoRipper2Pain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
NullRipper2(u);
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullRipper2(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
InitActorDecide(u);
InitActorDecide(actor);
return 0;
}
@ -1224,12 +1232,13 @@ int DoRipper2RipHeart(short SpriteNum)
return 0;
}
int DoRipper2StandHeart(USER* u)
int DoRipper2StandHeart(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
NullRipper2(u);
NullRipper2(actor);
if (!SoundValidAndActive(sp, CHAN_RipHeart))
PlaySound(DIGI_RIPPER2HEARTOUT, sp, v3df_none, CHAN_RipHeart);
@ -1294,13 +1303,14 @@ void Ripper2Hatch(short Weapon)
}
int
DoRipper2Move(USER* u)
DoRipper2Move(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if (sp->hitag == TAG_SWARMSPOT && sp->lotag == 1)
DoCheckSwarm(u);
DoCheckSwarm(actor);
if (u->scale_speed)
{
@ -1318,41 +1328,43 @@ DoRipper2Move(USER* u)
// if on a player/enemy sprite jump quickly
if (!TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
if (DoRipper2QuickJump(u))
if (DoRipper2QuickJump(actor))
return 0;
KeepActorOnFloor(SpriteNum);
}
if (TEST(u->Flags, SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int InitRipper2Charge(USER* u)
int InitRipper2Charge(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
DoActorSetSpeed(SpriteNum, FAST_SPEED);
InitActorMoveCloser(u);
InitActorMoveCloser(actor);
NewStateGroup(SpriteNum, sg_Ripper2RunFast);
return 0;
}
int ChestRipper2(USER* u)
int ChestRipper2(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
PlaySound(DIGI_RIPPER2CHEST, sp, v3df_follow);

View file

@ -433,8 +433,9 @@ int DoRotatorMove(short SpriteNum)
return 0;
}
int DoRotator(USER* u)
int DoRotator(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
// could move this inside sprite control

View file

@ -51,7 +51,7 @@ BEGIN_SW_NS
#define LAVAMAXDROPS 32
#define DEFAULT_DOOR_SPEED 800
int InitFireballTrap(USER* SpriteNum);
int InitFireballTrap(DSWActor* actor);
ANIMATOR DoGrating;
void DoPlayerBeginForceJump(PLAYERp);
@ -1112,9 +1112,10 @@ DoExplodeSector(short match)
}
int DoSpawnSpot(USER* u)
int DoSpawnSpot(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if ((u->WaitTics -= synctics) < 0)
{
@ -2029,6 +2030,7 @@ int DoTrapMatch(short match)
StatIterator it(STAT_TRAP);
while ((i = it.NextIndex()) >= 0)
{
auto actor = &swActors[i];
sp = &sprite[i];
u = User[i].Data();
@ -2043,7 +2045,7 @@ int DoTrapMatch(short match)
if (u->WaitTics <= 0)
{
u->WaitTics = 1 * 120;
InitFireballTrap(u);
InitFireballTrap(actor);
}
}
@ -2055,7 +2057,7 @@ int DoTrapMatch(short match)
if (u->WaitTics <= 0)
{
u->WaitTics = 1 * 120;
InitBoltTrap(u);
InitBoltTrap(actor);
}
}
@ -2225,56 +2227,7 @@ OperateContinuousTrigger(PLAYERp pp)
{
case TAG_TRIGGER_MISSILE_TRAP:
{
#if 1
DoTrapMatch(sector[pp->cursectnum].hitag);
#else
int i;
SPRITEp sp;
USERp u;
StatIterator it(STAT_TRAP);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i].Data();
// if correct type and matches
if (sp->hitag == FIREBALL_TRAP && sp->lotag == sector[pp->cursectnum].hitag)
{
u->WaitTics -= synctics;
if (u->WaitTics <= 0)
{
u->WaitTics = 1 * 120;
InitFireballTrap(u);
}
}
// if correct type and matches
if (sp->hitag == BOLT_TRAP && sp->lotag == sector[pp->cursectnum].hitag)
{
u->WaitTics -= synctics;
if (u->WaitTics <= 0)
{
u->WaitTics = 1 * 120;
InitBoltTrap(u);
}
}
// if correct type and matches
if (sp->hitag == SPEAR_TRAP && sp->lotag == sector[pp->cursectnum].hitag)
{
u->WaitTics -= synctics;
if (u->WaitTics <= 0)
{
u->WaitTics = 1 * 120;
InitSpearTrap(i);
}
}
}
#endif
break;
}

View file

@ -753,31 +753,33 @@ SetupSerp(short SpriteNum)
return 0;
}
int NullSerp(USER* u)
int NullSerp(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
KeepActorOnFloor(SpriteNum);
//DoActorSectorDamage(u);
//DoActorSectorDamage(actor);
return 0;
}
int DoSerpMove(USER* u)
int DoSerpMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
// serp ring
if (sp->pal != 16)
@ -804,13 +806,14 @@ int DoSerpMove(USER* u)
KeepActorOnFloor(SpriteNum);
//DoActorSectorDamage(u);
//DoActorSectorDamage(actor);
return 0;
}
int DoDeathSpecial(USER* u)
int DoDeathSpecial(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
DoMatchEverything(nullptr, sp->lotag, ON);

View file

@ -533,9 +533,10 @@ SetupSkel(short SpriteNum)
return 0;
}
int DoSkelInitTeleport(USER* u)
int DoSkelInitTeleport(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
@ -545,9 +546,10 @@ int DoSkelInitTeleport(USER* u)
return 0;
}
int DoSkelTeleport(USER* u)
int DoSkelTeleport(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int x,y;
@ -579,9 +581,10 @@ int DoSkelTeleport(USER* u)
return 0;
}
int DoSkelTermTeleport(USER* u)
int DoSkelTermTeleport(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
SET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
@ -589,45 +592,48 @@ int DoSkelTermTeleport(USER* u)
return 0;
}
int NullSkel(USER* u)
int NullSkel(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int DoSkelPain(USER* u)
int DoSkelPain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullSkel(u);
NullSkel(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
InitActorDecide(u);
InitActorDecide(actor);
return 0;
}
int DoSkelMove(USER* u)
int DoSkelMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}

View file

@ -34,9 +34,9 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
int InitSpriteGrenade(USER* SpriteNum);
int InitSpriteGrenade(DSWActor* actor);
int InitSpriteChemBomb(short SpriteNum);
int InitFlashBomb(USER* SpriteNum);
int InitFlashBomb(DSWActor* actor);
int InitCaltrops(short SpriteNum);
int InitPhosphorus(int16_t SpriteNum);
bool SpriteOverlapZ(int16_t, int16_t, int);
@ -49,7 +49,7 @@ bool SpriteOverlapZ(int16_t, int16_t, int);
extern DAMAGE_DATA DamageData[];
ANIMATOR DoSkullMove,NullAnimator,DoActorDebris;
ANIMATOR DoSkullMove,DoActorDebris;
#define SKULL_RATE 10
ANIMATOR DoSkullWait;
@ -179,7 +179,6 @@ STATEp sg_SkullJump[] =
#define SKULL_EXPLODE_RATE 11
ANIMATOR DoSuicide;
ANIMATOR DoDamageTest;
ANIMATOR DoSkullSpawnShrap;
STATE s_SkullExplode[] =
@ -262,9 +261,10 @@ SetupSkull(short SpriteNum)
}
int
DoSkullMove(USER* u)
DoSkullMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int32_t dax, day, daz;
@ -279,9 +279,10 @@ DoSkullMove(USER* u)
}
int
DoSkullBeginDeath(USER* u)
DoSkullBeginDeath(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int16_t i,num_ord=0;
//extern short *DamageRadiusSkull;
@ -320,7 +321,7 @@ DoSkullBeginDeath(USER* u)
case 3:
UpdateSinglePlayKills(SpriteNum);
InitFlashBomb(u);
InitFlashBomb(actor);
break;
case 4:
@ -331,7 +332,7 @@ DoSkullBeginDeath(USER* u)
for (i=0; i<num_ord; i++)
{
sp->ang = NORM_ANGLE(sp->ang+(i*(2048/num_ord)));
InitSpriteGrenade(u);
InitSpriteGrenade(actor);
}
break;
default:
@ -366,14 +367,15 @@ DoSkullBeginDeath(USER* u)
}
int DoSkullJump(USER* u)
int DoSkullJump(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if (sp->xvel)
DoSkullMove(u);
DoSkullMove(actor);
else
sp->ang = NORM_ANGLE(sp->ang + (64 * ACTORMOVETICS));
@ -397,7 +399,7 @@ int DoSkullJump(USER* u)
SpriteOverlapZ(SpriteNum, short(u->tgt_sp - sprite), Z(32)))
{
UpdateSinglePlayKills(SpriteNum);
DoSkullBeginDeath(u);
DoSkullBeginDeath(actor);
return 0;
}
@ -405,7 +407,7 @@ int DoSkullJump(USER* u)
{
sp->z = u->loz - Z(36);
UpdateSinglePlayKills(SpriteNum);
DoSkullBeginDeath(u);
DoSkullBeginDeath(actor);
return 0;
}
}
@ -415,7 +417,7 @@ int DoSkullJump(USER* u)
if (u->jump_speed > 200)
{
UpdateSinglePlayKills(SpriteNum);
DoSkullBeginDeath(u);
DoSkullBeginDeath(actor);
}
}
@ -423,15 +425,16 @@ int DoSkullJump(USER* u)
else
{
UpdateSinglePlayKills(SpriteNum);
DoSkullBeginDeath(u);
DoSkullBeginDeath(actor);
}
return 0;
}
int DoSkullBob(USER* u)
int DoSkullBob(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
// actor does a sine wave about u->sz - this is the z mid point
@ -444,9 +447,10 @@ int DoSkullBob(USER* u)
return 0;
}
int DoSkullSpawnShrap(USER* u)
int DoSkullSpawnShrap(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
int SpawnShrap(short, short);
SpawnShrap(SpriteNum, -1);
@ -455,9 +459,10 @@ int DoSkullSpawnShrap(USER* u)
return 0;
}
int DoSkullWait(USER* u)
int DoSkullWait(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int a,b,c,dist;
@ -491,7 +496,7 @@ int DoSkullWait(USER* u)
{
sp->ang = NORM_ANGLE(sp->ang + (48 * ACTORMOVETICS));
DoSkullBob(u);
DoSkullBob(actor);
if (dist < 8000)
{
@ -515,7 +520,7 @@ int DoSkullWait(USER* u)
//////////////////////
ANIMATOR DoBettyMove,NullAnimator,DoActorDebris;
ANIMATOR DoBettyMove,DoActorDebris;
#define BETTY_RATE 10
ANIMATOR DoBettyWait;
@ -614,7 +619,6 @@ STATEp sg_BettyJump[] =
#define BETTY_EXPLODE_RATE 11
#define BETTY_EXPLODE BETTY_R0
ANIMATOR DoSuicide;
ANIMATOR DoDamageTest;
ANIMATOR DoBettySpawnShrap;
STATE s_BettyExplode[] =
@ -681,9 +685,10 @@ SetupBetty(short SpriteNum)
}
int
DoBettyMove(USER* u)
DoBettyMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int32_t dax, day, daz;
@ -698,9 +703,10 @@ DoBettyMove(USER* u)
}
int
DoBettyBeginDeath(USER* u)
DoBettyBeginDeath(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int16_t i,num_ord=0;
//extern short *DamageRadiusBetty;
@ -734,7 +740,7 @@ DoBettyBeginDeath(USER* u)
break;
case 3:
InitFlashBomb(u);
InitFlashBomb(actor);
break;
case 4:
@ -745,7 +751,7 @@ DoBettyBeginDeath(USER* u)
for (i=0; i<num_ord; i++)
{
sp->ang = NORM_ANGLE(sp->ang + (i*(2048/num_ord)));
InitSpriteGrenade(u);
InitSpriteGrenade(actor);
}
break;
default:
@ -780,14 +786,15 @@ DoBettyBeginDeath(USER* u)
}
int DoBettyJump(USER* u)
int DoBettyJump(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if (sp->xvel)
DoBettyMove(u);
DoBettyMove(actor);
else
sp->ang = NORM_ANGLE(sp->ang + (64 * ACTORMOVETICS));
@ -810,7 +817,7 @@ int DoBettyJump(USER* u)
SpriteOverlapZ(SpriteNum, short(u->tgt_sp - sprite), Z(32)))
{
UpdateSinglePlayKills(SpriteNum);
DoBettyBeginDeath(u);
DoBettyBeginDeath(actor);
return 0;
}
@ -818,7 +825,7 @@ int DoBettyJump(USER* u)
{
sp->z = u->loz - Z(36);
UpdateSinglePlayKills(SpriteNum);
DoBettyBeginDeath(u);
DoBettyBeginDeath(actor);
return 0;
}
}
@ -828,7 +835,7 @@ int DoBettyJump(USER* u)
if (u->jump_speed > 200)
{
UpdateSinglePlayKills(SpriteNum);
DoBettyBeginDeath(u);
DoBettyBeginDeath(actor);
}
}
@ -836,14 +843,15 @@ int DoBettyJump(USER* u)
else
{
UpdateSinglePlayKills(SpriteNum);
DoBettyBeginDeath(u);
DoBettyBeginDeath(actor);
}
return 0;
}
int DoBettyBob(USER* u)
int DoBettyBob(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
// actor does a sine wave about u->sz - this is the z mid point
@ -856,17 +864,19 @@ int DoBettyBob(USER* u)
return 0;
}
int DoBettySpawnShrap(USER* u)
int DoBettySpawnShrap(DSWActor* actor)
{
USER* u = actor->u();
int SpawnShrap(short, short);
SpawnShrap(u->SpriteNum, -1);
//PlaySpriteSound(SpriteNum,attr_extra1,v3df_none);
return 0;
}
int DoBettyWait(USER* u)
int DoBettyWait(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
int a,b,c,dist;
@ -900,7 +910,7 @@ int DoBettyWait(USER* u)
{
sp->ang = NORM_ANGLE(sp->ang + (48 * ACTORMOVETICS));
DoBettyBob(u);
DoBettyBob(actor);
if (dist < 8000)
{

View file

@ -679,8 +679,9 @@ int DoSlidorMove(short SpriteNum)
return 0;
}
int DoSlidor(USER* u)
int DoSlidor(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
SECTORp sectp = &sector[sp->sectnum];

View file

@ -324,8 +324,9 @@ void MoveSpritesWithSpike(short sectnum)
}
}
int DoSpike(USER* u)
int DoSpike(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = u->SpriteP;
int *lptr;
@ -442,8 +443,9 @@ int DoSpike(USER* u)
return 0;
}
int DoSpikeAuto(USER* u)
int DoSpikeAuto(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = u->SpriteP;
int *lptr;

View file

@ -102,7 +102,7 @@ static int globhiz, globloz, globhihit, globlohit;
short wait_active_check_offset;
int PlaxCeilGlobZadjust, PlaxFloorGlobZadjust;
void SetSectorWallBits(short sectnum, int bit_mask, bool set_sectwall, bool set_nextwall);
int DoActorDebris(short SpriteNum);
int DoActorDebris(DSWActor* actor);
void ActorWarpUpdatePos(short SpriteNum,short sectnum);
void ActorWarpType(SPRITEp sp, SPRITEp sp_warp);
int MissileZrange(short SpriteNum);
@ -5147,18 +5147,20 @@ move_actor(short SpriteNum, int xchange, int ychange, int zchange)
}
int
DoStayOnFloor(USER* u)
DoStayOnFloor(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
sprite[SpriteNum].z = sector[sprite[SpriteNum].sectnum].floorz;
//sprite[SpriteNum].z = getflorzofslope(sprite[SpriteNum].sectnum, sprite[SpriteNum].x, sprite[SpriteNum].y);
return 0;
}
int
DoGrating(USER* u)
DoGrating(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
int dir;
#define GRATE_FACTOR 3
@ -5227,23 +5229,25 @@ DoSpriteFade(short SpriteNum)
int
DoKey(USER* u)
DoKey(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
sp->ang = NORM_ANGLE(sp->ang + (14 * ACTORMOVETICS));
//DoSpriteFade(SpriteNum);
DoGet(u);
DoGet(actor);
return 0;
}
int
DoCoin(USER* u)
DoCoin(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
int offset;
u->WaitTics -= ACTORMOVETICS * 2;
@ -5515,9 +5519,10 @@ struct InventoryDecl_t InventoryDecls[InvDecl_TOTAL] =
#define ITEMFLASHAMT -8
#define ITEMFLASHCLR 144
int
DoGet(USER* u)
DoGet(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
USERp pu;
SPRITEp sp = u->SpriteP;
PLAYERp pp;
@ -6502,6 +6507,7 @@ AdjustActiveRange(PLAYERp pp, short SpriteNum, int dist)
int
StateControl(int16_t SpriteNum)
{
auto actor = &swActors[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = &sprite[SpriteNum];
short StateTics;
@ -6509,7 +6515,7 @@ StateControl(int16_t SpriteNum)
if (!u->State)
{
ASSERT(u->ActorActionFunc);
(u->ActorActionFunc)(u);
(u->ActorActionFunc)(actor);
return 0;
}
@ -6542,7 +6548,7 @@ StateControl(int16_t SpriteNum)
while (TEST(u->State->Tics, SF_QUICK_CALL))
{
// Call it once and go to the next state
(*u->State->Animator)(u);
(*u->State->Animator)(actor);
ASSERT(u); //put this in to see if actor was getting killed with in his QUICK_CALL state
@ -6584,7 +6590,7 @@ StateControl(int16_t SpriteNum)
// Call the correct animator
if (u->State->Animator && u->State->Animator != NullAnimator)
(*u->State->Animator)(u);
(*u->State->Animator)(actor);
}
return 0;
@ -6685,8 +6691,10 @@ SpriteControl(void)
it.Reset(STAT_NO_STATE);
while ((i = it.NextIndex()) >= 0)
{
if (User[i].Data() && User[i]->ActorActionFunc)
(*User[i]->ActorActionFunc)(User[i].Data());
auto actor = &swActors[i];
auto u = actor->u();
if (u && u->ActorActionFunc)
(*u->ActorActionFunc)(actor);
}
if (MoveSkip8 == 0)
@ -6716,6 +6724,7 @@ SpriteControl(void)
it.Reset(STAT_VATOR);
while ((i = it.NextIndex()) >= 0)
{
auto actor = &swActors[i];
u = User[i].Data();
if (u == 0)
@ -6731,12 +6740,13 @@ SpriteControl(void)
if (!TEST(u->Flags, SPR_ACTIVE))
continue;
(*User[i]->ActorActionFunc)(u);
(*User[i]->ActorActionFunc)(actor);
}
it.Reset(STAT_SPIKE);
while ((i = it.NextIndex()) >= 0)
{
auto actor = &swActors[i];
u = User[i].Data();
if (u->Tics)
@ -6753,12 +6763,13 @@ SpriteControl(void)
if (i == 69 && it.PeekIndex() == -1)
continue;
(*User[i]->ActorActionFunc)(u);
(*User[i]->ActorActionFunc)(actor);
}
it.Reset(STAT_ROTATOR);
while ((i = it.NextIndex()) >= 0)
{
auto actor = &swActors[i];
u = User[i].Data();
if (u->Tics)
@ -6772,12 +6783,13 @@ SpriteControl(void)
if (!TEST(u->Flags, SPR_ACTIVE))
continue;
(*User[i]->ActorActionFunc)(u);
(*User[i]->ActorActionFunc)(actor);
}
it.Reset(STAT_SLIDOR);
while ((i = it.NextIndex()) >= 0)
{
auto actor = &swActors[i];
u = User[i].Data();
if (u->Tics)
@ -6791,7 +6803,7 @@ SpriteControl(void)
if (!TEST(u->Flags, SPR_ACTIVE))
continue;
(*User[i]->ActorActionFunc)(u);
(*User[i]->ActorActionFunc)(actor);
}
it.Reset(STAT_SUICIDE);

View file

@ -676,36 +676,38 @@ SetupSumo(short SpriteNum)
return 0;
}
int NullSumo(USER* u)
int NullSumo(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
//if (TEST(u->Flags,SPR_SLIDING))
//DoActorSlide(u);
//DoActorSlide(actor);
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int DoSumoMove(USER* u)
int DoSumoMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
//if (TEST(u->Flags,SPR_SLIDING))
//DoActorSlide(u);
//DoActorSlide(actor);
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
KeepActorOnFloor(SpriteNum);
if (DoActorSectorDamage(u))
if (DoActorSectorDamage(actor))
{
return 0;
}
@ -713,28 +715,11 @@ int DoSumoMove(USER* u)
return 0;
}
#if 0
int InitSumoCharge(USER* u)
int DoSumoRumble(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if (RANDOM_P2(1024) > 950)
PlaySound(DIGI_SUMOALERT, sp, v3df_follow);
DoActorSetSpeed(SpriteNum, FAST_SPEED);
InitActorMoveCloser(SpriteNum);
NewStateGroup(SpriteNum, sg_SumoCharge);
return 0;
}
#endif
int DoSumoRumble(USER* u)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
SetSumoQuake(SpriteNum);
@ -742,9 +727,10 @@ int DoSumoRumble(USER* u)
return 0;
}
int InitSumoFart(USER* u)
int InitSumoFart(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
extern int InitSumoNapalm(short SpriteNum);
@ -758,9 +744,10 @@ int InitSumoFart(USER* u)
return 0;
}
int InitSumoStomp(USER* u)
int InitSumoStomp(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
extern int InitSumoStompAttack(short SpriteNum);
@ -771,9 +758,10 @@ int InitSumoStomp(USER* u)
return 0;
}
int InitSumoClap(USER* u)
int InitSumoClap(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
extern int InitMiniSumoClap(short SpriteNum);
extern int InitSumoSkull(short SpriteNum);
@ -785,9 +773,10 @@ int InitSumoClap(USER* u)
return 0;
}
int DoSumoDeathMelt(USER* u)
int DoSumoDeathMelt(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
PlaySound(DIGI_SUMOFART, sp, v3df_follow);

View file

@ -0,0 +1,206 @@
#pragma once
// included by game.h
BEGIN_SW_NS
class DSWActor
{
int index;
DSWActor* base();
public:
int cumulDamage;
DSWActor() :index(int(this - base())) { /*assert(index >= 0 && index < kMaxSprites);*/ }
DSWActor& operator=(const DSWActor& other) = default;
void Clear()
{
}
bool hasU() { return User[index].Data() != nullptr; }
/*
void addU()
{
if (s().extra == -1) dbInsertXSprite(s().index);
}
*/
spritetype& s() { return sprite[index]; }
USER* u() { return User[index].Data(); }
void SetOwner(DSWActor* own)
{
s().owner = own ? own->s().index : -1;
}
DSWActor* GetOwner()
{
if (s().owner == -1 || s().owner == MAXSPRITES - 1) return nullptr;
return base() + s().owner;
}
int GetSpriteIndex() const
{
return index;
}
};
extern DSWActor swActors[MAXSPRITES];
inline DSWActor* DSWActor::base() { return swActors; }
// Iterator wrappers that return an actor pointer, not an index.
class SWStatIterator : public StatIterator
{
public:
SWStatIterator(int stat) : StatIterator(stat)
{
}
DSWActor* Next()
{
int n = NextIndex();
return n >= 0 ? &swActors[n] : nullptr;
}
DSWActor* Peek()
{
int n = PeekIndex();
return n >= 0 ? &swActors[n] : nullptr;
}
};
class SWSectIterator : public SectIterator
{
public:
SWSectIterator(int stat) : SectIterator(stat)
{
}
DSWActor* Next()
{
int n = NextIndex();
return n >= 0 ? &swActors[n] : nullptr;
}
DSWActor* Peek()
{
int n = PeekIndex();
return n >= 0 ? &swActors[n] : nullptr;
}
};
// An iterator to iterate over all sprites.
class SWSpriteIterator
{
SWStatIterator it;
int stat = 0;
public:
SWSpriteIterator() : it(0) {}
DSWActor* Next()
{
while (stat < MAXSTATUS)
{
auto ac = it.Next();
if (ac) return ac;
stat++;
if (stat < MAXSTATUS) it.Reset(stat);
}
return nullptr;
}
};
// For iterating linearly over map spawned sprites.
class SWLinearSpriteIterator
{
int index = 0;
public:
void Reset()
{
index = 0;
}
DSWActor* Next()
{
while (index < MAXSPRITES)
{
auto p = &swActors[index++];
if (p->s().statnum != MAXSTATUS) return p;
}
return nullptr;
}
};
// Wrapper around the insane collision info mess from Build.
struct Collision
{
int type;
int index;
int legacyVal; // should be removed later, but needed for converting back for unadjusted code.
DSWActor* actor;
Collision() = default;
Collision(int legacyval) { setFromEngine(legacyval); }
int setNone()
{
type = kHitNone;
index = -1;
legacyVal = 0;
actor = nullptr;
return kHitNone;
}
int setSector(int num)
{
type = kHitSector;
index = num;
legacyVal = type | index;
actor = nullptr;
return kHitSector;
}
int setWall(int num)
{
type = kHitWall;
index = num;
legacyVal = type | index;
actor = nullptr;
return kHitWall;
}
int setSprite(DSWActor* num)
{
type = kHitSprite;
index = -1;
legacyVal = type | int(num - swActors);
actor = num;
return kHitSprite;
}
int setFromEngine(int value)
{
legacyVal = value;
type = value & kHitTypeMask;
if (type == 0) { index = -1; actor = nullptr; }
else if (type != kHitSprite) { index = value & kHitIndexMask; actor = nullptr; }
else { index = -1; actor = &swActors[value & kHitIndexMask]; }
return type;
}
};
inline FSerializer& Serialize(FSerializer& arc, const char* keyname, DSWActor*& w, DSWActor** def)
{
int index = w? int(w - swActors) : -1;
Serialize(arc, keyname, index, nullptr);
if (arc.isReading()) w = index == -1? nullptr : &swActors[index];
return arc;
}
END_SW_NS

View file

@ -44,10 +44,8 @@ BEGIN_SW_NS
void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny);
void DoAutoTurretObject(SECTOR_OBJECTp sop);
void DoTornadoObject(SECTOR_OBJECTp sop);
int DoActorMoveJump(short SpriteNum);
int PickJumpSpeed(short SpriteNum, int pix_height);
SPRITEp FindNearSprite(SPRITEp, short);
ANIMATOR DoActorMoveJump;
ANIMATOR NinjaJumpActionFunc;
#define ACTOR_STD_JUMP (-384)
@ -3087,6 +3085,7 @@ bool
ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
{
SPRITEp sp;
auto actor = &swActors[SpriteNum];
USERp u = User[SpriteNum].Data();
sp = u->SpriteP;
@ -3193,7 +3192,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
else
u->jump_speed = -tpoint->tag_high;
DoActorBeginJump(u);
DoActorBeginJump(actor);
u->ActorActionFunc = DoActorMoveJump;
}
@ -3240,7 +3239,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
u->jump_speed = PickJumpSpeed(SpriteNum, zdiff);
}
DoActorBeginJump(u);
DoActorBeginJump(actor);
u->ActorActionFunc = DoActorMoveJump;
return false;
@ -3265,7 +3264,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
u->jump_speed = -350;
}
DoActorBeginJump(u);
DoActorBeginJump(actor);
u->ActorActionFunc = DoActorMoveJump;
return false;
}
@ -3286,8 +3285,6 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
if (u->Rot != u->ActorActionSet->Duck)
{
int DoActorDuck(USERp SpriteNum);
sp->ang = tpoint->ang;
ActorLeaveTrack(SpriteNum);
@ -3297,7 +3294,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
else
u->WaitTics = tpoint->tag_high * 128;
InitActorDuck(u);
InitActorDuck(actor);
u->ActorActionFunc = DoActorDuck;
return false;
}
@ -3383,7 +3380,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
else
u->jump_speed = -tpoint->tag_high;
DoActorBeginJump(u);
DoActorBeginJump(actor);
}
break;
@ -3396,7 +3393,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
else
u->jump_speed = -tpoint->tag_high;
DoActorBeginJump(u);
DoActorBeginJump(actor);
}
break;
@ -3458,7 +3455,7 @@ ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
SET(u->Flags, SPR_DEAD);
sp->xvel <<= 1;
u->jump_speed = -495;
DoActorBeginJump(u);
DoActorBeginJump(actor);
NewStateGroup(SpriteNum, u->ActorActionSet->DeathJump);
}
@ -3630,6 +3627,7 @@ present time.
int
ActorFollowTrack(short SpriteNum, short locktics)
{
auto actor = &swActors[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
PLAYERp pp;
@ -3765,7 +3763,7 @@ ActorFollowTrack(short SpriteNum, short locktics)
DoActorSetSpeed(SpriteNum, SLOW_SPEED);
u->ActorActionFunc = NinjaJumpActionFunc;
u->jump_speed = -650;
DoActorBeginJump(u);
DoActorBeginJump(actor);
return true;
}

View file

@ -453,9 +453,10 @@ int DoVatorMove(short SpriteNum, int *lptr)
}
int DoVator(USER* u)
int DoVator(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = u->SpriteP;
SECTORp sectp = &sector[sp->sectnum];
int *lptr;
@ -622,9 +623,10 @@ int DoVator(USER* u)
return 0;
}
int DoVatorAuto(USER* u)
int DoVatorAuto(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = u->SpriteP;
SECTORp sectp = &sector[sp->sectnum];
int *lptr;

File diff suppressed because it is too large Load diff

View file

@ -160,7 +160,7 @@ int DoActorBeginSlide(int SpriteNum, short ang, short vel, short dec);
int GetOverlapSector(int x, int y, short *over, short *under);
bool MissileHitDiveArea(short SpriteNum);
int DoDamageTest(USERp);
int DoDamageTest(DSWActor*);
extern short StatDamageList[STAT_DAMAGE_LIST_SIZE];
@ -208,10 +208,10 @@ void InitSpellRing(PLAYERp pp);
void InitSpellNapalm(PLAYERp pp);
int InitUzi(PLAYERp pp);
int InitSobjGun(PLAYERp pp);
int InitBoltTrap(USER* SpriteNum);
int InitBoltTrap(DSWActor* actor);
int InitSpearTrap(short SpriteNum);
int InitTurretMgun(SECTOR_OBJECTp sop);
int InitVulcanBoulder(USERp SpriteNum);
int InitVulcanBoulder(DSWActor* actor);
int DoBladeDamage(short SpriteNum);
int DoFindGround(int16_t SpriteNum);
int DoFindGroundPoint(int16_t SpriteNum);
@ -233,7 +233,7 @@ int SpawnTracerExp(int16_t Weapon);
int SpawnGoroFireballExp(int16_t Weapon);
bool MissileHitMatch(short Weapon,short WeaponNum,short hit_sprite);
int DoItemFly(int16_t SpriteNum);
int SpawnVehicleSmoke(USERp SpriteNum);
int SpawnVehicleSmoke(DSWActor* actor);
short PrevWall(short wall_num);
int DoDamage(short SpriteNum,short Weapon);

View file

@ -678,13 +678,14 @@ SetupZilla(short SpriteNum)
return 0;
}
int NullZilla(USER* u)
int NullZilla(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = User[SpriteNum]->SpriteP;
//if (TEST(u->Flags,SPR_SLIDING))
//DoActorSlide(u);
//DoActorSlide(actor);
#if 0
if (u->State == s_ZillaDie)
@ -705,19 +706,20 @@ int NullZilla(USER* u)
u->hi_sp = nullptr;
sp->z = u->loz;
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int DoZillaMove(USER* u)
int DoZillaMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
short choose;
//if (TEST(u->Flags,SPR_SLIDING))
//DoActorSlide(u);
//DoActorSlide(actor);
// Random Zilla taunts
if (!SoundValidAndActive(sp, CHAN_AnimeMad))
@ -737,11 +739,11 @@ int DoZillaMove(USER* u)
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
KeepActorOnFloor(SpriteNum);
if (DoActorSectorDamage(u))
if (DoActorSectorDamage(actor))
{
return 0;
}
@ -749,9 +751,10 @@ int DoZillaMove(USER* u)
return 0;
}
int DoZillaStomp(USER* u)
int DoZillaStomp(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
PlaySound(DIGI_ZILLASTOMP, sp, v3df_follow);
@ -761,9 +764,10 @@ int DoZillaStomp(USER* u)
extern int SpawnGrenadeExp(int16_t Weapon);
int DoZillaDeathMelt(USER* u)
int DoZillaDeathMelt(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &sprite[SpriteNum];
if (RandomRange(1000) > 800)

View file

@ -880,9 +880,10 @@ SpawnZombie2(short Weapon)
}
int
DoZombieMove(USER* u)
DoZombieMove(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (u->Counter3++ >= ZOMBIE_TIME_LIMIT)
{
@ -900,21 +901,21 @@ DoZombieMove(USER* u)
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
if (TEST(u->Flags, SPR_JUMPING))
DoActorJump(u);
DoActorJump(actor);
else if (TEST(u->Flags, SPR_FALLING))
DoActorFall(u);
DoActorFall(actor);
}
// sliding
if (TEST(u->Flags, SPR_SLIDING))
DoActorSlide(u);
DoActorSlide(actor);
// Do track or call current action function - such as DoActorMoveCloser()
if (u->track >= 0)
ActorFollowTrack(SpriteNum, ACTORMOVETICS);
else
{
(*u->ActorActionFunc)(u);
(*u->ActorActionFunc)(actor);
}
// stay on floor unless doing certain things
@ -924,15 +925,16 @@ DoZombieMove(USER* u)
}
// take damage from environment
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int
NullZombie(USER* u)
NullZombie(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
if (u->Counter3++ >= ZOMBIE_TIME_LIMIT)
{
@ -950,25 +952,26 @@ NullZombie(USER* u)
u->WaitTics -= ACTORMOVETICS;
if (TEST(u->Flags, SPR_SLIDING) && !TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
DoActorSlide(u);
DoActorSlide(actor);
if (!TEST(u->Flags, SPR_JUMPING|SPR_FALLING))
KeepActorOnFloor(SpriteNum);
DoActorSectorDamage(u);
DoActorSectorDamage(actor);
return 0;
}
int DoZombiePain(USER* u)
int DoZombiePain(DSWActor* actor)
{
int SpriteNum = u->SpriteNum;
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
NullZombie(u);
NullZombie(actor);
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
InitActorDecide(u);
InitActorDecide(actor);
return 0;
}