mirror of
https://github.com/zeldaret/mm.git
synced 2024-11-27 06:40:36 +00:00
Decompile z_eff_footmark.c
This commit is contained in:
parent
9bc4990814
commit
bdf36b85d3
@ -3070,14 +3070,14 @@ typedef union {
|
||||
_SHIFTL(dz, 0, 16))
|
||||
|
||||
#define gDPSetPrimColor(pkt, m, l, r, g, b, a) \
|
||||
{ \
|
||||
_DW({ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = (_SHIFTL(G_SETPRIMCOLOR, 24, 8) | \
|
||||
_SHIFTL(m, 8, 8) | _SHIFTL(l, 0, 8)); \
|
||||
_g->words.w1 = (_SHIFTL(r, 24, 8) | _SHIFTL(g, 16, 8) | \
|
||||
_SHIFTL(b, 8, 8) | _SHIFTL(a, 0, 8)); \
|
||||
}
|
||||
})
|
||||
|
||||
#define gsDPSetPrimColor(m, l, r, g, b, a) \
|
||||
{ \
|
||||
|
@ -1616,7 +1616,7 @@ void func_800EFAB8(GlobalContext* ctxt, s16 index); // func_800EFAB8
|
||||
void func_800EFBFC(GlobalContext* ctxt, s16 index); // func_800EFBFC
|
||||
void func_800EFD44(GlobalContext* ctxt, s16 index); // func_800EFD44
|
||||
void EffFootmark_Init(GlobalContext* ctxt); // func_800EFE60
|
||||
void EffFootmark_Add(GlobalContext* ctxt, z_Matrix* displayMatrix, Actor* actor, char id, Vector3f* location, u16 size, u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay); // func_800EFF04
|
||||
void EffFootmark_Add(GlobalContext* ctxt, z_Matrix* displayMatrix, Actor* actor, u8 id, Vector3f* location, u16 size, u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay); // func_800EFF04
|
||||
void EffFootmark_Update(GlobalContext* ctxt); // func_800F00BC
|
||||
void EffFootmark_Draw(GlobalContext* ctxt); // func_800F01C8
|
||||
void func_800F0390(GlobalContext* ctxt); // func_800F0390
|
||||
|
@ -1401,7 +1401,7 @@ struct GameAllocNode {
|
||||
};
|
||||
|
||||
struct ContextCommon {
|
||||
/* 0x00 */ GraphicsContext* graphicsContext;
|
||||
/* 0x00 */ GraphicsContext* gCtxt;
|
||||
/* 0x04 */ func_ptr update;
|
||||
/* 0x08 */ func_ptr fini;
|
||||
/* 0x0C */ func_ptr nextGameStateInit;
|
||||
@ -1909,7 +1909,7 @@ struct ActorPostDrawParams {
|
||||
};
|
||||
|
||||
struct GlobalContext {
|
||||
/* 0x00000 */ ContextCommon commonVars;
|
||||
/* 0x00000 */ ContextCommon common;
|
||||
/* 0x000A4 */ s16 currentScene;
|
||||
/* 0x000A6 */ u8 unkA6;
|
||||
/* 0x000A7 */ UNK_TYPE1 padA7[9];
|
||||
|
@ -516,8 +516,8 @@ extern cutscene_update_func D_801BB148[5]; // D_801BB148
|
||||
extern UNK_TYPE2 D_801BB15C; // D_801BB15C
|
||||
extern UNK_TYPE4 D_801BB160; // D_801BB160
|
||||
extern s801BB170 D_801BB170[118]; // D_801BB170
|
||||
extern UNK_TYPE1 D_801BC240; // D_801BC240
|
||||
extern UNK_TYPE1 D_801BC288; // D_801BC288
|
||||
extern Gfx D_801BC240[9]; // D_801BC240
|
||||
extern Gfx D_801BC288[3]; // D_801BC288
|
||||
extern UNK_TYPE1 D_801BC2A0; // D_801BC2A0
|
||||
extern UNK_TYPE1 D_801BC400; // D_801BC400
|
||||
extern UNK_TYPE1 D_801BC410; // D_801BC410
|
||||
|
@ -225,7 +225,7 @@ SECTIONS
|
||||
build/asm/z_debug_display.o(.text)
|
||||
build/asm/z_debug_mode.o(.text)
|
||||
build/asm/z_draw.o(.text)
|
||||
build/asm/z_eff_footmark.o(.text)
|
||||
build/src/code/z_eff_footmark.o(.text)
|
||||
build/asm/code_0x800F0390.o(.text)
|
||||
build/asm/code_0x800F05C0.o(.text)
|
||||
build/asm/code_0x800F07C0.o(.text)
|
||||
@ -352,7 +352,7 @@ SECTIONS
|
||||
build/asm/code_rodata_0x800E8EA0.o(.text)
|
||||
build/asm/code_rodata_z_debug_mode.o(.text)
|
||||
build/asm/code_rodata_z_draw.o(.text)
|
||||
build/asm/code_rodata_z_eff_footmark.o(.text)
|
||||
build/src/code/z_eff_footmark.o(.rodata)
|
||||
build/asm/code_rodata_0x800F1460.o(.text)
|
||||
build/asm/code_rodata_z_fcurve_data_skelanime.o(.text)
|
||||
build/asm/code_rodata_z_fireobj.o(.text)
|
||||
|
122
src/code/z_eff_footmark.c
Normal file
122
src/code/z_eff_footmark.c
Normal file
@ -0,0 +1,122 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
extern float fabsf(float);
|
||||
#pragma intrinsic (fabsf)
|
||||
|
||||
void EffFootmark_Init(GlobalContext* ctxt) {
|
||||
EffFootmark* footmark;
|
||||
s32 i;
|
||||
|
||||
for (footmark = ctxt->footmarks, i = 0; i < 100; i++, footmark++) {
|
||||
footmark->actor = NULL;
|
||||
footmark->location.x = 0;
|
||||
footmark->location.y = 0;
|
||||
footmark->location.z = 0;
|
||||
footmark->flags = 0;
|
||||
footmark->id = 0;
|
||||
footmark->alpha = 0;
|
||||
footmark->alphaChange = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void EffFootmark_Add(GlobalContext* ctxt, z_Matrix* displayMatrix, Actor* actor, u8 id, Vector3f* location, u16 size, u8 red, u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay) {
|
||||
s32 i;
|
||||
EffFootmark* footmark;
|
||||
EffFootmark* destination = NULL;
|
||||
EffFootmark* oldest = NULL;
|
||||
s32 isNew = 1;
|
||||
|
||||
for (footmark = ctxt->footmarks, i = 0; i < 100; i++, footmark++) {
|
||||
if (((actor == footmark->actor) && (footmark->id == id)) && ((footmark->flags & 1) == 0)) {
|
||||
if (fabsf((footmark->location).x - location->x) <= 1) {
|
||||
if (fabsf((footmark->location).z - location->z) <= 1) {
|
||||
isNew = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// This footmark is being re-added at a new location. Let's mark this one to start fading out.
|
||||
footmark->flags = 1;
|
||||
}
|
||||
|
||||
if (footmark->actor == NULL) {
|
||||
destination = footmark;
|
||||
} else {
|
||||
if (destination == NULL) {
|
||||
if ((oldest != NULL && footmark->age > oldest->age) || (oldest == NULL)) {
|
||||
oldest = footmark;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((isNew) && ((destination != NULL || (oldest != NULL)))) {
|
||||
if (destination == NULL) {
|
||||
destination = oldest;
|
||||
}
|
||||
SysMatrix_Copy(&destination->displayMatrix,displayMatrix);
|
||||
destination->actor = actor;
|
||||
destination->location.x = location->x;
|
||||
destination->location.y = location->y;
|
||||
destination->location.z = location->z;
|
||||
destination->flags = 0;
|
||||
destination->id = id;
|
||||
destination->red = red;
|
||||
destination->green = green;
|
||||
destination->blue = blue;
|
||||
destination->alpha = alpha;
|
||||
destination->alphaChange = alphaChange;
|
||||
destination->size = size;
|
||||
destination->fadeoutDelay = fadeoutDelay;
|
||||
destination->age = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void EffFootmark_Update(GlobalContext* ctxt) {
|
||||
EffFootmark* footmark;
|
||||
s32 i;
|
||||
|
||||
for (footmark = ctxt->footmarks, i = 0; i < 100; i++, footmark++) {
|
||||
if (footmark->actor != NULL) {
|
||||
if ((footmark->flags & 1) == 1) {
|
||||
if (footmark->age < 0xFFFFu) { // TODO replace with MAX_U16 or something
|
||||
footmark->age++;
|
||||
}
|
||||
|
||||
if (footmark->fadeoutDelay == 0) {
|
||||
if (footmark->alpha >= footmark->alphaChange + 0x1000) {
|
||||
footmark->alpha -= footmark->alphaChange;
|
||||
} else {
|
||||
footmark->actor = NULL;
|
||||
}
|
||||
} else if (footmark->fadeoutDelay > 0) {
|
||||
footmark->fadeoutDelay--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EffFootmark_Draw(GlobalContext* ctxt) {
|
||||
EffFootmark* footmark;
|
||||
s32 i;
|
||||
GraphicsContext *gCtxt = ctxt->common.gCtxt;
|
||||
|
||||
func_8012C448(ctxt->common.gCtxt);
|
||||
|
||||
gSPDisplayList(gCtxt->polyXlu.append++, D_801BC240);
|
||||
|
||||
for (footmark = ctxt->footmarks, i = 0; i < 100; i++, footmark++) {
|
||||
if (footmark->actor != NULL) {
|
||||
SysMatrix_SetCurrentState(&footmark->displayMatrix);
|
||||
SysMatrix_InsertScale(footmark->size * 0.00390625f * 0.7f, 1, footmark->size * 0.00390625f, 1);
|
||||
|
||||
gSPMatrix(gCtxt->polyXlu.append++, SysMatrix_AppendStateToPolyOpaDisp(ctxt->common.gCtxt), G_MTX_NOPUSH | G_MTX_LOAD);
|
||||
|
||||
gDPSetPrimColor(gCtxt->polyXlu.append++, 0, 0, footmark->red, footmark->green, footmark->blue, footmark->alpha >> 8);
|
||||
|
||||
gSPDisplayList(gCtxt->polyXlu.append++, D_801BC288);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ void EffectSS_Init(GlobalContext* ctxt, s32 numEntries) {
|
||||
LoadedParticleEntry* iter;
|
||||
ParticleOverlayTableEntry* iter2;
|
||||
|
||||
EffectSS2Info.data_table = (LoadedParticleEntry*)GameStateHeap_AllocFromEnd(&ctxt->commonVars.heap, numEntries * sizeof(LoadedParticleEntry));
|
||||
EffectSS2Info.data_table = (LoadedParticleEntry*)GameStateHeap_AllocFromEnd(&ctxt->common.heap, numEntries * sizeof(LoadedParticleEntry));
|
||||
EffectSS2Info.searchIndex = 0;
|
||||
EffectSS2Info.size = numEntries;
|
||||
|
||||
@ -282,9 +282,9 @@ void EffectSS_DrawAllParticles(GlobalContext* ctxt) {
|
||||
LightMapper* s0;
|
||||
s32 i;
|
||||
|
||||
s0 = Lights_CreateMapper(&ctxt->lightsContext, ctxt->commonVars.graphicsContext);
|
||||
s0 = Lights_CreateMapper(&ctxt->lightsContext, ctxt->common.gCtxt);
|
||||
Lights_MapLights(s0, ctxt->lightsContext.lightsHead, 0, ctxt);
|
||||
Lights_UploadLights(s0, ctxt->commonVars.graphicsContext);
|
||||
Lights_UploadLights(s0, ctxt->common.gCtxt);
|
||||
|
||||
for (i = 0; i < EffectSS2Info.size; i++) {
|
||||
if (EffectSS2Info.data_table[i].life > -1) {
|
||||
|
@ -503,8 +503,8 @@
|
||||
0x801BB15C:("D_801BB15C","UNK_TYPE2",""),
|
||||
0x801BB160:("D_801BB160","UNK_TYPE4",""),
|
||||
0x801BB170:("D_801BB170","s801BB170","[118]"),
|
||||
0x801BC240:("D_801BC240","UNK_TYPE1",""),
|
||||
0x801BC288:("D_801BC288","UNK_TYPE1",""),
|
||||
0x801BC240:("D_801BC240","Gfx","[9]"),
|
||||
0x801BC288:("D_801BC288","Gfx","[3]"),
|
||||
0x801BC2A0:("D_801BC2A0","UNK_TYPE1",""),
|
||||
0x801BC400:("D_801BC400","UNK_TYPE1",""),
|
||||
0x801BC410:("D_801BC410","UNK_TYPE1",""),
|
||||
|
Loading…
Reference in New Issue
Block a user