From a9d4c964304d16be23757a4e3fbe720255938157 Mon Sep 17 00:00:00 2001 From: cypress Date: Wed, 11 Sep 2024 19:12:20 -0700 Subject: [PATCH] CLIENT: Font kerning implementation --- progs/csqc.src | 1 + source/client/draw.qc | 94 +++++++++++++++++++ source/client/hud.qc | 199 +++++++++++++++++++-------------------- source/client/main.qc | 2 + source/client/menu.qc | 214 +++++++++++++++++++++--------------------- 5 files changed, 301 insertions(+), 209 deletions(-) create mode 100644 source/client/draw.qc diff --git a/progs/csqc.src b/progs/csqc.src index e9846b0..0c8e21f 100644 --- a/progs/csqc.src +++ b/progs/csqc.src @@ -11,6 +11,7 @@ shared_defs.qc sound_enhanced.qc weapon_stats.qc defs/custom.qc +draw.qc menu.qc achievements.qc hud.qc diff --git a/source/client/draw.qc b/source/client/draw.qc new file mode 100644 index 0000000..674a2eb --- /dev/null +++ b/source/client/draw.qc @@ -0,0 +1,94 @@ +/* + client/draw.qc + + Enhanced CSQC 2D Drawing Code + + Copyright (C) 2021-2024 NZ:P Team + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA + +*/ + +int font_kerningamount[96]; + +// ! " # $ % & ' ( ) * _ , - . / 0 +// 1 2 3 4 5 6 7 8 9 : ; < = > ? @ +// A B C D E F G H I J K L M N O P +// Q R S T U V W X Y Z [ \ ] ^ _ ` +// a b c d e f g h i j k l m n o p +// q r s t u v w x y z { | } ~ +int font_kerningamount[96]; + +void InitKerningMap(void) +{ + // Initialize the kerning amount as 8px for each + // char in the event we cant load the file. + for(int i = 0; i < 96; i++) { + font_kerningamount[i] = 8; + } + + int kerning_map = fopen("gfx/kerning_map.txt", FILE_READ); + if (kerning_map == -1) { + return; + } + + tokenize(fgets(kerning_map)); + for(int i = 0; i < 96 * 2; i += 2) { + font_kerningamount[i / 2] = stof(argv(i)); + } + + fclose(kerning_map); +} + +float(string text, float size) getTextWidth = +{ + int width = 0; + + for(int i = 0; i < strlen(text); i++) { + float chr = str2chr(text, i); + // Hooray for variable-spacing! + if (chr == ' ') + width += 4 * (size/8); + else if (chr < 33 || chr > 126) + width += 8 * (size/8); + else + width += (font_kerningamount[(chr - 33)] + 1) * (size/8); + } + + return width; +} + +void(vector position, string text, vector size, vector rgb, float alpha, float drawflag) Draw_String = +{ + int x, y; + x = position_x; + y = position_y; + for(int i = 0; i < strlen(text); i++) { + float chr = str2chr(text, i); + drawcharacter([x, y], chr, size, rgb, alpha, drawflag); + + // Hooray for variable-spacing! + if (chr == ' ') + x += 4 * (size_x/8); + else if (chr < 33 || chr > 126) + x += 8 * (size_x/8); + else + x += (font_kerningamount[(chr - 33)] + 1) * (size_x/8); + } +}; \ No newline at end of file diff --git a/source/client/hud.qc b/source/client/hud.qc index a2eb0f9..fd4ac46 100644 --- a/source/client/hud.qc +++ b/source/client/hud.qc @@ -86,17 +86,13 @@ void(float width, float height) HUD_Health = void(float width, float height) HUD_Ammo = { - local float ammo, curmag, benis, benis2; + float ammo, curmag; string ammostring, ammostring_1, ammostring_2; vector color; curmag = getstatf(STAT_CURRENTMAG); ammo = getstatf(STAT_AMMO); - benis = strlen(ftos(ammo)); - benis2 = strlen(ftos(curmag)); - benis = benis + benis2; - if (W_IsLowAmmo(getstatf(STAT_ACTIVEWEAPON), getstatf(STAT_CURRENTMAG), true)) color = [215/255, 0, 0]; else @@ -112,16 +108,16 @@ void(float width, float height) HUD_Ammo = float curmag2 = getstatf(STAT_CURRENTMAG2); ammostring = strcat(ftos(curmag2), " ", ftos(curmag), "/", ftos(ammo)); - float x2 = (g_width - GetUltraWideOffset()) - 62 - stringwidth(ammostring, 0, [12, 12]); - drawstring([x2, g_height - 29], ammostring, [12, 12], [1,1,1], 1, 0); + float x2 = (g_width - GetUltraWideOffset()) - 62 - getTextWidth(ammostring, 12); + Draw_String([x2, g_height - 29], ammostring, [12, 12], [1,1,1], 1, 0); } else { ammostring_1 = ftos(curmag); ammostring_2 = strcat("/", ftos(ammo)); string weapon_ammo_string = strcat(ftos(curmag), "/", ftos(ammo)); - float x = (g_width - GetUltraWideOffset()) - 62 - stringwidth(weapon_ammo_string, 0, [12, 12]); + float x = (g_width - GetUltraWideOffset()) - 62 - getTextWidth(weapon_ammo_string, 12); - drawstring([x, g_height - 29], ammostring_1, [12, 12], color, 1, 0); - drawstring([x + stringwidth(ammostring_1, 0, [12, 12]), g_height - 29], ammostring_2, [12, 12], color_2, 1, 0); + Draw_String([x, g_height - 29], ammostring_1, [12, 12], color, 1, 0); + Draw_String([x + getTextWidth(ammostring_1, 12), g_height - 29], ammostring_2, [12, 12], color_2, 1, 0); } } @@ -191,8 +187,8 @@ void() HUD_AmmoString = } } - float x = (g_width/2) - (stringwidth(message, 0, [12, 12])/2); - drawstring([x, g_height/2 + 40, 0], message, [12, 12, 0], textcolor, ammoopac, 0); + float x = (g_width/2) - (getTextWidth(message, 12)/2); + Draw_String([x, g_height/2 + 40, 0], message, [12, 12, 0], textcolor, ammoopac, 0); } /******************* @@ -241,7 +237,7 @@ void(float amount, float playernum) RegisterPointChange = } // determine the width of the text string - point_elements[index].string_width = stringwidth(point_elements[index].text_string, 0, [12, 12]); + point_elements[index].string_width = getTextWidth(point_elements[index].text_string, 12); // generate a velocity point_elements[index].y_velocity = random()/4; @@ -300,7 +296,7 @@ void(float pwidth, float width, float height, float playernum) PointUpdate = } if (point_elements[i].difference != 0 && point_elements[i].opacity > 0) { - drawstring([pwidth - point_elements[i].string_width - point_elements[i].x_position, + Draw_String([pwidth - point_elements[i].string_width - point_elements[i].x_position, point_elements[i].y_position], point_elements[i].text_string, [12, 12], POINT_DIFF_COLOR, point_elements[i].opacity, 0); } @@ -332,15 +328,15 @@ void(float width, float height) HUD_Points = default: TEXTCOLOR = [1, 1, 1]; break; } - pointwidth = stringwidth(ftos(client.points), 0, [12, 12]); + pointwidth = getTextWidth(ftos(client.points), 12); x = (99 - pointwidth)/2 + GetUltraWideOffset(); if ((i + 1) == getstatf(STAT_PLAYERNUM)) { drawpic([3 + GetUltraWideOffset(), g_height - 97 - (i * 25)], "gfx/hud/moneyback.tga", [96, 24], [1,1,1], 1); - drawstring([x, g_height - 92 - (i * 25)], ftos(client.points), [12, 12], TEXTCOLOR, 1, 0); + Draw_String([x, g_height - 92 - (i * 25)], ftos(client.points), [12, 12], TEXTCOLOR, 1, 0); } else { drawpic([-7 + GetUltraWideOffset(), g_height - 97 - (i * 25)], "gfx/hud/moneyback_condensed.tga", [96, 24], [1,1,1], 1); - drawstring([x - 9, g_height - 92 - (i * 25)], ftos(client.points), [12, 12], TEXTCOLOR, 1, 0); + Draw_String([x - 9, g_height - 92 - (i * 25)], ftos(client.points), [12, 12], TEXTCOLOR, 1, 0); } PointUpdate(x + 70, width, height, i + 1); @@ -360,7 +356,7 @@ void(float width, float height) HUD_CharacterName = alpha = (nameprint_time - time); } - drawstring([x, height - 92 - ((getstatf(STAT_PLAYERNUM) - 1) * 25)], character_name, [12, 12], [1, 1, 1], alpha, 0); + Draw_String([x, height - 92 - ((getstatf(STAT_PLAYERNUM) - 1) * 25)], character_name, [12, 12], [1, 1, 1], alpha, 0); } /******************* @@ -389,11 +385,11 @@ void(float width, float height) HUD_Grenades = betties_text_color = [1, 1, 1]; drawpic([g_width - 3 - 56 - GetUltraWideOffset(), g_height - 50], "gfx/hud/frag.tga", [32, 32], [1, 1, 1], 1); - drawstring([g_width - 3 - 38 - GetUltraWideOffset(), g_height - 29], ftos(grenades), [12, 12], grenade_text_color, 1, 0); + Draw_String([g_width - 3 - 38 - GetUltraWideOffset(), g_height - 29], ftos(grenades), [12, 12], grenade_text_color, 1, 0); if (betties != -1) { drawpic([g_width - 3 - 28 - GetUltraWideOffset(), g_height - 50], "gfx/hud/betty.tga", [32, 32], [1, 1, 1], 1); - drawstring([g_width - 3 - 10 - GetUltraWideOffset(), g_height - 29], ftos(betties), [12, 12], betties_text_color, 1, 0); + Draw_String([g_width - 3 - 10 - GetUltraWideOffset(), g_height - 29], ftos(betties), [12, 12], betties_text_color, 1, 0); } } @@ -446,8 +442,8 @@ void(float width, float height) HUD_Rounds = ralpha = 1; } - pwidth = stringwidth("Round", 0, [24, 24])/2; - drawstring([(g_width/2) - pwidth, g_height/2 - 70], "Round", [24, 24], [1, rcolor, rcolor], ralpha, 0); + pwidth = getTextWidth("Round", 24)/2; + Draw_String([(g_width/2) - pwidth, g_height/2 - 70], "Round", [24, 24], [1, rcolor, rcolor], ralpha, 0); rcolor -= frametime/2.5; if (rcolor < 0) { @@ -466,10 +462,10 @@ void(float width, float height) HUD_Rounds = } } - drawstring([3 + GetUltraWideOffset(), g_height/2 + 24], chaptertitle, [12, 12], [1, 1, 1], localpha, 0); - drawstring([3 + GetUltraWideOffset(), g_height/2 + 36], location, [12, 12], [1, 1, 1], localpha, 0); - drawstring([3 + GetUltraWideOffset(), g_height/2 + 48], date, [12, 12], [1, 1, 1], localpha, 0); - drawstring([3 + GetUltraWideOffset(), g_height/2 + 60], person, [12, 12], [1, 1, 1], localpha, 0); + Draw_String([3 + GetUltraWideOffset(), g_height/2 + 24], chaptertitle, [12, 12], [1, 1, 1], localpha, 0); + Draw_String([3 + GetUltraWideOffset(), g_height/2 + 36], location, [12, 12], [1, 1, 1], localpha, 0); + Draw_String([3 + GetUltraWideOffset(), g_height/2 + 48], date, [12, 12], [1, 1, 1], localpha, 0); + Draw_String([3 + GetUltraWideOffset(), g_height/2 + 60], person, [12, 12], [1, 1, 1], localpha, 0); } if (rounds_change == 1)//this is the rounds icon at the middle of the screen @@ -961,99 +957,99 @@ void(float width, float height) HUD_Useprint = usestring = ""; break; case 1://door - usestring = strcat("Hold ",usespace, " to open Door"); - usecost = strcat("[Cost:", ftos(useprint_cost), "]"); + usestring = strcat("Hold ",usespace, " to open Door"); + usecost = strcat("[Cost: ", ftos(useprint_cost), "]"); break; case 2://debris - usestring = strcat("Hold ",usespace, " to remove Debris"); - usecost = strcat("[Cost:", ftos(useprint_cost), "]"); + usestring = strcat("Hold ",usespace, " to remove Debris"); + usecost = strcat("[Cost: ", ftos(useprint_cost), "]"); break; case 3://ammo - usestring = strcat("Hold ",usespace, " to buy Ammo for ", GetWeaponName(useprint_weapon)); - usecost = strcat("[Cost:", ftos(useprint_cost), "]"); + usestring = strcat("Hold ",usespace, " to buy Ammo for ", GetWeaponName(useprint_weapon)); + usecost = strcat("[Cost: ", ftos(useprint_cost), "]"); break; case 4://weapon - usestring = strcat("Hold ",usespace, " to buy ", GetWeaponName(useprint_weapon)); - usecost = strcat("[Cost:", ftos(useprint_cost), "]"); + usestring = strcat("Hold ",usespace, " to buy ", GetWeaponName(useprint_weapon)); + usecost = strcat("[Cost: ", ftos(useprint_cost), "]"); break; case 5://window - usestring = strcat("Hold ",usespace, " to Rebuild Barrier"); + usestring = strcat("Hold ",usespace, " to Rebuild Barrier"); break; case 6://box - usestring = strcat("Hold ",usespace, " for Mystery Box"); - usecost = strcat("[Cost:", ftos(useprint_cost), "]"); + usestring = strcat("Hold ",usespace, " for Mystery Box"); + usecost = strcat("[Cost: ", ftos(useprint_cost), "]"); break; case 7://box take - usestring = strcat("Hold ",usespace, " for ", GetWeaponName(useprint_weapon)); + usestring = strcat("Hold ",usespace, " for ", GetWeaponName(useprint_weapon)); break; case 8://power usestring = "The Power must be Activated first"; break; case 9://perk - usestring = strcat("Hold ",usespace, " to buy ", GetPerkName(useprint_weapon)); - usecost = strcat("[Cost:", ftos(useprint_cost), "]"); + usestring = strcat("Hold ",usespace, " to buy ", GetPerkName(useprint_weapon)); + usecost = strcat("[Cost: ", ftos(useprint_cost), "]"); break; case 10://turn on power - usestring = strcat("Hold ",usespace, " to Turn On the Power"); + usestring = strcat("Hold ",usespace, " to Turn On the Power"); break; case 11://turn on trap - usestring = strcat("Hold ",usespace, " to Activate the Trap"); - usecost = strcat("[Cost:", ftos(useprint_cost), "]"); + usestring = strcat("Hold ",usespace, " to Activate the Trap"); + usecost = strcat("[Cost: ", ftos(useprint_cost), "]"); break; case 12://packapunch - usestring = strcat("Hold ",usespace, " to Pack-a-Punch"); - usecost = strcat("[Cost:", ftos(useprint_cost), "]"); + usestring = strcat("Hold ",usespace, " to Pack-a-Punch"); + usecost = strcat("[Cost: ", ftos(useprint_cost), "]"); break; case 13://revive - usestring = strcat("Hold ",usespace, " to Revive Player"); + usestring = strcat("Hold ",usespace, " to Revive Player"); break; case 14://use teleporter (free) - usestring = strcat("Hold ", usespace, " to use Teleporter"); + usestring = strcat("Hold ", usespace, " to use Teleporter"); break; case 15://use teleporter (cost) - usestring = strcat("Hold ", usespace, " to use Teleporter"); - usecost = strcat("[Cost:", ftos(useprint_cost), "]"); + usestring = strcat("Hold ", usespace, " to use Teleporter"); + usecost = strcat("[Cost: ", ftos(useprint_cost), "]"); break; case 16://tp cooldown usestring = "Teleporter is cooling down"; break; case 17://link - usestring = strcat("Hold ", usespace, " to initate link to pad"); + usestring = strcat("Hold ", usespace, " to initate link to pad"); break; case 18://no link usestring = "Link not active"; break; case 19://finish link - usestring = strcat("Hold ", usespace, " to link pad with core"); + usestring = strcat("Hold ", usespace, " to link pad with core"); break; case 20://buyable ending - usestring = strcat("Hold ", usespace, " to End the Game"); - usecost = strcat("[Cost:", ftos(useprint_cost), "]"); + usestring = strcat("Hold ", usespace, " to End the Game"); + usecost = strcat("[Cost: ", ftos(useprint_cost), "]"); break; default: usestring = "This should not happen you dum fuck"; //yikes break; } - print_width = stringwidth (usestring, 0, [12, 12]); + print_width = getTextWidth(usestring, 12); x = (width - print_width)/2; - drawstring([x, g_height/2 + 65, 0], usestring, [12, 12, 0], [1, 1, 1], 1, 0); + Draw_String([x, g_height/2 + 65, 0], usestring, [12, 12, 0], [1, 1, 1], 1, 0); // Draw "Cost" text. if (usecost != "") { - float cost_width = stringwidth(usecost, 0, [12, 12]); + float cost_width = getTextWidth(usecost, 12); float x3 = (width - cost_width)/2; - drawstring([x3, g_height/2 + 78, 0], usecost, [12, 12, 0], [1, 1, 1], 1, 0); + Draw_String([x3, g_height/2 + 78, 0], usecost, [12, 12, 0], [1, 1, 1], 1, 0); } // Draw highlighted usebutton if (substring(usestring, 0, 4) == "Hold") { - button_width = x + stringwidth ("Hold ", 0, [12, 12, 0]); + button_width = x + getTextWidth("Hold ", 12); if (Key_IsControllerGlyph(usebutton)) Key_DrawControllerGlyph([button_width - 5, g_height/2 + 60], usebutton, [22, 22]); else - drawstring([button_width, g_height/2 + 65, 0], usebutton, [12, 12, 0], [1, 1, 0], 1, 0); + Draw_String([button_width, g_height/2 + 65, 0], usebutton, [12, 12, 0], [1, 1, 0], 1, 0); } } @@ -1177,8 +1173,8 @@ void(float width, float height) HUD_Weaponstring = { string weaponstring; weaponstring = GetWeaponName(getstatf(STAT_ACTIVEWEAPON)); - float x = g_width - 62 - stringwidth(weaponstring, 0, [12, 12]); - drawstring([x - GetUltraWideOffset(), g_height - 49], weaponstring, [12, 12], [1, 1, 1], 1, 0); + float x = g_width - 62 - getTextWidth(weaponstring, 12); + Draw_String([x - GetUltraWideOffset(), g_height - 49], weaponstring, [12, 12], [1, 1, 1], 1, 0); } /********************* @@ -1211,19 +1207,19 @@ void(float width, float height) HUD_BouncingBetty = activate_string = strcat("Press ", betty_space, " to place a"); activate_string2 = "Bouncing Betty"; - top_x = (g_width/2) - (stringwidth(activate_string, 0, [12, 12])/2); - bot_x = (g_width/2) - (stringwidth(activate_string2, 0, [12, 12])/2); + top_x = (g_width/2) - (getTextWidth(activate_string, 12)/2); + bot_x = (g_width/2) - (getTextWidth(activate_string2, 12)/2); - drawstring([top_x, g_height - 303], activate_string, [12, 12], [1, 1, 1], 1, 0); - drawstring([bot_x, g_height - 289], activate_string2, [12, 12], [1, 1, 1], 1, 0); + Draw_String([top_x, g_height - 303], activate_string, [12, 12], [1, 1, 1], 1, 0); + Draw_String([bot_x, g_height - 289], activate_string2, [12, 12], [1, 1, 1], 1, 0); // Draw the highlighted button - but_x = top_x + stringwidth("Press ", 0, [12, 12, 0]); + but_x = top_x + getTextWidth("Press ", 12); if (Key_IsControllerGlyph(betty_key)) Key_DrawControllerGlyph([but_x - 5, g_height - 308], betty_key, [22, 22]); else - drawstring([but_x, g_height - 303], betty_key, [12, 12], [1, 1, 0], 1, 0); + Draw_String([but_x, g_height - 303], betty_key, [12, 12], [1, 1, 0], 1, 0); } /******************* @@ -1250,9 +1246,8 @@ void(float width, float height) HUD_Progressbar = drawfill ([bar_x - 1, bar_y - 1, 0], [bar_width+2, bar_height, 0], [0, 0, 0], 0.4, 0); drawfill ([bar_x, bar_y, 0], [bar_width * percent, bar_height-2, 0], [1, 1, 1], 0.4, 0); - - float x = (g_width/2) - (stringwidth("Reviving...", 0, [12, 12])/2); - drawstring([x, g_height - 105], "Reviving...", [12, 12], [1, 1, 1], 1, 0); + float x = (g_width/2) - (getTextWidth("Reviving...", 12)/2); + Draw_String([x, g_height - 105], "Reviving...", [12, 12], [1, 1, 1], 1, 0); } /******************* @@ -1382,8 +1377,8 @@ void() Draw_Crosshair = } // Area of Effect (o) else if (crosshair_value == 2) { - float circle_offset = stringwidth("O", 0, [14, 14])/2; - drawstring([g_width/2 - circle_offset, g_height/2 - circle_offset], "O", [14, 14], crosshair_color, 1, 0); + float circle_offset = getTextWidth("O", 14)/2; + Draw_String([g_width/2 - circle_offset, g_height/2 - circle_offset], "O", [14, 14], crosshair_color, 1, 0); } // Dot crosshair (.) else if (crosshair_value == 3) { @@ -1461,11 +1456,11 @@ void() HUD_Broadcast = break; } - float print_width = stringwidth (broadcast_msg, 0, [0.015*g_width, 0.015*g_width, 0]); + float print_width = getTextWidth(broadcast_msg, 0.015*g_width); float x = (g_width - print_width)/2; if (broadcast_msg != "") - drawstring([x, g_height/2, 0], broadcast_msg, [0.015*g_width, 0.015*g_width, 0], [1, 1, 1], 1, 0); + Draw_String([x, g_height/2, 0], broadcast_msg, [0.015*g_width, 0.015*g_width, 0], [1, 1, 1], 1, 0); }; void() HUD_Scores = @@ -1476,8 +1471,8 @@ void() HUD_Scores = if(serverkey("constate") != "disconnected") { // Headers - drawstring([g_width/2 + 15, 175], "Points", [12, 12], TEXTCOLOR, 1, 0); - drawstring([g_width/2 + 170, 175], "Kills", [12, 12], TEXTCOLOR, 1, 0); + Draw_String([g_width/2 + 15, 175], "Points", [12, 12], TEXTCOLOR, 1, 0); + Draw_String([g_width/2 + 170, 175], "Kills", [12, 12], TEXTCOLOR, 1, 0); for (int i = 0; i < 4; i = i + 1) { @@ -1512,17 +1507,17 @@ void() HUD_Scores = // Name string player_name = getplayerkeyvalue(i, "name"); - drawstring([g_width/2 - 245, 200 + (30 * i)], player_name, [12, 12], TEXTCOLOR, 1, 0); + Draw_String([g_width/2 - 245, 200 + (30 * i)], player_name, [12, 12], TEXTCOLOR, 1, 0); // Points - float point_width = stringwidth(ftos(client.points), 0, [12, 12]); + float point_width = getTextWidth(ftos(client.points), 12); float point_x = ((g_width/2) - (point_width)/2) + 52; - drawstring([point_x, 200 + (30 * i)], ftos(client.points), [12, 12], TEXTCOLOR, 1, 0); + Draw_String([point_x, 200 + (30 * i)], ftos(client.points), [12, 12], TEXTCOLOR, 1, 0); // Kills - float kill_width = stringwidth(ftos(client.points), 0, [12, 12]); + float kill_width = getTextWidth(ftos(client.kills), 12); float kill_x = ((g_width/2) - (kill_width)/2) + 210; - drawstring([kill_x, 200 + (30 * i)], ftos(client.kills), [12, 12], TEXTCOLOR, 1, 0); + Draw_String([kill_x, 200 + (30 * i)], ftos(client.kills), [12, 12], TEXTCOLOR, 1, 0); } } } @@ -1539,11 +1534,11 @@ void() HUD_Endgame = { survive = strcat("You Survived ", ftos(rounds), round); - float game_over_width = stringwidth(game_over, 0, [24, 24]); - drawstring([g_width/2 - game_over_width/2, 100], game_over, [24, 24], [1, 1, 1], 1, 0); + float game_over_width = getTextWidth(game_over, 24); + Draw_String([g_width/2 - game_over_width/2, 100], game_over, [24, 24], [1, 1, 1], 1, 0); - float survive_width = stringwidth(survive, 0, [18, 18]); - drawstring([g_width/2 - survive_width/2, 135], survive, [18, 18], [1, 1, 1], 1, 0); + float survive_width = getTextWidth(survive, 18); + Draw_String([g_width/2 - survive_width/2, 135], survive, [18, 18], [1, 1, 1], 1, 0); HUD_Scores(); } @@ -1604,7 +1599,7 @@ void(float width, float height) HUD_MaxAmmo = float text_alpha = 1; - float string_width = stringwidth(maxammo_string, 0, [14, 14]); + float string_width = getTextWidth(maxammo_string, 14); float pos_x = (width - string_width)/2; float pos_y; @@ -1629,7 +1624,7 @@ void(float width, float height) HUD_MaxAmmo = text_alpha = 1 - percent_time; } - drawstring([pos_x, pos_y, 0], maxammo_string, [14, 14], [1, 1, 1], text_alpha, 0); + Draw_String([pos_x, pos_y, 0], maxammo_string, [14, 14], [1, 1, 1], text_alpha, 0); }; float achievement_init; @@ -1650,8 +1645,8 @@ void(float width, float height) HUD_Achievements = { } - drawstring([0.2*width, achievement_ypos*height, 0], "ACHIEVEMENT GET!", [0.015*width, 0.015*width, 0], [1, 1, 0], 1, 0); - drawstring([0.2*width, achievement_desc_ypos*height, 0], achievements[active_achievement].name, [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); + Draw_String([0.2*width, achievement_ypos*height, 0], "ACHIEVEMENT GET!", [0.015*width, 0.015*width, 0], [1, 1, 0], 1, 0); + Draw_String([0.2*width, achievement_desc_ypos*height, 0], achievements[active_achievement].name, [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); drawpic([0.005*width, achievement_img_ypos*height,0], achievements[active_achievement].img, [0.16*width, 0.08*width, 0], [1,1,1], 1); if (achievement_time <= 120) { @@ -1695,16 +1690,16 @@ string(float index) GetButtonString = void(float width, float height) HUD_Waypoint = { - drawstring([0.015*width, 0.015*height, 0], "WAYPOINT MODE", [0.030*width, 0.030*width, 0], [1, 1, 1], 1, 0); + Draw_String([0.015*width, 0.015*height, 0], "WAYPOINT MODE", [0.030*width, 0.030*width, 0], [1, 1, 1], 1, 0); drawfill([0.015*width, 0.035*height + height*0.035, 0], [strlen("WAYPOINT MODE")*0.030*width, 0.005*width, 0], [1, 1,1], 1, 0); - drawstring([0.015*width, 0.095*height, 0], strcat("Press ", GetButtonString(100), " to Create a Waypoint"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); - drawstring([0.015*width, 0.125*height, 0], strcat("Press ", GetButtonString(9), " to Select a Waypoint"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); - drawstring([0.015*width, 0.155*height, 0], strcat("Press ", GetButtonString(101), " to Link a Waypoint"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); - drawstring([0.015*width, 0.185*height, 0], strcat("Press ", GetButtonString(11), " to Remove a Waypoint"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); - drawstring([0.015*width, 0.215*height, 0], strcat("Press ", GetButtonString(7), " to Move a Waypoint Here"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); - drawstring([0.015*width, 0.245*height, 0], strcat("Press ", GetButtonString(10), " to Create a Special Waypoint"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); - drawstring([0.015*width, 0.275*height, 0], strcat("Press ", "=", " to load map waypoints"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); - drawstring([0.015*width, 0.305*height, 0], strcat("Press ", "-", " to save current waypoints"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); + Draw_String([0.015*width, 0.095*height, 0], strcat("Press ", GetButtonString(100), " to Create a Waypoint"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); + Draw_String([0.015*width, 0.125*height, 0], strcat("Press ", GetButtonString(9), " to Select a Waypoint"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); + Draw_String([0.015*width, 0.155*height, 0], strcat("Press ", GetButtonString(101), " to Link a Waypoint"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); + Draw_String([0.015*width, 0.185*height, 0], strcat("Press ", GetButtonString(11), " to Remove a Waypoint"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); + Draw_String([0.015*width, 0.215*height, 0], strcat("Press ", GetButtonString(7), " to Move a Waypoint Here"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); + Draw_String([0.015*width, 0.245*height, 0], strcat("Press ", GetButtonString(10), " to Create a Special Waypoint"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); + Draw_String([0.015*width, 0.275*height, 0], strcat("Press ", "=", " to load map waypoints"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); + Draw_String([0.015*width, 0.305*height, 0], strcat("Press ", "-", " to save current waypoints"), [0.015*width, 0.015*width, 0], [1, 1, 1], 1, 0); } void(float width, float height) HUD_PlayerNames = @@ -1736,7 +1731,7 @@ void(float width, float height) HUD_PlayerNames = if (player_origin == '0 0 48') continue; - screen_position_x -= stringwidth(text, 0, [8, 8])/2; + screen_position_x -= getTextWidth(text, 8)/2; switch(i) { case 1: text_color = TEXT_LIGHTBLUE; break; @@ -1746,7 +1741,7 @@ void(float width, float height) HUD_PlayerNames = } if (screen_position_z > 0) - drawstring(screen_position, text, [8, 8], text_color, 1, 0); + Draw_String(screen_position, text, [8, 8], text_color, 1, 0); } } @@ -1814,7 +1809,7 @@ void(float width, float height) HUD_StopWatch = stopwatch = strcat(hr, ":", min, ":", sec); - drawstring([width - (strlen(stopwatch) * 12) - 2, 2], stopwatch, [12, 12], TEXT_ORANGE, 1, 0); + Draw_String([width - (getTextWidth(stopwatch, 12)) - 2, 2], stopwatch, [12, 12], TEXT_ORANGE, 1, 0); } void(float width, float height) HUD_RoundStopWatch = @@ -1834,7 +1829,7 @@ void(float width, float height) HUD_RoundStopWatch = stopwatch = strcat(hr, ":", min, ":", sec); - drawstring([width - (strlen(stopwatch) * 12) - 2, 16], stopwatch, [12, 12], [1, 1, 1], 1, 0); + Draw_String([width - (getTextWidth(stopwatch, 12)) - 2, 16], stopwatch, [12, 12], [1, 1, 1], 1, 0); } /******************* diff --git a/source/client/main.qc b/source/client/main.qc index 98be78e..facd443 100644 --- a/source/client/main.qc +++ b/source/client/main.qc @@ -190,6 +190,8 @@ noref void(float apiver, string enginename, float enginever) CSQC_Init = for(float i = 0; i < zombie_skins.length; i++) { deltalisten(zombie_skins[i], SetZombieSkinning, 0); } + + InitKerningMap(); }; noref void() CSQC_WorldLoaded = diff --git a/source/client/menu.qc b/source/client/menu.qc index 5e02e31..a6e394c 100644 --- a/source/client/menu.qc +++ b/source/client/menu.qc @@ -1090,14 +1090,14 @@ void(float index) Update_Button = if (buttons[index].gray_out == 0) { if(buttons[index].active > 0) { - drawstring(pos, buttons[index].text, [14, 14], [1, 0, 0], 1, 0); + Draw_String(pos, buttons[index].text, [14, 14], [1, 0, 0], 1, 0); } else { - drawstring(pos, buttons[index].text, [14, 14], [1, 1, 1], 1, 0); + Draw_String(pos, buttons[index].text, [14, 14], [1, 1, 1], 1, 0); } } else { - drawstring(pos, buttons[index].text, [14, 14], [0.25, 0.25, 0.25], 1, 0); + Draw_String(pos, buttons[index].text, [14, 14], [0.25, 0.25, 0.25], 1, 0); } - + if (cursor_pos_x > pos_x && cursor_pos_x < pos_x + 300 && cursor_pos_y > pos_y && cursor_pos_y < pos_y + 14 && buttons[index].gray_out == 0) { if (index != lastActive) @@ -1214,7 +1214,7 @@ void() Draw_Extra_Main = } // Draw desc - drawstring([6, g_height - 42, 0], main_desc, [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, g_height - 42, 0], main_desc, [12, 12], [1, 1, 1], 1, 0); // Social Links // Discord doesn't allow permanant invites anymore, "bummer".. @@ -1235,8 +1235,8 @@ void() Draw_Extra_Main = advert_text = "patreon.com/cypressimplex"; } - drawfill([cursor_pos_x - (strlen(advert_text) * 10) - 5, cursor_pos_y + 2], [strlen(advert_text) * 10, 10], [0, 0, 0], 0.90); - drawstring([cursor_pos_x - (strlen(advert_text) * 10) - 5, cursor_pos_y + 2], advert_text, [10, 10], [1, 1, 0], 1, 0); + drawfill([cursor_pos_x - (getTextWidth(advert_text, 10)) - 5, cursor_pos_y + 2], [getTextWidth(advert_text, 10), 10], [0, 0, 0], 0.90); + Draw_String([cursor_pos_x - (getTextWidth(advert_text, 10)) - 5, cursor_pos_y + 2], advert_text, [10, 10], [1, 1, 0], 1, 0); } } @@ -1246,11 +1246,11 @@ void() Draw_Extra_Join = // Server ID drawfill ([318, 73], [14 * 19, 18], [0.07, 0.07, 0.07], 0.5, 0); - drawstring([320, 75], temp_server_name, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 75], temp_server_name, [14, 14], [1, 1, 1], 1, 0); // Draw a cute little guy so user knows they're editing their name. if (editing_server_id) { - drawstring([320 + (strlen(temp_server_name)*14), 75], "_", [14, 14], [1, 1, 0], 1, 0); + Draw_String([320 + (strlen(temp_server_name)*14), 75], "_", [14, 14], [1, 1, 0], 1, 0); } // Password @@ -1260,11 +1260,11 @@ void() Draw_Extra_Join = safe_password = sprintf("%s%s", safe_password, "*"); } drawfill ([318, 93], [14 * 19, 18], [0.07, 0.07, 0.07], 0.5, 0); - drawstring([320, 95], safe_password, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 95], safe_password, [14, 14], [1, 1, 1], 1, 0); // Draw a cute little guy for password if (editing_password) { - drawstring([320 + (strlen(temp_password)*14), 95], "_", [14, 14], [1, 1, 0], 1, 0); + Draw_String([320 + (strlen(temp_password)*14), 95], "_", [14, 14], [1, 1, 0], 1, 0); } // Descriptions @@ -1284,7 +1284,7 @@ void() Draw_Extra_Join = } // Draw desc - drawstring([6, g_height - 42, 0], join_desc, [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, g_height - 42, 0], join_desc, [12, 12], [1, 1, 1], 1, 0); } void() Draw_Extra_Create = @@ -1299,20 +1299,20 @@ void() Draw_Extra_Create = } drawfill ([318, 73], [14 * 19, 18], [0.07, 0.07, 0.07], 0.5, 0); - drawstring([320, 75], safe_password, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 75], safe_password, [14, 14], [1, 1, 1], 1, 0); // Draw a cute little guy for password if (editing_password) { - drawstring([320 + (strlen(temp_hostname)*14), 75], "_", [14, 14], [1, 1, 0], 1, 0); + Draw_String([320 + (strlen(temp_hostname)*14), 75], "_", [14, 14], [1, 1, 0], 1, 0); } // hostname drawfill ([318, 93], [14 * 19, 18], [0.07, 0.07, 0.07], 0.5, 0); - drawstring([320, 95], temp_hostname, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 95], temp_hostname, [14, 14], [1, 1, 1], 1, 0); // Draw a cute little guy for hostname if (editing_hostname) { - drawstring([320 + (strlen(temp_hostname)*14), 95], "_", [14, 14], [1, 1, 0], 1, 0); + Draw_String([320 + (strlen(temp_hostname)*14), 95], "_", [14, 14], [1, 1, 0], 1, 0); } // Descriptions @@ -1332,7 +1332,7 @@ void() Draw_Extra_Create = } // Draw desc - drawstring([6, g_height - 42, 0], crea_desc, [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, g_height - 42, 0], crea_desc, [12, 12], [1, 1, 1], 1, 0); } void() Draw_Extra_Coop = @@ -1341,11 +1341,11 @@ void() Draw_Extra_Coop = // Player Name drawfill ([318, 73], [14 * 19, 18], [0.07, 0.07, 0.07], 0.5, 0); - drawstring([320, 75], temp_player_name, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 75], temp_player_name, [14, 14], [1, 1, 1], 1, 0); // Draw a cute little guy so user knows they're editing their name. if (editing_player_name) { - drawstring([320 + (strlen(temp_player_name)*14), 75], "_", [14, 14], [1, 1, 0], 1, 0); + Draw_String([320 + (strlen(temp_player_name)*14), 75], "_", [14, 14], [1, 1, 0], 1, 0); } // Division lines @@ -1368,7 +1368,7 @@ void() Draw_Extra_Coop = } // Draw desc - drawstring([6, g_height - 42, 0], coop_desc, [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, g_height - 42, 0], coop_desc, [12, 12], [1, 1, 1], 1, 0); } void() Draw_Extra_Solo = @@ -1437,14 +1437,14 @@ void() Draw_Extra_Solo = drawpic([g_width - 340 - 6, 75], solo_img, [300, 170], [1, 1, 1], 1); // Draw desc - drawstring([g_width - 360, 250, 0], solo_desc, [11, 11], [1, 1, 1], 1, 0); - drawstring([g_width - 360, 265, 0], solo_desc2, [11, 11], [1, 1, 1], 1, 0); - drawstring([g_width - 360, 280, 0], solo_desc3, [11, 11], [1, 1, 1], 1, 0); - drawstring([g_width - 360, 295, 0], solo_desc4, [11, 11], [1, 1, 1], 1, 0); - drawstring([g_width - 360, 310, 0], solo_desc5, [11, 11], [1, 1, 1], 1, 0); - drawstring([g_width - 360, 325, 0], solo_desc6, [11, 11], [1, 1, 1], 1, 0); - drawstring([g_width - 360, 340, 0], solo_desc7, [11, 11], [1, 1, 1], 1, 0); - drawstring([g_width - 360, 355, 0], solo_desc8, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 340, 250, 0], solo_desc, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 340, 265, 0], solo_desc2, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 340, 280, 0], solo_desc3, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 340, 295, 0], solo_desc4, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 340, 310, 0], solo_desc5, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 340, 325, 0], solo_desc6, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 340, 340, 0], solo_desc7, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 340, 355, 0], solo_desc8, [11, 11], [1, 1, 1], 1, 0); } void() Draw_Extra_Settings = @@ -1471,37 +1471,37 @@ void() Draw_Extra_Settings = } // Draw desc - drawstring([6, g_height - 42, 0], set_desc, [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, g_height - 42, 0], set_desc, [12, 12], [1, 1, 1], 1, 0); } void() Draw_Extra_Credits = { - drawstring([6, 65], "Programming:", [12, 12], TEXT_ORANGE, 1, 0); - drawstring([6, 85], "Blubs, Jukki, DR_Mabuse1981, Naievil", [12, 12], [1, 1, 1], 1, 0); - drawstring([6, 105], "Cypress, ScatterBox", [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, 65], "Programming:", [12, 12], TEXT_ORANGE, 1, 0); + Draw_String([6, 85], "Blubs, Jukki, DR_Mabuse1981, Naievil", [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, 105], "Cypress, ScatterBox", [12, 12], [1, 1, 1], 1, 0); - drawstring([6, 130], "Models:", [12, 12], TEXT_ORANGE, 1, 0); - drawstring([6, 150], "Blubs, Ju[s]tice, Derped_Crusader", [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, 130], "Models:", [12, 12], TEXT_ORANGE, 1, 0); + Draw_String([6, 150], "Blubs, Ju[s]tice, Derped_Crusader", [12, 12], [1, 1, 1], 1, 0); - drawstring([6, 175], "GFX:", [12, 12], TEXT_ORANGE, 1, 0); - drawstring([6, 195], "Blubs, Ju[s]tice, Cypress, Derped_Crusader", [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, 175], "GFX:", [12, 12], TEXT_ORANGE, 1, 0); + Draw_String([6, 195], "Blubs, Ju[s]tice, Cypress, Derped_Crusader", [12, 12], [1, 1, 1], 1, 0); - drawstring([6, 220], "Sounds/Music:", [12, 12], TEXT_ORANGE, 1, 0); - drawstring([6, 240], "Blubs, Biodude, Cypress, Marty P.", [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, 220], "Sounds/Music:", [12, 12], TEXT_ORANGE, 1, 0); + Draw_String([6, 240], "Blubs, Biodude, Cypress, Marty P.", [12, 12], [1, 1, 1], 1, 0); - drawstring([6, 265], "Special Thanks:", [12, 12], TEXT_ORANGE, 1, 0); - drawstring([6, 285], "- Spike, Eukara: FTEQW", [12, 12], [1, 1, 1], 1, 0); - drawstring([6, 305], "- Shpuld: CleanQC4FTE", [12, 12], [1, 1, 1], 1, 0); - drawstring([6, 325], "- Crow_Bar, st1x51: dQuake(plus)", [12, 12], [1, 1, 1], 1, 0); - drawstring([6, 345], "- fgsfdsfgs: Quakespasm-NX", [12, 12], [1, 1, 1], 1, 0); - drawstring([6, 365], "- MasterFeizz: ctrQuake", [12, 12], [1, 1, 1], 1, 0); - drawstring([6, 385], "- Rinnegatamante: Initial VITA Port & Updater", [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, 265], "Special Thanks:", [12, 12], TEXT_ORANGE, 1, 0); + Draw_String([6, 285], "- Spike, Eukara: FTEQW", [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, 305], "- Shpuld: CleanQC4FTE", [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, 325], "- Crow_Bar, st1x51: dQuake(plus)", [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, 345], "- fgsfdsfgs: Quakespasm-NX", [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, 365], "- MasterFeizz: ctrQuake", [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, 385], "- Rinnegatamante: Initial VITA Port & Updater", [12, 12], [1, 1, 1], 1, 0); } void() Draw_Extra_Restart = { - drawstring([0.025*g_width, 0.375*g_height, 0], "Are you sure you want to restart?", [g_height * 0.020, g_height * 0.020, 1], [0.8,0.8,0.8], 1, 0); - drawstring([0.02*g_width, 0.425*g_height, 0], "Your current progress will be lost!", [g_height * 0.020, g_height * 0.020, 1], [0.8,0.8,0.8], 1, 0); + Draw_String([0.025*g_width, 0.375*g_height, 0], "Are you sure you want to restart?", [g_height * 0.020, g_height * 0.020, 1], [0.8,0.8,0.8], 1, 0); + Draw_String([0.02*g_width, 0.425*g_height, 0], "Your current progress will be lost!", [g_height * 0.020, g_height * 0.020, 1], [0.8,0.8,0.8], 1, 0); } void() Draw_Extra_CSettings = @@ -1514,24 +1514,24 @@ void() Draw_Extra_CSettings = // ADS Mode if (button8_key == "MOUSE2") - drawstring([320, 75], "HOLD", [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 75], "HOLD", [14, 14], [1, 1, 1], 1, 0); else - drawstring([320, 75], "TOGGLE", [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 75], "TOGGLE", [14, 14], [1, 1, 1], 1, 0); // Look Sensitivity - drawstring([320, 95], ftos(cvar("sensitivity")), [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 95], ftos(cvar("sensitivity")), [14, 14], [1, 1, 1], 1, 0); // Mouse Inversion if (cvar("m_pitch") == 0.022) - drawstring([320, 115], S_DISABLED, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 115], S_DISABLED, [14, 14], [1, 1, 1], 1, 0); else - drawstring([320, 115], S_ENABLED, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 115], S_ENABLED, [14, 14], [1, 1, 1], 1, 0); // Rumble if (cvar("in_rumbleenabled") == 0) - drawstring([320, 155], S_DISABLED, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 155], S_DISABLED, [14, 14], [1, 1, 1], 1, 0); else - drawstring([320, 155], S_ENABLED, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 155], S_ENABLED, [14, 14], [1, 1, 1], 1, 0); // Controller Glyphs string controller_glyph_brand = "Unknown"; @@ -1552,20 +1552,20 @@ void() Draw_Extra_CSettings = controller_glyph_brand = sprintf("User (\"%s\")", cvar_string("cl_controllerglyphs")); break; } - drawstring([320, 135], controller_glyph_brand, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 135], controller_glyph_brand, [14, 14], [1, 1, 1], 1, 0); drawsubpic([325 + strlen(controller_glyph_brand)*14, 132], [80, 20], sprintf("gfx/controller_glyphs/%s.tga", cvar_string("cl_controllerglyphs")), [0, 0], [0.5, 0.125], [1, 1, 1], 1); // Gamepad if (gamepad_enabled == 0) - drawstring([320, 175], S_DISABLED, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 175], S_DISABLED, [14, 14], [1, 1, 1], 1, 0); else - drawstring([320, 175], S_ENABLED, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 175], S_ENABLED, [14, 14], [1, 1, 1], 1, 0); // Aim Assist if (cvar("in_aimassist") == 0) - drawstring([320, 195], S_DISABLED, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 195], S_DISABLED, [14, 14], [1, 1, 1], 1, 0); else - drawstring([320, 195], S_ENABLED, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 195], S_ENABLED, [14, 14], [1, 1, 1], 1, 0); // Descriptions switch(lastActive) { @@ -1599,7 +1599,7 @@ void() Draw_Extra_CSettings = drawfill ([6, g_height - 85], [270, 4], [0.5, 0.5, 0.5], 1, 0); // Draw desc - drawstring([6, g_height - 42, 0], cset_desc, [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, g_height - 42, 0], cset_desc, [12, 12], [1, 1, 1], 1, 0); } void() Draw_Extra_GSettings = @@ -1641,13 +1641,13 @@ void() Draw_Extra_GSettings = arval = "ERR"; break; } - drawstring([320, 115], arval, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 115], arval, [14, 14], [1, 1, 1], 1, 0); } else { // Render Scale resval = strcat(itos(ftoi(cvar("r_renderscale")*100)), "%"); } - drawstring([320, 95], resval, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 95], resval, [14, 14], [1, 1, 1], 1, 0); // Fullscreen if (fullscreenval == 0) @@ -1655,7 +1655,7 @@ void() Draw_Extra_GSettings = else sval = S_ENABLED; - drawstring([320, 135], sval, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 135], sval, [14, 14], [1, 1, 1], 1, 0); // Show FPS if (cvar("show_fps") == 0) @@ -1663,14 +1663,14 @@ void() Draw_Extra_GSettings = else fpsval = S_ENABLED; - drawstring([320, 155], fpsval, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 155], fpsval, [14, 14], [1, 1, 1], 1, 0); // Max FPS // can't adjust when vsync is enabled, so grey out if (!cvar("vid_vsync")) { - drawstring([320, 175], ftos(cvar("cl_maxfps")), [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 175], ftos(cvar("cl_maxfps")), [14, 14], [1, 1, 1], 1, 0); } else { - drawstring([320, 175], ftos(cvar("cl_maxfps")), [14, 14], [0.25, 0.25, 0.25], 1, 0); + Draw_String([320, 175], ftos(cvar("cl_maxfps")), [14, 14], [0.25, 0.25, 0.25], 1, 0); } // VSync @@ -1680,11 +1680,11 @@ void() Draw_Extra_GSettings = else vsyncval = S_ENABLED; - drawstring([320, 195], vsyncval, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 195], vsyncval, [14, 14], [1, 1, 1], 1, 0); } // Field of View - drawstring([320, 215], ftos(cvar("fov")), [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 215], ftos(cvar("fov")), [14, 14], [1, 1, 1], 1, 0); // Brightness // have to use a drawfill because of how gamma values are subtracted.. for some reason @@ -1696,7 +1696,7 @@ void() Draw_Extra_GSettings = else ultraval = S_DISABLED; - drawstring([320, 255], ultraval, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 255], ultraval, [14, 14], [1, 1, 1], 1, 0); // Particles if (cvar("nzp_particles") == 0) @@ -1704,7 +1704,7 @@ void() Draw_Extra_GSettings = else partval = S_ENABLED; - drawstring([320, 275], partval, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 275], partval, [14, 14], [1, 1, 1], 1, 0); // Fullbright if (cvar("r_fullbright") == 0) @@ -1712,7 +1712,7 @@ void() Draw_Extra_GSettings = else fullval = S_ENABLED; - drawstring([320, 295], fullval, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 295], fullval, [14, 14], [1, 1, 1], 1, 0); // Retro if (cvar_string("gl_texturemode") == "gl_nearest") @@ -1720,7 +1720,7 @@ void() Draw_Extra_GSettings = else retroval = S_DISABLED; - drawstring([320, 315], retroval, [14, 14], [1, 1, 1], 1, 0); + Draw_String([320, 315], retroval, [14, 14], [1, 1, 1], 1, 0); // Descriptions switch(lastActive) { @@ -1775,7 +1775,7 @@ void() Draw_Extra_GSettings = drawfill ([6, g_height - 85], [270, 4], [0.5, 0.5, 0.5], 1, 0); // Draw desc - drawstring([6, g_height - 42, 0], gset_desc, [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, g_height - 42, 0], gset_desc, [12, 12], [1, 1, 1], 1, 0); } void() Draw_Extra_Controls = @@ -1800,7 +1800,7 @@ void() Draw_Extra_Controls = if (Key_IsControllerGlyph(buttoncon[i])) Key_DrawControllerGlyph([320, 75+(20*i)], buttoncon[i], [22, 22]); else - drawstring([320, 75+(20*i)], buttoncon[i], [g_height * 0.030, g_height * 0.030, 1], [0.8,0.8,0.8], 1, 0); + Draw_String([320, 75+(20*i)], buttoncon[i], [g_height * 0.030, g_height * 0.030, 1], [0.8,0.8,0.8], 1, 0); } } @@ -1912,47 +1912,47 @@ void() Draw_Extra_Customs = for (float i = 0; i < 10; i++) { if (custom_map_active[i] == TRUE || last_active_custom_select == i) { if (custom_maps[i + multiplier].map_name_pretty) - drawstring([6, 75+(20*i)], custom_maps[i + multiplier].map_name_pretty, [14, 14], [1, 0, 0], 1, 0); + Draw_String([6, 75+(20*i)], custom_maps[i + multiplier].map_name_pretty, [14, 14], [1, 0, 0], 1, 0); else - drawstring([6, 75+(20*i)], custom_map_names[i], [14, 14], [1, 0, 0], 1, 0); + Draw_String([6, 75+(20*i)], custom_map_names[i], [14, 14], [1, 0, 0], 1, 0); float line_increment; line_increment = 0; if (custom_maps[i + multiplier].map_desc_1 != "" && custom_maps[i + multiplier].map_desc_1 != " ") { - drawstring([g_width - 360, 250, 0], custom_maps[i + multiplier].map_desc_1, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 360, 250, 0], custom_maps[i + multiplier].map_desc_1, [11, 11], [1, 1, 1], 1, 0); } if (custom_maps[i + multiplier].map_desc_2 != "" && custom_maps[i + multiplier].map_desc_2 != " ") { line_increment++; - drawstring([g_width - 360, 265, 0], custom_maps[i + multiplier].map_desc_2, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 360, 265, 0], custom_maps[i + multiplier].map_desc_2, [11, 11], [1, 1, 1], 1, 0); } if (custom_maps[i + multiplier].map_desc_3 != "" && custom_maps[i + multiplier].map_desc_3 != " ") { line_increment++; - drawstring([g_width - 360, 280, 0], custom_maps[i + multiplier].map_desc_3, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 360, 280, 0], custom_maps[i + multiplier].map_desc_3, [11, 11], [1, 1, 1], 1, 0); } if (custom_maps[i + multiplier].map_desc_4 != "" && custom_maps[i + multiplier].map_desc_4 != " ") { line_increment++; - drawstring([g_width - 360, 295, 0], custom_maps[i + multiplier].map_desc_4, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 360, 295, 0], custom_maps[i + multiplier].map_desc_4, [11, 11], [1, 1, 1], 1, 0); } if (custom_maps[i + multiplier].map_desc_5 != "" && custom_maps[i + multiplier].map_desc_5 != " ") { line_increment++; - drawstring([g_width - 360, 310, 0], custom_maps[i + multiplier].map_desc_5, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 360, 310, 0], custom_maps[i + multiplier].map_desc_5, [11, 11], [1, 1, 1], 1, 0); } if (custom_maps[i + multiplier].map_desc_6 != "" && custom_maps[i + multiplier].map_desc_6 != " ") { line_increment++; - drawstring([g_width - 360, 325, 0], custom_maps[i + multiplier].map_desc_6, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 360, 325, 0], custom_maps[i + multiplier].map_desc_6, [11, 11], [1, 1, 1], 1, 0); } if (custom_maps[i + multiplier].map_desc_7 != "" && custom_maps[i + multiplier].map_desc_7 != " ") { line_increment++; - drawstring([g_width - 360, 340, 0], custom_maps[i + multiplier].map_desc_7, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 360, 340, 0], custom_maps[i + multiplier].map_desc_7, [11, 11], [1, 1, 1], 1, 0); } if (custom_maps[i + multiplier].map_desc_8 != "" && custom_maps[i + multiplier].map_desc_8 != " ") { line_increment++; - drawstring([g_width - 360, 355, 0], custom_maps[i + multiplier].map_desc_8, [11, 11], [1, 1, 1], 1, 0); + Draw_String([g_width - 360, 355, 0], custom_maps[i + multiplier].map_desc_8, [11, 11], [1, 1, 1], 1, 0); } if (custom_maps[i + multiplier].map_author != "" && custom_maps[i + multiplier].map_author != " ") { line_increment++; - drawstring([g_width - 360, 235 + (20*line_increment), 0], custom_maps[i + multiplier].map_author, [11, 11], TEXT_ORANGE, 1, 0); + Draw_String([g_width - 360, 235 + (20*line_increment), 0], custom_maps[i + multiplier].map_author, [11, 11], TEXT_ORANGE, 1, 0); } if (custom_maps[i + multiplier].map_use_thumbnail) { @@ -1961,9 +1961,9 @@ void() Draw_Extra_Customs = } else { if (custom_maps[i + multiplier].map_name_pretty) - drawstring([6, 75+(20*i)], custom_maps[i + multiplier].map_name_pretty, [14, 14], [1, 1, 1], 1, 0); + Draw_String([6, 75+(20*i)], custom_maps[i + multiplier].map_name_pretty, [14, 14], [1, 1, 1], 1, 0); else - drawstring([6, 75+(20*i)], custom_map_names[i], [14, 14], [1, 1, 1], 1, 0); + Draw_String([6, 75+(20*i)], custom_map_names[i], [14, 14], [1, 1, 1], 1, 0); } } @@ -2020,31 +2020,31 @@ void() Draw_Extra_Achievements = if (achievements[i + multiplier].unlocked == false) { int lock_width_pos; - drawstring([0.450*g_height, (0.150 + (0.212 * i))*g_height, 0], name1, [g_height * 0.030, g_height * 0.030, 1], [0.5,0.5,0.5], 1, 0); - drawstring([0.450*g_height, (0.180 + (0.212 * i))*g_height, 0], name2, [g_height * 0.030, g_height * 0.030, 1], [0.5,0.5,0.5], 1, 0); + Draw_String([0.450*g_height, (0.150 + (0.212 * i))*g_height, 0], name1, [g_height * 0.030, g_height * 0.030, 1], [0.5,0.5,0.5], 1, 0); + Draw_String([0.450*g_height, (0.180 + (0.212 * i))*g_height, 0], name2, [g_height * 0.030, g_height * 0.030, 1], [0.5,0.5,0.5], 1, 0); if (name2 == "") { lock_width_pos = stringwidth(name1, 0, [g_height * 0.030, g_height * 0.030, 1]); - drawstring([0.450*g_height + lock_width_pos, (0.150 + (0.212 * i))*g_height, 0], " (LOCKED)", [g_height * 0.030, g_height * 0.030, 1], [1,0,0], 1, 0); + Draw_String([0.450*g_height + lock_width_pos, (0.150 + (0.212 * i))*g_height, 0], " (LOCKED)", [g_height * 0.030, g_height * 0.030, 1], [1,0,0], 1, 0); } else { lock_width_pos = stringwidth(name2, 0, [g_height * 0.030, g_height * 0.030, 1]); - drawstring([0.450*g_height + lock_width_pos, (0.180 + (0.212 * i))*g_height, 0], " (LOCKED)", [g_height * 0.030, g_height * 0.030, 1], [1,0,0], 1, 0); + Draw_String([0.450*g_height + lock_width_pos, (0.180 + (0.212 * i))*g_height, 0], " (LOCKED)", [g_height * 0.030, g_height * 0.030, 1], [1,0,0], 1, 0); } - drawstring([0.450*g_height, (0.210 + (0.212 * i))*g_height, 0], desc1, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); - drawstring([0.450*g_height, (0.240 + (0.212 * i))*g_height, 0], desc2, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); - drawstring([0.450*g_height, (0.270 + (0.212 * i))*g_height, 0], desc3, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); - drawstring([0.450*g_height, (0.300 + (0.212 * i))*g_height, 0], desc4, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); + Draw_String([0.450*g_height, (0.210 + (0.212 * i))*g_height, 0], desc1, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); + Draw_String([0.450*g_height, (0.240 + (0.212 * i))*g_height, 0], desc2, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); + Draw_String([0.450*g_height, (0.270 + (0.212 * i))*g_height, 0], desc3, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); + Draw_String([0.450*g_height, (0.300 + (0.212 * i))*g_height, 0], desc4, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); drawpic([0.025*g_width, (0.150 + (0.212 * i))*g_height, 0], "gfx/achievement/achievement_locked.tga", [0.38*g_height, 0.19*g_height, 0], [1,1,1], 1); } else { - drawstring([0.450*g_height, (0.150 + (0.212 * i))*g_height, 0], name1, [g_height * 0.030, g_height * 0.030, 1], [1,1,0], 1, 0); - drawstring([0.450*g_height, (0.180 + (0.212 * i))*g_height, 0], name2, [g_height * 0.030, g_height * 0.030, 1], [1,1,0], 1, 0); + Draw_String([0.450*g_height, (0.150 + (0.212 * i))*g_height, 0], name1, [g_height * 0.030, g_height * 0.030, 1], [1,1,0], 1, 0); + Draw_String([0.450*g_height, (0.180 + (0.212 * i))*g_height, 0], name2, [g_height * 0.030, g_height * 0.030, 1], [1,1,0], 1, 0); - drawstring([0.450*g_height, (0.210 + (0.212 * i))*g_height, 0], desc1, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); - drawstring([0.450*g_height, (0.240 + (0.212 * i))*g_height, 0], desc2, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); - drawstring([0.450*g_height, (0.270 + (0.212 * i))*g_height, 0], desc3, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); - drawstring([0.450*g_height, (0.300 + (0.212 * i))*g_height, 0], desc4, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); + Draw_String([0.450*g_height, (0.210 + (0.212 * i))*g_height, 0], desc1, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); + Draw_String([0.450*g_height, (0.240 + (0.212 * i))*g_height, 0], desc2, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); + Draw_String([0.450*g_height, (0.270 + (0.212 * i))*g_height, 0], desc3, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); + Draw_String([0.450*g_height, (0.300 + (0.212 * i))*g_height, 0], desc4, [g_height * 0.030, g_height * 0.030, 1], [1,1,1], 1, 0); drawpic([0.025*g_width, (0.150 + (0.212 * i))*g_height, 0], achievements[i + multiplier].img, [0.38*g_height, 0.19*g_height, 0], [1,1,1], 1); } @@ -2079,7 +2079,7 @@ void() Draw_Extra_ASettings = drawfill ([6, g_height - 85], [270, 4], [0.5, 0.5, 0.5], 1, 0); // Draw desc - drawstring([6, g_height - 42, 0], aset_desc, [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, g_height - 42, 0], aset_desc, [12, 12], [1, 1, 1], 1, 0); } string() LoadScreen_GiveTip; @@ -2099,12 +2099,12 @@ void() Draw_Menu = drawfill ([0, 0], [g_width, 32, 1], [0, 0, 0], 0.68, 0); drawfill ([0, g_height - 32], [g_width, 32, 1], [0, 0, 0], 0.68, 0); - drawstring([g_width/2 - (stringwidth(loadscreen_tip, 0, [12, 12])/2), g_height - 16, 0], loadscreen_tip, [12, 12], [1, 1, 1], 1, 0); - drawstring([6, 6], loadscreen_maptitle, [24, 24], TEXT_ORANGE, 1, 0); + Draw_String([g_width/2 - (stringwidth(loadscreen_tip, 0, [12, 12])/2), g_height - 16, 0], loadscreen_tip, [12, 12], [1, 1, 1], 1, 0); + Draw_String([6, 6], loadscreen_maptitle, [24, 24], TEXT_ORANGE, 1, 0); drawfill ([g_width/2 - 160, g_height - 42], [320, 18, 1], [0.27, 0.27, 0.27], 1, 0); drawfill ([g_width/2 - 164, g_height - 46], [328, 26, 1], [0, 0, 0], 0.77, 0); - drawstring([g_width/2 - (stringwidth("Loading...", 0, [14, 14])/2), g_height - 40, 0], "Loading...", [14, 14], [1, 1, 1], 1, 0); + Draw_String([g_width/2 - (stringwidth("Loading...", 0, [14, 14])/2), g_height - 40, 0], "Loading...", [14, 14], [1, 1, 1], 1, 0); if (loadscreen_timetrigger < cltime) { in_loadscreen = true; @@ -2149,7 +2149,7 @@ void() Draw_Menu = vers_string = build_datetime; - drawstring([(g_width - 6 - stringwidth(vers_string, 0, [12, 12])), 8], vers_string, [12, 12], [1, 1, 1], 1, 0); + Draw_String([(g_width - 6 - getTextWidth(vers_string, 12)), 8], vers_string, [12, 12], [1, 1, 1], 1, 0); } //menu title @@ -2226,7 +2226,7 @@ void() Draw_Menu = title = "Nazi Zombies: Portable"; } - drawstring([6, 8, 0], title, [28, 28, 0], [1, 1, 1], 1, 0); + Draw_String([6, 8, 0], title, [28, 28, 0], [1, 1, 1], 1, 0); //Update buttons local float i;