@@ -315,6 +315,30 @@ bool Mod::infiniteItemUsage(int16_t item, uint32_t index)
315
315
return mPFN_pouchRemoveItemIndex_trampoline (item, index);
316
316
}
317
317
318
+ void checkIfSystemLevelShouldBeLowered ()
319
+ {
320
+ // Only run when the player has either reloaded the room or warped
321
+ if (!ReloadRoom.SystemLevelShouldBeLowered )
322
+ {
323
+ return ;
324
+ }
325
+
326
+ // Keep lowering the system level until the seq changes to Game
327
+ if (!checkForSpecificSeq (ttyd::seqdrv::SeqIndex::kGame ))
328
+ {
329
+ // Only lower the system level if it's not currently at 0
330
+ uint32_t SystemLevel = getSystemLevel ();
331
+ if (SystemLevel > 0 )
332
+ {
333
+ setSystemLevel (0 );
334
+ }
335
+ }
336
+ else
337
+ {
338
+ ReloadRoom.SystemLevelShouldBeLowered = false ;
339
+ }
340
+ }
341
+
318
342
void reloadRoomMain ()
319
343
{
320
344
ttyd::seqdrv::SeqIndex NextSeq = ttyd::seqdrv::seqGetNextSeq ();
@@ -374,6 +398,7 @@ void reloadRoomMain()
374
398
ttyd::pmario_sound::psndClearFlag (0x80 );
375
399
ttyd::mario_cam::marioSetCamId (4 );
376
400
setSystemLevel (0 );
401
+ ReloadRoom.SystemLevelShouldBeLowered = true ;
377
402
}
378
403
379
404
void reloadRoom ()
@@ -401,12 +426,7 @@ void reloadRoom()
401
426
if ((player->currentMotionId == ReceivingItem) && (NextSeq == MapChange))
402
427
{
403
428
// Reset the System Level
404
- // Only lower the system level if it's not currently at 0
405
- uint32_t SystemLevel = getSystemLevel ();
406
- if (SystemLevel > 0 )
407
- {
408
- setSystemLevel (0 );
409
- }
429
+ ReloadRoom.SystemLevelShouldBeLowered = true ;
410
430
411
431
// Reset the camera - mainly for the black bars at the top and bottom of the screen
412
432
uint32_t CameraPointer = reinterpret_cast <uint32_t >(ttyd::camdrv::camGetPtr (8 ));
0 commit comments