Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mtiusane/new-edge
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikko Tiusanen committed Apr 17, 2015
2 parents e8ac213 + 73e6ff9 commit 3cd2cea
Show file tree
Hide file tree
Showing 28 changed files with 919 additions and 1,325 deletions.
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -1725,6 +1725,7 @@ GOBJ_ = \
$(B)/base/game/g_weapon.o \
$(B)/base/game/g_admin.o \
$(B)/base/game/g_namelog.o \
$(B)/base/game/g_buildpoints.o \
\
$(B)/base/qcommon/q_math.o \
$(B)/base/qcommon/q_shared.o
Expand Down
Binary file added assets/models/weapons/rocketl/prime.wav
Binary file not shown.
36 changes: 36 additions & 0 deletions assets/ui/assets/alien/buildstat.cfg
@@ -0,0 +1,36 @@
// config for the building status indicators that builders see
// NOTES:
// * all characters (text/icons) are square
// * character size is derived totally from frameHeight and vertialMargin
// * healthPadding is NOT used compensated for in the margins

frameShader "ui/assets/alien/buildstat/frame"
frameWidth 150
frameHeight 30

healthPadding 2
healthSevereColor 0.24 0.02 0.02 1
healthHighColor 0.32 0.04 0.04 1
healthElevatedColor 0.40 0.06 0.06 1
healthGuardedColor 0.48 0.08 0.08 1
healthLowColor 0.56 0.10 0.10 1

// this gets drawn over frame and health, but numbers and icons go on top of it
overlayShader "ui/assets/alien/buildstat/overlay"
overlayWidth 156
overlayHeight 36

// PERCENT of frameHeight to use for top/bottom margin of icons/text
// value is for total of top and bottom margins
// valid values between 0.0 and 1.0
verticalMargin 0.5

// number of CHARS worth of space that should be used for left/right margins
// value is for one side only
// char width is determined by frameHeight and verticalMargin
horizontalMargin 1.0

noPowerShader "ui/assets/alien/buildstat/nopower"

backColor 1.0 1.0 1.0 1
foreColor 0.0 0.0 0.0 1
38 changes: 38 additions & 0 deletions assets/ui/assets/human/buildstat.cfg
@@ -0,0 +1,38 @@
// config for the building status indicators that builders see
// NOTES:
// * all characters (text/icons) are square
// * character size is derived totally from frameHeight and vertialMargin
// * healthPadding is NOT used compensated for in the margins

frameShader "ui/assets/human/buildstat/frame"
frameWidth 150
frameHeight 30

healthPadding 2

// Homeworld Security Advisory System
healthSevereColor 0.83 0.03 0.02 1
healthHighColor 0.84 0.48 0.03 1
healthElevatedColor 0.82 0.82 0.00 1
healthGuardedColor 0.19 0.65 0.00 1
healthLowColor 0.27 0.49 0.55 1

// this gets drawn over frame and health, but numbers and icons go on top of it
overlayShader ""
overlayWidth 160
overlayHeight 40

// PERCENT of frameHeight to use for top/bottom margin of icons/text
// value is for total of top and bottom margins
// valid values between 0.0 and 1.0
verticalMargin 0.5

// number of CHARS worth of space that should be used for left/right margins
// value is for one side only
// char width is determined by frameHeight and verticalMargin
horizontalMargin 1.0

noPowerShader "ui/assets/human/buildstat/nopower"

