ksys/act: Implement even more ActorUtil functions

This commit is contained in:
Léo Lam 2020-12-04 21:12:01 +01:00
parent 5b523db03b
commit 5672fd9397
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
7 changed files with 163 additions and 25 deletions

View File

@ -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,

Can't render this file because it is too large.

View File

@ -1,4 +1,7 @@
target_sources(uking PRIVATE
Profiles/actRopeBase.cpp
Profiles/actRopeBase.h
actActor.h
actActorCaptureMgr.cpp
actActorCaptureMgr.h

View File

@ -0,0 +1 @@
#include "KingSystem/ActorSystem/Profiles/actRopeBase.h"

View File

@ -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

View File

@ -1,5 +1,6 @@
#pragma once
#include <prim/seadRuntimeTypeInfo.h>
#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 <typename T>
bool isDerivedFrom() const {
return sead::IsDerivedFrom<T>(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;
};

View File

@ -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

View File

@ -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();