Skip to content

Commit

Permalink
Split KartDynamics and match part of it
Browse files Browse the repository at this point in the history
  • Loading branch information
em-eight committed Oct 30, 2023
1 parent 60ce69c commit 5e4e0e8
Show file tree
Hide file tree
Showing 13 changed files with 764 additions and 53 deletions.
12 changes: 8 additions & 4 deletions pack/rel_objects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,24 @@ out/rel/text_8055572c_80577fc4.o
out/KartMove.o
out/rel/text_8058985c_80590128.o
out/rel/rodata_80891380_80891c58.o
out/rel/data_808b42ec_808bc810.o
out/rel/data_808b42ec_808b7300.o
out/rel/bss_809bd73c_809c1900.o
out/KartObjectProxy.o
out/rel/text_805919f4_805c23e4.o
out/rel/text_805919f4_805b4af8.o
out/rel/rodata_80891c80_80892750.o
out/KartDynamics.o
out/rel/text_805b6724_805c23e4.o
out/ControlGroup.o
out/rel/text_805c2c18_805f8b34.o
out/rel/rodata_80891c80_80896148.o
out/rel/rodata_80892788_80896148.o
out/MessageGroup.o
out/rel/text_805f8d5c_8060197c.o
out/Page.o
out/rel/text_80602d2c_80621d0c.o
out/Section.o
out/rel/text_80624690_8062c3a4.o
out/rel/rodata_80896158_808a4800.o
out/rel/data_808b7328_808bc810.o
out/SectionAutogens.o
out/rel/text_8063240c_80634b80.o
out/SectionDirector.o
Expand All @@ -77,7 +82,6 @@ out/ObjSunDSManager.o
out/ObjTaimatsu.o
out/rel/text_806deb40_80786e60.o
out/BoxColManager.o
out/rel/rodata_80896158_808a4800.o
out/BoxColUnit.o
out/rel/text_80786f98_8088f400.o
out/rel/rodata_808a4804_808b2bd0.o
Expand Down
5 changes: 5 additions & 0 deletions pack/rel_slices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ source/game/kart/KartObjectProxy.cpp:
rodata: [0x80891c58, 0x80891c80]
bss: [0x809c1900, 0x809c1910]

source/game/kart/KartDynamics.cpp:
text: [0x805b4af8, 0x805b6724]
rodata: [0x80892750, 0x80892788]
data: [0x808b7300, 0x808b7328]

source/game/ui/ControlGroup.cpp:
text: [0x805c23e4, 0x805c2c18]

