From b7ef791035205dc3c79d4e09cc8873186906d2ad Mon Sep 17 00:00:00 2001 From: driAn Date: Sun, 4 May 2008 11:32:25 +0000 Subject: [PATCH] water movement speed fixed, xhair in editmode git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1859 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/physics.cpp | 12 ++++++++---- source/src/renderhud.cpp | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source/src/physics.cpp b/source/src/physics.cpp index c62f5986..6c1cbd18 100644 --- a/source/src/physics.cpp +++ b/source/src/physics.cpp @@ -250,10 +250,6 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime) bool water = false; const bool editfly = (editmode && local) || pl->state==CS_EDITING; const bool specfly = local && pl->type==ENT_PLAYER && ((playerent *)pl)->spectating==SM_FLY; - - const float speed = curtime/(water ? 2000.0f : 1000.0f)*pl->maxspeed*(pl->crouching ? 0.5f : 1.0f); - const float friction = water ? 20.0f : (pl->onfloor || editfly || specfly ? 6.0f : (pl->onladder ? 1.5f : 30.0f)); - const float fpsfric = friction/curtime*20.0f; vec d; // vector of direction we ideally want to move in @@ -265,6 +261,10 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime) drop = rise = 0; water = hdr.waterlevel>pl->o.z; + const float speed = curtime/(water ? 2000.0f : 1000.0f)*pl->maxspeed; + const float friction = water ? 20.0f : (pl->onfloor || editfly || specfly ? 6.0f : 30.0f); + const float fpsfric = friction/curtime*20.0f; + if(pl->onfloor) // apply friction { pl->vel.mul(fpsfric-1); @@ -292,6 +292,10 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime) int move = pl->onladder && !pl->onfloor && pl->move == -1 ? 0 : pl->move; // movement on ladder water = hdr.waterlevel>pl->o.z-0.5f; + const float speed = curtime/(water ? 2000.0f : 1000.0f)*pl->maxspeed*(pl->crouching ? 0.5f : 1.0f); + const float friction = water ? 20.0f : (pl->onfloor || editfly || specfly ? 6.0f : (pl->onladder ? 1.5f : 30.0f)); + const float fpsfric = friction/curtime*20.0f; + d.x = (float)(move*cosf(RAD*(pl->yaw-90))); d.y = (float)(move*sinf(RAD*(pl->yaw-90))); d.z = 0.0f; diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index 8b482ca1..380f3e43 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -400,7 +400,7 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat bool menu = menuvisible(); bool command = getcurcommand() ? true : false; - if(player1->state==CS_ALIVE && !player1->weaponsel->reloading && !menu) + if((player1->state==CS_ALIVE || player1->state==CS_EDITING) && !player1->weaponsel->reloading && !menu) { bool drawteamwarning = targetplayer ? (isteam(targetplayer->team, player1->team) && targetplayer->state!=CS_DEAD) : false; player1->weaponsel->renderaimhelp(drawteamwarning);