summaryrefslogtreecommitdiffstats
path: root/src/World.h
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-21 11:09:09 +0200
committeraap <aap@papnet.eu>2019-06-21 11:11:29 +0200
commita9bcd1b7c5a91c0def1101223064651d538a00b2 (patch)
tree4d117f4ef2f65af36732ca17532873ca219a6d1a /src/World.h
parentMerge pull request #27 from gennariarmando/master (diff)
downloadre3-a9bcd1b7c5a91c0def1101223064651d538a00b2.tar
re3-a9bcd1b7c5a91c0def1101223064651d538a00b2.tar.gz
re3-a9bcd1b7c5a91c0def1101223064651d538a00b2.tar.bz2
re3-a9bcd1b7c5a91c0def1101223064651d538a00b2.tar.lz
re3-a9bcd1b7c5a91c0def1101223064651d538a00b2.tar.xz
re3-a9bcd1b7c5a91c0def1101223064651d538a00b2.tar.zst
re3-a9bcd1b7c5a91c0def1101223064651d538a00b2.zip
Diffstat (limited to 'src/World.h')
-rw-r--r--src/World.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/World.h b/src/World.h
index 9a8a0c46..b099583b 100644
--- a/src/World.h
+++ b/src/World.h
@@ -7,8 +7,20 @@
/* Sectors span from -2000 to 2000 in x and y.
* With 100x100 sectors, each is 40x40 units. */
-#define NUMSECTORS_X 100
-#define NUMSECTORS_Y 100
+#define SECTOR_SIZE_X (40.0f)
+#define SECTOR_SIZE_Y (40.0f)
+
+#define NUMSECTORS_X (100)
+#define NUMSECTORS_Y (100)
+
+#define WORLD_SIZE_X (NUMSECTORS_X * SECTOR_SIZE_X)
+#define WORLD_SIZE_Y (NUMSECTORS_Y * SECTOR_SIZE_Y)
+
+#define WORLD_MIN_X (-2000.0f)
+#define WORLD_MIN_Y (-2000.0f)
+
+#define WORLD_MAX_X (WORLD_MIN_X + WORLD_SIZE_X)
+#define WORLD_MAX_Y (WORLD_MIN_Y + WORLD_SIZE_Y)
enum
{
@@ -85,12 +97,12 @@ public:
static float FindGroundZFor3DCoord(float x, float y, float z, bool *found);
static float FindRoofZFor3DCoord(float x, float y, float z, bool *found);
- static float GetSectorX(float f) { return ((f + 2000.0f)/40.0f); }
- static float GetSectorY(float f) { return ((f + 2000.0f)/40.0f); }
+ static float GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); }
+ static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); }
static int GetSectorIndexX(float f) { return (int)GetSectorX(f); }
static int GetSectorIndexY(float f) { return (int)GetSectorY(f); }
- static float GetWorldX(int x) { return x*40.0f - 2000.0f; }
- static float GetWorldY(int y) { return y*40.0f - 2000.0f; }
+ static float GetWorldX(int x) { return x*SECTOR_SIZE_X + WORLD_MIN_X; }
+ static float GetWorldY(int y) { return y*SECTOR_SIZE_Y + WORLD_MIN_Y; }
};
class CPed;