diff options
author | Tim Angus <tim@ngus.net> | 2009-10-03 12:46:30 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:13 +0000 |
commit | 120a3dd717954482db9109358f26b009f05d0421 (patch) | |
tree | a11dbb06594df9b6bfb954769a979b77f89d0a42 /src | |
parent | 947d079b94b7cfb2cf42d612ede728c34552d373 (diff) |
* Various changes resulting from sanity checking against mgdev HEAD
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_draw.c | 316 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 8 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 20 | ||||
-rw-r--r-- | src/cgame/cg_tutorial.c | 3 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 16 | ||||
-rw-r--r-- | src/game/bg_misc.c | 13 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 3 | ||||
-rw-r--r-- | src/game/bg_public.h | 10 | ||||
-rw-r--r-- | src/game/g_active.c | 62 | ||||
-rw-r--r-- | src/game/g_buildable.c | 4 | ||||
-rw-r--r-- | src/game/g_client.c | 22 | ||||
-rw-r--r-- | src/game/g_cmds.c | 82 | ||||
-rw-r--r-- | src/game/g_combat.c | 23 | ||||
-rw-r--r-- | src/game/g_local.h | 7 | ||||
-rw-r--r-- | src/game/g_main.c | 4 | ||||
-rw-r--r-- | src/game/g_ptr.c | 38 | ||||
-rw-r--r-- | src/game/g_svcmds.c | 3 | ||||
-rw-r--r-- | src/game/g_team.c | 3 | ||||
-rw-r--r-- | src/game/g_weapon.c | 5 | ||||
-rw-r--r-- | src/qcommon/q_shared.h | 4 | ||||
-rw-r--r-- | src/ui/ui_atoms.c | 5 | ||||
-rw-r--r-- | src/ui/ui_main.c | 29 | ||||
-rw-r--r-- | src/ui/ui_shared.c | 6 | ||||
-rw-r--r-- | src/ui/ui_shared.h | 8 |
24 files changed, 310 insertions, 384 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index c54068cc..6c59be4a 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -340,114 +340,46 @@ static void CG_DrawPlayerCreditsValue( rectDef_t *rect, vec4_t color, qboolean p } } -#define HH_MIN_ALPHA 0.2f -#define HH_MAX_ALPHA 0.8f -#define HH_ALPHA_DIFF (HH_MAX_ALPHA-HH_MIN_ALPHA) - -#define AH_MIN_ALPHA 0.2f -#define AH_MAX_ALPHA 0.8f -#define AH_ALPHA_DIFF (AH_MAX_ALPHA-AH_MIN_ALPHA) /* ============== -CG_DrawPlayerStamina1 +CG_DrawPlayerStamina ============== */ -static void CG_DrawPlayerStamina1( rectDef_t *rect, vec4_t color, qhandle_t shader ) -{ - playerState_t *ps = &cg.snap->ps; - float stamina = ps->stats[ STAT_STAMINA ]; - float maxStaminaBy3 = (float)MAX_STAMINA / 3.0f; - float progress; - - stamina -= ( 2 * (int)maxStaminaBy3 ); - progress = stamina / maxStaminaBy3; - - if( progress > 1.0f ) - progress = 1.0f; - else if( progress < 0.0f ) - progress = 0.0f; - - color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF ); - - trap_R_SetColor( color ); - CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); - trap_R_SetColor( NULL ); -} - -/* -============== -CG_DrawPlayerStamina2 -============== -*/ -static void CG_DrawPlayerStamina2( rectDef_t *rect, vec4_t color, qhandle_t shader ) -{ - playerState_t *ps = &cg.snap->ps; - float stamina = ps->stats[ STAT_STAMINA ]; - float maxStaminaBy3 = (float)MAX_STAMINA / 3.0f; - float progress; - - stamina -= (int)maxStaminaBy3; - progress = stamina / maxStaminaBy3; - - if( progress > 1.0f ) - progress = 1.0f; - else if( progress < 0.0f ) - progress = 0.0f; - - color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF ); - - trap_R_SetColor( color ); - CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); - trap_R_SetColor( NULL ); -} - -/* -============== -CG_DrawPlayerStamina3 -============== -*/ -static void CG_DrawPlayerStamina3( rectDef_t *rect, vec4_t color, qhandle_t shader ) +static void CG_DrawPlayerStamina( int ownerDraw, rectDef_t *rect, + vec4_t backColor, vec4_t foreColor, + qhandle_t shader ) { playerState_t *ps = &cg.snap->ps; float stamina = ps->stats[ STAT_STAMINA ]; float maxStaminaBy3 = (float)MAX_STAMINA / 3.0f; float progress; + vec4_t color; + switch( ownerDraw ) + { + case CG_PLAYER_STAMINA_1: + progress = ( stamina - 2 * (int)maxStaminaBy3 ) / maxStaminaBy3; + break; + case CG_PLAYER_STAMINA_2: + progress = ( stamina - (int)maxStaminaBy3 ) / maxStaminaBy3; + break; + case CG_PLAYER_STAMINA_3: progress = stamina / maxStaminaBy3; + break; + case CG_PLAYER_STAMINA_4: + progress = ( stamina + MAX_STAMINA ) / MAX_STAMINA; + break; + default: + return; + } if( progress > 1.0f ) progress = 1.0f; else if( progress < 0.0f ) progress = 0.0f; - color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF ); - - trap_R_SetColor( color ); - CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); - trap_R_SetColor( NULL ); -} - -/* -============== -CG_DrawPlayerStamina4 -============== -*/ -static void CG_DrawPlayerStamina4( rectDef_t *rect, vec4_t color, qhandle_t shader ) -{ - playerState_t *ps = &cg.snap->ps; - float stamina = ps->stats[ STAT_STAMINA ]; - float progress; - - stamina += (float)MAX_STAMINA; - progress = stamina / (float)MAX_STAMINA; - - if( progress > 1.0f ) - progress = 1.0f; - else if( progress < 0.0f ) - progress = 0.0f; - - color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF ); + Vector4Lerp( progress, backColor, foreColor, color ); trap_R_SetColor( color ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); @@ -459,18 +391,19 @@ static void CG_DrawPlayerStamina4( rectDef_t *rect, vec4_t color, qhandle_t shad CG_DrawPlayerStaminaBolt ============== */ -static void CG_DrawPlayerStaminaBolt( rectDef_t *rect, vec4_t color, qhandle_t shader ) +static void CG_DrawPlayerStaminaBolt( rectDef_t *rect, vec4_t backColor, + vec4_t foreColor, qhandle_t shader ) { - playerState_t *ps = &cg.snap->ps; - float stamina = ps->stats[ STAT_STAMINA ]; + float stamina = cg.snap->ps.stats[ STAT_STAMINA ]; + vec4_t color; if( stamina < 0 ) - color[ 3 ] = HH_MIN_ALPHA; + Vector4Copy( backColor, color ); else if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_SPEEDBOOST ) - color[ 3 ] = HH_MIN_ALPHA + HH_MAX_ALPHA * - ( 0.5f + sin( cg.time / 200.0f ) / 2 ); + Vector4Lerp( ( sin( cg.time / 150.f ) + 1 ) / 2, + backColor, foreColor, color ); else - color[ 3 ] = HH_MAX_ALPHA; + Vector4Copy( foreColor, color ); trap_R_SetColor( color ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); @@ -482,7 +415,8 @@ static void CG_DrawPlayerStaminaBolt( rectDef_t *rect, vec4_t color, qhandle_t s CG_DrawPlayerClipsRing ============== */ -static void CG_DrawPlayerClipsRing( rectDef_t *rect, vec4_t color, qhandle_t shader ) +static void CG_DrawPlayerClipsRing( rectDef_t *rect, vec4_t backColor, + vec4_t foreColor, qhandle_t shader ) { playerState_t *ps = &cg.snap->ps; centity_t *cent; @@ -490,6 +424,7 @@ static void CG_DrawPlayerClipsRing( rectDef_t *rect, vec4_t color, qhandle_t sha float progress; float maxDelay; weapon_t weapon; + vec4_t color; cent = &cg_entities[ cg.snap->ps.clientNum ]; weapon = BG_GetPlayerWeapon( ps ); @@ -503,7 +438,7 @@ static void CG_DrawPlayerClipsRing( rectDef_t *rect, vec4_t color, qhandle_t sha buildTime = MAXIMUM_BUILD_TIME; progress = ( MAXIMUM_BUILD_TIME - buildTime ) / MAXIMUM_BUILD_TIME; - color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF ); + Vector4Lerp( progress, backColor, foreColor, color ); break; default: @@ -512,8 +447,10 @@ static void CG_DrawPlayerClipsRing( rectDef_t *rect, vec4_t color, qhandle_t sha maxDelay = (float)BG_Weapon( cent->currentState.weapon )->reloadTime; progress = ( maxDelay - (float)ps->weaponTime ) / maxDelay; - color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF ); + Vector4Lerp( progress, backColor, foreColor, color ); } + else + Com_Memcpy( color, foreColor, sizeof( color ) ); break; } @@ -527,12 +464,14 @@ static void CG_DrawPlayerClipsRing( rectDef_t *rect, vec4_t color, qhandle_t sha CG_DrawPlayerBuildTimerRing ============== */ -static void CG_DrawPlayerBuildTimerRing( rectDef_t *rect, vec4_t color, qhandle_t shader ) +static void CG_DrawPlayerBuildTimerRing( rectDef_t *rect, vec4_t backColor, + vec4_t foreColor, qhandle_t shader ) { playerState_t *ps = &cg.snap->ps; centity_t *cent; float buildTime = ps->stats[ STAT_MISC ]; float progress; + vec4_t color; cent = &cg_entities[ cg.snap->ps.clientNum ]; @@ -541,7 +480,7 @@ static void CG_DrawPlayerBuildTimerRing( rectDef_t *rect, vec4_t color, qhandle_ progress = ( MAXIMUM_BUILD_TIME - buildTime ) / MAXIMUM_BUILD_TIME; - color[ 3 ] = AH_MIN_ALPHA + ( progress * AH_ALPHA_DIFF ); + Vector4Lerp( progress, backColor, foreColor, color ); trap_R_SetColor( color ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); @@ -553,14 +492,14 @@ static void CG_DrawPlayerBuildTimerRing( rectDef_t *rect, vec4_t color, qhandle_ CG_DrawPlayerBoosted ============== */ -static void CG_DrawPlayerBoosted( rectDef_t *rect, vec4_t color, qhandle_t shader ) +static void CG_DrawPlayerBoosted( rectDef_t *rect, vec4_t backColor, + vec4_t foreColor, qhandle_t shader ) { if( cg.snap->ps.stats[ STAT_STATE ] & SS_BOOSTED ) - color[ 3 ] = AH_MAX_ALPHA; + trap_R_SetColor( foreColor ); else - color[ 3 ] = AH_MIN_ALPHA; + trap_R_SetColor( backColor ); - trap_R_SetColor( color ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); trap_R_SetColor( NULL ); } @@ -570,19 +509,20 @@ static void CG_DrawPlayerBoosted( rectDef_t *rect, vec4_t color, qhandle_t shade CG_DrawPlayerBoosterBolt ============== */ -static void CG_DrawPlayerBoosterBolt( rectDef_t *rect, vec4_t color, qhandle_t shader ) +static void CG_DrawPlayerBoosterBolt( rectDef_t *rect, vec4_t backColor, + vec4_t foreColor, qhandle_t shader ) { - vec4_t localColor; - - Vector4Copy( color, localColor ); + vec4_t color; // Flash bolts when the boost is almost out if( ( cg.snap->ps.stats[ STAT_STATE ] & SS_BOOSTED ) && ( cg.snap->ps.stats[ STAT_STATE ] & SS_BOOSTEDWARNING ) ) - localColor[ 3 ] += ( 1.0f - localColor[ 3 ] ) * - ( 0.5f + sin( cg.time / 100.0f ) / 2 ); + Vector4Lerp( ( sin( cg.time / 100.0f ) + 1 ) / 2, + backColor, foreColor, color ); + else + Vector4Copy( foreColor, color ); - trap_R_SetColor( localColor ); + trap_R_SetColor( color ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); trap_R_SetColor( NULL ); } @@ -647,17 +587,13 @@ static void CG_DrawPlayerPoisonBarbs( rectDef_t *rect, vec4_t color, qhandle_t s CG_DrawPlayerWallclimbing ============== */ -static void CG_DrawPlayerWallclimbing( rectDef_t *rect, vec4_t color, qhandle_t shader ) +static void CG_DrawPlayerWallclimbing( rectDef_t *rect, vec4_t backColor, vec4_t foreColor, qhandle_t shader ) { - playerState_t *ps = &cg.snap->ps; - qboolean ww = ps->stats[ STAT_STATE ] & SS_WALLCLIMBING; - - if( ww ) - color[ 3 ] = AH_MAX_ALPHA; + if( cg.snap->ps.stats[ STAT_STATE ] & SS_WALLCLIMBING ) + trap_R_SetColor( foreColor ); else - color[ 3 ] = AH_MIN_ALPHA; + trap_R_SetColor( backColor ); - trap_R_SetColor( color ); CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader ); trap_R_SetColor( NULL ); } @@ -762,15 +698,23 @@ static void CG_DrawPlayerBuildTimer( rectDef_t *rect, vec4_t color ) { int index; playerState_t *ps; - weapon_t weapon; ps = &cg.snap->ps; - weapon = BG_PrimaryWeapon( ps->stats ); - if( ( weapon != WP_ABUILD && weapon != WP_ABUILD2 && weapon != WP_HBUILD ) || - ps->stats[ STAT_MISC ] <= 0 ) + if( ps->stats[ STAT_MISC ] <= 0 ) return; + switch( BG_PrimaryWeapon( ps->stats ) ) + { + case WP_ABUILD: + case WP_ABUILD2: + case WP_HBUILD: + break; + + default: + return; + } + index = 8 * ( ps->stats[ STAT_MISC ] - 1 ) / MAXIMUM_BUILD_TIME; if( index > 7 ) index = 7; @@ -794,20 +738,16 @@ static void CG_DrawPlayerBuildTimer( rectDef_t *rect, vec4_t color ) static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color ) { int value; - playerState_t *ps; - weapon_t weapon; - - ps = &cg.snap->ps; - weapon = BG_PrimaryWeapon( ps->stats ); + playerState_t *ps = &cg.snap->ps; - switch( weapon ) + switch( BG_PrimaryWeapon( ps->stats ) ) { case WP_NONE: case WP_BLASTER: case WP_ABUILD: case WP_ABUILD2: case WP_HBUILD: - break; + return; default: value = ps->clips; @@ -1386,7 +1326,7 @@ static void CG_DrawTeamSpectators( rectDef_t *rect, float scale, int textvalign, /* ================== -CG_DrawSpectatorText +CG_DrawFollow ================== */ static void CG_DrawFollow( rectDef_t *rect, float text_x, float text_y, @@ -2327,7 +2267,7 @@ Draw an owner drawn item void CG_OwnerDraw( float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, int align, int textalign, int textvalign, float special, - float scale, vec4_t color, + float scale, vec4_t foreColor, vec4_t backColor, qhandle_t shader, int textStyle ) { rectDef_t rect; @@ -2340,110 +2280,104 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, switch( ownerDraw ) { case CG_PLAYER_CREDITS_VALUE: - CG_DrawPlayerCreditsValue( &rect, color, qtrue ); + CG_DrawPlayerCreditsValue( &rect, foreColor, qtrue ); break; case CG_PLAYER_CREDITS_VALUE_NOPAD: - CG_DrawPlayerCreditsValue( &rect, color, qfalse ); + CG_DrawPlayerCreditsValue( &rect, foreColor, qfalse ); break; case CG_PLAYER_STAMINA_1: - CG_DrawPlayerStamina1( &rect, color, shader ); - break; case CG_PLAYER_STAMINA_2: - CG_DrawPlayerStamina2( &rect, color, shader ); - break; case CG_PLAYER_STAMINA_3: - CG_DrawPlayerStamina3( &rect, color, shader ); - break; case CG_PLAYER_STAMINA_4: - CG_DrawPlayerStamina4( &rect, color, shader ); + CG_DrawPlayerStamina( ownerDraw, &rect, backColor, foreColor, shader ); break; case CG_PLAYER_STAMINA_BOLT: - CG_DrawPlayerStaminaBolt( &rect, color, shader ); + CG_DrawPlayerStaminaBolt( &rect, backColor, foreColor, shader ); break; case CG_PLAYER_AMMO_VALUE: - CG_DrawPlayerAmmoValue( &rect, color ); + CG_DrawPlayerAmmoValue( &rect, foreColor ); break; case CG_PLAYER_CLIPS_VALUE: - CG_DrawPlayerClipsValue( &rect, color ); + CG_DrawPlayerClipsValue( &rect, foreColor ); break; case CG_PLAYER_BUILD_TIMER: - CG_DrawPlayerBuildTimer( &rect, color ); + CG_DrawPlayerBuildTimer( &rect, foreColor ); break; case CG_PLAYER_HEALTH: - CG_DrawPlayerHealthValue( &rect, color ); + CG_DrawPlayerHealthValue( &rect, foreColor ); break; case CG_PLAYER_HEALTH_CROSS: - CG_DrawPlayerHealthCross( &rect, color ); + CG_DrawPlayerHealthCross( &rect, foreColor ); break; case CG_PLAYER_CHARGE_BAR_BG: - CG_DrawPlayerChargeBarBG( &rect, color, shader ); + CG_DrawPlayerChargeBarBG( &rect, foreColor, shader ); break; case CG_PLAYER_CHARGE_BAR: - CG_DrawPlayerChargeBar( &rect, color, shader ); + CG_DrawPlayerChargeBar( &rect, foreColor, shader ); break; case CG_PLAYER_CLIPS_RING: - CG_DrawPlayerClipsRing( &rect, color, shader ); + CG_DrawPlayerClipsRing( &rect, backColor, foreColor, shader ); break; case CG_PLAYER_BUILD_TIMER_RING: - CG_DrawPlayerBuildTimerRing( &rect, color, shader ); + CG_DrawPlayerBuildTimerRing( &rect, backColor, foreColor, shader ); break; case CG_PLAYER_WALLCLIMBING: - CG_DrawPlayerWallclimbing( &rect, color, shader ); + CG_DrawPlayerWallclimbing( &rect, backColor, foreColor, shader ); break; case CG_PLAYER_BOOSTED: - CG_DrawPlayerBoosted( &rect, color, shader ); + CG_DrawPlayerBoosted( &rect, backColor, foreColor, shader ); break; case CG_PLAYER_BOOST_BOLT: - CG_DrawPlayerBoosterBolt( &rect, color, shader ); + CG_DrawPlayerBoosterBolt( &rect, backColor, foreColor, shader ); break; case CG_PLAYER_POISON_BARBS: - CG_DrawPlayerPoisonBarbs( &rect, color, shader ); + CG_DrawPlayerPoisonBarbs( &rect, foreColor, shader ); break; case CG_PLAYER_ALIEN_SENSE: CG_DrawAlienSense( &rect ); break; case CG_PLAYER_HUMAN_SCANNER: - CG_DrawHumanScanner( &rect, shader, color ); + CG_DrawHumanScanner( &rect, shader, foreColor ); break; case CG_PLAYER_USABLE_BUILDABLE: - CG_DrawUsableBuildable( &rect, shader, color ); + CG_DrawUsableBuildable( &rect, shader, foreColor ); break; case CG_KILLER: - CG_DrawKiller( &rect, scale, color, shader, textStyle ); + CG_DrawKiller( &rect, scale, foreColor, shader, textStyle ); break; case CG_PLAYER_SELECT: - CG_DrawItemSelect( &rect, color ); + CG_DrawItemSelect( &rect, foreColor ); break; case CG_PLAYER_WEAPONICON: - CG_DrawWeaponIcon( &rect, color ); + CG_DrawWeaponIcon( &rect, foreColor ); break; case CG_PLAYER_SELECTTEXT: CG_DrawItemSelectText( &rect, scale, textStyle ); break; case CG_SPECTATORS: - CG_DrawTeamSpectators( &rect, scale, textvalign, color, shader ); + CG_DrawTeamSpectators( &rect, scale, textvalign, foreColor, shader ); break; case CG_PLAYER_LOCATION: - CG_DrawLocation( &rect, scale, textalign, color ); + CG_DrawLocation( &rect, scale, textalign, foreColor ); break; case CG_FOLLOW: - CG_DrawFollow( &rect, text_x, text_y, color, scale, + CG_DrawFollow( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle ); break; case CG_PLAYER_CROSSHAIRNAMES: CG_DrawCrosshairNames( &rect, scale, textStyle ); break; case CG_PLAYER_CROSSHAIR: - CG_DrawCrosshair( &rect, color ); + CG_DrawCrosshair( &rect, foreColor ); break; case CG_STAGE_REPORT_TEXT: - CG_DrawStageReport( &rect, text_x, text_y, color, scale, textalign, textvalign, textStyle ); + CG_DrawStageReport( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle ); break; case CG_ALIENS_SCORE_LABEL: - CG_DrawTeamLabel( &rect, TEAM_ALIENS, text_x, text_y, color, scale, textalign, textvalign, textStyle ); + CG_DrawTeamLabel( &rect, TEAM_ALIENS, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle ); break; case CG_HUMANS_SCORE_LABEL: - CG_DrawTeamLabel( &rect, TEAM_HUMANS, text_x, text_y, color, scale, textalign, textvalign, textStyle ); + CG_DrawTeamLabel( &rect, TEAM_HUMANS, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle ); break; //loading screen @@ -2451,74 +2385,74 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, CG_DrawLevelShot( &rect ); break; case CG_LOAD_MEDIA: - CG_DrawMediaProgress( &rect, color, scale, align, textalign, textStyle, special ); + CG_DrawMediaProgress( &rect, foreColor, scale, align, textalign, textStyle, special ); break; case CG_LOAD_MEDIA_LABEL: - CG_DrawMediaProgressLabel( &rect, text_x, text_y, color, scale, textalign, textvalign ); + CG_DrawMediaProgressLabel( &rect, text_x, text_y, foreColor, scale, textalign, textvalign ); break; case CG_LOAD_BUILDABLES: - CG_DrawBuildablesProgress( &rect, color, scale, align, textalign, textStyle, special ); + CG_DrawBuildablesProgress( &rect, foreColor, scale, align, textalign, textStyle, special ); break; case CG_LOAD_BUILDABLES_LABEL: - CG_DrawBuildablesProgressLabel( &rect, text_x, text_y, color, scale, textalign, textvalign ); + CG_DrawBuildablesProgressLabel( &rect, text_x, text_y, foreColor, scale, textalign, textvalign ); break; case CG_LOAD_CHARMODEL: - CG_DrawCharModelProgress( &rect, color, scale, align, textalign, textStyle, special ); + CG_DrawCharModelProgress( &rect, foreColor, scale, align, textalign, textStyle, special ); break; case CG_LOAD_CHARMODEL_LABEL: - CG_DrawCharModelProgressLabel( &rect, text_x, text_y, color, scale, textalign, textvalign ); + CG_DrawCharModelProgressLabel( &rect, text_x, text_y, foreColor, scale, textalign, textvalign ); break; case CG_LOAD_OVERALL: - CG_DrawOverallProgress( &rect, color, scale, align, textalign, textStyle, special ); + CG_DrawOverallProgress( &rect, foreColor, scale, align, textalign, textStyle, special ); break; case CG_LOAD_LEVELNAME: - CG_DrawLevelName( &rect, text_x, text_y, color, scale, textalign, textvalign, textStyle ); + CG_DrawLevelName( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle ); break; case CG_LOAD_MOTD: - CG_DrawMOTD( &rect, text_x, text_y, color, scale, textalign, textvalign, textStyle ); + CG_DrawMOTD( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle ); break; case CG_LOAD_HOSTNAME: - CG_DrawHostname( &rect, text_x, text_y, color, scale, textalign, textvalign, textStyle ); + CG_DrawHostname( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle ); break; case CG_FPS: - CG_DrawFPS( &rect, text_x, text_y, scale, color, textalign, textvalign, textStyle, qtrue ); + CG_DrawFPS( &rect, text_x, text_y, scale, foreColor, textalign, textvalign, textStyle, qtrue ); break; case CG_FPS_FIXED: - CG_DrawFPS( &rect, text_x, text_y, scale, color, textalign, textvalign, textStyle, qfalse ); + CG_DrawFPS( &rect, text_x, text_y, scale, foreColor, textalign, textvalign, textStyle, qfalse ); break; case CG_TIMER: - CG_DrawTimer( &rect, text_x, text_y, scale, color, textalign, textvalign, textStyle ); + CG_DrawTimer( &rect, text_x, text_y, scale, foreColor, textalign, textvalign, textStyle ); break; case CG_CLOCK: - CG_DrawClock( &rect, text_x, text_y, scale, color, textalign, textvalign, textStyle ); + CG_DrawClock( &rect, text_x, text_y, scale, foreColor, textalign, textvalign, textStyle ); break; case CG_TIMER_MINS: - CG_DrawTimerMins( &rect, color ); + CG_DrawTimerMins( &rect, foreColor ); break; case CG_TIMER_SECS: - CG_DrawTimerSecs( &rect, color ); + CG_DrawTimerSecs( &rect, foreColor ); break; case CG_SNAPSHOT: - CG_DrawSnapshot( &rect, text_x, text_y, scale, color, textalign, textvalign, textStyle ); + CG_DrawSnapshot( &rect, text_x, text_y, scale, foreColor, textalign, textvalign, textStyle ); break; case CG_LAGOMETER: - CG_DrawLagometer( &rect, text_x, text_y, scale, color ); + CG_DrawLagometer( &rect, text_x, text_y, scale, foreColor ); break; case CG_DEMO_PLAYBACK: - CG_DrawDemoPlayback( &rect, color, shader ); + CG_DrawDemoPlayback( &rect, foreColor, shader ); break; case CG_DEMO_RECORDING: - CG_DrawDemoRecording( &rect, color, shader ); + CG_DrawDemoRecording( &rect, foreColor, shader ); break; case CG_CONSOLE: - CG_DrawConsole( &rect, text_x, text_y, color, scale, textalign, textvalign, textStyle ); + CG_DrawConsole( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle ); break; case CG_TUTORIAL: - CG_DrawTutorial( &rect, text_x, text_y, color, scale, textalign, textvalign, textStyle ); + CG_DrawTutorial( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle ); break; default: diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index be2d8cbd..8f26df43 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -572,8 +572,6 @@ typedef struct lerpFrame_t legs, torso, nonseg, weapon; int painTime; int painDirection; // flip from 0 to 1 - - qboolean squadMarked; // player has been marked as a squadmember // machinegun spinning float barrelAngle; @@ -1636,9 +1634,9 @@ void CG_CenterPrint( const char *str, int y, int charWidth ); void CG_DrawActive( stereoFrame_t stereoView ); void CG_OwnerDraw( float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, - int align, int textalign, int textvalign, float special, - float scale, vec4_t color, - qhandle_t shader, int textStyle ); + int align, int textalign, int textvalign, + float special, float scale, vec4_t foreColor, + vec4_t backColor, qhandle_t shader, int textStyle ); float CG_GetValue(int ownerDraw); void CG_RunMenuScript(char **args); void CG_SetPrintString( int type, const char *p ); diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index 422bdb75..28f42553 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -658,7 +658,7 @@ void CG_Menu( int menu, int arg ) case MN_H_NOPOWERHERE: longMsg = "There is no power here. If available, a Repeater may be used to " - "transmit power, to this location."; + "transmit power to this location."; shortMsg = "There is no power here"; type = DT_BUILD; break; @@ -828,8 +828,10 @@ void CG_Menu( int menu, int arg ) break; case MN_A_INFEST: - trap_Cvar_Set( "ui_currentClass", va( "%d %d", cg.snap->ps.stats[ STAT_CLASS ], - cg.snap->ps.persistant[ PERS_CREDIT ] ) ); + trap_Cvar_Set( "ui_currentClass", + va( "%d %d", cg.snap->ps.stats[ STAT_CLASS ], + cg.snap->ps.persistant[ PERS_CREDIT ] ) ); + cmd = "menu tremulous_alienupgrade\n"; type = DT_INTERACTIVE; break; @@ -1149,11 +1151,13 @@ CG_ServerMenu_f */ static void CG_ServerMenu_f( void ) { - if( trap_Argc( ) == 2 && !cg.demoPlayback ) - CG_Menu( atoi( CG_Argv( 1 ) ), 0 ); - - if( trap_Argc( ) == 3 && !cg.demoPlayback ) - CG_Menu( atoi( CG_Argv( 1 ) ), atoi( CG_Argv( 2 ) ) ); + if( !cg.demoPlayback ) + { + if( trap_Argc( ) == 2 ) + CG_Menu( atoi( CG_Argv( 1 ) ), 0 ); + else if( trap_Argc( ) == 3 ) + CG_Menu( atoi( CG_Argv( 1 ) ), atoi( CG_Argv( 2 ) ) ); + } } /* diff --git a/src/cgame/cg_tutorial.c b/src/cgame/cg_tutorial.c index bd41be2a..41507162 100644 --- a/src/cgame/cg_tutorial.c +++ b/src/cgame/cg_tutorial.c @@ -221,7 +221,8 @@ static void CG_AlienBuilderText( char *text, playerState_t *ps ) } } - if( ps->stats[ STAT_CLASS ] == PCL_ALIEN_BUILDER0_UPG ) + if( ps->stats[ STAT_CLASS ] == PCL_ALIEN_BUILDER0 || + ps->stats[ STAT_CLASS ] == PCL_ALIEN_BUILDER0_UPG ) { if( ( ps->stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) == BA_NONE ) { diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index b020c8bb..ceb0c3b1 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -1366,12 +1366,20 @@ CG_DrawItemSelect */ void CG_DrawItemSelect( rectDef_t *rect, vec4_t color ) { + int i; + float x = rect->x; + float y = rect->y; + float width = rect->w; + float height = rect->h; + float iconWidth; + float iconHeight; + int items[ 64 ]; + int colinfo[ 64 ]; + int numItems = 0, selectedItem = 0; + int length; + qboolean vertical; centity_t *cent; playerState_t *ps; - float x = rect->x, y = rect->y, width = rect->w, height = rect->h, - iconWidth, iconHeight; - int i, items[ 64 ], colinfo[ 64 ], numItems = 0, selectedItem = 0, length; - qboolean vertical; cent = &cg_entities[ cg.snap->ps.clientNum ]; ps = &cg.snap->ps; diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 79bdb09f..3de02f9b 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -2055,10 +2055,9 @@ static const weaponAttributes_t bg_weapons[ ] = SLOT_WEAPON, //int slots; "mdriver", //char *weaponName; "Mass Driver", //char *humanName; - "A portable magnetic accelerator capable of launching " - "metallic slugs at extremely high velocity. Damage is dealt to " - "all targets in the line of fire until the slug comes to a halt " - "within a wall.", + "A portable particle accelerator which causes minor nuclear " + "reactions at the point of impact. It has a very large " + "payload, but fires slowly.", MDRIVER_CLIPSIZE, //int maxAmmo; MDRIVER_MAXCLIPS, //int maxClips; qfalse, //int infiniteAmmo; @@ -3096,7 +3095,7 @@ qboolean BG_WeaponIsFull( weapon_t weapon, int stats[ ], int ammo, int clips ) maxClips = BG_Weapon( weapon )->maxClips; if( BG_InventoryContainsUpgrade( UP_BATTPACK, stats ) ) - maxAmmo *= BATTPACK_MODIFIER; + maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER ); return ( maxAmmo == ammo ) && ( maxClips == clips ); } @@ -3418,9 +3417,9 @@ Only needs to be used for human weapons. */ weapon_t BG_GetPlayerWeapon( playerState_t *ps ) { - if( ps->persistant[ PERS_NEWWEAPON ] && - ps->persistant[ PERS_NEWWEAPON ] != ps->weapon ) + if( ps->persistant[ PERS_NEWWEAPON ] ) return ps->persistant[ PERS_NEWWEAPON ]; + return ps->weapon; } diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 5ac711ad..0a6f1923 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -790,7 +790,6 @@ static qboolean PM_CheckJump( void ) if( pm->ps->pm_type == PM_GRABBED ) { pm->cmd.upmove = 0; - // not holding jump return qfalse; } @@ -3681,7 +3680,7 @@ void PmoveSingle( pmove_t *pmove ) if( pm->cmd.upmove < 10 ) { - // not holding jump or minijump + // not holding jump pm->ps->pm_flags &= ~PMF_JUMP_HELD; } diff --git a/src/game/bg_public.h b/src/game/bg_public.h index cfe456c5..5be99588 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -242,12 +242,12 @@ typedef enum #define SS_POISONED 0x00000020 #define SS_HOVELING 0x00000040 #define SS_BOOSTED 0x00000080 -#define SS_SLOWLOCKED 0x00000100 -#define SS_BOOSTEDWARNING 0x00000200 // booster poison is running out +#define SS_BOOSTEDWARNING 0x00000100 // booster poison is running out +#define SS_SLOWLOCKED 0x00000200 #define SS_CHARGING 0x00000400 -#define SS_HEALING_ACTIVE 0x00002000 // medistat for Humans, creep for Aliens -#define SS_HEALING_2X 0x00004000 // medkit or double healing rate (for HUD) -#define SS_HEALING_3X 0x00008000 // triple healing rate (for HUD) +#define SS_HEALING_ACTIVE 0x00000800 // medistat for humans, creep for aliens +#define SS_HEALING_2X 0x00001000 // medkit or double healing rate +#define SS_HEALING_3X 0x00002000 // triple healing rate #define SB_VALID_TOGGLEBIT 0x00004000 diff --git a/src/game/g_active.c b/src/game/g_active.c index 29b57c4f..e004346a 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -198,7 +198,7 @@ ClientShove */ static int GetClientMass( gentity_t *ent ) { - int entMass = 75; + int entMass = 100; if( ent->client->pers.teamSelection == TEAM_ALIENS ) entMass = BG_Class( ent->client->pers.classSelection )->health; @@ -459,11 +459,12 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) client->ps.pm_type = PM_FREEZE; else if( client->noclip ) client->ps.pm_type = PM_NOCLIP; - else if( queued ) - client->ps.pm_flags |= PMF_QUEUED; - + else client->ps.pm_type = PM_SPECTATOR; + if( queued ) + client->ps.pm_flags |= PMF_QUEUED; + client->ps.speed = client->pers.flySpeed; client->ps.stats[ STAT_STAMINA ] = 0; client->ps.stats[ STAT_MISC ] = 0; @@ -760,11 +761,7 @@ void ClientTimerActions( gentity_t *ent, int msec ) // Regenerate Adv. Dragoon barbs if( client->ps.weapon == WP_ALEVEL3_UPG ) { - int maxAmmo; - - maxAmmo = BG_Weapon( WP_ALEVEL3_UPG )->maxAmmo; - - if( client->ps.ammo < maxAmmo ) + if( client->ps.ammo < BG_Weapon( WP_ALEVEL3_UPG )->maxAmmo ) { if( ent->timestamp + LEVEL3_BOUNCEBALL_REGEN < level.time ) { @@ -1272,19 +1269,6 @@ void ClientThink_real( gentity_t *ent ) // G_Printf("serverTime >>>>>\n" ); } - // ucmd->serverTime is a client predicted value, but it works for making a - // replacement for client->ps.ping when in SPECTATOR_FOLLOW - client->pers.ping = level.time - ucmd->serverTime; - - // account for the one frame of delay on client side - client->pers.ping -= level.time - level.previousTime; - - // account for the time that's elapsed since the last ClientEndFrame() - client->pers.ping += trap_Milliseconds() - level.frameMsec; - - if( client->pers.ping < 0 ) - client->pers.ping = 0; - msec = ucmd->serverTime - client->ps.commandTime; // following others may result in bad times, but we still want // to check for follow toggles @@ -1840,24 +1824,20 @@ void SpectatorClientEndFrame( gentity_t *ent ) cl = &level.clients[ clientNum ]; if( cl->pers.connected == CON_CONNECTED ) { - if( cl->sess.spectatorState == SPECTATOR_NOT ) - { - // Save - flags = ( cl->ps.eFlags & ~( EF_VOTED | EF_TEAMVOTED ) ) | - ( ent->client->ps.eFlags & ( EF_VOTED | EF_TEAMVOTED ) ); - score = ent->client->ps.persistant[ PERS_SCORE ]; - ping = ent->client->ps.ping; - - // Copy - ent->client->ps = cl->ps; - - // Restore - ent->client->ps.eFlags = flags; - ent->client->ps.persistant[ PERS_SCORE ] = score; - ent->client->ps.ping = ping; - } + // Save + flags = ( cl->ps.eFlags & ~( EF_VOTED | EF_TEAMVOTED ) ) | + ( ent->client->ps.eFlags & ( EF_VOTED | EF_TEAMVOTED ) ); + score = ent->client->ps.persistant[ PERS_SCORE ]; + ping = ent->client->ps.ping; + + // Copy + ent->client->ps = cl->ps; + + // Restore + ent->client->ps.eFlags = flags; + ent->client->ps.persistant[ PERS_SCORE ] = score; + ent->client->ps.ping = ping; - ent->client->ps.clientNum = clientNum; ent->client->ps.pm_flags |= PMF_FOLLOW; ent->client->ps.pm_flags &= ~PMF_QUEUED; } @@ -1886,10 +1866,6 @@ void ClientEndFrame( gentity_t *ent ) pers = &ent->client->pers; - // save a copy of certain playerState values in case of SPECTATOR_FOLLOW - pers->score = ent->client->ps.persistant[ PERS_SCORE ]; - pers->credit = ent->client->ps.persistant[ PERS_CREDIT ]; - // // If the end of unit layout is displayed, don't give // the player any normal movement attributes diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index e2bc16a8..889836cc 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -594,7 +594,7 @@ void AGeneric_Blast( gentity_t *self ) TEAM_ALIENS ); //pretty events and item cleanup - self->s.eFlags |= EF_NODRAW; //don't draw the model once its destroyed + self->s.eFlags |= EF_NODRAW; //don't draw the model once it's destroyed G_AddEvent( self, EV_ALIEN_BUILDABLE_EXPLOSION, DirToByte( dir ) ); self->timestamp = level.time; self->think = AGeneric_CreepRecede; @@ -2367,7 +2367,7 @@ void HSpawn_Think( gentity_t *self ) // If it's part of the map, kill self. if( ent->s.eType == ET_BUILDABLE ) { - G_Damage( ent, NULL, NULL, NULL, NULL, 10000, 0, MOD_SUICIDE ); + G_Damage( ent, NULL, NULL, NULL, NULL, self->health, 0, MOD_SUICIDE ); G_SetBuildableAnim( self, BANIM_SPAWN1, qtrue ); } else if( ent->s.number == ENTITYNUM_WORLD || ent->s.eType == ET_MOVER ) diff --git a/src/game/g_client.c b/src/game/g_client.c index 912e9dd9..174498ab 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -91,19 +91,15 @@ void G_AddCreditToClient( gclient_t *client, short credit, qboolean cap ) if( !client ) return; - client->pers.credit += credit; - capAmount = client->pers.teamSelection == TEAM_ALIENS ? - ALIEN_MAX_FRAGS * ALIEN_CREDITS_PER_FRAG : HUMAN_MAX_CREDITS; + client->ps.persistant[ PERS_CREDIT ] += credit; + capAmount = client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ? + ALIEN_MAX_CREDITS : HUMAN_MAX_CREDITS; - if( cap && client->pers.credit > capAmount ) - client->pers.credit = capAmount; + if( cap && client->ps.persistant[ PERS_CREDIT ] > capAmount ) + client->ps.persistant[ PERS_CREDIT ] = capAmount; - if( client->pers.credit < 0 ) - client->pers.credit = 0; - - // keep PERS_CREDIT in sync if not following - if( client->sess.spectatorState != SPECTATOR_FOLLOW ) - client->ps.persistant[ PERS_CREDIT ] = client->pers.credit; + if( client->ps.persistant[ PERS_CREDIT ] < 0 ) + client->ps.persistant[ PERS_CREDIT ] = 0; } @@ -1455,10 +1451,6 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles client->ps.persistant[ PERS_SPAWN_COUNT ]++; client->ps.persistant[ PERS_SPECSTATE ] = client->sess.spectatorState; - // restore really persistant things - client->ps.persistant[ PERS_SCORE ] = client->pers.score; - client->ps.persistant[ PERS_CREDIT ] = client->pers.credit; - client->airOutTime = level.time + 12000; trap_GetUserinfo( index, userinfo, sizeof( userinfo ) ); diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index b0f1bdd1..2bca3a27 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -252,8 +252,6 @@ void ScoreboardMessage( gentity_t *ent ) if( cl->pers.connected == CON_CONNECTING ) ping = -1; - else if( cl->sess.spectatorState == SPECTATOR_FOLLOW ) - ping = cl->pers.ping < 999 ? cl->pers.ping : 999; else ping = cl->ps.ping < 999 ? cl->ps.ping : 999; @@ -283,7 +281,7 @@ void ScoreboardMessage( gentity_t *ent ) } Com_sprintf( entry, sizeof( entry ), - " %d %d %d %d %d %d", level.sortedClients[ i ], cl->pers.score, + " %d %d %d %d %d %d", level.sortedClients[ i ], cl->ps.persistant[ PERS_SCORE ], ping, ( level.time - cl->pers.enterTime ) / 60000, weapon, upgrade ); j = strlen( entry ); @@ -397,22 +395,18 @@ void Cmd_Give_f( gentity_t *ent ) if( give_all || Q_stricmp( name, "ammo" ) == 0 ) { - int maxAmmo, maxClips; gclient_t *client = ent->client; if( client->ps.weapon != WP_ALEVEL3_UPG && BG_Weapon( client->ps.weapon )->infiniteAmmo ) return; - maxAmmo = BG_Weapon( client->ps.weapon )->maxAmmo; - maxClips = BG_Weapon( client->ps.weapon )->maxClips; + client->ps.ammo = BG_Weapon( client->ps.weapon )->maxAmmo; + client->ps.clips = BG_Weapon( client->ps.weapon )->maxClips; if( BG_Weapon( client->ps.weapon )->usesEnergy && BG_InventoryContainsUpgrade( UP_BATTPACK, client->ps.stats ) ) - maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER ); - - client->ps.ammo = maxAmmo; - client->ps.clips = maxClips; + client->ps.ammo = (int)( (float)client->ps.ammo * BATTPACK_MODIFIER ); } } @@ -1648,7 +1642,8 @@ void Cmd_SetViewpos_f( gentity_t *ent ) #define AS_OVER_RT3 ((ALIENSENSE_RANGE*0.5f)/M_ROOT3) -static qboolean G_RoomForClassChange( gentity_t *ent, class_t class, vec3_t newOrigin ) +static qboolean G_RoomForClassChange( gentity_t *ent, class_t class, + vec3_t newOrigin ) { vec3_t fromMins, fromMaxs; vec3_t toMins, toMaxs; @@ -2005,7 +2000,7 @@ void Cmd_Destroy_f( gentity_t *ent ) if( !g_cheats.integer ) { ent->client->ps.stats[ STAT_MISC ] += - BG_Buildable( traceEnt->s.modelindex )->buildTime; + BG_Buildable( traceEnt->s.modelindex )->buildTime / 4; } } } @@ -2122,7 +2117,7 @@ void Cmd_Buy_f( gentity_t *ent ) { char s[ MAX_TOKEN_CHARS ]; weapon_t weapon; - upgrade_t upgrade, maxAmmo, maxClips; + upgrade_t upgrade; qboolean energyOnly; trap_Argv( 1, s, sizeof( s ) ); @@ -2197,15 +2192,12 @@ void Cmd_Buy_f( gentity_t *ent ) return; ent->client->ps.stats[ STAT_WEAPON ] = weapon; - maxAmmo = BG_Weapon( weapon )->maxAmmo; - maxClips = BG_Weapon( weapon )->maxClips; + ent->client->ps.ammo = BG_Weapon( weapon )->maxAmmo; + ent->client->ps.clips = BG_Weapon( weapon )->maxClips; if( BG_Weapon( weapon )->usesEnergy && BG_InventoryContainsUpgrade( UP_BATTPACK, ent->client->ps.stats ) ) - maxAmmo *= BATTPACK_MODIFIER; - - ent->client->ps.ammo = maxAmmo; - ent->client->ps.clips = maxClips; + ent->client->ps.ammo *= BATTPACK_MODIFIER; G_ForceWeaponChange( ent, weapon ); @@ -2634,8 +2626,6 @@ to free floating spectator mode */ void G_StopFollowing( gentity_t *ent ) { - ent->client->sess.spectatorState = - ent->client->ps.persistant[ PERS_SPECSTATE ] = SPECTATOR_FREE; ent->client->ps.stats[ STAT_TEAM ] = ent->client->pers.teamSelection; if( ent->client->pers.teamSelection == TEAM_NONE ) @@ -2747,7 +2737,7 @@ qboolean G_FollowNewClient( gentity_t *ent, int dir ) clientnum = level.maxclients - 1; // can't follow self - if( level.clients[ clientnum ].pers.connected != CON_CONNECTED ) + if( &g_entities[ clientnum ] == ent ) continue; // avoid selecting existing follow target @@ -2889,9 +2879,6 @@ void Cmd_PTRCVerify_f( gentity_t *ent ) char s[ MAX_TOKEN_CHARS ] = { 0 }; int code; - if( ent->client->pers.connection ) - return; - trap_Argv( 1, s, sizeof( s ) ); if( !s[ 0 ] ) @@ -2899,16 +2886,16 @@ void Cmd_PTRCVerify_f( gentity_t *ent ) code = atoi( s ); - connection = G_FindConnectionForCode( code ); - if( connection && connection->clientNum == -1 ) + if( G_VerifyPTRC( code ) ) { + connection = G_FindConnectionForCode( code ); + // valid code if( connection->clientTeam != TEAM_NONE ) trap_SendServerCommand( ent->client->ps.clientNum, "ptrcconfirm" ); // restore mapping ent->client->pers.connection = connection; - connection->clientNum = ent->client->ps.clientNum; } else { @@ -2936,13 +2923,6 @@ void Cmd_PTRCRestore_f( gentity_t *ent ) int code; connectionRecord_t *connection; - if( ent->client->pers.joinedATeam ) - { - trap_SendServerCommand( ent - g_entities, - "print \"You cannot use a PTR code after joining a team\n\"" ); - return; - } - trap_Argv( 1, s, sizeof( s ) ); if( !s[ 0 ] ) @@ -2950,15 +2930,28 @@ void Cmd_PTRCRestore_f( gentity_t *ent ) code = atoi( s ); - connection = ent->client->pers.connection; - if( connection && connection->ptrCode == code ) + if( G_VerifyPTRC( code ) ) { - // set the correct team - G_ChangeTeam( ent, connection->clientTeam ); + if( ent->client->pers.joinedATeam ) + { + trap_SendServerCommand( ent - g_entities, + "print \"You cannot use a PTR code after joining a team\n\"" ); + } + else + { + // valid code + connection = G_FindConnectionForCode( code ); - // set the correct credit - ent->client->ps.persistant[ PERS_CREDIT ] = 0; - G_AddCreditToClient( ent->client, connection->clientCredit, qtrue ); + if( connection ) + { + // set the correct team + G_ChangeTeam( ent, connection->clientTeam ); + + // set the correct credit + ent->client->ps.persistant[ PERS_CREDIT ] = 0; + G_AddCreditToClient( ent->client, connection->clientCredit, qtrue ); + } + } } else { @@ -3042,11 +3035,6 @@ Cmd_Test_f */ void Cmd_Test_f( gentity_t *humanPlayer ) { - humanPlayer->client->ps.eFlags |= EF_POISONCLOUDED; - humanPlayer->client->lastPoisonCloudedTime = level.time; - - trap_SendServerCommand( humanPlayer->client->ps.clientNum, - "poisoncloud" ); } /* diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 0e05da98..2e359ab7 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -993,26 +993,14 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, // if the attacker was on the same team if( targ != attacker && OnSameTeam( targ, attacker ) ) { - // if dretchpunt is enabled and this is a dretch, do dretchpunt instead of damage - if( g_dretchPunt.integer && - targ->client->ps.stats[ STAT_CLASS ] == PCL_ALIEN_LEVEL0 ) - { - vec3_t dir, push; - - VectorSubtract( targ->r.currentOrigin, attacker->r.currentOrigin, dir ); - VectorNormalizeFast( dir ); - VectorScale( dir, ( damage * 10.0f ), push ); - push[2] = 64.0f; - VectorAdd( targ->client->ps.velocity, push, targ->client->ps.velocity ); - return; - } // don't do friendly fire on movement attacks - else if( mod == MOD_LEVEL4_TRAMPLE || mod == MOD_LEVEL3_POUNCE || + if( mod == MOD_LEVEL4_TRAMPLE || mod == MOD_LEVEL3_POUNCE || mod == MOD_LEVEL4_CRUSH ) return; + // if dretchpunt is enabled and this is a dretch, do dretchpunt instead of damage if( g_dretchPunt.integer && - targ->client->ps.stats[ STAT_CLASS ] == PCL_ALIEN_LEVEL0 ) + targ->client->ps.stats[ STAT_CLASS ] == PCL_ALIEN_LEVEL0 ) { vec3_t dir, push; @@ -1023,13 +1011,16 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, VectorAdd( targ->client->ps.velocity, push, targ->client->ps.velocity ); return; } - else if( !g_friendlyFire.integer ) + + // check if friendly fire has been disabled + if( !g_friendlyFire.integer ) { if( !g_friendlyFireHumans.integer && targ->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) { return; } + if( !g_friendlyFireAliens.integer && targ->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) { diff --git a/src/game/g_local.h b/src/game/g_local.h index c7b8dcd0..2068e5a6 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -318,11 +318,6 @@ typedef struct int nameChangeTime; int nameChanges; - // used to save playerState_t values while in SPECTATOR_FOLLOW mode - int score; - int credit; - int ping; - // used to save persistant[] values while in SPECTATOR_FOLLOW mode int savedCredit; @@ -1073,8 +1068,10 @@ qboolean G_MapExists( char *name ); // void G_UpdatePTRConnection( gclient_t *client ); connectionRecord_t *G_GenerateNewConnection( gclient_t *client ); +qboolean G_VerifyPTRC( int code ); void G_ResetPTRConnections( void ); connectionRecord_t *G_FindConnectionForCode( int code ); +void G_DeletePTRConnection( connectionRecord_t *connection ); //some maxs diff --git a/src/game/g_main.c b/src/game/g_main.c index 44ffd098..89e47759 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -760,9 +760,9 @@ int QDECL SortRanks( const void *a, const void *b ) cb = &level.clients[ *(int *)b ]; // then sort by score - if( ca->pers.score > cb->pers.score ) + if( ca->ps.persistant[ PERS_SCORE ] > cb->ps.persistant[ PERS_SCORE ] ) return -1; - else if( ca->pers.score < cb->pers.score ) + if( ca->ps.persistant[ PERS_SCORE ] < cb->ps.persistant[ PERS_SCORE ] ) return 1; else return 0; diff --git a/src/game/g_ptr.c b/src/game/g_ptr.c index 21e2636e..869df256 100644 --- a/src/game/g_ptr.c +++ b/src/game/g_ptr.c @@ -63,7 +63,7 @@ void G_UpdatePTRConnection( gclient_t *client ) { client->pers.connection->clientTeam = client->pers.teamSelection; if( client->pers.teamSelection == TEAM_NONE ) - client->pers.connection->clientCredit = client->pers.credit; + client->pers.connection->clientCredit = client->pers.savedCredit; else client->pers.connection->clientCredit = client->ps.persistant[ PERS_CREDIT ]; } @@ -107,6 +107,29 @@ connectionRecord_t *G_GenerateNewConnection( gclient_t *client ) /* =============== +G_VerifyPTRC + +Check a PTR code for validity +=============== +*/ +qboolean G_VerifyPTRC( int code ) +{ + int i; + + if( code == 0 ) + return qfalse; + + for( i = 0; i < MAX_CLIENTS; i++ ) + { + if( connections[ i ].ptrCode == code ) + return qtrue; + } + + return qfalse; +} + +/* +=============== G_FindConnectionForCode Finds a connection for a given code @@ -130,6 +153,19 @@ connectionRecord_t *G_FindConnectionForCode( int code ) /* =============== +G_DeletePTRConnection + +Finds a connection and deletes it +=============== +*/ +void G_DeletePTRConnection( connectionRecord_t *connection ) +{ + if( connection ) + memset( connection, 0, sizeof( connectionRecord_t ) ); +} + +/* +=============== G_ResetPTRConnections Invalidate any existing codes diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c index d74fb147..72523331 100644 --- a/src/game/g_svcmds.c +++ b/src/game/g_svcmds.c @@ -100,6 +100,9 @@ void Svcmd_EntityList_f( void ) case ET_LIGHTFLARE: G_Printf( "ET_LIGHTFLARE " ); break; + case ET_LEV2_ZAP_CHAIN: + G_Printf( "ET_LEV2_ZAP_CHAIN " ); + break; default: G_Printf( "%-3i ", check->s.eType ); break; diff --git a/src/game/g_team.c b/src/game/g_team.c index c3c490e5..856e0f20 100644 --- a/src/game/g_team.c +++ b/src/game/g_team.c @@ -95,7 +95,6 @@ void G_LeaveTeam( gentity_t *self ) G_RemoveFromSpawnQueue( &level.humanSpawnQueue, self->client->ps.clientNum ); else { - // might have been following somone so reset if( self->client->sess.spectatorState == SPECTATOR_FOLLOW ) G_StopFollowing( self ); return; @@ -164,8 +163,6 @@ void G_ChangeTeam( gentity_t *ent, team_t newTeam ) HUMAN_MAX_CREDITS / ALIEN_MAX_CREDITS + 0.5f ); } - ent->client->pers.credit = ent->client->ps.persistant[ PERS_CREDIT ]; - if( newTeam == TEAM_NONE ) { // save values before the client enters the spectator team and their diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index b150d65f..72bd730c 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -53,7 +53,7 @@ void G_ForceWeaponChange( gentity_t *ent, weapon_t weapon ) !BG_InventoryContainsWeapon( weapon, ps->stats ) ) { // switch to the first non blaster weapon - ent->client->ps.persistant[ PERS_NEWWEAPON ] = + ps->persistant[ PERS_NEWWEAPON ] = BG_PrimaryWeapon( ent->client->ps.stats ); } else @@ -931,9 +931,6 @@ qboolean CheckVenomAttack( gentity_t *ent ) if( traceEnt->health <= 0 ) return qfalse; - if( traceEnt->health <= 0 ) - return qfalse; - if( !traceEnt->client && !( traceEnt->s.eType == ET_BUILDABLE ) ) return qfalse; diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h index 5b5daee8..81c53e4f 100644 --- a/src/qcommon/q_shared.h +++ b/src/qcommon/q_shared.h @@ -469,6 +469,10 @@ typedef struct { #define VectorSet(v, x, y, z) ((v)[0]=(x), (v)[1]=(y), (v)[2]=(z)) #define Vector4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3]) #define Vector4Add(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1],(c)[2]=(a)[2]+(b)[2],(c)[3]=(a)[3]+(b)[3]) +#define Vector4Lerp( f, s, e, r ) ((r)[0]=(s)[0]+(f)*((e)[0]-(s)[0]),\ + (r)[1]=(s)[1]+(f)*((e)[1]-(s)[1]),\ + (r)[2]=(s)[2]+(f)*((e)[2]-(s)[2]),\ + (r)[3]=(s)[3]+(f)*((e)[3]-(s)[3])) #define SnapVector(v) ( (v)[0] = (int)(v)[0],\ (v)[1] = (int)(v)[1],\ diff --git a/src/ui/ui_atoms.c b/src/ui/ui_atoms.c index 32df5491..c78df7ff 100644 --- a/src/ui/ui_atoms.c +++ b/src/ui/ui_atoms.c @@ -128,7 +128,6 @@ static void UI_MessageMode_f( void ) char *arg = UI_Argv( 0 ); trap_Cvar_Set( "ui_sayBuffer", "" ); - uiInfo.chatTeam = qfalse; switch( arg[ 11 ] ) { @@ -189,8 +188,8 @@ qboolean UI_ConsoleCommand( int realTime ) if( Q_stricmp( commands[ i ].cmd, cmd ) == 0 ) { commands[ i ].function( ); - } - return qtrue; + return qtrue; + } } return qfalse; diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index d1af8f85..9854bda7 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -1890,7 +1890,8 @@ static void UI_OwnerDraw( float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, int align, int textalign, int textvalign, float special, - float scale, vec4_t color, qhandle_t shader, int textStyle ) + float scale, vec4_t foreColor, vec4_t backColor, + qhandle_t shader, int textStyle ) { rectDef_t rect; @@ -1903,63 +1904,63 @@ static void UI_OwnerDraw( float x, float y, float w, float h, { case UI_TEAMINFOPANE: UI_DrawInfoPane( &uiInfo.teamList[ uiInfo.teamIndex ], - &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); + &rect, text_x, text_y, scale, textalign, textvalign, foreColor, textStyle ); break; case UI_ACLASSINFOPANE: UI_DrawInfoPane( &uiInfo.alienClassList[ uiInfo.alienClassIndex ], - &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); + &rect, text_x, text_y, scale, textalign, textvalign, foreColor, textStyle ); break; case UI_AUPGRADEINFOPANE: UI_DrawInfoPane( &uiInfo.alienUpgradeList[ uiInfo.alienUpgradeIndex ], - &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); + &rect, text_x, text_y, scale, textalign, textvalign, foreColor, textStyle ); break; case UI_HITEMINFOPANE: UI_DrawInfoPane( &uiInfo.humanItemList[ uiInfo.humanItemIndex ], - &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); + &rect, text_x, text_y, scale, textalign, textvalign, foreColor, textStyle ); break; case UI_HBUYINFOPANE: UI_DrawInfoPane( &uiInfo.humanArmouryBuyList[ uiInfo.humanArmouryBuyIndex ], - &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); + &rect, text_x, text_y, scale, textalign, textvalign, foreColor, textStyle ); break; case UI_HSELLINFOPANE: UI_DrawInfoPane( &uiInfo.humanArmourySellList[ uiInfo.humanArmourySellIndex ], - &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); + &rect, text_x, text_y, scale, textalign, textvalign, foreColor, textStyle ); break; case UI_ABUILDINFOPANE: UI_DrawInfoPane( &uiInfo.alienBuildList[ uiInfo.alienBuildIndex ], - &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); + &rect, text_x, text_y, scale, textalign, textvalign, foreColor, textStyle ); break; case UI_HBUILDINFOPANE: UI_DrawInfoPane( &uiInfo.humanBuildList[ uiInfo.humanBuildIndex ], - &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); + &rect, text_x, text_y, scale, textalign, textvalign, foreColor, textStyle ); break; case UI_HELPINFOPANE: UI_DrawInfoPane( &uiInfo.helpList[ uiInfo.helpIndex ], - &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); + &rect, text_x, text_y, scale, textalign, textvalign, foreColor, textStyle ); break; case UI_NETMAPPREVIEW: - UI_DrawServerMapPreview( &rect, scale, color ); + UI_DrawServerMapPreview( &rect, scale, foreColor ); break; case UI_SELECTEDMAPPREVIEW: - UI_DrawSelectedMapPreview( &rect, scale, color ); + UI_DrawSelectedMapPreview( &rect, scale, foreColor ); break; case UI_SELECTEDMAPNAME: - UI_DrawSelectedMapName( &rect, scale, color, textStyle ); + UI_DrawSelectedMapName( &rect, scale, foreColor, textStyle ); break; case UI_GLINFO: - UI_DrawGLInfo( &rect, scale, textalign, textvalign, color, textStyle, text_x, text_y ); + UI_DrawGLInfo( &rect, scale, textalign, textvalign, foreColor, textStyle, text_x, text_y ); break; default: diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index 315f6135..de433a85 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -5163,9 +5163,7 @@ static bind_t g_bindings[] = { "scoresUp", K_KP_PGUP, -1, -1, -1 }, { "scoresDown", K_KP_PGDN, -1, -1, -1 }, { "messagemode", -1, -1, -1, -1 }, - { "messagemode2", -1, -1, -1, -1 }, - { "messagemode3", -1, -1, -1, -1 }, - { "messagemode4", -1, -1, -1, -1 }, + { "messagemode2", -1, -1, -1, -1 } }; @@ -5979,7 +5977,7 @@ void Item_OwnerDraw_Paint( itemDef_t *item ) item->textalignx, item->textaligny, item->window.ownerDraw, item->window.ownerDrawFlags, item->alignment, item->textalignment, item->textvalignment, - item->special, item->textscale, color, + item->special, item->textscale, color, item->window.backColor, item->window.background, item->textStyle ); } } diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h index c42dd241..3a8ee74f 100644 --- a/src/ui/ui_shared.h +++ b/src/ui/ui_shared.h @@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "../renderer/tr_types.h" #include "../client/keycodes.h" -#include "../../ui/menudef.h" +#include "../../assets/ui/menudef.h" #define MAX_MENUNAME 32 #define MAX_ITEMTEXT 64 @@ -379,7 +379,11 @@ typedef struct void ( *addRefEntityToScene ) ( const refEntity_t *re ); void ( *renderScene ) ( const refdef_t *fd ); void ( *registerFont ) ( const char *pFontname, int pointSize, fontInfo_t *font ); - void ( *ownerDrawItem ) ( float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, int align, int textalign, int textvalign, float special, float scale, vec4_t color, qhandle_t shader, int textStyle ); + void ( *ownerDrawItem ) ( float x, float y, float w, float h, float text_x, + float text_y, int ownerDraw, int ownerDrawFlags, + int align, int textalign, int textvalign, + float special, float scale, vec4_t foreColor, + vec4_t backColor, qhandle_t shader, int textStyle ); float ( *getValue ) ( int ownerDraw ); qboolean ( *ownerDrawVisible ) ( int flags ); void ( *runScript )( char **p ); |