Prevented controllers from clearing, fixes movement animations

This commit is contained in:
MysterD 2021-08-29 14:57:40 -07:00
parent 029e1f3a46
commit d7d26639a8
7 changed files with 36 additions and 32 deletions

View file

@ -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.

View file

@ -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);

View file

@ -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;
}

View file

@ -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;

View file

@ -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) {

View file

@ -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();
}

View file

@ -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;