mirror of
https://github.com/MonsterDruide1/OdysseyDecomp.git
synced 2024-11-23 05:19:52 +00:00
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
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:
parent
3d6069b929
commit
9381713600
@ -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.
|
@ -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
49
src/Enemy/SenobiLeaf.cpp
Normal 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
20
src/Enemy/SenobiLeaf.h
Normal 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;
|
||||
};
|
Loading…
Reference in New Issue
Block a user