summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/g_admin.c54
-rw-r--r--src/game/g_admin.h1
-rw-r--r--src/game/g_client.c5
-rw-r--r--src/game/g_local.h6
-rw-r--r--src/game/g_weapon.c18
5 files changed, 78 insertions, 6 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 9fcfdef..356369c 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -446,6 +446,11 @@ g_admin_cmd_t g_admin_cmds[ ] =
{"god", G_admin_god, "god",
"makes a player invincible",
"[^3name|slot#^7]"
+ },
+
+ {"range", G_admin_range, "range",
+ "changes a player's bite/swipe/chomp range",
+ "[^3name|slot#^7] [^5range^7]"
}
};
@@ -8609,3 +8614,52 @@ qboolean G_admin_god( gentity_t *ent, int skiparg )
return qtrue;
}
+
+qboolean G_admin_range( gentity_t *ent, int skiparg )
+{
+ int pids[ MAX_CLIENTS ];
+ char name[ MAX_NAME_LENGTH ], err[ MAX_STRING_CHARS ];
+ int minargc;
+ gentity_t *vic;
+ adminRangeBoosts_t *newRange;
+ char rangeInt[ MAX_STRING_CHARS ];
+ float value;
+ minargc = 3 + skiparg;
+
+ if( G_SayArgc() < minargc )
+ {
+ ADMP( "^3!range: ^7usage: !range [name|slot#] [range]\n" );
+ return qfalse;
+ }
+
+ G_SayArgv( 1 + skiparg, name, sizeof( name ) );
+ G_SayArgv( 2 + skiparg, rangeInt, sizeof( rangeInt ) );
+
+ if( G_ClientNumbersFromString( name, pids ) != 1 )
+ {
+ G_MatchOnePlayer( pids, err, sizeof( err ) );
+ ADMP( va( "^3!range: ^7%s\n", err ) );
+ return qfalse;
+ }
+
+ vic = &g_entities[ pids[ 0 ] ];
+
+ if( !admin_higher( ent, &g_entities[ pids[ 0 ] ] ) )
+ {
+ ADMP( "^3!range: ^7sorry, but that player has a higher admin"
+ " level than you\n" );
+ return qfalse;
+ }
+
+ newRange = &vic->client->newRange;
+ value = atof( rangeInt );
+ newRange->rangeBoost = value - 1.0f;
+
+ AP( va( "print \"^3!range: ^7range for %s ^7was multipled by ^2%s ^7by %s^7\n\"",
+ vic->client->pers.netname,
+ rangeInt,
+ ( ent ) ? G_admin_adminPrintName( ent ) : "console" ) );
+
+ return qtrue;
+
+}
diff --git a/src/game/g_admin.h b/src/game/g_admin.h
index 81ff5ff..1d3b254 100644
--- a/src/game/g_admin.h
+++ b/src/game/g_admin.h
@@ -310,6 +310,7 @@ qboolean G_admin_print2( gentity_t *ent, int skiparg );
qboolean G_admin_switch( gentity_t *ent, int skiparg );
qboolean G_admin_drug( gentity_t *ent, int skiparg );
qboolean G_admin_god( gentity_t *ent, int skiparg );
+qboolean G_admin_range( gentity_t *ent, int skiparg );
void G_admin_print( gentity_t *ent, char *m );
void G_admin_buffer_print( gentity_t *ent, char *m );
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 313927c..6a8bcc5 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1737,6 +1737,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
vec3_t up = { 0.0f, 0.0f, 1.0f };
int maxAmmo, maxClips;
weapon_t weapon;
+ adminRangeBoosts_t savedRanges;
index = ent - g_entities;
@@ -1818,6 +1819,8 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
for( i = 0; i < MAX_PERSISTANT; i++ )
persistant[ i ] = client->ps.persistant[ i ];
+ memcpy( &savedRanges, &client->newRange, sizeof( adminRangeBoosts_t ) );
+
eventSequence = client->ps.eventSequence;
memset( client, 0, sizeof( *client ) );
@@ -1826,6 +1829,8 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles
client->ps.ping = savedPing;
client->lastkilled_client = -1;
+ memcpy( &client->newRange, &savedRanges, sizeof( adminRangeBoosts_t ) );
+
for( i = 0; i < MAX_PERSISTANT; i++ )
client->ps.persistant[ i ] = persistant[ i ];
diff --git a/src/game/g_local.h b/src/game/g_local.h
index f15e5c6..e673583 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -464,6 +464,10 @@ typedef struct unlagged_s {
qboolean used;
} unlagged_t;
+typedef struct {
+ float rangeBoost;
+} adminRangeBoosts_t;
+
// this structure is cleared on each ClientSpawn(),
// except for 'client->pers' and 'client->sess'
struct gclient_s
@@ -563,6 +567,8 @@ struct gclient_s
int tkcredits[ MAX_CLIENTS ];
+ adminRangeBoosts_t newRange;
+
};
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index a74a4bf..316124c 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -885,6 +885,8 @@ qboolean CheckVenomAttack( gentity_t *ent )
gentity_t *traceEnt;
vec3_t mins, maxs;
int damage = LEVEL0_BITE_DMG;
+ adminRangeBoosts_t *newRange;
+ newRange = &ent->client->newRange;
VectorSet( mins, -LEVEL0_BITE_WIDTH, -LEVEL0_BITE_WIDTH, -LEVEL0_BITE_WIDTH );
VectorSet( maxs, LEVEL0_BITE_WIDTH, LEVEL0_BITE_WIDTH, LEVEL0_BITE_WIDTH );
@@ -894,7 +896,7 @@ qboolean CheckVenomAttack( gentity_t *ent )
CalcMuzzlePoint( ent, forward, right, up, muzzle );
- VectorMA( muzzle, LEVEL0_BITE_RANGE, forward, end );
+ VectorMA( muzzle, LEVEL0_BITE_RANGE * ( newRange->rangeBoost + 1.0f ), forward, end );
G_UnlaggedOn( ent, muzzle, LEVEL0_BITE_RANGE );
trap_Trace( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT );
@@ -1574,6 +1576,10 @@ FireWeapon
*/
void FireWeapon( gentity_t *ent )
{
+
+ adminRangeBoosts_t *newRange;
+ newRange = &ent->client->newRange;
+
if( level.paused ) return;
if( ent->client )
@@ -1593,20 +1599,20 @@ void FireWeapon( gentity_t *ent )
{
case WP_ALEVEL1:
case WP_ALEVEL1_UPG:
- meleeAttack( ent, LEVEL1_CLAW_RANGE, LEVEL1_CLAW_WIDTH, LEVEL1_CLAW_DMG, MOD_LEVEL1_CLAW );
+ meleeAttack( ent, LEVEL1_CLAW_RANGE * ( newRange->rangeBoost + 1.0f ), LEVEL1_CLAW_WIDTH, LEVEL1_CLAW_DMG, MOD_LEVEL1_CLAW );
break;
case WP_ALEVEL3:
case WP_ALEVEL3_UPG:
- meleeAttack( ent, LEVEL3_CLAW_RANGE, LEVEL3_CLAW_WIDTH, LEVEL3_CLAW_DMG, MOD_LEVEL3_CLAW );
+ meleeAttack( ent, LEVEL3_CLAW_RANGE * ( newRange->rangeBoost + 1.0f ), LEVEL3_CLAW_WIDTH, LEVEL3_CLAW_DMG, MOD_LEVEL3_CLAW );
break;
case WP_ALEVEL2:
- meleeAttack( ent, LEVEL2_CLAW_RANGE, LEVEL2_CLAW_WIDTH, LEVEL2_CLAW_DMG, MOD_LEVEL2_CLAW );
+ meleeAttack( ent, LEVEL2_CLAW_RANGE * ( newRange->rangeBoost + 1.0f ), LEVEL2_CLAW_WIDTH, LEVEL2_CLAW_DMG, MOD_LEVEL2_CLAW );
break;
case WP_ALEVEL2_UPG:
- meleeAttack( ent, LEVEL2_CLAW_RANGE, LEVEL2_CLAW_WIDTH, LEVEL2_CLAW_DMG, MOD_LEVEL2_CLAW );
+ meleeAttack( ent, LEVEL2_CLAW_RANGE * ( newRange->rangeBoost + 1.0f ), LEVEL2_CLAW_WIDTH, LEVEL2_CLAW_DMG, MOD_LEVEL2_CLAW );
break;
case WP_ALEVEL4:
- meleeAttack( ent, LEVEL4_CLAW_RANGE, LEVEL4_CLAW_WIDTH, LEVEL4_CLAW_DMG, MOD_LEVEL4_CLAW );
+ meleeAttack( ent, LEVEL4_CLAW_RANGE * ( newRange->rangeBoost + 1.0f ), LEVEL4_CLAW_WIDTH, LEVEL4_CLAW_DMG, MOD_LEVEL4_CLAW );
break;
case WP_BLASTER: