Skip to content

Commit

Permalink
Allow showing found and total number of secrets
Browse files Browse the repository at this point in the history
With new cvar "cg_drawSecrets"
  • Loading branch information
kugelrund committed Sep 28, 2020
1 parent c571398 commit 26f0694
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
17 changes: 17 additions & 0 deletions code/cgame/cg_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2322,6 +2322,20 @@ static void CG_DrawOverbounceInfo( void ) {
}
}

/*
===============
CG_DrawSecrets
===============
*/
static float CG_DrawSecrets( float y ) {
const char *secrets_string = va( "Secrets %i/%i",
cg_entities[0].gent->client->sess.missionStats.secretsFound,
cg_entities[0].gent->client->sess.missionStats.totalSecrets );
const int width = cgi_R_Font_StrLenPixels( secrets_string, cgs.media.qhFontMedium, 1.0f );
cgi_R_Font_DrawString( 635 - width, y + 2, secrets_string, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.0f );
return y + BIGCHAR_HEIGHT + 10;
}

/*
====================
CG_DrawStrafeHelper
Expand Down Expand Up @@ -2463,6 +2477,9 @@ static void CG_Draw2D( void )
if (g_cheats->integer) {
y=CG_DrawCheatsNotice(y);
}
if (cg_drawSecrets.integer) {
y=CG_DrawSecrets(y);
}
if (cg_drawSnapshot.integer) {
y=CG_DrawSnapshot(y);
}
Expand Down
1 change: 1 addition & 0 deletions code/cgame/cg_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ extern vmCvar_t cg_smoothPlayerPlat;
extern vmCvar_t cg_smoothPlayerPlatAccel;

// Additions for Speed Outcast
extern vmCvar_t cg_drawSecrets;
extern vmCvar_t cg_drawSpeedrunTotalTimer;
extern vmCvar_t cg_drawSpeedrunLevelTimer;
extern vmCvar_t cg_drawOverbounceInfo;
Expand Down
2 changes: 2 additions & 0 deletions code/cgame/cg_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ vmCvar_t cg_smoothPlayerPlat;
vmCvar_t cg_smoothPlayerPlatAccel;

// Additions for Speed Outcast
vmCvar_t cg_drawSecrets;
vmCvar_t cg_drawSpeedrunTotalTimer;
vmCvar_t cg_drawSpeedrunLevelTimer;
vmCvar_t cg_drawOverbounceInfo;
Expand Down Expand Up @@ -434,6 +435,7 @@ Ghoul2 Insert End
{ &cg_smoothPlayerPlatAccel, "cg_smoothPlayerPlatAccel", "3.25", 0},

// Additions for Speed Outcast
{ &cg_drawSecrets, "cg_drawSecrets", "0", CVAR_ARCHIVE },
{ &cg_drawSpeedrunTotalTimer, "cg_drawSpeedrunTotalTimer", "1", CVAR_ARCHIVE },
{ &cg_drawSpeedrunLevelTimer, "cg_drawSpeedrunLevelTimer", "0", CVAR_ARCHIVE },
{ &cg_drawOverbounceInfo, "cg_drawOverbounceInfo", "0", CVAR_ARCHIVE },
Expand Down

0 comments on commit 26f0694

Please sign in to comment.