diff --git a/include/initvars.h b/include/initvars.h index a1dbe1fa15..797e738764 100644 --- a/include/initvars.h +++ b/include/initvars.h @@ -1,6 +1,39 @@ #ifndef _INITVARS_H_ #define _INITVARS_H_ +extern EffectSsInit Effect_Ss_Dust_InitVars; +extern EffectSsInit Effect_Ss_Kirakira_InitVars; +extern EffectSsInit Effect_Ss_Bomb2_InitVars; +extern EffectSsInit Effect_Ss_Blast_InitVars; +extern EffectSsInit Effect_Ss_G_Spk_InitVars; +extern EffectSsInit Effect_Ss_D_Fire_InitVars; +extern EffectSsInit Effect_Ss_Bubble_InitVars; +extern EffectSsInit Effect_Ss_G_Ripple_InitVars; +extern EffectSsInit Effect_Ss_G_Splash_InitVars; +extern EffectSsInit Effect_Ss_G_Fire_InitVars; +extern EffectSsInit Effect_Ss_Lightning_InitVars; +extern EffectSsInit Effect_Ss_Dt_Bubble_InitVars; +extern EffectSsInit Effect_Ss_Hahen_InitVars; +extern EffectSsInit Effect_Ss_Stick_InitVars; +extern EffectSsInit Effect_Ss_Sibuki_InitVars; +extern EffectSsInit Effect_Ss_Stone1_InitVars; +extern EffectSsInit Effect_Ss_Hitmark_InitVars; +extern EffectSsInit Effect_Ss_Fhg_Flash_InitVars; +extern EffectSsInit Effect_Ss_K_Fire_InitVars; +extern EffectSsInit Effect_Ss_Solder_Srch_Ball_InitVars; +extern EffectSsInit Effect_Ss_Kakera_InitVars; +extern EffectSsInit Effect_Ss_Ice_Piece_InitVars; +extern EffectSsInit Effect_Ss_En_Ice_InitVars; +extern EffectSsInit Effect_Ss_Fire_Tail_InitVars; +extern EffectSsInit Effect_Ss_En_Fire_InitVars; +extern EffectSsInit Effect_Ss_Extra_InitVars; +extern EffectSsInit Effect_Ss_Dead_Db_InitVars; +extern EffectSsInit Effect_Ss_Dead_Dd_InitVars; +extern EffectSsInit Effect_Ss_Dead_Ds_InitVars; +extern EffectSsInit Effect_Ss_Ice_Smoke_InitVars; +extern EffectSsInit Effect_En_Ice_Block_InitVars; +extern EffectSsInit Effect_Ss_Sbn_InitVars; + extern ActorInit Arms_Hook_InitVars; extern ActorInit Arrow_Fire_InitVars; extern ActorInit Arrow_Ice_InitVars; diff --git a/include/variables.h b/include/variables.h index f6bfd4e8a6..b57a09599e 100644 --- a/include/variables.h +++ b/include/variables.h @@ -382,7 +382,7 @@ extern UNK_PTR D_801AE260[3]; // extern UNK_TYPE4 D_801AE2BC; // extern UNK_TYPE4 D_801AE2CC; // extern UNK_TYPE4 D_801AE2DC; -extern EffectSsInfo EffectSS2Info; +// extern EffectSsInfo sEffectSsInfo; // extern UNK_TYPE1 D_801AE3B0; // extern UNK_TYPE1 D_801AE3B4; // extern UNK_TYPE4 D_801AE3B8; @@ -410,7 +410,7 @@ extern EffectSsInfo EffectSS2Info; // extern UNK_TYPE1 D_801AE48A; // extern UNK_TYPE1 D_801AE48C; // extern UNK_TYPE1 D_801AE490; -extern EffectSsOverlay particleOverlayTable[39]; +extern EffectSsOverlay gParticleOverlayTable[39]; // extern FlagSetEntry sFlagEntries[]; // extern s32 sEntryIndex; // extern u32 sCurrentBit; diff --git a/include/z64effect.h b/include/z64effect.h index b095c89e90..d9211ef5e1 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -254,7 +254,7 @@ typedef struct { /* 0x0C */ void* vramEnd; /* 0x10 */ void* loadedRamAddr; /* 0x14 */ EffectSsInit* initInfo; - /* 0x18 */ u32 unk18; // Always 0x01000000? + /* 0x18 */ u8 unk18; // Always 1? } EffectSsOverlay; // size = 0x1C typedef struct EffectSs { @@ -279,27 +279,6 @@ typedef struct { /* 0x8 */ s32 size; } EffectSsInfo; // size = 0xC -typedef struct { - /* 0x0 */ EffectSs* data_table; // Name from debug assert - /* 0x4 */ s32 searchIndex; - /* 0x8 */ s32 size; -} EffectTableInfo; // size = 0xC - -typedef struct { - /* 0x0 */ UNK_TYPE4 unk0; - /* 0x4 */ EffectSsInitFunc init; -} ParticleOverlayInfo; // size = 0x8 - -typedef struct { - /* 0x00 */ u32 vromStart; - /* 0x04 */ u32 vromEnd; - /* 0x08 */ void* vramStart; - /* 0x0C */ void* vramEnd; - /* 0x10 */ void* loadedRamAddr; - /* 0x14 */ ParticleOverlayInfo* overlayInfo; - /* 0x18 */ u32 unk18; // Always 0x01000000? -} ParticleOverlay; // size = 0x1C - typedef enum { /* 0x00 */ EFFECT_SS_DUST, /* 0x01 */ EFFECT_SS_KIRAKIRA, diff --git a/spec b/spec index 67cc91d7f8..b5217c4d80 100644 --- a/spec +++ b/spec @@ -434,9 +434,8 @@ beginseg include "build/src/code/z_eff_tire_mark.o" include "build/src/code/z_effect.o" include "build/src/code/z_effect_soft_sprite.o" - include "build/data/code/z_effect_soft_sprite.data.o" include "build/src/code/z_effect_soft_sprite_old_init.o" - include "build/data/code/z_effect_soft_sprite_old_init.data.o" + include "build/src/code/z_effect_soft_sprite_dlftbls.o" include "build/src/code/flg_set.o" include "build/data/code/flg_set.bss.o" include "build/src/code/pad_801DC9C0.o" diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 47c2202f16..424166f893 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -1,20 +1,22 @@ #include "global.h" +EffectSsInfo sEffectSsInfo = { NULL, 0, 0 }; + void EffectSS_Init(GlobalContext* globalCtx, s32 numEntries) { u32 i; EffectSs* effectsSs; EffectSsOverlay* overlay; - EffectSS2Info.data_table = (EffectSs*)THA_AllocEndAlign16(&globalCtx->state.heap, numEntries * sizeof(EffectSs)); - EffectSS2Info.searchIndex = 0; - EffectSS2Info.size = numEntries; + sEffectSsInfo.data_table = (EffectSs*)THA_AllocEndAlign16(&globalCtx->state.heap, numEntries * sizeof(EffectSs)); + sEffectSsInfo.searchIndex = 0; + sEffectSsInfo.size = numEntries; - for (effectsSs = &EffectSS2Info.data_table[0]; effectsSs < &EffectSS2Info.data_table[EffectSS2Info.size]; + for (effectsSs = &sEffectSsInfo.data_table[0]; effectsSs < &sEffectSsInfo.data_table[sEffectSsInfo.size]; effectsSs++) { EffectSS_ResetEntry(effectsSs); } - overlay = &particleOverlayTable[0]; + overlay = &gParticleOverlayTable[0]; for (i = 0; i < EFFECT_SS_MAX; i++) { overlay->loadedRamAddr = NULL; overlay++; @@ -27,30 +29,31 @@ void EffectSS_Clear(GlobalContext* globalCtx) { EffectSsOverlay* overlay; void* addr; - EffectSS2Info.data_table = NULL; - EffectSS2Info.searchIndex = 0; - EffectSS2Info.size = 0; + sEffectSsInfo.data_table = NULL; + sEffectSsInfo.searchIndex = 0; + sEffectSsInfo.size = 0; - // This code is completely useless, as data_table was just set to NULL and size to 0 - for (effectsSs = EffectSS2Info.data_table; effectsSs < EffectSS2Info.data_table + EffectSS2Info.size; effectsSs++) { + //! @bug: Effects left in the table are not properly deleted, as data_table was just set to NULL and size to 0 + for (effectsSs = &sEffectSsInfo.data_table[0]; effectsSs < &sEffectSsInfo.data_table[sEffectSsInfo.size]; + effectsSs++) { EffectSS_Delete(effectsSs); } // Free memory from loaded particle overlays - overlay = &particleOverlayTable[0]; + overlay = &gParticleOverlayTable[0]; for (i = 0; i < EFFECT_SS_MAX; i++) { addr = overlay->loadedRamAddr; if (addr != NULL) { ZeldaArena_Free(addr); } - overlay->loadedRamAddr = 0; + overlay->loadedRamAddr = NULL; overlay++; } } EffectSs* EffectSS_GetTable() { - return EffectSS2Info.data_table; + return sEffectSsInfo.data_table; } void EffectSS_Delete(EffectSs* effectSs) { @@ -90,27 +93,27 @@ s32 EffectSS_FindFreeSpace(s32 priority, s32* tableEntry) { s32 foundFree; s32 i; - if (EffectSS2Info.searchIndex >= EffectSS2Info.size) { - EffectSS2Info.searchIndex = 0; + if (sEffectSsInfo.searchIndex >= sEffectSsInfo.size) { + sEffectSsInfo.searchIndex = 0; } // Search for a unused entry - i = EffectSS2Info.searchIndex; + i = sEffectSsInfo.searchIndex; foundFree = false; while (true) { - if (EffectSS2Info.data_table[i].life == -1) { + if (sEffectSsInfo.data_table[i].life == -1) { foundFree = true; break; } i++; - if (i >= EffectSS2Info.size) { + if (i >= sEffectSsInfo.size) { i = 0; // Loop around the whole table } // After a full loop, break out - if (i == EffectSS2Info.searchIndex) { + if (i == sEffectSsInfo.searchIndex) { break; } } @@ -122,22 +125,22 @@ s32 EffectSS_FindFreeSpace(s32 priority, s32* tableEntry) { // If all slots are in use, search for a slot with a lower priority // Note that a lower priority is representend by a higher value - i = EffectSS2Info.searchIndex; + i = sEffectSsInfo.searchIndex; while (true) { // Equal priority should only be considered "lower" if flag 0 is set - if ((priority <= EffectSS2Info.data_table[i].priority) && - !((priority == EffectSS2Info.data_table[i].priority) && (EffectSS2Info.data_table[i].flags & 1))) { + if ((priority <= sEffectSsInfo.data_table[i].priority) && + !((priority == sEffectSsInfo.data_table[i].priority) && (sEffectSsInfo.data_table[i].flags & 1))) { break; } i++; - if (i >= EffectSS2Info.size) { + if (i >= sEffectSsInfo.size) { i = 0; // Loop around the whole table } // After a full loop, return 1 to indicate that we failed to find a suitable slot - if (i == EffectSS2Info.searchIndex) { + if (i == sEffectSsInfo.searchIndex) { return true; } } @@ -151,8 +154,8 @@ void EffectSS_Copy(GlobalContext* globalCtx, EffectSs* effectsSs) { if (FrameAdvance_IsEnabled(globalCtx) != true) { if (EffectSS_FindFreeSpace(effectsSs->priority, &index) == 0) { - EffectSS2Info.searchIndex = index + 1; - EffectSS2Info.data_table[index] = *effectsSs; + sEffectSsInfo.searchIndex = index + 1; + sEffectSsInfo.data_table[index] = *effectsSs; } } } @@ -160,7 +163,7 @@ void EffectSS_Copy(GlobalContext* globalCtx, EffectSs* effectsSs) { void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* initData) { s32 index; u32 overlaySize; - EffectSsOverlay* entry = &particleOverlayTable[type]; + EffectSsOverlay* entry = &gParticleOverlayTable[type]; EffectSsInit* initInfo; if (EffectSS_FindFreeSpace(priority, &index) != 0) { @@ -168,8 +171,8 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init return; } - EffectSS2Info.searchIndex = index + 1; - overlaySize = (u32)entry->vramEnd - (u32)entry->vramStart; + sEffectSsInfo.searchIndex = index + 1; + overlaySize = (uintptr_t)entry->vramEnd - (uintptr_t)entry->vramStart; if (entry->vramStart == NULL) { initInfo = entry->initInfo; @@ -184,27 +187,27 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init Load2_LoadOverlay(entry->vromStart, entry->vromEnd, entry->vramStart, entry->vramEnd, entry->loadedRamAddr); } - initInfo = (void*)(u32)( - entry->initInfo != NULL - ? (EffectSsInit*)(-((u32)entry->vramStart - (u32)entry->loadedRamAddr) + (u32)entry->initInfo) - : NULL); + initInfo = (u32)((entry->initInfo != NULL) + ? (EffectSsInit*)(-((uintptr_t)entry->vramStart - (uintptr_t)entry->loadedRamAddr) + + (uintptr_t)entry->initInfo) + : NULL); } if (initInfo->init != NULL) { // Delete the previous effect in the slot, in case the slot wasn't free - EffectSS_Delete(&EffectSS2Info.data_table[index]); + EffectSS_Delete(&sEffectSsInfo.data_table[index]); - EffectSS2Info.data_table[index].type = type; - EffectSS2Info.data_table[index].priority = priority; + sEffectSsInfo.data_table[index].type = type; + sEffectSsInfo.data_table[index].priority = priority; - if (initInfo->init(globalCtx, index, &EffectSS2Info.data_table[index], initData) == 0) { - EffectSS_ResetEntry(&EffectSS2Info.data_table[index]); + if (initInfo->init(globalCtx, index, &sEffectSsInfo.data_table[index], initData) == 0) { + EffectSS_ResetEntry(&sEffectSsInfo.data_table[index]); } } } void EffectSS_UpdateParticle(GlobalContext* globalCtx, s32 index) { - EffectSs* particle = &EffectSS2Info.data_table[index]; + EffectSs* particle = &sEffectSsInfo.data_table[index]; if (particle->update != NULL) { particle->velocity.x += particle->accel.x; @@ -222,23 +225,23 @@ void EffectSS_UpdateParticle(GlobalContext* globalCtx, s32 index) { void EffectSS_UpdateAllParticles(GlobalContext* globalCtx) { s32 i; - for (i = 0; i < EffectSS2Info.size; i++) { - if (EffectSS2Info.data_table[i].life > -1) { - EffectSS2Info.data_table[i].life--; + for (i = 0; i < sEffectSsInfo.size; i++) { + if (sEffectSsInfo.data_table[i].life > -1) { + sEffectSsInfo.data_table[i].life--; - if (EffectSS2Info.data_table[i].life < 0) { - EffectSS_Delete(&EffectSS2Info.data_table[i]); + if (sEffectSsInfo.data_table[i].life < 0) { + EffectSS_Delete(&sEffectSsInfo.data_table[i]); } } - if (EffectSS2Info.data_table[i].life > -1) { + if (sEffectSsInfo.data_table[i].life > -1) { EffectSS_UpdateParticle(globalCtx, i); } } } void EffectSS_DrawParticle(GlobalContext* globalCtx, s32 index) { - EffectSs* entry = &EffectSS2Info.data_table[index]; + EffectSs* entry = &sEffectSsInfo.data_table[index]; if (entry->draw != NULL) { entry->draw(globalCtx, index, entry); @@ -252,12 +255,12 @@ void EffectSS_DrawAllParticles(GlobalContext* globalCtx) { Lights_BindAll(lights, globalCtx->lightCtx.listHead, NULL, globalCtx); Lights_Draw(lights, globalCtx->state.gfxCtx); - for (i = 0; i < EffectSS2Info.size; i++) { - if (EffectSS2Info.data_table[i].life > -1) { - if ((EffectSS2Info.data_table[i].pos.x > 32000.0f) || (EffectSS2Info.data_table[i].pos.x < -32000.0f) || - (EffectSS2Info.data_table[i].pos.y > 32000.0f) || (EffectSS2Info.data_table[i].pos.y < -32000.0f) || - (EffectSS2Info.data_table[i].pos.z > 32000.0f) || (EffectSS2Info.data_table[i].pos.z < -32000.0f)) { - EffectSS_Delete(&EffectSS2Info.data_table[i]); + for (i = 0; i < sEffectSsInfo.size; i++) { + if (sEffectSsInfo.data_table[i].life > -1) { + if ((sEffectSsInfo.data_table[i].pos.x > 32000.0f) || (sEffectSsInfo.data_table[i].pos.x < -32000.0f) || + (sEffectSsInfo.data_table[i].pos.y > 32000.0f) || (sEffectSsInfo.data_table[i].pos.y < -32000.0f) || + (sEffectSsInfo.data_table[i].pos.z > 32000.0f) || (sEffectSsInfo.data_table[i].pos.z < -32000.0f)) { + EffectSS_Delete(&sEffectSsInfo.data_table[i]); } else { EffectSS_DrawParticle(globalCtx, i); } diff --git a/src/code/z_effect_soft_sprite_dlftbls.c b/src/code/z_effect_soft_sprite_dlftbls.c new file mode 100644 index 0000000000..e215cdee96 --- /dev/null +++ b/src/code/z_effect_soft_sprite_dlftbls.c @@ -0,0 +1,56 @@ +#include "global.h" +#include "initvars.h" + +#define EFFECT_SS_OVERLAY(name) \ + { \ + SEGMENT_ROM_START(ovl_##name), SEGMENT_ROM_END(ovl_##name), SEGMENT_START(ovl_##name), \ + SEGMENT_END(ovl_##name), NULL, &name##_InitVars, 1, \ + } + +#define EFFECT_SS_OVERLAY_INTERNAL(name) \ + { 0, 0, NULL, NULL, NULL, &name##_InitVars, 1 } + +#define EFFECT_SS_OVERLAY_UNSET \ + { 0 } + +EffectSsOverlay gParticleOverlayTable[] = { + EFFECT_SS_OVERLAY(Effect_Ss_Dust), + EFFECT_SS_OVERLAY(Effect_Ss_Kirakira), + EFFECT_SS_OVERLAY_UNSET, + EFFECT_SS_OVERLAY(Effect_Ss_Bomb2), + EFFECT_SS_OVERLAY(Effect_Ss_Blast), + EFFECT_SS_OVERLAY(Effect_Ss_G_Spk), + EFFECT_SS_OVERLAY(Effect_Ss_D_Fire), + EFFECT_SS_OVERLAY(Effect_Ss_Bubble), + EFFECT_SS_OVERLAY_UNSET, + EFFECT_SS_OVERLAY(Effect_Ss_G_Ripple), + EFFECT_SS_OVERLAY(Effect_Ss_G_Splash), + EFFECT_SS_OVERLAY_UNSET, + EFFECT_SS_OVERLAY(Effect_Ss_G_Fire), + EFFECT_SS_OVERLAY(Effect_Ss_Lightning), + EFFECT_SS_OVERLAY(Effect_Ss_Dt_Bubble), + EFFECT_SS_OVERLAY(Effect_Ss_Hahen), + EFFECT_SS_OVERLAY(Effect_Ss_Stick), + EFFECT_SS_OVERLAY(Effect_Ss_Sibuki), + EFFECT_SS_OVERLAY_UNSET, + EFFECT_SS_OVERLAY_UNSET, + EFFECT_SS_OVERLAY(Effect_Ss_Stone1), + EFFECT_SS_OVERLAY(Effect_Ss_Hitmark), + EFFECT_SS_OVERLAY(Effect_Ss_Fhg_Flash), + EFFECT_SS_OVERLAY(Effect_Ss_K_Fire), + EFFECT_SS_OVERLAY(Effect_Ss_Solder_Srch_Ball), + EFFECT_SS_OVERLAY(Effect_Ss_Kakera), + EFFECT_SS_OVERLAY(Effect_Ss_Ice_Piece), + EFFECT_SS_OVERLAY(Effect_Ss_En_Ice), + EFFECT_SS_OVERLAY(Effect_Ss_Fire_Tail), + EFFECT_SS_OVERLAY(Effect_Ss_En_Fire), + EFFECT_SS_OVERLAY(Effect_Ss_Extra), + EFFECT_SS_OVERLAY_UNSET, + EFFECT_SS_OVERLAY(Effect_Ss_Dead_Db), + EFFECT_SS_OVERLAY(Effect_Ss_Dead_Dd), + EFFECT_SS_OVERLAY(Effect_Ss_Dead_Ds), + EFFECT_SS_OVERLAY_UNSET, + EFFECT_SS_OVERLAY(Effect_Ss_Ice_Smoke), + EFFECT_SS_OVERLAY(Effect_En_Ice_Block), + EFFECT_SS_OVERLAY(Effect_Ss_Sbn), +}; diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 4303d3db2d..1c69f57f3d 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -124,32 +124,32 @@ void func_800B1054(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1); } -extern Color_RGBA8 D_801AE3B0; -extern Color_RGBA8 D_801AE3B4; +static Color_RGBA8 sDustBrownPrim = { 170, 130, 90, 255 }; +static Color_RGBA8 sDustBrownEnv = { 100, 60, 20, 255 }; void func_800B10C0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { - EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &D_801AE3B0, &D_801AE3B4, 100, 5, 10, 0); + EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); } void func_800B1130(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { - EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &D_801AE3B0, &D_801AE3B4, 100, 5, 10, 0); + EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0); } void func_800B11A0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &D_801AE3B0, &D_801AE3B4, scale, scaleStep, 10, 0); + EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0); } void func_800B1210(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { - EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &D_801AE3B0, &D_801AE3B4, scale, scaleStep, 10, 0); + EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0); } void func_800B1280(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life) { - EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &D_801AE3B0, &D_801AE3B4, scale, scaleStep, life, 0); + EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0); } void func_800B12F0(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life) { - EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &D_801AE3B0, &D_801AE3B4, scale, scaleStep, life, 0); + EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0); } void func_800B1360(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, @@ -206,12 +206,9 @@ void func_800B1598(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) { } } -extern Color_RGBA8 D_801AE3B8; -extern Color_RGBA8 D_801AE3BC; - void EffectSsKiraKira_SpawnSmallYellow(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { - Color_RGBA8 primColor = D_801AE3B8; - Color_RGBA8 envColor = D_801AE3BC; + Color_RGBA8 primColor = { 255, 255, 200, 255 }; + Color_RGBA8 envColor = { 255, 200, 0, 0 }; EffectSsKiraKira_SpawnDispersed(globalCtx, pos, velocity, accel, &primColor, &envColor, 1000, 16); } @@ -307,12 +304,12 @@ void EffectSsBlast_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, EffectSs_Spawn(globalCtx, EFFECT_SS_BLAST, 128, &initParams); } -extern Color_RGBA8 D_801AE3C0; -extern Color_RGBA8 D_801AE3C4; - void EffectSsBlast_SpawnWhiteCustomScale(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life) { - EffectSsBlast_Spawn(globalCtx, pos, velocity, accel, &D_801AE3C0, &D_801AE3C4, scale, scaleStep, 35, life); + static Color_RGBA8 primColor = { 255, 255, 255, 255 }; + static Color_RGBA8 envColor = { 200, 200, 200, 0 }; + + EffectSsBlast_Spawn(globalCtx, pos, velocity, accel, &primColor, &envColor, scale, scaleStep, 35, life); } void EffectSsBlast_SpawnShockwave(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, @@ -320,11 +317,11 @@ void EffectSsBlast_SpawnShockwave(GlobalContext* globalCtx, Vec3f* pos, Vec3f* v EffectSsBlast_Spawn(globalCtx, pos, velocity, accel, primColor, envColor, 100, 375, 35, life); } -extern Color_RGBA8 D_801AE3C8; -extern Color_RGBA8 D_801AE3CC; - void EffectSsBlast_SpawnWhiteShockwave(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { - EffectSsBlast_SpawnShockwave(globalCtx, pos, velocity, accel, &D_801AE3C8, &D_801AE3CC, 10); + static Color_RGBA8 primColor = { 255, 255, 255, 255 }; + static Color_RGBA8 envColor = { 200, 200, 200, 0 }; + + EffectSsBlast_SpawnShockwave(globalCtx, pos, velocity, accel, &primColor, &envColor, 10); } // EffectSsGSpk Spawn Functions @@ -364,24 +361,18 @@ void EffectSsGSpk_SpawnNoAccel(GlobalContext* globalCtx, Actor* actor, Vec3f* po EffectSs_Spawn(globalCtx, EFFECT_SS_G_SPK, 128, &initParams); } -extern Color_RGBA8 D_801AE3D0; -extern Color_RGBA8 D_801AE3D4; - void EffectSsGSpk_SpawnFuse(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { - Color_RGBA8 primColor = D_801AE3D0; - Color_RGBA8 envColor = D_801AE3D4; + Color_RGBA8 primColor = { 255, 255, 150, 255 }; + Color_RGBA8 envColor = { 255, 0, 0, 0 }; EffectSsGSpk_SpawnSmall(globalCtx, actor, pos, velocity, accel, &primColor, &envColor); } -extern Color_RGBA8 D_801AE3D8; -extern Color_RGBA8 D_801AE3DC; - // unused void EffectSsGSpk_SpawnRandColor(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) { - Color_RGBA8 primColor = D_801AE3D8; - Color_RGBA8 envColor = D_801AE3DC; + Color_RGBA8 primColor = { 255, 255, 150, 255 }; + Color_RGBA8 envColor = { 255, 0, 0, 0 }; s32 randOffset = (Rand_ZeroOne() * 20.0f) - 10.0f; primColor.r += randOffset; @@ -585,12 +576,10 @@ void EffectSsHahen_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos, f32 burstSca } } -extern Vec3f D_801AE3E0; - void func_800B2364(GlobalContext* globalCtx, Vec3f* pos, Gfx* dList) { - Vec3f posVec = D_801AE3E0; + Vec3f accel = { 0.0f, -2.0f, 0.0f }; - EffectSsHahen_Spawn(globalCtx, pos, &gZeroVec3f, &posVec, 1, 5, 1, 10, dList); + EffectSsHahen_Spawn(globalCtx, pos, &gZeroVec3f, &accel, 1, 5, 1, 10, dList); } // EffectSsStick Spawn Functions @@ -624,12 +613,9 @@ void EffectSsSibuki_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, EffectSs_Spawn(globalCtx, EFFECT_SS_SIBUKI, 128, &initParams); } -extern Vec3f D_801AE3EC; -extern Vec3f D_801AE3F8; - void EffectSsSibuki_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos) { s16 i; - Vec3f zeroVec = D_801AE3EC; + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s16 randDirection = Rand_ZeroOne() * 1.99f; for (i = 0; i < KREG(19) + 30; i++) { @@ -759,11 +745,6 @@ void EffectSsIcePiece_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec EffectSs_Spawn(globalCtx, EFFECT_SS_ICE_PIECE, 128, &initParams); } -extern Vec3f D_801AE3F8; -extern Vec3f D_801AE404[10]; - -#ifdef NON_MATCHING -/* needs data migration to match */ void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 scale) { static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Vec3f vecScales[] = { @@ -799,15 +780,11 @@ void EffectSsIcePiece_SpawnBurst(GlobalContext* globalCtx, Vec3f* refPos, f32 sc &accel, 25); } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsIcePiece_SpawnBurst.s") -#endif // EffectSsEnIce Spawn Functions void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, Color_RGBA8* prim, Color_RGBA8* env, f32 scale) { - EffectSsEnIceInitParams initParams; initParams.actor = actor; @@ -824,11 +801,11 @@ void EffectSsEnIce_SpawnFlyingVec3f(GlobalContext* globalCtx, Actor* actor, Vec3 EffectSs_Spawn(globalCtx, EFFECT_SS_EN_ICE, 80, &initParams); } -extern Color_RGBA8 D_801AE47C; -extern Color_RGBA8 D_801AE480; - void func_800B2B44(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 scale) { - EffectSsEnIce_SpawnFlyingVec3f(globalCtx, actor, pos, &D_801AE47C, &D_801AE480, scale); + static Color_RGBA8 primColor = { 150, 150, 150, 250 }; + static Color_RGBA8 envColor = { 235, 245, 255, 255 }; + + EffectSsEnIce_SpawnFlyingVec3f(globalCtx, actor, pos, &primColor, &envColor, scale); } void func_800B2B7C(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, f32 scale) { @@ -874,29 +851,21 @@ void EffectSsFireTail_Spawn(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, EffectSs_Spawn(globalCtx, EFFECT_SS_FIRE_TAIL, 128, &initParams); } -extern Color_RGBA8 D_801AE484; -extern Color_RGBA8 D_801AE488; - -#ifdef NON_MATCHING -// needs data migration to match void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart, f32 colorIntensity) { + static Color_RGBA8 primColor = { 255, 255, 0, 255 }; + static Color_RGBA8 envColor = { 255, 0, 0, 255 }; - D_801AE484.g = (s32)(255.0f * colorIntensity); - D_801AE484.b = 0; + primColor.g = (s32)(255.0f * colorIntensity); + primColor.b = 0; - D_801AE488.g = 0; - D_801AE488.b = 0; - D_801AE484.r = D_801AE488.r = (s32)(255.0f * colorIntensity); + envColor.g = 0; + envColor.b = 0; + primColor.r = envColor.r = (s32)(255.0f * colorIntensity); - EffectSsFireTail_Spawn(globalCtx, actor, pos, arg3, &actor->velocity, 15, &D_801AE484, &D_801AE488, + EffectSsFireTail_Spawn(globalCtx, actor, pos, arg3, &actor->velocity, 15, &primColor, &envColor, (colorIntensity == 1.0f) ? 0 : 1, bodyPart, 1); } -#else -void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, f32 arg3, s16 bodyPart, - f32 colorIntensity); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsFireTail_SpawnFlame.s") -#endif void EffectSsFireTail_SpawnFlameOnPlayer(GlobalContext* globalCtx, f32 scale, s16 bodyPart, f32 colorIntensity) { Player* player = GET_PLAYER(globalCtx); @@ -982,12 +951,17 @@ void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, EffectSs_Spawn(globalCtx, EFFECT_SS_DEAD_DB, 120, &initParams); } -extern Color_RGBA8 D_801AE48C; -extern Color_RGBA8 D_801AE490[4]; - void func_800B3030(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s32 colorIndex) { - EffectSsDeadDb_Spawn(globalCtx, pos, velocity, accel, &D_801AE48C, &D_801AE490[colorIndex], scale, scaleStep, 9); + static Color_RGBA8 primColor = { 255, 255, 255, 255 }; + static Color_RGBA8 envColors[] = { + { 255, 0, 0, 255 }, + { 0, 255, 0, 255 }, + { 0, 0, 255, 255 }, + { 150, 150, 150, 255 }, + }; + + EffectSsDeadDb_Spawn(globalCtx, pos, velocity, accel, &primColor, &envColors[colorIndex], scale, scaleStep, 9); } // EffectSsDeadDd Spawn Functions diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index 586c2653be..04e4a5f39a 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -511,6 +511,7 @@ 0x801AE330 : "", 0x801AE3A0 : "z_effect_soft_sprite", 0x801AE3B0 : "z_effect_soft_sprite_old_init", + 0x801AE4A0 : "z_effect_soft_sprite_dlftbls", 0x801AE8F0 : "flg_set_table", 0x801AEC70 : "flg_set", 0x801AEC80 : "z_actor", diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index f56f75f0d8..4f1345a864 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -398,7 +398,7 @@ 0x801AE2DC:("D_801AE2DC","UNK_TYPE4","",0x4), 0x801AE2F0:("sEffectShieldParticleVertices","F3DVertex","[4]",0x40), 0x801AE330:("sEffectInfoTable","EffectInfo","[5]",0x64), - 0x801AE3A0:("EffectSS2Info","EffectSsInfo","",0xc), + 0x801AE3A0:("sEffectSsInfo","EffectSsInfo","",0xc), 0x801AE3B0:("D_801AE3B0","Color_RGBA8","",0x4), 0x801AE3B4:("D_801AE3B4","Color_RGBA8","",0x4), 0x801AE3B8:("D_801AE3B8","Color_RGBA8","",0x4), @@ -419,11 +419,9 @@ 0x801AE480:("D_801AE480","Color_RGBA8","",0x4), 0x801AE484:("D_801AE484","Color_RGBA8","",0x4), 0x801AE488:("D_801AE488","Color_RGBA8","",0x4), - 0x801AE489:("D_801AE489","UNK_TYPE1","",0x1), - 0x801AE48A:("D_801AE48A","UNK_TYPE1","",0x1), 0x801AE48C:("D_801AE48C","Color_RGBA8","",0x4), 0x801AE490:("D_801AE490","Color_RGBA8","[4]",0x10), - 0x801AE4A0:("particleOverlayTable","EffectSsOverlay","[39]",0x444), + 0x801AE4A0:("gParticleOverlayTable","EffectSsOverlay","[39]",0x444), 0x801AE8F0:("sFlagEntries","FlagSetEntry","[112]",0x8), 0x801AEC70:("sEntryIndex","s32","",0x4), 0x801AEC74:("sCurrentBit","u32","",0x4),