From: Rudolf Polzer <divverent@alientrap.org>
Date: Fri, 24 Dec 2010 11:52:08 +0000 (+0100)
Subject: use FONT_USER1 for everything in CSQC, get rid of hud_font/hud_bigfont decision ... 
X-Git-Tag: xonotic-v0.5.0~339^2~5
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=37ba0e87abf0b0b1998872ffe35f2093c5ed92c0;p=xonotic%2Fxonotic-data.pk3dir.git

use FONT_USER1 for everything in CSQC, get rid of hud_font/hud_bigfont decision (which doesn't make sense in the panelhud)
---

diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc
index 435dedabc..04ab52e14 100644
--- a/qcsrc/client/Main.qc
+++ b/qcsrc/client/Main.qc
@@ -65,14 +65,13 @@ void CSQC_Init(void)
 #endif
 
 	float i;
-	CSQC_CheckEngine();
 
 	binddb = db_create();
 	tempdb = db_create();
 	ClientProgsDB = db_load("client.db");
 	compressShortVector_init();
 
-	drawfont = 0;
+	drawfont = FONT_USER+1;
 	menu_visible = FALSE;
 	menu_show = menu_show_error;
 	menu_action = menu_sub_null;
diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc
index d489955ab..2b3db644e 100644
--- a/qcsrc/client/hud.qc
+++ b/qcsrc/client/hud.qc
@@ -297,7 +297,6 @@ void HUD_DrawCenterPrint (void)
 	{
 		ts = centerprint_messages[i];
 		drawfontscale = sz * '1 1 0';
-		drawfont = hud_bigfont;
 		pos_x = (vid_conwidth - stringwidth(ts, TRUE, centerprint_fontsize)) * 0.5;
 		if (ts != "")
 		{
@@ -308,7 +307,6 @@ void HUD_DrawCenterPrint (void)
 			// half height for empty lines looks better
 			pos_y = pos_y + sz * centerprint_fontsize_y * 0.5;
 		drawfontscale = '1 1 0';
-		drawfont = hud_font;
 	}
 }
 
@@ -1984,7 +1982,6 @@ void HUD_Ammo(void)
 		ammo_size_y = newSize;
 	}
 
-	drawfont = hud_bigfont;
 	float i, stat_items, currently_selected;
 	if (autocvar_hud_panel_ammo_onlycurrent)
 	{
@@ -2016,7 +2013,6 @@ void HUD_Ammo(void)
 			column = column + 1;
 		}
 	}
-	drawfont = hud_font;
 }
 
 void DrawNumIcon(float iconalign, vector myPos, vector mySize, float x, string icon, float left, vector color, float alpha)
@@ -2068,9 +2064,7 @@ void DrawNumIcon(float iconalign, vector myPos, vector mySize, float x, string i
 		}
 	}
 
-	drawfont = hud_bigfont;
 	drawstring_aspect(numpos, ftos(x), eX * (2/3) * newSize_x + eY * newSize_y, color, panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
-	drawfont = hud_font;
 	drawpic_aspect_skin(picpos, icon, '1 1 0' * newSize_y, '1 1 1', panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
 }
 
@@ -2153,7 +2147,6 @@ void HUD_Powerups(void) {
 		rightexact = strength_time;
 	}
 
-	drawfont = hud_bigfont;
 	float baralign = autocvar_hud_panel_powerups_baralign;
     float barflip;
 	float iconalign = autocvar_hud_panel_powerups_iconalign;
@@ -2325,7 +2318,6 @@ void HUD_Powerups(void) {
             }
 		}
 	}
-	drawfont = hud_font;
 }
 
 // Health/armor (#3)
@@ -2367,7 +2359,6 @@ void HUD_HealthArmor(void)
 	vector picpos;
 	vector numpos;
 
-	drawfont = hud_bigfont;
 	float baralign = autocvar_hud_panel_healtharmor_baralign;
 	float iconalign = autocvar_hud_panel_healtharmor_iconalign;
 	float progressbar = autocvar_hud_panel_healtharmor_progressbar;
@@ -2630,7 +2621,6 @@ void HUD_HealthArmor(void)
 			}
 		}
 	}
-	drawfont = hud_font;
 }
 
 // Notification area (#4)
@@ -3134,8 +3124,6 @@ void HUD_Notify (void)
 	if(!autocvar_hud_panel_notify && !autocvar__hud_configure)
 		return;
 
-	drawfont = hud_bigfont;
-
 	active_panel = HUD_PANEL_NOTIFY;
 	HUD_Panel_UpdateCvars(notify);
 	vector pos, mySize;
@@ -3426,8 +3414,6 @@ void HUD_Notify (void)
 			}
 		}
 	}
-
-	drawfont = hud_font;
 }
 
 // Timer (#5)
