- DoSuicide

This commit is contained in:
Christoph Oelckers 2021-10-30 22:44:16 +02:00
parent 400f822df3
commit 740c5e1e56
11 changed files with 57 additions and 57 deletions

View file

@ -327,7 +327,6 @@ int DoActorSectorDamage(DSWActor* actor)
SPRITEp sp = &actor->s(); SPRITEp sp = &actor->s();
SECT_USERp sectu = SectUser[sp->sectnum].Data(); SECT_USERp sectu = SectUser[sp->sectnum].Data();
SECTORp sectp = &sector[sp->sectnum]; SECTORp sectp = &sector[sp->sectnum];
int SpriteNum = actor->GetSpriteIndex();
if (u->Health <= 0) if (u->Health <= 0)
return false; return false;
@ -374,7 +373,7 @@ int DoActorSectorDamage(DSWActor* actor)
if (SpawnShrap(actor, nullptr, WPN_NM_SECTOR_SQUISH)) if (SpawnShrap(actor, nullptr, WPN_NM_SECTOR_SQUISH))
{ {
UpdateSinglePlayKills(actor); UpdateSinglePlayKills(actor);
SetSuicide(SpriteNum); SetSuicide(actor);
} }
else else
{ {

View file

@ -838,6 +838,7 @@ bool HitBreakWall(WALLp wp, int hit_x, int hit_y, int hit_z, short ang, short ty
int KillBreakSprite(short BreakSprite) int KillBreakSprite(short BreakSprite)
{ {
auto breakActor = &swActors[BreakSprite];
SPRITEp bp = &sprite[BreakSprite]; SPRITEp bp = &sprite[BreakSprite];
USERp bu = User[BreakSprite].Data(); USERp bu = User[BreakSprite].Data();
@ -856,11 +857,11 @@ int KillBreakSprite(short BreakSprite)
// a few things have users and are not StateControlled // a few things have users and are not StateControlled
KillSprite(BreakSprite); KillSprite(BreakSprite);
else else
SetSuicide(BreakSprite); SetSuicide(breakActor);
} }
else else
{ {
change_sprite_stat(BreakSprite, STAT_SUICIDE); change_actor_stat(breakActor, STAT_SUICIDE);
} }
return 0; return 0;

View file

@ -1005,7 +1005,7 @@ DoBunnyQuickJump(DSWActor* actor)
if (SpawnShrap(hitActor, actor)) if (SpawnShrap(hitActor, actor))
{ {
SetSuicide(hit_sprite); SetSuicide(hitActor);
} }
else else
DoActorDie(hitActor, actor, 0); DoActorDie(hitActor, actor, 0);
@ -1225,7 +1225,7 @@ void BunnyHatch(short Weapon)
if (SpawnShrap(actor, actorNew)) if (SpawnShrap(actor, actorNew))
{ {
SetSuicide(Weapon); SetSuicide(actor);
} }
else else
DoActorDie(actor, actorNew, 0); DoActorDie(actor, actorNew, 0);
@ -1336,7 +1336,7 @@ DoBunnyMove(DSWActor* actor)
// Sometimes they just won't die! // Sometimes they just won't die!
if (u->Health <= 0) if (u->Health <= 0)
SetSuicide(SpriteNum); SetSuicide(actor);
if (u->scale_speed) if (u->scale_speed)
{ {

View file

@ -633,7 +633,7 @@ int DoCoolgMatchPlayerZ(DSWActor* actor)
InitBloodSpray(SpriteNum, true, 105); InitBloodSpray(SpriteNum, true, 105);
InitBloodSpray(SpriteNum, true, 105); InitBloodSpray(SpriteNum, true, 105);
UpdateSinglePlayKills(actor); UpdateSinglePlayKills(actor);
SetSuicide(SpriteNum); SetSuicide(actor);
} }
// actor does a sine wave about u->sz - this is the z mid point // actor does a sine wave about u->sz - this is the z mid point

View file

@ -2256,7 +2256,7 @@ DoCarryFlag(DSWActor* actor)
} }
} }
} }
SetSuicide(Weapon); // Kill the flag, you scored! SetSuicide(actor); // Kill the flag, you scored!
} }
} }
else else
@ -2328,7 +2328,7 @@ DoCarryFlag(DSWActor* actor)
break; break;
case FLAG_DETONATE_STATE + 1: case FLAG_DETONATE_STATE + 1:
SpawnGrenadeExp(Weapon); SpawnGrenadeExp(Weapon);
SetSuicide(Weapon); SetSuicide(actor);
return false; return false;
break; break;
} }
@ -2368,7 +2368,7 @@ DoCarryFlagNoDet(DSWActor* actor)
{ {
if (u->FlagOwner >= 0) if (u->FlagOwner >= 0)
fu->WaitTics = 0; // Tell it to respawn fu->WaitTics = 0; // Tell it to respawn
SetSuicide(Weapon); SetSuicide(actor);
return false; return false;
} }
@ -2399,7 +2399,7 @@ DoCarryFlagNoDet(DSWActor* actor)
} }
} }
} }
SetSuicide(Weapon); // Kill the flag, you scored! SetSuicide(actor); // Kill the flag, you scored!
} }
return false; return false;

View file

@ -2647,7 +2647,7 @@ DriveCrush(PLAYERp pp, int *x, int *y)
UpdateSinglePlayKills(actor); UpdateSinglePlayKills(actor);
if (SpawnShrap(actor, nullptr, -99)) if (SpawnShrap(actor, nullptr, -99))
SetSuicide(i); SetSuicide(actor);
else else
KillSprite(i); KillSprite(i);
} }
@ -2719,7 +2719,7 @@ DriveCrush(PLAYERp pp, int *x, int *y)
if (sp->statnum == STAT_ENEMY) if (sp->statnum == STAT_ENEMY)
{ {
if (SpawnShrap(actor, nullptr, -99)) if (SpawnShrap(actor, nullptr, -99))
SetSuicide(i); SetSuicide(actor);
else else
KillSprite(i); KillSprite(i);
} }
@ -4915,7 +4915,7 @@ DoPlayerFireOutWater(PLAYERp pp)
if (pp->WadeDepth > 20) if (pp->WadeDepth > 20)
{ {
if (u->flame >= 0) if (u->flame >= 0)
SetSuicide(u->flame); SetSuicide(&swActors[u->flame]);
u->flame = -2; u->flame = -2;
} }
} }
@ -4929,7 +4929,7 @@ DoPlayerFireOutDeath(PLAYERp pp)
return; return;
if (u->flame >= 0) if (u->flame >= 0)
SetSuicide(u->flame); SetSuicide(&swActors[u->flame]);
u->flame = -2; u->flame = -2;
} }

View file

@ -359,7 +359,7 @@ DoSkullBeginDeath(DSWActor* actor)
sp->shade = -40; sp->shade = -40;
SpawnLittleExp(SpriteNum); SpawnLittleExp(SpriteNum);
SetSuicide(SpriteNum); SetSuicide(actor);
//u->spal = sp->pal = PALETTE_RED_LIGHTING; //u->spal = sp->pal = PALETTE_RED_LIGHTING;
@ -775,7 +775,7 @@ DoBettyBeginDeath(DSWActor* actor)
sp->shade = -40; sp->shade = -40;
SpawnLittleExp(SpriteNum); SpawnLittleExp(SpriteNum);
SetSuicide(SpriteNum); SetSuicide(actor);
//u->spal = sp->pal = PALETTE_RED_LIGHTING; //u->spal = sp->pal = PALETTE_RED_LIGHTING;

View file

