@@ -969,31 +969,99 @@ void oob_state::write_persistent(xSerial& s)
969969 }
970970}
971971
972- void oob_state::in_state_type::start ()
972+ namespace oob_state
973+ {
974+ namespace
975+ {
976+ void in_state_type::start ()
973977{
974- shared.reset_time = FLOAT_MAX ;
975- shared.out_time = FLOAT_MAX ;
978+ shared.reset_time = 0 . 0f ;
979+ shared.out_time = 0 . 0f ;
976980 shared.control = 0 ;
977981};
978982
979- void oob_state::in_state_type::stop () {
983+ void in_state_type::stop ()
984+ {
980985
981- };
986+ };
987+
988+ state_enum in_state_type::update (xScene& scene, F32& dt)
989+ {
990+ xSurface* floor_surf = globals.player .floor_surf ;
991+ U8 oob = FALSE ;
992+
993+ if (floor_surf != NULL && !(globals.player .ControlOff & 0x8000 ))
994+ {
995+ oob = zSurfaceOutOfBounds (*floor_surf);
996+ if (oob)
997+ {
998+ update_max_out_time (*floor_surf);
999+ }
1000+ }
1001+
1002+ if (!oob)
1003+ {
1004+ shared.reset_time = 0 .0f ;
1005+ shared.out_time = 0 .0f ;
1006+ shared.control = FALSE ;
1007+
1008+ return STATE_IN;
1009+ }
9821010
983- void oob_state::out_state_type::start ()
1011+ return STATE_OUT;
1012+ };
1013+
1014+ void out_state_type::start ()
9841015{
9851016 shared.out_time = shared.max_out_time ;
9861017 shared.reset_time = fixed.reset_time ;
9871018};
9881019
989- void oob_state:: out_state_type::stop () {
1020+ void out_state_type::stop () {
9901021
991- };
1022+ };
1023+
1024+ state_enum out_state_type::update (xScene& scene, F32& dt)
1025+ {
1026+ xSurface* floor_surf = globals.player .floor_surf ;
1027+ U8 oob = FALSE ;
1028+
1029+ if (floor_surf != NULL && !(globals.player .ControlOff & 0x8000 ))
1030+ {
1031+ oob = zSurfaceOutOfBounds (*floor_surf);
1032+ if (oob)
1033+ {
1034+ update_max_out_time (*floor_surf);
1035+ }
1036+ }
1037+
1038+ shared.out_time -= dt;
1039+
1040+ if (oob)
1041+ {
1042+ shared.reset_time = fixed.reset_time ;
1043+ if (shared.reset_time <= 0 .0f )
1044+ {
1045+ return STATE_GRAB;
1046+ }
1047+ }
1048+ else
1049+ {
1050+ if (!globals.player .JumpState )
1051+ {
1052+ shared.reset_time = 0 .0f ;
1053+ }
1054+
1055+ shared.reset_time -= dt;
1056+ if (shared.reset_time <= 0 .0f )
1057+ {
1058+ return STATE_IN;
1059+ }
1060+ }
1061+
1062+ return STATE_OUT;
1063+ };
9921064
993- namespace oob_state
994- {
995- namespace
996- {
9971065 void grab_state_type::start ()
9981066 {
9991067 }
0 commit comments