Refresh 14

This commit is contained in:
n64 committed 2021-07-12 23:17:54 -04:00
1 parent ecd3d152fb
commit f9982e0ef5
251 files changed
+7496 -5757

No files matched your search

+24 -24
View File
@@ -548,7 +548,7 @@ void exit_score_file_to_score_menu(struct Object *scoreFileButton, s8 scoreButto
if (scoreFileButton->oMenuButtonState == MENU_BUTTON_STATE_FULLSCREEN
&& sCursorClickingTimer == 2) {
play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
scoreFileButton->oMenuButtonState = MENU_BUTTON_STATE_SHRINKING;
@@ -643,7 +643,7 @@ void check_score_menu_clicked_buttons(struct Object *scoreButton) {
if (buttonID == MENU_BUTTON_SCORE_RETURN || buttonID == MENU_BUTTON_SCORE_COPY_FILE
|| buttonID == MENU_BUTTON_SCORE_ERASE_FILE) {
play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
sMainMenuButtons[buttonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT;
@@ -654,7 +654,7 @@ void check_score_menu_clicked_buttons(struct Object *scoreButton) {
// If clicked in a existing save file, select it too see it's score
if (save_file_exists(buttonID - MENU_BUTTON_SCORE_MIN) == TRUE) {
play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
sMainMenuButtons[buttonID]->oMenuButtonState = MENU_BUTTON_STATE_GROWING;
@@ -663,7 +663,7 @@ void check_score_menu_clicked_buttons(struct Object *scoreButton) {
else {
// If clicked in a non-existing save file, play buzz sound
play_sound(SOUND_MENU_CAMERA_BUZZ, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
sMainMenuButtons[buttonID]->oMenuButtonState =
@@ -759,7 +759,7 @@ void copy_action_file_button(struct Object *copyButton, s32 copyFileButtonID) {
if (save_file_exists(copyFileButtonID - MENU_BUTTON_COPY_MIN) == TRUE) {
// If clicked in a existing save file, ask where it wants to copy
play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
sMainMenuButtons[copyFileButtonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN;
@@ -770,7 +770,7 @@ void copy_action_file_button(struct Object *copyButton, s32 copyFileButtonID) {
} else {
// If clicked in a non-existing save file, play buzz sound
play_sound(SOUND_MENU_CAMERA_BUZZ, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
sMainMenuButtons[copyFileButtonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT;
@@ -785,7 +785,7 @@ void copy_action_file_button(struct Object *copyButton, s32 copyFileButtonID) {
if (save_file_exists(copyFileButtonID - MENU_BUTTON_COPY_MIN) == FALSE) {
// If clicked in a non-existing save file, copy the file
play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
copyButton->oMenuButtonActionPhase = COPY_PHASE_COPY_COMPLETE;
@@ -800,7 +800,7 @@ void copy_action_file_button(struct Object *copyButton, s32 copyFileButtonID) {
// If clicked in a existing save file, play buzz sound
if (MENU_BUTTON_COPY_FILE_A + sSelectedFileIndex == copyFileButtonID) {
play_sound(SOUND_MENU_CAMERA_BUZZ, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
sMainMenuButtons[MENU_BUTTON_COPY_FILE_A + sSelectedFileIndex]->oMenuButtonState =
@@ -843,7 +843,7 @@ void check_copy_menu_clicked_buttons(struct Object *copyButton) {
|| buttonID == MENU_BUTTON_COPY_ERASE_FILE) {
if (copyButton->oMenuButtonActionPhase == COPY_PHASE_MAIN) {
play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
sMainMenuButtons[buttonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT;
@@ -941,7 +941,7 @@ void erase_action_file_button(struct Object *eraseButton, s32 eraseFileButtonID)
if (save_file_exists(eraseFileButtonID - MENU_BUTTON_ERASE_MIN) == TRUE) {
// If clicked in a existing save file, ask if it wants to delete it
play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
sMainMenuButtons[eraseFileButtonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN;
@@ -952,7 +952,7 @@ void erase_action_file_button(struct Object *eraseButton, s32 eraseFileButtonID)
} else {
// If clicked in a non-existing save file, play buzz sound
play_sound(SOUND_MENU_CAMERA_BUZZ, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
sMainMenuButtons[eraseFileButtonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT;
@@ -969,7 +969,7 @@ void erase_action_file_button(struct Object *eraseButton, s32 eraseFileButtonID)
// Note: The prompt functions are actually called when the ERASE_MSG_PROMPT
// message is displayed with print_erase_menu_prompt
play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
sMainMenuButtons[MENU_BUTTON_ERASE_MIN + sSelectedFileIndex]->oMenuButtonState =
@@ -999,7 +999,7 @@ void check_erase_menu_clicked_buttons(struct Object *eraseButton) {
|| buttonID == MENU_BUTTON_ERASE_COPY_FILE) {
if (eraseButton->oMenuButtonActionPhase == ERASE_PHASE_MAIN) {
play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
sMainMenuButtons[buttonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT;
@@ -1094,7 +1094,7 @@ void check_sound_mode_menu_clicked_buttons(struct Object *soundModeButton) {
|| buttonID == MENU_BUTTON_HEADSET) {
if (soundModeButton->oMenuButtonActionPhase == SOUND_MODE_PHASE_MAIN) {
play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
sMainMenuButtons[buttonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT;
@@ -1425,28 +1425,28 @@ void check_main_menu_clicked_buttons(void) {
switch (sSelectedButtonID) {
case MENU_BUTTON_PLAY_FILE_A:
play_sound(SAVE_FILE_SOUND, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(60, 70);
func_sh_8024C89C(1);
#endif
break;
case MENU_BUTTON_PLAY_FILE_B:
play_sound(SAVE_FILE_SOUND, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(60, 70);
func_sh_8024C89C(1);
#endif
break;
case MENU_BUTTON_PLAY_FILE_C:
play_sound(SAVE_FILE_SOUND, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(60, 70);
func_sh_8024C89C(1);
#endif
break;
case MENU_BUTTON_PLAY_FILE_D:
play_sound(SAVE_FILE_SOUND, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(60, 70);
func_sh_8024C89C(1);
#endif
@@ -1454,28 +1454,28 @@ void check_main_menu_clicked_buttons(void) {
// Play sound of the button clicked and render buttons of that menu.
case MENU_BUTTON_SCORE:
play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
render_score_menu_buttons(sMainMenuButtons[MENU_BUTTON_SCORE]);
break;
case MENU_BUTTON_COPY:
play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
render_copy_menu_buttons(sMainMenuButtons[MENU_BUTTON_COPY]);
break;
case MENU_BUTTON_ERASE:
play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
render_erase_menu_buttons(sMainMenuButtons[MENU_BUTTON_ERASE]);
break;
case MENU_BUTTON_SOUND_MODE:
play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
render_sound_mode_menu_buttons(sMainMenuButtons[MENU_BUTTON_SOUND_MODE]);
@@ -2248,7 +2248,7 @@ void print_erase_menu_prompt(s16 x, s16 y) {
// ..and is hovering "YES", delete file
if (sEraseYesNoHoverState == MENU_ERASE_HOVER_YES) {
play_sound(SOUND_MARIO_WAAAOOOW, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
sMainMenuButtons[MENU_BUTTON_ERASE]->oMenuButtonActionPhase = ERASE_PHASE_MARIO_ERASED;
@@ -2263,7 +2263,7 @@ void print_erase_menu_prompt(s16 x, s16 y) {
// ..and is hovering "NO", return back to main phase
} else if (sEraseYesNoHoverState == MENU_ERASE_HOVER_NO) {
play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(5, 80);
#endif
sMainMenuButtons[MENU_BUTTON_ERASE_MIN + sSelectedFileIndex]->oMenuButtonState =
+5 -1
View File
@@ -348,7 +348,7 @@ u16 *intro_sample_frame_buffer(s32 imageW, s32 imageH, s32 sampleW, s32 sampleH)
s32 xOffset = 120;
s32 yOffset = 80;
fb = sFrameBuffers[frameBufferIndex];
fb = sFrameBuffers[sRenderingFrameBuffer];
image = alloc_display_list(imageW * imageH * sizeof(u16));
if (image == NULL) {
@@ -439,6 +439,10 @@ Gfx *geo_intro_rumble_pak_graphic(s32 state, struct GraphNode *node, UNUSED void
Gfx *dl;
s32 introContext;
s8 backgroundTileSix;
#ifdef AVOID_UB
dl = NULL;
backgroundTileSix = 0;
#endif
if (state != 1) {
dl = NULL;
-10
View File
@@ -1,10 +0,0 @@
#ifndef LEVEL_SELECT_MENU_H
#define LEVEL_SELECT_MENU_H
#include <PR/ultratypes.h>
#include "macros.h"
s32 lvl_intro_update(s16 arg1, UNUSED s32 arg2);
#endif // LEVEL_SELECT_MENU_H
+1 -1
View File
@@ -421,7 +421,7 @@ s32 lvl_update_obj_and_load_act_button_actions(UNUSED s32 arg, UNUSED s32 unused
#else
play_sound(SOUND_MENU_STAR_SOUND_LETS_A_GO, gGlobalSoundSource);
#endif
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(60, 70);
func_sh_8024C89C(1);
#endif
@@ -14,71 +14,81 @@
#include "level_table.h"
#include "seq_ids.h"
#include "sm64.h"
#include "title_screen.h"
#define PRESS_START_DEMO_TIMER 800
/**
* @file title_screen.c
* This file implements how title screen functions.
* That includes playing demo sequences, introduction screens
* and a level select used for testing purposes.
*/
#define STUB_LEVEL(textname, _1, _2, _3, _4, _5, _6, _7, _8) textname,
#define DEFINE_LEVEL(textname, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) textname,
static char gLevelSelect_StageNamesText[64][16] = {
static char sLevelSelectStageNames[64][16] = {
#include "levels/level_defines.h"
};
#undef STUB_LEVEL
#undef DEFINE_LEVEL
static u16 gDemoCountdown = 0;
static u16 sDemoCountdown = 0;
#ifndef VERSION_JP
static s16 D_U_801A7C34 = 1;
static s16 gameOverNotPlayed = 1;
static s16 sPlayMarioGreeting = TRUE;
static s16 sPlayMarioGameOver = TRUE;
#endif
// run the demo timer on the PRESS START screen.
// this function will return a non-0 timer once
// the demo starts, signaling to the subsystem that
// the demo needs to be ran.
#define PRESS_START_DEMO_TIMER 800
// don't shift this function from being the first function in the segment.
// the level scripts assume this function is the first, so it cant be moved.
s32 run_press_start_demo_timer(s32 timer) {
/**
* Run the demo timer on the PRESS START screen after a number of frames.
* This function returns the level ID from the first byte of a demo file.
* It also returns the level ID from intro_regular (file select or level select menu)
*/
s32 run_level_id_or_demo(s32 level) {
gCurrDemoInput = NULL;
if (timer == 0) {
if (level == LEVEL_NONE) {
if (!gPlayer1Controller->buttonDown && !gPlayer1Controller->stickMag) {
if ((++gDemoCountdown) == PRESS_START_DEMO_TIMER) {
// start the demo. 800 frames has passed while
// player is idle on PRESS START screen.
// start the demo. 800 frames has passed while
// player is idle on PRESS START screen.
if ((++sDemoCountdown) == PRESS_START_DEMO_TIMER) {
// start the Mario demo animation for the demo list.
load_patchable_table(&gDemo, gDemoInputListID);
load_patchable_table(&gDemoInputsBuf, gDemoInputListID);
// if the next demo sequence ID is the count limit, reset it back to
// the first sequence.
if (++gDemoInputListID == gDemo.animDmaTable->count) {
if (++gDemoInputListID == gDemoInputsBuf.dmaTable->count) {
gDemoInputListID = 0;
}
// add 1 (+4) to the pointer to skip the demoID.
gCurrDemoInput = ((struct DemoInput *) gDemo.targetAnim) + 1;
timer = (s8)((struct DemoInput *) gDemo.targetAnim)->timer;
// add 1 (+4) to the pointer to skip the first 4 bytes
// Use the first 4 bytes to store level ID,
// then use the rest of the values for inputs
gCurrDemoInput = ((struct DemoInput *) gDemoInputsBuf.bufTarget) + 1;
level = (s8)((struct DemoInput *) gDemoInputsBuf.bufTarget)->timer;
gCurrSaveFileNum = 1;
gCurrActNum = 1;
}
} else { // activity was detected, so reset the demo countdown.
gDemoCountdown = 0;
sDemoCountdown = 0;
}
}
return timer;
return level;
}
// input loop for the level select menu. updates the selected stage
// count if an input was received. signals the stage to be started
// or the level select to be exited if start or the quit combo is
// pressed.
s16 level_select_input_loop(void) {
/**
* Level select intro function, updates the selected stage
* count if an input was received. signals the stage to be started
* or the level select to be exited if start or the quit combo is pressed.
*/
s16 intro_level_select(void) {
s32 stageChanged = FALSE;
// perform the ID updates per each button press.
// runs into a loop so after a button is pressed
// stageChanged goes back to FALSE
if (gPlayer1Controller->buttonPressed & A_BUTTON) {
++gCurrLevelNum, stageChanged = TRUE;
}
@@ -103,7 +113,6 @@ s16 level_select_input_loop(void) {
play_sound(SOUND_GENERAL_LEVEL_SELECT_CHANGE, gGlobalSoundSource);
}
// TODO: enum counts for the stage lists
if (gCurrLevelNum > LEVEL_MAX) {
gCurrLevelNum = LEVEL_MIN; // exceeded max. set to min.
}
@@ -112,12 +121,14 @@ s16 level_select_input_loop(void) {
gCurrLevelNum = LEVEL_MAX; // exceeded min. set to max.
}
gCurrSaveFileNum = 4; // file 4 is used for level select tests
// Use file 4 and last act as a test
gCurrSaveFileNum = 4;
gCurrActNum = 6;
print_text_centered(160, 80, "SELECT STAGE");
print_text_centered(160, 30, "PRESS START BUTTON");
print_text_fmt_int(40, 60, "%2d", gCurrLevelNum);
print_text(80, 60, gLevelSelect_StageNamesText[gCurrLevelNum - 1]); // print stage name
print_text(80, 60, sLevelSelectStageNames[gCurrLevelNum - 1]); // print stage name
#define QUIT_LEVEL_SELECT_COMBO (Z_TRIG | START_BUTTON | L_CBUTTONS | R_CBUTTONS)
@@ -135,42 +146,55 @@ s16 level_select_input_loop(void) {
return 0;
}
s32 intro_default(void) {
s32 sp1C = 0;
/**
* Regular intro function that handles Mario's greeting voice and game start.
*/
s32 intro_regular(void) {
s32 level = LEVEL_NONE;
#ifndef VERSION_JP
if (D_U_801A7C34 == 1) {
if (gGlobalTimer < 0x81) {
// When the game stars, gGlobalTimer is less than 129 frames,
// so Mario greets the player. After that, he will always say
// "press start to play" when it goes back to the title screen
// (using SAVE AND QUIT)
if (sPlayMarioGreeting == TRUE) {
if (gGlobalTimer < 129) {
play_sound(SOUND_MARIO_HELLO, gGlobalSoundSource);
} else {
play_sound(SOUND_MARIO_PRESS_START_TO_PLAY, gGlobalSoundSource);
}
D_U_801A7C34 = 0;
sPlayMarioGreeting = FALSE;
}
#endif
print_intro_text();
if (gPlayer1Controller->buttonPressed & START_BUTTON) {
play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(60, 70);
func_sh_8024C89C(1);
#endif
sp1C = 100 + gDebugLevelSelect;
// calls level ID 100 (or 101 adding level select bool value)
// defined in level_intro_mario_head_regular JUMP_IF commands
// 100 is File Select - 101 is Level Select
level = 100 + gDebugLevelSelect;
#ifndef VERSION_JP
D_U_801A7C34 = 1;
sPlayMarioGreeting = TRUE;
#endif
}
return run_press_start_demo_timer(sp1C);
return run_level_id_or_demo(level);
}
/**
* Game over intro function that handles Mario's game over voice and game start.
*/
s32 intro_game_over(void) {
s32 sp1C = 0;
s32 level = LEVEL_NONE;
#ifndef VERSION_JP
if (gameOverNotPlayed == 1) {
if (sPlayMarioGameOver == TRUE) {
play_sound(SOUND_MARIO_GAME_OVER, gGlobalSoundSource);
gameOverNotPlayed = 0;
sPlayMarioGameOver = FALSE;
}
#endif
@@ -178,39 +202,47 @@ s32 intro_game_over(void) {
if (gPlayer1Controller->buttonPressed & START_BUTTON) {
play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource);
#ifdef VERSION_SH
#if ENABLE_RUMBLE
queue_rumble_data(60, 70);
func_sh_8024C89C(1);
#endif
sp1C = 100 + gDebugLevelSelect;
// same criteria as intro_regular
level = 100 + gDebugLevelSelect;
#ifndef VERSION_JP
gameOverNotPlayed = 1;
sPlayMarioGameOver = TRUE;
#endif
}
return run_press_start_demo_timer(sp1C);
return run_level_id_or_demo(level);
}
/**
* Plays the casual "It's a me mario" when the game stars.
*/
s32 intro_play_its_a_me_mario(void) {
set_background_music(0, SEQ_SOUND_PLAYER, 0);
play_sound(SOUND_MENU_COIN_ITS_A_ME_MARIO, gGlobalSoundSource);
return 1;
}
s32 lvl_intro_update(s16 arg1, UNUSED s32 arg2) {
/**
* Update intro functions to handle title screen actions.
* Returns a level ID after their criteria is met.
*/
s32 lvl_intro_update(s16 arg, UNUSED s32 unusedArg) {
s32 retVar;
switch (arg1) {
case 0:
switch (arg) {
case LVL_INTRO_PLAY_ITS_A_ME_MARIO:
retVar = intro_play_its_a_me_mario();
break;
case 1:
retVar = intro_default();
case LVL_INTRO_REGULAR:
retVar = intro_regular();
break;
case 2:
case LVL_INTRO_GAME_OVER:
retVar = intro_game_over();
break;
case 3:
retVar = level_select_input_loop();
case LVL_INTRO_LEVEL_SELECT:
retVar = intro_level_select();
break;
}
return retVar;
+17
View File
@@ -0,0 +1,17 @@
#ifndef TITLE_SCREEN_H
#define TITLE_SCREEN_H
#include <PR/ultratypes.h>
#include "macros.h"
enum LevelScriptIntroArgs {
LVL_INTRO_PLAY_ITS_A_ME_MARIO,
LVL_INTRO_REGULAR,
LVL_INTRO_GAME_OVER,
LVL_INTRO_LEVEL_SELECT
};
s32 lvl_intro_update(s16 arg, UNUSED s32 unusedArg);
#endif // TITLE_SCREEN_H