Explicitly call A_DeleteSprite() from game code instead of relying on macro expansion.

git-svn-id: https://svn.eduke32.com/eduke32@2452 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-03-11 17:38:13 +00:00
parent 3917e05c1e
commit bdc02d36d9
8 changed files with 31 additions and 34 deletions

View file

@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# define ACTOR_STATIC static # define ACTOR_STATIC static
#endif #endif
#define KILLIT(KX) { deletesprite(KX); goto BOLT; } #define KILLIT(KX) { A_DeleteSprite(KX); goto BOLT; }
extern int32_t g_numEnvSoundsPlaying; extern int32_t g_numEnvSoundsPlaying;
extern int32_t g_noEnemies; extern int32_t g_noEnemies;
@ -501,7 +501,7 @@ void G_Polymer_UnInit(void)
} }
#endif #endif
// all calls to deletesprite() from the game are wrapped by this function // deletesprite() game wrapper
void A_DeleteSprite(int32_t s) void A_DeleteSprite(int32_t s)
{ {
if (block_deletesprite) if (block_deletesprite)
@ -527,16 +527,14 @@ void A_DeleteSprite(int32_t s)
} }
#endif #endif
#undef deletesprite
deletesprite(s); deletesprite(s);
#define deletesprite A_DeleteSprite
} }
void A_AddToDeleteQueue(int32_t i) void A_AddToDeleteQueue(int32_t i)
{ {
if (g_netClientPeer || g_spriteDeleteQueueSize == 0) if (g_netClientPeer || g_spriteDeleteQueueSize == 0)
{ {
deletesprite(i); A_DeleteSprite(i);
return; return;
} }
@ -4777,7 +4775,7 @@ DETONATEB:
if (j != i) if (j != i)
{ {
deletesprite(j); A_DeleteSprite(j);
break; break;
} }
j = l; j = l;
@ -5008,7 +5006,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5
t[1]++; t[1]++;
} }
if (t[1] == 5) if (t[1] == 5)
deletesprite(i); A_DeleteSprite(i);
goto BOLT; goto BOLT;
case FRAMEEFFECT1_13__STATIC: case FRAMEEFFECT1_13__STATIC:
if (PLUTOPAK) goto BOLT; // JBF: ideally this should never happen... if (PLUTOPAK) goto BOLT; // JBF: ideally this should never happen...
@ -5900,7 +5898,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
{ {
A_DoGutsDir(j,JIBS6,72); A_DoGutsDir(j,JIBS6,72);
A_PlaySound(SQUISHED,i); A_PlaySound(SQUISHED,i);
deletesprite(j); A_DeleteSprite(j);
} }
} }
j = l; j = l;
@ -6090,7 +6088,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
{ {
A_DoGutsDir(j,JIBS6,24); A_DoGutsDir(j,JIBS6,24);
A_PlaySound(SQUISHED,j); A_PlaySound(SQUISHED,j);
deletesprite(j); A_DeleteSprite(j);
} }
} }

View file

@ -72,7 +72,6 @@ typedef enum basepal_ {
BASEPALCOUNT BASEPALCOUNT
} basepal_t; } basepal_t;
#define deletesprite A_DeleteSprite
void A_DeleteSprite(int32_t s); void A_DeleteSprite(int32_t s);
typedef struct { typedef struct {

View file

@ -124,7 +124,7 @@ void VM_OnEvent(register int32_t iEventID, register int32_t iActor, register int
if (vm.g_p >= 0 && g_player[vm.g_p].ps->actorsqu == vm.g_i) if (vm.g_p >= 0 && g_player[vm.g_p].ps->actorsqu == vm.g_i)
g_player[vm.g_p].ps->actorsqu = -1; g_player[vm.g_p].ps->actorsqu = -1;
deletesprite(vm.g_i); A_DeleteSprite(vm.g_i);
} }
Bmemcpy(&vm, &vm_backup, sizeof(vmstate_t)); Bmemcpy(&vm, &vm_backup, sizeof(vmstate_t));
@ -4905,14 +4905,14 @@ void A_LoadActor(int32_t iActor)
{ {
// if(A_CheckEnemySprite(vm.g_sp)) // if(A_CheckEnemySprite(vm.g_sp))
// g_player[vm.g_p].ps->actors_killed++; // g_player[vm.g_p].ps->actors_killed++;
deletesprite(vm.g_i); A_DeleteSprite(vm.g_i);
return; return;
} }
VM_Execute(1); VM_Execute(1);
if (vm.g_flags & VM_KILL) if (vm.g_flags & VM_KILL)
deletesprite(vm.g_i); A_DeleteSprite(vm.g_i);
} }
void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist) void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
@ -4923,7 +4923,7 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
if (g_netClient && A_CheckSpriteFlags(iActor, SPRITE_NULL)) if (g_netClient && A_CheckSpriteFlags(iActor, SPRITE_NULL))
{ {
deletesprite(iActor); A_DeleteSprite(iActor);
return; return;
} }
@ -4938,7 +4938,7 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
{ {
if (A_CheckEnemySprite(vm.g_sp)) if (A_CheckEnemySprite(vm.g_sp))
g_player[vm.g_p].ps->actors_killed++; g_player[vm.g_p].ps->actors_killed++;
deletesprite(vm.g_i); A_DeleteSprite(vm.g_i);
return; return;
} }
@ -4970,7 +4970,7 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
if (vm.g_p >= 0 && g_player[vm.g_p].ps->actorsqu == vm.g_i) if (vm.g_p >= 0 && g_player[vm.g_p].ps->actorsqu == vm.g_i)
g_player[vm.g_p].ps->actorsqu = -1; g_player[vm.g_p].ps->actorsqu = -1;
deletesprite(vm.g_i); A_DeleteSprite(vm.g_i);
return; return;
} }

