diff --git a/data/file_list.yml b/data/file_list.yml index 849ee8c91c..2684b63ff8 100644 --- a/data/file_list.yml +++ b/data/file_list.yml @@ -157466,331 +157466,331 @@ Util/PlayerPuppetFunction.o: - offset: 0x56e678 size: 88 label: _ZN2rs11startPuppetEPN2al9HitSensorES2_ - status: NotDecompiled + status: Matching - offset: 0x56e6d0 size: 48 label: _ZN2rs20endBindAndPuppetNullEPP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56e700 size: 64 label: _ZN2rs28endBindOnGroundAndPuppetNullEPP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56e740 size: 64 label: _ZN2rs24endBindJumpAndPuppetNullEPP16IUsePlayerPuppetRKN4sead7Vector3IfEEi - status: NotDecompiled + status: Matching - offset: 0x56e780 size: 60 label: _ZN2rs28endBindWallJumpAndPuppetNullEPP16IUsePlayerPuppetRKN4sead7Vector3IfEEi - status: NotDecompiled + status: Matching - offset: 0x56e7bc size: 56 label: _ZN2rs15endBindCapThrowEPP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56e7f4 size: 56 label: _ZN2rs36tryReceiveBindCancelMsgAndPuppetNullEPP16IUsePlayerPuppetPKN2al9SensorMsgE - status: NotDecompiled + status: Matching - offset: 0x56e82c size: 12 label: _ZN2rs14setPuppetTransEP16IUsePlayerPuppetRKN4sead7Vector3IfEE - status: NotDecompiled + status: Matching - offset: 0x56e838 size: 12 label: _ZN2rs17setPuppetVelocityEP16IUsePlayerPuppetRKN4sead7Vector3IfEE - status: NotDecompiled + status: Matching - offset: 0x56e844 size: 116 label: _ZN2rs14setPuppetFrontEP16IUsePlayerPuppetRKN4sead7Vector3IfEE - status: NotDecompiled + status: Matching - offset: 0x56e8b8 size: 24 label: _ZN2rs12calcPuppetUpEPN4sead7Vector3IfEEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56e8d0 size: 116 label: _ZN2rs11setPuppetUpEP16IUsePlayerPuppetRKN4sead7Vector3IfEE - status: NotDecompiled + status: Matching - offset: 0x56e944 size: 24 label: _ZN2rs15calcPuppetFrontEPN4sead7Vector3IfEEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56e95c size: 12 label: _ZN2rs13setPuppetQuatEP16IUsePlayerPuppetRKN4sead4QuatIfEE - status: NotDecompiled + status: Matching - offset: 0x56e968 size: 12 label: _ZN2rs19resetPuppetPositionEP16IUsePlayerPuppetRKN4sead7Vector3IfEE - status: NotDecompiled + status: Matching - offset: 0x56e974 size: 188 label: _ZN2rs21addPuppetVelocityFallEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ea30 size: 28 label: _ZN2rs16getPuppetGravityEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ea4c size: 28 label: _ZN2rs17getPuppetVelocityEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ea68 size: 28 label: _ZN2rs14getPuppetTransEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ea84 size: 112 label: _ZN2rs14calcPuppetQuatEPN4sead4QuatIfEEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56eaf4 size: 56 label: _ZN2rs17startPuppetActionEP16IUsePlayerPuppetPKc - status: NotDecompiled + status: Matching - offset: 0x56eb2c size: 12 label: _ZN2rs17isPuppetActionEndEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56eb38 size: 12 label: _ZN2rs21isPuppetActionPlayingEPK16IUsePlayerPuppetPKc - status: NotDecompiled + status: Matching - offset: 0x56eb44 size: 12 label: _ZN2rs17setPuppetAnimRateEP16IUsePlayerPuppetf - status: NotDecompiled + status: Matching - offset: 0x56eb50 size: 8 label: _ZN2rs24setPuppetAnimBlendWeightEP16IUsePlayerPuppetffffff - status: NotDecompiled + status: Matching - offset: 0x56eb58 size: 12 label: _ZN2rs21getPuppetAnimFrameMaxEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56eb64 size: 12 label: _ZN2rs26startPuppetHitReactionLandEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56eb70 size: 12 label: _ZN2rs10hidePuppetEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56eb7c size: 12 label: _ZN2rs10showPuppetEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56eb88 size: 12 label: _ZN2rs14isPuppetHiddenEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56eb94 size: 100 label: _ZN2rs20syncPuppetVisibilityEPN2al9LiveActorEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ebf8 size: 12 label: _ZN2rs20hidePuppetSilhouetteEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ec04 size: 12 label: _ZN2rs20showPuppetSilhouetteEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ec10 size: 12 label: _ZN2rs16hidePuppetShadowEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ec1c size: 12 label: _ZN2rs16showPuppetShadowEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ec28 size: 12 label: _ZN2rs20validatePuppetSensorEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ec34 size: 12 label: _ZN2rs22invalidatePuppetSensorEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ec40 size: 12 label: _ZN2rs24invalidatePuppetColliderEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ec4c size: 12 label: _ZN2rs22isCollidedPuppetGroundEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ec58 size: 28 label: _ZN2rs29getCollidedPuppetGroundNormalEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ec74 size: 12 label: _ZN2rs22validatePuppetColliderEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ec80 size: 12 label: _ZN2rs13requestDamageEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ec8c size: 16 label: _ZN2rs16clearStainEffectEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ec9c size: 56 label: _ZN2rs21copyPuppetDitherAlphaEP16IUsePlayerPuppetPKN2al9LiveActorE - status: NotDecompiled + status: Matching - offset: 0x56ecd4 size: 12 label: _ZN2rs20validatePuppetLookAtEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ece0 size: 8 label: _ZN2rs22invalidatePuppetLookAtEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ece8 size: 36 label: _ZN2rs25validatePuppetForceLookAtEP16IUsePlayerPuppetRKN4sead7Vector3IfEE - status: NotDecompiled + status: Matching - offset: 0x56ed0c size: 8 label: _ZN2rs27invalidatePuppetForceLookAtEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ed14 size: 12 label: _ZN2rs26validatePuppetSeparateModeEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ed20 size: 8 label: _ZN2rs28invalidatePuppetSeparateModeEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ed28 size: 8 label: _ZN2rs25validatePuppetReceivePushEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ed30 size: 12 label: _ZN2rs27invalidatePuppetReceivePushEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ed3c size: 40 label: _ZN2rs19forcePutOnPuppetCapEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ed64 size: 96 label: _ZN2rs29forcePutOnPuppetCapWithEffectEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56edc4 size: 8 label: _ZN2rs23setForceRunAfterEndBindEP16IUsePlayerPuppetif - status: NotDecompiled + status: Matching - offset: 0x56edcc size: 12 label: _ZN2rs20validateRecoveryAreaEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56edd8 size: 8 label: _ZN2rs22invalidateRecoveryAreaEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ede0 size: 12 label: _ZN2rs18validateGuideArrowEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56edec size: 8 label: _ZN2rs20invalidateGuideArrowEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56edf4 size: 12 label: _ZN2rs26validateWaterSurfaceShadowEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ee00 size: 8 label: _ZN2rs28invalidateWaterSurfaceShadowEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ee08 size: 16 label: _ZN2rs21isPuppetInputCapThrowEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ee18 size: 72 label: _ZN2rs18isPuppetInputSwingEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ee60 size: 52 label: _ZN2rs20initBindKeepDemoInfoEv - status: NotDecompiled + status: Matching - offset: 0x56ee94 size: 8 label: _ZN2rs20isActiveBindKeepDemoEPK16BindKeepDemoInfo - status: NotDecompiled + status: Matching - offset: 0x56ee9c size: 188 label: _ZN2rs20tryStartBindKeepDemoEP16BindKeepDemoInfoPKN2al9SensorMsgEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56ef58 size: 124 label: _ZN2rs18tryEndBindKeepDemoEP16BindKeepDemoInfoPKN2al9SensorMsgEP16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56efd4 size: 8 label: _ZN2rs22isPuppetTrigJumpButtonEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56efdc size: 8 label: _ZN2rs22isPuppetHoldJumpButtonEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56efe4 size: 8 label: _ZN2rs24isPuppetTrigActionButtonEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56efec size: 8 label: _ZN2rs24isPuppetHoldActionButtonEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56eff4 size: 60 label: _ZN2rs24isPuppetTriggerAnyButtonEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56f030 size: 60 label: _ZN2rs21isPuppetHoldAnyButtonEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56f06c size: 8 label: _ZN2rs19isPuppetMoveStickOnEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56f074 size: 8 label: _ZN2rs22isPuppetStartWorldWarpEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56f07c size: 8 label: _ZN2rs23isPuppetCancelWorldWarpEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56f084 size: 8 label: _ZN2rs18getPuppetMoveStickEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56f08c size: 8 label: _ZN2rs15isTriggerGetOffEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56f094 size: 8 label: _ZN2rs27getPuppetPoseRotZDegreeLeftEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56f09c size: 8 label: _ZN2rs28getPuppetPoseRotZDegreeRightEPK16IUsePlayerPuppet - status: NotDecompiled + status: Matching - offset: 0x56f0a4 size: 224 label: _ZN2rs24requestUpdateSafetyPointEP16IUsePlayerPuppetPKN2al9LiveActorEPK19IUsePlayerCollision - status: NotDecompiled + status: Matching - offset: 0x56f184 size: 32 label: _ZN2rs23requestForceSafetyPointEP16IUsePlayerPuppetRKN4sead7Vector3IfEES6_ - status: NotDecompiled + status: Matching Util/PlayerPuppetFunction2D3D.o: '.text': - offset: 0x56f1a4 diff --git a/src/Player/PlayerEffect.h b/src/Player/PlayerEffect.h index a69c76a2dc..74848deb20 100644 --- a/src/Player/PlayerEffect.h +++ b/src/Player/PlayerEffect.h @@ -42,8 +42,12 @@ class PlayerEffect { void tryDeleteSandSinkEffect(); void tryDeleteDamageFireRunEffect(); + void requestClearStainEffect() { mIsRequestClearStain = true; } + private: - char filler[0xc0]; + u8 _0[0xba]; + bool mIsRequestClearStain; + u8 _bb[0xc0 - 0xbb]; }; static_assert(sizeof(PlayerEffect) == 0xc0); diff --git a/src/Player/PlayerInput.h b/src/Player/PlayerInput.h index 8015c953ad..56dd6ab11d 100644 --- a/src/Player/PlayerInput.h +++ b/src/Player/PlayerInput.h @@ -30,7 +30,7 @@ class PlayerInput { s32 getSeparatePlay2P(); bool isMove() const; bool isMoveDeepDown() const; - const sead::Vector2f& getStickMoveRaw() const; + sead::Vector2f getStickMoveRaw() const; bool isMoveDeepDownNoSnap() const; bool isEnableCarry() const; bool isTriggerCarryStart() const; diff --git a/src/Player/PlayerPuppet.h b/src/Player/PlayerPuppet.h index 2debf32811..24c9716ec2 100644 --- a/src/Player/PlayerPuppet.h +++ b/src/Player/PlayerPuppet.h @@ -15,6 +15,7 @@ class LiveActor; class ActorDimensionKeeper; class HackCap; +class IJudge; class IPlayerModelChanger; class IUsePlayerCollision; class PlayerAnimator; @@ -91,6 +92,59 @@ class PlayerPuppet : public IUsePlayerPuppet { bool isBindEndCapThrow() const { return mIsBindEndCapThrow; } + void setBindEndCapThrow() { mIsBindEndCapThrow = true; } + + void validateLookAt() { mIsValidLookAt = true; } + + void invalidateLookAt() { mIsValidLookAt = false; } + + void validateForceLookAt(const sead::Vector3f& lookAt) { + mIsValidForceLookAt = true; + mForceLookAtDir = lookAt; + } + + void invalidateForceLookAt() { mIsValidForceLookAt = false; } + + void validateSeparateMode() { mIsValidSeparateMode = true; } + + void invalidateSeparateMode() { mIsValidSeparateMode = false; } + + void validateReceivePush() { mIsInvalidReceivePush = false; } + + void invalidateReceivePush() { mIsInvalidReceivePush = true; } + + void validateRecoveryArea() { mIsValidRecoveryArea = true; } + + void invalidateRecoveryArea() { mIsValidRecoveryArea = false; } + + void validateGuideArrow() { mIsValidGuideArrow = true; } + + void invalidateGuideArrow() { mIsValidGuideArrow = false; } + + void validateWaterSurfaceShadow() { mIsValidWaterSurfaceShadow = true; } + + void invalidateWaterSurfaceShadow() { mIsValidWaterSurfaceShadow = false; } + + void setCopyDitherAlpha() { mIsCopyDitherAlpha = true; } + + const PlayerInput* getPlayerInput() const { return mPlayerInput; } + + IJudge* getJudgePreInputJump() const { return mJudgePreInputJump; } + + HackCap* getHackCap() const { return mHackCap; } + + al::LiveActor* getActor() const { return mActor; } + + PlayerEffect* getPlayerEffect() const { return mPlayerEffect; } + + const PlayerConst* getPlayerConst() const { return mPlayerConst; } + + al::HitSensor* getHitSensor() const { return _78; } + + PlayerAnimator* getPlayerAnimator() const { return mPlayerAnimator; } + + PlayerCounterForceRun* getPlayerCounterForceRun() const { return mPlayerCounterForceRun; } + const PlayerBindEndJumpInfo* getBindEndJumpInfo() const { return mBindEndJumpInfo; } bool isNoCollide() const; @@ -106,7 +160,7 @@ class PlayerPuppet : public IUsePlayerPuppet { PlayerCounterForceRun* mPlayerCounterForceRun; PlayerDamageKeeper* mPlayerDamageKeeper; PlayerEffect* mPlayerEffect; - void* _58; + IJudge* mJudgePreInputJump; PlayerInput* mPlayerInput; PlayerConst* mPlayerConst; al::HitSensor* _70; @@ -121,19 +175,20 @@ class PlayerPuppet : public IUsePlayerPuppet { bool mIsBindEndJump; bool mIsBindEndCapThrow; bool mIsValidCollisionCheck; - bool _ac; + bool mIsInvalidReceivePush; bool mIsRequestDamage; bool _ae; bool mIsSensorValid; - bool _b0; - bool _b1; - bool _b2; - bool _b3; - bool _b4; - bool _b5; - bool _b6; - - char filler[0x10]; + bool mIsValidLookAt; + bool mIsValidForceLookAt; + bool mIsValidRecoveryArea; + bool mIsValidSeparateMode; + bool mIsValidGuideArrow; + bool mIsValidWaterSurfaceShadow; + bool mIsCopyDitherAlpha; + u8 _b7; + sead::Vector3f mForceLookAtDir; + u8 _c4[0xc8 - 0xc4]; PlayerBindEndJumpInfo* mBindEndJumpInfo; }; diff --git a/src/Util/PlayerPuppetFunction.cpp b/src/Util/PlayerPuppetFunction.cpp new file mode 100644 index 0000000000..547fb898ca --- /dev/null +++ b/src/Util/PlayerPuppetFunction.cpp @@ -0,0 +1,487 @@ +#include "Util/PlayerPuppetFunction.h" + +#include + +#include "Library/LiveActor/ActorActionFunction.h" +#include "Library/LiveActor/ActorModelFunction.h" +#include "Library/LiveActor/ActorPoseUtil.h" +#include "Library/LiveActor/ActorSensorUtil.h" +#include "Library/Math/MathUtil.h" + +#include "Player/HackCap.h" +#include "Player/IUsePlayerPuppet.h" +#include "Player/PlayerActorBase.h" +#include "Player/PlayerAnimator.h" +#include "Player/PlayerCapFunction.h" +#include "Player/PlayerConst.h" +#include "Player/PlayerCounterForceRun.h" +#include "Player/PlayerEffect.h" +#include "Player/PlayerInput.h" +#include "Player/PlayerPuppet.h" +#include "Util/JudgeUtil.h" +#include "Util/PlayerCollisionUtil.h" +#include "Util/SensorMsgFunction.h" + +class BindKeepDemoInfo { +public: + BindKeepDemoInfo() : mIsActive(false), mTrans(0.0f, 0.0f, 0.0f), mQuat(sead::Quatf::unit) {} + + bool mIsActive; + sead::Vector3f mTrans; + sead::Quatf mQuat; +}; + +static_assert(sizeof(BindKeepDemoInfo) == 0x20); + +namespace rs { + +void setPuppetTrans(IUsePlayerPuppet* playerPuppet, const sead::Vector3f& trans) { + playerPuppet->setTrans(trans); +} + +void setPuppetVelocity(IUsePlayerPuppet* playerPuppet, const sead::Vector3f& velocity) { + playerPuppet->setVelocity(velocity); +} + +void setPuppetQuat(IUsePlayerPuppet* playerPuppet, const sead::Quatf& quat) { + playerPuppet->setPose(quat); +} + +void resetPuppetPosition(IUsePlayerPuppet* playerPuppet, const sead::Vector3f& trans) { + playerPuppet->resetPosition(trans); +} + +bool isPuppetActionEnd(const IUsePlayerPuppet* playerPuppet) { + return playerPuppet->isActionEnd(); +} + +bool isPuppetActionPlaying(const IUsePlayerPuppet* playerPuppet, const char* action) { + return playerPuppet->isActionPlaying(action); +} + +void setPuppetAnimRate(IUsePlayerPuppet* playerPuppet, f32 animRate) { + playerPuppet->setAnimRate(animRate); +} + +f32 getPuppetAnimFrameMax(const IUsePlayerPuppet* playerPuppet) { + return playerPuppet->getAnimFrameMax(); +} + +void hidePuppet(IUsePlayerPuppet* playerPuppet) { + playerPuppet->hide(); +} + +void showPuppet(IUsePlayerPuppet* playerPuppet) { + playerPuppet->show(); +} + +bool isPuppetHidden(const IUsePlayerPuppet* playerPuppet) { + return playerPuppet->isHidden(); +} + +void hidePuppetSilhouette(IUsePlayerPuppet* playerPuppet) { + playerPuppet->hideSilhouette(); +} + +void showPuppetSilhouette(IUsePlayerPuppet* playerPuppet) { + playerPuppet->showSilhouette(); +} + +void hidePuppetShadow(IUsePlayerPuppet* playerPuppet) { + playerPuppet->hideShadow(); +} + +void showPuppetShadow(IUsePlayerPuppet* playerPuppet) { + playerPuppet->showShadow(); +} + +void requestDamage(IUsePlayerPuppet* playerPuppet) { + playerPuppet->requestDamage(); +} + +void validatePuppetCollider(IUsePlayerPuppet* playerPuppet) { + playerPuppet->validateCollisionCheck(); +} + +void invalidatePuppetCollider(IUsePlayerPuppet* playerPuppet) { + playerPuppet->invalidateCollisionCheck(); +} + +bool isCollidedPuppetGround(IUsePlayerPuppet* playerPuppet) { + return playerPuppet->isCollidedGround(); +} + +void validatePuppetSensor(IUsePlayerPuppet* playerPuppet) { + playerPuppet->validateSensor(); +} + +void invalidatePuppetSensor(IUsePlayerPuppet* playerPuppet) { + playerPuppet->invalidateSensor(); +} + +void calcPuppetUp(sead::Vector3f* up, const IUsePlayerPuppet* playerPuppet) { + playerPuppet->calcUp(up); +} + +bool tryReceiveBindCancelMsgAndPuppetNull(IUsePlayerPuppet** playerPuppet, + const al::SensorMsg* msg) { + if (al::isMsgBindCancel(msg)) { + *playerPuppet = nullptr; + return true; + } + return false; +} + +BindKeepDemoInfo* initBindKeepDemoInfo() { + return new BindKeepDemoInfo(); +} + +bool isActiveBindKeepDemo(const BindKeepDemoInfo* bindKeepDemoInfo) { + return bindKeepDemoInfo->mIsActive; +} + +bool tryStartBindKeepDemo(BindKeepDemoInfo* bindKeepDemoInfo, const al::SensorMsg* msg, + const IUsePlayerPuppet* playerPuppet) { + if (isMsgBindKeepDemoStart(msg)) { + bindKeepDemoInfo->mIsActive = true; + bindKeepDemoInfo->mTrans.set(playerPuppet->getTrans()); + sead::Quatf* quat = &bindKeepDemoInfo->mQuat; + sead::Vector3f front(0.0f, 0.0f, 0.0f); + sead::Vector3f up(0.0f, 0.0f, 0.0f); + playerPuppet->calcFront(&front); + playerPuppet->calcUp(&up); + al::makeQuatUpFront(quat, up, front); + return true; + } + return false; +} + +bool tryEndBindKeepDemo(BindKeepDemoInfo* bindKeepDemoInfo, const al::SensorMsg* msg, + IUsePlayerPuppet* playerPuppet) { + if (isMsgBindKeepDemoEnd(msg)) { + playerPuppet->setPose(bindKeepDemoInfo->mQuat); + playerPuppet->resetPosition(bindKeepDemoInfo->mTrans); + bindKeepDemoInfo->mIsActive = false; + bindKeepDemoInfo->mTrans.set(0.0f, 0.0f, 0.0f); + bindKeepDemoInfo->mQuat.set(1.0f, 0.0f, 0.0f, 0.0f); + return true; + } + return false; +} + +void syncPuppetVisibility(al::LiveActor* actor, const IUsePlayerPuppet* playerPuppet) { + bool isHidden = playerPuppet->isHidden(); + bool isHideModel = al::isHideModel(actor); + if (isHidden) { + if (!isHideModel) + al::hideModel(actor); + } else { + if (isHideModel) + al::showModel(actor); + } +} + +void calcPuppetFront(sead::Vector3f* front, const IUsePlayerPuppet* playerPuppet) { + playerPuppet->calcFront(front); +} + +const sead::Vector3f& getPuppetGravity(const IUsePlayerPuppet* playerPuppet) { + return playerPuppet->getGravity(); +} + +const sead::Vector3f& getPuppetVelocity(const IUsePlayerPuppet* playerPuppet) { + return playerPuppet->getVelocity(); +} + +const sead::Vector3f& getPuppetTrans(const IUsePlayerPuppet* playerPuppet) { + return playerPuppet->getTrans(); +} + +void startPuppetAction(IUsePlayerPuppet* playerPuppet, const char* action) { + playerPuppet->startAction(action); +} + +const sead::Vector3f& getCollidedPuppetGroundNormal(IUsePlayerPuppet* playerPuppet) { + return playerPuppet->getCollidedGroundNormal(); +} + +void validatePuppetLookAt(IUsePlayerPuppet* playerPuppet) { + static_cast(playerPuppet)->validateLookAt(); +} + +void invalidatePuppetLookAt(IUsePlayerPuppet* playerPuppet) { + static_cast(playerPuppet)->invalidateLookAt(); +} + +void validatePuppetForceLookAt(IUsePlayerPuppet* playerPuppet, const sead::Vector3f& lookAt) { + static_cast(playerPuppet)->validateForceLookAt(lookAt); +} + +void invalidatePuppetForceLookAt(IUsePlayerPuppet* playerPuppet) { + static_cast(playerPuppet)->invalidateForceLookAt(); +} + +void validatePuppetSeparateMode(IUsePlayerPuppet* playerPuppet) { + static_cast(playerPuppet)->validateSeparateMode(); +} + +void invalidatePuppetSeparateMode(IUsePlayerPuppet* playerPuppet) { + static_cast(playerPuppet)->invalidateSeparateMode(); +} + +void validatePuppetReceivePush(IUsePlayerPuppet* playerPuppet) { + static_cast(playerPuppet)->validateReceivePush(); +} + +void invalidatePuppetReceivePush(IUsePlayerPuppet* playerPuppet) { + static_cast(playerPuppet)->invalidateReceivePush(); +} + +void validateRecoveryArea(IUsePlayerPuppet* playerPuppet) { + static_cast(playerPuppet)->validateRecoveryArea(); +} + +void invalidateRecoveryArea(IUsePlayerPuppet* playerPuppet) { + static_cast(playerPuppet)->invalidateRecoveryArea(); +} + +void validateGuideArrow(IUsePlayerPuppet* playerPuppet) { + static_cast(playerPuppet)->validateGuideArrow(); +} + +void invalidateGuideArrow(IUsePlayerPuppet* playerPuppet) { + static_cast(playerPuppet)->invalidateGuideArrow(); +} + +void validateWaterSurfaceShadow(IUsePlayerPuppet* playerPuppet) { + static_cast(playerPuppet)->validateWaterSurfaceShadow(); +} + +void invalidateWaterSurfaceShadow(IUsePlayerPuppet* playerPuppet) { + static_cast(playerPuppet)->invalidateWaterSurfaceShadow(); +} + +void endBindAndPuppetNull(IUsePlayerPuppet** playerPuppet) { + (*playerPuppet)->end(); + *playerPuppet = nullptr; +} + +void endBindOnGroundAndPuppetNull(IUsePlayerPuppet** playerPuppet) { + (*playerPuppet)->setBindEndOnGround(); + (*playerPuppet)->end(); + *playerPuppet = nullptr; +} + +void endBindJumpAndPuppetNull(IUsePlayerPuppet** playerPuppet, const sead::Vector3f& endTrans, + s32 timeBeforeEnd) { + (*playerPuppet)->setBindEndJump(endTrans, timeBeforeEnd); + (*playerPuppet)->end(); + *playerPuppet = nullptr; +} + +void endBindWallJumpAndPuppetNull(IUsePlayerPuppet** playerPuppet, const sead::Vector3f& endTrans, + s32 timeBeforeEnd) { + PlayerPuppet* puppet = static_cast(*playerPuppet); + puppet->setBindEndWallJump(endTrans, timeBeforeEnd); + puppet->end(); + *playerPuppet = nullptr; +} + +void endBindCapThrow(IUsePlayerPuppet** playerPuppet) { + PlayerPuppet* puppet = static_cast(*playerPuppet); + puppet->setBindEndCapThrow(); + puppet->end(); + *playerPuppet = nullptr; +} + +void startPuppetHitReactionLand(IUsePlayerPuppet* playerPuppet) { + static_cast(playerPuppet)->startPlayerHitReaction("着地"); +} + +void setPuppetAnimBlendWeight(IUsePlayerPuppet* playerPuppet, f32 weight1, f32 weight2, f32 weight3, + f32 weight4, f32 weight5, f32 weight6) { + static_cast(playerPuppet) + ->getPlayerAnimator() + ->setBlendWeight(weight1, weight2, weight3, weight4, weight5, weight6); +} + +void setForceRunAfterEndBind(IUsePlayerPuppet* playerPuppet, s32 frames, f32 speed) { + static_cast(playerPuppet) + ->getPlayerCounterForceRun() + ->setupForceRun(frames, speed); +} + +bool isPuppetInputCapThrow(const IUsePlayerPuppet* playerPuppet) { + const PlayerInput* input = static_cast(playerPuppet)->getPlayerInput(); + if (input == nullptr) + return false; + return input->isTriggerSpinCap(); +} + +bool isPuppetHoldJumpButton(const IUsePlayerPuppet* playerPuppet) { + return static_cast(playerPuppet)->getPlayerInput()->isHoldJump(); +} + +bool isPuppetTrigActionButton(const IUsePlayerPuppet* playerPuppet) { + return static_cast(playerPuppet)->getPlayerInput()->isTriggerAction(); +} + +bool isPuppetHoldActionButton(const IUsePlayerPuppet* playerPuppet) { + return static_cast(playerPuppet)->getPlayerInput()->isHoldAction(); +} + +bool isPuppetMoveStickOn(const IUsePlayerPuppet* playerPuppet) { + return static_cast(playerPuppet)->getPlayerInput()->isMove(); +} + +bool isPuppetStartWorldWarp(const IUsePlayerPuppet* playerPuppet) { + return static_cast(playerPuppet) + ->getPlayerInput() + ->isTriggerStartWorldWarp(); +} + +bool isPuppetCancelWorldWarp(const IUsePlayerPuppet* playerPuppet) { + return static_cast(playerPuppet) + ->getPlayerInput() + ->isTriggerCancelWorldWarp(); +} + +sead::Vector2f getPuppetMoveStick(const IUsePlayerPuppet* playerPuppet) { + return static_cast(playerPuppet)->getPlayerInput()->getStickMoveRaw(); +} + +bool isTriggerGetOff(const IUsePlayerPuppet* playerPuppet) { + return static_cast(playerPuppet)->getPlayerInput()->isTriggerGetOff(); +} + +f32 getPuppetPoseRotZDegreeLeft(const IUsePlayerPuppet* playerPuppet) { + return static_cast(playerPuppet) + ->getPlayerInput() + ->getPoseRotZDegreeLeft(); +} + +f32 getPuppetPoseRotZDegreeRight(const IUsePlayerPuppet* playerPuppet) { + return static_cast(playerPuppet) + ->getPlayerInput() + ->getPoseRotZDegreeRight(); +} + +bool isPuppetTrigJumpButton(const IUsePlayerPuppet* playerPuppet) { + return judgeAndResetReturnTrue( + static_cast(playerPuppet)->getJudgePreInputJump()); +} + +bool isPuppetTriggerAnyButton(const IUsePlayerPuppet* playerPuppet) { + const PlayerPuppet* puppet = static_cast(playerPuppet); + return puppet->getPlayerInput()->isTriggerAction() || + judgeAndResetReturnTrue(puppet->getJudgePreInputJump()); +} + +bool isPuppetHoldAnyButton(const IUsePlayerPuppet* playerPuppet) { + const PlayerPuppet* puppet = static_cast(playerPuppet); + return puppet->getPlayerInput()->isHoldAction() || puppet->getPlayerInput()->isHoldJump(); +} + +IUsePlayerPuppet* startPuppet(al::HitSensor* actorHitSensor, al::HitSensor* playerHitSensor) { + PlayerPuppet* puppet = + static_cast(al::getSensorHost(playerHitSensor))->getPlayerPuppet(); + puppet->start(actorHitSensor, playerHitSensor); + return puppet; +} + +void addPuppetVelocityFall(IUsePlayerPuppet* playerPuppet) { + const sead::Vector3f& gravity = playerPuppet->getGravity(); + sead::Vector3f velocity = playerPuppet->getVelocity(); + const PlayerConst* playerConst = static_cast(playerPuppet)->getPlayerConst(); + sead::Vector3f fallVelocity = gravity * playerConst->getGravityAir(); + al::addVectorLimit(&velocity, fallVelocity, playerConst->getFallSpeedMax()); + playerPuppet->setVelocity(velocity); +} + +void setPuppetFront(IUsePlayerPuppet* playerPuppet, const sead::Vector3f& front) { + sead::Vector3f up(0.0f, 0.0f, 0.0f); + playerPuppet->calcUp(&up); + sead::Quatf quat = sead::Quatf::unit; + al::makeQuatFrontUp(&quat, front, up); + playerPuppet->setPose(quat); +} + +void setPuppetUp(IUsePlayerPuppet* playerPuppet, const sead::Vector3f& up) { + sead::Vector3f front(0.0f, 0.0f, 0.0f); + playerPuppet->calcFront(&front); + sead::Quatf quat = sead::Quatf::unit; + al::makeQuatUpFront(&quat, up, front); + playerPuppet->setPose(quat); +} + +void calcPuppetQuat(sead::Quatf* quat, const IUsePlayerPuppet* playerPuppet) { + sead::Vector3f front(0.0f, 0.0f, 0.0f); + sead::Vector3f up(0.0f, 0.0f, 0.0f); + playerPuppet->calcFront(&front); + playerPuppet->calcUp(&up); + al::makeQuatUpFront(quat, up, front); +} + +bool isPuppetInputSwing(const IUsePlayerPuppet* playerPuppet) { + const PlayerInput* input = static_cast(playerPuppet)->getPlayerInput(); + if (input == nullptr) + return false; + return input->isTriggerSwingLeftHand() || input->isTriggerSwingRightHand(); +} + +void forcePutOnPuppetCap(IUsePlayerPuppet* playerPuppet) { + PlayerPuppet* puppet = static_cast(playerPuppet); + CapFunction::putOnCapPlayer(puppet->getHackCap(), puppet->getPlayerAnimator()); + puppet->invalidateSeparateMode(); +} + +void forcePutOnPuppetCapWithEffect(IUsePlayerPuppet* playerPuppet) { + PlayerPuppet* puppet = static_cast(playerPuppet); + HackCap* hackCap = puppet->getHackCap(); + bool isHide = hackCap->isHide(); + CapFunction::putOnCapPlayer(puppet->getHackCap(), puppet->getPlayerAnimator()); + puppet->invalidateSeparateMode(); + if (!isHide) + al::startHitReaction(hackCap, "エフェクト付き強制装着"); +} + +void clearStainEffect(IUsePlayerPuppet* playerPuppet) { + PlayerEffect* playerEffect = static_cast(playerPuppet)->getPlayerEffect(); + playerEffect->requestClearStainEffect(); + playerEffect->clearStainEffect(); +} + +void copyPuppetDitherAlpha(IUsePlayerPuppet* playerPuppet, const al::LiveActor* actor) { + PlayerPuppet* puppet = static_cast(playerPuppet); + puppet->getPlayerAnimator()->setModelAlpha(al::getModelAlphaMask(actor)); + puppet->setCopyDitherAlpha(); +} + +void requestUpdateSafetyPoint(IUsePlayerPuppet* playerPuppet, const al::LiveActor* actor, + const IUsePlayerCollision* playerCollision) { + PlayerPuppet* puppet = static_cast(playerPuppet); + al::HitSensor* hitSensor = puppet->getHitSensor(); + sead::Vector3f safetyPoint(0.0f, 0.0f, 0.0f); + sead::Vector3f safetyPointNormal(0.0f, 0.0f, 0.0f); + sead::Vector3f* recoveryTrans = nullptr; + const al::AreaObj* areaObj = nullptr; + if (calcActorCollidedGroundSafetyPoint(&safetyPoint, &safetyPointNormal, &areaObj, + &recoveryTrans, actor, hitSensor, playerCollision)) { + puppet->requestUpdateRecoveryInfo(true, false, safetyPoint, safetyPointNormal, areaObj); + } else { + bool collisionCode = false; + safetyPoint = al::getTrans(actor); + calcActorCollisionCodeNoSafetyPointPos(&safetyPoint, &collisionCode, actor, + playerCollision); + puppet->requestUpdateRecoveryInfo(false, collisionCode, safetyPoint, safetyPointNormal, + areaObj); + } +} + +void requestForceSafetyPoint(IUsePlayerPuppet* playerPuppet, const sead::Vector3f& recoveryTrans, + const sead::Vector3f& recoveryNormal) { + static_cast(playerPuppet) + ->requestUpdateRecoveryInfo(true, false, recoveryTrans, recoveryNormal, nullptr); +} + +} // namespace rs diff --git a/src/Util/PlayerPuppetFunction.h b/src/Util/PlayerPuppetFunction.h index 7bde4603b9..cd03b1e2ad 100644 --- a/src/Util/PlayerPuppetFunction.h +++ b/src/Util/PlayerPuppetFunction.h @@ -95,7 +95,7 @@ bool isPuppetHoldAnyButton(const IUsePlayerPuppet* playerPuppet); bool isPuppetMoveStickOn(const IUsePlayerPuppet* playerPuppet); bool isPuppetStartWorldWarp(const IUsePlayerPuppet* playerPuppet); bool isPuppetCancelWorldWarp(const IUsePlayerPuppet* playerPuppet); -const sead::Vector2f& getPuppetMoveStick(const IUsePlayerPuppet* playerPuppet); +sead::Vector2f getPuppetMoveStick(const IUsePlayerPuppet* playerPuppet); bool isTriggerGetOff(const IUsePlayerPuppet* playerPuppet); f32 getPuppetPoseRotZDegreeLeft(const IUsePlayerPuppet* playerPuppet); f32 getPuppetPoseRotZDegreeRight(const IUsePlayerPuppet* playerPuppet);