Skip to content

Commit 38ad3df

Browse files
committed
OOBState: Match oob_state::update
1 parent dd58967 commit 38ad3df

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

src/SB/Game/zEntPlayerOOBState.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "zEntCruiseBubble.h"
1010
#include "zGameState.h"
1111
#include "xScrFx.h"
12+
#include "zSaveLoad.h"
1213

1314
#include <types.h>
1415
#include <rwplcore.h>
@@ -881,6 +882,45 @@ namespace oob_state
881882
} // namespace
882883
} // namespace oob_state
883884

885+
U8 oob_state::update(xScene& scene, F32 dt)
886+
{
887+
if ((shared.flags & 0x3) != 0x3)
888+
{
889+
return FALSE;
890+
}
891+
892+
if (zSaveLoadGetPreAutoSave())
893+
{
894+
return FALSE;
895+
}
896+
897+
if (oob_player_teleported)
898+
{
899+
shared.flags &= ~0x8;
900+
}
901+
902+
if ((shared.flags & 0x8) && !(globals.player.ControlOff & 0x8000))
903+
{
904+
force_start();
905+
}
906+
907+
while (true)
908+
{
909+
state_enum newtype = shared.state->update(scene, dt);
910+
if (newtype == shared.state->type)
911+
{
912+
break;
913+
}
914+
915+
shared.state->stop();
916+
shared.state = shared.states[newtype];
917+
shared.state->start();
918+
}
919+
920+
921+
return shared.control;
922+
}
923+
884924
bool oob_state::IsPlayerInControl()
885925
{
886926
return oob_state::shared.control == 0;

src/SB/Game/zEntPlayerOOBState.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ extern bool oob_player_teleported;
1111

1212
namespace oob_state
1313
{
14+
U8 update(xScene& scene, F32 dt);
1415
bool render();
1516
void fx_render();
1617
void force_start();

0 commit comments

Comments
 (0)