@@ -3494,9 +3480,7 @@ void HUD_Timer(void)
 		timer = seconds_tostring(timeleft);
 	}
 
-	drawfont = hud_bigfont;
 	drawstring_aspect(pos, timer, mySize, timer_color, panel_fg_alpha, DRAWFLAG_NORMAL);
-	drawfont = hud_font;
 }
 
 // Radar (#6)
@@ -3685,9 +3669,7 @@ void HUD_Score(void)
 		// race record display
 		if (distribution <= 0)
 			HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-		drawfont = hud_bigfont;
 		drawstring_aspect(pos, timer, eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-		drawfont = hud_font;
 	} else if (!teamplay) { // non-teamgames
 		// me vector := [team/connected frags id]
 		pl = players.sort_next;
@@ -3719,9 +3701,7 @@ void HUD_Score(void)
 		drawstring_aspect(pos + eX * 0.75 * mySize_x, ftos(distribution), eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
 		if (leader)
 			HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-		drawfont = hud_bigfont;
 		drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize_x + eY * mySize_y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
-		drawfont = hud_font;
 	} else { // teamgames
 		float max_fragcount;
 		max_fragcount = -99;
@@ -3743,9 +3723,7 @@ void HUD_Score(void)
 					leader = 1;
 				if (leader)
 					HUD_Panel_DrawHighlight(pos, eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-				drawfont = hud_bigfont;
 				drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize_x + eY * mySize_y, GetTeamRGB(tm.team) * 0.8, panel_fg_alpha, DRAWFLAG_NORMAL);
-				drawfont = hud_font;
 			} else {
 				if (max_fragcount == score)
 					leader = 1;
@@ -3795,7 +3773,6 @@ void HUD_RaceTimer (void) {
 	}
 	mySize = newSize;
 
-	drawfont = hud_bigfont;
 	float a, t;
 	string s, forcetime;
 
@@ -3895,8 +3872,6 @@ void HUD_RaceTimer (void) {
 			}
 		}
 	}
-
-	drawfont = hud_font;
 }
 
 // Vote window (#9)
@@ -4060,7 +4035,6 @@ void HUD_Mod_CA(vector pos, vector mySize)
 	redalive = getstati(STAT_REDALIVE);
 	bluealive = getstati(STAT_BLUEALIVE);
 
-	drawfont = hud_bigfont;
 	vector redpos, bluepos;
 	if(mySize_x > mySize_y)
 	{
@@ -4080,7 +4054,6 @@ void HUD_Mod_CA(vector pos, vector mySize)
 		drawpic_aspect_skin(bluepos, "player_blue.tga", eX * mySize_x + eY * 0.3 * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 		drawstring_aspect(bluepos + eY * 0.3 * mySize_y, ftos(bluealive), eX * mySize_x + eY * 0.2 * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 	}
-	drawfont = hud_font;
 }
 
 // CTF HUD modicon section
@@ -4478,8 +4451,6 @@ void HUD_Mod_Race(vector pos, vector mySize)
 	if not((scores_flags[ps_primary] & SFL_TIME) && !teamplay) // race/cts record display on HUD
 		return; // no records in the actual race
 
-	drawfont = hud_bigfont;
-
 	// clientside personal record
 	string rr;
 	if(gametype == GAME_CTS)
@@ -4602,7 +4573,6 @@ void HUD_Mod_Race(vector pos, vector mySize)
 			strunzone(race_status_name_prev);
 		race_status_name_prev = string_null;
 	}
-	drawfont = hud_font;
 }
 
 float mod_prev; // previous state of mod_active to check for a change
@@ -4839,9 +4809,7 @@ void HUD_EngineInfo(void)
 
 	vector color;
 	color = HUD_Get_Num_Color (prevfps, 100);
-	drawfont = hud_bigfont;
 	drawstring_aspect(pos, strcat("FPS: ", ftos_decimals(prevfps, autocvar_hud_panel_engineinfo_framecounter_decimals)), mySize, color, panel_fg_alpha, DRAWFLAG_NORMAL);
-	drawfont = hud_font;
 }
 
 // Info messages panel (#14)
@@ -5076,15 +5044,12 @@ void HUD_ShowSpeed(void)
 	numsize_x = numsize_y = autocvar_cl_showspeed_size;
 	pos = (vid_conheight - numsize_y) * autocvar_cl_showspeed_position;
 
-	drawfont = hud_bigfont;
 	drawstringcenter(eX + pos * eY, speed, numsize, '1 1 1', autocvar_hud_panel_fg_alpha * hud_fade_alpha, DRAWFLAG_NORMAL);
 
 	if (autocvar_cl_showspeed_z == 1) {
 		zspeed = strcat(ftos(fabs(floor( pmove_vel_z * conversion_factor + 0.5 ))), unit);
 		drawstringcenter(eX + pos * eY + numsize_y * eY, zspeed, numsize * 0.5, '1 1 1', autocvar_hud_panel_fg_alpha * hud_fade_alpha, DRAWFLAG_NORMAL);
 	}
