summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2004-09-29 22:34:54 +0000
committerTim Angus <tim@ngus.net>2004-09-29 22:34:54 +0000
commit69c0ba88b5d5c745775750dca93d9844c0575733 (patch)
treecbbdd6a69c3f18a680f29720dc9bd5182eacad23 /src/cgame
parenta85e66b8d70f3249a89141a0f921819341bfa547 (diff)
* A smattering of fondulations
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_buildable.c15
-rw-r--r--src/cgame/cg_draw.c98
-rw-r--r--src/cgame/cg_local.h7
-rw-r--r--src/cgame/cg_main.c19
4 files changed, 118 insertions, 21 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c
index 708e8277..9420af94 100644
--- a/src/cgame/cg_buildable.c
+++ b/src/cgame/cg_buildable.c
@@ -81,18 +81,29 @@ void CG_AlienBuildableExplosion( vec3_t origin, vec3_t dir )
vec3_t velocity;
int count;
particleSystem_t *ps;
+ qhandle_t gibModel;
+ int i;
trap_S_StartSound( origin, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.alienBuildableExplosion );
// allow gibs to be turned off for speed
if( cg_gibs.integer )
{
- for( count = 0; count <= 9; count++ )
+ for( count = 0; count <= 8; count++ )
{
velocity[ 0 ] = crandom( ) * GGIB_VELOCITY;
velocity[ 1 ] = crandom( ) * GGIB_VELOCITY;
velocity[ 2 ] = GGIB_JUMP + crandom( ) * GGIB_VELOCITY;
- CG_AlienBuildableExplosionFragment( origin, velocity, cgs.media.gibAbdomen );
+
+ switch( i )
+ {
+ case 1: case 5: gibModel = cgs.media.alienGib1; break;
+ case 2: case 6: gibModel = cgs.media.alienGib2; break;
+ case 3: case 7: gibModel = cgs.media.alienGib3; break;
+ case 4: case 8: gibModel = cgs.media.alienGib4; break;
+ }
+
+ CG_AlienBuildableExplosionFragment( origin, velocity, gibModel );
}
}
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 266d03e9..d321d34e 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -537,9 +537,16 @@ static void CG_DrawPlayerCreditsValue( rectDef_t *rect, vec4_t color, qboolean p
{
int value;
playerState_t *ps;
+ centity_t *cent;
+ cent = &cg_entities[ cg.snap->ps.clientNum ];
ps = &cg.snap->ps;
+ //if the build timer pie is showing don't show this
+ if( ( cent->currentState.weapon == WP_ABUILD ||
+ cent->currentState.weapon == WP_ABUILD2 ) && ps->stats[ STAT_MISC ] )
+ return;
+
value = ps->persistant[ PERS_CREDIT ];
if( value > -1 )
{
@@ -1011,9 +1018,10 @@ static void CG_DrawUsableBuildable( rectDef_t *rect, qhandle_t shader, vec4_t co
#define BUILD_DELAY_TIME 2000
-static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color )
+static void CG_DrawPlayerBuildTimer( rectDef_t *rect, vec4_t color )
{
- int value;
+ float progress;
+ int index;
centity_t *cent;
playerState_t *ps;
@@ -1025,33 +1033,82 @@ static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color )
switch( cent->currentState.weapon )
{
case WP_ABUILD:
+ progress = (float)ps->stats[ STAT_MISC ] / (float)ABUILDER_BASE_DELAY;
+ break;
+
case WP_ABUILD2:
+ progress = (float)ps->stats[ STAT_MISC ] / (float)ABUILDER_ADV_DELAY;
+ break;
+
case WP_HBUILD:
+ progress = (float)ps->stats[ STAT_MISC ] / (float)HBUILD_DELAY;
+ break;
+
case WP_HBUILD2:
- //remaining build delay
- value = (int)( ceil( (float)ps->stats[ STAT_MISC ] / 1000.0f ) );
-
- if( cg.time - cg.lastBuildAttempt <= BUILD_DELAY_TIME )
- {
- if( ( cg.time / 300 ) % 2 )
- {
- color[ 0 ] = 1.0f;
- color[ 1 ] = color[ 2 ] = 0.0f;
- color[ 3 ] = 1.0f;
- }
- }
+ progress = (float)ps->stats[ STAT_MISC ] / (float)HBUILD2_DELAY;
break;
default:
- BG_unpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value, NULL );
+ return;
break;
}
+
+ if( !ps->stats[ STAT_MISC ] )
+ return;
- if( value > -1 )
+ index = (int)( progress * 8.0f );
+
+ if( index > 7 )
+ index = 7;
+ else if( index < 0 )
+ index = 0;
+
+ if( cg.time - cg.lastBuildAttempt <= BUILD_DELAY_TIME )
{
- trap_R_SetColor( color );
- CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value );
- trap_R_SetColor( NULL );
+ if( ( cg.time / 300 ) % 2 )
+ {
+ color[ 0 ] = 1.0f;
+ color[ 1 ] = color[ 2 ] = 0.0f;
+ color[ 3 ] = 1.0f;
+ }
+ }
+
+ trap_R_SetColor( color );
+ CG_DrawPic( rect->x, rect->y, rect->w, rect->h,
+ cgs.media.buildWeaponTimerPie[ index ] );
+ trap_R_SetColor( NULL );
+ }
+}
+
+static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color )
+{
+ int value;
+ centity_t *cent;
+ playerState_t *ps;
+
+ cent = &cg_entities[ cg.snap->ps.clientNum ];
+ ps = &cg.snap->ps;
+
+ if( cent->currentState.weapon )
+ {
+ switch( cent->currentState.weapon )
+ {
+ case WP_ABUILD:
+ case WP_ABUILD2:
+ case WP_HBUILD:
+ case WP_HBUILD2:
+ break;
+
+ default:
+ BG_unpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value, NULL );
+
+ if( value > -1 )
+ {
+ trap_R_SetColor( color );
+ CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value );
+ trap_R_SetColor( NULL );
+ }
+ break;
}
}
}
@@ -2335,6 +2392,9 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x,
case CG_PLAYER_CLIPS_VALUE:
CG_DrawPlayerClipsValue( &rect, color );
break;
+ case CG_PLAYER_BUILD_TIMER:
+ CG_DrawPlayerBuildTimer( &rect, color );
+ break;
case CG_PLAYER_HEALTH:
CG_DrawPlayerHealthValue( &rect, color );
break;
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 36d859fb..12ed3c7b 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1059,6 +1059,11 @@ typedef struct
qhandle_t metalGib7;
qhandle_t metalGib8;
+ qhandle_t alienGib1;
+ qhandle_t alienGib2;
+ qhandle_t alienGib3;
+ qhandle_t alienGib4;
+
qhandle_t gibSpark1;
qhandle_t gibSpark2;
@@ -1223,6 +1228,8 @@ typedef struct
qhandle_t alienBuildableDestroyedPS;
sfxHandle_t lCannonWarningSound;
+
+ qhandle_t buildWeaponTimerPie[ 8 ];
} cgMedia_t;
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 4995cde0..782db516 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -706,6 +706,17 @@ static void CG_RegisterGraphics( void )
"gfx/2d/numbers/nine_32b",
"gfx/2d/numbers/minus_32b",
};
+ static char *buildWeaponTimerPieShaders[ 8 ] =
+ {
+ "ui/assets/neutral/1_5pie",
+ "ui/assets/neutral/3_0pie",
+ "ui/assets/neutral/4_5pie",
+ "ui/assets/neutral/6_0pie",
+ "ui/assets/neutral/7_5pie",
+ "ui/assets/neutral/9_0pie",
+ "ui/assets/neutral/10_5pie",
+ "ui/assets/neutral/12_0pie",
+ };
// clear any references to old media
memset( &cg.refdef, 0, sizeof( cg.refdef ) );
@@ -757,6 +768,9 @@ static void CG_RegisterGraphics( void )
cgs.media.noPowerShader = trap_R_RegisterShader("gfx/2d/nopower" );
cgs.media.humanSpawningShader = trap_R_RegisterShader("models/buildables/telenode/rep_cyl" );
+ for( i = 0; i < 8; i++ )
+ cgs.media.buildWeaponTimerPie[ i ] = trap_R_RegisterShader( buildWeaponTimerPieShaders[ i ] );
+
cgs.media.machinegunBrassModel = trap_R_RegisterModel( "models/weapons2/shells/m_shell.md3" );
cgs.media.shotgunBrassModel = trap_R_RegisterModel( "models/weapons2/shells/s_shell.md3" );
@@ -783,6 +797,11 @@ static void CG_RegisterGraphics( void )
cgs.media.gibSpark1 = trap_R_RegisterShader( "models/fx/metal_gibs/spark.jpg" );
cgs.media.gibSpark2 = trap_R_RegisterShader( "models/fx/metal_gibs/spark2.jpg" );
+ cgs.media.alienGib1 = trap_R_RegisterModel( "models/fx/alien_gibs/a_gib1.md3" );
+ cgs.media.alienGib2 = trap_R_RegisterModel( "models/fx/alien_gibs/a_gib2.md3" );
+ cgs.media.alienGib3 = trap_R_RegisterModel( "models/fx/alien_gibs/a_gib3.md3" );
+ cgs.media.alienGib4 = trap_R_RegisterModel( "models/fx/alien_gibs/a_gib4.md3" );
+
cgs.media.smoke2 = trap_R_RegisterModel( "models/weapons2/shells/s_shell.md3" );
cgs.media.balloonShader = trap_R_RegisterShader( "sprites/balloon3" );