Skip to content

Commit 822fddb

Browse files
committed
OOBState: Progress on start/stop/update funcs
1 parent bdfc7c9 commit 822fddb

File tree

1 file changed

+52
-7
lines changed

1 file changed

+52
-7
lines changed

src/SB/Game/zEntPlayerOOBState.cpp

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "zSurface.h"
77
#include "zRenderState.h"
88
#include "zEntPlayerBungeeState.h"
9+
#include "zEntCruiseBubble.h"
910

1011
#include <types.h>
1112
#include <rwplcore.h>
@@ -974,11 +975,11 @@ namespace oob_state
974975
namespace
975976
{
976977
void in_state_type::start()
977-
{
978+
{
978979
shared.reset_time = 0.0f;
979980
shared.out_time = 0.0f;
980-
shared.control = 0;
981-
};
981+
shared.control = 0;
982+
};
982983

983984
void in_state_type::stop()
984985
{
@@ -1012,10 +1013,10 @@ namespace oob_state
10121013
};
10131014

10141015
void out_state_type::start()
1015-
{
1016-
shared.out_time = shared.max_out_time;
1017-
shared.reset_time = fixed.reset_time;
1018-
};
1016+
{
1017+
shared.out_time = shared.max_out_time;
1018+
shared.reset_time = fixed.reset_time;
1019+
};
10191020

10201021
void out_state_type::stop() {
10211022

@@ -1064,6 +1065,42 @@ namespace oob_state
10641065

10651066
void grab_state_type::start()
10661067
{
1068+
this->finished_tutorial = FALSE;
1069+
zEntPlayerControlOff(CONTROL_OWNER_OOB);
1070+
1071+
globals.player.ControlOffTimer = FLOAT_MAX;
1072+
cruise_bubble::reset();
1073+
1074+
shared.flags |= 0x4;
1075+
shared.vertical = FABS(fixed.in_loc.y - fixed.out_loc.y) > 0.01f;
1076+
shared.control = TRUE;
1077+
1078+
this->move_substate = shared.model != NULL ? SS_REORIENT : SS_INVALID;
1079+
this->reorient_time = fixed.reorient_time;
1080+
1081+
set_camera(false);
1082+
1083+
shared.loc = fixed.out_loc;
1084+
shared.dir = (fixed.in_loc - fixed.out_loc).normal();
1085+
shared.vel = fixed.grab.in_vel;
1086+
shared.accel = 0.0f;
1087+
1088+
this->fade_substate = SS_START_FADE_OUT;
1089+
this->fade_start_time = fixed.grab.fade_start_time;
1090+
this->fade_time = fixed.grab.fade_time;
1091+
1092+
shared.fade_alpha = 1.0f;
1093+
this->player_start = globals.player.ent.frame->mat.pos;
1094+
1095+
xVec3 eulerOut;
1096+
xMat3x3GetEuler(&globals.player.ent.frame->mat, &eulerOut);
1097+
globals.player.ent.frame->rot.angle = xrmod(eulerOut.x);
1098+
1099+
this->angle_delta = xrmod(PI + (globals.camera.pcur - eulerOut.x)) - PI;
1100+
this->angle_delta /= fixed.reorient_time;
1101+
1102+
xModelUpdate(globals.player.ent.model, 1.0f / 1000.0f);
1103+
this->scene_reset = FALSE;
10671104
}
10681105

10691106
void grab_state_type::stop()
@@ -1081,6 +1118,14 @@ namespace oob_state
10811118

10821119
void drop_state_type::stop()
10831120
{
1121+
zEntPlayerControlOn(CONTROL_OWNER_OOB);
1122+
globals.player.ControlOffTimer = 1.0f;
1123+
1124+
reset_camera();
1125+
1126+
shared.render_hand = FALSE;
1127+
shared.fade_alpha = 1.0f;
1128+
shared.flags &= ~0x4;
10841129
}
10851130

10861131
state_enum drop_state_type::update(xScene& scene, F32& dt)

0 commit comments

Comments
 (0)