Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
merlin_house_stars.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects_internal.h"
3
4extern Gfx D_09001000_3A6BE0[];
5extern Gfx D_09001418_3A6FF8[];
6
10void merlin_house_stars_appendGfx(void* effect);
11
12EffectInstance* merlin_house_stars_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3) {
14 EffectInstance* effect;
16 s32 numParts = 1;
17
21 bp.unk_00 = 0;
22 bp.renderUI = NULL;
23 bp.effectID = EFFECT_MERLIN_HOUSE_STARS;
24
25 effect = create_effect_instance(&bp);
26 effect->numParts = numParts;
27 data = effect->data.merlinHouseStars = general_heap_malloc(numParts * sizeof(*data));
28 ASSERT(effect->data.merlinHouseStars != NULL);
29
30 data->unk_04 = 100;
31 data->unk_00 = arg0;
32 data->alpha = 255;
33 data->unk_0C = arg1;
34 data->unk_10 = arg2;
35 data->unk_14 = arg3;
36 data->unk_08 = 0;
37 data->unk_1C = data->unk_20 = 0.0f;
38 data->unk_24 = data->unk_28 = 0.0f;
39 data->unk_2C = 1.2f;
40 data->unk_30 = 0.4f;
41 data->unk_34 = -1.0f;
42 data->unk_38 = 0.4f;
43
44 return effect;
45}
46
49
52 s32 unk_04;
53
54 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
55 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
56 data->unk_04 = 30;
57 }
58
59 if (data->unk_04 < 100) {
60 data->unk_04--;
61 }
62
63 data->unk_08++;
64
65 if (data->unk_04 < 0) {
66 remove_effect(effect);
67 return;
68 }
69
70 data->unk_1C += data->unk_2C;
71 data->unk_20 += data->unk_30;
72 data->unk_24 += data->unk_34;
73 data->unk_28 += data->unk_38;
74
75 unk_04 = data->unk_04;
76
77 if (data->unk_08 < 17) {
78 data->alpha = data->unk_08 * 16 - 1;
79 }
80
81 if (unk_04 < 16) {
82 data->alpha = unk_04 * 16;
83 }
84
85 if (data->unk_1C < 0.0f) {
86 data->unk_1C += 128.0f;
87 } else if (data->unk_1C > 128.0f) {
88 data->unk_1C -= 128.0f;
89 }
90
91 data->unk_20 += data->unk_30;
92 if (data->unk_20 < 0.0f) {
93 data->unk_20 += 128.0f;
94 } else if (data->unk_20 > 128.0f) {
95 data->unk_20 -= 128.0f;
96 }
97
98 data->unk_24 += data->unk_34;
99 if (data->unk_24 < 0.0f) {
100 data->unk_24 += 128.0f;
101 } else if (data->unk_24 > 128.0f) {
102 data->unk_24 -= 128.0f;
103 }
104
105 data->unk_28 += data->unk_38;
106 if (data->unk_28 < 0.0f) {
107 data->unk_28 += 128.0f;
108 } else if (data->unk_28 > 128.0f) {
109 data->unk_28 -= 128.0f;
110 }
111}
112
114 RenderTask renderTask;
115 RenderTask* retTask;
116
118 renderTask.appendGfxArg = effect;
119 renderTask.dist = 0;
121
122 retTask = queue_render_task(&renderTask);
124}
125
126void func_E00A639C(void) {
127}
128
129#define PM_CC1_MERLIN_STARS 0, 0, 0, 1, TEXEL1, 0, PRIMITIVE, TEXEL0
130#define PM_CC2_MERLIN_STARS 0, 0, 0, COMBINED, COMBINED, 0, ENVIRONMENT, 0
131
133 MerlinHouseStarsFXData* data = ((EffectInstance*)effect)->data.merlinHouseStars;
134 s32 envAlpha = data->alpha;
135 Matrix4f sp10;
136 Matrix4f sp50;
137 s32 uls;
138 s32 ult;
139
140 gDPPipeSync(gMainGfxPos++);
141 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
142
143 guTranslateF(sp10, data->unk_0C, data->unk_10, data->unk_14);
144 guScaleF(sp50, 0.96f, 0.96f, 0.96f);
145 guMtxCatF(sp50, sp10, sp10);
147
148 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
149 gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, 127);
150 gDPSetEnvColor(gMainGfxPos++, 0, 0, 0, envAlpha);
152 gSPDisplayList(gMainGfxPos++, D_09001000_3A6BE0);
153
154 uls = data->unk_1C * 4.0f;
155 ult = data->unk_20 * 4.0f;
156 gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, uls, ult, uls + 252, ult + 252);
157
158 uls = data->unk_24 * 4.0f;
159 ult = data->unk_28 * 4.0f;
160 gDPSetTileSize(gMainGfxPos++, 1, uls, ult, uls + 252, ult + 252);
161
162 gSPDisplayList(gMainGfxPos++, D_09001418_3A6FF8);
163 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
164 gDPPipeSync(gMainGfxPos++);
165}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define general_heap_malloc
#define queue_render_task
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define remove_effect
#define create_effect_instance
#define guScaleF
struct MerlinHouseStarsFXData * merlinHouseStars
Definition effects.h:2547
EffectData data
Definition effects.h:2605
#define ASSERT(condition)
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
EffectInstance * merlin_house_stars_main(s32 arg0, f32 arg1, f32 arg2, f32 arg3)
void merlin_house_stars_appendGfx(void *effect)
#define PM_CC1_MERLIN_STARS
#define PM_CC2_MERLIN_STARS
void merlin_house_stars_init(EffectInstance *effect)
void func_E00A639C(void)
void merlin_house_stars_render(EffectInstance *effect)
Gfx D_09001000_3A6BE0[]
Gfx D_09001418_3A6FF8[]
void merlin_house_stars_update(EffectInstance *effect)
#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 *)
Gfx * gMainGfxPos
Definition cam_main.c:15
u16 gMatrixListPos
Definition main_loop.c:45
DisplayContext * gDisplayContext
Definition cam_main.c:16