mirror of
https://github.com/MonsterDruide1/OdysseyDecomp
synced 2026-04-23 09:04:21 +00:00
Library/Rail: Implement RailRider (#766)
This commit is contained in:
parent
43bccbee0f
commit
d894dc77b8
|
|
@ -275497,79 +275497,79 @@ Library/Rail/RailRider.o:
|
|||
- offset: 0x9c3490
|
||||
size: 60
|
||||
label: _ZN2al9RailRider15moveToRailStartEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c34cc
|
||||
size: 80
|
||||
label: _ZN2al9RailRider4moveEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c351c
|
||||
size: 56
|
||||
label: _ZN2al9RailRider10syncPosDirEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c3554
|
||||
size: 56
|
||||
label: _ZN2al9RailRider8setCoordEf
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c358c
|
||||
size: 64
|
||||
label: _ZN2al9RailRider15moveToRailPointEi
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c35cc
|
||||
size: 64
|
||||
label: _ZN2al9RailRider13moveToRailEndEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c360c
|
||||
size: 88
|
||||
label: _ZN2al9RailRider11moveToBeginEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c3664
|
||||
size: 88
|
||||
label: _ZN2al9RailRider10moveToGoalEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c36bc
|
||||
size: 68
|
||||
label: _ZN2al9RailRider17moveToNearestRailERKN4sead7Vector3IfEE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c3700
|
||||
size: 16
|
||||
label: _ZN2al9RailRider7reverseEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c3710
|
||||
size: 8
|
||||
label: _ZN2al9RailRider17setMoveGoingStartEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c3718
|
||||
size: 12
|
||||
label: _ZN2al9RailRider15setMoveGoingEndEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c3724
|
||||
size: 8
|
||||
label: _ZN2al9RailRider8setSpeedEf
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c372c
|
||||
size: 16
|
||||
label: _ZN2al9RailRider8addSpeedEf
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c373c
|
||||
size: 16
|
||||
label: _ZN2al9RailRider10scaleSpeedEf
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c374c
|
||||
size: 96
|
||||
label: _ZNK2al9RailRider13isReachedGoalEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c37ac
|
||||
size: 68
|
||||
label: _ZNK2al9RailRider16isReachedRailEndEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c37f0
|
||||
size: 36
|
||||
label: _ZNK2al9RailRider18isReachedRailStartEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x9c3814
|
||||
size: 128
|
||||
label: _ZNK2al9RailRider13isReachedEdgeEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
Library/Rail/RailUtil.o:
|
||||
'.text':
|
||||
- offset: 0x9c3894
|
||||
|
|
|
|||
|
|
@ -1,10 +1,107 @@
|
|||
#include "Library/Rail/RailRider.h"
|
||||
|
||||
#include "Library/Math/MathUtil.h"
|
||||
#include "Library/Rail/Rail.h"
|
||||
|
||||
namespace al {
|
||||
RailRider::RailRider(const Rail* rail) : mRail(rail) {
|
||||
mCoord = rail->normalizeLength(0);
|
||||
syncPosDir();
|
||||
}
|
||||
|
||||
void RailRider::moveToRailStart() {
|
||||
mCoord = 0.0f;
|
||||
syncPosDir();
|
||||
}
|
||||
|
||||
void RailRider::move() {
|
||||
mCoord += mIsMoveForwards ? mRate : -mRate;
|
||||
syncPosDir();
|
||||
}
|
||||
|
||||
void RailRider::syncPosDir() {
|
||||
mCoord = mRail->normalizeLength(mCoord);
|
||||
mRail->calcPosDir(&mPosition, &mDirection, mCoord);
|
||||
}
|
||||
|
||||
void RailRider::setCoord(f32 coord) {
|
||||
mCoord = coord;
|
||||
syncPosDir();
|
||||
}
|
||||
|
||||
void RailRider::moveToRailPoint(s32 point) {
|
||||
mCoord = mRail->getPartLength(point);
|
||||
syncPosDir();
|
||||
}
|
||||
|
||||
void RailRider::moveToRailEnd() {
|
||||
mCoord = mRail->getTotalLength();
|
||||
syncPosDir();
|
||||
}
|
||||
|
||||
void RailRider::moveToBegin() {
|
||||
if (mIsMoveForwards)
|
||||
moveToRailStart();
|
||||
else
|
||||
moveToRailEnd();
|
||||
}
|
||||
|
||||
void RailRider::moveToGoal() {
|
||||
if (mIsMoveForwards)
|
||||
moveToRailEnd();
|
||||
else
|
||||
moveToRailStart();
|
||||
}
|
||||
|
||||
void RailRider::moveToNearestRail(const sead::Vector3f& position) {
|
||||
mCoord = mRail->calcNearestRailPosCoord(position, 20.0f);
|
||||
syncPosDir();
|
||||
}
|
||||
|
||||
void RailRider::reverse() {
|
||||
mIsMoveForwards = !mIsMoveForwards;
|
||||
}
|
||||
|
||||
void RailRider::setMoveGoingStart() {
|
||||
mIsMoveForwards = false;
|
||||
}
|
||||
|
||||
void RailRider::setMoveGoingEnd() {
|
||||
mIsMoveForwards = true;
|
||||
}
|
||||
|
||||
void RailRider::setSpeed(f32 speed) {
|
||||
mRate = speed;
|
||||
}
|
||||
|
||||
void RailRider::addSpeed(f32 speed) {
|
||||
mRate += speed;
|
||||
}
|
||||
|
||||
void RailRider::scaleSpeed(f32 scale) {
|
||||
mRate *= scale;
|
||||
}
|
||||
|
||||
bool RailRider::isReachedGoal() const {
|
||||
if (mIsMoveForwards)
|
||||
return isReachedRailEnd();
|
||||
else
|
||||
return isReachedRailStart();
|
||||
}
|
||||
|
||||
bool RailRider::isReachedRailEnd() const {
|
||||
if (mRail->isClosed())
|
||||
return false;
|
||||
return isNearZero(mCoord - mRail->getTotalLength());
|
||||
}
|
||||
|
||||
bool RailRider::isReachedRailStart() const {
|
||||
if (mRail->isClosed())
|
||||
return false;
|
||||
return isNearZero(mCoord);
|
||||
}
|
||||
|
||||
bool RailRider::isReachedEdge() const {
|
||||
return isReachedRailStart() || isReachedRailEnd();
|
||||
}
|
||||
|
||||
} // namespace al
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ public:
|
|||
void setMoveGoingEnd();
|
||||
void setSpeed(f32 speed);
|
||||
void addSpeed(f32 speed);
|
||||
void scaleSpeed(f32 speed);
|
||||
bool isReachedGoal();
|
||||
bool isReachedRailEnd();
|
||||
bool isReachedRailStart();
|
||||
bool isReachedEdge();
|
||||
void scaleSpeed(f32 scale);
|
||||
bool isReachedGoal() const;
|
||||
bool isReachedRailEnd() const;
|
||||
bool isReachedRailStart() const;
|
||||
bool isReachedEdge() const;
|
||||
|
||||
const Rail* getRail() const { return mRail; }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue