From 370013efbfad737f9eab3f7df271b4014c788c62 Mon Sep 17 00:00:00 2001 From: Headpenguin Date: Sun, 14 Apr 2024 16:40:43 -0400 Subject: [PATCH] Rename variables logically --- csv/Animation.csv | 2 +- csv/Player.csv | 6 ++-- include/Game/Animation/XanimePlayer.hpp | 8 +++-- include/Game/Player/MarioAnimator.hpp | 13 +++---- source/Game/Animation/XanimePlayer.cpp | 15 +++++--- source/Game/Player/MarioAnimator.cpp | 48 ++++++++++++++++++------- 6 files changed, 62 insertions(+), 30 deletions(-) diff --git a/csv/Animation.csv b/csv/Animation.csv index af9c52f1..dfcfe923 100644 --- a/csv/Animation.csv +++ b/csv/Animation.csv @@ -180,7 +180,7 @@ checkPass__12XanimePlayerCFf,XanimePlayer.o,Animation.a,false getSimpleGroup__12XanimePlayerCFv,XanimePlayer.o,Animation.a,false duplicateSimpleGroup__12XanimePlayerFv,XanimePlayer.o,Animation.a,false __ct__15XanimeFrameCtrlFv,XanimePlayer.o,Animation.a,false -changeCurrentAnimation__12XanimePlayerFPC15XanimeGroupInfo,XanimePlayer.o,Animation.a,false +changeCurrentAnimation__12XanimePlayerFPC15XanimeGroupInfo,XanimePlayer.o,Animation.a,true __dt__15XanimeFrameCtrlFv,XanimePlayer.o,Animation.a,false init__19XanimeResourceTableFv,XanimeResource.o,Animation.a,false getGroupInfo__19XanimeResourceTableCFPCc,XanimeResource.o,Animation.a,false diff --git a/csv/Player.csv b/csv/Player.csv index 8ef4a702..b94c0fcc 100644 --- a/csv/Player.csv +++ b/csv/Player.csv @@ -582,11 +582,11 @@ getUpperFrame__13MarioAnimatorCFv,MarioAnimator.o,Player.a,false setWalkMode__13MarioAnimatorFv,MarioAnimator.o,Player.a,false calc__13MarioAnimatorFv,MarioAnimator.o,Player.a,false change__13MarioAnimatorFPCc,MarioAnimator.o,Player.a,false -changeUpper__13MarioAnimatorFPCc,MarioAnimator.o,Player.a,false +changeUpper__13MarioAnimatorFPCc,MarioAnimator.o,Player.a,true stopUpper__13MarioAnimatorFPCc,MarioAnimator.o,Player.a,false -changeDefault__13MarioAnimatorFPCc,MarioAnimator.o,Player.a,false +changeDefault__13MarioAnimatorFPCc,MarioAnimator.o,Player.a,true isDefaultAnimationRun__13MarioAnimatorCFPCc,MarioAnimator.o,Player.a,false -changeDefaultUpper__13MarioAnimatorFPCc,MarioAnimator.o,Player.a,false +changeDefaultUpper__13MarioAnimatorFPCc,MarioAnimator.o,Player.a,true getUpperJointID__13MarioAnimatorCFv,MarioAnimator.o,Player.a,false updateJointRumble__13MarioAnimatorFv,MarioAnimator.o,Player.a,false addRumblePower__13MarioAnimatorFfUl,MarioAnimator.o,Player.a,false diff --git a/include/Game/Animation/XanimePlayer.hpp b/include/Game/Animation/XanimePlayer.hpp index eafb29b8..e8dbc534 100644 --- a/include/Game/Animation/XanimePlayer.hpp +++ b/include/Game/Animation/XanimePlayer.hpp @@ -33,9 +33,10 @@ public: void setDefaultAnimation(const char *); void changeAnimation(const char *); - void changeAnimation(const XanimeGroupInfo *); + void changeCurrentAnimation(const XanimeGroupInfo *); + inline XanimeCore* getCore() { return mCore; } @@ -44,8 +45,9 @@ public: J3DModelData *mModelData; // _4 u8 _8[0x5C-8]; const XanimeGroupInfo *mDefaultAnimation; // _5C - const XanimeGroupInfo *mStopAnimation; // _60 - u8 _64[8]; + const XanimeGroupInfo *mCurrentAnimation; // _60 + const XanimeGroupInfo *mPrevAnimation; // _64 + const XanimeGroupInfo *_68; XanimeCore *mCore; // _6C XanimeResourceTable *mResourceTable; // _70 u8 _74[0x8]; diff --git a/include/Game/Player/MarioAnimator.hpp b/include/Game/Player/MarioAnimator.hpp index ce880fd1..e8b03d0d 100644 --- a/include/Game/Player/MarioAnimator.hpp +++ b/include/Game/Player/MarioAnimator.hpp @@ -22,6 +22,8 @@ public: void waterToGround(); void initCallbackTable(); void change(const char *); + void changeDefault(const char *); + void changeUpper(const char *); void changeDefaultUpper(const char *); void entryCallback(const char *); @@ -29,8 +31,7 @@ public: { getPlayer()->startBas(nullptr, false, 0.0f, 0.0f); - _C->setDefaultAnimation(name); - change(name); + mXanimePlayer->setDefaultAnimation(name); } inline bool isTeresaClear() const { @@ -38,8 +39,8 @@ public: } XanimeResourceTable *mResourceTable; // _8 - XanimePlayer *_C; - XanimePlayer *_10; + XanimePlayer *mXanimePlayer; // _C + XanimePlayer *mXanimePlayerUpper; // _10 u8 _14; u8 _15; u8 _16; @@ -51,7 +52,7 @@ public: f32 _58; f32 _5C; TVec3f _60; - u8 _6C; + bool _6C; f32 _70; u32 _74; u16 _78; @@ -60,7 +61,7 @@ public: TMtx34f _DC; u8 _10C; u8 _10D; - u8 _10E; + bool mUpperDefaultSet; // _10E f32 _110; const char *mCurrBck; // _114 f32 _118; diff --git a/source/Game/Animation/XanimePlayer.cpp b/source/Game/Animation/XanimePlayer.cpp index 47a02edc..fd792fda 100644 --- a/source/Game/Animation/XanimePlayer.cpp +++ b/source/Game/Animation/XanimePlayer.cpp @@ -1,10 +1,17 @@ #include "Game/Animation/XanimePlayer.hpp" void XanimePlayer::setDefaultAnimation(const char *name) { - const XanimeGroupInfo *animation = mResourceTable->getGroupInfo(name); - if(mStopAnimation == mDefaultAnimation) { - changeAnimation(animation); + const XanimeGroupInfo *defaultAnimation = mResourceTable->getGroupInfo(name); + if(mCurrentAnimation == mDefaultAnimation) { + changeAnimation(defaultAnimation); } - mDefaultAnimation = animation; + mDefaultAnimation = defaultAnimation; _7D = true; } + +void XanimePlayer::changeCurrentAnimation(const XanimeGroupInfo *animation) { + if(mCurrentAnimation == animation) return; + mPrevAnimation = mCurrentAnimation; + mCurrentAnimation = animation; + updateAfterMovement(); +} diff --git a/source/Game/Player/MarioAnimator.cpp b/source/Game/Player/MarioAnimator.cpp index 5daa5496..a8765142 100644 --- a/source/Game/Player/MarioAnimator.cpp +++ b/source/Game/Player/MarioAnimator.cpp @@ -35,10 +35,10 @@ void MarioAnimator::init() _5C = 0.0f; _60.zero(); - _6C = 0; + _6C = false; _10C = 0; _10D = 0; - _10E = 0; + mUpperDefaultSet = false; mCurrBck = 0; _118 = 0.0f; _70 = 0.0f; @@ -48,23 +48,24 @@ void MarioAnimator::init() initCallbackTable(); - _C = new XanimePlayer(MR::getJ3DModel(mActor), mResourceTable); + mXanimePlayer = new XanimePlayer(MR::getJ3DModel(mActor), mResourceTable); - f1("基本"); + changeDefault("基本"); + change("基本"); - _C->getCore()->enableJointTransform(MR::getJ3DModelData(mActor)); + mXanimePlayer->getCore()->enableJointTransform(MR::getJ3DModelData(mActor)); - mActor->mModelManager->mXanimePlayer = _C; - _10 = new XanimePlayer(MR::getJ3DModel(mActor), mResourceTable, _C); + mActor->mModelManager->mXanimePlayer = mXanimePlayer; + mXanimePlayerUpper = new XanimePlayer(MR::getJ3DModel(mActor), mResourceTable, mXanimePlayer); changeDefaultUpper("基本"); - _10->changeAnimation("基本"); - _10->mCore->shareJointTransform(_C->mCore); + mXanimePlayerUpper->changeAnimation("基本"); + mXanimePlayerUpper->mCore->shareJointTransform(mXanimePlayer->mCore); PSMTXCopy(MR::tmpMtxRotYRad(3.14159274101f), _DC.toMtxPtr()); } bool MarioAnimator::isAnimationStop() const { - return _C->mStopAnimation == _C->mDefaultAnimation; + return mXanimePlayer->mCurrentAnimation == mXanimePlayer->mDefaultAnimation; } void MarioAnimator::change(const char *name) { @@ -72,12 +73,12 @@ void MarioAnimator::change(const char *name) { if(mActor->_B90) return; if(!isTeresaClear()) { - _C->changeAnimation(name); + mXanimePlayer->changeAnimation(name); } - const char *bck = _C->getCurrentBckName(); + const char *bck = mXanimePlayer->getCurrentBckName(); if(bck) { - const XanimeGroupInfo *info = _C->mStopAnimation; + const XanimeGroupInfo *info = mXanimePlayer->mCurrentAnimation; if(info->_18 == 2) { f32 arg1 = info->_14, arg2 = info->_10; getPlayer()->startBas(bck, false, arg1, arg2); @@ -96,3 +97,24 @@ void MarioAnimator::change(const char *name) { entryCallback(name); } + +void MarioAnimator::changeUpper(const char *name) { + mXanimePlayerUpper->changeAnimation(name); + _6C = true; +} + +void MarioAnimator::changeDefault(const char *name) { + getPlayer()->startBas(nullptr, false, 0.0f, 0.0f); + + mXanimePlayer->setDefaultAnimation(name); +} + +void MarioAnimator::changeDefaultUpper(const char *name) { + if(name) { + mUpperDefaultSet = true; + mXanimePlayerUpper->setDefaultAnimation(name); + } + else { + mUpperDefaultSet = false; + } +}