From: terencehill Date: Thu, 16 May 2013 06:43:42 +0000 (+0200) Subject: Decide which ModIcons panel to display right after game type initialization X-Git-Tag: xonotic-v0.8.0~226^2~1^2~15 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=65c863a96488429c9ae5288921706559fb336e0b;p=xonotic%2Fxonotic-data.pk3dir.git Decide which ModIcons panel to display right after game type initialization --- diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 7a11300ea..625696560 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -883,6 +883,7 @@ void Ent_ScoresInfo() float i; self.classname = "ent_client_scores_info"; gametype = ReadInt24_t(); + HUD_ModIcons_SetFunc(); for(i = 0; i < MAX_SCORE; ++i) { scores_label[i] = strzone(ReadString()); diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 7058cdbf7..1ca42657a 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -3332,6 +3332,22 @@ void HUD_Mod_Dom(vector myPos, vector mySize) } } +void HUD_ModIcons_SetFunc() +{ + switch(gametype) + { + case MAPINFO_TYPE_KEYHUNT: HUD_ModIcons_GameType = HUD_Mod_KH; break; + case MAPINFO_TYPE_CTF: HUD_ModIcons_GameType = HUD_Mod_CTF; break; + case MAPINFO_TYPE_NEXBALL: HUD_ModIcons_GameType = HUD_Mod_NexBall; break; + case MAPINFO_TYPE_CTS: + case MAPINFO_TYPE_RACE: HUD_ModIcons_GameType = HUD_Mod_Race; break; + case MAPINFO_TYPE_CA: + case MAPINFO_TYPE_FREEZETAG: HUD_ModIcons_GameType = HUD_Mod_CA; break; + case MAPINFO_TYPE_DOMINATION: HUD_ModIcons_GameType = HUD_Mod_Dom; break; + case MAPINFO_TYPE_KEEPAWAY: HUD_ModIcons_GameType = HUD_Mod_Keepaway; break; + } +} + float mod_prev; // previous state of mod_active to check for a change float mod_alpha; float mod_change; // "time" when mod_active changed @@ -3341,7 +3357,7 @@ void HUD_ModIcons(void) if(!autocvar__hud_configure) { if(!autocvar_hud_panel_modicons) return; - if (gametype != MAPINFO_TYPE_CTF && gametype != MAPINFO_TYPE_KEYHUNT && gametype != MAPINFO_TYPE_NEXBALL && gametype != MAPINFO_TYPE_CTS && gametype != MAPINFO_TYPE_RACE && gametype != MAPINFO_TYPE_CA && gametype != MAPINFO_TYPE_FREEZETAG && gametype != MAPINFO_TYPE_KEEPAWAY && gametype != MAPINFO_TYPE_DOMINATION) return; + if(!HUD_ModIcons_GameType) return; } HUD_Panel_UpdateCvars(); @@ -3349,10 +3365,6 @@ void HUD_ModIcons(void) draw_beginBoldFont(); - vector pos, mySize; - pos = panel_pos; - mySize = panel_size; - if(mod_active != mod_prev) { mod_change = time; mod_prev = mod_active; @@ -3368,25 +3380,14 @@ void HUD_ModIcons(void) if(panel_bg_padding) { - pos += '1 1 0' * panel_bg_padding; - mySize -= '2 2 0' * panel_bg_padding; + panel_pos += '1 1 0' * panel_bg_padding; + panel_size -= '2 2 0' * panel_bg_padding; } - // these MUST be ran in order to update mod_active - if(gametype == MAPINFO_TYPE_KEYHUNT) - HUD_Mod_KH(pos, mySize); - else if(gametype == MAPINFO_TYPE_CTF || autocvar__hud_configure) - HUD_Mod_CTF(pos, mySize); // forcealpha only needed for ctf icons, as only they are shown in config mode - else if(gametype == MAPINFO_TYPE_NEXBALL) - HUD_Mod_NexBall(pos, mySize); - else if(gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE) - HUD_Mod_Race(pos, mySize); - else if(gametype == MAPINFO_TYPE_CA || gametype == MAPINFO_TYPE_FREEZETAG) - HUD_Mod_CA(pos, mySize); - else if(gametype == MAPINFO_TYPE_DOMINATION) - HUD_Mod_Dom(pos, mySize); - else if(gametype == MAPINFO_TYPE_KEEPAWAY) - HUD_Mod_Keepaway(pos, mySize); + if(autocvar__hud_configure) + HUD_Mod_CTF(panel_pos, panel_size); + else + HUD_ModIcons_GameType(panel_pos, panel_size); draw_endBoldFont(); } diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index 3fcd0c4c4..9270d0f6d 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -354,3 +354,6 @@ string notify_icon[KN_MAX_ENTRIES]; string notify_attackers[KN_MAX_ENTRIES]; string notify_victims[KN_MAX_ENTRIES]; void HUD_Notify_Push(string icon, string attacker, string victim); + +var void HUD_ModIcons_GameType(vector pos, vector size); +void HUD_ModIcons_SetFunc();