Paper Mario DX
Paper Mario (N64) modding
Loading...
Searching...
No Matches
hieroglyphs.c
Go to the documentation of this file.
1
#include "common.h"
2
#include "
effects_internal.h
"
3
4
extern
Gfx
D_09001000_3DDD50
[];
5
extern
Vtx_t
D_090010A8_3DDDF8
[];
6
7
Gfx
*
D_E00E29F0
[] = {
D_09001000_3DDD50
};
8
9
u8
D_E00E29F4
[] = {
10
120, 130, 140, 150, 160, 170, 180, 190, 200, 200,
11
190, 180, 170, 160, 150, 140, 130
12
};
13
14
u8
D_E00E2A08
[] = {
15
170, 160, 150, 140, 130, 120, 130, 140, 150, 160,
16
170, 180, 190, 200, 200, 190, 180
17
};
18
19
u8
D_E00E2A1C
[] = {
20
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
21
255, 255, 255, 255, 255, 255, 255
22
};
23
24
void
hieroglyphs_init
(
EffectInstance
* effect);
25
void
hieroglyphs_update
(
EffectInstance
* effect);
26
void
hieroglyphs_render
(
EffectInstance
* effect);
27
void
hieroglyphs_appendGfx
(
void
* effect);
28
29
EffectInstance
*
hieroglyphs_main
(s32
arg0
,
f32
posX,
f32
posY,
f32
posZ,
f32
arg4
, s32 timeLeft) {
30
EffectBlueprint
effectBp
;
31
EffectInstance
* effect;
32
HieroglyphsFXData
* data;
33
s32 numParts = 1;
34
35
effectBp
.init =
hieroglyphs_init
;
36
effectBp
.update =
hieroglyphs_update
;
37
effectBp
.renderScene =
hieroglyphs_render
;
38
effectBp
.
unk_00
= 0;
39
effectBp
.renderUI =
NULL
;
40
effectBp
.effectID =
EFFECT_HIEROGLYPHS
;
41
42
effect =
create_effect_instance
(&
effectBp
);
43
effect->
numParts
= numParts;
44
45
data = effect->
data
.
hieroglyphs
=
general_heap_malloc
(numParts *
sizeof
(*data));
46
ASSERT
(data !=
NULL
);
47
48
data->
unk_00
=
arg0
;
49
data->
lifeTime
= 0;
50
if
(timeLeft <= 0) {
51
data->
timeLeft
= 1000;
52
}
else
{
53
data->
timeLeft
= timeLeft;
54
}
55
data->
unk_24
= 0;
56
data->
pos
.
x
= posX;
57
data->
pos
.
y
= posY;
58
data->
pos
.
z
= posZ;
59
data->
unk_38
=
arg4
;
60
data->
unk_18
= 70;
61
data->
unk_1C
= 180;
62
data->
unk_20
= 120;
63
data->
unk_28
= 20;
64
data->
unk_2C
= 230;
65
data->
unk_30
= 50;
66
data->
unk_34
= 255;
67
68
return
effect;
69
}
70
71
void
hieroglyphs_init
(
EffectInstance
* effect) {
72
}
73
74
void
hieroglyphs_update
(
EffectInstance
* effect) {
75
HieroglyphsFXData
* data = effect->
data
.
hieroglyphs
;
76
s32
temp_a2
;
77
78
if
(effect->
flags
&
FX_INSTANCE_FLAG_DISMISS
) {
79
effect->
flags
&=
~FX_INSTANCE_FLAG_DISMISS
;
80
data->
timeLeft
= 16;
81
}
82
83
if
(data->
timeLeft
< 1000) {
84
data->
timeLeft
--;
85
}
86
temp_a2
= ++data->
lifeTime
;
87
if
(data->
timeLeft
< 0) {
88
remove_effect
(effect);
89
return
;
90
}
91
if
(data->
timeLeft
< 16) {
92
data->
unk_24
= data->
timeLeft
* 16;
93
}
94
if
(
temp_a2
< 16) {
95
data->
unk_24
= (
temp_a2
* 16) + 15;
96
}
97
}
98
99
void
hieroglyphs_render
(
EffectInstance
* effect) {
100
RenderTask
renderTask
;
101
RenderTask
*
retTask
;
102
103
renderTask
.
appendGfx
=
hieroglyphs_appendGfx
;
104
renderTask
.appendGfxArg = effect;
105
renderTask
.dist = 10;
106
renderTask
.renderMode =
RENDER_MODE_CLOUD_NO_ZCMP
;
107
108
retTask
=
queue_render_task
(&
renderTask
);
109
retTask
->renderMode |=
RENDER_TASK_FLAG_REFLECT_FLOOR
;
110
}
111
112
void
func_E00E2210
(
void
) {
113
}
114
115
void
hieroglyphs_appendGfx
(
void
* effect) {
116
HieroglyphsFXData
* data = ((
EffectInstance
*)effect)->data.hieroglyphs;
117
Camera
*
camera
= &
gCameras
[
gCurrentCameraID
];
118
s32 lifeTime = data->
lifeTime
;
119
s32 unk_24 = data->
unk_24
;
120
Gfx
*
savedGfxPos
;
121
Matrix4f
sp20
;
122
Matrix4f
sp60
;
123
s32 i;
124
125
gDPPipeSync
(
gMainGfxPos
++);
126
gSPSegment
(
gMainGfxPos
++, 0x09,
VIRTUAL_TO_PHYSICAL
(((
EffectInstance
*)effect)->shared->graphics));
127
128
guTranslateF
(
sp20
, data->
pos
.
x
, data->
pos
.
y
, data->
pos
.
z
);
129
guScaleF
(
sp60
, data->
unk_38
, data->
unk_38
, data->
unk_38
);
130
guMtxCatF
(
sp60
,
sp20
,
sp20
);
131
guMtxF2L
(
sp20
, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
132
133
gSPMatrix
(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++],
G_MTX_PUSH
|
G_MTX_LOAD
|
G_MTX_MODELVIEW
);
134
gSPMatrix
(
gMainGfxPos
++,
camera
->mtxBillboard,
G_MTX_NOPUSH
|
G_MTX_MUL
|
G_MTX_MODELVIEW
);
135
gDPSetPrimColor
(
gMainGfxPos
++, 0, 0, data->
unk_18
, data->
unk_1C
, data->
unk_20
, unk_24);
136
gDPSetEnvColor
(
gMainGfxPos
++, data->
unk_28
, data->
unk_2C
, data->
unk_30
, data->
unk_34
);
137
gSPDisplayList
(
gMainGfxPos
++,
D_E00E29F0
[0]);
138
gSPBranchList
(
gMainGfxPos
,
gMainGfxPos
+ 52);
139
140
savedGfxPos
=
gMainGfxPos
+ 1;
141
142
gDPSetTileSize
(
savedGfxPos
,
G_TX_RENDERTILE
,
143
(lifeTime * 2 ) * 4, 0,
144
(lifeTime * 2 + 127) * 4, 31 * 4);
145
gMainGfxPos
+= 2;
146
147
guRotateF
(
sp20
, 20.0f, 1.0f, 0.0f, 0.0f);
148
guPositionF
(
sp60
, 0.0f,
sin_deg
(lifeTime * 8 + 78.75) * -30.0f, 0.0f, 1.0f, 6.0f, 0.0f, 0.0f);
149
guMtxCatF
(
sp60
,
sp20
,
sp20
);
150
guMtxF2L
(
sp20
, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
151
152
gSPMatrix
(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++],
G_MTX_PUSH
|
G_MTX_MUL
|
G_MTX_MODELVIEW
);
153
154
for
(i = 0; i < 16; i++) {
155
f32
angle = i * 48 + lifeTime * 8;
156
157
guPositionF
(
sp20
, 0.0f,
sin_deg
(angle) * 30.0f, 6.0f, (
f32
) i * 0.01 + 1.0, 8.0f, 0.0f, 0.0f);
158
guMtxF2L
(
sp20
, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
159
160
gSPMatrix
(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++],
G_MTX_NOPUSH
|
G_MTX_MUL
|
G_MTX_MODELVIEW
);
161
gSPVertex
(
gMainGfxPos
++, &
D_090010A8_3DDDF8
[i * 2], 2, i * 2);
162
}
163
164
for
(i = 0; i < 15; i++) {
165
s32
i2
= i * 2;
166
gSP2Triangles
(
gMainGfxPos
++,
167
i2
,
i2
+ 2,
i2
+ 1,
i2
,
168
i2
+ 1,
i2
+ 2,
i2
+ 3,
i2
);
169
}
170
171
gSPPopMatrix
(
gMainGfxPos
++,
G_MTX_MODELVIEW
);
172
gSPEndDisplayList
(
gMainGfxPos
++);
173
174
for
(i = 0; i < 2; i++) {
175
s32
idx
= (lifeTime + i * 4) % 17;
176
177
guPositionF
(
sp20
, 0.0f, 0.0f, -0x11A + i * 0x24, 1.0f, 0.0f, 0.0f, 0.0f);
178
guMtxF2L
(
sp20
, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
]);
179
180
gSPMatrix
(
gMainGfxPos
++, &
gDisplayContext
->
matrixStack
[
gMatrixListPos
++],
G_MTX_PUSH
|
G_MTX_MUL
|
G_MTX_MODELVIEW
);
181
gDPSetPrimColor
(
gMainGfxPos
++, 0, 0,
D_E00E29F4
[
idx
],
D_E00E2A08
[
idx
],
D_E00E2A1C
[
idx
], data->
unk_24
);
182
gDPSetEnvColor
(
gMainGfxPos
++, 255, 255, 255, 0);
183
gSPDisplayList
(
gMainGfxPos
++,
savedGfxPos
);
184
gSPPopMatrix
(
gMainGfxPos
++,
G_MTX_MODELVIEW
);
185
}
186
187
gSPPopMatrix
(
gMainGfxPos
++,
G_MTX_MODELVIEW
);
188
}
PopupMenu_SelectedIndex
BSS s32 PopupMenu_SelectedIndex
Definition
8a860_len_3f30.c:84
DisplayContext::matrixStack
Mtx matrixStack[0x200]
Definition
common_structs.h:2192
Matrix4f
f32 Matrix4f[4][4]
Definition
common_structs.h:133
Vec3f::z
f32 z
Definition
common_structs.h:103
Vec3f::x
f32 x
Definition
common_structs.h:101
Vec3f::y
f32 y
Definition
common_structs.h:102
general_heap_malloc
#define general_heap_malloc
Definition
effect_shims.h:51
guRotateF
#define guRotateF
Definition
effect_shims.h:42
queue_render_task
#define queue_render_task
Definition
effect_shims.h:48
guMtxF2L
#define guMtxF2L
Definition
effect_shims.h:47
sin_deg
#define sin_deg
Definition
effect_shims.h:55
guTranslateF
#define guTranslateF
Definition
effect_shims.h:43
guMtxCatF
#define guMtxCatF
Definition
effect_shims.h:46
remove_effect
#define remove_effect
Definition
effect_shims.h:50
guPositionF
#define guPositionF
Definition
effect_shims.h:65
create_effect_instance
#define create_effect_instance
Definition
effect_shims.h:49
guScaleF
#define guScaleF
Definition
effect_shims.h:45
HieroglyphsFXData::unk_1C
s32 unk_1C
Definition
effects.h:2034
HieroglyphsFXData::pos
Vec3f pos
Definition
effects.h:2030
EffectInstance::flags
s32 flags
Definition
effects.h:2602
HieroglyphsFXData::unk_18
s32 unk_18
Definition
effects.h:2033
HieroglyphsFXData::unk_00
s32 unk_00
Definition
effects.h:2029
HieroglyphsFXData::timeLeft
s32 timeLeft
Definition
effects.h:2031
HieroglyphsFXData::unk_28
s32 unk_28
Definition
effects.h:2037
EffectInstance::data
EffectInstanceDataPtr data
Definition
effects.h:2605
HieroglyphsFXData::unk_24
s32 unk_24
Definition
effects.h:2036
HieroglyphsFXData::lifeTime
s32 lifeTime
Definition
effects.h:2032
HieroglyphsFXData::unk_38
f32 unk_38
Definition
effects.h:2041
HieroglyphsFXData::unk_2C
s32 unk_2C
Definition
effects.h:2038
HieroglyphsFXData::unk_20
s32 unk_20
Definition
effects.h:2035
EffectInstance::numParts
s32 numParts
Definition
effects.h:2604
HieroglyphsFXData::unk_34
s32 unk_34
Definition
effects.h:2040
HieroglyphsFXData::unk_30
s32 unk_30
Definition
effects.h:2039
EffectInstanceDataPtr::hieroglyphs
struct HieroglyphsFXData * hieroglyphs
Definition
effects.h:2577
EffectInstance
Definition
effects.h:2601
HieroglyphsFXData
Definition
effects.h:2028
effects_internal.h
ASSERT
#define ASSERT(condition)
Definition
effects_internal.h:8
FX_INSTANCE_FLAG_DISMISS
@ FX_INSTANCE_FLAG_DISMISS
Definition
enums.h:3517
RENDER_TASK_FLAG_REFLECT_FLOOR
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition
enums.h:3318
RENDER_MODE_CLOUD_NO_ZCMP
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition
enums.h:3311
D_E00E29F4
u8 D_E00E29F4[]
Definition
hieroglyphs.c:9
hieroglyphs_update
void hieroglyphs_update(EffectInstance *effect)
Definition
hieroglyphs.c:74
hieroglyphs_render
void hieroglyphs_render(EffectInstance *effect)
Definition
hieroglyphs.c:99
hieroglyphs_init
void hieroglyphs_init(EffectInstance *effect)
Definition
hieroglyphs.c:71
hieroglyphs_appendGfx
void hieroglyphs_appendGfx(void *effect)
Definition
hieroglyphs.c:115
D_E00E2A1C
u8 D_E00E2A1C[]
Definition
hieroglyphs.c:19
D_09001000_3DDD50
Gfx D_09001000_3DDD50[]
D_E00E2A08
u8 D_E00E2A08[]
Definition
hieroglyphs.c:14
D_090010A8_3DDDF8
Vtx_t D_090010A8_3DDDF8[]
D_E00E29F0
Gfx * D_E00E29F0[]
Definition
hieroglyphs.c:7
hieroglyphs_main
EffectInstance * hieroglyphs_main(s32 arg0, f32 posX, f32 posY, f32 posZ, f32 arg4, s32 timeLeft)
Definition
hieroglyphs.c:29
func_E00E2210
void func_E00E2210(void)
Definition
hieroglyphs.c:112
VIRTUAL_TO_PHYSICAL
#define VIRTUAL_TO_PHYSICAL(addr)
Definition
macros.h:47
Camera
Definition
common_structs.h:749
EffectBlueprint
Definition
effects.h:2649
RenderTask
Definition
common_structs.h:1508
RenderTask::appendGfx
void(* appendGfx)(void *)
Definition
common_structs.h:1512
gCameras
Camera gCameras[4]
Definition
cam_main.c:17
gMainGfxPos
Gfx * gMainGfxPos
Definition
cam_main.c:15
gMatrixListPos
u16 gMatrixListPos
Definition
main_loop.c:45
gCurrentCameraID
s32 gCurrentCameraID
Definition
cam_math.c:4
gDisplayContext
DisplayContext * gDisplayContext
Definition
cam_main.c:16
src
effects
hieroglyphs.c
Generated by
1.10.0