summaryrefslogtreecommitdiff
path: root/src/KingSystem/ActorSystem/actActorUtil.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-04-04 18:20:42 +0200
committerLéo Lam <leo@leolam.fr>2021-04-07 18:46:55 +0200
commit2cf1e01137b043990991ef720de15d69781c998b (patch)
tree6f9d903bf183bb120ad9ccedc7b31ce09df5b967 /src/KingSystem/ActorSystem/actActorUtil.cpp
parentcdd2a501a0a1098fdd75e3817c80bc99a4cf7d4e (diff)
ksys/gdt: Implement more TriggerParam functions and StageInfo
Diffstat (limited to 'src/KingSystem/ActorSystem/actActorUtil.cpp')
-rw-r--r--src/KingSystem/ActorSystem/actActorUtil.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/KingSystem/ActorSystem/actActorUtil.cpp b/src/KingSystem/ActorSystem/actActorUtil.cpp
index 16ab1640..8f24330e 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 <math/seadMathCalcCommon.h>
#include "KingSystem/ActorSystem/Profiles/actRopeBase.h"
#include "KingSystem/ActorSystem/actActor.h"
#include "KingSystem/ActorSystem/actActorConstDataAccess.h"
@@ -525,6 +526,30 @@ bool isAirOctaWoodPlatformDlc(const sead::SafeString& name) {
name == "FldObj_DLC_FlyShield_Wood_A_Snow_02";
}
+void getRevivalGridPosition(const sead::Vector3f& pos, int* col1, int* row1, int* col2, int* row2) {
+ const int col = sead::clamp((int(pos.x) + 5000) / 1000, 0, 9);
+ const int row = sead::clamp((int(pos.z) + 4000) / 1000, 0, 7);
+
+ const auto x = (float(col) + 0.5f) * 1000.0f - 5000.0f;
+ const auto z = (float(row) + 0.5f) * 1000.0f - 4000.0f;
+
+ if (x < pos.x) {
+ *col1 = col;
+ *col2 = col + 1;
+ } else {
+ *col1 = col - 1;
+ *col2 = col;
+ }
+
+ if (z < pos.z) {
+ *row1 = row;
+ *row2 = row + 1;
+ } else {
+ *row1 = row - 1;
+ *row2 = row;
+ }
+}
+
bool getSameGroupActorName(sead::SafeString* name, BaseProcLink* link) {
return getAccessor(link).getSameGroupActorName(name);
}