View file

@ -567,7 +567,7 @@ int32_t Net_UnpackSprite(int32_t i, uint8_t *pbuf)
{ {
// j += sizeof(netactor_t); // j += sizeof(netactor_t);
if (sprite[i].sectnum != MAXSECTORS && sprite[i].statnum != MAXSTATUS) if (sprite[i].sectnum != MAXSECTORS && sprite[i].statnum != MAXSTATUS)
deletesprite(i); A_DeleteSprite(i);
return j; return j;
} }
@ -577,7 +577,7 @@ int32_t Net_UnpackSprite(int32_t i, uint8_t *pbuf)
int16_t sprs[MAXSPRITES], z = 0; int16_t sprs[MAXSPRITES], z = 0;
while ((sprs[z++] = insertsprite(sect, statnum)) != i); while ((sprs[z++] = insertsprite(sect, statnum)) != i);
z--; z--;
while (z--) deletesprite(sprs[z]); while (z--) A_DeleteSprite(sprs[z]);
} }
else else
{ {

View file

@ -494,7 +494,7 @@ static int32_t osdcmd_spawn(const osdfuncparm_t *parm)
if (setsprite(idx, &vect) < 0) if (setsprite(idx, &vect) < 0)
{ {
OSD_Printf("spawn: Sprite can't be spawned into null space\n"); OSD_Printf("spawn: Sprite can't be spawned into null space\n");
deletesprite(idx); A_DeleteSprite(idx);
} }
} }

View file

@ -5605,7 +5605,7 @@ HORIZONLY:
case STATUE__STATIC: case STATUE__STATIC:
if (sprite[p->actorsqu].yvel) if (sprite[p->actorsqu].yvel)
G_OperateRespawns(sprite[p->actorsqu].yvel); G_OperateRespawns(sprite[p->actorsqu].yvel);
deletesprite(p->actorsqu); A_DeleteSprite(p->actorsqu);
break; break;
case APLAYER__STATIC: case APLAYER__STATIC:
P_QuickKill(g_player[sprite[p->actorsqu].yvel].ps); P_QuickKill(g_player[sprite[p->actorsqu].yvel].ps);
@ -5614,7 +5614,7 @@ HORIZONLY:
default: default:
if (A_CheckEnemySprite(&sprite[p->actorsqu])) if (A_CheckEnemySprite(&sprite[p->actorsqu]))
p->actors_killed++; p->actors_killed++;
deletesprite(p->actorsqu); A_DeleteSprite(p->actorsqu);
break; break;
} }
} }

View file

@ -1178,7 +1178,7 @@ static inline void prelevel(char g)
{ {
case GPSPEED__STATIC: case GPSPEED__STATIC:
sector[SECT].extra = SLT; sector[SECT].extra = SLT;
deletesprite(i); A_DeleteSprite(i);
break; break;
case CYCLER__STATIC: case CYCLER__STATIC:
@ -1194,7 +1194,7 @@ static inline void prelevel(char g)
cyclers[g_numCyclers][4] = SHT; cyclers[g_numCyclers][4] = SHT;
cyclers[g_numCyclers][5] = (SA == 1536); cyclers[g_numCyclers][5] = (SA == 1536);
g_numCyclers++; g_numCyclers++;
deletesprite(i); A_DeleteSprite(i);
break; break;
case SECTOREFFECTOR__STATIC: case SECTOREFFECTOR__STATIC:
@ -1720,7 +1720,7 @@ static void resetpspritevars(char g)
j++; j++;
} }
else deletesprite(i); else A_DeleteSprite(i);
i = nexti; i = nexti;
} }
} }

View file

