Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
balloon.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects_internal.h"
3
4extern Gfx D_09001280_3958F0[];
5extern Gfx D_09001358_3959C8[];
6extern Gfx D_09001430_395AA0[];
7extern Gfx D_09001508_395B78[];
8
10
11void balloon_init(EffectInstance* effect);
12void balloon_update(EffectInstance* effect);
13void balloon_render(EffectInstance* effect);
14void balloon_appendGfx(void* effect);
15
16EffectInstance* balloon_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5) {
18 EffectInstance* effect;
19 BalloonFXData* data;
20 BalloonFXData* part;
21 s32 numParts = 1;
22
23 bp.init = balloon_init;
26 bp.unk_00 = 0;
27 bp.renderUI = NULL;
28 bp.effectID = EFFECT_BALLOON;
29
30 effect = create_effect_instance(&bp);
31 effect->numParts = numParts;
32
33 data = general_heap_malloc(numParts * sizeof(*data));
34 effect->data.balloon = data;
35 part = data;
36
37 ASSERT(data != NULL);
38
39 part->unk_00 = arg0;
40 part->unk_04 = arg1;
41 part->unk_08 = arg2;
42 part->unk_0C = arg3;
43 part->unk_10 = 0.0f;
44 part->unk_1C = arg5;
45 part->unk_18 = 0.67f;
46 part->unk_20 = 0;
47 part->unk_14 = arg4;
48
49 return effect;
50}
51
53}
54
56 BalloonFXData* part = effect->data.balloon;
57
58 part->unk_1C--;
59 part->unk_20++;
60
61 if (part->unk_1C < 0) {
62 remove_effect(effect);
63 return;
64 }
65
66 part->unk_10 += part->unk_14;
67 if (part->unk_10 > 2.0f) {
68 part->unk_10 = 2.0f;
69 }
70 part->unk_08 += part->unk_10;
71}
72
74 RenderTask renderTask;
75 RenderTask* retTask;
76
77 renderTask.appendGfx = balloon_appendGfx;
78 renderTask.appendGfxArg = effect;
79 renderTask.dist = 0;
81
82 retTask = queue_render_task(&renderTask);
84}
85
86void balloon_appendGfx(void* effect) {
87 Matrix4f sp18;
88 Matrix4f sp58;
89 BalloonFXData* data = ((EffectInstance*)effect)->data.balloon;
90 s32 idx = data->unk_00;
91
92 gDPPipeSync(gMainGfxPos++);
93 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
94
95 guTranslateF(sp18, data->unk_04, data->unk_08, data->unk_0C);
96 guRotateF(sp58, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
97 guMtxCatF(sp58, sp18, sp18);
98 guScaleF(sp58, data->unk_18, data->unk_18, 1.0f);
99 guMtxCatF(sp58, sp18, sp18);
101
103 G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
104 gSPDisplayList(gMainGfxPos++, D_E00963E0[idx]);
105 gSPDisplayList(gMainGfxPos++, D_09001508_395B78);
106 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
107 gDPPipeSync(gMainGfxPos++);
108}
Gfx D_09001508_395B78[]
Gfx D_09001430_395AA0[]
void balloon_render(EffectInstance *effect)
Definition balloon.c:73
void balloon_update(EffectInstance *effect)
Definition balloon.c:55
void balloon_init(EffectInstance *effect)
Definition balloon.c:52
Gfx D_09001280_3958F0[]
Gfx D_09001358_3959C8[]
void balloon_appendGfx(void *effect)
Definition balloon.c:86
EffectInstance * balloon_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s32 arg5)
Definition balloon.c:16
Gfx * D_E00963E0[]
Definition balloon.c:9
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define general_heap_malloc
#define guRotateF
#define queue_render_task
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define remove_effect
#define create_effect_instance
#define guScaleF
struct BalloonFXData * balloon
Definition effects.h:2539
EffectData data
Definition effects.h:2605
#define ASSERT(condition)
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_SURFACE_OPA
Definition enums.h:3264
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
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
void * appendGfxArg
void(* appendGfx)(void *)
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