- changed the trip bomb indexing to use a separate counter for robustness.

This commit is contained in:
Christoph Oelckers 2020-11-03 07:14:39 +01:00
parent 0eb10f0313
commit 5cf288a05c
4 changed files with 8 additions and 2 deletions

View file

@ -890,7 +890,10 @@ static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa)
}
}
bomb->s.hitag = bomb->GetIndex(); // sigh...
// this originally used the sprite index as tag to link the laser segments.
// This value is never used again to reference an actor by index. Decouple this for robustness.
ud.bomb_tag = (ud.bomb_tag + 1) & 32767;
bomb->s.hitag = ud.bomb_tag;
S_PlayActorSound(LASERTRIP_ONWALL, bomb);
bomb->s.xvel = -20;
ssp(bomb, CLIPMASK0);

View file

@ -379,6 +379,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
("marker", ud.marker)
("ffire", ud.ffire)
("levelclock", ud.levelclock)
("bomb_tag", ud.bomb_tag)
.Array("sectorextra", sectorextra, numsectors)
("rtsplaying", rtsplaying)

View file

@ -339,7 +339,8 @@ int spawn_d(int j, int pn)
sp->yrepeat=5;
act->SetOwner(act);
sp->hitag = i; // hijack
ud.bomb_tag = (ud.bomb_tag + 1) & 32767;
sp->hitag = ud.bomb_tag;
sp->xvel = 16;
ssp(act, CLIPMASK0);

View file

@ -132,6 +132,7 @@ struct user_defs
short from_bonus;
short last_level, secretlevel;
short bomb_tag;
int const_visibility;