mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-13 03:14:38 +00:00
Decompile most effect files in "code" (#144)
- `z_effect`: Matched and essentially all documented. - `z_eff_spark.c`: Decompiled (1 non matching left) and mostly documented. - `z_eff_shield_particle.c`: Matched and mostly documented. - `z_eff_blure.c`: Decompiled (5 non matchings left) and partially documented. - `z_effect_soft_sprite.c`: Matched and mostly documented. - `z_eff_ss_dead.c`: Matched but not documented. - `z_effect_soft_sprite_dlftbls.c`: "Matched" (only data, contains the effect ss overlay table). - `z_effect_soft_sprite_old_init.c`: Not decompiled, but functions are categorized by effect ss overlay. And they should be decompiled at the same time as their corresponding effect ss in the future. Other changes: - Added a lot of types/enums to `z64effect.h`and moved+renamed some structs from `z64.h` to this header - Added effect ss overlay segments to `segment_symbols.h` and effect ss init vars to `initvars.h` - Added a macro called `VTX_T` to generate a `Vtx_t` in the same style as `VTX` - Fixed `flg_set.c` .bss to be in the right file - Removed `tools/overlayhelpers/batchdisasm` since it's no longer relevant - Removed unused leftover asm from recent PRs
This commit is contained in:
parent
785011c33c
commit
e29b77919b
227 changed files with 3739 additions and 8132 deletions
|
@ -1,26 +1,264 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
GlobalContext* func_80026B00(void) {
|
||||
return D_80157DA0;
|
||||
EffectContext sEffectContext;
|
||||
|
||||
EffectInfo sEffectInfoTable[] = {
|
||||
{
|
||||
sizeof(EffectSpark),
|
||||
EffectSpark_Init,
|
||||
EffectSpark_Destroy,
|
||||
EffectSpark_Update,
|
||||
EffectSpark_Draw,
|
||||
},
|
||||
{
|
||||
sizeof(EffectBlure),
|
||||
EffectBlure_Init1,
|
||||
EffectBlure_Destroy,
|
||||
EffectBlure_Update,
|
||||
EffectBlure_Draw,
|
||||
},
|
||||
{
|
||||
sizeof(EffectBlure),
|
||||
EffectBlure_Init2,
|
||||
EffectBlure_Destroy,
|
||||
EffectBlure_Update,
|
||||
EffectBlure_Draw,
|
||||
},
|
||||
{
|
||||
sizeof(EffectShieldParticle),
|
||||
EffectShieldParticle_Init,
|
||||
EffectShieldParticle_Destroy,
|
||||
EffectShieldParticle_Update,
|
||||
EffectShieldParticle_Draw,
|
||||
},
|
||||
};
|
||||
|
||||
GlobalContext* Effect_GetGlobalCtx(void) {
|
||||
return sEffectContext.globalCtx;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect/func_80026B0C.s")
|
||||
void* Effect_GetByIndex(s32 index) {
|
||||
if (index == TOTAL_EFFECT_COUNT) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void func_80026C1C(u8* arg0) {
|
||||
arg0[0] = 0;
|
||||
arg0[1] = 0;
|
||||
arg0[2] = 0;
|
||||
if (index < SPARK_COUNT) {
|
||||
if (sEffectContext.sparks[index].status.active == true) {
|
||||
return &sEffectContext.sparks[index].effect;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
index -= SPARK_COUNT;
|
||||
if (index < BLURE_COUNT) {
|
||||
if (sEffectContext.blures[index].status.active == true) {
|
||||
return &sEffectContext.blures[index].effect;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
index -= BLURE_COUNT;
|
||||
if (index < SHIELD_PARTICLE_COUNT) {
|
||||
if (sEffectContext.shieldParticles[index].status.active == true) {
|
||||
return &sEffectContext.shieldParticles[index].effect;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect/func_80026C2C.s")
|
||||
void Effect_InitStatus(EffectStatus* status) {
|
||||
status->active = false;
|
||||
status->unk_01 = 0;
|
||||
status->unk_02 = 0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect/Effect_Add.s")
|
||||
void Effect_InitContext(GlobalContext* globalCtx) {
|
||||
s32 i;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect/func_80026E74.s")
|
||||
for (i = 0; i < SPARK_COUNT; i++) {
|
||||
Effect_InitStatus(&sEffectContext.sparks[i].status);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect/func_80026F70.s")
|
||||
for (i = 0; i < BLURE_COUNT; i++) {
|
||||
Effect_InitStatus(&sEffectContext.blures[i].status);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect/func_8002709C.s")
|
||||
for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) {
|
||||
//! @bug This is supposed to initialize shieldParticles, not blures again
|
||||
Effect_InitStatus(&sEffectContext.blures[i].status);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect/func_800271A8.s")
|
||||
sEffectContext.globalCtx = globalCtx;
|
||||
}
|
||||
|
||||
void Effect_Add(GlobalContext* globalCtx, s32* pIndex, s32 type, u8 arg3, u8 arg4, void* initParams) {
|
||||
s32 i;
|
||||
u32 slotFound;
|
||||
void* effect;
|
||||
EffectStatus* status;
|
||||
|
||||
effect = NULL;
|
||||
status = NULL;
|
||||
*pIndex = TOTAL_EFFECT_COUNT;
|
||||
|
||||
if (func_800C0D28(globalCtx) != 1) {
|
||||
slotFound = false;
|
||||
switch (type) {
|
||||
case EFFECT_SPARK:
|
||||
for (i = 0; i < SPARK_COUNT; i++) {
|
||||
if (sEffectContext.sparks[i].status.active == false) {
|
||||
slotFound = true;
|
||||
*pIndex = i;
|
||||
effect = &sEffectContext.sparks[i].effect;
|
||||
status = &sEffectContext.sparks[i].status;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EFFECT_BLURE1:
|
||||
case EFFECT_BLURE2:
|
||||
for (i = 0; i < BLURE_COUNT; i++) {
|
||||
if (sEffectContext.blures[i].status.active == false) {
|
||||
slotFound = true;
|
||||
*pIndex = i + SPARK_COUNT;
|
||||
effect = &sEffectContext.blures[i].effect;
|
||||
status = &sEffectContext.blures[i].status;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EFFECT_SHIELD_PARTICLE:
|
||||
for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) {
|
||||
if (sEffectContext.shieldParticles[i].status.active == false) {
|
||||
slotFound = true;
|
||||
*pIndex = i + SPARK_COUNT + BLURE_COUNT;
|
||||
effect = &sEffectContext.shieldParticles[i].effect;
|
||||
status = &sEffectContext.shieldParticles[i].status;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!slotFound) {
|
||||
// Translates to: "EffectAdd(): I cannot secure it. Be careful. Type %d"
|
||||
osSyncPrintf("EffectAdd():確保できません。注意してください。Type%d\n", type);
|
||||
// Translates to: "Exit without adding the effect."
|
||||
osSyncPrintf("エフェクト追加せずに終了します。\n");
|
||||
} else {
|
||||
sEffectInfoTable[type].init(effect, initParams);
|
||||
status->unk_02 = arg3;
|
||||
status->unk_01 = arg4;
|
||||
status->active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Effect_DrawAll(GraphicsContext* gfxCtx) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < SPARK_COUNT; i++) {
|
||||
if (sEffectContext.sparks[i].status.active) {
|
||||
sEffectInfoTable[EFFECT_SPARK].draw(&sEffectContext.sparks[i].effect, gfxCtx);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < BLURE_COUNT; i++) {
|
||||
do {
|
||||
if (1) {} // Necessary to match
|
||||
if (sEffectContext.blures[i].status.active) {
|
||||
sEffectInfoTable[EFFECT_BLURE1].draw(&sEffectContext.blures[i].effect, gfxCtx);
|
||||
}
|
||||
} while (0); // Necessary to match
|
||||
}
|
||||
|
||||
for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) {
|
||||
if (sEffectContext.shieldParticles[i].status.active) {
|
||||
if (gfxCtx) {} // Necessary to match
|
||||
sEffectInfoTable[EFFECT_SHIELD_PARTICLE].draw(&sEffectContext.shieldParticles[i].effect, gfxCtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Effect_UpdateAll(GlobalContext* globalCtx) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < SPARK_COUNT; i++) {
|
||||
if (sEffectContext.sparks[i].status.active) {
|
||||
if (sEffectInfoTable[EFFECT_SPARK].update(&sEffectContext.sparks[i].effect) == 1) {
|
||||
Effect_Delete(globalCtx, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < BLURE_COUNT; i++) {
|
||||
if (sEffectContext.blures[i].status.active) {
|
||||
if (sEffectInfoTable[EFFECT_BLURE1].update(&sEffectContext.blures[i].effect) == 1) {
|
||||
Effect_Delete(globalCtx, i + SPARK_COUNT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) {
|
||||
if (sEffectContext.shieldParticles[i].status.active) {
|
||||
if (sEffectInfoTable[EFFECT_SHIELD_PARTICLE].update(&sEffectContext.shieldParticles[i].effect) == 1) {
|
||||
Effect_Delete(globalCtx, i + SPARK_COUNT + BLURE_COUNT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Effect_Delete(GlobalContext* globalCtx, s32 index) {
|
||||
if (index == TOTAL_EFFECT_COUNT) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (index < SPARK_COUNT) {
|
||||
sEffectContext.sparks[index].status.active = false;
|
||||
sEffectInfoTable[EFFECT_SPARK].destroy(&sEffectContext.sparks[index].effect);
|
||||
return;
|
||||
}
|
||||
|
||||
index -= SPARK_COUNT;
|
||||
if (index < BLURE_COUNT) {
|
||||
sEffectContext.blures[index].status.active = false;
|
||||
sEffectInfoTable[EFFECT_BLURE1].destroy(&sEffectContext.blures[index].effect);
|
||||
return;
|
||||
}
|
||||
|
||||
index -= BLURE_COUNT;
|
||||
if (index < SHIELD_PARTICLE_COUNT) {
|
||||
sEffectContext.shieldParticles[index].status.active = false;
|
||||
sEffectInfoTable[EFFECT_SHIELD_PARTICLE].destroy(&sEffectContext.shieldParticles[index].effect);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Effect_DeleteAll(GlobalContext* globalCtx) {
|
||||
s32 i;
|
||||
|
||||
osSyncPrintf("エフェクト総て解放\n"); // "All effect release"
|
||||
|
||||
for (i = 0; i < SPARK_COUNT; i++) {
|
||||
sEffectContext.sparks[i].status.active = false;
|
||||
sEffectInfoTable[EFFECT_SPARK].destroy(&sEffectContext.sparks[i].effect);
|
||||
}
|
||||
|
||||
for (i = 0; i < BLURE_COUNT; i++) {
|
||||
sEffectContext.blures[i].status.active = false;
|
||||
sEffectInfoTable[EFFECT_BLURE1].destroy(&sEffectContext.blures[i].effect);
|
||||
}
|
||||
|
||||
for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) {
|
||||
sEffectContext.shieldParticles[i].status.active = false;
|
||||
sEffectInfoTable[EFFECT_SHIELD_PARTICLE].destroy(&sEffectContext.shieldParticles[i].effect);
|
||||
}
|
||||
|
||||
osSyncPrintf("エフェクト総て解放 終了\n"); // "All effects release End"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue