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

Go to the source code of this file.

Functions

void ending_decals_init (EffectInstance *effect)
 
void ending_decals_update (EffectInstance *effect)
 
void ending_decals_render (EffectInstance *effect)
 
void ending_decals_appendGfx (void *effect)
 
void ending_decals_main (s32 type, f32 posX, f32 posY, f32 posZ, f32 arg4, EffectInstance **outEffect)
 

Variables

Gfx D_09001E40_36CD20 []
 
Gfx D_09001EA8_36CD88 []
 
Gfx D_09001F10_36CDF0 []
 
Gfx D_09001F78_36CE58 []
 
Gfx D_09002058_36CF38 []
 
Gfx D_09002078_36CF58 []
 
Gfx * D_E00685B0 []
 
Gfx * D_E00685BC []
 
Gfx * D_E00685F4 []
 

Function Documentation

◆ ending_decals_init()

void ending_decals_init ( EffectInstance * effect)

Definition at line 83 of file ending_decals.c.

83 {
84}

Referenced by ending_decals_main().

◆ ending_decals_update()

void ending_decals_update ( EffectInstance * effect)

Definition at line 86 of file ending_decals.c.

86 {
87 EndingDecalsFXData* data = effect->data.endingDecals;
88
89 if (effect->flags & FX_INSTANCE_FLAG_DISMISS) {
90 effect->flags &= ~FX_INSTANCE_FLAG_DISMISS;
91 data->unk_1C = 10;
92 }
93
94 if (data->unk_1C < 11) {
95 data->unk_1C--;
96 }
97
98 data->unk_20++;
99
100 if (data->unk_1C < 0) {
101 remove_effect(effect);
102 return;
103 }
104
105 if (data->unk_1C < 10) {
106 data->haloAlpha -= 25;
107 if (data->haloAlpha < 0) {
108 data->haloAlpha = 0;
109 }
110 }
111}
#define remove_effect
struct EndingDecalsFXData * endingDecals
Definition effects.h:2516
EffectData data
Definition effects.h:2605
@ FX_INSTANCE_FLAG_DISMISS
Definition enums.h:3517

Referenced by ending_decals_main().

◆ ending_decals_render()

void ending_decals_render ( EffectInstance * effect)

Definition at line 113 of file ending_decals.c.

113 {
114 EndingDecalsFXData* data = effect->data.endingDecals;
115 RenderTask renderTask;
116 RenderTask* renderTaskPtr = &renderTask;
117 RenderTask* retTask;
118
119 renderTask.appendGfxArg = effect;
121 renderTask.dist = 10;
122 if (data->type == 0) {
123 renderTaskPtr->renderMode = RENDER_MODE_SURFACE_OPA;
124 } else {
125 renderTaskPtr->renderMode = RENDER_MODE_CLOUD_NO_ZCMP;
126 }
127
128 retTask = queue_render_task(renderTaskPtr);
130}
#define queue_render_task
void ending_decals_appendGfx(void *effect)
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_SURFACE_OPA
Definition enums.h:3264
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by ending_decals_main().

◆ ending_decals_appendGfx()

void ending_decals_appendGfx ( void * effect)

Definition at line 132 of file ending_decals.c.

