Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
stat_change.c File Reference

Go to the source code of this file.

Data Structures

struct  ExtraArrowDataEntry
 
struct  ArrowDataTableEntry
 

Enumerations

enum  ArrowType { ARROW_TYPE_ATK_UP = 0 , ARROW_TYPE_ATK_DOWN = 1 , ARROW_TYPE_DEF_UP = 2 }
 

Functions

void func_E00AC288 (EffectInstance *effect)
 
void func_E00AC2A4 (EffectInstance *effect)
 
void stat_change_init (EffectInstance *effect)
 
void stat_change_update (EffectInstance *effect)
 
void stat_change_render (EffectInstance *effect)
 
EffectInstancestat_change_main (s32 arg0, f32 x, f32 y, f32 z, f32 scale, s32 time)
 

Variables

Gfx D_09002700_3B1E00 []
 
Gfx D_09002798_3B1E98 []
 
Gfx D_09002860_3B1F60 []
 
Gfx D_09002880_3B1F80 []
 
Gfx D_090028A0_3B1FA0 []
 
Gfx D_090028C0_3B1FC0 []
 
Gfx D_090028E0_3B1FE0 []
 
Gfx D_09002950_3B2050 []
 
Gfx D_09002990_3B2090 []
 
Gfx D_090029D0_3B20D0 []
 
Gfx D_09002A10_3B2110 []
 
Gfx D_09002A50_3B2150 []
 
Gfx D_09002A90_3B2190 []
 
Gfx D_09002AD0_3B21D0 []
 
Gfx D_09002B10_3B2210 []
 
Gfx D_09002B50_3B2250 []
 
Gfx D_09002B90_3B2290 []
 
Gfx D_09002BD0_3B22D0 []
 
Gfx D_09002C10_3B2310 []
 
Gfx * D_E00AC7B0 [] = { D_09002700_3B1E00, D_09002700_3B1E00, D_09002798_3B1E98 }
 
Gfx * D_E00AC7BC [] = { D_09002860_3B1F60, D_09002880_3B1F80, D_09002860_3B1F60 }
 
Gfx * D_E00AC7C8 []
 
ExtraArrowDataEntry D_E00AC7F8 []
 
ExtraArrowDataEntry D_E00AC83C []
 
ArrowDataTableEntry D_E00AC880 []
 

Data Structure Documentation

◆ ExtraArrowDataEntry

struct ExtraArrowDataEntry
Data Fields
u8 unk_00
u8 unk_01

◆ ArrowDataTableEntry

struct ArrowDataTableEntry
Data Fields
s32 type
s32 value

Enumeration Type Documentation

◆ ArrowType

enum ArrowType
Enumerator
ARROW_TYPE_ATK_UP 
ARROW_TYPE_ATK_DOWN 
ARROW_TYPE_DEF_UP 

Definition at line 4 of file stat_change.c.

4 {
8};
@ ARROW_TYPE_DEF_UP
Definition stat_change.c:7
@ ARROW_TYPE_ATK_DOWN
Definition stat_change.c:6
@ ARROW_TYPE_ATK_UP
Definition stat_change.c:5

Function Documentation

◆ func_E00AC288()

void func_E00AC288 ( EffectInstance * effect)

Definition at line 230 of file stat_change.c.

230 {
231 func_E00AC2A4(effect);
232}
void func_E00AC2A4(EffectInstance *effect)

Referenced by stat_change_main().

◆ func_E00AC2A4()

void func_E00AC2A4 ( EffectInstance * effect)

Definition at line 234 of file stat_change.c.

