summaryrefslogtreecommitdiff
path: root/src/KingSystem/Ecosystem/ecoSystem.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-04-29 17:14:14 +0200
committerLéo Lam <leo@leolam.fr>2021-04-30 11:47:13 +0200
commitb39e0e5be38d01b57608024988a18f7717cbe361 (patch)
tree68b603f2a5197c730ac5879f0c18c3576fc84a32 /src/KingSystem/Ecosystem/ecoSystem.cpp
parent34c85c322ee38d77fa32144a0b382763b9b45971 (diff)
ksys/world: Start implementing WorldMgr
Diffstat (limited to 'src/KingSystem/Ecosystem/ecoSystem.cpp')
-rw-r--r--src/KingSystem/Ecosystem/ecoSystem.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/KingSystem/Ecosystem/ecoSystem.cpp b/src/KingSystem/Ecosystem/ecoSystem.cpp
index 96680112..42da40ac 100644
--- a/src/KingSystem/Ecosystem/ecoSystem.cpp
+++ b/src/KingSystem/Ecosystem/ecoSystem.cpp
@@ -30,28 +30,28 @@ SEAD_SINGLETON_DISPOSER_IMPL(Ecosystem)
void Ecosystem::calc() {}
// NON_MATCHING: FP instructions rearranged.
-s32 Ecosystem::getCurrentAreaNum(EcoMapInfo* info, f32 posX, f32 posZ) const {
+s32 Ecosystem::getMapArea(const EcoMapInfo& info, f32 posX, f32 posZ) const {
posX = sead::clamp(posX, -5000.0F, 4999.0F);
posZ = sead::clamp(posZ, -4000.0F, 4000.0F);
f32 epsilon1 = (posX + 5000.0F >= 0.0F) ? 0.5F : -0.5F;
f32 epsilon2 = (posZ + 4000.0F >= 0.0F) ? 0.5F : -0.5F;
s32 x = posX + 5000.0F + epsilon1;
- s32 z = (posZ + 4000.0F + epsilon2) / info->mHeader->divisor;
+ s32 z = (posZ + 4000.0F + epsilon2) / info.mHeader->divisor;
- s32 row = sead::clamp(z, (s32)0, info->mHeader->num_rows - 2);
+ s32 row = sead::clamp(z, (s32)0, info.mHeader->num_rows - 2);
- if (info->mHeader->divisor == 10)
+ if (info.mHeader->divisor == 10)
x = x / 10;
- s32* offsets = (s32*)info->mRowOffsets + row;
+ s32* offsets = (s32*)info.mRowOffsets + row;
s32 val0 = offsets[0];
s32 val1 = offsets[1];
if (val0 >= val1)
return -1;
- Segment* segmentEnd = reinterpret_cast<Segment*>((char*)info->mRows + 2 * val1);
- Segment* segment = reinterpret_cast<Segment*>((char*)info->mRows + 2 * val0);
+ Segment* segmentEnd = reinterpret_cast<Segment*>((char*)info.mRows + 2 * val1);
+ Segment* segment = reinterpret_cast<Segment*>((char*)info.mRows + 2 * val0);
s32 totalLength = 0;
while (true) {
totalLength += segment->length;