Synchronized race timers

This commit is contained in:
MysterD 2021-06-08 22:05:12 -07:00
parent 33fbed94e4
commit 6e7c542068
4 changed files with 23 additions and 6 deletions

View File

@ -138,7 +138,7 @@ static u32 sBackwardKnockbackActions[][3] = {
static u8 sDisplayingDoorText = FALSE; static u8 sDisplayingDoorText = FALSE;
static u8 sJustTeleported = FALSE; static u8 sJustTeleported = FALSE;
static u8 sPssSlideStarted = FALSE; u8 gPssSlideStarted = FALSE;
/** /**
* Returns the type of hat Mario is wearing. * Returns the type of hat Mario is wearing.
@ -2143,13 +2143,13 @@ void pss_begin_slide(UNUSED struct MarioState *m) {
if (!(gHudDisplay.flags & HUD_DISPLAY_FLAG_TIMER)) { if (!(gHudDisplay.flags & HUD_DISPLAY_FLAG_TIMER)) {
level_control_timer(TIMER_CONTROL_SHOW); level_control_timer(TIMER_CONTROL_SHOW);
level_control_timer(TIMER_CONTROL_START); level_control_timer(TIMER_CONTROL_START);
sPssSlideStarted = TRUE; gPssSlideStarted = TRUE;
} }
} }
void pss_end_slide(struct MarioState *m) { void pss_end_slide(struct MarioState *m) {
//! This flag isn't set on death or level entry, allowing double star spawn //! This flag isn't set on death or level entry, allowing double star spawn
if (sPssSlideStarted) { if (gPssSlideStarted) {
u16 slideTime = level_control_timer(TIMER_CONTROL_STOP); u16 slideTime = level_control_timer(TIMER_CONTROL_STOP);
if (slideTime < 630) { if (slideTime < 630) {
// PSS secret star uses oBehParams to spawn // PSS secret star uses oBehParams to spawn
@ -2158,7 +2158,7 @@ void pss_end_slide(struct MarioState *m) {
spawn_default_star(-6358.0f, -4300.0f, 4700.0f); spawn_default_star(-6358.0f, -4300.0f, 4700.0f);
m->marioObj->oBehParams = tmp; m->marioObj->oBehParams = tmp;
} }
sPssSlideStarted = FALSE; gPssSlideStarted = FALSE;
} }
} }

View File

@ -97,6 +97,7 @@
#define INT_STATUS_STOP_RIDING (1 << 22) /* 0x00400000 */ #define INT_STATUS_STOP_RIDING (1 << 22) /* 0x00400000 */
#define INT_STATUS_TOUCHED_BOB_OMB (1 << 23) /* 0x00800000 */ #define INT_STATUS_TOUCHED_BOB_OMB (1 << 23) /* 0x00800000 */
extern u8 gPssSlideStarted;
s16 mario_obj_angle_to_object(struct MarioState *m, struct Object *o); s16 mario_obj_angle_to_object(struct MarioState *m, struct Object *o);
void mario_stop_riding_object(struct MarioState *m); void mario_stop_riding_object(struct MarioState *m);

View File

@ -3,9 +3,11 @@
#include "menu/custom_menu_system.h" #include "menu/custom_menu_system.h"
#include "game/interaction.h" #include "game/interaction.h"
#include "game/object_list_processor.h" #include "game/object_list_processor.h"
#include "game/object_helpers.h"
#include "game/interaction.h"
#include "game/level_update.h"
#include "object_constants.h" #include "object_constants.h"
#include "object_fields.h" #include "object_fields.h"
#include "game/object_helpers.h"
#include "behavior_table.h" #include "behavior_table.h"
#include "model_ids.h" #include "model_ids.h"
//#define DISABLE_MODULE_LOG 1 //#define DISABLE_MODULE_LOG 1
@ -183,7 +185,10 @@ void network_send_location_response(u8 destGlobalIndex) {
packet_write(&p, &gCurrLevelNum, sizeof(s16)); packet_write(&p, &gCurrLevelNum, sizeof(s16));
packet_write(&p, &gCurrAreaIndex, sizeof(s16)); packet_write(&p, &gCurrAreaIndex, sizeof(s16));
// level variables
packet_write(&p, &gMarioStates[0].numCoins, sizeof(s16)); packet_write(&p, &gMarioStates[0].numCoins, sizeof(s16));
packet_write(&p, &gPssSlideStarted, sizeof(u8));
packet_write(&p, &gHudDisplay.timer, sizeof(u16));
// static spawn removal // static spawn removal
packet_write(&p, &sStaticSpawnRemovalIndex, sizeof(u8)); packet_write(&p, &sStaticSpawnRemovalIndex, sizeof(u8));
@ -276,6 +281,17 @@ void network_receive_location_response(struct Packet* p) {
s16 numCoins; s16 numCoins;
packet_read(p, &numCoins, sizeof(s16)); packet_read(p, &numCoins, sizeof(s16));
u8 pssSlideStarted;
u16 hudDisplayTimer;
packet_read(p, &pssSlideStarted, sizeof(u8));
packet_read(p, &hudDisplayTimer, sizeof(u16));
if (pssSlideStarted) {
level_control_timer(TIMER_CONTROL_SHOW);
level_control_timer(TIMER_CONTROL_START);
gPssSlideStarted = TRUE;
gHudDisplay.timer = hudDisplayTimer;
}
u8 staticSpawnRemovals; u8 staticSpawnRemovals;
static_spawn_removal_clear(); static_spawn_removal_clear();

View File

@ -9,7 +9,7 @@
#define DISABLE_MODULE_LOG 1 #define DISABLE_MODULE_LOG 1
#include "pc/debuglog.h" #include "pc/debuglog.h"
#define RESERVATION_COUNT 10 #define RESERVATION_COUNT 5
void network_send_reservation_request(void) { void network_send_reservation_request(void) {
assert(gNetworkType == NT_CLIENT); assert(gNetworkType == NT_CLIENT);