From 670219fa5a1b7047faa0a9922a16f70930ae6ee6 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Tue, 17 Apr 2012 15:35: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 ea5acaf71..5b774d8ee 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -5,6 +5,7 @@ D1X-Rebirth Changelog main/gameseq.c: Allow level progressing if playing the builtin mission with EDITOR compiled - only exit 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 76c1dad8d..adeb35f99 100644 --- a/main/newdemo.c +++ b/main/newdemo.c @@ -518,10 +518,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) && !shareware) {