@ -1993,7 +1993,7 @@ void A_DamageObject(int32_t i,int32_t sn)
case OCEANSPRITE4__STATIC: case OCEANSPRITE4__STATIC:
case OCEANSPRITE5__STATIC: case OCEANSPRITE5__STATIC:
A_Spawn(i,SMALLSMOKE); A_Spawn(i,SMALLSMOKE);
deletesprite(i); A_DeleteSprite(i);
break; break;
case QUEBALL__STATIC: case QUEBALL__STATIC:
case STRIPEBALL__STATIC: case STRIPEBALL__STATIC:
@ -2015,7 +2015,7 @@ void A_DamageObject(int32_t i,int32_t sn)
else else
{ {
A_SpawnWallGlass(i,-1,3); A_SpawnWallGlass(i,-1,3);
deletesprite(i); A_DeleteSprite(i);
} }
} }
break; break;
@ -2074,7 +2074,7 @@ void A_DamageObject(int32_t i,int32_t sn)
if (PN == CACTUS) if (PN == CACTUS)
PN = CACTUSBROKE; PN = CACTUSBROKE;
CS &= ~257; CS &= ~257;
// else deletesprite(i); // else A_DeleteSprite(i);
break; break;
} }
break; break;
@ -2084,7 +2084,7 @@ void A_DamageObject(int32_t i,int32_t sn)
for (k=6; k>0; k--) for (k=6; k>0; k--)
A_InsertSprite(SECT,SX,SY,SZ-(8<<8),SCRAP1+(krand()&15),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(sprite[i].zvel>>2),i,5); A_InsertSprite(SECT,SX,SY,SZ-(8<<8),SCRAP1+(krand()&15),-8,48,48,krand()&2047,(krand()&63)+64,-(krand()&4095)-(sprite[i].zvel>>2),i,5);
A_PlaySound(GLASS_HEAVYBREAK,i); A_PlaySound(GLASS_HEAVYBREAK,i);
deletesprite(i); A_DeleteSprite(i);
break; break;
@ -2116,7 +2116,7 @@ void A_DamageObject(int32_t i,int32_t sn)
A_InsertSprite(SECT,SX,SY,sector[SECT].floorz-(12<<8)-(j<<9),SCRAP1+(krand()&15),-8,64,64, A_InsertSprite(SECT,SX,SY,sector[SECT].floorz-(12<<8)-(j<<9),SCRAP1+(krand()&15),-8,64,64,
krand()&2047,(krand()&127)+64,-(krand()&511)-256,i,5); krand()&2047,(krand()&127)+64,-(krand()&511)-256,i,5);
A_Spawn(i,EXPLOSION2); A_Spawn(i,EXPLOSION2);
deletesprite(i); A_DeleteSprite(i);
} }
break; break;
case BOTTLE1__STATIC: case BOTTLE1__STATIC:
@ -2160,7 +2160,7 @@ void A_DamageObject(int32_t i,int32_t sn)
A_PlaySound(GLASS_BREAKING,i); A_PlaySound(GLASS_BREAKING,i);
SA = krand()&2047; SA = krand()&2047;
A_SpawnWallGlass(i,-1,8); A_SpawnWallGlass(i,-1,8);
deletesprite(i); A_DeleteSprite(i);
break; break;
case FETUS__STATIC: case FETUS__STATIC:
PN = FETUSBROKE; PN = FETUSBROKE;
@ -2178,7 +2178,7 @@ void A_DamageObject(int32_t i,int32_t sn)
case BOTTLE7__STATIC: case BOTTLE7__STATIC:
A_PlaySound(GLASS_BREAKING,i); A_PlaySound(GLASS_BREAKING,i);
A_SpawnWallGlass(i,-1,10); A_SpawnWallGlass(i,-1,10);
deletesprite(i); A_DeleteSprite(i);
break; break;
case HYDROPLANT__STATIC: case HYDROPLANT__STATIC:
PN = BROKEHYDROPLANT; PN = BROKEHYDROPLANT;
@ -2197,7 +2197,7 @@ void A_DamageObject(int32_t i,int32_t sn)
case BROKEHYDROPLANT__STATIC: case BROKEHYDROPLANT__STATIC:
A_PlaySound(GLASS_BREAKING,i); A_PlaySound(GLASS_BREAKING,i);
A_SpawnWallGlass(i,-1,5); A_SpawnWallGlass(i,-1,5);
deletesprite(i); A_DeleteSprite(i);
break; break;
case TOILET__STATIC: case TOILET__STATIC:
@ -2314,7 +2314,7 @@ void A_DamageObject(int32_t i,int32_t sn)
A_DoGuts(i,JIBS5,1); A_DoGuts(i,JIBS5,1);
A_DoGuts(i,JIBS3,6); A_DoGuts(i,JIBS3,6);
S_PlaySound(SQUISHED); S_PlaySound(SQUISHED);
deletesprite(i); A_DeleteSprite(i);
break; break;
case CHAIR1__STATIC: case CHAIR1__STATIC:
case CHAIR2__STATIC: case CHAIR2__STATIC:
@ -2334,7 +2334,7 @@ void A_DamageObject(int32_t i,int32_t sn)
A_PlaySound(GLASS_HEAVYBREAK,i); A_PlaySound(GLASS_HEAVYBREAK,i);
s = &sprite[i]; s = &sprite[i];
for (j=16; j>0; j--) RANDOMSCRAP; for (j=16; j>0; j--) RANDOMSCRAP;
deletesprite(i); A_DeleteSprite(i);
break; break;
case PLAYERONWATER__STATIC: case PLAYERONWATER__STATIC:
i = OW; i = OW;