diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 13ff54dd..57e6976b 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -80234,34 +80234,34 @@ 0x0000007100edfe10,sub_7100EDFE10,76,_ZN4ksys3act19isNotLivingCreatureEPNS0_12BaseProcLinkE 0x0000007100edfe5c,sub_7100EDFE5C,188,_ZN4ksys3act15isWeaponProfileERKNS0_20ActorConstDataAccessE 0x0000007100edff18,isWeaponActorProfile,168,_ZN4ksys3act15isWeaponProfileERKN4sead14SafeStringBaseIcEE -0x0000007100edffc0,Actor::isWeaponActorProfile,224, -0x0000007100ee00a0,sub_7100EE00A0,216, -0x0000007100ee0178,act::acc::isWeaponOrArmor,332, -0x0000007100ee02c4,act::isWeaponOrArmor,84, -0x0000007100ee0318,act::acc::isBulletClass,168, -0x0000007100ee03c0,sub_7100EE03C0,204, -0x0000007100ee048c,sub_7100EE048C,196, +0x0000007100edffc0,Actor::isWeaponActorProfile,224,_ZN4ksys3act15isWeaponProfileEPNS0_5ActorE +0x0000007100ee00a0,sub_7100EE00A0,216,_ZN4ksys3act15isWeaponProfileEPNS0_12BaseProcLinkE +0x0000007100ee0178,act::acc::isWeaponOrArmor,332,_ZN4ksys3act15isWeaponOrArmorERKNS0_20ActorConstDataAccessE +0x0000007100ee02c4,act::isWeaponOrArmor,84,_ZN4ksys3act15isWeaponOrArmorEPNS0_5ActorE +0x0000007100ee0318,act::acc::isBulletClass,168,_ZN4ksys3act15isBulletProfileERKNS0_20ActorConstDataAccessE +0x0000007100ee03c0,sub_7100EE03C0,204,_ZN4ksys3act15isBulletProfileEPNS0_5ActorE +0x0000007100ee048c,sub_7100EE048C,196,_ZN4ksys3act15isBulletProfileEPNS0_12BaseProcLinkE 0x0000007100ee0550,act::acc::isHorseClass,168,_ZN4ksys3act14isHorseProfileERKNS0_20ActorConstDataAccessE -0x0000007100ee05f8,sub_7100EE05F8,204, -0x0000007100ee06c4,BaseProcLink::isHorseClass,196, +0x0000007100ee05f8,sub_7100EE05F8,204,_ZN4ksys3act14isHorseProfileEPNS0_5ActorE +0x0000007100ee06c4,BaseProcLink::isHorseClass,196,_ZN4ksys3act14isHorseProfileEPNS0_12BaseProcLinkE 0x0000007100ee0788,sub_7100EE0788,24, -0x0000007100ee07a0,sub_7100EE07A0,116, -0x0000007100ee0814,sub_7100EE0814,100, -0x0000007100ee0878,sub_7100EE0878,28, -0x0000007100ee0894,sub_7100EE0894,100, +0x0000007100ee07a0,sub_7100EE07A0,116,_ZN4ksys3act22isGrabAttClientEnabledEPvPNS0_12BaseProcLinkE +0x0000007100ee0814,sub_7100EE0814,100,_ZN4ksys3act14isStalfosPartsEPNS0_12BaseProcLinkE +0x0000007100ee0878,sub_7100EE0878,28,_ZN4ksys3act6isDoorERKNS0_20ActorConstDataAccessE +0x0000007100ee0894,sub_7100EE0894,100,_ZN4ksys3act6isDoorEPNS0_12BaseProcLinkE 0x0000007100ee08f8,sub_7100EE08F8,260,_ZN4ksys3act13isPreyOrSwarmERKNS0_20ActorConstDataAccessE -0x0000007100ee09fc,isPreyOrSwarm,312, -0x0000007100ee0b34,BaseProcLink::isPreyClass,304, -0x0000007100ee0c64,sub_7100EE0C64,92, -0x0000007100ee0cc0,sub_7100EE0CC0,136, -0x0000007100ee0d48,sub_7100EE0D48,128, +0x0000007100ee09fc,isPreyOrSwarm,312,_ZN4ksys3act13isPreyOrSwarmEPNS0_5ActorE +0x0000007100ee0b34,BaseProcLink::isPreyClass,304,_ZN4ksys3act13isPreyOrSwarmEPNS0_12BaseProcLinkE +0x0000007100ee0c64,sub_7100EE0C64,92,_ZN4ksys3act12isWolfOrBearERKNS0_20ActorConstDataAccessE +0x0000007100ee0cc0,sub_7100EE0CC0,136,_ZN4ksys3act12isWolfOrBearEPNS0_5ActorE +0x0000007100ee0d48,sub_7100EE0D48,128,_ZN4ksys3act12isWolfOrBearEPNS0_12BaseProcLinkE 0x0000007100ee0dc8,sub_7100EE0DC8,136, -0x0000007100ee0e50,sub_7100EE0E50,176, -0x0000007100ee0f00,sub_7100EE0F00,168, -0x0000007100ee0fa8,Actor::isTreeOrScaffoldOrSignboard,164, +0x0000007100ee0e50,sub_7100EE0E50,176,_ZN4ksys3act6isRopeEPNS0_5ActorE +0x0000007100ee0f00,sub_7100EE0F00,168,_ZN4ksys3act6isRopeEPNS0_12BaseProcLinkE +0x0000007100ee0fa8,Actor::isTreeOrScaffoldOrSignboard,164,_ZN4ksys3act27isTreeOrScaffoldOrSignboardEPNS0_5ActorE 0x0000007100ee104c,sub_7100EE104C,96, -0x0000007100ee10ac,isAirOctaPlatformActorName,440, -0x0000007100ee1264,isAirOctaPlatformActorName2,256, +0x0000007100ee10ac,isAirOctaPlatformActorName,440,_ZN4ksys3act17isAirOctaPlatformERKN4sead14SafeStringBaseIcEE +0x0000007100ee1264,isAirOctaPlatformActorName2,256,_ZN4ksys3act24isAirOctaWoodPlatformDlcERKN4sead14SafeStringBaseIcEE 0x0000007100ee1364,sub_7100EE1364,956, 0x0000007100ee1720,sub_7100EE1720,416, 0x0000007100ee18c0,sub_7100EE18C0,256, diff --git a/src/KingSystem/ActorSystem/CMakeLists.txt b/src/KingSystem/ActorSystem/CMakeLists.txt index dfd43084..8a0d6800 100644 --- a/src/KingSystem/ActorSystem/CMakeLists.txt +++ b/src/KingSystem/ActorSystem/CMakeLists.txt @@ -1,4 +1,7 @@ target_sources(uking PRIVATE + Profiles/actRopeBase.cpp + Profiles/actRopeBase.h + actActor.h actActorCaptureMgr.cpp actActorCaptureMgr.h diff --git a/src/KingSystem/ActorSystem/Profiles/actRopeBase.cpp b/src/KingSystem/ActorSystem/Profiles/actRopeBase.cpp new file mode 100644 index 00000000..8fbfb33d --- /dev/null +++ b/src/KingSystem/ActorSystem/Profiles/actRopeBase.cpp @@ -0,0 +1 @@ +#include "KingSystem/ActorSystem/Profiles/actRopeBase.h" diff --git a/src/KingSystem/ActorSystem/Profiles/actRopeBase.h b/src/KingSystem/ActorSystem/Profiles/actRopeBase.h new file mode 100644 index 00000000..7454c73a --- /dev/null +++ b/src/KingSystem/ActorSystem/Profiles/actRopeBase.h @@ -0,0 +1,12 @@ +#pragma once + +#include "KingSystem/ActorSystem/actActor.h" + +namespace ksys::act { + +// TODO +class RopeBase : public Actor { + SEAD_RTTI_OVERRIDE(RopeBase, Actor) +}; + +} // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actActorConstDataAccess.h b/src/KingSystem/ActorSystem/actActorConstDataAccess.h index ba4c4ed5..037e1c8b 100644 --- a/src/KingSystem/ActorSystem/actActorConstDataAccess.h +++ b/src/KingSystem/ActorSystem/actActorConstDataAccess.h @@ -1,5 +1,6 @@ #pragma once +#include #include "KingSystem/ActorSystem/actActorLinkConstDataAccess.h" #include "KingSystem/ActorSystem/actBaseProcLink.h" #include "KingSystem/Utils/Types.h" @@ -22,6 +23,11 @@ public: /// by comparing the IDs. bool hasProc(const BaseProcLink& link) const; + template + bool isDerivedFrom() const { + return sead::IsDerivedFrom(mProc); + } + bool linkAcquire(BaseProcLink* link) const; bool linkAcquireImmediately(BaseProcLink* link) const; @@ -36,6 +42,8 @@ public: bool acquireConnectedCalcChild(ActorLinkConstDataAccess* accessor) const; bool hasConnectedCalcParent() const; + bool isAttClientEnabled(const sead::SafeString& client) const; + private: u8 _10 = 0; }; diff --git a/src/KingSystem/ActorSystem/actActorUtil.cpp b/src/KingSystem/ActorSystem/actActorUtil.cpp index 095d7500..61b97fef 100644 --- a/src/KingSystem/ActorSystem/actActorUtil.cpp +++ b/src/KingSystem/ActorSystem/actActorUtil.cpp @@ -1,5 +1,6 @@ #include "KingSystem/ActorSystem/actActorUtil.h" #include +#include "KingSystem/ActorSystem/Profiles/actRopeBase.h" #include "KingSystem/ActorSystem/actActor.h" #include "KingSystem/ActorSystem/actActorConstDataAccess.h" #include "KingSystem/ActorSystem/actActorParam.h" @@ -400,10 +401,72 @@ bool isWeaponProfile(const sead::SafeString& actor) { return sead::SafeString(profile).startsWith("Weapon"); } +bool isWeaponProfile(Actor* actor) { + return isWeaponProfile(getAccessor(actor)); +} + +bool isWeaponProfile(BaseProcLink* link) { + return isWeaponProfile(getAccessor(link)); +} + +bool isWeaponOrArmor(const ActorConstDataAccess& accessor) { + if (!accessor.hasProc()) + return false; + + const auto& name = accessor.getName(); + const char* profile_cstr = nullptr; + InfoData::instance()->getActorProfile(&profile_cstr, name.cstr()); + + const sead::SafeString profile = profile_cstr; + return profile.startsWith("Weapon") || profile.startsWith("OptionalWeapon") || + profile.startsWith("Armor"); +} + +bool isWeaponOrArmor(Actor* actor) { + return isWeaponOrArmor(getAccessor(actor)); +} + +bool isBulletProfile(const ActorConstDataAccess& accessor) { + return isProfile(accessor, "Bullet"); +} + +bool isBulletProfile(Actor* actor) { + return isBulletProfile(getAccessor(actor)); +} + +bool isBulletProfile(BaseProcLink* link) { + return isBulletProfile(getAccessor(link)); +} + bool isHorseProfile(const ActorConstDataAccess& accessor) { return isProfile(accessor, "Horse"); } +bool isHorseProfile(Actor* actor) { + return isHorseProfile(getAccessor(actor)); +} + +bool isHorseProfile(BaseProcLink* link) { + return isHorseProfile(getAccessor(link)); +} + +bool isGrabAttClientEnabled(void*, BaseProcLink* link) { + return getAccessor(link).isAttClientEnabled("Grab"); +} + +bool isStalfosParts(BaseProcLink* link) { + const auto accessor = getAccessor(link); + return accessor.hasProc() && accessor.hasTag(tags::StalfosParts); +} + +bool isDoor(const ActorConstDataAccess& accessor) { + return accessor.hasProc() && accessor.hasTag(tags::Door); +} + +bool isDoor(BaseProcLink* link) { + return isDoor(getAccessor(link)); +} + bool isPreyOrSwarm(const ActorConstDataAccess& accessor) { if (!accessor.hasProc()) return false; @@ -411,4 +474,55 @@ bool isPreyOrSwarm(const ActorConstDataAccess& accessor) { return profile == "Prey" || profile == "Swarm"; } +bool isPreyOrSwarm(Actor* actor) { + return isPreyOrSwarm(getAccessor(actor)); +} + +bool isPreyOrSwarm(BaseProcLink* link) { + return isPreyOrSwarm(getAccessor(link)); +} + +bool isWolfOrBear(const ActorConstDataAccess& accessor) { + if (!accessor.hasProc()) + return false; + return accessor.hasTag(tags::AnimalTypeWolf) || accessor.hasTag(tags::AnimalTypeBear); +} + +bool isWolfOrBear(Actor* actor) { + return isWolfOrBear(getAccessor(actor)); +} + +bool isWolfOrBear(BaseProcLink* link) { + return isWolfOrBear(getAccessor(link)); +} + +bool isRope(Actor* actor) { + const auto accessor = getAccessor(actor); + return accessor.hasProc() && accessor.isDerivedFrom(); +} + +bool isRope(BaseProcLink* link) { + const auto accessor = getAccessor(link); + return accessor.hasProc() && accessor.isDerivedFrom(); +} + +bool isTreeOrScaffoldOrSignboard(Actor* actor) { + const auto accessor = getAccessor(actor); + if (!accessor.hasProc()) + return false; + + return accessor.hasTag(tags::Tree) || accessor.hasTag(tags::Scaffold) || + accessor.hasTag(tags::Signboard); +} + +bool isAirOctaPlatform(const sead::SafeString& name) { + return name == "Obj_BoardWood_Square_01" || name == "Obj_BoardWood_Triangle_01" || + name == "FldObj_DLC_FlyShield_A_Snow_01" || name == "FldObj_DLC_FlyShield_A_Snow_02"; +} + +bool isAirOctaWoodPlatformDlc(const sead::SafeString& name) { + return name == "FldObj_DLC_FlyShield_Wood_A_02" || + name == "FldObj_DLC_FlyShield_Wood_A_Snow_02"; +} + } // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actActorUtil.h b/src/KingSystem/ActorSystem/actActorUtil.h index f13b8cbc..ab71fe3c 100644 --- a/src/KingSystem/ActorSystem/actActorUtil.h +++ b/src/KingSystem/ActorSystem/actActorUtil.h @@ -133,7 +133,7 @@ bool isGrabAttClientEnabled(void* x, BaseProcLink* link); bool isStalfosParts(BaseProcLink* link); -bool isDoor(Actor* actor); +bool isDoor(const ActorConstDataAccess& accessor); bool isDoor(BaseProcLink* link); bool isPreyOrSwarm(const ActorConstDataAccess& accessor); @@ -152,7 +152,7 @@ bool isTreeOrScaffoldOrSignboard(Actor* actor); bool isAlive(BaseProcLink* link); bool isAirOctaPlatform(const sead::SafeString& name); -bool isAirOctaPlatformDlc(const sead::SafeString& name); +bool isAirOctaWoodPlatformDlc(const sead::SafeString& name); const sead::SafeString& getDefaultDropActor();