-
-	drawfont = hud_font;
 }
 
 vector acc_prevspeed;
diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh
index 625a4ba7b..3219d338f 100644
--- a/qcsrc/client/main.qh
+++ b/qcsrc/client/main.qh
@@ -80,9 +80,6 @@ float hud_size[MAX_HUD_FIELDS + 1];
 string hud_title[MAX_HUD_FIELDS + 1];
 float hud_num_fields;
 
-float hud_font;
-float hud_bigfont;
-
 string scores_label[MAX_SCORE];
 float scores_flags[MAX_SCORE];
 string teamscores_label[MAX_SCORE];
diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc
index 8ff4817b0..4d96d5821 100644
--- a/qcsrc/client/mapvoting.qc
+++ b/qcsrc/client/mapvoting.qc
@@ -58,7 +58,6 @@ void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, strin
 	img_size_y = isize;
 	img_size_x = isize / 0.75; // 4:3 x can be stretched easily, height is defined in isize
 
-	drawfont = hud_font;
 	pos_y = pos_y + img_size_y;
 	
 	label = MapVote_FormatMapItem(id, map, count, tsize, hud_fontsize);
@@ -99,7 +98,6 @@ void MapVote_DrawAbstain(vector pos, float isize, float tsize, float count, floa
 	
 	rgb = MapVote_RGB(id);
 
-	drawfont = hud_font;
 	pos_y = pos_y + hud_fontsize_y;
 	
 	label = MapVote_FormatMapItem(id, "Don't care", count, tsize, hud_fontsize);
@@ -178,7 +176,6 @@ void MapVote_Draw()
 	if(i >= 0 || ymax < (vid_conheight*0.5))
 		ymax = vid_conheight - ymin;
 
-	drawfont = hud_bigfont;
 	hud_fontsize = HUD_GetFontsize("hud_fontsize");
 
 	pos_y = ymin;
@@ -196,8 +193,6 @@ void MapVote_Draw()
 	pos_y += 22;
 	pos_x = xmin;
 
-	drawfont = hud_font;
-	
 	// base for multi-column stuff...
 	ymin = pos_y;
 	if(mv_abstain)
diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc
index 57e25810f..90098a79a 100644
--- a/qcsrc/client/miscfunctions.qc
+++ b/qcsrc/client/miscfunctions.qc
@@ -306,12 +306,6 @@ entity GetTeam(float Team, float add)
 	return tm;
 }
 
-void CSQC_CheckEngine()
-{
-	hud_font = FONT_USER+1;
-	hud_bigfont = FONT_USER+2;
-}
-
 vector HUD_GetFontsize(string cvarname)
 {
 	vector v;
diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc
index 31cdc45bf..14f80db99 100644
--- a/qcsrc/client/scoreboard.qc
+++ b/qcsrc/client/scoreboard.qc
@@ -296,7 +296,6 @@ void Cmd_HUD_SetFields(float argc)
 
 	hud_num_fields = 0;
 
-	drawfont = hud_font;
 	hud_fontsize = HUD_GetFontsize("hud_fontsize");	
 
 	for(i = 0; i < argc - 1; ++i)
@@ -933,7 +932,6 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
 		drawfill(pos + '0 1 0' * weapon_height + '0 1 0' * height * i, '1 0 0' * sbwidth + '0 1 0' * fontsize, '1 1 1', scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
 	}
 
-	drawfont = hud_bigfont;
 	average_accuracy = 0;
 	float weapons_with_stats;
 	weapons_with_stats = 0;
@@ -1002,7 +1000,6 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
 			pos_y += height;
 		}
 	}
-	drawfont = hud_font;
 
 	if(weapons_with_stats)
 		average_accuracy = floor(average_accuracy / weapons_with_stats);
@@ -1126,7 +1123,6 @@ void HUD_DrawScoreboard()
 	pos_z = 0;
 
 	// Heading
-	drawfont = hud_bigfont;
 	drawstring(pos, "Scoreboard", '24 24 0', '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
 	
 	centerprint_start_x = vid_conwidth - 0.5 * (pos_x + stringwidth("Scoreboard", FALSE, '24 24 0'));
@@ -1134,8 +1130,6 @@ void HUD_DrawScoreboard()
 
 	pos_y += 24;
 
-	drawfont = hud_font;
-
 	// Draw the scoreboard
 	vector bg_size = drawgetimagesize("gfx/scoreboard/scoreboard_bg") * autocvar_scoreboard_bg_scale;