234 {
235 StatChangeFXData* data = effect->data.statChange;
236 s32 arrowType = data->arrowType;
237 s32 arrowValue = data->arrowValue;
238 s32 idx;
239 Matrix4f sp20;
240 Matrix4f sp60;
241
242 if (data->scaleX != 0.0f && data->scaleY != 0.0f) {
243 gDPPipeSync(gMainGfxPos++);
244 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
245
246 guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->scale, data->pos.x, data->pos.y, data->pos.z);
248
249 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
250
251 if (data->unk_24 == 255) {
252 gDPSetRenderMode(gMainGfxPos++, AA_EN | CVG_DST_FULL | ZMODE_OPA | CVG_X_ALPHA | GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM), AA_EN | CVG_DST_FULL | ZMODE_OPA | CVG_X_ALPHA | GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM));
253 gDPSetCombineMode(gMainGfxPos++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
254 } else {
255 gDPSetRenderMode(gMainGfxPos++, G_RM_CLD_SURF, G_RM_CLD_SURF2);
256 gDPSetCombineMode(gMainGfxPos++, PM_CC_49, PM_CC_49);
257 }
258
259 guTranslateF(sp20, 0.0f, data->unk_40, 0.0f);
260 guScaleF(sp60, data->scaleX, data->scaleY, 1.0f);
261 guMtxCatF(sp60, sp20, sp20);
263
264 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
265 gSPDisplayList(gMainGfxPos++, D_E00AC7B0[arrowType]);
266 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, data->unk_24);
267 gSPDisplayList(gMainGfxPos++, D_E00AC7BC[arrowType]);
268 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
269 gSPDisplayList(gMainGfxPos++, D_090028E0_3B1FE0);
270
271 guTranslateF(sp20, 0.0f, data->unk_3C, 0.0f);
273
274 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
275
276 if (arrowValue < 0) {
277 idx = -arrowValue;
278 } else {
279 idx = arrowValue;
280 }
281
282 gSPDisplayList(gMainGfxPos++, D_E00AC7C8[idx % 10]);
283 gSPDisplayList(gMainGfxPos++, D_090028C0_3B1FC0);
284
285 if (arrowValue >= 0) {
286 gSPDisplayList(gMainGfxPos++, D_E00AC7C8[11]);
287 } else {
288 gSPDisplayList(gMainGfxPos++, D_E00AC7C8[10]);
289 }
290
291 gSPDisplayList(gMainGfxPos++, D_090028A0_3B1FA0);
292 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
293 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
294 gDPPipeSync(gMainGfxPos++);
295 }
296}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guPositionF
#define guScaleF
struct StatChangeFXData * statChange
Definition effects.h:2550
EffectData data
Definition effects.h:2605
#define PM_CC_49
Definition macros.h:478
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Gfx * D_E00AC7B0[]
Definition stat_change.c:40
Gfx D_090028C0_3B1FC0[]
Gfx D_090028E0_3B1FE0[]
Gfx D_090028A0_3B1FA0[]
Gfx * D_E00AC7C8[]
Definition stat_change.c:44
Gfx * D_E00AC7BC[]
Definition stat_change.c:42
Camera gCameras[4]
Definition cam_main.c:17
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
s32 gCurrentCameraID
Definition cam_math.c:4
DisplayContext * gDisplayContext
Definition cam_main.c:16

Referenced by func_E00AC288().

◆ stat_change_init()

void stat_change_init ( EffectInstance * effect)

Definition at line 182 of file stat_change.c.

182 {
183}

Referenced by stat_change_main().

◆ stat_change_update()

void stat_change_update ( EffectInstance * effect)

Definition at line 185 of file stat_change.c.

185 {
186 StatChangeFXData* part = effect->data.statChange;
187 s32 old_unk18;
188
189 part->timeLeft--;
190 old_unk18 = part->unk_18++;
191
192 if (part->timeLeft < 0) {
193 remove_effect(effect);
194 return;
195 }
196
197 if (part->arrowType == ARROW_TYPE_ATK_DOWN) {
198 if (old_unk18 >= ARRAY_COUNT(D_E00AC83C)) {
199 part->unk_24 = 0;
200 part->scaleX = 0.0f;
201 part->scaleY = 0.0f;
202 } else {
203 part->unk_24 = D_E00AC83C[old_unk18].unk_00;
204 part->scaleY = (f32)D_E00AC83C[old_unk18].unk_01 * 0.01;
205 part->scaleX = 1.0f - part->scaleY + 1.0f;
206 }
207 } else {
208 if (old_unk18 >= ARRAY_COUNT(D_E00AC7F8)) {
209 part->unk_24 = 0;
210 part->scaleX = 0.0f;
211 part->scaleY = 0.0f;
212 } else {
213 part->unk_24 = D_E00AC7F8[old_unk18].unk_00;
214 part->scaleX = (f32)D_E00AC7F8[old_unk18].unk_01 * 0.01;
215 part->scaleY = 1.0f - part->scaleX + 1.0f;
216 }
217 }
218
219 part->unk_3C = 0;
220 part->unk_40 = 0;
221
222 part->pos.x += part->unk_30;
223 part->pos.y += part->unk_38;
224 part->pos.z += part->unk_34;
225}
#define remove_effect
#define ARRAY_COUNT(arr)
Definition macros.h:40
ExtraArrowDataEntry D_E00AC83C[]
Definition stat_change.c:86
ExtraArrowDataEntry D_E00AC7F8[]
Definition stat_change.c:50

