diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2015-06-26 01:29:00 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2015-06-26 01:29:00 +0200 |
commit | b28d5f6dbedd5b895eed4cc5b730581df3b2215d (patch) | |
tree | 9bb750d3f30ff731ce2c60f6a845fff25f20b668 /src/cgame | |
parent | 6c7152aada204bfdfa6e39cdfea5e10440e0ed36 (diff) |
Initial implementation of Wraith.
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_draw.c | 28 | ||||
-rw-r--r-- | src/cgame/cg_event.c | 32 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 10 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 9 | ||||
-rw-r--r-- | src/cgame/cg_players.c | 4 | ||||
-rw-r--r-- | src/cgame/cg_predict.c | 2 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 7 |
7 files changed, 91 insertions, 1 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 754b446..4782c00 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -1101,6 +1101,11 @@ static float CG_ChargeProgress( void ) max = LEVEL4_TRAMPLE_CHARGE_MAX; } } + else if( cg.snap->ps.weapon == WP_ALEVEL1 ) + { + min = 0; + max = LEVEL1_WARP_TIME; + } else if( cg.snap->ps.weapon == WP_LUCIFER_CANNON || cg.snap->ps.weapon == WP_FLAMER ) { @@ -4131,6 +4136,27 @@ static void CG_DrawHealthBars( void ) } } +/* +================= +CG_DrawWarpOverlay +================= +*/ +static void CG_DrawWarpOverlay( void ) +{ + if( !( cg.predictedPlayerEntity.currentState.eFlags & EF_WARPING ) || + cg.renderingThirdPerson ) + { + return; + } + + trap_R_SetColor( NULL ); + CG_DrawPic( 0, 0, 640, 480, cgs.media.warpOverlay ); + + if( cg.warpExitBlocked ) + { + CG_DrawPic( 0, 0, 640, 480, cgs.media.warpOverlayBlocked ); + } +} //================================================================================== @@ -4154,6 +4180,8 @@ static void CG_Draw2D( void ) // (only 2D that can't be disabled) CG_DrawLighting( ); + CG_DrawWarpOverlay( ); + if( cg_draw2D.integer == 0 ) return; diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 436e819..2ff1520 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -976,6 +976,38 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.rocketlPrimeSound ); break; + case EV_WARP_ENTER: + { + particleSystem_t *ps; + + ps = CG_SpawnNewParticleSystem( cgs.media.warpEnterPS ); + + if( CG_IsParticleSystemValid( &ps ) ) + { + CG_SetAttachmentPoint( &ps->attachment, position ); + CG_AttachToPoint( &ps->attachment ); + } + + trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.warpEnterSound ); + } + break; + + case EV_WARP_EXIT: + { + particleSystem_t *ps; + + ps = CG_SpawnNewParticleSystem( cgs.media.warpExitPS ); + + if( CG_IsParticleSystemValid( &ps ) ) + { + CG_SetAttachmentPoint( &ps->attachment, position ); + CG_AttachToPoint( &ps->attachment ); + } + + trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.warpExitSound ); + } + break; + // // missile impacts // diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 2233414..9a4793c 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1161,6 +1161,8 @@ typedef struct int nextWeaponClickTime; float viewQuake; + + qboolean warpExitBlocked; } cg_t; @@ -1351,6 +1353,14 @@ typedef struct sfxHandle_t hitSounds[ 5 ]; sfxHandle_t rocketlPrimeSound; + + sfxHandle_t warpEnterSound; + qhandle_t warpEnterPS; + sfxHandle_t warpExitSound; + qhandle_t warpExitPS; + sfxHandle_t warpingSound; + qhandle_t warpOverlay; + qhandle_t warpOverlayBlocked; } cgMedia_t; typedef struct diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index c3f45dd..c224171 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -769,6 +769,10 @@ static void CG_RegisterSounds( void ) cgs.media.hitSounds[ i ] = trap_S_RegisterSound( hit_sounds[ i ], qfalse ); cgs.media.rocketlPrimeSound = trap_S_RegisterSound( "models/weapons/rocketl/prime.wav", qfalse ); + + cgs.media.warpEnterSound = trap_S_RegisterSound( "sound/player/level1/warp1.wav", qfalse ); + cgs.media.warpExitSound = trap_S_RegisterSound( "sound/player/level1/warp2.wav", qfalse ); + cgs.media.warpingSound = trap_S_RegisterSound( "sound/player/level1/warping.wav", qfalse ); } @@ -930,6 +934,11 @@ static void CG_RegisterGraphics( void ) cgs.media.lightningImpactPS = CG_RegisterParticleSystem( "models/weapons/lightning/impactPS" ); + cgs.media.warpEnterPS = CG_RegisterParticleSystem( "gfx/level1/warpEnterPS" ); + cgs.media.warpExitPS = CG_RegisterParticleSystem( "gfx/level1/warpExitPS" ); + cgs.media.warpOverlay = trap_R_RegisterShader( "gfx/level1/warpOverlay" ); + cgs.media.warpOverlayBlocked = trap_R_RegisterShader( "gfx/level1/warpOverlayBlocked" ); + CG_BuildableStatusParse( "ui/assets/human/buildstat.cfg", &cgs.humanBuildStat ); CG_BuildableStatusParse( "ui/assets/alien/buildstat.cfg", &cgs.alienBuildStat ); diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 8cb5e17..e0bb622 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -1964,7 +1964,9 @@ void CG_Player( centity_t *cent ) // add the shadow if( ( es->number == cg.snap->ps.clientNum && cg.renderingThirdPerson ) || es->number != cg.snap->ps.clientNum ) - shadow = CG_PlayerShadow( cent, &shadowPlane, class ); + { + shadow = CG_PlayerShadow( cent, &shadowPlane, class ); + } // add a water splash if partially in and out of water CG_PlayerSplash( cent, class ); diff --git a/src/cgame/cg_predict.c b/src/cgame/cg_predict.c index bba333c..aa62e4d 100644 --- a/src/cgame/cg_predict.c +++ b/src/cgame/cg_predict.c @@ -910,6 +910,8 @@ void CG_PredictPlayerState( void ) cg.physicsTime, cg.time, cg.predictedPlayerState.origin ); + cg.warpExitBlocked = cg.pmext.warpExitBlocked; + // fire events and other transition triggered things CG_TransitionPlayerState( &cg.predictedPlayerState, &oldPlayerState ); diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index 520d40a..69b8b90 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -1131,6 +1131,13 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent CG_DestroyParticleSystem( ¢->muzzlePS ); } + + if( ps && ( cent->currentState.eFlags & EF_WARPING ) ) + { + trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, + vec3_origin, cgs.media.warpingSound ); + } + // add the flash if( !weapon->wim[ weaponMode ].continuousFlash || !firing ) { |