backColor 1.0 1.0 1.0 1
foreColor 0.0 0.0 0.0 1
17 changes: 1 addition & 16 deletions src/cgame/cg_buildable.c
Expand Up @@ -803,12 +803,6 @@ void CG_BuildableStatusParse( const char *filename, buildStat_t *bs )
bs->noPowerShader = trap_R_RegisterShader( s );
continue;
}
else if( !Q_stricmp( token.string, "markedShader" ) )
{
if( PC_String_Parse( handle, &s ) )
bs->markedShader = trap_R_RegisterShader( s );
continue;
}
else if( !Q_stricmp( token.string, "healthSevereColor" ) )
{
if( PC_Color_Parse( handle, &c ) )
Expand Down Expand Up @@ -922,7 +916,7 @@ static void CG_BuildableStatusDisplay( centity_t *cent )
int health;
float x, y;
vec4_t color;
qboolean powered, marked;
qboolean powered;
trace_t tr;
float d;
buildStat_t *bs;
Expand Down Expand Up @@ -1080,7 +1074,6 @@ static void CG_BuildableStatusDisplay( centity_t *cent )
scale = ( picH / d ) * 3;

powered = es->eFlags & EF_B_POWERED;
marked = es->eFlags & EF_B_MARKED;

picH *= scale;
picW *= scale;
Expand Down Expand Up @@ -1161,14 +1154,6 @@ static void CG_BuildableStatusDisplay( centity_t *cent )
CG_DrawPic( pX, subY, subH, subH, bs->noPowerShader );
}

if( marked )
{
float mX;

mX = picX + picW - ( subH * bs->horizontalMargin ) - subH;
CG_DrawPic( mX, subY, subH, subH, bs->markedShader );
}

{
float nX;
int healthMax;
Expand Down
73 changes: 71 additions & 2 deletions src/cgame/cg_draw.c
Expand Up @@ -375,10 +375,34 @@ 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)STAMINA_MAX / 3.0f;
float progress;
vec4_t color;

progress = 0.0f;
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 + STAMINA_MAX ) / STAMINA_MAX;
break;
default:
return;
}

if( progress > 1.0f )
progress = 1.0f;
else if( progress < 0.0f )
progress = 0.0f;

Vector4Lerp( progress, backColor, foreColor, color );

Expand All @@ -395,9 +419,25 @@ CG_DrawPlayerStaminaBolt
static void CG_DrawPlayerStaminaBolt( rectDef_t *rect, vec4_t backColor,
vec4_t foreColor, qhandle_t shader )
{
float stamina = cg.snap->ps.stats[ STAT_STAMINA ];
vec4_t color;

Vector4Copy( backColor, color );
if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_SPEEDBOOST )
{
if( stamina >= 0 )
Vector4Lerp( ( sin( cg.time / 150.0f ) + 1 ) / 2,
backColor, foreColor, color );
else
Vector4Lerp( ( sin( cg.time / 2000.0f ) + 1 ) / 2,
backColor, foreColor, color );
}
else
{
if( stamina < 0 )
Vector4Copy( backColor, color );
else
Vector4Copy( foreColor, color );
}

trap_R_SetColor( color );
CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
Expand Down Expand Up @@ -3420,6 +3460,31 @@ void CG_RunMenuScript( char **args )
}
//END TA UI


/*
================
CG_DrawLighting
================
*/
static void CG_DrawLighting( void )
{
// centity_t *cent;

// cent = &cg_entities[ cg.snap->ps.clientNum ];

//fade to black if stamina is low
if( ( cg.snap->ps.stats[ STAT_STAMINA ] < STAMINA_BLACKOUT_LEVEL ) &&
( cg.snap->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) )
{
vec4_t black = { 0, 0, 0, 0 };
black[ 3 ] = 1.0 - ( (float)( cg.snap->ps.stats[ STAT_STAMINA ] + 1000 ) / 200.0f );
trap_R_SetColor( black );
CG_DrawPic( 0, 0, 640, 480, cgs.media.whiteShader );
trap_R_SetColor( NULL );
}
}

