diff --git a/libultraship/libultraship/InputEditor.cpp b/libultraship/libultraship/InputEditor.cpp index 0ad5c09a0..9186e2b22 100644 --- a/libultraship/libultraship/InputEditor.cpp +++ b/libultraship/libultraship/InputEditor.cpp @@ -91,7 +91,11 @@ namespace Ship { if (ControllerName != nullptr && ImGui::BeginCombo("##ControllerEntries", ControllerName)) { for (uint8_t i = 0; i < controlDeck->GetNumPhysicalDevices(); i++) { - if (ImGui::Selectable(controlDeck->GetPhysicalDevice(i)->GetControllerName(), i == controlDeck->GetVirtualDevice(CurrentPort))) { + std::string DeviceName = controlDeck->GetPhysicalDevice(i)->GetControllerName(); + if (DeviceName != "Keyboard" && DeviceName != "Auto") { + DeviceName+="##"+std::to_string(i); + } + if (ImGui::Selectable(DeviceName.c_str(), i == controlDeck->GetVirtualDevice(CurrentPort))) { controlDeck->SetPhysicalDevice(CurrentPort, i); } } diff --git a/soh/include/z64effect.h b/soh/include/z64effect.h index 1b35d46b6..8dce5b6a3 100644 --- a/soh/include/z64effect.h +++ b/soh/include/z64effect.h @@ -25,7 +25,8 @@ typedef struct { /* 0x0C */ Vec3f position; /* 0x18 */ Vec3s unkVelocity; /* 0x1E */ Vec3s unkPosition; -} EffectSparkElement; // size = 0x24 + /* 0x24 */ s32 epoch; +} EffectSparkElement; // size = 0x28 typedef struct { /* 0x000 */ Vec3s position; @@ -117,7 +118,8 @@ typedef struct { /* 0x10 */ f32 startX; /* 0x14 */ s16 yaw; /* 0x16 */ s16 pitch; -} EffectShieldParticleElement; // size = 0x18 + /* 0x18 */ s32 epoch; +} EffectShieldParticleElement; // size = 0x1C typedef struct { /* 0x00 */ u8 numElements; diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 41347264e..17843ac45 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -1516,6 +1516,11 @@ extern "C" s32 Randomizer_GetItemIdFromKnownCheck(RandomizerCheck randomizerChec return OTRGlobals::Instance->gRandomizer->GetRandomizedItemIdFromKnownCheck(randomizerCheck, ogId); } +extern "C" bool Randomizer_ObtainedFreestandingIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId, Actor* actor) { + return gSaveContext.n64ddFlag && (actor->parent != NULL) && + Randomizer_GetItemIdFromKnownCheck(randomizerCheck, ogId) == GI_ICE_TRAP; +} + extern "C" bool Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId) { return gSaveContext.n64ddFlag && Randomizer_GetItemIdFromKnownCheck(randomizerCheck, ogId) == GI_ICE_TRAP; } diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index 018c3c941..fca7baea6 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -101,6 +101,7 @@ s16 Randomizer_GetItemModelFromId(s16 itemId); s32 Randomizer_GetItemIDFromGetItemID(s32 getItemId); s32 Randomizer_GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum); s32 Randomizer_GetItemIdFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId); +bool Randomizer_ObtainedFreestandingIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId, Actor* actor); bool Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId); #endif diff --git a/soh/src/code/speed_meter.c b/soh/src/code/speed_meter.c index f645c7bb5..800eef0f0 100644 --- a/soh/src/code/speed_meter.c +++ b/soh/src/code/speed_meter.c @@ -55,13 +55,13 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) { uly = this->y; lry = this->y + 2; - OPEN_DISPS(gfxCtx); - /*! @bug if gIrqMgrRetraceTime is 0, CLOSE_DISPS will never be reached */ if (gIrqMgrRetraceTime == 0) { return; } + OPEN_DISPS(gfxCtx); + sSpeedMeterTimeEntryPtr = &sSpeedMeterTimeEntryArray[0]; for (i = 0; i < ARRAY_COUNT(sSpeedMeterTimeEntryArray); i++) { temp = ((f64) * (sSpeedMeterTimeEntryPtr->time) / gIrqMgrRetraceTime) * 64.0; diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index fff93a560..b96978620 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -3957,6 +3957,8 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) { f32 chainsTranslateX; f32 chainsTranslateY; f32 rotZStep; + static s32 epoch = 0; + epoch++; entry = &sDoorLocksInfo[type]; chainRotZ = entry->chainsRotZInit; @@ -3970,6 +3972,7 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) { chainsTranslateY = cosf(entry->chainAngle - chainRotZ) * (10 - frame) * 0.1f * entry->chainLength; for (i = 0; i < 4; i++) { + FrameInterpolation_RecordOpenChild(entry, epoch + i * 25); Matrix_Put(&baseMtxF); Matrix_RotateZ(chainRotZ, MTXMODE_APPLY); Matrix_Translate(chainsTranslateX, chainsTranslateY, 0.0f, MTXMODE_APPLY); @@ -3989,6 +3992,7 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) { } chainRotZ += rotZStep; + FrameInterpolation_RecordCloseChild(); } Matrix_Put(&baseMtxF); diff --git a/soh/src/code/z_eff_shield_particle.c b/soh/src/code/z_eff_shield_particle.c index a5d9ca53f..27032a632 100644 --- a/soh/src/code/z_eff_shield_particle.c +++ b/soh/src/code/z_eff_shield_particle.c @@ -47,6 +47,7 @@ void EffectShieldParticle_Init(void* thisx, void* initParamsx) { elem->endXChange = elem->initialSpeed; elem->yaw = Rand_ZeroOne() * 65534.0f; elem->pitch = Rand_ZeroOne() * 65534.0f; + elem->epoch++; } this->lightDecay = initParams->lightDecay; @@ -156,7 +157,6 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) { Color_RGBA8 primColor; Color_RGBA8 envColor; - FrameInterpolation_RecordOpenChild(this, 0); OPEN_DISPS(gfxCtx); if (this != NULL) { @@ -182,6 +182,8 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) { gDPPipeSync(POLY_XLU_DISP++); for (elem = &this->elements[0]; elem < &this->elements[this->numElements]; elem++) { + FrameInterpolation_RecordOpenChild(elem, elem->epoch); + Mtx* mtx; MtxF sp104; MtxF spC4; @@ -212,9 +214,10 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) { gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPVertex(POLY_XLU_DISP++, sVertices, 4, 0); gSP2Triangles(POLY_XLU_DISP++, 0, 1, 2, 0, 0, 3, 1, 0); + + FrameInterpolation_RecordCloseChild(); } } CLOSE_DISPS(gfxCtx); - FrameInterpolation_RecordCloseChild(); } diff --git a/soh/src/code/z_eff_spark.c b/soh/src/code/z_eff_spark.c index 445fd7fea..5ce627508 100644 --- a/soh/src/code/z_eff_spark.c +++ b/soh/src/code/z_eff_spark.c @@ -89,6 +89,7 @@ void EffectSpark_Init(void* thisx, void* initParamsx) { elem->unkPosition.x = Rand_ZeroOne() * 65534.0f; elem->unkPosition.y = Rand_ZeroOne() * 65534.0f; elem->unkPosition.z = Rand_ZeroOne() * 65534.0f; + elem->epoch++; } this->timer = 0; @@ -210,6 +211,8 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) { Mtx* mtx; f32 temp; + FrameInterpolation_RecordOpenChild(elem, elem->epoch); + SkinMatrix_SetTranslate(&spEC, elem->position.x, elem->position.y, elem->position.z); temp = ((Rand_ZeroOne() * 2.5f) + 1.5f) / 64.0f; SkinMatrix_SetScale(&spAC, temp, temp, 1.0f); @@ -264,6 +267,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) { mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp12C); if (mtx == NULL) { + FrameInterpolation_RecordCloseChild(); goto end; } @@ -273,6 +277,8 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) { } gDPPipeSync(POLY_XLU_DISP++); + + FrameInterpolation_RecordCloseChild(); } end: diff --git a/soh/src/code/z_kankyo.c b/soh/src/code/z_kankyo.c index de654dfbb..de8634f32 100644 --- a/soh/src/code/z_kankyo.c +++ b/soh/src/code/z_kankyo.c @@ -3,6 +3,7 @@ #include "vt.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/gameplay_field_keep/gameplay_field_keep.h" +#include "soh/frame_interpolation.h" typedef enum { /* 0 */ LENS_FLARE_CIRCLE0, @@ -950,7 +951,6 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li Gfx* prevDisplayList; OPEN_DISPS(globalCtx->state.gfxCtx); - prevDisplayList = POLY_OPA_DISP; displayList = Graph_GfxPlusOne(POLY_OPA_DISP); gSPDisplayList(OVERLAY_DISP++, displayList); @@ -1459,6 +1459,8 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env LENS_FLARE_RING, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, }; + static s32 epoch = 0; + epoch++; OPEN_DISPS(gfxCtx); @@ -1502,9 +1504,7 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env unk88Target = cosAngle; } - if (cosAngle < 0.0f) { - - } else { + if (!(cosAngle < 0.0f)) { if (arg9) { u32 shrink = ShrinkWindow_GetCurrentVal(); func_800C016C(globalCtx, &pos, &screenPos); @@ -1517,6 +1517,8 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env } for (i = 0; i < ARRAY_COUNT(lensFlareTypes); i++) { + FrameInterpolation_RecordOpenChild("Lens Flare", epoch + i * 25); + Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_NEW); if (arg9) { @@ -1573,6 +1575,8 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env gSPDisplayList(POLY_XLU_DISP++, gLensFlareRingDL); break; } + + FrameInterpolation_RecordCloseChild(); } alphaScale = cosAngle - (1.5f - cosAngle); @@ -1638,6 +1642,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* Vec3f unused = { 0.0f, 0.0f, 0.0f }; Vec3f windDirection = { 0.0f, 0.0f, 0.0f }; Player* player = GET_PLAYER(globalCtx); + static s32 epoch = 0; + epoch++; if (!(globalCtx->cameraPtrs[0]->unk_14C & 0x100) && (globalCtx->envCtx.unk_EE[2] == 0)) { OPEN_DISPS(gfxCtx); @@ -1667,6 +1673,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* // draw rain drops for (i = 0; i < globalCtx->envCtx.unk_EE[1]; i++) { + FrameInterpolation_RecordOpenChild("Rain Drop", epoch + i * 25); + temp2 = Rand_ZeroOne(); temp1 = Rand_ZeroOne(); temp3 = Rand_ZeroOne(); @@ -1692,6 +1700,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gRaindropDL); + + FrameInterpolation_RecordCloseChild(); } // draw droplet rings on the ground @@ -1699,6 +1709,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* u8 firstDone = false; for (i = 0; i < globalCtx->envCtx.unk_EE[1]; i++) { + FrameInterpolation_RecordOpenChild("Droplet Ring", epoch + i * 25); + if (!firstDone) { func_80093D84(gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 155, 0); @@ -1719,6 +1731,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffShockwaveDL); + + FrameInterpolation_RecordCloseChild(); } } @@ -1911,10 +1925,14 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) { s32 pad[2]; Vec3f unused1 = { 0.0f, 0.0f, 0.0f }; Vec3f unused2 = { 0.0f, 0.0f, 0.0f }; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(sLightningBolts); i++) { + FrameInterpolation_RecordOpenChild("Lightning Bolt", epoch + i * 25); + switch (sLightningBolts[i].state) { case LIGHTNING_BOLT_START: dx = globalCtx->view.lookAt.x - globalCtx->view.eye.x; @@ -1969,6 +1987,8 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) { gSPMatrix(POLY_XLU_DISP++, SEG_ADDR(1, 0), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffLightningDL); } + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/code/z_lifemeter.c b/soh/src/code/z_lifemeter.c index e1bafb3d2..400f0a275 100644 --- a/soh/src/code/z_lifemeter.c +++ b/soh/src/code/z_lifemeter.c @@ -1,5 +1,6 @@ #include "global.h" #include "textures/parameter_static/parameter_static.h" +#include "soh/frame_interpolation.h" s16 Top_LM_Margin = 0; s16 Left_LM_Margin = 0; @@ -412,6 +413,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) { s32 curCombineModeSet = 0; u8* curBgImgLoaded = NULL; s32 ddHeartCountMinusOne = gSaveContext.inventory.defenseHearts - 1; + static s32 epoch = 0; + epoch++; OPEN_DISPS(gfxCtx); @@ -449,6 +452,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) { } for (i = 0; i < totalHeartCount; i++) { + FrameInterpolation_RecordOpenChild("HealthMeter Heart", epoch + i * 25); + if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) { if (i < fullHeartCount) { if (curColorSet != 0) { @@ -624,6 +629,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) { offsetX = PosX_original; } } + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(gfxCtx); diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 44d529587..364e63956 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1384,6 +1384,12 @@ void Inventory_SwapAgeEquipment(void) { u16 temp; if (LINK_AGE_IN_YEARS == YEARS_CHILD) { + // When becoming adult, remove swordless flag since we'll get master sword + // Only in rando to keep swordless link bugs in vanilla + if (gSaveContext.n64ddFlag) { + gSaveContext.infTable[29] &= ~1; + } + for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) { if (i != 0) { gSaveContext.childEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i]; @@ -1444,6 +1450,12 @@ void Inventory_SwapAgeEquipment(void) { gSaveContext.equips.equipment = gSaveContext.adultEquips.equipment; } } else { + // When becoming child, set swordless flag if player doesn't have kokiri sword + // Only in rando to keep swordless link bugs in vanilla + if (gSaveContext.n64ddFlag && (1 << 0 & gSaveContext.inventory.equipment) == 0) { + gSaveContext.infTable[29] |= 1; + } + for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) { gSaveContext.adultEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i]; @@ -3352,8 +3364,8 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { const s16 C_Right_BTN_Pos_ori[] = { C_RIGHT_BUTTON_X+X_Margins_CR, C_RIGHT_BUTTON_Y+Y_Margins_CR }; const s16 C_Up_BTN_Pos_ori[] = { C_UP_BUTTON_X+X_Margins_CU, C_UP_BUTTON_Y+Y_Margins_CU }; const s16 C_Down_BTN_Pos_ori[] = { C_DOWN_BUTTON_X+X_Margins_CD, C_DOWN_BUTTON_Y+Y_Margins_CD }; - s16 LabelX_Navi=8; - s16 LabelY_Navi=4 - !!CVar_GetS32("gNaviTextFix", 0); + s16 LabelX_Navi=7 + !!CVar_GetS32("gNaviTextFix", 0); + s16 LabelY_Navi=4; s16 C_Left_BTN_Pos[2]; //(X,Y) s16 C_Right_BTN_Pos[2]; s16 C_Up_BTN_Pos[2]; diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index f99979715..8974495fb 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -203,7 +203,8 @@ void GivePlayerRandoRewardSongOfTime(GlobalContext* globalCtx, RandomizerCheck c !Flags_GetTreasure(globalCtx, 0x1F) && gSaveContext.nextTransition == 0xFF) { GetItemID getItemId = Randomizer_GetItemIdFromKnownCheck(check, GI_SONG_OF_TIME); GiveItemWithoutActor(globalCtx, getItemId); - Flags_SetTreasure(globalCtx, 0x1F); + player->pendingFlag.flagID = 0x1F; + player->pendingFlag.flagType = FLAG_SCENE_TREASURE; } } diff --git a/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index 7be483bd9..0f1713ba8 100644 --- a/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -10,6 +10,7 @@ #include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h" #include "scenes/indoors/yousei_izumi_yoko/yousei_izumi_yoko_scene.h" #include "scenes/indoors/daiyousei_izumi/daiyousei_izumi_scene.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) @@ -960,6 +961,7 @@ void BgDyYoseizo_ParticleInit(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVelo particle->pitch = 0.0f; particle->yaw = Rand_CenteredFloat(30000.0f); particle->roll = 0.0f; + particle->epoch++; return; } } @@ -1039,6 +1041,8 @@ void BgDyYoseizo_ParticleDraw(BgDyYoseizo* this, GlobalContext* globalCtx) { func_80093D84(globalCtx->state.gfxCtx); for (i = 0; i < 200; i++, particle++) { + FrameInterpolation_RecordOpenChild(particle, particle->epoch); + if (particle->alive == 1) { if (phi_s3 == 0) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGreatFairyParticleAppearDL)); @@ -1060,6 +1064,8 @@ void BgDyYoseizo_ParticleDraw(BgDyYoseizo* this, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGreatFairyParticleAliveDL)); } + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h b/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h index 59abc6065..401eb8b22 100644 --- a/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h +++ b/soh/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h @@ -24,7 +24,8 @@ typedef struct { /* 0x36 */ f32 pitch; /* 0x36 */ f32 yaw; /* 0x40 */ f32 roll; -} BgDyYoseizoParticle; // size = 0x44 + /* 0x44 */ s32 epoch; +} BgDyYoseizoParticle; // size = 0x48 typedef struct BgDyYoseizo { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c b/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c index 1ac76f25b..4b2bb78c5 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c @@ -1,6 +1,7 @@ #include "z_bg_jya_megami.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "objects/object_jya_obj/object_jya_obj.h" +#include "soh/frame_interpolation.h" #define FLAGS 0 @@ -217,6 +218,7 @@ void BgJyaMegami_SetupExplode(BgJyaMegami* this) { for (i = 0; i < ARRAY_COUNT(this->pieces); i++) { Math_Vec3f_Copy(&this->pieces[i].pos, &this->dyna.actor.world.pos); this->pieces[i].vel.x = sPiecesInit[i].velX; + this->pieces[i].epoch++; } this->explosionTimer = 0; } @@ -326,6 +328,9 @@ void BgJyaMegami_DrawExplode(BgJyaMegami* this, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(this->pieces); i++) { piece = &this->pieces[i]; + + FrameInterpolation_RecordOpenChild(piece, piece->epoch); + Matrix_Translate(piece->pos.x + sPiecesInit[i].unk_00.x, piece->pos.y + sPiecesInit[i].unk_00.y, piece->pos.z + sPiecesInit[i].unk_00.z, MTXMODE_NEW); Matrix_RotateY(piece->rotVelY * (M_PI / 0x8000), MTXMODE_APPLY); @@ -337,6 +342,8 @@ void BgJyaMegami_DrawExplode(BgJyaMegami* this, GlobalContext* globalCtx) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, sDLists[i]); + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h b/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h index f4a859c31..4198781b0 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h @@ -13,7 +13,8 @@ typedef struct { /* 0x0C */ Vec3f vel; /* 0x18 */ s16 rotVelX; /* 0x1A */ s16 rotVelY; -} BgJyaMegamiPiece; // size = 0x1C + /* 0x1C */ s32 epoch; +} BgJyaMegamiPiece; // size = 0x20 typedef struct BgJyaMegami { /* 0x0000 */ DynaPolyActor dyna; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c b/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c index 2385ee163..d74a39624 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c @@ -7,6 +7,7 @@ #include "z_bg_spot00_hanebasi.h" #include "objects/object_spot00_objects/object_spot00_objects.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "soh/frame_interpolation.h" #define FLAGS ACTOR_FLAG_4 @@ -260,6 +261,8 @@ void BgSpot00Hanebasi_DrawTorches(Actor* thisx, GlobalContext* globalCtx2) { GlobalContext* globalCtx = globalCtx2; f32 angle; s32 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -276,6 +279,8 @@ void BgSpot00Hanebasi_DrawTorches(Actor* thisx, GlobalContext* globalCtx2) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); for (i = 0; i < 2; i++) { + FrameInterpolation_RecordOpenChild("Hanebasi Torch", epoch + i * 25); + gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, ((globalCtx->gameplayFrames + i) * -20) & 0x1FF, 32, 128)); @@ -287,6 +292,8 @@ void BgSpot00Hanebasi_DrawTorches(Actor* thisx, GlobalContext* globalCtx2) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 721fcf51c..234ef4a11 100644 --- a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -2,6 +2,7 @@ #include "objects/object_kingdodongo/object_kingdodongo.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" #include "scenes/dungeons/ddan_boss/ddan_boss_room_1.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -150,6 +151,7 @@ void func_808C17C8(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* ar for (i = 0; i < arg5; i++, eff++) { if (eff->unk_24 == 0) { + eff->epoch++; eff->unk_24 = 1; eff->unk_00 = *arg1; eff->unk_0C = *arg2; @@ -1703,6 +1705,7 @@ void BossDodongo_DrawEffects(GlobalContext* globalCtx) { #endif for (i = 0; i < 80; i++, eff++) { + FrameInterpolation_RecordOpenChild(eff, eff->epoch); if (eff->unk_24 == 1) { gDPPipeSync(POLY_XLU_DISP++); @@ -1719,6 +1722,7 @@ void BossDodongo_DrawEffects(GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_kingdodongo_DL_009DD0); } + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h index 62aefe8cc..f920b44a6 100644 --- a/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h +++ b/soh/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h @@ -17,7 +17,8 @@ typedef struct { /* 0x26 */ Color_RGB8 color; /* 0x2A */ s16 alpha; /* 0x2C */ f32 unk_2C; -} BossDodongoEffect; // Size = 0x30 + /* 0x30 */ s32 epoch; +} BossDodongoEffect; // Size = 0x34 typedef struct BossDodongo { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index f1620c267..8afb08ba1 100644 --- a/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -1835,6 +1835,8 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { s16 i; f32 temp_float; Mtx* tempMat = Graph_Alloc(globalCtx->state.gfxCtx, 18 * sizeof(Mtx)); + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); if (this->skinSegments != 0) { @@ -1876,6 +1878,8 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { Matrix_Push(); for (i = 0; i < 18; i++, tempMat++) { + FrameInterpolation_RecordOpenChild(tempMat, epoch + i * 25); + segIndex = (this->work[BFD_LEAD_BODY_SEG] + sBodyIndex[i + 1]) % 100; Matrix_Translate(this->bodySegsPos[segIndex].x, this->bodySegsPos[segIndex].y, this->bodySegsPos[segIndex].z, MTXMODE_NEW); @@ -1938,6 +1942,8 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) { if (i > 0) { Collider_UpdateSpheres(i + 1, &this->collider); } + + FrameInterpolation_RecordCloseChild(); } Matrix_Pop(); osSyncPrintf("BH\n"); diff --git a/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index 5a891887e..8915c068f 100644 --- a/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -9,6 +9,7 @@ #include "overlays/actors/ovl_Boss_Fd/z_boss_fd.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" #include "vt.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -1146,6 +1147,8 @@ void BossFd2_UpdateMane(BossFd2* this, GlobalContext* globalCtx, Vec3f* head, Ve } for (i = 0; i < 9; i++) { + FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); + Matrix_Translate((pos + i)->x, (pos + i)->y, (pos + i)->z, MTXMODE_NEW); Matrix_RotateY((rot + i)->y, MTXMODE_APPLY); Matrix_RotateX((rot + i)->x, MTXMODE_APPLY); @@ -1155,6 +1158,8 @@ void BossFd2_UpdateMane(BossFd2* this, GlobalContext* globalCtx, Vec3f* head, Ve gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gHoleVolvagiaManeModelDL); + + FrameInterpolation_RecordCloseChild(); } Matrix_Pop(); CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h b/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h index afafdbba3..3bc77b0b7 100644 --- a/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h +++ b/soh/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h @@ -87,6 +87,7 @@ typedef struct BossFd2 { /* 0x1394 */ BossFd2Cam camData; /* 0x141C */ ColliderJntSph collider; /* 0x143C */ ColliderJntSphElement elements[9]; -} BossFd2; // size = 0x167C + /* 0x167C */ s32 epoch; +} BossFd2; // size = 0x1680 #endif diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index f7a85fc26..10e118c17 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -3356,6 +3356,8 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { s32 pad; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s16 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(gfxCtx); @@ -3369,6 +3371,8 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); for (i = 0; i < ARRAY_COUNT(player->bodyPartsPos); i++) { + FrameInterpolation_RecordOpenChild("Ganondorf Shock 0", epoch + i * 25); + Matrix_Translate(player->bodyPartsPos[i].x, player->bodyPartsPos[i].y, player->bodyPartsPos[i].z, MTXMODE_NEW); Matrix_ReplaceRotation(&globalCtx->billboardMtxF); @@ -3377,9 +3381,13 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDorfSquareDL); + + FrameInterpolation_RecordCloseChild(); } } else { for (i = 1; i < 15; i++) { + FrameInterpolation_RecordOpenChild("Ganondorf Shock 1", epoch + i * 25); + Matrix_Translate(this->unk_2EC[i].x, this->unk_2EC[i].y, this->unk_2EC[i].z, MTXMODE_NEW); Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(this->unk_49C[i], this->unk_49C[i], this->unk_49C[i], MTXMODE_APPLY); @@ -3401,6 +3409,8 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { } else { gSPDisplayList(POLY_XLU_DISP++, gDorfSquareDL); } + + FrameInterpolation_RecordCloseChild(); } } } @@ -3443,9 +3453,9 @@ void BossGanon_DrawHandLightBall(BossGanon* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gDorfLightCoreDL); - - CLOSE_DISPS(gfxCtx); } + + CLOSE_DISPS(gfxCtx); } void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { @@ -3453,6 +3463,8 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { f32 yRot; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s16 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(gfxCtx); @@ -3513,6 +3525,8 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { yRot = BINANG_TO_RAD(this->actor.yawTowardsPlayer); for (i = 0; i < this->unk_1AC; i++) { + FrameInterpolation_RecordOpenChild("Ganondorf Big Magic", epoch + i * 25); + f32 xzRot = (BossGanon_RandZeroOne() - 0.5f) * M_PI * 1.5f; gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s8)this->unk_294[i]); @@ -3527,10 +3541,12 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gDorfLightRayTriDL); Matrix_Pop(); - } - CLOSE_DISPS(gfxCtx); + FrameInterpolation_RecordCloseChild(); + } } + + CLOSE_DISPS(gfxCtx); } void BossGanon_DrawTriforce(BossGanon* this, GlobalContext* globalCtx) { @@ -4142,6 +4158,8 @@ void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx) { s16 i; f32 alpha; s32 pad; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -4166,6 +4184,8 @@ void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_1A8 == 1) { for (i = 0; i < 8; i++) { + FrameInterpolation_RecordOpenChild("Ganondorf Light Ball 0", epoch + i * 25); + Matrix_Push(); Matrix_RotateY(i * (M_PI / 8), MTXMODE_APPLY); Matrix_RotateZ(this->fwork[GDF_FWORK_0], MTXMODE_APPLY); @@ -4174,6 +4194,8 @@ void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gDorfSquareDL); Matrix_Pop(); + + FrameInterpolation_RecordCloseChild(); } } else if (this->unk_1A8 == 0) { Matrix_ReplaceRotation(&globalCtx->billboardMtxF); diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 23fa7fcc9..ecc084be3 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -5,6 +5,7 @@ #include "objects/object_ganon2/object_ganon2.h" #include "objects/object_ganon_anime3/object_ganon_anime3.h" #include "objects/object_geff/object_geff.h" +#include "soh/frame_interpolation.h" #include @@ -2463,6 +2464,8 @@ void func_80904340(BossGanon2* this, GlobalContext* globalCtx) { f32 angle; f32 sin; f32 cos; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); Matrix_Push(); @@ -2485,6 +2488,7 @@ void func_80904340(BossGanon2* this, GlobalContext* globalCtx) { rand = BossGanon2_RandZeroOne(); for (i = 0; i < 5; i++) { + FrameInterpolation_RecordOpenChild("Ganon 80904340", epoch + i * 25); angle = (i * (2 * M_PI / 5)) + (rand * M_PI); sin = 5000.0f * sinf(angle); cos = 5000.0f * cosf(angle); @@ -2500,6 +2504,7 @@ void func_80904340(BossGanon2* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00D798)); + FrameInterpolation_RecordCloseChild(); } } @@ -2632,6 +2637,8 @@ void BossGanon2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis void func_80904D88(BossGanon2* this, GlobalContext* globalCtx) { s32 pad; s16 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -2647,6 +2654,8 @@ void func_80904D88(BossGanon2* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B308); for (i = 0; i < 15; i++) { + FrameInterpolation_RecordOpenChild("Ganon 80904D88", epoch + i * 25); + Matrix_Translate(this->unk_234[i].x, this->unk_234[i].y, this->unk_234[i].z, MTXMODE_NEW); Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(this->unk_30C, this->unk_30C, this->unk_30C, MTXMODE_APPLY); @@ -2654,6 +2663,8 @@ void func_80904D88(BossGanon2* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B378); + + FrameInterpolation_RecordCloseChild(); } } @@ -2690,6 +2701,8 @@ void func_80904FC8(BossGanon2* this, GlobalContext* globalCtx) { void func_8090523C(BossGanon2* this, GlobalContext* globalCtx) { Player* player; f32 phi_f20; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -2703,6 +2716,8 @@ void func_8090523C(BossGanon2* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B308); for (i = 0; i < 11; i++) { + FrameInterpolation_RecordOpenChild("Ganon 8090523C", epoch + i * 25); + Matrix_Mult(&player->mf_9E0, MTXMODE_NEW); Matrix_Translate((i * 250.0f) + 900.0f, 350.0f, 0.0f, MTXMODE_APPLY); @@ -2718,6 +2733,8 @@ void func_8090523C(BossGanon2* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(ovl_Boss_Ganon2_DL_00B378)); + + FrameInterpolation_RecordCloseChild(); } } @@ -2916,6 +2933,8 @@ void func_809060E8(GlobalContext* globalCtx) { BossGanon2Effect* effect; s16 i; BossGanon2Effect* effects; + static s32 epoch = 0; + epoch++; effects = effect = globalCtx->specialEffects; @@ -2925,6 +2944,8 @@ void func_809060E8(GlobalContext* globalCtx) { for (i = 0; i < 1; i++) { if (effect->type == 1) { + FrameInterpolation_RecordOpenChild("Ganon 809060E8 0", epoch + i * 25); + Vec3f spA0; f32 temp_f0; f32 angle; @@ -2958,6 +2979,8 @@ void func_809060E8(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00F188); + + FrameInterpolation_RecordCloseChild(); } } @@ -2965,6 +2988,8 @@ void func_809060E8(GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(sBossGanon2Particles); i++, effect++) { if (effect->type == 2) { + FrameInterpolation_RecordOpenChild("Ganon 809060E8 1", epoch + i * 25); + if (!usingObjectGEff) { BossGanon2_SetObjectSegment(NULL, globalCtx, OBJECT_GEFF, true); usingObjectGEff++; @@ -2977,6 +3002,8 @@ void func_809060E8(GlobalContext* globalCtx) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGanonRubbleDL); + + FrameInterpolation_RecordCloseChild(); } } diff --git a/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 7ba83aebf..b7756765a 100644 --- a/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -348,6 +348,7 @@ void BossMo_Init(Actor* thisx, GlobalContext* globalCtx2) { globalCtx->specialEffects = sEffects; for (i = 0; i < ARRAY_COUNT(sEffects); i++) { sEffects[i].type = MO_FX_NONE; + sEffects[i].epoch++; } this->actor.world.pos.x = 200.0f; this->actor.world.pos.y = MO_WATER_LEVEL(globalCtx) + 50.0f; @@ -2442,6 +2443,8 @@ void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { f32 phi_f20; f32 phi_f22; Vec3f sp110; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -2462,6 +2465,8 @@ void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { BossMo_InitRand(1, 29100, 9786); for (i = 0; i < 41; i++, matrix++) { + FrameInterpolation_RecordOpenChild("Morpha Tentacle", epoch + i * 25); + s32 pad; s32 pad2; @@ -2559,6 +2564,8 @@ void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { if ((i < 38) && ((i & 1) == 1)) { BossMo_UpdateTentColliders(this, i / 2, &this->tentCollider, &this->tentPos[i]); } + + FrameInterpolation_RecordCloseChild(); } Matrix_Pop(); diff --git a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 81686f84b..1a1a93b07 100644 --- a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -9,6 +9,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_10) @@ -2705,6 +2706,8 @@ s32 BossSst_OverrideHandTrailDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { BossSst* this = (BossSst*)thisx; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -2738,6 +2741,8 @@ void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < end; i++) { if (Math3D_Vec3fDistSq(&trail2->world.pos, &trail->world.pos) > 900.0f) { + FrameInterpolation_RecordOpenChild(trail, 0); + Matrix_SetTranslateRotateYXZ(trail->world.pos.x, trail->world.pos.y, trail->world.pos.z, &trail->world.rot); Matrix_Scale(0.02f, 0.02f, 0.02f, MTXMODE_APPLY); @@ -2749,6 +2754,8 @@ void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossSst_OverrideHandTrailDraw, NULL, trail, POLY_XLU_DISP); + + FrameInterpolation_RecordCloseChild(); } idx = (idx + 5) % 7; trail2 = trail; @@ -2955,6 +2962,8 @@ void BossSst_SpawnHeadShadow(BossSst* this) { shadow->scale = 1450; shadow->alpha = 254; shadow->status = 65; + + shadow->epoch++; } this->effects[3].status = -1; @@ -2968,6 +2977,7 @@ void BossSst_SpawnHandShadow(BossSst* this) { this->effects[0].scale = 2300; this->effects[0].alpha = 254; this->effects[0].status = 5; + this->effects[0].epoch++; this->effects[1].status = -1; } @@ -2981,6 +2991,7 @@ void BossSst_SpawnShockwave(BossSst* this) { for (i = 0; i < 3; i++) { BossSstEffect* shockwave = &this->effects[i]; + shockwave->epoch++; Math_Vec3f_Copy(&shockwave->pos, &this->actor.world.pos); shockwave->move = (i + 9) * 2; @@ -3035,6 +3046,8 @@ void BossSst_SpawnIceCrystal(BossSst* this, s32 index) { if ((index % 2) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_PL_FREEZE_S); } + + ice->epoch++; } void BossSst_SpawnIceShard(BossSst* this) { @@ -3050,6 +3063,7 @@ void BossSst_SpawnIceShard(BossSst* this) { for (i = 0; i < 18; i++) { BossSstEffect* ice = &this->effects[i]; + ice->epoch++; Math_Vec3f_Copy(&ice->pos, &spawnPos); ice->status = 1; @@ -3165,6 +3179,8 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < 18; i++) { effect = &this->effects[i]; + FrameInterpolation_RecordOpenChild(effect, effect->epoch); + if (effect->move) { func_8003435C(&effect->pos, globalCtx); if (this->effects[0].status != 0) { @@ -3182,6 +3198,8 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gBongoIceShardDL); } + + FrameInterpolation_RecordCloseChild(); } } else if (this->effectMode == BONGO_SHOCKWAVE) { f32 scaleY = 0.005f; @@ -3193,6 +3211,7 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < 3; i++, scaleY -= 0.001f) { effect = &this->effects[i]; + FrameInterpolation_RecordOpenChild(effect, effect->epoch); if (effect->move != 0) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); @@ -3205,6 +3224,8 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFireCircleDL); } + + FrameInterpolation_RecordCloseChild(); } } else if (this->effectMode == BONGO_SHADOW) { gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 10, 10, 80, 0); @@ -3212,12 +3233,16 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { effect = &this->effects[0]; while (effect->status != -1) { + FrameInterpolation_RecordOpenChild(effect, effect->epoch); + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale * 0.001f, 1.0f, effect->scale * 0.001f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, sShadowDList); + + FrameInterpolation_RecordCloseChild(); effect++; } } diff --git a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h index 8b2b311d6..32c12b7fd 100644 --- a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h +++ b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h @@ -17,7 +17,8 @@ typedef struct { /* 0x0020 */ s16 move; /* 0x0022 */ s16 status; /* 0x0024 */ u8 alpha; -} BossSstEffect; // size = 0x28 + /* 0x0028 */ s32 epoch; +} BossSstEffect; // size = 0x2C typedef struct { /* 0x0000 */ PosRot world; diff --git a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 8d19fdd8e..1252df4bf 100644 --- a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -2,6 +2,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_tw/object_tw.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" +#include "soh/frame_interpolation.h" #include @@ -467,6 +468,7 @@ void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) { for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) { sTwEffects[i].type = TWEFF_NONE; + sTwEffects[i].epoch++; } } @@ -3327,6 +3329,8 @@ void func_80942180(BossTw* this, GlobalContext* globalCtx) { void func_809426F0(BossTw* this, GlobalContext* globalCtx) { s32 pad; s16 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -3360,6 +3364,8 @@ void func_809426F0(BossTw* this, GlobalContext* globalCtx) { } for (i = 0; i < 8; i++) { + FrameInterpolation_RecordOpenChild("Twinrova 809426F0", epoch + i * 25); + Matrix_Push(); Matrix_Translate(0.0f, 0.0f, 5000.0f, MTXMODE_APPLY); Matrix_RotateZ(((i * M_PI) * 2.0f * 0.125f) + this->flameRotation, MTXMODE_APPLY); @@ -3373,6 +3379,8 @@ void func_809426F0(BossTw* this, GlobalContext* globalCtx) { G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); Matrix_Pop(); + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); @@ -4410,6 +4418,8 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { f32 scaleFactor; s16 tailIdx; s16 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -4420,6 +4430,8 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 20, 0, (s8)this->workf[TAIL_ALPHA]); gDPSetEnvColor(POLY_XLU_DISP++, 255, 215, 255, 128); for (i = 9; i >= 0; i--) { + FrameInterpolation_RecordOpenChild("Twinrova Fire Blast", epoch + i * 25); + gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll( globalCtx->state.gfxCtx, 0, ((this->work[CS_TIMER_1] * 3) + (i * 10)) & 0x7F, @@ -4434,6 +4446,8 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); + + FrameInterpolation_RecordCloseChild(); } break; @@ -4444,6 +4458,8 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, (s8)this->workf[TAIL_ALPHA]); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998)); for (i = 9; i >= 0; i--) { + FrameInterpolation_RecordOpenChild("Twinrova Ice Blast", epoch + i * 25); + gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll( globalCtx->state.gfxCtx, 0, ((this->work[CS_TIMER_1] * 3) + (i * 0xA)) & 0x7F, @@ -4458,6 +4474,8 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00)); + + FrameInterpolation_RecordCloseChild(); } break; @@ -4474,6 +4492,8 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { f32 scaleFactor; s16 tailIdx; s16 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -4484,6 +4504,8 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 215, 255, 128); for (i = 9; i >= 0; i--) { + FrameInterpolation_RecordOpenChild("Twinrova Death Ball 0", epoch + i * 25); + gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (((this->work[CS_TIMER_1] * 3) + (i * 0xA))) & 0x7F, (u8)((-this->work[CS_TIMER_1] * 0xF) + (i * 50)), 0x20, 0x40, 1, 0, 0, 0x20, @@ -4498,12 +4520,16 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); + + FrameInterpolation_RecordCloseChild(); } } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, (s8)this->workf[TAIL_ALPHA]); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998)); for (i = 9; i >= 0; i--) { + FrameInterpolation_RecordOpenChild("Twinrova Death Ball 1", epoch + i * 25); + gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (((this->work[CS_TIMER_1] * 3) + (i * 0xA))) & 0x7F, (u8)((-this->work[CS_TIMER_1] * 0xF) + (i * 50)), 0x20, 0x40, 1, 0, 0, 0x20, @@ -4518,6 +4544,8 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00)); + + FrameInterpolation_RecordCloseChild(); } } @@ -4883,6 +4911,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) { if (currentEffect->type == 1) { + FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch); + if (sp18F == 0) { gSPDisplayList(POLY_XLU_DISP++, object_tw_DL_01A528); sp18F++; @@ -4896,8 +4926,9 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_tw_DL_01A5A8); - } + FrameInterpolation_RecordCloseChild(); + } currentEffect++; } @@ -4906,6 +4937,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) { if (currentEffect->type == 3) { + FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch); + if (sp18F == 0) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998)); sp18F++; @@ -4921,6 +4954,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00)); + + FrameInterpolation_RecordCloseChild(); } currentEffect++; } @@ -4930,6 +4965,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) { if (currentEffect->type == 2) { + FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch); + if (sp18F == 0) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 255, 215, 255, 128); @@ -4946,6 +4983,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); + + FrameInterpolation_RecordCloseChild(); } currentEffect++; @@ -4956,6 +4995,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) { if (currentEffect->type == 4) { + FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch); + if (sp18F == 0) { sp18F++; } @@ -4991,6 +5032,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2); gSPClearGeometryMode(POLY_XLU_DISP++, G_CULL_BACK | G_FOG); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A790)); + + FrameInterpolation_RecordCloseChild(); } currentEffect++; @@ -5004,6 +5047,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { Vec3f off; if (currentEffect->type == TWEFF_PLYR_FRZ) { + FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch); + if (sp18F == 0) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AA50)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, 255); @@ -5037,6 +5082,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00)); } + + FrameInterpolation_RecordCloseChild(); } currentEffect++; @@ -5047,6 +5094,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) { if (currentEffect->type >= 6) { + FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch); + if (currentEffect->work[EFF_ARGS] == 0) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, currentEffect->alpha); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998)); @@ -5070,6 +5119,8 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { } else { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); } + + FrameInterpolation_RecordCloseChild(); } currentEffect++; diff --git a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h index 51b664726..1a4a31438 100644 --- a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h +++ b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h @@ -43,6 +43,7 @@ typedef struct { /* 0x002E */ s16 work[EFF_WORK_MAX]; /* 0x0034 */ f32 workf[EFF_FWORK_MAX]; /* 0x0044 */ Actor* target; + s32 epoch; } BossTwEffect; typedef enum { diff --git a/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 6f492145b..b4236ef25 100644 --- a/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -4006,6 +4006,8 @@ void BossVa_DrawDoor(GlobalContext* globalCtx, s16 scale) { f32 yScale; f32 segAngle = 0.0f; s32 i; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -4023,6 +4025,8 @@ void BossVa_DrawDoor(GlobalContext* globalCtx, s16 scale) { Matrix_Get(&doorMtx); for (i = 0; i < 8; i++, segAngle -= M_PI / 4) { + FrameInterpolation_RecordOpenChild("Barinade Door", epoch + i * 25); + Matrix_Put(&doorMtx); Matrix_RotateZ(segAngle, MTXMODE_APPLY); Matrix_Translate(0.0f, doorPieceLength[i] * yScale, 0.0f, MTXMODE_APPLY); @@ -4030,6 +4034,8 @@ void BossVa_DrawDoor(GlobalContext* globalCtx, s16 scale) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, doorPieceDispList[i]); + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index 0c0a57317..fd131a244 100644 --- a/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -10,6 +10,7 @@ #include "objects/object_demo_6k/object_demo_6k.h" #include "objects/object_gnd_magic/object_gnd_magic.h" #include "overlays/actors/ovl_Eff_Dust/z_eff_dust.h" +#include "soh/frame_interpolation.h" #define FLAGS ACTOR_FLAG_4 @@ -563,9 +564,10 @@ void func_80967FFC(Actor* thisx, GlobalContext* globalCtx) { Demo6K* this = (Demo6K*)thisx; s32 pad; u16 timer1 = this->timer1; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); - func_80093D84(globalCtx->state.gfxCtx); Matrix_RotateX(-M_PI / 2, MTXMODE_APPLY); gSPSegment(POLY_XLU_DISP++, 0x08, @@ -584,6 +586,8 @@ void func_80967FFC(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZ(-M_PI / 2, MTXMODE_APPLY); for (i = 0; i < 6; i++) { + FrameInterpolation_RecordOpenChild("Demo6K 80967FFC", epoch + i * 25); + Matrix_RotateZ(M_PI / 3, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -591,6 +595,8 @@ void func_80967FFC(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, colors[i][0].r, colors[i][0].g, colors[i][0].b, 255); gDPSetEnvColor(POLY_XLU_DISP++, colors[i][1].r, colors[i][1].g, colors[i][1].b, 255); gSPDisplayList(POLY_XLU_DISP++, object_demo_6k_DL_0022B0); + + FrameInterpolation_RecordCloseChild(); } // required to avoid optimizing out i @@ -689,6 +695,8 @@ void func_809688C4(Actor* thisx, GlobalContext* globalCtx2) { GlobalContext* globalCtx = globalCtx2; u32 frames = globalCtx->state.frames; s32 i; + static s32 epoch = 0; + epoch++; if ((i = (globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[1] != NULL)) && (globalCtx->csCtx.npcActions[1]->action != 1)) { @@ -699,6 +707,8 @@ void func_809688C4(Actor* thisx, GlobalContext* globalCtx2) { Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); for (i = 0; i < 16; i++) { + FrameInterpolation_RecordOpenChild("Demo6K 809688C4", epoch + i * 25); + gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, sEnvColors[this->unk_274[i]].r, sEnvColors[this->unk_274[i]].g, sEnvColors[this->unk_274[i]].b, 255); @@ -712,6 +722,8 @@ void func_809688C4(Actor* thisx, GlobalContext* globalCtx2) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); Matrix_Pop(); + + FrameInterpolation_RecordCloseChild(); } gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); diff --git a/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index b365b3038..6ca6a025b 100644 --- a/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -3,6 +3,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_efc_star_field/object_efc_star_field.h" #include "objects/object_toki_objects/object_toki_objects.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -521,6 +522,8 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { f32 translateY; f32 translateZ; s16 j; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -594,6 +597,8 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { Matrix_Scale(sRainScale * 0.001f, sRainScale * 0.001f, sRainScale * 0.001f, MTXMODE_APPLY); for (j = 0; j < 5; j++) { + FrameInterpolation_RecordOpenChild("Kankyo Rain", epoch + i * j * 25); + s32 pad1; if (globalCtx->sceneNum != SCENE_TOKINOMA) { @@ -623,6 +628,8 @@ void DemoKankyo_DrawRain(Actor* thisx, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); gSPDisplayList(POLY_XLU_DISP++, object_efc_star_field_DL_000080); + + FrameInterpolation_RecordCloseChild(); } } CLOSE_DISPS(globalCtx->state.gfxCtx); @@ -656,10 +663,14 @@ void DemoKankyo_DrawClouds(Actor* thisx, GlobalContext* globalCtx) { f32 dx; f32 dy; f32 dz; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); for (i = 0; i < 30; i++) { + FrameInterpolation_RecordOpenChild("Kankyo Clouds", epoch + i * 25); + dx = -(Math_SinS(this->unk_150[i].unk_20 - 0x8000) * 120.0f) * (30.0f + (i / 30.0f) * 10.0f); dy = Math_CosS(this->unk_150[i].unk_20 - 0x8000) * 5.0f + 1200.0f; dz = (Math_CosS(this->unk_150[i].unk_20 - 0x8000) * 120.0f) * (30.0f + (i / 30.0f) * 10.0f); @@ -681,6 +692,8 @@ void DemoKankyo_DrawClouds(Actor* thisx, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, SEG_ADDR(1, 0), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffDustDL); + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); @@ -771,6 +784,8 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { f32 translateZ; PosRot posRot; u8 linkAge = gSaveContext.linkAge; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -778,6 +793,8 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { this->sparkleCounter += 2; } for (i = this->sparkleCounter - 1; i >= 0; i--) { + FrameInterpolation_RecordOpenChild("Kankyo Warp Sparkles", epoch + i * 25); + temp_f22 = 1.0f - (i / (f32)this->sparkleCounter); switch (this->unk_150[i].unk_22) { @@ -891,6 +908,8 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, disp); this->unk_150[i].unk_24 += 0x190; } + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); @@ -914,6 +933,8 @@ void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { f32 scale; s16 i; PosRot posRot; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -922,6 +943,8 @@ void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { } for (i = this->sparkleCounter - 1; i >= 0; i--) { + FrameInterpolation_RecordOpenChild("Kankyo Sparkles", epoch + i * 25); + temp_f20 = 1.0f - (i / (f32)this->sparkleCounter); switch (this->unk_150[i].unk_22) { @@ -993,6 +1016,8 @@ void DemoKankyo_DrawSparkles(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); this->unk_150[i].unk_24 += 0x190; } + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c index 08ceebc18..cf0159eed 100644 --- a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c +++ b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c @@ -1,5 +1,6 @@ #include "z_efc_erupc.h" #include "objects/object_efc_erupc/object_efc_erupc.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -167,6 +168,8 @@ void EfcErupc_DrawParticles(EfcErupcParticles* particles, GlobalContext* globalC OPEN_DISPS(gfxCtx); for (i = 0; i < EFC_ERUPC_NUM_PARTICLES; i++, particles++) { + FrameInterpolation_RecordOpenChild(particles, particles->epoch); + if (particles->isActive) { func_80093D84(globalCtx->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, object_efc_erupc_DL_002760); @@ -181,7 +184,10 @@ void EfcErupc_DrawParticles(EfcErupcParticles* particles, GlobalContext* globalC G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_efc_erupc_DL_0027D8); } + + FrameInterpolation_RecordCloseChild(); } + CLOSE_DISPS(gfxCtx); } @@ -249,5 +255,6 @@ void EfcErupc_InitParticles(EfcErupcParticles* particles) { for (i = 0; i < EFC_ERUPC_NUM_PARTICLES; i++, particles++) { particles->isActive = false; + particles->epoch++; } } diff --git a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h index 6b201cf5d..6e7fa6693 100644 --- a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h +++ b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h @@ -19,7 +19,8 @@ typedef struct { /* 0x30 */ char unk_2C[4]; /* 0x34 */ f32 scale; /* 0x38 */ char unk_34[8]; -} EfcErupcParticles; // size 0x3C + /* 0x3C */ s32 epoch; +} EfcErupcParticles; // size 0x40 #define EFC_ERUPC_NUM_PARTICLES 100 diff --git a/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index 15704ef2d..e3af7ba4d 100644 --- a/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -6,6 +6,7 @@ #include "z_eff_dust.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -268,6 +269,8 @@ void EffDust_DrawFunc_8099E4F4(Actor* thisx, GlobalContext* globalCtx2) { f32* distanceTraveled; s32 i; f32 aux; + static s32 epoch = 0; + epoch++; OPEN_DISPS(gfxCtx); @@ -283,6 +286,8 @@ void EffDust_DrawFunc_8099E4F4(Actor* thisx, GlobalContext* globalCtx2) { gSPSegment(POLY_XLU_DISP++, 0x08, sEmptyDL); for (i = 0; i < 64; i++) { + FrameInterpolation_RecordOpenChild("Dust 8099E4F4", epoch + i * 25); + if (*distanceTraveled < 1.0f) { aux = 1.0f - (*distanceTraveled * *distanceTraveled); Matrix_Translate(this->actor.world.pos.x + (initialPositions->x * ((this->dx * aux) + (1.0f - this->dx))), @@ -298,6 +303,8 @@ void EffDust_DrawFunc_8099E4F4(Actor* thisx, GlobalContext* globalCtx2) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); } + FrameInterpolation_RecordCloseChild(); + initialPositions++; distanceTraveled++; } @@ -314,6 +321,8 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx2) { s32 i; f32 aux; Player* player = GET_PLAYER(globalCtx); + static s32 epoch = 0; + epoch++; OPEN_DISPS(gfxCtx); @@ -333,6 +342,8 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx2) { gSPSegment(POLY_XLU_DISP++, 0x08, sEmptyDL); for (i = 0; i < 64; i++) { + FrameInterpolation_RecordOpenChild("Dust 8099E784", epoch + i * 25); + if (*distanceTraveled < 1.0f) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, *distanceTraveled * 255); @@ -357,6 +368,8 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx2) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); } + FrameInterpolation_RecordCloseChild(); + initialPositions++; distanceTraveled++; } diff --git a/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c b/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c index 409dc2a3b..e01c093c6 100644 --- a/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c +++ b/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c @@ -7,6 +7,7 @@ #include "z_en_anubice_fire.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_anubice/object_anubice.h" +#include "soh/frame_interpolation.h" #define FLAGS ACTOR_FLAG_4 @@ -62,6 +63,7 @@ void EnAnubiceFire_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_15A = 30; this->unk_154 = 2.0f; this->scale = 0.0f; + this->epoch++; for (i = 0; i < 6; i++) { this->unk_160[i] = this->actor.world.pos; @@ -230,6 +232,8 @@ void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Push(); for (i = this->unk_15E; i < 6; ++i) { + FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); + f32 scale = this->actor.scale.x - (i * 0.2f); if (scale < 0.0f) { @@ -248,6 +252,8 @@ void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gAnubiceFireAttackDL); } + FrameInterpolation_RecordCloseChild(); + if (this->scale < 0.1f) { break; } diff --git a/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h b/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h index 1ea831ffc..848bcdae9 100644 --- a/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h +++ b/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h @@ -19,6 +19,7 @@ typedef struct EnAnubiceFire { /* 0x015E */ s16 unk_15E; /* 0x0178 */ Vec3f unk_160[6]; /* 0x01A8 */ ColliderCylinder cylinder; -} EnAnubiceFire; // size = 0x01F4 + /* 0x01F4 */ s32 epoch; +} EnAnubiceFire; // size = 0x01F8 #endif diff --git a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c index 6b06c50c4..c2a878288 100644 --- a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -6,6 +6,7 @@ #include "z_en_ba.h" #include "objects/object_bxa/object_bxa.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4) @@ -107,6 +108,7 @@ void EnBa_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 4; this->upperParams = (thisx->params >> 8) & 0xFF; thisx->params &= 0xFF; + this->epoch++; if (this->actor.params < EN_BA_DEAD_BLOB) { if (Flags_GetSwitch(globalCtx, this->upperParams)) { @@ -489,6 +491,8 @@ void EnBa_Draw(Actor* thisx, GlobalContext* globalCtx) { Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 16, 1, 0, (globalCtx->gameplayFrames * -10) % 128, 32, 32)); for (i = 0; i < 14; i++, mtx++) { + FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); + Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); Matrix_RotateZYX(this->unk2A8[i].x, this->unk2A8[i].y, this->unk2A8[i].z, MTXMODE_APPLY); Matrix_Scale(this->unk200[i].x, this->unk200[i].y, this->unk200[i].z, MTXMODE_APPLY); @@ -504,6 +508,8 @@ void EnBa_Draw(Actor* thisx, GlobalContext* globalCtx) { } } MATRIX_TOMTX(mtx); + + FrameInterpolation_RecordCloseChild(); } Matrix_Pop(); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), diff --git a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h index 008ec9597..a43c33e81 100644 --- a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h +++ b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.h @@ -32,6 +32,7 @@ typedef struct EnBa { /* 0x031C */ s16 unk31C; /* 0x0320 */ ColliderJntSph collider; /* 0x0340 */ ColliderJntSphElement colliderItems[2]; -} EnBa; // size = 0x03C0 + /* 0x03C0 */ s32 epoch; +} EnBa; // size = 0x03C4 #endif diff --git a/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.c index bd4fc5767..7c9749dd3 100644 --- a/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -6,6 +6,7 @@ #include "z_en_bx.h" #include "objects/object_bxa/object_bxa.h" +#include "soh/frame_interpolation.h" #define FLAGS ACTOR_FLAG_4 @@ -103,6 +104,7 @@ void EnBx_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(&this->actor); } thisx->params &= 0xFF; + this->epoch++; } void EnBx_Destroy(Actor* thisx, GlobalContext* globalCtx) { @@ -235,10 +237,14 @@ void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx) { } for (i = 0; i < 4; i++, mtx++) { + FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); + Matrix_Translate(this->unk_154[i].x, this->unk_154[i].y, this->unk_154[i].z, MTXMODE_NEW); Matrix_RotateZYX(this->unk_1B4[i].x, this->unk_1B4[i].y, this->unk_1B4[i].z, MTXMODE_APPLY); Matrix_Scale(this->unk_184[i].x, this->unk_184[i].y, this->unk_184[i].z, MTXMODE_APPLY); MATRIX_TOMTX(mtx); + + FrameInterpolation_RecordCloseChild(); } gSPDisplayList(POLY_OPA_DISP++, object_bxa_DL_0022F0); diff --git a/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.h b/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.h index 189349a0f..e842ce3a0 100644 --- a/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.h +++ b/soh/src/overlays/actors/ovl_En_Bx/z_en_bx.h @@ -16,6 +16,7 @@ typedef struct EnBx { /* 0x01B4 */ Vec3s unk_1B4[4]; /* 0x01CC */ ColliderCylinder collider; /* 0x0218 */ ColliderQuad colliderQuad; -} EnBx; // size = 0x0298 + /* 0x0298 */ s32 epoch; +} EnBx; // size = 0x029C #endif diff --git a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 90a838ad2..097250ff5 100644 --- a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -2,6 +2,8 @@ #include +#include "soh/frame_interpolation.h" + #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx); @@ -278,6 +280,7 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { globalCtx->specialEffects = &sClearTagEffects[0]; for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++) { sClearTagEffects[i].type = CLEAR_TAG_EFFECT_AVAILABLE; + sClearTagEffects[i].epoch++; } this->drawMode = CLEAR_TAG_DRAW_MODE_ALL; } @@ -902,6 +905,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { // Draw all Debris effects. for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { + FrameInterpolation_RecordOpenChild(effect, effect->epoch); + if (effect->type == CLEAR_TAG_EFFECT_DEBRIS) { // Apply the debris effect material if it has not already been applied. if (!isMaterialApplied) { @@ -918,6 +923,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gArwingDebrisEffectDL); } + + FrameInterpolation_RecordCloseChild(); } // Draw all ground flash effects. @@ -925,6 +932,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { isMaterialApplied = false; for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { if (effect->type == CLEAR_TAG_EFFECT_FLASH) { + FrameInterpolation_RecordOpenChild(effect, effect->epoch); + // Apply the flash ground effect material if it has not already been applied. if (!isMaterialApplied) { gDPPipeSync(POLY_XLU_DISP++); @@ -941,6 +950,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingFlashEffectGroundDL); + + FrameInterpolation_RecordCloseChild(); } } @@ -949,6 +960,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { isMaterialApplied = false; for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { if (effect->type == CLEAR_TAG_EFFECT_SMOKE) { + FrameInterpolation_RecordOpenChild(effect, effect->epoch); + // Apply the smoke effect material if it has not already been applied. if (!isMaterialApplied) { gSPDisplayList(POLY_XLU_DISP++, gArwingFireEffectMaterialDL); @@ -970,6 +983,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingFireEffectDL); + + FrameInterpolation_RecordCloseChild(); } } @@ -978,6 +993,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { isMaterialApplied = false; for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { if (effect->type == CLEAR_TAG_EFFECT_FIRE) { + FrameInterpolation_RecordOpenChild(effect, effect->epoch); + // Apply the fire effect material if it has not already been applied. if (!isMaterialApplied) { gSPDisplayList(POLY_XLU_DISP++, gArwingFireEffectMaterialDL); @@ -996,6 +1013,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingFireEffectDL); + + FrameInterpolation_RecordCloseChild(); } } @@ -1004,6 +1023,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { isMaterialApplied = false; for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) { if (effect->type == CLEAR_TAG_EFFECT_FLASH) { + FrameInterpolation_RecordOpenChild(effect, effect->epoch); + // Apply the flash billboard effect material if it has not already been applied. if (!isMaterialApplied) { gDPPipeSync(POLY_XLU_DISP++); @@ -1019,6 +1040,8 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gArwingFlashEffectDL); + + FrameInterpolation_RecordCloseChild(); } } diff --git a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h index 707fbb4a5..4c9b92584 100644 --- a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h +++ b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h @@ -88,7 +88,8 @@ typedef struct EnClearTagEffect { /* 0x0058 */ f32 rotationX; /* 0x005C */ f32 floorHeight; /* 0x0060 */ Vec3f floorTangent; -} EnClearTagEffect; // size = 0x6C + /* 0x006C */ s32 epoch; +} EnClearTagEffect; // size = 0x70 #define CLEAR_TAG_EFFECT_MAX_COUNT 100 diff --git a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index c5d1e649c..4f59f8982 100644 --- a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -2,6 +2,7 @@ #include "overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h" #include "vt.h" #include "objects/object_efc_star_field/object_efc_star_field.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -303,6 +304,7 @@ void EnEncount2_ParticleInit(EnEncount2* this, Vec3f* particlePos, f32 scale) { particle->moveDirection.y = -20.0f; particle->moveDirection.z = Rand_CenteredFloat(20.0f); particle->isAlive = 1; + particle->epoch++; break; } } @@ -354,6 +356,8 @@ void EnEncount2_ParticleDraw(Actor* thisx, GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objBankIndex].segment); for (i = 0; i < ARRAY_COUNT(this->particles); particle++, i++) { + FrameInterpolation_RecordOpenChild(particle, particle->epoch); + if (particle->isAlive) { Matrix_Translate(particle->pos.x, particle->pos.y, particle->pos.z, MTXMODE_NEW); Matrix_RotateX(particle->rot.x * (M_PI / 180.0f), MTXMODE_APPLY); @@ -366,6 +370,8 @@ void EnEncount2_ParticleDraw(Actor* thisx, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_efc_star_field_DL_000DE0); } + + FrameInterpolation_RecordCloseChild(); } } diff --git a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h index 302affd9a..b4c7db491 100644 --- a/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h +++ b/soh/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h @@ -14,7 +14,8 @@ typedef struct { /* 0x0010 */ u8 isAlive; /* 0x0014 */ Vec3f moveDirection; /* 0x0020 */ Vec3f rot; -} EnEncount2Particle; // size = 0x2C + /* 0x002C */ s32 epoch; +} EnEncount2Particle; // size = 0x30 typedef struct EnEncount2 { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.c index cd3bd87e7..0cc83f4e0 100644 --- a/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -7,6 +7,7 @@ #include "z_en_fd.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_fw/object_fw.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9) @@ -812,6 +813,7 @@ void EnFd_AddEffect(EnFd* this, u8 type, Vec3f* pos, Vec3f* velocity, Vec3f* acc eff->color.a = 255; eff->timer = (s16)(Rand_ZeroOne() * 10.0f); } + eff->epoch++; return; } } @@ -886,6 +888,8 @@ void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx) { func_80093D84(globalCtx->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) { if (eff->type == FD_EFFECT_FLAME) { + FrameInterpolation_RecordOpenChild(eff, eff->epoch); + if (!firstDone) { POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_7928); @@ -902,8 +906,11 @@ void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx) { idx = eff->timer * (8.0f / eff->initialTimer); gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(dustTextures[idx])); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerSquareParticleDL); + + FrameInterpolation_RecordCloseChild(); } } + CLOSE_DISPS(globalCtx->state.gfxCtx); } @@ -919,6 +926,8 @@ void EnFd_DrawDots(EnFd* this, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) { if (eff->type == FD_EFFECT_DOT) { + FrameInterpolation_RecordOpenChild(eff, eff->epoch); + if (!firstDone) { func_80093D84(globalCtx->state.gfxCtx); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_79F8); @@ -933,6 +942,8 @@ void EnFd_DrawDots(EnFd* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerTriangleParticleDL); + + FrameInterpolation_RecordCloseChild(); } } diff --git a/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.h b/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.h index a00b622c9..7dc990a7e 100644 --- a/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.h +++ b/soh/src/overlays/actors/ovl_En_Fd/z_en_fd.h @@ -25,6 +25,7 @@ typedef struct { /* 0x0014 */ Vec3f pos; /* 0x0020 */ Vec3f velocity; /* 0x002C */ Vec3f accel; + s32 epoch; } EnFdEffect; // size = 0x38 typedef struct EnFd { diff --git a/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.c index c0f0a048c..23073ed1a 100644 --- a/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -8,6 +8,7 @@ #include "objects/object_fw/object_fw.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9) @@ -421,6 +422,7 @@ void EnFw_AddDust(EnFw* this, Vec3f* initialPos, Vec3f* initialSpeed, Vec3f* acc eff->pos = *initialPos; eff->accel = *accel; eff->velocity = *initialSpeed; + eff->epoch++; return; } } @@ -464,6 +466,8 @@ void EnFw_DrawDust(EnFw* this, GlobalContext* globalCtx) { func_80093D84(globalCtx->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) { + FrameInterpolation_RecordOpenChild(eff, eff->epoch); + if (eff->type != 0) { if (!firstDone) { POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0U); @@ -484,6 +488,8 @@ void EnFw_DrawDust(EnFw* this, GlobalContext* globalCtx) { gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(dustTextures[idx])); gSPDisplayList(POLY_XLU_DISP++, gFlareDancerSquareParticleDL); } + + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.h b/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.h index f7d245e5e..0230a2c3d 100644 --- a/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.h +++ b/soh/src/overlays/actors/ovl_En_Fw/z_en_fw.h @@ -19,6 +19,7 @@ typedef struct { /* 0x0014 */ Vec3f pos; /* 0x0020 */ Vec3f velocity; /* 0x002C */ Vec3f accel; + s32 epoch; } EnFwEffect; typedef struct EnFw { diff --git a/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.c index 5381efc5b..7ee3412b6 100644 --- a/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -1,5 +1,6 @@ #include "z_en_fz.h" #include "objects/object_fz/object_fz.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_10) @@ -756,6 +757,7 @@ void EnFz_SpawnIceSmokeNoFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* iceSmoke->xyScale = xyScale / 1000.0f; iceSmoke->primAlpha = 0; iceSmoke->timer = 0; + iceSmoke->epoch++; break; } @@ -780,6 +782,7 @@ void EnFz_SpawnIceSmokeFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* ac iceSmoke->primAlpha = primAlpha; iceSmoke->timer = 0; iceSmoke->isTimerMod8 = isTimerMod8; + iceSmoke->epoch++; break; } @@ -864,6 +867,8 @@ void EnFz_DrawIceSmoke(EnFz* this, GlobalContext* globalCtx) { func_80093D84(globalCtx->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->iceSmoke); i++) { + FrameInterpolation_RecordOpenChild(iceSmoke, iceSmoke->epoch); + if (iceSmoke->type > 0) { gDPPipeSync(POLY_XLU_DISP++); @@ -884,6 +889,8 @@ void EnFz_DrawIceSmoke(EnFz* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gFreezardSteamDL)); } + FrameInterpolation_RecordCloseChild(); + iceSmoke++; } diff --git a/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.h b/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.h index 536d2525f..471a2fce2 100644 --- a/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.h +++ b/soh/src/overlays/actors/ovl_En_Fz/z_en_fz.h @@ -21,6 +21,7 @@ typedef struct { /* 0x0030 */ f32 xyScale; // /* 0x0034 */ f32 xyScaleTarget; /* 0x0038 */ u8 isTimerMod8; // conditional, used to run CollisionCheck_SetAT + s32 epoch; } EnFzEffectSsIceSmoke; // size = 0x3C typedef struct EnFz { diff --git a/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index 93c1061d7..f4740dbb3 100644 --- a/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -12,6 +12,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_tsubo/object_tsubo.h" #include "objects/object_gi_rupy/object_gi_rupy.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -533,6 +534,7 @@ void EnGSwitch_SpawnEffects(EnGSwitch* this, Vec3f* pos, s16 scale, s16 colorIdx f32 pitch; f32 yaw; + effect->epoch++; effect->pos = *pos; effect->scale = scale; effect->colorIdx = colorIdx; @@ -590,6 +592,7 @@ void EnGSwitch_DrawEffects(EnGSwitch* this, GlobalContext* globalCtx) { func_80093D18(globalCtx->state.gfxCtx); for (i = 0; i < this->numEffects; i++, effect++) { if (effect->flag) { + FrameInterpolation_RecordOpenChild(effect, effect->epoch); scale = effect->scale / 10000.0f; Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); @@ -600,6 +603,7 @@ void EnGSwitch_DrawEffects(EnGSwitch* this, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sRupeeTextures[effect->colorIdx])); gSPDisplayList(POLY_OPA_DISP++, gRupeeDL); + FrameInterpolation_RecordCloseChild(); } } CLOSE_DISPS(gfxCtx); diff --git a/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h b/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h index dba5b09c0..366a7d120 100644 --- a/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h +++ b/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h @@ -32,6 +32,7 @@ typedef struct { /* 0x12 */ u8 flag; /* 0x14 */ Vec3f velocity; /* 0x20 */ Vec3f rot; + s32 epoch; } EnGSwitchEffect; // size = 0x2C typedef struct EnGSwitch { diff --git a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c index a92ef3d6d..31fe04e90 100644 --- a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -6,6 +6,7 @@ #include "z_en_gb.h" #include "objects/object_ps/object_ps.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) @@ -184,6 +185,7 @@ void EnGb_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionTimer = (s16)Rand_ZeroFloat(100.0f) + 100; for (i = 0; i < ARRAY_COUNT(sCagedSoulPositions); i++) { + this->cagedSouls[i].epoch++; this->cagedSouls[i].infoIdx = (s32)Rand_ZeroFloat(30.0f) % 3; this->cagedSouls[i].unk_14.x = this->cagedSouls[i].translation.x = sCagedSoulPositions[i].x + this->dyna.actor.world.pos.x; @@ -524,6 +526,7 @@ void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx) { for (i = 0; i < 4; i++) { s32 idx = this->cagedSouls[i].infoIdx; + FrameInterpolation_RecordOpenChild(&this->cagedSouls[i], this->cagedSouls[i].epoch); gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (u32)(sCagedSoulInfo[idx].timerMultiplier * this->frameTimer) % 512, 32, 128)); @@ -548,6 +551,7 @@ void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gPoeSellerCagedSoulDL); Matrix_Pop(); + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h index 5de160ff2..48908d7e5 100644 --- a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h +++ b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h @@ -27,6 +27,7 @@ typedef struct { /* 0x20 */ f32 unk_20; /* 0x24 */ f32 unk_24; /* 0x28 */ f32 unk_28; + s32 epoch; } EnGbCagedSoul; // size = 0x2C typedef struct EnGb { diff --git a/soh/src/overlays/actors/ovl_En_Go/z_en_go.c b/soh/src/overlays/actors/ovl_En_Go/z_en_go.c index 050bfc4d1..e1179fe1b 100644 --- a/soh/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/soh/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -2,6 +2,7 @@ #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_oF1d_map/object_oF1d_map.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -1133,11 +1134,9 @@ void EnGo_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->actionFunc == EnGo_CurledUp) { EnGo_DrawCurledUp(this, globalCtx); - return; // needed for match? } else if (this->actionFunc == EnGo_GoronLinkRolling || this->actionFunc == func_80A3FEB4 || this->actionFunc == EnGo_StopRolling || this->actionFunc == func_80A3FEB4) { EnGo_DrawRolling(this, globalCtx); - return; // needed for match? } else { func_800943C8(globalCtx->state.gfxCtx); @@ -1146,9 +1145,9 @@ void EnGo_Draw(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGo_OverrideLimbDraw, EnGo_PostLimbDraw, &this->actor); - CLOSE_DISPS(globalCtx->state.gfxCtx); EnGo_DrawDust(this, globalCtx); } + CLOSE_DISPS(globalCtx->state.gfxCtx); } void EnGo_AddDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 initialTimer, f32 scale, f32 scaleStep) { @@ -1158,6 +1157,7 @@ void EnGo_AddDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 init for (i = 0; i < ARRAY_COUNT(this->dustEffects); i++, dustEffect++) { if (dustEffect->type != 1) { + dustEffect->epoch++; dustEffect->scale = scale; dustEffect->scaleStep = scaleStep; timer = initialTimer; @@ -1218,6 +1218,7 @@ void EnGo_DrawDust(EnGo* this, GlobalContext* globalCtx) { firstDone = true; } + FrameInterpolation_RecordOpenChild(dustEffect, dustEffect->epoch); alpha = dustEffect->timer * (255.0f / dustEffect->initialTimer); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); gDPPipeSync(POLY_XLU_DISP++); @@ -1230,6 +1231,7 @@ void EnGo_DrawDust(EnGo* this, GlobalContext* globalCtx) { index = dustEffect->timer * (8.0f / dustEffect->initialTimer); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(dustTex[index])); gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); + FrameInterpolation_RecordCloseChild(); } } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_En_Go/z_en_go.h b/soh/src/overlays/actors/ovl_En_Go/z_en_go.h index 2aef4b168..94bad5bab 100644 --- a/soh/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/soh/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -34,6 +34,7 @@ typedef struct { /* 0x0014 */ Vec3f pos; /* 0x0020 */ Vec3f velocity; /* 0x002C */ Vec3f accel; + s32 epoch; } EnGoEffect; // size = 0x38 typedef struct EnGo { diff --git a/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 4ea819f33..22c19f5f0 100644 --- a/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -2,6 +2,7 @@ #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_oF1d_map/object_oF1d_map.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -140,8 +141,6 @@ typedef enum { /* 10 */ ENGO2_ANIM_10, /* 11 */ ENGO2_ANIM_11, /* 12 */ ENGO2_ANIM_12, - /* 13 */ ENGO2_ANIM_13, // Fixed Goron Wakeup Animation - /* 14 */ ENGO2_ANIM_14 // Fixed Biggoron Wakeup Animation } EnGo2Animation; static AnimationInfo sAnimationInfo[] = { @@ -151,8 +150,7 @@ static AnimationInfo sAnimationInfo[] = { { &gGoronAnim_002D80, 1.0f, 0.0f, -1.0f, 0x02, -8.0f }, { &gGoronAnim_00161C, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_001A00, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_0021D0, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_004930, 0.0f, 0.0f, -1.0f, 0x01, -8.0f }, { &gGoronAnim_000750, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, - { &gGoronAnim_000D5C, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_004930, 0.0f, 0.0f, -1.0f, 0x00, 0.0f }, - { &gGoronAnim_004930, 0.0f, 1.0f, -1.0f, 0x01, 0.0f }, + { &gGoronAnim_000D5C, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, }; static EnGo2DustEffectData sDustEffectData[2][4] = { @@ -179,6 +177,7 @@ void EnGo2_AddDust(EnGo2* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 in for (i = 0; i < ARRAY_COUNT(this->dustEffects); i++, dustEffect++) { if (dustEffect->type != 1) { + dustEffect->epoch++; dustEffect->scale = scale; dustEffect->scaleStep = scaleStep; timer = initialTimer; @@ -239,6 +238,7 @@ void EnGo2_DrawDust(EnGo2* this, GlobalContext* globalCtx) { firstDone = true; } + FrameInterpolation_RecordOpenChild(dustEffect, dustEffect->epoch); alpha = dustEffect->timer * (255.0f / dustEffect->initialTimer); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); gDPPipeSync(POLY_XLU_DISP++); @@ -250,6 +250,7 @@ void EnGo2_DrawDust(EnGo2* this, GlobalContext* globalCtx) { index = dustEffect->timer * (8.0f / dustEffect->initialTimer); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sDustTex[index])); gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); + FrameInterpolation_RecordCloseChild(); } } @@ -1344,10 +1345,10 @@ void EnGo2_WakeUp(EnGo2* this, GlobalContext* globalCtx) { } if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { OnePointCutscene_Init(globalCtx, 4200, -99, &this->actor, MAIN_CAM); - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ((CVar_GetS32("gGoronSpeen", 0) == 1) ? ENGO2_ANIM_10 : ENGO2_ANIM_14)); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10); this->skelAnime.playSpeed = 0.5f; } else { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ((CVar_GetS32("gGoronSpeen", 0) == 1) ? ENGO2_ANIM_1 : ENGO2_ANIM_13)); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1); this->skelAnime.playSpeed = 1.0f; } this->actionFunc = func_80A46B40; diff --git a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 816d485b7..82c52f724 100644 --- a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -8,6 +8,7 @@ #include "objects/object_niw/object_niw.h" #include "overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h" #include "vt.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_23) @@ -1145,6 +1146,7 @@ void EnNiw_FeatherSpawn(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 s for (i = 0; i < ARRAY_COUNT(this->feathers); i++, feather++) { if (feather->type == 0) { + feather->epoch++; feather->type = 1; feather->pos = *pos; feather->vel = *vel; @@ -1202,6 +1204,7 @@ void EnNiw_FeatherDraw(EnNiw* this, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(this->feathers); i++, feather++) { if (feather->type == 1) { + FrameInterpolation_RecordOpenChild(feather, feather->epoch); if (!flag) { gSPDisplayList(POLY_XLU_DISP++, gCuccoParticleAppearDL); flag++; @@ -1214,6 +1217,7 @@ void EnNiw_FeatherDraw(EnNiw* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCuccoParticleAliveDL); + FrameInterpolation_RecordCloseChild(); } } diff --git a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.h b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.h index d02732496..78d52af33 100644 --- a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -18,6 +18,7 @@ typedef struct { /* 0x002C */ f32 scale; /* 0x0030 */ f32 unk_30; /* 0x0034 */ u8 timer; + s32 epoch; } EnNiwFeather; // size = 0x0038 typedef struct EnNiw { diff --git a/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index 129e62d5b..b2db1621a 100644 --- a/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -6,6 +6,7 @@ #include "z_en_nwc.h" #include "objects/object_nwc/object_nwc.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -170,6 +171,7 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { if (chick->type != CHICK_NONE) { Mtx* mtx; + FrameInterpolation_RecordOpenChild(chick, chick->epoch); Matrix_SetTranslateRotateYXZ(chick->pos.x, chick->pos.y + chick->height, chick->pos.z, &chick->rot); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); mtx = MATRIX_NEWMTX(globalCtx->state.gfxCtx); @@ -180,6 +182,7 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { gSPDisplayList(dList2++, gCuccoChickEyesDL); gSPMatrix(dList3++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(dList3++, gCuccoChickBeakDL); + FrameInterpolation_RecordCloseChild(); } } @@ -190,6 +193,7 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { for (i = 0; i < this->count; i++, chick++) { if ((chick->type != CHICK_NONE) && (chick->floorPoly != NULL)) { + FrameInterpolation_RecordOpenChild(chick, chick->epoch * 25); func_80038A28(chick->floorPoly, chick->pos.x, chick->floorY, chick->pos.z, &floorMat); Matrix_Put(&floorMat); Matrix_RotateY(chick->rot.y * (M_PI / 0x8000), MTXMODE_APPLY); @@ -197,6 +201,7 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCuccoChickShadowDL); + FrameInterpolation_RecordCloseChild(); } } CLOSE_DISPS(globalCtx->state.gfxCtx); @@ -220,6 +225,7 @@ void EnNwc_Init(Actor* thisx, GlobalContext* globalCtx) { this->count = 16; chick = this->chicks; for (i = 0; i < this->count; i++, chick++) { + chick->epoch++; chick->type = CHICK_NORMAL; chick->pos.x = thisx->world.pos.x + ((Rand_ZeroOne() * 100.0f) - 50.0f); chick->pos.y = thisx->world.pos.y + 20.0f; diff --git a/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h b/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h index 0597ce76c..fa57bb2f3 100644 --- a/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h +++ b/soh/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h @@ -23,6 +23,7 @@ typedef struct EnNwcChick { /* 0x36 */ u16 height; /* 0x38 */ CollisionPoly* floorPoly; /* 0x44 */ char unk_3C[0x20]; + s32 epoch; } EnNwcChick; // size = 0x5C typedef struct EnNwc { diff --git a/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.c b/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.c index 7d81a324a..a5831e3ec 100644 --- a/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -1,5 +1,6 @@ #include "z_en_ny.h" #include "objects/object_ny/object_ny.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2) @@ -107,6 +108,7 @@ static InitChainEntry sInitChain[] = { void EnNy_Init(Actor* thisx, GlobalContext* globalCtx) { EnNy* this = (EnNy*)thisx; + this->epoch++; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 2; @@ -577,6 +579,7 @@ void EnNy_DrawDeathEffect(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); for (i = 0; i < 8; i++) { if (this->timer < (i + 22)) { + FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); temp = &this->unk_1F8[i]; Matrix_Translate(temp->x, temp->y, temp->z, MTXMODE_NEW); scale = this->actor.scale.x * 0.4f * (1.0f + (i * 0.04f)); @@ -584,6 +587,7 @@ void EnNy_DrawDeathEffect(Actor* thisx, GlobalContext* globalCtx) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gEnNyRockBodyDL); + FrameInterpolation_RecordCloseChild(); } } CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.h b/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.h index fd93efcdb..ebc358254 100644 --- a/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.h +++ b/soh/src/overlays/actors/ovl_En_Ny/z_en_ny.h @@ -30,6 +30,7 @@ typedef struct EnNy { /* 0x01F0 */ f32 unk_1F0; /* 0x01F4 */ f32 unk_1F4; /* 0x01F8 */ Vec3f unk_1F8[16]; + s32 epoch; } EnNy; // size = 0x02B8 #endif diff --git a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 807292c24..d66cdae6c 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -7,6 +7,7 @@ #include "z_en_po_sisters.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_po_sisters/object_po_sisters.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9 | ACTOR_FLAG_12 | ACTOR_FLAG_14) @@ -179,6 +180,8 @@ void EnPoSisters_Init(Actor* thisx, GlobalContext* globalCtx) { EnPoSisters* this = (EnPoSisters*)thisx; s32 pad; + this->epoch++; + // Skip Poe Intro Cutscene if (gSaveContext.n64ddFlag && thisx->params == 4124) { Flags_SetSwitch(globalCtx, 0x1B); @@ -1186,7 +1189,7 @@ void EnPoSisters_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnPoSisters* this = (EnPoSisters*)thisx; s16 temp; - + if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; func_80AD9568(this); @@ -1413,6 +1416,7 @@ void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc != func_80ADBEE8) { phi_s5 = -i * 31 + 248; } + FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, temp_s7->r, temp_s7->g, temp_s7->b, phi_s5); Matrix_Translate(this->unk_234[i].x, this->unk_234[i].y, this->unk_234[i].z, MTXMODE_NEW); @@ -1425,6 +1429,7 @@ void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h index 2b3b7446a..cc55a1dc9 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h +++ b/soh/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h @@ -29,6 +29,7 @@ typedef struct EnPoSisters { /* 0x029C */ LightInfo lightInfo; /* 0x02AC */ ColliderCylinder collider; /* 0x02F8 */ MtxF unk_2F8; + s32 epoch; } EnPoSisters; // size = 0x0338 #endif diff --git a/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c b/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c index d8e680d90..a21e47ab7 100644 --- a/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c +++ b/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c @@ -7,6 +7,7 @@ #include "z_en_syateki_niw.h" #include "objects/object_niw/object_niw.h" #include "vt.h" +#include "soh/frame_interpolation.h" #define FLAGS ACTOR_FLAG_4 @@ -713,6 +714,7 @@ void func_80B131B8(EnSyatekiNiw* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f3 for (i = 0; i < 5; i++, ptr++) { if (ptr->unk_00 == 0) { + ptr->epoch++; ptr->unk_00 = 1; ptr->unk_04 = *arg1; ptr->unk_10 = *arg2; @@ -773,6 +775,7 @@ void func_80B13464(EnSyatekiNiw* this, GlobalContext* globalCtx) { flag++; } + FrameInterpolation_RecordOpenChild(ptr, ptr->epoch); Matrix_Translate(ptr->unk_04.x, ptr->unk_04.y, ptr->unk_04.z, MTXMODE_NEW); Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(ptr->unk_2C, ptr->unk_2C, 1.0f, MTXMODE_APPLY); @@ -782,6 +785,7 @@ void func_80B13464(EnSyatekiNiw* this, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gCuccoParticleAliveDL); + FrameInterpolation_RecordCloseChild(); } } diff --git a/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h b/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h index 6a6398a6f..dfa493817 100644 --- a/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h +++ b/soh/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h @@ -18,6 +18,7 @@ typedef struct { /* 0x2C */ f32 unk_2C; /* 0x30 */ f32 unk_30; /* 0x34 */ u8 unk_34; + s32 epoch; } EnSyatekiNiw_1; // size = 0x38 typedef struct EnSyatekiNiw { diff --git a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c index f87e7e666..11530b07e 100644 --- a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -7,6 +7,7 @@ #include "z_en_tk.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_tk/object_tk.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) #define COLLECTFLAG_GRAVEDIGGING_HEART_PIECE 0x19 @@ -43,6 +44,7 @@ void EnTkEff_Create(EnTk* this, Vec3f* pos, Vec3f* speed, Vec3f* accel, u8 durat for (i = 0; i < ARRAY_COUNT(this->eff); i++) { if (eff->active != 1) { + eff->epoch++; eff->size = size; eff->growth = growth; eff->timeTotal = eff->timeLeft = duration; @@ -107,6 +109,7 @@ void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { gfxSetup = 1; } + FrameInterpolation_RecordOpenChild(eff, eff->epoch); alpha = eff->timeLeft * (255.0f / eff->timeTotal); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); @@ -121,6 +124,7 @@ void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(dustTextures[imageIdx])); gSPDisplayList(POLY_XLU_DISP++, gDampeEff2DL); + FrameInterpolation_RecordCloseChild(); } eff++; } diff --git a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h index 816a7042c..82fb6eef3 100644 --- a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h +++ b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h @@ -17,6 +17,7 @@ typedef struct EnTkEff { /* 0x0014 */ Vec3f pos; /* 0x0020 */ Vec3f speed; /* 0x002C */ Vec3f accel; + s32 epoch; } EnTkEff; // size = 0x0038 struct EnTk; diff --git a/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index b25a42ad9..bf4956f35 100644 --- a/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -14,6 +14,7 @@ #include "objects/object_gndd/object_gndd.h" #include "objects/object_ganon/object_ganon.h" #include "objects/object_opening_demo1/object_opening_demo1.h" +#include "soh/frame_interpolation.h" #define FLAGS ACTOR_FLAG_4 @@ -793,6 +794,7 @@ void EnViewer_InitFireEffect(EnViewer* this, GlobalContext* globalCtx, s16 i) { eff->endPos.y = -420.0f; eff->endPos.z = -400.0f; eff->scale = (Rand_ZeroOne() * 5.0f + 12.0f) * 0.001f; + eff->epoch++; } else { eff = &this->fireEffects[i]; eff->startPos.x = -100.0f; @@ -802,6 +804,7 @@ void EnViewer_InitFireEffect(EnViewer* this, GlobalContext* globalCtx, s16 i) { eff->endPos.y = -420.0f; eff->endPos.z = -400.0f; eff->scale = (Rand_ZeroOne() * 5.0f + 12.0f) * 0.001f; + eff->epoch++; } if (this) {} } @@ -843,6 +846,7 @@ void EnViewer_DrawFireEffects(EnViewer* this2, GlobalContext* globalCtx) { break; } + FrameInterpolation_RecordOpenChild(&this->fireEffects[i], this->fireEffects[i].epoch); func_80093D84(globalCtx->state.gfxCtx); Matrix_Translate(this->fireEffects[i].pos.x, this->fireEffects[i].pos.y, this->fireEffects[i].pos.z, MTXMODE_NEW); @@ -856,6 +860,7 @@ void EnViewer_DrawFireEffects(EnViewer* this2, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPMatrix(POLY_XLU_DISP++, SEG_ADDR(1, 0), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + FrameInterpolation_RecordCloseChild(); } CLOSE_DISPS(globalCtx->state.gfxCtx); } diff --git a/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h b/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h index 6d797cb34..d16613fcf 100644 --- a/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h +++ b/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h @@ -56,6 +56,7 @@ typedef struct { /* 0x28 */ f32 scale; /* 0x2C */ f32 lerpFactor; /* 0x30 */ u8 state; + s32 epoch; } EnViewerFireEffect; // size = 0x34 typedef struct EnViewer { diff --git a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c index eb7c0a20a..5f404c4ad 100644 --- a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -90,6 +90,7 @@ typedef struct { /* 0x32 */ s16 timer; /* 0x34 */ u8 shouldDraw; /* 0x38 */ f32 drawDistance; + s32 epoch; } FishingProp; // size = 0x3C typedef enum { @@ -115,6 +116,7 @@ typedef struct { /* 0x40 */ s16 unk_40; /* 0x42 */ s16 unk_42; /* 0x44 */ u8 shouldDraw; + s32 epoch; } FishingGroupFish; // size = 0x48 #define LINE_SEG_COUNT 200 @@ -764,6 +766,7 @@ void Fishing_InitPondProps(Fishing* this, GlobalContext* globalCtx) { break; } + prop->epoch++; prop->type = sPondPropInits[i].type; prop->pos.x = sPondPropInits[i].pos.x; prop->pos.y = sPondPropInits[i].pos.y; @@ -929,6 +932,8 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) { for (i = 0; i < GROUP_FISH_COUNT; i++) { FishingGroupFish* fish = &sGroupFishes[i]; + fish->epoch++; + fish->type = FS_GROUP_FISH_NORMAL; if (i <= 20) { @@ -1761,6 +1766,8 @@ static f32 sSinkingLureSizes[] = { void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { s16 i; f32 scale; + static s32 epoch = 0; + epoch++; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -1773,6 +1780,7 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { for (i = SINKING_LURE_SEG_COUNT - 1; i >= 0; i--) { if ((i + D_80B7FEA0) < SINKING_LURE_SEG_COUNT) { + FrameInterpolation_RecordOpenChild("Fishing Lures 1", epoch + i * 25); Matrix_Translate(sSinkingLurePos[i].x, sSinkingLurePos[i].y, sSinkingLurePos[i].z, MTXMODE_NEW); scale = sSinkingLureSizes[i + D_80B7FEA0] * 0.04f; Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); @@ -1781,6 +1789,7 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingSinkingLureSegmentModelDL); + FrameInterpolation_RecordCloseChild(); } } } else { @@ -1790,6 +1799,7 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { for (i = SINKING_LURE_SEG_COUNT - 1; i >= 0; i--) { if ((i + D_80B7FEA0) < SINKING_LURE_SEG_COUNT) { + FrameInterpolation_RecordOpenChild("Fishing Lures 2", epoch + i * 25); Matrix_Translate(sSinkingLurePos[i].x, sSinkingLurePos[i].y, sSinkingLurePos[i].z, MTXMODE_NEW); scale = sSinkingLureSizes[i + D_80B7FEA0] * 0.04f; Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); @@ -1798,6 +1808,7 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gFishingSinkingLureSegmentModelDL); + FrameInterpolation_RecordCloseChild(); } } } @@ -4451,7 +4462,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { } if (prop->shouldDraw) { - FrameInterpolation_RecordOpenChild(prop, 0); + FrameInterpolation_RecordOpenChild(prop, prop->epoch); Matrix_Translate(prop->pos.x, prop->pos.y, prop->pos.z, MTXMODE_NEW); Matrix_Scale(prop->scale, prop->scale, prop->scale, MTXMODE_APPLY); Matrix_RotateY(prop->rotY, MTXMODE_APPLY); @@ -4478,7 +4489,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { } if (prop->shouldDraw) { - FrameInterpolation_RecordOpenChild(prop, 0); + FrameInterpolation_RecordOpenChild(prop, prop->epoch); Matrix_Translate(prop->pos.x, prop->pos.y, prop->pos.z, MTXMODE_NEW); Matrix_Scale(prop->scale, prop->scale, prop->scale, MTXMODE_APPLY); @@ -4502,7 +4513,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { } if (prop->shouldDraw) { - FrameInterpolation_RecordOpenChild(prop, 0); + FrameInterpolation_RecordOpenChild(prop, prop->epoch); Matrix_Translate(prop->pos.x, prop->pos.y, prop->pos.z, MTXMODE_NEW); Matrix_Scale(prop->scale, 1.0f, prop->scale, MTXMODE_APPLY); Matrix_RotateY(prop->lilyPadAngle * (M_PI / 32768), MTXMODE_APPLY); @@ -4529,7 +4540,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { } if (prop->shouldDraw) { - FrameInterpolation_RecordOpenChild(prop, 0); + FrameInterpolation_RecordOpenChild(prop, prop->epoch); Matrix_Translate(prop->pos.x, prop->pos.y, prop->pos.z, MTXMODE_NEW); Matrix_Scale(prop->scale, prop->scale, prop->scale, MTXMODE_APPLY); Matrix_RotateY(prop->rotY, MTXMODE_APPLY); @@ -4759,6 +4770,7 @@ void Fishing_DrawGroupFishes(GlobalContext* globalCtx) { } if (fish->shouldDraw) { + FrameInterpolation_RecordOpenChild(fish, fish->epoch); Matrix_Translate(fish->pos.x, fish->pos.y, fish->pos.z, MTXMODE_NEW); Matrix_RotateY(((f32)fish->unk_3E * M_PI) / 32768.0f, MTXMODE_APPLY); Matrix_RotateX((-(f32)fish->unk_3C * M_PI) / 32768.0f, MTXMODE_APPLY); @@ -4767,6 +4779,7 @@ void Fishing_DrawGroupFishes(GlobalContext* globalCtx) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishModelDL); + FrameInterpolation_RecordCloseChild(); } } fish++; diff --git a/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c b/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c index 72fc68876..f58b0927a 100644 --- a/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c +++ b/soh/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c @@ -168,7 +168,8 @@ void ItemOcarina_DoNothing(ItemOcarina* this, GlobalContext* globalCtx) { } void ItemOcarina_StartSoTCutscene(ItemOcarina* this, GlobalContext* globalCtx) { - if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { + if (Actor_TextboxIsClosing(&this->actor, globalCtx) || + Randomizer_ObtainedFreestandingIceTrap(RC_HF_OCARINA_OF_TIME_ITEM, GI_OCARINA_OOT, &this->actor)) { if (!gSaveContext.n64ddFlag) { globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gHyruleFieldZeldaSongOfTimeCs); gSaveContext.cutsceneTrigger = 1; diff --git a/soh/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/soh/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c index 5389e2469..c332590dd 100644 --- a/soh/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/soh/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -6,6 +6,7 @@ #include "z_mir_ray.h" #include "objects/object_mir_ray/object_mir_ray.h" +#include "soh/frame_interpolation.h" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) @@ -481,6 +482,8 @@ void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 i; MirRayShieldReflection reflection[6]; s32 temp; + static s32 epoch = 0; + epoch++; this->reflectIntensity = 0.0f; if ((D_80B8E670 == 0) && !this->unLit && Player_HasMirrorShieldSetToDraw(globalCtx)) { @@ -511,6 +514,7 @@ void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { } for (i = 0; i < 6; i++) { if (reflection[i].reflectionPoly != NULL) { + FrameInterpolation_RecordOpenChild(&reflection[i], epoch + i * 25); Matrix_Translate(reflection[i].pos.x, reflection[i].pos.y, reflection[i].pos.z, MTXMODE_NEW); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); Matrix_Mult(&reflection[i].mtx, MTXMODE_APPLY); @@ -519,6 +523,7 @@ void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_DECAL2); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 150, reflection[0].opacity); gSPDisplayList(POLY_XLU_DISP++, gShieldBeamImageDL); + FrameInterpolation_RecordCloseChild(); } } diff --git a/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 01c4aa469..22b796964 100644 --- a/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -924,6 +924,7 @@ void ObjectKankyo_DrawBeams(ObjectKankyo* this2, GlobalContext* globalCtx2) { if (this->requiredObjectLoaded) { for (i = 0; i < 6; i++) { if (this->effects[i].size > 0.001f) { + FrameInterpolation_RecordOpenChild(&this->effects[i], this->effects[i].epoch); Matrix_Translate(beamX[i], beamY[i], beamZ[i], MTXMODE_NEW); Matrix_RotateY(DEG_TO_RAD(beamYaw[i]), MTXMODE_APPLY); Matrix_RotateX(DEG_TO_RAD(beamPitch[i]), MTXMODE_APPLY); @@ -940,6 +941,7 @@ void ObjectKankyo_DrawBeams(ObjectKankyo* this2, GlobalContext* globalCtx2) { globalCtx->state.frames * 10, 32, 64, 1, globalCtx->state.frames * 5, globalCtx->state.frames * 10, 32, 64)); gSPDisplayList(POLY_XLU_DISP++, gDemoKekkaiDL_005FF0); + FrameInterpolation_RecordCloseChild(); } } } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c b/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c index 39d374925..34bd3446b 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c @@ -6,6 +6,7 @@ #include "z_eff_ss_bomb2.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "soh/frame_interpolation.h" #define rScale regs[0] #define rTexIdx regs[1] @@ -54,6 +55,7 @@ u32 EffectSsBomb2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void this->rEnvColorR = 0; this->rEnvColorG = 0; this->rEnvColorB = 200; + this->epoch++; return 1; } @@ -144,6 +146,7 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th Matrix_Put(&mtx2F); for (i = 1; i >= 0; i--) { + FrameInterpolation_RecordOpenChild(this, this->epoch + i * 25); Matrix_Translate(0.0f, 0.0f, depth, MTXMODE_APPLY); Matrix_RotateZ((this->life * 0.02f) + 180.0f, MTXMODE_APPLY); Matrix_Scale(layer2Scale, layer2Scale, layer2Scale, MTXMODE_APPLY); @@ -151,6 +154,7 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffBombExplosion3DL); layer2Scale -= 0.15f; + FrameInterpolation_RecordCloseChild(); } } } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h b/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h index 454303b50..93dc28031 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h @@ -11,6 +11,7 @@ typedef struct { /* 0x24 */ s16 scale; /* 0x26 */ s16 scaleStep; /* 0x28 */ u8 drawMode; + /* 0x29 */ s32 epoch; } EffectSsBomb2InitParams; // size = 0x30 #endif