mirror of
https://github.com/SMGCommunity/Petari.git
synced 2025-02-21 14:40:36 +00:00
SkeletalFishRailControl.o
100%
This commit is contained in:
parent
4d033a0369
commit
ae75cf2cde
12
csv/Boss.csv
12
csv/Boss.csv
@ -3233,12 +3233,12 @@ appearGuard__23SkeletalFishGuardHolderFll,SkeletalFishGuardHolder.o,Boss.a,false
|
||||
__dt__23SkeletalFishGuardHolderFv,SkeletalFishGuardHolder.o,Boss.a,false
|
||||
createAndInitGuard__23SkeletalFishGuardHolderFv,SkeletalFishGuardHolder.o,Boss.a,false
|
||||
calcJoint__21SkeletalFishJointCalcFPQ29JGeometry64TPosition3<Q29JGeometry38TMatrix34<Q29JGeometry13SMatrix34C<f>>>PCQ29JGeometry64TPosition3<Q29JGeometry38TMatrix34<Q29JGeometry13SMatrix34C<f>>>P23SkeletalFishRailControlRC19JointControllerInfo,SkeletalFishJointCalc.o,Boss.a,false
|
||||
__ct__23SkeletalFishRailControlFv,SkeletalFishRailControl.o,Boss.a,false
|
||||
setRailActor__23SkeletalFishRailControlFP9LiveActorP9LiveActorb,SkeletalFishRailControl.o,Boss.a,false
|
||||
update__23SkeletalFishRailControlFv,SkeletalFishRailControl.o,Boss.a,false
|
||||
getRailInfo__23SkeletalFishRailControlFP20SkeletalFishRailInfof,SkeletalFishRailControl.o,Boss.a,false
|
||||
getPos__23SkeletalFishRailControlFPQ29JGeometry8TVec3<f>f,SkeletalFishRailControl.o,Boss.a,false
|
||||
getMtx__23SkeletalFishRailControlFPQ29JGeometry64TPosition3<Q29JGeometry38TMatrix34<Q29JGeometry13SMatrix34C<f>>>f,SkeletalFishRailControl.o,Boss.a,false
|
||||
__ct__23SkeletalFishRailControlFv,SkeletalFishRailControl.o,Boss.a,true
|
||||
setRailActor__23SkeletalFishRailControlFP9LiveActorP9LiveActorb,SkeletalFishRailControl.o,Boss.a,true
|
||||
update__23SkeletalFishRailControlFv,SkeletalFishRailControl.o,Boss.a,true
|
||||
getRailInfo__23SkeletalFishRailControlFP20SkeletalFishRailInfof,SkeletalFishRailControl.o,Boss.a,true
|
||||
getPos__23SkeletalFishRailControlFPQ29JGeometry8TVec3<f>f,SkeletalFishRailControl.o,Boss.a,true
|
||||
getMtx__23SkeletalFishRailControlFPQ29JGeometry64TPosition3<Q29JGeometry38TMatrix34<Q29JGeometry13SMatrix34C<f>>>f,SkeletalFishRailControl.o,Boss.a,true
|
||||
__ct__10TombSpiderFPCc,TombSpider.o,Boss.a,false
|
||||
init__10TombSpiderFRC12JMapInfoIter,TombSpider.o,Boss.a,false
|
||||
exeWaitPlayer__10TombSpiderFv,TombSpider.o,Boss.a,false
|
||||
|
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"label": "Game",
|
||||
"message": "12.654%",
|
||||
"message": "12.689%",
|
||||
"color": "blue"
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"label": "Boss",
|
||||
"message": "0.711%",
|
||||
"message": "1.092%",
|
||||
"color": "orange"
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
| [Animation](https://github.com/shibbo/Petari/blob/master/docs/lib/Animation.md) | 4.860149543062863% |
|
||||
| [AreaObj](https://github.com/shibbo/Petari/blob/master/docs/lib/AreaObj.md) | 57.68352365415987% |
|
||||
| [AudioLib](https://github.com/shibbo/Petari/blob/master/docs/lib/AudioLib.md) | 0.0% |
|
||||
| [Boss](https://github.com/shibbo/Petari/blob/master/docs/lib/Boss.md) | 0.7115068550148751% |
|
||||
| [Boss](https://github.com/shibbo/Petari/blob/master/docs/lib/Boss.md) | 1.0922254353298522% |
|
||||
| [Camera](https://github.com/shibbo/Petari/blob/master/docs/lib/Camera.md) | 34.12644987572494% |
|
||||
| [Demo](https://github.com/shibbo/Petari/blob/master/docs/lib/Demo.md) | 3.7442572741194486% |
|
||||
| [Effect](https://github.com/shibbo/Petari/blob/master/docs/lib/Effect.md) | 1.855215360664245% |
|
||||
|
@ -140,7 +140,7 @@
|
||||
| [SkeletalFishGuard.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Boss/SkeletalFishGuard.md) | 0.0% | 0 / 62 | 0.0% | :x:
|
||||
| [SkeletalFishGuardHolder.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Boss/SkeletalFishGuardHolder.md) | 0.0% | 0 / 15 | 0.0% | :x:
|
||||
| [SkeletalFishJointCalc.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Boss/SkeletalFishJointCalc.md) | 0.0% | 0 / 1 | 0.0% | :x:
|
||||
| [SkeletalFishRailControl.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Boss/SkeletalFishRailControl.md) | 0.0% | 0 / 6 | 0.0% | :x:
|
||||
| [SkeletalFishRailControl.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Boss/SkeletalFishRailControl.md) | 100.0% | 6 / 6 | 100.0% | :white_check_mark:
|
||||
| [TombSpider.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Boss/TombSpider.md) | 0.0% | 0 / 41 | 0.0% | :x:
|
||||
| [TombSpiderAcid.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Boss/TombSpiderAcid.md) | 0.0% | 0 / 8 | 0.0% | :x:
|
||||
| [TombSpiderAction1st.o](https://github.com/shibbo/Petari/blob/master/docs/lib/Boss/TombSpiderAction1st.md) | 0.0% | 0 / 38 | 0.0% | :x:
|
||||
|
@ -5,13 +5,13 @@
|
||||
| :white_check_mark: | Function is completed.
|
||||
|
||||
|
||||
# 0 / 6 Completed -- (0.0%)
|
||||
# 6 / 6 Completed -- (100.0%)
|
||||
# SkeletalFishRailControl.o
|
||||
| Symbol | Decompiled? |
|
||||
| ------------- | ------------- |
|
||||
| `__ct__23SkeletalFishRailControlFv` | :x: |
|
||||
| `setRailActor__23SkeletalFishRailControlFP9LiveActorP9LiveActorb` | :x: |
|
||||
| `update__23SkeletalFishRailControlFv` | :x: |
|
||||
| `getRailInfo__23SkeletalFishRailControlFP20SkeletalFishRailInfof` | :x: |
|
||||
| `getPos__23SkeletalFishRailControlFPQ29JGeometry8TVec3<f>f` | :x: |
|
||||
| `getMtx__23SkeletalFishRailControlFPQ29JGeometry64TPosition3<Q29JGeometry38TMatrix34<Q29JGeometry13SMatrix34C<f>>>f` | :x: |
|
||||
| `__ct__23SkeletalFishRailControlFv` | :white_check_mark: |
|
||||
| `setRailActor__23SkeletalFishRailControlFP9LiveActorP9LiveActorb` | :white_check_mark: |
|
||||
| `update__23SkeletalFishRailControlFv` | :white_check_mark: |
|
||||
| `getRailInfo__23SkeletalFishRailControlFP20SkeletalFishRailInfof` | :white_check_mark: |
|
||||
| `getPos__23SkeletalFishRailControlFPQ29JGeometry8TVec3<f>f` | :white_check_mark: |
|
||||
| `getMtx__23SkeletalFishRailControlFPQ29JGeometry64TPosition3<Q29JGeometry38TMatrix34<Q29JGeometry13SMatrix34C<f>>>f` | :white_check_mark: |
|
||||
|
27
include/Game/Boss/SkeletalFishRailControl.hpp
Normal file
27
include/Game/Boss/SkeletalFishRailControl.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include "Game/LiveActor/LiveActor.hpp"
|
||||
|
||||
struct SkeletalFishRailInfo {
|
||||
LiveActor* _0;
|
||||
f32 _4;
|
||||
};
|
||||
|
||||
class SkeletalFishRailControl {
|
||||
public:
|
||||
SkeletalFishRailControl();
|
||||
|
||||
void setRailActor(LiveActor *, LiveActor *, bool);
|
||||
void update();
|
||||
void getRailInfo(SkeletalFishRailInfo *, f32);
|
||||
void getPos(TVec3f *, f32);
|
||||
void getMtx(TPos3f *, f32);
|
||||
|
||||
u32 _0;
|
||||
LiveActor* _4;
|
||||
LiveActor* _8;
|
||||
f32 _C;
|
||||
f32 _10;
|
||||
f32 _14;
|
||||
bool _18;
|
||||
};
|
@ -52,7 +52,7 @@ namespace MR {
|
||||
bool getRailArg0WithInit(const LiveActor *, s32 *);
|
||||
bool getRailArg1WithInit(const RailRider *, s32 *);
|
||||
|
||||
f32 calcNearestRailCoord(const LiveActor *, const TVec3f &);
|
||||
f64 calcNearestRailCoord(const LiveActor *, const TVec3f &);
|
||||
|
||||
void moveCoordAndFollowTrans(LiveActor *, f32);
|
||||
|
||||
@ -71,4 +71,6 @@ namespace MR {
|
||||
void setRailDirectionToEnd(const LiveActor *);
|
||||
|
||||
bool isLoopRail(const LiveActor *);
|
||||
|
||||
const TVec3f& getRailPointPosEnd(const LiveActor *);
|
||||
};
|
184
source/Game/Boss/SkeletalFishRailControl.cpp
Normal file
184
source/Game/Boss/SkeletalFishRailControl.cpp
Normal file
@ -0,0 +1,184 @@
|
||||
#include "Game/Boss/SkeletalFishRailControl.hpp"
|
||||
|
||||
SkeletalFishRailControl::SkeletalFishRailControl() {
|
||||
_0 = 2;
|
||||
_4 = nullptr;
|
||||
_8 = nullptr;
|
||||
_10 = 0.0f;
|
||||
_14 = 20.0f;
|
||||
_18 = false;
|
||||
}
|
||||
|
||||
void SkeletalFishRailControl::setRailActor(LiveActor *a1, LiveActor *a2, bool a3) {
|
||||
_4 = a2;
|
||||
_8 = a1;
|
||||
|
||||
if (a2 != nullptr) {
|
||||
_0 = 0;
|
||||
MR::setRailCoord(a2, 0.0f);
|
||||
MR::setRailDirectionToEnd(_4);
|
||||
}
|
||||
else {
|
||||
_0 = 2;
|
||||
}
|
||||
|
||||
if (a3) {
|
||||
MR::setRailCoord(_8, 0.0f);
|
||||
MR::setRailDirectionToEnd(_8);
|
||||
}
|
||||
}
|
||||
|
||||
void SkeletalFishRailControl::update() {
|
||||
if (_4 != nullptr) {
|
||||
MR::setRailCoordSpeed(_4, _14);
|
||||
}
|
||||
|
||||
MR::setRailCoordSpeed(_8, _14);
|
||||
|
||||
switch (_0) {
|
||||
case 0:
|
||||
{
|
||||
f32 railLength = MR::getRailTotalLength(_4);
|
||||
f32 v3 = ((_14 + MR::getRailCoord(_4) - railLength));
|
||||
if (v3 >= 0.0f) {
|
||||
f32 coord = MR::calcNearestRailCoord(_8, MR::getRailPointPosEnd(_4));
|
||||
_10 = coord;
|
||||
_C = (coord - v3);
|
||||
MR::setRailCoord(_8, _C);
|
||||
_0 = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
if (_C - _10 >= MR::getRailTotalLength(_8)) {
|
||||
_0 = 2;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
}
|
||||
|
||||
_18 = false;
|
||||
|
||||
switch (_0) {
|
||||
case 0:
|
||||
MR::moveRailRider(_4);
|
||||
break;
|
||||
case 1:
|
||||
_C += _14;
|
||||
MR::getRailTotalLength(_8);
|
||||
MR::setRailCoord(_8, _C);
|
||||
break;
|
||||
case 2:
|
||||
if (MR::getRailCoord(_8) + MR::getRailCoordSpeed(_8) > MR::getRailTotalLength(_8)) {
|
||||
_18 = true;
|
||||
}
|
||||
|
||||
MR::moveRailRider(_8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SkeletalFishRailControl::getRailInfo(SkeletalFishRailInfo* pOutInfo, f32 a2) {
|
||||
switch (_0) {
|
||||
case 0:
|
||||
{
|
||||
f32 coord = MR::getRailCoord(_4);
|
||||
pOutInfo->_0 = _4;
|
||||
pOutInfo->_4 = coord - a2;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
f32 dist = _C - a2;
|
||||
if (dist < _10) {
|
||||
f32 railLength = MR::getRailTotalLength(_4);
|
||||
f32 diff = _10 - dist;
|
||||
pOutInfo->_0 = _4;
|
||||
dist = railLength - diff;
|
||||
}
|
||||
else {
|
||||
pOutInfo->_0 = _8;
|
||||
}
|
||||
|
||||
pOutInfo->_4 = dist;
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
f32 coord = MR::getRailCoord(_8);
|
||||
pOutInfo->_0 = _8;
|
||||
pOutInfo->_4 = coord - a2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SkeletalFishRailControl::getPos(TVec3f *pOut, f32 a2) {
|
||||
SkeletalFishRailInfo info;
|
||||
getRailInfo(&info, a2);
|
||||
|
||||
if (info._4 < 0.0f && !MR::isLoopRail(info._0)) {
|
||||
MR::calcRailPosAtCoord(pOut, info._0, 0.0f);
|
||||
TVec3f railDir;
|
||||
MR::calcRailDirectionAtCoord(&railDir, info._0, 0.0f);
|
||||
railDir.scale(info._4);
|
||||
pOut->add(railDir);
|
||||
|
||||
}
|
||||
else {
|
||||
MR::calcRailPosAtCoord(pOut, info._0, info._4);
|
||||
}
|
||||
}
|
||||
|
||||
void SkeletalFishRailControl::getMtx(TPos3f *pOut, f32 a2) {
|
||||
SkeletalFishRailInfo normalRailInfo;
|
||||
SkeletalFishRailInfo distRailInfo;
|
||||
getRailInfo(&normalRailInfo, a2);
|
||||
getRailInfo(&distRailInfo, a2 - 1000.0f);
|
||||
|
||||
TVec3f railPos;
|
||||
TVec3f railDir;
|
||||
TVec3f gravityVec;
|
||||
TVec3f stack_3C;
|
||||
TVec3f v15;
|
||||
TVec3f v14;
|
||||
TVec3f negVector;
|
||||
|
||||
if (normalRailInfo._4 < 0.0f && !MR::isLoopRail(normalRailInfo._0)) {
|
||||
MR::calcRailPosAtCoord(&railPos, normalRailInfo._0, 0.0f);
|
||||
MR::calcRailDirectionAtCoord(&railDir, normalRailInfo._0, 0.0f);
|
||||
stack_3C.setInlinePS_2(railDir);
|
||||
stack_3C.scale(normalRailInfo._4);
|
||||
railPos.add(stack_3C);
|
||||
}
|
||||
else {
|
||||
MR::calcRailPosAtCoord(&railPos, normalRailInfo._0, normalRailInfo._4);
|
||||
MR::calcRailDirectionAtCoord(&railDir, normalRailInfo._0, normalRailInfo._4);
|
||||
}
|
||||
|
||||
MR::normalizeOrZero(&railDir);
|
||||
MR::calcGravityVector(normalRailInfo._0, railPos, &gravityVec, nullptr, 0);
|
||||
negVector.negateInline(gravityVec);
|
||||
PSVECCrossProduct(negVector.toCVec(), railDir.toCVec(), v15.toVec());
|
||||
PSVECCrossProduct(railDir.toCVec(), v15.toCVec(), v14.toVec());
|
||||
|
||||
MR::normalizeOrZero(&v15);
|
||||
MR::normalizeOrZero(&v14);
|
||||
MR::normalizeOrZero(&railDir);
|
||||
|
||||
pOut->mMtx[0][0] = v15.x;
|
||||
pOut->mMtx[1][0] = v15.y;
|
||||
pOut->mMtx[2][0] = v15.z;
|
||||
pOut->mMtx[0][1] = v14.x;
|
||||
pOut->mMtx[1][1] = v14.y;
|
||||
pOut->mMtx[2][1] = v14.z;
|
||||
pOut->mMtx[0][2] = railDir.x;
|
||||
pOut->mMtx[1][2] = railDir.y;
|
||||
pOut->mMtx[2][2] = railDir.z;
|
||||
pOut->mMtx[0][3] = railPos.x;
|
||||
pOut->mMtx[1][3] = railPos.y;
|
||||
pOut->mMtx[2][3] = railPos.z;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user