/*
===============================================================================
Expand Down Expand Up @@ -4097,6 +4162,10 @@ static void CG_Draw2D( void )
if( cg.levelShot )
return;

// fading to black if stamina runs out
// (only 2D that can't be disabled)
CG_DrawLighting( );

if( cg_draw2D.integer == 0 )
return;

Expand Down
4 changes: 4 additions & 0 deletions src/cgame/cg_event.c
Expand Up @@ -993,6 +993,10 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.acidBombBounceSound2 );
break;

case EV_ROCKETL_PRIME:
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.rocketlPrimeSound );
break;

//
// missile impacts
//
Expand Down
4 changes: 2 additions & 2 deletions src/cgame/cg_local.h
Expand Up @@ -1351,14 +1351,15 @@ typedef struct
qhandle_t lightningImpactPS;

sfxHandle_t hitSounds[ 5 ];

sfxHandle_t rocketlPrimeSound;
} cgMedia_t;

typedef struct
{
qhandle_t frameShader;
qhandle_t overlayShader;
qhandle_t noPowerShader;
qhandle_t markedShader;
vec4_t healthSevereColor;
vec4_t healthHighColor;
vec4_t healthElevatedColor;
Expand Down Expand Up @@ -1398,7 +1399,6 @@ typedef struct
int timelimit;
int maxclients;
char mapname[ MAX_QPATH ];
qboolean markDeconstruct; // Whether or not buildables are marked

int voteTime[ NUM_TEAMS ];
int voteYes[ NUM_TEAMS ];
Expand Down
2 changes: 2 additions & 0 deletions src/cgame/cg_main.c
Expand Up @@ -765,6 +765,8 @@ static void CG_RegisterSounds( void )

for( i = 0; i < 5; i++ )
cgs.media.hitSounds[ i ] = trap_S_RegisterSound( hit_sounds[ i ], qfalse );

cgs.media.rocketlPrimeSound = trap_S_RegisterSound( "models/weapons/rocketl/prime.wav", qfalse );
}


Expand Down
17 changes: 17 additions & 0 deletions src/cgame/cg_predict.c
Expand Up @@ -620,6 +620,23 @@ void CG_PredictPlayerState( void )

cg_pmove.noFootsteps = 0;

/* for( i = 0; i < cg.snap->numEntities; i++ )
{
cent = &cg_entities[ cg.snap->entities[ i ].number ];
es = &cent->currentState;*/

for( cg_pmove.numForceFields = 0, i = 0; i < cg.snap->numEntities; i++ )
{
centity_t *cent = cg_entities + cg.snap->entities[ i ].number;

if( BG_ForceFieldForEntity( &cg.predictedPlayerState, &cent->currentState,
cg_pmove.forceFields + cg_pmove.numForceFields ) )
cg_pmove.numForceFields++;

if( cg_pmove.numForceFields == MAX_FORCE_FIELDS )
break;
}

// save the state before the pmove so we can detect transitions
oldPlayerState = cg.predictedPlayerState;

Expand Down
9 changes: 2 additions & 7 deletions src/cgame/cg_servercmds.c
Expand Up @@ -119,7 +119,6 @@ void CG_ParseServerinfo( void )
info = CG_ConfigString( CS_SERVERINFO );
cgs.timelimit = atoi( Info_ValueForKey( info, "timelimit" ) );
cgs.maxclients = atoi( Info_ValueForKey( info, "sv_maxclients" ) );
cgs.markDeconstruct = atoi( Info_ValueForKey( info, "g_markDeconstruct" ) );
mapname = Info_ValueForKey( info, "mapname" );
Com_sprintf( cgs.mapname, sizeof( cgs.mapname ), "maps/%s.bsp", mapname );
}
Expand Down Expand Up @@ -692,12 +691,8 @@ void CG_Menu( int menu, int arg )
//===============================

case MN_H_NOBP:
if( cgs.markDeconstruct )
longMsg = "^5There is no power remaining. Free up power by marking "
"existing buildable objects.";
else
longMsg = "There is no power remaining. Free up power by deconstructing "
"existing buildable objects.";
longMsg = "There is no power remaining. Free up power by deconstructing "
"existing buildable objects.";
shortMsg = "^5There is no power remaining";
type = DT_BUILD;
break;
Expand Down

0 comments on commit 3cd2cea

Please sign in to comment.