diff options
| author | Léo Lam <leo@leolam.fr> | 2020-12-04 21:12:01 +0100 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2020-12-04 21:58:56 +0100 |
| commit | 5672fd9397052f31810581df749be6e40dc57f4a (patch) | |
| tree | 2e25e1de53c98a3fbde57e6030a7f3bee4d1c9fd /src/KingSystem/ActorSystem/actActorUtil.cpp | |
| parent | 5b523db03b954fd55cc1ab6b83a9655f5cdcae72 (diff) | |
ksys/act: Implement even more ActorUtil functions
Diffstat (limited to 'src/KingSystem/ActorSystem/actActorUtil.cpp')
| -rw-r--r-- | src/KingSystem/ActorSystem/actActorUtil.cpp | 114 |
1 files changed, 114 insertions, 0 deletions
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 <container/seadSafeArray.h> +#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<RopeBase>(); +} + +bool isRope(BaseProcLink* link) { + const auto accessor = getAccessor(link); + return accessor.hasProc() && accessor.isDerivedFrom<RopeBase>(); +} + +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 |
