AirOctaFlyUp::handleMessage ok, AirOctaFlyUp::leave_ not ok with a difference of 0

This commit is contained in:
bomba1749 2023-06-09 23:24:19 -04:00 committed by GitHub
parent d7091eb132
commit efa72cb461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 6 deletions

View File

@ -1,6 +1,8 @@
#include "Game/AI/AI/aiAirOctaFlyUp.h"
#include "Game/DLC/aocHardModeManager.h"
#include "KingSystem/Utils/Thread/Message.h"
namespace uking::ai {
namespace uking::ai{
AirOctaFlyUp::AirOctaFlyUp(const InitArg& arg) : ksys::act::ai::Ai(arg) {}
@ -10,8 +12,27 @@ bool AirOctaFlyUp::init_(sead::Heap* heap) {
return ksys::act::ai::Ai::init_(heap);
}
bool AirOctaFlyUp::handleMessage_( const ksys::Message& message) {
if (message.getType().value == 0x80000c8) {
u32* user_data = static_cast<u32*>(message.getUserData());
auto* data_mgr = sead::DynamicCast<AirOctaDataMgr>((AirOctaDataMgr*)*mAirOctaDataMgr_a);
if (!data_mgr) {
return true;
}
if (user_data != nullptr) {
if (*user_data == 3) {
Ai::changeChild( "終了"); //END IN JAPANESE
} else if (*user_data == 4) {
ActionBase::setFinished();
}
}
return true;
}
return false;
}
void AirOctaFlyUp::enter_(ksys::act::ai::InlineParamPack* params) {
ksys::act::ai::Ai::enter_(params);
ksys::act::ai::Ai::enter_();
}
void AirOctaFlyUp::leave_() {
@ -24,4 +45,5 @@ void AirOctaFlyUp::loadParams_() {
getAITreeVariable(&mAirOctaDataMgr_a, "AirOctaDataMgr");
}
} // namespace uking::ai
// namespace uking::ai
}

View File

@ -1,19 +1,32 @@
#pragma once
#include "KingSystem/ActorSystem/actAiAi.h"
#include "KingSystem/ActorSystem/actBaseProcLink.h"
namespace uking::ai {
class AirOctaDataMgr {
SEAD_RTTI_BASE(AirOctaDataMgr)
public:
ksys::act::BaseProcLink& getProc() { return mBaseProcLink; }
private:
/* 0x08 */ char unk_00[0x10];
/* 0x18 */ ksys::act::BaseProcLink mBaseProcLink;
};
class AirOctaFlyUp : public ksys::act::ai::Ai {
SEAD_RTTI_OVERRIDE(AirOctaFlyUp, ksys::act::ai::Ai)
friend uking::ai::AirOctaDataMgr;
public:
explicit AirOctaFlyUp(const InitArg& arg);
~AirOctaFlyUp() override;
bool handleMessage_(const ksys::Message& message) override;
bool init_(sead::Heap* heap) override;
void enter_(ksys::act::ai::InlineParamPack* params) override;
void leave_() override;
void loadParams_() override;
void getRuntimeTypeInfo();
protected:
// static_param at offset 0x38
@ -21,7 +34,12 @@ protected:
// dynamic_param at offset 0x40
float* mTargetDistance_d{};
// aitree_variable at offset 0x48
void* mAirOctaDataMgr_a{};
// for whatever reason, removing getAITreeVariable(&mAirOctaDataMgr_a, "AirOctaDataMgr"); and replacing it with
// AirOctaDataMgr** mAirOctaDataMgr_a{}; will make loadParams_ be not matching with a difference of 0 and make
// handleMessage_ go from a difference of 5 to matching. ¯\_(ツ)_/¯ going from nonmatching to matching and
// making another function go from matching to not really unmatching is still net progress
// getAITreeVariable(&mAirOctaDataMgr_a, "AirOctaDataMgr");
AirOctaDataMgr** mAirOctaDataMgr_a{};
};
} // namespace uking::ai