Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
state_logos.c
Go to the documentation of this file.
1#include "common.h"
2#include "ld_addrs.h"
3#include "hud_element.h"
4#include "sprite.h"
5#include "nu/nusys.h"
6#include "fio.h"
7#include "game_modes.h"
8#include "dx/versioning.h"
9
10void appendGfx_intro_logos(void);
11
12#if VERSION_JP
13#define LOGO_1_Y 54
14#define LOGO_2_Y 104
15#define N64_FADE_IN_TIME 30
16#else
17#define LOGO_1_Y 89
18#define LOGO_2_Y 59
19#define N64_FADE_IN_TIME 40
20#endif
21
36
37s32 D_800778C0[] = { 0, 0 };
38
39Gfx D_800778C8[] = {
40 gsDPPipeSync(),
41 gsDPSetCycleType(G_CYC_COPY),
42 gsDPSetTexturePersp(G_TP_NONE),
43 gsDPSetTextureLUT(G_TT_NONE),
44 gsDPSetCombineMode(G_CC_DECALRGB, G_CC_DECALRGB),
45 gsDPSetRenderMode(G_RM_NOOP, G_RM_NOOP2),
46 gsDPSetTextureFilter(G_TF_POINT),
47 gsSPEndDisplayList(),
48};
49
50Gfx D_80077908[] = {
51 gsDPPipeSync(),
52 gsDPSetCycleType(G_CYC_1CYCLE),
53 gsDPSetTexturePersp(G_TP_NONE),
54 gsDPSetTextureLUT(G_TT_NONE),
55 gsDPSetCombineMode(G_CC_DECALRGB, G_CC_DECALRGB),
56 gsDPSetRenderMode(G_RM_OPA_SURF, G_RM_OPA_SURF2),
57 gsDPSetTextureFilter(G_TF_POINT),
58 gsSPEndDisplayList(),
59};
60
65
66void state_init_logos(void) {
67 s8* romStart;
68 s8* romEnd;
69
76
77 romEnd = logos_ROM_END;
78 romStart = logos_ROM_START;
79 gLogosImages = heap_malloc(romEnd - romStart);
80 dma_copy(romStart, romEnd, gLogosImages);
81
83 gLogosImage3 = gLogosImages + 0x7000;
84 gLogosImage2 = gLogosImages + 0x15000;
85
86 nuContRmbForceStop();
92 gCameras[CAM_DEFAULT].vfov = 25.0f;
93 set_cam_viewport(CAM_DEFAULT, 12, 28, 296, 184);
94
95 gCameras[CAM_DEFAULT].params.basic.skipRecalc = FALSE;
96 gCameras[CAM_DEFAULT].params.basic.pitch = 0;
97 gCameras[CAM_DEFAULT].params.basic.dist = 40;
98 gCameras[CAM_DEFAULT].params.basic.fovScale = 100;
99
101 gCameras[CAM_DEFAULT].lookAt_eye.y = 1000.0f;
102 gCameras[CAM_DEFAULT].lookAt_eye.z = 1500.0f;
103
107
111
113
118
125 clear_npcs();
128 clear_entity_data(TRUE);
133}
134
136 int pressedButtons = gGameStatusPtr->pressedButtons[0];
138 if (startup_fade_screen_out(10)) {
139 set_curtain_scale(1.0f);
140 set_curtain_fade(0.0f);
142 }
143 } else {
154 && (pressedButtons & (BUTTON_START | BUTTON_Z | BUTTON_A))
155 ) {
158 }
159
160 switch (gGameStatusPtr->startupState) {
162 if (startup_fade_screen_in(10)) {
165 }
166 break;
168 if (gGameStatusPtr->logoTime == 0) {
171 }
173 break;
175 if (startup_fade_screen_out(10)) {
177#if VERSION_JP
179#endif
180 }
181 break;
183 if (startup_fade_screen_in(10)) {
186 }
187 break;
189 if (gGameStatusPtr->logoTime == 0) {
191#if VERSION_JP
193#else
195#endif
196 }
198 break;
200 if (startup_fade_screen_out(10)) {
202 }
203 break;
205 if (startup_fade_screen_in(10)) {
208 }
209 break;
211 if (gGameStatusPtr->logoTime == 0) {
215 }
217 break;
219 if (gGameStatusPtr->logoTime == 0) {
224 } else {
226 }
227 break;
229 if (startup_fade_screen_out(10)) {
232 }
233 break;
235 if (gGameStatusPtr->logoTime == 0) {
237 } else {
239 }
240 break;
243 gLogosImages = NULL;
247 break;
248 }
249 }
250 update_npcs();
253}
254
258
260 s32 i;
261
262 gDPPipeSync(gMainGfxPos++);
263 gDPSetRenderMode(gMainGfxPos++, G_RM_NOOP, G_RM_NOOP2);
264 gDPSetCombineMode(gMainGfxPos++, G_CC_DECALRGB, G_CC_DECALRGB);
265 gDPSetCycleType(gMainGfxPos++, G_CYC_FILL);
266 gDPSetFillColor(gMainGfxPos++, PACK_FILL_COLOR(224, 224, 224, 1));
267 gDPFillRectangle(gMainGfxPos++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
268 gDPPipeSync(gMainGfxPos++);
269
270 switch (gGameStatusPtr->startupState) {
274 gSPDisplayList(gMainGfxPos++, D_80077908);
275 for (i = 0; i < 7; i++) {
276 gDPLoadTextureTile(gMainGfxPos++, gLogosImage1 + i * 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 128, 112,
277 0, 0, 127, 15, 0,
278 G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
279 gSPTextureRectangle(gMainGfxPos++, 96 * 4, (64 + i * 16) * 4, 224 * 4, (80 + i * 16) * 4, G_TX_RENDERTILE, 0, 0, 1024, 1024);
280 gDPPipeSync(gMainGfxPos++);
281 }
282 break;
286#if VERSION_JP
287 break;
292#endif
293 gSPDisplayList(gMainGfxPos++, D_80077908);
294 for (i = 0; i < 6; i++) {
295 gDPLoadTextureTile(gMainGfxPos++, gLogosImage2 + i * 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 256, 48,
296 0, 0, 255, 7, 0,
297 G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
298 gSPTextureRectangle(
299 gMainGfxPos++,
300 32 * 4, (LOGO_1_Y + i * 8) * 4,
301 288 * 4, (LOGO_1_Y + 8 + i * 8) * 4,
302 G_TX_RENDERTILE, 0, 0, 1024, 1024);
303 gDPPipeSync(gMainGfxPos++);
304 }
305#if !VERSION_JP
306 break;
311 gSPDisplayList(gMainGfxPos++, D_80077908);
312#endif
313 for (i = 0; i < 14; i++) {
314 gDPLoadTextureTile(gMainGfxPos++, gLogosImage3 + i * 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 256, 112,
315 0, 0, 255, 7, 0,
316 G_TX_WRAP, G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
317 gSPTextureRectangle(gMainGfxPos++,
318 32 * 4, (LOGO_2_Y + i * 8) * 4,
319 288 * 4, (LOGO_2_Y + 8 + i * 8) * 4,
320 G_TX_RENDERTILE, 0, 0, 1024, 1024);
321 gDPPipeSync(gMainGfxPos++);
322 }
323 break;
324 }
325}
u32 pressedButtons[4]
@ BUTTON_A
Definition enums.h:2790
@ BUTTON_START
Definition enums.h:2787
@ BUTTON_Z
Definition enums.h:2788
@ CAMERA_FLAG_DISABLED
Definition enums.h:4721
@ CAM_UPDATE_NO_INTERP
Definition enums.h:4761
@ INTRO_PART_0
Definition enums.h:3552
@ PLAYER_SPRITES_MARIO_WORLD
Definition enums.h:6346
@ GLOBAL_OVERRIDES_DISABLE_RENDER_WORLD
Definition enums.h:4321
@ CAM_TATTLE
Definition enums.h:1802
@ CAM_DEFAULT
Definition enums.h:1800
@ CAM_HUD
Definition enums.h:1803
@ CAM_BATTLE
Definition enums.h:1801
void clear_script_list(void)
void create_cameras(void)
Definition cam_main.c:255
void clear_animator_list(void)
Definition animator.c:222
void clear_render_tasks(void)
Definition model.c:4536
void startup_set_fade_screen_alpha(s16 alpha)
void set_curtain_fade(f32 fade)
Definition curtains.c:302
void set_curtain_draw_callback(void(*callback)(void))
b32 startup_fade_screen_in(s16 subtractAlpha)
void clear_entity_data(b32)
Definition entity.c:787
u32 dma_copy(Addr romStart, Addr romEnd, void *vramDest)
Definition 43F0.c:444
void startup_fade_screen_update(void)
void set_curtain_fade_goal(f32 fade)
Definition curtains.c:298
void update_cameras(void)
Definition cam_main.c:19
void clear_effect_data(void)
Definition effects.c:37
s32 heap_free(void *ptr)
Definition heap.c:42
HeapNode * general_heap_create(void)
Definition heap.c:6
void clear_worker_list(void)
Definition worker.c:10
void set_curtain_scale(f32 scale)
Definition curtains.c:289
void startup_set_fade_screen_color(s16 color)
b32 startup_fade_screen_out(s16 addAlpha)
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 * heap_malloc(s32 size)
Definition heap.c:34
void set_cam_viewport(s16 id, s16 x, s16 y, s16 width, s16 height)
Definition cam_main.c:373
void set_game_mode(s32 modeID)
Definition game_modes.c:127
@ GAME_MODE_TITLE_SCREEN
Definition game_modes.h:9
@ GAME_MODE_INTRO
Definition game_modes.h:21
void hud_element_clear_cache(void)
void clear_npcs(void)
Definition npc.c:60
void update_npcs(void)
Updates all NPCs.
Definition npc.c:617
#define CAM_NEAR_CLIP
Definition macros.h:117
#define SCREEN_WIDTH
Definition macros.h:105
#define BSS
Definition macros.h:7
#define CAM_FAR_CLIP
Definition macros.h:118
#define SCREEN_HEIGHT
Definition macros.h:106
#define PACK_FILL_COLOR(r, g, b, a)
Definition macros.h:163
void spr_init_sprites(s32 playerSpriteSet)
Definition sprite.c:764
BSS u8 * gLogosImages
Definition state_logos.c:61
s32 D_800778C0[]
Definition state_logos.c:37
#define N64_FADE_IN_TIME
Definition state_logos.c:19
void state_step_logos(void)
BSS u8 * gLogosImage2
Definition state_logos.c:64
BSS u8 * gLogosImage1
Definition state_logos.c:63
Gfx D_80077908[]
Definition state_logos.c:50
Gfx D_800778C8[]
Definition state_logos.c:39
#define LOGO_1_Y
Definition state_logos.c:17
BSS u8 * gLogosImage3
Definition state_logos.c:62
void state_init_logos(void)
Definition state_logos.c:66
#define LOGO_2_Y
Definition state_logos.c:18
void appendGfx_intro_logos(void)
LogoStates
Definition state_logos.c:22
@ LOGOS_STATE_NINTENDO_HOLD
Definition state_logos.c:27
@ LOGOS_STATE_NINTENDO_FADE_OUT
Definition state_logos.c:28
@ LOGOS_STATE_IS_FADE_OUT
Definition state_logos.c:32
@ LOGOS_STATE_NINTENDO_FADE_IN
Definition state_logos.c:26
@ LOGOS_STATE_IS_HOLD_1
Definition state_logos.c:30
@ LOGOS_STATE_N64_FADE_IN
Definition state_logos.c:23
@ LOGOS_STATE_CLEANUP
Definition state_logos.c:34
@ LOGOS_STATE_N64_FADE_OUT
Definition state_logos.c:25
@ LOGOS_STATE_N64_HOLD
Definition state_logos.c:24
@ LOGOS_STATE_CURTAINS_APPEAR
Definition state_logos.c:33
@ LOGOS_STATE_IS_HOLD_2
Definition state_logos.c:31
@ LOGOS_STATE_IS_FADE_IN
Definition state_logos.c:29
void state_drawUI_logos(void)
s16 bgColor[3]
Vec3f lookAt_obj_target
union Camera::@17 params
Vec3f lookAt_eye
s32 gOverrideFlags
Definition main_loop.c:11
GameStatus * gGameStatusPtr
Definition main_loop.c:32
Camera gCameras[4]
Definition cam_main.c:17
Gfx * gMainGfxPos
Definition cam_main.c:15
s32 gCurrentCameraID
Definition cam_math.c:4