summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2009-10-03 12:12:12 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:45 +0000
commit32631d7354556ff88ecfe3ff9a9d80075422fbef (patch)
tree083df63c1aada8cc7d0f6849c19b3dcee056c3fe
parentec254e3bebdc3957a630b23b3b77d5460f2c7674 (diff)
* Add BG_EventName and use it to simplify a series of debugging messages
* Correct crouch check in ClientTimerActions * Ensure animation togglebit on buildables is only used once per frame (bug 3377) * Make G_FloodLimited more robust and with a pointlessly informative return value * Add a brief comment to the G_SayArg* functions to explain their purpose, which wasn't at all clear to me until I experimented with them * Remove more redundant va()s * Remove an unused variable and associated functions that were causing a compiler warning
-rw-r--r--src/cgame/cg_event.c70
-rw-r--r--src/game/bg_misc.c19
-rw-r--r--src/game/bg_public.h2
-rw-r--r--src/game/g_active.c2
-rw-r--r--src/game/g_admin.c4
-rw-r--r--src/game/g_buildable.c9
-rw-r--r--src/game/g_cmds.c37
-rw-r--r--src/game/g_local.h3
-rw-r--r--src/game/g_utils.c4
-rw-r--r--src/qcommon/parse.c20
-rw-r--r--src/ui/ui_main.c3
11 files changed, 62 insertions, 111 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 8acbbeaf..7bc50929 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -508,7 +508,6 @@ An entity has an event value
also called by CG_CheckPlayerstateEvents
==============
*/
-#define DEBUGNAME(x) if(cg_debugEvents.integer){CG_Printf(x"\n");}
void CG_EntityEvent( centity_t *cent, vec3_t position )
{
entityState_t *es;
@@ -528,13 +527,11 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
event = es->event & ~EV_EVENT_BITS;
if( cg_debugEvents.integer )
- CG_Printf( "ent:%3i event:%3i ", es->number, event );
+ CG_Printf( "ent:%3i event:%3i %s\n", es->number, event,
+ BG_EventName( event ) );
if( !event )
- {
- DEBUGNAME("ZEROEVENT");
return;
- }
clientNum = es->clientNum;
if( clientNum < 0 || clientNum >= MAX_CLIENTS )
@@ -548,7 +545,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
// movement generated events
//
case EV_FOOTSTEP:
- DEBUGNAME( "EV_FOOTSTEP" );
if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE )
{
if( ci->footsteps == FOOTSTEP_CUSTOM )
@@ -561,7 +557,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_FOOTSTEP_METAL:
- DEBUGNAME( "EV_FOOTSTEP_METAL" );
if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE )
{
if( ci->footsteps == FOOTSTEP_CUSTOM )
@@ -574,7 +569,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_FOOTSTEP_SQUELCH:
- DEBUGNAME( "EV_FOOTSTEP_SQUELCH" );
if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE )
{
trap_S_StartSound( NULL, es->number, CHAN_BODY,
@@ -583,7 +577,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_FOOTSPLASH:
- DEBUGNAME( "EV_FOOTSPLASH" );
if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE )
{
trap_S_StartSound( NULL, es->number, CHAN_BODY,
@@ -592,7 +585,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_FOOTWADE:
- DEBUGNAME( "EV_FOOTWADE" );
if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE )
{
trap_S_StartSound( NULL, es->number, CHAN_BODY,
@@ -601,7 +593,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_SWIM:
- DEBUGNAME( "EV_SWIM" );
if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE )
{
trap_S_StartSound( NULL, es->number, CHAN_BODY,
@@ -611,7 +602,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
case EV_FALL_SHORT:
- DEBUGNAME( "EV_FALL_SHORT" );
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.landSound );
if( clientNum == cg.predictedPlayerState.clientNum )
@@ -623,7 +613,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_FALL_MEDIUM:
- DEBUGNAME( "EV_FALL_MEDIUM" );
// use normal pain sound
trap_S_StartSound( NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, "*pain100_1.wav" ) );
@@ -636,7 +625,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_FALL_FAR:
- DEBUGNAME( "EV_FALL_FAR" );
trap_S_StartSound (NULL, es->number, CHAN_AUTO, CG_CustomSound( es->number, "*fall1.wav" ) );
cent->pe.painTime = cg.time; // don't play a pain sound right after this
@@ -649,7 +637,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_FALLING:
- DEBUGNAME( "EV_FALLING" );
trap_S_StartSound( NULL, es->number, CHAN_AUTO, CG_CustomSound( es->number, "*falling1.wav" ) );
break;
@@ -661,7 +648,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
case EV_STEPDN_8:
case EV_STEPDN_12:
case EV_STEPDN_16: // smooth out step down transitions
- DEBUGNAME( "EV_STEP" );
{
float oldStep;
int delta;
@@ -705,7 +691,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
}
case EV_JUMP:
- DEBUGNAME( "EV_JUMP" );
trap_S_StartSound( NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, "*jump1.wav" ) );
if( BG_ClassHasAbility( cg.predictedPlayerState.stats[ STAT_CLASS ], SCA_WALLJUMPER ) )
@@ -736,44 +721,36 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_LEV1_GRAB:
- DEBUGNAME( "EV_LEV1_GRAB" );
trap_S_StartSound( NULL, es->number, CHAN_VOICE, cgs.media.alienL1Grab );
break;
case EV_LEV4_TRAMPLE_PREPARE:
- DEBUGNAME( "EV_LEV4_TRAMPLE_PREPARE" );
trap_S_StartSound( NULL, es->number, CHAN_VOICE, cgs.media.alienL4ChargePrepare );
break;
case EV_LEV4_TRAMPLE_START:
- DEBUGNAME( "EV_LEV4_TRAMPLE_START" );
//FIXME: stop cgs.media.alienL4ChargePrepare playing here
trap_S_StartSound( NULL, es->number, CHAN_VOICE, cgs.media.alienL4ChargeStart );
break;
case EV_TAUNT:
- DEBUGNAME( "EV_TAUNT" );
if( !cg_noTaunt.integer )
trap_S_StartSound( NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, "*taunt.wav" ) );
break;
case EV_WATER_TOUCH:
- DEBUGNAME( "EV_WATER_TOUCH" );
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.watrInSound );
break;
case EV_WATER_LEAVE:
- DEBUGNAME( "EV_WATER_LEAVE" );
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.watrOutSound );
break;
case EV_WATER_UNDER:
- DEBUGNAME( "EV_WATER_UNDER" );
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.watrUnSound );
break;
case EV_WATER_CLEAR:
- DEBUGNAME( "EV_WATER_CLEAR" );
trap_S_StartSound( NULL, es->number, CHAN_AUTO, CG_CustomSound( es->number, "*gasp.wav" ) );
break;
@@ -781,28 +758,23 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
// weapon events
//
case EV_NOAMMO:
- DEBUGNAME( "EV_NOAMMO" );
trap_S_StartSound( NULL, es->number, CHAN_WEAPON,
cgs.media.weaponEmptyClick );
break;
case EV_CHANGE_WEAPON:
- DEBUGNAME( "EV_CHANGE_WEAPON" );
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.selectSound );
break;
case EV_FIRE_WEAPON:
- DEBUGNAME( "EV_FIRE_WEAPON" );
CG_FireWeapon( cent, WPM_PRIMARY );
break;
case EV_FIRE_WEAPON2:
- DEBUGNAME( "EV_FIRE_WEAPON2" );
CG_FireWeapon( cent, WPM_SECONDARY );
break;
case EV_FIRE_WEAPON3:
- DEBUGNAME( "EV_FIRE_WEAPON3" );
CG_FireWeapon( cent, WPM_TERTIARY );
break;
@@ -812,32 +784,26 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
// other events
//
case EV_PLAYER_TELEPORT_IN:
- DEBUGNAME( "EV_PLAYER_TELEPORT_IN" );
//deprecated
break;
case EV_PLAYER_TELEPORT_OUT:
- DEBUGNAME( "EV_PLAYER_TELEPORT_OUT" );
CG_PlayerDisconnect( position );
break;
case EV_BUILD_CONSTRUCT:
- DEBUGNAME( "EV_BUILD_CONSTRUCT" );
//do something useful here
break;
case EV_BUILD_DESTROY:
- DEBUGNAME( "EV_BUILD_DESTROY" );
//do something useful here
break;
case EV_RPTUSE_SOUND:
- DEBUGNAME( "EV_RPTUSE_SOUND" );
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.repeaterUseSound );
break;
case EV_GRENADE_BOUNCE:
- DEBUGNAME( "EV_GRENADE_BOUNCE" );
if( rand( ) & 1 )
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.hardBounceSound1 );
else
@@ -848,37 +814,31 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
// missile impacts
//
case EV_MISSILE_HIT:
- DEBUGNAME( "EV_MISSILE_HIT" );
ByteToDir( es->eventParm, dir );
CG_MissileHitEntity( es->weapon, es->generic1, position, dir, es->otherEntityNum, es->torsoAnim );
break;
case EV_MISSILE_MISS:
- DEBUGNAME( "EV_MISSILE_MISS" );
ByteToDir( es->eventParm, dir );
CG_MissileHitWall( es->weapon, es->generic1, 0, position, dir, IMPACTSOUND_DEFAULT, es->torsoAnim );
break;
case EV_MISSILE_MISS_METAL:
- DEBUGNAME( "EV_MISSILE_MISS_METAL" );
ByteToDir( es->eventParm, dir );
CG_MissileHitWall( es->weapon, es->generic1, 0, position, dir, IMPACTSOUND_METAL, es->torsoAnim );
break;
case EV_HUMAN_BUILDABLE_EXPLOSION:
- DEBUGNAME( "EV_HUMAN_BUILDABLE_EXPLOSION" );
ByteToDir( es->eventParm, dir );
CG_HumanBuildableExplosion( position, dir );
break;
case EV_ALIEN_BUILDABLE_EXPLOSION:
- DEBUGNAME( "EV_ALIEN_BUILDABLE_EXPLOSION" );
ByteToDir( es->eventParm, dir );
CG_AlienBuildableExplosion( position, dir );
break;
case EV_TESLATRAIL:
- DEBUGNAME( "EV_TESLATRAIL" );
cent->currentState.weapon = WP_TESLAGEN;
{
centity_t *source = &cg_entities[ es->generic1 ];
@@ -904,23 +864,19 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_BULLET_HIT_WALL:
- DEBUGNAME( "EV_BULLET_HIT_WALL" );
ByteToDir( es->eventParm, dir );
CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qfalse, ENTITYNUM_WORLD );
break;
case EV_BULLET_HIT_FLESH:
- DEBUGNAME( "EV_BULLET_HIT_FLESH" );
CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qtrue, es->eventParm );
break;
case EV_SHOTGUN:
- DEBUGNAME( "EV_SHOTGUN" );
CG_ShotgunFire( es );
break;
case EV_GENERAL_SOUND:
- DEBUGNAME( "EV_GENERAL_SOUND" );
if( cgs.gameSounds[ es->eventParm ] )
trap_S_StartSound( NULL, es->number, CHAN_VOICE, cgs.gameSounds[ es->eventParm ] );
else
@@ -931,7 +887,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_GLOBAL_SOUND: // play from the player's head so it never diminishes
- DEBUGNAME( "EV_GLOBAL_SOUND" );
if( cgs.gameSounds[ es->eventParm ] )
trap_S_StartSound( NULL, cg.snap->ps.clientNum, CHAN_AUTO, cgs.gameSounds[ es->eventParm ] );
else
@@ -944,7 +899,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
case EV_PAIN:
// local player sounds are triggered in CG_CheckLocalSounds,
// so ignore events on the player
- DEBUGNAME( "EV_PAIN" );
if( cent->currentState.number != cg.snap->ps.clientNum )
CG_PainEvent( cent, es->eventParm );
break;
@@ -952,34 +906,28 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
case EV_DEATH1:
case EV_DEATH2:
case EV_DEATH3:
- DEBUGNAME( "EV_DEATHx" );
trap_S_StartSound( NULL, es->number, CHAN_VOICE,
CG_CustomSound( es->number, va( "*death%i.wav", event - EV_DEATH1 + 1 ) ) );
break;
case EV_OBITUARY:
- DEBUGNAME( "EV_OBITUARY" );
CG_Obituary( es );
break;
case EV_GIB_PLAYER:
- DEBUGNAME( "EV_GIB_PLAYER" );
// no gibbing
break;
case EV_STOPLOOPINGSOUND:
- DEBUGNAME( "EV_STOPLOOPINGSOUND" );
trap_S_StopLoopingSound( es->number );
es->loopSound = 0;
break;
case EV_DEBUG_LINE:
- DEBUGNAME( "EV_DEBUG_LINE" );
CG_Beam( cent );
break;
case EV_BUILD_DELAY:
- DEBUGNAME( "EV_BUILD_DELAY" );
if( clientNum == cg.predictedPlayerState.clientNum )
{
trap_S_StartLocalSound( cgs.media.buildableRepairedSound, CHAN_LOCAL_SOUND );
@@ -988,17 +936,14 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_BUILD_REPAIR:
- DEBUGNAME( "EV_BUILD_REPAIR" );
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.buildableRepairSound );
break;
case EV_BUILD_REPAIRED:
- DEBUGNAME( "EV_BUILD_REPAIRED" );
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.buildableRepairedSound );
break;
case EV_OVERMIND_ATTACK:
- DEBUGNAME( "EV_OVERMIND_ATTACK" );
if( cg.predictedPlayerState.stats[ STAT_TEAM ] == TEAM_ALIENS )
{
trap_S_StartLocalSound( cgs.media.alienOvermindAttack, CHAN_ANNOUNCER );
@@ -1007,7 +952,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_OVERMIND_DYING:
- DEBUGNAME( "EV_OVERMIND_DYING" );
if( cg.predictedPlayerState.stats[ STAT_TEAM ] == TEAM_ALIENS )
{
trap_S_StartLocalSound( cgs.media.alienOvermindDying, CHAN_ANNOUNCER );
@@ -1016,7 +960,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_DCC_ATTACK:
- DEBUGNAME( "EV_DCC_ATTACK" );
if( cg.predictedPlayerState.stats[ STAT_TEAM ] == TEAM_HUMANS )
{
//trap_S_StartLocalSound( cgs.media.humanDCCAttack, CHAN_ANNOUNCER );
@@ -1025,12 +968,10 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_MGTURRET_SPINUP:
- DEBUGNAME( "EV_MGTURRET_SPINUP" );
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.turretSpinupSound );
break;
case EV_OVERMIND_SPAWNS:
- DEBUGNAME( "EV_OVERMIND_SPAWNS" );
if( cg.predictedPlayerState.stats[ STAT_TEAM ] == TEAM_ALIENS )
{
trap_S_StartLocalSound( cgs.media.alienOvermindSpawns, CHAN_ANNOUNCER );
@@ -1039,7 +980,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_ALIEN_EVOLVE:
- DEBUGNAME( "EV_ALIEN_EVOLVE" );
trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.alienEvolveSound );
{
particleSystem_t *ps = CG_SpawnNewParticleSystem( cgs.media.alienEvolvePS );
@@ -1059,7 +999,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_ALIEN_EVOLVE_FAILED:
- DEBUGNAME( "EV_ALIEN_EVOLVE_FAILED" );
if( clientNum == cg.predictedPlayerState.clientNum )
{
//FIXME: change to "negative" sound
@@ -1069,7 +1008,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_ALIEN_ACIDTUBE:
- DEBUGNAME( "EV_ALIEN_ACIDTUBE" );
{
particleSystem_t *ps = CG_SpawnNewParticleSystem( cgs.media.alienAcidTubePS );
@@ -1084,23 +1022,19 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
break;
case EV_MEDKIT_USED:
- DEBUGNAME( "EV_MEDKIT_USED" );
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.medkitUseSound );
break;
case EV_PLAYER_RESPAWN:
- DEBUGNAME( "EV_PLAYER_RESPAWN" );
if( es->number == cg.clientNum )
cg.spawnTime = cg.time;
break;
case EV_LEV2_ZAP:
- DEBUGNAME( "EV_LEV2_ZAP" );
CG_Level2Zap( es );
break;
default:
- DEBUGNAME( "UNKNOWN" );
CG_Error( "Unknown event: %i", event );
break;
}
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index cac8f17b..8e925581 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -2815,6 +2815,19 @@ char *eventnames[ ] =
/*
===============
+BG_EventName
+===============
+*/
+const char *BG_EventName( int num )
+{
+ if( num < 0 || num >= sizeof( eventnames ) / sizeof( char * ) )
+ return "UNKNOWN";
+
+ return eventnames[ num ];
+}
+
+/*
+===============
BG_AddPredictableEventToPlayerstate
Handles the sequence numbers
@@ -2834,10 +2847,12 @@ void BG_AddPredictableEventToPlayerstate( int newEvent, int eventParm, playerSta
{
#ifdef GAME
Com_Printf( " game event svt %5d -> %5d: num = %20s parm %d\n",
- ps->pmove_framecount/*ps->commandTime*/, ps->eventSequence, eventnames[ newEvent ], eventParm);
+ ps->pmove_framecount/*ps->commandTime*/, ps->eventSequence,
+ BG_EventName( newEvent ), eventParm );
#else
Com_Printf( "Cgame event svt %5d -> %5d: num = %20s parm %d\n",
- ps->pmove_framecount/*ps->commandTime*/, ps->eventSequence, eventnames[ newEvent ], eventParm);
+ ps->pmove_framecount/*ps->commandTime*/, ps->eventSequence,
+ BG_EventName( newEvent ), eventParm );
#endif
}
}
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index 707b6256..f1400522 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -440,6 +440,8 @@ typedef enum
#define EVENT_VALID_MSEC 300
+const char *BG_EventName( int num );
+
typedef enum
{
EV_NONE,
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 921d2388..bd6d4956 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -587,7 +587,7 @@ void ClientTimerActions( gentity_t *ent, int msec )
if( ucmd->upmove > 0 )
jumping = qtrue;
- else if( ucmd->upmove < 0 )
+ else if( ent->client->ps.pm_flags & PMF_DUCKED )
crouched = qtrue;
client = ent->client;
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index f6768ffa..c83a7ffe 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -947,7 +947,7 @@ qboolean G_admin_cmd_check( gentity_t *ent, qboolean say )
if( admin_command_permission( ent, cmd ) )
{
// flooding say will have already been accounted for in ClientCommand
- if( ent && !say && G_FloodLimited( ent ) )
+ if( !say && G_FloodLimited( ent ) )
return qtrue;
trap_SendConsoleCommand( EXEC_APPEND, g_admin_commands[ i ]->exec );
admin_log( ent, cmd, skip );
@@ -968,7 +968,7 @@ qboolean G_admin_cmd_check( gentity_t *ent, qboolean say )
if( G_admin_permission( ent, g_admin_cmds[ i ].flag[ 0 ] ) )
{
// flooding say will have already been accounted for in ClientCommand
- if( ent && !say && G_FloodLimited( ent ) )
+ if( !say && G_FloodLimited( ent ) )
return qtrue;
g_admin_cmds[ i ].handler( ent, skip );
admin_log( ent, cmd, skip );
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 8a987a2d..2a089ba5 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -32,12 +32,17 @@ Triggers an animation client side
*/
void G_SetBuildableAnim( gentity_t *ent, buildableAnimNumber_t anim, qboolean force )
{
- int localAnim = anim;
+ int localAnim = anim | ( ent->s.legsAnim & ANIM_TOGGLEBIT );
if( force )
localAnim |= ANIM_FORCEBIT;
- localAnim |= ( ( ent->s.legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT );
+ // don't flip the togglebit more than once per frame
+ if( ent->animTime != level.time )
+ {
+ ent->animTime = level.time;
+ localAnim ^= ANIM_TOGGLEBIT;
+ }
ent->s.legsAnim = localAnim;
}
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 4fb3dcb1..3214ce3d 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -2918,34 +2918,35 @@ void Cmd_Damage_f( gentity_t *ent )
G_FloodLimited
Determine whether a user is flood limited, and adjust their flood demerits
-Notify them if this is the first time they were over the limit
+Print them a warning message if they are over the limit
+Return is time in msec until the user can speak again
==================
*/
-qboolean G_FloodLimited( gentity_t *ent )
+int G_FloodLimited( gentity_t *ent )
{
- int deltatime = level.time - ent->client->pers.floodTime;
- int flooding;
+ int deltatime, ms;
if( g_floodMinTime.integer <= 0 )
- return qfalse;
+ return 0;
+ // handles !ent
if( G_admin_permission( ent, ADMF_NOCENSORFLOOD ) )
- return qfalse;
+ return 0;
+
+ deltatime = level.time - ent->client->pers.floodTime;
ent->client->pers.floodDemerits += g_floodMinTime.integer - deltatime;
if( ent->client->pers.floodDemerits < 0 )
ent->client->pers.floodDemerits = 0;
ent->client->pers.floodTime = level.time;
- flooding = ent->client->pers.floodDemerits - g_floodMaxDemerits.integer;
- if( flooding <= 0 )
- return qfalse;
- // seconds (rounded up)
- flooding = ( flooding + 999 ) / 1000;
+ ms = ent->client->pers.floodDemerits - g_floodMaxDemerits.integer;
+ if( ms <= 0 )
+ return 0;
trap_SendServerCommand( ent - g_entities, va( "print \"You are flooding: "
"please wait %d second%s before trying again\n",
- flooding, ( flooding != 1 ) ? "s" : "" ) );
- return qtrue;
+ ( ms + 999 ) / 1000, ( ms > 1000 ) ? "s" : "" ) );
+ return ms;
}
commands_t cmds[ ] = {
@@ -3092,6 +3093,16 @@ void ClientCommand( int clientNum )
cmds[ i ].cmdHandler( ent );
}
+/*
+=================
+G_SayArgc
+G_SayArgv
+G_SayConcatArgs
+
+trap_Argc, trap_Argv, and ConcatArgs consider say text as a single argument
+These functions assemble the text and re-parse it on word boundaries
+=================
+*/
int G_SayArgc( void )
{
int c = 0;
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 5f9029a9..01b6ef5c 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -204,6 +204,7 @@ struct gentity_s
qboolean spawned; // whether or not this buildable has finished spawning
int shrunkTime; // time when a barricade shrunk or zero
int buildTime; // when this buildable was built
+ int animTime; // last animation change
int time1000; // timer evaluated every second
qboolean deconstruct; // deconstruct if no BP left
int deconstructTime; // time at which structure marked
@@ -681,7 +682,7 @@ void G_SanitiseString( char *in, char *out, int len );
void Cmd_PrivateMessage_f( gentity_t *ent );
void Cmd_Test_f( gentity_t *ent );
void Cmd_AdminMessage_f( gentity_t *ent );
-qboolean G_FloodLimited( gentity_t *ent );
+int G_FloodLimited( gentity_t *ent );
//
// g_physics.c
diff --git a/src/game/g_utils.c b/src/game/g_utils.c
index 870d781b..0cab96a1 100644
--- a/src/game/g_utils.c
+++ b/src/game/g_utils.c
@@ -642,8 +642,8 @@ void G_AddEvent( gentity_t *ent, int event, int eventParm )
// eventParm is converted to uint8_t (0 - 255) in msg.c
if( eventParm & ~0xFF )
{
- G_Printf( S_COLOR_YELLOW "WARNING: G_AddEvent: event %d "
- " eventParm uint8_t overflow (given %d)\n", event, eventParm );
+ G_Printf( S_COLOR_YELLOW "WARNING: G_AddEvent( %s ) has eventParm %d, "
+ "which will overflow\n", BG_EventName( event ), eventParm );
}
// clients need to add the event in playerState_t instead of entityState_t
diff --git a/src/qcommon/parse.c b/src/qcommon/parse.c
index 2c7595f0..9308aa6e 100644
--- a/src/qcommon/parse.c
+++ b/src/qcommon/parse.c
@@ -316,8 +316,6 @@ punctuation_t default_punctuations[] =
{NULL, 0}
};
-char basefolder[MAX_QPATH];
-
/*
===============
Parse_CreatePunctuationTable
@@ -1007,16 +1005,11 @@ Parse_LoadScriptFile
static script_t *Parse_LoadScriptFile(const char *filename)
{
fileHandle_t fp;
- char pathname[MAX_QPATH];
int length;
void *buffer;
script_t *script;
- if (strlen(basefolder))
- Com_sprintf(pathname, sizeof(pathname), "%s/%s", basefolder, filename);
- else
- Com_sprintf(pathname, sizeof(pathname), "%s", filename);
- length = FS_FOpenFileRead( pathname, &fp, qfalse );
+ length = FS_FOpenFileRead( filename, &fp, qfalse );
if (!fp) return NULL;
buffer = Z_Malloc(sizeof(script_t) + length + 1);
@@ -1100,16 +1093,6 @@ static void Parse_FreeScript(script_t *script)
/*
===============
-Parse_SetBaseFolder
-===============
-*/
-static void Parse_SetBaseFolder(char *path)
-{
- Com_sprintf(basefolder, sizeof(basefolder), path);
-}
-
-/*
-===============
Parse_SourceError
===============
*/
@@ -3508,7 +3491,6 @@ int Parse_LoadSourceHandle(const char *filename)
}
if (i >= MAX_SOURCEFILES)
return 0;
- Parse_SetBaseFolder("");
source = Parse_LoadSourceFile(filename);
if (!source)
return 0;
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index 304222af..df295a4e 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -4351,7 +4351,8 @@ void UI_DrawConnectScreen( qboolean overlay )
Text_PaintCenter( centerPoint, yStart, scale, colorWhite, va( "Loading %s", Info_ValueForKey( info, "mapname" ) ), 0 );
if( !Q_stricmp( cstate.servername, "localhost" ) )
- Text_PaintCenter( centerPoint, yStart + 48, scale, colorWhite, va( "Starting up..." ), ITEM_TEXTSTYLE_SHADOWEDMORE );
+ Text_PaintCenter( centerPoint, yStart + 48, scale, colorWhite,
+ "Starting up...", ITEM_TEXTSTYLE_SHADOWEDMORE );
else
{
Com_sprintf( text, sizeof( text ), "Connecting to %s", cstate.servername );