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
11
INCLUDE_IMG
(
"theater/walls.png"
,
theater_walls_png
);
12
13
Gfx
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
21
INCLUDE_IMG
(
"theater/curtains.png"
,
theater_curtains_png
);
22
23
Gfx
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
31
INCLUDE_IMG
(
"theater/floor.png"
,
theater_floor_png
);
32
INCLUDE_PAL
(
"theater/floor.pal"
,
theater_floor_pal
);
33
34
Gfx
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
51
Gfx
TheaterWallShadowsGfx
[] = {
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
62
Gfx
TheaterCurtainGfx
[] = {
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
81
Gfx
TheaterInsetShadowsGfx
[] = {
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
93
Gfx
TheaterFloorGfx
[] = {
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
115
Gfx
TheaterRightWallGfx
[] = {
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
127
Gfx
TheaterLeftWallGfx
[] = {
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
139
Gfx
TheaterGfx
[] ={
140
gsSPDisplayList
(
TheaterFloorGfx
),
141
gsSPDisplayList
(
TheaterLeftWallGfx
),
142
gsSPDisplayList
(
TheaterRightWallGfx
),
143
gsSPDisplayList
(
TheaterInsetShadowsGfx
),
144
gsSPDisplayList
(
TheaterWallShadowsGfx
),
145
gsSPDisplayList
(
TheaterCurtainGfx
),
146
gsSPEndDisplayList
(),
147
};
148
149
Vp
TheaterViewport
= {
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
156
Gfx
TheaterInitGfx
[] = {
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
176
INCLUDE_IMG
(
"ui/no_controller.png"
,
ui_no_controller_png
);
177
178
Gfx
NoControllerSetupTexGfx
[] = {
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
199
Gfx
NoControllerGfx
[] = {
200
gsSPTextureRectangle
(0x0180, 0x0260, 0x0380, 0x02E0,
G_TX_RENDERTILE
, 0, 0, 0x0400, 0x0400),
201
gsDPPipeSync
(),
202
gsSPEndDisplayList
(),
203
};
204
205
BSS
f32
gCurtainScale
;
206
BSS
f32
gCurtainScaleGoal
;
207
BSS
f32
gCurtainFade
;
208
BSS
f32
gCurtainFadeGoal
;
209
BSS
UNK_FUN_PTR
(
gCurtainDrawCallback
);
210
BSS
Mtx
D_8009BAA8
[2];
211
212
void
initialize_curtains
(
void
) {
213
gCurtainDrawCallback
=
NULL
;
214
gCurtainScale
= 2.0f;
215
gCurtainScaleGoal
= 2.0f;
216
gCurtainFade
= 0.0f;
217
gCurtainFadeGoal
= 0.0f;
218
}
219
220
void
update_curtains
(
void
) {
221
}
222
223
void
render_curtains
(
void
) {
224
if
(
gCurtainScaleGoal
!=
gCurtainScale
) {
225
gCurtainScale
+= (
gCurtainScaleGoal
-
gCurtainScale
) * 0.1;
226
}
227
228
if
(
gCurtainFadeGoal
!=
gCurtainFade
) {
229
gCurtainFade
+= (
gCurtainFadeGoal
-
gCurtainFade
) * 0.03;
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)) {
268
if
((
get_game_mode
() ==
GAME_MODE_INTRO
)
269
|| (
get_game_mode
() ==
GAME_MODE_TITLE_SCREEN
)
270
|| (
gGameStatusPtr
->
demoState
!=
DEMO_STATE_NONE
)) {
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
285
void
set_curtain_scale_goal
(
f32
scale) {
286
gCurtainScaleGoal
= scale;
287
}
288
289
void
set_curtain_scale
(
f32
scale) {
290
gCurtainScaleGoal
= scale;
291
gCurtainScale
= scale;
292
}
293
294
void
set_curtain_draw_callback
(
UNK_FUN_PTR
(callback)) {
295
gCurtainDrawCallback
= callback;
296
}
297
298
void
set_curtain_fade_goal
(
f32
fade
) {
299
gCurtainFadeGoal
=
fade
;
300
}
301
302
void
set_curtain_fade
(
f32
fade
) {
303
gCurtainFadeGoal
=
fade
;
304
gCurtainFade
=
fade
;
305
}
PopupMenu_SelectedIndex
BSS s32 PopupMenu_SelectedIndex
Definition
8a860_len_3f30.c:84
nuGfxCfb_ptr
u16 * nuGfxCfb_ptr
Definition
cam_main.c:14
GameStatus::frameCounter
u16 frameCounter
Definition
common_structs.h:1446
Matrix4f
f32 Matrix4f[4][4]
Definition
common_structs.h:133
GameStatus::demoState
s8 demoState
Definition
common_structs.h:1399
GameStatus::contBitPattern
u8 contBitPattern
Definition
common_structs.h:1401
TheaterInsetShadowsGfx
Gfx TheaterInsetShadowsGfx[]
Definition
curtains.c:81
initialize_curtains
void initialize_curtains(void)
Definition
curtains.c:212
NoControllerGfx
Gfx NoControllerGfx[]
Definition
curtains.c:199
set_curtain_fade
void set_curtain_fade(f32 fade)
Definition
curtains.c:302
TheaterWallShadowsGfx
Gfx TheaterWallShadowsGfx[]
Definition
curtains.c:51
TheaterGfx
Gfx TheaterGfx[]
Definition
curtains.c:139
D_80075730
Gfx D_80075730[]
Definition
curtains.c:23
NoControllerSetupTexGfx
Gfx NoControllerSetupTexGfx[]
Definition
curtains.c:178
TheaterViewport
Vp TheaterViewport
Definition
curtains.c:149
update_curtains
void update_curtains(void)
Definition
curtains.c:220
D_800746E0
Gfx D_800746E0[]
Definition
curtains.c:13
set_curtain_fade_goal
void set_curtain_fade_goal(f32 fade)
Definition
curtains.c:298
set_curtain_draw_callback
void set_curtain_draw_callback(UNK_FUN_PTR(callback))
Definition
curtains.c:294
TheaterInitGfx
Gfx TheaterInitGfx[]
Definition
curtains.c:156
gCurtainFadeGoal
BSS f32 gCurtainFadeGoal
Definition
curtains.c:208
D_800758A0
Gfx D_800758A0[]
Definition
curtains.c:34
gCurtainScale
BSS f32 gCurtainScale
Definition
curtains.c:205
TheaterRightWallGfx
Gfx TheaterRightWallGfx[]
Definition
curtains.c:115
D_8009BAA8
BSS Mtx D_8009BAA8[2]
Definition
curtains.c:210
set_curtain_scale
void set_curtain_scale(f32 scale)
Definition
curtains.c:289
TheaterFloorGfx
Gfx TheaterFloorGfx[]
Definition
curtains.c:93
render_curtains
void render_curtains(void)
Definition
curtains.c:223
gCurtainScaleGoal
BSS f32 gCurtainScaleGoal
Definition
curtains.c:206
gCurtainFade
BSS f32 gCurtainFade
Definition
curtains.c:207
TheaterLeftWallGfx
Gfx TheaterLeftWallGfx[]
Definition
curtains.c:127
TheaterCurtainGfx
Gfx TheaterCurtainGfx[]
Definition
curtains.c:62
set_curtain_scale_goal
void set_curtain_scale_goal(f32 scale)
Definition
curtains.c:285
rgb
Color_RGB8 rgb
Definition
demo_api.c:16
guMtxF2L
#define guMtxF2L
Definition
effect_shims.h:47
guFrustumF
#define guFrustumF
Definition
effect_shims.h:67
guPositionF
#define guPositionF
Definition
effect_shims.h:65
DEMO_STATE_NONE
@ DEMO_STATE_NONE
Definition
enums.h:3534
get_game_mode
s32 get_game_mode(void)
Definition
game_modes.c:123
game_modes.h
GAME_MODE_TITLE_SCREEN
@ GAME_MODE_TITLE_SCREEN
Definition
game_modes.h:9
GAME_MODE_INTRO
@ GAME_MODE_INTRO
Definition
game_modes.h:21
include_asset.h
INCLUDE_PAL
#define INCLUDE_PAL(FILENAME, SYMBOLNAME)
Definition
include_asset.h:30
INCLUDE_IMG
#define INCLUDE_IMG(FILENAME, SYMBOLNAME)
Definition
include_asset.h:27
SCREEN_WIDTH
#define SCREEN_WIDTH
Definition
macros.h:109
BSS
#define BSS
Definition
macros.h:7
PM_CC2_MULTIPLY_PRIM
#define PM_CC2_MULTIPLY_PRIM
Definition
macros.h:309
SCREEN_HEIGHT
#define SCREEN_HEIGHT
Definition
macros.h:110
UNK_FUN_PTR
#define UNK_FUN_PTR(name)
Definition
types.h:10
gGameStatusPtr
GameStatus * gGameStatusPtr
Definition
main_loop.c:32
gMainGfxPos
Gfx * gMainGfxPos
Definition
cam_main.c:15
src
curtains.c
Generated by
1.10.0