mirror of https://github.com/zeldaret/botw.git
ksys/act: Add more InfoData functions
This commit is contained in:
parent
e99f0f8949
commit
622104fbd2
|
@ -73360,7 +73360,7 @@
|
|||
0x0000007100d2e2d8,ActorInfoData::init,628,_ZN4ksys3act8InfoData4initEPhPN4sead4HeapES5_
|
||||
0x0000007100d2e54c,ActorInfoData::getActorScaleColorModelBfres,820,_ZNK4ksys3act8InfoData12getModelInfoEPKcRNS1_9ModelInfoE
|
||||
0x0000007100d2e880,ActorInfoData::getActorDataIter,208,_ZNK4ksys3act8InfoData12getActorIterEPN2al9ByamlIterEPKcb
|
||||
0x0000007100d2e950,ActorInfoData::isNotMergedGrudgeOrArmor50OrWeaponSwordDemoCheck,348,
|
||||
0x0000007100d2e950,ActorInfoData::isNotMergedGrudgeOrArmor50OrWeaponSwordDemoCheck,348,_ZNK4ksys3act8InfoData10logFailureERKN4sead14SafeStringBaseIcEE
|
||||
0x0000007100d2eaac,ActorInfoData::x,1484,_ZNK4ksys3act8InfoData13getRecipeInfoEPKcRNS1_10RecipeInfoE
|
||||
0x0000007100d2f078,act::getActorInfoInt,56,_ZN4ksys3act8InfoData11getIntByKeyERKN2al9ByamlIterEPKci
|
||||
0x0000007100d2f0b0,bymlGetString,84,_ZN4ksys3act8InfoData14getStringByKeyERKN2al9ByamlIterEPKcRKN4sead14SafeStringBaseIcEE
|
||||
|
@ -73402,14 +73402,14 @@
|
|||
0x0000007100d30cdc,sub_7100D30CDC,132,_ZNK4ksys3act8InfoData15getAabbNormHalfEPKc
|
||||
0x0000007100d30d60,ActorInfoData::getIsHasFar,20,_ZNK4ksys3act8InfoData8isHasFarEPKc
|
||||
0x0000007100d30d74,ActorInfoData::isAmiiboDrop,92,_ZNK4ksys3act8InfoData12hasDropEntryEPKcS3_
|
||||
0x0000007100d30dd0,ActorInfoData::getActorInstSize,20,
|
||||
0x0000007100d30de4,ActorInfoData::getBugMask,20,
|
||||
0x0000007100d30dd0,ActorInfoData::getActorInstSize,20,_ZNK4ksys3act8InfoData11getInstSizeEPKc
|
||||
0x0000007100d30de4,ActorInfoData::getBugMask,20,_ZNK4ksys3act8InfoData10getBugMaskEPKc
|
||||
0x0000007100d30df8,sub_7100D30DF8,64,
|
||||
0x0000007100d30e38,sub_7100D30E38,408,
|
||||
0x0000007100d30fd0,sub_7100D30FD0,408,
|
||||
0x0000007100d31168,ActorInfoData::x_0,712,
|
||||
0x0000007100d31430,sub_7100D31430,328,
|
||||
0x0000007100d31578,ActorInfoData::getStringFromByaml,168,
|
||||
0x0000007100d31168,ActorInfoData::x_0,712,_ZNK4ksys3act8InfoData13getModelFlagsEPKc
|
||||
0x0000007100d31430,sub_7100D31430,328,_ZNK4ksys3act8InfoData19getVariationMatAnimEPKcPS3_Pf
|
||||
0x0000007100d31578,ActorInfoData::getStringFromByaml,168,_ZNK4ksys3act8InfoData7getNameEPN2al9ByamlIterEPPKci
|
||||
0x0000007100d31620,getTimeSubTypeString,428,
|
||||
0x0000007100d317cc,AI_Action_DemoGetItem::ctor,48,
|
||||
0x0000007100d317fc,AI_Action_DemoGetItem::dtor,20,
|
||||
|
|
Can't render this file because it is too large.
|
|
@ -19,6 +19,8 @@ class ActorCreator {
|
|||
public:
|
||||
void setActorFactory(ActorFactory* factory) { mActorFactory = factory; }
|
||||
|
||||
bool get5a() const { return _5a; }
|
||||
|
||||
private:
|
||||
sead::Heap* forBaseProcDualHeap;
|
||||
sead::Heap* placementMgrHeap;
|
||||
|
|
|
@ -1,21 +1,31 @@
|
|||
#pragma once
|
||||
|
||||
#include <heap/seadDisposer.h>
|
||||
#include <prim/seadTypedBitFlag.h>
|
||||
#include "KingSystem/Utils/Types.h"
|
||||
|
||||
namespace ksys::act {
|
||||
|
||||
class ActorDebug {
|
||||
SEAD_SINGLETON_DISPOSER(ActorDebug)
|
||||
virtual ~ActorDebug();
|
||||
|
||||
public:
|
||||
enum class Flag {
|
||||
_10000000 = 0x10000000,
|
||||
};
|
||||
|
||||
struct HashUnused {
|
||||
u32 hash = 0;
|
||||
u32 b;
|
||||
};
|
||||
|
||||
const char* getNullStr(HashUnused* u);
|
||||
bool hasFlag(Flag flag) const { return mFlags.isOn(flag); }
|
||||
|
||||
u8 TEMP1[0x2F0];
|
||||
void* _28;
|
||||
sead::TypedBitFlag<Flag> mFlags;
|
||||
u8 TEMP1[0x2DC];
|
||||
f32 mDispDistanceMultiplier;
|
||||
u8 TEMP2[0x114];
|
||||
};
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
#include <KingSystem/Resource/resModelResourceDivide.h>
|
||||
#include <codec/seadHashCRC32.h>
|
||||
#include <math/seadMathNumbers.h>
|
||||
#include "KingSystem/ActorSystem/actActorCreator.h"
|
||||
#include "KingSystem/ActorSystem/actDebug.h"
|
||||
#include "KingSystem/Event/evtEvent.h"
|
||||
#include "KingSystem/Event/evtManager.h"
|
||||
#include "KingSystem/Utils/Byaml/Byaml.h"
|
||||
#include "KingSystem/Utils/Byaml/ByamlArrayIter.h"
|
||||
|
@ -144,6 +147,35 @@ bool InfoData::getActorIter(al::ByamlIter* iter, const char* actor, bool x) cons
|
|||
return false;
|
||||
}
|
||||
|
||||
bool InfoData::logFailure(const sead::SafeString& actor_name) const {
|
||||
#ifdef MATCHING_HACK_NX_CLANG
|
||||
// This is required to prevent LLVM from detecting that 'this' is unused
|
||||
// and optimizing out the passing of 'this' in callers.
|
||||
__builtin_assume(mActorsBytes);
|
||||
#endif
|
||||
|
||||
auto* event = evt::Manager::instance()->getActiveEvent();
|
||||
if (event && event->hasFlag(evt::Event::Flag::_80000000000))
|
||||
return false;
|
||||
|
||||
if (!ActorCreator::instance()->get5a())
|
||||
return false;
|
||||
|
||||
if (ActorDebug::instance() && ActorDebug::instance()->hasFlag(ActorDebug::Flag::_10000000))
|
||||
return false;
|
||||
|
||||
if (actor_name.startsWith("MergedGrudge"))
|
||||
return false;
|
||||
|
||||
if (actor_name.startsWith("Armor_50"))
|
||||
return false;
|
||||
|
||||
if (actor_name == "Weapon_Sword_DemoCheck")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InfoData::getRecipeInfo(const char* actor, InfoData::RecipeInfo& info) const {
|
||||
al::ByamlIter iter;
|
||||
if (getActorIter(&iter, actor)) {
|
||||
|
@ -614,4 +646,84 @@ bool InfoData::hasDropEntry(const char* actor, const char* key) const {
|
|||
return iter.isExistKey(key);
|
||||
}
|
||||
|
||||
s32 InfoData::getInstSize(const char* actor) const {
|
||||
return getInt(actor, "instSize", 0, false);
|
||||
}
|
||||
|
||||
u32 InfoData::getBugMask(const char* actor) const {
|
||||
return getInt(actor, "bugMask");
|
||||
}
|
||||
|
||||
u32 InfoData::getModelFlags(const char* actor) const {
|
||||
u32 flags = 0x4000;
|
||||
if (!actor)
|
||||
return flags;
|
||||
|
||||
bool is_map_const = false;
|
||||
|
||||
{
|
||||
const char* profile;
|
||||
if (getActorProfile(&profile, actor)) {
|
||||
const sead::SafeString profile_ = profile;
|
||||
if (profile_ == "MapConstPassive" || profile_ == "MapConstActive")
|
||||
is_map_const = true;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
al::ByamlIter iter;
|
||||
if (getActorIter(&iter, actor)) {
|
||||
if (!hasTag(iter, tags::Tree))
|
||||
flags |= 0x1000;
|
||||
} else {
|
||||
flags |= 0x1000;
|
||||
}
|
||||
}
|
||||
|
||||
s32 type = -1;
|
||||
{
|
||||
al::ByamlIter iter;
|
||||
if (getActorIter(&iter, actor)) {
|
||||
if (hasTag(iter, tags::Unk_0x4F4E1426))
|
||||
type = 0;
|
||||
else if (hasTag(iter, tags::PasteGrudgeSlime))
|
||||
type = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_map_const)
|
||||
flags &= ~0x1000;
|
||||
|
||||
if (type == 0 || (type != 1 && !is_map_const))
|
||||
flags |= 0x2000;
|
||||
|
||||
if (is_map_const && type == 1)
|
||||
flags |= 0x1000;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
bool InfoData::getVariationMatAnim(const char* actor, const char** anim, f32* frame) const {
|
||||
al::ByamlIter iter;
|
||||
if (!getActorIter(&iter, actor))
|
||||
return false;
|
||||
|
||||
*anim = getStringByKey(iter, "variationMatAnim", sead::SafeString::cEmptyString);
|
||||
*frame = getIntByKey(iter, "variationMatAnimFrame");
|
||||
return (*anim)[0] != 0;
|
||||
}
|
||||
|
||||
bool InfoData::getName(al::ByamlIter* iter, const char** name, s32 idx) const {
|
||||
if (idx < 0 || idx >= mNumActors)
|
||||
return false;
|
||||
|
||||
*iter = {mActorsBytes, mActorsBytes + mActorOffsets[idx]};
|
||||
al::ByamlHashIter hash_iter{iter->getRootNode()};
|
||||
al::ByamlData data;
|
||||
if (!hash_iter.getDataByKey(&data, mNameIdx))
|
||||
return false;
|
||||
|
||||
return iter->tryConvertString(name, &data);
|
||||
}
|
||||
|
||||
} // namespace ksys::act
|
||||
|
|
|
@ -121,6 +121,11 @@ public:
|
|||
f32 getAabbNormHalf(const char* actor) const;
|
||||
bool isHasFar(const char* actor) const;
|
||||
bool hasDropEntry(const char* actor, const char* key) const;
|
||||
s32 getInstSize(const char* actor) const;
|
||||
u32 getBugMask(const char* actor) const;
|
||||
u32 getModelFlags(const char* actor) const;
|
||||
bool getVariationMatAnim(const char* actor, const char** anim, f32* frame) const;
|
||||
bool getName(al::ByamlIter* iter, const char** name, s32 idx) const;
|
||||
|
||||
const char* getString(const char* actor, const char* key, const sead::SafeString& default_,
|
||||
bool x = true) const;
|
||||
|
|
|
@ -28,6 +28,7 @@ private:
|
|||
};
|
||||
|
||||
#define KSYS_ACT_DEFINE_TAG(NAME) inline constexpr Tag NAME(#NAME)
|
||||
#define KSYS_ACT_DEFINE_TAG_UNK(HASH) inline constexpr Tag Unk_##HASH(HASH)
|
||||
|
||||
namespace tags {
|
||||
|
||||
|
@ -396,8 +397,11 @@ KSYS_ACT_DEFINE_TAG(ZukanOther);
|
|||
KSYS_ACT_DEFINE_TAG(ZukanSozai);
|
||||
KSYS_ACT_DEFINE_TAG(ZukanWeapon);
|
||||
|
||||
KSYS_ACT_DEFINE_TAG_UNK(0x4F4E1426);
|
||||
|
||||
} // namespace tags
|
||||
|
||||
#undef KSYS_ACT_DEFINE_TAG
|
||||
#undef KSYS_ACT_DEFINE_TAG_UNK
|
||||
|
||||
} // namespace ksys::act
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
target_sources(uking PRIVATE
|
||||
evtEvent.cpp
|
||||
evtEvent.h
|
||||
evtManager.cpp
|
||||
evtManager.h
|
||||
)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#include "KingSystem/Event/evtEvent.h"
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
#include <prim/seadTypedBitFlag.h>
|
||||
|
||||
namespace ksys::evt {
|
||||
|
||||
// TODO
|
||||
class Event {
|
||||
public:
|
||||
Event();
|
||||
virtual ~Event();
|
||||
|
||||
enum class Flag : u64 {
|
||||
_80000000000 = 0x80000000000,
|
||||
};
|
||||
|
||||
bool hasFlag(Flag flag) const { return mFlags.isOn(flag); }
|
||||
|
||||
private:
|
||||
u8 TEMP_0[0x338];
|
||||
sead::TypedBitFlag<Flag> mFlags;
|
||||
};
|
||||
// sizeof() = 0x620
|
||||
|
||||
} // namespace ksys::evt
|
Loading…
Reference in New Issue