Skip to content

Commit

Permalink
Potentially fixed level reset not reloading objects in areas other th…
Browse files Browse the repository at this point in the history
…an the one level reset into
  • Loading branch information
aglab2 committed Aug 31, 2024
1 parent 8b7da5c commit c0b107f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/level_reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "binary.h"
#include "types.h"
#include "game/camera.h"
#include "game/display.h"
#include "game/level_update.h"
#include "game/envfx_snow.h"
#include "object_constants.h"
Expand All @@ -12,6 +13,8 @@
#include "timer.h"

static bool sTimerRunningDeferred = false;
static u32 sReloadObjectsAreasMask = 0;
static u32 sReloadObjectsFrame = 0;
extern u8 sTransitionColorFadeCount[4];
extern u16 sTransitionTextureFadeCount[2];

Expand Down Expand Up @@ -58,6 +61,7 @@ static void resetCommon()
{
miniResetCommon();
sTimerRunningDeferred = true;
sReloadObjectsAreasMask = ~0;
}

void LevelReset_onNormal()
Expand Down Expand Up @@ -91,6 +95,7 @@ void LevelReset_onNormal()
gHudDisplay.timer = 0;
sTimerRunning = true;
sTimerRunningDeferred = true;
sReloadObjectsAreasMask = ~0;
}

LevelConv_PlainLevels warp = Config_warpIdAndReset();
Expand All @@ -107,6 +112,7 @@ void LevelReset_onNormal()
gHudDisplay.timer = 0;
sTimerRunning = true;
sTimerRunningDeferred = true;
sReloadObjectsAreasMask = ~0;
Timer_reset();
resetCamera();
}
Expand All @@ -127,8 +133,15 @@ static inline bool isScroll(struct SpawnInfo* spawnInfo)

s32 LevelReset_onSpawnObjectsFromInfoHook(struct SpawnInfo* spawnInfo)
{
if (sTimerRunningDeferred && !isScroll(spawnInfo))
u32 areaMask = 1 << gCurrAreaIndex;
if (((sReloadObjectsAreasMask & areaMask) || sReloadObjectsFrame == gGlobalTimer) && !isScroll(spawnInfo))
{
sReloadObjectsFrame = gGlobalTimer;
sReloadObjectsAreasMask &= ~areaMask;

#ifndef BINARY
spawnInfo->respawnInfo = RESPAWN_INFO_NONE;
#endif
spawnInfo->behaviorArg &= ~(RESPAWN_INFO_DONT_RESPAWN << 8);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/xversion.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
HACKTICE_VERSION(1, 6, 1)
HACKTICE_VERSION(1, 6, 2)

0 comments on commit c0b107f

Please sign in to comment.