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

Go to the source code of this file.

Functions

void got_item_outline_init (EffectInstance *effect)
 
void got_item_outline_update (EffectInstance *effect)
 
void got_item_outline_render (EffectInstance *effect)
 
void got_item_outline_appendGfx (void *effect)
 
void got_item_outline_main (s32 type, f32 posX, f32 posY, f32 posZ, f32 arg4, EffectInstance **outEffect)
 
void func_E003621C (void)
 

Variables

IMG_BIN D_09000000_345B40 [][0x1000]
 
IMG_BIN D_09004000_349B40 [][0x1000]
 
Gfx D_09008100_34DC40 []
 
Gfx D_09008170_34DCB0 []
 
Gfx D_09008190_34DCD0 []
 
Gfx D_090081A8_34DCE8 []
 
Gfx D_090081C0_34DD00 []
 
Gfx * D_E0036630 []
 
u8 AnimScaleIn [] = { 60, 120, 140, 147, 149, 150 }
 
u8 AnimScaleOut [] = { 150, 150, 150, 150, 150, 150 }
 

Function Documentation

◆ got_item_outline_init()

void got_item_outline_init ( EffectInstance * effect)

Definition at line 60 of file got_item_outline.c.

60 {
61}

Referenced by got_item_outline_main().

◆ got_item_outline_update()

void got_item_outline_update ( EffectInstance * effect)

Definition at line 63 of file got_item_outline.c.

63 {
65 s32 time;
66
67 if (data->timeLeft < 100) {
68 data->timeLeft--;
69 if (data->timeLeft < 0) {
70 remove_effect(effect);
71 return;
72 }
73 }
74
75 data->lifetime++;
76 time = data->lifetime;
77
78 if (data->timeLeft < 6) {
79 data->scale = AnimScaleOut[5 - data->timeLeft] / 150.0f;
80 data->alpha /= 2;
81 } else {
82 if (time < 7) {
83 data->scale = AnimScaleIn[time - 1] / 150.0f;
84 } else {
85 data->scale = 1.0f;
86 }
87
88 if (time >= 7) {
89 data->lifetime = 7;
90 }
91 }
92}
#define remove_effect
struct GotItemOutlineFXData * gotItemOutline
Definition effects.h:2491
EffectData data
Definition effects.h:2605
u8 AnimScaleOut[]
u8 AnimScaleIn[]

Referenced by got_item_outline_main().

◆ got_item_outline_render()

void got_item_outline_render ( EffectInstance * effect)

Definition at line 94 of file got_item_outline.c.

94 {
95 RenderTask renderTask;
96 RenderTask* retTask;
97
99 renderTask.appendGfxArg = effect;
100 renderTask.dist = 0;
102
103 retTask = queue_render_task(&renderTask);
105}
#define queue_render_task
@ RENDER_TASK_FLAG_REFLECT_FLOOR
Definition enums.h:3318
@ RENDER_MODE_CLOUD_NO_ZCMP
Definition enums.h:3311
void got_item_outline_appendGfx(void *effect)
void * appendGfxArg
void(* appendGfx)(void *)

Referenced by got_item_outline_main().

◆ got_item_outline_appendGfx()

void got_item_outline_appendGfx ( void * effect)

Definition at line 110 of file got_item_outline.c.

