From f6a33bf4c6049acd50080db3a14826fd894062a9 Mon Sep 17 00:00:00 2001 From: Sonic Dreamcaster Date: Tue, 20 May 2025 01:04:45 -0300 Subject: [PATCH] tag hedgehogs --- src/engine/objects/Hedgehog.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/engine/objects/Hedgehog.cpp b/src/engine/objects/Hedgehog.cpp index ebc5b30bb..1c2aada9d 100644 --- a/src/engine/objects/Hedgehog.cpp +++ b/src/engine/objects/Hedgehog.cpp @@ -11,6 +11,7 @@ extern "C" { #include "code_80086E70.h" #include "code_80057C60.h" } +#include "port/interpolation/FrameInterpolation.h" size_t OHedgehog::_count = 0; @@ -25,7 +26,7 @@ OHedgehog::OHedgehog(const FVector& pos, const FVector2D& patrolPoint, s16 unk) gObjectList[objectId].pos[0] = gObjectList[objectId].origin_pos[0] = pos.x * xOrientation; gObjectList[objectId].pos[1] = gObjectList[objectId].surfaceHeight = pos.y + 6.0; gObjectList[objectId].pos[2] = gObjectList[objectId].origin_pos[2] = pos.z; - gObjectList[objectId].unk_0D5 = (u8)unk; + gObjectList[objectId].unk_0D5 = (u8) unk; gObjectList[objectId].unk_09C = patrolPoint.x * xOrientation; gObjectList[objectId].unk_09E = patrolPoint.z; @@ -38,10 +39,10 @@ void OHedgehog::Tick() { OHedgehog::func_800833D0(objectIndex, _idx); OHedgehog::func_80083248(objectIndex); OHedgehog::func_80083474(objectIndex); - + // This func clears a bit from all hedgehogs. This results in setting the height of all hedgehogs to zero. // The solution is to only clear the bit from the current instance; `self` or `this` - //func_80072120(indexObjectList2, NUM_HEDGEHOGS); + // func_80072120(indexObjectList2, NUM_HEDGEHOGS); clear_object_flag(objectIndex, 0x00600000); // The fix } @@ -78,7 +79,8 @@ void OHedgehog::func_800555BC(s32 objectIndex, s32 cameraId) { func_800418AC(gObjectList[objectIndex].pos[0], gObjectList[objectIndex].pos[2], camera->pos); draw_2d_texture_at(gObjectList[objectIndex].pos, gObjectList[objectIndex].orientation, gObjectList[objectIndex].sizeScaling, (u8*) gObjectList[objectIndex].activeTLUT, - (u8*)gObjectList[objectIndex].activeTexture, gObjectList[objectIndex].vertex, 64, 64, 64, 32); + (u8*) gObjectList[objectIndex].activeTexture, gObjectList[objectIndex].vertex, 64, 64, 64, + 32); } } @@ -92,13 +94,20 @@ void OHedgehog::func_8004A870(s32 objectIndex, f32 arg1) { D_80183E50[0] = object->pos[0]; D_80183E50[1] = object->surfaceHeight + 0.8; D_80183E50[2] = object->pos[2]; + + // @port: Tag the transform. + FrameInterpolation_RecordOpenChild("hedgehog", (uintptr_t) &gObjectList[objectIndex]); + set_transform_matrix(mtx, object->unk_01C, D_80183E50, 0U, arg1); // convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], mtx); // gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), // G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); AddHudMatrix(mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D007B98); + gSPDisplayList(gDisplayListHead++, (Gfx*) D_0D007B98); + + // @port Pop the transform id. + FrameInterpolation_RecordCloseChild(); } } @@ -108,7 +117,8 @@ void OHedgehog::func_8008311C(s32 objectIndex, s32 arg1) { Object* object; Vtx* vtx = (Vtx*) LOAD_ASSET_RAW(common_vtx_hedgehog); - init_texture_object(objectIndex, (u8*)d_course_yoshi_valley_hedgehog_tlut, sHedgehogTexList, 0x40U, (u16) 0x00000040); + init_texture_object(objectIndex, (u8*) d_course_yoshi_valley_hedgehog_tlut, sHedgehogTexList, 0x40U, + (u16) 0x00000040); object = &gObjectList[objectIndex]; object->activeTLUT = d_course_yoshi_valley_hedgehog_tlut; object->activeTexture = d_course_yoshi_valley_hedgehog;