mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-22 04:01:17 +00:00
Flymode works.
This commit is contained in:
parent
b58329b37a
commit
226ab58a84
5 changed files with 68 additions and 14 deletions
|
@ -95,6 +95,7 @@ void CL_PredictUsercmd (player_state_t *from, player_state_t *to, usercmd_t *u,
|
|||
pmove.waterjumptime = from->waterjumptime;
|
||||
pmove.dead = cl.stats[STAT_HEALTH] <= 0;
|
||||
pmove.spectator = spectator;
|
||||
pmove.flying = cl.stats[STAT_FLYMODE];
|
||||
|
||||
pmove.cmd = *u;
|
||||
|
||||
|
|
|
@ -232,6 +232,51 @@ int PM_FlyMove (void)
|
|||
return blocked;
|
||||
}
|
||||
|
||||
|
||||
void PM_Accelerate (vec3_t, float, float);
|
||||
|
||||
/*
|
||||
PM_FlymodeMove
|
||||
|
||||
Pre-PM_FlyMove function for MOVETYPE_FLY players. Could have altered
|
||||
other physics to fit this in, but that's to easy to screw up. --KB
|
||||
*/
|
||||
void
|
||||
PM_FlymodeMove ( void )
|
||||
{
|
||||
vec3_t start, dest, pmvel, pmtmp;
|
||||
pmtrace_t trace;
|
||||
float pmspeed;
|
||||
|
||||
pmvel[0] = forward[0]*pmove.cmd.forwardmove + right[0]*pmove.cmd.sidemove;
|
||||
pmvel[1] = forward[1]*pmove.cmd.forwardmove + right[1]*pmove.cmd.sidemove;
|
||||
pmvel[2] = forward[2]*pmove.cmd.forwardmove + right[2]*pmove.cmd.sidemove
|
||||
+ pmove.cmd.upmove;
|
||||
|
||||
VectorCopy (pmvel, pmtmp);
|
||||
pmspeed = VectorNormalize(pmtmp); // don't alter pmvel
|
||||
|
||||
if (pmspeed > movevars.maxspeed) // there IS a spoon, Neo..
|
||||
{
|
||||
VectorScale (pmvel, movevars.maxspeed / pmspeed, pmvel);
|
||||
pmspeed = movevars.maxspeed;
|
||||
}
|
||||
PM_Accelerate (pmtmp, pmspeed, movevars.wateraccelerate);
|
||||
|
||||
VectorMA (pmove.origin, frametime, pmove.velocity, dest);
|
||||
VectorCopy (dest, start);
|
||||
start[2] += STEPSIZE + 1;
|
||||
trace = PM_PlayerMove (start, dest);
|
||||
if (!trace.startsolid && !trace.allsolid)
|
||||
{
|
||||
VectorCopy (trace.endpos, pmove.origin);
|
||||
return; // just step up
|
||||
}
|
||||
|
||||
PM_FlyMove (); // NOW we fly.
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
PM_GroundMove
|
||||
|
@ -332,7 +377,7 @@ Handles both ground friction and water friction
|
|||
void PM_Friction (void)
|
||||
{
|
||||
float *vel;
|
||||
float speed, newspeed, control;
|
||||
float speed, newspeed;
|
||||
float friction;
|
||||
float drop;
|
||||
vec3_t start, stop;
|
||||
|
@ -371,12 +416,10 @@ void PM_Friction (void)
|
|||
|
||||
if (waterlevel >= 2) // apply water friction
|
||||
drop += speed*movevars.waterfriction*waterlevel*frametime;
|
||||
else if (pmove.flying) // apply flying friction
|
||||
drop += max(movevars.stopspeed, speed) * friction * frametime;
|
||||
else if (onground != -1) // apply ground friction
|
||||
{
|
||||
control = speed < movevars.stopspeed ? movevars.stopspeed : speed;
|
||||
drop += control*friction*frametime;
|
||||
}
|
||||
|
||||
drop += max(movevars.stopspeed, speed) * friction * frametime;
|
||||
|
||||
// scale the velocity
|
||||
newspeed = speed - drop;
|
||||
|
@ -550,9 +593,12 @@ void PM_AirMove (void)
|
|||
PM_Accelerate (wishdir, wishspeed, movevars.accelerate);
|
||||
pmove.velocity[2] -= movevars.entgravity * movevars.gravity * frametime;
|
||||
PM_GroundMove ();
|
||||
}
|
||||
else
|
||||
{ // not on ground, so little effect on velocity
|
||||
} else if (pmove.flying)
|
||||
{
|
||||
PM_AirAccelerate (wishdir, wishspeed, movevars.accelerate);
|
||||
PM_FlyMove ();
|
||||
} else {
|
||||
// not on ground, so little effect on velocity
|
||||
PM_AirAccelerate (wishdir, wishspeed, movevars.accelerate);
|
||||
|
||||
// add gravity
|
||||
|
@ -702,7 +748,7 @@ void CheckWaterJump (void)
|
|||
int cont;
|
||||
vec3_t flatforward;
|
||||
|
||||
if (pmove.waterjumptime)
|
||||
if (pmove.waterjumptime || pmove.flying)
|
||||
return;
|
||||
|
||||
// ZOID, don't hop out if we just jumped in
|
||||
|
@ -900,6 +946,8 @@ void PlayerMove (void)
|
|||
|
||||
if (waterlevel >= 2)
|
||||
PM_WaterMove ();
|
||||
else if (pmove.flying)
|
||||
PM_FlymodeMove ();
|
||||
else
|
||||
PM_AirMove ();
|
||||
|
||||
|
|
|
@ -1374,12 +1374,12 @@ void SV_InitLocal (void)
|
|||
for (i=0 ; i<MAX_MODELS ; i++)
|
||||
sprintf (localmodels[i], "*%i", i);
|
||||
|
||||
Info_SetValueForStarKey (svs.info, "*qf_version", QF_VERSION,
|
||||
MAX_SERVERINFO_STRING);
|
||||
// Info_SetValueForStarKey (svs.info, "*qf_version", QF_VERSION,
|
||||
// MAX_SERVERINFO_STRING);
|
||||
Info_SetValueForStarKey (svs.info, "*version", QW_VERSION,
|
||||
MAX_SERVERINFO_STRING);
|
||||
Info_SetValueForStarKey (svs.info, "*qsg_standard", QSG_STANDARD,
|
||||
MAX_SERVERINFO_STRING);
|
||||
// Info_SetValueForStarKey (svs.info, "*qsg_standard", QSG_STANDARD,
|
||||
// MAX_SERVERINFO_STRING);
|
||||
|
||||
// init fraglog stuff
|
||||
svs.logsequence = 1;
|
||||
|
|
|
@ -549,6 +549,10 @@ void SV_UpdateClientStats (client_t *client)
|
|||
// stuff the sigil bits into the high bits of items for sbar
|
||||
stats[STAT_ITEMS] = (int)ent->v.items | ((int)pr_global_struct->serverflags << 28);
|
||||
|
||||
// Extensions to the QW 2.40 protocol for MegaTF --KB
|
||||
stats[STAT_VIEWHEIGHT] = (int)ent->v.view_ofs[2];
|
||||
stats[STAT_FLYMODE] = (ent->v.movetype == MOVETYPE_FLY);
|
||||
|
||||
for (i=0 ; i<MAX_CL_STATS ; i++)
|
||||
if (stats[i] != client->stats[i])
|
||||
{
|
||||
|
|
|
@ -1435,6 +1435,7 @@ void SV_RunCmd (usercmd_t *ucmd)
|
|||
VectorCopy (sv_player->v.velocity, pmove.velocity);
|
||||
VectorCopy (sv_player->v.v_angle, pmove.angles);
|
||||
|
||||
pmove.flying = sv_player->v.movetype == MOVETYPE_FLY;
|
||||
pmove.spectator = host_client->spectator;
|
||||
pmove.waterjumptime = sv_player->v.teleport_time;
|
||||
pmove.numphysent = 1;
|
||||
|
|
Loading…
Reference in a new issue