Set object lifeleft to IMMORTAL_TIME if the byte read in demo playback is -1. This allows the objects to stay when playing a demo, going to the editor then playing the game from the editor

This commit is contained in:
Chris Taylor 2012-04-17 15:36:23 +08:00
parent 5197d7665a
commit aecfbbee23
2 changed files with 6 additions and 2 deletions

View file

@ -6,6 +6,7 @@ main/game.c: Make sure Cursegp is initialised if using it to set an object when
main/gameseq.c: Finish the game cleanly, closing Game_wind, if Current_level_num is 0
editor/med.c: Reset the player object for the editor, since demo playback mucks it up
main/render.c: Skip rendering of OBJ_NONE objects to avoid a failed Assert (can happen when playing a demo then going to the editor)
main/newdemo.c: Set object lifeleft to IMMORTAL_TIME if the byte read in demo playback is -1. This allows the objects to stay when playing a demo, going to the editor then playing the game from the editor
20120416
--------

View file

@ -541,10 +541,13 @@ void nd_read_object(object *obj)
else {
sbyte b;
// MWA old way -- won't work with big endian machines nd_read_byte((ubyte *)&(obj->lifeleft));
nd_read_byte(&b);
obj->lifeleft = (fix)b;
// MWA old way -- won't work with big endian machines nd_read_byte((ubyte *)&(obj->lifeleft));
obj->lifeleft = (fix)((int)obj->lifeleft << 12);
if (obj->lifeleft == -1)
obj->lifeleft = IMMORTAL_TIME;
else
obj->lifeleft = (fix)((int)obj->lifeleft << 12);
}
if (obj->type == OBJ_ROBOT) {