summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-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
8 files changed, 57 insertions, 23 deletions
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