Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert TeamStatus system. Fix #118 #121

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion assets/ui/menudef.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ enum
CG_LAGOMETER,
CG_SPEEDOMETER,
CG_PLAYER_CROSSHAIRNAMES,
CG_TEAM_STATUS,
CG_STAGE_REPORT_TEXT,
CG_ALIENS_SCORE_LABEL,
CG_HUMANS_SCORE_LABEL,
Expand Down
17 changes: 0 additions & 17 deletions assets/ui/teamscore.menu
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,6 @@
focusColor .75 .75 .75 1 // Avoid focus
style WINDOW_STYLE_EMPTY


// TEAM STATUS //

itemDef
{
name teamStatus
textalign ALIGN_CENTER
textvalign VALIGN_CENTER
textscale 0.38
rect 0 (-BAR_H - SPACE) W BAR_H
forecolor 1 1 1 1
decoration
visible MENU_TRUE
textstyle ITEM_TEXTSTYLE_SHADOWED
ownerdraw CG_TEAM_STATUS
}

// TEAM NAME //

itemDef
Expand Down
65 changes: 0 additions & 65 deletions src/cgame/cg_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1495,68 +1495,6 @@ static void CG_DrawTeamLabel( rectDef_t *rect, team_t team, float text_x, float
UI_Text_Paint( text_x + tx, text_y + ty, scale, color, s, 0, 0, textStyle );
}

/*
==================
CG_DrawTeamStatus
==================
*/
static void CG_DrawTeamStatus( rectDef_t *rect, float text_x, float text_y,
vec4_t color, float scale, int textalign, int textvalign, int textStyle )
{
char s[ MAX_TOKEN_CHARS ];
float tx, ty;

if( cg.intermissionStarted )
return;

if( cg.snap->ps.stats[ STAT_TEAM ] == TEAM_NONE )
return;

if( cg.snap->ps.stats[ STAT_TEAM ] == TEAM_ALIENS )
{
alienStates_t *alienStates = &cgs.alienStates;
int fullHealth = BG_Buildable(BA_A_OVERMIND)->health;
Com_sprintf( s, MAX_TOKEN_CHARS, "^7%s[overmind](%s%i/%i^7) [egg](%s%i^7) [granger](%s%i^7) [booster](%s%i^7)",
alienStates->omBuilding ? "[upgrade]" : (alienStates->omHealth ? "" : "[!]"),
((alienStates->omHealth > fullHealth / 2) ? "^2" : ((alienStates->omHealth > fullHealth / 4) ? "^3" : "^1" )),
alienStates->omHealth,
fullHealth,
!alienStates->spawns ? "^1" : "^2",
alienStates->spawns,
!alienStates->builders ? ((!alienStates->spawns || !alienStates->omHealth) ? "^1" : "^0") : "^2",
alienStates->builders,
!alienStates->boosters ? (BG_BuildableAllowedInStage(BA_A_BOOSTER, cgs.alienStage) ? "^1" : "^0") : "^2",
alienStates->boosters
);
}
else if( cg.snap->ps.stats[ STAT_TEAM ] == TEAM_HUMANS )
{
humanStates_t *humanStates = &cgs.humanStates;
int fullHealth = BG_Buildable(BA_H_REACTOR)->health;
Com_sprintf( s, MAX_TOKEN_CHARS, "^7%s[reactor](%s%i/%i^7) [telenode](%s%i^7) [ckit](%s%i^7) [armoury](%s%i^7) [medstat](%s%i^7) [defcomp](%s%i^7)",
(humanStates->rcBuilding ? "[upgrade]" : (humanStates->rcHealth ? "" : "[!]")),
((humanStates->rcHealth > fullHealth / 2) ? "^2" : ((humanStates->rcHealth > fullHealth / 4) ? "^3" : "^1" )),
humanStates->rcHealth,
fullHealth,
!humanStates->spawns ? "^1" : "^2",
humanStates->spawns,
!humanStates->builders ? ((!humanStates->spawns || !humanStates->rcHealth) ? "^1" : "^0") : "^2",
humanStates->builders,
!humanStates->armourys ? "^1" : "^2",
humanStates->armourys,
!humanStates->medicals ? "^1" : "^2",
humanStates->medicals,
!humanStates->computers ? (BG_BuildableAllowedInStage(BA_H_DCC, cgs.humanStage) ? "^1" : "^0") : "^2",
humanStates->computers
);
}

CG_AlignText( rect, s, scale, 0.0f, 0.0f, textalign, textvalign, &tx, &ty );

UI_Text_Paint( text_x + tx, text_y + ty, scale, color, s, 0, 0, textStyle );
}