@ -778,7 +778,7 @@ KillSprite(int16_t SpriteNum)
if (u->flame >= 0) if (u->flame >= 0)
{ {
SetSuicide(u->flame); SetSuicide(&swActors[u->flame]);
} }
User[SpriteNum].Clear(); User[SpriteNum].Clear();
} }
@ -5014,7 +5014,7 @@ ActorDrop(short SpriteNum, int x, int y, int z, short new_sector, short min_heig
if (florhit < 0 || ceilhit < 0) if (florhit < 0 || ceilhit < 0)
{ {
//SetSuicide(SpriteNum); //SetSuicide(actor);
return true; return true;
} }

View file

@ -3565,7 +3565,7 @@ AutoShrap:
p = StoneShrap; p = StoneShrap;
shrap_xsize = shrap_ysize = 4; shrap_xsize = shrap_ysize = 4;
shrap_bounce = true; shrap_bounce = true;
SetSuicide(short(parent - sprite)); // kill next iteration SetSuicide(parentActor); // kill next iteration
break; break;
case BOLT_EXP: case BOLT_EXP:
return false; return false;
@ -4431,8 +4431,9 @@ VehicleMoveHit(short SpriteNum)
bool bool
WeaponMoveHit(short SpriteNum) WeaponMoveHit(short SpriteNum)
{ {
USERp u = User[SpriteNum].Data(); auto actor = &swActors[SpriteNum];
SPRITEp sp = User[SpriteNum]->SpriteP; USERp u = actor->u();
SPRITEp sp = &actor->s();
if (!u->ret) if (!u->ret)
@ -4441,7 +4442,7 @@ WeaponMoveHit(short SpriteNum)
switch (TEST(u->ret, HIT_MASK)) switch (TEST(u->ret, HIT_MASK))
{ {
case HIT_PLAX_WALL: case HIT_PLAX_WALL:
SetSuicide(SpriteNum); SetSuicide(actor);
return true; return true;
case HIT_SECTOR: case HIT_SECTOR:
@ -4476,7 +4477,7 @@ WeaponMoveHit(short SpriteNum)
if (SectUser[hit_sect].Data() && FixedToInt(SectUser[hit_sect]->depth_fixed) > 0) if (SectUser[hit_sect].Data() && FixedToInt(SectUser[hit_sect]->depth_fixed) > 0)
{ {
SpawnSplash(SpriteNum); SpawnSplash(SpriteNum);
//SetSuicide(SpriteNum); //SetSuicide(actor);
return true; return true;
} }
@ -4512,7 +4513,7 @@ WeaponMoveHit(short SpriteNum)
{ {
if (labs(sp->z - sectp->ceilingz) < SPRITEp_SIZE_Z(sp)) if (labs(sp->z - sectp->ceilingz) < SPRITEp_SIZE_Z(sp))
{ {
SetSuicide(SpriteNum); SetSuicide(actor);
return true; return true;
} }
} }
@ -4894,10 +4895,8 @@ DoBreakFlames(DSWActor* actor)
return 0; return 0;
} }
int int SetSuicide(DSWActor* actor)
SetSuicide(short SpriteNum)
{ {
auto actor = &swActors[SpriteNum];
USERp u = actor->u(); USERp u = actor->u();
if (u != nullptr) if (u != nullptr)
@ -5074,7 +5073,7 @@ ActorChooseDeath(short SpriteNum, short Weapon)
PlaySound(DIGI_TOILETGIRLSCREAM, sp, v3df_none); PlaySound(DIGI_TOILETGIRLSCREAM, sp, v3df_none);
} }
if (SpawnShrap(actor, weapActor)) if (SpawnShrap(actor, weapActor))
SetSuicide(SpriteNum); SetSuicide(actor);
break; break;
} }
@ -5083,7 +5082,7 @@ ActorChooseDeath(short SpriteNum, short Weapon)
InitBloodSpray(SpriteNum,true,105); InitBloodSpray(SpriteNum,true,105);
InitBloodSpray(SpriteNum,true,105); InitBloodSpray(SpriteNum,true,105);
if (SpawnShrap(actor, weapActor)) if (SpawnShrap(actor, weapActor))
SetSuicide(SpriteNum); SetSuicide(actor);
break; break;
default: default:
@ -5153,7 +5152,7 @@ ActorChooseDeath(short SpriteNum, short Weapon)
if (SpawnShrap(actor, weapActor)) if (SpawnShrap(actor, weapActor))
{ {
SetSuicide(SpriteNum); SetSuicide(actor);
} }
else else
DoActorDie(actor, weapActor, 0); DoActorDie(actor, weapActor, 0);
@ -5163,7 +5162,7 @@ ActorChooseDeath(short SpriteNum, short Weapon)
#if 0 #if 0
case PLASMA_FOUNTAIN: case PLASMA_FOUNTAIN:
if (SpawnShrap(SpriteNum, Weapon)) if (SpawnShrap(SpriteNum, Weapon))
SetSuicide(SpriteNum); SetSuicide(actor);
else else
DoActorDie(actor, weapActor, 0); DoActorDie(actor, weapActor, 0);
break; break;
@ -5237,7 +5236,7 @@ ActorChooseDeath(short SpriteNum, short Weapon)
if (SpawnShrap(actor, weapActor)) if (SpawnShrap(actor, weapActor))
{ {
SetSuicide(SpriteNum); SetSuicide(actor);
} }
else else
DoActorDie(actor, weapActor, 0); DoActorDie(actor, weapActor, 0);
@ -5928,7 +5927,7 @@ DoDamage(short SpriteNum, short Weapon)
PlayerSound(TauntAIVocs[choosesnd],v3df_dontpan|v3df_follow,pp); PlayerSound(TauntAIVocs[choosesnd],v3df_dontpan|v3df_follow,pp);
} }
SpawnShrap(actor, weapActor); SpawnShrap(actor, weapActor);
SetSuicide(SpriteNum); SetSuicide(actor);
return 0; return 0;
} }
} }
@ -6331,7 +6330,7 @@ DoDamage(short SpriteNum, short Weapon)
StarBlood(SpriteNum, Weapon); StarBlood(SpriteNum, Weapon);
wu->ID = 0; wu->ID = 0;
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
case SPEAR_R0: case SPEAR_R0:
@ -6364,7 +6363,7 @@ DoDamage(short SpriteNum, short Weapon)
SpawnBlood(actor, weapActor, 0, 0, 0, 0); SpawnBlood(actor, weapActor, 0, 0, 0, 0);
wu->ID = 0; wu->ID = 0;
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
case LAVA_BOULDER: case LAVA_BOULDER:
@ -6395,7 +6394,7 @@ DoDamage(short SpriteNum, short Weapon)
SpawnBlood(actor, weapActor, 0, 0, 0, 0); SpawnBlood(actor, weapActor, 0, 0, 0, 0);
wu->ID = 0; wu->ID = 0;
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
case LAVA_SHARD: case LAVA_SHARD:
@ -6426,7 +6425,7 @@ DoDamage(short SpriteNum, short Weapon)
SpawnBlood(actor, weapActor, 0, 0, 0, 0); SpawnBlood(actor, weapActor, 0, 0, 0, 0);
wu->ID = 0; wu->ID = 0;
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
case UZI_SMOKE: case UZI_SMOKE:
@ -6555,7 +6554,7 @@ DoDamage(short SpriteNum, short Weapon)
ActorStdMissile(SpriteNum, Weapon); ActorStdMissile(SpriteNum, Weapon);
} }
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
case SERP_METEOR: case SERP_METEOR:
@ -6582,7 +6581,7 @@ DoDamage(short SpriteNum, short Weapon)
ActorStdMissile(SpriteNum, Weapon); ActorStdMissile(SpriteNum, Weapon);
} }
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
case BOLT_THINMAN_R0: case BOLT_THINMAN_R0:
@ -6611,7 +6610,7 @@ DoDamage(short SpriteNum, short Weapon)
SpawnNuclearExp(Weapon); SpawnNuclearExp(Weapon);
else else
SpawnBoltExp(Weapon); SpawnBoltExp(Weapon);
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
case BOLT_THINMAN_R1: case BOLT_THINMAN_R1:
@ -6656,7 +6655,7 @@ DoDamage(short SpriteNum, short Weapon)
wu->ID = 0; // No more damage wu->ID = 0; // No more damage
SpawnTracerExp(Weapon); SpawnTracerExp(Weapon);
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
case BOLT_THINMAN_R2: case BOLT_THINMAN_R2:
@ -6685,7 +6684,7 @@ DoDamage(short SpriteNum, short Weapon)
SpawnNuclearExp(Weapon); SpawnNuclearExp(Weapon);
else else
SpawnBoltExp(Weapon); SpawnBoltExp(Weapon);
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
case BOLT_THINMAN_R4: case BOLT_THINMAN_R4:
@ -6716,7 +6715,7 @@ DoDamage(short SpriteNum, short Weapon)
//InitBloodSpray(Weapon,true,-1); //InitBloodSpray(Weapon,true,-1);
//InitBloodSpray(Weapon,true,-1); //InitBloodSpray(Weapon,true,-1);
//InitBloodSpray(Weapon,true,-1); //InitBloodSpray(Weapon,true,-1);
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
case SUMO_RUN_R0: case SUMO_RUN_R0:
@ -7031,7 +7030,7 @@ DoDamage(short SpriteNum, short Weapon)
ActorChooseDeath(SpriteNum, Weapon); ActorChooseDeath(SpriteNum, Weapon);
} }
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
case Vomit1: case Vomit1:
@ -7058,7 +7057,7 @@ DoDamage(short SpriteNum, short Weapon)
ActorChooseDeath(SpriteNum, Weapon); ActorChooseDeath(SpriteNum, Weapon);
} }
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
case COOLG_FIRE: case COOLG_FIRE:
@ -7084,7 +7083,7 @@ DoDamage(short SpriteNum, short Weapon)
} }
// u->ID = 0; // u->ID = 0;
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
// Skull Exp // Skull Exp
@ -7153,7 +7152,7 @@ DoDamage(short SpriteNum, short Weapon)
if (wp->owner >= 0) // For SerpGod Ring if (wp->owner >= 0) // For SerpGod Ring
User[wp->owner]->Counter--; User[wp->owner]->Counter--;
SpawnFireballFlames(Weapon, SpriteNum); SpawnFireballFlames(Weapon, SpriteNum);
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
case FIREBALL: case FIREBALL:
@ -7186,7 +7185,7 @@ DoDamage(short SpriteNum, short Weapon)
} }
SpawnGoroFireballExp(Weapon); SpawnGoroFireballExp(Weapon);
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
case FIREBALL_FLAMES: case FIREBALL_FLAMES:
@ -7268,7 +7267,7 @@ DoDamage(short SpriteNum, short Weapon)
ActorHealth(SpriteNum, damage); ActorHealth(SpriteNum, damage);
ActorStdMissile(SpriteNum, Weapon); ActorStdMissile(SpriteNum, Weapon);
ActorChooseDeath(SpriteNum, Weapon); ActorChooseDeath(SpriteNum, Weapon);
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
} }
else if (u->ID == RIPPER_RUN_R0) else if (u->ID == RIPPER_RUN_R0)
@ -7282,7 +7281,7 @@ DoDamage(short SpriteNum, short Weapon)
InitPlasmaFountain(wp, sp); InitPlasmaFountain(wp, sp);
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
@ -7312,7 +7311,7 @@ DoDamage(short SpriteNum, short Weapon)
ActorChooseDeath(SpriteNum, Weapon); ActorChooseDeath(SpriteNum, Weapon);
} }
SetSuicide(Weapon); SetSuicide(weapActor);
break; break;
#if 0 #if 0
@ -12235,6 +12234,7 @@ DoBloodWorm(DSWActor* actor)
StatIterator it(STAT_ENEMY); StatIterator it(STAT_ENEMY);
while ((i = it.NextIndex()) >= 0) while ((i = it.NextIndex()) >= 0)
{ {
auto itActor = &swActors[i];
tsp = &sprite[i]; tsp = &sprite[i];
tu = User[i].Data(); tu = User[i].Data();
@ -12244,7 +12244,7 @@ DoBloodWorm(DSWActor* actor)
{ {
InitBloodSpray(i,true,105); InitBloodSpray(i,true,105);
InitBloodSpray(i,true,105); InitBloodSpray(i,true,105);
SetSuicide(i); SetSuicide(itActor);
break; break;
} }
} }

