Skip to content

Commit a6105e9

Browse files
Anthony Rossisnailspeed3
authored andcommitted
Work on KartObjectProxy (and related)
1 parent 6eed2ce commit a6105e9

8 files changed

Lines changed: 156 additions & 22 deletions

File tree

‎config/RMCP01/module/splits.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,20 @@ ui/MessageGroup.cpp:
151151
.text start:0x000E8780 end:0x000E89A8
152152
.rodata start:0x00006A28 end:0x00006A38
153153

154-
Page.o:
154+
ui/Page.cpp:
155155
.text start:0x000F15C8 end:0x000F2978
156+
.data start:0x000079F0 end:0x00007A54
156157

157-
Section.o:
158+
ui/Section.o:
158159
.text start:0x00111958 end:0x001142DC
159160

160161
ui/SectionAutogens.cpp:
161162
.text start:0x0011BFF0 end:0x00122058
162163
.data start:0x00009C40 end:0x0000A400
163164

164-
SectionDirector.o:
165+
ui/SectionManager.cpp:
165166
.text start:0x001247CC end:0x00125B04
167+
.bss start:0x00004758 end:0x00004760
166168

167169
net/MiscPacketHandler.cpp:
168170
.text start:0x00142E54 end:0x00145484

‎config/RMCP01/module/symbols.txt‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2817,19 +2817,19 @@ __ct__Q24Kart15KartObjectProxyFv = .text:0x0007FDD8; // type:function size:0x44
28172817
setupSingle = .text:0x0007FE1C; // type:function size:0x3C scope:global align:4
28182818
getPos__Q24Kart15KartObjectProxyCFv = .text:0x0007FE58; // type:function size:0x18 scope:global align:4
28192819
PlayerPointers_getPlayerPhysicsHolderPosition = .text:0x0007FE70; // type:function size:0x14 scope:global align:4
2820-
various_stuff_set_player_position = .text:0x0007FE84; // type:function size:0x2C scope:global align:4
2821-
PlayerPointers_getMat = .text:0x0007FEB0; // type:function size:0x14 scope:global align:4
2822-
fn_1_7FEC4 = .text:0x0007FEC4; // type:function size:0x10
2823-
various_stuff_set_player_rotation = .text:0x0007FED4; // type:function size:0x54 scope:global align:4
2824-
PlayerPointers_getWheelCount0 = .text:0x0007FF28; // type:function size:0x10 scope:global align:4
2825-
PlayerPointers_getWheelCount1 = .text:0x0007FF38; // type:function size:0x10 scope:global align:4
2826-
fn_1_7FF48 = .text:0x0007FF48; // type:function size:0x10
2827-
fn_1_7FF58 = .text:0x0007FF58; // type:function size:0x10
2828-
fn_1_7FF68 = .text:0x0007FF68; // type:function size:0x1C
2829-
fn_1_7FF84 = .text:0x0007FF84; // type:function size:0x18
2820+
setPos__Q24Kart15KartObjectProxyFPQ23EGG8Vector3f = .text:0x0007FE84; // type:function size:0x2C scope:global align:4
2821+
getPose__Q24Kart15KartObjectProxyCFv = .text:0x0007FEB0; // type:function size:0x14 scope:global align:4
2822+
getBodyRot__Q24Kart15KartObjectProxyCFv = .text:0x0007FEC4; // type:function size:0x10
2823+
setRot__Q24Kart15KartObjectProxyFQ23EGG5Quatf = .text:0x0007FED4; // type:function size:0x54 scope:global align:4
2824+
getSuspCount__Q24Kart15KartObjectProxyFv = .text:0x0007FF28; // type:function size:0x10 scope:global align:4
2825+
getWheelCount__Q24Kart15KartObjectProxyFv = .text:0x0007FF38; // type:function size:0x10 scope:global align:4
2826+
getWheelCountRecip__Q24Kart15KartObjectProxyFv = .text:0x0007FF48; // type:function size:0x10
2827+
getWheelCountPlusOneRecip__Q24Kart15KartObjectProxyFv = .text:0x0007FF58; // type:function size:0x10
2828+
getWheelPos__Q24Kart15KartObjectProxyFUl = .text:0x0007FF68; // type:function size:0x1C
2829+
wheelIdxHasFloorCollision__Q24Kart15KartObjectProxyFUl = .text:0x0007FF84; // type:function size:0x18
28302830
fn_1_7FF9C = .text:0x0007FF9C; // type:function size:0x18
28312831
fn_1_7FFB4 = .text:0x0007FFB4; // type:function size:0x18
2832-
fn_1_7FFCC = .text:0x0007FFCC; // type:function size:0x10
2832+
setStartBoostIdx__Q24Kart15KartObjectProxyFl = .text:0x0007FFCC; // type:function size:0x10
28332833
fn_1_7FFDC = .text:0x0007FFDC; // type:function size:0x1C
28342834
kartPhysics__Q24Kart15KartObjectProxyFv = .text:0x0007FFF8; // type:function size:0x10 scope:global align:4
28352835
kartPhysics__Q24Kart15KartObjectProxyCFv = .text:0x00080008; // type:function size:0x10 scope:global align:4
@@ -2842,20 +2842,20 @@ fn_1_800C4 = .text:0x000800C4; // type:function size:0xF4
28422842
fn_1_801B8 = .text:0x000801B8; // type:function size:0x4
28432843
fn_1_801BC = .text:0x000801BC; // type:function size:0xDC
28442844
fn_1_80298 = .text:0x00080298; // type:function size:0x4
2845-
PlayerPointers_isReal = .text:0x0008029C; // type:function size:0x14 scope:global align:4
2845+
isLocal__Q24Kart15KartObjectProxyFv = .text:0x0008029C; // type:function size:0x14 scope:global align:4
28462846
isCpu__Q24Kart15KartObjectProxyCFv = .text:0x000802B0; // type:function size:0x14 scope:global align:4
2847-
PlayerPointers_isGhost = .text:0x000802C4; // type:function size:0x14 scope:global align:4
2847+
isGhost__Q24Kart15KartObjectProxyFv = .text:0x000802C4; // type:function size:0x14 scope:global align:4
28482848
PlayerModel_isMii = .text:0x000802D8; // type:function size:0x10 scope:global align:4
28492849
kartBody__Q24Kart15KartObjectProxyFv = .text:0x000802E8; // type:function size:0xC scope:global align:4
28502850
kartBody__Q24Kart15KartObjectProxyCFv = .text:0x000802F4; // type:function size:0xC scope:global align:4
28512851
kartSus__Q24Kart15KartObjectProxyFl = .text:0x00080300; // type:function size:0x14 scope:global align:4
28522852
kartSus__Q24Kart15KartObjectProxyCFl = .text:0x00080314; // type:function size:0x14 scope:global align:4
28532853
kartWheel__Q24Kart15KartObjectProxyFl = .text:0x00080328; // type:function size:0x14 scope:global align:4
28542854
kartWheel__Q24Kart15KartObjectProxyCFl = .text:0x0008033C; // type:function size:0x14 scope:global align:4
2855-
PlayerPointers_getWheelPhysicsHolder = .text:0x00080350; // type:function size:0x18 scope:global align:4
2856-
fn_1_80368 = .text:0x00080368; // type:function size:0x18
2857-
PlayerPointers_getWheelPhysics = .text:0x00080380; // type:function size:0x18 scope:global align:4
2858-
fn_1_80398 = .text:0x00080398; // type:function size:0x18
2855+
kartSusPhysics__Q24Kart15KartObjectProxyFl = .text:0x00080350; // type:function size:0x18 scope:global align:4
2856+
kartSusPhysics__Q24Kart15KartObjectProxyCFl = .text:0x00080368; // type:function size:0x18
2857+
kartWheelPhysics__Q24Kart15KartObjectProxyFl = .text:0x00080380; // type:function size:0x18 scope:global align:4
2858+
kartWheelPhysics__Q24Kart15KartObjectProxyCFl = .text:0x00080398; // type:function size:0x18
28592859
kartPhysicsEngine__Q24Kart15KartObjectProxyFv = .text:0x000803B0; // type:function size:0xC scope:global align:4
28602860
kartPhysicsEngine__Q24Kart15KartObjectProxyCFv = .text:0x000803BC; // type:function size:0xC scope:global align:4
28612861
kartMove__Q24Kart15KartObjectProxyFv = .text:0x000803C8; // type:function size:0xC scope:global align:4

