Match and link CTweakBall

This commit is contained in:
Henrique Gemignani Passos Lima 2022-11-10 23:16:05 +02:00
parent 393704d4ee
commit 40820957c8
No known key found for this signature in database
GPG Key ID: E224F951761145F8
4 changed files with 147 additions and 12 deletions

View File

@ -3,8 +3,8 @@
.section .data
.balign 8
.global lbl_803DAD30
lbl_803DAD30:
.global __vt__10CTweakBall
__vt__10CTweakBall:
# ROM: 0x3D7D30
.4byte 0
.4byte 0
@ -51,10 +51,10 @@ __ct__10CTweakBallFR12CInputStream:
/* 80090B54 0008DAB4 94 21 FF C0 */ stwu r1, -0x40(r1)
/* 80090B58 0008DAB8 7C 08 02 A6 */ mflr r0
/* 80090B5C 0008DABC 3C C0 80 3E */ lis r6, __vt__12ITweakObject@ha
/* 80090B60 0008DAC0 3C A0 80 3E */ lis r5, lbl_803DAD30@ha
/* 80090B60 0008DAC0 3C A0 80 3E */ lis r5, __vt__10CTweakBall@ha
/* 80090B64 0008DAC4 90 01 00 44 */ stw r0, 0x44(r1)
/* 80090B68 0008DAC8 38 C6 9C C4 */ addi r6, r6, __vt__12ITweakObject@l
/* 80090B6C 0008DACC 38 05 AD 30 */ addi r0, r5, lbl_803DAD30@l
/* 80090B6C 0008DACC 38 05 AD 30 */ addi r0, r5, __vt__10CTweakBall@l
/* 80090B70 0008DAD0 C0 22 8A F0 */ lfs f1, lbl_805AA810@sda21(r2)
/* 80090B74 0008DAD4 93 E1 00 3C */ stw r31, 0x3c(r1)
/* 80090B78 0008DAD8 7C 7F 1B 78 */ mr r31, r3
@ -453,8 +453,8 @@ __dt__10CTweakBallFv:
/* 80091180 0008E0E0 93 E1 00 0C */ stw r31, 0xc(r1)
/* 80091184 0008E0E4 7C 7F 1B 79 */ or. r31, r3, r3
/* 80091188 0008E0E8 41 82 00 30 */ beq lbl_800911B8
/* 8009118C 0008E0EC 3C 60 80 3E */ lis r3, lbl_803DAD30@ha
/* 80091190 0008E0F0 38 03 AD 30 */ addi r0, r3, lbl_803DAD30@l
/* 8009118C 0008E0EC 3C 60 80 3E */ lis r3, __vt__10CTweakBall@ha
/* 80091190 0008E0F0 38 03 AD 30 */ addi r0, r3, __vt__10CTweakBall@l
/* 80091194 0008E0F4 90 1F 00 00 */ stw r0, 0(r31)
/* 80091198 0008E0F8 41 82 00 10 */ beq lbl_800911A8
/* 8009119C 0008E0FC 3C 60 80 3E */ lis r3, __vt__12ITweakObject@ha

View File

