countdown code added

This commit is contained in:
Bryce Hutchings 2002-08-22 03:32:10 +00:00
parent f551f8b016
commit 4ea01cf8c6
3 changed files with 72 additions and 18 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.63 2002/08/22 03:32:10 niceass
// countdown code added
//
// Revision 1.62 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
//
@ -566,6 +569,35 @@ static void CG_DrawStatusBar(void)
===========================================================================================
*/
static float CG_DrawCTBCountDown(float y)
{
char *s;
int w;
int x = 0;
float Color[4];
if ( cg.CTBcountdowntime - cg.time < 0 ) {
cg.CTBcountdowntime = 0;
return y;
}
y += 4;
s = va("Respawn in %d", (int)ceil( (cg.CTBcountdowntime - cg.time) / 1000.0f) );
w = CG_DrawStrlen(s) * SMALLCHAR_WIDTH;
x = w;
MAKERGBA(Color, 0.0f, 0.0f, 0.0f, 0.4f);
CG_FillRect(631 - x - 3, y - 1, w + 6, SMALLCHAR_HEIGHT + 6, Color);
MAKERGBA(Color, 0.0f, 0.0f, 0.0f, 1.0f);
CG_DrawCleanRect(631 - x - 3, y - 1, w + 6, SMALLCHAR_HEIGHT + 6, 1, Color);
CG_DrawSmallString(631 - x, y + 2, s, 1.0F);
return y + SMALLCHAR_HEIGHT + 4;
}
/*
================
CG_DrawAttacker
@ -844,7 +876,10 @@ static float CG_DrawTimer(float y)
int w;
int mins, seconds, tens;
int msec;
int x = 0;
float Color[4];
y += 4;
msec = cg.time - cgs.levelStartTime;
seconds = msec / 1000;
@ -854,9 +889,16 @@ static float CG_DrawTimer(float y)
seconds -= tens * 10;
s = va("%i:%i%i", mins, tens, seconds);
w = CG_DrawStrlen(s) * BIGCHAR_WIDTH;
w = CG_DrawStrlen(s) * SMALLCHAR_WIDTH;
x = w;
CG_DrawBigString(635 - w, y + 2, s, 1.0F);
MAKERGBA(Color, 0.0f, 0.0f, 0.0f, 0.4f);
CG_FillRect(631 - x - 3, y - 1, w + 6, SMALLCHAR_HEIGHT + 6, Color);
MAKERGBA(Color, 0.0f, 0.0f, 0.0f, 1.0f);
CG_DrawCleanRect(631 - x - 3, y - 1, w + 6, SMALLCHAR_HEIGHT + 6, 1, Color);
CG_DrawSmallString(631 - x, y + 2, s, 1.0F);
return y + BIGCHAR_HEIGHT + 4;
}
@ -1035,21 +1077,23 @@ static void CG_DrawUpperRight(void)
y = 0;
if (cgs.gametype >= GT_TEAM && cg_drawTeamOverlay.integer == 1) {
if (cgs.gametype >= GT_TEAM && cg_drawTeamOverlay.integer == 1)
y = CG_DrawTeamOverlay(y, qtrue, qtrue);
}
if (cg_drawSnapshot.integer) {
if (cg_drawSnapshot.integer)
y = CG_DrawSnapshot(y);
}
y = CG_DrawScore(y);
y = CG_DrawFPSandPing(y);
if (cg_drawTimer.integer) {
y = CG_DrawTimer(y);
}
if (cg_drawAttacker.integer) {
y = CG_DrawAttacker(y);
}
if (cg_drawTimer.integer)
y = CG_DrawTimer(y);
if (cg.CTBcountdowntime)
y = CG_DrawCTBCountDown(y);
if (cg_drawAttacker.integer)
y = CG_DrawAttacker(y);
}
/*
@ -1928,12 +1972,14 @@ CG_DrawSpectator
*/
static void CG_DrawSpectator(void)
{
float Color[4];
float Color[4];
int team;
MAKERGBA(Color, 0.0f, 0.0f, 0.0f, 0.4f);
if (cgs.gametype == GT_TEAMPLAY || cgs.gametype == GT_CTF) {
CG_TeamColor(cg.snap->ps.persistant[PERS_SAVEDTEAM], Color);
team = (cgs.gametype == GT_TEAMPLAY) ? cg.snap->ps.persistant[PERS_SAVEDTEAM] : cg.snap->ps.persistant[PERS_TEAM];
CG_TeamColor(team, Color);
Color[0] *= 0.7f;
Color[1] *= 0.7f;
Color[2] *= 0.7f;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.116 2002/08/22 03:30:20 niceass
// countdown code added
//
// Revision 1.115 2002/08/07 04:45:07 niceass
// ctb changes
//
@ -997,6 +1000,8 @@ typedef struct {
int matchTime;
int team1ready;
int team2ready;
int CTBcountdowntime;
} cg_t;
//Blaze: struct to hold the func_breakable stuff

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.62 2002/08/22 03:29:36 niceass
// countdown code added
//
// Revision 1.61 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
//
@ -1179,7 +1182,7 @@ void RemoveColorEscapeSequences(char *text)
void CG_CtbCountDown(int delay)
{
// NiceAss, do your magic here :)
cg.CTBcountdowntime = cg.time + delay * 1000;
}
/*
@ -1319,7 +1322,7 @@ void CG_RQ3_Cmd()
}
break;
case SETWEAPON:
i = atoi(CG_Argv(1));
i = atoi(CG_Argv(2));
cg.weaponSelect = i;
cg.weaponSelectTime = cg.time;
break;
@ -1341,7 +1344,7 @@ void CG_RQ3_Cmd()
CG_CvarSet();
break;
case CTBCOUNTDOWN:
i = atoi(CG_Argv(1));
i = atoi(CG_Argv(2));
CG_CtbCountDown(i);
break;
default: