-
Notifications
You must be signed in to change notification settings - Fork 42
[WIP] Work on KartObjectProxy (and related) #301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,11 @@ | ||
| #include "KartObjectProxy.hpp" | ||
| #include "egg/math/eggMatrix.hpp" | ||
| #include "host_system/SystemManager.hpp" | ||
| #include "kart/KartPart.hpp" | ||
| #include "kart/KartPhysics.hpp" | ||
| #include "kart/KartState.hpp" | ||
| #include "system/KPadController.hpp" | ||
| #include "system/RaceManager.hpp" | ||
| #include <stddef.h> | ||
|
|
||
| #include <kart/KartMove.hpp> | ||
|
|
@@ -30,6 +37,73 @@ KartObjectProxy::KartObjectProxy() : mAccessor(nullptr) { | |
|
|
||
| const EGG::Vector3f& KartObjectProxy::getPos() const { return kartDynamics()->pos; } | ||
|
|
||
| const EGG::Vector3f& KartObjectProxy::getPrevPos() const { return kartPhysics()->pos; } | ||
|
|
||
| void KartObjectProxy::setPos(EGG::Vector3f *pos) { | ||
| float z,y,x; | ||
| KartDynamics* dynamics; | ||
| x = pos->x; | ||
| y = pos->y; | ||
| z = pos->z; | ||
| dynamics = kartDynamics(); | ||
| dynamics->pos.x = x; | ||
| dynamics->pos.y = y; | ||
| dynamics->pos.z = z; | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| const EGG::Matrix34f& KartObjectProxy::getPose() const { return kartPhysics()->pose; } | ||
|
|
||
| const EGG::Matrix34f& KartObjectProxy::getBodyRot() const { return kartBody()->pose; } | ||
|
|
||
| void KartObjectProxy::setRot(EGG::Quatf rot) { | ||
| KartDynamics* dynamics; | ||
| float w, x, y, z; | ||
| x = rot.x; | ||
| y = rot.y; | ||
| z = rot.z; | ||
| w = rot.w; | ||
| dynamics = kartDynamics(); | ||
| dynamics->fullRot.x = x; | ||
| dynamics->fullRot.y = y; | ||
| dynamics->fullRot.z = z; | ||
| dynamics->fullRot.w = w; | ||
| dynamics->mainRot.x = x; | ||
| dynamics->mainRot.y = y; | ||
| dynamics->mainRot.z = z; | ||
| dynamics->mainRot.w = w; | ||
|
||
| } | ||
|
|
||
| u16 KartObjectProxy::getSuspCount() { return kartSettings()->susCount; } | ||
| u16 KartObjectProxy::getWheelCount() { return kartSettings()->wheelCount; } | ||
| float KartObjectProxy::getWheelCountRecip() { return kartSettings()->wheelCountRecip; } | ||
| float KartObjectProxy::getWheelCountPlusOneRecip() { return kartSettings()->wheelCountPlusOneRecip; } | ||
|
|
||
| const EGG::Vector3f& KartObjectProxy::getWheelPos(u32 wheelIdx) { | ||
| return kartWheel(wheelIdx)->getPhysics()->wheelPos; | ||
| } | ||
|
|
||
| bool KartObjectProxy::wheelIdxHasFloorCollision(u32 wheelIdx) { | ||
| return kartWheel(wheelIdx)->getPhysics()->hasFloorCollision(); | ||
| } | ||
|
|
||
| void KartObjectProxy::setBodyAngle(f32 angle) { | ||
| // TODO | ||
| //kartBody()->setAngle(angle); | ||
| } | ||
|
|
||
| void KartObjectProxy::setStartBoostIdx(s32 idx) { | ||
| kartState()->setStartBoostIdx(idx); | ||
| } | ||
|
|
||
| const EGG::Vector3f& KartObjectProxy::getWheelEdgePos(u32 wheelIdx) { | ||
| return kartWheel(wheelIdx)->getPhysics()->wheelEdgePos; | ||
| } | ||
|
|
||
| KartSettings* KartObjectProxy::kartSettings() { return mAccessor->kartSettings; } | ||
|
|
||
| const KartSettings* KartObjectProxy::kartSettings() const { return mAccessor->kartSettings; } | ||
| KartPhysics* KartObjectProxy::kartPhysics() { return mAccessor->mBody->getPhysics(); } | ||
|
|
||
| const KartPhysics* KartObjectProxy::kartPhysics() const { return mAccessor->mBody->getPhysics(); } | ||
|
|
@@ -38,6 +112,22 @@ KartDynamics* KartObjectProxy::kartDynamics() { return mAccessor->mBody->getPhys | |
|
|
||
| const KartDynamics* KartObjectProxy::kartDynamics() const { return mAccessor->mBody->getPhysics()->mpDynamics; } | ||
|
|
||
| System::KPad* KartObjectProxy::getInput() { | ||
| return System::RaceManager::spInstance->players[kartSettings()->playerIdx]->kpadPlayer; | ||
| } | ||
|
|
||
| bool KartObjectProxy::isLocal() { | ||
| return kartState()->on(KART_FLAG_LOCAL); | ||
| } | ||
|
|
||
| bool KartObjectProxy::isCpu() { | ||
| return kartState()->on(KART_FLAG_CPU); | ||
| } | ||
|
|
||
| bool KartObjectProxy::isGhost() { | ||
| return kartState()->on(KART_FLAG_GHOST); | ||
| } | ||
|
|
||
| KartBody* KartObjectProxy::kartBody() { return mAccessor->mBody; } | ||
|
|
||
| const KartBody* KartObjectProxy::kartBody() const { return mAccessor->mBody; } | ||
|
|
@@ -54,6 +144,19 @@ const KartWheel* KartObjectProxy::kartWheel(s32 idx) const { | |
| return mAccessor->mWheels[idx]; | ||
| } | ||
|
|
||
| KartSusPhysics* KartObjectProxy::kartSusPhysics(s32 idx) { return kartSus(idx)->getPhysics(); } | ||
|
|
||
| const KartSusPhysics* KartObjectProxy::kartSusPhysics(s32 idx) const { | ||
| return kartSus(idx)->getPhysics(); | ||
| } | ||
|
|
||
| KartWheelPhysics* KartObjectProxy::kartWheelPhysics(s32 idx) { return mAccessor->mWheels[idx]->getPhysics(); } | ||
|
|
||
| const KartWheelPhysics* KartObjectProxy::kartWheelPhysics(s32 idx) const { | ||
| return mAccessor->mWheels[idx]->getPhysics(); | ||
| } | ||
|
|
||
|
|
||
| KartPhysicsEngine* KartObjectProxy::kartPhysicsEngine() { return mAccessor->mPhysicsEngine; } | ||
|
|
||
| const KartPhysicsEngine* KartObjectProxy::kartPhysicsEngine() const { return mAccessor->mPhysicsEngine; } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,9 +5,16 @@ | |
| #include <decomp.h> | ||
|
|
||
| #include "KartPart.hpp" | ||
| #include "kart/KartObjectProxy.hpp" | ||
|
|
||
| namespace Kart { | ||
| class KartSus { | ||
| class KartSusPhysics; | ||
|
||
| class KartSus: KartPart { | ||
| public: | ||
| inline const KartSusPhysics* getPhysics() const { return susPhysics; } | ||
| inline KartSusPhysics* getPhysics() { return susPhysics; } | ||
|
|
||
| private: | ||
| KartSusPhysics* susPhysics; | ||
| }; | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move definitions to declarations if you can maintain matching