mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
Clean up game_modes.c and game_states.c (#1115)
This commit is contained in:
parent
ef440ff994
commit
bde8f70e3f
@ -2478,15 +2478,6 @@ typedef struct CreditsPairOffset {
|
|||||||
/* 0x02 */ s16 offset;
|
/* 0x02 */ s16 offset;
|
||||||
} CreditsPairOffset; // size = 0x4
|
} CreditsPairOffset; // size = 0x4
|
||||||
|
|
||||||
typedef struct GameMode {
|
|
||||||
/* 0x00 */ u16 flags;
|
|
||||||
/* 0x04 */ void (*init)(void);
|
|
||||||
/* 0x08 */ void (*step)(void);
|
|
||||||
/* 0x0C */ UNK_FUN_PTR(unk_0C);
|
|
||||||
/* 0x10 */ void (*render)(void);
|
|
||||||
/* 0x14 */ void (*renderAux)(void); ///< @see state_render_frontUI
|
|
||||||
} GameMode; // size = 0x18
|
|
||||||
|
|
||||||
typedef struct PartnerDMAData {
|
typedef struct PartnerDMAData {
|
||||||
/* 0x00 */ u32 dmaStart;
|
/* 0x00 */ u32 dmaStart;
|
||||||
/* 0x04 */ u32 dmaEnd;
|
/* 0x04 */ u32 dmaEnd;
|
||||||
|
@ -3491,27 +3491,6 @@ enum EffectGfxDataFlags {
|
|||||||
|
|
||||||
#include "move_enum.h"
|
#include "move_enum.h"
|
||||||
|
|
||||||
enum GameModeIDs {
|
|
||||||
GAME_MODE_STARTUP = 0x00000000,
|
|
||||||
GAME_MODE_LOGOS = 0x00000001,
|
|
||||||
GAME_MODE_TITLE_SCREEN = 0x00000002,
|
|
||||||
GAME_MODE_ENTER_DEMO_WORLD = 0x00000003,
|
|
||||||
GAME_MODE_CHANGE_MAP = 0x00000004,
|
|
||||||
GAME_MODE_UNUSED = 0x00000005,
|
|
||||||
GAME_MODE_ENTER_WORLD = 0x00000006,
|
|
||||||
GAME_MODE_WORLD = 0x00000007,
|
|
||||||
GAME_MODE_BATTLE = 0x00000008,
|
|
||||||
GAME_MODE_END_BATTLE = 0x00000009,
|
|
||||||
GAME_MODE_PAUSE = 0x0000000A,
|
|
||||||
GAME_MODE_UNPAUSE = 0x0000000B,
|
|
||||||
GAME_MODE_LANGUAGE_SELECT = 0x0000000C,
|
|
||||||
GAME_MODE_END_LANGUAGE_SELECT = 0x0000000D,
|
|
||||||
GAME_MODE_FILE_SELECT = 0x0000000E,
|
|
||||||
GAME_MODE_END_FILE_SELECT = 0x0000000F,
|
|
||||||
GAME_MODE_INTRO = 0x00000010,
|
|
||||||
GAME_MODE_DEMO = 0x00000011,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum DemoState {
|
enum DemoState {
|
||||||
DEMO_STATE_NONE = 0,
|
DEMO_STATE_NONE = 0,
|
||||||
DEMO_STATE_ACTIVE = 1,
|
DEMO_STATE_ACTIVE = 1,
|
||||||
|
@ -283,8 +283,6 @@ void mem_clear(void* data, s32 numBytes);
|
|||||||
void intro_logos_set_fade_color(s16 color);
|
void intro_logos_set_fade_color(s16 color);
|
||||||
void intro_logos_set_fade_alpha(s16 alpha);
|
void intro_logos_set_fade_alpha(s16 alpha);
|
||||||
|
|
||||||
void set_game_mode(s16 idx);
|
|
||||||
|
|
||||||
f32 get_xz_dist_to_player(f32, f32);
|
f32 get_xz_dist_to_player(f32, f32);
|
||||||
void func_800E06C0(s32);
|
void func_800E06C0(s32);
|
||||||
void close_status_bar(void);
|
void close_status_bar(void);
|
||||||
@ -584,7 +582,6 @@ void update_workers(void);
|
|||||||
void update_triggers(void);
|
void update_triggers(void);
|
||||||
void update_scripts(void);
|
void update_scripts(void);
|
||||||
void update_messages(void);
|
void update_messages(void);
|
||||||
void step_current_game_mode(void);
|
|
||||||
void update_entities(void);
|
void update_entities(void);
|
||||||
void func_80138198(void);
|
void func_80138198(void);
|
||||||
void bgm_update_music_settings(void);
|
void bgm_update_music_settings(void);
|
||||||
@ -596,13 +593,11 @@ void func_802C3EE4(void);
|
|||||||
void render_screen_overlay_backUI(void);
|
void render_screen_overlay_backUI(void);
|
||||||
void render_workers_backUI(void);
|
void render_workers_backUI(void);
|
||||||
void render_effects_UI(void);
|
void render_effects_UI(void);
|
||||||
void state_render_backUI(void);
|
|
||||||
void render_window_root(void);
|
void render_window_root(void);
|
||||||
void render_messages(void);
|
void render_messages(void);
|
||||||
void render_workers_frontUI(void);
|
void render_workers_frontUI(void);
|
||||||
void render_screen_overlay_frontUI(void);
|
void render_screen_overlay_frontUI(void);
|
||||||
void render_curtains(void);
|
void render_curtains(void);
|
||||||
void state_render_frontUI(void);
|
|
||||||
void fio_init_flash(void);
|
void fio_init_flash(void);
|
||||||
void func_80028838(void);
|
void func_80028838(void);
|
||||||
void clear_screen_overlays(void);
|
void clear_screen_overlays(void);
|
||||||
@ -704,9 +699,9 @@ void state_step_enter_world(void);
|
|||||||
void state_init_change_map(void);
|
void state_init_change_map(void);
|
||||||
void state_step_change_map(void);
|
void state_step_change_map(void);
|
||||||
void state_drawUI_change_map(void);
|
void state_drawUI_change_map(void);
|
||||||
void func_80036430(void);
|
void state_init_game_over(void);
|
||||||
void func_8003646C(void);
|
void state_step_game_over(void);
|
||||||
void func_80036640(void);
|
void state_drawUI_game_over(void);
|
||||||
void state_init_enter_world(void);
|
void state_init_enter_world(void);
|
||||||
void state_drawUI_enter_world(void);
|
void state_drawUI_enter_world(void);
|
||||||
void state_init_world(void);
|
void state_init_world(void);
|
||||||
@ -742,7 +737,6 @@ void state_drawUI_intro(void);
|
|||||||
void state_init_demo(void);
|
void state_init_demo(void);
|
||||||
void state_step_demo(void);
|
void state_step_demo(void);
|
||||||
void state_drawUI_demo(void);
|
void state_drawUI_demo(void);
|
||||||
void game_mode_set_fpDrawAuxUI(s32 i, void (*fn)(void));
|
|
||||||
|
|
||||||
void btl_set_player_idle_anims(void);
|
void btl_set_player_idle_anims(void);
|
||||||
|
|
||||||
@ -1073,7 +1067,6 @@ void clear_model_data(void);
|
|||||||
void init_sprite_shading_data(void);
|
void init_sprite_shading_data(void);
|
||||||
void clear_sprite_shading_data(void);
|
void clear_sprite_shading_data(void);
|
||||||
void clear_character_set(void);
|
void clear_character_set(void);
|
||||||
void clear_game_modes(void);
|
|
||||||
void clear_trigger_data(void);
|
void clear_trigger_data(void);
|
||||||
void clear_script_list(void);
|
void clear_script_list(void);
|
||||||
void clear_entity_data(s32);
|
void clear_entity_data(s32);
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
#define UNK_FUN_PTR(name) void(*name)(void)
|
#define UNK_FUN_PTR(name) void(*name)(void)
|
||||||
#define UNK_ARGS
|
#define UNK_ARGS
|
||||||
|
|
||||||
typedef void (*StateFunc)(void);
|
|
||||||
|
|
||||||
typedef char* (*PrintCallback)(void*, const char*, u32);
|
typedef char* (*PrintCallback)(void*, const char*, u32);
|
||||||
|
|
||||||
/// Linker symbol address, as in `ld_addrs.h`.
|
/// Linker symbol address, as in `ld_addrs.h`.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "nu/nusys.h"
|
#include "nu/nusys.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
SHIFT_BSS s16 gMapTransitionAlpha;
|
SHIFT_BSS s16 gMapTransitionAlpha;
|
||||||
SHIFT_BSS s16 gMapTransitionFadeRate;
|
SHIFT_BSS s16 gMapTransitionFadeRate;
|
||||||
@ -85,7 +86,7 @@ void state_step_enter_world(void) {
|
|||||||
enable_player_input();
|
enable_player_input();
|
||||||
}
|
}
|
||||||
set_screen_overlay_params_front(OVERLAY_NONE, -1.0f);
|
set_screen_overlay_params_front(OVERLAY_NONE, -1.0f);
|
||||||
set_game_mode(GAME_MODE_CHANGE_MAP);
|
set_game_mode(GAME_MODE_WORLD);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -173,7 +174,7 @@ void state_step_change_map(void) {
|
|||||||
enable_player_input();
|
enable_player_input();
|
||||||
}
|
}
|
||||||
set_screen_overlay_params_front(OVERLAY_NONE, -1.0f);
|
set_screen_overlay_params_front(OVERLAY_NONE, -1.0f);
|
||||||
set_game_mode(GAME_MODE_CHANGE_MAP);
|
set_game_mode(GAME_MODE_WORLD);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -185,14 +186,14 @@ void state_drawUI_change_map(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_80036430(void) {
|
void state_init_game_over(void) {
|
||||||
gMapTransitionAlpha = 255;
|
gMapTransitionAlpha = 255;
|
||||||
gMapTransitionFadeRate = 20;
|
gMapTransitionFadeRate = 20;
|
||||||
gMapTransitionState = 0x01;
|
gMapTransitionState = 0x01;
|
||||||
gPlayerStatus.flags |= PS_FLAG_NO_STATIC_COLLISION;
|
gPlayerStatus.flags |= PS_FLAG_NO_STATIC_COLLISION;
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_8003646C(void) {
|
void state_step_game_over(void) {
|
||||||
switch (gMapTransitionState) {
|
switch (gMapTransitionState) {
|
||||||
case 1:
|
case 1:
|
||||||
gOverrideFlags |= GLOBAL_OVERRIDES_8;
|
gOverrideFlags |= GLOBAL_OVERRIDES_8;
|
||||||
@ -226,7 +227,7 @@ void func_8003646C(void) {
|
|||||||
gMapTransitionAlpha = 0;
|
gMapTransitionAlpha = 0;
|
||||||
gMapTransitionState++;
|
gMapTransitionState++;
|
||||||
set_screen_overlay_params_front(OVERLAY_NONE, -1.0f);
|
set_screen_overlay_params_front(OVERLAY_NONE, -1.0f);
|
||||||
set_game_mode(GAME_MODE_CHANGE_MAP);
|
set_game_mode(GAME_MODE_WORLD);
|
||||||
}
|
}
|
||||||
update_npcs();
|
update_npcs();
|
||||||
update_player();
|
update_player();
|
||||||
@ -238,5 +239,5 @@ void func_8003646C(void) {
|
|||||||
set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, gMapTransitionAlpha);
|
set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, gMapTransitionAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_80036640(void) {
|
void state_drawUI_game_over(void) {
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "hud_element.h"
|
#include "hud_element.h"
|
||||||
#include "battle/battle.h"
|
#include "battle/battle.h"
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
extern StageListRow* gCurrentStagePtr;
|
extern StageListRow* gCurrentStagePtr;
|
||||||
|
|
||||||
@ -2144,7 +2145,7 @@ void btl_state_update_end_battle(void) {
|
|||||||
gGameStatusPtr->areaID = areaID;
|
gGameStatusPtr->areaID = areaID;
|
||||||
gGameStatusPtr->mapID = mapID;
|
gGameStatusPtr->mapID = mapID;
|
||||||
gGameStatusPtr->entryID = gv_01_ENTRY_0;
|
gGameStatusPtr->entryID = gv_01_ENTRY_0;
|
||||||
set_game_mode(GAME_MODE_ENTER_WORLD);
|
set_game_mode(GAME_MODE_GAME_OVER);
|
||||||
} else {
|
} else {
|
||||||
btl_set_state(BATTLE_STATE_0);
|
btl_set_state(BATTLE_STATE_0);
|
||||||
gLastDrawBattleState = gBattleState;
|
gLastDrawBattleState = gBattleState;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
|
#include "game_modes.h"
|
||||||
#include "pause/pause_common.h"
|
#include "pause/pause_common.h"
|
||||||
#include "world/partners.h"
|
#include "world/partners.h"
|
||||||
#include "world/partner/lakilester.h"
|
#include "world/partner/lakilester.h"
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "battle_tables.h"
|
#include "battle_tables.h"
|
||||||
#include "hud_element.h"
|
#include "hud_element.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
SHIFT_BSS s32 D_800DC060;
|
SHIFT_BSS s32 D_800DC060;
|
||||||
SHIFT_BSS StageListRow* gCurrentStagePtr;
|
SHIFT_BSS StageListRow* gCurrentStagePtr;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "ui/no_controller.png.h"
|
#include "ui/no_controller.png.h"
|
||||||
#include "ld_addrs.h"
|
#include "ld_addrs.h"
|
||||||
#include "nu/nusys.h"
|
#include "nu/nusys.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
#include "theater/walls.png.inc.c"
|
#include "theater/walls.png.inc.c"
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
// args: start, end, duration, EasingType
|
// args: start, end, duration, EasingType
|
||||||
ApiStatus MakeLerp(Evt* script, s32 isInitialCall) {
|
ApiStatus MakeLerp(Evt* script, s32 isInitialCall) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
#include "evt.h"
|
#include "evt.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
extern LavaReset* gLavaResetList;
|
extern LavaReset* gLavaResetList;
|
||||||
extern s32 LastSafeFloor;
|
extern s32 LastSafeFloor;
|
||||||
@ -721,7 +722,7 @@ void goto_map(Evt* script, s32 mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_map_transition_effect(mapTransitionEffect);
|
set_map_transition_effect(mapTransitionEffect);
|
||||||
set_game_mode(GAME_MODE_UNUSED);
|
set_game_mode(GAME_MODE_CHANGE_MAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiStatus GotoMap(Evt* script, s32 isInitialCall) {
|
ApiStatus GotoMap(Evt* script, s32 isInitialCall) {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "hud_element.h"
|
#include "hud_element.h"
|
||||||
#include "fio.h"
|
#include "fio.h"
|
||||||
#include "ld_addrs.h"
|
#include "ld_addrs.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
extern HudScript HES_AnimatedCursorHand;
|
extern HudScript HES_AnimatedCursorHand;
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "hud_element.h"
|
#include "hud_element.h"
|
||||||
#include "audio/public.h"
|
#include "audio/public.h"
|
||||||
#include "fio.h"
|
#include "fio.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
extern HudScript HES_Spirit1;
|
extern HudScript HES_Spirit1;
|
||||||
extern HudScript HES_Spirit2;
|
extern HudScript HES_Spirit2;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "message_ids.h"
|
#include "message_ids.h"
|
||||||
#include "hud_element.h"
|
#include "hud_element.h"
|
||||||
#include "ld_addrs.h"
|
#include "ld_addrs.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
extern HudScript HES_Spirit1;
|
extern HudScript HES_Spirit1;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "filemenu.h"
|
#include "filemenu.h"
|
||||||
#include "fio.h"
|
#include "fio.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
#if VERSION_IQUE
|
#if VERSION_IQUE
|
||||||
#define DELETE_FILE_DELETE_X 20
|
#define DELETE_FILE_DELETE_X 20
|
||||||
|
286
src/game_modes.c
286
src/game_modes.c
@ -1,6 +1,4 @@
|
|||||||
#include "common.h"
|
#include "game_modes.h"
|
||||||
|
|
||||||
// TODO: decide whether to call these 'game modes' or 'states'
|
|
||||||
|
|
||||||
s32 D_80077420[] = {
|
s32 D_80077420[] = {
|
||||||
0x000000E4, 0x000000E1, 0x000000EB, 0x000000EF, 0x000000F6, 0x0000010A, 0x0000010C, 0x00000121, 0x00000122,
|
0x000000E4, 0x000000E1, 0x000000EB, 0x000000EF, 0x000000F6, 0x0000010A, 0x0000010C, 0x00000121, 0x00000122,
|
||||||
@ -25,82 +23,246 @@ s32 D_80077420[] = {
|
|||||||
0x000000D4, 0x000000D5, 0x000000D6, 0x000000D7, 0x000000D8, 0x000000D9, 0x000000DA,
|
0x000000D4, 0x000000D5, 0x000000D6, 0x000000D7, 0x000000D8, 0x000000D9, 0x000000DA,
|
||||||
};
|
};
|
||||||
|
|
||||||
// These StateFunc[] should really be GameMode but they seem to sometimes only take up 0x14 bytes of data rather than 0x18 like they should if they were really a struct.
|
// These GameModeIncomplete are used as the struct GameMode. As GameModeIncomplete is 0x14 long and GameMode is 0x18 long, the last element
|
||||||
|
// and first element of the next struct are shared in data.
|
||||||
|
|
||||||
StateFunc gameModeBlueprints[] = { NULL, state_init_startup, state_step_startup, NULL, state_drawUI_startup };
|
typedef struct GameModeIncomplete {
|
||||||
|
/* 0x00 */ u16 flags;
|
||||||
|
/* 0x04 */ void (*init)(void);
|
||||||
|
/* 0x08 */ void (*step)(void);
|
||||||
|
/* 0x0C */ UNK_FUN_PTR(unusedFunc);
|
||||||
|
/* 0x10 */ void (*render)(void);
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
/* 0x14 */ void (*renderAux)(void); ///< @see state_render_frontUI
|
||||||
|
#endif
|
||||||
|
} GameModeIncomplete; // size = 0x14
|
||||||
|
|
||||||
StateFunc D_800776FC[] = { NULL, state_init_logos, state_step_logos, NULL, state_drawUI_logos };
|
GameModeIncomplete GameModeStartup = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
StateFunc D_80077710[] = { NULL, state_init_title_screen, state_step_title_screen, NULL, state_drawUI_title_screen };
|
state_init_startup,
|
||||||
|
state_step_startup,
|
||||||
StateFunc D_80077724[] = { NULL, state_init_enter_demo, state_step_enter_world, NULL, state_drawUI_enter_world };
|
NULL,
|
||||||
|
state_drawUI_startup,
|
||||||
StateFunc D_80077738[] = { NULL, state_init_change_map, state_step_change_map, NULL, state_drawUI_change_map };
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
StateFunc D_8007774C[] = { NULL, func_80036430, func_8003646C, NULL, func_80036640 };
|
#endif
|
||||||
|
|
||||||
StateFunc D_80077760[] = { NULL, state_init_enter_world, state_step_enter_world, NULL, state_drawUI_enter_world };
|
|
||||||
|
|
||||||
StateFunc D_80077774[] = { NULL, state_init_world, state_step_world, NULL, state_drawUI_world };
|
|
||||||
|
|
||||||
StateFunc D_80077788[] = { NULL, state_init_battle, state_step_battle, NULL, state_drawUI_battle };
|
|
||||||
|
|
||||||
StateFunc D_8007779C[] = { NULL, state_init_end_battle, state_step_end_battle, NULL, state_drawUI_end_battle };
|
|
||||||
|
|
||||||
StateFunc D_800777B0[] = { NULL, state_init_pause, state_step_pause, NULL, state_drawUI_pause };
|
|
||||||
|
|
||||||
StateFunc D_800777C4[] = { NULL, state_init_unpause, state_step_unpause, NULL, state_drawUI_unpause };
|
|
||||||
|
|
||||||
StateFunc D_800777D8[] = {
|
|
||||||
NULL, state_init_language_select, state_step_language_select, NULL, state_drawUI_language_select
|
|
||||||
};
|
};
|
||||||
|
|
||||||
StateFunc D_800777EC[] = {
|
GameModeIncomplete GameModeLogos = {
|
||||||
NULL, state_init_exit_language_select, state_step_exit_language_select, NULL, state_drawUI_exit_language_select
|
MODE_FLAG_NONE,
|
||||||
|
state_init_logos,
|
||||||
|
state_step_logos,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_logos,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
StateFunc D_80077800[] = { NULL, state_init_file_select, state_step_file_select, NULL, state_drawUI_file_select };
|
GameModeIncomplete GameModeTitleScreen = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
StateFunc D_80077814[] = {
|
state_init_title_screen,
|
||||||
NULL, state_init_exit_file_select, state_step_exit_file_select, NULL, state_drawUI_exit_file_select
|
state_step_title_screen,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_title_screen,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
StateFunc D_80077828[] = { NULL, state_init_intro, state_step_intro, NULL, state_drawUI_intro };
|
GameModeIncomplete GameModeEnterDemoWorld = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
|
state_init_enter_demo,
|
||||||
|
state_step_enter_world,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_enter_world,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
StateFunc D_8007783C[] = { NULL, state_init_demo, state_step_demo, NULL, state_drawUI_demo };
|
GameModeIncomplete GameModeChangeMap = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
|
state_init_change_map,
|
||||||
|
state_step_change_map,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_change_map,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
GameModeIncomplete GameModeGameOver = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
|
state_init_game_over,
|
||||||
|
state_step_game_over,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_game_over,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
GameModeIncomplete GameModeEnterWorld = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
|
state_init_enter_world,
|
||||||
|
state_step_enter_world,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_enter_world,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
GameModeIncomplete GameModeWorld = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
|
state_init_world,
|
||||||
|
state_step_world,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_world,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
GameModeIncomplete GameModeBattle = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
|
state_init_battle,
|
||||||
|
state_step_battle,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_battle,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
GameModeIncomplete GameModeEndBattle = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
|
state_init_end_battle,
|
||||||
|
state_step_end_battle,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_end_battle,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
GameModeIncomplete GameModePause = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
|
state_init_pause,
|
||||||
|
state_step_pause,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_pause,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
GameModeIncomplete GameModeUnpause = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
|
state_init_unpause,
|
||||||
|
state_step_unpause,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_unpause,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
GameModeIncomplete GameModeLanguageSelect = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
|
state_init_language_select,
|
||||||
|
state_step_language_select,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_language_select,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
GameModeIncomplete GameModeEndLanguageSelect = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
|
state_init_exit_language_select,
|
||||||
|
state_step_exit_language_select,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_exit_language_select,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
GameModeIncomplete GameModeFileSelect = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
|
state_init_file_select,
|
||||||
|
state_step_file_select,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_file_select,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
GameModeIncomplete GameModeEndFileSelect = {
|
||||||
|
0,
|
||||||
|
state_init_exit_file_select,
|
||||||
|
state_step_exit_file_select,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_exit_file_select,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
GameModeIncomplete GameModeIntro = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
|
state_init_intro,
|
||||||
|
state_step_intro,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_intro,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
GameModeIncomplete GameModeDemo = {
|
||||||
|
MODE_FLAG_NONE,
|
||||||
|
state_init_demo,
|
||||||
|
state_step_demo,
|
||||||
|
NULL,
|
||||||
|
state_drawUI_demo,
|
||||||
|
#ifdef AVOID_UB
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
GameMode* gameModeMap[] = {
|
GameMode* gameModeMap[] = {
|
||||||
(GameMode*) gameModeBlueprints,
|
(GameMode*) &GameModeStartup,
|
||||||
(GameMode*) D_800776FC,
|
(GameMode*) &GameModeLogos,
|
||||||
(GameMode*) D_80077710,
|
(GameMode*) &GameModeTitleScreen,
|
||||||
(GameMode*) D_80077724,
|
(GameMode*) &GameModeEnterDemoWorld,
|
||||||
(GameMode*) D_80077774,
|
(GameMode*) &GameModeWorld,
|
||||||
(GameMode*) D_80077738,
|
(GameMode*) &GameModeChangeMap,
|
||||||
(GameMode*) D_8007774C,
|
(GameMode*) &GameModeGameOver,
|
||||||
(GameMode*) D_80077760,
|
(GameMode*) &GameModeEnterWorld,
|
||||||
(GameMode*) D_80077788,
|
(GameMode*) &GameModeBattle,
|
||||||
(GameMode*) D_8007779C,
|
(GameMode*) &GameModeEndBattle,
|
||||||
(GameMode*) D_800777B0,
|
(GameMode*) &GameModePause,
|
||||||
(GameMode*) D_800777C4,
|
(GameMode*) &GameModeUnpause,
|
||||||
(GameMode*) D_800777D8,
|
(GameMode*) &GameModeLanguageSelect,
|
||||||
(GameMode*) D_800777EC,
|
(GameMode*) &GameModeEndLanguageSelect,
|
||||||
(GameMode*) D_80077800,
|
(GameMode*) &GameModeFileSelect,
|
||||||
(GameMode*) D_80077814,
|
(GameMode*) &GameModeEndFileSelect,
|
||||||
(GameMode*) D_80077828,
|
(GameMode*) &GameModeIntro,
|
||||||
(GameMode*) D_8007783C,
|
(GameMode*) &GameModeDemo,
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SHIFT_BSS s16 gameMode;
|
SHIFT_BSS s16 CurGameMode;
|
||||||
|
|
||||||
GameMode* set_game_mode_slot(s32 i, GameMode* mode);
|
|
||||||
|
|
||||||
void set_game_mode(s16 mode) {
|
void set_game_mode(s16 mode) {
|
||||||
gameMode = mode;
|
CurGameMode = mode;
|
||||||
set_game_mode_slot(0, gameModeMap[mode]);
|
set_game_mode_slot(0, gameModeMap[mode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
s16 get_game_mode(void) {
|
s16 get_game_mode(void) {
|
||||||
return gameMode;
|
return CurGameMode;
|
||||||
}
|
}
|
||||||
|
55
src/game_modes.h
Normal file
55
src/game_modes.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#ifndef _GAME_MODES_H_
|
||||||
|
#define _GAME_MODES_H_
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
// These flags are mostly unused. Not enough context to discern their original purpose.
|
||||||
|
enum GameModeFlags {
|
||||||
|
MODE_FLAG_NONE = 0,
|
||||||
|
MODE_FLAG_INITIALIZED = (1 << 0), // Set when the mod is initialized
|
||||||
|
MODE_FLAG_STEP_NOT_DONE = (1 << 1), // Turned off after the first step is done
|
||||||
|
MODE_FLAG_4 = (1 << 2),
|
||||||
|
MODE_FLAG_8 = (1 << 3),
|
||||||
|
MODE_FLAG_10 = (1 << 4),
|
||||||
|
MODE_FLAG_RENDER_AUX_SET = (1 << 5), // Set when the renderAux function is set
|
||||||
|
};
|
||||||
|
|
||||||
|
enum GameModeIDs {
|
||||||
|
GAME_MODE_STARTUP = 0,
|
||||||
|
GAME_MODE_LOGOS = 1,
|
||||||
|
GAME_MODE_TITLE_SCREEN = 2,
|
||||||
|
GAME_MODE_ENTER_DEMO_WORLD = 3,
|
||||||
|
GAME_MODE_WORLD = 4,
|
||||||
|
GAME_MODE_CHANGE_MAP = 5,
|
||||||
|
GAME_MODE_GAME_OVER = 6,
|
||||||
|
GAME_MODE_ENTER_WORLD = 7,
|
||||||
|
GAME_MODE_BATTLE = 8,
|
||||||
|
GAME_MODE_END_BATTLE = 9,
|
||||||
|
GAME_MODE_PAUSE = 10,
|
||||||
|
GAME_MODE_UNPAUSE = 11,
|
||||||
|
GAME_MODE_LANGUAGE_SELECT = 12,
|
||||||
|
GAME_MODE_END_LANGUAGE_SELECT = 13,
|
||||||
|
GAME_MODE_FILE_SELECT = 14,
|
||||||
|
GAME_MODE_END_FILE_SELECT = 15,
|
||||||
|
GAME_MODE_INTRO = 16,
|
||||||
|
GAME_MODE_DEMO = 17,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct GameMode {
|
||||||
|
/* 0x00 */ u16 flags;
|
||||||
|
/* 0x04 */ void (*init)(void);
|
||||||
|
/* 0x08 */ void (*step)(void);
|
||||||
|
/* 0x0C */ UNK_FUN_PTR(unusedFunc);
|
||||||
|
/* 0x10 */ void (*render)(void);
|
||||||
|
/* 0x14 */ void (*renderAux)(void); ///< @see state_render_frontUI
|
||||||
|
} GameMode; // size = 0x18
|
||||||
|
|
||||||
|
void set_game_mode(s16 mode);
|
||||||
|
void clear_game_modes(void);
|
||||||
|
GameMode* set_game_mode_slot(s32 i, GameMode* mode);
|
||||||
|
void game_mode_set_fpDrawAuxUI(s32 i, void (*fn)(void));
|
||||||
|
void step_current_game_mode(void);
|
||||||
|
void state_render_backUI(void);
|
||||||
|
void state_render_frontUI(void);
|
||||||
|
|
||||||
|
#endif
|
@ -1,116 +1,123 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
SHIFT_BSS GameMode gMainGameState[2]; // TODO rename
|
SHIFT_BSS GameMode gMainGameMode[2];
|
||||||
|
|
||||||
void state_delegate_NOP(void) {
|
void mode_default_nop(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_game_modes(void) {
|
void clear_game_modes(void) {
|
||||||
GameMode* gameMode;
|
GameMode* gameMode;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (gameMode = gMainGameState, i = 0; i < ARRAY_COUNT(gMainGameState); i++, gameMode++) {
|
for (gameMode = gMainGameMode, i = 0; i < ARRAY_COUNT(gMainGameMode); i++, gameMode++) {
|
||||||
gameMode->flags = 0;
|
gameMode->flags = MODE_FLAG_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GameMode* set_next_game_mode(GameMode* arg0) {
|
|
||||||
|
// Function is unused.
|
||||||
|
GameMode* set_next_game_mode(GameMode* mode) {
|
||||||
GameMode* gameMode;
|
GameMode* gameMode;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (gameMode = gMainGameState, i = 0; i < ARRAY_COUNT(gMainGameState); i++, gameMode++) {
|
for (gameMode = gMainGameMode, i = 0; i < ARRAY_COUNT(gMainGameMode); i++, gameMode++) {
|
||||||
if (gameMode->flags == 0) {
|
if (gameMode->flags == MODE_FLAG_NONE) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(i < ARRAY_COUNT(gMainGameState));
|
ASSERT(i < ARRAY_COUNT(gMainGameMode));
|
||||||
|
|
||||||
gameMode->flags = 1 | 2;
|
gameMode->flags = MODE_FLAG_INITIALIZED | MODE_FLAG_STEP_NOT_DONE;
|
||||||
gameMode->init = arg0->init;
|
gameMode->init = mode->init;
|
||||||
gameMode->step = arg0->step;
|
gameMode->step = mode->step;
|
||||||
gameMode->render = arg0->render;
|
gameMode->render = mode->render;
|
||||||
gameMode->unk_0C = NULL;
|
gameMode->unusedFunc = NULL;
|
||||||
|
|
||||||
if (gameMode->init == NULL) {
|
if (gameMode->init == NULL) {
|
||||||
gameMode->init = state_delegate_NOP;
|
gameMode->init = mode_default_nop;
|
||||||
}
|
}
|
||||||
if (gameMode->step == NULL) {
|
if (gameMode->step == NULL) {
|
||||||
gameMode->step = state_delegate_NOP;
|
gameMode->step = mode_default_nop;
|
||||||
}
|
}
|
||||||
if (gameMode->unk_0C == NULL) {
|
if (gameMode->unusedFunc == NULL) {
|
||||||
gameMode->unk_0C = state_delegate_NOP;
|
gameMode->unusedFunc = mode_default_nop;
|
||||||
}
|
}
|
||||||
if (gameMode->render == NULL) {
|
if (gameMode->render == NULL) {
|
||||||
gameMode->render = state_delegate_NOP;
|
gameMode->render = mode_default_nop;
|
||||||
}
|
}
|
||||||
|
|
||||||
gameMode->renderAux = state_delegate_NOP;
|
gameMode->renderAux = mode_default_nop;
|
||||||
gameMode->init();
|
gameMode->init();
|
||||||
|
|
||||||
return gameMode;
|
return gameMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameMode* set_game_mode_slot(s32 i, GameMode* mode) {
|
GameMode* set_game_mode_slot(s32 i, GameMode* mode) {
|
||||||
GameMode* gameMode = &gMainGameState[i];
|
GameMode* gameMode = &gMainGameMode[i];
|
||||||
|
|
||||||
ASSERT(i < ARRAY_COUNT(gMainGameState));
|
ASSERT(i < ARRAY_COUNT(gMainGameMode));
|
||||||
|
|
||||||
gameMode->flags = 2 | 1;
|
gameMode->flags = MODE_FLAG_INITIALIZED | MODE_FLAG_STEP_NOT_DONE;
|
||||||
gameMode->init = mode->init;
|
gameMode->init = mode->init;
|
||||||
gameMode->step = mode->step;
|
gameMode->step = mode->step;
|
||||||
gameMode->render = mode->render;
|
gameMode->render = mode->render;
|
||||||
gameMode->unk_0C = NULL;
|
gameMode->unusedFunc = NULL;
|
||||||
if (gameMode->init == NULL) gameMode->init = state_delegate_NOP;
|
if (gameMode->init == NULL) gameMode->init = mode_default_nop;
|
||||||
if (gameMode->step == NULL) gameMode->step = state_delegate_NOP;
|
if (gameMode->step == NULL) gameMode->step = mode_default_nop;
|
||||||
if (gameMode->unk_0C == NULL) gameMode->unk_0C = state_delegate_NOP;
|
if (gameMode->unusedFunc == NULL) gameMode->unusedFunc = mode_default_nop;
|
||||||
if (gameMode->render == NULL) gameMode->render = state_delegate_NOP;
|
if (gameMode->render == NULL) gameMode->render = mode_default_nop;
|
||||||
|
|
||||||
gameMode->renderAux = state_delegate_NOP;
|
gameMode->renderAux = mode_default_nop;
|
||||||
gameMode->init();
|
gameMode->init();
|
||||||
|
|
||||||
return gameMode;
|
return gameMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void game_mode_set_fpDrawAuxUI(s32 i, void (*fn)(void)) {
|
void game_mode_set_fpDrawAuxUI(s32 i, void (*fn)(void)) {
|
||||||
GameMode* gameMode = &gMainGameState[i];
|
GameMode* gameMode = &gMainGameMode[i];
|
||||||
|
|
||||||
ASSERT(i < ARRAY_COUNT(gMainGameState));
|
ASSERT(i < ARRAY_COUNT(gMainGameMode));
|
||||||
|
|
||||||
gameMode->renderAux = fn;
|
gameMode->renderAux = fn;
|
||||||
gameMode->flags |= 0x20;
|
gameMode->flags |= MODE_FLAG_RENDER_AUX_SET;
|
||||||
|
|
||||||
if (fn == NULL) {
|
if (fn == NULL) {
|
||||||
gameMode->renderAux = state_delegate_NOP;
|
gameMode->renderAux = mode_default_nop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_80112DD4(s32 i) {
|
// Unused
|
||||||
gMainGameState[i].flags |= 4;
|
void set_game_mode_flag_4(s32 i) {
|
||||||
|
gMainGameMode[i].flags |= MODE_FLAG_4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_80112DFC(s32 i) {
|
// Unused
|
||||||
gMainGameState[i].flags |= 8;
|
void set_game_mode_flag_8(s32 i) {
|
||||||
|
gMainGameMode[i].flags |= MODE_FLAG_8;
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_80112E24(s32 i) {
|
// Unused
|
||||||
gMainGameState[i].flags &= ~0x1C;
|
void clear_game_mode_unk_flags(s32 i) {
|
||||||
|
gMainGameMode[i].flags &= ~(MODE_FLAG_4 | MODE_FLAG_8 | MODE_FLAG_10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void func_80112E4C(s32 i) {
|
// Unused
|
||||||
gMainGameState[i].flags &= ~0x0C;
|
void set_game_mode_flag_10(s32 i) {
|
||||||
gMainGameState[i].flags |= 0x10;
|
gMainGameMode[i].flags &= ~(MODE_FLAG_4 | MODE_FLAG_8);
|
||||||
|
gMainGameMode[i].flags |= MODE_FLAG_10;
|
||||||
}
|
}
|
||||||
|
|
||||||
void step_current_game_mode(void) {
|
void step_current_game_mode(void) {
|
||||||
GameMode* gameMode = gMainGameState;
|
GameMode* gameMode = gMainGameMode;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_COUNT(gMainGameState); i++, gameMode++) {
|
for (i = 0; i < ARRAY_COUNT(gMainGameMode); i++, gameMode++) {
|
||||||
if (gameMode->flags != 0) {
|
if (gameMode->flags != MODE_FLAG_NONE) {
|
||||||
if (!(gameMode->flags & 4)) {
|
if (!(gameMode->flags & MODE_FLAG_4)) {
|
||||||
if (!(gameMode->flags & 8)) {
|
if (!(gameMode->flags & MODE_FLAG_8)) {
|
||||||
gameMode->flags &= ~2;
|
gameMode->flags &= ~MODE_FLAG_STEP_NOT_DONE;
|
||||||
gameMode->step();
|
gameMode->step();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,15 +125,16 @@ void step_current_game_mode(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unused
|
||||||
void state_do_unk(void) {
|
void state_do_unk(void) {
|
||||||
GameMode* gameMode = gMainGameState;
|
GameMode* gameMode = gMainGameMode;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_COUNT(gMainGameState); i++, gameMode++) {
|
for (i = 0; i < ARRAY_COUNT(gMainGameMode); i++, gameMode++) {
|
||||||
if (gameMode->flags != 0) {
|
if (gameMode->flags != MODE_FLAG_NONE) {
|
||||||
if (!(gameMode->flags & 4)) {
|
if (!(gameMode->flags & MODE_FLAG_4)) {
|
||||||
if (!(gameMode->flags & 0x10)) {
|
if (!(gameMode->flags & MODE_FLAG_10)) {
|
||||||
gameMode->unk_0C();
|
gameMode->unusedFunc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,13 +142,13 @@ void state_do_unk(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void state_render_backUI(void) {
|
void state_render_backUI(void) {
|
||||||
GameMode* gameMode = gMainGameState;
|
GameMode* gameMode = gMainGameMode;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_COUNT(gMainGameState); i++, gameMode++) {
|
for (i = 0; i < ARRAY_COUNT(gMainGameMode); i++, gameMode++) {
|
||||||
if (gameMode->flags != 0) {
|
if (gameMode->flags != MODE_FLAG_NONE) {
|
||||||
if (!(gameMode->flags & 4)) {
|
if (!(gameMode->flags & MODE_FLAG_4)) {
|
||||||
if (!(gameMode->flags & 0x10)) {
|
if (!(gameMode->flags & MODE_FLAG_10)) {
|
||||||
gameMode->render();
|
gameMode->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,14 +157,14 @@ void state_render_backUI(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void state_render_frontUI(void) {
|
void state_render_frontUI(void) {
|
||||||
GameMode* gameMode = gMainGameState;
|
GameMode* gameMode = gMainGameMode;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_COUNT(gMainGameState); i++, gameMode++) {
|
for (i = 0; i < ARRAY_COUNT(gMainGameMode); i++, gameMode++) {
|
||||||
if (gameMode->flags != 0) {
|
if (gameMode->flags != MODE_FLAG_NONE) {
|
||||||
if (!(gameMode->flags & 4)) {
|
if (!(gameMode->flags & MODE_FLAG_4)) {
|
||||||
if (!(gameMode->flags & 2)) {
|
if (!(gameMode->flags & MODE_FLAG_STEP_NOT_DONE)) {
|
||||||
if (gameMode->flags & 0x20) {
|
if (gameMode->flags & MODE_FLAG_RENDER_AUX_SET) {
|
||||||
gameMode->renderAux();
|
gameMode->renderAux();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,12 +173,12 @@ void state_render_frontUI(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// re-initialization needed - evidence of inlining? or just copy/pasting?
|
// re-initialization needed - evidence of inlining? or just copy/pasting?
|
||||||
gameMode = &gMainGameState[0];
|
gameMode = &gMainGameMode[0];
|
||||||
for (i = 0; i < ARRAY_COUNT(gMainGameState); i++, gameMode++) {
|
for (i = 0; i < ARRAY_COUNT(gMainGameMode); i++, gameMode++) {
|
||||||
if (gameMode->flags != 0) {
|
if (gameMode->flags != MODE_FLAG_NONE) {
|
||||||
if (!(gameMode->flags & 4)) {
|
if (!(gameMode->flags & MODE_FLAG_4)) {
|
||||||
if (!(gameMode->flags & 2)) {
|
if (!(gameMode->flags & MODE_FLAG_STEP_NOT_DONE)) {
|
||||||
if (gameMode->flags & 0x10) {
|
if (gameMode->flags & MODE_FLAG_10) {
|
||||||
gameMode->render();
|
gameMode->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "hud_element.h"
|
#include "hud_element.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
#include "overlay.h"
|
#include "overlay.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
SHIFT_BSS s32 gOverrideFlags;
|
SHIFT_BSS s32 gOverrideFlags;
|
||||||
SHIFT_BSS s32 timeFreezeMode;
|
SHIFT_BSS s32 timeFreezeMode;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "message_ids.h"
|
#include "message_ids.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
#include "pause_common.h"
|
#include "pause_common.h"
|
||||||
|
#include "game_modes.h"
|
||||||
#include "sprite/npc/Goombaria.h"
|
#include "sprite/npc/Goombaria.h"
|
||||||
#include "sprite/npc/WorldGoombario.h"
|
#include "sprite/npc/WorldGoombario.h"
|
||||||
#include "sprite/npc/Goompa.h"
|
#include "sprite/npc/Goompa.h"
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
#include "battle/battle.h"
|
#include "battle/battle.h"
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
extern u16 gFrameBuf0[];
|
extern u16 gFrameBuf0[];
|
||||||
extern u16 gFrameBuf1[];
|
extern u16 gFrameBuf1[];
|
||||||
@ -203,7 +204,7 @@ void state_step_end_battle(void) {
|
|||||||
if (D_800A0908 != 0) {
|
if (D_800A0908 != 0) {
|
||||||
set_time_freeze_mode(D_800A0908);
|
set_time_freeze_mode(D_800A0908);
|
||||||
}
|
}
|
||||||
set_game_mode(GAME_MODE_CHANGE_MAP);
|
set_game_mode(GAME_MODE_WORLD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "hud_element.h"
|
#include "hud_element.h"
|
||||||
#include "battle/battle.h"
|
#include "battle/battle.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
typedef struct DemoSceneData {
|
typedef struct DemoSceneData {
|
||||||
/* 0x0 */ s16 sceneType;
|
/* 0x0 */ s16 sceneType;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "hud_element.h"
|
#include "hud_element.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
#if VERSION_JP
|
#if VERSION_JP
|
||||||
// TODO: split the filemenu segment
|
// TODO: split the filemenu segment
|
||||||
@ -369,7 +370,7 @@ void state_step_exit_language_select(void) {
|
|||||||
update_encounters();
|
update_encounters();
|
||||||
update_effects();
|
update_effects();
|
||||||
enable_player_input();
|
enable_player_input();
|
||||||
set_game_mode(GAME_MODE_CHANGE_MAP);
|
set_game_mode(GAME_MODE_WORLD);
|
||||||
set_screen_overlay_params_front(OVERLAY_NONE, -1.0f);
|
set_screen_overlay_params_front(OVERLAY_NONE, -1.0f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -432,7 +433,7 @@ void state_step_exit_file_select(void) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
set_game_mode(GAME_MODE_WORLD);
|
set_game_mode(GAME_MODE_ENTER_WORLD);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "hud_element.h"
|
#include "hud_element.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
SHIFT_BSS s32 D_800A0950;
|
SHIFT_BSS s32 D_800A0950;
|
||||||
SHIFT_BSS s16 D_800A0954;
|
SHIFT_BSS s16 D_800A0954;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "hud_element.h"
|
#include "hud_element.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
#include "nu/nusys.h"
|
#include "nu/nusys.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
void appendGfx_intro_logos(void);
|
void appendGfx_intro_logos(void);
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "hud_element.h"
|
#include "hud_element.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
#if VERSION_JP
|
#if VERSION_JP
|
||||||
// TODO: split this segment
|
// TODO: split this segment
|
||||||
@ -249,7 +250,7 @@ void state_step_unpause(void) {
|
|||||||
update_player();
|
update_player();
|
||||||
update_effects();
|
update_effects();
|
||||||
enable_player_input();
|
enable_player_input();
|
||||||
set_game_mode(GAME_MODE_CHANGE_MAP);
|
set_game_mode(GAME_MODE_WORLD);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "hud_element.h"
|
#include "hud_element.h"
|
||||||
#include "fio.h"
|
#include "fio.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
void state_init_startup(void) {
|
void state_init_startup(void) {
|
||||||
gOverrideFlags |= GLOBAL_OVERRIDES_8;
|
gOverrideFlags |= GLOBAL_OVERRIDES_8;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "nu/nusys.h"
|
#include "nu/nusys.h"
|
||||||
#include "hud_element.h"
|
#include "hud_element.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
#if VERSION_JP
|
#if VERSION_JP
|
||||||
#define TITLE_WIDTH 272
|
#define TITLE_WIDTH 272
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "npc.h"
|
#include "npc.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
void state_world_draw_aux_ui(void);
|
void state_world_draw_aux_ui(void);
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "gv_01.h"
|
#include "gv_01.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
#include "hud_element.h"
|
#include "hud_element.h"
|
||||||
|
#include "game_modes.h"
|
||||||
#include "sprite/player.h"
|
#include "sprite/player.h"
|
||||||
|
|
||||||
#include "world/common/entity/Pipe.inc.c"
|
#include "world/common/entity/Pipe.inc.c"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "kmr_02.h"
|
#include "kmr_02.h"
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
|
#include "game_modes.h"
|
||||||
#include "sprite/player.h"
|
#include "sprite/player.h"
|
||||||
|
|
||||||
extern EvtScript N(EVS_NpcAI_Eldstar_02);
|
extern EvtScript N(EVS_NpcAI_Eldstar_02);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "kmr_24.h"
|
#include "kmr_24.h"
|
||||||
#include "fio.h"
|
#include "fio.h"
|
||||||
|
#include "game_modes.h"
|
||||||
|
|
||||||
API_CALLABLE(N(ExitGame)) {
|
API_CALLABLE(N(ExitGame)) {
|
||||||
s16 progress;
|
s16 progress;
|
||||||
@ -17,7 +18,7 @@ API_CALLABLE(N(ExitGame)) {
|
|||||||
script->functionTemp[1] = progress;
|
script->functionTemp[1] = progress;
|
||||||
return ApiStatus_BLOCK;
|
return ApiStatus_BLOCK;
|
||||||
} else {
|
} else {
|
||||||
set_game_mode(0);
|
set_game_mode(GAME_MODE_STARTUP);
|
||||||
return ApiStatus_DONE2;
|
return ApiStatus_DONE2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ dlabel D_800A08E8
|
|||||||
dlabel D_800A08EC
|
dlabel D_800A08EC
|
||||||
.space 4
|
.space 4
|
||||||
|
|
||||||
dlabel gameMode
|
dlabel CurGameMode
|
||||||
.space 4
|
.space 4
|
||||||
|
|
||||||
dlabel D_800A08F4
|
dlabel D_800A08F4
|
||||||
|
@ -168,7 +168,7 @@ dlabel bEntityBlueprint
|
|||||||
dlabel D_801516FC
|
dlabel D_801516FC
|
||||||
.space 4
|
.space 4
|
||||||
|
|
||||||
dlabel gMainGameState
|
dlabel gMainGameMode
|
||||||
.space 0x00000040
|
.space 0x00000040
|
||||||
|
|
||||||
dlabel gCurrentTextureHeader
|
dlabel gCurrentTextureHeader
|
||||||
|
@ -223,7 +223,7 @@ dlabel D_800A08E8
|
|||||||
dlabel D_800A08EC
|
dlabel D_800A08EC
|
||||||
.space 4
|
.space 4
|
||||||
|
|
||||||
dlabel gameMode
|
dlabel CurGameMode
|
||||||
.space 0x00000010
|
.space 0x00000010
|
||||||
|
|
||||||
dlabel D_800A0900
|
dlabel D_800A0900
|
||||||
|
@ -170,7 +170,7 @@ dlabel bEntityBlueprint
|
|||||||
dlabel D_801516FC
|
dlabel D_801516FC
|
||||||
.space 4
|
.space 4
|
||||||
|
|
||||||
dlabel gMainGameState
|
dlabel gMainGameMode
|
||||||
.space 0x00000040
|
.space 0x00000040
|
||||||
|
|
||||||
dlabel gCurrentTextureHeader
|
dlabel gCurrentTextureHeader
|
||||||
|
@ -280,7 +280,7 @@ dlabel D_800A08E8
|
|||||||
dlabel D_800A08EC
|
dlabel D_800A08EC
|
||||||
.space 4
|
.space 4
|
||||||
|
|
||||||
dlabel gameMode
|
dlabel CurGameMode
|
||||||
.space 4
|
.space 4
|
||||||
|
|
||||||
dlabel D_800A08F4
|
dlabel D_800A08F4
|
||||||
|
@ -170,7 +170,7 @@ dlabel bEntityBlueprint
|
|||||||
dlabel D_801516FC
|
dlabel D_801516FC
|
||||||
.space 4
|
.space 4
|
||||||
|
|
||||||
dlabel gMainGameState
|
dlabel gMainGameMode
|
||||||
.space 0x00000040
|
.space 0x00000040
|
||||||
|
|
||||||
dlabel gCurrentTextureHeader
|
dlabel gCurrentTextureHeader
|
||||||
|
@ -220,9 +220,9 @@ state_drawUI_enter_world = 0x800360FC; // type:func rom:0x114FC
|
|||||||
state_init_change_map = 0x80036130; // type:func rom:0x11530
|
state_init_change_map = 0x80036130; // type:func rom:0x11530
|
||||||
state_step_change_map = 0x8003617C; // type:func rom:0x1157C
|
state_step_change_map = 0x8003617C; // type:func rom:0x1157C
|
||||||
state_drawUI_change_map = 0x800363FC; // type:func rom:0x117FC
|
state_drawUI_change_map = 0x800363FC; // type:func rom:0x117FC
|
||||||
func_80036430 = 0x80036430; // type:func rom:0x11830
|
state_init_game_over = 0x80036430; // type:func rom:0x11830
|
||||||
func_8003646C = 0x8003646C; // type:func rom:0x1186C
|
state_step_game_over = 0x8003646C; // type:func rom:0x1186C
|
||||||
func_80036640 = 0x80036640; // type:func rom:0x11A40
|
state_drawUI_game_over = 0x80036640; // type:func rom:0x11A40
|
||||||
state_init_intro = 0x80036650; // type:func rom:0x11A50
|
state_init_intro = 0x80036650; // type:func rom:0x11A50
|
||||||
state_step_intro = 0x80036854; // type:func rom:0x11C54
|
state_step_intro = 0x80036854; // type:func rom:0x11C54
|
||||||
state_drawUI_intro = 0x80036DE0; // type:func rom:0x121E0
|
state_drawUI_intro = 0x80036DE0; // type:func rom:0x121E0
|
||||||
@ -1362,24 +1362,24 @@ beforeFlag = 0x800773FC; // rom:0x527FC
|
|||||||
nuSiCallBackList = 0x80077400; // rom:0x52800
|
nuSiCallBackList = 0x80077400; // rom:0x52800
|
||||||
gCurrentCameraID = 0x80077410; // rom:0x52810
|
gCurrentCameraID = 0x80077410; // rom:0x52810
|
||||||
D_80077420 = 0x80077420; // rom:0x52820
|
D_80077420 = 0x80077420; // rom:0x52820
|
||||||
gameModeBlueprints = 0x800776E8; // rom:0x52AE8
|
GameModeStartup = 0x800776E8; // rom:0x52AE8
|
||||||
D_800776FC = 0x800776FC; // rom:0x52AFC
|
GameModeLogos = 0x800776FC; // rom:0x52AFC
|
||||||
D_80077710 = 0x80077710; // rom:0x52B10
|
GameModeTitleScreen = 0x80077710; // rom:0x52B10
|
||||||
D_80077724 = 0x80077724; // rom:0x52B24
|
GameModeEnterDemoWorld = 0x80077724; // rom:0x52B24
|
||||||
D_80077738 = 0x80077738; // rom:0x52B38
|
GameModeChangeMap = 0x80077738; // rom:0x52B38
|
||||||
D_8007774C = 0x8007774C; // rom:0x52B4C
|
GameModeGameOver = 0x8007774C; // rom:0x52B4C
|
||||||
D_80077760 = 0x80077760; // rom:0x52B60
|
GameModeEnterWorld = 0x80077760; // rom:0x52B60
|
||||||
D_80077774 = 0x80077774; // rom:0x52B74
|
GameModeWorld = 0x80077774; // rom:0x52B74
|
||||||
D_80077788 = 0x80077788; // rom:0x52B88
|
GameModeBattle = 0x80077788; // rom:0x52B88
|
||||||
D_8007779C = 0x8007779C; // rom:0x52B9C
|
GameModeEndBattle = 0x8007779C; // rom:0x52B9C
|
||||||
D_800777B0 = 0x800777B0; // rom:0x52BB0
|
GameModePause = 0x800777B0; // rom:0x52BB0
|
||||||
D_800777C4 = 0x800777C4; // rom:0x52BC4
|
GameModeUnpause = 0x800777C4; // rom:0x52BC4
|
||||||
D_800777D8 = 0x800777D8; // rom:0x52BD8
|
GameModeLanguageSelect = 0x800777D8; // rom:0x52BD8
|
||||||
D_800777EC = 0x800777EC; // rom:0x52BEC
|
GameModeEndLanguageSelect = 0x800777EC; // rom:0x52BEC
|
||||||
D_80077800 = 0x80077800; // rom:0x52C00
|
GameModeFileSelect = 0x80077800; // rom:0x52C00
|
||||||
D_80077814 = 0x80077814; // rom:0x52C14
|
GameModeEndFileSelect = 0x80077814; // rom:0x52C14
|
||||||
D_80077828 = 0x80077828; // rom:0x52C28
|
GameModeIntro = 0x80077828; // rom:0x52C28
|
||||||
D_8007783C = 0x8007783C; // rom:0x52C3C
|
GameModeDemo = 0x8007783C; // rom:0x52C3C
|
||||||
gameModeMap = 0x80077850; // rom:0x52C50
|
gameModeMap = 0x80077850; // rom:0x52C50
|
||||||
bFrameBuffers = 0x800778A0; // rom:0x52CA0
|
bFrameBuffers = 0x800778A0; // rom:0x52CA0
|
||||||
D_800778AC = 0x800778AC; // rom:0x52CAC
|
D_800778AC = 0x800778AC; // rom:0x52CAC
|
||||||
@ -3947,15 +3947,15 @@ set_standard_shadow_scale = 0x8011285C; // type:func rom:0xA8F5C
|
|||||||
set_npc_shadow_scale = 0x80112900; // type:func rom:0xA9000
|
set_npc_shadow_scale = 0x80112900; // type:func rom:0xA9000
|
||||||
set_peach_shadow_scale = 0x801129D4; // type:func rom:0xA90D4
|
set_peach_shadow_scale = 0x801129D4; // type:func rom:0xA90D4
|
||||||
is_block_on_ground = 0x80112B20; // type:func rom:0xA9220
|
is_block_on_ground = 0x80112B20; // type:func rom:0xA9220
|
||||||
state_delegate_NOP = 0x80112B90; // type:func rom:0xA9290
|
mode_default_nop = 0x80112B90; // type:func rom:0xA9290
|
||||||
clear_game_modes = 0x80112B98; // type:func rom:0xA9298
|
clear_game_modes = 0x80112B98; // type:func rom:0xA9298
|
||||||
set_next_game_mode = 0x80112BBC; // type:func rom:0xA92BC
|
set_next_game_mode = 0x80112BBC; // type:func rom:0xA92BC
|
||||||
set_game_mode_slot = 0x80112CA8; // type:func rom:0xA93A8
|
set_game_mode_slot = 0x80112CA8; // type:func rom:0xA93A8
|
||||||
game_mode_set_fpDrawAuxUI = 0x80112D84; // type:func rom:0xA9484
|
game_mode_set_fpDrawAuxUI = 0x80112D84; // type:func rom:0xA9484
|
||||||
func_80112DD4 = 0x80112DD4; // type:func rom:0xA94D4
|
set_game_mode_flag_3 = 0x80112DD4; // type:func rom:0xA94D4
|
||||||
func_80112DFC = 0x80112DFC; // type:func rom:0xA94FC
|
set_game_mode_flag_4 = 0x80112DFC; // type:func rom:0xA94FC
|
||||||
func_80112E24 = 0x80112E24; // type:func rom:0xA9524
|
clear_game_mode_unk_flags = 0x80112E24; // type:func rom:0xA9524
|
||||||
func_80112E4C = 0x80112E4C; // type:func rom:0xA954C
|
set_game_mode_flag_5 = 0x80112E4C; // type:func rom:0xA954C
|
||||||
step_current_game_mode = 0x80112E78; // type:func rom:0xA9578
|
step_current_game_mode = 0x80112E78; // type:func rom:0xA9578
|
||||||
state_do_unk = 0x80112EEC; // type:func rom:0xA95EC
|
state_do_unk = 0x80112EEC; // type:func rom:0xA95EC
|
||||||
state_render_backUI = 0x80112F58; // type:func rom:0xA9658
|
state_render_backUI = 0x80112F58; // type:func rom:0xA9658
|
||||||
@ -4819,7 +4819,7 @@ wEntityBlueprint = 0x80151668; // rom:0xE7D68
|
|||||||
start_script = 0x802C33E0; // type:func rom:0xE7D90
|
start_script = 0x802C33E0; // type:func rom:0xE7D90
|
||||||
bEntityBlueprint = 0x801516E8; // rom:0xE7DE8
|
bEntityBlueprint = 0x801516E8; // rom:0xE7DE8
|
||||||
D_801516FC = 0x801516FC; // rom:0xE7DFC
|
D_801516FC = 0x801516FC; // rom:0xE7DFC
|
||||||
gMainGameState = 0x80151700; // rom:0xE7E00
|
gMainGameMode = 0x80151700; // rom:0xE7E00
|
||||||
gCurrentTileDescriptor = 0x80151740; // rom:0xE7E40
|
gCurrentTileDescriptor = 0x80151740; // rom:0xE7E40
|
||||||
wModelList = 0x80151770; // rom:0xE7E70
|
wModelList = 0x80151770; // rom:0xE7E70
|
||||||
start_script_in_group = 0x802C35D0; // type:func rom:0xE7F80
|
start_script_in_group = 0x802C35D0; // type:func rom:0xE7F80
|
||||||
|
Loading…
Reference in New Issue
Block a user