This should fix (all?) 60fps interpolation issues left. (#938)

* This should fix (all?) 60fps interpolation issues left.

Resolves #631 #917

* Update z_fishing.c

* Re-adds Emil's interpolation in certain places.

* move open/close disps out of if statments checking timer based vars, revert fishing to use recordopen/closed child

* move disps out of ifs for morpha

* use recordopen/recordclose for volv

* recordopen/recordclose for ganondorf

* switch back to recordopen/recordclose for ganondorf floor

* Frame interpolation now uses a 64bit parameter rather than 32.

* More 60fps fixes

* Fix close child typo

* add todo calls to recordopen/recordclose

* fix build

* revert long long frame interpolation

* add some epochs

* add more epochs

* bongo epochs

* the rest of the epochs

* fix the typo fix the build

* interpolation fixes pr cleanup

* init/cleanup bongo epochs

* bongo hand trails

* Fixes niw feathers

* Fixes bongo bongo hands, and replaces epoch * i with epoch + i

* don't update epochs

Co-authored-by: briaguya <briaguya@alice>
This commit is contained in:
Kenix3 2022-08-03 22:36:13 -04:00 committed by GitHub
parent fe02818d51
commit 0f7a88bd5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
72 changed files with 474 additions and 35 deletions

View file

@ -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;

View file

@ -3973,6 +3973,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;
@ -3986,6 +3988,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);
@ -4005,6 +4008,7 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) {
}
chainRotZ += rotZStep;
FrameInterpolation_RecordCloseChild();
}
Matrix_Put(&baseMtxF);

View file

@ -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();
}

View file

@ -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:

View file

@ -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);

View file

@ -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);