diff options
author | Tim Angus <tim@ngus.net> | 2001-07-18 22:37:36 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2001-07-18 22:37:36 +0000 |
commit | c4771d2a8707609f9908e4dcc5eb7cbb7c10ed36 (patch) | |
tree | 829a4463556c275dc5b39c69e6e10e76190b4b2c /src | |
parent | e000aa468822c7201cefa30c48f1d02a0bdef142 (diff) |
Fiddled alt fire a bit
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_players.c | 12 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 4 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 53 | ||||
-rw-r--r-- | src/game/g_active.c | 19 | ||||
-rw-r--r-- | src/game/g_weapon.c | 14 | ||||
-rw-r--r-- | src/game/q_shared.h | 24 |
6 files changed, 81 insertions, 45 deletions
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index a6c5fcab..c19fccd2 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -1758,6 +1758,7 @@ void CG_Player( centity_t *cent ) { refEntity_t legs; refEntity_t torso; refEntity_t head; + refEntity_t aura; int clientNum; int renderfx; qboolean shadow; @@ -1931,6 +1932,17 @@ void CG_Player( centity_t *cent ) { // add the gun / barrel / flash // CG_AddPlayerWeapon( &torso, NULL, cent ); + +/* aura.reType = RT_SPRITE; + VectorCopy( cent->lerpOrigin, aura.origin ); + aura.customShader = cgs.media.whiteShader; + aura.shaderRGBA[ 0 ] = 0xff; + aura.shaderRGBA[ 1 ] = 0xff; + aura.shaderRGBA[ 2 ] = 0xff; + aura.shaderRGBA[ 3 ] = 0xff; + aura.radius = 64; + + trap_R_AddRefEntityToScene( &aura );*/ } /* diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index e3a68917..95aca2d5 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -990,11 +990,11 @@ static void CG_ServerCommand( void ) { return; } - if ( Q_stricmp (cmd, "remapShader") == 0 ) { +/* if ( Q_stricmp (cmd, "remapShader") == 0 ) { if (trap_Argc() == 4) { trap_R_RemapShader(CG_Argv(1), CG_Argv(2), CG_Argv(3)); } - } + }*/ // loaddeferred can be both a servercmd and a consolecmd if ( !strcmp( cmd, "loaddefered" ) ) { // FIXME: spelled wrong, but not changing for demo diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 97e81461..c6bc6d07 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2206,6 +2206,8 @@ static void PM_Weapon( void ) { int addTime; int ammo, clips, maxclips; + qboolean attack1 = qfalse; + qboolean attack2 = qfalse; // don't allow attack until all buttons are up if ( pm->ps->pm_flags & PMF_RESPAWNED ) @@ -2336,9 +2338,13 @@ static void PM_Weapon( void ) return; } + //check if non-auto primary/secondary attacks are permited switch( pm->ps->weapon ) { case WP_VENOM: + //venom is only autohit + attack1 = attack2 = qfalse; + if( !pm->autoWeaponHit[ pm->ps->weapon ] ) { pm->ps->weaponTime = 0; @@ -2348,8 +2354,26 @@ static void PM_Weapon( void ) break; case WP_POUNCE: - if( !pm->autoWeaponHit[ pm->ps->weapon ] && - !( pm->cmd.buttons & ( BUTTON_ATTACK | BUTTON_ATTACK2 ) ) ) + //pouncing has primary secondary AND autohit procedures + attack1 = pm->cmd.buttons & BUTTON_ATTACK; + attack2 = pm->cmd.buttons & BUTTON_ATTACK2; + + if( !pm->autoWeaponHit[ pm->ps->weapon ] && !attack1 && !attack2 ) + { + pm->ps->weaponTime = 0; + pm->ps->weaponstate = WEAPON_READY; + return; + } + break; + + case WP_GRABANDCSAW: + attack1 = pm->cmd.buttons & BUTTON_ATTACK; + + //secondary attack is only permitted if target is in range + if( pm->autoWeaponHit[ pm->ps->weapon ] ) + attack2 = pm->cmd.buttons & BUTTON_ATTACK2; + + if( !attack1 && !attack2 ) { pm->ps->weaponTime = 0; pm->ps->weaponstate = WEAPON_READY; @@ -2358,8 +2382,11 @@ static void PM_Weapon( void ) break; default: - // check for fire - if( !( pm->cmd.buttons & ( BUTTON_ATTACK | BUTTON_ATTACK2 ) ) ) + //by default primary and secondary attacks are allowed + attack1 = pm->cmd.buttons & BUTTON_ATTACK; + attack2 = pm->cmd.buttons & BUTTON_ATTACK2; + + if( !attack1 && !attack2 ) { pm->ps->weaponTime = 0; pm->ps->weaponstate = WEAPON_READY; @@ -2367,24 +2394,28 @@ static void PM_Weapon( void ) } break; } - - // fire weapon - if( pm->cmd.buttons & BUTTON_ATTACK2 ) + + //TA: fire events for non auto weapons + if( attack2 ) { if( BG_WeaponHasAltMode( pm->ps->weapon ) ) { - if( BG_WeaponModesAreSynced( pm->ps->weapon ) && ( pm->cmd.buttons & BUTTON_ATTACK ) ) + if( BG_WeaponModesAreSynced( pm->ps->weapon ) && attack1 ) PM_AddEvent( EV_FIRE_WEAPONBOTH ); else PM_AddEvent( EV_FIRE_WEAPON2 ); } else + { + pm->ps->weaponTime = 0; + pm->ps->weaponstate = WEAPON_READY; return; + } } - else if( pm->cmd.buttons & BUTTON_ATTACK ) + else if( attack1 ) PM_AddEvent( EV_FIRE_WEAPON ); - //TA: yuck hack + //TA: fire events for autohit weapons if( pm->autoWeaponHit[ pm->ps->weapon ] ) { switch( pm->ps->weapon ) @@ -2453,7 +2484,7 @@ static void PM_Weapon( void ) addTime = 500; break; case WP_GRABANDCSAW: - addTime = 50; + addTime = 500; break; case WP_POUNCE: addTime = 750; diff --git a/src/game/g_active.c b/src/game/g_active.c index 685ff10c..ca7552a3 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -863,29 +863,22 @@ void ClientThink_real( gentity_t *ent ) { memset (&pm, 0, sizeof(pm)); - if( !( ucmd->buttons & BUTTON_TALK ) && client->ps.weaponTime <= 0 ) + if( !( ucmd->buttons & BUTTON_TALK ) ) //&& client->ps.weaponTime <= 0 ) //TA: erk more server load { - qboolean temp; - switch( client->ps.weapon ) { case WP_VENOM: - pm.autoWeaponHit[ WP_VENOM ] = CheckVenomAttack( ent ); + if( client->ps.weaponTime <= 0 ) + pm.autoWeaponHit[ WP_VENOM ] = CheckVenomAttack( ent ); break; case WP_GRABANDCSAW: - temp = CheckGrabAttack( ent ); - if( !pm.autoWeaponHit[ WP_GRABANDCSAW ] && temp ) - { - //enemy has *just* entered grab range - //only allow grab if attack2 button is UP - if( !( ucmd->buttons & BUTTON_ATTACK2 ) ) - pm.autoWeaponHit[ WP_GRABANDCSAW ] = qtrue; - } + pm.autoWeaponHit[ WP_GRABANDCSAW ] = CheckGrabAttack( ent ); break; case WP_POUNCE: - pm.autoWeaponHit[ WP_POUNCE ] = CheckPounceAttack( ent ); + if( client->ps.weaponTime <= 0 ) + pm.autoWeaponHit[ WP_POUNCE ] = CheckPounceAttack( ent ); break; default: diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 15beb4dc..b1f94d7e 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -635,6 +635,13 @@ qboolean CheckVenomAttack( gentity_t *ent ) traceEnt = &g_entities[ tr.entityNum ]; + if( !traceEnt->takedamage) + return qfalse; + if( !traceEnt->client ) + return qfalse; + if( traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_DROIDS ) + return qfalse; + // send blood impact if ( traceEnt->takedamage && traceEnt->client ) { @@ -644,13 +651,6 @@ qboolean CheckVenomAttack( gentity_t *ent ) tent->s.weapon = ent->s.weapon; } - if( !traceEnt->takedamage) - return qfalse; - if( !traceEnt->client ) - return qfalse; - if( traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_DROIDS ) - return qfalse; - G_Damage( traceEnt, ent, ent, forward, tr.endpos, 5, DAMAGE_NO_KNOCKBACK, MOD_VENOM ); if( traceEnt->client ) { diff --git a/src/game/q_shared.h b/src/game/q_shared.h index 4d4d02dd..895f1961 100644 --- a/src/game/q_shared.h +++ b/src/game/q_shared.h @@ -997,26 +997,26 @@ typedef struct playerState_s { // usercmd_t->button bits, many of which are generated by the client system, // so they aren't game/cgame only definitions // -#define BUTTON_ATTACK 1 -#define BUTTON_TALK 2 // displays talk balloon and disables actions +#define BUTTON_ATTACK 1 +#define BUTTON_TALK 2 // displays talk balloon and disables actions #define BUTTON_USE_HOLDABLE 4 -#define BUTTON_GESTURE 8 -#define BUTTON_WALKING 16 // walking can't just be infered from MOVE_RUN +#define BUTTON_GESTURE 8 +#define BUTTON_WALKING 16 // walking can't just be infered from MOVE_RUN // because a key pressed late in the frame will // only generate a small move value for that frame // walking will use different animations and // won't generate footsteps -#define BUTTON_ATTACK2 32 //TA: should be safe to change from BUTTON_AFFIRMATIVE -#define BUTTON_NEGATIVE 64 +#define BUTTON_ATTACK2 32 //TA: should be safe to change from BUTTON_AFFIRMATIVE +#define BUTTON_NEGATIVE 64 -#define BUTTON_GETFLAG 128 -#define BUTTON_GUARDBASE 256 -#define BUTTON_PATROL 512 -#define BUTTON_FOLLOWME 1024 +#define BUTTON_GETFLAG 128 +#define BUTTON_GUARDBASE 256 +#define BUTTON_PATROL 512 +#define BUTTON_FOLLOWME 1024 -#define BUTTON_ANY 2048 // any key whatsoever +#define BUTTON_ANY 2048 // any key whatsoever -#define MOVE_RUN 120 // if forwardmove or rightmove are >= MOVE_RUN, +#define MOVE_RUN 120 // if forwardmove or rightmove are >= MOVE_RUN, // then BUTTON_WALKING should be set |