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
+3 -3
View File
@@ -328,7 +328,7 @@ void resizephysent(physent *pl, int moveres, int curtime, float min, float max)
{
if(pl->eyeheightvel==0.0f) return;
const bool water = hdr.waterlevel>pl->o.z;
const bool water = waterlevel > pl->o.z;
const float speed = curtime*pl->maxspeed/(water ? 2000.0f : 1000.0f);
float h = pl->eyeheightvel * speed / moveres;
@@ -391,7 +391,7 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime)
if(pl->type==ENT_BOUNCE)
{
bounceent* bounce = (bounceent *) pl;
water = hdr.waterlevel>pl->o.z;
water = waterlevel > pl->o.z;
const float speed = curtime*pl->maxspeed/(water ? 2000.0f : 1000.0f);
const float friction = water ? 20.0f : (pl->onfloor || isfly ? 6.0f : 30.0f);
@@ -423,7 +423,7 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime)
{
const int timeinair = pl->timeinair;
int move = pl->onladder && !pl->onfloor && pl->move == -1 ? 0 : pl->move; // movement on ladder
if(!editfly) water = hdr.waterlevel>pl->o.z-0.5f;
if(!editfly) water = waterlevel > pl->o.z - 0.5f;
float chspeed = 0.4f;
if(!(pl->onfloor || pl->onladder)) chspeed = 1.0f;