- a large batch of KillSprite calls.

This commit is contained in:
Christoph Oelckers 2021-10-30 22:53:24 +02:00
parent 740c5e1e56
commit 3e1e5fb343
12 changed files with 216 additions and 197 deletions

View file

@ -404,7 +404,6 @@ bool move_debris(DSWActor* actor, int xchange, int ychange, int zchange)
int DoActorDebris(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
SPRITEp sp = &actor->s();
SECTORp sectp = &sector[sp->sectnum];
int nx, ny;
@ -417,7 +416,7 @@ int DoActorDebris(DSWActor* actor)
{
case HORNET_RUN_R0:
case BUNNY_RUN_R0:
KillSprite(SpriteNum);
KillActor(actor);
return 0;
case ZILLA_RUN_R0:
getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz);

View file

@ -744,7 +744,7 @@ SetupBunny(short SpriteNum)
Bunny_Count++;
//if(Bunny_Count > 20)
// {
// KillSprite(SpriteNum);
// KillActor(actor);
// Bunny_Count--;
// return(0);
// }

View file

@ -290,7 +290,7 @@ DoWallBloodDrip(DSWActor* actor)
{
sp->z = u->loz;
SpawnFloorSplash(SpriteNum);
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}

View file

@ -310,8 +310,9 @@ void DoRotatorStopInterp(short SpriteNum)
int DoRotatorMove(short SpriteNum)
{
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
auto actor = &swActors[SpriteNum];
USERp u = actor->u();
SPRITEp sp = &actor->s();
ROTATORp r;
short ndx,w,startwall,endwall;
SPRITEp pivot = nullptr;
@ -426,7 +427,7 @@ int DoRotatorMove(short SpriteNum)
if (kill)
{
SetRotatorInactive(SpriteNum);
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}

View file

@ -1134,7 +1134,7 @@ int DoSpawnSpot(DSWActor* actor)
if (u->LastDamage == 1)
{
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
}

View file

@ -537,8 +537,9 @@ int DoSlidorInstantClose(short SpriteNum)
int DoSlidorMove(short SpriteNum)
{
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
auto actor = &swActors[SpriteNum];
USERp u = actor->u();
SPRITEp sp = &actor->s();
ROTATORp r;
int old_pos;
bool kill = false;
@ -672,7 +673,7 @@ int DoSlidorMove(short SpriteNum)
if (kill)
{
SetSlidorInactive(SpriteNum);
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}

View file

@ -385,7 +385,7 @@ int DoSpike(DSWActor* actor)
if (TEST_BOOL2(sp))
{
SetSpikeInactive(SpriteNum);
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}

View file

@ -619,8 +619,12 @@ SetAttach(short owner, short child)
cu->Attach = owner;
}
void
KillSprite(int16_t SpriteNum)
void KillActor(DSWActor* actor)
{
KillSprite(actor->GetSpriteIndex());
}
void KillSprite(int16_t SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum].Data();
@ -1175,7 +1179,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1193,7 +1197,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1210,7 +1214,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1224,7 +1228,7 @@ ActorSpawn(SPRITEp sp)
{
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1240,7 +1244,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1256,7 +1260,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1273,7 +1277,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1290,7 +1294,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1307,7 +1311,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1324,7 +1328,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1341,7 +1345,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1358,7 +1362,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1375,7 +1379,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1402,7 +1406,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1418,7 +1422,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1434,7 +1438,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1450,7 +1454,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1464,7 +1468,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1480,7 +1484,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1496,7 +1500,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1512,7 +1516,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1528,7 +1532,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1587,7 +1591,7 @@ ActorSpawn(SPRITEp sp)
if (!ActorTestSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return false;
}
@ -1736,10 +1740,9 @@ void PreMapCombineFloors(void)
// get rid of the sprites used
it.Reset(STAT_FAF);
int SpriteNum;
while ((SpriteNum = it.NextIndex()) >= 0)
while (auto actor = it.Next())
{
KillSprite(SpriteNum);
KillActor(actor);
}
GlobalSectorList.Resize(sectliststart);
}
@ -1943,7 +1946,7 @@ SpriteSetup(void)
{
if (numplayers <= 1 || gNet.MultiGameType == MULTI_GAME_COOPERATIVE)
{
KillSprite(SpriteNum);
KillActor(actor);
continue;
}
}
@ -2053,18 +2056,18 @@ SpriteSetup(void)
{
sectu = GetSectUser(sp->sectnum);
sectu->depth_fixed = IntToFixed(sp->lotag);
KillSprite(SpriteNum);
KillActor(actor);
}
else if (TEST(bit, SECTFX_OPERATIONAL))
{
KillSprite(SpriteNum);
KillActor(actor);
}
else if (TEST(bit, SECTFX_CURRENT))
{
sectu = GetSectUser(sp->sectnum);
sectu->speed = sp->lotag;
sectu->ang = sp->ang;
KillSprite(SpriteNum);
KillActor(actor);
}
else if (TEST(bit, SECTFX_NO_RIDE))
{
@ -2109,14 +2112,14 @@ SpriteSetup(void)
sectu->number = sp->lotag;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SLIDE_SECTOR:
sectu = GetSectUser(sp->sectnum);
SET(sectu->flags, SECTFU_SLIDE_SECTOR);
sectu->speed = SP_TAG2(sp);
KillSprite(SpriteNum);
KillActor(actor);
break;
case SECT_DAMAGE:
@ -2125,7 +2128,7 @@ SpriteSetup(void)
if (TEST_BOOL1(sp))
SET(sectu->flags, SECTFU_DAMAGE_ABOVE_SECTOR);
sectu->damage = sp->lotag;
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -2135,7 +2138,7 @@ SpriteSetup(void)
pskybits_override = sp->lotag;
if (SP_TAG4(sp) > 2048)
parallaxyscale_override = SP_TAG4(sp);
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -2149,7 +2152,7 @@ SpriteSetup(void)
sectu = GetSectUser(sp->sectnum);
SET(sectu->flags, SECTFU_DONT_COPY_PALETTE);
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -2193,7 +2196,7 @@ SpriteSetup(void)
if (hitinfo.wall == -1)
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -2225,12 +2228,12 @@ SpriteSetup(void)
if (hitinfo.wall == -1)
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
SET(wall[hitinfo.wall].extra, WALLFX_DONT_STICK);
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -2253,7 +2256,7 @@ SpriteSetup(void)
{
if (numplayers <= 1 || gNet.MultiGameType == MULTI_GAME_COOPERATIVE)
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
}
@ -2868,7 +2871,7 @@ SpriteSetup(void)
change_actor_stat(actor, STAT_ST1);
break;
case MULTI_GAME_COMMBAT:
KillSprite(SpriteNum);
KillActor(actor);
break;
case MULTI_GAME_COOPERATIVE:
change_actor_stat(actor, STAT_ST1);
@ -2967,7 +2970,7 @@ SpriteSetup(void)
SET(sector[sp->sectnum].extra, SECTFX_Z_ADJUST);
PlaxCeilGlobZadjust = SP_TAG2(sp);
PlaxFloorGlobZadjust = SP_TAG3(sp);
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3054,7 +3057,7 @@ SpriteSetup(void)
{
sectu = GetSectUser(sp->sectnum);
SET(sectu->flags, SECTFU_SO_DONT_BOB);
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3063,7 +3066,7 @@ SpriteSetup(void)
sectu = GetSectUser(sp->sectnum);
sectu->number = sp->lotag;
sectu->stag = SECT_LOCK_DOOR;
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3073,7 +3076,7 @@ SpriteSetup(void)
SET(sectu->flags, SECTFU_SO_SINK_DEST);
sectu->number = sp->lotag; // acually the offset Z
// value
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3081,7 +3084,7 @@ SpriteSetup(void)
{
sectu = GetSectUser(sp->sectnum);
SET(sectu->flags, SECTFU_SO_DONT_SINK);
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3090,7 +3093,7 @@ SpriteSetup(void)
sectu = GetSectUser(sp->sectnum);
SET(sectu->flags, SECTFU_SO_SLOPE_FLOOR_TO_POINT);
SET(sector[sp->sectnum].extra, SECTFX_DYNAMIC_AREA);
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3099,7 +3102,7 @@ SpriteSetup(void)
sectu = GetSectUser(sp->sectnum);
SET(sectu->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT);
SET(sector[sp->sectnum].extra, SECTFX_DYNAMIC_AREA);
KillSprite(SpriteNum);
KillActor(actor);
break;
}
case SECT_SO_FORM_WHIRLPOOL:
@ -3107,7 +3110,7 @@ SpriteSetup(void)
sectu = GetSectUser(sp->sectnum);
sectu->stag = SECT_SO_FORM_WHIRLPOOL;
sectu->height = sp->lotag;
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3130,7 +3133,7 @@ SpriteSetup(void)
}
while (wall_num != start_wall);
KillSprite(SpriteNum);
KillActor(actor);
break;
}
}
@ -3178,7 +3181,7 @@ KeyMain:
if (gNet.MultiGameType == MULTI_GAME_COMMBAT || gNet.MultiGameType == MULTI_GAME_AI_BOTS)
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3246,7 +3249,7 @@ KeyStatueMain:
if (TEST(sprite[SpriteNum].extra, SPRX_MULTI_ITEM))
if (numplayers <= 1 || gNet.MultiGameType == MULTI_GAME_COOPERATIVE)
{
KillSprite(SpriteNum);
KillActor(actor);
}
break;
@ -3274,7 +3277,7 @@ KeyStatueMain:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3287,7 +3290,7 @@ KeyStatueMain:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3300,7 +3303,7 @@ KeyStatueMain:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3313,7 +3316,7 @@ KeyStatueMain:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3328,7 +3331,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3341,7 +3344,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3353,7 +3356,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3365,7 +3368,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3377,7 +3380,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3390,7 +3393,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3402,7 +3405,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3415,7 +3418,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3428,7 +3431,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3441,7 +3444,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3453,7 +3456,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3468,7 +3471,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3480,7 +3483,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3493,7 +3496,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3505,7 +3508,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3517,7 +3520,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3529,7 +3532,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3542,7 +3545,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3555,7 +3558,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3569,7 +3572,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3585,7 +3588,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3597,7 +3600,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3609,7 +3612,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3621,7 +3624,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3642,7 +3645,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3655,7 +3658,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3667,7 +3670,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3679,7 +3682,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3692,7 +3695,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3706,7 +3709,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3719,7 +3722,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3732,7 +3735,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3745,7 +3748,7 @@ NUKE_REPLACEMENT:
if (!IconSpawn(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -3857,7 +3860,7 @@ NUKE_REPLACEMENT:
{
if (numplayers <= 1 || gNet.MultiGameType == MULTI_GAME_COOPERATIVE)
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
}
@ -5295,7 +5298,7 @@ DoCoin(DSWActor* actor)
if (u->WaitTics <= 0)
{
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
@ -5324,8 +5327,12 @@ DoCoin(DSWActor* actor)
int
KillGet(short SpriteNum)
{
USERp u = User[SpriteNum].Data(),nu;
SPRITEp sp = User[SpriteNum]->SpriteP,np;
auto actor = &swActors[SpriteNum];
USERp u = actor->u();
SPRITEp sp = &actor->s();
USERp nu;
SPRITEp np;
short New;
@ -5333,14 +5340,14 @@ KillGet(short SpriteNum)
{
case MULTI_GAME_NONE:
case MULTI_GAME_COOPERATIVE:
KillSprite(SpriteNum);
KillActor(actor);
break;
case MULTI_GAME_COMMBAT:
case MULTI_GAME_AI_BOTS:
if (TEST(u->Flags2, SPR2_NEVER_RESPAWN))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -5368,8 +5375,12 @@ KillGet(short SpriteNum)
int
KillGetAmmo(short SpriteNum)
{
USERp u = User[SpriteNum].Data(),nu;
SPRITEp sp = User[SpriteNum]->SpriteP,np;
auto actor = &swActors[SpriteNum];
USERp u = actor->u();
SPRITEp sp = &actor->s();
USERp nu;
SPRITEp np;
short New;
@ -5377,7 +5388,7 @@ KillGetAmmo(short SpriteNum)
{
case MULTI_GAME_NONE:
case MULTI_GAME_COOPERATIVE:
KillSprite(SpriteNum);
KillActor(actor);
break;
case MULTI_GAME_COMMBAT:
@ -5385,14 +5396,14 @@ KillGetAmmo(short SpriteNum)
if (TEST(u->Flags2, SPR2_NEVER_RESPAWN))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
// No Respawn mode - all ammo goes away
if (gNet.NoRespawn)
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -5420,15 +5431,19 @@ KillGetAmmo(short SpriteNum)
int
KillGetWeapon(short SpriteNum)
{
USERp u = User[SpriteNum].Data(),nu;
SPRITEp sp = User[SpriteNum]->SpriteP,np;
auto actor = &swActors[SpriteNum];
USERp u = actor->u();
SPRITEp sp = &actor->s();
USERp nu;
SPRITEp np;
short New;
switch (gNet.MultiGameType)
{
case MULTI_GAME_NONE:
KillSprite(SpriteNum);
KillActor(actor);
break;
case MULTI_GAME_COOPERATIVE:
@ -5437,7 +5452,7 @@ KillGetWeapon(short SpriteNum)
// unless told too :)
if (TEST(u->Flags2, SPR2_NEVER_RESPAWN))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
break;
@ -5447,7 +5462,7 @@ KillGetWeapon(short SpriteNum)
if (TEST(u->Flags2, SPR2_NEVER_RESPAWN))
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -5682,7 +5697,7 @@ KeyMain:
if (gNet.MultiGameType == MULTI_GAME_COOPERATIVE)
break;
KillSprite(SpriteNum);
KillActor(actor);
break;
case ICON_ARMOR:
@ -5710,7 +5725,7 @@ KeyMain:
// override for respawn mode
if (gNet.MultiGameType == MULTI_GAME_COMMBAT && gNet.NoRespawn)
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -5745,7 +5760,7 @@ KeyMain:
// override for respawn mode
if (gNet.MultiGameType == MULTI_GAME_COMMBAT && gNet.NoRespawn)
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -5782,7 +5797,7 @@ KeyMain:
// override for respawn mode
if (gNet.MultiGameType == MULTI_GAME_COMMBAT && gNet.NoRespawn)
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -5808,7 +5823,7 @@ KeyMain:
// override for respawn mode
if (gNet.MultiGameType == MULTI_GAME_COMMBAT && gNet.NoRespawn)
{
KillSprite(SpriteNum);
KillActor(actor);
break;
}
@ -6172,7 +6187,7 @@ KeyMain:
#endif
case ICON_RAIL_GUN:
if (SW_SHAREWARE) { KillSprite(SpriteNum); break; }
if (SW_SHAREWARE) { KillActor(actor); break; }
if (!CanGetWeapon(pp, SpriteNum, WPN_RAIL))
break;
@ -6208,7 +6223,7 @@ KeyMain:
break;
case ICON_RAIL_AMMO:
if (SW_SHAREWARE) { KillSprite(SpriteNum); break; }
if (SW_SHAREWARE) { KillActor(actor); break; }
if (pp->WpnAmmo[WPN_RAIL] >= DamageData[WPN_RAIL].max_ammo)
break;
@ -6287,7 +6302,7 @@ KeyMain:
#endif
case ICON_GUARD_HEAD:
if (SW_SHAREWARE) { KillSprite(SpriteNum); break; }
if (SW_SHAREWARE) { KillActor(actor); break; }
if (!CanGetWeapon(pp, SpriteNum, WPN_HOTHEAD))
break;
@ -6318,7 +6333,7 @@ KeyMain:
break;
case ICON_FIREBALL_LG_AMMO:
if (SW_SHAREWARE) { KillSprite(SpriteNum); break; }
if (SW_SHAREWARE) { KillActor(actor); break; }
if (pp->WpnAmmo[WPN_HOTHEAD] >= DamageData[WPN_HOTHEAD].max_ammo)
break;
@ -6332,7 +6347,7 @@ KeyMain:
break;
case ICON_HEART:
if (SW_SHAREWARE) { KillSprite(SpriteNum); break; }
if (SW_SHAREWARE) { KillActor(actor); break; }
if (!CanGetWeapon(pp, SpriteNum, WPN_HEART))
break;
@ -6365,7 +6380,7 @@ KeyMain:
break;
case ICON_HEART_LG_AMMO:
if (SW_SHAREWARE) { KillSprite(SpriteNum); break; }
if (SW_SHAREWARE) { KillActor(actor); break; }
if (pp->WpnAmmo[WPN_HEART] >= DamageData[WPN_HEART].max_ammo)
break;
@ -6436,7 +6451,7 @@ KeyMain:
break;
default:
KillSprite(SpriteNum);
KillActor(actor);
}
}

View file

@ -31,6 +31,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS
void KillSprite(int16_t SpriteNum);
void KillActor(DSWActor* actor);
int16_t SpawnSprite(short stat, short id, STATEp state, short sectnum, int x, int y, int z, int ang, int vel);
DSWActor* SpawnActor(short stat, short id, STATEp state, short sectnum, int x, int y, int z, int ang, int vel);
void SpriteSetup(void);

View file

@ -302,7 +302,9 @@ NextActorTrackPoint(short SpriteNum)
void
TrackAddPoint(TRACKp t, TRACK_POINTp tp, short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
auto actor = &swActors[SpriteNum];
SPRITEp sp = &actor->s();
TRACK_POINTp tpoint = (tp + t->NumPoints);
// //DSPRINTF(ds,"3 ndx = %d, numpoints = %d", t - Track, t->NumPoints);
@ -317,7 +319,7 @@ TrackAddPoint(TRACKp t, TRACK_POINTp tp, short SpriteNum)
t->NumPoints++;
KillSprite(SpriteNum);
KillActor(actor);
}
int
@ -480,6 +482,7 @@ void QuickExitSetup(short stat, short type)
StatIterator it(stat);
while ((SpriteNum = it.NextIndex()) >= 0)
{
auto actor = &swActors[SpriteNum];
// find an open track
for (ndx = 0; ndx < MAX_TRACKS; ndx++)
@ -512,7 +515,7 @@ void QuickExitSetup(short stat, short type)
nsp->hitag = 0;
TrackAddPoint(t, tp, start_sprite);
KillSprite(SpriteNum);
KillActor(actor);
// add end point
nsp = &sprite[end_sprite];
@ -1142,7 +1145,7 @@ SetupSectorObject(short sectnum, short tag)
sop->scale_x_mult = SP_TAG5(sp);
if (SP_TAG6(sp))
sop->scale_y_mult = SP_TAG6(sp);
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_SCALE_POINT_INFO:
@ -1161,7 +1164,7 @@ SetupSectorObject(short sectnum, short tag)
sop->scale_point_dist_min = -SP_TAG5(sp);
sop->scale_point_dist_max = SP_TAG6(sp);
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_SCALE_INFO:
@ -1183,7 +1186,7 @@ SetupSectorObject(short sectnum, short tag)
else if (SP_TAG3(sp) == 1)
sop->scale_dist = sop->scale_dist_max;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SPAWN_SPOT:
@ -1198,7 +1201,7 @@ SetupSectorObject(short sectnum, short tag)
case SO_AUTO_TURRET:
sop->Animator = DoAutoTurretObject;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_TORNADO:
@ -1221,7 +1224,7 @@ SetupSectorObject(short sectnum, short tag)
sop->morph_dist_max = 1024;
sop->morph_rand_freq = 8;
sop->scale_dist_min = -768;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_FLOOR_MORPH:
if (SW_SHAREWARE) break;
@ -1232,7 +1235,7 @@ SetupSectorObject(short sectnum, short tag)
sop->PostMoveAnimator = MorphFloor;
sop->morph_dist_max = 4000;
sop->morph_rand_freq = 8;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_AMOEBA:
@ -1249,7 +1252,7 @@ SetupSectorObject(short sectnum, short tag)
sop->scale_point_dist_min = -256;
sop->scale_point_dist_max = 256;
sop->scale_point_rand_freq = 32;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_MAX_DAMAGE:
u->MaxHealth = SP_TAG2(sp);
@ -1266,7 +1269,7 @@ SetupSectorObject(short sectnum, short tag)
SET(sop->flags, SOBJ_DIE_HARD);
break;
}
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_DRIVABLE_ATTRIB:
@ -1295,29 +1298,29 @@ SetupSectorObject(short sectnum, short tag)
SET(sop->flags, SOBJ_RECT_CLIP);
}
//KillSprite(SpriteNum);
//KillActor(actor);
break;
case SO_RAM_DAMAGE:
sop->ram_damage = sp->lotag;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SECT_SO_CLIP_DIST:
sop->clipdist = sp->lotag;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SECT_SO_SPRITE_OBJ:
SET(sop->flags, SOBJ_SPRITE_OBJ);
KillSprite(SpriteNum);
KillActor(actor);
break;
case SECT_SO_DONT_ROTATE:
SET(sop->flags, SOBJ_DONT_ROTATE);
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_LIMIT_TURN:
sop->limit_ang_center = sp->ang;
sop->limit_ang_delta = sp->lotag;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_MATCH_EVENT:
sop->match_event = sp->lotag;
@ -1326,20 +1329,20 @@ SetupSectorObject(short sectnum, short tag)
case SO_SET_SPEED:
sop->vel = sp->lotag * 256;
sop->vel_tgt = sop->vel;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_SPIN:
if (sop->spin_speed)
break;
sop->spin_speed = sp->lotag;
sop->last_ang = sop->ang;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_ANGLE:
sop->ang = sop->ang_moving = sp->ang;
sop->last_ang = sop->ang_orig = sop->ang;
sop->spin_ang = 0;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_SPIN_REVERSE:
@ -1349,29 +1352,29 @@ SetupSectorObject(short sectnum, short tag)
if (sop->spin_speed >= 0)
sop->spin_speed = -sop->spin_speed;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_BOB_START:
sop->bob_amt = Z(sp->lotag);
sop->bob_sine_ndx = 0;
sop->bob_speed = 4;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_TURN_SPEED:
sop->turn_speed = sp->lotag;
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_SYNC1:
SET(sop->flags, SOBJ_SYNC1);
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_SYNC2:
SET(sop->flags, SOBJ_SYNC2);
KillSprite(SpriteNum);
KillActor(actor);
break;
case SO_KILLABLE:
SET(sop->flags, SOBJ_KILLABLE);
KillSprite(SpriteNum);
KillActor(actor);
break;
}
}

View file

@ -526,7 +526,7 @@ int DoVator(DSWActor* actor)
if (TEST_BOOL2(sp))
{
SetVatorInactive(SpriteNum);
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}

View file

@ -3925,7 +3925,7 @@ DoVomit(DSWActor* actor)
if (TEST(sprite[hit_sprite].extra, SPRX_PLAYER_OR_ENEMY))
{
DoDamage(hit_sprite, SpriteNum);
//KillSprite(SpriteNum);
//KillActor(actor);
return 0;
}
}
@ -3946,7 +3946,7 @@ DoVomitSplash(DSWActor* actor)
if ((u->WaitTics-=MISSILEMOVETICS) < 0)
{
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
@ -3966,7 +3966,7 @@ DoFastShrapJumpFall(DSWActor* actor)
u->WaitTics -= MISSILEMOVETICS;
if (u->WaitTics <= 0)
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
@ -3984,7 +3984,7 @@ DoTracerShrap(DSWActor* actor)
u->WaitTics -= MISSILEMOVETICS;
if (u->WaitTics <= 0)
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
@ -4051,7 +4051,7 @@ DoShrapDamage(DSWActor* actor)
return 0;
}
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
@ -4062,7 +4062,7 @@ DoShrapDamage(DSWActor* actor)
case HIT_SPRITE:
{
WeaponMoveHit(SpriteNum);
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
}
@ -4767,14 +4767,14 @@ DoFireballFlames(DSWActor* actor)
{
if (labs(sector[sp->sectnum].floorz - sp->z) <= Z(4))
{
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
}
if (TestDontStickSector(sp->sectnum))
{
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
}
@ -4792,7 +4792,7 @@ DoFireballFlames(DSWActor* actor)
{
if (u->Attach >= 0)
User[u->Attach]->flame = -1;
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
}
@ -4841,14 +4841,14 @@ DoBreakFlames(DSWActor* actor)
{
if (labs(sector[sp->sectnum].floorz - sp->z) <= Z(4))
{
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
}
if (TestDontStickSector(sp->sectnum))
{
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
}
@ -4865,7 +4865,7 @@ DoBreakFlames(DSWActor* actor)
{
if (u->Attach >= 0)
User[u->Attach]->flame = -1;
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
}
@ -5887,7 +5887,7 @@ DoDamage(short SpriteNum, short Weapon)
if (sp->statnum == STAT_MINE_STUCK)
{
SpawnMineExp(SpriteNum);
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
@ -13082,7 +13082,6 @@ InitSerpRing(DSWActor* actor)
void
InitSpellNapalm(PLAYERp pp)
{
short SpriteNum;
SPRITEp sp;
USERp u;
unsigned i;
@ -13115,22 +13114,22 @@ InitSpellNapalm(PLAYERp pp)
for (i = 0; i < SIZ(mp); i++)
{
SpriteNum = SpawnSprite(STAT_MISSILE, FIREBALL1, s_Napalm, pp->cursectnum,
auto actor = SpawnActor(STAT_MISSILE, FIREBALL1, s_Napalm, pp->cursectnum,
pp->posx, pp->posy, pp->posz + Z(12), pp->angle.ang.asbuild(), NAPALM_VELOCITY*2);
sp = &sprite[SpriteNum];
u = User[SpriteNum].Data();
sp = &actor->s();
u = actor->u();
sp->hitag = LUMINOUS; //Always full brightness
if (i==0) // Only attach sound to first projectile
{
PlaySound(DIGI_NAPWIZ, sp, v3df_follow);
Set3DSoundOwner(SpriteNum);
Set3DSoundOwner(u->SpriteNum);
}
//sp->owner = pp->SpriteP - sprite;
SetOwner(short(pp->SpriteP - sprite), SpriteNum);
SetOwner(pp->Actor(), actor);
sp->shade = -40;
sp->xrepeat = 32;
sp->yrepeat = 32;
@ -13150,7 +13149,7 @@ InitSpellNapalm(PLAYERp pp)
if (mp[i].dist_over != 0)
{
sp->ang = NORM_ANGLE(sp->ang + mp[i].ang);
HelpMissileLateral(SpriteNum, mp[i].dist_over);
HelpMissileLateral(u->SpriteNum, mp[i].dist_over);
sp->ang = NORM_ANGLE(sp->ang - mp[i].ang);
}
@ -13158,10 +13157,10 @@ InitSpellNapalm(PLAYERp pp)
u->ychange = MOVEy(sp->xvel, sp->ang);
u->zchange = sp->zvel;
if (MissileSetPos(SpriteNum, DoNapalm, mp[i].dist_out))
if (MissileSetPos(u->SpriteNum, DoNapalm, mp[i].dist_out))
{
pp->SpriteP->clipdist = oclipdist;
KillSprite(SpriteNum);
KillActor(actor);
continue;
}
@ -14441,7 +14440,7 @@ InitHeartAttack(PLAYERp pp)
if (MissileSetPos(SpriteNum, DoBloodWorm, mp[i].dist_out))
{
pp->SpriteP->clipdist = oclipdist;
KillSprite(SpriteNum);
KillActor(actor);
continue;
}
#endif
@ -17070,7 +17069,7 @@ DoSuicide(DSWActor* actor)
{
USER* u = actor->u();
int SpriteNum = u->SpriteNum;
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
@ -20080,7 +20079,7 @@ DoBubble(DSWActor* actor)
{
if (!SpriteWarpToSurface(sp))
{
KillSprite(SpriteNum);
KillActor(actor);
return true;
}
@ -20090,7 +20089,7 @@ DoBubble(DSWActor* actor)
}
else
{
KillSprite(SpriteNum);
KillActor(actor);
return true;
}
}
@ -20099,7 +20098,7 @@ DoBubble(DSWActor* actor)
{
if ((u->WaitTics -= MISSILEMOVETICS) <= 0)
{
KillSprite(SpriteNum);
KillActor(actor);
return true;
}
}
@ -20108,7 +20107,7 @@ DoBubble(DSWActor* actor)
{
if ((u->WaitTics -= MISSILEMOVETICS) <= 0)
{
KillSprite(SpriteNum);
KillActor(actor);
return true;
}
}
@ -20219,7 +20218,7 @@ int QueueStar(short SpriteNum)
if (TestDontStick(SpriteNum, -1))
{
KillSprite(SpriteNum);
KillActor(actor);
return -1;
}
@ -20239,7 +20238,7 @@ int QueueStar(short SpriteNum)
osp->y = sp->y;
osp->z = sp->z;
changespritesect(StarQueue[StarQueueHead], sp->sectnum);
KillSprite(SpriteNum);
KillActor(actor);
SpriteNum = StarQueue[StarQueueHead];
ASSERT(sprite[SpriteNum].statnum != MAXSTATUS);
}
@ -20740,19 +20739,19 @@ int QueueGeneric(short SpriteNum, short pic)
if (TEST(sector[sp->sectnum].extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER)
{
KillSprite(SpriteNum);
KillActor(actor);
return -1;
}
if (TEST(sector[sp->sectnum].extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA)
{
KillSprite(SpriteNum);
KillActor(actor);
return -1;
}
if (TestDontStickSector(sp->sectnum))
{
KillSprite(SpriteNum);
KillActor(actor);
return -1;
}
@ -20775,7 +20774,7 @@ int QueueGeneric(short SpriteNum, short pic)
osp->y = sp->y;
osp->z = sp->z;
changespritesect(GenericQueue[GenericQueueHead], sp->sectnum);
KillSprite(SpriteNum);
KillActor(actor);
SpriteNum = GenericQueue[GenericQueueHead];
ASSERT(sprite[SpriteNum].statnum != MAXSTATUS);
}
@ -20823,20 +20822,20 @@ DoShellShrap(short SpriteNum)
// If the shell doesn't fall in the allowable range, kill it.
if (u->ShellNum < (ShellCount-MAXSHELLS))
{
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
// Get rid of shell if they fall in non-divable liquid areas
if (TEST(sector[sp->sectnum].extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER)
{
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
if (TEST(sector[sp->sectnum].extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA)
{
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}
@ -20889,7 +20888,7 @@ DoShrapVelocity(int16_t SpriteNum)
switch (TEST(u->ret, HIT_MASK))
{
case HIT_PLAX_WALL:
KillSprite(SpriteNum);
KillActor(actor);
return true;
case HIT_SPRITE:
{
@ -21023,7 +21022,7 @@ DoShrapVelocity(int16_t SpriteNum)
// just outright kill it if its boucing around alot
if (u->bounce > 10)
{
KillSprite(SpriteNum);
KillActor(actor);
return true;
}
@ -21160,7 +21159,7 @@ ShrapKillSprite(short SpriteNum)
}
// If it wasn't in the switch statement, kill it.
KillSprite(SpriteNum);
KillActor(actor);
return 0;
}