Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
8a160_len_700.c
Go to the documentation of this file.
1#include "common.h"
2#include "include_asset.h"
3
4INCLUDE_IMG("A2960.png", D_801094B0);
5
7 .vp = {
8 .vscale = { 640, 480, 511, 0 },
9 .vtrans = { 640, 480, 511, 0 }
10 }
11};
12
13#include "A2B70.vtx.inc.c"
14
15#include "A2BC0.gfx.inc.c"
16#include "A2C88.gfx.inc.c"
17
18u8 D_80109800[32] = {
19 40, 90, 81, 72, 65, 59, 53, 47, 43, 38, 34, 31, 28, 25, 22, 20, 18, 16, 15, 13, 12, 10, 9, 8, 7, 7, 6, 5, 5, 4, 0, 0
20};
21
23 { 247, 105 }, { 239, 87 }, { 17, 87 }, { 9, 105 }, { 0, 122 }, { 230, 69 }, { 26, 69 }, { 221, 52 }, { 35, 52 },
24 { 202, 49 }, { 186, 255 }, { 200, 241 }, { 0, 200 }, { 56, 241 }, { 70, 255 }, { 54, 49 }, { 196, 222 },
25 { 239, 191 }, { 17, 191 }, { 60, 222 }, { 85, 13 }, { 74, 46 }, { 99, 27 }, { 93, 43 }, { 12, 33 }, { 12, 22 },
26 { 24, 22 }, { 24, 33 }, { 12, 10 }, { 24, 10 }, { 24, 45 }, { 232, 33 }, { 232, 22 }, { 232, 45 }, { 113, 40 },
27 { 193, 203 }, { 190, 183 }, { 182, 46 }, { 163, 43 }, { 35, 182 }, { 52, 173 }, { 12, 45 }, { 244, 22 },
28 { 244, 33 }, { 232, 10 }, { 244, 10 }, { 244, 45 }, { 204, 173 }, { 221, 182 }, { 186, 164 }, { 171, 13 },
29 { 157, 27 }, { 143, 40 }, { 63, 203 }, { 66, 183 }, { 70, 164 }
30};
31
32typedef struct Unk8a160 {
33 /* 0x00 */ u8 alive;
34 /* 0x01 */ s8 timeLeft;
35 /* 0x02 */ u8 lifetime;
36 /* 0x03 */ Color_RGBA8 rgba;
37 /* 0x07 */ s8 lodVal;
38 /* 0x08 */ f32 x;
39 /* 0x0C */ f32 y;
40 /* 0x10 */ Vec2f vel;
41 /* 0x18 */ f32 scale;
42} Unk8a160; // size = 0x1C
43
44typedef struct Unk8a160Outer {
45 /* 0x00 */ Unk8a160 subs[57]; // one base + 56 others?
47
49
50void func_800F0CB0(s32 arg0, f32 x, f32 y, f32 scale) {
51 Unk8a160Outer* outer = &D_8010D000[arg0];
52 Unk8a160* sub = &outer->subs[0];
53 s32 numSubstructs = ARRAY_COUNT(outer->subs);
54 s32 i;
55
56 if (arg0 <= 0) {
57 sub->alive = TRUE;
58 sub->x = x;
59 sub->y = y;
60 sub->scale = scale;
61 sub->timeLeft = 40;
62 sub->lifetime = 0;
63 sub = &outer->subs[1];
64
65 for (i = 1; i < numSubstructs; i++, sub++) {
66 sub->lodVal = (s32) (-((f32) i) * 0.0f) - 1;
67 }
68 }
69}
70
71void func_800F0D5C(void) {
72 Unk8a160Outer* outer = &D_8010D000[0];
73 s32 i;
74
75 for (i = 0; i < ARRAY_COUNT(D_8010D000); i++) {
76 outer[i].subs[0].alive = FALSE;
77 }
78}
79
80void func_800F0D80(void) {
81 Unk8a160Outer* outer;
82 s32 i;
83 s32 j;
84
85 for (i = 0; i < ARRAY_COUNT(D_8010D000); i++, outer++) {
86 outer = &D_8010D000[i];
87
88 if (outer->subs[0].alive) {
89 outer->subs[0].timeLeft--;
90 outer->subs[0].lifetime++;
91
92 if (outer->subs[0].timeLeft < 0) {
93 outer->subs[0].alive = FALSE;
94 } else {
95 Unk8a160* sub = &outer->subs[0];
96 s32 baseTimeLeft = sub->timeLeft;
97 f32 baseX = sub->x;
98 f32 baseY = sub->y;
99
100 sub++;
101 for (j = 1; j < ARRAY_COUNT(outer->subs); j++, sub++) {
102 sub->lodVal++;
103 if (sub->lodVal >= 30) {
104 if (baseTimeLeft < 30) {
105 sub->lodVal = -31;
106 } else {
107 sub->lodVal = 0;
108 }
109 }
110
111 if (sub->lodVal >= 0) {
112 if (sub->lodVal == 0) {
113 f32 tx = D_80109820[j - 1].x;
114 f32 ty = D_80109820[j - 1].y;
115 u8 t = 127;
116
117 sub->vel.x = tx * 0.1;
118 sub->vel.y = -ty * 0.1;
119 sub->x = baseX;
120 sub->y = baseY;
121 sub->scale = 1.0f;
122 sub->rgba.r = rand_int(t);
123 sub->rgba.g = rand_int(t - sub->rgba.r);
124 sub->rgba.b = rand_int(t - sub->rgba.g - sub->rgba.r);
125 sub->rgba.a = 255;
126 sub->rgba.r += 128;
127 sub->rgba.g += 128;
128 sub->rgba.b += 128;
129 }
130 sub->x += sub->vel.x;
131 sub->y += sub->vel.y;
132 sub->vel.x *= 0.92;
133 sub->vel.y *= 0.92;
134 sub->scale = (f32) D_80109800[sub->lodVal] * 0.04;
135 }
136 }
137 }
138 }
139 }
140}
141
142void func_800F102C(void) {
143 Matrix4f sp20, sp60;
144 Unk8a160Outer* outer;
145 s32 i;
146 s32 j;
147
148 gDPPipeSync(gMainGfxPos++);
149 gSPSegment(gMainGfxPos++, 0x00, 0x00000000);
150 gDPSetScissor(gMainGfxPos++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
151 gSPViewport(gMainGfxPos++, &D_801096B0);
152
153 guOrthoF(sp20, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, -100.0f, 100.0f, 1.0f);
155
156 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
157 gSPDisplayList(gMainGfxPos++, D_80109710);
158 gDPSetEnvColor(gMainGfxPos++, 127, 127, 127, 127);
159
160 for (i = 0; i < ARRAY_COUNT(D_8010D000); i++, outer++) {
161 outer = &D_8010D000[i];
162
163 if (outer->subs[0].alive) {
164 Unk8a160* it = &outer->subs[0];
165 f32 baseScale = it->scale;
166
167 it++;
168 for (j = 1; j < ARRAY_COUNT(outer->subs); j++, it++) {
169 if (it->lodVal >= 0) {
170 guPositionF(sp60, 0.0f, 0.0f, gGameStatusPtr->frameCounter * 10, it->scale * baseScale,
171 it->x, it->y, 0.0f);
173
175 G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
176 gDPSetPrimColor(gMainGfxPos++, 0, 80 - it->lodVal, it->rgba.r, it->rgba.g, it->rgba.b, it->rgba.a);
177 gSPDisplayList(gMainGfxPos++, D_801097D8);
178 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
179 }
180 }
181 }
182 }
183}
Unk8a160 subs[57]
void func_800F102C(void)
u8 D_80109800[32]
void func_800F0CB0(s32 arg0, f32 x, f32 y, f32 scale)
void func_800F0D80(void)
Vec2b D_80109820[56]
void func_800F0D5C(void)
Vp D_801096B0
BSS Unk8a160Outer D_8010D000[1]
Color_RGBA8 rgba
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guOrthoF
#define guMtxF2L
#define rand_int
#define guPositionF
#define INCLUDE_IMG(FILENAME, SYMBOLNAME)
#define SCREEN_WIDTH
Definition macros.h:105
#define BSS
Definition macros.h:7
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define SCREEN_HEIGHT
Definition macros.h:106
GameStatus * gGameStatusPtr
Definition main_loop.c:32
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
DisplayContext * gDisplayContext
Definition cam_main.c:16