110 {
111 GotItemOutlineFXData* data = ((EffectInstance*)effect)->data.gotItemOutline;
112 s32 type = data->type;
113 f32 scale = data->scale;
114 Matrix4f mtxTransform;
115 Matrix4f mtxTemp;
116 s32 i;
117
118 if (scale != 0.0f) {
119 gDPPipeSync(gMainGfxPos++);
120 gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data));
121 gSPDisplayList(gMainGfxPos++, D_09008100_34DC40);
122
123 if (type == 0) {
124 gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 255, data->alpha);
125 gDPSetEnvColor(gMainGfxPos++, 0, 0, 0, 255);
126 } else {
127 gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 255, data->alpha);
128 gDPSetEnvColor(gMainGfxPos++, 255, 255, 0, 255);
129 }
130
131 guTranslateF(mtxTransform, data->pos.x, data->pos.y, data->pos.z);
132 guRotateF(mtxTemp, -gCameras[gCurrentCameraID].curYaw, 0.0f, 1.0f, 0.0f);
133 guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
134 guTranslateF(mtxTemp, 0.0f, 0.0f, -2.0f);
135 guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
136
137 scale *= 0.6;
138
139 guScaleF(mtxTemp, scale, scale, 1.0f);
140 guMtxCatF(mtxTemp, mtxTransform, mtxTransform);
142
143 gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
144
145 for (i = 0; i < 4; i++) {
146 IMG_PTR img;
147
148 if (type == 0) {
149 img = D_09000000_345B40[i];
150 } else {
151 img = D_09004000_349B40[i];
152 }
153
154 gDPSetTextureImage(gMainGfxPos++, G_IM_FMT_IA, G_IM_SIZ_8b, 128, img);
155 gDPSetTile(gMainGfxPos++, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 0, G_TX_LOADTILE, 0,
156 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD,
157 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
158 gDPLoadSync(gMainGfxPos++);
159 gDPLoadTile(gMainGfxPos++, G_TX_LOADTILE, 0, 0, 508, 124);
160 gDPPipeSync(gMainGfxPos++);
161 gDPSetTile(gMainGfxPos++, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 0, G_TX_RENDERTILE, 0,
162 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD,
163 G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
164 gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, 0, 0, 508, 124);
165 gSPDisplayList(gMainGfxPos++, D_E0036630[i]);
166 }
167
168 gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW);
169 gDPPipeSync(gMainGfxPos++);
170 }
171}
Mtx matrixStack[0x200]
#define IMG_PTR
f32 Matrix4f[4][4]
#define guRotateF
#define guMtxF2L
#define guTranslateF
#define guMtxCatF
#define guScaleF
Gfx * D_E0036630[]
IMG_BIN D_09000000_345B40[][0x1000]
IMG_BIN D_09004000_349B40[][0x1000]
Gfx D_09008100_34DC40[]
#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 got_item_outline_render().

◆ got_item_outline_main()

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

Definition at line 24 of file got_item_outline.c.

31 {
33 EffectInstance* effect;
35 s32 numParts = 1;
36
40 bp.unk_00 = 0;
41 bp.renderUI = NULL;
42 bp.effectID = EFFECT_GOT_ITEM_OUTLINE;
43
44 effect = create_effect_instance(&bp);
45 effect->numParts = numParts;
46 data = effect->data.gotItemOutline = general_heap_malloc(numParts * sizeof(*data));
47 ASSERT(effect->data.gotItemOutline != NULL);
48
49 data->timeLeft = 100;
50 data->type = type;
51 data->lifetime = 0;
52 data->pos.x = posX;
53 data->pos.y = posY;
54 data->pos.z = posZ;
55 data->alpha = 255;
56
57 *outEffect = effect;
58}
#define general_heap_malloc
#define create_effect_instance
#define ASSERT(condition)
void got_item_outline_render(EffectInstance *effect)
void got_item_outline_init(EffectInstance *effect)
void got_item_outline_update(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

◆ func_E003621C()

void func_E003621C ( void )

Definition at line 107 of file got_item_outline.c.

107 {
108}

Variable Documentation

◆ D_09000000_345B40

IMG_BIN D_09000000_345B40[][0x1000]
extern

◆ D_09004000_349B40

IMG_BIN D_09004000_349B40[][0x1000]
extern

◆ D_09008100_34DC40

Gfx D_09008100_34DC40[]
extern

◆ D_09008170_34DCB0

Gfx D_09008170_34DCB0[]
extern

◆ D_09008190_34DCD0

Gfx D_09008190_34DCD0[]
extern

◆ D_090081A8_34DCE8

Gfx D_090081A8_34DCE8[]
extern

◆ D_090081C0_34DD00

Gfx D_090081C0_34DD00[]
extern

◆ D_E0036630

Gfx* D_E0036630[]
Initial value:
= {
}
Gfx D_090081C0_34DD00[]
Gfx D_09008170_34DCB0[]
Gfx D_09008190_34DCD0[]
Gfx D_090081A8_34DCE8[]

Definition at line 12 of file got_item_outline.c.

Referenced by got_item_outline_appendGfx().

◆ AnimScaleIn

u8 AnimScaleIn[] = { 60, 120, 140, 147, 149, 150 }

Definition at line 16 of file got_item_outline.c.

16{ 60, 120, 140, 147, 149, 150 };

Referenced by got_item_outline_update().

◆ AnimScaleOut

u8 AnimScaleOut[] = { 150, 150, 150, 150, 150, 150 }

Definition at line 17 of file got_item_outline.c.

17{ 150, 150, 150, 150, 150, 150 };

Referenced by got_item_outline_update().