132 {
133 EndingDecalsFXData* data = ((EffectInstance*)effect)->data.endingDecals;
134 Gfx* dlist1;
135 Gfx* dlist2;
136 u32 unk_20;
137 s32 alpha;
138 f64 temp_f64;
139 Matrix4f sp20;
140
141 unk_20 = data->unk_20;
142 dlist1 = D_E00685F4[data->type];
143 dlist2 = D_E00685B0[data->type];
144
145 gDPPipeSync(gMainGfxPos++);
146 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
147
148 guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].curYaw, 0.0f, data->scale, data->pos.x, data->pos.y, data->pos.z);
150
151 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
152
153 temp_f64 = data->haloAlpha;
154 if (unk_20 % 2 == 0) {
155 alpha = temp_f64 * 0.97;
156 } else {
157 alpha = temp_f64;
158 }
159
160 gDPSetEnvColor(gMainGfxPos++, 26, 121, 29, 158);
161 gDPSetColorDither(gMainGfxPos++, G_CD_BAYER);
162 gDPSetAlphaDither(gMainGfxPos++, G_AD_PATTERN);
163 gSPDisplayList(gMainGfxPos++, dlist1);
164 gDPSetPrimColor(gMainGfxPos++, 0, 0, data->unk_24, data->unk_25, data->unk_26, alpha);
165 gDPSetEnvColor(gMainGfxPos++, data->unk_27, data->unk_28, data->unk_29, 0);
166
167 if (dlist2 == D_09001E40_36CD20) {
168 dlist2 = D_E00685BC[unk_20 % 14];
169 }
170
171 gSPDisplayList(gMainGfxPos++, dlist2);
172 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
173 gDPPipeSync(gMainGfxPos++);
174 gDPSetColorDither(gMainGfxPos++, G_CD_DISABLE);
175 gDPSetAlphaDither(gMainGfxPos++, G_AD_DISABLE);
176 gDPPipeSync(gMainGfxPos++);
177}
Mtx matrixStack[0x200]
f32 Matrix4f[4][4]
#define guMtxF2L
#define guPositionF
Gfx D_09001E40_36CD20[]
Gfx * D_E00685F4[]
Gfx * D_E00685B0[]
Gfx * D_E00685BC[]
#define VIRTUAL_TO_PHYSICAL(addr)
Definition macros.h:47
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 ending_decals_render().

◆ ending_decals_main()

void ending_decals_main ( s32 type,
f32 posX,
f32 posY,
f32 posZ,
f32 arg4,
EffectInstance ** outEffect )

Definition at line 31 of file ending_decals.c.

31 {
33 EffectInstance* effect;
35 s32 numParts = 1;
36
40 bp.unk_00 = 0;
41 bp.renderUI = NULL;
42 bp.effectID = EFFECT_ENDING_DECALS;
43
44 effect = create_effect_instance(&bp);
45 effect->numParts = numParts;
46 data = effect->data.endingDecals = general_heap_malloc(numParts * sizeof(*data));
47 ASSERT(effect->data.endingDecals != NULL);
48
49 data->type = type;
50 data->pos.x = posX;
51 data->pos.y = posY;
52 data->pos.z = posZ;
53 data->haloAlpha = 255;
54 data->unk_14 = arg4;
55 data->scale = arg4;
56 data->unk_1C = 100;
57 data->unk_20 = 0;
58
59 switch (type) {
60 case 0:
61 case 1:
62 data->unk_24 = 0;
63 data->unk_25 = 0;
64 data->unk_26 = 0;
65 data->unk_27 = 255;
66 data->unk_28 = 255;
67 data->unk_29 = 255;
68 break;
69 case 2:
70 default:
71 data->unk_24 = 255;
72 data->unk_25 = 255;
73 data->unk_26 = 255;
74 data->unk_27 = 225;
75 data->unk_28 = 255;
76 data->unk_29 = 235;
77 break;
78 }
79
80 *outEffect = effect;
81}
#define general_heap_malloc
#define create_effect_instance
#define ASSERT(condition)
void ending_decals_update(EffectInstance *effect)
void ending_decals_render(EffectInstance *effect)
void ending_decals_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_09001E40_36CD20

Gfx D_09001E40_36CD20[]
extern

Referenced by ending_decals_appendGfx().

◆ D_09001EA8_36CD88

Gfx D_09001EA8_36CD88[]
extern

◆ D_09001F10_36CDF0

Gfx D_09001F10_36CDF0[]
extern

◆ D_09001F78_36CE58

Gfx D_09001F78_36CE58[]
extern

◆ D_09002058_36CF38

Gfx D_09002058_36CF38[]
extern

◆ D_09002078_36CF58

Gfx D_09002078_36CF58[]
extern

◆ D_E00685B0

Gfx* D_E00685B0[]
Initial value:

Definition at line 11 of file ending_decals.c.

Referenced by ending_decals_appendGfx().

◆ D_E00685BC

◆ D_E00685F4

Gfx* D_E00685F4[]
Initial value:
= {
}
Gfx D_09002078_36CF58[]
Gfx D_09001F78_36CE58[]

Definition at line 22 of file ending_decals.c.

Referenced by ending_decals_appendGfx().