Expand Down
68 changes: 34 additions & 34 deletions pack/symbols.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15052,7 +15052,7 @@ global:
0x80510a50: 'unk_80510a50'
0x80510a90: 'unk_80510a90'
0x80510ab8: 'unk_80510ab8'
0x80510b84: 'unk_80510b84'
0x80510b84: 'checkSector__Q26System17MapdataCheckPointCFRCQ26System16LinkedCheckpointRCQ23EGG8Vector2fRCQ23EGG8Vector2f'
0x80510bf0: 'unk_80510bf0'
0x80510c74: 'unk_80510c74'
0x80510d7c: 'Checkpoint_getCompletion'
Expand Down Expand Up @@ -16070,7 +16070,7 @@ global:
0x80542694: 'doLoadGlobeImpl__Q26System15ResourceManagerVFPPUc'
0x80542754: 'loadGlobeAsync__Q26System15ResourceManagerFPv'
0x805427bc: 'loadStaffGhostAsync__Q26System15ResourceManagerFQ36System14GhostFileGroup14GhostGroupTypeQ26System8CourseIdPUc'
0x80542868: 'unk_80542868__FPUlUlUl'
0x80542868: 'unk80542868__23ResourceManager80542868Fll'
0x80542878: 'InitScene_construct'
0x805429a8: 'InitScene_destroy'
0x80542a10: 'unk_80542a10'
Expand Down Expand Up @@ -16655,9 +16655,9 @@ global:
0x80555264: 'unk_80555264'
0x80555298: 'unk_80555298'
0x805552c8: 'MenuScene_vf30'
0x8055531c: 'rel_start'
0x80555368: 'unk_80555368'
0x805553b0: 'unk_805553b0'
0x8055531c: '_prolog'
0x80555368: '_epilog'
0x805553b0: '_unresolved'
0x80555464: '__ct__Q24Util6RandomFv'
0x805554d0: 'reseed__Q24Util6RandomFv'
0x80555514: '__ct__Q24Util6RandomFUl'
Expand Down Expand Up @@ -18260,8 +18260,8 @@ global:
0x8059f4f0: 'unk_8059f4f0'
0x8059f508: 'unk_8059f508'
0x8059f5bc: 'PlayerPhysicsHolder_construct'
0x8059f678: '__dt__Q24kart12KartDynamicsFv'
0x8059f6b8: '__dt__Q24kart11KartPhysics'
0x8059f678: '__dt__Q24Kart12KartDynamicsFv'
0x8059f6b8: '__dt__Q24Kart11KartPhysics'
0x8059f6f8: 'unk_8059f6f8'
0x8059f788: 'unk_8059f788'
0x8059f7c8: 'unk_8059f7c8'
Expand Down Expand Up @@ -18651,29 +18651,29 @@ global:
0x805b4a30: 'unk_805b4a30'
0x805b4a8c: 'unk_805b4a8c'
0x805b4a98: 'unk_805b4a98'
0x805b4af8: '__ct__Q24kart12KartDynamicsFv'
0x805b4b54: 'setDefault__Q24kart12KartDynamicsFv'
0x805b4d24: 'reset__Q24kart12KartDynamicsFv'
0x805b4dc0: 'init__Q24kart12KartDynamicsFv'
0x805b4dc4: 'setBspParams__Q24kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3fbf'
0x805b4e84: 'setInertia__Q24kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3f'
0x805b4f34: 'unk_805b4f34'
0x805b4f44: 'unk_805b4f44'
0x805b50f8: 'composeQuat__Q24kart12KartDynamicsFRQ23EGG5QuatfRCQ23EGG5QuatfRCQ23EGG5Quatf'
0x805b5170: 'PlayerPhysics_update'
0x805b5b64: 'forceUpright__Q24kart12KartDynamicsFv'
0x805b5b68: 'stabilize__Q24kart12KartDynamicsFv'
0x805b5ce8: 'unk_805b5ce8'
0x805b5e40: 'applyTorqueWorld__Q24kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3f'
0x805b5f44: 'unk_805b5f44'
0x805b5f78: 'unk_805b5f78'
0x805b6150: 'applySuspensionWrench__Q24kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3fRCQ23EGG8Vector3fb'
0x805b629c: 'unk_805b629c'
0x805b6388: 'addForce__Q24kart12KartDynamicsFRCQ23EGG8Vector3f'
0x805b63bc: 'getAngAcc__Q24kart12KartDynamicsFRQ23EGG8Vector3fRCQ23EGG8Vector3f'
0x805b6438: 'forceUpright__Q24kart16KartDynamicsBikeFv'
0x805b6448: 'stabilize__Q24kart16KartDynamicsBikeFv'
0x805b66e4: '__dt__Q24kart16KartDynamicsBikeFv'
0x805b4af8: '__ct__Q24Kart12KartDynamicsFv'
0x805b4b54: 'setDefault__Q24Kart12KartDynamicsFv'
0x805b4d24: 'reset__Q24Kart12KartDynamicsFv'
0x805b4dc0: 'init__Q24Kart12KartDynamicsFv'
0x805b4dc4: 'setBspParams__Q24Kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3fbf'
0x805b4e84: 'setInertia__Q24Kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3f'
0x805b4f34: 'updateInertiaTensorInverse__Q24Kart12KartDynamicsFv'
0x805b4f44: 'unk_805b4f44__Fv'
0x805b50f8: 'composeQuat__Q24Kart12KartDynamicsFRQ23EGG5QuatfRCQ23EGG5QuatfRCQ23EGG5Quatf'
0x805b5170: 'calc__Q24kart12KartDynamicsFffi'
0x805b5b64: 'forceUpright__Q24Kart12KartDynamicsFv'
0x805b5b68: 'stabilize__Q24Kart12KartDynamicsFv'
0x805b5ce8: 'applyWrenchScaled__Q24kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3ff'
0x805b5e40: 'applyTorqueWorld__Q24kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3f__Fv'
0x805b5f44: 'addTorque__Q24Kart12KartDynamicsFRCQ23EGG8Vector3f'
0x805b5f78: 'unk_805b5f78__Fv'
0x805b6150: 'applySuspensionWrench__Q24Kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3fRCQ23EGG8Vector3fb'
0x805b629c: 'applyWrench__Q24Kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3f'
0x805b6388: 'addForce__Q24Kart12KartDynamicsFRCQ23EGG8Vector3f'
0x805b63bc: 'getAngAcc__Q24Kart12KartDynamicsFRQ23EGG8Vector3fRCQ23EGG8Vector3f'
0x805b6438: 'forceUpright__Q24Kart16KartDynamicsBikeFv'
0x805b6448: 'stabilize__Q24Kart16KartDynamicsBikeFv'
0x805b66e4: '__dt__Q24Kart16KartDynamicsBikeFv'
0x805b6724: 'PlayerSub18_findCollisionInner'
0x805b6a9c: 'unk_805b6a9c'
0x805b6d48: 'PlayerSub18_applyBodyCollision'
Expand Down Expand Up @@ -36277,7 +36277,7 @@ global:
0x808b3bec: 'LOD_RES_SUFFIXES'
0x808b3bf8: 'EarthResourceListing'
0x808b3bfc: '__vt__Q26System15ResourceManager'
0x808b3c08: 'lbl_808b3c08'
0x808b3c08: '__vt__Q26System20MenuCharacterManager'
0x808b3c14: '__vt__Q26System1S'
0x808b3c20: '__vt__Q26System11CourseCache'
0x808b3c48: 'lbl_808b3c48'
Expand Down Expand Up @@ -36632,7 +36632,7 @@ global:
0x808b6968: 'lbl_808b6968'
0x808b69b0: 'lbl_808b69b0'
0x808b69cc: 'lbl_808b69cc'
0x808b69e8: '__vt__Q24kart11KartPhysics'
0x808b69e8: '__vt__Q24Kart11KartPhysics'
0x808b6a08: 'lbl_808b6a08'
0x808b6a10: 'lbl_808b6a10'
0x808b6a20: 'lbl_808b6a20'
Expand Down Expand Up @@ -36704,8 +36704,8 @@ global:
0x808b72a0: 'lbl_808b72a0'
0x808b72c0: 'lbl_808b72c0'
0x808b72e0: 'lbl_808b72e0'
0x808b7300: '__vt__Q24kart16KartDynamicsBike'
0x808b7314: '__vt__Q24kart12KartDynamics'
0x808b7300: '__vt__Q24Kart16KartDynamicsBike'
0x808b7314: '__vt__Q24Kart12KartDynamics'
0x808b7328: 'lbl_808b7328'
0x808b7334: 'lbl_808b7334'
0x808b7340: 'lbl_808b7340'
Expand Down
61 changes: 61 additions & 0 deletions source/egg/math/eggMatrix.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// credits: kiwi
// https://github.com/kiwi515/ogws/blob/master/include/egg/math/eggMatrix.h

