From 7efd8f81839f00406637075d517e025b4efbcf9b Mon Sep 17 00:00:00 2001 From: zicodxx Date: Fri, 26 Aug 2011 18:56:22 +0200 Subject: [PATCH] Due to conversion from fix64 to fix Boss_dying_start_time was not 0 when saving even if boss was not dead - fixed; Fixed warning about set but unused variable --- CHANGELOG.txt | 4 ++++ main/ai.c | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ccf8e1639..08517f926 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D2X-Rebirth Changelog +20110826 +-------- +main/ai.c: Due to conversion from fix64 to fix Boss_dying_start_time was not 0 when saving even if boss was not dead - fixed; Fixed warning about set but unused variable + 20110720 -------- main/menu: Added Polygon model viewer and GameBitmaps viewer in non-Release build for debugging, messing around, DXX-Redrawn, etc. diff --git a/main/ai.c b/main/ai.c index cf0a77054..253a0cb56 100644 --- a/main/ai.c +++ b/main/ai.c @@ -625,7 +625,6 @@ _exit_cheat: default: { int pv; - fix dtp = dist_to_player/4; if (aip->GOAL_STATE == AIS_FLIN) aip->GOAL_STATE = AIS_FIRE; @@ -639,7 +638,6 @@ _exit_cheat: // If player cloaked, visibility is screwed up and superboss will gate in robots when not supposed to. if (Players[Player_num].flags & PLAYER_FLAGS_CLOAKED) { pv = 0; - dtp = vm_vec_dist_quick(&ConsoleObject->pos, &obj->pos)/4; } do_boss_stuff(obj, pv); @@ -1617,10 +1615,19 @@ int ai_save_state(PHYSFS_file *fp) tmptime32 = Last_gate_time - GameTime64; PHYSFS_write(fp, &tmptime32, sizeof(fix), 1); PHYSFS_write(fp, &Gate_interval, sizeof(fix), 1); - if (Boss_dying_start_time - GameTime64 < F1_0*(-18000)) - tmptime32 = F1_0*(-18000); + if (Boss_dying_start_time == 0) // if Boss not dead, yet we expect this to be 0, so do not convert! + { + tmptime32 = 0; + } else - tmptime32 = Boss_dying_start_time - GameTime64; + { + if (Boss_dying_start_time - GameTime64 < F1_0*(-18000)) + tmptime32 = F1_0*(-18000); + else + tmptime32 = Boss_dying_start_time - GameTime64; + if (tmptime32 == 0) // now if our converted value went 0 we should do something against it + tmptime32 = -1; + } PHYSFS_write(fp, &tmptime32, sizeof(fix), 1); PHYSFS_write(fp, &Boss_dying, sizeof(int), 1); PHYSFS_write(fp, &Boss_dying_sound_playing, sizeof(int), 1);