Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ def MatchingFor(*versions):
Object(NonMatching, "Shiraiwa/MapObjDossun.cpp"),
Object(Matching, "Shiraiwa/JugemMain.cpp"),
Object(Matching, "Shiraiwa/JugemLap.cpp"),
Object(NonMatching, "Shiraiwa/Interp.cpp"),
Object(Matching, "Shiraiwa/Interp.cpp"),
Object(Equivalent, "Shiraiwa/JugemReverse.cpp"),
Object(Matching, "Shiraiwa/JugemRescue.cpp"),
Object(Matching, "Shiraiwa/JugemVoidRod.cpp"),
Expand Down
4 changes: 4 additions & 0 deletions include/Shiraiwa/Interp.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "Shiraiwa/Coord3D.h"
#include "JSystem/JGeometry.h"
#include "JSystem/JGeometry/Vec.h"
#include "dolphin/mtx.h"
#include "macros.h"

class TBSplineInterp { // Autogenerated
Expand Down Expand Up @@ -33,6 +34,9 @@ class TBSplineInterp { // Autogenerated
inline s16 getUnknownValue10() { return _10; }
inline f32 getRatio() { return mRatio; }

f32 getPointX(u8 idx) const { return mpPoint[idx*3+0]; }
f32 getPointY(u8 idx) const { return mpPoint[idx*3+1]; }
f32 getPointZ(u8 idx) const { return mpPoint[idx*3+2]; }
protected:
u8 _4;
u8 _5;
Expand Down
88 changes: 84 additions & 4 deletions src/Shiraiwa/Interp.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Shiraiwa/Interp.h"
#include "JSystem/JGeometry/Vec.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "Shiraiwa/Coord3D.h"

TBSplineInterp::TBSplineInterp() {
_5 = 0;
Expand All @@ -14,6 +15,7 @@ TBSplineInterp::TBSplineInterp() {
TBSplineInterp::~TBSplineInterp() {}

void TBSplineInterp::init(JGeometry::TVec3f *pos) {
#line 41
mpCurPos = pos;
JUT_ASSERT(mpCurPos != 0);
}
Expand Down Expand Up @@ -59,8 +61,7 @@ bool TBSplineInterp::update() {
_10 = 0;
}
else {
const JGeometry::TVec3f &point = ((const JGeometry::TVec3f *)mpPoint)[(u8)(_5 - 1)];
mpCurPos->set(point);
mpCurPos->set(getPointX(_5 - 1), getPointY(_5 - 1), getPointZ(_5 - 1));
_13 = false;
}
}
Expand All @@ -81,7 +82,67 @@ bool TBSplineInterp::checkReachTarget() {
return _10 > _5;
}

void TBSplineInterp::updatePos() {}
void TBSplineInterp::updatePos() {
pointUpdate(mRatio);

u8 indices[4];
for (int i = -1; i < 3; i++)
{
int index = _10 + i;

if (index > _5 - 1) {
if (_12) {
index -= _5;
}
else {
index = _5 - 1;
}
}
else {
if (index < 0) {
if (_12) {
index += _5;
}
else {
index = 0;
}
}
}

indices[i+1] = index;
}

if (_14) { // with offset
mpCurPos->x = mOffset.x + (mPoint.x * getPointX(indices[0]) +
mPoint.y * getPointX(indices[1]) +
mPoint.z * getPointX(indices[2]) +
mPoint.w * getPointX(indices[3]));
mpCurPos->y = mOffset.y + (mPoint.x * getPointY(indices[0]) +
mPoint.y * getPointY(indices[1]) +
mPoint.z * getPointY(indices[2]) +
mPoint.w * getPointY(indices[3]));
mpCurPos->z = mOffset.z + (mPoint.x * getPointZ(indices[0]) +
mPoint.y * getPointZ(indices[1]) +
mPoint.z * getPointZ(indices[2]) +
mPoint.w * getPointZ(indices[3]));
}
else { // without offset
mpCurPos->x = (mPoint.x * getPointX(indices[0]) +
mPoint.y * getPointX(indices[1]) +
mPoint.z * getPointX(indices[2]) +
mPoint.w * getPointX(indices[3]));
mpCurPos->y = (mPoint.x * getPointY(indices[0]) +
mPoint.y * getPointY(indices[1]) +
mPoint.z * getPointY(indices[2]) +
mPoint.w * getPointY(indices[3]));
mpCurPos->z = (mPoint.x * getPointZ(indices[0]) +
mPoint.y * getPointZ(indices[1]) +
mPoint.z * getPointZ(indices[2]) +
mPoint.w * getPointZ(indices[3]));
}


}

void TBSplineInterp::ratioUpdate() {
mRatio += mSpeed;
Expand All @@ -95,7 +156,24 @@ void TBSplineInterp::ratioUpdate() {

}

void TBSplineInterp::setRotation(u8) {}
void TBSplineInterp::setRotation(u8 p1) {
#line 242
JUT_ASSERT(mRotate != 0);

JGeometry::TVec3f v;
if (p1 < 1) {
v.set(0.0f, 0.0f, 0.0f);
}
else {
v.set(getPointX(p1) - getPointX(p1-1), 0.0f, getPointZ(p1) - getPointZ(p1-1));
}


if (v.length() > 10.0f) {
v.normalize();
mRotate->setTargetVec(v, mSpeed, mSpeed, mRatio, 'z');
}
}

void TBSplineInterp::setSpeed(f32 speed) {
mSpeed = speed;
Expand Down Expand Up @@ -130,3 +208,5 @@ void TBSplineInterp::restart() {
mRotate->restart();
}
}

#include "JSystem/JAudio/JASFakeMatch2.h"
Loading