summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_draw.c32
-rw-r--r--src/cgame/cg_event.c12
-rw-r--r--src/game/bg_public.h4
-rw-r--r--src/game/g_buildable.c46
-rw-r--r--src/game/g_cmds.c8
-rw-r--r--src/game/g_main.c13
6 files changed, 82 insertions, 33 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 534aa705..02e77449 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -533,6 +533,38 @@ static void CG_DrawStatusBar( void ) {
}
//
+ // power
+ //
+ #define PWR_HEIGHT 10
+ #define PWR_WIDTH 80
+ #define PWR_X 555
+ #define PWR_Y 20
+ if( ps->stats[ STAT_PTEAM ] == PTE_HUMANS )
+ {
+ int total = cgs.hBuildPointsTotal;
+ int allocated = total - cgs.hBuildPoints;
+ int powered = total - cgs.hBuildPointsPowered;
+
+ int awidth = (int)( (float)allocated / ( total / PWR_WIDTH ) );
+ int pwidth = (int)( (float)powered / ( total / PWR_WIDTH ) );
+ vec4_t bcolor = { 0.5, 0.5, 0.5, 0.5 };
+
+ //Com_Printf( "%d %d %d\n", allocated, powered, total );
+
+ trap_R_SetColor( bcolor ); // white
+ CG_DrawPic( PWR_X, PWR_Y, PWR_WIDTH, PWR_HEIGHT, cgs.media.whiteShader );
+
+ trap_R_SetColor( colors[0] ); // green
+ CG_DrawPic( PWR_X, PWR_Y, awidth, PWR_HEIGHT, cgs.media.whiteShader );
+
+ if( allocated > powered )
+ {
+ trap_R_SetColor( colors[1] ); // red
+ CG_DrawPic( PWR_X + pwidth, PWR_Y, awidth - pwidth, PWR_HEIGHT, cgs.media.whiteShader );
+ }
+ }
+
+ //
// health+armor
//
if( ps->stats[ STAT_PTEAM ] == PTE_DROIDS )
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 9d0c9052..1826e1ba 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -450,10 +450,18 @@ void CG_Menu( int eventParm )
trap_SendConsoleCommand( "menu hmcumenu\n" );
break;
- case MN_NOROOM:
+ case MN_HNOROOM:
trap_SendConsoleCommand( "menu hnoroom\n" );
break;
+ case MN_HNOPOWER:
+ trap_SendConsoleCommand( "menu hnopower\n" );
+ break;
+
+ case MN_DNOROOM:
+ trap_SendConsoleCommand( "menu dnoroom\n" );
+ break;
+
case MN_NOCREEP:
trap_SendConsoleCommand( "menu dnocreep\n" );
break;
@@ -467,7 +475,7 @@ void CG_Menu( int eventParm )
break;
case MN_INFEST:
- strcpy( menuDef, "5,5|Infest|0.8,0,0.8,1|0.6,0,0.6,0.8|1,0,1,1|1|16|" );
+ strcpy( menuDef, "5,5|Infest|0.976,0.957,0.0,1.0|0.933,0.612,0.0,1.0|0.976,0.957,0.0,1.0|1|16|" );
for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
{
if( BG_ClassCanEvolveFromTo( cg.snap->ps.stats[ STAT_PCLASS ], i ) )
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index d67d5a90..70652f23 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -522,7 +522,9 @@ typedef enum
MN_HBUILD,
MN_MCU,
MN_INFEST,
- MN_NOROOM,
+ MN_DNOROOM,
+ MN_HNOROOM,
+ MN_HNOPOWER,
MN_NOCREEP,
MN_REACTOR,
MN_MCUPOWER
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 286b792a..b8ddc67c 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -24,6 +24,7 @@
#include "g_local.h"
+#define REFRESH_TIME 2000
/*
================
@@ -41,6 +42,9 @@ qboolean findPower( gentity_t *self )
int minDistance = 10000;
vec3_t temp_v;
+ //reset parent
+ self->parentNode = NULL;
+
for ( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ )
{
if( !Q_stricmp( ent->classname, "team_human_reactor" ) ||
@@ -60,29 +64,27 @@ qboolean findPower( gentity_t *self )
!Q_stricmp( closestPower->classname, "team_human_reactor" ) &&
( minDistance <= REACTOR_BASESIZE )
)
- ||
+ ||
(
!Q_stricmp( closestPower->classname, "team_human_repeater" ) &&
+ !Q_stricmp( self->classname, "team_human_spawn" ) &&
( minDistance <= REPEATER_BASESIZE ) &&
- closestPower->active
+ closestPower->powered
)
- ||
+ ||
(
!Q_stricmp( closestPower->classname, "team_human_repeater" ) &&
- !Q_stricmp( self->classname, "team_human_spawn" ) &&
- ( minDistance <= REPEATER_BASESIZE )
+ ( minDistance <= REPEATER_BASESIZE ) &&
+ closestPower->active &&
+ closestPower->powered
)
)
{
- self->powered = qtrue;
self->parentNode = closestPower;
return qtrue;
}
else
- {
- self->powered = qfalse;
return qfalse;
- }
}
/*
@@ -280,16 +282,19 @@ void HRpt_Think( gentity_t *self )
{
if( !Q_stricmp( ent->classname, "team_human_spawn" ) && ent->parentNode == self )
count++;
+
if( !Q_stricmp( ent->classname, "team_human_reactor" ) )
reactor = qtrue;
}
if( count && reactor )
- self->active = self->powered = qtrue;
+ self->active = qtrue;
else
- self->active = self->powered = qfalse;
+ self->active = qfalse;
- self->nextthink = level.time + 10000;
+ self->powered = reactor;
+
+ self->nextthink = level.time + REFRESH_TIME;
}
/*
@@ -318,14 +323,13 @@ Think for mcu
*/
void HMCU_Think( gentity_t *self )
{
- self->nextthink = level.time + 1000;
+ self->nextthink = level.time + REFRESH_TIME;
if( ( self->parentNode == NULL ) ||
!self->parentNode->inuse ||
!self->parentNode->active )
{
- if( !findPower( self ) )
- self->nextthink = level.time + 10000;
+ self->powered = !findPower( self );
}
}
@@ -490,9 +494,10 @@ void HDef1_Think( gentity_t *self )
!self->parentNode->inuse ||
!self->parentNode->active )
{
- if( !findPower( self ) )
+ self->powered = findPower( self );
+ if( !self->powered )
{
- self->nextthink = level.time + 10000;
+ self->nextthink = level.time + REFRESH_TIME;
return;
}
}
@@ -559,14 +564,13 @@ Think for human spawn
*/
void HSpawn_Think( gentity_t *self )
{
- self->nextthink = level.time + 1000;
-
+ self->nextthink = level.time + REFRESH_TIME;
+
if( ( self->parentNode == NULL ) ||
!self->parentNode->inuse ||
!self->parentNode->active )
{
- if( !findPower( self ) )
- self->nextthink = level.time + 10000;
+ self->powered = findPower( self );
}
}
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 7735ee12..228a0af1 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1929,7 +1929,7 @@ void Cmd_Build_f( gentity_t *ent )
break;
case IBE_NOROOM:
- G_AddPredictableEvent( ent, EV_MENU, MN_NOROOM );
+ G_AddPredictableEvent( ent, EV_MENU, MN_DNOROOM );
break;
}
}
@@ -1955,7 +1955,11 @@ void Cmd_Build_f( gentity_t *ent )
break;
case IBE_NOROOM:
- G_AddPredictableEvent( ent, EV_MENU, MN_NOROOM );
+ G_AddPredictableEvent( ent, EV_MENU, MN_HNOROOM );
+ break;
+
+ case IBE_NOPOWER:
+ G_AddPredictableEvent( ent, EV_MENU, MN_HNOPOWER );
break;
}
}
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 4da1a4b1..897a1c89 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -818,6 +818,12 @@ void calculateBuildPoints( void )
}
}
}
+
+ trap_SetConfigstring( CS_DBPOINTS, va("%i", level.droidBuildPoints ) );
+ trap_SetConfigstring( CS_DTBPOINTS, va("%i", level.droidBuildPointsTotal ) );
+ trap_SetConfigstring( CS_HBPOINTS, va("%i", level.humanBuildPoints ) );
+ trap_SetConfigstring( CS_HTBPOINTS, va("%i", level.humanBuildPointsTotal ) );
+ trap_SetConfigstring( CS_HPBPOINTS, va("%i", level.humanBuildPointsPowered ) );
}
@@ -938,12 +944,6 @@ void CalculateRanks( void ) {
}
}
- trap_SetConfigstring( CS_DBPOINTS, va("%i", level.droidBuildPoints ) );
- trap_SetConfigstring( CS_DTBPOINTS, va("%i", level.droidBuildPointsTotal ) );
- trap_SetConfigstring( CS_HBPOINTS, va("%i", level.humanBuildPoints ) );
- trap_SetConfigstring( CS_HTBPOINTS, va("%i", level.humanBuildPointsTotal ) );
- trap_SetConfigstring( CS_HPBPOINTS, va("%i", level.humanBuildPointsPowered ) );
-
// set the CS_SCORES1/2 configstrings, which will be visible to everyone
if ( g_gametype.integer >= GT_TEAM ) {
trap_SetConfigstring( CS_SCORES1, va("%i", level.teamScores[TEAM_HUMANS] ) );
@@ -1904,7 +1904,6 @@ end = trap_Milliseconds();
//TA:
countSpawns();
calculateBuildPoints();
- Com_Printf( "%d %d %d\n", level.humanBuildPointsTotal, level.humanBuildPoints, level.humanBuildPointsPowered );
// see if it is time to end the level
CheckExitRules();