This still passed the sprites instead of the actors. Moved the relinking code to DCoreActor::Destroy because it is the same for all games.
Also did a little bit of sound cleanup to ensure the sound backend does not hold stale actor pointers.
There's little benefit of using pointers here - it inflates a critical render struct, does not make any code more readable and requires quite deep refactoring of hw_bunchdrawer.
Now, with all fields having the same tyoe and name a lot less code needs to be changed.
Both RRRA E3L1.map and SW $yamato.map have this:
Wall x and Wall x+1 have identical properties and both reference Wall x+2 as point2.
The duplicate in this case can be safely deleted to make the sector well formed.
* the saveable tables were initialized too late when reading in the actors.
* the abort messages for the saveables did not show. We need to use I_FatalError here, plus some actor list modifications to make this work.
The backwards search loop starts at one element behind the data it is supposed to check. If this is the last wall in the map it accesses undefined memory.
This tripped the range check in TArray for wall[].
* Lines in question:
** 606 | if (chan->SoundID == nSound + 1)
** 621 | if (chan->SoundID == nSound + 1)
* All data sent to `PlayFX2()` and functions that wrap `PlayFX2()` are signed values, so keep signed all the way through.
Apparently something in the crane code can cause a condition where this wasn't cleared before grabbing a player.
Formerly these two were the same variable but had to be separated.
This reverts commit c074b0995648a4057c516e5646f5fe7a11719317.
* The commit notes talk about `updatesectorneighborz()`, but the change is applied to `nextsectorneighborz()`. Further to this, `nextsectorneighborz()` is only called from some ptr wrappers in `build.h` and they both test against `-1` return values.
```
inline sectortype* nextsectorneighborzptr(int16_t sectnum, int32_t refz, int16_t topbottom, int16_t direction)
{
auto sect = nextsectorneighborz(sectnum, refz, topbottom, direction);
return sect == -1? nullptr : §or[sect];
}
inline sectortype* nextsectorneighborzptr(sectortype* sectp, int32_t refz, int16_t topbottom, int16_t direction)
{
auto sect = nextsectorneighborz(sector.IndexOf(sectp), refz, topbottom, direction);
return sect == -1? nullptr : §or[sect];
}
```
* Also fixes broken Duke elevators and possibly a whole raft of issues.