Enemy: Implement SenobiLeaf (#177)
Some checks are pending
Compile and verify functions / compile_verify (push) Waiting to run
Copy headers to separate repo / copy_headers (push) Waiting to run
lint / clang-format (push) Waiting to run
lint / custom-lint (push) Waiting to run
progress / publish_progress (push) Waiting to run

Co-authored-by: GRAnimated <devin@nhscan.com>
Co-authored-by: LynxDev2 <developer.iika@gmail.com>
This commit is contained in:
LynxDev2 2024-10-18 18:23:13 +02:00 committed by GitHub
parent 3d6069b929
commit 9381713600
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 77 additions and 6 deletions

View File

@ -9096,12 +9096,12 @@ Address,Quality,Size,Name
0x000000710017fed0,U,000064,
0x000000710017ff10,U,000004,
0x000000710017ff14,U,000124,_ZNK12_GLOBAL__N_119HostTypeNrvGenerate7executeEPN2al11NerveKeeperE
0x000000710017ff90,U,000148,_ZN10SenobiLeafC2EPKc
0x0000007100180024,U,000160,_ZN10SenobiLeafC1EPKc
0x00000071001800c4,U,000124,_ZN10SenobiLeaf4initERKN2al13ActorInitInfoE
0x0000007100180140,U,000228,_ZN10SenobiLeaf8calcAnimEv
0x0000007100180224,U,000220,_ZN10SenobiLeaf10updatePoseEv
0x0000007100180300,U,000144,_ZN10SenobiLeaf14registerToHostEPN2al9LiveActorEb
0x000000710017ff90,O,000148,_ZN10SenobiLeafC2EPKc
0x0000007100180024,O,000160,_ZN10SenobiLeafC1EPKc
0x00000071001800c4,O,000124,_ZN10SenobiLeaf4initERKN2al13ActorInitInfoE
0x0000007100180140,O,000228,_ZN10SenobiLeaf8calcAnimEv
0x0000007100180224,O,000220,_ZN10SenobiLeaf10updatePoseEv
0x0000007100180300,m,000144,_ZN10SenobiLeaf14registerToHostEPN2al9LiveActorEb
0x0000007100180390,U,000232,_ZN19SenobiLocalFunction22setTransToStretchPointEP6Senobi
0x0000007100180478,U,000196,_ZN19SenobiLocalFunction10shrinkBodyEP6Senobif
0x000000710018053c,U,000048,_ZN19SenobiLocalFunction11calcBodyPosEPN4sead7Vector3IfEEPKN2al9LiveActorE

Can't render this file because it is too large.

View File

@ -10,9 +10,11 @@ void turnVecToVecDegree(sead::Vector3f*, const sead::Vector3f&, const sead::Vect
void turnVecToVecRate(sead::Vector3f*, const sead::Vector3f&, const sead::Vector3f&, f32);
void verticalizeVec(sead::Vector3f*, const sead::Vector3f&, const sead::Vector3f&);
void rotateQuatRadian(sead::Quatf*, const sead::Quatf&, const sead::Vector3f&, f32);
void calcQuatFront(sead::Vector3f*, const sead::Quatf&);
void calcQuatUp(sead::Vector3f*, const sead::Quatf&);
void makeQuatFrontUp(sead::Quatf*, const sead::Vector3f&, const sead::Vector3f&);
void makeQuatUpFront(sead::Quatf*, const sead::Vector3f&, const sead::Vector3f&);
void makeMtxFrontUpPos(sead::Matrix34f*, const sead::Vector3f&, const sead::Vector3f&,
const sead::Vector3f&);

49
src/Enemy/SenobiLeaf.cpp Normal file
View File

@ -0,0 +1,49 @@
#include "Enemy/SenobiLeaf.h"
#include <math/seadMathCalcCommon.h>
#include "Library/Joint/JointControllerKeeper.h"
#include "Library/LiveActor/ActorClippingFunction.h"
#include "Library/LiveActor/ActorInitInfo.h"
#include "Library/LiveActor/ActorPoseKeeper.h"
#include "Library/LiveActor/LiveActorUtil.h"
#include "Library/Math/MathRandomUtil.h"
#include "Library/Math/VectorUtil.h"
SenobiLeaf::SenobiLeaf(const char* actorName) : al::LiveActor(actorName) {}
void SenobiLeaf::init(const al::ActorInitInfo& info) {
al::initActorWithArchiveName(this, info, "SenobiLeaf", 0);
al::initJointControllerKeeper(this, 1);
al::initJointLocalZRotator(this, &mLocalZRotator, "Leaf1");
makeActorDead();
}
void SenobiLeaf::calcAnim() {
updatePose();
al::LiveActor::calcAnim();
}
void SenobiLeaf::updatePose() {
sead::Vector3f frontDir;
al::calcJointFrontDir(&frontDir, mHostActor, "AllRoot");
sead::Quatf targetQuat = sead::Quatf::unit;
al::makeQuatUpFront(&targetQuat, mUp, frontDir);
al::rotateQuatRadian(&targetQuat, targetQuat, mUp, sead::Mathf::deg2rad(mYDegree));
al::updatePoseQuat(this, targetQuat);
sead::Vector3f newFrontDir;
al::calcQuatFront(&newFrontDir, targetQuat);
al::updatePoseTrans(this, al::getTrans(this) - newFrontDir * 15.0f);
}
// NON_MATCHING: regswap when adding
void SenobiLeaf::registerToHost(al::LiveActor* host, bool flip) {
mHostActor = host;
getName(); // unused
al::invalidateClipping(this);
al::registerSubActorSyncClipping(host, this);
al::onSyncHideSubActor(host, this);
mYDegree = al::getRandom(-60.0f, 60.0f) + (flip ? -90.0f : 90.0f);
}

20
src/Enemy/SenobiLeaf.h Normal file
View File

@ -0,0 +1,20 @@
#pragma once
#include "Library/LiveActor/LiveActor.h"
class SenobiLeaf : public al::LiveActor {
public:
SenobiLeaf(const char* actorName);
void init(const al::ActorInitInfo& info) override;
void calcAnim() override;
void updatePose();
void registerToHost(al::LiveActor*, bool);
private:
al::LiveActor* mHostActor = nullptr;
f32 mLocalZRotator = 0.0f;
f32 mYDegree = 0.0f;
sead::Vector3f mUp = sead::Vector3f::ey;
};