View file

@ -200,7 +200,7 @@ enum ShrapPos
Z_BOT Z_BOT
}; };
int SetSuicide(short SpriteNum); int SetSuicide(DSWActor*);
void UpdateSinglePlayKills(DSWActor* actor); void UpdateSinglePlayKills(DSWActor* actor);
int InitPlasmaFountain(SPRITEp wp, SPRITEp sp); int InitPlasmaFountain(SPRITEp wp, SPRITEp sp);
int InitCoolgDrip(short SpriteNum); int InitCoolgDrip(short SpriteNum);

View file

@ -893,7 +893,7 @@ DoZombieMove(DSWActor* actor)
InitBloodSpray(SpriteNum,true,105); InitBloodSpray(SpriteNum,true,105);
InitBloodSpray(SpriteNum,true,105); InitBloodSpray(SpriteNum,true,105);
InitBloodSpray(SpriteNum,true,105); InitBloodSpray(SpriteNum,true,105);
SetSuicide(SpriteNum); SetSuicide(actor);
return 0; return 0;
} }
@ -944,7 +944,7 @@ NullZombie(DSWActor* actor)
InitBloodSpray(SpriteNum,true,105); InitBloodSpray(SpriteNum,true,105);
InitBloodSpray(SpriteNum,true,105); InitBloodSpray(SpriteNum,true,105);
InitBloodSpray(SpriteNum,true,105); InitBloodSpray(SpriteNum,true,105);
SetSuicide(SpriteNum); SetSuicide(actor);
return 0; return 0;
} }