33#include "binary.h"
44#include "types.h"
55#include "game/camera.h"
6+ #include "game/display.h"
67#include "game/level_update.h"
78#include "game/envfx_snow.h"
89#include "object_constants.h"
1213#include "timer.h"
1314
1415static bool sTimerRunningDeferred = false;
16+ static u32 sReloadObjectsAreasMask = 0 ;
17+ static u32 sReloadObjectsFrame = 0 ;
1518extern u8 sTransitionColorFadeCount [4 ];
1619extern u16 sTransitionTextureFadeCount [2 ];
1720
@@ -58,6 +61,7 @@ static void resetCommon()
5861{
5962 miniResetCommon ();
6063 sTimerRunningDeferred = true;
64+ sReloadObjectsAreasMask = ~0 ;
6165}
6266
6367void LevelReset_onNormal ()
@@ -91,6 +95,7 @@ void LevelReset_onNormal()
9195 gHudDisplay .timer = 0 ;
9296 sTimerRunning = true;
9397 sTimerRunningDeferred = true;
98+ sReloadObjectsAreasMask = ~0 ;
9499 }
95100
96101 LevelConv_PlainLevels warp = Config_warpIdAndReset ();
@@ -107,6 +112,7 @@ void LevelReset_onNormal()
107112 gHudDisplay .timer = 0 ;
108113 sTimerRunning = true;
109114 sTimerRunningDeferred = true;
115+ sReloadObjectsAreasMask = ~0 ;
110116 Timer_reset ();
111117 resetCamera ();
112118 }
@@ -127,8 +133,15 @@ static inline bool isScroll(struct SpawnInfo* spawnInfo)
127133
128134s32 LevelReset_onSpawnObjectsFromInfoHook (struct SpawnInfo * spawnInfo )
129135{
130- if (sTimerRunningDeferred && !isScroll (spawnInfo ))
136+ u32 areaMask = 1 << gCurrAreaIndex ;
137+ if (((sReloadObjectsAreasMask & areaMask ) || sReloadObjectsFrame == gGlobalTimer ) && !isScroll (spawnInfo ))
131138 {
139+ sReloadObjectsFrame = gGlobalTimer ;
140+ sReloadObjectsAreasMask &= ~areaMask ;
141+
142+ #ifndef BINARY
143+ spawnInfo -> respawnInfo = RESPAWN_INFO_NONE ;
144+ #endif
132145 spawnInfo -> behaviorArg &= ~(RESPAWN_INFO_DONT_RESPAWN << 8 );
133146 return true;
134147 }
0 commit comments