From 44db9bab773cc3b14c8f944a9411673b6fe08b01 Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sat, 7 Jun 2025 21:38:12 -0600 Subject: Add Interpolation (#204) * initial work * more work * progress * Fixed slow fps * Add Lywx changes * Interp Works * Test default tick/logic update * Added missing include (#202) * Added missing include * More missing includes --------- Co-authored-by: MegaMech * test * Revert "test" This reverts commit 1a810d74cc8531ce486bcb1c399cc6798fa1b51d. * Interp Item box * Actually interpolate item box * fix clouds * interp player? * Test 2 * Fix mistake * tag and fix item boxes * tag fake item box and whatever func_800696CC is * these aren't needed * tag karts * Slightly better falling rocks(still needs work) * Tag Smoke and Dust * Removed unneeded code from falling_rock * tag whatever func_80051ABC is * add missing rotate x coord * GrandPrixBallon/kart shadow * Green shells tag, and added comments I neglected to add before. * doesn't compile on win * Fixes * Disabled camera interpolation * Balloons fixes * progress * set_transform_matrix compiles * Compile setTransformMatrix * More transforms interp * Add more interps * matrix * Matrix multi interp * Fix interpolation camera bug * Missing includes needed for Linux. * Excluded access to HM64 Labs on Switch. * interpolation tags for various objects * Bowser castle statue flame interpolated. * tag hedgehogs * cloud interpolation * Interpolated smoke particles from shells * cloud interpolation refactor * Interpolated snowflakes * Interpolated penguins, also added comment tags to places I missed. * tag Snowman interpolation * Interpolated player reflection(sherbet land) * Forgot to uncomment stuff while testing * better tag * tag leaves * Set the default FPS to 30 * tag hud * Fixed "Match Refresh Rate" option * adjust draw distance * remove innecessary rock tag * rag rocks * better tag * Tagged player rank placement in HUD * Tagged Bat, Boos, and TrashBin(Banshee Boardwalk objects) * Refactor render_screens and fix editor raycast * better object interpolation * shift is not needed here * fix tag * fix tags * mole comments * comment * Changed how shell flames are interpolated. * interpolated ended scene fireworks. * Tagged star particles in the ending scene * Shell flames handled better. * this isn't needed * Fix multiplayer cameras * Fixed loading battle maps. * Tagged battle balloons * Some fixes for battle mode * No longer needed changes toAFinishline with the changes mega made. * Tag finishline * fix to make it compile with cmake 3.31 * changed mtxf_multiplication() to fix vert explosion in Desert & DK parkway.(provided by Coco.) * fix memory leaks, avoid invalidate texture (#207) * Fixed macos * More stupid fixes * update with main and update torch and lus and enable action on this branch * Update FrameInterpolation.h * Update FrameInterpolation.cpp * fix some memory leak * Update torch * Update torch * update torch and lus * reduce texture import * don't use fork of torch and lus * Update torch * Update torch --------- Co-authored-by: Lywx * Refactor World::Courses to unique_ptr (#211) * wip course unique ptr * Track unique_ptr : This probably compiles * Finish impl Courses as unique_ptr * Fix error * Fixes * More fixes * Cleanup * Remove old vars --------- Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com> * particle boat and train * fix player particle interpolation * add modify interpolation target fps in menu * fix windows * Update libultraship * Fix logo interp * Interp SetTextMatrix * Fix freecam camera * Clarify comment * Clarify func * fix linux compilation * Update Thwomp.cpp * Update Thwomp.h * Update render.inc.c * Update render.inc.c * Update gbiMacro.c * interp falling rock shadow * Revert change that has no explanation * Update code_80057C60.c * Update code_80057C60.c * Update GrandPrixBalloons.cpp * Update Lakitu.cpp * Update framebuffer_effects.c * Update render_courses.c --------- Co-authored-by: Sonic Dreamcaster Co-authored-by: KiritoDv Co-authored-by: sitton76 <58642183+sitton76@users.noreply.github.com> Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com> Co-authored-by: coco875 <59367621+coco875@users.noreply.github.com> Co-authored-by: coco875 --- src/engine/objects/Mole.cpp | 107 +++++++++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 45 deletions(-) (limited to 'src/engine/objects/Mole.cpp') diff --git a/src/engine/objects/Mole.cpp b/src/engine/objects/Mole.cpp index 06bd5f56c..f623b1f52 100644 --- a/src/engine/objects/Mole.cpp +++ b/src/engine/objects/Mole.cpp @@ -21,6 +21,7 @@ extern "C" { #include "sounds.h" #include "external.h" } +#include "port/interpolation/FrameInterpolation.h" size_t OMole::_count = 0; @@ -145,7 +146,7 @@ void OMole::func_80081AFC(s32 objectIndex, s32 arg1) { // sp2C = D_8018D1B8; // break; // } - //sp2C[object->type] = 0; + // sp2C[object->type] = 0; } break; case 0: @@ -179,20 +180,20 @@ void OMole::func_8008153C(s32 objectIndex) { } u8* mole = (u8*) LOAD_ASSET_RAW(d_course_moo_moo_farm_mole_dirt); - init_object(loopObjectIndex, 0); - gObjectList[loopObjectIndex].activeTLUT = d_course_moo_moo_farm_mole_dirt; - gObjectList[loopObjectIndex].tlutList = mole; - gObjectList[loopObjectIndex].sizeScaling = 0.15f; - gObjectList[loopObjectIndex].velocity[1] = random_int(0x000AU); - gObjectList[loopObjectIndex].velocity[1] = (gObjectList[loopObjectIndex].velocity[1] * 0.1) + 4.8; - gObjectList[loopObjectIndex].unk_034 = random_int(5U); - gObjectList[loopObjectIndex].unk_034 = (gObjectList[loopObjectIndex].unk_034 * 0.01) + 0.8; - gObjectList[loopObjectIndex].orientation[1] = (0x10000 / sp70) * var_s1; - gObjectList[loopObjectIndex].origin_pos[0] = gObjectList[objectIndex].origin_pos[0]; - gObjectList[loopObjectIndex].origin_pos[1] = gObjectList[objectIndex].origin_pos[1] - 13.0; - gObjectList[loopObjectIndex].origin_pos[2] = gObjectList[objectIndex].origin_pos[2]; - break; - } + init_object(loopObjectIndex, 0); + gObjectList[loopObjectIndex].activeTLUT = d_course_moo_moo_farm_mole_dirt; + gObjectList[loopObjectIndex].tlutList = mole; + gObjectList[loopObjectIndex].sizeScaling = 0.15f; + gObjectList[loopObjectIndex].velocity[1] = random_int(0x000AU); + gObjectList[loopObjectIndex].velocity[1] = (gObjectList[loopObjectIndex].velocity[1] * 0.1) + 4.8; + gObjectList[loopObjectIndex].unk_034 = random_int(5U); + gObjectList[loopObjectIndex].unk_034 = (gObjectList[loopObjectIndex].unk_034 * 0.01) + 0.8; + gObjectList[loopObjectIndex].orientation[1] = (0x10000 / sp70) * var_s1; + gObjectList[loopObjectIndex].origin_pos[0] = gObjectList[objectIndex].origin_pos[0]; + gObjectList[loopObjectIndex].origin_pos[1] = gObjectList[objectIndex].origin_pos[1] - 13.0; + gObjectList[loopObjectIndex].origin_pos[2] = gObjectList[objectIndex].origin_pos[2]; + break; + } } } @@ -243,21 +244,15 @@ void OMole::func_80081D34(s32 objectIndex) { } static const char* frames[] = { - gTextureMole1, - gTextureMole2, - gTextureMole3, - gTextureMole4, - gTextureMole5, - gTextureMole6, - gTextureMole7, - d_course_moo_moo_farm_mole_dirt, + gTextureMole1, gTextureMole2, gTextureMole3, gTextureMole4, + gTextureMole5, gTextureMole6, gTextureMole7, d_course_moo_moo_farm_mole_dirt, }; - void OMole::func_80081848(s32 objectIndex) { - init_texture_object(objectIndex, (u8*)d_course_moo_moo_farm_mole_tlut, (const char**) frames, 0x20U, (u16) 0x00000040); - //gObjectList[objectIndex].activeTexture = (const char*)d_course_moo_moo_farm_mole_frames; - //gObjectList[objectIndex].activeTLUT = (const char*)d_course_moo_moo_farm_mole_tlut; + init_texture_object(objectIndex, (u8*) d_course_moo_moo_farm_mole_tlut, (const char**) frames, 0x20U, + (u16) 0x00000040); + // gObjectList[objectIndex].activeTexture = (const char*)d_course_moo_moo_farm_mole_frames; + // gObjectList[objectIndex].activeTLUT = (const char*)d_course_moo_moo_farm_mole_tlut; gObjectList[objectIndex].sizeScaling = 0.15f; gObjectList[objectIndex].textureListIndex = 0; @@ -270,7 +265,6 @@ void OMole::func_80081848(s32 objectIndex) { object_next_state(objectIndex); } - void OMole::func_80081924(s32 objectIndex) { switch (gObjectList[objectIndex].unk_0AE) { case 1: @@ -307,7 +301,6 @@ void OMole::func_80081924(s32 objectIndex) { } } - void OMole::func_80081A88(s32 objectIndex) { switch (gObjectList[objectIndex].unk_0DD) { /* irregular */ case 0: @@ -330,9 +323,14 @@ void OMole::func_800821AC(s32 objectIndex, s32 arg1) { } } +// Holes void OMole::func_80054E10(s32 objectIndex) { if (gObjectList[objectIndex].state > 0) { if (is_obj_flag_status_active(objectIndex, 0x00800000) != 0) { + + // @port: Tag the transform. + FrameInterpolation_RecordOpenChild("func_80054E10", TAG_OBJECT(&gObjectList[objectIndex])); + D_80183E50[0] = gObjectList[objectIndex].pos[0]; D_80183E50[1] = gObjectList[objectIndex].surfaceHeight + 0.8; D_80183E50[2] = gObjectList[objectIndex].pos[2]; @@ -340,6 +338,9 @@ void OMole::func_80054E10(s32 objectIndex) { D_80183E70[1] = gObjectList[objectIndex].velocity[1]; D_80183E70[2] = gObjectList[objectIndex].velocity[2]; func_8004A9B8(gObjectList[objectIndex].sizeScaling); + + // @port Pop the transform id. + FrameInterpolation_RecordCloseChild(); } } } @@ -348,8 +349,8 @@ void OMole::func_80054E10(s32 objectIndex) { void OMole::func_80054EB8() { s32 someIndex; - //for (someIndex = 0; someIndex < NUM_TOTAL_MOLES; someIndex++) { - func_80054E10(_moleIndex); + // for (someIndex = 0; someIndex < NUM_TOTAL_MOLES; someIndex++) { + func_80054E10(_moleIndex); //} } @@ -360,36 +361,52 @@ void OMole::func_80054D00(s32 objectIndex, s32 cameraId) { if (gObjectList[objectIndex].state >= 3) { func_8008A364(objectIndex, cameraId, 0x2AABU, 0x0000012C); if (is_obj_flag_status_active(objectIndex, VISIBLE) != 0) { + + // @port: Tag the transform. + FrameInterpolation_RecordOpenChild("func_80054D00", (uintptr_t)&gObjectList[objectIndex]); + D_80183E80[0] = (s16) gObjectList[objectIndex].orientation[0]; D_80183E80[1] = func_800418AC(gObjectList[objectIndex].pos[0], gObjectList[objectIndex].pos[2], camera->pos); D_80183E80[2] = (u16) gObjectList[objectIndex].orientation[2]; func_80048130(gObjectList[objectIndex].pos, (u16*) D_80183E80, gObjectList[objectIndex].sizeScaling, - (u8*) gObjectList[objectIndex].activeTLUT, (u8*)gObjectList[objectIndex].activeTexture, - (Vtx*)LOAD_ASSET_RAW(D_0D0062B0), 0x00000020, 0x00000040, 0x00000020, 0x00000040, 5); + (u8*) gObjectList[objectIndex].activeTLUT, (u8*) gObjectList[objectIndex].activeTexture, + (Vtx*) LOAD_ASSET_RAW(D_0D0062B0), 0x00000020, 0x00000040, 0x00000020, 0x00000040, 5); + + // @port Pop the transform id. + FrameInterpolation_RecordCloseChild(); } } } +// Mole rocks void OMole::func_80054F04(s32 cameraId) { Camera* camera = &camera1[cameraId]; - gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D0079C8); + gSPDisplayList(gDisplayListHead++, (Gfx*) D_0D0079C8); load_texture_block_rgba16_mirror((u8*) LOAD_ASSET_RAW(d_course_moo_moo_farm_mole_dirt), 0x00000010, 0x00000010); -if (_idx == 0) { - for (size_t i = 0; i < gObjectParticle2_SIZE; i++) { - s32 objectIndex = gObjectParticle2[i]; - Object* object = &gObjectList[objectIndex]; - if (object->state > 0) { - func_8008A364(objectIndex, cameraId, 0x2AABU, 0x000000C8); - if ((is_obj_flag_status_active(objectIndex, VISIBLE) != 0) && (gMatrixHudCount <= MTX_HUD_POOL_SIZE_MAX)) { - object->orientation[1] = func_800418AC(object->pos[0], object->pos[2], camera->pos); - rsp_set_matrix_gObjectList(objectIndex); - gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D006980); + if (_idx == 0) { + for (size_t i = 0; i < gObjectParticle2_SIZE; i++) { + s32 objectIndex = gObjectParticle2[i]; + Object* object = &gObjectList[objectIndex]; + if (object->state > 0) { + func_8008A364(objectIndex, cameraId, 0x2AABU, 0x000000C8); + if ((is_obj_flag_status_active(objectIndex, VISIBLE) != 0) && + (gMatrixHudCount <= MTX_HUD_POOL_SIZE_MAX)) { + + // @port: Tag the transform. + FrameInterpolation_RecordOpenChild("func_80054F04", TAG_OBJECT(object) | (i << 32)); + + object->orientation[1] = func_800418AC(object->pos[0], object->pos[2], camera->pos); + rsp_set_matrix_gObjectList(objectIndex); + gSPDisplayList(gDisplayListHead++, (Gfx*) D_0D006980); + + // @port Pop the transform id. + FrameInterpolation_RecordCloseChild(); + } } } } -} gSPTexture(gDisplayListHead++, 1, 1, 0, G_TX_RENDERTILE, G_OFF); } -- cgit v1.2.3