#ifndef EGG_MATH_MATRIX_H
#define EGG_MATH_MATRIX_H

#include "egg/math/eggVector.hpp"
#include "egg/math/eggQuat.hpp"

namespace EGG
{
struct Matrix33f
{
f32& operator()(int i, int j) { return tbl[i][j]; }

f32 tbl[3][3];
};

struct Matrix34f
{
Matrix34f() {}
Matrix34f(f32, f32, f32, f32,
f32, f32, f32, f32,
f32, f32, f32, f32);

void makeZero()
{
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 4; j++) {
tbl[i][j] = 0.0f;
}
}
}

void inverseToC(Matrix34f& inv) const;
void makeIdentity();
void makeQ(const Quatf&);
void makeS(const Vector3f&);
void setAxisRotation(const Vector3f &, f32);
void loadPosMtx(u32);

f32& operator()(int i, int j) { return tbl[i][j]; }

friend Vector3f operator*(const Matrix34f& M, const Vector3f& v) {
Vector3f out;
const float vecX = v.x;
const float vecY = v.y;
const float vecZ = v.z;
out.x = (vecX * M.tbl[0][0]) + (vecY * M.tbl[0][1]) + (vecZ * M.tbl[0][2]);
out.y = (vecX * M.tbl[1][0]) + (vecY * M.tbl[1][1]) + (vecZ * M.tbl[1][2]);
out.z = (vecX * M.tbl[2][0]) + (vecY * M.tbl[2][1]) + (vecZ * M.tbl[2][2]);
return out;
}