Referenced by stat_change_main().

◆ stat_change_render()

void stat_change_render ( EffectInstance * effect)

Definition at line 227 of file stat_change.c.

227 {
228}

Referenced by stat_change_main().

◆ stat_change_main()

EffectInstance * stat_change_main ( s32 arg0,
f32 x,
f32 y,
f32 z,
f32 scale,
s32 time )

Definition at line 141 of file stat_change.c.

141 {
143 EffectBlueprint* bpPtr = &bp;
144 EffectInstance* effect;
145 StatChangeFXData* part;
146 s32 numParts = 1;
147
152 bp.unk_00 = 0;
153 bp.effectID = EFFECT_STAT_CHANGE;
154
155 effect = create_effect_instance(bpPtr);
156 effect->numParts = numParts;
157 part = effect->data.statChange = general_heap_malloc(numParts * sizeof(*part));
158
159 ASSERT(effect->data.statChange != NULL);
160
161 part->unk_00 = arg0;
162 part->pos.x = x;
163 part->pos.y = y;
164 part->pos.z = z;
165 part->timeLeft = time;
166
167 part->unk_18 = 0;
168 part->scale = scale;
169 part->unk_24 = 255;
170 part->scaleX = 0;
171 part->scaleY = 0;
172 part->unk_30 = 0;
173 part->unk_38 = 0;
174 part->unk_34 = 0;
175
176 part->arrowType = D_E00AC880[arg0].type;
177 part->arrowValue = D_E00AC880[arg0].value;
178
179 return effect;
180}
#define general_heap_malloc
#define create_effect_instance
#define ASSERT(condition)
void func_E00AC288(EffectInstance *effect)
void stat_change_init(EffectInstance *effect)
void stat_change_render(EffectInstance *effect)
void stat_change_update(EffectInstance *effect)
ArrowDataTableEntry D_E00AC880[]
void(* renderUI)(EffectInstance *effectInst)
Definition effects.h:2655
void(* init)(EffectInstance *effectInst)
Definition effects.h:2652
void(* update)(EffectInstance *effectInst)
Definition effects.h:2653
void(* renderWorld)(EffectInstance *effectInst)
Definition effects.h:2654

Variable Documentation

◆ D_09002700_3B1E00

Gfx D_09002700_3B1E00[]
extern

◆ D_09002798_3B1E98

Gfx D_09002798_3B1E98[]
extern

◆ D_09002860_3B1F60

Gfx D_09002860_3B1F60[]
extern

◆ D_09002880_3B1F80

Gfx D_09002880_3B1F80[]
extern

◆ D_090028A0_3B1FA0

Gfx D_090028A0_3B1FA0[]
extern

Referenced by func_E00AC2A4().

◆ D_090028C0_3B1FC0

Gfx D_090028C0_3B1FC0[]
extern

Referenced by func_E00AC2A4().

◆ D_090028E0_3B1FE0

Gfx D_090028E0_3B1FE0[]
extern

Referenced by func_E00AC2A4().

◆ D_09002950_3B2050

Gfx D_09002950_3B2050[]
extern

◆ D_09002990_3B2090

Gfx D_09002990_3B2090[]
extern

◆ D_090029D0_3B20D0

Gfx D_090029D0_3B20D0[]
extern

◆ D_09002A10_3B2110

Gfx D_09002A10_3B2110[]
extern

◆ D_09002A50_3B2150

