Skip to content

Commit

Permalink
fix(zc): prevent calling dmap script twice in scrolling dmap warp
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Dec 23, 2023
1 parent 297b543 commit e8edc34
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/zc/hero.cpp
Expand Up @@ -25460,10 +25460,8 @@ bool HeroClass::HasHeavyBoots()
return false;
}

static bool refresh_dmap_scrollscript = false;
bool HeroClass::dowarp(int32_t type, int32_t index, int32_t warpsfx)
{
refresh_dmap_scrollscript = false;
byte reposition_sword_postwarp = 0;
if(index<0)
{
Expand Down Expand Up @@ -26017,7 +26015,7 @@ bool HeroClass::dowarp(int32_t type, int32_t index, int32_t warpsfx)
{
sdir = dir;
}

scrollscr(sdir, wscr+DMaps[wdmap].xoff, wdmap);
//dlevel = DMaps[wdmap].level; //Fix dlevel and draw the map (end hack). -Z

Expand Down Expand Up @@ -26557,9 +26555,7 @@ bool HeroClass::dowarp(int32_t type, int32_t index, int32_t warpsfx)
}
return false;
}




// Stop Hero from drowning!
if(action==drowning || action==lavadrowning || action==sidedrowning)
{
Expand Down Expand Up @@ -26737,11 +26733,6 @@ bool HeroClass::dowarp(int32_t type, int32_t index, int32_t warpsfx)
FFScript::deallocateAllScriptOwned(ScriptType::DMap, olddmap);
FFCore.initZScriptDMapScripts();
FFCore.initZScriptScriptedActiveSubscreen();
if(refresh_dmap_scrollscript)
{
run_scrolling_script_int(false); //Pre-waitdraw
refresh_dmap_scrollscript = false;
}
}
is_warping = false;
if(!get_qr(qr_SCROLLWARP_NO_RESET_FRAME))
Expand Down Expand Up @@ -28709,7 +28700,7 @@ void HeroClass::scrollscr(int32_t scrolldir, int32_t destscr, int32_t destdmap)
cx *= delay; //so we can have drawing re-done every frame,
//previously it was for(0 to delay) advanceframes at end of loop
int32_t no_move = 0;

currdmap = newdmap;
for(word i = 0; cx >= 0 && delay != 0; i++, cx--) //Go!
{
Expand Down Expand Up @@ -29328,8 +29319,9 @@ void HeroClass::scrollscr(int32_t scrolldir, int32_t destscr, int32_t destdmap)
if(get_qr(qr_FIXSCRIPTSDURINGSCROLLING))
{
if(olddmap == newdmap || (replay_version_check(0, 15)))
{
ZScriptVersion::RunScrollingScript(scrolldir, cx, sx, sy, end_frames, false); //Prewaitdraw
else refresh_dmap_scrollscript = true;
}
}
if(!get_qr(qr_SCROLLWARP_NO_RESET_FRAME))
GameFlags |= GAMEFLAG_RESET_GAME_LOOP;
Expand Down

0 comments on commit e8edc34

Please sign in to comment.