Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
state_intro.c
Go to the documentation of this file.
1#include "common.h"
2#include "hud_element.h"
3#include "sprite.h"
4#include "game_modes.h"
5#include "dx/config.h"
6
8 INTRO_INIT = 0x00000000,
10 INTRO_LOAD_MAP = 0x00000002,
11 INTRO_AWAIT_MAIN = 0x00000003,
12 INTRO_FADE_IN = 0x00000004,
13 INTRO_ENABLE_DRAW_FRAME = 0x00000015, // unused
14};
15
24BSS s32 D_800A0964; // related to skipping the intro
25
26void state_init_intro(void) {
28
31
32 switch (gGameStatusPtr->introPart) {
33 case INTRO_PART_0:
35
40 IntroFadeColorR = 208;
41 IntroFadeColorG = 208;
42 IntroFadeColorB = 208;
43 D_800A0964 = 0;
44
45 // hos_05 (Star Sanctuary)
47 gGameStatusPtr->mapID = 5; //TODO hard-coded map ID
49 break;
50 case INTRO_PART_1:
52
60 D_800A0964 = 0;
61
62 // hos_04 (Outside the Sanctuary)
64 gGameStatusPtr->mapID = 4; //TODO hard-coded map ID
66 break;
67 default:
70
72
75
77 if (IntroMessageIdx >= 4) {
78 // both hos_04 and hos_05 have an IntroMessage array of length 4
80 }
81
82 D_800A0964 = 3;
83 break;
84 }
85
88
90}
91
92void state_step_intro(void) {
93 PlayerData* playerData = &gPlayerData;
94 u32 pressedButtons = gGameStatusPtr->pressedButtons[0];
95 s32 i;
96
97 #if DX_SKIP_STORY
98 // immediately quit out of the state when skipping story
99 pressedButtons = BUTTON_START;
100 #endif
101
103 if (D_800A0964 == 0 && pressedButtons & (BUTTON_A | BUTTON_B | BUTTON_START | BUTTON_Z)) {
104 D_800A0964 = 1;
105 }
106
110 {
113 return;
114 }
115
119 {
122 return;
123 }
124 }
125
126 switch (gGameStatusPtr->startupState) {
127 case INTRO_INIT:
135 }
136 } else {
138 if (IntroOverlayAlpha >= 255) {
139 IntroOverlayAlpha = 255;
142 }
143 }
144 break;
148 // this condition is always true, likely leftover from an earlier version
151 }
152 break;
153 case INTRO_ENABLE_DRAW_FRAME: // unused
155 if (IntroEnableDrawFrameDelay <= 0) {
156 gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME;
158 }
159 break;
160 case INTRO_LOAD_MAP:
166
182 clear_entity_data(FALSE);
185 clear_npcs();
194 return;
195 }
196
197 playerData->curHP = 10;
198 playerData->curMaxHP = 10;
199 playerData->hardMaxHP = 10;
200 playerData->curFP = 5;
201 playerData->curMaxFP = 5;
202 playerData->hardMaxFP = 5;
203 playerData->maxBP = 2;
204 playerData->bootsLevel = 0;
205 playerData->hammerLevel = -1;
206 playerData->level = 0;
207
208 for (i = 0; i < ARRAY_COUNT(playerData->partners); i++) {
209 playerData->partners[i].enabled = FALSE;
210 }
211
212 playerData->curPartner = PARTNER_NONE;
216 break;
217 case INTRO_AWAIT_MAIN:
220 }
222 gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME;
223 gCameras[CAM_DEFAULT].flags &= ~CAMERA_FLAG_DISABLED;
224 gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_RENDER_WORLD;
227 update_npcs();
233 break;
234 }
235 return;
236 case INTRO_FADE_IN:
239 update_npcs();
240 if (IntroOverlayAlpha == 0) {
243 } else {
245 if (IntroOverlayAlpha < 0) {
247 }
248 }
249 break;
250 }
251
255}
256
258}
b8 keepUsingPartnerOnMapChange
u32 pressedButtons[4]
PartnerData partners[12]
@ OVERLAY_NONE
Definition enums.h:2387
@ OVERLAY_SCREEN_COLOR
Definition enums.h:2388
@ OVERLAY_VIEWPORT_COLOR
Definition enums.h:2389
@ OVERLAY_INTRO_2
Definition enums.h:2403
@ OVERLAY_INTRO_1
Definition enums.h:2402
@ DEBUG_SCRIPTS_NONE
Definition enums.h:4275
@ BUTTON_A
Definition enums.h:2790
@ BUTTON_START
Definition enums.h:2787
@ BUTTON_B
Definition enums.h:2789
@ BUTTON_Z
Definition enums.h:2788
@ SCREEN_LAYER_BACK
Definition enums.h:2383
@ LOAD_FROM_MAP
Definition enums.h:3560
@ INTRO_PART_NONE
Definition enums.h:3556
@ INTRO_PART_0
Definition enums.h:3552
@ INTRO_PART_100
Definition enums.h:3555
@ INTRO_PART_1
Definition enums.h:3553
@ AREA_HOS
Definition enums.h:2965
@ CONTEXT_WORLD
Definition enums.h:3529
@ PARTNER_NONE
Definition enums.h:2885
@ PLAYER_SPRITES_MARIO_WORLD
Definition enums.h:6346
@ GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME
Definition enums.h:4322
@ CAM_DEFAULT
Definition enums.h:1800
void clear_script_list(void)
void clear_item_entity_data(void)
void create_cameras(void)
Definition cam_main.c:255
void set_screen_overlay_params_back(u8, f32)
void clear_animator_list(void)
Definition animator.c:222
void clear_saved_variables(void)
Definition vars_access.c:5
void clear_screen_overlays(void)
void clear_render_tasks(void)
Definition model.c:4536
void clear_model_data(void)
Definition model.c:2364
void startup_set_fade_screen_alpha(s16 alpha)
void set_curtain_draw_callback(void(*callback)(void))
void clear_trigger_data(void)
Definition trigger.c:13
void clear_sprite_shading_data(void)
void clear_entity_data(b32)
Definition entity.c:787
s32 disable_player_input(void)
Definition 77480.c:990
void update_effects(void)
Definition effects.c:56
void set_screen_overlay_params_front(u8, f32)
void startup_fade_screen_update(void)
void clear_printers(void)
Definition msg.c:196
void set_curtain_fade_goal(f32 fade)
Definition curtains.c:298
void initialize_collision(void)
Definition collision.c:111
void reset_battle_status(void)
Definition battle.c:99
void update_cameras(void)
Definition cam_main.c:19
void clear_player_status(void)
Definition 77480.c:807
void clear_effect_data(void)
Definition effects.c:37
HeapNode * general_heap_create(void)
Definition heap.c:6
void clear_worker_list(void)
Definition worker.c:10
void load_map_by_IDs(s16 areaID, s16 mapID, s16 loadType)
Definition world.c:53
void set_screen_overlay_color(s32, u8, u8, u8)
void startup_set_fade_screen_color(s16 color)
void clear_player_data(void)
Definition inventory.c:49
b32 startup_fade_screen_out(s16 addAlpha)
s32 does_script_exist(s32 id)
void update_player(void)
Definition 77480.c:625
void clear_entity_models(void)
void reset_background_settings(void)
Definition background.c:33
void set_curtain_scale_goal(f32 scale)
Definition curtains.c:285
void set_game_mode(s32 modeID)
Definition game_modes.c:127
@ GAME_MODE_TITLE_SCREEN
Definition game_modes.h:9
void hud_element_clear_cache(void)
void update_encounters(void)
Definition npc.c:2270
void clear_npcs(void)
Definition npc.c:60
void update_npcs(void)
Updates all NPCs.
Definition npc.c:617
void init_encounter_status(void)
Definition npc.c:2191
#define BSS
Definition macros.h:7
#define ARRAY_COUNT(arr)
Definition macros.h:40
void spr_init_sprites(s32 playerSpriteSet)
Definition sprite.c:764
BSS s16 IntroFadeColorB
Definition state_intro.c:22
BSS s32 IntroEnableDrawFrameDelay
Definition state_intro.c:16
BSS s16 IntroOverlayDelta
Definition state_intro.c:19
BSS s16 IntroFadeColorG
Definition state_intro.c:21
BSS s16 IntroOverlayAlpha
Definition state_intro.c:17
void state_init_intro(void)
Definition state_intro.c:26
BSS s16 IntroFadeColorR
Definition state_intro.c:20
void state_step_intro(void)
Definition state_intro.c:92
BSS s32 IntroOverlayType
Definition state_intro.c:23
IntroStates
Definition state_intro.c:7
@ INTRO_ENABLE_DRAW_FRAME
Definition state_intro.c:13
@ INTRO_INIT
Definition state_intro.c:8
@ INTRO_DISABLE_DRAW_FRAME
Definition state_intro.c:9
@ INTRO_AWAIT_MAIN
Definition state_intro.c:11
@ INTRO_LOAD_MAP
Definition state_intro.c:10
@ INTRO_FADE_IN
Definition state_intro.c:12
BSS s32 D_800A0964
Definition state_intro.c:24
BSS s16 IntroFrontFadeAlpha
Definition state_intro.c:18
void state_drawUI_intro(void)
u8 IntroMessageIdx
s32 gOverrideFlags
Definition main_loop.c:11
GameStatus * gGameStatusPtr
Definition main_loop.c:32
Camera gCameras[4]
Definition cam_main.c:17
PlayerData gPlayerData
Definition 77480.c:40