diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_draw.c | 10 | ||||
-rw-r--r-- | src/cgame/cg_view.c | 4 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 4 | ||||
-rw-r--r-- | src/game/g_buildable.c | 4 | ||||
-rw-r--r-- | src/game/g_cmds.c | 2 | ||||
-rw-r--r-- | src/game/g_combat.c | 2 | ||||
-rw-r--r-- | src/game/g_weapon.c | 58 | ||||
-rw-r--r-- | src/game/tremulous.h | 6 | ||||
-rw-r--r-- | src/ui/ui_shared.c | 2 |
9 files changed, 42 insertions, 50 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 4c18e4c4..57e6f25f 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -400,7 +400,7 @@ static void CG_DrawPlayerStaminaBolt( rectDef_t *rect, vec4_t backColor, if( stamina < 0 ) Vector4Copy( backColor, color ); else if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_SPEEDBOOST ) - Vector4Lerp( ( sin( cg.time / 150.f ) + 1 ) / 2, + Vector4Lerp( ( sin( cg.time / 150.0f ) + 1 ) / 2, backColor, foreColor, color ); else Vector4Copy( foreColor, color ); @@ -814,10 +814,10 @@ static void CG_DrawPlayerHealthCross( rectDef_t *rect, vec4_t ref_color ) // Fade the icon during transition if( cg.lastHealthCross != shader ) { - cg.healthCrossFade += cg.frametime / 500.f; - if( cg.healthCrossFade > 1.f ) + cg.healthCrossFade += cg.frametime / 500.0f; + if( cg.healthCrossFade > 1.0f ) { - cg.healthCrossFade = 0.f; + cg.healthCrossFade = 0.0f; cg.lastHealthCross = shader; } else @@ -826,7 +826,7 @@ static void CG_DrawPlayerHealthCross( rectDef_t *rect, vec4_t ref_color ) color[ 3 ] = ref_alpha * cg.healthCrossFade; trap_R_SetColor( color ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); - color[ 3 ] = ref_alpha * ( 1.f - cg.healthCrossFade ); + color[ 3 ] = ref_alpha * ( 1.0f - cg.healthCrossFade ); trap_R_SetColor( color ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, cg.lastHealthCross ); trap_R_SetColor( NULL ); diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index bc331133..e419ba33 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -1334,8 +1334,8 @@ static int CG_CalcViewValues( void ) ps->velocity[ 1 ] * ps->velocity[ 1 ] ); // the bob velocity should't get too fast to avoid jerking - if( cg.xyspeed > 300.f ) - cg.xyspeed = 300.f; + if( cg.xyspeed > 300.0f ) + cg.xyspeed = 300.0f; VectorCopy( ps->origin, cg.refdef.vieworg ); diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 0a6f1923..59269469 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -291,8 +291,8 @@ static void PM_Friction( void ) // when landing a dodge, extra friction if( pm->ps->pm_flags & PMF_TIME_LAND ) - friction *= 1.f + HUMAN_LAND_FRICTION * - pm->ps->pm_time / HUMAN_DODGE_TIMEOUT; + friction *= 1.0f + HUMAN_LAND_FRICTION * + pm->ps->pm_time / HUMAN_DODGE_TIMEOUT; control = speed < stopSpeed ? stopSpeed : speed; drop += control * friction * pml.frametime; diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 889836cc..8d77267a 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -940,7 +940,7 @@ void ABarricade_Shrink( gentity_t *self, qboolean shrink ) trap_Trace( &tr, self->s.origin, self->r.mins, self->r.maxs, self->s.origin, self->s.number, MASK_PLAYERSOLID ); - if ( tr.startsolid || tr.fraction < 1.f ) + if ( tr.startsolid || tr.fraction < 1.0f ) { self->r.maxs[ 2 ] = (int)( self->r.maxs[ 2 ] * BARRICADE_SHRINKPROP ); return; @@ -3178,7 +3178,7 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance } //this item does not fit here - if( reason == IBE_NONE && ( tr2.fraction < 1.0 || tr3.fraction < 1.0 ) ) + if( reason == IBE_NONE && ( tr2.fraction < 1.0f || tr3.fraction < 1.0f ) ) reason = IBE_NOROOM; if( reason != IBE_NONE ) diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index ec00c8a4..812f5a83 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -3045,7 +3045,7 @@ void Cmd_Damage_f( gentity_t *ent ) { vec3_t point; char arg[ 16 ]; - float dx = 0.f, dy = 0.f, dz = 100.f; + float dx = 0.0f, dy = 0.0f, dz = 100.0f; int damage = 100; qboolean nonloc = qtrue; diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 2e359ab7..ff1af0bf 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -685,7 +685,7 @@ Returns the damage region given an angle and a height proportion static float GetPointDamageModifier( gentity_t *targ, damageRegion_t *regions, int len, float angle, float height ) { - float modifier = 1.f; + float modifier = 1.0f; int i; for( i = 0; i < len; i++ ) diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 123679da..a7c30d02 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -144,54 +144,46 @@ static void G_WideTrace( trace_t *tr, gentity_t *ent, float range, vec3_t mins, maxs; vec3_t end; - VectorSet( mins, -width, -width, -width ); + VectorSet( mins, -width, -width, -height ); VectorSet( maxs, width, width, width ); - mins[ 2 ] -= height - width; *target = NULL; if( !ent->client ) return; - // Set aiming directions - VectorMA( muzzle, range, forward, end ); + // Try a linear trace first + VectorMA( muzzle, range + width, forward, end ); - G_UnlaggedOn( ent, muzzle, range ); + G_UnlaggedOn( ent, muzzle, range + width ); - //prefer the target in the crosshairs - trap_Trace( tr, muzzle, NULL, NULL, end, ent->s.number, CONTENTS_BODY ); - - // Trace against entities - if( tr->entityNum == ENTITYNUM_NONE ) - trap_Trace( tr, muzzle, mins, maxs, end, ent->s.number, CONTENTS_BODY ); + trap_Trace( tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT ); + if( tr->entityNum != ENTITYNUM_NONE ) + { + // We hit something with the linear trace + *target = &g_entities[ tr->entityNum ]; + } else - //if the first trace hit, we need to set width to 0 to avoid - //"missing" in some rare cases - width = 0; - - // If we started in a solid that means someone is within our muzzle box, - // the trace didn't give us the entity number though so do a trace - // from the entity origin to the muzzle - if( tr->startsolid ) { - trap_Trace( tr, ent->client->ps.origin, mins, maxs, muzzle, - ent->s.number, CONTENTS_BODY ); + // The linear trace didn't hit anything, so retry with a wide trace + VectorMA( muzzle, range, forward, end ); + + // Trace against entities + trap_Trace( tr, muzzle, mins, maxs, end, ent->s.number, CONTENTS_BODY ); if( tr->entityNum != ENTITYNUM_NONE ) + { *target = &g_entities[ tr->entityNum ]; - } - else if( tr->entityNum != ENTITYNUM_NONE ) - { - *target = &g_entities[ tr->entityNum ]; - // Set range to the trace length plus the width, so that the end of the - // LOS trace is close to the exterior of the target's bounding box - range = Distance( muzzle, tr->endpos ) + width; - VectorMA( muzzle, range, forward, end ); + // Set range to the trace length plus the width, so that the end of the + // LOS trace is close to the exterior of the target's bounding box + range = Distance( muzzle, tr->endpos ) + width; + VectorMA( muzzle, range, forward, end ); - // Trace for line of sight against the world - trap_Trace( tr, muzzle, NULL, NULL, end, 0, CONTENTS_SOLID ); - if( tr->fraction < 1.0f ) - *target = NULL; + // Trace for line of sight against the world + trap_Trace( tr, muzzle, NULL, NULL, end, 0, CONTENTS_SOLID ); + if( tr->fraction < 1.0f ) + *target = NULL; + } } G_UnlaggedOff( ); diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 45a64979..7859173e 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -389,8 +389,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define PAINSAW_K_SCALE 1.0f #define PAINSAW_DAMAGE HDM(11) #define PAINSAW_RANGE 64.0f -#define PAINSAW_WIDTH 0.f -#define PAINSAW_HEIGHT 8.f +#define PAINSAW_WIDTH 0.0f +#define PAINSAW_HEIGHT 8.0f #define GRENADE_PRICE 200 #define GRENADE_REPEAT 0 @@ -628,7 +628,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define HUMAN_DODGE_SIDE_MODIFIER 2.9f #define HUMAN_DODGE_UP_MODIFIER 0.5f #define HUMAN_DODGE_TIMEOUT 500 -#define HUMAN_LAND_FRICTION 3.f +#define HUMAN_LAND_FRICTION 3.0f #define STAMINA_STOP_RESTORE 25 #define STAMINA_WALK_RESTORE 15 diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index de433a85..75abe046 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -1628,7 +1628,7 @@ void Script_ConditionalOpen( itemDef_t *item, char **args ) { val = DC->getCVarValue( cvar ); - if( val == 0.f ) + if( val == 0.0f ) Menus_ActivateByName( name2 ); else Menus_ActivateByName( name1 ); |