From d7d26639a89de7f351b8c535b5f0b265e85b1588 Mon Sep 17 00:00:00 2001 From: MysterD Date: Sun, 29 Aug 2021 14:57:40 -0700 Subject: [PATCH] Prevented controllers from clearing, fixes movement animations --- src/game/game_init.c | 6 ++-- src/game/ingame_menu.c | 30 +++++++++---------- src/game/main.c | 6 ++-- src/game/obj_behaviors.c | 4 +-- src/menu/file_select.c | 10 +++---- src/menu/star_select.c | 8 ++--- src/pc/controller/controller_keyboard_debug.c | 4 +++ 7 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/game/game_init.c b/src/game/game_init.c index 067e7318..98be2f9a 100644 --- a/src/game/game_init.c +++ b/src/game/game_init.c @@ -483,7 +483,7 @@ void read_controller_inputs(void) { // 0.5x A presses are a good meme controller->buttonDown = controller->controllerData->button; adjust_analog_stick(controller); - } else { + } else if (i != 0) { // otherwise, if the controllerData is NULL, 0 out all of the inputs. controller->rawStickX = 0; controller->rawStickY = 0; @@ -500,13 +500,13 @@ void read_controller_inputs(void) { // For some reason, player 1's inputs are copied to player 3's port. This // potentially may have been a way the developers "recorded" the inputs // for demos, despite record_demo existing. - gPlayer3Controller->rawStickX = gPlayer1Controller->rawStickX; + /*gPlayer3Controller->rawStickX = gPlayer1Controller->rawStickX; gPlayer3Controller->rawStickY = gPlayer1Controller->rawStickY; gPlayer3Controller->stickX = gPlayer1Controller->stickX; gPlayer3Controller->stickY = gPlayer1Controller->stickY; gPlayer3Controller->stickMag = gPlayer1Controller->stickMag; gPlayer3Controller->buttonPressed = gPlayer1Controller->buttonPressed; - gPlayer3Controller->buttonDown = gPlayer1Controller->buttonDown; + gPlayer3Controller->buttonDown = gPlayer1Controller->buttonDown;*/ } // initialize the controller structs to point at the OSCont information. diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c index 8031afda..7378e965 100644 --- a/src/game/ingame_menu.c +++ b/src/game/ingame_menu.c @@ -843,19 +843,19 @@ void handle_menu_scrolling(s8 scrollDirection, s8 *currentIndex, s8 minIndex, s8 u8 index = 0; if (scrollDirection == MENU_SCROLL_VERTICAL) { - if (gPlayer3Controller->rawStickY > 60) { + if (gPlayer1Controller->rawStickY > 60) { index++; } - if (gPlayer3Controller->rawStickY < -60) { + if (gPlayer1Controller->rawStickY < -60) { index += 2; } } else if (scrollDirection == MENU_SCROLL_HORIZONTAL) { - if (gPlayer3Controller->rawStickX > 60) { + if (gPlayer1Controller->rawStickX > 60) { index += 2; } - if (gPlayer3Controller->rawStickX < -60) { + if (gPlayer1Controller->rawStickX < -60) { index++; } } @@ -1880,8 +1880,8 @@ void render_dialog_entries(void) { case DIALOG_STATE_VERTICAL: gDialogBoxOpenTimer = 0.0f; - if ((gPlayer3Controller->buttonPressed & A_BUTTON) - || (gPlayer3Controller->buttonPressed & B_BUTTON)) { + if ((gPlayer1Controller->buttonPressed & A_BUTTON) + || (gPlayer1Controller->buttonPressed & B_BUTTON)) { if (gLastDialogPageStrPos == -1) { handle_special_dialog_text(gDialogID); gDialogBoxState = DIALOG_STATE_CLOSING; @@ -2764,10 +2764,10 @@ s16 render_pause_courses_and_castle(void) { } #ifdef VERSION_EU - if (gPlayer3Controller->buttonPressed & (A_BUTTON | Z_TRIG | START_BUTTON)) + if (gPlayer1Controller->buttonPressed & (A_BUTTON | Z_TRIG | START_BUTTON)) #else - if (gPlayer3Controller->buttonPressed & A_BUTTON - || gPlayer3Controller->buttonPressed & START_BUTTON) + if (gPlayer1Controller->buttonPressed & A_BUTTON + || gPlayer1Controller->buttonPressed & START_BUTTON) #endif { level_set_transition(0, 0); @@ -2791,10 +2791,10 @@ s16 render_pause_courses_and_castle(void) { render_pause_castle_main_strings(104, 60); #ifdef VERSION_EU - if (gPlayer3Controller->buttonPressed & (A_BUTTON | Z_TRIG | START_BUTTON)) + if (gPlayer1Controller->buttonPressed & (A_BUTTON | Z_TRIG | START_BUTTON)) #else - if (gPlayer3Controller->buttonPressed & A_BUTTON - || gPlayer3Controller->buttonPressed & START_BUTTON) + if (gPlayer1Controller->buttonPressed & A_BUTTON + || gPlayer1Controller->buttonPressed & START_BUTTON) #endif { level_set_transition(0, 0); @@ -3154,10 +3154,10 @@ s16 render_course_complete_screen(void) { render_save_confirmation(100, 86, &gDialogLineNum, 20); #endif if (gCourseDoneMenuTimer > 110 - && (gPlayer3Controller->buttonPressed & A_BUTTON - || gPlayer3Controller->buttonPressed & START_BUTTON + && (gPlayer1Controller->buttonPressed & A_BUTTON + || gPlayer1Controller->buttonPressed & START_BUTTON #ifdef VERSION_EU - || gPlayer3Controller->buttonPressed & Z_TRIG + || gPlayer1Controller->buttonPressed & Z_TRIG #endif )) { level_set_transition(0, 0); diff --git a/src/game/main.c b/src/game/main.c index 88855ee5..3c6d863c 100644 --- a/src/game/main.c +++ b/src/game/main.c @@ -82,8 +82,8 @@ void handle_debug_key_sequences(void) { L_JPAD, R_JPAD, L_JPAD, R_JPAD }; static s16 sProfilerKey = 0; static s16 sDebugTextKey = 0; - if (gPlayer3Controller->buttonPressed != 0) { - if (sProfilerKeySequence[sProfilerKey++] == gPlayer3Controller->buttonPressed) { + if (gPlayer1Controller->buttonPressed != 0) { + if (sProfilerKeySequence[sProfilerKey++] == gPlayer1Controller->buttonPressed) { if (sProfilerKey == ARRAY_COUNT(sProfilerKeySequence)) { sProfilerKey = 0, gShowProfiler ^= 1; } @@ -91,7 +91,7 @@ void handle_debug_key_sequences(void) { sProfilerKey = 0; } - if (sDebugTextKeySequence[sDebugTextKey++] == gPlayer3Controller->buttonPressed) { + if (sDebugTextKeySequence[sDebugTextKey++] == gPlayer1Controller->buttonPressed) { if (sDebugTextKey == ARRAY_COUNT(sDebugTextKeySequence)) { sDebugTextKey = 0, gShowDebugText ^= 1; } diff --git a/src/game/obj_behaviors.c b/src/game/obj_behaviors.c index 15bc2423..966c60a5 100644 --- a/src/game/obj_behaviors.c +++ b/src/game/obj_behaviors.c @@ -851,11 +851,11 @@ s32 UNUSED debug_sequence_tracker(s16 debugInputSequence[]) { } // If the third controller button pressed is next in sequence, reset timer and progress to next value. - if ((debugInputSequence[sDebugSequenceTracker] & gPlayer3Controller->buttonPressed) != 0) { + if ((debugInputSequence[sDebugSequenceTracker] & gPlayer1Controller->buttonPressed) != 0) { sDebugSequenceTracker++; sDebugTimer = 0; // If wrong input or timer reaches 10, reset sequence progress. - } else if (sDebugTimer == 10 || gPlayer3Controller->buttonPressed != 0) { + } else if (sDebugTimer == 10 || gPlayer1Controller->buttonPressed != 0) { sDebugSequenceTracker = 0; sDebugTimer = 0; return FALSE; diff --git a/src/menu/file_select.c b/src/menu/file_select.c index d0a36a06..9bdb3185 100644 --- a/src/menu/file_select.c +++ b/src/menu/file_select.c @@ -1569,7 +1569,7 @@ void handle_cursor_button_input(void) { if (sSelectedButtonID == MENU_BUTTON_SCORE_FILE_A || sSelectedButtonID == MENU_BUTTON_SCORE_FILE_B || sSelectedButtonID == MENU_BUTTON_SCORE_FILE_C || sSelectedButtonID == MENU_BUTTON_SCORE_FILE_D) { - if (gPlayer3Controller->buttonPressed + if (gPlayer1Controller->buttonPressed #ifdef VERSION_EU & (B_BUTTON | START_BUTTON | Z_TRIG)) { #else @@ -1578,12 +1578,12 @@ void handle_cursor_button_input(void) { sClickPos[0] = sCursorPos[0]; sClickPos[1] = sCursorPos[1]; sCursorClickingTimer = 1; - } else if (gPlayer3Controller->buttonPressed & A_BUTTON) { + } else if (gPlayer1Controller->buttonPressed & A_BUTTON) { sScoreFileCoinScoreMode = 1 - sScoreFileCoinScoreMode; play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs); } } else { // If cursor is clicked - if (gPlayer3Controller->buttonPressed + if (gPlayer1Controller->buttonPressed #ifdef VERSION_EU & (A_BUTTON | B_BUTTON | START_BUTTON | Z_TRIG)) { #else @@ -1600,8 +1600,8 @@ void handle_cursor_button_input(void) { * Cursor function that handles analog stick input and button presses with a function near the end. */ void handle_controller_cursor_input(void) { - s16 rawStickX = gPlayer3Controller->rawStickX; - s16 rawStickY = gPlayer3Controller->rawStickY; + s16 rawStickX = gPlayer1Controller->rawStickX; + s16 rawStickY = gPlayer1Controller->rawStickY; // Handle deadzone if (rawStickY > -2 && rawStickY < 2) { diff --git a/src/menu/star_select.c b/src/menu/star_select.c index 26377cb4..ac3d2828 100644 --- a/src/menu/star_select.c +++ b/src/menu/star_select.c @@ -471,11 +471,11 @@ s32 lvl_update_obj_and_load_act_button_actions(UNUSED s32 arg, UNUSED s32 unused if (sActSelectorMenuTimer >= 11) { // If any of these buttons are pressed, play sound and go to course act #ifndef VERSION_EU - if ((gPlayer3Controller->buttonPressed & A_BUTTON) - || (gPlayer3Controller->buttonPressed & START_BUTTON) - || (gPlayer3Controller->buttonPressed & B_BUTTON)) { + if ((gPlayer1Controller->buttonPressed & A_BUTTON) + || (gPlayer1Controller->buttonPressed & START_BUTTON) + || (gPlayer1Controller->buttonPressed & B_BUTTON)) { #else - if ((gPlayer3Controller->buttonPressed & (A_BUTTON | START_BUTTON | B_BUTTON | Z_TRIG))) { + if ((gPlayer1Controller->buttonPressed & (A_BUTTON | START_BUTTON | B_BUTTON | Z_TRIG))) { #endif star_select_finish_selection(); } diff --git a/src/pc/controller/controller_keyboard_debug.c b/src/pc/controller/controller_keyboard_debug.c index 48a4aa7a..2d0f7e8d 100644 --- a/src/pc/controller/controller_keyboard_debug.c +++ b/src/pc/controller/controller_keyboard_debug.c @@ -35,6 +35,10 @@ static void debug_breakpoint_here(void) { } static void debug_warp_level(u8 level) { + // warp to credits + //set_mario_action(&gMarioStates[0], ACT_JUMBO_STAR_CUTSCENE, 0); + //return; + if (sCurrPlayMode == PLAY_MODE_CHANGE_LEVEL) { return; } gCurrCourseNum = 0; gCurrLevelNum = 0;