diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2025-06-07 21:38:12 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-07 21:38:12 -0600 |
| commit | 44db9bab773cc3b14c8f944a9411673b6fe08b01 (patch) | |
| tree | 8ad796dac5ec3f42eca1220efe1e054b576374e8 /src/engine/objects/Snowman.cpp | |
| parent | a67fbb6442d76016397c67f2cb7831687cdda91a (diff) | |
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 <MegaMech@users.noreply.github.com>
* 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 <kiritodev01@gmail.com>
* 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 <alejandro.asenjo88@gmail.com>
Co-authored-by: KiritoDv <kiritodev01@gmail.com>
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 <pereira.jannin@gmail.com>
Diffstat (limited to 'src/engine/objects/Snowman.cpp')
| -rw-r--r-- | src/engine/objects/Snowman.cpp | 59 |
1 files changed, 39 insertions, 20 deletions
diff --git a/src/engine/objects/Snowman.cpp b/src/engine/objects/Snowman.cpp index 12beb9e47..7cbfc691d 100644 --- a/src/engine/objects/Snowman.cpp +++ b/src/engine/objects/Snowman.cpp @@ -11,6 +11,7 @@ extern "C" { #include "code_80086E70.h" #include "code_80057C60.h" } +#include "port/interpolation/FrameInterpolation.h" static const char* sSnowmanHeadList[] = { d_course_frappe_snowland_snowman_head }; @@ -27,7 +28,7 @@ OSnowman::OSnowman(const FVector& pos) { gObjectList[_headIndex].origin_pos[0] = pos.x * xOrientation; gObjectList[_headIndex].origin_pos[1] = pos.y + 5.0 + 3.0; gObjectList[_headIndex].origin_pos[2] = pos.z; - gObjectList[_headIndex].pos[0] = pos.x * xOrientation; + gObjectList[_headIndex].pos[0] = pos.x * xOrientation; gObjectList[_headIndex].pos[1] = pos.y + 5.0 + 3.0; gObjectList[_headIndex].pos[2] = pos.z; @@ -38,7 +39,7 @@ OSnowman::OSnowman(const FVector& pos) { gObjectList[_bodyIndex].origin_pos[2] = pos.z; gObjectList[_bodyIndex].unk_0D5 = 0; // Section Id no longer used. - gObjectList[_bodyIndex].pos[0] = pos.x * xOrientation; + gObjectList[_bodyIndex].pos[0] = pos.x * xOrientation; gObjectList[_bodyIndex].pos[1] = pos.y + 3.0; gObjectList[_bodyIndex].pos[2] = pos.z; @@ -71,14 +72,15 @@ void OSnowman::Tick() { } } - //for (var_s0 = 0; var_s0 < NUM_SNOWMEN; var_s0++) { + // for (var_s0 = 0; var_s0 < NUM_SNOWMEN; var_s0++) { var_s4 = _bodyIndex; var_s3 = _headIndex; OSnowman::func_80083A94(var_s3); // snowman head OSnowman::func_80083C04(var_s4); // snowman body if (is_obj_index_flag_status_inactive(var_s4, 0x00001000) != 0) { object = &gObjectList[var_s4]; - if ((are_players_in_course_section(object->unk_0D5 - 1, object->unk_0D5 + 1) != 0) && (func_80089B50(var_s4) != 0)) { + if ((are_players_in_course_section(object->unk_0D5 - 1, object->unk_0D5 + 1) != 0) && + (func_80089B50(var_s4) != 0)) { set_object_flag(var_s4, 0x00001000); clear_object_flag(var_s4, 0x00000010); func_800726CC(var_s4, 0x0000000A); @@ -93,6 +95,7 @@ void OSnowman::Tick() { } void OSnowman::Draw(s32 cameraId) { + OSnowman::DrawHead(cameraId); OSnowman::DrawBody(cameraId); } @@ -117,23 +120,29 @@ void OSnowman::DrawHead(s32 cameraId) { if (gObjectList[objectIndex].state >= 2) { func_8008A364(objectIndex, cameraId, 0x2AABU, 0x00000258); if (is_obj_flag_status_active(objectIndex, VISIBLE) != 0) { + + // @port: Tag the transform. + FrameInterpolation_RecordOpenChild("OSnowman::DrawHead", (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]; if (is_obj_flag_status_active(objectIndex, 0x00000010) != 0) { draw_2d_texture_at(gObjectList[objectIndex].pos, (u16*) D_80183E80, - gObjectList[objectIndex].sizeScaling, (u8*) gObjectList[objectIndex].activeTLUT, - (u8*)gObjectList[objectIndex].activeTexture, gObjectList[objectIndex].vertex, - 0x00000040, 0x00000040, 0x00000040, 0x00000020); + gObjectList[objectIndex].sizeScaling, (u8*) gObjectList[objectIndex].activeTLUT, + (u8*) gObjectList[objectIndex].activeTexture, gObjectList[objectIndex].vertex, + 0x00000040, 0x00000040, 0x00000040, 0x00000020); } objectIndex = _headIndex; D_80183E80[0] = (s16) gObjectList[objectIndex].orientation[0]; D_80183E80[2] = (u16) gObjectList[objectIndex].orientation[2]; - draw_2d_texture_at(gObjectList[objectIndex].pos, (u16*) D_80183E80, - gObjectList[objectIndex].sizeScaling, (u8*) gObjectList[objectIndex].activeTLUT, - (u8*)gObjectList[objectIndex].activeTexture, gObjectList[objectIndex].vertex, 0x00000040, - 0x00000040, 0x00000040, 0x00000020); + draw_2d_texture_at(gObjectList[objectIndex].pos, (u16*) D_80183E80, gObjectList[objectIndex].sizeScaling, + (u8*) gObjectList[objectIndex].activeTLUT, (u8*) gObjectList[objectIndex].activeTexture, + gObjectList[objectIndex].vertex, 0x00000040, 0x00000040, 0x00000040, 0x00000020); + + // @port Pop the transform id. + FrameInterpolation_RecordCloseChild(); } } } @@ -146,7 +155,8 @@ void OSnowman::DrawBody(s32 cameraId) { Object* object; sp44 = &camera1[cameraId]; - load_texture_and_tlut((u8*)d_course_frappe_snowland_snow_tlut, (u8*)d_course_frappe_snowland_snow, 0x00000020, 0x00000020); + load_texture_and_tlut((u8*) d_course_frappe_snowland_snow_tlut, (u8*) d_course_frappe_snowland_snow, 0x00000020, + 0x00000020); //! @todo quick hack to add the snow particles on hit. Need to separate into its own class if (_idx == 0) { @@ -157,9 +167,16 @@ void OSnowman::DrawBody(s32 cameraId) { if (object->state > 0) { func_8008A364(objectIndex, cameraId, 0x2AABU, 0x000001F4); if (is_obj_flag_status_active(objectIndex, VISIBLE) != 0) { + + // @port: Tag the transform. + FrameInterpolation_RecordOpenChild("OSnowman::DrawBody", (uintptr_t) object); + object->orientation[1] = func_800418AC(object->pos[0], object->pos[2], sp44->pos); rsp_set_matrix_gObjectList(objectIndex); - gSPDisplayList(gDisplayListHead++, (Gfx*)D_0D0069E0); + gSPDisplayList(gDisplayListHead++, (Gfx*) D_0D0069E0); + + // @port Pop the transform id. + FrameInterpolation_RecordCloseChild(); } } } @@ -215,7 +232,8 @@ void OSnowman::func_80083BE4(s32 objectIndex) { void OSnowman::func_80083868(s32 objectIndex) { Object* object; Vtx* vtx = (Vtx*) LOAD_ASSET_RAW(D_0D0061B0); - init_texture_object(objectIndex, (u8*)d_course_frappe_snowland_snowman_tlut, (const char**)sSnowmanHeadList, 0x40U, (u16) 0x00000040); + init_texture_object(objectIndex, (u8*) d_course_frappe_snowland_snowman_tlut, (const char**) sSnowmanHeadList, + 0x40U, (u16) 0x00000040); object = &gObjectList[objectIndex]; object->vertex = vtx; object->sizeScaling = 0.1f; @@ -259,7 +277,8 @@ void OSnowman::func_80083948(s32 objectIndex) { break; } object_calculate_new_pos_offset(objectIndex); - OSnowman::func_80073D0C(objectIndex, &gObjectList[objectIndex].primAlpha, -0x00001000, 0x00001000, 0x00000400, 1, -1); + OSnowman::func_80073D0C(objectIndex, &gObjectList[objectIndex].primAlpha, -0x00001000, 0x00001000, 0x00000400, 1, + -1); gObjectList[objectIndex].orientation[2] = gObjectList[objectIndex].primAlpha + 0x8000; } @@ -285,7 +304,8 @@ static const char* sSnowmanBodyList[] = { d_course_frappe_snowland_snowman_body void OSnowman::func_80083B0C(s32 objectIndex) { Vtx* vtx = (Vtx*) LOAD_ASSET_RAW(common_vtx_hedgehog); - init_texture_object(objectIndex, (u8*)d_course_frappe_snowland_snowman_tlut, (const char**)sSnowmanBodyList, 0x40U, (u16) 0x00000040); + init_texture_object(objectIndex, (u8*) d_course_frappe_snowland_snowman_tlut, (const char**) sSnowmanBodyList, + 0x40U, (u16) 0x00000040); gObjectList[objectIndex].vertex = vtx; gObjectList[objectIndex].sizeScaling = 0.1f; gObjectList[objectIndex].textureListIndex = 0; @@ -299,16 +319,15 @@ void OSnowman::func_80083B0C(s32 objectIndex) { set_object_flag(objectIndex, 0x04000210); } - void OSnowman::func_80083538(s32 objectIndex, Vec3f arg1, s32 arg2, s32 arg3) { Object* object; init_object(objectIndex, 0); object = &gObjectList[objectIndex]; - object->activeTexture = (const char*)d_course_frappe_snowland_snow; - object->textureList = (const char**)d_course_frappe_snowland_snow; + object->activeTexture = (const char*) d_course_frappe_snowland_snow; + object->textureList = (const char**) d_course_frappe_snowland_snow; object->activeTLUT = d_course_frappe_snowland_snow_tlut; - object->tlutList = (u8*)d_course_frappe_snowland_snow_tlut; + object->tlutList = (u8*) d_course_frappe_snowland_snow_tlut; object->sizeScaling = random_int(0x0064U); object->sizeScaling = (object->sizeScaling * 0.001) + 0.05; object->velocity[1] = random_int(0x0014U); |
