diff --git a/platform/base_textures.pk3dir/fonts/font16.font b/platform/base_textures.pk3dir/fonts/font16.font new file mode 100644 index 00000000..59d2200f --- /dev/null +++ b/platform/base_textures.pk3dir/fonts/font16.font @@ -0,0 +1,3 @@ +name "16" +font "gfx/shell/arial" +size "16" diff --git a/platform/base_textures.pk3dir/fonts/font20.font b/platform/base_textures.pk3dir/fonts/font20.font new file mode 100644 index 00000000..5c117f52 --- /dev/null +++ b/platform/base_textures.pk3dir/fonts/font20.font @@ -0,0 +1,3 @@ +name "cr" +font "gfx/shell/arial" +size "20" diff --git a/platform/base_textures.pk3dir/fonts/fontcon.font b/platform/base_textures.pk3dir/fonts/fontcon.font new file mode 100644 index 00000000..9806bbd3 --- /dev/null +++ b/platform/base_textures.pk3dir/fonts/fontcon.font @@ -0,0 +1,3 @@ +name "font" +font "gfx/shell/arial" +size "12" diff --git a/platform/menu_fallback.pk3dir/gfx/shell/cb_checked.tga b/platform/menu_fallback.pk3dir/gfx/shell/cb_checked.tga new file mode 100644 index 00000000..cef0ac8b Binary files /dev/null and b/platform/menu_fallback.pk3dir/gfx/shell/cb_checked.tga differ diff --git a/platform/menu_fallback.pk3dir/gfx/shell/cb_disabled.tga b/platform/menu_fallback.pk3dir/gfx/shell/cb_disabled.tga new file mode 100644 index 00000000..f5faae16 Binary files /dev/null and b/platform/menu_fallback.pk3dir/gfx/shell/cb_disabled.tga differ diff --git a/platform/menu_fallback.pk3dir/gfx/shell/cb_down.tga b/platform/menu_fallback.pk3dir/gfx/shell/cb_down.tga new file mode 100644 index 00000000..cef0ac8b Binary files /dev/null and b/platform/menu_fallback.pk3dir/gfx/shell/cb_down.tga differ diff --git a/platform/menu_fallback.pk3dir/gfx/shell/cb_empty.tga b/platform/menu_fallback.pk3dir/gfx/shell/cb_empty.tga new file mode 100644 index 00000000..f5faae16 Binary files /dev/null and b/platform/menu_fallback.pk3dir/gfx/shell/cb_empty.tga differ diff --git a/platform/menu_fallback.pk3dir/gfx/shell/cb_over.tga b/platform/menu_fallback.pk3dir/gfx/shell/cb_over.tga new file mode 100644 index 00000000..1bc4d7f6 Binary files /dev/null and b/platform/menu_fallback.pk3dir/gfx/shell/cb_over.tga differ diff --git a/src/client/entry.qc b/src/client/entry.qc index 7f13c986..42b84fa8 100644 --- a/src/client/entry.qc +++ b/src/client/entry.qc @@ -113,9 +113,9 @@ void CSQC_RendererRestarted(string rstr) { /* Fonts */ - FONT_16 = loadfont("16", "fonts/default", "16", -1); - FONT_20 = loadfont("cr", "creditsfont?fmt=h", "20", -1); - FONT_CON = loadfont("font", "", "12", -1); + FONT_16 = Font_LoadFont("fonts/font16.font"); + FONT_20 = Font_LoadFont("fonts/font20.font"); + FONT_CON = Font_LoadFont("fonts/fontcon.font"); drawfont = FONT_CON; /* Particles */ diff --git a/src/client/font.qc b/src/client/font.qc new file mode 100644 index 00000000..a9288361 --- /dev/null +++ b/src/client/font.qc @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016-2021 Marco Hladik + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* very basic wrapper around loadfont(), as we don't want to hard-code + * paths to fonts used in the cgame */ +float +Font_LoadFont(string filename) +{ + string line; + filestream fs_font; + + fs_font = fopen(filename, FILE_READ); + + if (fs_font < 0) { + print(sprintf("[FONT] ^1WARNING: ^7Could NOT load %s\n", filename)); + return -1; + } + + string font; + string size; + string shortname; + while ((line = fgets(fs_font))) { + int c = tokenize_console(line); + + switch (argv(0)) { + case "font": + font = argv(1); + break; + case "size": + size = argv(1); + break; + case "name": + shortname = argv(1); + break; + } + } + + fclose(fs_font); + + return loadfont(shortname, font, size, -1); +} diff --git a/src/client/include.src b/src/client/include.src index 4c0507ee..d5c4e04f 100644 --- a/src/client/include.src +++ b/src/client/include.src @@ -1,5 +1,6 @@ #includelist fog.qc +font.qc sky.qc music.qc sound.qc diff --git a/src/menu-fn/entry.qc b/src/menu-fn/entry.qc index 7337074e..ba505ea1 100644 --- a/src/menu-fn/entry.qc +++ b/src/menu-fn/entry.qc @@ -106,7 +106,7 @@ m_init(void) cvar_set("v_bobup", "0.5"); cvar_set("v_contentblend", "0"); cvar_set("gl_mindist", "4"); - cvar_set("con_textsize", "-12"); + cvar_set("con_textsize", "12"); cvar_set("scr_conalpha", "1"); cvar_set("scr_sshot_type", "tga"); cvar_set("con_notifylines", "0");