summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_event.c4
-rw-r--r--src/game/bg_misc.c1
-rw-r--r--src/game/bg_pmove.c39
-rw-r--r--src/game/bg_public.h16
-rw-r--r--src/game/g_active.c4
-rw-r--r--src/game/g_buildable.c2
-rw-r--r--src/game/g_client.c6
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/g_weapon.c128
-rw-r--r--src/game/q_shared.h2
10 files changed, 106 insertions, 97 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index a9fa5138..8ad2f3dd 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -792,6 +792,10 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
DEBUGNAME("EV_FIRE_WEAPON");
CG_FireWeapon( cent );
break;
+ case EV_FIRE_WEAPON2:
+ DEBUGNAME("EV_FIRE_WEAPON2");
+ CG_FireWeapon( cent ); //FIXME:??
+ break;
case EV_USE_ITEM0:
DEBUGNAME("EV_USE_ITEM0");
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c
index 1825afb8..2a24d540 100644
--- a/src/game/bg_misc.c
+++ b/src/game/bg_misc.c
@@ -3239,6 +3239,7 @@ char *eventnames[] = {
"EV_NOAMMO",
"EV_CHANGE_WEAPON",
"EV_FIRE_WEAPON",
+ "EV_FIRE_WEAPON2",
"EV_USE_ITEM0",
"EV_USE_ITEM1",
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 276aa428..b0f5d67a 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -1654,24 +1654,27 @@ static void PM_GroundTrace( void ) {
trace_t trace;
float srotAngle;
- if( pm->cmd.upmove < 0 && wcl[ pm->ps->clientNum ].lastUpmove >= 0 )
+ if( BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_WALLCLIMBER ) )
{
- if( !( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) && pm->cmd.upmove < 0 )
- pm->ps->stats[ STAT_STATE ] |= SS_WALLCLIMBING;
- else if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING && pm->cmd.upmove < 0 )
- pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBING;
- }
+ //toggle wall climbing if holding crouch
+ if( pm->cmd.upmove < 0 && wcl[ pm->ps->clientNum ].lastUpmove >= 0 )
+ {
+ if( !( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) && pm->cmd.upmove < 0 )
+ pm->ps->stats[ STAT_STATE ] |= SS_WALLCLIMBING;
+ else if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING && pm->cmd.upmove < 0 )
+ pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBING;
+ }
- if( pm->ps->pm_type == PM_DEAD )
- pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBING;
+ if( pm->ps->pm_type == PM_DEAD )
+ pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBING;
- wcl[ pm->ps->clientNum ].lastUpmove = pm->cmd.upmove;
+ wcl[ pm->ps->clientNum ].lastUpmove = pm->cmd.upmove;
- //if( BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_WALLCLIMBER ) && ( pm->cmd.upmove < 0 ) )
- if( BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_WALLCLIMBER ) && ( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) )
- {
- PM_GroundClimbTrace( );
- return;
+ if( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING )
+ {
+ PM_GroundClimbTrace( );
+ return;
+ }
}
pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBING;
@@ -2238,12 +2241,11 @@ static void PM_Weapon( void ) {
//done reloading so give em some ammo
if( pm->ps->weaponstate == WEAPON_RELOADING )
{
-
switch( pm->ps->weapon )
{
case WP_MACHINEGUN:
clips--;
- ammo = CS_MG;
+ BG_FindAmmoForWeapon( pm->ps->weapon, &ammo, NULL, NULL );
break;
default:
@@ -2285,7 +2287,7 @@ static void PM_Weapon( void ) {
default:
// check for fire
- if ( !( pm->cmd.buttons & BUTTON_ATTACK ) )
+ if ( !( pm->cmd.buttons & ( BUTTON_ATTACK | BUTTON_ATTACK2 ) ) )
{
pm->ps->weaponTime = 0;
pm->ps->weaponstate = WEAPON_READY;
@@ -2306,7 +2308,8 @@ static void PM_Weapon( void ) {
}
// fire weapon
- PM_AddEvent( EV_FIRE_WEAPON );
+ if( pm->cmd.buttons & BUTTON_ATTACK ) PM_AddEvent( EV_FIRE_WEAPON );
+ if( pm->cmd.buttons & BUTTON_ATTACK2 ) PM_AddEvent( EV_FIRE_WEAPON2 );
switch( pm->ps->weapon ) {
default:
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index c5307569..b2354531 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -151,21 +151,6 @@ typedef enum {
WEAPON_RELOADING
} weaponstate_t;
-//TA: clip-size defines
-#define CS_MG 30 //clip-size
-#define CS_CG 500
-#define CS_BFG 100
-#define CS_FLAMER 400
-
-//TA: bitmasks to get ammo, clips and maxclips out of ammo array
-#define BM_AMMO 0x3F
-#define BM_CLIPS 0xC0
-
-//TA: bitmasks to get weapons out of weapons store
-#define BM_SWB 0x0000FFFF
-#define BM_SW2B 0xFFFF0000
-
-
// pmove->pm_flags
#define PMF_DUCKED 1
#define PMF_JUMP_HELD 2
@@ -464,6 +449,7 @@ typedef enum {
EV_NOAMMO,
EV_CHANGE_WEAPON,
EV_FIRE_WEAPON,
+ EV_FIRE_WEAPON2,
EV_USE_ITEM0,
EV_USE_ITEM1,
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 0fc8737c..dc981beb 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -566,6 +566,10 @@ void ClientEvents( gentity_t *ent, int oldEventSequence ) {
FireWeapon( ent );
break;
+ case EV_FIRE_WEAPON2:
+ FireWeapon2( ent );
+ break;
+
case EV_USE_ITEM1: // teleporter
// drop flags in CTF
item = NULL;
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index d51465f6..df85b49f 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -606,7 +606,7 @@ Used by HDef_Think to fire at enemy
void hdef_fireonenemy( gentity_t *self, int firespeed )
{
//fire at target
- FireWeapon( self );
+ G_AddEvent( self, EV_FIRE_WEAPON, 0 );
self->count = level.time + firespeed;
}
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 6aa6b855..ae2b529a 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1405,8 +1405,12 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn ) {
case PCL_H_BASE:
if( client->pers.pitem == WP_MACHINEGUN )
{
+ int ammo, clips, maxClips;
+
+ BG_FindAmmoForWeapon( WP_MACHINEGUN, &ammo, &clips, &maxClips );
+
BG_packWeapon( WP_MACHINEGUN, client->ps.stats );
- BG_packAmmoArray( WP_MACHINEGUN, client->ps.ammo, client->ps.powerups, CS_MG, 4, 4 );
+ BG_packAmmoArray( WP_MACHINEGUN, client->ps.ammo, client->ps.powerups, ammo, clips, maxClips );
}
else if( client->pers.pitem == WP_HBUILD )
{
diff --git a/src/game/g_local.h b/src/game/g_local.h
index b07099b2..8e7107fa 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -668,6 +668,7 @@ qboolean G_FilterPacket (char *from);
// g_weapon.c
//
void FireWeapon( gentity_t *ent );
+void FireWeapon2( gentity_t *ent );
//
// p_hud.c
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index c4268deb..7012e850 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -753,19 +753,24 @@ void CalcMuzzlePoint( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, v
SnapVector( muzzlePoint );
}
+/*
+===============
+FireWeapon2
+===============
+*/
+void FireWeapon2( gentity_t *ent )
+{
+ //just so i can do a cvs commit on compilable code before sleep
+ Com_Printf( "Attack2 pressed\n" );
+}
/*
===============
FireWeapon
===============
*/
-void FireWeapon( gentity_t *ent ) {
- /*if (ent->client->ps.powerups[PW_QUAD] ) {
- s_quadFactor = g_quadfactor.value;
- } else*/ {
- s_quadFactor = 1;
- }
-
+void FireWeapon( gentity_t *ent )
+{
if( ent->client )
{
// track shots taken for accuracy tracking. Grapple is not a weapon and gauntet is just not tracked
@@ -786,60 +791,61 @@ void FireWeapon( gentity_t *ent ) {
}
// fire the specific weapon
- switch( ent->s.weapon ) {
- case WP_GAUNTLET:
- Weapon_Gauntlet( ent );
- break;
- case WP_LIGHTNING:
- Weapon_LightningFire( ent );
- break;
- case WP_SHOTGUN:
- weapon_supershotgun_fire( ent );
- break;
- case WP_MACHINEGUN:
- if ( g_gametype.integer != GT_TEAM ) {
- Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE, MOD_MACHINEGUN );
- } else {
- Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_TEAM_DAMAGE, MOD_MACHINEGUN );
- }
- break;
- case WP_CHAINGUN:
- Bullet_Fire( ent, CHAINGUN_SPREAD, CHAINGUN_DAMAGE, MOD_CHAINGUN );
- break;
- case WP_GRENADE_LAUNCHER:
- weapon_grenadelauncher_fire( ent );
- break;
- case WP_ROCKET_LAUNCHER:
- Weapon_RocketLauncher_Fire( ent );
- break;
- case WP_FLAMER:
- Weapon_Flamer_Fire( ent );
- break;
- case WP_PLASMAGUN:
- Weapon_Plasma_Fire( ent );
- break;
- case WP_RAILGUN:
- weapon_railgun_fire( ent );
- break;
- case WP_BFG:
- BFG_Fire( ent );
- break;
- case WP_GRAPPLING_HOOK:
- Weapon_GrapplingHook_Fire( ent );
- break;
- case WP_VENOM:
- Weapon_Venom_Fire( ent );
- break;
- case WP_ABUILD:
- Weapon_Abuild_Fire( ent );
- break;
- case WP_HBUILD:
- Weapon_Hbuild_Fire( ent );
- break;
- case WP_SCANNER: //scanner doesn't "fire"
- default:
-// FIXME G_Error( "Bad ent->s.weapon" );
- break;
+ switch( ent->s.weapon )
+ {
+ case WP_GAUNTLET:
+ Weapon_Gauntlet( ent );
+ break;
+ case WP_LIGHTNING:
+ Weapon_LightningFire( ent );
+ break;
+ case WP_SHOTGUN:
+ weapon_supershotgun_fire( ent );
+ break;
+ case WP_MACHINEGUN:
+ if ( g_gametype.integer != GT_TEAM ) {
+ Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_DAMAGE, MOD_MACHINEGUN );
+ } else {
+ Bullet_Fire( ent, MACHINEGUN_SPREAD, MACHINEGUN_TEAM_DAMAGE, MOD_MACHINEGUN );
+ }
+ break;
+ case WP_CHAINGUN:
+ Bullet_Fire( ent, CHAINGUN_SPREAD, CHAINGUN_DAMAGE, MOD_CHAINGUN );
+ break;
+ case WP_GRENADE_LAUNCHER:
+ weapon_grenadelauncher_fire( ent );
+ break;
+ case WP_ROCKET_LAUNCHER:
+ Weapon_RocketLauncher_Fire( ent );
+ break;
+ case WP_FLAMER:
+ Weapon_Flamer_Fire( ent );
+ break;
+ case WP_PLASMAGUN:
+ Weapon_Plasma_Fire( ent );
+ break;
+ case WP_RAILGUN:
+ weapon_railgun_fire( ent );
+ break;
+ case WP_BFG:
+ BFG_Fire( ent );
+ break;
+ case WP_GRAPPLING_HOOK:
+ Weapon_GrapplingHook_Fire( ent );
+ break;
+ case WP_VENOM:
+ Weapon_Venom_Fire( ent );
+ break;
+ case WP_ABUILD:
+ Weapon_Abuild_Fire( ent );
+ break;
+ case WP_HBUILD:
+ Weapon_Hbuild_Fire( ent );
+ break;
+ case WP_SCANNER: //scanner doesn't "fire"
+ default:
+ // FIXME G_Error( "Bad ent->s.weapon" );
+ break;
}
}
diff --git a/src/game/q_shared.h b/src/game/q_shared.h
index 494f7390..4d4d02dd 100644
--- a/src/game/q_shared.h
+++ b/src/game/q_shared.h
@@ -1006,7 +1006,7 @@ typedef struct playerState_s {
// only generate a small move value for that frame
// walking will use different animations and
// won't generate footsteps
-#define BUTTON_AFFIRMATIVE 32
+#define BUTTON_ATTACK2 32 //TA: should be safe to change from BUTTON_AFFIRMATIVE
#define BUTTON_NEGATIVE 64
#define BUTTON_GETFLAG 128