summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorenneract <trem.redman@gmail.com>2014-12-20 20:07:54 +0100
committerenneract <trem.redman@gmail.com>2014-12-20 20:07:54 +0100
commit74be23bb4d9e5fe441ce25008281e4cfc387185e (patch)
tree5af9e0f2016f9cf81948224108934ea1ae4abbfe /src/game
parentf5c4bc00cf6307c14a6037a1f0a68259e4fe2ac8 (diff)
Add logging of weapon settings at game init.
Also adds a few missing weapons and hardcodes Lightning Gun's settings.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_admin.c2
-rw-r--r--src/game/g_combat.c39
-rw-r--r--src/game/g_csw.h54
-rw-r--r--src/game/g_local.h3
-rw-r--r--src/game/g_main.c9
-rw-r--r--src/game/g_weapon.c11
-rw-r--r--src/game/tremulous.h3
7 files changed, 80 insertions, 41 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index c407788..a6f5f78 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -4387,7 +4387,7 @@ qboolean G_admin_stats( gentity_t *ent )
qboolean header = qfalse;
const static char *cswNames[ ] =
{
-#define CSW(a,b) b
+#define CSW(a,b,c) b
#include "g_csw.h"
#undef CSW
};
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 7713d2a..337ebf1 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -1138,6 +1138,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
vec3_t dir, vec3_t point, int damage, int dflags, int mod )
{
gclient_t *client;
+ int damage_orig = damage;
int take;
int asave = 0;
int knockback;
@@ -1432,7 +1433,14 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker,
targ->credits[ attacker->client->ps.clientNum ] += take;
}
- G_CombatStats_HitMOD( attacker, targ, mod, take );
+ // special cases...
+ if( mod == MOD_LEVEL2_CLAW && damage_orig == LEVEL2_CLAW_UPG_DMG )
+ G_CombatStats_Hit( attacker, targ, CSW_LEVEL2_UPG, take );
+ else if( ( mod == MOD_LCANNON || mod == MOD_LCANNON_SPLASH ) &&
+ inflictor->s.generic1 == WPM_SECONDARY )
+ G_CombatStats_Hit( attacker, targ, CSW_LCANNON_ALT, take );
+ else
+ G_CombatStats_HitMOD( attacker, targ, mod, take );
if( targ->health <= 0 )
{
@@ -1782,7 +1790,7 @@ const static combatStatsWeapon_t modToCsw[ ] =
const static char *cswStrings[ ] =
{
-#define CSW(a,b) #a
+#define CSW(a,b,c) #a
#include "g_csw.h"
#undef CSW
};
@@ -1970,6 +1978,33 @@ void G_CalculateCombatRanks( void )
/*
================
+G_LogCombatSettings
+
+Log settings of all combat stats weapons
+================
+*/
+void G_LogCombatSettings( void )
+{
+ int i;
+ char buffer[ 4096 ], *p = buffer;
+ static const int cswDamages[ ] =
+ {
+#define CSW(a,b,c) (c)
+#include "g_csw.h"
+#undef CSW
+ };
+
+ for( i = 0; i < CSW_MAX; i++ )
+ {
+ Com_sprintf( p, 4096 - ( p - buffer ), " %s %i", cswStrings[ i ], cswDamages[ i ] );
+ while( *p ) p++;
+ }
+
+ G_LogPrintf( "CombatSettings:%s\n", buffer );
+}
+
+/*
+================
G_LogCombatStats
Write combat stats of a player to the game log
diff --git a/src/game/g_csw.h b/src/game/g_csw.h
index 4f3cdf2..e37313b 100644
--- a/src/game/g_csw.h
+++ b/src/game/g_csw.h
@@ -1,30 +1,32 @@
-CSW( CSW_UNKNOWN, NULL ),
+CSW( CSW_UNKNOWN, NULL, 0 ),
-CSW( CSW_BLASTER, "Blaster" ),
-CSW( CSW_MACHINEGUN, "Rifle" ),
-CSW( CSW_PAINSAW, "Pain Saw" ),
-CSW( CSW_PAINSAW_ALT, "Pain Saw Blade" ),
-CSW( CSW_SHOTGUN, "Shotgun" ),
-CSW( CSW_LASGUN, "Las Gun" ),
-CSW( CSW_MDRIVER, "Mass Driver" ),
-CSW( CSW_CHAINGUN, "Chaingun" ),
-CSW( CSW_PRIFLE, "Pulse Rifle" ),
-CSW( CSW_FLAMER, "Flame Thrower" ),
-CSW( CSW_LIGHTNING, "Lightning Gun" ),
-CSW( CSW_LCANNON, "Lucifer Cannon" ),
-CSW( CSW_ROCKETL, "Rocket Launcher" ),
-CSW( CSW_GRENADE, "Grenade" ),
+CSW( CSW_BLASTER, "Blaster", BLASTER_DMG ),
+CSW( CSW_MACHINEGUN, "Rifle", RIFLE_DMG ),
+CSW( CSW_PAINSAW, "Pain Saw", PAINSAW_DAMAGE ),
+CSW( CSW_PAINSAW_ALT, "Pain Saw Blade", PAINSAW_DAMAGE2 ),
+CSW( CSW_SHOTGUN, "Shotgun", SHOTGUN_DMG * SHOTGUN_PELLETS ),
+CSW( CSW_LASGUN, "Las Gun", LASGUN_DAMAGE ),
+CSW( CSW_MDRIVER, "Mass Driver", MDRIVER_DMG ),
+CSW( CSW_CHAINGUN, "Chaingun", CHAINGUN_DMG ),
+CSW( CSW_PRIFLE, "Pulse Rifle", PRIFLE_DMG ),
+CSW( CSW_FLAMER, "Flame Thrower", FLAMER_DMG ),
+CSW( CSW_LIGHTNING, "Lightning Gun", LIGHTNING_DAMAGE ),
+CSW( CSW_LCANNON, "Lucifer Cannon", LCANNON_DAMAGE ),
+CSW( CSW_LCANNON_ALT, "Lucifer Alt.", LCANNON_SECONDARY_DAMAGE ),
+CSW( CSW_ROCKETL, "Rocket Launcher", ROCKETL_DAMAGE ),
+CSW( CSW_GRENADE, "Grenade", GRENADE_DAMAGE ),
-CSW( CSW_ABUILDER, "Granger" ),
-CSW( CSW_ABUILDER_ALT, "Granger Spit" ),
-CSW( CSW_LEVEL1, "Basilisk" ),
-CSW( CSW_LEVEL2, "Marauder" ),
-CSW( CSW_LEVEL2_ALT, "Marauder Zap" ),
-CSW( CSW_LEVEL3, "Dragoon" ),
-CSW( CSW_LEVEL3_ALT, "Dragoon Barb" ),
-CSW( CSW_LEVEL4, "Tyrant" ),
-CSW( CSW_LEVEL4_ALT, "Tyrant Flames" ),
-CSW( CSW_LEVEL5, "Hummel" ),
-CSW( CSW_LEVEL5_ALT, "Hummel Prickles" )
+CSW( CSW_ABUILDER, "Granger", ABUILDER_CLAW_DMG ),
+CSW( CSW_ABUILDER_ALT, "Granger Spit", ABUILDER_BLOB_DMG ),
+CSW( CSW_LEVEL1, "Basilisk", LEVEL1_CLAW_DMG ),
+CSW( CSW_LEVEL2, "Marauder", LEVEL2_CLAW_DMG ),
+CSW( CSW_LEVEL2_UPG, "Adv. Marauder", LEVEL2_CLAW_UPG_DMG ),
+CSW( CSW_LEVEL2_ALT, "Marauder Zap", LEVEL2_AREAZAP_DMG ),
+CSW( CSW_LEVEL3, "Dragoon", LEVEL3_CLAW_DMG ),
+CSW( CSW_LEVEL3_ALT, "Dragoon Barb", LEVEL3_BOUNCEBALL_DMG ),
+CSW( CSW_LEVEL4, "Tyrant", LEVEL4_CLAW_DMG ),
+CSW( CSW_LEVEL4_ALT, "Tyrant Flames", 50 ),
+CSW( CSW_LEVEL5, "Hummel", LEVEL5_CLAW_DMG ),
+CSW( CSW_LEVEL5_ALT, "Hummel Prickles", LEVEL5_PRICKLES_DMG )
#define CSW_MAX_NAME_LEN 15
diff --git a/src/game/g_local.h b/src/game/g_local.h
index a98d818..18ff14b 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -320,7 +320,7 @@ typedef enum
typedef enum
{
-#define CSW(a,b) a
+#define CSW(a,b,c) a
#include "g_csw.h"
#undef CSW
,
@@ -984,6 +984,7 @@ void G_InitDamageLocations( void );
#define DAMAGE_NO_PROTECTION 0x00000008 // armor, shields, invulnerability, and godmode have no effect
#define DAMAGE_NO_LOCDAMAGE 0x00000010 // do not apply locational damage
+void G_LogCombatSettings( void );
void G_CombatStats_Fire( gentity_t *ent, combatStatsWeapon_t weapon, int damage );
void G_CombatStats_FireMOD( gentity_t *ent, meansOfDeath_t mod, int damage );
void G_CombatStats_Hit( gentity_t *ent, gentity_t *hit, combatStatsWeapon_t weapon, int damage );
diff --git a/src/game/g_main.c b/src/game/g_main.c
index f31e7ec..28dfb33 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -206,9 +206,6 @@ vmCvar_t g_DretchBuildingDamage;
vmCvar_t g_OwnTeamBPFactor;
vmCvar_t g_EnemyTeamBPFactor;
-vmCvar_t g_lightningDamage;
-vmCvar_t g_lightningDifficulty;
-
// copy cvars that can be set in worldspawn so they can be restored later
static char cv_gravity[ MAX_CVAR_VALUE_STRING ];
static char cv_humanMaxStage[ MAX_CVAR_VALUE_STRING ];
@@ -379,10 +376,7 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_DretchTurretDamage, "g_DretchTurretDamage", "1", CVAR_ARCHIVE, 0, qfalse },
{ &g_DretchBuildingDamage, "g_DretchBuildingDamage", "0.5", CVAR_ARCHIVE, 0, qfalse },
{ &g_OwnTeamBPFactor, "g_OwnTeamBPFactor", "1.0", CVAR_ARCHIVE, 0, qfalse },
- { &g_EnemyTeamBPFactor, "g_EnemyTeamBPFactor", "0.0", CVAR_ARCHIVE, 0, qfalse },
-
- { &g_lightningDamage, "g_lightningDamage", "140", 0, 0, qfalse },
- { &g_lightningDifficulty, "g_lightningDifficulty", "1", 0, 0, qfalse }
+ { &g_EnemyTeamBPFactor, "g_EnemyTeamBPFactor", "0.0", CVAR_ARCHIVE, 0, qfalse }
};
static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[ 0 ] );
void G_InitGame( int levelTime, int randomSeed, int restart );
@@ -749,6 +743,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart )
level.weakSuddenDeathBeginTime = g_weakSuddenDeathTime.integer * 60000;
level.nextArmageddonKillTime = (g_suddenDeathTime.integer+g_armageddonInitialTimeStep.integer) * 60000;
level.nextCommandTime = g_TimerPeriod.integer;
+ G_LogCombatSettings( );
G_Printf( "-----------------------------------\n" );
G_Printf( "EDGE LOADED SUCCESSFULLY\n" );
// So the server counts the spawns without a client attached
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index 2a87754..357847a 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -300,7 +300,10 @@ void meleeAttack( gentity_t *ent, float range, float width, float height,
trace_t tr;
gentity_t *traceEnt;
- G_CombatStats_FireMOD( ent, mod, damage );
+ if( mod == MOD_LEVEL2_CLAW && damage == LEVEL2_CLAW_UPG_DMG )
+ G_CombatStats_Fire( ent, CSW_LEVEL2_UPG, damage );
+ else
+ G_CombatStats_FireMOD( ent, mod, damage );
G_WideTrace( &tr, ent, range, width, height, &traceEnt );
if( traceEnt == NULL || !traceEnt->takedamage )
@@ -817,7 +820,7 @@ void LCChargeFire( gentity_t *ent, qboolean secondary )
{
if( secondary && ent->client->ps.stats[ STAT_MISC ] <= 0 )
{
- G_CombatStats_Fire( ent, CSW_LCANNON, LCANNON_SECONDARY_DAMAGE );
+ G_CombatStats_Fire( ent, CSW_LCANNON_ALT, LCANNON_SECONDARY_DAMAGE );
fire_luciferCannon( ent, muzzle, forward, LCANNON_SECONDARY_DAMAGE,
LCANNON_SECONDARY_RADIUS, LCANNON_SECONDARY_SPEED );
}
@@ -887,7 +890,7 @@ float G_LightningAccuracy( const vec3_t ws_origin, const vec3_t ws_dir,
if( chord <= 0.0f )
return 0.0f;
- chord = pow( chord, g_lightningDifficulty.value * 0.5f );
+ chord = pow( chord, LIGHTNING_DIFFICULTY * 0.5f );
return chord;
}
@@ -900,7 +903,7 @@ void lightningGunFire( gentity_t *ent )
gentity_t *target;
int damage;
- damage = g_lightningDamage.value / ( 1000.0f / LIGHTNING_REPEAT );
+ damage = LIGHTNING_DAMAGE;
G_CombatStats_Fire( ent, CSW_LIGHTNING, damage );
VectorMA( muzzle, LIGHTNING_RANGE, forward, end );
diff --git a/src/game/tremulous.h b/src/game/tremulous.h
index b3b9b92..9e925c3 100644
--- a/src/game/tremulous.h
+++ b/src/game/tremulous.h
@@ -517,7 +517,10 @@ TREMULOUS EDGE MOD SRC FILE
#define LIGHTNING_PRICE 500
#define LIGHTNING_AMMO 300
#define LIGHTNING_K_SCALE 1
+#define LIGHTNING_DPS 140
+#define LIGHTNING_DIFFICULTY 2
#define LIGHTNING_REPEAT 50 // keep it as low as possible
+#define LIGHTNING_DAMAGE ( LIGHTNING_DPS * LIGHTNING_REPEAT / 1000 )
#define LIGHTNING_RANGE 450
#define LCANNON_PRICE 600