From aecfbbee23240ff6beed28db6e590be7520e4180 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Tue, 17 Apr 2012 15:36:23 +0800 Subject: [PATCH] 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 --- CHANGELOG.txt | 1 + main/newdemo.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index bfd747904..31577f727 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 -------- diff --git a/main/newdemo.c b/main/newdemo.c index 402edec05..47397c3c1 100644 --- a/main/newdemo.c +++ b/main/newdemo.c @@ -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) {