Add transform tagging for moths to fix their interpolation (#460)

Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
This commit is contained in:
Wiseguy 2024-08-09 23:43:43 -04:00 committed by GitHub
parent d782d3dcb9
commit 473b3d3d02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,6 +11,7 @@
#include "overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h" #include "overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h"
#include "overlays/actors/ovl_En_Twig/z_en_twig.h" #include "overlays/actors/ovl_En_Twig/z_en_twig.h"
#include "overlays/actors/ovl_En_Honotrap/z_en_honotrap.h" #include "overlays/actors/ovl_En_Honotrap/z_en_honotrap.h"
#include "overlays/actors/ovl_En_Tanron1/z_en_tanron1.h"
// Decomp renames, TODO update decomp and remove these // Decomp renames, TODO update decomp and remove these
#define EnHonotrap_FlameGroup func_8092F878 #define EnHonotrap_FlameGroup func_8092F878
@ -1259,3 +1260,74 @@ RECOMP_PATCH void EnHonotrap_DrawFlameGroup(Actor* thisx, PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx); CLOSE_DISPS(play->state.gfxCtx);
} }
extern Gfx ovl_En_Tanron1_DL_001428[];
extern Gfx ovl_En_Tanron1_DL_001888[];
extern Gfx ovl_En_Tanron1_DL_001900[];
// @recomp Patched to interpolate the moths that circle torches.
void func_80BB5AAC(EnTanron1* this, PlayState* play) {
EnTanron1Struct* ptrBase = &this->unk_160[0];
s16 i;
u8 flag = 0;
EnTanron1Struct* ptr = ptrBase;
// @recomp Get actor transform id
u32 cur_transform_id = actor_transform_id(&this->actor);
OPEN_DISPS(play->state.gfxCtx);
Gfx_SetupDL25_Opa(play->state.gfxCtx);
for (i = 0; i < this->actor.params; i++, ptr++) {
if (ptr->unk_24 == 1) {
if (!flag) {
gSPDisplayList(POLY_OPA_DISP++, ovl_En_Tanron1_DL_001888);
flag++;
}
Matrix_Translate(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, MTXMODE_NEW);
Matrix_RotateYS(ptr->unk_1A, MTXMODE_APPLY);
Matrix_RotateXS(ptr->unk_18 * -1, MTXMODE_APPLY);
Matrix_Scale(1.2f, ptr->unk_2C, 1.2f, MTXMODE_APPLY);
// @recomp Write matrix group for POLY_OPA
gEXMatrixGroupDecomposedNormal(POLY_OPA_DISP++, cur_transform_id + i, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_ALLOW);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, ovl_En_Tanron1_DL_001900);
// @recomp Pop matrix group
gEXPopMatrixGroup(POLY_OPA_DISP++, G_MTX_MODELVIEW);
}
}
flag = 0;
ptr = ptrBase;
for (i = 0; i < this->actor.params; i++, ptr++) {
if (ptr->unk_24 == 2) {
if (!flag) {
gSPDisplayList(POLY_OPA_DISP++, ovl_En_Tanron1_DL_001888);
gDPLoadTextureBlock(POLY_OPA_DISP++, ovl_En_Tanron1_DL_001428, G_IM_FMT_RGBA, G_IM_SIZ_16b, 16, 32, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 4, 5, G_TX_NOLOD,
G_TX_NOLOD);
flag++;
}
Matrix_Translate(ptr->unk_00.x, ptr->unk_00.y, ptr->unk_00.z, MTXMODE_NEW);
Matrix_RotateYS(ptr->unk_1A, MTXMODE_APPLY);
Matrix_RotateXS(ptr->unk_18 * -1, MTXMODE_APPLY);
Matrix_Scale(1.0f, ptr->unk_2C, 1.0f, MTXMODE_APPLY);
// @recomp Write matrix group for POLY_OPA
gEXMatrixGroupDecomposedNormal(POLY_OPA_DISP++, cur_transform_id + i, G_EX_PUSH, G_MTX_MODELVIEW, G_EX_EDIT_ALLOW);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, ovl_En_Tanron1_DL_001900);
// @recomp Pop matrix group
gEXPopMatrixGroup(POLY_OPA_DISP++, G_MTX_MODELVIEW);
}
}
CLOSE_DISPS(play->state.gfxCtx);
}