mirror of
https://github.com/BodbDearg/PsyDoom.git
synced 2025-02-22 06:02:32 +00:00

(1) Do this to fix occasional undefined behavior with dangling pointers after certain enemies (like Lost Souls) have been removed from the game. I first noticed this bug when testing out the save file code; the system was trying to serialize a map object reference which had been invalidated. Fix the problem by using a construct similar to 'std::weak_ptr' but for map objects. (2 ) As part of this fix also, add extra null checks and verification for the 'target' and 'tracer' fields throughout the code, since they can now be nulled at any time. (3) Related: re-record NTSC DOOM MAP23 demo since it had undefined behavior that can't be reproduced, with dangling 'mobj_t' pointer fields. (4) Unrelated: fix a slight bug where the game was doing a line of sight check from the player to other map objects. (5) Unrelated: fix a crash playing demos via the '-playdemo' command where the map has a fire sky. Need to ensure the texture metrics for the sky texture are updated.