/*
==================
CG_DrawStageReport
Expand Down Expand Up @@ -3033,9 +2971,6 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x,
case CG_PLAYER_CROSSHAIR:
CG_DrawCrosshair( &rect, foreColor );
break;
case CG_TEAM_STATUS:
CG_DrawTeamStatus( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle );
break;
case CG_STAGE_REPORT_TEXT:
CG_DrawStageReport( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle );
break;
Expand Down
3 changes: 0 additions & 3 deletions src/cgame/cg_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1392,9 +1392,6 @@ typedef struct
int alienNextStageThreshold;
int humanNextStageThreshold;

alienStates_t alienStates;
humanStates_t humanStates;

//
// locally derived information from gamestate
//
Expand Down
8 changes: 0 additions & 8 deletions src/cgame/cg_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,6 @@ static void CG_SetUIVars( void )
char carriageCvar[ MAX_TOKEN_CHARS ];
int credit;
playerState_t *ps;
alienStates_t *alienStates = &cgs.alienStates;
humanStates_t *humanStates = &cgs.humanStates;

if( !cg.snap )
return;
Expand Down Expand Up @@ -496,12 +494,6 @@ static void CG_SetUIVars( void )
trap_Cvar_Set( "ui_ammoFull", va( "%d", !CG_DoNeedAmmo(ps)));

trap_Cvar_Set( "ui_stages", va( "%d %d", cgs.alienStage, cgs.humanStage ) );

trap_Cvar_Set( "ui_alienStates", va( "%d %d %d %d %d", alienStates->omBuilding, alienStates->omHealth,
alienStates->spawns, alienStates->builders, alienStates->boosters ) );

trap_Cvar_Set( "ui_humanStates", va( "%d %d %d %d %d %d %d", humanStates->rcBuilding, humanStates->rcHealth,
humanStates->spawns, humanStates->builders, humanStates->armourys, humanStates->medicals, humanStates->computers ) );
}

/*
Expand Down
45 changes: 0 additions & 45 deletions src/cgame/cg_servercmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,44 +146,6 @@ static void CG_ParseWarmup( void )
cg.warmupTime = warmup;
}

/*
==================
CG_ParseAlienStates
==================
*/
static void CG_ParseAlienStates( void )
{
const char *alienStates = CG_ConfigString( CS_ALIEN_STATUS );
alienStates_t *state = &cgs.alienStates;

if( alienStates[0] )
{
sscanf( alienStates, "%d %d %d %d %d", &state->omBuilding, &state->omHealth,
&state->spawns, &state->builders, &state->boosters );
}
else
state->omBuilding = state->omHealth = state->spawns = state->builders = state->boosters = 0;
}

/*
==================
CG_ParseAliensStates
==================
*/
static void CG_ParseHumanStates( void )
{
const char *humanStates = CG_ConfigString( CS_HUMAN_STATUS );
humanStates_t *state = &cgs.humanStates;

if( humanStates[0] )
{
sscanf( humanStates, "%d %d %d %d %d %d %d", &state->rcBuilding, &state->rcHealth,
&state->spawns, &state->builders, &state->armourys, &state->medicals, &state->computers );
}
else
state->rcBuilding = state->rcHealth = state->spawns = state->builders = state->armourys = state->medicals = 0;
}

