Skip to content
Permalink
Browse files

cgame: register only 1 time images from debriefing UI

  • Loading branch information...
Aranud committed Oct 9, 2019
1 parent c26eb0e commit 149d84a005a89546cbabd07085fca4426ef11aba
Showing with 90 additions and 32 deletions.
  1. +36 −12 src/cgame/cg_debriefing.c
  2. +54 −20 src/cgame/cg_scoreboard.c
@@ -3563,6 +3563,23 @@ void CG_Debriefing_Maps_Draw(panel_button_t *button)
*/
void CG_Debriefing_Mission_Draw(panel_button_t *button)
{
static qhandle_t pinAxis = 0, pinAllied = 0, pinNeutral = 0;

if (!pinAxis)
{
pinAxis = trap_R_RegisterShaderNoMip("gfx/loading/pin_axis");
}

if (!pinAllied)
{
pinAllied = trap_R_RegisterShaderNoMip("gfx/loading/pin_allied");
}

if (!pinNeutral)
{
pinNeutral = trap_R_RegisterShaderNoMip("gfx/loading/pin_neutral");
}

if (cg_gameType.integer == GT_WOLF_CAMPAIGN)
{
if (!cgs.campaignInfoLoaded)
@@ -3605,13 +3622,13 @@ void CG_Debriefing_Mission_Draw(panel_button_t *button)
switch (CG_Debriefing_FindWinningTeamForPos(i + 1))
{
case TEAM_AXIS:
CG_DrawPic(x - 12, y - 12, 24, 24, trap_R_RegisterShaderNoMip("gfx/loading/pin_axis"));
CG_DrawPic(x - 12, y - 12, 24, 24, pinAxis);
break;
case TEAM_ALLIES:
CG_DrawPic(x - 12, y - 12, 24, 24, trap_R_RegisterShaderNoMip("gfx/loading/pin_allied"));
CG_DrawPic(x - 12, y - 12, 24, 24, pinAllied);
break;
default:
CG_DrawPic(x - 12, y - 12, 24, 24, trap_R_RegisterShaderNoMip("gfx/loading/pin_neutral"));
CG_DrawPic(x - 12, y - 12, 24, 24, pinNeutral);
break;
}

@@ -3633,12 +3650,13 @@ void CG_Debriefing_Mission_Draw(panel_button_t *button)
switch (CG_Debriefing_FindWinningTeamForPos(cgs.tdbSelectedMap))
{
case TEAM_AXIS:
CG_DrawPic(x - 12, y - 12, 24, 24, trap_R_RegisterShaderNoMip("gfx/loading/pin_axis"));
CG_DrawPic(x - 12, y - 12, 24, 24, pinAxis);
break;
case TEAM_ALLIES:
CG_DrawPic(x - 12, y - 12, 24, 24, trap_R_RegisterShaderNoMip("gfx/loading/pin_allied"));
CG_DrawPic(x - 12, y - 12, 24, 24, pinAllied);
break;
default:
CG_DrawPic(x - 12, y - 12, 24, 24, pinNeutral);
break;
}
}
@@ -3658,9 +3676,10 @@ void CG_Debriefing_Mission_Draw(panel_button_t *button)

if (cgs.arenaData.mappos[0] != 0.f && cgs.arenaData.mappos[1] != 0.f)
{
float x, y, w;
vec2_t tl, br;
vec4_t colourFadedBlack = { 0.f, 0.f, 0.f, 0.4f };
float x, y, w;
vec2_t tl, br;
vec4_t colourFadedBlack = { 0.f, 0.f, 0.f, 0.4f };
static qhandle_t campMap = 0;

tl[0] = cgs.arenaData.mappos[0] - .5f * 650.f;
if (tl[0] < 0)
@@ -3686,7 +3705,12 @@ void CG_Debriefing_Mission_Draw(panel_button_t *button)
tl[1] = br[1] - 650.f;
}

CG_DrawPicST(button->rect.x, button->rect.y, button->rect.w, button->rect.h, tl[0] / 1024.f, tl[1] / 1024.f, br[0] / 1024.f, br[1] / 1024.f, trap_R_RegisterShaderNoMip("gfx/loading/camp_map"));
if (!campMap)
{
campMap = trap_R_RegisterShaderNoMip("gfx/loading/camp_map");
}

CG_DrawPicST(button->rect.x, button->rect.y, button->rect.w, button->rect.h, tl[0] / 1024.f, tl[1] / 1024.f, br[0] / 1024.f, br[1] / 1024.f, campMap);

x = button->rect.x + ((cgs.arenaData.mappos[0] - tl[0]) / 650.f * button->rect.w);
y = button->rect.y + ((cgs.arenaData.mappos[1] - tl[1]) / 650.f * button->rect.h);
@@ -3713,13 +3737,13 @@ void CG_Debriefing_Mission_Draw(panel_button_t *button)
switch (CG_Debriefing_FindWinningTeam())
{
case TEAM_AXIS:
CG_DrawPic(x - 12, y - 12, 24, 24, trap_R_RegisterShaderNoMip("gfx/loading/pin_axis"));
CG_DrawPic(x - 12, y - 12, 24, 24, pinAxis);
break;
case TEAM_ALLIES:
CG_DrawPic(x - 12, y - 12, 24, 24, trap_R_RegisterShaderNoMip("gfx/loading/pin_allied"));
CG_DrawPic(x - 12, y - 12, 24, 24, pinAllied);
break;
default:
CG_DrawPic(x - 12, y - 12, 24, 24, trap_R_RegisterShaderNoMip("gfx/loading/pin_neutral"));
CG_DrawPic(x - 12, y - 12, 24, 24, pinNeutral);
break;
}

@@ -38,10 +38,10 @@
char *Binding_FromName(const char *cvar);

// colors and fonts for overlays
vec4_t SB_bg = { 0.16f, 0.2f, 0.17f, 0.8f };
vec4_t SB_bg2 = { 0.0f, 0.0f, 0.0f, 0.6f };
vec4_t SB_bg = { 0.16f, 0.2f, 0.17f, 0.8f };
vec4_t SB_bg2 = { 0.0f, 0.0f, 0.0f, 0.6f };
vec4_t SB_border = { 1.0f, 1.0f, 1.0f, 0.3f };
vec4_t SB_text = { 0.6f, 0.6f, 0.6f, 1.0f };
vec4_t SB_text = { 0.6f, 0.6f, 0.6f, 1.0f };

#define FONT_HEADER &cgs.media.limboFont1
#define FONT_TEXT &cgs.media.limboFont2
@@ -120,7 +120,14 @@ int WM_DrawObjectives(int x, int y, int width, float fade)

if (cg.snap->ps.pm_type == PM_INTERMISSION)
{
const char *buf, *flagshader = NULL, *nameshader = NULL;
static qhandle_t alliesFlag = 0;
static qhandle_t textAllies = 0;
static qhandle_t axisFlag = 0;
static qhandle_t textAxis = 0;
static qhandle_t textWin = 0;

const char *buf;
qhandle_t *flagshader = NULL, *nameshader = NULL;
int rows = 8;

y += 16 * (rows - 1);
@@ -145,28 +152,55 @@ int WM_DrawObjectives(int x, int y, int width, float fade)
else if (atoi(buf))
{
// "ALLIES";
flagshader = "ui/assets/portraits/allies_win_flag.tga";
nameshader = "ui/assets/portraits/text_allies.tga";

if (!alliesFlag)
{
alliesFlag = trap_R_RegisterShaderNoMip("ui/assets/portraits/allies_win_flag.tga");
}

if (!textAllies)
{
textAllies = trap_R_RegisterShaderNoMip("ui/assets/portraits/text_allies.tga");
}

flagshader = &alliesFlag;
nameshader = &textAllies;
}
else
{
// "AXIS";
flagshader = "ui/assets/portraits/axis_win_flag.tga";
nameshader = "ui/assets/portraits/text_axis.tga";

if (!axisFlag)
{
axisFlag = trap_R_RegisterShaderNoMip("ui/assets/portraits/allies_win_flag.tga");
}

if (!textAxis)
{
textAxis = trap_R_RegisterShaderNoMip("ui/assets/portraits/text_allies.tga");
}

flagshader = &axisFlag;
nameshader = &textAxis;
}

y += 16 * ((rows - 2) / 2);

if (flagshader)
{
CG_DrawPic(100 + cgs.wideXoffset, 10, 210, 136, trap_R_RegisterShaderNoMip(flagshader));
CG_DrawPic(325 + cgs.wideXoffset, 10, 210, 136, trap_R_RegisterShaderNoMip(flagshader));
CG_DrawPic(100 + cgs.wideXoffset, 10, 210, 136, *flagshader);
CG_DrawPic(325 + cgs.wideXoffset, 10, 210, 136, *flagshader);
}

if (nameshader)
{
CG_DrawPic(140 + cgs.wideXoffset, 50, 127, 64, trap_R_RegisterShaderNoMip(nameshader));
CG_DrawPic(365 + cgs.wideXoffset, 50, 127, 64, trap_R_RegisterShaderNoMip("ui/assets/portraits/text_win.tga"));
if (!textWin)
{
textWin = trap_R_RegisterShaderNoMip("ui/assets/portraits/text_win.tga");
}

CG_DrawPic(140 + cgs.wideXoffset, 50, 127, 64, *nameshader);
CG_DrawPic(365 + cgs.wideXoffset, 50, 127, 64, textWin);
}
return y;
}
@@ -271,7 +305,7 @@ int WM_DrawObjectives(int x, int y, int width, float fade)
else
{
s = va("%s %s%i", CG_TranslateString("REINFORCE TIME:"), (seconds <= 2 &&
cgs.clientinfo[cg.clientNum].health == 0 && !(cg.snap->ps.pm_flags & PMF_FOLLOW)) ? "^3" : "^F", seconds);
cgs.clientinfo[cg.clientNum].health == 0 && !(cg.snap->ps.pm_flags & PMF_FOLLOW)) ? "^3" : "^F", seconds);
}
CG_Text_Paint_Ext(SCREEN_WIDTH - 20 - CG_Text_Width_Ext(s, 0.25f, 0, FONT_HEADER) + cgs.wideXoffset, y, 0.25f, 0.25f, SB_text, s, 0, 0, 0, FONT_HEADER);
}
@@ -729,7 +763,7 @@ static void WM_DrawClientScore_Small(int x, int y, score_t *score, float *color,
{
for (j = 0; j < ci->medals[i]; j++)
{
Q_strcat(buf, sizeof(buf), va("^%c%c", COLOR_RED + i,GetSkillTableData(i)->skillNames[0]));
Q_strcat(buf, sizeof(buf), va("^%c%c", COLOR_RED + i, GetSkillTableData(i)->skillNames[0]));
}
maxchars--;
}
@@ -915,11 +949,11 @@ static int WM_TeamScoreboard(int x, int y, team_t team, float fade, int maxrows,
vec4_t hcolor;
float tempx, tempy;
int i;
int count = 0;
int width = INFO_TOTAL_WIDTH;
int count = 0;
int width = INFO_TOTAL_WIDTH;
qboolean use_mini_chars = qfalse, livesleft = qfalse;
const char *buffer = CG_ConfigString(CS_SERVERINFO);
const char *str = Info_ValueForKey(buffer, "g_maxlives");
const char *buffer = CG_ConfigString(CS_SERVERINFO);
const char *str = Info_ValueForKey(buffer, "g_maxlives");

if (str && *str && atoi(str))
{
@@ -1263,7 +1297,7 @@ qboolean CG_DrawScoreboard(void)
{
int x = 20, y = 6, x_right = SCREEN_WIDTH - x - (INFO_TOTAL_WIDTH - 5);
float fade;
int width = SCREEN_WIDTH - 2 * x + 5;
int width = SCREEN_WIDTH - 2 * x + 5;
#ifdef FEATURE_RATING
int w;
const char *s, *s2, *s3;
@@ -1339,7 +1373,7 @@ qboolean CG_DrawScoreboard(void)
//Skill Rating
// XP view
s3 = (cgs.skillRating && cg_scoreboard.integer == SCOREBOARD_SR) ? CG_TranslateString("Skill Rating view") : CG_TranslateString("XP view");
s = va(CG_TranslateString("%s - Press double-%s quickly to switch scoreboard"), s3, s2);
s = va(CG_TranslateString("%s - Press double-%s quickly to switch scoreboard"), s3, s2);

w = CG_Text_Width_Ext(s, fontScale, 0, &cgs.media.limboFont2);
x = Ccg_WideX(SCREEN_WIDTH / 2) - w / 2;

0 comments on commit 149d84a

Please sign in to comment.
You can’t perform that action at this time.