summaryrefslogtreecommitdiff
path: root/src/KingSystem/ActorSystem
diff options
context:
space:
mode:
authorAlexApps99 <alex.apps99@gmail.com>2021-07-26 21:58:51 +1200
committerAlexApps99 <alex.apps99@gmail.com>2021-07-26 23:05:19 +1200
commit42807160cfb33af9f3cf2fa6b0ba98f232208cdb (patch)
tree95b1b16a3f4cf7d0ab51e90b3d73e53f74ba7f2b /src/KingSystem/ActorSystem
parent88bcc9eec1481b47361dc717c83e4953e8929a2b (diff)
Add #ifdef declarations for NON_MATCHING code
Diffstat (limited to 'src/KingSystem/ActorSystem')
-rw-r--r--src/KingSystem/ActorSystem/LOD/actLodState.cpp8
-rw-r--r--src/KingSystem/ActorSystem/actASSetting.cpp4
-rw-r--r--src/KingSystem/ActorSystem/actActorCreator.cpp4
-rw-r--r--src/KingSystem/ActorSystem/actActorParamMgr.cpp8
-rw-r--r--src/KingSystem/ActorSystem/actActorUtil.cpp12
-rw-r--r--src/KingSystem/ActorSystem/actAiClassDef.cpp8
-rw-r--r--src/KingSystem/ActorSystem/actBaseProc.cpp8
-rw-r--r--src/KingSystem/ActorSystem/actBaseProcJobQue.cpp4
-rw-r--r--src/KingSystem/ActorSystem/actBaseProcMgr.cpp16
-rw-r--r--src/KingSystem/ActorSystem/actInstParamPack.cpp11
10 files changed, 62 insertions, 21 deletions
diff --git a/src/KingSystem/ActorSystem/LOD/actLodState.cpp b/src/KingSystem/ActorSystem/LOD/actLodState.cpp
index 99bdfbca..3dff3e29 100644
--- a/src/KingSystem/ActorSystem/LOD/actLodState.cpp
+++ b/src/KingSystem/ActorSystem/LOD/actLodState.cpp
@@ -9,7 +9,8 @@
namespace ksys::act {
-// NON_MATCHING: reorders at the beginning because of initFlags -- should be equivalent
+// reorders at the beginning because of initFlags -- should be equivalent
+#ifdef NON_MATCHING
LodState::LodState(sead::Heap* heap, sead::BitFlag32 flags, Actor* actor,
int disable_calc_skip_frame, float x)
: mFlags14(flags), mActor(actor), _44(x), mDisableCalcSkipFrame(disable_calc_skip_frame) {
@@ -300,13 +301,15 @@ LodState::LodState(sead::Heap* heap, sead::BitFlag32 flags, Actor* actor,
_50 = 3.0f;
}
}
+#endif
LodState::~LodState() {
if (mOcclusionQueryCylinder)
delete mOcclusionQueryCylinder;
}
-// NON_MATCHING: ????? reordering
+// ????? reordering
+#ifdef NON_MATCHING
void LodState::initFlags() {
_28 = 1.0;
_40 = 0.0;
@@ -327,5 +330,6 @@ void LodState::initFlags() {
_60 = 0xFFFF;
_64 = -3;
}
+#endif
} // namespace ksys::act
diff --git a/src/KingSystem/ActorSystem/actASSetting.cpp b/src/KingSystem/ActorSystem/actASSetting.cpp
index 2b020cfe..164d9e67 100644
--- a/src/KingSystem/ActorSystem/actASSetting.cpp
+++ b/src/KingSystem/ActorSystem/actASSetting.cpp
@@ -15,7 +15,8 @@ void ASSetting::init(const sead::SafeString& config_path, sead::Heap* heap) {
mHandle.load(config_path, &req);
}
-// NON_MATCHING: sead::DirectResource to res::ASSetting cast nullptr check; branching for the return
+// sead::DirectResource to res::ASSetting cast nullptr check; branching for the return
+#ifdef NON_MATCHING
res::ASParamParser* ASSetting::getBoneParams(const sead::SafeString& key) const {
auto* res = sead::DynamicCast<res::ASSetting>(mHandle.getResource());
if (!res)
@@ -27,5 +28,6 @@ res::ASParamParser* ASSetting::getBoneParams(const sead::SafeString& key) const
}
return nullptr;
}
+#endif
} // namespace ksys::act
diff --git a/src/KingSystem/ActorSystem/actActorCreator.cpp b/src/KingSystem/ActorSystem/actActorCreator.cpp
index e3203b5e..fc5a54c0 100644
--- a/src/KingSystem/ActorSystem/actActorCreator.cpp
+++ b/src/KingSystem/ActorSystem/actActorCreator.cpp
@@ -166,7 +166,8 @@ bool ActorCreator::requestCreateActor(const char* name, sead::Heap* heap, BasePr
return requestCreateActor_(actor_class, name, heap, map_object, handle, task_lane_id, params);
}
-// NON_MATCHING: OffsetList iteration
+// OffsetList iteration
+#ifdef NON_MATCHING
void ActorCreator::enableDistanceUnloadChecks() {
const auto lock = sead::makeScopedLock(mActorListCS);
for (auto it = mActorList.robustBegin(); it != mActorList.robustEnd(); ++it) {
@@ -176,6 +177,7 @@ void ActorCreator::enableDistanceUnloadChecks() {
}
mEnableDistanceChecks = true;
}
+#endif
void ActorCreator::eraseActor(Actor* actor) {
const auto lock = sead::makeScopedLock(mActorListCS);
diff --git a/src/KingSystem/ActorSystem/actActorParamMgr.cpp b/src/KingSystem/ActorSystem/actActorParamMgr.cpp
index e2ace0d4..3e8d4317 100644
--- a/src/KingSystem/ActorSystem/actActorParamMgr.cpp
+++ b/src/KingSystem/ActorSystem/actActorParamMgr.cpp
@@ -175,7 +175,8 @@ ActorParam* ActorParamMgr::allocParam(const char* actor_name, bool* allocated_ne
return param;
}
-// NON_MATCHING: addressing mode
+// addressing mode
+#ifdef NON_MATCHING
ActorParam* ActorParamMgr::getParam(const char* actor_name, ActorParam** out_free_param) const {
auto lock = sead::makeScopedLock(mCS);
for (s32 i = 0; i < NumParams; ++i) {
@@ -189,6 +190,7 @@ ActorParam* ActorParamMgr::getParam(const char* actor_name, ActorParam** out_fre
}
return nullptr;
}
+#endif
ActorParam* ActorParamMgr::loadParam(const char* actor_name, res::Handle* pack_handle, void* x,
u32 load_req_c) {
@@ -291,7 +293,8 @@ bool ActorParamMgr::loadFileAsync(ActorParam* param, ActorParam::ResourceType ty
return true;
}
-// NON_MATCHING: different address calculation for static_cast<ParamIO*>(res)->getPath()
+// different address calculation for static_cast<ParamIO*>(res)->getPath()
+#ifdef NON_MATCHING
template <typename T>
T* ActorParamMgr::handleAsyncFileLoad(ActorParam* param, s32* idx, ActorParam::ResourceType type,
void*) {
@@ -329,6 +332,7 @@ T* ActorParamMgr::handleAsyncFileLoad(ActorParam* param, s32* idx, ActorParam::R
return res;
}
+#endif
bool ActorParamMgr::finishLoadingActorLink(ActorParam* param, void* x) {
s32 idx = 0;
diff --git a/src/KingSystem/ActorSystem/actActorUtil.cpp b/src/KingSystem/ActorSystem/actActorUtil.cpp
index 24fb1011..443e4046 100644
--- a/src/KingSystem/ActorSystem/actActorUtil.cpp
+++ b/src/KingSystem/ActorSystem/actActorUtil.cpp
@@ -113,7 +113,8 @@ bool hasOneTagAtLeast(const ActorConstDataAccess& accessor, const sead::SafeStri
return false;
}
-// NON_MATCHING: this version doesn't have unnecessary register moves.
+// this version doesn't have unnecessary register moves.
+#ifdef NON_MATCHING
bool shouldSkipSpawnWhenRaining(map::Object* obj) {
if (obj->getFlags().isOff(map::Object::Flag::CreateNotRain))
return false;
@@ -124,6 +125,7 @@ bool shouldSkipSpawnWhenRaining(map::Object* obj) {
const auto pos = obj->getTranslate();
return !world::Manager::instance()->isRaining(pos);
}
+#endif
bool shouldSkipSpawnIfGodForestOff(map::Object* obj) {
bool value = false;
@@ -177,7 +179,8 @@ auto initSpawnConditionGameDataFlags_dummy() {
return sIsGetStopTimerLv2Handle;
}
-// NON_MATCHING: redundant branches in the original code.
+// redundant branches in the original code.
+#ifdef NON_MATCHING
bool hasAnyRevivalTag(const sead::SafeString& actor) {
auto* info = InfoData::instance();
al::ByamlIter iter;
@@ -198,6 +201,7 @@ bool hasAnyRevivalTag(const sead::SafeString& actor) {
}
return false;
}
+#endif
bool hasStopTimerMiddleTag(Actor* actor) {
return hasTag(actor, tags::StopTimerMiddle);
@@ -207,10 +211,12 @@ bool hasStopTimerShortTag(Actor* actor) {
return hasTag(actor, tags::StopTimerShort);
}
-// NON_MATCHING: ???
+// ???
+#ifdef NON_MATCHING
const char* arrowTypeToString(ArrowType idx) {
return sArrowTypes[u32(idx)];
}
+#endif
ArrowType arrowTypeFromString(const sead::SafeString& name) {
for (s32 i = 0; i < sArrowTypes.size(); ++i) {
diff --git a/src/KingSystem/ActorSystem/actAiClassDef.cpp b/src/KingSystem/ActorSystem/actAiClassDef.cpp
index 378d2248..064aa883 100644
--- a/src/KingSystem/ActorSystem/actAiClassDef.cpp
+++ b/src/KingSystem/ActorSystem/actAiClassDef.cpp
@@ -42,7 +42,8 @@ void AIClassDef::init(const sead::SafeString& aidef_file_name, sead::Heap* heap)
mData->load(heap);
}
-// NON_MATCHING: not trying to match the heap sort. The rest should be equivalent
+// not trying to match the heap sort. The rest should be equivalent
+#ifdef NON_MATCHING
bool AIClassDef::Data::load(sead::Heap* heap) {
root_iter.tryGetIterByKey(&iters[s32(AIDefType::AI)], str_AIs);
root_iter.tryGetIterByKey(&iters[s32(AIDefType::Action)], str_Actions);
@@ -82,6 +83,7 @@ bool AIClassDef::Data::load(sead::Heap* heap) {
return true;
}
+#endif
s32 AIClassDef::getRawDefIdx(const sead::SafeString& def_name, AIDefType type) const {
const auto hash = sead::HashCRC32::calcStringHash(def_name);
@@ -137,7 +139,8 @@ void AIClassDef::getDef(const sead::SafeString& class_name, AIDefSet* set,
data->inst_params_key_idx[s32(AIDefInstParamKind::AITree)]);
}
-// NON_MATCHING: CalcTiming ifs are reordered
+// CalcTiming ifs are reordered
+#ifdef NON_MATCHING
void AIClassDef::doGetDef(AIDef* def, const al::ByamlIter& iter, AIDefInstParamKind param_kind,
AIDefType class_type, s32 key_idx) const {
def->no_stop = false;
@@ -259,6 +262,7 @@ void AIClassDef::doGetDef(AIDef* def, const al::ByamlIter& iter, AIDefInstParamK
++def->num_params;
}
}
+#endif
void AIClassDef::getDef(AIDef* def, const sead::SafeString& class_name,
AIDefInstParamKind param_kind, AIDefType class_type) const {
diff --git a/src/KingSystem/ActorSystem/actBaseProc.cpp b/src/KingSystem/ActorSystem/actBaseProc.cpp
index 528766d3..545618a2 100644
--- a/src/KingSystem/ActorSystem/actBaseProc.cpp
+++ b/src/KingSystem/ActorSystem/actBaseProc.cpp
@@ -155,7 +155,8 @@ BaseProc::PreDeletePrepareResult BaseProc::prepareForPreDelete_() {
return PreDeletePrepareResult::Done;
}
-// NON_MATCHING: branching
+// branching
+#ifdef NON_MATCHING
bool BaseProc::startPreparingForPreDelete_() {
if (mUpdateStateListNode.isLinked())
return false;
@@ -163,6 +164,7 @@ bool BaseProc::startPreparingForPreDelete_() {
return !mBaseProcLinkData || mBaseProcLinkData->refCount() <= 0 ||
BaseProcMgr::instance()->getUnk3() || tera::checkTeraSystemStatus();
}
+#endif
void BaseProc::destruct_(int should_destruct) {
if (should_destruct == 1) {
@@ -346,7 +348,8 @@ void BaseProc::jobInvoked(JobType type) {
}
}
-// NON_MATCHING: branching
+// branching
+#ifdef NON_MATCHING
bool BaseProc::processStateUpdate(u8 counter) {
const bool delete_requested = mStateFlags.isOn(StateFlags::RequestDelete);
const bool initialized = mFlags.isOn(Flags::Initialized);
@@ -444,6 +447,7 @@ bool BaseProc::processStateUpdate(u8 counter) {
mStateFlags = new_flags;
return ret;
}
+#endif
void BaseProc::processPreDelete() {
if (!mFlags.isOn(Flags::Initialized))
diff --git a/src/KingSystem/ActorSystem/actBaseProcJobQue.cpp b/src/KingSystem/ActorSystem/actBaseProcJobQue.cpp
index efa623a1..6803f6bd 100644
--- a/src/KingSystem/ActorSystem/actBaseProcJobQue.cpp
+++ b/src/KingSystem/ActorSystem/actBaseProcJobQue.cpp
@@ -80,7 +80,8 @@ bool BaseProcJobQue::pushJobs(sead::FixedSizeJQ* queue, BaseProcJobLists* lists,
return true;
}
-// NON_MATCHING: sxtw + madd -> smaddl
+// sxtw + madd -> smaddl
+#ifdef NON_MATCHING
bool BaseProcJobQue::pushExtraJobs(sead::FixedSizeJQ* queue, BaseProcJobLists* lists, int priority,
JobType type) {
const auto& list = lists->getList(priority);
@@ -104,6 +105,7 @@ bool BaseProcJobQue::pushExtraJobs(sead::FixedSizeJQ* queue, BaseProcJobLists* l
return true;
}
+#endif
bool BaseProcJobQue::pushExtraJobs(sead::FixedSizeJQ* queue,
const agl::utl::AtomicPtrArray<BaseProcJobLink>& links) {
diff --git a/src/KingSystem/ActorSystem/actBaseProcMgr.cpp b/src/KingSystem/ActorSystem/actBaseProcMgr.cpp
index a3ca8407..d3e84e17 100644
--- a/src/KingSystem/ActorSystem/actBaseProcMgr.cpp
+++ b/src/KingSystem/ActorSystem/actBaseProcMgr.cpp
@@ -40,7 +40,8 @@ BaseProcMgr::~BaseProcMgr() {
BaseProcHeapMgr::deleteInstance();
}
-// NON_MATCHING: mJobLists.allocBufferAssert - BaseProcJobLists ctor
+// mJobLists.allocBufferAssert - BaseProcJobLists ctor
+#ifdef NON_MATCHING
void BaseProcMgr::init(sead::Heap* heap, s32 num_job_types, u32 main_thread_id,
u32 havok_thread_id1, u32 havok_thread_id2,
const BaseProcInitializerArgs& initializer_args) {
@@ -66,6 +67,7 @@ void BaseProcMgr::init(sead::Heap* heap, s32 num_job_types, u32 main_thread_id,
BaseProcHeapMgr::createInstance(heap);
BaseProcLinkDataMgr::createInstance(heap);
}
+#endif
void BaseProcMgr::generateProcId(u32* id) {
*id = mCreatedProcCounter.increment();
@@ -529,7 +531,8 @@ BaseProc* BaseProcMgr::getProc(const u32& id, BaseProcMgr::ProcFilters filters)
return proc;
}
-// NON_MATCHING: stack
+// stack
+#ifdef NON_MATCHING
void BaseProcMgr::forEachProc(sead::IDelegate1<BaseProc*>& callback, ProcFilters filters) {
const auto lock = sead::makeScopedLock(mProcMapCS);
@@ -542,6 +545,7 @@ void BaseProcMgr::forEachProc(sead::IDelegate1<BaseProc*>& callback, ProcFilters
mProcMap.forEach(sead::Delegate1<ProcForEachContext, util::StrTreeMapNode*>(
&context, &ProcForEachContext::forEach));
}
+#endif
void BaseProcMgr::forEachProc(const sead::SafeString& proc_name,
sead::IDelegate1<BaseProc*>& callback,
@@ -633,12 +637,15 @@ void BaseProcMgr::decrementUnk3() {
--mUnk3;
}
-// NON_MATCHING: reorderings
+// reorderings
+#ifdef NON_MATCHING
void BaseProcMgr::queueExtraJobPush(BaseProcJobLink* job_link) {
getExtraJobs().pushBack(job_link);
}
+#endif
-// NON_MATCHING: ???
+// ???
+#ifdef NON_MATCHING
void BaseProcMgr::moveExtraJobsToOtherBuffer(JobType type) {
const auto old_idx = mCurrentExtraJobArrayIdx;
swapExtraJobArray();
@@ -647,6 +654,7 @@ void BaseProcMgr::moveExtraJobsToOtherBuffer(JobType type) {
link.getProc()->queueExtraJobPush_(type, mCurrentExtraJobArrayIdx);
}
}
+#endif
bool BaseProcMgr::hasExtraJobLink(BaseProcJobLink* job_link, s32 idx) {
for (auto& ptr : mExtraJobLinkArrays.ref()[idx]) {
diff --git a/src/KingSystem/ActorSystem/actInstParamPack.cpp b/src/KingSystem/ActorSystem/actInstParamPack.cpp
index a943cd06..1bf45cac 100644
--- a/src/KingSystem/ActorSystem/actInstParamPack.cpp
+++ b/src/KingSystem/ActorSystem/actInstParamPack.cpp
@@ -9,7 +9,8 @@ void InstParamPack::Buffer::clear() {
mData.fill(0);
}
-// NON_MATCHING: write()
+// write()
+#ifdef NON_MATCHING
void InstParamPack::Buffer::add(const void* data, const sead::SafeString& name, s32 byte_size,
InstParamPack::EntryType type) {
if (byte_size + mPosition + u32(sizeof(const char*)) + 1 > mData.getByteSize()) {
@@ -22,13 +23,16 @@ void InstParamPack::Buffer::add(const void* data, const sead::SafeString& name,
writeBytes(data, byte_size);
++mNumItems;
}
+#endif
-// NON_MATCHING: write()
+// write()
+#ifdef NON_MATCHING
void InstParamPack::Buffer::add(ActorCallback* callback, const sead::SafeString& name) {
add(callback, name, sizeof(callback), EntryType::UInt64);
}
+#endif
-// NON_MATCHING
+#ifdef NON_MATCHING
bool InstParamPack::Buffer::pop(s32* position, InstParamPack::Entry* out_entry) {
if (!read(out_entry->key, position))
return false;
@@ -67,6 +71,7 @@ bool InstParamPack::Buffer::pop(s32* position, InstParamPack::Entry* out_entry)
return false;
}
}
+#endif
InstParamPack::Buffer& InstParamPack::Buffer::operator=(const InstParamPack::Buffer& other) {
size_t pos = other.mPosition;