summaryrefslogtreecommitdiff
path: root/src/engine/objects/Thwomp.cpp
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2025-06-07 21:38:12 -0600
committerGitHub <noreply@github.com>2025-06-07 21:38:12 -0600
commit44db9bab773cc3b14c8f944a9411673b6fe08b01 (patch)
tree8ad796dac5ec3f42eca1220efe1e054b576374e8 /src/engine/objects/Thwomp.cpp
parenta67fbb6442d76016397c67f2cb7831687cdda91a (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/Thwomp.cpp')
-rw-r--r--src/engine/objects/Thwomp.cpp54
1 files changed, 29 insertions, 25 deletions
diff --git a/src/engine/objects/Thwomp.cpp b/src/engine/objects/Thwomp.cpp
index d3f99a8d9..9cee27c50 100644
--- a/src/engine/objects/Thwomp.cpp
+++ b/src/engine/objects/Thwomp.cpp
@@ -45,6 +45,7 @@ f32 D_800E594C[][2] = {
s16 D_800E597C[] = { 0x0000, 0x0000, 0x4000, 0x8000, 0x8000, 0xc000 };
size_t OThwomp::_count = 0;
+size_t OThwomp::_rand = 0;
OThwomp::OThwomp(s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha, u16 boundingBoxSize) {
Name = "Thwomp";
@@ -88,6 +89,7 @@ void OThwomp::Tick60fps() { // func_80081210
if (_idx == 0) {
D_80165834[0] += 0x100;
D_80165834[1] += 0x200;
+ _rand += 1;
}
if (gObjectList[_objectIndex].state != 0) {
@@ -131,26 +133,26 @@ void OThwomp::Tick60fps() { // func_80081210
}
OThwomp::func_8007542C(3);
- if (func_80072320(_objectIndex, 0x00000020) == 0) {
- return;
+ if (func_80072320(_objectIndex, 0x00000020)) {
+ func_800722CC(_objectIndex, 0x00000020);
+ OThwomp::AddParticles(_objectIndex);
}
- func_800722CC(_objectIndex, 0x00000020);
- OThwomp::AddParticles(_objectIndex);
-
- for (var_s4 = 0; var_s4 < gObjectParticle2_SIZE; var_s4++) {
- objectIndex = gObjectParticle2[var_s4];
- if (objectIndex == DELETED_OBJECT_ID) {
- return;
- }
- if (gObjectList[objectIndex].state == 0) {
- return;
- }
- OThwomp::func_800810F4(objectIndex);
- if (gObjectList[objectIndex].state != 0) {
- return;
+ if (_idx == 0) {
+ for (var_s4 = 0; var_s4 < gObjectParticle2_SIZE; var_s4++) {
+ objectIndex = gObjectParticle2[var_s4];
+ if (objectIndex == DELETED_OBJECT_ID) {
+ continue;
+ }
+ if (gObjectList[objectIndex].state == 0) {
+ continue;
+ }
+ OThwomp::func_800810F4(objectIndex);
+ if (gObjectList[objectIndex].state != 0) {
+ continue;
+ }
+ delete_object_wrapper(&gObjectParticle2[var_s4]);
}
- delete_object_wrapper(&gObjectParticle2[var_s4]);
}
}
@@ -361,14 +363,16 @@ void OThwomp::func_8007F8D8() {
s32 OThwomp::func_8007F75C(s32 playerId) {
s32 someIndex;
- s32 temp_s7;
+ static s32 temp_s7 = 0; // Must be static to sync far travelling thwomp instances
s32 var_s6;
s32 waypoint;
waypoint = gNearestWaypointByPlayerId[playerId];
var_s6 = 0;
if ((waypoint >= 0xAA) && (waypoint < 0xB5)) {
- temp_s7 = random_int(0x0032U) + 0x32;
+ if (_idx == 0) {
+ temp_s7 = random_int(0x0032U) + 0x32;
+ }
if (gObjectList[_objectIndex].unk_0D5 == 3) {
var_s6 = 1;
OThwomp::func_8007F660(_objectIndex, playerId, temp_s7);
@@ -928,9 +932,9 @@ void OThwomp::func_8007FA08(s32 objectIndex) {
set_obj_origin_offset(objectIndex, 0.0f, 0.0f, 0.0f);
set_obj_direction_angle(objectIndex, 0U, 0U, 0U);
if (gIsMirrorMode != 0) {
- set_obj_orientation(objectIndex, 0U, 0xC000U, 0U);
+ set_obj_orientation(objectIndex, 0U, _faceDirection, 0U);
} else {
- set_obj_orientation(objectIndex, 0U, 0x4000U, 0U);
+ set_obj_orientation(objectIndex, 0U, -_faceDirection, 0U);
}
object->velocity[0] = 0.0f;
object->direction_angle[1] = object->orientation[1];
@@ -970,7 +974,7 @@ void OThwomp::func_8007FB48(s32 objectIndex) {
gObjectList[objectIndex].velocity[0] = player->unk_094 * xOrientation * 1.25;
if (gObjectList[objectIndex].unk_048 >= gObjectList[objectIndex].unk_0B0) {
if (gObjectList[objectIndex].unk_0B0 == gObjectList[objectIndex].unk_048) {
- if (D_8018D400 & 1) {
+ if (_rand & 1) { // D_8018D400 & 1
gObjectList[objectIndex].velocity[2] = 1.5f;
} else {
gObjectList[objectIndex].velocity[2] = -1.5f;
@@ -1169,9 +1173,9 @@ void OThwomp::func_800802C0(s32 objectIndex) {
object->offset[1] = 10.0f;
object->unk_01C[1] = 10.0f;
if (gIsMirrorMode != 0) {
- set_obj_orientation(objectIndex, 0U, 0x4000U, 0U);
+ set_obj_orientation(objectIndex, 0U, -_faceDirection, 0U);
} else {
- set_obj_orientation(objectIndex, 0U, 0xC000U, 0U);
+ set_obj_orientation(objectIndex, 0U, _faceDirection, 0U);
}
object->offset[0] = 0.0f;
object->offset[2] = 0.0f;
@@ -1195,7 +1199,7 @@ void OThwomp::SlidingBehaviour(s32 objectIndex) { // func_800808CC
OThwomp::func_8008085C(objectIndex);
func_80073514(objectIndex);
if (gGamestate != 9) {
- if ((D_8018D40C == 0) && (gObjectList[objectIndex].state == 2)) {
+ if (((_rand & 0x3F) == 0) && (gObjectList[objectIndex].state == 2)) { // D_8018D40C == 0 &&
func_800C98B8(gObjectList[objectIndex].pos, gObjectList[objectIndex].velocity,
SOUND_ARG_LOAD(0x19, 0x03, 0x60, 0x45));
}