higher resolution for waterlevel

Interpret the waterlevel value as tenths of a cube.

This makes the waterlevel variable a float value to the user, while the
map file still stores an integer value - but now it is interpreted
differently - for example, a waterlevel value of 123 now means 12.3 cubes
instead of 123. Old map files are converted during loading.

Note: the values of waterlevel and hdr.waterlevel need to be in sync.

DOCREF waterlevel
This commit is contained in:
ac-stef
2015-05-18 14:59:41 +02:00
parent b1b789eefc
commit ea480a7b0c
15 changed files with 39 additions and 32 deletions
+1 -1
View File
@@ -1744,7 +1744,7 @@ bool CBot::WaterNav()
if (UnderWater(v)) continue; // Skip, cube is underwater
if (hdr.waterlevel < (v.z - 2.0f)) continue; // Cube is too high
if (waterlevel < (v.z - 2.0f)) continue; // Cube is too high
// Check if the bot 'can fit' on the cube(no near obstacles)
bool small_ = false;
+2 -2
View File
@@ -17,8 +17,8 @@ bool FileIsOlder(const char *szFileName1, const char *szFileName2);
vec PredictPos(vec pos, vec vel, float Time);
vec Normalize(vec v);
inline void makevec(vec *v, float x, float y, float z) { v->x=x; v->y=y; v->z=z; }
inline bool UnderWater(const vec &o) { return hdr.waterlevel>o.z-0.5f; }
inline bool InWater(const vec &o) { return hdr.waterlevel>=o.z; }
inline bool UnderWater(const vec &o) { return waterlevel > o.z - 0.5f; }
inline bool InWater(const vec &o) { return waterlevel >= o.z; }
float GetYawDiff(float curyaw, vec v1, vec v2);
vec CrossProduct(const vec &a, const vec &b);
int GetDirection(const vec &angles, const vec &v1, const vec &v2);