mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2024-11-30 07:52:03 +00:00
Elder:
New code for upcoming VM 0-09-00 Server-side
This commit is contained in:
parent
7b3547e2b5
commit
2a5aacc346
10 changed files with 270 additions and 77 deletions
|
@ -1279,6 +1279,9 @@ char *eventnames[] = {
|
||||||
"EV_FOOTSTEP",
|
"EV_FOOTSTEP",
|
||||||
"EV_FOOTSTEP_METAL",
|
"EV_FOOTSTEP_METAL",
|
||||||
"EV_FOOTSTEP_GRASS", // Elder: grass stuff
|
"EV_FOOTSTEP_GRASS", // Elder: grass stuff
|
||||||
|
"EV_FOOTSTEP_WOOD",
|
||||||
|
"EV_FOOTSTEP_CARPET",
|
||||||
|
"EV_FOOTSTEP_METAL2",
|
||||||
"EV_FOOTSPLASH",
|
"EV_FOOTSPLASH",
|
||||||
"EV_FOOTWADE",
|
"EV_FOOTWADE",
|
||||||
"EV_SWIM",
|
"EV_SWIM",
|
||||||
|
|
|
@ -1148,6 +1148,19 @@ static int PM_FootstepForSurface( void ) {
|
||||||
if ( pml.groundTrace.surfaceFlags & SURF_GRASS ) {
|
if ( pml.groundTrace.surfaceFlags & SURF_GRASS ) {
|
||||||
return EV_FOOTSTEP_GRASS;
|
return EV_FOOTSTEP_GRASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( pml.groundTrace.surfaceFlags & SURF_WOOD ) {
|
||||||
|
return EV_FOOTSTEP_WOOD;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( pml.groundTrace.surfaceFlags & SURF_CARPET ) {
|
||||||
|
return EV_FOOTSTEP_CARPET;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( pml.groundTrace.surfaceFlags & SURF_METAL2 ) {
|
||||||
|
return EV_FOOTSTEP_METAL2;
|
||||||
|
}
|
||||||
|
|
||||||
return EV_FOOTSTEP;
|
return EV_FOOTSTEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1758,50 +1771,68 @@ static void PM_BeginWeaponChange( int weapon ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PM_AddEvent( EV_CHANGE_WEAPON );
|
PM_AddEvent( EV_CHANGE_WEAPON );
|
||||||
pm->ps->weaponstate = WEAPON_DROPPING;
|
|
||||||
//pm->ps->weaponTime += 200;
|
//Elder: ignore disarm delays when throwing a weapon
|
||||||
//Elder: dependent time for each weapon
|
if (pm->ps->stats[STAT_RQ3] & RQ3_THROWWEAPON)
|
||||||
switch (pm->ps->weapon) {
|
{
|
||||||
case WP_PISTOL:
|
//Com_Printf("Got to throw skip\n");
|
||||||
pm->ps->weaponTime += RQ3_PISTOL_DISARM_DELAY;
|
pm->ps->stats[STAT_RQ3] &= ~RQ3_THROWWEAPON;
|
||||||
break;
|
pm->ps->weaponTime = 0;
|
||||||
case WP_M3:
|
}
|
||||||
pm->ps->weaponTime += RQ3_M3_DISARM_DELAY;
|
else
|
||||||
break;
|
{
|
||||||
case WP_M4:
|
//pm->ps->weaponTime += 200;
|
||||||
pm->ps->weaponTime += RQ3_M4_DISARM_DELAY;
|
//Elder: dependent time for each weapon
|
||||||
break;
|
switch (pm->ps->weapon) {
|
||||||
case WP_MP5:
|
case WP_PISTOL:
|
||||||
pm->ps->weaponTime += RQ3_MP5_DISARM_DELAY;
|
pm->ps->weaponTime += RQ3_PISTOL_DISARM_DELAY;
|
||||||
break;
|
break;
|
||||||
case WP_HANDCANNON:
|
case WP_M3:
|
||||||
pm->ps->weaponTime += RQ3_HANDCANNON_DISARM_DELAY;
|
pm->ps->weaponTime += RQ3_M3_DISARM_DELAY;
|
||||||
break;
|
break;
|
||||||
case WP_SSG3000:
|
case WP_M4:
|
||||||
pm->ps->weaponTime += RQ3_SSG3000_DISARM_DELAY;
|
pm->ps->weaponTime += RQ3_M4_DISARM_DELAY;
|
||||||
break;
|
break;
|
||||||
case WP_AKIMBO:
|
case WP_MP5:
|
||||||
pm->ps->weaponTime += RQ3_AKIMBO_DISARM_DELAY;
|
pm->ps->weaponTime += RQ3_MP5_DISARM_DELAY;
|
||||||
break;
|
break;
|
||||||
case WP_KNIFE:
|
case WP_HANDCANNON:
|
||||||
pm->ps->weaponTime += RQ3_KNIFE_DISARM_DELAY;
|
pm->ps->weaponTime += RQ3_HANDCANNON_DISARM_DELAY;
|
||||||
break;
|
break;
|
||||||
case WP_GRENADE:
|
case WP_SSG3000:
|
||||||
pm->ps->weaponTime += RQ3_GRENADE_DISARM_DELAY;
|
pm->ps->weaponTime += RQ3_SSG3000_DISARM_DELAY;
|
||||||
break;
|
break;
|
||||||
default:
|
case WP_AKIMBO:
|
||||||
//Elder: shouldn't be here
|
pm->ps->weaponTime += RQ3_AKIMBO_DISARM_DELAY;
|
||||||
//G_Printf("PM_BeginWeaponChange: received bad weapon %d\n", pm->ps->weapon);
|
break;
|
||||||
pm->ps->weaponTime += 600;
|
case WP_KNIFE:
|
||||||
break;
|
pm->ps->weaponTime += RQ3_KNIFE_DISARM_DELAY;
|
||||||
|
break;
|
||||||
|
case WP_GRENADE:
|
||||||
|
pm->ps->weaponTime += RQ3_GRENADE_DISARM_DELAY;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//Elder: shouldn't be here
|
||||||
|
//G_Printf("PM_BeginWeaponChange: received bad weapon %d\n", pm->ps->weapon);
|
||||||
|
pm->ps->weaponTime += 600;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Elder: temp hack
|
||||||
|
if (pm->ps->weapon == WP_PISTOL ||
|
||||||
|
pm->ps->weapon == WP_M3 ||
|
||||||
|
pm->ps->weapon == WP_HANDCANNON)
|
||||||
|
PM_StartWeaponAnim(WP_ANIM_DISARM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pm->ps->weaponstate = WEAPON_DROPPING;
|
||||||
//Elder: temp hack
|
//Elder: temp hack
|
||||||
if (pm->ps->weapon == WP_PISTOL || pm->ps->weapon == WP_M3 || pm->ps->weapon == WP_HANDCANNON)
|
if (pm->ps->weapon == WP_PISTOL ||
|
||||||
|
pm->ps->weapon == WP_M3 ||
|
||||||
|
pm->ps->weapon == WP_HANDCANNON)
|
||||||
PM_StartWeaponAnim(WP_ANIM_DISARM);
|
PM_StartWeaponAnim(WP_ANIM_DISARM);
|
||||||
|
|
||||||
PM_StartTorsoAnim( TORSO_DROP );
|
PM_StartTorsoAnim( TORSO_DROP );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1870,7 +1901,9 @@ static void PM_FinishWeaponChange( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Elder: temp hack
|
//Elder: temp hack
|
||||||
if (pm->ps->weapon == WP_PISTOL || pm->ps->weapon == WP_M3 || pm->ps->weapon == WP_HANDCANNON)
|
if (pm->ps->weapon == WP_PISTOL ||
|
||||||
|
pm->ps->weapon == WP_M3 ||
|
||||||
|
pm->ps->weapon == WP_HANDCANNON)
|
||||||
PM_StartWeaponAnim(WP_ANIM_ACTIVATE);
|
PM_StartWeaponAnim(WP_ANIM_ACTIVATE);
|
||||||
|
|
||||||
PM_StartTorsoAnim( TORSO_RAISE );
|
PM_StartTorsoAnim( TORSO_RAISE );
|
||||||
|
@ -1894,7 +1927,9 @@ static void PM_TorsoAnimation( void ) {
|
||||||
// QUARANTINE - Weapon Animation
|
// QUARANTINE - Weapon Animation
|
||||||
// Should always draw the weapon when it is just ready
|
// Should always draw the weapon when it is just ready
|
||||||
//Elder: temp hack
|
//Elder: temp hack
|
||||||
if (pm->ps->weapon == WP_PISTOL || pm->ps->weapon == WP_M3 || pm->ps->weapon == WP_HANDCANNON)
|
if (pm->ps->weapon == WP_PISTOL ||
|
||||||
|
pm->ps->weapon == WP_M3 ||
|
||||||
|
pm->ps->weapon == WP_HANDCANNON)
|
||||||
PM_ContinueWeaponAnim( WP_ANIM_IDLE );
|
PM_ContinueWeaponAnim( WP_ANIM_IDLE );
|
||||||
// PM_ContinueWeaponAnim( WP_ANIM_READY );
|
// PM_ContinueWeaponAnim( WP_ANIM_READY );
|
||||||
|
|
||||||
|
@ -1913,12 +1948,12 @@ static void PM_WeaponAnimation( void ) {
|
||||||
{
|
{
|
||||||
PM_ContinueWeaponAnim( WP_ANIM_RELOAD );
|
PM_ContinueWeaponAnim( WP_ANIM_RELOAD );
|
||||||
}
|
}
|
||||||
else if (pm->ps->weaponstate == WEAPON_READY)
|
//else if (pm->ps->weaponstate == WEAPON_READY)
|
||||||
PM_ContinueWeaponAnim( WP_ANIM_IDLE );
|
//PM_ContinueWeaponAnim( WP_ANIM_IDLE );
|
||||||
else if (pm->ps->weaponstate == WEAPON_DROPPING)
|
//else if (pm->ps->weaponstate == WEAPON_DROPPING)
|
||||||
PM_ContinueWeaponAnim( WP_ANIM_DISARM );
|
//PM_ContinueWeaponAnim( WP_ANIM_DISARM );
|
||||||
else if (pm->ps->weaponstate == WEAPON_RAISING)
|
//else if (pm->ps->weaponstate == WEAPON_RAISING)
|
||||||
PM_ContinueWeaponAnim( WP_ANIM_ACTIVATE );
|
//PM_ContinueWeaponAnim( WP_ANIM_ACTIVATE );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2049,9 +2084,11 @@ static void PM_Weapon( void ) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Elder: added
|
//Elder: temp hack
|
||||||
if (pm->ps->weaponstate == WEAPON_READY &&
|
if (pm->ps->weaponstate == WEAPON_READY &&
|
||||||
(pm->ps->weapon == WP_PISTOL || pm->ps->weapon == WP_M3 || pm->ps->weapon == WP_HANDCANNON))
|
(pm->ps->weapon == WP_PISTOL ||
|
||||||
|
pm->ps->weapon == WP_M3 ||
|
||||||
|
pm->ps->weapon == WP_HANDCANNON))
|
||||||
PM_ContinueWeaponAnim(WP_ANIM_IDLE);
|
PM_ContinueWeaponAnim(WP_ANIM_IDLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2093,7 +2130,10 @@ static void PM_Weapon( void ) {
|
||||||
// QUARANTINE - Weapon Animation
|
// QUARANTINE - Weapon Animation
|
||||||
// Should always draw the weapon when it is just ready
|
// Should always draw the weapon when it is just ready
|
||||||
// PM_StartWeaponAnim( WP_ANIM_READY );
|
// PM_StartWeaponAnim( WP_ANIM_READY );
|
||||||
if (pm->ps->weapon == WP_PISTOL || pm->ps->weapon == WP_M3 || pm->ps->weapon == WP_HANDCANNON)
|
// temp hack
|
||||||
|
if (pm->ps->weapon == WP_PISTOL ||
|
||||||
|
pm->ps->weapon == WP_M3 ||
|
||||||
|
pm->ps->weapon == WP_HANDCANNON)
|
||||||
PM_StartWeaponAnim( WP_ANIM_IDLE );
|
PM_StartWeaponAnim( WP_ANIM_IDLE );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2178,7 +2218,9 @@ static void PM_Weapon( void ) {
|
||||||
// QUARANTINE - Weapon animations
|
// QUARANTINE - Weapon animations
|
||||||
// This should change pm->ps->generic1 so we can animate
|
// This should change pm->ps->generic1 so we can animate
|
||||||
// Elder: don't repeat if on semi-auto
|
// Elder: don't repeat if on semi-auto
|
||||||
if (pm->ps->weapon == WP_PISTOL || pm->ps->weapon == WP_M3 || pm->ps->weapon == WP_HANDCANNON)
|
if (pm->ps->weapon == WP_PISTOL ||
|
||||||
|
pm->ps->weapon == WP_M3 ||
|
||||||
|
pm->ps->weapon == WP_HANDCANNON)
|
||||||
PM_StartWeaponAnim( WP_ANIM_FIRE );
|
PM_StartWeaponAnim( WP_ANIM_FIRE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2741,8 +2783,10 @@ void PmoveSingle (pmove_t *pmove) {
|
||||||
PM_Weapon();
|
PM_Weapon();
|
||||||
|
|
||||||
//weapon animations(rq3 specific)
|
//weapon animations(rq3 specific)
|
||||||
//Elder: hack to avoid messing up fast-reloads
|
//Elder: temp hack to avoid messing up fast-reloads
|
||||||
if (pm->ps->weapon == WP_PISTOL || pm->ps->weapon == WP_M3 || pm->ps->weapon == WP_HANDCANNON)
|
if (pm->ps->weapon == WP_PISTOL ||
|
||||||
|
pm->ps->weapon == WP_M3 ||
|
||||||
|
pm->ps->weapon == WP_HANDCANNON )
|
||||||
PM_WeaponAnimation();
|
PM_WeaponAnimation();
|
||||||
|
|
||||||
// torso animation
|
// torso animation
|
||||||
|
|
|
@ -374,7 +374,7 @@ typedef enum {
|
||||||
WEAPON_RAISING, //sync with WP_ANIM_ACTIVATE
|
WEAPON_RAISING, //sync with WP_ANIM_ACTIVATE
|
||||||
WEAPON_DROPPING, //sync with WP_ANIM_DISARM
|
WEAPON_DROPPING, //sync with WP_ANIM_DISARM
|
||||||
WEAPON_FIRING, //sync with WP_ANIM_FIRE
|
WEAPON_FIRING, //sync with WP_ANIM_FIRE
|
||||||
WEAPON_RELOADING //sync with WP_ANIM_RELOAD
|
WEAPON_RELOADING, //sync with WP_ANIM_RELOAD
|
||||||
} weaponstate_t;
|
} weaponstate_t;
|
||||||
|
|
||||||
//Blaze: for the weapon animation states
|
//Blaze: for the weapon animation states
|
||||||
|
@ -385,7 +385,7 @@ typedef enum {
|
||||||
WP_ANIM_IDLE,
|
WP_ANIM_IDLE,
|
||||||
WP_ANIM_DISARM,
|
WP_ANIM_DISARM,
|
||||||
WP_ANIM_ACTIVATE,
|
WP_ANIM_ACTIVATE,
|
||||||
//WP_ANIM_FIRE2,
|
//WP_ANIM_EMPTY,
|
||||||
MAX_WEAPON_ANIMATIONS
|
MAX_WEAPON_ANIMATIONS
|
||||||
} wpAnimNumber_t;
|
} wpAnimNumber_t;
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ typedef enum {
|
||||||
|
|
||||||
|
|
||||||
STAT_CLIENTS_READY, // bit mask of clients wishing to exit the intermission (FIXME: configstring?)
|
STAT_CLIENTS_READY, // bit mask of clients wishing to exit the intermission (FIXME: configstring?)
|
||||||
// STAT_MAX_HEALTH, // health / armor limit, changable by handicap
|
//STAT_MAX_HEALTH, // health / armor limit, changable by handicap
|
||||||
|
|
||||||
//These are RQ3-related specific stats
|
//These are RQ3-related specific stats
|
||||||
STAT_CLIPS, // Num Clips player currently has
|
STAT_CLIPS, // Num Clips player currently has
|
||||||
|
@ -482,7 +482,7 @@ typedef enum {
|
||||||
//Elder: zoom stat - 1x = 0, 2x = zoom low, 4x = zoom_med, 6x = zoom_low + zoom_med
|
//Elder: zoom stat - 1x = 0, 2x = zoom low, 4x = zoom_med, 6x = zoom_low + zoom_med
|
||||||
#define RQ3_ZOOM_LOW 8
|
#define RQ3_ZOOM_LOW 8
|
||||||
#define RQ3_ZOOM_MED 16
|
#define RQ3_ZOOM_MED 16
|
||||||
|
#define RQ3_THROWWEAPON 32 //Present if dropping weapon via cmd or kicked away
|
||||||
|
|
||||||
|
|
||||||
// player_state->persistant[] indexes
|
// player_state->persistant[] indexes
|
||||||
|
@ -610,6 +610,22 @@ typedef enum {
|
||||||
WP_NUM_WEAPONS
|
WP_NUM_WEAPONS
|
||||||
} weapon_t;
|
} weapon_t;
|
||||||
|
|
||||||
|
// Elder: for our end-level awards later on
|
||||||
|
typedef enum {
|
||||||
|
RECORD_HEADSHOTS,
|
||||||
|
RECORD_CHESTSHOTS,
|
||||||
|
RECORD_STOMACHSHOTS,
|
||||||
|
RECORD_LEGSHOTS,
|
||||||
|
RECORD_FALLINGDEATHS,
|
||||||
|
RECORD_CAMPCOUNT,
|
||||||
|
RECORD_JUMPCOUNT, // e.g. rabbit or monkey award
|
||||||
|
RECORD_SUICIDES, // e.g. for MPELP award
|
||||||
|
RECORD_STEALTHKILLS,
|
||||||
|
RECORD_FRAGSTEALS,
|
||||||
|
|
||||||
|
RECORD_TOTAL
|
||||||
|
} rq3record_t;
|
||||||
|
|
||||||
|
|
||||||
//Elder: added
|
//Elder: added
|
||||||
//
|
//
|
||||||
|
@ -645,6 +661,9 @@ typedef enum {
|
||||||
EV_FOOTSTEP,
|
EV_FOOTSTEP,
|
||||||
EV_FOOTSTEP_METAL,
|
EV_FOOTSTEP_METAL,
|
||||||
EV_FOOTSTEP_GRASS, // Elder: new surfaces
|
EV_FOOTSTEP_GRASS, // Elder: new surfaces
|
||||||
|
EV_FOOTSTEP_WOOD,
|
||||||
|
EV_FOOTSTEP_CARPET,
|
||||||
|
EV_FOOTSTEP_METAL2,
|
||||||
EV_FOOTSPLASH,
|
EV_FOOTSPLASH,
|
||||||
EV_FOOTWADE,
|
EV_FOOTWADE,
|
||||||
EV_SWIM,
|
EV_SWIM,
|
||||||
|
|
|
@ -906,7 +906,14 @@ int ThrowWeapon( gentity_t *ent, qboolean forceThrow )
|
||||||
//Elder: Don't reset the weapon ammo
|
//Elder: Don't reset the weapon ammo
|
||||||
//client->ps.ammo[ weap ] = 0;
|
//client->ps.ammo[ weap ] = 0;
|
||||||
client->pers.hadUniqueWeapon[weap] = qtrue;
|
client->pers.hadUniqueWeapon[weap] = qtrue;
|
||||||
trap_SendServerCommand( ent-g_entities, va("selectpistol"));
|
|
||||||
|
|
||||||
|
//Elder: for immediate weapon drops
|
||||||
|
if (client->ps.weapon == weap)
|
||||||
|
{
|
||||||
|
client->ps.stats[STAT_RQ3] |= RQ3_THROWWEAPON;
|
||||||
|
trap_SendServerCommand( ent-g_entities, va("selectpistol"));
|
||||||
|
}
|
||||||
|
|
||||||
client->ps.stats[STAT_WEAPONS] &= ~( 1 << weap);
|
client->ps.stats[STAT_WEAPONS] &= ~( 1 << weap);
|
||||||
xr_drop= dropWeapon( ent, xr_item, 0, FL_DROPPED_ITEM | FL_THROWN_ITEM );
|
xr_drop= dropWeapon( ent, xr_item, 0, FL_DROPPED_ITEM | FL_THROWN_ITEM );
|
||||||
|
|
|
@ -1279,6 +1279,9 @@ void ClientSpawn(gentity_t *ent) {
|
||||||
// set default animations
|
// set default animations
|
||||||
client->ps.torsoAnim = TORSO_STAND;
|
client->ps.torsoAnim = TORSO_STAND;
|
||||||
client->ps.legsAnim = LEGS_IDLE;
|
client->ps.legsAnim = LEGS_IDLE;
|
||||||
|
// weapon animations
|
||||||
|
client->ps.generic1 = ( ( client->ps.generic1 & ANIM_TOGGLEBIT )
|
||||||
|
^ ANIM_TOGGLEBIT ) | WP_ANIM_IDLE;
|
||||||
|
|
||||||
if ( level.intermissiontime ) {
|
if ( level.intermissiontime ) {
|
||||||
MoveClientToIntermission( ent );
|
MoveClientToIntermission( ent );
|
||||||
|
|
|
@ -451,6 +451,9 @@ void Cmd_LevelShot_f( gentity_t *ent ) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
|
Elder: WTF... this is the wrong description, but it was
|
||||||
|
like this in the 1.29h source
|
||||||
|
|
||||||
Cmd_LevelShot_f
|
Cmd_LevelShot_f
|
||||||
|
|
||||||
This is just to help generate the level pictures
|
This is just to help generate the level pictures
|
||||||
|
@ -876,15 +879,20 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
|
||||||
if (validation != SAY_OK)
|
if (validation != SAY_OK)
|
||||||
{
|
{
|
||||||
// Only send one message for the initial offense
|
// Only send one message for the initial offense
|
||||||
if (ent->client->pers.sayMuteTime == level.time)
|
if (ent->client->pers.sayMuteTime == level.time && ent->client->pers.sayModerated == qfalse)
|
||||||
{
|
{
|
||||||
|
ent->client->pers.sayModerated = qtrue;
|
||||||
if (validation == SAY_WARNING)
|
if (validation == SAY_WARNING)
|
||||||
{
|
{
|
||||||
trap_SendServerCommand( ent-g_entities, va("print \"Exceeded message limit - ^3WARNING ^7(%i seconds).\n\"", SAY_WARNING_TIME));
|
trap_SendServerCommand( ent-g_entities, va("print \"Exceeded message limit - ^3WARNING ^7(%i seconds).\n\"", g_RQ3_messageWarnTime.integer));
|
||||||
|
G_LogPrintf( "Server: %s received a message protect warning (offense %i)\n", ent->client->pers.netname, ent->client->pers.sayWarnings);
|
||||||
}
|
}
|
||||||
else if (validation == SAY_BAN)
|
else if (validation == SAY_BAN)
|
||||||
{
|
{
|
||||||
trap_SendServerCommand( ent-g_entities, va("print \"Exceeded message limit - ^1BAN ^7(%i seconds).\n\"", SAY_BAN_TIME));
|
// Don't bother printing if kicked
|
||||||
|
if (g_RQ3_messageBanTime.integer > 0)
|
||||||
|
trap_SendServerCommand( ent-g_entities, va("print \"Exceeded message limit - ^1BAN ^7(%i seconds).\n\"", g_RQ3_messageBanTime.integer));
|
||||||
|
G_LogPrintf( "Server: %s received a message protect ban (offense %i)\n", ent->client->pers.netname, ent->client->pers.sayBans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1669,7 +1677,9 @@ void Cmd_Bandage (gentity_t *ent)
|
||||||
ent->client->ps.weaponstate = WEAPON_DROPPING;
|
ent->client->ps.weaponstate = WEAPON_DROPPING;
|
||||||
|
|
||||||
//Elder: temp hack
|
//Elder: temp hack
|
||||||
if (ent->client->ps.weapon == WP_PISTOL || ent->client->ps.weapon == WP_M3)
|
if (ent->client->ps.weapon == WP_PISTOL ||
|
||||||
|
ent->client->ps.weapon == WP_M3 ||
|
||||||
|
ent->client->ps.weapon == WP_HANDCANNON)
|
||||||
{
|
{
|
||||||
ent->client->ps.generic1 = ( ( ent->client->ps.generic1 & ANIM_TOGGLEBIT )
|
ent->client->ps.generic1 = ( ( ent->client->ps.generic1 & ANIM_TOGGLEBIT )
|
||||||
^ ANIM_TOGGLEBIT ) | WP_ANIM_DISARM;
|
^ ANIM_TOGGLEBIT ) | WP_ANIM_DISARM;
|
||||||
|
@ -2548,12 +2558,74 @@ spam from reaching other clients.
|
||||||
|
|
||||||
int RQ3_ValidateSay ( gentity_t *ent )
|
int RQ3_ValidateSay ( gentity_t *ent )
|
||||||
{
|
{
|
||||||
int timeCheck;
|
int timeCheck;
|
||||||
|
int warnTime;
|
||||||
|
int banTime;
|
||||||
|
int intervalTime;
|
||||||
|
int maxWarnings;
|
||||||
|
int maxMessages;
|
||||||
|
|
||||||
if (ent->client->pers.sayWarnings)
|
if (g_RQ3_messageProtect.integer == 0)
|
||||||
timeCheck = SAY_WARNING_TIME * 1000;
|
return SAY_OK;
|
||||||
|
|
||||||
|
// Check for good cvar values and set them to defaults if bad
|
||||||
|
// We use local vars because the cvars may not update in time for use
|
||||||
|
|
||||||
|
// message count
|
||||||
|
if (g_RQ3_messageMaxCount.integer < 0)
|
||||||
|
{
|
||||||
|
maxMessages = atoi(SAY_MAX_NUMBER);
|
||||||
|
trap_Cvar_Set( "sv_RQ3_messageMaxCount", SAY_MAX_NUMBER);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
timeCheck = SAY_BAN_TIME * 1000;
|
maxMessages = g_RQ3_messageMaxCount.integer;
|
||||||
|
|
||||||
|
// warning time
|
||||||
|
if (g_RQ3_messageWarnTime.integer < 0)
|
||||||
|
{
|
||||||
|
warnTime = atoi(SAY_WARNING_TIME);
|
||||||
|
trap_Cvar_Set( "sv_RQ3_messageWarnTime", SAY_WARNING_TIME);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
warnTime = g_RQ3_messageWarnTime.integer;
|
||||||
|
|
||||||
|
// max warnings
|
||||||
|
if (g_RQ3_messageMaxWarnings.integer < 0)
|
||||||
|
{
|
||||||
|
maxWarnings = atoi(SAY_MAX_WARNINGS);
|
||||||
|
trap_Cvar_Set( "sv_RQ3_messageMaxWarnings", SAY_MAX_WARNINGS);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
maxWarnings = g_RQ3_messageMaxWarnings.integer;
|
||||||
|
|
||||||
|
// ban time
|
||||||
|
if (g_RQ3_messageBanTime.integer < 0)
|
||||||
|
{
|
||||||
|
banTime = atoi(SAY_BAN_TIME);
|
||||||
|
trap_Cvar_Set( "sv_RQ3_messageBanTime", SAY_BAN_TIME);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
banTime = g_RQ3_messageBanTime.integer;
|
||||||
|
|
||||||
|
// interval time
|
||||||
|
if (g_RQ3_messageInterval.integer < 0)
|
||||||
|
{
|
||||||
|
intervalTime = atoi(SAY_PERIOD_TIME);
|
||||||
|
trap_Cvar_Set( "sv_RQ3_messageInterval", SAY_PERIOD_TIME);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
intervalTime = g_RQ3_messageInterval.integer;
|
||||||
|
|
||||||
|
|
||||||
|
// seconds to milliseconds
|
||||||
|
if (ent->client->pers.sayWarnings)
|
||||||
|
{
|
||||||
|
timeCheck = warnTime * 1000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
timeCheck = banTime * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
// check if already warned/banned
|
// check if already warned/banned
|
||||||
if (ent->client->pers.sayMuteTime &&
|
if (ent->client->pers.sayMuteTime &&
|
||||||
|
@ -2566,17 +2638,22 @@ int RQ3_ValidateSay ( gentity_t *ent )
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if a flooder
|
// check if a flooder
|
||||||
if (ent->client->pers.sayCount >= SAY_MAX_NUMBER &&
|
if (ent->client->pers.sayCount >= maxMessages &&
|
||||||
level.time - ent->client->pers.sayTime < SAY_PERIOD_TIME * 1000)
|
level.time - ent->client->pers.sayTime < intervalTime * 1000)
|
||||||
{
|
{
|
||||||
ent->client->pers.sayMuteTime = level.time;
|
ent->client->pers.sayMuteTime = level.time;
|
||||||
|
|
||||||
// determine penalty level
|
// determine penalty level
|
||||||
if (ent->client->pers.sayWarnings >= SAY_MAX_WARNINGS)
|
if (ent->client->pers.sayWarnings >= maxWarnings)
|
||||||
{
|
{
|
||||||
// bans never reset, but warnings do
|
// bans never reset, but warnings do
|
||||||
ent->client->pers.sayBans++;
|
ent->client->pers.sayBans++;
|
||||||
ent->client->pers.sayWarnings = 0;
|
ent->client->pers.sayWarnings = 0;
|
||||||
|
|
||||||
|
// kick if no ban time is set
|
||||||
|
if (banTime == 0)
|
||||||
|
trap_DropClient(ent->s.clientNum, "Dropped due to chat abuse");
|
||||||
|
|
||||||
return SAY_BAN;
|
return SAY_BAN;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2587,11 +2664,12 @@ int RQ3_ValidateSay ( gentity_t *ent )
|
||||||
}
|
}
|
||||||
|
|
||||||
// regular say check
|
// regular say check
|
||||||
if (level.time - ent->client->pers.sayTime > SAY_PERIOD_TIME * 1000)
|
if (level.time - ent->client->pers.sayTime > intervalTime * 1000)
|
||||||
{
|
{
|
||||||
ent->client->pers.sayCount = 0;
|
ent->client->pers.sayCount = 0;
|
||||||
ent->client->pers.sayTime = level.time;
|
ent->client->pers.sayTime = level.time;
|
||||||
ent->client->pers.sayMuteTime = 0;
|
ent->client->pers.sayMuteTime = 0;
|
||||||
|
ent->client->pers.sayModerated = qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
ent->client->pers.sayCount++;
|
ent->client->pers.sayCount++;
|
||||||
|
|
|
@ -818,8 +818,11 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
|
||||||
( ( self->client->ps.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim;
|
( ( self->client->ps.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim;
|
||||||
|
|
||||||
// Elder: only do death sounds if not hit in the head
|
// Elder: only do death sounds if not hit in the head
|
||||||
if ((self->client->lasthurt_location & LOCATION_HEAD) != LOCATION_HEAD &&
|
//G_Printf("Shot Diff: %i\n", level.time - self->client->headShotTime);
|
||||||
(self->client->lasthurt_location & LOCATION_FACE) != LOCATION_FACE )
|
|
||||||
|
//if ((self->client->lasthurt_location & LOCATION_HEAD) != LOCATION_HEAD &&
|
||||||
|
//(self->client->lasthurt_location & LOCATION_FACE) != LOCATION_FACE &&
|
||||||
|
if (level.time - self->client->headShotTime > 400)
|
||||||
G_AddEvent( self, EV_DEATH1 + i, killer );
|
G_AddEvent( self, EV_DEATH1 + i, killer );
|
||||||
|
|
||||||
// the body can still be gibbed
|
// the body can still be gibbed
|
||||||
|
@ -1631,6 +1634,9 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
|
||||||
{
|
{
|
||||||
case LOCATION_HEAD:
|
case LOCATION_HEAD:
|
||||||
case LOCATION_FACE:
|
case LOCATION_FACE:
|
||||||
|
//save headshot time for player_die
|
||||||
|
targ->client->headShotTime = level.time;
|
||||||
|
|
||||||
//Elder: reusing line so we don't have to declare more variables
|
//Elder: reusing line so we don't have to declare more variables
|
||||||
line[0] = 0;
|
line[0] = 0;
|
||||||
line[1] = 0;
|
line[1] = 0;
|
||||||
|
|
|
@ -269,17 +269,24 @@ typedef struct {
|
||||||
int sayWarnings;
|
int sayWarnings;
|
||||||
int sayBans;
|
int sayBans;
|
||||||
int sayMuteTime;
|
int sayMuteTime;
|
||||||
|
qboolean sayModerated; // so warnings are not repeated for multi-line, same-frame messages
|
||||||
|
|
||||||
} clientPersistant_t;
|
} clientPersistant_t;
|
||||||
|
|
||||||
|
|
||||||
// Elder: spam prevention defaults
|
// Elder: spam prevention defaults
|
||||||
|
/*
|
||||||
#define SAY_MAX_NUMBER 6
|
#define SAY_MAX_NUMBER 6
|
||||||
#define SAY_MAX_WARNINGS 3
|
#define SAY_MAX_WARNINGS 3
|
||||||
#define SAY_PERIOD_TIME 3 // Elder: in seconds
|
#define SAY_PERIOD_TIME 3 // Elder: in seconds
|
||||||
#define SAY_WARNING_TIME 15
|
#define SAY_WARNING_TIME 15
|
||||||
#define SAY_BAN_TIME 60 // Technically should drop client
|
#define SAY_BAN_TIME 60 // Technically should drop client
|
||||||
|
*/
|
||||||
|
#define SAY_MAX_NUMBER "6"
|
||||||
|
#define SAY_MAX_WARNINGS "3"
|
||||||
|
#define SAY_PERIOD_TIME "3" // Elder: in seconds
|
||||||
|
#define SAY_WARNING_TIME "15"
|
||||||
|
#define SAY_BAN_TIME "60" // Technically should drop client
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
SAY_BAN,
|
SAY_BAN,
|
||||||
|
@ -393,6 +400,7 @@ struct gclient_s {
|
||||||
// int legDamage; //Blaze: Client has leg damage - holds number of hits too
|
// int legDamage; //Blaze: Client has leg damage - holds number of hits too
|
||||||
int bleedtick; //Blaze: Holds # of seconds till bleeding stops.
|
int bleedtick; //Blaze: Holds # of seconds till bleeding stops.
|
||||||
int bleedBandageCount; //Elder: hack to restrict amount of bleeding to 6 points
|
int bleedBandageCount; //Elder: hack to restrict amount of bleeding to 6 points
|
||||||
|
int headShotTime; // Elder: got headshot?
|
||||||
|
|
||||||
//Elder: server only needs to know for sniper spread - ARGH
|
//Elder: server only needs to know for sniper spread - ARGH
|
||||||
// int zoomed; // Hawkins (SSG zoom)
|
// int zoomed; // Hawkins (SSG zoom)
|
||||||
|
@ -410,6 +418,8 @@ struct gclient_s {
|
||||||
int consecutiveShots; // Elder: for M4 ride-up/kick
|
int consecutiveShots; // Elder: for M4 ride-up/kick
|
||||||
int uniqueWeapons; // Elder: formerly a stat, now just a server var
|
int uniqueWeapons; // Elder: formerly a stat, now just a server var
|
||||||
int uniqueItems;
|
int uniqueItems;
|
||||||
|
//int records[RECORD_TOTAL]; // Elder: for our awards when we implement it
|
||||||
|
|
||||||
|
|
||||||
#ifdef MISSIONPACK
|
#ifdef MISSIONPACK
|
||||||
gentity_t *persistantPowerup;
|
gentity_t *persistantPowerup;
|
||||||
|
@ -920,6 +930,13 @@ extern vmCvar_t g_proxMineTimeout;
|
||||||
//Blaze: Reaction cvars
|
//Blaze: Reaction cvars
|
||||||
extern vmCvar_t g_rxn_knifelimit;
|
extern vmCvar_t g_rxn_knifelimit;
|
||||||
extern vmCvar_t g_RQ3_maxWeapons;
|
extern vmCvar_t g_RQ3_maxWeapons;
|
||||||
|
//Elder: spam protection cvars
|
||||||
|
extern vmCvar_t g_RQ3_messageMaxCount; // Max messages in interval
|
||||||
|
extern vmCvar_t g_RQ3_messageInterval; // Time interval for spam check
|
||||||
|
extern vmCvar_t g_RQ3_messageMaxWarnings; // Max warning count
|
||||||
|
extern vmCvar_t g_RQ3_messageWarnTime; // Time for warning; 0 for no-penalty warning
|
||||||
|
extern vmCvar_t g_RQ3_messageBanTime; // Time for ban; 0 to kick
|
||||||
|
extern vmCvar_t g_RQ3_messageProtect; // Elder: 0 disable, non-zero enable
|
||||||
|
|
||||||
void trap_Printf( const char *fmt );
|
void trap_Printf( const char *fmt );
|
||||||
void trap_Error( const char *fmt );
|
void trap_Error( const char *fmt );
|
||||||
|
|
|
@ -64,6 +64,13 @@ vmCvar_t g_listEntity;
|
||||||
//Blaze: Reaction cvars
|
//Blaze: Reaction cvars
|
||||||
vmCvar_t g_rxn_knifelimit;
|
vmCvar_t g_rxn_knifelimit;
|
||||||
vmCvar_t g_RQ3_maxWeapons;
|
vmCvar_t g_RQ3_maxWeapons;
|
||||||
|
//Elder: spam protection cvars
|
||||||
|
vmCvar_t g_RQ3_messageMaxCount;
|
||||||
|
vmCvar_t g_RQ3_messageInterval;
|
||||||
|
vmCvar_t g_RQ3_messageMaxWarnings;
|
||||||
|
vmCvar_t g_RQ3_messageWarnTime;
|
||||||
|
vmCvar_t g_RQ3_messageBanTime;
|
||||||
|
vmCvar_t g_RQ3_messageProtect;
|
||||||
#ifdef MISSIONPACK
|
#ifdef MISSIONPACK
|
||||||
vmCvar_t g_obeliskHealth;
|
vmCvar_t g_obeliskHealth;
|
||||||
vmCvar_t g_obeliskRegenPeriod;
|
vmCvar_t g_obeliskRegenPeriod;
|
||||||
|
@ -163,7 +170,13 @@ static cvarTable_t gameCvarTable[] = {
|
||||||
|
|
||||||
{ &g_rankings, "g_rankings", "0", 0, 0, qfalse},
|
{ &g_rankings, "g_rankings", "0", 0, 0, qfalse},
|
||||||
//Blaze: Reaction stuff
|
//Blaze: Reaction stuff
|
||||||
{ &g_RQ3_maxWeapons, "g_RQ3_maxWeapons", "1",0,0,qtrue}
|
{ &g_RQ3_maxWeapons, "g_RQ3_maxWeapons", "1",0,0, qtrue},
|
||||||
|
{ &g_RQ3_messageMaxCount, "sv_RQ3_messageMaxCount", SAY_MAX_NUMBER, CVAR_ARCHIVE, 0, qfalse },
|
||||||
|
{ &g_RQ3_messageInterval, "sv_RQ3_messageInterval", SAY_PERIOD_TIME, CVAR_ARCHIVE, 0, qfalse },
|
||||||
|
{ &g_RQ3_messageMaxWarnings, "sv_RQ3_messageMaxWarnings", SAY_MAX_WARNINGS, CVAR_ARCHIVE, 0, qfalse },
|
||||||
|
{ &g_RQ3_messageWarnTime, "sv_RQ3_messageWarnTime", SAY_WARNING_TIME, CVAR_ARCHIVE, 0, qfalse },
|
||||||
|
{ &g_RQ3_messageBanTime, "sv_RQ3_messageBanTime", SAY_BAN_TIME, CVAR_ARCHIVE, 0, qfalse },
|
||||||
|
{ &g_RQ3_messageProtect, "sv_RQ3_messageProtect", "1", CVAR_ARCHIVE | CVAR_SERVERINFO, 0, qtrue}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -59,5 +59,8 @@
|
||||||
#define SURF_NODLIGHT 0x20000 // don't dlight even if solid (solid lava, skies)
|
#define SURF_NODLIGHT 0x20000 // don't dlight even if solid (solid lava, skies)
|
||||||
#define SURF_DUST 0x40000 // leave a dust trail when walking on this surface
|
#define SURF_DUST 0x40000 // leave a dust trail when walking on this surface
|
||||||
//Elder: new surfaces
|
//Elder: new surfaces
|
||||||
#define SURF_GRASS 0x80000 // grass footsteps and turf hits later
|
#define SURF_GRASS 0x80000
|
||||||
//#define SURF_CERAMIC 0x100000
|
#define SURF_WOOD 0x100000
|
||||||
|
#define SURF_CARPET 0x200000
|
||||||
|
#define SURF_METAL2 0x400000
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue