mirror of
https://github.com/projectPiki/pikmin2.git
synced 2024-11-23 05:20:06 +00:00
some JSTObject fixes
This commit is contained in:
parent
75415f0510
commit
6044ebc142
@ -169,10 +169,10 @@
|
||||
### <section id="sysGCU">sysGCU</section>
|
||||
| File | Size (bytes) | File | Size (bytes) |
|
||||
| ---- | ---- | ---- | ---- |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/aramMgr.cpp">aramMgr.cpp</a> | 4254 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/section.cpp">section.cpp</a> | 7985 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectCamera.cpp">JSTObjectCamera.cpp</a> | 8577 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectGameActor.cpp">JSTObjectGameActor.cpp</a> | 9285 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/aramMgr.cpp">aramMgr.cpp</a> | 4254 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectCamera.cpp">JSTObjectCamera.cpp</a> | 7561 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/section.cpp">section.cpp</a> | 7985 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectGameActor.cpp">JSTObjectGameActor.cpp</a> | 9285 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/sysShapeModel.cpp">sysShapeModel.cpp</a> | 15500 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/titleSection.cpp">titleSection.cpp</a> | 19709 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectActor.cpp">JSTObjectActor.cpp</a> | 22510 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectSystem.cpp">JSTObjectSystem.cpp</a> | 22652 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectActor.cpp">JSTObjectActor.cpp</a> | 20961 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectSystem.cpp">JSTObjectSystem.cpp</a> | 22652 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/matMath.cpp">matMath.cpp</a> | 26236 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/moviePlayer.cpp">moviePlayer.cpp</a> | 26335 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/windowMessage.cpp">windowMessage.cpp</a> | 29493 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/system.cpp">system.cpp</a> | 29872 |
|
||||
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/memoryCard.cpp">memoryCard.cpp</a> | 31350 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/bootSection.cpp">bootSection.cpp</a> | 38573 |
|
||||
|
@ -75,9 +75,9 @@ struct ObjectActor : public JStage::TActor, public ObjectBase {
|
||||
J3DAnmTransform* mAnmTransform; // _28
|
||||
J3DMtxCalcAnmBase* mMtxCalcAnm; // _2C
|
||||
JKRArchive* mArchive; // _30
|
||||
Vector3f mTranslation; // _34
|
||||
Vector3f mRotation; // _40
|
||||
Vector3f mScaling; // _4C
|
||||
Vec mTranslation; // _34
|
||||
Vec mRotation; // _40
|
||||
Vec mScaling; // _4C
|
||||
u32 mShape; // _58 (index of the model file within the archive)
|
||||
u32 mAnimation; // _5C (index of the animation file within the archive)
|
||||
f32 mAnimFrame; // _60
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "math.h"
|
||||
#include "Dolphin/vec.h"
|
||||
|
||||
// #include "Dolphin/int.h"
|
||||
namespace Game {
|
||||
namespace P2JST {
|
||||
struct _u32FakeMatch {
|
||||
@ -17,9 +17,8 @@ struct _u32FakeMatch {
|
||||
|
||||
// static u32 gu32NAN = -1;
|
||||
const _u32FakeMatch gu32NAN_(-1);
|
||||
// static f32 gfNAN = *reinterpret_cast<const f32*>(&__float_nan);
|
||||
const f32 gfNAN_ = NAN;
|
||||
const f32 govNAN_[3] = { NAN, gfNAN_, NAN };
|
||||
const f32 gfNAN_ = NAN;
|
||||
const Vec govNAN_ = { NAN, gfNAN_, NAN };
|
||||
} // namespace P2JST
|
||||
} // namespace Game
|
||||
|
||||
|
@ -20,79 +20,23 @@ namespace P2JST {
|
||||
*/
|
||||
ObjectActor::ObjectActor(char const* name, MoviePlayer* movie)
|
||||
: ObjectBase(name, movie)
|
||||
, mModelData(nullptr)
|
||||
, mModel(nullptr)
|
||||
, mAnmTransform(nullptr)
|
||||
, mMtxCalcAnm(nullptr)
|
||||
, mArchive(nullptr)
|
||||
, mTranslation(govNAN_)
|
||||
, mRotation(govNAN_)
|
||||
, mScaling(govNAN_)
|
||||
, mShape(*(u32*)&govNAN_.x) // these should be gu32NAN but it wont cooperate
|
||||
, mAnimation(*(u32*)&govNAN_.x)
|
||||
, mAnimFrame(gfNAN_)
|
||||
, mAnimFrameMax(gfNAN_)
|
||||
, mModelFileId(*(u32*)&govNAN_.x)
|
||||
, mAnimationFileId(*(u32*)&govNAN_.x)
|
||||
{
|
||||
u32 nan = gu32NAN_.a;
|
||||
f32 fnan = gfNAN_;
|
||||
mModelData = nullptr;
|
||||
mModel = nullptr;
|
||||
mAnmTransform = nullptr;
|
||||
mMtxCalcAnm = nullptr;
|
||||
mArchive = nullptr;
|
||||
// mTranslation = Vector3f(0.0f, 0.0f, 0.0f);
|
||||
// mRotation = Vector3f(0.0f, 0.0f, 0.0f);
|
||||
// mScaling = Vector3f(0.0f, 0.0f, 0.0f);
|
||||
mShape = nan;
|
||||
mAnimation = nan;
|
||||
mAnimFrame = fnan;
|
||||
mAnimFrameMax = fnan;
|
||||
mModelFileId = nan;
|
||||
mAnimationFileId = nan;
|
||||
|
||||
mArchive = MoviePlayer::mArchive;
|
||||
/*
|
||||
lis r6, __vt__Q26JStage7TObject@ha
|
||||
lis r8, __vt__Q26JStage6TActor@ha
|
||||
addi r0, r6, __vt__Q26JStage7TObject@l
|
||||
lis r7, __vt__Q34Game5P2JST10ObjectBase@ha
|
||||
stw r0, 0(r3)
|
||||
addi r0, r8, __vt__Q26JStage6TActor@l
|
||||
lis r6, __vt__Q34Game5P2JST11ObjectActor@ha
|
||||
li r11, 0
|
||||
stw r0, 0(r3)
|
||||
addi r9, r6, __vt__Q34Game5P2JST11ObjectActor@l
|
||||
addi r0, r7, __vt__Q34Game5P2JST10ObjectBase@l
|
||||
lis r6, lbl_804EC018@ha
|
||||
stw r0, 4(r3)
|
||||
addi r7, r6, lbl_804EC018@l
|
||||
li r10, -1
|
||||
addi r8, r9, 0x8c
|
||||
stw r5, 8(r3)
|
||||
lwz r6, 0(r7)
|
||||
stw r4, 0xc(r3)
|
||||
lwz r5, 4(r7)
|
||||
stw r11, 0x10(r3)
|
||||
lwz r4, 8(r7)
|
||||
stw r10, 0x14(r3)
|
||||
lwz r0, lbl_805161D8@sda21(r13)
|
||||
stw r11, 0x18(r3)
|
||||
lfs f0, lbl_805161DC@sda21(r13)
|
||||
stw r11, 0x1c(r3)
|
||||
stw r9, 0(r3)
|
||||
stw r8, 4(r3)
|
||||
stw r11, 0x20(r3)
|
||||
stw r11, 0x24(r3)
|
||||
stw r11, 0x28(r3)
|
||||
stw r11, 0x2c(r3)
|
||||
stw r11, 0x30(r3)
|
||||
stw r6, 0x34(r3)
|
||||
stw r5, 0x38(r3)
|
||||
stw r4, 0x3c(r3)
|
||||
stw r6, 0x40(r3)
|
||||
stw r5, 0x44(r3)
|
||||
stw r4, 0x48(r3)
|
||||
stw r6, 0x4c(r3)
|
||||
stw r5, 0x50(r3)
|
||||
stw r4, 0x54(r3)
|
||||
stw r0, 0x58(r3)
|
||||
stw r0, 0x5c(r3)
|
||||
stfs f0, 0x60(r3)
|
||||
stfs f0, 0x64(r3)
|
||||
stw r0, 0x68(r3)
|
||||
stw r0, 0x6c(r3)
|
||||
lwz r0, mArchive__Q24Game11MoviePlayer@sda21(r13)
|
||||
stw r0, 0x30(r3)
|
||||
blr
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,22 +51,18 @@ ObjectActor::~ObjectActor() { }
|
||||
*/
|
||||
void ObjectActor::reset()
|
||||
{
|
||||
Vector3f z;
|
||||
z.x = govNAN_[0];
|
||||
z.y = govNAN_[1];
|
||||
z.z = govNAN_[2];
|
||||
u32 a = gu32NAN_.a;
|
||||
f32 f = gfNAN_;
|
||||
mTranslation = z;
|
||||
mRotation = z;
|
||||
mScaling = z;
|
||||
mShape = a;
|
||||
mAnimation = a;
|
||||
mAnimFrame = f;
|
||||
mAnimFrameMax = f;
|
||||
mModelFileId = a;
|
||||
mAnimationFileId = a;
|
||||
mScaling = 1.0f;
|
||||
mTranslation = govNAN_;
|
||||
mRotation = govNAN_;
|
||||
mScaling = govNAN_;
|
||||
mShape = gu32NAN_.a;
|
||||
mAnimation = gu32NAN_.a;
|
||||
mAnimFrame = gfNAN_;
|
||||
mAnimFrameMax = gfNAN_;
|
||||
mModelFileId = gu32NAN_.a;
|
||||
mAnimationFileId = gu32NAN_.a;
|
||||
mScaling.z = 1.0f;
|
||||
mScaling.y = 1.0f;
|
||||
mScaling.x = 1.0f;
|
||||
mAnimFrame = 0.0f;
|
||||
/*
|
||||
lis r4, lbl_804EC018@ha
|
||||
@ -171,7 +111,7 @@ void ObjectActor::update()
|
||||
|
||||
Matrixf mtx;
|
||||
PSMTXIdentity(mtx.mMatrix.mtxView);
|
||||
mtx.setTranslation(mTranslation);
|
||||
mtx.setTranslation(*(Vector3f*)&mTranslation);
|
||||
|
||||
Matrixf mtx2;
|
||||
f32 angle = mRotation.z * DEG2RAD;
|
||||
|
@ -12,8 +12,8 @@ static f32 sFovBackup;
|
||||
*/
|
||||
ObjectCamera::ObjectCamera(char const* name, MoviePlayer* movie)
|
||||
: ObjectBase(name, movie)
|
||||
, mViewPos(*(const Vec*)govNAN_)
|
||||
, mViewTargetPos(*(const Vec*)govNAN_)
|
||||
, mViewPos(govNAN_)
|
||||
, mViewTargetPos(govNAN_)
|
||||
, mViewRoll(gfNAN_)
|
||||
, mProjectionNear(gfNAN_)
|
||||
, mProjectionFar(gfNAN_)
|
||||
@ -101,65 +101,14 @@ ObjectCamera::~ObjectCamera() { }
|
||||
*/
|
||||
void ObjectCamera::reset()
|
||||
{
|
||||
Vec set;
|
||||
set.x = govNAN_[0];
|
||||
set.y = govNAN_[1];
|
||||
set.z = govNAN_[2];
|
||||
mViewPos = govNAN_;
|
||||
mViewTargetPos = govNAN_;
|
||||
mViewRoll = gfNAN_;
|
||||
mProjectionNear = gfNAN_;
|
||||
mProjectionFar = gfNAN_;
|
||||
|
||||
f32 n = gfNAN_;
|
||||
|
||||
mViewPos = set;
|
||||
mViewTargetPos = set;
|
||||
|
||||
mViewRoll = n;
|
||||
mProjectionNear = n;
|
||||
mProjectionFar = n;
|
||||
mProjectionFovy = 45.0f;
|
||||
mProjectionAspect = sys->getRenderModeObj()->fbWidth / sys->getRenderModeObj()->efbHeight;
|
||||
/*
|
||||
stwu r1, -0x20(r1)
|
||||
mflr r0
|
||||
lis r4, lbl_804EC110@ha
|
||||
lfs f1, lbl_805161E4@sda21(r13)
|
||||
stw r0, 0x24(r1)
|
||||
lfs f0, lbl_80520698@sda21(r2)
|
||||
stw r31, 0x1c(r1)
|
||||
stw r30, 0x18(r1)
|
||||
mr r30, r3
|
||||
addi r3, r4, lbl_804EC110@l
|
||||
lfs f4, 0(r3)
|
||||
lfs f3, 4(r3)
|
||||
stfs f4, 0x90(r30)
|
||||
lfs f2, 8(r3)
|
||||
stfs f3, 0x94(r30)
|
||||
stfs f2, 0x98(r30)
|
||||
stfs f4, 0x9c(r30)
|
||||
stfs f3, 0xa0(r30)
|
||||
stfs f2, 0xa4(r30)
|
||||
stfs f1, 0xa8(r30)
|
||||
stfs f1, 0xac(r30)
|
||||
stfs f1, 0xb0(r30)
|
||||
stfs f0, 0xb4(r30)
|
||||
bl getRenderModeObj__6SystemFv
|
||||
lhz r31, 6(r3)
|
||||
bl getRenderModeObj__6SystemFv
|
||||
lhz r3, 4(r3)
|
||||
lis r0, 0x4330
|
||||
stw r0, 8(r1)
|
||||
divw r0, r3, r31
|
||||
lfd f1, lbl_805206A0@sda21(r2)
|
||||
xoris r0, r0, 0x8000
|
||||
stw r0, 0xc(r1)
|
||||
lfd f0, 8(r1)
|
||||
fsubs f0, f0, f1
|
||||
stfs f0, 0xb8(r30)
|
||||
lwz r31, 0x1c(r1)
|
||||
lwz r30, 0x18(r1)
|
||||
lwz r0, 0x24(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x20
|
||||
blr
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
@ -329,6 +278,19 @@ f32 ObjectCamera::JSGGetProjectionAspect() const { return mProjectionAspect; }
|
||||
*/
|
||||
void ObjectCamera::setParms(Camera*)
|
||||
{
|
||||
// this might not be right since its not using the camera input, but the size is right and it does get setCamera a bit closer
|
||||
|
||||
Vector3f pos = mCameraObj->getPosition();
|
||||
JSGSetViewPosition(*(Vec*)&pos);
|
||||
pos += mCameraObj->getViewVector() * 200.0f;
|
||||
JSGSetViewTargetPosition(*(Vec*)&pos);
|
||||
|
||||
JSGSetViewRoll(0.0f);
|
||||
JSGSetProjectionNear(mCameraObj->getNear());
|
||||
JSGSetProjectionFar(mCameraObj->getFar());
|
||||
JSGSetProjectionFovy(mCameraObj->mViewAngle);
|
||||
JSGSetProjectionAspect(mCameraObj->mAspectRatio);
|
||||
sFovBackup = mCameraObj->mViewAngle;
|
||||
// UNUSED FUNCTION
|
||||
}
|
||||
|
||||
@ -342,18 +304,8 @@ void ObjectCamera::setCamera(Camera* cam)
|
||||
mCameraObj = cam;
|
||||
mCameraObj->mJstObject = this;
|
||||
|
||||
Vector3f pos = mCameraObj->getPosition();
|
||||
JSGSetViewPosition(*(Vec*)&pos);
|
||||
setParms(cam);
|
||||
|
||||
pos += mCameraObj->getViewVector() * 200.0f;
|
||||
|
||||
JSGSetViewTargetPosition(*(Vec*)&pos);
|
||||
JSGSetViewRoll(0.0f);
|
||||
JSGSetProjectionNear(mCameraObj->getNear());
|
||||
JSGSetProjectionFar(mCameraObj->getFar());
|
||||
JSGSetProjectionFovy(mCameraObj->mViewAngle);
|
||||
JSGSetProjectionAspect(mCameraObj->mAspectRatio);
|
||||
sFovBackup = mCameraObj->mViewAngle;
|
||||
mCameraObj2->copyFrom(mCameraObj);
|
||||
mCameraObj->mViewMatrix = &mViewMatrix;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user