diff options
author | Tim Angus <tim@ngus.net> | 2002-04-06 05:09:20 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2002-04-06 05:09:20 +0000 |
commit | b414c90e98a92c3c29bf3eb7d76ca6b089e95b34 (patch) | |
tree | d8845b9f88cc4ccf3d85147e7c97385e01c1b72c /src | |
parent | 0f4a33d3db91faaa7194ec4b25a570bf02e976e0 (diff) |
Jetpack sounds and graphics
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_local.h | 5 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 5 | ||||
-rw-r--r-- | src/cgame/cg_players.c | 76 | ||||
-rw-r--r-- | src/game/bg_misc.c | 34 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 4 |
5 files changed, 110 insertions, 14 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index bcde7efe..855bb39e 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -190,6 +190,7 @@ typedef struct centity_s { //TA: buildableAnimNumber_t buildableAnim; //persistant anim number int flamerTime; //limit flameball count + int jetTime; //limit jet count } centity_t; @@ -967,6 +968,10 @@ typedef struct { sfxHandle_t flightSound; sfxHandle_t medkitSound; + sfxHandle_t jetpackDescendSound; + sfxHandle_t jetpackIdleSound; + sfxHandle_t jetpackAscendSound; + sfxHandle_t weaponHoverSound; // teamplay sounds diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 5463ad20..1372c9b3 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -621,6 +621,11 @@ static void CG_RegisterSounds( void ) { cgs.gameSounds[i] = trap_S_RegisterSound( soundName, qfalse ); } + //TA: + cgs.media.jetpackDescendSound = trap_S_RegisterSound( "sound/upgrades/jetpack/low.wav", qfalse ); + cgs.media.jetpackIdleSound = trap_S_RegisterSound( "sound/upgrades/jetpack/idle.wav", qfalse ); + cgs.media.jetpackAscendSound = trap_S_RegisterSound( "sound/upgrades/jetpack/hi.wav", qfalse ); + // FIXME: only needed with item cgs.media.flightSound = trap_S_RegisterSound( "sound/items/flight.wav", qfalse ); cgs.media.medkitSound = trap_S_RegisterSound ("sound/items/use_medkit.wav", qfalse); diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 326ae51e..5d465616 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -1363,16 +1363,84 @@ static void CG_TrailItem( centity_t *cent, qhandle_t hModel ) { trap_R_AddRefEntityToScene( &ent ); } +#define JET_SPREAD 30.0f +#define JET_LIFETIME 1500 /* =============== -CG_PlayerPowerups +CG_PlayerUpgrade =============== */ -static void CG_PlayerPowerups( centity_t *cent, refEntity_t *torso ) { - int powerups; +static void CG_PlayerUpgrades( centity_t *cent, refEntity_t *torso ) +{ + int held, active; clientInfo_t *ci; + vec3_t acc = { 0.0f, 0.0f, 10.0f }; + vec3_t vel = { 0.0f, 0.0f, 0.0f }; + vec3_t origin; + vec3_t back; + vec3_t forward = { 1.0f, 0.0f, 0.0f }; + vec3_t right = { 0.0f, 1.0f, 0.0f }; + vec3_t pvel; + int addTime; + float fspread = tan( DEG2RAD( ( random( ) * JET_SPREAD ) - ( JET_SPREAD / 2 ) ) ); + float rspread = tan( DEG2RAD( ( random( ) * JET_SPREAD ) - ( JET_SPREAD / 2 ) ) ); + + held = cent->currentState.modelindex; + active = cent->currentState.modelindex2; + + if( held & ( 1 << UP_JETPACK ) ) + { + //FIXME: add model to back + if( active & ( 1 << UP_JETPACK ) ) + { + if( cent->currentState.pos.trDelta[ 2 ] > 10.0f ) + { + trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cgs.media.jetpackAscendSound ); + addTime = 80; + vel[ 2 ] = -60.0f; + } + else if( cent->currentState.pos.trDelta[ 2 ] < -10.0f ) + { + trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cgs.media.jetpackDescendSound ); + addTime = 110; + vel[ 2 ] = -45.0f; + } + else + { + trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cgs.media.jetpackIdleSound ); + addTime = 100; + vel[ 2 ] = -50.0f; + } + + if( cent->jetTime < cg.time ) + { + VectorCopy( cent->lerpOrigin, origin ); + AngleVectors( cent->lerpAngles, back, NULL, NULL ); + VectorInverse( back ); + back[ 2 ] = 0.0f; + VectorNormalize( back ); + + VectorMA( origin, 10.0f, back, origin ); + origin[ 2 ] += 10.0f; + + VectorScale( cent->currentState.pos.trDelta, 0.75f, pvel ); + VectorAdd( vel, pvel, vel ); + + VectorMA( vel, fspread, forward, vel ); + VectorMA( vel, rspread, right, vel ); + + CG_LaunchSprite( origin, vel, acc, + 0.5f, 4.0f, 20.0f, 128.0f, 0.0f, + rand( ) % 360, cg.time, JET_LIFETIME, + cgs.media.smokePuffShader, qfalse, qfalse ); + + //set next ball time + cent->jetTime = cg.time + addTime; + } + } + } /*powerups = cent->currentState.powerups; if ( !powerups ) { return; @@ -1963,6 +2031,8 @@ void CG_Player( centity_t *cent ) // CG_AddPlayerWeapon( &torso, NULL, cent ); + CG_PlayerUpgrades( cent, &torso ); + /* if( ( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS ) && ( ( cent->currentState.powerups & 0xFF ) == PTE_HUMANS ) ) trap_R_AddAdditiveLightToScene( cent->lerpOrigin, 64, 0.1, 0.1, 0.4 );*/ diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index c6241fbd..e6243391 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -3436,12 +3436,19 @@ void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean s->weapon = ps->weapon; s->groundEntityNum = ps->groundEntityNum; - /*s->powerups = 0; - for ( i = 0 ; i < MAX_POWERUPS ; i++ ) { - if ( ps->powerups[ i ] ) { - s->powerups |= 1 << i; + //store items held and active items in otherEntityNum + s->modelindex = 0; + s->modelindex2 = 0; + for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) + { + if( BG_gotItem( i, ps->stats ) ) + { + s->modelindex |= 1 << i; + + if( BG_activated( i, ps->stats ) ) + s->modelindex2 |= 1 << i; } - }*/ + } //TA: use powerups field to store team/class info: s->powerups = ps->stats[ STAT_PTEAM ] | ( ps->stats[ STAT_PCLASS ] << 8 ); @@ -3529,12 +3536,19 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s s->weapon = ps->weapon; s->groundEntityNum = ps->groundEntityNum; - /*s->powerups = 0; - for ( i = 0 ; i < MAX_POWERUPS ; i++ ) { - if ( ps->powerups[ i ] ) { - s->powerups |= 1 << i; + //store items held and active items in otherEntityNum + s->modelindex = 0; + s->modelindex2 = 0; + for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) + { + if( BG_gotItem( i, ps->stats ) ) + { + s->modelindex |= 1 << i; + + if( BG_activated( i, ps->stats ) ) + s->modelindex2 |= 1 << i; } - }*/ + } //TA: use powerups field to store team/class info: s->powerups = ps->stats[ STAT_PTEAM ] | ( ps->stats[ STAT_PCLASS ] << 8 ); diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index e4b95260..017e9155 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -680,7 +680,7 @@ static void PM_JetPackMove( void ) { if( pm->cmd.upmove > 0.0f ) wishvel[ 2 ] = 48.0f; if( pm->cmd.upmove < 0.0f ) - wishvel[ 2 ] = -32.0f; + wishvel[ 2 ] = -48.0f; VectorCopy( wishvel, wishdir ); wishspeed = VectorNormalize( wishdir ); @@ -688,6 +688,8 @@ static void PM_JetPackMove( void ) { PM_Accelerate( wishdir, wishspeed, pm_flyaccelerate ); PM_StepSlideMove( qfalse, qfalse ); + + PM_ForceLegsAnim( LEGS_LAND ); } |