f32 tbl[3][4];

static Matrix34f ident;
};
}

#endif
62 changes: 54 additions & 8 deletions source/egg/math/eggVector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <nw4r/math/mathTypes.hpp>

namespace EGG {
class Quatf;

struct Vector2f {
float x;
Expand All @@ -31,10 +32,13 @@ struct Vector2f {

struct Vector3f : public nw4r::math::VEC3 {
float dot() const { return x * x + y * y + z * z; }
static float dot(const Vector3f& v1, const Vector3f& v2) { return v1.x * v2.x + v1.y * v2.y + v1.z * v2.z; }

float normalise();
// uses fsqrt directly
void normalise2();
void fromRotated(const Quatf& q, const Vector3f& v);
static void projAndRej(Vector3f& proj, Vector3f& rej, const Vector3f& v1, const Vector3f& v2);

static const Vector3f zero;
// Basis vectors
Expand All @@ -54,27 +58,69 @@ struct Vector3f : public nw4r::math::VEC3 {
z = v.z;
}

// operator Vec*() { return reinterpret_cast<Vec*>(&x); }
inline void setZero() {
x = y = z = 0.0f;
}

inline void setOne() {
x = y = z = 1.0f;
}

inline void setUp() {
x = 0.0f;
y = 1.0f;
z = 0.0f;
}

Vector3f operator-() const { return Vector3f(-x, -y, -z); }
Vector3f operator-(const Vector3f& rhs) const {
return Vector3f(x - rhs.x, y - rhs.y, z - rhs.y);
Vector3f operator-(const Vector3f& rhs) const;
Vector3f& operator+=(const Vector3f& rhs) {
this->x += rhs.x;
this->y += rhs.y;
this->z += rhs.z;
return *this;
}
Vector3f operator+(const Vector3f& rhs) const {
return Vector3f(x + rhs.x, y + rhs.y, z + rhs.z);
friend Vector3f operator+(Vector3f lhs, const Vector3f& rhs) {
lhs += rhs;
return lhs;
}
Vector3f operator*(float scalar) const {
return Vector3f(x * scalar, y * scalar, z * scalar);
Vector3f& operator*=(float rhs) {
this->x *= rhs;
this->y *= rhs;
this->z *= rhs;
return *this;
}
friend Vector3f operator*(Vector3f lhs, float rhs) {
lhs *= rhs;
return lhs;
}
Vector3f cross(EGG::Vector3f& rhs) const {
/*Vector3f operator*(float scalar) const {
return Vector3f(x * scalar, y * scalar, z * scalar);
}*/
Vector3f cross(const EGG::Vector3f& rhs) const {
return Vector3f(y * rhs.z - z * rhs.y, z * rhs.x - x * rhs.z,
x * rhs.y - y * rhs.x);
}
static Vector3f cross(const EGG::Vector3f& lhs, const EGG::Vector3f& rhs) {
return lhs.cross(rhs);
}

// for now
#ifndef REL
// projection and rejection of v0 onto v1
~Vector3f();
#endif
};

inline Vector3f VEC3Sub(const Vector3f& lhs, const Vector3f& rhs) {
Vector3f out;
out.x = lhs.x - rhs.x;
out.y = lhs.y - rhs.y;
out.z = lhs.z - rhs.z;
return out;
}
inline Vector3f Vector3f::operator-(const Vector3f& rhs) const {
return VEC3Sub(*this, rhs);
}

} // namespace EGG
Loading

0 comments on commit 5e4e0e8

Please sign in to comment.