mirror of https://github.com/zeldaret/botw.git
Add uking::ai::ActorWaterDepthSelect functions (#117)
This commit is contained in:
parent
9a6a5fffa4
commit
78fd3c6e7a
|
|
@ -1,5 +1,5 @@
|
|||
ai::ActorWaterDepthSelect:
|
||||
status: pending
|
||||
status: done
|
||||
ai::AddBasicLinkOn:
|
||||
status: pending
|
||||
ai::AddCarried:
|
||||
|
|
|
|||
|
|
@ -20062,15 +20062,15 @@ Address,Quality,Size,Name
|
|||
0x00000071002f6180,O,000004,_ZN5uking2ai21ActorWaterDepthSelectD1Ev
|
||||
0x00000071002f6184,O,000036,_ZN5uking2ai21ActorWaterDepthSelectD0Ev
|
||||
0x00000071002f61a8,O,000008,_ZN5uking2ai21ActorWaterDepthSelect5init_EPN4sead4HeapE
|
||||
0x00000071002f61b0,U,000084,_ZN5uking2ai21ActorWaterDepthSelect6enter_EPN4ksys3act2ai15InlineParamPackE
|
||||
0x00000071002f6204,U,000324,_ZN5uking2ai21ActorWaterDepthSelect5calc_Ev
|
||||
0x00000071002f61b0,O,000084,_ZN5uking2ai21ActorWaterDepthSelect6enter_EPN4ksys3act2ai15InlineParamPackE
|
||||
0x00000071002f6204,O,000324,_ZN5uking2ai21ActorWaterDepthSelect5calc_Ev
|
||||
0x00000071002f6348,O,000004,_ZN5uking2ai21ActorWaterDepthSelect6leave_Ev
|
||||
0x00000071002f634c,O,000128,_ZN5uking2ai21ActorWaterDepthSelect11loadParams_Ev
|
||||
0x00000071002f63cc,O,000288,_ZNK5uking2ai21ActorWaterDepthSelect27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
|
||||
0x00000071002f64ec,O,000092,_ZNK5uking2ai21ActorWaterDepthSelect18getRuntimeTypeInfoEv
|
||||
0x00000071002f6548,U,000036,_ZNK5uking2ai21ActorWaterDepthSelect8isFailedEv
|
||||
0x00000071002f656c,U,000036,_ZNK5uking2ai21ActorWaterDepthSelect10isFinishedEv
|
||||
0x00000071002f6590,U,000036,_ZNK5uking2ai21ActorWaterDepthSelect12isChangeableEv
|
||||
0x00000071002f6548,O,000036,_ZNK5uking2ai21ActorWaterDepthSelect8isFailedEv
|
||||
0x00000071002f656c,O,000036,_ZNK5uking2ai21ActorWaterDepthSelect10isFinishedEv
|
||||
0x00000071002f6590,O,000036,_ZNK5uking2ai21ActorWaterDepthSelect12isChangeableEv
|
||||
0x00000071002f65b4,O,000008,_ZNK4ksys3act2ai2Ai14getNumChildrenEv
|
||||
0x00000071002f65bc,O,000008,_ZNK4ksys3act2ai2Ai7getTypeEv
|
||||
0x00000071002f65c4,O,000008,_ZN4ksys3act2ai2Ai9postLeaveEv
|
||||
|
|
|
|||
|
Can't render this file because it is too large.
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "Game/AI/AI/aiActorWaterDepthSelect.h"
|
||||
#include "KingSystem/ActorSystem/actActor.h"
|
||||
|
||||
namespace uking::ai {
|
||||
|
||||
|
|
@ -6,12 +7,48 @@ ActorWaterDepthSelect::ActorWaterDepthSelect(const InitArg& arg) : ksys::act::ai
|
|||
|
||||
ActorWaterDepthSelect::~ActorWaterDepthSelect() = default;
|
||||
|
||||
bool ActorWaterDepthSelect::isChangeable() const {
|
||||
return getCurrentChild()->isChangeable();
|
||||
}
|
||||
|
||||
bool ActorWaterDepthSelect::isFailed() const {
|
||||
return getCurrentChild()->isFailed();
|
||||
}
|
||||
|
||||
bool ActorWaterDepthSelect::isFinished() const {
|
||||
return getCurrentChild()->isFinished();
|
||||
}
|
||||
|
||||
bool ActorWaterDepthSelect::init_(sead::Heap* heap) {
|
||||
return ksys::act::ai::Ai::init_(heap);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ActorWaterDepthSelect::enter_(ksys::act::ai::InlineParamPack* params) {
|
||||
ksys::act::ai::Ai::enter_(params);
|
||||
if (isDeep() && isUnderwater()) {
|
||||
changeChild("深瀬", params);
|
||||
} else {
|
||||
changeChild("浅瀬", params);
|
||||
}
|
||||
}
|
||||
|
||||
void ActorWaterDepthSelect::calc_() {
|
||||
if (*mOnEnterOnly_s)
|
||||
return;
|
||||
|
||||
auto is_deep = isDeep() && isUnderwater();
|
||||
if (*mForceDeepChange_s && is_deep) {
|
||||
if (!isCurrentChild("深瀬")) {
|
||||
changeChild("深瀬");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (getCurrentChild()->isChangeable()) {
|
||||
if (is_deep && !isCurrentChild("深瀬"))
|
||||
changeChild("深瀬");
|
||||
else if (!is_deep && !isCurrentChild("浅瀬"))
|
||||
changeChild("浅瀬");
|
||||
}
|
||||
}
|
||||
|
||||
void ActorWaterDepthSelect::leave_() {
|
||||
|
|
@ -24,4 +61,13 @@ void ActorWaterDepthSelect::loadParams_() {
|
|||
getStaticParam(&mForceDeepChange_s, "ForceDeepChange");
|
||||
}
|
||||
|
||||
bool ActorWaterDepthSelect::isDeep() const {
|
||||
return 0.0 < *mDeepDepth_s && mActor->get68f().load();
|
||||
}
|
||||
|
||||
bool ActorWaterDepthSelect::isUnderwater() const {
|
||||
float y_w = mActor->getMtx().m[1][3];
|
||||
return mActor->get6f0() - y_w > *mDeepDepth_s;
|
||||
}
|
||||
|
||||
} // namespace uking::ai
|
||||
|
|
|
|||
|
|
@ -10,11 +10,18 @@ public:
|
|||
explicit ActorWaterDepthSelect(const InitArg& arg);
|
||||
~ActorWaterDepthSelect() override;
|
||||
|
||||
bool isFailed() const override;
|
||||
bool isChangeable() const override;
|
||||
bool isFinished() const override;
|
||||
bool init_(sead::Heap* heap) override;
|
||||
void enter_(ksys::act::ai::InlineParamPack* params) override;
|
||||
void calc_() override;
|
||||
void leave_() override;
|
||||
void loadParams_() override;
|
||||
|
||||
bool isDeep() const;
|
||||
bool isUnderwater() const;
|
||||
|
||||
protected:
|
||||
// static_param at offset 0x38
|
||||
const float* mDeepDepth_s{};
|
||||
|
|
|
|||
|
|
@ -285,6 +285,9 @@ public:
|
|||
virtual void m146();
|
||||
virtual void m147();
|
||||
|
||||
sead::Atomic<bool>& get68f() { return _68f; }
|
||||
float get6f0() const { return _6f0; }
|
||||
|
||||
void emitBasicSigOn();
|
||||
void emitBasicSigOff();
|
||||
bool checkBasicSig() const;
|
||||
|
|
|
|||
Loading…
Reference in New Issue