Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
curtains.c
Go to the documentation of this file.
1#include "common.h"
2#include "theater/walls.png.h"
3#include "theater/curtains.png.h"
4#include "theater/floor.png.h"
5#include "ui/no_controller.png.h"
6#include "ld_addrs.h"
7#include "nu/nusys.h"
8#include "game_modes.h"
9#include "include_asset.h"
10
11INCLUDE_IMG("theater/walls.png", theater_walls_png);
12
13Gfx D_800746E0[] = {
14 gsDPSetTextureLUT(G_TT_NONE),
15 gsSPTexture(-1, -1, 0, G_TX_RENDERTILE, G_ON),
16 gsDPLoadTextureBlock_4b(theater_walls_png, G_IM_FMT_I, 16, 32, 0, G_TX_NOMIRROR | G_TX_WRAP,
17 G_TX_NOMIRROR | G_TX_CLAMP, 4, 5, G_TX_NOLOD, G_TX_NOLOD),
18 gsSPEndDisplayList(),
19};
20
21INCLUDE_IMG("theater/curtains.png", theater_curtains_png);
22
23Gfx D_80075730[] = {
24 gsDPSetTextureLUT(G_TT_NONE),
25 gsSPTexture(-1, -1, 0, G_TX_RENDERTILE, G_ON),
26 gsDPLoadTextureBlock(theater_curtains_png, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, 0, G_TX_MIRROR | G_TX_WRAP,
27 G_TX_NOMIRROR | G_TX_CLAMP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
28 gsSPEndDisplayList(),
29};
30
31INCLUDE_IMG("theater/floor.png", theater_floor_png);
32INCLUDE_PAL("theater/floor.pal", theater_floor_pal);
33
34Gfx D_800758A0[] = {
35 gsDPSetTextureLUT(G_TT_RGBA16),
36 gsDPLoadTLUT_pal16(0, theater_floor_pal),
37 gsSPTexture(-1, -1, 0, G_TX_RENDERTILE, G_ON),
38 gsDPLoadTextureBlock_4b(theater_floor_png, G_IM_FMT_CI, 32, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR |
39 G_TX_WRAP, 5, 4, G_TX_NOLOD, G_TX_NOLOD),
40 gsSPEndDisplayList(),
41};
42
43#include "theater/left_wall_vtx.vtx.inc.c"
44#include "theater/right_wall_vtx.vtx.inc.c"
45#include "theater/floor_vtx.vtx.inc.c"
46#include "theater/left_inset_shadow_vtx.vtx.inc.c"
47#include "theater/right_inset_shadow_vtx.vtx.inc.c"
48#include "theater/curtain_vtx.vtx.inc.c"
49#include "theater/wall_shadows_vtx.vtx.inc.c"
50
52 gsDPPipeSync(),
53 gsDPSetRenderMode(G_RM_PASS, G_RM_CLD_SURF2),
54 gsDPSetCombineMode(G_CC_MODULATEIA, PM_CC2_MULTIPLY_PRIM),
55 gsSPDisplayList(D_80075730),
56 gsSPVertex(theater_wall_shadows_vtx, 8, 0),
57 gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
58 gsSP2Triangles(4, 5, 6, 0, 4, 6, 7, 0),
59 gsSPEndDisplayList(),
60};
61
63 gsDPPipeSync(),
64 gsDPSetRenderMode(G_RM_PASS, G_RM_XLU_SURF2),
65 gsDPSetCombineMode(G_CC_MODULATEIDECALA, PM_CC2_MULTIPLY_PRIM),
66 gsSPDisplayList(D_80075730),
67 gsSPVertex(theater_curtain_vtx, 31, 0),
68 gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
69 gsSP2Triangles(4, 5, 6, 0, 4, 6, 7, 0),
70 gsSP2Triangles(8, 9, 10, 0, 8, 10, 11, 0),
71 gsSP2Triangles(12, 13, 14, 0, 12, 14, 15, 0),
72 gsSP2Triangles(15, 16, 17, 0, 15, 17, 18, 0),
73 gsSP2Triangles(19, 20, 21, 0, 19, 21, 22, 0),
74 gsSP2Triangles(13, 23, 24, 0, 13, 24, 14, 0),
75 gsSP2Triangles(23, 25, 26, 0, 23, 26, 24, 0),
76 gsSP2Triangles(25, 27, 28, 0, 25, 28, 26, 0),
77 gsSP2Triangles(27, 29, 30, 0, 27, 30, 28, 0),
78 gsSPEndDisplayList(),
79};
80
82 gsDPPipeSync(),
83 gsDPSetRenderMode(G_RM_PASS, G_RM_XLU_SURF2),
84 gsDPSetCombineMode(G_CC_SHADE, PM_CC2_MULTIPLY_PRIM),
85 gsSPTexture(0x0080, 0x0080, 0, G_TX_RENDERTILE, G_OFF),
86 gsSPVertex(theater_left_inset_shadow_vtx, 4, 0),
87 gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
88 gsSPVertex(theater_right_inset_shadow_vtx, 4, 0),
89 gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
90 gsSPEndDisplayList(),
91};
92
94 gsDPPipeSync(),
95 gsDPSetRenderMode(CVG_DST_FULL | ZMODE_OPA | FORCE_BL | G_RM_PASS, CVG_DST_FULL | ZMODE_OPA | FORCE_BL |
96 GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1)),
97 gsDPSetCombineMode(G_CC_MODULATEIA, PM_CC2_MULTIPLY_PRIM),
98 gsSPDisplayList(D_800746E0),
99 gsSPVertex(theater_floor_vtx, 25, 0),
100 gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
101 gsSP2Triangles(4, 5, 0, 0, 4, 0, 3, 0),
102 gsSP2Triangles(1, 6, 7, 0, 1, 7, 2, 0),
103 gsSP2Triangles(3, 8, 9, 0, 3, 9, 10, 0),
104 gsSP2Triangles(11, 4, 3, 0, 11, 3, 10, 0),
105 gsSP2Triangles(12, 13, 14, 0, 12, 14, 15, 0),
106 gsSP2Triangles(8, 12, 15, 0, 8, 15, 9, 0),
107 gsSP2Triangles(6, 16, 13, 0, 6, 13, 7, 0),
108 gsSP2Triangles(14, 17, 18, 0, 19, 14, 18, 0),
109 gsSP2Triangles(20, 11, 21, 0, 11, 22, 21, 0),
110 gsSP2Triangles(23, 19, 18, 0, 23, 18, 24, 0),
111 gsSP2Triangles(22, 23, 24, 0, 22, 24, 21, 0),
112 gsSPEndDisplayList(),
113};
114
116 gsDPPipeSync(),
117 gsDPSetRenderMode(CVG_DST_FULL | ZMODE_OPA | FORCE_BL | G_RM_PASS, CVG_DST_FULL | ZMODE_OPA | FORCE_BL |
118 GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1)),
119 gsDPSetCombineMode(G_CC_MODULATEIA, PM_CC2_MULTIPLY_PRIM),
120 gsSPDisplayList(D_800758A0),
121 gsSPVertex(theater_right_wall_vtx, 6, 0),
122 gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
123 gsSP2Triangles(1, 4, 5, 0, 1, 5, 2, 0),
124 gsSPEndDisplayList(),
125};
126
128 gsDPPipeSync(),
129 gsDPSetRenderMode(CVG_DST_FULL | ZMODE_OPA | FORCE_BL | G_RM_PASS, CVG_DST_FULL | ZMODE_OPA | FORCE_BL |
130 GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1)),
131 gsDPSetCombineMode(G_CC_MODULATEIA, PM_CC2_MULTIPLY_PRIM),
132 gsSPDisplayList(D_800758A0),
133 gsSPVertex(theater_left_wall_vtx, 6, 0),
134 gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
135 gsSP2Triangles(1, 4, 5, 0, 1, 5, 2, 0),
136 gsSPEndDisplayList(),
137};
138
140 gsSPDisplayList(TheaterFloorGfx),
141 gsSPDisplayList(TheaterLeftWallGfx),
142 gsSPDisplayList(TheaterRightWallGfx),
143 gsSPDisplayList(TheaterInsetShadowsGfx),
144 gsSPDisplayList(TheaterWallShadowsGfx),
145 gsSPDisplayList(TheaterCurtainGfx),
146 gsSPEndDisplayList(),
147};
148
150 {
151 {(SCREEN_WIDTH/2)*4, (SCREEN_HEIGHT/2)*4, 0x200 - 1, 0},
152 {(SCREEN_WIDTH/2)*4, (SCREEN_HEIGHT/2)*4, 0x200 - 1, 0},
153 }
154};
155
157 gsSPViewport(&TheaterViewport),
158 gsDPSetCycleType(G_CYC_2CYCLE),
159 gsDPSetTextureLOD(G_TL_TILE),
160 gsDPSetTexturePersp(G_TP_PERSP),
161 gsDPSetTextureFilter(G_TF_BILERP),
162 gsDPSetTextureDetail(G_TD_CLAMP),
163 gsDPSetTextureConvert(G_TC_FILT),
164 gsDPSetCombineKey(G_CK_NONE),
165 gsDPSetAlphaCompare(G_AC_NONE),
166 gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, 320, 240),
167 gsDPSetColorDither(G_CD_MAGICSQ),
168 gsDPSetAlphaDither(G_AD_PATTERN),
169 gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN |
170 G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH | G_CLIPPING | 0x0040F9FA),
171 gsSPSetGeometryMode(G_SHADE | G_SHADING_SMOOTH),
172 gsSPPerspNormalize(0x0014),
173 gsSPEndDisplayList(),
174};
175
176INCLUDE_IMG("ui/no_controller.png", ui_no_controller_png);
177
179 gsDPPipeSync(),
180 gsSPTexture(-1, -1, 0, G_TX_RENDERTILE, G_ON),
181 gsDPSetCycleType(G_CYC_1CYCLE),
182 gsDPSetTexturePersp(G_TP_NONE),
183 gsDPSetTextureDetail(G_TD_CLAMP),
184 gsDPSetTextureLOD(G_TL_TILE),
185 gsDPSetTextureFilter(G_TF_POINT),
186 gsDPSetTextureConvert(G_TC_FILT),
187 gsDPSetCombineMode(G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM),
188 gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
189 gsDPSetTextureLUT(G_TT_NONE),
190 gsDPLoadTextureTile(ui_no_controller_png, G_IM_FMT_IA, G_IM_SIZ_8b, ui_no_controller_png_width,
191 ui_no_controller_png_height, 0, 0, ui_no_controller_png_width - 1,
192 ui_no_controller_png_height - 1, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 7,
193 5, G_TX_NOLOD, G_TX_NOLOD),
194 gsSPClearGeometryMode(G_CULL_BOTH | G_LIGHTING),
195 gsSPSetGeometryMode(G_SHADE | G_SHADING_SMOOTH),
196 gsSPEndDisplayList(),
197};
198
200 gsSPTextureRectangle(0x0180, 0x0260, 0x0380, 0x02E0, G_TX_RENDERTILE, 0, 0, 0x0400, 0x0400),
201 gsDPPipeSync(),
202 gsSPEndDisplayList(),
203};
204
209BSS UNK_FUN_PTR(gCurtainDrawCallback);
211
213 gCurtainDrawCallback = NULL;
214 gCurtainScale = 2.0f;
215 gCurtainScaleGoal = 2.0f;
216 gCurtainFade = 0.0f;
217 gCurtainFadeGoal = 0.0f;
218}
219
220void update_curtains(void) {
221}
222
223void render_curtains(void) {
226 }
227
230 }
231
232 if (gCurtainScale < 1.9) {
233 Matrix4f m;
234 f32 scale;
235 s8 rgb;
236
237 gDPPipeSync(gMainGfxPos++);
238 gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, osVirtualToPhysical(nuGfxCfb_ptr));
239 gSPDisplayList(gMainGfxPos++, &TheaterInitGfx);
240
241 guFrustumF(m, -80.0f, 80.0f, -60.0f, 60.0f, 160.0f, 640.0f, 1.0f);
242 guMtxF2L(m, &D_8009BAA8[0]);
243
244 gSPMatrix(gMainGfxPos++, &D_8009BAA8[0], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
245
246 scale = gCurtainScale - 0.01;
247 if (scale < 1.0f) {
248 scale = 1.0f;
249 }
250
251 guPositionF(m, 0.0f, 0.0f, 0.0f, scale * 0.1, 0.0f, 0.0f, -320.0f);
252
253 guMtxF2L(m, &D_8009BAA8[1]);
254
255 gSPMatrix(gMainGfxPos++, &D_8009BAA8[1], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
256 rgb = 255.0f - (gCurtainFade * 255.0f);
257 gDPSetPrimColor(gMainGfxPos++, 0, 0, rgb, rgb, rgb, 255);
258 gSPDisplayList(gMainGfxPos++, &TheaterGfx);
259 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
260 gDPPipeSync(gMainGfxPos++);
261 }
262
263 if (gCurtainDrawCallback != NULL) {
264 gCurtainDrawCallback();
265 }
266
267 if (!(gGameStatusPtr->contBitPattern & 1)) {
271 s32 alpha = ((gGameStatusPtr->frameCounter) % 0x18) << 5;
272
273 if (alpha > 255) {
274 alpha = 255;
275 }
276
277 gSPDisplayList(gMainGfxPos++, &TheaterInitGfx);
278 gSPDisplayList(gMainGfxPos++, &NoControllerSetupTexGfx);
279 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0xFF, 0x20, 0x10, alpha);
280 gSPDisplayList(gMainGfxPos++, &NoControllerGfx);
281 }
282 }
283}
284
285void set_curtain_scale_goal(f32 scale) {
286 gCurtainScaleGoal = scale;
287}
288
289void set_curtain_scale(f32 scale) {
290 gCurtainScaleGoal = scale;
291 gCurtainScale = scale;
292}
293
295 gCurtainDrawCallback = callback;
296}
297
298void set_curtain_fade_goal(f32 fade) {
299 gCurtainFadeGoal = fade;
300}
301
302void set_curtain_fade(f32 fade) {
303 gCurtainFadeGoal = fade;
304 gCurtainFade = fade;
305}
u16 * nuGfxCfb_ptr
Definition cam_main.c:14
f32 Matrix4f[4][4]
Gfx TheaterInsetShadowsGfx[]
Definition curtains.c:81
void initialize_curtains(void)
Definition curtains.c:212
Gfx NoControllerGfx[]
Definition curtains.c:199
void set_curtain_fade(f32 fade)
Definition curtains.c:302
Gfx TheaterWallShadowsGfx[]
Definition curtains.c:51
Gfx TheaterGfx[]
Definition curtains.c:139
Gfx D_80075730[]
Definition curtains.c:23
Gfx NoControllerSetupTexGfx[]
Definition curtains.c:178
Vp TheaterViewport
Definition curtains.c:149
void update_curtains(void)
Definition curtains.c:220
Gfx D_800746E0[]
Definition curtains.c:13
void set_curtain_fade_goal(f32 fade)
Definition curtains.c:298
void set_curtain_draw_callback(UNK_FUN_PTR(callback))
Definition curtains.c:294
Gfx TheaterInitGfx[]
Definition curtains.c:156
BSS f32 gCurtainFadeGoal
Definition curtains.c:208
Gfx D_800758A0[]
Definition curtains.c:34
BSS f32 gCurtainScale
Definition curtains.c:205
Gfx TheaterRightWallGfx[]
Definition curtains.c:115
BSS Mtx D_8009BAA8[2]
Definition curtains.c:210
void set_curtain_scale(f32 scale)
Definition curtains.c:289
Gfx TheaterFloorGfx[]
Definition curtains.c:93
void render_curtains(void)
Definition curtains.c:223
BSS f32 gCurtainScaleGoal
Definition curtains.c:206
BSS f32 gCurtainFade
Definition curtains.c:207
Gfx TheaterLeftWallGfx[]
Definition curtains.c:127
Gfx TheaterCurtainGfx[]
Definition curtains.c:62
void set_curtain_scale_goal(f32 scale)
Definition curtains.c:285
Color_RGB8 rgb
Definition demo_api.c:16
#define guMtxF2L
#define guFrustumF
#define guPositionF
@ DEMO_STATE_NONE
Definition enums.h:3535
s32 get_game_mode(void)
Definition game_modes.c:123
@ GAME_MODE_TITLE_SCREEN
Definition game_modes.h:9
@ GAME_MODE_INTRO
Definition game_modes.h:21
#define INCLUDE_PAL(FILENAME, SYMBOLNAME)
#define INCLUDE_IMG(FILENAME, SYMBOLNAME)
#define SCREEN_WIDTH
Definition macros.h:105
#define BSS
Definition macros.h:7
#define PM_CC2_MULTIPLY_PRIM
Definition macros.h:305
#define SCREEN_HEIGHT
Definition macros.h:106
#define UNK_FUN_PTR(name)
Definition types.h:10
GameStatus * gGameStatusPtr
Definition main_loop.c:32
Gfx * gMainGfxPos
Definition cam_main.c:15