mirror of
https://github.com/Q3Rally-Team/q3rally.git
synced 2024-11-22 12:01:44 +00:00
Only show as many Domination sigils on the HUD as exist in the map.
This commit is contained in:
parent
7edcfd0e0a
commit
755736061c
5 changed files with 74 additions and 69 deletions
|
@ -570,6 +570,8 @@ void CG_DrawSigilHUD( void ) {
|
|||
CG_DrawPic( x + cg_wideoffset.integer, y, 18, 18, cgs.media.sigilShader );
|
||||
break;
|
||||
|
||||
case SIGIL_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
x+= 19;
|
||||
|
|
|
@ -2160,7 +2160,7 @@ int realVidHeight;
|
|||
void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum ) {
|
||||
const char *s;
|
||||
// Q3Rally Code Start
|
||||
int size;
|
||||
int i, size;
|
||||
// Q3Rally Code END
|
||||
|
||||
// clear everything
|
||||
|
@ -2190,10 +2190,12 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum ) {
|
|||
|
||||
cgs.redflag = cgs.blueflag = -1; // For compatibily, default to unset for
|
||||
cgs.flagStatus = -1;
|
||||
// Q3Rally Code Start
|
||||
cgs.sigil[0] = cgs.sigil[1] = cgs.sigil[2] = cgs.sigil[3] = cgs.sigil[4] = -1; // Sigil Reset
|
||||
// Q3Rally Code END
|
||||
// old servers
|
||||
// Q3Rally Code Start
|
||||
for ( i = 0; i < MAX_SIGILS; i++ ) {
|
||||
cgs.sigil[i] = SIGIL_NONE; // Sigil Reset
|
||||
}
|
||||
// Q3Rally Code END
|
||||
|
||||
// Q3Rally Code Start(Danil_Dm)
|
||||
if(cg_widescreen.integer == 1){
|
||||
|
|
|
@ -241,6 +241,28 @@ static void CG_ParseWarmup( void ) {
|
|||
cg.warmup = warmup;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CG_ParseSigilStatus
|
||||
==================
|
||||
*/
|
||||
static void CG_ParseSigilStatus( void ) {
|
||||
const char *str;
|
||||
int i;
|
||||
|
||||
str = CG_ConfigString( CS_SIGILSTATUS );
|
||||
|
||||
for ( i = 0; i < MAX_SIGILS; i++ ) {
|
||||
if ( str[i] == 0 ) {
|
||||
break;
|
||||
}
|
||||
cgs.sigil[i] = str[i] - '0';
|
||||
}
|
||||
for (/**/; i < MAX_SIGILS; i++ ) {
|
||||
cgs.sigil[i] = SIGIL_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CG_SetConfigValues
|
||||
|
@ -263,16 +285,11 @@ void CG_SetConfigValues( void ) {
|
|||
cgs.redflag = s[0] - '0';
|
||||
cgs.blueflag = s[1] - '0';
|
||||
}
|
||||
|
||||
else if ( cgs.gametype == GT_DOMINATION ) {
|
||||
s = CG_ConfigString( CS_SIGILSTATUS );
|
||||
cgs.sigil[0] = s[0] - '0';
|
||||
cgs.sigil[1] = s[1] - '0';
|
||||
cgs.sigil[2] = s[2] - '0';
|
||||
cgs.sigil[3] = s[3] - '0';
|
||||
cgs.sigil[4] = s[4] - '0';
|
||||
}
|
||||
|
||||
|
||||
else if ( cgs.gametype == GT_DOMINATION ) {
|
||||
CG_ParseSigilStatus();
|
||||
}
|
||||
|
||||
#ifdef MISSIONPACK
|
||||
else if( cgs.gametype == GT_1FCTF ) {
|
||||
s = CG_ConfigString( CS_FLAGSTATUS );
|
||||
|
@ -410,17 +427,12 @@ static void CG_ConfigStringModified( void ) {
|
|||
cgs.flagStatus = str[0] - '0';
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
else if ( num == CS_SIGILSTATUS ) {
|
||||
if ( cgs.gametype == GT_DOMINATION ) {
|
||||
cgs.sigil[0] = str[0] - '0';
|
||||
cgs.sigil[1] = str[1] - '0';
|
||||
cgs.sigil[2] = str[2] - '0';
|
||||
cgs.sigil[3] = str[3] - '0';
|
||||
cgs.sigil[4] = str[4] - '0';
|
||||
}
|
||||
}
|
||||
if( cgs.gametype == GT_DOMINATION ) {
|
||||
CG_ParseSigilStatus();
|
||||
}
|
||||
}
|
||||
else if ( num == CS_SHADERSTATE ) {
|
||||
CG_ShaderStateChanged();
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ typedef struct teamgame_s {
|
|||
int blueObeliskAttackedTime;
|
||||
// Q3Rally Code Start
|
||||
domination_sigil_t sigil[MAX_SIGILS];
|
||||
int numSigils;
|
||||
// Q3Rally Code END
|
||||
} teamgame_t;
|
||||
|
||||
|
@ -60,6 +61,8 @@ void Init_Sigils( void );
|
|||
// Q3Rally Code END
|
||||
|
||||
void Team_InitGame( void ) {
|
||||
int i;
|
||||
|
||||
memset(&teamgame, 0, sizeof teamgame);
|
||||
|
||||
switch( g_gametype.integer ) {
|
||||
|
@ -74,16 +77,14 @@ void Team_InitGame( void ) {
|
|||
|
||||
case GT_DOMINATION:
|
||||
Init_Sigils();
|
||||
teamgame.sigil[0].status = -1; // Invalid to force update
|
||||
Team_SetSigilStatus( 0, SIGIL_ISWHITE );
|
||||
teamgame.sigil[1].status = -1; // Invalid to force update
|
||||
Team_SetSigilStatus( 1, SIGIL_ISWHITE );
|
||||
teamgame.sigil[2].status = -1; // Invalid to force update
|
||||
Team_SetSigilStatus( 2, SIGIL_ISWHITE );
|
||||
teamgame.sigil[3].status = -1; // Invalid to force update
|
||||
Team_SetSigilStatus( 3, SIGIL_ISWHITE );
|
||||
teamgame.sigil[4].status = -1; // Invalid to force update
|
||||
Team_SetSigilStatus( 4, SIGIL_ISWHITE );
|
||||
for ( i = 0; i < teamgame.numSigils; i++ ) {
|
||||
teamgame.sigil[i].status = -1; // Invalid to force update
|
||||
Team_SetSigilStatus( i, SIGIL_ISWHITE );
|
||||
}
|
||||
for ( ; i < MAX_SIGILS; i++ ) {
|
||||
teamgame.sigil[i].status = -1; // Invalid to force update
|
||||
Team_SetSigilStatus( i, SIGIL_NONE );
|
||||
}
|
||||
break;
|
||||
|
||||
// Q3Rally Code END
|
||||
|
@ -106,20 +107,11 @@ void Team_InitGame( void ) {
|
|||
void Team_EndGame( void ) {
|
||||
// stop adding score when intermission starts
|
||||
if ( g_gametype.integer == GT_DOMINATION ) {
|
||||
if( teamgame.sigil[0].entity ) {
|
||||
teamgame.sigil[0].entity->nextthink = 0;
|
||||
}
|
||||
if( teamgame.sigil[1].entity ) {
|
||||
teamgame.sigil[1].entity->nextthink = 0;
|
||||
}
|
||||
if( teamgame.sigil[2].entity ) {
|
||||
teamgame.sigil[2].entity->nextthink = 0;
|
||||
}
|
||||
if( teamgame.sigil[3].entity ) {
|
||||
teamgame.sigil[3].entity->nextthink = 0;
|
||||
}
|
||||
if( teamgame.sigil[4].entity ) {
|
||||
teamgame.sigil[4].entity->nextthink = 0;
|
||||
int i;
|
||||
for ( i = 0; i < teamgame.numSigils; i++ ) {
|
||||
if( teamgame.sigil[i].entity ) {
|
||||
teamgame.sigil[i].entity->nextthink = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +266,7 @@ Init_Sigils
|
|||
*/
|
||||
void Init_Sigils( void ) {
|
||||
gentity_t *point = NULL;
|
||||
int sigilNum = 0;
|
||||
teamgame.numSigils = 0;
|
||||
for (point = g_entities; point < &g_entities[level.num_entities] ;
|
||||
point++)
|
||||
{
|
||||
|
@ -282,12 +274,11 @@ void Init_Sigils( void ) {
|
|||
continue;
|
||||
|
||||
if (!Q_stricmp(point->classname, "team_domination_sigil")) {
|
||||
teamgame.sigil[sigilNum].entity = point;
|
||||
sigilNum++;
|
||||
}
|
||||
|
||||
if ( sigilNum == MAX_SIGILS )
|
||||
return;
|
||||
teamgame.sigil[teamgame.numSigils].entity = point;
|
||||
teamgame.numSigils++;
|
||||
if ( teamgame.numSigils == MAX_SIGILS )
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -312,15 +303,14 @@ void Team_SetSigilStatus( int sigilNum, sigilStatus_t status ) {
|
|||
|
||||
|
||||
if( modified ) {
|
||||
char st[6];
|
||||
char st[MAX_SIGILS+1];
|
||||
int i;
|
||||
|
||||
//send all 5 sigils' status to the configstring
|
||||
st[0] = '0' + teamgame.sigil[0].status;
|
||||
st[1] = '0' + teamgame.sigil[1].status;
|
||||
st[2] = '0' + teamgame.sigil[2].status;
|
||||
st[3] = '0' + teamgame.sigil[3].status;
|
||||
st[4] = '0' + teamgame.sigil[4].status;
|
||||
st[5] = 0;
|
||||
//send all sigils' status to the configstring
|
||||
for ( i = 0; i < teamgame.numSigils; i++ ) {
|
||||
st[i] = '0' + teamgame.sigil[i].status;
|
||||
}
|
||||
st[teamgame.numSigils] = 0;
|
||||
|
||||
trap_SetConfigstring( CS_SIGILSTATUS, st );
|
||||
|
||||
|
@ -342,12 +332,9 @@ void ValidateSigilsInMap( gentity_t *ent )
|
|||
float vlen;
|
||||
qboolean foundItem = qfalse, foundPreferredItem = qfalse;
|
||||
gitem_t *item;
|
||||
|
||||
if (!teamgame.sigil[0].entity || !teamgame.sigil[1].entity)
|
||||
return;
|
||||
|
||||
// if 3rd sigil exists, this function doesn't need to run
|
||||
if (teamgame.sigil[2].entity)
|
||||
if (teamgame.numSigils != 2 || MAX_SIGILS < 3)
|
||||
return;
|
||||
|
||||
VectorCopy(teamgame.sigil[0].entity->r.currentOrigin, start);
|
||||
|
@ -408,7 +395,8 @@ void ValidateSigilsInMap( gentity_t *ent )
|
|||
targ->item = item;
|
||||
targ->r.svFlags = SVF_BROADCAST;
|
||||
targ->s.powerups = PW_SIGILWHITE;
|
||||
teamgame.sigil[2].entity = targ;
|
||||
teamgame.sigil[teamgame.numSigils].entity = targ;
|
||||
teamgame.numSigils++;
|
||||
}
|
||||
// kill the entity that does the spawn conversions
|
||||
G_FreeEntity(ent);
|
||||
|
|
|
@ -1797,7 +1797,8 @@ typedef enum _flag_status {
|
|||
#define MAX_SIGILS 5
|
||||
|
||||
typedef enum _sigil_status {
|
||||
SIGIL_ISWHITE = 0,
|
||||
SIGIL_NONE = 0,
|
||||
SIGIL_ISWHITE,
|
||||
SIGIL_ISRED,
|
||||
SIGIL_ISBLUE,
|
||||
SIGIL_ISGREEN,
|
||||
|
|
Loading…
Reference in a new issue