Refresh 2
This commit is contained in:
1 parent
1ef98ec785
commit
52e605f075
316 files changed
+16344
-16365
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,128 @@
|
||||
#ifndef FILE_SELECT_H
|
||||
#define FILE_SELECT_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#define MENU_LAYER_MAIN 1
|
||||
#define MENU_LAYER_SUBMENU 2
|
||||
|
||||
#define MENU_ERASE_HOVER_NONE 0
|
||||
#define MENU_ERASE_HOVER_YES 1
|
||||
#define MENU_ERASE_HOVER_NO 2
|
||||
|
||||
enum MainMenuButtonStates {
|
||||
MENU_BUTTON_STATE_DEFAULT,
|
||||
MENU_BUTTON_STATE_GROWING,
|
||||
MENU_BUTTON_STATE_FULLSCREEN,
|
||||
MENU_BUTTON_STATE_SHRINKING,
|
||||
MENU_BUTTON_STATE_ZOOM_IN_OUT,
|
||||
MENU_BUTTON_STATE_ZOOM_IN,
|
||||
MENU_BUTTON_STATE_ZOOM_OUT
|
||||
};
|
||||
|
||||
enum MenuButtonTypes {
|
||||
MENU_BUTTON_NONE = -1, // no button selected (on main menu screen)
|
||||
|
||||
// Main Menu (SELECT FILE)
|
||||
MENU_BUTTON_MAIN_MIN,
|
||||
MENU_BUTTON_PLAY_FILE_A = MENU_BUTTON_MAIN_MIN,
|
||||
MENU_BUTTON_PLAY_FILE_B,
|
||||
MENU_BUTTON_PLAY_FILE_C,
|
||||
MENU_BUTTON_PLAY_FILE_D,
|
||||
MENU_BUTTON_SCORE,
|
||||
MENU_BUTTON_COPY,
|
||||
MENU_BUTTON_ERASE,
|
||||
MENU_BUTTON_MAIN_MAX,
|
||||
|
||||
// Score Menu (CHECK FILE)
|
||||
MENU_BUTTON_SCORE_MIN = MENU_BUTTON_MAIN_MAX,
|
||||
MENU_BUTTON_SCORE_FILE_A = MENU_BUTTON_SCORE_MIN,
|
||||
MENU_BUTTON_SCORE_FILE_B,
|
||||
MENU_BUTTON_SCORE_FILE_C,
|
||||
MENU_BUTTON_SCORE_FILE_D,
|
||||
MENU_BUTTON_SCORE_RETURN,
|
||||
MENU_BUTTON_SCORE_COPY_FILE,
|
||||
MENU_BUTTON_SCORE_ERASE_FILE,
|
||||
MENU_BUTTON_SCORE_MAX,
|
||||
|
||||
// Copy Menu (COPY FILE)
|
||||
MENU_BUTTON_COPY_MIN = MENU_BUTTON_SCORE_MAX,
|
||||
MENU_BUTTON_COPY_FILE_A = MENU_BUTTON_COPY_MIN,
|
||||
MENU_BUTTON_COPY_FILE_B,
|
||||
MENU_BUTTON_COPY_FILE_C,
|
||||
MENU_BUTTON_COPY_FILE_D,
|
||||
MENU_BUTTON_COPY_RETURN,
|
||||
MENU_BUTTON_COPY_CHECK_SCORE,
|
||||
MENU_BUTTON_COPY_ERASE_FILE,
|
||||
MENU_BUTTON_COPY_MAX,
|
||||
|
||||
// Erase Menu (ERASE FILE)
|
||||
MENU_BUTTON_ERASE_MIN = MENU_BUTTON_COPY_MAX,
|
||||
MENU_BUTTON_ERASE_FILE_A = MENU_BUTTON_ERASE_MIN,
|
||||
MENU_BUTTON_ERASE_FILE_B,
|
||||
MENU_BUTTON_ERASE_FILE_C,
|
||||
MENU_BUTTON_ERASE_FILE_D,
|
||||
MENU_BUTTON_ERASE_RETURN,
|
||||
MENU_BUTTON_ERASE_CHECK_SCORE,
|
||||
MENU_BUTTON_ERASE_COPY_FILE,
|
||||
MENU_BUTTON_ERASE_MAX,
|
||||
|
||||
// Sound Mode Menu (SOUND SELECT)
|
||||
MENU_BUTTON_SOUND_MODE = MENU_BUTTON_ERASE_MAX,
|
||||
MENU_BUTTON_SOUND_MIN,
|
||||
MENU_BUTTON_STEREO = MENU_BUTTON_SOUND_MIN,
|
||||
MENU_BUTTON_MONO,
|
||||
MENU_BUTTON_HEADSET,
|
||||
MENU_BUTTON_SOUND_MAX
|
||||
};
|
||||
|
||||
enum ScoreMenuMessageID {
|
||||
SCORE_MSG_CHECK_FILE,
|
||||
SCORE_MSG_NOSAVE_DATA
|
||||
};
|
||||
|
||||
enum CopyMenuMessageID {
|
||||
COPY_MSG_MAIN_TEXT,
|
||||
COPY_MSG_COPY_WHERE,
|
||||
COPY_MSG_NOSAVE_EXISTS,
|
||||
COPY_MSG_COPY_COMPLETE,
|
||||
COPY_MSG_SAVE_EXISTS
|
||||
};
|
||||
|
||||
enum CopyMenuActionPhase {
|
||||
COPY_PHASE_MAIN,
|
||||
COPY_PHASE_COPY_WHERE,
|
||||
COPY_PHASE_COPY_COMPLETE
|
||||
};
|
||||
|
||||
enum EraseMenuMessageID {
|
||||
ERASE_MSG_MAIN_TEXT,
|
||||
ERASE_MSG_PROMPT,
|
||||
ERASE_MSG_NOSAVE_EXISTS,
|
||||
ERASE_MSG_MARIO_ERASED,
|
||||
ERASE_MSG_SAVE_EXISTS
|
||||
};
|
||||
|
||||
enum EraseMenuActionPhase {
|
||||
ERASE_PHASE_MAIN,
|
||||
ERASE_PHASE_PROMPT,
|
||||
ERASE_PHASE_MARIO_ERASED
|
||||
};
|
||||
|
||||
enum SoundModeMenuActionPhase {
|
||||
SOUND_MODE_PHASE_MAIN
|
||||
};
|
||||
|
||||
extern u32 gGlobalTimer;
|
||||
|
||||
extern void beh_yellow_background_menu_init(void);
|
||||
extern void beh_yellow_background_menu_loop(void);
|
||||
extern void bhv_menu_button_init(void);
|
||||
extern void bhv_menu_button_loop(void);
|
||||
extern void bhv_menu_button_manager_init(void);
|
||||
extern void bhv_menu_button_manager_loop(void);
|
||||
extern Gfx *geo_menu_strings_and_cursor(s32 run, UNUSED struct GraphNode *node, UNUSED f32 mtx[4][4]);
|
||||
extern void lvl_init_menu_values_and_cursor_pos(UNUSED s32 arg, UNUSED s32 unused);
|
||||
extern s32 lvl_update_menu_obj_and_load_file_selected(UNUSED s32 arg, UNUSED s32 unused);
|
||||
|
||||
#endif /* FILE_SELECT_H */
|
||||
@@ -0,0 +1,262 @@
|
||||
#include "ultra64.h"
|
||||
#include "sm64.h"
|
||||
#include "types.h"
|
||||
#include "game/memory.h"
|
||||
#include "game/segment2.h"
|
||||
#include "game/segment7.h"
|
||||
#include "intro_geo.h"
|
||||
|
||||
// frame counts for the zoom in, hold, and zoom out of title model
|
||||
#define INTRO_STEPS_ZOOM_IN 20
|
||||
#define INTRO_STEPS_HOLD_1 75
|
||||
#define INTRO_STEPS_ZOOM_OUT 91
|
||||
|
||||
// background types
|
||||
#define INTRO_BACKGROUND_SUPER_MARIO 0
|
||||
#define INTRO_BACKGROUND_GAME_OVER 1
|
||||
|
||||
struct GraphNodeMore {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ void *todo;
|
||||
/*0x18*/ u32 unk18;
|
||||
};
|
||||
|
||||
// title screen segment A
|
||||
extern Gfx title_screen_bg_dl_0A000118[];
|
||||
extern Gfx title_screen_bg_dl_0A000100[];
|
||||
extern Gfx title_screen_bg_dl_0A000130[];
|
||||
extern Gfx title_screen_bg_dl_0A000148[];
|
||||
extern Gfx title_screen_bg_dl_0A000160[];
|
||||
extern Gfx title_screen_bg_dl_0A000178[];
|
||||
extern Gfx title_screen_bg_dl_0A000190[];
|
||||
extern Gfx mario_title_texture_table[];
|
||||
extern Gfx game_over_texture_table[];
|
||||
|
||||
// intro geo bss
|
||||
int gGameOverFrameCounter;
|
||||
int gGameOverTableIndex;
|
||||
s16 gTitleZoomCounter;
|
||||
s32 gTitleFadeCounter;
|
||||
|
||||
// intro screen background display lists for each of four 80x20 textures
|
||||
Gfx *introBackgroundDlRows[] = { title_screen_bg_dl_0A000130, title_screen_bg_dl_0A000148,
|
||||
title_screen_bg_dl_0A000160, title_screen_bg_dl_0A000178 };
|
||||
|
||||
// intro screen background texture X offsets
|
||||
float introBackgroundOffsetX[] = {
|
||||
0.0, 80.0, 160.0, 240.0, 0.0, 80.0, 160.0, 240.0, 0.0, 80.0, 160.0, 240.0,
|
||||
};
|
||||
|
||||
// intro screen background texture Y offsets
|
||||
float introBackgroundOffsetY[] = {
|
||||
160.0, 160.0, 160.0, 160.0, 80.0, 80.0, 80.0, 80.0, 0.0, 0.0, 0.0, 0.0,
|
||||
};
|
||||
|
||||
// table that points to either the "Super Mario 64" or "Game Over" tables
|
||||
Gfx *introBackgroundTextureType[] = { mario_title_texture_table, game_over_texture_table };
|
||||
|
||||
s8 introBackgroundIndexTable[] = {
|
||||
INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO,
|
||||
INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO,
|
||||
INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO,
|
||||
INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO,
|
||||
};
|
||||
|
||||
// only one table of indexes listed
|
||||
s8 *introBackgroundTables[] = { introBackgroundIndexTable };
|
||||
|
||||
s8 gameOverBackgroundTable[] = {
|
||||
INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER,
|
||||
INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER,
|
||||
INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER,
|
||||
INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER,
|
||||
};
|
||||
|
||||
// order of tiles that are flipped from "Game Over" to "Super Mario 64"
|
||||
s8 gameOverBackgroundFlipOrder[] = { 0x00, 0x01, 0x02, 0x03, 0x07, 0x0B,
|
||||
0x0a, 0x09, 0x08, 0x04, 0x05, 0x06 };
|
||||
|
||||
Gfx *geo18_title_screen(u32 sp50, struct GraphNode *sp54, UNUSED u32 sp58) {
|
||||
struct GraphNode *graphNode; // sp4c
|
||||
Gfx *displayList; // sp48
|
||||
Gfx *displayListIter; // sp44
|
||||
Mtx *scaleMat; // sp40
|
||||
f32 *scaleTable1; // sp3c
|
||||
f32 *scaleTable2; // sp38
|
||||
f32 scaleX; // sp34
|
||||
f32 scaleY; // sp30
|
||||
f32 scaleZ; // sp2c
|
||||
graphNode = sp54;
|
||||
displayList = NULL;
|
||||
displayListIter = NULL;
|
||||
scaleTable1 = segmented_to_virtual(intro_seg7_table_0700C790);
|
||||
scaleTable2 = segmented_to_virtual(intro_seg7_table_0700C880);
|
||||
if (sp50 != 1) {
|
||||
gTitleZoomCounter = 0;
|
||||
} else if (sp50 == 1) {
|
||||
graphNode->flags = (graphNode->flags & 0xFF) | 0x100;
|
||||
scaleMat = alloc_display_list(sizeof(*scaleMat));
|
||||
displayList = alloc_display_list(4 * sizeof(*displayList));
|
||||
displayListIter = displayList;
|
||||
if (gTitleZoomCounter >= 0 && gTitleZoomCounter < INTRO_STEPS_ZOOM_IN) {
|
||||
scaleX = scaleTable1[gTitleZoomCounter * 3];
|
||||
scaleY = scaleTable1[gTitleZoomCounter * 3 + 1];
|
||||
scaleZ = scaleTable1[gTitleZoomCounter * 3 + 2];
|
||||
} else if (gTitleZoomCounter >= INTRO_STEPS_ZOOM_IN && gTitleZoomCounter < INTRO_STEPS_HOLD_1) {
|
||||
scaleX = 1.0f;
|
||||
scaleY = 1.0f;
|
||||
scaleZ = 1.0f;
|
||||
} else if (gTitleZoomCounter >= INTRO_STEPS_HOLD_1
|
||||
&& gTitleZoomCounter < INTRO_STEPS_ZOOM_OUT) {
|
||||
scaleX = scaleTable2[(gTitleZoomCounter - INTRO_STEPS_HOLD_1) * 3];
|
||||
scaleY = scaleTable2[(gTitleZoomCounter - INTRO_STEPS_HOLD_1) * 3 + 1];
|
||||
scaleZ = scaleTable2[(gTitleZoomCounter - INTRO_STEPS_HOLD_1) * 3 + 2];
|
||||
} else {
|
||||
scaleX = 0.0f;
|
||||
scaleY = 0.0f;
|
||||
scaleZ = 0.0f;
|
||||
}
|
||||
guScale(scaleMat, scaleX, scaleY, scaleZ);
|
||||
gSPMatrix(displayListIter++, scaleMat, G_MTX_PUSH);
|
||||
gSPDisplayList(displayListIter++, &intro_seg7_dl_0700B3A0);
|
||||
gSPPopMatrix(displayListIter++, G_MTX_MODELVIEW);
|
||||
gSPEndDisplayList(displayListIter);
|
||||
gTitleZoomCounter++;
|
||||
}
|
||||
return displayList;
|
||||
}
|
||||
|
||||
Gfx *geo18_fade_transition(u32 sp40, struct GraphNode *sp44, UNUSED u32 sp48) {
|
||||
struct GraphNode *graphNode = sp44; // sp3c
|
||||
Gfx *displayList = NULL; // sp38
|
||||
Gfx *displayListIter = NULL; // sp34
|
||||
if (sp40 != 1) {
|
||||
gTitleFadeCounter = 0; // D_801B985C
|
||||
} else if (sp40 == 1) {
|
||||
displayList = alloc_display_list(5 * sizeof(*displayList));
|
||||
displayListIter = displayList;
|
||||
gSPDisplayList(displayListIter++, dl_proj_mtx_fullscreen);
|
||||
gDPSetEnvColor(displayListIter++, 0xFF, 0xFF, 0xFF, gTitleFadeCounter);
|
||||
if (gTitleFadeCounter == 0xFF) {
|
||||
if (0) {
|
||||
}
|
||||
graphNode->flags = (graphNode->flags & 0xFF) | 0x100;
|
||||
gDPSetRenderMode(displayListIter++, G_RM_AA_OPA_SURF, G_RM_AA_OPA_SURF2);
|
||||
} else {
|
||||
graphNode->flags = (graphNode->flags & 0xFF) | 0x500;
|
||||
gDPSetRenderMode(displayListIter++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2);
|
||||
if (0) {
|
||||
}
|
||||
}
|
||||
gSPDisplayList(displayListIter++, &intro_seg7_dl_0700C6A0);
|
||||
gSPEndDisplayList(displayListIter);
|
||||
if (gTitleZoomCounter >= 0x13) {
|
||||
gTitleFadeCounter += 0x1a;
|
||||
if (gTitleFadeCounter >= 0x100) {
|
||||
gTitleFadeCounter = 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
return displayList;
|
||||
}
|
||||
|
||||
Gfx *intro_backdrop_one_image(u32 index, s8 *backgroundTable) {
|
||||
Mtx *mtx; // sp5c
|
||||
Gfx *displayList; // sp58
|
||||
Gfx *displayListIter; // sp54
|
||||
u32 *vIntroBgTable; // sp50
|
||||
s32 i; // sp4c
|
||||
mtx = alloc_display_list(sizeof(*mtx));
|
||||
displayList = alloc_display_list(36 * sizeof(*displayList));
|
||||
displayListIter = displayList;
|
||||
vIntroBgTable = segmented_to_virtual(introBackgroundTextureType[backgroundTable[index]]);
|
||||
guTranslate(mtx, introBackgroundOffsetX[index], introBackgroundOffsetY[index], 0.0f);
|
||||
gSPMatrix(displayListIter++, mtx, G_MTX_LOAD | G_MTX_PUSH);
|
||||
gSPDisplayList(displayListIter++, &title_screen_bg_dl_0A000118);
|
||||
for (i = 0; i < 4; ++i) {
|
||||
gDPSetTextureImage(displayListIter++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, vIntroBgTable[i]);
|
||||
gDPSetTile(displayListIter++, 0, 2, 0, 0, 7, 0, 2, 6, 0, 2, 7, 0);
|
||||
gDPLoadSync(displayListIter++);
|
||||
gDPLoadBlock(displayListIter++, 7, 0, 0, 1599, 103);
|
||||
gDPPipeSync(displayListIter++);
|
||||
gDPSetTile(displayListIter++, 0, 2, 0x14, 0, 0, 0, 2, 6, 0, 2, 7, 0);
|
||||
gDPSetTileSize(displayListIter++, 0, 0, 0, 316, 76);
|
||||
gSPDisplayList(displayListIter++, introBackgroundDlRows[i]);
|
||||
}
|
||||
gSPPopMatrix(displayListIter++, G_MTX_MODELVIEW);
|
||||
gSPEndDisplayList(displayListIter);
|
||||
return displayList;
|
||||
}
|
||||
|
||||
Gfx *geo18_intro_backdrop(u32 sp48, struct GraphNode *sp4c, UNUSED u32 sp50) {
|
||||
struct GraphNodeMore *graphNode; // sp44
|
||||
s32 index; // sp40
|
||||
s8 *backgroundTable; // sp3c
|
||||
Gfx *displayList; // sp38
|
||||
Gfx *displayListIter; // sp34
|
||||
s32 i; // sp30
|
||||
graphNode = (struct GraphNodeMore *) sp4c;
|
||||
index = graphNode->unk18 & 0xff; // TODO: word at offset 0x18 of struct GraphNode
|
||||
backgroundTable = introBackgroundTables[index];
|
||||
displayList = NULL;
|
||||
displayListIter = NULL;
|
||||
if (sp48 == 1) {
|
||||
displayList = alloc_display_list(16 * sizeof(*displayList));
|
||||
displayListIter = displayList;
|
||||
graphNode->node.flags = (graphNode->node.flags & 0xFF) | 0x100;
|
||||
gSPDisplayList(displayListIter++, &dl_proj_mtx_fullscreen);
|
||||
gSPDisplayList(displayListIter++, &title_screen_bg_dl_0A000100);
|
||||
for (i = 0; i < 12; ++i) {
|
||||
gSPDisplayList(displayListIter++, intro_backdrop_one_image(i, backgroundTable));
|
||||
}
|
||||
gSPDisplayList(displayListIter++, &title_screen_bg_dl_0A000190);
|
||||
gSPEndDisplayList(displayListIter);
|
||||
}
|
||||
return displayList;
|
||||
}
|
||||
|
||||
Gfx *geo18_game_over_tile(u32 sp40, struct GraphNode *sp44, UNUSED u32 sp48) {
|
||||
struct GraphNode *graphNode; // sp3c
|
||||
Gfx *displayList; // sp38
|
||||
Gfx *displayListIter; // sp34
|
||||
s32 j; // sp30
|
||||
s32 i; // sp2c
|
||||
graphNode = sp44;
|
||||
displayList = NULL;
|
||||
displayListIter = NULL;
|
||||
if (sp40 != 1) {
|
||||
gGameOverFrameCounter = 0;
|
||||
gGameOverTableIndex = -2;
|
||||
for (i = 0; i < (s32) sizeof(gameOverBackgroundTable); ++i) {
|
||||
gameOverBackgroundTable[i] = INTRO_BACKGROUND_GAME_OVER;
|
||||
}
|
||||
} else {
|
||||
displayList = alloc_display_list(16 * sizeof(*displayList));
|
||||
displayListIter = displayList;
|
||||
if (gGameOverTableIndex == -2) {
|
||||
if (gGameOverFrameCounter == 180) {
|
||||
gGameOverTableIndex++;
|
||||
gGameOverFrameCounter = 0;
|
||||
}
|
||||
} else {
|
||||
// transition tile from "Game Over" to "Super Mario 64"
|
||||
if (gGameOverTableIndex != 11 && !(gGameOverFrameCounter & 0x1)) {
|
||||
gGameOverTableIndex++;
|
||||
gameOverBackgroundTable[gameOverBackgroundFlipOrder[gGameOverTableIndex]] =
|
||||
INTRO_BACKGROUND_SUPER_MARIO;
|
||||
}
|
||||
}
|
||||
if (gGameOverTableIndex != 11) {
|
||||
gGameOverFrameCounter++;
|
||||
}
|
||||
graphNode->flags = (graphNode->flags & 0xFF) | 0x100;
|
||||
gSPDisplayList(displayListIter++, &dl_proj_mtx_fullscreen);
|
||||
gSPDisplayList(displayListIter++, &title_screen_bg_dl_0A000100);
|
||||
for (j = 0; j < (s32) sizeof(gameOverBackgroundTable); ++j) {
|
||||
gSPDisplayList(displayListIter++, intro_backdrop_one_image(j, gameOverBackgroundTable));
|
||||
}
|
||||
gSPDisplayList(displayListIter++, &title_screen_bg_dl_0A000190);
|
||||
gSPEndDisplayList(displayListIter);
|
||||
}
|
||||
return displayList;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef _INTRO_GEO_H
|
||||
#define _INTRO_GEO_H
|
||||
|
||||
#include "engine/graph_node.h"
|
||||
|
||||
Gfx *geo18_title_screen(u32 a0, struct GraphNode *a1, UNUSED u32 a2);
|
||||
Gfx *geo18_fade_transition(u32 a0, struct GraphNode *a1, UNUSED u32 a2);
|
||||
Gfx *intro_backdrop_one_image(u32 index, s8 *backdrop_table);
|
||||
Gfx *geo18_intro_backdrop(u32 a0, struct GraphNode *a1, UNUSED u32 a2);
|
||||
Gfx *geo18_game_over_tile(u32 a0, struct GraphNode *a1, UNUSED u32 a2);
|
||||
|
||||
#endif /* _INTRO_GEO_H */
|
||||
@@ -0,0 +1,269 @@
|
||||
#include <ultra64.h>
|
||||
|
||||
#include "sm64.h"
|
||||
#include "audio/external.h"
|
||||
#include "game/game.h"
|
||||
#include "game/main.h"
|
||||
#include "game/memory.h"
|
||||
#include "game/area.h"
|
||||
#include "game/save_file.h"
|
||||
#include "game/level_update.h"
|
||||
#include "game/sound_init.h"
|
||||
#include "game/print.h"
|
||||
#include "game/display.h"
|
||||
#include "seq_ids.h"
|
||||
#include "engine/math_util.h"
|
||||
|
||||
#define PRESS_START_DEMO_TIMER 800
|
||||
|
||||
static char gLevelSelect_StageNamesText[64][16] = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"TERESA OBAKE",
|
||||
"YYAMA1 % YSLD1",
|
||||
"SELECT ROOM",
|
||||
"HORROR DUNGEON",
|
||||
"SABAKU % PYRMD",
|
||||
"BATTLE FIELD",
|
||||
"YUKIYAMA2",
|
||||
"POOL KAI",
|
||||
"WTDG % TINBOTU",
|
||||
"BIG WORLD",
|
||||
"CLOCK TOWER",
|
||||
"RAINBOW CRUISE",
|
||||
"MAIN MAP",
|
||||
"EXT1 YOKO SCRL",
|
||||
"EXT7 HORI MINI",
|
||||
"EXT2 TIKA LAVA",
|
||||
"EXT9 SUISOU",
|
||||
"EXT3 HEAVEN",
|
||||
"FIREB1 % INVLC",
|
||||
"WATER LAND",
|
||||
"MOUNTAIN",
|
||||
"ENDING",
|
||||
"URANIWA",
|
||||
"EXT4 MINI SLID",
|
||||
"IN THE FALL",
|
||||
"EXT6 MARIO FLY",
|
||||
"KUPPA1",
|
||||
"EXT8 BLUE SKY",
|
||||
"",
|
||||
"KUPPA2",
|
||||
"KUPPA3",
|
||||
"",
|
||||
"DONKEY % SLID2",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
};
|
||||
|
||||
static u16 gDemoCountdown = 0;
|
||||
#ifndef VERSION_JP
|
||||
static s16 D_U_801A7C34 = 1;
|
||||
static s16 gameOverNotPlayed = 1;
|
||||
#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.
|
||||
|
||||
// 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.
|
||||
int run_press_start_demo_timer(s32 timer) {
|
||||
gCurrDemoInput = NULL;
|
||||
|
||||
if (timer == 0) {
|
||||
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 mario demo animation for the demo list.
|
||||
func_80278AD4(&gDemo, gDemoInputListID);
|
||||
|
||||
// if the next demo sequence ID is the count limit, reset it back to
|
||||
// the first sequence.
|
||||
if (++gDemoInputListID == gDemo.animDmaTable->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;
|
||||
gCurrSaveFileNum = 1;
|
||||
gCurrActNum = 1;
|
||||
}
|
||||
} else { // activity was detected, so reset the demo countdown.
|
||||
gDemoCountdown = 0;
|
||||
}
|
||||
}
|
||||
return timer;
|
||||
}
|
||||
|
||||
// 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) {
|
||||
s32 stageChanged = FALSE;
|
||||
|
||||
// perform the ID updates per each button press.
|
||||
if (gPlayer1Controller->buttonPressed & A_BUTTON) {
|
||||
++gCurrLevelNum, stageChanged = TRUE;
|
||||
}
|
||||
if (gPlayer1Controller->buttonPressed & B_BUTTON) {
|
||||
--gCurrLevelNum, stageChanged = TRUE;
|
||||
}
|
||||
if (gPlayer1Controller->buttonPressed & U_JPAD) {
|
||||
--gCurrLevelNum, stageChanged = TRUE;
|
||||
}
|
||||
if (gPlayer1Controller->buttonPressed & D_JPAD) {
|
||||
++gCurrLevelNum, stageChanged = TRUE;
|
||||
}
|
||||
if (gPlayer1Controller->buttonPressed & L_JPAD) {
|
||||
gCurrLevelNum -= 10, stageChanged = TRUE;
|
||||
}
|
||||
if (gPlayer1Controller->buttonPressed & R_JPAD) {
|
||||
gCurrLevelNum += 10, stageChanged = TRUE;
|
||||
}
|
||||
|
||||
// if the stage was changed, play the sound for changing a stage.
|
||||
if (stageChanged) {
|
||||
play_sound(SOUND_GENERAL_LEVEL_SELECT_CHANGE, gDefaultSoundArgs);
|
||||
}
|
||||
|
||||
// TODO: enum counts for the stage lists
|
||||
if (gCurrLevelNum > LEVEL_MAX) {
|
||||
gCurrLevelNum = LEVEL_MIN; // exceeded max. set to min.
|
||||
}
|
||||
|
||||
if (gCurrLevelNum < LEVEL_MIN) {
|
||||
gCurrLevelNum = LEVEL_MAX; // exceeded min. set to max.
|
||||
}
|
||||
|
||||
gCurrSaveFileNum = 4; // file 4 is used for level select tests
|
||||
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
|
||||
|
||||
#define QUIT_LEVEL_SELECT_COMBO (Z_TRIG | START_BUTTON | L_CBUTTONS | R_CBUTTONS)
|
||||
|
||||
// start being pressed signals the stage to be started. that is, unless...
|
||||
if (gPlayer1Controller->buttonPressed & START_BUTTON) {
|
||||
// ... the level select quit combo is being pressed, which uses START. If this
|
||||
// is the case, quit the menu instead.
|
||||
if (gPlayer1Controller->buttonDown == QUIT_LEVEL_SELECT_COMBO) {
|
||||
gDebugLevelSelect = 0;
|
||||
return -1;
|
||||
}
|
||||
play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs);
|
||||
return gCurrLevelNum;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int func_8016F3CC(void) {
|
||||
s32 sp1C = 0;
|
||||
|
||||
#ifndef VERSION_JP
|
||||
if (D_U_801A7C34 == 1) {
|
||||
if (gGlobalTimer < 0x81) {
|
||||
play_sound(SOUND_MARIO_HELLO, gDefaultSoundArgs);
|
||||
} else {
|
||||
play_sound(SOUND_MARIO_PRESS_START_TO_PLAY, gDefaultSoundArgs);
|
||||
}
|
||||
D_U_801A7C34 = 0;
|
||||
}
|
||||
#endif
|
||||
print_intro_text();
|
||||
|
||||
if (gPlayer1Controller->buttonPressed & START_BUTTON) {
|
||||
#ifdef VERSION_JP
|
||||
play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs);
|
||||
sp1C = 100 + gDebugLevelSelect;
|
||||
#else
|
||||
play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs);
|
||||
sp1C = 100 + gDebugLevelSelect;
|
||||
D_U_801A7C34 = 1;
|
||||
#endif
|
||||
}
|
||||
return run_press_start_demo_timer(sp1C);
|
||||
}
|
||||
|
||||
int func_8016F444(void) {
|
||||
s32 sp1C = 0;
|
||||
|
||||
#ifndef VERSION_JP
|
||||
if (gameOverNotPlayed == 1) {
|
||||
play_sound(SOUND_MARIO_GAME_OVER, gDefaultSoundArgs);
|
||||
gameOverNotPlayed = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
print_intro_text();
|
||||
|
||||
if (gPlayer1Controller->buttonPressed & START_BUTTON) {
|
||||
play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs);
|
||||
sp1C = 100 + gDebugLevelSelect;
|
||||
#ifndef VERSION_JP
|
||||
gameOverNotPlayed = 1;
|
||||
#endif
|
||||
}
|
||||
return run_press_start_demo_timer(sp1C);
|
||||
}
|
||||
|
||||
int func_8016F4BC(void) {
|
||||
set_background_music(0, SEQ_SOUND_PLAYER, 0);
|
||||
play_sound(SOUND_MENU_COIN_ITS_A_ME_MARIO, gDefaultSoundArgs);
|
||||
return 1;
|
||||
}
|
||||
|
||||
s32 LevelProc_8016F508(s16 arg1, UNUSED s32 arg2) {
|
||||
s32 retVar;
|
||||
|
||||
switch (arg1) {
|
||||
case 0:
|
||||
retVar = func_8016F4BC();
|
||||
break;
|
||||
case 1:
|
||||
retVar = func_8016F3CC();
|
||||
break;
|
||||
case 2:
|
||||
retVar = func_8016F444();
|
||||
break;
|
||||
case 3:
|
||||
retVar = level_select_input_loop();
|
||||
break; // useless break needed to match
|
||||
}
|
||||
return retVar;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef _LEVEL_SELECT_MENU_H
|
||||
#define _LEVEL_SELECT_MENU_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
// extern ? LevelProc_8016F508(?);
|
||||
|
||||
#endif /* _LEVEL_SELECT_MENU_H */
|
||||
@@ -0,0 +1,344 @@
|
||||
#include <ultra64.h>
|
||||
|
||||
#include "sm64.h"
|
||||
#include "audio/external.h"
|
||||
#include "game/game.h"
|
||||
#include "game/memory.h"
|
||||
#include "game/area.h"
|
||||
#include "game/save_file.h"
|
||||
#include "game/object_helpers.h"
|
||||
#include "game/ingame_menu.h"
|
||||
#include "game/level_update.h"
|
||||
#include "game/segment2.h"
|
||||
#include "game/segment7.h"
|
||||
#include "game/object_list_processor.h"
|
||||
#include "engine/behavior_script.h"
|
||||
#include "engine/graph_node.h"
|
||||
#include "behavior_data.h"
|
||||
#include "text_strings.h"
|
||||
#include "star_select.h"
|
||||
|
||||
/**
|
||||
* @file star_select.c
|
||||
* This file implements how the star select screen (act selector) function.
|
||||
* That includes handles what stars can be selected, star selector types,
|
||||
* strings, act values, and star selector model rendering if a star is collected or not.
|
||||
*/
|
||||
|
||||
// Star Selector count models printed in the act selector menu.
|
||||
static struct Object *sStarSelectorModels[8];
|
||||
|
||||
// The act the course is loaded as, affects whether some objects spawn.
|
||||
static s8 sLoadedActNum;
|
||||
|
||||
// Number of obtained stars, excluding the coin star.
|
||||
static u8 sObtainedStars;
|
||||
|
||||
// Total number of stars that appear in the act selector menu.
|
||||
static s8 sVisibleStars;
|
||||
|
||||
// Act selected when the act menu is first opened.
|
||||
static u8 sInitSelectedActNum;
|
||||
|
||||
// Index value of the act selected in the act menu.
|
||||
static s8 sSelectedActIndex = 0;
|
||||
|
||||
// Index value of the star that is selectable in the act menu.
|
||||
// Excluding the next star, it doesn't count other transparent stars.
|
||||
static s8 sSelectableStarIndex = 0;
|
||||
|
||||
// Act Selector menu timer that keeps counting until you choose an act.
|
||||
static s32 sActSelectorMenuTimer = 0;
|
||||
|
||||
/**
|
||||
* Act Selector Star Type Loop Action
|
||||
* Defines a select type for a star in the act selector.
|
||||
*/
|
||||
void bhv_act_selector_star_type_loop(void) {
|
||||
switch (gCurrentObject->oStarSelectorType) {
|
||||
// If a star is not selected, don't rotate or change size
|
||||
case STAR_SELECTOR_NOT_SELECTED:
|
||||
gCurrentObject->oStarSelectorSize -= 0.1;
|
||||
if (gCurrentObject->oStarSelectorSize < 1.0) {
|
||||
gCurrentObject->oStarSelectorSize = 1.0;
|
||||
}
|
||||
gCurrentObject->oFaceAngleYaw = 0;
|
||||
break;
|
||||
// If a star is selected, rotate and slightly increase size
|
||||
case STAR_SELECTOR_SELECTED:
|
||||
gCurrentObject->oStarSelectorSize += 0.1;
|
||||
if (gCurrentObject->oStarSelectorSize > 1.3) {
|
||||
gCurrentObject->oStarSelectorSize = 1.3;
|
||||
}
|
||||
gCurrentObject->oFaceAngleYaw += 0x800;
|
||||
break;
|
||||
// If the 100 coin star is selected, rotate
|
||||
case STAR_SELECTOR_100_COINS:
|
||||
gCurrentObject->oFaceAngleYaw += 0x800;
|
||||
break;
|
||||
}
|
||||
// Scale act selector stars depending of the type selected
|
||||
obj_scale(gCurrentObject->oStarSelectorSize);
|
||||
// Unused timer, only referenced here. Probably replaced by sActSelectorMenuTimer
|
||||
gCurrentObject->oStarSelectorTimer++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the 100 coin star with an special star selector type.
|
||||
*/
|
||||
void render_100_coin_star(u8 stars) {
|
||||
if (stars & (1 << 6)) {
|
||||
// If the 100 coin star has been collected, create a new star selector next to the coin score.
|
||||
sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
|
||||
bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
|
||||
sStarSelectorModels[6]->oStarSelectorSize = 0.8;
|
||||
sStarSelectorModels[6]->oStarSelectorType = STAR_SELECTOR_100_COINS;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Act Selector Init Action
|
||||
* Checks how many stars has been obtained in a course, to render
|
||||
* the correct star models, the 100 coin star and also handles
|
||||
* checks of what star should be next in sInitSelectedActNum.
|
||||
*/
|
||||
void bhv_act_selector_init(void) {
|
||||
s16 i = 0;
|
||||
s32 selectorModelIDs[10];
|
||||
u8 stars = save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1);
|
||||
|
||||
sVisibleStars = 0;
|
||||
while (i != sObtainedStars) {
|
||||
if (stars & (1 << sVisibleStars)) { // Star has been collected
|
||||
selectorModelIDs[sVisibleStars] = MODEL_STAR;
|
||||
i++;
|
||||
} else { // Star has not been collected
|
||||
selectorModelIDs[sVisibleStars] = MODEL_TRANSPARENT_STAR;
|
||||
// If this is the first star that has not been collected, set
|
||||
// the default selection to this star.
|
||||
if (sInitSelectedActNum == 0) {
|
||||
sInitSelectedActNum = sVisibleStars + 1;
|
||||
sSelectableStarIndex = sVisibleStars;
|
||||
}
|
||||
}
|
||||
sVisibleStars++;
|
||||
}
|
||||
|
||||
// If the stars have been collected in order so far, show the next star.
|
||||
if (sVisibleStars == sObtainedStars && sVisibleStars != 6) {
|
||||
selectorModelIDs[sVisibleStars] = MODEL_TRANSPARENT_STAR;
|
||||
sInitSelectedActNum = sVisibleStars + 1;
|
||||
sSelectableStarIndex = sVisibleStars;
|
||||
sVisibleStars++;
|
||||
}
|
||||
|
||||
// If all stars have been collected, set the default selection to the last star.
|
||||
if (sObtainedStars == 6) {
|
||||
sInitSelectedActNum = sVisibleStars;
|
||||
}
|
||||
|
||||
//! Useless, since sInitSelectedActNum has already been set in this
|
||||
//! scenario by the code that shows the next uncollected star.
|
||||
if (sObtainedStars == 0) {
|
||||
sInitSelectedActNum = 1;
|
||||
}
|
||||
|
||||
// Render star selector objects
|
||||
for (i = 0; i < sVisibleStars; i++) {
|
||||
sStarSelectorModels[i] =
|
||||
spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
|
||||
75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
|
||||
sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
|
||||
}
|
||||
|
||||
render_100_coin_star(stars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Act Selector Loop Action
|
||||
* Handles star selector scrolling depending of what stars are
|
||||
* selectable, whenever all 6 stars are obtained or not.
|
||||
* Also handles 2 star selector types whenever the star is selected
|
||||
* or not, the types are defined in bhv_act_selector_star_type_loop.
|
||||
*/
|
||||
void bhv_act_selector_loop(void) {
|
||||
s8 i;
|
||||
u8 starIndexCounter;
|
||||
u8 stars = save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1);
|
||||
|
||||
if (sObtainedStars != 6) {
|
||||
// Sometimes, stars are not selectable even if they appear on the screen.
|
||||
// This code filters selectable and non-selectable stars.
|
||||
sSelectedActIndex = 0;
|
||||
handle_menu_scrolling(MENU_SCROLL_HORIZONTAL, &sSelectableStarIndex, 0, sObtainedStars);
|
||||
starIndexCounter = sSelectableStarIndex;
|
||||
for (i = 0; i < sVisibleStars; i++) {
|
||||
// Can the star be selected (is it either already completed or the first non-completed mission)
|
||||
if ((stars & (1 << i)) || i + 1 == sInitSelectedActNum) {
|
||||
if (starIndexCounter == 0) { // We have reached the sSelectableStarIndex-th selectable star.
|
||||
sSelectedActIndex = i;
|
||||
break;
|
||||
}
|
||||
starIndexCounter--;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If all stars are collected then they are all selectable.
|
||||
handle_menu_scrolling(MENU_SCROLL_HORIZONTAL, &sSelectableStarIndex, 0, sVisibleStars - 1);
|
||||
sSelectedActIndex = sSelectableStarIndex;
|
||||
}
|
||||
|
||||
// Star selector type handler
|
||||
for (i = 0; i < sVisibleStars; i++) {
|
||||
if (sSelectedActIndex == i) {
|
||||
sStarSelectorModels[i]->oStarSelectorType = STAR_SELECTOR_SELECTED;
|
||||
} else {
|
||||
sStarSelectorModels[i]->oStarSelectorType = STAR_SELECTOR_NOT_SELECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the course number selected with the wood rgba16 course texture.
|
||||
*/
|
||||
static void print_course_number(void) {
|
||||
u8 courseNum[4];
|
||||
|
||||
create_dl_translation_matrix(MENU_MTX_PUSH, 158.0f, 81.0f, 0.0f);
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_menu_rgba16_wood_course);
|
||||
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255);
|
||||
|
||||
int_to_str(gCurrCourseNum, courseNum);
|
||||
|
||||
if (gCurrCourseNum < 10) { // 1 digit number
|
||||
print_hud_lut_string(HUD_LUT_GLOBAL, 152, 158, courseNum);
|
||||
} else { // 2 digit number
|
||||
print_hud_lut_string(HUD_LUT_GLOBAL, 143, 158, courseNum);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end);
|
||||
}
|
||||
|
||||
#ifdef VERSION_JP
|
||||
#define ACT_NAME_X 158
|
||||
#else
|
||||
#define ACT_NAME_X 163
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Print act selector strings, some with special checks.
|
||||
*/
|
||||
static void print_act_selector_strings(void) {
|
||||
// TODO: EU relocates level and act name tables to translation segment 0x19
|
||||
#ifndef VERSION_EU
|
||||
unsigned char myScore[] = { TEXT_MYSCORE };
|
||||
unsigned char starNumbers[] = { TEXT_ZERO };
|
||||
u8 **levelNameTbl = segmented_to_virtual(seg2_level_name_table);
|
||||
u8 *currLevelName = segmented_to_virtual(levelNameTbl[gCurrCourseNum - 1]);
|
||||
u8 **actNameTbl = segmented_to_virtual(seg2_act_name_table);
|
||||
u8 *selectedActName;
|
||||
s16 lvlNameX;
|
||||
s16 actNameX;
|
||||
s8 i;
|
||||
|
||||
create_dl_ortho_matrix();
|
||||
|
||||
// Print the coin highscore.
|
||||
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255);
|
||||
print_hud_my_score_coins(1, gCurrSaveFileNum - 1, gCurrCourseNum - 1, 155, 106);
|
||||
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end);
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, 255);
|
||||
// Print the "MY SCORE" text if the coin score is more than 0
|
||||
if (save_file_get_course_coin_score(gCurrSaveFileNum - 1, gCurrCourseNum - 1) != 0) {
|
||||
print_generic_string(102, 118, myScore);
|
||||
}
|
||||
// Print the level name; add 3 to skip the number and spacing to get to the actual string to center.
|
||||
lvlNameX = get_str_x_pos_from_center(160, currLevelName + 3, 10.0f);
|
||||
print_generic_string(lvlNameX, 33, currLevelName + 3);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_end);
|
||||
|
||||
print_course_number();
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_menu_ia8_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, 255);
|
||||
// Print the name of the selected act.
|
||||
if (sVisibleStars != 0) {
|
||||
selectedActName = segmented_to_virtual(actNameTbl[(gCurrCourseNum - 1) * 6 + sSelectedActIndex]);
|
||||
actNameX = get_str_x_pos_from_center(ACT_NAME_X, selectedActName, 8.0f);
|
||||
print_menu_generic_string(actNameX, 81, selectedActName);
|
||||
}
|
||||
|
||||
// Print the numbers above each star.
|
||||
for (i = 1; i <= sVisibleStars; i++) {
|
||||
starNumbers[0] = i;
|
||||
print_menu_generic_string(i * 34 - sVisibleStars * 17 + 139, 38, starNumbers);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_menu_ia8_text_end);
|
||||
#endif // !VERSION_EU
|
||||
}
|
||||
|
||||
/**
|
||||
* Geo function that Print act selector strings.
|
||||
*!@bug: This geo function is missing the third param. Harmless in practice due to o32 convention.
|
||||
*/
|
||||
Gfx *geo_act_selector_strings(s16 callContext, UNUSED struct GraphNode *node) {
|
||||
if (callContext == GEO_CONTEXT_RENDER) {
|
||||
print_act_selector_strings();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates act selector values before entering a main course.
|
||||
* Also load how much stars a course has, without counting the 100 coin star.
|
||||
*/
|
||||
void lvl_init_act_selector_values_and_stars(UNUSED s32 arg, UNUSED s32 unused) {
|
||||
u8 stars = save_file_get_star_flags(gCurrSaveFileNum - 1, gCurrCourseNum - 1);
|
||||
|
||||
sLoadedActNum = 0;
|
||||
sInitSelectedActNum = 0;
|
||||
sVisibleStars = 0;
|
||||
sActSelectorMenuTimer = 0;
|
||||
sObtainedStars = save_file_get_course_star_count(gCurrSaveFileNum - 1, gCurrCourseNum - 1);
|
||||
|
||||
// Don't count 100 coin star
|
||||
if (stars & (1 << 6)) {
|
||||
sObtainedStars--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads act selector button actions with selected act value checks.
|
||||
* Also updates objects and returns act number selected after is choosen.
|
||||
*/
|
||||
int 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
|
||||
if ((gPlayer3Controller->buttonPressed & A_BUTTON)
|
||||
|| (gPlayer3Controller->buttonPressed & START_BUTTON)
|
||||
|| (gPlayer3Controller->buttonPressed & B_BUTTON)) {
|
||||
#ifdef VERSION_JP
|
||||
play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs);
|
||||
#else
|
||||
play_sound(SOUND_MENU_STAR_SOUND_LETS_A_GO, gDefaultSoundArgs);
|
||||
#endif
|
||||
if (sInitSelectedActNum > sSelectedActIndex) {
|
||||
sLoadedActNum = sSelectedActIndex + 1;
|
||||
} else {
|
||||
sLoadedActNum = sInitSelectedActNum;
|
||||
}
|
||||
gDialogCourseActNum = sSelectedActIndex + 1;
|
||||
}
|
||||
}
|
||||
|
||||
area_update_objects();
|
||||
sActSelectorMenuTimer++;
|
||||
return sLoadedActNum;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef STAR_SELECT_H
|
||||
#define STAR_SELECT_H
|
||||
|
||||
enum StarSelectorTypes
|
||||
{
|
||||
STAR_SELECTOR_NOT_SELECTED,
|
||||
STAR_SELECTOR_SELECTED,
|
||||
STAR_SELECTOR_100_COINS
|
||||
};
|
||||
|
||||
#endif /* STAR_SELECT_H */
|
||||
Reference in new issue
Block a user