diff options
author | Ben Millwood <thebenmachine@gmail.com> | 2009-10-03 12:17:37 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:15:49 +0000 |
commit | 0244441adde816d896eb05034b48202bc19e19dd (patch) | |
tree | 1e328564112a1d172523ca835c3c88268fd777c5 | |
parent | 7992017f0570eb540fdc886e5d389f3121b7feae (diff) |
* Don't play EV_FALL_FAR sound if dead
* Merging some fixes from mgdev, courtesy of Michael "Risujin" Levin:
- Ensure SnapVector always snaps downwards, rather than always towards 0
- Don't send score information that won't be displayed
- /give poison as a human poisons rather than boosting
* Remove some trailing whitespace
* Remove some useless intermediate variables in cg_draw.c
* Ammo/clips/build timer display depends on primary weapon rather than equipped
- (this also fixes bug 3837)
-rw-r--r-- | src/cgame/cg_draw.c | 75 | ||||
-rw-r--r-- | src/game/bg_lib.c | 2 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 6 | ||||
-rw-r--r-- | src/game/g_cmds.c | 28 | ||||
-rw-r--r-- | src/qcommon/q_shared.h | 4 |
5 files changed, 48 insertions, 67 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 13412eef..f97bf9b6 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -674,42 +674,36 @@ static void CG_DrawPlayerWallclimbing( rectDef_t *rect, vec4_t color, qhandle_t static void CG_DrawPlayerAmmoValue( rectDef_t *rect, vec4_t color ) { - int value; - centity_t *cent; - playerState_t *ps; - weapon_t weapon; - - cent = &cg_entities[ cg.snap->ps.clientNum ]; - ps = &cg.snap->ps; - weapon = BG_GetPlayerWeapon( ps ); + int value; - if( weapon ) + switch( BG_PrimaryWeapon( cg.snap->ps.stats ) ) { - switch( weapon ) - { - case WP_ABUILD: - case WP_ABUILD2: - value = cgs.alienBuildPoints; - break; + case WP_NONE: + case WP_BLASTER: + return; - case WP_HBUILD: - value = cgs.humanBuildPoints; - break; + case WP_ABUILD: + case WP_ABUILD2: + value = cgs.alienBuildPoints; + break; - default: - value = ps->ammo; - break; - } + case WP_HBUILD: + value = cgs.humanBuildPoints; + break; + + default: + value = cg.snap->ps.ammo; + break; + } - if( value > 999 ) - value = 999; + if( value > 999 ) + value = 999; - if( value > -1 ) - { - trap_R_SetColor( color ); - CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value ); - trap_R_SetColor( NULL ); - } + if( value > -1 ) + { + trap_R_SetColor( color ); + CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value ); + trap_R_SetColor( NULL ); } } @@ -777,13 +771,11 @@ static void CG_DrawUsableBuildable( rectDef_t *rect, qhandle_t shader, vec4_t co static void CG_DrawPlayerBuildTimer( rectDef_t *rect, vec4_t color ) { int index; - centity_t *cent; playerState_t *ps; weapon_t weapon; - cent = &cg_entities[ cg.snap->ps.clientNum ]; ps = &cg.snap->ps; - weapon = BG_GetPlayerWeapon( ps ); + weapon = BG_PrimaryWeapon( ps->stats ); if( ( weapon != WP_ABUILD && weapon != WP_ABUILD2 && weapon != WP_HBUILD ) || ps->stats[ STAT_MISC ] <= 0 ) @@ -812,20 +804,19 @@ static void CG_DrawPlayerBuildTimer( rectDef_t *rect, vec4_t color ) static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color ) { int value; - centity_t *cent; playerState_t *ps; weapon_t weapon; - cent = &cg_entities[ cg.snap->ps.clientNum ]; ps = &cg.snap->ps; - weapon = BG_GetPlayerWeapon( ps ); + weapon = BG_PrimaryWeapon( ps->stats ); switch( weapon ) { + case WP_NONE: + case WP_BLASTER: case WP_ABUILD: case WP_ABUILD2: case WP_HBUILD: - case 0: break; default: @@ -843,15 +834,9 @@ static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color ) static void CG_DrawPlayerHealthValue( rectDef_t *rect, vec4_t color ) { - playerState_t *ps; - int value; - - ps = &cg.snap->ps; - - value = ps->stats[ STAT_HEALTH ]; - trap_R_SetColor( color ); - CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value ); + CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, + cg.snap->ps.stats[ STAT_HEALTH ] ); trap_R_SetColor( NULL ); } diff --git a/src/game/bg_lib.c b/src/game/bg_lib.c index 328af322..fa184228 100644 --- a/src/game/bg_lib.c +++ b/src/game/bg_lib.c @@ -76,7 +76,7 @@ static char* med3(char *, char *, char *, cmp_t *); static void swapfunc(char *, char *, int, int); #ifndef min -#define min(a, b) ((a) < (b) ? a : b) +#define min(a, b) ((a) < (b) ? (a) : (b)) #endif /* diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 7f62fd14..6769fa02 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -1757,12 +1757,12 @@ static void PM_CrashLand( void ) if( delta > AVG_FALL_DISTANCE ) { - PM_AddEvent( EV_FALL_FAR ); + if( PM_Live( pm->ps->pm_type ) ) + PM_AddEvent( EV_FALL_FAR ); } else if( delta > MIN_FALL_DISTANCE ) { - // this is a pain grunt, so don't play it if dead - if( pm->ps->stats[STAT_HEALTH] > 0 ) + if( PM_Live( pm->ps->pm_type ) ) PM_AddEvent( EV_FALL_MEDIUM ); } else diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index e9052b05..00302fc1 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -585,7 +585,7 @@ void Cmd_Team_f( gentity_t *ent ) { trap_SendServerCommand( ent-g_entities, "print \"Alien team has been ^1LOCKED\n\"" ); - return; + return; } else if( level.humanTeamLocked ) force = qtrue; @@ -604,7 +604,7 @@ void Cmd_Team_f( gentity_t *ent ) { trap_SendServerCommand( ent-g_entities, "print \"Human team has been ^1LOCKED\n\"" ); - return; + return; } else if( level.alienTeamLocked ) force = qtrue; @@ -790,7 +790,7 @@ static void Cmd_Say_f( gentity_t *ent ) // support parsing /a out of say text for the same reason if( !Q_stricmpn( args, "say /a ", 7 ) || - !Q_stricmpn( args, "say_team /a ", 12 ) ) + !Q_stricmpn( args, "say_team /a ", 12 ) ) { Cmd_AdminMessage_f( ent ); return; @@ -864,7 +864,7 @@ void Cmd_VSay_f( gentity_t *ent ) trap_Argv( 0, arg, sizeof( arg ) ); if( trap_Argc( ) < 2 ) { - trap_SendServerCommand( ent-g_entities, va( + trap_SendServerCommand( ent-g_entities, va( "print \"usage: %s command [text] \n\"", arg ) ); return; } @@ -876,7 +876,7 @@ void Cmd_VSay_f( gentity_t *ent ) } if( !g_voiceChats.integer ) { - trap_SendServerCommand( ent-g_entities, va( + trap_SendServerCommand( ent-g_entities, va( "print \"%s: voice system administratively disabled on this server\n\"", arg ) ); return; @@ -890,22 +890,22 @@ void Cmd_VSay_f( gentity_t *ent ) else return; Q_strncpyz( vsay, arg, sizeof( vsay ) ); - + if( ent->client->pers.voice[ 0 ] ) Q_strncpyz( voiceName, ent->client->pers.voice, sizeof( voiceName ) ); voice = BG_VoiceByName( level.voices, voiceName ); if( !voice ) { - trap_SendServerCommand( ent-g_entities, va( + trap_SendServerCommand( ent-g_entities, va( "print \"%s: voice '%s' not found\n\"", vsay, voiceName ) ); return; } - + trap_Argv( 1, voiceCmd, sizeof( voiceCmd ) ) ; cmd = BG_VoiceCmdFind( voice->cmds, voiceCmd, &cmdNum ); if( !cmd ) { - trap_SendServerCommand( ent-g_entities, va( + trap_SendServerCommand( ent-g_entities, va( "print \"%s: command '%s' not found in voice '%s'\n\"", vsay, voiceCmd, voiceName ) ); return; @@ -923,20 +923,20 @@ void Cmd_VSay_f( gentity_t *ent ) &trackNum ); if( !track ) { - trap_SendServerCommand( ent-g_entities, va( + trap_SendServerCommand( ent-g_entities, va( "print \"%s: no available track for command '%s', team %d, " "class %d, weapon %d, and enthusiasm %d in voice '%s'\n\"", vsay, voiceCmd, ent->client->pers.teamSelection, ent->client->pers.classSelection, weapon, (int)ent->client->voiceEnthusiasm, voiceName ) ); - return; + return; } if( !Q_stricmp( ent->client->lastVoiceCmd, cmd->cmd ) ) ent->client->voiceEnthusiasm++; Q_strncpyz( ent->client->lastVoiceCmd, cmd->cmd, - sizeof( ent->client->lastVoiceCmd ) ); + sizeof( ent->client->lastVoiceCmd ) ); // optional user supplied text trap_Argv( 2, arg, sizeof( arg ) ); @@ -956,7 +956,7 @@ void Cmd_VSay_f( gentity_t *ent ) break; default: break; - } + } } /* @@ -3371,7 +3371,7 @@ void Cmd_AdminMessage_f( gentity_t *ent ) ent->client->pers.netname ); } - // Skip say/say_team if this was used from one of those + // Skip say/say_team if this was used from one of those G_SayArgv( 0, cmd, sizeof( cmd ) ); if( !Q_stricmp( cmd, "say" ) || !Q_stricmp( cmd, "say_team" ) ) { diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h index 84408371..97caa377 100644 --- a/src/qcommon/q_shared.h +++ b/src/qcommon/q_shared.h @@ -462,10 +462,6 @@ typedef struct { #define Vector4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3]) #define Vector4Add(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1],(c)[2]=(a)[2]+(b)[2],(c)[3]=(a)[3]+(b)[3]) -// DO NOT USE: Snaps differently depending on whether number is positive or -// negative! -0.5 and 0.5 both snapped to zero! -//#define SnapVector(v) {v[0]=((int)(v[0]));v[1]=((int)(v[1]));v[2]=((int)(v[2]));} - // Snaps the vector to the floor value always, ignoring any weirdness from // snapping negative versus positive numbers #define Floor(fl) ((fl) >= 0.0f ? (int)(fl) : -(int)(-(fl))) |