Gfx D_09002A50_3B2150[]
extern

◆ D_09002A90_3B2190

Gfx D_09002A90_3B2190[]
extern

◆ D_09002AD0_3B21D0

Gfx D_09002AD0_3B21D0[]
extern

◆ D_09002B10_3B2210

Gfx D_09002B10_3B2210[]
extern

◆ D_09002B50_3B2250

Gfx D_09002B50_3B2250[]
extern

◆ D_09002B90_3B2290

Gfx D_09002B90_3B2290[]
extern

◆ D_09002BD0_3B22D0

Gfx D_09002BD0_3B22D0[]
extern

◆ D_09002C10_3B2310

Gfx D_09002C10_3B2310[]
extern

◆ D_E00AC7B0

Definition at line 40 of file stat_change.c.

Gfx D_09002798_3B1E98[]
Gfx D_09002700_3B1E00[]

Referenced by func_E00AC2A4().

◆ D_E00AC7BC

Definition at line 42 of file stat_change.c.

Gfx D_09002880_3B1F80[]
Gfx D_09002860_3B1F60[]

Referenced by func_E00AC2A4().

◆ D_E00AC7C8

Gfx* D_E00AC7C8[]

◆ D_E00AC7F8

ExtraArrowDataEntry D_E00AC7F8[]

Definition at line 50 of file stat_change.c.

50 {
51 { .unk_00 = 0xFF, .unk_01 = 0x96 },
52 { .unk_00 = 0xFF, .unk_01 = 0x82 },
53 { .unk_00 = 0xFF, .unk_01 = 0x64 },
54 { .unk_00 = 0xFF, .unk_01 = 0x46 },
55 { .unk_00 = 0xFF, .unk_01 = 0x3C },
56 { .unk_00 = 0xFF, .unk_01 = 0x50 },
57 { .unk_00 = 0xFF, .unk_01 = 0x6E },
58 { .unk_00 = 0xFF, .unk_01 = 0x73 },
59 { .unk_00 = 0xFF, .unk_01 = 0x6B },
60 { .unk_00 = 0xFF, .unk_01 = 0x5C },
61 { .unk_00 = 0xFF, .unk_01 = 0x5A },
62 { .unk_00 = 0xFF, .unk_01 = 0x5E },
63 { .unk_00 = 0xFF, .unk_01 = 0x67 },
64 { .unk_00 = 0xFF, .unk_01 = 0x68 },
65 { .unk_00 = 0xFF, .unk_01 = 0x67 },
66 { .unk_00 = 0xFF, .unk_01 = 0x64 },
67 { .unk_00 = 0xFF, .unk_01 = 0x62 },
68 { .unk_00 = 0xFF, .unk_01 = 0x63 },
69 { .unk_00 = 0xFF, .unk_01 = 0x65 },
70 { .unk_00 = 0xFF, .unk_01 = 0x64 },
71 { .unk_00 = 0xF0, .unk_01 = 0x64 },
72 { .unk_00 = 0xDC, .unk_01 = 0x64 },
73 { .unk_00 = 0xC8, .unk_01 = 0x64 },
74 { .unk_00 = 0xB4, .unk_01 = 0x64 },
75 { .unk_00 = 0xA0, .unk_01 = 0x64 },
76 { .unk_00 = 0x82, .unk_01 = 0x64 },
77 { .unk_00 = 0x64, .unk_01 = 0x64 },
78 { .unk_00 = 0x46, .unk_01 = 0x64 },
79 { .unk_00 = 0x32, .unk_01 = 0x64 },
80 { .unk_00 = 0x28, .unk_01 = 0x64 },
81 { .unk_00 = 0x1E, .unk_01 = 0x64 },
82 { .unk_00 = 0x14, .unk_01 = 0x64 },
83 { .unk_00 = 0x0A, .unk_01 = 0x64 },
84};

Referenced by stat_change_update().

◆ D_E00AC83C

ExtraArrowDataEntry D_E00AC83C[]

Definition at line 86 of file stat_change.c.