‎configure.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,7 @@ def MatchingFor(*versions):
778778
Object(NonMatching, "kart/KartState.cpp"),
779779
Object(NonMatching, "kart/KartSus.cpp"),
780780
Object(NonMatching, "kart/KartWheelPhysics.cpp"),
781+
Object(NonMatching, "kart/KartSusPhysics.cpp"),
781782
Object(NonMatching, "kart/KartPhysics.cpp"),
782783
Object(Matching, "kart/KartPhysicsInstance.cpp"),
783784
Object(NonMatching, "kart/KartDynamics.cpp"),
@@ -786,6 +787,8 @@ def MatchingFor(*versions):
786787
Object(Matching, "ui/ControlGroup.cpp"),
787788
Object(Matching, "ui/MessageGroup.cpp"),
788789
Object(NonMatching, "ui/SectionAutogens.cpp"),
790+
Object(NonMatching, "ui/SectionManager.cpp"),
791+
Object(NonMatching, "ui/Page.cpp"),
789792

790793
Object(Equivalent, "enemy/AI.cpp"),
791794
Object(Equivalent, "enemy/AITrickHandler.cpp"),

‎src/kart/KartObjectProxy.cpp‎

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
#include "KartObjectProxy.hpp"
2+
#include "egg/math/eggMatrix.hpp"
3+
#include "host_system/SystemManager.hpp"
4+
#include "kart/KartPart.hpp"
5+
#include "kart/KartPhysics.hpp"
6+
#include "kart/KartState.hpp"
7+
#include "system/KPadController.hpp"
8+
#include "system/RaceManager.hpp"
29
#include <stddef.h>
310

411
#include <kart/KartMove.hpp>
@@ -30,6 +37,51 @@ KartObjectProxy::KartObjectProxy() : mAccessor(nullptr) {
3037

3138
const EGG::Vector3f& KartObjectProxy::getPos() const { return kartDynamics()->pos; }
3239

40+
const EGG::Vector3f& KartObjectProxy::getPrevPos() const { return kartPhysics()->pos; }
41+
42+
void KartObjectProxy::setPos(const EGG::Vector3f &pos) {
43+
kartDynamics()->pos = pos;
44+
}
45+
46+
const EGG::Matrix34f& KartObjectProxy::getPose() const { return kartPhysics()->pose; }
47+
48+
const EGG::Matrix34f& KartObjectProxy::getBodyRot() const { return kartBody()->pose; }
49+
50+
void KartObjectProxy::setRot(const EGG::Quatf &rot) {
51+
KartDynamics* dynamics = kartDynamics();
52+
dynamics->fullRot = rot;
53+
dynamics->mainRot = rot;
54+
}
55+
56+
u16 KartObjectProxy::getSuspCount() { return kartSettings()->susCount; }
57+
u16 KartObjectProxy::getWheelCount() { return kartSettings()->wheelCount; }
58+
float KartObjectProxy::getWheelCountRecip() { return kartSettings()->wheelCountRecip; }
59+
float KartObjectProxy::getWheelCountPlusOneRecip() { return kartSettings()->wheelCountPlusOneRecip; }
60+
61+
const EGG::Vector3f& KartObjectProxy::getWheelPos(u32 wheelIdx) {
62+
return kartWheel(wheelIdx)->getPhysics()->wheelPos;
63+
}
64+
65+
bool KartObjectProxy::wheelIdxHasFloorCollision(u32 wheelIdx) {
66+
return kartWheel(wheelIdx)->getPhysics()->hasFloorCollision();
67+
}
68+
69+
void KartObjectProxy::setBodyAngle(f32 angle) {
70+
// TODO
71+
//kartBody()->setAngle(angle);
72+
}
73+
74+
void KartObjectProxy::setStartBoostIdx(s32 idx) {
75+
kartState()->setStartBoostIdx(idx);
76+
}
77+
78+
const EGG::Vector3f& KartObjectProxy::getWheelEdgePos(u32 wheelIdx) {
79+
return kartWheel(wheelIdx)->getPhysics()->wheelEdgePos;
80+
}
81+
82+
KartSettings* KartObjectProxy::kartSettings() { return mAccessor->kartSettings; }
83+
84+
const KartSettings* KartObjectProxy::kartSettings() const { return mAccessor->kartSettings; }
3385
KartPhysics* KartObjectProxy::kartPhysics() { return mAccessor->mBody->getPhysics(); }
3486

3587
const KartPhysics* KartObjectProxy::kartPhysics() const { return mAccessor->mBody->getPhysics(); }
@@ -38,6 +90,22 @@ KartDynamics* KartObjectProxy::kartDynamics() { return mAccessor->mBody->getPhys
3890

3991
const KartDynamics* KartObjectProxy::kartDynamics() const { return mAccessor->mBody->getPhysics()->mpDynamics; }
4092

93+
System::KPad* KartObjectProxy::getInput() {
94+
return System::RaceManager::spInstance->players[kartSettings()->playerIdx]->kpadPlayer;
95+
}
96+
97+
bool KartObjectProxy::isLocal() {
98+
return kartState()->on(KART_FLAG_LOCAL);
99+
}
100+
101+
bool KartObjectProxy::isCpu() {
102+
return kartState()->on(KART_FLAG_CPU);
103+
}
104+
105+
bool KartObjectProxy::isGhost() {
106+
return kartState()->on(KART_FLAG_GHOST);
107+
}
108+
41109
KartBody* KartObjectProxy::kartBody() { return mAccessor->mBody; }
42110

43111
const KartBody* KartObjectProxy::kartBody() const { return mAccessor->mBody; }
@@ -54,6 +122,19 @@ const KartWheel* KartObjectProxy::kartWheel(s32 idx) const {
54122
return mAccessor->mWheels[idx];
55123
}
56124

125+
KartSusPhysics* KartObjectProxy::kartSusPhysics(s32 idx) { return kartSus(idx)->getPhysics(); }
126+
127+
const KartSusPhysics* KartObjectProxy::kartSusPhysics(s32 idx) const {
128+
return kartSus(idx)->getPhysics();
129+
}
130+
131+
KartWheelPhysics* KartObjectProxy::kartWheelPhysics(s32 idx) { return mAccessor->mWheels[idx]->getPhysics(); }
132+
133+
const KartWheelPhysics* KartObjectProxy::kartWheelPhysics(s32 idx) const {
134+
return mAccessor->mWheels[idx]->getPhysics();
135+
}
136+
137+
57138
KartPhysicsEngine* KartObjectProxy::kartPhysicsEngine() { return mAccessor->mPhysicsEngine; }
58139

59140
const KartPhysicsEngine* KartObjectProxy::kartPhysicsEngine() const { return mAccessor->mPhysicsEngine; }

‎src/kart/KartObjectProxy.hpp‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010

1111
#include "KartSettings.hpp"
1212
#include "KartHitbox.hpp"
13+
#include "egg/math/eggMatrix.hpp"
14+
#include "egg/math/eggQuat.hpp"
15+
#include "kart/KartWheel.hpp"
16+
#include "kart/KartSus.hpp"
17+
#include "system/KPadController.hpp"
1318

1419
namespace Kart {
1520

@@ -18,6 +23,8 @@ class KartPhysics;
1823
class KartDynamics;
1924
class KartSus;
2025
class KartWheel;
26+
class KartSusPhysics;
27+
class KartWheelPhysics;
2128
class KartPhysicsEngine;
2229
class KartMove;
2330
class KartSnd;
@@ -77,6 +84,8 @@ class KartObjectProxy {
7784
public:
7885
KartObjectProxy();
7986

87+
KartSettings* kartSettings();
88+
const KartSettings* kartSettings() const;
8089
KartPhysics* kartPhysics();
8190
const KartPhysics* kartPhysics() const;
8291
KartDynamics* kartDynamics();
@@ -87,6 +96,10 @@ class KartObjectProxy {
8796
const KartSus* kartSus(s32 idx) const;
8897
KartWheel* kartWheel(s32 idx);
8998
const KartWheel* kartWheel(s32 idx) const;
99+
KartSusPhysics* kartSusPhysics(s32 idx);
100+
const KartSusPhysics* kartSusPhysics(s32 idx) const;
101+
KartWheelPhysics* kartWheelPhysics(s32 idx);
102+
const KartWheelPhysics* kartWheelPhysics(s32 idx) const;
90103
KartPhysicsEngine* kartPhysicsEngine();
91104
const KartPhysicsEngine* kartPhysicsEngine() const;
92105
KartMove* kartMove();
@@ -135,6 +148,24 @@ class KartObjectProxy {
135148
const KartJump* kartJump();
136149

137150
const EGG::Vector3f& getPos() const;
151+
const EGG::Vector3f& getPrevPos() const;
152+
void setPos(const EGG::Vector3f &pos);
153+
const EGG::Matrix34f& getPose() const;
154+
const EGG::Matrix34f& getBodyRot() const;
155+
void setRot(const EGG::Quatf& rot);
156+
u16 getSuspCount();
157+
u16 getWheelCount();
158+
float getWheelCountRecip();
159+
float getWheelCountPlusOneRecip();
160+
const EGG::Vector3f& getWheelPos(u32 wheelIdx);
161+
bool wheelIdxHasFloorCollision(u32 wheelIdx);
162+
void setBodyAngle(f32 angle);
163+
void setStartBoostIdx(s32 idx);
164+
const EGG::Vector3f& getWheelEdgePos(u32 wheelIdx);
165+
System::KPad* getInput();
166+
bool isLocal();
167+
bool isCpu();
168+
bool isGhost();
138169
void getBodyForward(EGG::Vector3f& out);
139170
s32 getHopStickX();
140171
s32 getAppliedHopStickX();

‎src/kart/KartPart.hpp‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@
22
#pragma once
33

44
#include "KartSettings.hpp"
5+
#include "egg/math/eggMatrix.hpp"
6+
#include "egg/math/eggVector.hpp"
57

68
namespace Kart {
79
class KartPart {
8-
u8 todo[0x90];
10+
911

1012
public:
1113
KartPart(const KartSettings& kartSettings, u32 thing);
14+
const EGG::Matrix34f getPose() const { return pose; };
15+
16+
// TODO : structure is still very wrong
17+
EGG::Vector3f pos;
18+
EGG::Matrix34f pose;
19+
u8 todo[0x90-0x3c];
1220
};
1321
}

‎src/kart/KartState.hpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class KartState {
7171
void setBoostRampType(s32 type) { mBoostRampType = type; }
7272
void setJumpPadType(s32 type) { mJumpPadType = type; }
7373
void setHalfpipeInvisibilityTimer(s32 timer) { mHalfpipeInvisibilityTimer = timer; }
74+
void setStartBoostIdx(s32 idx) { mStartBoostIdx = idx; }
7475

7576
private:
7677
RKBitField<160> mFlags;

‎src/kart/KartSus.hpp‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,17 @@
55
#include <decomp.h>
66

77
#include "KartPart.hpp"
8+
#include "kart/KartObjectProxy.hpp"
89

910
namespace Kart {
10-
class KartSus {
11+
class KartSusPhysics;
1112

13+
class KartSus: KartPart {
14+
public:
15+
inline const KartSusPhysics* getPhysics() const { return susPhysics; }
16+
inline KartSusPhysics* getPhysics() { return susPhysics; }
17+
18+
private:
19+
KartSusPhysics* susPhysics;
1220
};
1321
}

0 commit comments

Comments
 (0)