From 831c0cd82235bed9528ba4e22ac76b55250e1be8 Mon Sep 17 00:00:00 2001 From: Martin Haye Date: Mon, 31 Oct 2016 08:04:22 -0700 Subject: [PATCH] Fixed memory corruption issue when party screen updated during combat. --- Platform/Apple/virtual/extractText.sh | 0 Platform/Apple/virtual/src/plasma/combat.pla | 6 ++++-- Platform/Apple/virtual/src/plasma/gameloop.pla | 12 +++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) mode change 100644 => 100755 Platform/Apple/virtual/extractText.sh diff --git a/Platform/Apple/virtual/extractText.sh b/Platform/Apple/virtual/extractText.sh old mode 100644 new mode 100755 diff --git a/Platform/Apple/virtual/src/plasma/combat.pla b/Platform/Apple/virtual/src/plasma/combat.pla index 97762bd3..b402fa44 100644 --- a/Platform/Apple/virtual/src/plasma/combat.pla +++ b/Platform/Apple/virtual/src/plasma/combat.pla @@ -316,7 +316,7 @@ end /////////////////////////////////////////////////////////////////////////////////////////////////// def enemyCombatTurn(pe) word pl - byte roll, dam + byte roll, dam, needShow // Choose a target pl = randomFromListFiltered(global=>p_players, p_nextObj, @canFight) @@ -330,6 +330,7 @@ def enemyCombatTurn(pe) // TODO: consider player dodge // TODO: consider player agility // TODO: consider player skills + needShow = FALSE if roll <= pe->b_chanceToHit dam = rollDice(pe=>r_enemyDmg) printf1("and hits for %d damage!", dam) @@ -337,13 +338,14 @@ def enemyCombatTurn(pe) if pl=>w_health == 0 printf1(" %s is killed!", pl=>s_name) fin - showParty() + needShow = TRUE else puts("and misses.") fin puts("\n") displayStr(finishString(0)) + if needShow; showParty(); fin return TRUE end diff --git a/Platform/Apple/virtual/src/plasma/gameloop.pla b/Platform/Apple/virtual/src/plasma/gameloop.pla index e589bb7e..83c0bb26 100644 --- a/Platform/Apple/virtual/src/plasma/gameloop.pla +++ b/Platform/Apple/virtual/src/plasma/gameloop.pla @@ -1199,7 +1199,9 @@ export def showParty() loop // Finish up - if mapIs3D; copyWindow(); fin + if mapIs3D and texturesLoaded + copyWindow() + fin setWindow2() restoreCursor() needShowParty = FALSE @@ -1404,7 +1406,7 @@ def doRender() fin texturesLoaded = TRUE fin - if textDrawn and mapIs3D; copyWindow(); fin + if textDrawn and mapIs3D and texturesLoaded; copyWindow(); fin render() needRender = FALSE end @@ -1431,7 +1433,7 @@ def moveForward() if val >= 2 if textDrawn clearWindow() - if mapIs3D; copyWindow(); fin + if mapIs3D and texturesLoaded; copyWindow(); fin textDrawn = FALSE fin scriptEvent(@S_LEAVE, NULL) @@ -1637,7 +1639,7 @@ export def showMapName(mapName) displayChar('Y'-$40) // center mode displayStr(mapName) displayChar('N'-$40) // normal mode - if mapIs3D; copyWindow(); fin + if mapIs3D and texturesLoaded; copyWindow(); fin mapNameHash = newNameHash fin end @@ -1719,7 +1721,7 @@ def showAnimFrame() blit(curFullscreenImg + 2, $2000, 192, 40) // the +2 is to skip anim hdr offset needRender = FALSE // suppress display of map for this frame elsif mapIs3D - if textDrawn and mapIs3D; copyWindow(); fin + if textDrawn and mapIs3D and texturesLoaded; copyWindow(); fin render() fin end