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

Go to the source code of this file.

Functions

void sleep_bubble_appendGfx (void *effect)
 
void sleep_bubble_init (EffectInstance *effect)
 
void sleep_bubble_update (EffectInstance *effect)
 
void sleep_bubble_render (EffectInstance *effect)
 
void sleep_bubble_main (s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, EffectInstance **arg6)
 

Variables

f32 D_E00529E0 []
 
Vtx D_09000180_35D690 []
 
Gfx D_090002E0_35D7F0 []
 
Gfx D_09000390_35D8A0 []
 
Gfx D_09000440_35D950 []
 

Function Documentation

◆ sleep_bubble_appendGfx()

void sleep_bubble_appendGfx ( void * effect)

Definition at line 127 of file sleep_bubble.c.

127 {
128 SleepBubbleFXData* data = ((EffectInstance*)effect)->data.sleepBubble;
129 Matrix4f sp18, sp58;
130 s32 timeLeft;
131 s32 i;
132
133 gDPPipeSync(gMainGfxPos++);
134 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
135
136 timeLeft = data->timeLeft;
137 if (timeLeft == 0) {
138 gSPDisplayList(gMainGfxPos++, D_09000440_35D950);
139 } else if (timeLeft == 1) {
140 gSPDisplayList(gMainGfxPos++, D_09000390_35D8A0);
141 } else {
142 gSPDisplayList(gMainGfxPos++, D_090002E0_35D7F0);
143 }
144
145 guTranslateF(sp18, data->pos.x, data->pos.y, data->pos.z);
147
149 G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
150 gSPVertex(gMainGfxPos++, &D_09000180_35D690[1], 1, 0);
151
152 guRotateF(sp18, data->unk_10, 0.0f, 0.0f, 1.0f);
155 G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
156 guRotateF(sp18, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
157 guTranslateF(sp58, data->unk_C4, data->unk_C8, 0.0f);
158 guMtxCatF(sp58, sp18, sp18);
160
162 G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
163 gSPVertex(gMainGfxPos++, &D_09000180_35D690[0], 1, 1);
164
165 for (i = 0; i < ARRAY_COUNT(data->points); i++) {
166 guTranslateF(sp18, data->points[i].x, data->points[i].y, 0.0f);
169 G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
170 gSPVertex(gMainGfxPos++, &D_09000180_35D690[i + 2], 1, i + 2);
171 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
172 }
173
174 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
175 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
176
177 if (timeLeft < 100) {
178 gSP1Triangle(gMainGfxPos++, 21, 2, 1, 0);
179
180 for (i = 0; i < ARRAY_COUNT(data->points) - 1; i++) {
181 gSP1Triangle(gMainGfxPos++, i + 2, i + 3, 1, 0);
182 }
183 } else {
184 gSP1Triangle(gMainGfxPos++, 0, 1, 2, 0);
185 gSP1Triangle(gMainGfxPos++, 0, 21, 1, 0);
186
187 for (i = 0; i < ARRAY_COUNT(data->points) - 1; i++) {
188 gSP1Triangle(gMainGfxPos++, i + 2, i + 3, 1, 0);
189 }
190 }
191}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
Vec2f points[20]
Definition effects.h:622
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
Gfx D_090002E0_35D7F0[]
Gfx D_09000390_35D8A0[]
Gfx D_09000440_35D950[]
Vtx D_09000180_35D690[]
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 sleep_bubble_render().

◆ sleep_bubble_init()

void sleep_bubble_init ( EffectInstance * effect)

Definition at line 54 of file sleep_bubble.c.

54 {
55}

Referenced by sleep_bubble_main().

◆ sleep_bubble_update()

void sleep_bubble_update ( EffectInstance * effect)

Definition at line 58 of file sleep_bubble.c.

58 {
59 SleepBubbleFXData* part = effect->data.sleepBubble;
60 f32* xPtr = &part->points->x;
61 f32* yPtr;
62 s32 xAngle, yAngle, i, timeLeft, unk_20;
63 f32 angle, temp1, temp2;
64
65 if (part->timeLeft < 100) {
66 part->timeLeft--;
67 }
68
69 part->unk_20++;
70 if (part->unk_20 > 324000) {
71 part->unk_20 = 256;
72 }
73
74 if (part->timeLeft < 0) {
75 remove_effect(effect);
76 return;
77 }
78
79 unk_20 = part->unk_20;
80 timeLeft = part->timeLeft;
81
82 temp1 = part->unk_18 + (part->unk_14 - part->unk_18) * 0.1f;
83 part->unk_18 = temp1;
84 temp2 = temp1 + (temp1 * sin_deg(unk_20 * 3)) * 0.1;
85
86 i = 0;
87 yPtr = &part->points->y;
88 xAngle = yAngle = i;
89
90 for (i = 0; i < ARRAY_COUNT(part->points); i++) {
91 angle = i * 360.0f / 21.0f + 17.0f;
92
93 *xPtr = temp2 * sin_deg(angle);
94 *yPtr = -temp2 * cos_deg(angle);
95
96 *xPtr += sin_deg((f32)unk_20 * (sin_deg(xAngle) * 0.1 + 2.0) + (i + 5.0f) * 30.0f) * 1.5;
97 *yPtr += cos_deg((f32)unk_20 * (cos_deg(yAngle) * 0.1 + 2.0) + (i + 5.0f) * 50.0f) * 1.5;
98
99 xAngle += 53;
100 yAngle += 36;
101
102 xPtr += 2;
103 yPtr += 2;
104 }
105
106 part->unk_C4 = 0.0f;
107 if (timeLeft < 100) {
108 part->unk_C8 += 1.0f;
109 } else {
110 part->unk_C8 = temp2 * 1.2;
111 }
112}
#define sin_deg
#define remove_effect
#define cos_deg
struct SleepBubbleFXData * sleepBubble
Definition effects.h:2505
EffectData data
Definition effects.h:2605

Referenced by sleep_bubble_main().

◆ sleep_bubble_render()

void sleep_bubble_render ( EffectInstance * effect)

Definition at line 114 of file sleep_bubble.c.

114 {
115 RenderTask renderTask;
116 RenderTask* retTask;
117
119 renderTask.appendGfxArg = effect;
120 renderTask.dist = 0;
122
123 retTask = queue_render_task(&renderTask);
125}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void sleep_bubble_appendGfx(void *effect)
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by sleep_bubble_main().

◆ sleep_bubble_main()

void sleep_bubble_main ( s32 arg0,
f32 arg1,
f32 arg2,
f32 arg3,
f32 arg4,
f32 arg5,
EffectInstance ** arg6 )

Definition at line 21 of file sleep_bubble.c.

21 {
23 EffectBlueprint* bpPtr = &bp;
24 EffectInstance* effect;
26 s32 numParts = 1;
27
28 bp.unk_00 = 0;
32 bp.renderUI = NULL;
33 bp.effectID = EFFECT_SLEEP_BUBBLE;
34
35 effect = create_effect_instance(bpPtr);
36 effect->numParts = numParts;
37 part = effect->data.sleepBubble = general_heap_malloc(numParts * sizeof(*part));
38
39 ASSERT(effect->data.sleepBubble != NULL);
40
41 part->unk_00 = arg0;
42 part->pos.x = arg1;
43 part->pos.y = arg2;
44 part->pos.z = arg3;
45 part->unk_10 = arg5;
46 part->timeLeft = 100;
47 part->unk_14 = arg4;
48 part->unk_18 = 0;
49 part->unk_20 = 0;
50
51 *arg6 = effect;
52}
#define general_heap_malloc
#define create_effect_instance
#define ASSERT(condition)
void sleep_bubble_render(EffectInstance *effect)
void sleep_bubble_update(EffectInstance *effect)
void sleep_bubble_init(EffectInstance *effect)
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_E00529E0

f32 D_E00529E0[]
Initial value:
= {
4.4f, 3.2f, 5.4f, 2.7f, 6.0f, 4.9f, 5.2f, 3.1f, 2.4f, 4.5f,
2.6f, 5.7f, 3.8f, 2.9f, 3.1f, 5.2f, 2.3f, 5.4f, 3.5f, 2.6f,
2.4f, 3.1f, 5.2f, 4.9f, 6.0f, 2.7f, 5.4f, 3.2f, 4.4f, 2.6f,
3.5f, 5.4f, 2.3f, 5.2f, 3.1f, 2.9f, 3.8f, 5.7f, 2.6f, 4.5f
}

Definition at line 9 of file sleep_bubble.c.

9 {
10 4.4f, 3.2f, 5.4f, 2.7f, 6.0f, 4.9f, 5.2f, 3.1f, 2.4f, 4.5f,
11 2.6f, 5.7f, 3.8f, 2.9f, 3.1f, 5.2f, 2.3f, 5.4f, 3.5f, 2.6f,
12 2.4f, 3.1f, 5.2f, 4.9f, 6.0f, 2.7f, 5.4f, 3.2f, 4.4f, 2.6f,
13 3.5f, 5.4f, 2.3f, 5.2f, 3.1f, 2.9f, 3.8f, 5.7f, 2.6f, 4.5f
14};

◆ D_09000180_35D690

Vtx D_09000180_35D690[]
extern

Referenced by sleep_bubble_appendGfx().

◆ D_090002E0_35D7F0

Gfx D_090002E0_35D7F0[]
extern

Referenced by sleep_bubble_appendGfx().

◆ D_09000390_35D8A0

Gfx D_09000390_35D8A0[]
extern

Referenced by sleep_bubble_appendGfx().

◆ D_09000440_35D950

Gfx D_09000440_35D950[]
extern

Referenced by sleep_bubble_appendGfx().