Wake up player if sleeping on the player menu

This commit is contained in:
Agent X 2024-06-27 16:52:55 -04:00
parent 8831360153
commit 26683b9b4f
10 changed files with 22 additions and 15 deletions

View File

@ -3648,7 +3648,7 @@ void zoom_out_if_paused_and_outside(struct GraphNodeCamera *camera) {
areaMaskIndex = 0;
areaBit = 0;
}
if (gCameraMovementFlags & CAM_MOVE_PAUSE_SCREEN && !gInPlayerMenu) {
if (gCameraMovementFlags & CAM_MOVE_PAUSE_SCREEN && !gDjuiInPlayerMenu) {
if (sFramesPaused >= 2) {
if (sZoomOutAreaMasks[areaMaskIndex] & areaBit) {
@ -10858,7 +10858,7 @@ void cutscene_palette_editor(struct Camera *c) {
if (!c) { return; }
struct MarioState* m = gMarioState;
if (!gInPlayerMenu) {
if (!gDjuiInPlayerMenu) {
if (c->paletteEditorCap) {
if (m->action == ACT_IDLE && !(m->flags & MARIO_CAP_ON_HEAD)) {
set_mario_action(m, ACT_PUTTING_ON_CAP, 0);

View File

@ -3168,7 +3168,7 @@ s16 render_pause_courses_and_castle(void) {
gDialogTextAlpha += 25;
}
if (gDjuiPanelPauseCreated && !gInPlayerMenu) { shade_screen(); }
if (gDjuiPanelPauseCreated && !gDjuiInPlayerMenu) { shade_screen(); }
if (gPlayer1Controller->buttonPressed & R_TRIG) {
djui_panel_pause_create(NULL);
}

View File

@ -65,7 +65,6 @@ s16 gDelayedInitSound = -1;
static bool sFirstCastleGroundsMenu = true;
bool gIsDemoActive = false;
bool gInPlayerMenu = false;
static u16 gDemoCountdown = 0;
static int sDemoNumber = -1;
static bool sCancelNextActSelector = false;
@ -1256,7 +1255,7 @@ s32 play_mode_normal(void) {
!configMenuStaffRoll &&
gCurrDemoInput == NULL &&
configMenuDemos &&
!gInPlayerMenu &&
!gDjuiInPlayerMenu &&
(++gDemoCountdown) == PRESS_START_DEMO_TIMER &&
(find_demo_number() && (sDemoNumber <= 6 && sDemoNumber > -1)) &&
gNetworkType == NT_NONE) {
@ -1264,7 +1263,7 @@ s32 play_mode_normal(void) {
}
if (((gCurrDemoInput != NULL) &&
(gPlayer1Controller->buttonPressed & END_DEMO || !gIsDemoActive || !gDjuiInMainMenu || gNetworkType != NT_NONE || gInPlayerMenu)) ||
(gPlayer1Controller->buttonPressed & END_DEMO || !gIsDemoActive || !gDjuiInMainMenu || gNetworkType != NT_NONE || gDjuiInPlayerMenu)) ||
(gCurrDemoInput == NULL && gIsDemoActive)) {
gPlayer1Controller->buttonPressed &= ~END_DEMO;
stop_demo(NULL);

View File

@ -150,8 +150,6 @@ extern bool gNeverEnteredCastle;
extern u32 gControlTimerStartNat;
extern u32 gControlTimerStopNat;
extern bool gInPlayerMenu;
enum HUDDisplayFlag {
HUD_DISPLAY_FLAG_LIVES = 0x0001,
HUD_DISPLAY_FLAG_COIN_COUNT = 0x0002,

View File

@ -132,7 +132,7 @@ s32 act_idle(struct MarioState *m) {
if (m->area && ((m->area->terrainType & TERRAIN_MASK) == TERRAIN_SNOW)) {
return set_mario_action(m, ACT_SHIVERING, 0);
} else {
if (gDjuiInMainMenu || gInPlayerMenu) {
if (gDjuiInMainMenu || gDjuiInPlayerMenu) {
m->actionState = 0;
m->actionTimer = 0;
} else {
@ -208,6 +208,10 @@ s32 act_start_sleeping(struct MarioState *m) {
return set_mario_action(m, ACT_IN_QUICKSAND, 0);
}
if (m->playerIndex == 0 && gDjuiInPlayerMenu) {
return set_mario_action(m, ACT_IDLE, 0);
}
if (m->actionState == 4) {
return set_mario_action(m, ACT_SLEEPING, 0);
}
@ -287,6 +291,10 @@ s32 act_sleeping(struct MarioState *m) {
if (m->pos[1] - find_floor_height_relative_polar(m, -0x8000, 60.0f) > 24.0f) {
return set_mario_action(m, ACT_WAKING_UP, m->actionState);
}
if (gDjuiInPlayerMenu) {
return set_mario_action(m, ACT_WAKING_UP, m->actionState);
}
}
m->marioBodyState->eyeState = MARIO_EYES_CLOSED;

View File

@ -23,6 +23,7 @@ static struct DjuiText* sDjuiPauseOptions = NULL;
static struct DjuiText* sDjuiLuaError = NULL;
static u32 sDjuiLuaErrorTimeout = 0;
bool gDjuiInMainMenu = true;
bool gDjuiInPlayerMenu = false;
bool gDjuiDisabled = false;
bool gDjuiShuttingDown = false;
static bool sDjuiInited = false;

View File

@ -38,6 +38,7 @@
extern struct DjuiRoot* gDjuiRoot;
extern bool gDjuiInMainMenu;
extern bool gDjuiInPlayerMenu;
extern bool gDjuiDisabled;
void djui_init(void);

View File

@ -32,11 +32,11 @@ static void djui_panel_dynos_refresh(UNUSED struct DjuiBase* base) {
}
static void djui_panel_dynos_destroy(UNUSED struct DjuiBase* caller) {
gInPlayerMenu = false;
gDjuiInPlayerMenu = false;
}
void djui_panel_dynos_create(struct DjuiBase* caller) {
gInPlayerMenu = true;
gDjuiInPlayerMenu = true;
int packCount = dynos_pack_get_count();
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(DYNOS, DYNOS));
struct DjuiBase* body = djui_three_panel_get_body(panel);

View File

@ -217,7 +217,7 @@ static void djui_panel_player_edit_palette_destroy(struct DjuiBase* caller) {
}
static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) {
gInPlayerMenu = true;
gDjuiInPlayerMenu = true;
char* sPartStrings[PLAYER_PART_MAX] = { DLANG(PLAYER, OVERALLS), DLANG(PLAYER, SHIRT), DLANG(PLAYER, GLOVES), DLANG(PLAYER, SHOES), DLANG(PLAYER, HAIR), DLANG(PLAYER, SKIN), DLANG(PLAYER, CAP), DLANG(PLAYER, EMBLEM) };
@ -387,13 +387,13 @@ static void djui_panel_player_update_preset_palette(UNUSED struct DjuiBase* call
}
static void djui_panel_player_destroy(UNUSED struct DjuiBase* caller) {
gInPlayerMenu = false;
gDjuiInPlayerMenu = false;
}
void djui_panel_player_create(struct DjuiBase* caller) {
djui_panel_player_prevent_demo(NULL);
djui_panel_player_update_camera_cutscene();
gInPlayerMenu = true;
gDjuiInPlayerMenu = true;
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(PLAYER, PLAYER_TITLE));
struct DjuiBase* body = djui_three_panel_get_body(panel);

View File

@ -54,5 +54,5 @@ const char* network_get_player_text_color_string(u8 localIndex) {
extern s16 gMenuMode;
bool network_check_singleplayer_pause(void) {
return gMenuMode != -1 && network_player_connected_count() == 1 && mods_get_all_pausable() && !gInPlayerMenu;
return gMenuMode != -1 && network_player_connected_count() == 1 && mods_get_all_pausable() && !gDjuiInPlayerMenu;
}