diff options
author | Tim Angus <tim@ngus.net> | 2001-07-13 00:48:12 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2001-07-13 00:48:12 +0000 |
commit | 3beaebed802a096cccdee04f26526a3b667333ec (patch) | |
tree | 1815684c2ed51872dd3863c58da8965e66cc79e6 /src/cgame | |
parent | 2ab1eefdb54b0d4a82001b3d87158d7fa876bdf4 (diff) |
Saved a couple of STAT_ indices. Added the pounce and clawing weapon
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_local.h | 7 | ||||
-rw-r--r-- | src/cgame/cg_view.c | 35 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 25 |
3 files changed, 58 insertions, 9 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index ce615221..c66ce5fe 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -631,8 +631,11 @@ typedef struct { char testModelName[MAX_QPATH]; qboolean testGun; - int spawnTime; //TA: fovwarp - + int spawnTime; //TA: fovwarp + int weapon1Time; //TA: time when BUTTON_ATTACK went t->f f->t + int weapon2Time; //TA: time when BUTTON_ATTACK2 went t->f f->t + qboolean weapon1Firing; + qboolean weapon2Firing; } cg_t; diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 712e5422..aad94541 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -244,8 +244,8 @@ static void CG_OffsetThirdPersonView( void ) { // if dead, look at killer if ( cg.predictedPlayerState.stats[STAT_HEALTH] <= 0 ) { - focusAngles[YAW] = cg.predictedPlayerState.stats[STAT_DEAD_YAW]; - cg.refdefViewAngles[YAW] = cg.predictedPlayerState.stats[STAT_DEAD_YAW]; + focusAngles[YAW] = cg.predictedPlayerState.generic1; + cg.refdefViewAngles[YAW] = cg.predictedPlayerState.generic1; } //if ( focusAngles[PITCH] > 45 ) { @@ -346,7 +346,7 @@ static void CG_OffsetFirstPersonView( void ) { if ( cg.snap->ps.stats[STAT_HEALTH] <= 0 ) { angles[ROLL] = 40; angles[PITCH] = -15; - angles[YAW] = cg.snap->ps.stats[STAT_DEAD_YAW]; + angles[YAW] = cg.snap->ps.generic1; origin[2] += cg.predictedPlayerState.viewheight; return; } @@ -407,6 +407,28 @@ static void CG_OffsetFirstPersonView( void ) { angles[ROLL] += delta; } + //provide some feedback for pouncing + if( cg.predictedPlayerState.weapon == WP_POUNCE ) + { + if( cg.predictedPlayerState.stats[ STAT_MISC ] > 0 ) + { + float fraction1, fraction2; + vec3_t forward; + + AngleVectors( angles, forward, NULL, NULL ); + VectorNormalize( forward ); + + fraction1 = (float)( cg.time - cg.weapon2Time ) / POUNCE_TIME; + + if( fraction1 > 1.0f ) + fraction1 = 1.0f; + + fraction2 = -sin( fraction1 * M_PI / 2 ); + + VectorMA( origin, 15*fraction2, forward, origin ); + } + } + //TA: this *feels* more realisitic for humans if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_HUMANS ) { @@ -458,10 +480,13 @@ static void CG_OffsetFirstPersonView( void ) { // add fall height delta = cg.time - cg.landTime; - if ( delta < LAND_DEFLECT_TIME ) { + if( delta < LAND_DEFLECT_TIME ) + { f = delta / LAND_DEFLECT_TIME; cg.refdef.vieworg[2] += cg.landChange * f; - } else if ( delta < LAND_DEFLECT_TIME + LAND_RETURN_TIME ) { + } + else if( delta < LAND_DEFLECT_TIME + LAND_RETURN_TIME ) + { delta -= LAND_DEFLECT_TIME; f = 1.0 - ( delta / LAND_RETURN_TIME ); cg.refdef.vieworg[2] += cg.landChange * f; diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 74a1ef6a..a53336f9 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -601,6 +601,11 @@ void CG_RegisterWeapon( int weaponNum ) { weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav", qfalse ); break; + case WP_POUNCE: + MAKERGB( weaponInfo->flashDlightColor, 0, 0, 0 ); + weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav", qfalse ); + break; + case WP_DBUILD: case WP_HBUILD: case WP_SCANNER: @@ -941,19 +946,35 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent if ( ps ) { if ( cg.predictedPlayerState.weapon == WP_RAILGUN - && cg.predictedPlayerState.weaponstate == WEAPON_FIRING ) { + && cg.predictedPlayerState.weaponstate == WEAPON_FIRING ) + { float f; f = (float)cg.predictedPlayerState.weaponTime / 1500; gun.shaderRGBA[1] = 0; gun.shaderRGBA[0] = gun.shaderRGBA[2] = 255 * ( 1.0 - f ); - } else { + } + else + { gun.shaderRGBA[0] = 255; gun.shaderRGBA[1] = 255; gun.shaderRGBA[2] = 255; gun.shaderRGBA[3] = 255; } + + //set weapon[1/2]Time when respective buttons change state + if( cg.weapon1Firing != ( cg.predictedPlayerState.eFlags & EF_FIRING ) ) + { + cg.weapon1Time = cg.time; + cg.weapon1Firing = ( cg.predictedPlayerState.eFlags & EF_FIRING ); + } + + if( cg.weapon2Firing != ( cg.predictedPlayerState.eFlags & EF_FIRING2 ) ) + { + cg.weapon2Time = cg.time; + cg.weapon2Firing = ( cg.predictedPlayerState.eFlags & EF_FIRING2 ); + } } gun.hModel = weapon->weaponModel; |