mirror of
https://github.com/Q3Rally-Team/q3rally.git
synced 2025-01-31 05:40:34 +00:00
Fix sending angles in damagePitch/damageYaw
damagePitch/damageYaw are send over the network as 8-bit but Q3Rally stored 16-bit short for angle in them. This caused CGame to have different angles than Game.
This commit is contained in:
parent
d1a0772586
commit
866db4eba5
9 changed files with 31 additions and 28 deletions
|
@ -418,8 +418,8 @@ static void CG_InterpolatePlayerState( qboolean grabAngles ) {
|
|||
*/
|
||||
|
||||
if ( !grabAngles ) {
|
||||
out->damagePitch = ANGLE2SHORT(LerpAngle( SHORT2ANGLE(prev->ps.damagePitch), SHORT2ANGLE(next->ps.damagePitch), f ));
|
||||
out->damageYaw = ANGLE2SHORT(LerpAngle( SHORT2ANGLE(prev->ps.damageYaw), SHORT2ANGLE(next->ps.damageYaw), f ));
|
||||
out->damagePitch = ANGLE2BYTE(LerpAngle( BYTE2ANGLE(prev->ps.damagePitch), BYTE2ANGLE(next->ps.damagePitch), f ));
|
||||
out->damageYaw = ANGLE2BYTE(LerpAngle( BYTE2ANGLE(prev->ps.damageYaw), BYTE2ANGLE(next->ps.damageYaw), f ));
|
||||
}
|
||||
// END
|
||||
|
||||
|
|
|
@ -690,8 +690,8 @@ static int CG_CalcViewValues( void ) {
|
|||
VectorCopy( ps->origin, cg.refdef.vieworg );
|
||||
// STONELANCE (uses new way of sending view angles)
|
||||
// VectorCopy( ps->viewangles, cg.refdefViewAngles );
|
||||
cg.refdefViewAngles[PITCH] = SHORT2ANGLE(ps->damagePitch);
|
||||
cg.refdefViewAngles[YAW] = SHORT2ANGLE(ps->damageYaw);
|
||||
cg.refdefViewAngles[PITCH] = BYTE2ANGLE(ps->damagePitch);
|
||||
cg.refdefViewAngles[YAW] = BYTE2ANGLE(ps->damageYaw);
|
||||
cg.refdefViewAngles[ROLL] = 0;
|
||||
// END
|
||||
AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
|
||||
|
@ -717,8 +717,8 @@ static int CG_CalcViewValues( void ) {
|
|||
VectorCopy( ps->viewangles, cg.refdefViewAngles );
|
||||
/*
|
||||
if (!cg_paused.integer){
|
||||
Com_Printf("pitch: angles2 %f, damage %f, viewangle %f\n", cg.predictedPlayerEntity.currentState.angles2[PITCH], SHORT2ANGLE(ps->damagePitch), ps->viewangles[PITCH]);
|
||||
Com_Printf("yaw: angles2 %f, damage %f, viewangle %f\n", cg.predictedPlayerEntity.currentState.angles2[YAW], SHORT2ANGLE(ps->damageYaw), ps->viewangles[YAW]);
|
||||
Com_Printf("pitch: angles2 %f, damage %f, viewangle %f\n", cg.predictedPlayerEntity.currentState.angles2[PITCH], BYTE2ANGLE(ps->damagePitch), ps->viewangles[PITCH]);
|
||||
Com_Printf("yaw: angles2 %f, damage %f, viewangle %f\n", cg.predictedPlayerEntity.currentState.angles2[YAW], BYTE2ANGLE(ps->damageYaw), ps->viewangles[YAW]);
|
||||
Com_Printf( "origin: %f %f %f, vel %f %f %f\n", cg.refdef.vieworg[0], cg.refdef.vieworg[1], cg.refdef.vieworg[2], ps->velocity[0], ps->velocity[1], ps->velocity[2] );
|
||||
}
|
||||
*/
|
||||
|
@ -759,8 +759,8 @@ static int CG_CalcViewValues( void ) {
|
|||
// if( !cg_paused.integer )
|
||||
// Com_Printf( "5 predictedPlayerState damageYaw %d\n", ps->damageYaw );
|
||||
|
||||
cg.refdefViewAngles[PITCH] = SHORT2ANGLE(ps->damagePitch);
|
||||
cg.refdefViewAngles[YAW] = SHORT2ANGLE(ps->damageYaw);
|
||||
cg.refdefViewAngles[PITCH] = BYTE2ANGLE(ps->damagePitch);
|
||||
cg.refdefViewAngles[YAW] = BYTE2ANGLE(ps->damageYaw);
|
||||
cg.refdefViewAngles[ROLL] = 0;
|
||||
}
|
||||
|
||||
|
@ -795,8 +795,8 @@ static int CG_CalcViewValues( void ) {
|
|||
#else
|
||||
// Use third-person mouse view (not car viewpoint)
|
||||
angles[ROLL] = 0;
|
||||
angles[PITCH] = 0; // SHORT2ANGLE(ps->damagePitch);
|
||||
angles[YAW] = SHORT2ANGLE(ps->damageYaw);
|
||||
angles[PITCH] = 0; // BYTE2ANGLE(ps->damagePitch);
|
||||
angles[YAW] = BYTE2ANGLE(ps->damageYaw);
|
||||
#endif
|
||||
|
||||
AnglesToAxis( angles, cg.mmapRefdef.viewaxis );
|
||||
|
|
|
@ -1938,8 +1938,8 @@ void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean
|
|||
}
|
||||
|
||||
// View Angles
|
||||
s->angles2[PITCH] = SHORT2ANGLE(ps->damagePitch);
|
||||
s->angles2[YAW] = SHORT2ANGLE(ps->damageYaw);
|
||||
s->angles2[PITCH] = BYTE2ANGLE(ps->damagePitch);
|
||||
s->angles2[YAW] = BYTE2ANGLE(ps->damageYaw);
|
||||
// s->angles2[YAW] = ps->movementDir;
|
||||
// END
|
||||
s->legsAnim = ps->legsAnim;
|
||||
|
@ -2065,8 +2065,8 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s
|
|||
// END
|
||||
|
||||
// View Angles
|
||||
s->angles2[PITCH] = SHORT2ANGLE(ps->damagePitch);
|
||||
s->angles2[YAW] = SHORT2ANGLE(ps->damageYaw);
|
||||
s->angles2[PITCH] = BYTE2ANGLE(ps->damagePitch);
|
||||
s->angles2[YAW] = BYTE2ANGLE(ps->damageYaw);
|
||||
// s->angles2[YAW] = ps->movementDir;
|
||||
// END
|
||||
s->legsAnim = ps->legsAnim;
|
||||
|
|
|
@ -961,7 +961,7 @@ static void PM_NoclipMove( void ) {
|
|||
VectorMA (pm->ps->origin, pml.frametime, pm->ps->velocity, pm->ps->origin);
|
||||
|
||||
// STONELANCE
|
||||
pm->ps->viewangles[YAW] = SHORT2ANGLE(pm->ps->damageYaw);
|
||||
pm->ps->viewangles[YAW] = BYTE2ANGLE(pm->ps->damageYaw);
|
||||
PM_InitializeVehicle(pm->car, pm->ps->origin, pm->ps->viewangles, pm->ps->velocity /* , pm->car_frontweight_dist */ );
|
||||
// END
|
||||
}
|
||||
|
@ -2403,10 +2403,10 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd, int controlMo
|
|||
// STONELANCE use damage yaw and pitch for view angles
|
||||
if (controlMode == CT_MOUSE){
|
||||
if (i == PITCH){
|
||||
ps->damagePitch = temp;
|
||||
ps->damagePitch = ANGLE2BYTE( SHORT2ANGLE( temp ) );
|
||||
}
|
||||
if (i == YAW){
|
||||
ps->damageYaw = temp;
|
||||
ps->damageYaw = ANGLE2BYTE( SHORT2ANGLE( temp ) );
|
||||
}
|
||||
}
|
||||
// END
|
||||
|
@ -2519,8 +2519,8 @@ void PmoveSingle (pmove_t *pmove) {
|
|||
PM_UpdateViewAngles( pm->ps, &pm->cmd, pm->controlMode );
|
||||
|
||||
// AngleVectors (pm->ps->viewangles, pml.forward, pml.right, pml.up);
|
||||
delta[YAW] = SHORT2ANGLE(pm->ps->damageYaw);
|
||||
delta[PITCH] = SHORT2ANGLE(pm->ps->damagePitch);
|
||||
delta[YAW] = BYTE2ANGLE(pm->ps->damageYaw);
|
||||
delta[PITCH] = BYTE2ANGLE(pm->ps->damagePitch);
|
||||
delta[ROLL] = 0;
|
||||
AngleVectors (delta, pml.forward, pml.right, pml.up);
|
||||
// END
|
||||
|
|
|
@ -517,7 +517,7 @@ void PM_AddRoadForces(car_t *car, carBody_t *body, carPoint_t *points, float sec
|
|||
}
|
||||
|
||||
if (pm->controlMode == CT_MOUSE){
|
||||
car->wheelAngle = WheelAngle(pm->ps->viewangles[YAW], SHORT2ANGLE(pm->ps->damageYaw));
|
||||
car->wheelAngle = WheelAngle(pm->ps->viewangles[YAW], BYTE2ANGLE(pm->ps->damageYaw));
|
||||
|
||||
if (v < 0.5f && v > -0.5f)
|
||||
car->wheelAngle = 0.0;
|
||||
|
@ -561,8 +561,8 @@ void PM_AddRoadForces(car_t *car, carBody_t *body, carPoint_t *points, float sec
|
|||
if (car->wheelAngle < -20.0f)
|
||||
car->wheelAngle = -20.0f;
|
||||
|
||||
pm->ps->damagePitch = ANGLE2SHORT(0.0f);
|
||||
pm->ps->damageYaw = ANGLE2SHORT(car->wheelAngle);
|
||||
pm->ps->damagePitch = ANGLE2BYTE(0.0f);
|
||||
pm->ps->damageYaw = ANGLE2BYTE(car->wheelAngle);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1769,8 +1769,8 @@ void SpectatorClientEndFrame( gentity_t *ent ) {
|
|||
}
|
||||
}
|
||||
|
||||
ent->client->ps.damagePitch = ANGLE2SHORT(ent->client->ps.viewangles[PITCH]);
|
||||
ent->client->ps.damageYaw = ANGLE2SHORT(ent->client->ps.viewangles[YAW]);
|
||||
ent->client->ps.damagePitch = ANGLE2BYTE(ent->client->ps.viewangles[PITCH]);
|
||||
ent->client->ps.damageYaw = ANGLE2BYTE(ent->client->ps.viewangles[YAW]);
|
||||
|
||||
ent->client->ps.pm_flags |= PMF_OBSERVE;
|
||||
return;
|
||||
|
|
|
@ -591,8 +591,8 @@ void SetClientViewAngle( gentity_t *ent, vec3_t angle ) {
|
|||
VectorCopy (ent->s.angles, ent->client->ps.viewangles);
|
||||
// STONELANCE
|
||||
VectorCopy( angle, ent->s.angles2 );
|
||||
ent->client->ps.damagePitch = ANGLE2SHORT(ent->s.angles2[PITCH]);
|
||||
ent->client->ps.damageYaw = ANGLE2SHORT(ent->s.angles2[YAW]);
|
||||
ent->client->ps.damagePitch = ANGLE2BYTE(ent->s.angles2[PITCH]);
|
||||
ent->client->ps.damageYaw = ANGLE2BYTE(ent->s.angles2[YAW]);
|
||||
// END
|
||||
}
|
||||
|
||||
|
|
|
@ -1144,8 +1144,8 @@ void MoveClientToIntermission( gentity_t *ent ) {
|
|||
// STONELANCE (used for viewing angles client side)
|
||||
// VectorCopy (level.intermission_angle, ent->client->ps.viewangles);
|
||||
VectorCopy( level.intermission_angle, ent->s.angles2 ); // FIXME: need this?
|
||||
ent->client->ps.damagePitch = ANGLE2SHORT(ent->s.angles2[PITCH]);
|
||||
ent->client->ps.damageYaw = ANGLE2SHORT(ent->s.angles2[YAW]);
|
||||
ent->client->ps.damagePitch = ANGLE2BYTE(ent->s.angles2[PITCH]);
|
||||
ent->client->ps.damageYaw = ANGLE2BYTE(ent->s.angles2[YAW]);
|
||||
// END
|
||||
ent->client->ps.pm_type = PM_INTERMISSION;
|
||||
|
||||
|
|
|
@ -1177,6 +1177,9 @@ typedef enum {
|
|||
#define SHORT2FLOAT(x) ((x)*(1.0/16384))
|
||||
// END
|
||||
|
||||
#define ANGLE2BYTE(x) ((int)((x)*256/360) & 255)
|
||||
#define BYTE2ANGLE(x) ((x)*(360.0/256))
|
||||
|
||||
#define SNAPFLAG_RATE_DELAYED 1
|
||||
#define SNAPFLAG_NOT_ACTIVE 2 // snapshot used during connection and for zombies
|
||||
#define SNAPFLAG_SERVERCOUNT 4 // toggled every map_restart so transitions can be detected
|
||||
|
|
Loading…
Reference in a new issue