Re-add vanilla singleplayer pause with proper network timer pausing

This commit is contained in:
Agent X 2024-03-03 17:25:11 -05:00
parent 65e913034f
commit a0a65e19bd
3 changed files with 10 additions and 3 deletions

View File

@ -1287,7 +1287,7 @@ void cur_obj_update(void) {
} }
// handle network area timer // handle network area timer
if (gCurrentObject->areaTimerType != AREA_TIMER_TYPE_NONE) { if (gCurrentObject->areaTimerType != AREA_TIMER_TYPE_NONE && !(gMenuMode != -1 && network_player_connected_count() == 1 && gActiveMods.entryCount == 0)) {
// make sure the area is valid // make sure the area is valid
if (gNetworkPlayerLocal == NULL || !gNetworkPlayerLocal->currAreaSyncValid) { if (gNetworkPlayerLocal == NULL || !gNetworkPlayerLocal->currAreaSyncValid) {
goto cur_obj_update_end; goto cur_obj_update_end;
@ -1437,7 +1437,7 @@ cur_obj_update_begin:;
} }
// update network area timer // update network area timer
if (gCurrentObject->areaTimerType != AREA_TIMER_TYPE_NONE) { if (gCurrentObject->areaTimerType != AREA_TIMER_TYPE_NONE && !(gMenuMode != -1 && network_player_connected_count() == 1 && gActiveMods.entryCount == 0)) {
gCurrentObject->areaTimer++; gCurrentObject->areaTimer++;
if (gCurrentObject->areaTimer < gNetworkAreaTimer) { if (gCurrentObject->areaTimer < gNetworkAreaTimer) {
goto cur_obj_update_begin; goto cur_obj_update_begin;

View File

@ -1667,7 +1667,10 @@ s32 update_level(void) {
changeLevel = play_mode_normal(); changeLevel = play_mode_normal();
break; break;
case PLAY_MODE_PAUSED: case PLAY_MODE_PAUSED:
changeLevel = play_mode_normal(); if (!(network_player_connected_count() == 1 && gActiveMods.entryCount == 0)) {
changeLevel = play_mode_normal();
}
changeLevel = play_mode_paused(); changeLevel = play_mode_paused();
break; break;
case PLAY_MODE_CHANGE_AREA: case PLAY_MODE_CHANGE_AREA:

View File

@ -502,6 +502,7 @@ static void network_rehost_update(void) {
djui_panel_do_host(true); djui_panel_do_host(true);
} }
extern s16 gMenuMode;
static void network_update_area_timer(void) { static void network_update_area_timer(void) {
bool brokenClock = false; bool brokenClock = false;
#ifdef DEVELOPMENT #ifdef DEVELOPMENT
@ -522,6 +523,9 @@ static void network_update_area_timer(void) {
//brokenClock = (skipClockCount > 0); //brokenClock = (skipClockCount > 0);
#endif #endif
if (!brokenClock) { if (!brokenClock) {
if (gMenuMode != -1 && network_player_connected_count() == 1 && gActiveMods.entryCount == 0) {
gNetworkAreaTimerClock++;
}
// update network area timer // update network area timer
u32 desiredNAT = gNetworkAreaTimer + 1; u32 desiredNAT = gNetworkAreaTimer + 1;
gNetworkAreaTimer = (clock_elapsed_ticks() - gNetworkAreaTimerClock); gNetworkAreaTimer = (clock_elapsed_ticks() - gNetworkAreaTimerClock);