physents gravity corrected, fixed nade sounds on water transition

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2052 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-05-19 18:58:17 +00:00
parent 0980a15235
commit 215b661ab0
3 changed files with 11 additions and 12 deletions
-1
View File
@@ -656,7 +656,6 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
{
player1->state = CS_SPECTATE;
player1->spectatemode = SM_NONE;
//togglespect();
}
else
{
+6 -10
View File
@@ -272,14 +272,14 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime)
}
else // apply gravity
{
const float gravity = 9.81f*bounce->maxspeed/1000.0f;
const float heightvel = (gravity)*pow(speed, 2.0f);
bounce->vel.z -= heightvel;
const float CUBES_PER_METER = 4; // assumes 4 cubes make up 1 meter
const float GRAVITY = 9.81f/CUBES_PER_METER/1000.0f;
bounce->vel.z -= GRAVITY*curtime;
}
d = bounce->vel;
d.mul(speed);
if(water) d.div(6.0f);
if(water) d.div(6.0f); // incorrect
// rotate
float rotspeed = bounce->rotspeed*d.magnitude();
@@ -480,18 +480,14 @@ const int PHYSFPS = 200;
const int PHYSFRAMETIME = 1000 / PHYSFPS;
int physicsfraction = 0, physicsrepeat = 0;
void playerphysicsframe() // optimally schedule physics frames inside the graphics frames
// optimally schedule physics frames inside the graphics frames
void physicsframe()
{
int faketime = curtime+physicsfraction;
physicsrepeat = faketime/PHYSFRAMETIME;
physicsfraction = faketime%PHYSFRAMETIME;
}
void physicsframe()
{
playerphysicsframe();
}
void moveplayer(physent *p, int moveres, bool local)
{
loopi(physicsrepeat) moveplayer(p, moveres, local, PHYSFRAMETIME);
+5 -1
View File
@@ -296,7 +296,7 @@ void renderbounceents()
VARP(gib, 0, 1, 1);
VARP(gibnum, 0, 6, 1000);
VARP(gibttl, 0, 5000, 15000);
VARP(gibttl, 0, 7000, 60000);
VARP(gibspeed, 1, 30, 100);
void addgib(playerent *d)
@@ -314,6 +314,7 @@ void addgib(playerent *d)
p->o = d->o;
p->o.z -= d->aboveeye;
p->inwater = hdr.waterlevel>p->o.z;
p->yaw = (float)rnd(360);
p->pitch = (float)rnd(360);
@@ -546,6 +547,7 @@ grenadeent::grenadeent (playerent *owner, int millis)
bouncetype = BT_NADE;
maxspeed = 27.0f;
rotspeed = 6.0f;
}
void grenadeent::explode()
@@ -599,6 +601,7 @@ void grenadeent::_throw(const vec &from, const vec &vel)
nadestate = NS_THROWED;
this->vel = vel;
this->o = from;
inwater = hdr.waterlevel>o.z;
if(local)
{
@@ -612,6 +615,7 @@ void grenadeent::moveoutsidebbox(const vec &direction, playerent *boundingbox)
{
vel = direction;
o = boundingbox->o;
inwater = hdr.waterlevel>o.z;
boundingbox->cancollide = false;
loopi(10) moveplayer(this, 10, true, 10);