@ -97,7 +97,7 @@ LIBS = [
["MetroidPrime/Cameras/CBallCamera", False],
"MetroidPrime/ScriptObjects/CScriptEffect",
"MetroidPrime/Weapons/CBomb",
"MetroidPrime/Tweaks/CTweakBall",
["MetroidPrime/Tweaks/CTweakBall", True],
["MetroidPrime/Player/CPlayerState", False],
["MetroidPrime/ScriptObjects/CScriptTimer", True],
"MetroidPrime/Cameras/CCinematicCamera",

View File

@ -5,13 +5,18 @@
#include "MetroidPrime/Tweaks/ITweakObject.hpp"
#include "Kyoto/TOneStatic.hpp"
#include "Kyoto/Math/CVector3f.hpp"
#include "Kyoto/Math/CRelAngle.hpp"
#include "rstl/string.hpp"
class CTweakBall : public ITweakObject {
class CTweakBall;
class CTweakBall : public ITweakObject, public TOneStatic< CTweakBall > {
public:
~CTweakBall() override;
CTweakBall(CInputStream&);
float GetMaxBallTranslationAcceleration(int s) const { return x4_maxTranslationAcceleration[s]; }
float GetBallTranslationFriction(int s) const { return x24_translationFriction[s]; }
@ -157,8 +162,8 @@ private:
float x12c_ballSlipFactor[8];
float x14c_;
float x150_;
float x158_;
float x154_;
float x158_;
float x15c_;
float x160_;
float x164_;
@ -189,27 +194,29 @@ private:
float x1d8_;
float x1dc_minimumAlignmentSpeed;
float x1e0_tireness;
float x1e4_leftStickDivisor;
float x1e8_rightStickDivisor;
float x1ec_maxLeanAngle;
float x1f0_tireToMarbleThresholdSpeed;
float x1f4_marbleToTireThresholdSpeed;
float x1f8_forceToLeanGain;
float x1fc_leanTrackingGain;
float x1e4_leftStickDivisor;
float x1e8_rightStickDivisor;
float x200_;
float x204_ballTouchRadius;
float x208_;
float x20c_boostBallDrainTime;
float x210_boostBallMaxChargeTime;
float x214_;
float x218_boostBallMinChargeTime;
float x21c_boostBallMinRelativeSpeedForDamage;
float x220_boostBallChargeTime0;
float x224_boostBallChargeTime1;
float x228_boostBallChargeTime2;
float x210_boostBallMaxChargeTime;
float x22c_boostBallIncrementalSpeed0;
float x230_boostBallIncrementalSpeed1;
float x234_boostBallIncrementalSpeed2;
};
CHECK_SIZEOF(CTweakBall, 0x238)
extern CTweakBall* gpTweakBall;

View File

@ -0,0 +1,128 @@
#include "MetroidPrime/Tweaks/CTweakBall.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
CTweakBall::~CTweakBall() {}
CTweakBall::CTweakBall(CInputStream& in)
: x78_ballCameraOffset(CVector3f::Zero())
, x158_(0.0f)
, x18c_ballCameraChaseLookAtOffset(CVector3f::Zero())
, x1b8_ballCameraBoostLookAtOffset(CVector3f::Zero())
, x1ec_maxLeanAngle(0.0f)
{
int i;
for (i = 0; i < 8; ++i) {
x4_maxTranslationAcceleration[i] = in.ReadFloat();
}
for (i = 0; i < 8; ++i) {
x24_translationFriction[i] = in.ReadFloat();
}
for (i = 0; i < 8; ++i) {
x44_translationMaxSpeed[i] = in.ReadFloat();
}
x64_ = in.ReadFloat();
x68_ = in.ReadFloat();
x6c_ = -in.ReadFloat();
x70_ = -in.ReadFloat();
for (i = 0; i < 8; ++i) {
xc4_ballForwardBrakingAcceleration[i] = in.ReadFloat();
}
xe4_ballGravity = -in.ReadFloat();
xe8_ballWaterGravity = -in.ReadFloat();
x14c_ = in.ReadFloat();
x150_ = in.ReadFloat();
x158_ = in.ReadFloat() * (M_PIF / 180.f);
x1dc_minimumAlignmentSpeed = in.ReadFloat();
x1e0_tireness = in.ReadFloat();
x1ec_maxLeanAngle = in.ReadFloat() * (M_PIF / 180.f);
x1f0_tireToMarbleThresholdSpeed = in.ReadFloat();
x1f4_marbleToTireThresholdSpeed = in.ReadFloat();
x1f8_forceToLeanGain = in.ReadFloat();
x1fc_leanTrackingGain = in.ReadFloat();
x12c_ballSlipFactor[0] = 10000.f;
x12c_ballSlipFactor[1] = 10000.f;
x12c_ballSlipFactor[2] = 1000.f;
x12c_ballSlipFactor[3] = 10000.f;
x12c_ballSlipFactor[4] = 2000.f;
x12c_ballSlipFactor[5] = 2000.f;
x12c_ballSlipFactor[6] = 2000.f;
x12c_ballSlipFactor[7] = 2000.f;
xec_ = 10000.f;
xf0_ = 1000.f;
xf4_ = 40000.f;
xf8_ = 40000.f;
xfc_ = 40000.f;
x100_ = 40000.f;
x104_ = 40000.f;
x108_ = 40000.f;
x10c_ = 10000.f;
x110_ = 1000.f;
x114_ = 40000.f;
x118_ = 40000.f;
x11c_ = 40000.f;
x120_ = 40000.f;
x124_ = 40000.f;
x128_ = 40000.f;
x74_ballCameraAnglePerSecond = in.ReadFloat() * (M_PIF / 180.f);
x78_ballCameraOffset = CVector3f(in);
x84_ballCameraMinSpeedDistance = in.ReadFloat();
x88_ballCameraMaxSpeedDistance = in.ReadFloat();
x8c_ballCameraBackwardsDistance = in.ReadFloat();
x90_ = in.ReadFloat() * (M_PIF / 180.f);
x94_ballCameraSpringConstant = in.ReadFloat();
x98_ballCameraSpringMax = in.ReadFloat();
x9c_ballCameraSpringTardis = in.ReadFloat();
xa0_ballCameraCentroidSpringConstant = in.ReadFloat();
xa4_ballCameraCentroidSpringMax = in.ReadFloat();
xa8_ballCameraCentroidSpringTardis = in.ReadFloat();
xac_ballCameraCentroidDistanceSpringConstant = in.ReadFloat();
xb0_ballCameraCentroidDistanceSpringMax = in.ReadFloat();
xb4_ballCameraCentroidDistanceSpringTardis = in.ReadFloat();
xb8_ballCameraLookAtSpringConstant = in.ReadFloat();
xbc_ballCameraLookAtSpringMax = in.ReadFloat();
xc0_ballCameraLookAtSpringTardis = in.ReadFloat();
x154_ = in.ReadFloat();
x15c_ = in.ReadFloat() * (M_PIF / 180.f);
x160_ = in.ReadFloat();
x164_ = in.ReadFloat();
x168_ = in.ReadFloat();
x16c_ = in.ReadFloat() * (M_PIF / 180.f);
x170_conservativeDoorCamDistance = in.ReadFloat();
x174_ = in.ReadFloat() * (M_PIF / 180.f);
x178_ballCameraChaseElevation = in.ReadFloat();
x17c_ballCameraChaseDampenAngle = in.ReadFloat() * (M_PIF / 180.f);
x180_ballCameraChaseDistance = in.ReadFloat();
x184_ballCameraChaseYawSpeed = in.ReadFloat() * (M_PIF / 180.f);
x188_ballCameraChaseAnglePerSecond = in.ReadFloat() * (M_PIF / 180.f);
x18c_ballCameraChaseLookAtOffset = CVector3f(in);
x198_ballCameraChaseSpringConstant = in.ReadFloat();
x19c_ballCameraChaseSpringMax = in.ReadFloat();
x1a0_ballCameraChaseSpringTardis = in.ReadFloat();
x1a4_ballCameraBoostElevation = in.ReadFloat();
x1a8_ballCameraBoostDampenAngle = in.ReadFloat() * (M_PIF / 180.f);
x1ac_ballCameraBoostDistance = in.ReadFloat();
x1b0_ballCameraBoostYawSpeed = in.ReadFloat() * (M_PIF / 180.f);
x1b4_ballCameraBoostAnglePerSecond = in.ReadFloat() * (M_PIF / 180.f);
x1b8_ballCameraBoostLookAtOffset = CVector3f(in);
x1c4_ballCameraBoostSpringConstant = in.ReadFloat();
x1c8_ballCameraBoostSpringMax = in.ReadFloat();
x1cc_ballCameraBoostSpringTardis = in.ReadFloat();
x1d0_ballCameraControlDistance = in.ReadFloat();
x1d4_ = in.ReadFloat();
x1d8_ = in.ReadFloat();
x1e4_leftStickDivisor = in.ReadFloat();
x1e8_rightStickDivisor = in.ReadFloat();
x200_ = in.ReadFloat();
x204_ballTouchRadius = in.ReadFloat();
x20c_boostBallDrainTime = in.ReadFloat();
x218_boostBallMinChargeTime = in.ReadFloat();
x21c_boostBallMinRelativeSpeedForDamage = in.ReadFloat();
x220_boostBallChargeTime0 = in.ReadFloat();
x224_boostBallChargeTime1 = in.ReadFloat();
x210_boostBallMaxChargeTime = in.ReadFloat();
x228_boostBallChargeTime2 = x210_boostBallMaxChargeTime;
x22c_boostBallIncrementalSpeed0 = in.ReadFloat();
x230_boostBallIncrementalSpeed1 = in.ReadFloat();
x234_boostBallIncrementalSpeed2 = in.ReadFloat();
}