86 {
87 { .unk_00 = 0xFF, .unk_01 = 0x96 },
88 { .unk_00 = 0xFF, .unk_01 = 0x82 },
89 { .unk_00 = 0xFF, .unk_01 = 0x64 },
90 { .unk_00 = 0xFF, .unk_01 = 0x46 },
91 { .unk_00 = 0xFF, .unk_01 = 0x3C },
92 { .unk_00 = 0xFF, .unk_01 = 0x50 },
93 { .unk_00 = 0xFF, .unk_01 = 0x6E },
94 { .unk_00 = 0xFF, .unk_01 = 0x73 },
95 { .unk_00 = 0xFF, .unk_01 = 0x6B },
96 { .unk_00 = 0xFF, .unk_01 = 0x5C },
97 { .unk_00 = 0xFF, .unk_01 = 0x5A },
98 { .unk_00 = 0xFF, .unk_01 = 0x5E },
99 { .unk_00 = 0xFF, .unk_01 = 0x67 },
100 { .unk_00 = 0xFF, .unk_01 = 0x68 },
101 { .unk_00 = 0xFF, .unk_01 = 0x67 },
102 { .unk_00 = 0xFF, .unk_01 = 0x64 },
103 { .unk_00 = 0xFF, .unk_01 = 0x62 },
104 { .unk_00 = 0xFF, .unk_01 = 0x63 },
105 { .unk_00 = 0xFF, .unk_01 = 0x65 },
106 { .unk_00 = 0xFF, .unk_01 = 0x64 },
107 { .unk_00 = 0xF0, .unk_01 = 0x64 },
108 { .unk_00 = 0xDC, .unk_01 = 0x64 },
109 { .unk_00 = 0xC8, .unk_01 = 0x64 },
110 { .unk_00 = 0xB4, .unk_01 = 0x64 },
111 { .unk_00 = 0xA0, .unk_01 = 0x64 },
112 { .unk_00 = 0x82, .unk_01 = 0x64 },
113 { .unk_00 = 0x64, .unk_01 = 0x64 },
114 { .unk_00 = 0x46, .unk_01 = 0x64 },
115 { .unk_00 = 0x32, .unk_01 = 0x64 },
116 { .unk_00 = 0x28, .unk_01 = 0x64 },
117 { .unk_00 = 0x1E, .unk_01 = 0x64 },
118 { .unk_00 = 0x14, .unk_01 = 0x64 },
119 { .unk_00 = 0x0A, .unk_01 = 0x64 },
120};

Referenced by stat_change_update().

◆ D_E00AC880

ArrowDataTableEntry D_E00AC880[]
Initial value:
= {
{ .type = ARROW_TYPE_ATK_UP, .value = 1 },
{ .type = ARROW_TYPE_ATK_UP, .value = 2 },
{ .type = ARROW_TYPE_ATK_UP, .value = 3 },
{ .type = ARROW_TYPE_ATK_DOWN, .value = -1 },
{ .type = ARROW_TYPE_ATK_DOWN, .value = -2 },
{ .type = ARROW_TYPE_ATK_DOWN, .value = -3 },
{ .type = ARROW_TYPE_DEF_UP, .value = 1 },
{ .type = ARROW_TYPE_DEF_UP, .value = 2 },
{ .type = ARROW_TYPE_DEF_UP, .value = 3 },
{ .type = ARROW_TYPE_ATK_UP, .value = 0 },
}

Definition at line 122 of file stat_change.c.

122 {
123 { .type = ARROW_TYPE_ATK_UP, .value = 1 },
124 { .type = ARROW_TYPE_ATK_UP, .value = 2 },
125 { .type = ARROW_TYPE_ATK_UP, .value = 3 },
126 { .type = ARROW_TYPE_ATK_DOWN, .value = -1 },
127 { .type = ARROW_TYPE_ATK_DOWN, .value = -2 },
128 { .type = ARROW_TYPE_ATK_DOWN, .value = -3 },
129 { .type = ARROW_TYPE_DEF_UP, .value = 1 },
130 { .type = ARROW_TYPE_DEF_UP, .value = 2 },
131 { .type = ARROW_TYPE_DEF_UP, .value = 3 },
132 { .type = ARROW_TYPE_ATK_UP, .value = 0 },
133};

Referenced by stat_change_main().