/*
================
CG_SetConfigValues
Expand Down Expand Up @@ -213,9 +175,6 @@ void CG_SetConfigValues( void )
else
cgs.humanStage = cgs.humanCredits = cgs.humanNextStageThreshold = 0;

CG_ParseAlienStates();
CG_ParseHumanStates();

cgs.levelStartTime = atoi( CG_ConfigString( CS_LEVEL_START_TIME ) );
cg.warmupTime = atoi( CG_ConfigString( CS_WARMUP ) );
}
Expand Down Expand Up @@ -360,10 +319,6 @@ static void CG_ConfigStringModified( void )
cgs.humanStage = cgs.humanCredits = cgs.humanNextStageThreshold = 0;
}
}
else if( num == CS_ALIEN_STATUS )
CG_ParseAlienStates( );
else if( num == CS_HUMAN_STATUS )
CG_ParseHumanStates( );
else if( num == CS_LEVEL_START_TIME )
cgs.levelStartTime = atoi( str );
else if( num >= CS_VOTE_TIME && num < CS_VOTE_TIME + NUM_TEAMS )
Expand Down
23 changes: 0 additions & 23 deletions src/game/bg_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ enum

CS_ALIEN_STAGES,
CS_HUMAN_STAGES,
CS_ALIEN_STATUS,
CS_HUMAN_STATUS,

CS_MODELS,
CS_SOUNDS = CS_MODELS + MAX_MODELS,
Expand Down Expand Up @@ -1108,27 +1106,6 @@ typedef struct
team_t team;
} upgradeAttributes_t;

// Teams status provided by the server, also a remplacement for /teamstatus
typedef struct
{
int omBuilding;
int omHealth;
int spawns;
int builders;
int boosters;
} alienStates_t;

typedef struct
{
int rcBuilding;
int rcHealth;
int spawns;
int builders;
int armourys;
int medicals;
int computers;
} humanStates_t;

qboolean BG_WeaponIsFull( weapon_t weapon, int stats[ ], int ammo, int clips );
qboolean BG_InventoryContainsWeapon( int weapon, int stats[ ] );
void BG_GetConflictingWithInventory( int refSlots, int stats[ ], int conflictingWP[WP_NUM_WEAPONS - 1],
Expand Down
85 changes: 0 additions & 85 deletions src/game/g_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1396,90 +1396,6 @@ void G_CalculateStages( void )
humanNextStageThreshold ) );
}

/*
============
G_CalculateStates
============
*/
void G_CalculateStates( void )
{
int i;
int abuilders = 0;
int hbuilders = 0;
int arm = 0, medi = 0, dcc = 0, boost = 0;
int om = 0, rc = 0;
qboolean ombuild = qfalse, rcbuild = qfalse;
gentity_t *ent;

// Objects counter
for ( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ )
{
if( !ent->inuse || ent->s.eType != ET_BUILDABLE || ent->health <= 0 )
continue;

switch (ent->s.modelindex) {

case BA_A_OVERMIND:
om = ent->health;
ombuild = !ent->spawned;
break;

case BA_H_REACTOR:
rc = ent->health;
rcbuild = !ent->spawned;
break;

case BA_A_BOOSTER:
boost++;
break;

case BA_H_MEDISTAT:
medi++;
break;

case BA_H_ARMOURY:
arm++;
break;

case BA_H_DCC:
dcc++;
break;

}
}

// Builder counter
for( i = 0; i < level.maxclients; i++ )
{
ent = &g_entities[ i ];
if( !ent->client || ent->client->pers.connected != CON_CONNECTED
|| ent->client->pers.teamSelection == TEAM_NONE || ent->client->sess.spectatorState == SPECTATOR_FOLLOW )
continue;

if( ent->client->ps.stats[ STAT_CLASS ] == PCL_ALIEN_BUILDER0 ||
ent->client->ps.stats[ STAT_CLASS ] == PCL_ALIEN_BUILDER0_UPG )
abuilders++;
else if( BG_InventoryContainsWeapon( WP_HBUILD, ent->client->ps.stats ) )
hbuilders++;
}


trap_SetConfigstring( CS_ALIEN_STATUS, va( "%d %d %d %d %d",
ombuild,
( om > 0 ) ? om : 0,
level.numAlienSpawns,
abuilders,
boost ) );
trap_SetConfigstring( CS_HUMAN_STATUS, va( "%d %d %d %d %d %d %d",
rcbuild,
( rc > 0 ) ? rc : 0,
level.numHumanSpawns,
hbuilders,
arm,
medi,
dcc ) );
}

/*
============
CalculateAvgPlayers
Expand Down Expand Up @@ -2529,7 +2445,6 @@ void G_RunFrame( int levelTime )
{
G_CalculateBuildPoints( );
G_CalculateStages( );
G_CalculateStates( );
G_SpawnClients( TEAM_ALIENS );
G_SpawnClients( TEAM_HUMANS );
G_CalculateAvgPlayers( );
Expand Down
2 changes: 0 additions & 2 deletions src/game/g_team.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ void G_UpdateTeamConfigStrings( void )

trap_SetConfigstringRestrictions( CS_ALIEN_STAGES, &humanTeam );
trap_SetConfigstringRestrictions( CS_HUMAN_STAGES, &alienTeam );
trap_SetConfigstringRestrictions( CS_ALIEN_STATUS, &humanTeam );
trap_SetConfigstringRestrictions( CS_HUMAN_STATUS, &alienTeam );
}

/*
Expand Down
Loading