diff --git a/ASSETS/Attributes/LayoutNew.TXT b/ASSETS/Attributes/LayoutNew.TXT index 6c8d548..a3ab7ee 100644 --- a/ASSETS/Attributes/LayoutNew.TXT +++ b/ASSETS/Attributes/LayoutNew.TXT @@ -1634,7 +1634,14 @@ MineDetectScreenTint = <224.0, 224.0, 0.0> WeaponPickupColor = <80.0, 40.0, 128.0> AmmoPickupColor = <80.0, 40.0, 128.0> TintTime = 2.000000 -ExpoFont = "interface\fonts\BETHHAND.TTF" +ScaleFont = "NOLF\Modernizer\Fonts" +ScaleHelpFont = "..\NOLF\Modernizer\Fonts\font_help.pcx" +ScaleSmallFont = "..\NOLF\Modernizer\Fonts\font_small.pcx" +ScaleMediumFont = "..\NOLF\Modernizer\Fonts\font_medium.pcx" +ScaleLargeFont = "..\NOLF\Modernizer\Fonts\font_large.pcx" +ScaleTitleFont = "..\NOLF\Modernizer\Fonts\font_title.pcx" +ScaleMsgFont = "..\NOLF\Modernizer\Fonts\font_msg.pcx" +ScaleHUDFont = "..\NOLF\Modernizer\Fonts\font_hud.pcx" HelpFont = "interface\fonts\font_help.pcx" SmallFontBase = "interface\fonts\font_small_0.pcx" MediumFontBase = "interface\fonts\font_med_0.pcx" diff --git a/LIBS/SDL2_ttf-2.0.15/CHANGES.txt b/LIBS/SDL2_ttf-2.0.15/CHANGES.txt new file mode 100644 index 0000000..41b9eac --- /dev/null +++ b/LIBS/SDL2_ttf-2.0.15/CHANGES.txt @@ -0,0 +1,39 @@ +2.0.15: +Sam Lantinga - Fri Oct 26 13:26:54 PDT 2018 + * Updated to FreeType version 2.9.1 +Sam Lantinga - Sun Sep 10 00:18:45 PDT 2017 + * Text rendering functions now use the alpha component of the text colors +Sam Lantinga - Sat Sep 9 22:21:55 PDT 2017 + * Added support for characters greater than 0xFFFF (e.g. emoji) in the UTF-8 APIs + +2.0.14: +Ryan Gordon - Fri Jan 29 12:53:29 PST 2016 + * Deprecated TTF_GetFontKerningSize() which takes font glyph indices and added TTF_GetFontKerningSizeGlyphs() which takes characters + +2.0.13: +Sylvain - Sat Jun 28 11:42:42 2014 + * Fixed bug rendering text starting with a glyph with negative starting offset +beuc - Sun Jun 15 18:27:28 2014 + * Fixed regression loading non-scalable fonts +Sam Lantinga - Sun Jun 15 18:21:04 PDT 2014 + * TTF_GetFontKerningSize() gets kerning between two characters, not two glyph indices +David Ludwig - Sun Apr 13 22:28:26 2014 + * Added support for building for Windows RT and Windows Phone + +2.0.12: +Sam Lantinga - Sat Jun 1 19:11:26 PDT 2013 + * Updated for SDL 2.0 release + +2.0.11: +Sam Lantinga - Sat Dec 31 10:49:42 EST 2011 + * SDL_ttf is now under the zlib license +Peter Kosyh - Mon Feb 28 14:57:03 PST 2011 + * Improved font glyph caching for non-latin languages +Erik Snoek - Wed Jan 12 09:10:15 PST 2011 + * Added API to get kerning info: TTF_GetFontKerningSize() +Sam Lantinga - Mon Jan 10 10:58:34 2011 -0800 + * Added Android.mk to build on the Android platform + +2.0.10: +Adam Strzelecki - Wed Oct 21 21:02:37 PDT 2009 + * Find the Unicode or symbol character map if it's available in the font diff --git a/LIBS/SDL2_ttf-2.0.15/COPYING.txt b/LIBS/SDL2_ttf-2.0.15/COPYING.txt new file mode 100644 index 0000000..aefc48c --- /dev/null +++ b/LIBS/SDL2_ttf-2.0.15/COPYING.txt @@ -0,0 +1,20 @@ +/* + SDL_ttf: A companion library to SDL for working with TrueType (tm) fonts + Copyright (C) 1997-2019 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ diff --git a/LIBS/SDL2_ttf-2.0.15/README.txt b/LIBS/SDL2_ttf-2.0.15/README.txt new file mode 100644 index 0000000..b75b3d7 --- /dev/null +++ b/LIBS/SDL2_ttf-2.0.15/README.txt @@ -0,0 +1,25 @@ + +This library is a wrapper around the excellent FreeType 2.0 library, +available at: + http://www.freetype.org/ + +This library allows you to use TrueType fonts to render text in SDL +applications. + +To make the library, first install the FreeType library, then type +'./configure' then 'make' to build the SDL truetype library and the +showfont and glfont example applications. + +Be careful when including fonts with your application, as many of them +are copyrighted. The Microsoft fonts, for example, are not freely +redistributable and even the free "web" fonts they provide are only +redistributable in their special executable installer form (May 1998). +There are plenty of freeware and shareware fonts available on the Internet +though, and may suit your purposes. + +This library is under the zlib license, see the file "COPYING.txt" for details. + +Portions of this software are copyright © 2013 The FreeType Project (www.freetype.org). All rights reserved. + +Enjoy! + -Sam Lantinga (6/20/2001) diff --git a/LIBS/SDL2_ttf-2.0.15/include/SDL_ttf.h b/LIBS/SDL2_ttf-2.0.15/include/SDL_ttf.h new file mode 100644 index 0000000..0861185 --- /dev/null +++ b/LIBS/SDL2_ttf-2.0.15/include/SDL_ttf.h @@ -0,0 +1,294 @@ +/* + SDL_ttf: A companion library to SDL for working with TrueType (tm) fonts + Copyright (C) 2001-2019 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* This library is a wrapper around the excellent FreeType 2.0 library, + available at: + http://www.freetype.org/ +*/ + +/* Note: In many places, SDL_ttf will say "glyph" when it means "code point." + Unicode is hard, we learn as we go, and we apologize for adding to the + confusion. */ + +#ifndef SDL_TTF_H_ +#define SDL_TTF_H_ + +#include "SDL.h" +#include "begin_code.h" + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL +*/ +#define SDL_TTF_MAJOR_VERSION 2 +#define SDL_TTF_MINOR_VERSION 0 +#define SDL_TTF_PATCHLEVEL 15 + +/* This macro can be used to fill a version structure with the compile-time + * version of the SDL_ttf library. + */ +#define SDL_TTF_VERSION(X) \ +{ \ + (X)->major = SDL_TTF_MAJOR_VERSION; \ + (X)->minor = SDL_TTF_MINOR_VERSION; \ + (X)->patch = SDL_TTF_PATCHLEVEL; \ +} + +/* Backwards compatibility */ +#define TTF_MAJOR_VERSION SDL_TTF_MAJOR_VERSION +#define TTF_MINOR_VERSION SDL_TTF_MINOR_VERSION +#define TTF_PATCHLEVEL SDL_TTF_PATCHLEVEL +#define TTF_VERSION(X) SDL_TTF_VERSION(X) + +/** + * This is the version number macro for the current SDL_ttf version. + */ +#define SDL_TTF_COMPILEDVERSION \ + SDL_VERSIONNUM(SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL) + +/** + * This macro will evaluate to true if compiled with SDL_ttf at least X.Y.Z. + */ +#define SDL_TTF_VERSION_ATLEAST(X, Y, Z) \ + (SDL_TTF_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) + +/* Make sure this is defined (only available in newer SDL versions) */ +#ifndef SDL_DEPRECATED +#define SDL_DEPRECATED +#endif + +/* This function gets the version of the dynamically linked SDL_ttf library. + it should NOT be used to fill a version structure, instead you should + use the SDL_TTF_VERSION() macro. + */ +extern DECLSPEC const SDL_version * SDLCALL TTF_Linked_Version(void); + +/* ZERO WIDTH NO-BREAKSPACE (Unicode byte order mark) */ +#define UNICODE_BOM_NATIVE 0xFEFF +#define UNICODE_BOM_SWAPPED 0xFFFE + +/* This function tells the library whether UNICODE text is generally + byteswapped. A UNICODE BOM character in a string will override + this setting for the remainder of that string. +*/ +extern DECLSPEC void SDLCALL TTF_ByteSwappedUNICODE(int swapped); + +/* The internal structure containing font information */ +typedef struct _TTF_Font TTF_Font; + +/* Initialize the TTF engine - returns 0 if successful, -1 on error */ +extern DECLSPEC int SDLCALL TTF_Init(void); + +/* Open a font file and create a font of the specified point size. + * Some .fon fonts will have several sizes embedded in the file, so the + * point size becomes the index of choosing which size. If the value + * is too high, the last indexed size will be the default. */ +extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFont(const char *file, int ptsize); +extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndex(const char *file, int ptsize, long index); +extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontRW(SDL_RWops *src, int freesrc, int ptsize); +extern DECLSPEC TTF_Font * SDLCALL TTF_OpenFontIndexRW(SDL_RWops *src, int freesrc, int ptsize, long index); + +/* Set and retrieve the font style */ +#define TTF_STYLE_NORMAL 0x00 +#define TTF_STYLE_BOLD 0x01 +#define TTF_STYLE_ITALIC 0x02 +#define TTF_STYLE_UNDERLINE 0x04 +#define TTF_STYLE_STRIKETHROUGH 0x08 +extern DECLSPEC int SDLCALL TTF_GetFontStyle(const TTF_Font *font); +extern DECLSPEC void SDLCALL TTF_SetFontStyle(TTF_Font *font, int style); +extern DECLSPEC int SDLCALL TTF_GetFontOutline(const TTF_Font *font); +extern DECLSPEC void SDLCALL TTF_SetFontOutline(TTF_Font *font, int outline); + +/* Set and retrieve FreeType hinter settings */ +#define TTF_HINTING_NORMAL 0 +#define TTF_HINTING_LIGHT 1 +#define TTF_HINTING_MONO 2 +#define TTF_HINTING_NONE 3 +extern DECLSPEC int SDLCALL TTF_GetFontHinting(const TTF_Font *font); +extern DECLSPEC void SDLCALL TTF_SetFontHinting(TTF_Font *font, int hinting); + +/* Get the total height of the font - usually equal to point size */ +extern DECLSPEC int SDLCALL TTF_FontHeight(const TTF_Font *font); + +/* Get the offset from the baseline to the top of the font + This is a positive value, relative to the baseline. + */ +extern DECLSPEC int SDLCALL TTF_FontAscent(const TTF_Font *font); + +/* Get the offset from the baseline to the bottom of the font + This is a negative value, relative to the baseline. + */ +extern DECLSPEC int SDLCALL TTF_FontDescent(const TTF_Font *font); + +/* Get the recommended spacing between lines of text for this font */ +extern DECLSPEC int SDLCALL TTF_FontLineSkip(const TTF_Font *font); + +/* Get/Set whether or not kerning is allowed for this font */ +extern DECLSPEC int SDLCALL TTF_GetFontKerning(const TTF_Font *font); +extern DECLSPEC void SDLCALL TTF_SetFontKerning(TTF_Font *font, int allowed); + +/* Get the number of faces of the font */ +extern DECLSPEC long SDLCALL TTF_FontFaces(const TTF_Font *font); + +/* Get the font face attributes, if any */ +extern DECLSPEC int SDLCALL TTF_FontFaceIsFixedWidth(const TTF_Font *font); +extern DECLSPEC char * SDLCALL TTF_FontFaceFamilyName(const TTF_Font *font); +extern DECLSPEC char * SDLCALL TTF_FontFaceStyleName(const TTF_Font *font); + +/* Check wether a glyph is provided by the font or not */ +extern DECLSPEC int SDLCALL TTF_GlyphIsProvided(const TTF_Font *font, Uint16 ch); + +/* Get the metrics (dimensions) of a glyph + To understand what these metrics mean, here is a useful link: + http://freetype.sourceforge.net/freetype2/docs/tutorial/step2.html + */ +extern DECLSPEC int SDLCALL TTF_GlyphMetrics(TTF_Font *font, Uint16 ch, + int *minx, int *maxx, + int *miny, int *maxy, int *advance); + +/* Get the dimensions of a rendered string of text */ +extern DECLSPEC int SDLCALL TTF_SizeText(TTF_Font *font, const char *text, int *w, int *h); +extern DECLSPEC int SDLCALL TTF_SizeUTF8(TTF_Font *font, const char *text, int *w, int *h); +extern DECLSPEC int SDLCALL TTF_SizeUNICODE(TTF_Font *font, const Uint16 *text, int *w, int *h); + +/* Create an 8-bit palettized surface and render the given text at + fast quality with the given font and color. The 0 pixel is the + colorkey, giving a transparent background, and the 1 pixel is set + to the text color. + This function returns the new surface, or NULL if there was an error. +*/ +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Solid(TTF_Font *font, + const char *text, SDL_Color fg); +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Solid(TTF_Font *font, + const char *text, SDL_Color fg); +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Solid(TTF_Font *font, + const Uint16 *text, SDL_Color fg); + +/* Create an 8-bit palettized surface and render the given glyph at + fast quality with the given font and color. The 0 pixel is the + colorkey, giving a transparent background, and the 1 pixel is set + to the text color. The glyph is rendered without any padding or + centering in the X direction, and aligned normally in the Y direction. + This function returns the new surface, or NULL if there was an error. +*/ +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Solid(TTF_Font *font, + Uint16 ch, SDL_Color fg); + +/* Create an 8-bit palettized surface and render the given text at + high quality with the given font and colors. The 0 pixel is background, + while other pixels have varying degrees of the foreground color. + This function returns the new surface, or NULL if there was an error. +*/ +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Shaded(TTF_Font *font, + const char *text, SDL_Color fg, SDL_Color bg); +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Shaded(TTF_Font *font, + const char *text, SDL_Color fg, SDL_Color bg); +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Shaded(TTF_Font *font, + const Uint16 *text, SDL_Color fg, SDL_Color bg); + +/* Create an 8-bit palettized surface and render the given glyph at + high quality with the given font and colors. The 0 pixel is background, + while other pixels have varying degrees of the foreground color. + The glyph is rendered without any padding or centering in the X + direction, and aligned normally in the Y direction. + This function returns the new surface, or NULL if there was an error. +*/ +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Shaded(TTF_Font *font, + Uint16 ch, SDL_Color fg, SDL_Color bg); + +/* Create a 32-bit ARGB surface and render the given text at high quality, + using alpha blending to dither the font with the given color. + This function returns the new surface, or NULL if there was an error. +*/ +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended(TTF_Font *font, + const char *text, SDL_Color fg); +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Blended(TTF_Font *font, + const char *text, SDL_Color fg); +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Blended(TTF_Font *font, + const Uint16 *text, SDL_Color fg); + + +/* Create a 32-bit ARGB surface and render the given text at high quality, + using alpha blending to dither the font with the given color. + Text is wrapped to multiple lines on line endings and on word boundaries + if it extends beyond wrapLength in pixels. + This function returns the new surface, or NULL if there was an error. +*/ +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderText_Blended_Wrapped(TTF_Font *font, + const char *text, SDL_Color fg, Uint32 wrapLength); +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Blended_Wrapped(TTF_Font *font, + const char *text, SDL_Color fg, Uint32 wrapLength); +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUNICODE_Blended_Wrapped(TTF_Font *font, + const Uint16 *text, SDL_Color fg, Uint32 wrapLength); + +/* Create a 32-bit ARGB surface and render the given glyph at high quality, + using alpha blending to dither the font with the given color. + The glyph is rendered without any padding or centering in the X + direction, and aligned normally in the Y direction. + This function returns the new surface, or NULL if there was an error. +*/ +extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderGlyph_Blended(TTF_Font *font, + Uint16 ch, SDL_Color fg); + +/* For compatibility with previous versions, here are the old functions */ +#define TTF_RenderText(font, text, fg, bg) \ + TTF_RenderText_Shaded(font, text, fg, bg) +#define TTF_RenderUTF8(font, text, fg, bg) \ + TTF_RenderUTF8_Shaded(font, text, fg, bg) +#define TTF_RenderUNICODE(font, text, fg, bg) \ + TTF_RenderUNICODE_Shaded(font, text, fg, bg) + +/* Close an opened font file */ +extern DECLSPEC void SDLCALL TTF_CloseFont(TTF_Font *font); + +/* De-initialize the TTF engine */ +extern DECLSPEC void SDLCALL TTF_Quit(void); + +/* Check if the TTF engine is initialized */ +extern DECLSPEC int SDLCALL TTF_WasInit(void); + +/* Get the kerning size of two glyphs indices */ +/* DEPRECATED: this function requires FreeType font indexes, not glyphs, + by accident, which we don't expose through this API, so it could give + wildly incorrect results, especially with non-ASCII values. + Going forward, please use TTF_GetFontKerningSizeGlyphs() instead, which + does what you probably expected this function to do. */ +extern DECLSPEC int TTF_GetFontKerningSize(TTF_Font *font, int prev_index, int index) SDL_DEPRECATED; + +/* Get the kerning size of two glyphs */ +extern DECLSPEC int TTF_GetFontKerningSizeGlyphs(TTF_Font *font, Uint16 previous_ch, Uint16 ch); + +/* We'll use SDL for reporting errors */ +#define TTF_SetError SDL_SetError +#define TTF_GetError SDL_GetError + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_TTF_H_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/LIBS/SDL2_ttf-2.0.15/lib/x64/LICENSE.freetype.txt b/LIBS/SDL2_ttf-2.0.15/lib/x64/LICENSE.freetype.txt new file mode 100644 index 0000000..5fb9b74 --- /dev/null +++ b/LIBS/SDL2_ttf-2.0.15/lib/x64/LICENSE.freetype.txt @@ -0,0 +1,173 @@ +The source code to this library used with SDL_ttf can be found here: +https://hg.libsdl.org/SDL_ttf/file/default/external +--- + + The FreeType Project LICENSE + ---------------------------- + + 2006-Jan-27 + + Copyright 1996-2002, 2006 by + David Turner, Robert Wilhelm, and Werner Lemberg + + + +Introduction +============ + + The FreeType Project is distributed in several archive packages; + some of them may contain, in addition to the FreeType font engine, + various tools and contributions which rely on, or relate to, the + FreeType Project. + + This license applies to all files found in such packages, and + which do not fall under their own explicit license. The license + affects thus the FreeType font engine, the test programs, + documentation and makefiles, at the very least. + + This license was inspired by the BSD, Artistic, and IJG + (Independent JPEG Group) licenses, which all encourage inclusion + and use of free software in commercial and freeware products + alike. As a consequence, its main points are that: + + o We don't promise that this software works. However, we will be + interested in any kind of bug reports. (`as is' distribution) + + o You can use this software for whatever you want, in parts or + full form, without having to pay us. (`royalty-free' usage) + + o You may not pretend that you wrote this software. If you use + it, or only parts of it, in a program, you must acknowledge + somewhere in your documentation that you have used the + FreeType code. (`credits') + + We specifically permit and encourage the inclusion of this + software, with or without modifications, in commercial products. + We disclaim all warranties covering The FreeType Project and + assume no liability related to The FreeType Project. + + + Finally, many people asked us for a preferred form for a + credit/disclaimer to use in compliance with this license. We thus + encourage you to use the following text: + + """ + Portions of this software are copyright © The FreeType + Project (www.freetype.org). All rights reserved. + """ + + Please replace with the value from the FreeType version you + actually use. + + +Legal Terms +=========== + +0. Definitions +-------------- + + Throughout this license, the terms `package', `FreeType Project', + and `FreeType archive' refer to the set of files originally + distributed by the authors (David Turner, Robert Wilhelm, and + Werner Lemberg) as the `FreeType Project', be they named as alpha, + beta or final release. + + `You' refers to the licensee, or person using the project, where + `using' is a generic term including compiling the project's source + code as well as linking it to form a `program' or `executable'. + This program is referred to as `a program using the FreeType + engine'. + + This license applies to all files distributed in the original + FreeType Project, including all source code, binaries and + documentation, unless otherwise stated in the file in its + original, unmodified form as distributed in the original archive. + If you are unsure whether or not a particular file is covered by + this license, you must contact us to verify this. + + The FreeType Project is copyright (C) 1996-2000 by David Turner, + Robert Wilhelm, and Werner Lemberg. All rights reserved except as + specified below. + +1. No Warranty +-------------- + + THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO + USE, OF THE FREETYPE PROJECT. + +2. Redistribution +----------------- + + This license grants a worldwide, royalty-free, perpetual and + irrevocable right and license to use, execute, perform, compile, + display, copy, create derivative works of, distribute and + sublicense the FreeType Project (in both source and object code + forms) and derivative works thereof for any purpose; and to + authorize others to exercise some or all of the rights granted + herein, subject to the following conditions: + + o Redistribution of source code must retain this license file + (`FTL.TXT') unaltered; any additions, deletions or changes to + the original files must be clearly indicated in accompanying + documentation. The copyright notices of the unaltered, + original files must be preserved in all copies of source + files. + + o Redistribution in binary form must provide a disclaimer that + states that the software is based in part of the work of the + FreeType Team, in the distribution documentation. We also + encourage you to put an URL to the FreeType web page in your + documentation, though this isn't mandatory. + + These conditions apply to any software derived from or based on + the FreeType Project, not just the unmodified files. If you use + our work, you must acknowledge us. However, no fee need be paid + to us. + +3. Advertising +-------------- + + Neither the FreeType authors and contributors nor you shall use + the name of the other for commercial, advertising, or promotional + purposes without specific prior written permission. + + We suggest, but do not require, that you use one or more of the + following phrases to refer to this software in your documentation + or advertising materials: `FreeType Project', `FreeType Engine', + `FreeType library', or `FreeType Distribution'. + + As you have not signed this license, you are not required to + accept it. However, as the FreeType Project is copyrighted + material, only this license, or another one contracted with the + authors, grants you the right to use, distribute, and modify it. + Therefore, by using, distributing, or modifying the FreeType + Project, you indicate that you understand and accept all the terms + of this license. + +4. Contacts +----------- + + There are two mailing lists related to FreeType: + + o freetype@nongnu.org + + Discusses general use and applications of FreeType, as well as + future and wanted additions to the library and distribution. + If you are looking for support, start in this list if you + haven't found anything to help you in the documentation. + + o freetype-devel@nongnu.org + + Discusses bugs, as well as engine internals, design issues, + specific licenses, porting, etc. + + Our home page can be found at + + https://www.freetype.org + + +--- end of FTL.TXT --- diff --git a/LIBS/SDL2_ttf-2.0.15/lib/x64/LICENSE.zlib.txt b/LIBS/SDL2_ttf-2.0.15/lib/x64/LICENSE.zlib.txt new file mode 100644 index 0000000..53ffccc --- /dev/null +++ b/LIBS/SDL2_ttf-2.0.15/lib/x64/LICENSE.zlib.txt @@ -0,0 +1,31 @@ +The source code to this library used with SDL_ttf can be found here: +https://hg.libsdl.org/SDL_image/file/default/external +--- + +Copyright notice: + + (C) 1995-2010 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* receiving +lengthy legal documents to sign. The sources are provided for free but without +warranty of any kind. The library has been entirely written by Jean-loup +Gailly and Mark Adler; it does not include third-party code. diff --git a/LIBS/SDL2_ttf-2.0.15/lib/x64/SDL2_ttf.dll b/LIBS/SDL2_ttf-2.0.15/lib/x64/SDL2_ttf.dll new file mode 100644 index 0000000..575636a Binary files /dev/null and b/LIBS/SDL2_ttf-2.0.15/lib/x64/SDL2_ttf.dll differ diff --git a/LIBS/SDL2_ttf-2.0.15/lib/x64/SDL2_ttf.lib b/LIBS/SDL2_ttf-2.0.15/lib/x64/SDL2_ttf.lib new file mode 100644 index 0000000..28810a7 Binary files /dev/null and b/LIBS/SDL2_ttf-2.0.15/lib/x64/SDL2_ttf.lib differ diff --git a/LIBS/SDL2_ttf-2.0.15/lib/x64/libfreetype-6.dll b/LIBS/SDL2_ttf-2.0.15/lib/x64/libfreetype-6.dll new file mode 100644 index 0000000..16ef777 Binary files /dev/null and b/LIBS/SDL2_ttf-2.0.15/lib/x64/libfreetype-6.dll differ diff --git a/LIBS/SDL2_ttf-2.0.15/lib/x64/zlib1.dll b/LIBS/SDL2_ttf-2.0.15/lib/x64/zlib1.dll new file mode 100644 index 0000000..e7493de Binary files /dev/null and b/LIBS/SDL2_ttf-2.0.15/lib/x64/zlib1.dll differ diff --git a/LIBS/SDL2_ttf-2.0.15/lib/x86/LICENSE.freetype.txt b/LIBS/SDL2_ttf-2.0.15/lib/x86/LICENSE.freetype.txt new file mode 100644 index 0000000..5fb9b74 --- /dev/null +++ b/LIBS/SDL2_ttf-2.0.15/lib/x86/LICENSE.freetype.txt @@ -0,0 +1,173 @@ +The source code to this library used with SDL_ttf can be found here: +https://hg.libsdl.org/SDL_ttf/file/default/external +--- + + The FreeType Project LICENSE + ---------------------------- + + 2006-Jan-27 + + Copyright 1996-2002, 2006 by + David Turner, Robert Wilhelm, and Werner Lemberg + + + +Introduction +============ + + The FreeType Project is distributed in several archive packages; + some of them may contain, in addition to the FreeType font engine, + various tools and contributions which rely on, or relate to, the + FreeType Project. + + This license applies to all files found in such packages, and + which do not fall under their own explicit license. The license + affects thus the FreeType font engine, the test programs, + documentation and makefiles, at the very least. + + This license was inspired by the BSD, Artistic, and IJG + (Independent JPEG Group) licenses, which all encourage inclusion + and use of free software in commercial and freeware products + alike. As a consequence, its main points are that: + + o We don't promise that this software works. However, we will be + interested in any kind of bug reports. (`as is' distribution) + + o You can use this software for whatever you want, in parts or + full form, without having to pay us. (`royalty-free' usage) + + o You may not pretend that you wrote this software. If you use + it, or only parts of it, in a program, you must acknowledge + somewhere in your documentation that you have used the + FreeType code. (`credits') + + We specifically permit and encourage the inclusion of this + software, with or without modifications, in commercial products. + We disclaim all warranties covering The FreeType Project and + assume no liability related to The FreeType Project. + + + Finally, many people asked us for a preferred form for a + credit/disclaimer to use in compliance with this license. We thus + encourage you to use the following text: + + """ + Portions of this software are copyright © The FreeType + Project (www.freetype.org). All rights reserved. + """ + + Please replace with the value from the FreeType version you + actually use. + + +Legal Terms +=========== + +0. Definitions +-------------- + + Throughout this license, the terms `package', `FreeType Project', + and `FreeType archive' refer to the set of files originally + distributed by the authors (David Turner, Robert Wilhelm, and + Werner Lemberg) as the `FreeType Project', be they named as alpha, + beta or final release. + + `You' refers to the licensee, or person using the project, where + `using' is a generic term including compiling the project's source + code as well as linking it to form a `program' or `executable'. + This program is referred to as `a program using the FreeType + engine'. + + This license applies to all files distributed in the original + FreeType Project, including all source code, binaries and + documentation, unless otherwise stated in the file in its + original, unmodified form as distributed in the original archive. + If you are unsure whether or not a particular file is covered by + this license, you must contact us to verify this. + + The FreeType Project is copyright (C) 1996-2000 by David Turner, + Robert Wilhelm, and Werner Lemberg. All rights reserved except as + specified below. + +1. No Warranty +-------------- + + THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO + USE, OF THE FREETYPE PROJECT. + +2. Redistribution +----------------- + + This license grants a worldwide, royalty-free, perpetual and + irrevocable right and license to use, execute, perform, compile, + display, copy, create derivative works of, distribute and + sublicense the FreeType Project (in both source and object code + forms) and derivative works thereof for any purpose; and to + authorize others to exercise some or all of the rights granted + herein, subject to the following conditions: + + o Redistribution of source code must retain this license file + (`FTL.TXT') unaltered; any additions, deletions or changes to + the original files must be clearly indicated in accompanying + documentation. The copyright notices of the unaltered, + original files must be preserved in all copies of source + files. + + o Redistribution in binary form must provide a disclaimer that + states that the software is based in part of the work of the + FreeType Team, in the distribution documentation. We also + encourage you to put an URL to the FreeType web page in your + documentation, though this isn't mandatory. + + These conditions apply to any software derived from or based on + the FreeType Project, not just the unmodified files. If you use + our work, you must acknowledge us. However, no fee need be paid + to us. + +3. Advertising +-------------- + + Neither the FreeType authors and contributors nor you shall use + the name of the other for commercial, advertising, or promotional + purposes without specific prior written permission. + + We suggest, but do not require, that you use one or more of the + following phrases to refer to this software in your documentation + or advertising materials: `FreeType Project', `FreeType Engine', + `FreeType library', or `FreeType Distribution'. + + As you have not signed this license, you are not required to + accept it. However, as the FreeType Project is copyrighted + material, only this license, or another one contracted with the + authors, grants you the right to use, distribute, and modify it. + Therefore, by using, distributing, or modifying the FreeType + Project, you indicate that you understand and accept all the terms + of this license. + +4. Contacts +----------- + + There are two mailing lists related to FreeType: + + o freetype@nongnu.org + + Discusses general use and applications of FreeType, as well as + future and wanted additions to the library and distribution. + If you are looking for support, start in this list if you + haven't found anything to help you in the documentation. + + o freetype-devel@nongnu.org + + Discusses bugs, as well as engine internals, design issues, + specific licenses, porting, etc. + + Our home page can be found at + + https://www.freetype.org + + +--- end of FTL.TXT --- diff --git a/LIBS/SDL2_ttf-2.0.15/lib/x86/LICENSE.zlib.txt b/LIBS/SDL2_ttf-2.0.15/lib/x86/LICENSE.zlib.txt new file mode 100644 index 0000000..53ffccc --- /dev/null +++ b/LIBS/SDL2_ttf-2.0.15/lib/x86/LICENSE.zlib.txt @@ -0,0 +1,31 @@ +The source code to this library used with SDL_ttf can be found here: +https://hg.libsdl.org/SDL_image/file/default/external +--- + +Copyright notice: + + (C) 1995-2010 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* receiving +lengthy legal documents to sign. The sources are provided for free but without +warranty of any kind. The library has been entirely written by Jean-loup +Gailly and Mark Adler; it does not include third-party code. diff --git a/LIBS/SDL2_ttf-2.0.15/lib/x86/README.txt b/LIBS/SDL2_ttf-2.0.15/lib/x86/README.txt new file mode 100644 index 0000000..8affa0a --- /dev/null +++ b/LIBS/SDL2_ttf-2.0.15/lib/x86/README.txt @@ -0,0 +1,22 @@ +This library is distributed under the terms of the zlib license: + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + +Portions of this software are copyright © 2013 The FreeType Project (www.freetype.org). All rights reserved. + +The source is available from the SDL website: +http://www.libsdl.org/projects/SDL_ttf diff --git a/LIBS/SDL2_ttf-2.0.15/lib/x86/SDL2_ttf.dll b/LIBS/SDL2_ttf-2.0.15/lib/x86/SDL2_ttf.dll new file mode 100644 index 0000000..8bf6239 Binary files /dev/null and b/LIBS/SDL2_ttf-2.0.15/lib/x86/SDL2_ttf.dll differ diff --git a/LIBS/SDL2_ttf-2.0.15/lib/x86/SDL2_ttf.lib b/LIBS/SDL2_ttf-2.0.15/lib/x86/SDL2_ttf.lib new file mode 100644 index 0000000..841420f Binary files /dev/null and b/LIBS/SDL2_ttf-2.0.15/lib/x86/SDL2_ttf.lib differ diff --git a/LIBS/SDL2_ttf-2.0.15/lib/x86/libfreetype-6.dll b/LIBS/SDL2_ttf-2.0.15/lib/x86/libfreetype-6.dll new file mode 100644 index 0000000..41ac163 Binary files /dev/null and b/LIBS/SDL2_ttf-2.0.15/lib/x86/libfreetype-6.dll differ diff --git a/LIBS/SDL2_ttf-2.0.15/lib/x86/zlib1.dll b/LIBS/SDL2_ttf-2.0.15/lib/x86/zlib1.dll new file mode 100644 index 0000000..3a45deb Binary files /dev/null and b/LIBS/SDL2_ttf-2.0.15/lib/x86/zlib1.dll differ diff --git a/NOLF/ClientShellDLL/BaseFolder.cpp b/NOLF/ClientShellDLL/BaseFolder.cpp index 822e534..c75b19e 100644 --- a/NOLF/ClientShellDLL/BaseFolder.cpp +++ b/NOLF/ClientShellDLL/BaseFolder.cpp @@ -166,11 +166,6 @@ LTBOOL CBaseFolder::Init(int nFolderID) m_nAlignment = g_pLayoutMgr->GetFolderItemAlign((eFolderID)nFolderID); - int nWidth = m_HelpRect.right - m_HelpRect.left; - int nHeight = m_HelpRect.bottom - m_HelpRect.top; - if (!m_hHelpSurf) - m_hHelpSurf = g_pLTClient->CreateSurface((uint32)nWidth,(uint32)nHeight); - m_bInit=TRUE; return LTTRUE; } @@ -431,6 +426,15 @@ LTBOOL CBaseFolder::CreateTitle(int nStringID) LTBOOL CBaseFolder::Build() { + float yr = g_pInterfaceResMgr->GetYRatio(); + + int nWidth = (m_HelpRect.right - m_HelpRect.left) * yr; + int nHeight = (m_HelpRect.bottom - m_HelpRect.top) * yr; + if (!m_hHelpSurf) { + m_hHelpSurf = g_pLTClient->CreateSurface((uint32)nWidth, (uint32)nHeight); + } + + m_UpArrowPos = g_pLayoutMgr->GetUpArrowPos((eFolderID)m_nFolderID); m_DownArrowPos = g_pLayoutMgr->GetDownArrowPos((eFolderID)m_nFolderID); @@ -1670,6 +1674,27 @@ void CBaseFolder::AddBlankLine() pCtrl->Enable(LTFALSE); } +void CBaseFolder::FlushFolder() +{ + RemoveAll(); + + m_pBack = LTNULL; + m_pBackArrow = LTNULL; + + m_pUpArrow = LTNULL; + m_pDownArrow = LTNULL; + m_pMain = LTNULL; + m_pContinue = LTNULL; + m_pContinueArrow = LTNULL; + + if (m_hHelpSurf) { + g_pLTClient->DeleteSurface(m_hHelpSurf); + m_hHelpSurf = LTNULL; + } + + m_bBuilt = LTFALSE; +} + void CBaseFolder::UseArrows(LTBOOL bArrows, LTBOOL bLeft, LTBOOL bRight) { if (bArrows) @@ -2420,6 +2445,8 @@ void CBaseFolder::UpdateHelpText() { CLTGUICtrl *pCtrl = GetSelectedControl(); uint32 dwID = 0; + float yr = g_pInterfaceResMgr->GetYRatio(); + if (pCtrl) dwID = pCtrl->GetHelpID(); @@ -2427,8 +2454,8 @@ void CBaseFolder::UpdateHelpText() { m_dwCurrHelpID = dwID; - int nWidth = m_HelpRect.right - m_HelpRect.left; - int nHeight = m_HelpRect.bottom - m_HelpRect.top; + int nWidth = (m_HelpRect.right - m_HelpRect.left) * yr; + int nHeight = (m_HelpRect.bottom - m_HelpRect.top) * yr; LTRect rect(0,0,nWidth,nHeight); g_pLTClient->FillRect(m_hHelpSurf,&rect,kBlack); @@ -2436,7 +2463,7 @@ void CBaseFolder::UpdateHelpText() { HSTRING hHelpTxt = GetHelpString(m_dwCurrHelpID,m_nSelection); - GetHelpFont()->DrawFormat(hHelpTxt,m_hHelpSurf,0,0,(uint32)nWidth,kWhite); + GetHelpFont()->DrawFormat(hHelpTxt,m_hHelpSurf,0,0,(uint32)nWidth ,kWhite); g_pLTClient->OptimizeSurface(m_hHelpSurf,kBlack); g_pLTClient->FreeString(hHelpTxt); } diff --git a/NOLF/ClientShellDLL/BaseFolder.h b/NOLF/ClientShellDLL/BaseFolder.h index 77ed9cb..2b21132 100644 --- a/NOLF/ClientShellDLL/BaseFolder.h +++ b/NOLF/ClientShellDLL/BaseFolder.h @@ -210,7 +210,7 @@ class CBaseFolder : public CLTGUICommandHandler void AddPageBreak(); void AddBlankLine(); - + void FlushFolder(); protected: // Calls UpdateData on each control in the folder @@ -235,6 +235,8 @@ class CBaseFolder : public CLTGUICommandHandler // Returns FALSE if there isn't one under the specified point. LTBOOL GetControlUnderPoint(int xPos, int yPos, int *pnIndex); + + protected: void RemoveAll(); diff --git a/NOLF/ClientShellDLL/ClientShellDLL.vcxproj b/NOLF/ClientShellDLL/ClientShellDLL.vcxproj index ff319c7..7768df0 100644 --- a/NOLF/ClientShellDLL/ClientShellDLL.vcxproj +++ b/NOLF/ClientShellDLL/ClientShellDLL.vcxproj @@ -110,7 +110,7 @@ MaxSpeed true Level3 - $(SolutionDir)shared;$(SolutionDir)..\lt2\sdk\inc;$(SolutionDir)..\lt2\lithshared\incs;$(SolutionDir)ClientShellDLL;$(SolutionDir)..\LIBS\SDL2-2.0.10\include;$(SolutionDir)..\LIBS\detours\include;$(SolutionDir)..\lt2\lithshared\lith;$(SolutionDir)..\lt2\lithshared\ButeMgr\;$(SolutionDir)..\lt2\lithshared\CryptMgr;$(SolutionDir)..\lt2\lithshared\mfcstub;$(SolutionDir)ClientRes;%(AdditionalIncludeDirectories) + $(SolutionDir)shared;$(SolutionDir)..\lt2\sdk\inc;$(SolutionDir)..\lt2\lithshared\incs;$(SolutionDir)ClientShellDLL;$(SolutionDir)..\LIBS\SDL2-2.0.10\include;$(SolutionDir)..\LIBS\detours\include;$(SolutionDir)..\lt2\lithshared\lith;$(SolutionDir)..\lt2\lithshared\ButeMgr\;$(SolutionDir)..\lt2\lithshared\CryptMgr;$(SolutionDir)..\lt2\lithshared\mfcstub;$(SolutionDir)ClientRes;$(SolutionDir)..\LIBS\SDL2_ttf-2.0.15\include;%(AdditionalIncludeDirectories) _REZFILE;_FINAL;NDEBUG;_CLIENTBUILD;WIN32;_WINDOWS;_NOLFBUILD;NO_PRAGMA_LIBS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) .\Final_Release\ .\Final_Release\ClientShellDLL.pch @@ -147,9 +147,9 @@ LIBCMTD;\proj\libs\release\StdLith.lib;%(IgnoreSpecificDefaultLibraries) Final_Release\CShell.dll .\Final_Release\CShell.lib - odbc32.lib;odbccp32.lib;ButeMgr.lib;cryptmgr.lib;GameSpyClientMgr.lib;MFCStub.lib;StdLith.lib;RegMgr.lib;ltguimgr_LT2.lib;LithFontMgr_LT2.lib;SDL2.lib;SDL2main.lib;detours.lib;%(AdditionalDependencies) + odbc32.lib;odbccp32.lib;ButeMgr.lib;cryptmgr.lib;GameSpyClientMgr.lib;MFCStub.lib;StdLith.lib;RegMgr.lib;ltguimgr_LT2.lib;LithFontMgr_LT2.lib;SDL2.lib;SDL2main.lib;detours.lib;SDL2_ttf.lib;%(AdditionalDependencies) false - $(SolutionDir)..\lt2\lithshared\built\Release\ButeMgr;$(SolutionDir)..\lt2\lithshared\built\Release\CryptMgr;$(SolutionDir)..\lt2\lithshared\built\Release\MFCStub;$(SolutionDir)..\lt2\lithshared\libs\Release;$(SolutionDir)..\LIBS\SDL2-2.0.10\lib\x86;$(SolutionDir)..\LIBS\detours\lib.X86;%(AdditionalLibraryDirectories) + $(SolutionDir)..\lt2\lithshared\built\Release\ButeMgr;$(SolutionDir)..\lt2\lithshared\built\Release\CryptMgr;$(SolutionDir)..\lt2\lithshared\built\Release\MFCStub;$(SolutionDir)..\lt2\lithshared\libs\Release;$(SolutionDir)..\LIBS\SDL2-2.0.10\lib\x86;$(SolutionDir)..\LIBS\detours\lib.X86;$(SolutionDir)..\LIBS\SDL2_ttf-2.0.15\lib\x86;%(AdditionalLibraryDirectories) @@ -208,7 +208,7 @@ true Level3 true - ..\shared;..\..\lt2\sdk\inc;..\..\lt2\lithshared\incs;..\ClientShellDLL;..\..\LIBS\SDL2-2.0.10\include;..\..\LIBS\detours\include;..\..\lt2\lithshared\lith;..\..\lt2\lithshared\ButeMgr\;..\..\lt2\lithshared\CryptMgr;..\..\lt2\lithshared\mfcstub;..\ClientRes;%(AdditionalIncludeDirectories) + ..\shared;..\..\lt2\sdk\inc;..\..\lt2\lithshared\incs;..\ClientShellDLL;..\..\LIBS\SDL2-2.0.10\include;..\..\LIBS\detours\include;..\..\lt2\lithshared\lith;..\..\lt2\lithshared\ButeMgr\;..\..\lt2\lithshared\CryptMgr;..\..\lt2\lithshared\mfcstub;..\ClientRes;..\..\LIBS\SDL2_ttf-2.0.15\include;%(AdditionalIncludeDirectories) _DEBUG;_CLIENTBUILD;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;NO_PRAGMA_LIBS;%(PreprocessorDefinitions) .\Debug\ true @@ -254,10 +254,10 @@ call "D:\GameDev\no-one-lives-forever-master\NOLF\_after_build_debug.bat"Windows debug\CShell.dll .\Debug\CShell.lib - odbc32.lib;odbccp32.lib;ButeMgr.lib;cryptmgr.lib;GameSpyClientMgr.lib;MFCStub.lib;StdLith.lib;RegMgr.lib;ltguimgr_LT2.lib;LithFontMgr_LT2.lib;SDL2.lib;SDL2main.lib;detours.lib;%(AdditionalDependencies) + odbc32.lib;odbccp32.lib;ButeMgr.lib;cryptmgr.lib;GameSpyClientMgr.lib;MFCStub.lib;StdLith.lib;RegMgr.lib;ltguimgr_LT2.lib;LithFontMgr_LT2.lib;SDL2.lib;SDL2main.lib;detours.lib;SDL2_ttf.lib;%(AdditionalDependencies) false libcimtd.lib;MSVCRTD.lib - ..\..\lt2\lithshared\built\Debug\ButeMgr;..\..\lt2\lithshared\built\Debug\CryptMgr;..\..\lt2\lithshared\built\Debug\MFCStub;..\..\lt2\lithshared\libs\Debug;..\..\LIBS\SDL2-2.0.10\lib\x86;..\..\LIBS\detours\lib.X86;%(AdditionalLibraryDirectories) + ..\..\lt2\lithshared\built\Debug\ButeMgr;..\..\lt2\lithshared\built\Debug\CryptMgr;..\..\lt2\lithshared\built\Debug\MFCStub;..\..\lt2\lithshared\libs\Debug;..\..\LIBS\SDL2-2.0.10\lib\x86;..\..\LIBS\detours\lib.X86;..\..\LIBS\SDL2_ttf-2.0.15\lib\x86;%(AdditionalLibraryDirectories) @@ -431,6 +431,7 @@ call "D:\GameDev\no-one-lives-forever-master\NOLF\_after_build_debug.bat" + @@ -655,6 +656,7 @@ call "D:\GameDev\no-one-lives-forever-master\NOLF\_after_build_debug.bat" + @@ -688,6 +690,7 @@ call "D:\GameDev\no-one-lives-forever-master\NOLF\_after_build_debug.bat" + diff --git a/NOLF/ClientShellDLL/ClientShellDLL.vcxproj.filters b/NOLF/ClientShellDLL/ClientShellDLL.vcxproj.filters index 6e8e553..3c533f9 100644 --- a/NOLF/ClientShellDLL/ClientShellDLL.vcxproj.filters +++ b/NOLF/ClientShellDLL/ClientShellDLL.vcxproj.filters @@ -614,6 +614,9 @@ Source\Interface + + Source + @@ -1309,5 +1312,11 @@ Source\Interface + + Headers + + + Headers + \ No newline at end of file diff --git a/NOLF/ClientShellDLL/FolderDisplay.cpp b/NOLF/ClientShellDLL/FolderDisplay.cpp index 6add2c4..9d3b616 100644 --- a/NOLF/ClientShellDLL/FolderDisplay.cpp +++ b/NOLF/ClientShellDLL/FolderDisplay.cpp @@ -396,10 +396,8 @@ LTBOOL CFolderDisplay::SetRenderer(int nRendererIndex, int nResolutionIndex) SDL_SetWindowSize(g_SDLWindow, newMode.m_Width, newMode.m_Height); SDL_SetWindowPosition(g_SDLWindow, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); - g_pInterfaceMgr->ScreenDimsChanged(); - g_pInterfaceMgr->InitCursor(); - - g_pInterfaceResMgr->HandleBorderlessWindowed(); + // This will now call the rest of the options! + g_pInterfaceMgr->ScreenDimsChanged(LTTRUE); return LTTRUE; } diff --git a/NOLF/ClientShellDLL/FolderMain.cpp b/NOLF/ClientShellDLL/FolderMain.cpp index 1b5e061..273b37c 100644 --- a/NOLF/ClientShellDLL/FolderMain.cpp +++ b/NOLF/ClientShellDLL/FolderMain.cpp @@ -192,10 +192,19 @@ LTBOOL CFolderMain::Render(HSURFACE hDestSurf) pFont->Draw(m_BuildVersion, hDestSurf, (m_BuildPos.x * g_pInterfaceResMgr->GetXRatio()) + g_pInterfaceResMgr->GetXOffset(), m_BuildPos.y*g_pInterfaceResMgr->GetYRatio(), LTF_JUSTIFY_RIGHT, kBlack); -/* font test - pFont = g_pInterfaceResMgr->GetTitleFont(); - LTIntPt pos(320+g_pInterfaceResMgr->GetXOffset(),50+g_pInterfaceResMgr->GetYOffset()); +/* font test */ + pFont = g_pInterfaceResMgr->GetLargeFont(); int ht = pFont->GetHeight(); + int x = 512 + g_pInterfaceResMgr->GetXOffset(); + int y = 50 + g_pInterfaceResMgr->GetYOffset(); + LTRect rect = { x, y, x + 512, y + ht * 10 }; + HLTCOLOR colour = g_pLTClient->CreateColor(1, 1, 1, false); + g_pOptimizedRenderer->FillRect(g_pLTClient->GetScreenSurface(), &rect, colour); + + + LTIntPt pos(512+g_pInterfaceResMgr->GetXOffset(),50+g_pInterfaceResMgr->GetYOffset()); + + pFont->Draw("! \" # $ % & ' ( ) *",hDestSurf,pos.x,pos.y,LTF_JUSTIFY_LEFT); pos.y += ht; pFont->Draw("+ , - . / 0 1 2 3 4",hDestSurf,pos.x,pos.y,LTF_JUSTIFY_LEFT); diff --git a/NOLF/ClientShellDLL/FolderMgr.cpp b/NOLF/ClientShellDLL/FolderMgr.cpp index 973ebd4..ed9a7b2 100644 --- a/NOLF/ClientShellDLL/FolderMgr.cpp +++ b/NOLF/ClientShellDLL/FolderMgr.cpp @@ -609,3 +609,44 @@ void CFolderMgr::SkipOutfitting(void) pGear->SkipOutfitting(); } } + +void CFolderMgr::FlushAllFolders() +{ +#if 1 + // Tell the old folder that it is losing focus + if (m_pCurrentFolder) + { + m_pCurrentFolder->OnFocus(LTFALSE); + m_pCurrentFolder = LTNULL; + } + + for (int i = 0; i < m_folderArray.GetSize(); i++) + { + auto pFolder = m_folderArray.GetAt(i); + + if (!pFolder->IsBuilt()) { + continue; + } + + pFolder->FlushFolder(); + //pFolder->Build(); + } +#else + for (int i = 0; i < m_folderArray.GetSize(); i++) + { + auto folder = m_folderArray.GetAt(i); + folder->Term(); + debug_delete(folder); + } + + m_folderArray.RemoveAll(); + + //build folder array + m_folderArray.SetSize(0); + + for (int nID = FOLDER_ID_MAIN; nID < FOLDER_ID_UNASSIGNED; nID++) + { + AddFolder((eFolderID)nID); + } +#endif +} diff --git a/NOLF/ClientShellDLL/FolderMgr.h b/NOLF/ClientShellDLL/FolderMgr.h index e02600e..9b11c36 100644 --- a/NOLF/ClientShellDLL/FolderMgr.h +++ b/NOLF/ClientShellDLL/FolderMgr.h @@ -121,6 +121,8 @@ class CFolderMgr CBaseFolder* GetFolderFromID(eFolderID folderID); void SkipOutfitting(void); + void FlushAllFolders(); + private: void AddFolder(eFolderID folderID); diff --git a/NOLF/ClientShellDLL/FontMgr.cpp b/NOLF/ClientShellDLL/FontMgr.cpp new file mode 100644 index 0000000..556ffd5 --- /dev/null +++ b/NOLF/ClientShellDLL/FontMgr.cpp @@ -0,0 +1,368 @@ +#include "stdafx.h" +#include "FontMgr.h" +#include "SDL.h" +#include "SDL_ttf.h" +#include "MakePCX.h" +#include "WinUtil.h" + +#include +#include +#include + +// Uncomment for helpful debugging, it'll break the font though. +//#define IMAGE_DEBUG + +extern CLayoutMgr* g_pLayoutMgr; +extern SDL_Window* g_SDLWindow; + +FontMgr* g_pFontMgr = NULL; + +FontMgr::FontMgr() +{ + g_pFontMgr = this; +} + +FontMgr::~FontMgr() +{ + Term(); +} + +bool FontMgr::Init() +{ + if (TTF_Init() == -1) { + g_pLTClient->CPrint("TTF_Init: %s\n", TTF_GetError()); + SDL_Log("TTF_Init: %s\n", TTF_GetError()); + ASSERT(LTFALSE); + return false; + } + + char szFontFolder[128]; + g_pLayoutMgr->GetScaleFontFolder(szFontFolder, sizeof(szFontFolder)); + + if (!CWinUtil::DirExist(szFontFolder)) { + int ret = CWinUtil::CreateDir(szFontFolder); + + if (!ret) + { + ShowCursor(TRUE); + char szPath[256]; + DWORD nResult = GetModuleFileName(NULL, szPath, sizeof(szPath)); + + // Make our font cache folder path! + std::string sFontFolderPath = szPath; + sFontFolderPath = StringReplace("lithtech.exe", "", sFontFolderPath); + sFontFolderPath += szFontFolder; + + std::string sMessage = "This is awkward, we couldn't create the font cache folder...\n\nCan you make the folders at:\n" + sFontFolderPath + "\n\nIf you have anymore troubles you can turn off scalable fonts by adding \"ScaleFonts\" \"0\" to your autoexec.cfg\n\nI've also added this message to debug.log in your NOLF installation folder!\n\nCheers!"; + + // Throw it in debug.log! + SDL_Log("!! ERROR START !!"); + SDL_Log(sMessage.c_str()); + SDL_Log("!! ERROR END !!"); + + // Create a new window so it'll show up for fullscreen folks! + SDL_Window* hMsgWindow = SDL_CreateWindow("Oops!", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 0, 0, SDL_WINDOW_HIDDEN); + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Oops!", sMessage.c_str(), hMsgWindow); + SDL_DestroyWindow(hMsgWindow); + return false; + } + } + + return true; +} + +bool FontMgr::Term() +{ + return true; +} + +void FontMgr::SetPixel(SDL_Surface* pSurface, int x, int y, int r, int g, int b) +{ + int bpp = pSurface->format->BytesPerPixel; + /* Here p is the address to the pixel we want to retrieve */ + Uint8* p = (Uint8*)pSurface->pixels + y * pSurface->pitch + x * bpp; + + uint32 colour = SDL_MapRGB(pSurface->format, r, g, b); + + *p = colour & 0xFF; +} + +// +// Get Trim Dimensions +// Terms: SOLID = a non black pixel +// VOID/BLACK = a fully black pixel (rgb: 0, 0, 0) +// +void FontMgr::GetTrimDims(SDL_Surface* pSurface, int startX, int* outLeft, int* outRight) +{ + int x = startX; + int bpp = pSurface->format->BytesPerPixel; + int left = 0; + int right = 0; + + bool bFoundLeft = false; + bool bThisColumnIsSolid = false; + bool bLastColumnIsSolid = false; + bool bFoundSolidAfterRight = false; + + int debug_found_solid_at_y = -1; + + const int BLACK = 0; + + // Loop through every column! + while (x < pSurface->w) { + + bThisColumnIsSolid = false; + + for (int y = 0; y < pSurface->h; y++) + { + /* Here p is the address to the pixel we want to retrieve */ + Uint8* p = (Uint8*)pSurface->pixels + y * pSurface->pitch + x * bpp; + + int pixel = *p; + + // Check if we've found the first solid block + if (!bFoundLeft && pixel != BLACK) + { + bFoundLeft = true; + left = x; + } + + // We found a solid! Mark this row as solid. + if (pixel != BLACK) + { + debug_found_solid_at_y = y; + bThisColumnIsSolid = true; + } + } + + // Hey we found a possible right position! + // Save our current x position. + if (bLastColumnIsSolid && !bThisColumnIsSolid) + { + right = x; + } + + // This allows to determine if might be some middle void + // In case the surface ends in a solid. + if (right && !bFoundSolidAfterRight) + { + bFoundSolidAfterRight = true; + } + + // Carry forward... + bLastColumnIsSolid = bThisColumnIsSolid; + + // Foward! + x++; + } + + // If we never wrote our right value... + // OR + // If we found solid after we wrote our right value + // and the last row is solid, that means there was some middle void + // and we want to ignore that, and use the surface width as our right value! + if (right == 0 || (bFoundSolidAfterRight && bLastColumnIsSolid)) + { + right = pSurface->w; + } + + + if (outLeft != NULL) + { + *outLeft = left; + } + + if (outRight != NULL) + { + *outRight = right; + } +} + +// +// Because symbols like " exists we have to actually find the break in the middle so we can draw a barely transparent line to connect them.. +// +void FontMgr::GlyphCheckForEmpty(SDL_Surface* pSurface, int start, int &minX, int &maxX) +{ + int originalX = minX; + + + bool bFoundMin = false; + bool bFoundMax = false; + + while (!bFoundMin || !bFoundMax) + { + bool bFoundUninterruptedMin = true; + bool bFoundUninterruptedMax = false; + for (int y = 0; y < pSurface->h; y++) + { + int bpp = pSurface->format->BytesPerPixel; + /* Here p is the address to the pixel we want to retrieve */ + Uint8* p = (Uint8*)pSurface->pixels + y * pSurface->pitch + start * bpp; + + if (*p != 0) + { + bFoundUninterruptedMin = false; + } + + // We want to find the first solid + if (bFoundMin && *p != 0) + { + bFoundUninterruptedMax = true; + } + } + + if (!bFoundMin && bFoundUninterruptedMin) + { + minX = start; + bFoundMin = true; + } + + if (!bFoundMax && bFoundUninterruptedMax) + { + maxX = start; + bFoundMax = true; + } + + // Retreat! + if (!bFoundMin || !bFoundMax) { + start++; + } + + if (start == pSurface->w) { + break; + } + + } + +} + +bool FontMgr::LoadAndExport(std::string font, int size, std::string filename, bool forceGenerate) +{ + // Check to see if the font has already been saved + SDL_RWops* in = SDL_RWFromFile(filename.c_str(), "rb"); + + // If it has, then we don't need to regenerate it + // unless we want to generate it again! + if (in && !forceGenerate) + { + SDL_RWclose(in); + return true; + } + + // load font.ttf at size 16 into font + TTF_Font* pFont; + pFont = TTF_OpenFont(font.c_str(), size); + if (!pFont) { + g_pLTClient->CPrint("TTF_OpenFont: %s\n", TTF_GetError()); + SDL_Log("TTF_OpenFont: %s\n", TTF_GetError()); + return false; + } + + SDL_Color color = { 255,255,255 }; + SDL_Color bg = { 0,0,0 }; + SDL_Surface* pSurface; + + // Our character map + std::string sFontCharacters = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]#_`abcdefghijklmnopqrstuvwxyz{|}~"; + + std::string sFillerCharacters = sFontCharacters; + + // Add some extra width + sFillerCharacters += "=========================================="; + + // Create the initial file to cheat the width and height! + pSurface = TTF_RenderText_Shaded(pFont, sFillerCharacters.c_str(), color, bg); + SDL_Rect rect = { 0, 0, pSurface->w, pSurface->h }; + + // Ok fill it with black! + SDL_FillRect(pSurface, &rect, 0); + + // X starts at 1, because we need one black space. + int x = 1; + +#ifdef IMAGE_DEBUG + SDL_Rect line = { x, 0, 1, pSurface->h }; + SDL_FillRect(pSurface, &line, SDL_MapRGB(pSurface->format, 255, 255, 255)); + + SDL_SaveBMP(pSurface, "pSurface.bmp"); +#endif + + // Ok let's loop through every character in our beautiful font alphabet + // We only want ONE PIXEL of space between characters. + for (auto glyph : sFontCharacters) + { + int minX, minY, maxX, maxY, advance; + TTF_GlyphMetrics(pFont, glyph, &minX, &maxX, &minY, &maxY, &advance); + + SDL_Surface* pGlyph = TTF_RenderGlyph_Shaded(pFont, glyph, color, bg); + +#ifdef IMAGE_DEBUG + // Debug dump every glyph + std::string filename = "chars\\"; + filename += glyph; + filename += ".bmp"; + + SDL_SaveBMP(pGlyph, filename.c_str()); +#endif + + // Get our REAL minX and maxX. Fonts like to lie. + GetTrimDims(pGlyph, 0, &minX, &maxX); + + int glyphWidth = maxX - minX; + + // Ok special case for symbols that are separated but are actually one + // We need to draw a barely transparent line (fonts are blended, so darker the better!) + // So that the engine picks it up as one character! + // + // We could probably run this on every character, but our map only has one character like this... + // + if (glyph == '\"') + { + int emptyMin = 0; + int emptyMax = 0; + + GlyphCheckForEmpty(pGlyph, minX, emptyMin, emptyMax); + + for (int i = emptyMin; i < emptyMax; i++) + { + SetPixel(pGlyph, i, 0, 128, 128, 128); + } + + } + + // Use glyphCheck's positioning in case we need to get rid of some extra spaces at the start! + rect = { x, 0, x + glyphWidth, 0 }; + SDL_Rect srcRect = { minX, 0, maxX, pGlyph->h }; + + SDL_BlitSurface(pGlyph, &srcRect, pSurface, &rect); + + // Advance our x position! + x += glyphWidth + 1; + +#ifdef IMAGE_DEBUG + line = { x, 0, 1, pSurface->h }; + SDL_FillRect(pSurface, &line, SDL_MapRGB(pSurface->format, 255, 255, 255)); + + SDL_SaveBMP(pSurface, "pSurface.bmp"); +#endif + } + + // Create a new scaled surface + SDL_Surface* pRealSurface = SDL_CreateRGBSurface(0, x + 2, pSurface->h, 8, 0, 0, 0, 0); + + // Set the palette colours so we'll actually get something! + SDL_SetPaletteColors(pRealSurface->format->palette, pSurface->format->palette->colors, 0, pSurface->format->palette->ncolors); + + // Blit the old surface onto the new scaled surface + rect = { 0, 0, x, pSurface->h }; + SDL_BlitSurface(pSurface, NULL, pRealSurface, &rect); + + MakePCX(pRealSurface, filename); + + SDL_FreeSurface(pSurface); + SDL_FreeSurface(pRealSurface); + + return true; +} + + diff --git a/NOLF/ClientShellDLL/FontMgr.h b/NOLF/ClientShellDLL/FontMgr.h new file mode 100644 index 0000000..8a2e611 --- /dev/null +++ b/NOLF/ClientShellDLL/FontMgr.h @@ -0,0 +1,21 @@ +#pragma once +#include + +class FontMgr +{ +public: + FontMgr(); + ~FontMgr(); + + bool Init(); + bool Term(); + + bool LoadAndExport(std::string font, int size, std::string filename, bool forceGenerate); + +protected: + void GlyphCheckForEmpty(SDL_Surface* pSurface, int start, int& minX, int& maxX); + void GetTrimDims(SDL_Surface* pSurface, int startX, int* outLeft, int* outRight); + void SetPixel(SDL_Surface* pSurface, int x, int y, int r, int g, int b); + +}; + diff --git a/NOLF/ClientShellDLL/GameClientShell.cpp b/NOLF/ClientShellDLL/GameClientShell.cpp index 1dd7a3f..17f194d 100644 --- a/NOLF/ClientShellDLL/GameClientShell.cpp +++ b/NOLF/ClientShellDLL/GameClientShell.cpp @@ -57,6 +57,7 @@ #include #include "ConsoleMgr.h" #include "DetourMgr.h" +#include "FontMgr.h" extern ConsoleMgr* g_pConsoleMgr; @@ -161,6 +162,8 @@ VarTrack g_vtFOVYMinUW; VarTrack g_vtUWFOVRate; VarTrack g_vtPlayerName; +VarTrack g_vtScaleFonts; + LTFLOAT s_fDemoTime = 0.0f; LTFLOAT s_fDeadTimer = 0.0f; LTFLOAT s_fDeathDelay = 0.0f; @@ -1100,6 +1103,9 @@ uint32 CGameClientShell::OnEngineInitialized(RMode *pMode, LTGUID *pAppGuid) g_vtFOVYMinUW.Init(g_pLTClient, "FOVYUWMin", NULL, 77.0f); g_vtUWFOVRate.Init(g_pLTClient, "FOVUWRate", NULL, 0.3f); + // Use scale fonts! + g_vtScaleFonts.Init(g_pLTClient, "ScaleFonts", NULL, 1.0f); + HCONSOLEVAR hIsSet = g_pLTClient->GetConsoleVar("UpdateRateInitted"); if (!hIsSet || g_pLTClient->GetVarValueFloat(hIsSet) != 1.0f) { @@ -1217,6 +1223,9 @@ uint32 CGameClientShell::OnEngineInitialized(RMode *pMode, LTGUID *pAppGuid) // Interface stuff... + + //pFontMgr->Load("C:\\Windows\\Fonts\\Comic.ttf", 40); + if (!m_InterfaceMgr.Init()) { // Don't call ShutdownWithMessage since InterfaceMgr will have called @@ -1442,6 +1451,11 @@ uint32 CGameClientShell::OnEngineInitialized(RMode *pMode, LTGUID *pAppGuid) DetourMgr* detourMgr = new DetourMgr(); detourMgr->Init(); + /* + FontMgr* pFontMgr = new FontMgr(); + pFontMgr->Init(); + pFontMgr->Load("Fonts\\KIMBERLE.TTF", 32); + */ return LT_OK; } @@ -3800,13 +3814,13 @@ void CGameClientShell::UpdateContainerFX() if (IsLiquid(m_eCurContainerCode) && !IsLiquid(eCode)) { UpdateUnderWaterFX(LTFALSE); - g_pLTClient->RunConsoleString("+ModelWarble 0"); + //g_pLTClient->RunConsoleString("+ModelWarble 0"); m_InterfaceMgr.EndUnderwater(); } if (!IsLiquid(m_eCurContainerCode) && IsLiquid(eCode)) { - g_pLTClient->RunConsoleString("ModelWarble 1"); + //g_pLTClient->RunConsoleString("ModelWarble 1"); m_InterfaceMgr.BeginUnderwater(); } @@ -9373,4 +9387,7 @@ const char *CGameClientShell::GetDisconnectMsg() return LTNULL; } - +LTBOOL CGameClientShell::UseScaleFonts() +{ + return (LTBOOL)g_vtScaleFonts.GetFloat(); +} diff --git a/NOLF/ClientShellDLL/GameClientShell.h b/NOLF/ClientShellDLL/GameClientShell.h index 8cfbb3d..9da95fc 100644 --- a/NOLF/ClientShellDLL/GameClientShell.h +++ b/NOLF/ClientShellDLL/GameClientShell.h @@ -272,6 +272,8 @@ class CGameClientShell : public IClientShell void SetFramerateLock(LTBOOL bLock) { m_bLockFramerate = bLock; } void UpdateConfigSettings(); + LTBOOL UseScaleFonts(); + protected : uint32 OnEngineInitialized(RMode *pMode, LTGUID *pAppGuid); diff --git a/NOLF/ClientShellDLL/InterfaceMgr.cpp b/NOLF/ClientShellDLL/InterfaceMgr.cpp index cef3bd0..5cd0815 100644 --- a/NOLF/ClientShellDLL/InterfaceMgr.cpp +++ b/NOLF/ClientShellDLL/InterfaceMgr.cpp @@ -28,6 +28,7 @@ #include "SDL.h" #include #include "ConsoleMgr.h" +#include "FontMgr.h" extern ConsoleMgr* g_pConsoleMgr; @@ -312,6 +313,7 @@ LTBOOL CInterfaceMgr::Init() g_pLTClient->ShutdownWithMessage("ERROR in CInterfaceMgr::Init(): Could not initialize LayoutMgr!"); return LTFALSE; } + hShadeColor = m_LayoutMgr.GetShadeColor(); if (!m_InterfaceResMgr.Init(g_pLTClient, g_pGameClientShell)) @@ -4051,10 +4053,19 @@ void CInterfaceMgr::MissionFailed(int nFailStringId) // // --------------------------------------------------------------------------- // -void CInterfaceMgr::ScreenDimsChanged() +void CInterfaceMgr::ScreenDimsChanged(LTBOOL bComingFromDisplay) { + // Need to flush the folders before the fonts resize + // Otherwise the destroy on text elements MIGHT reference the old fonts! + m_FolderMgr.FlushAllFolders(); + + // Font will resize here! m_InterfaceResMgr.ScreenDimsChanged(); + // Update some classes that for some reason hold a global font >:( + GetPlayerStats()->FlushFonts(); + GetMessageMgr()->FlushFonts(); + // Update the camera rect... uint32 dwWidth = 640, dwHeight = 480; @@ -4071,6 +4082,15 @@ void CInterfaceMgr::ScreenDimsChanged() g_pOptimizedRenderer->Term(); g_pOptimizedRenderer->Init(); + + // Just in case this gets called anywhere else. + if (bComingFromDisplay) { + // We can now do these boys! + g_pInterfaceMgr->InitCursor(); + g_pInterfaceResMgr->HandleBorderlessWindowed(); + + m_FolderMgr.SetCurrentFolder(FOLDER_ID_OPTIONS); + } } diff --git a/NOLF/ClientShellDLL/InterfaceMgr.h b/NOLF/ClientShellDLL/InterfaceMgr.h index f01e470..ddc447b 100644 --- a/NOLF/ClientShellDLL/InterfaceMgr.h +++ b/NOLF/ClientShellDLL/InterfaceMgr.h @@ -278,7 +278,7 @@ class CInterfaceMgr void UpdatePlayerStats(uint8 nThing, uint8 nType1, uint8 nType2, LTFLOAT fAmount); void UpdateWeaponStats(uint8 nWeaponId, uint8 nAmmoId, uint32 dwAmmo); - void ScreenDimsChanged(); + void ScreenDimsChanged(LTBOOL bComingFromDisplay = LTFALSE); LTIntPt GetCursorPos() {return m_CursorPos;} LTBOOL IsCursorUsed() {return m_bUseCursor;} diff --git a/NOLF/ClientShellDLL/InterfaceResMgr.cpp b/NOLF/ClientShellDLL/InterfaceResMgr.cpp index 1be3705..842c519 100644 --- a/NOLF/ClientShellDLL/InterfaceResMgr.cpp +++ b/NOLF/ClientShellDLL/InterfaceResMgr.cpp @@ -9,10 +9,12 @@ #include "ClientButeMgr.h" #include "SDL.h" #include "ConsoleMgr.h" +#include "FontMgr.h" CInterfaceResMgr* g_pInterfaceResMgr = LTNULL; extern SDL_Window* g_SDLWindow; extern ConsoleMgr* g_pConsoleMgr; +extern FontMgr* g_pFontMgr; namespace { @@ -33,7 +35,6 @@ CInterfaceResMgr::CInterfaceResMgr() m_pTitleFont = LTNULL; m_pLargeFont = LTNULL; - m_pLargeHDFont = LTNULL; m_pMediumFont = LTNULL; m_pSmallFont = LTNULL; m_pHelpFont = LTNULL; @@ -54,6 +55,8 @@ CInterfaceResMgr::CInterfaceResMgr() m_fUserScale = 0.50; + m_bFontsSetup = LTFALSE; + } CInterfaceResMgr::~CInterfaceResMgr() @@ -111,19 +114,26 @@ LTBOOL CInterfaceResMgr::Init(ILTClient* pClientDE, CGameClientShell* pClientShe // Init the InterfaceSurfMgr class m_InterfaceSurfMgr.Init(g_pLTClient); + // Init font stuff here! + FontMgr* pFontMgr = new FontMgr(); + if (!g_pFontMgr->Init()) { + // If we can't init FontMgr that means we couldn't create the font folder, so force quit out! + SDL_Quit(); + return LTFALSE; + } + + // This now includes InitFonts // set resolution dependant variables ScreenDimsChanged(); - - // Initialize the fonts - if (!InitFonts()) - { - return LTFALSE; + /* + if (!SetupScaleFonts()) { + return LTFALSE; } + */ g_pConsoleMgr->Init(); - HandleBorderlessWindowed(); m_fUserScale = GetConfigFloat("UIScale", 0.5f); @@ -150,67 +160,7 @@ void CInterfaceResMgr::Term() m_hSurfCursor = NULL; } - if ( m_pHelpFont ) - { - m_pHelpFont->Term(); - debug_delete(m_pHelpFont); - m_pHelpFont=LTNULL; - } - if ( m_pSmallFont ) - { - m_pSmallFont->Term(); - debug_delete(m_pSmallFont); - m_pSmallFont=LTNULL; - } - if ( m_pMediumFont ) - { - m_pMediumFont->Term(); - debug_delete(m_pMediumFont); - m_pMediumFont=LTNULL; - } - if ( m_pLargeFont ) - { - m_pLargeFont->Term(); - debug_delete(m_pLargeFont); - m_pLargeFont=LTNULL; - } - if ( m_pLargeHDFont ) - { - m_pLargeHDFont->Term(); - debug_delete(m_pLargeHDFont); - m_pLargeHDFont=LTNULL; - } - if ( m_pTitleFont ) - { - m_pTitleFont->Term(); - debug_delete(m_pTitleFont); - m_pTitleFont=LTNULL; - } - if ( m_pMsgForeFont ) - { - m_pMsgForeFont->Term(); - debug_delete(m_pMsgForeFont); - m_pMsgForeFont=LTNULL; - } - if ( m_pHUDForeFont ) - { - m_pHUDForeFont->Term(); - debug_delete(m_pHUDForeFont); - m_pHUDForeFont=LTNULL; - } - if ( m_pAirFont ) - { - m_pAirFont->Term(); - debug_delete(m_pAirFont); - m_pAirFont=LTNULL; - } - if ( m_pChooserFont ) - { - m_pChooserFont->Term(); - debug_delete(m_pChooserFont); - m_pChooserFont=LTNULL; - } - + TermFonts(); } ////////////////////////////////////////////////////////////////////// @@ -249,6 +199,93 @@ void CInterfaceResMgr::Clean() } } +std::string CInterfaceResMgr::FixScaleFontName(std::string sFileName, bool bKeepUpDirectory) +{ + // If we requested it, remove the ..\ at the start. + if (!bKeepUpDirectory) { + sFileName = sFileName.substr(3, sFileName.length()); + } + // Remove the .PCX + sFileName = sFileName.substr(0, sFileName.length() - 4); + + // Add screen resolution + sFileName += "_" + std::to_string(GetScreenWidth()) + "x" + std::to_string(GetScreenHeight()); + + // Re-add the extension + sFileName += ".pcx"; + + return sFileName; +} + +// +// Loads TTFs and exports the approiately scaled PCXs +// +LTBOOL CInterfaceResMgr::SetupScaleFonts() +{ + if (m_bFontsSetup) { + TermFonts(); + } + + // If we're not using scale fonts, we don't need to do this setup + if (!g_pGameClientShell->UseScaleFonts()) { + + return InitFonts(); + } + + // Initialize some font magic here + char szFontName[128]; + std::string sFileName = ""; + bool bForceGenerate = true; + + float nResolutionRatio = 1.0f;//(GetYRatio() * 0.50f); + int nTitle = (int)((LTFLOAT)32 * nResolutionRatio); + int nLarge = (int) ((LTFLOAT)28 * nResolutionRatio); + int nMedium = (int) ((LTFLOAT)20 * nResolutionRatio); + int nSmall = (int)((LTFLOAT)14 * nResolutionRatio); + + // Cap the font size so we don't exceed 2000 pixels in width + // Might need to pack my own d3dim700.dll to fix this... + /* + nTitle = min(30, nTitle); + nLarge = min(30, nLarge); + nMedium = min(30, nMedium); + nSmall = min(30, nSmall); + */ +#if 1 + g_pLayoutMgr->GetLargeFontBase(szFontName, sizeof(szFontName)); + sFileName = FixScaleFontName(szFontName, false); + g_pFontMgr->LoadAndExport("Fonts\\SQR721B.TTF", nLarge, sFileName, bForceGenerate); + + g_pLayoutMgr->GetHelpFont(szFontName, sizeof(szFontName)); + sFileName = FixScaleFontName(szFontName, false); + g_pFontMgr->LoadAndExport("Fonts\\SQR721B.TTF", nSmall, sFileName, bForceGenerate); + + g_pLayoutMgr->GetTitleFont(szFontName, sizeof(szFontName)); + sFileName = FixScaleFontName(szFontName, false); + g_pFontMgr->LoadAndExport("Fonts\\SQR721KN.TTF", nTitle, sFileName, bForceGenerate); + + g_pLayoutMgr->GetMediumFontBase(szFontName, sizeof(szFontName)); + sFileName = FixScaleFontName(szFontName, false); + g_pFontMgr->LoadAndExport("Fonts\\SQR721B.TTF", nMedium, sFileName, bForceGenerate); + + g_pLayoutMgr->GetSmallFontBase(szFontName, sizeof(szFontName)); + sFileName = FixScaleFontName(szFontName, false); + g_pFontMgr->LoadAndExport("Fonts\\SQR721B.TTF", nSmall, sFileName, bForceGenerate); + + g_pLayoutMgr->GetHUDForeFont(szFontName, sizeof(szFontName)); + sFileName = FixScaleFontName(szFontName, false); + g_pFontMgr->LoadAndExport("Fonts\\SQR721B.TTF", nMedium, sFileName, bForceGenerate); + + g_pLayoutMgr->GetMsgForeFont(szFontName, sizeof(szFontName)); + sFileName = FixScaleFontName(szFontName, false); + g_pFontMgr->LoadAndExport("Fonts\\SQR721B.TTF", nLarge, sFileName, bForceGenerate); +#endif + + // Initialize the fonts + return InitFonts(); + +} + ////////////////////////////////////////////////////////////////////// // Function name : CInterfaceResMgr::DrawFolder // Description : @@ -418,8 +455,6 @@ void CInterfaceResMgr::HandleBorderlessWindowed() LTBOOL CInterfaceResMgr::InitFonts() { - - m_pSmallFont = debug_new(CLTGUIFont); m_pMediumFont = debug_new(CLTGUIFont); m_pLargeFont = debug_new(CLTGUIFont); @@ -430,10 +465,6 @@ LTBOOL CInterfaceResMgr::InitFonts() m_pAirFont = debug_new(CLTGUIFont); m_pChooserFont = debug_new(CLTGUIFont); - // HD Fonts - m_pLargeHDFont = debug_new(CLTGUIFont); - - // Initialize the bitmap fonts if we are in english if (IsEnglish()) { @@ -472,17 +503,8 @@ LTBOOL CInterfaceResMgr::InitFonts() return LTFALSE; } - //g_pLayoutMgr->GetLargeFontBase(g_szFontName,sizeof(g_szFontName)); - LTStrCpy(g_szFontName, "interface\\fonts\\font_large_0_hd.pcx", sizeof(g_szFontName)); - if (!SetupFont(m_pLargeHDFont)) - { - debug_delete(m_pLargeHDFont); - m_pLargeHDFont=LTNULL; - return LTFALSE; - } - // ************* Title font - g_pLayoutMgr->GetTitleFont(g_szFontName,sizeof(g_szFontName)); + g_pLayoutMgr->GetLargeFontBase(g_szFontName,sizeof(g_szFontName)); if (!SetupFont(m_pTitleFont)) { if (!SetupFont(m_pTitleFont,LTFALSE)) @@ -569,10 +591,75 @@ LTBOOL CInterfaceResMgr::InitFonts() // CLTGUIFont::SetWrapMethod(LTFALSE); // } + m_bFontsSetup = LTTRUE; + return LTTRUE; } +LTBOOL CInterfaceResMgr::TermFonts() +{ + + if (m_pHelpFont) + { + m_pHelpFont->Term(); + debug_delete(m_pHelpFont); + m_pHelpFont = LTNULL; + } + if (m_pSmallFont) + { + m_pSmallFont->Term(); + debug_delete(m_pSmallFont); + m_pSmallFont = LTNULL; + } + if (m_pMediumFont) + { + m_pMediumFont->Term(); + debug_delete(m_pMediumFont); + m_pMediumFont = LTNULL; + } + if (m_pLargeFont) + { + m_pLargeFont->Term(); + debug_delete(m_pLargeFont); + m_pLargeFont = LTNULL; + } + if (m_pTitleFont) + { + m_pTitleFont->Term(); + debug_delete(m_pTitleFont); + m_pTitleFont = LTNULL; + } + if (m_pMsgForeFont) + { + m_pMsgForeFont->Term(); + debug_delete(m_pMsgForeFont); + m_pMsgForeFont = LTNULL; + } + if (m_pHUDForeFont) + { + m_pHUDForeFont->Term(); + debug_delete(m_pHUDForeFont); + m_pHUDForeFont = LTNULL; + } + if (m_pAirFont) + { + m_pAirFont->Term(); + debug_delete(m_pAirFont); + m_pAirFont = LTNULL; + } + if (m_pChooserFont) + { + m_pChooserFont->Term(); + debug_delete(m_pChooserFont); + m_pChooserFont = LTNULL; + } + + m_bFontsSetup = LTFALSE; + + return LTTRUE; +} + // ******************************************************************* // Initialize an engine font from string IDs that represent the name, width, and height @@ -674,6 +761,8 @@ void CInterfaceResMgr::ScreenDimsChanged() m_dwScreenWidth = currentMode.m_Width; m_dwScreenHeight = currentMode.m_Height; + // Adjust scale fonts + SetupScaleFonts(); // Re-init the console g_pConsoleMgr->Init(); @@ -861,13 +950,16 @@ HSURFACE CInterfaceResMgr::CreateSurfaceFromString(CLTGUIFont *pFont, char *lpsz g_pLTClient->FreeString(hString); } - - LTBOOL CInterfaceResMgr::SetupFont(CLTGUIFont *pFont, LTBOOL bBlend, uint32 dwFlags) { + std::string sFontName = g_szFontName; + + if (g_pGameClientShell->UseScaleFonts()) { + sFontName = FixScaleFontName(sFontName, true); + } LITHFONTCREATESTRUCT lithFont; - lithFont.szFontBitmap = g_szFontName; + lithFont.szFontBitmap = (char*)sFontName.c_str(); lithFont.nGroupFlags = dwFlags; if (bBlend) { diff --git a/NOLF/ClientShellDLL/InterfaceResMgr.h b/NOLF/ClientShellDLL/InterfaceResMgr.h index 0b2d325..6139e3e 100644 --- a/NOLF/ClientShellDLL/InterfaceResMgr.h +++ b/NOLF/ClientShellDLL/InterfaceResMgr.h @@ -101,10 +101,14 @@ class CInterfaceResMgr LTBOOL Setup(); void Clean(); + LTBOOL SetupScaleFonts(); + std::string FixScaleFontName(std::string sFileName, bool bKeepUpDirectory); + protected: // More initialization LTBOOL InitFonts(); + LTBOOL TermFonts(); LTBOOL InitEngineFont(CLTGUIFont *pFont, int nNameID, int nWidthID, int nHeightID, LTBOOL bBold); LTBOOL InitEngineFont(CLTGUIFont *pFont, char *lpszName, int nWidth, int nHeight, LTBOOL bBold); LTBOOL SetupFont(CLTGUIFont *pFont, LTBOOL bBlend = LTTRUE, uint32 dwFlags = LTF_INCLUDE_ALL); @@ -112,17 +116,6 @@ class CInterfaceResMgr protected: LTBOOL m_bEnglish; // True if the resource file has English as the specified language - // HD Fonts - Upscaled for higher resolutions - CLTGUIFont *m_pTitleHDFont; // Title font - CLTGUIFont *m_pLargeHDFont; // Large fading font - CLTGUIFont *m_pMediumHDFont; // Medium fading font - CLTGUIFont *m_pSmallHDFont; // Small fading font - CLTGUIFont *m_pHelpHDFont; // Help font - CLTGUIFont *m_pMsgForeHDFont; // Foreground Font used in HUD text display - CLTGUIFont *m_pHUDForeHDFont; // Foreground Font used in HUD numeric display - CLTGUIFont *m_pAirHDFont; // Font used in HUD for air meter - CLTGUIFont *m_pChooserHDFont; // Font used in HUD for choosing weapons/ammo - // Original Fonts CLTGUIFont *m_pTitleFont; // Title font CLTGUIFont *m_pLargeFont; // Large fading font @@ -169,6 +162,8 @@ class CInterfaceResMgr CString m_csSoundObjRemove; CString m_csSoundObjComplete; + LTBOOL m_bFontsSetup; + }; #define TERMSHAREDSURF(surf) if(surf) { g_pInterfaceResMgr->FreeSharedSurface(surf); surf = NULL; } diff --git a/NOLF/ClientShellDLL/LayoutMgr.cpp b/NOLF/ClientShellDLL/LayoutMgr.cpp index 65cc493..8aa44f7 100644 --- a/NOLF/ClientShellDLL/LayoutMgr.cpp +++ b/NOLF/ClientShellDLL/LayoutMgr.cpp @@ -123,6 +123,16 @@ #define LO_MISC_FAILPOS "FailStringPos" #define LO_MISC_FAILDELAY "FailScreenDelay" #define LO_MISC_DEATHDELAY "DeathDelay" +// New scale fonts start +#define LO_MISC_SCALE_FOLDER "ScaleFont" +#define LO_MISC_SCALE_HELPFONT "ScaleHelpFont" +#define LO_MISC_SCALE_SMALLFONT "ScaleSmallFont" +#define LO_MISC_SCALE_MEDIUMFONT "ScaleMediumFont" +#define LO_MISC_SCALE_LARGEFONT "ScaleLargeFont" +#define LO_MISC_SCALE_TITLEFONT "ScaleTitleFont" +#define LO_MISC_SCALE_MSGFONT "ScaleMsgFont" +#define LO_MISC_SCALE_HUDFONT "ScaleHUDFont" +// New scale fonts end #define LO_MISC_HELPFONT "HelpFont" #define LO_MISC_SMALLFONT "SmallFontBase" #define LO_MISC_MEDFONT "MediumFontBase" @@ -1469,51 +1479,91 @@ LTFLOAT CLayoutMgr::GetDeathDelay() return (LTFLOAT)m_buteMgr.GetDouble(LO_MISC_TAG, LO_MISC_DEATHDELAY, 0.0f); } +void CLayoutMgr::GetScaleFontFolder(char* pBuf, int nBufLen) +{ + GetString(LO_MISC_TAG, LO_MISC_SCALE_FOLDER, pBuf, nBufLen); +} + void CLayoutMgr::GetHelpFont(char *pBuf, int nBufLen) { + if (g_pGameClientShell->UseScaleFonts()) { + GetString(LO_MISC_TAG, LO_MISC_SCALE_HELPFONT, pBuf, nBufLen); + return; + } GetString(LO_MISC_TAG, LO_MISC_HELPFONT, pBuf, nBufLen); } - void CLayoutMgr::GetSmallFontBase(char *pBuf, int nBufLen) { + if (g_pGameClientShell->UseScaleFonts()) { + GetString(LO_MISC_TAG, LO_MISC_SCALE_SMALLFONT, pBuf, nBufLen); + return; + } GetString(LO_MISC_TAG, LO_MISC_SMALLFONT, pBuf, nBufLen); } void CLayoutMgr::GetMediumFontBase(char *pBuf, int nBufLen) { + if (g_pGameClientShell->UseScaleFonts()) { + GetString(LO_MISC_TAG, LO_MISC_SCALE_MEDIUMFONT, pBuf, nBufLen); + return; + } GetString(LO_MISC_TAG, LO_MISC_MEDFONT, pBuf, nBufLen); } void CLayoutMgr::GetLargeFontBase(char *pBuf, int nBufLen) { + if (g_pGameClientShell->UseScaleFonts()) { + GetString(LO_MISC_TAG, LO_MISC_SCALE_LARGEFONT, pBuf, nBufLen); + return; + } GetString(LO_MISC_TAG, LO_MISC_LARGEFONT, pBuf, nBufLen); } void CLayoutMgr::GetTitleFont(char *pBuf, int nBufLen) { + if (g_pGameClientShell->UseScaleFonts()) { + GetString(LO_MISC_TAG, LO_MISC_SCALE_TITLEFONT, pBuf, nBufLen); + return; + } GetString(LO_MISC_TAG, LO_MISC_TITLEFONT, pBuf, nBufLen); } void CLayoutMgr::GetMsgForeFont(char *pBuf, int nBufLen) { + if (g_pGameClientShell->UseScaleFonts()) { + GetString(LO_MISC_TAG, LO_MISC_SCALE_MSGFONT, pBuf, nBufLen); + return; + } GetString(LO_MISC_TAG, LO_MISC_MSGFOREFONT, pBuf, nBufLen); } void CLayoutMgr::GetHUDForeFont(char *pBuf, int nBufLen) { + if (g_pGameClientShell->UseScaleFonts()) { + GetString(LO_MISC_TAG, LO_MISC_SCALE_HUDFONT, pBuf, nBufLen); + return; + } GetString(LO_MISC_TAG, LO_MISC_HUDFOREFONT, pBuf, nBufLen); } void CLayoutMgr::GetAirFont(char *pBuf, int nBufLen) { + if (g_pGameClientShell->UseScaleFonts()) { + GetString(LO_MISC_TAG, LO_MISC_SCALE_HUDFONT, pBuf, nBufLen); + return; + } GetString(LO_MISC_TAG, LO_MISC_AIRFONT, pBuf, nBufLen); } void CLayoutMgr::GetChooserFont(char *pBuf, int nBufLen) { + if (g_pGameClientShell->UseScaleFonts()) { + GetString(LO_MISC_TAG, LO_MISC_SCALE_HUDFONT, pBuf, nBufLen); + return; + } GetString(LO_MISC_TAG, LO_MISC_CHOOSERFONT, pBuf, nBufLen); } diff --git a/NOLF/ClientShellDLL/LayoutMgr.h b/NOLF/ClientShellDLL/LayoutMgr.h index 115c718..633cb03 100644 --- a/NOLF/ClientShellDLL/LayoutMgr.h +++ b/NOLF/ClientShellDLL/LayoutMgr.h @@ -180,6 +180,7 @@ class CLayoutMgr : public CGameButeMgr LTFLOAT GetFailScreenDelay(); LTFLOAT GetDeathDelay(); + void GetScaleFontFolder(char* pBuf, int nBufLen); void GetHelpFont(char *pBuf, int nBufLen); void GetSmallFontBase(char *pBuf, int nBufLen); void GetMediumFontBase(char *pBuf, int nBufLen); diff --git a/NOLF/ClientShellDLL/MakePCX.h b/NOLF/ClientShellDLL/MakePCX.h new file mode 100644 index 0000000..5e900e8 --- /dev/null +++ b/NOLF/ClientShellDLL/MakePCX.h @@ -0,0 +1,157 @@ +#pragma once +#include "Stdafx.h" +#include + +#define PCX_MAX_PALETTE 48 +// Thanks https://www.fileformat.info/format/pcx/egff.htm +typedef struct _PcxHeader +{ + BYTE Identifier; /* PCX Id Number (Always 0x0A) */ + BYTE Version; /* Version Number */ + BYTE Encoding; /* Encoding Format */ + BYTE BitsPerPixel; /* Bits per Pixel */ + WORD XStart; /* Left of image */ + WORD YStart; /* Top of Image */ + WORD XEnd; /* Right of Image */ + WORD YEnd; /* Bottom of image */ + WORD HorzRes; /* Horizontal Resolution */ + WORD VertRes; /* Vertical Resolution */ + BYTE Palette[PCX_MAX_PALETTE]; /* 16-Color EGA Palette */ + BYTE Reserved1; /* Reserved (Always 0) */ + BYTE NumBitPlanes; /* Number of Bit Planes */ + WORD BytesPerLine; /* Bytes per Scan-line */ + WORD PaletteType; /* Palette Type */ + WORD HorzScreenSize; /* Horizontal Screen Size */ + WORD VertScreenSize; /* Vertical Screen Size */ + BYTE Reserved2[54]; /* Reserved (Always 0) */ +} PCXHEAD; +#define USE_SDL_RW + +// +// Returns the number of bytes written to data +// +int PCXEncodedPut(BYTE byte, int counter, SDL_RWops* outFile) +{ + if (!counter) { + return 0; + } + + if ((counter == 1) && (0xC0 != (0xC0 & byte))) + { + SDL_RWwrite(outFile, &byte, sizeof(byte), 1); + return 1; + } + unsigned char end = 0xC0 | counter; + SDL_RWwrite(outFile, &end, sizeof(end), 1); + SDL_RWwrite(outFile, &byte, sizeof(byte), 1); + + return 2; +} + + +void MakePCX(SDL_Surface* pSurface, std::string filename) +{ + BYTE colourMap[PCX_MAX_PALETTE] = { 0 }; + + _PcxHeader PCX; + memset(&PCX, 0, sizeof(PCX)); + + PCX.Identifier = 0x0A; + PCX.Version = 5; + PCX.Encoding = 1; + PCX.BitsPerPixel = 8; + PCX.XStart = 0; + PCX.XEnd = pSurface->w - 1; + PCX.YStart = 0; + PCX.YEnd = pSurface->h - 1; + memcpy(PCX.Palette, colourMap, sizeof(colourMap)); + PCX.PaletteType = 1; + PCX.HorzRes = 96; + PCX.VertRes = 96; + PCX.BytesPerLine = pSurface->pitch; + PCX.NumBitPlanes = 1; + + // Start up a file + // FIXME: I think a bug is preventing regenerating font files. + // w+ should create an empty file or load an existing file and discard its content, but it fails with NULL on the latter. + SDL_RWops* outFile = SDL_RWFromFile(filename.c_str(), "w+b"); + + if (!outFile) + { + auto error = SDL_GetError(); + SDL_Log("Couldn't generate font file <%s> due to <%s>", filename.c_str(), error); + return; + } + + // + // Header time! + // + SDL_RWwrite(outFile, &PCX, sizeof(_PcxHeader), 1); + + // + // Encoding time! + // + + // Get a reference to the pixels, and setup our last and current pixel + BYTE* pixelBuffer = (BYTE*)pSurface->pixels; + + for (int y = 0; y < pSurface->h; y++) + { + int counter = 1; + int total = 0; + + BYTE pixel = pixelBuffer[y * pSurface->pitch]; + BYTE lastPixel = pixel; + + // This will run through every pixel of the image, and encode it with RLE. + for (int x = 1; x < pSurface->pitch; x++) + { + // Increment our pixel + pixel = pixelBuffer[(y * pSurface->pitch) + x]; + + if (pixel == lastPixel) { + counter++; + // We hit our max, write! + if (counter == 63) + { + int i = PCXEncodedPut(lastPixel, counter, outFile); + total += i; + counter = 0; + } + } + else + { + if (counter) + { + int i = PCXEncodedPut(lastPixel, counter, outFile); + total += i; + } + + lastPixel = pixel; + counter = 1; + } + } + if (counter) { + int i = PCXEncodedPut(lastPixel, counter, outFile); + total += i; + } + } + + // + // Palette time, mark a palette, and write out SDL2's one! + // + int paletteIdentifier = 0x0C; + SDL_RWwrite(outFile, &paletteIdentifier, sizeof(paletteIdentifier), 1); + + SDL_Color* sdlPal = pSurface->format->palette->colors; + BYTE pal[768] = { 0 }; + for (int i = 0; i < 256; i++) { + pal[3 * i] = sdlPal[i].r; + pal[3 * i + 1] = sdlPal[i].g; + pal[3 * i + 2] = sdlPal[i].b; + } + SDL_RWwrite(outFile, &pal, 768, 1); + + SDL_RWclose(outFile); + +} diff --git a/NOLF/ClientShellDLL/MessageMgr.cpp b/NOLF/ClientShellDLL/MessageMgr.cpp index a9dfaa4..cc78833 100644 --- a/NOLF/ClientShellDLL/MessageMgr.cpp +++ b/NOLF/ClientShellDLL/MessageMgr.cpp @@ -161,6 +161,10 @@ LTBOOL CMessageMgr::Init () return LTTRUE; } +void CMessageMgr::FlushFonts() +{ + m_pForeFont = g_pInterfaceResMgr->GetMsgForeFont(); +} // ----------------------------------------------------------------------- // // @@ -1039,7 +1043,7 @@ void CCheatMgr::Process( CheatCode nCheatCode ) SetPos(!s_CheatInfo[nCheatCode].bActive); break; -#ifndef _FINAL +//#ifndef _FINAL case CHEAT_CLIP: // toggle clipping mode SetClipMode(!s_CheatInfo[nCheatCode].bActive); break; @@ -1107,7 +1111,7 @@ void CCheatMgr::Process( CheatCode nCheatCode ) case CHEAT_RESET_HISTORY: // clear player history ResetHistory(); break; -#endif // _FINAL +//#endif // _FINAL default: return; // skip setting global cheat indicator for unhandled cheats diff --git a/NOLF/ClientShellDLL/MessageMgr.h b/NOLF/ClientShellDLL/MessageMgr.h index 86a83dc..e13352e 100644 --- a/NOLF/ClientShellDLL/MessageMgr.h +++ b/NOLF/ClientShellDLL/MessageMgr.h @@ -118,8 +118,9 @@ class CMessageMgr CMessageMgr(); LTBOOL Init (); - void Term () { Clear(); } + void Term () { Clear(); } + void FlushFonts(); void Enable( LTBOOL bEnabled ); void AddLine( char *szMsg, eMessageType eType = MMGR_DEFAULT, HSURFACE hSurf = LTNULL); diff --git a/NOLF/ClientShellDLL/PlayerStats.cpp b/NOLF/ClientShellDLL/PlayerStats.cpp index 2e6de2e..5e531dc 100644 --- a/NOLF/ClientShellDLL/PlayerStats.cpp +++ b/NOLF/ClientShellDLL/PlayerStats.cpp @@ -602,6 +602,12 @@ void CPlayerStats::Term() } +void CPlayerStats::FlushFonts() +{ + g_pObjForeFont = g_pInterfaceResMgr->GetMsgForeFont(); + g_pForeFont = g_pInterfaceResMgr->GetHUDForeFont(); +} + // ----------------------------------------------------------------------- // // // ROUTINE: CPlayerStats::OnEnterWorld() diff --git a/NOLF/ClientShellDLL/PlayerStats.h b/NOLF/ClientShellDLL/PlayerStats.h index b7a98b5..5be5b25 100644 --- a/NOLF/ClientShellDLL/PlayerStats.h +++ b/NOLF/ClientShellDLL/PlayerStats.h @@ -34,6 +34,8 @@ class CPlayerStats LTBOOL Init(); void Term(); + void FlushFonts(); + void OnEnterWorld(LTBOOL bRestoringGame=LTFALSE); void OnExitWorld(); diff --git a/NOLF/ClientShellDLL/PopupText.cpp b/NOLF/ClientShellDLL/PopupText.cpp index b43a940..f15358e 100644 --- a/NOLF/ClientShellDLL/PopupText.cpp +++ b/NOLF/ClientShellDLL/PopupText.cpp @@ -84,9 +84,9 @@ void CPopupText::Init() m_rcRect = g_pLayoutMgr->GetPopupTextRect(); - m_pForeFont = g_pInterfaceResMgr->GetMsgForeFont(); + m_pForeFont = LTNULL; - m_nLineHeight = m_pForeFont->GetHeight(); + m_nLineHeight = g_pInterfaceResMgr->GetMsgForeFont()->GetHeight(); m_bVisible = LTFALSE; m_dwWidth = 0; @@ -143,7 +143,7 @@ void CPopupText::ShowText(int nStringId) g_pLTClient->GetSurfaceDims(m_hForeSurf,&m_dwWidth,&m_dwHeight); } - LTIntPt size = m_pForeFont->GetTextExtentsFormat(hText,width); + LTIntPt size = g_pInterfaceResMgr->GetMsgForeFont()->GetTextExtentsFormat(hText,width); if (size.y > height) size.y = height; if ((uint32)size.x > m_dwWidth || (uint32)size.y > m_dwHeight) @@ -159,7 +159,7 @@ void CPopupText::ShowText(int nStringId) m_pos.x += (width - size.x) / 2; m_pos.y += (height - size.y); - m_pForeFont->DrawFormat(hText,m_hForeSurf,0,0,(uint32)width,kWhite); + g_pInterfaceResMgr->GetMsgForeFont()->DrawFormat(hText,m_hForeSurf,0,0,(uint32)width,kWhite); m_bVisible = LTTRUE; g_pLTClient->FreeString(hText); diff --git a/NOLF/ClientShellDLL/Subtitle.cpp b/NOLF/ClientShellDLL/Subtitle.cpp index d54c7ae..18a115c 100644 --- a/NOLF/ClientShellDLL/Subtitle.cpp +++ b/NOLF/ClientShellDLL/Subtitle.cpp @@ -44,8 +44,8 @@ CSubtitle::~CSubtitle() void CSubtitle::Init() { - m_pForeFont = g_pInterfaceResMgr->GetMsgForeFont(); - m_nLineHeight = m_pForeFont->GetHeight(); + m_pForeFont = LTNULL; + m_nLineHeight = g_pInterfaceResMgr->GetMsgForeFont()->GetHeight(); m_CinematicPos = g_pLayoutMgr->GetSubtitleCinematicPos(); @@ -93,6 +93,7 @@ void CSubtitle::Show(int nStringId, LTVector vSpeakerPos, LTFLOAT fRadius, LTFLO HSTRING hText = g_pLTClient->FormatString(nStringId); if (!hText) return; + m_nLineHeight = g_pInterfaceResMgr->GetMsgForeFont()->GetHeight(); m_vSpeakerPos = vSpeakerPos; m_fRadius = fRadius > 0 ? fRadius : g_vtSubtitleMaxDist.GetFloat(); @@ -122,7 +123,7 @@ void CSubtitle::Show(int nStringId, LTVector vSpeakerPos, LTFLOAT fRadius, LTFLO { g_pLTClient->GetSurfaceDims(m_hForeSurf,&m_dwWidth,&m_dwHeight); } - m_txtSize = m_pForeFont->GetTextExtentsFormat(hText,(int)width); + m_txtSize = g_pInterfaceResMgr->GetMsgForeFont()->GetTextExtentsFormat(hText,(int)width); if ((uint32)m_txtSize.x > m_dwWidth || (uint32)m_txtSize.y > m_dwHeight) @@ -165,7 +166,7 @@ void CSubtitle::Show(int nStringId, LTVector vSpeakerPos, LTFLOAT fRadius, LTFLO m_rcSrcRect = m_rcBaseRect; m_fOffset = 0.0f; - m_pForeFont->DrawFormat(hText,m_hForeSurf,0,0,(uint32)width,kWhite); + g_pInterfaceResMgr->GetMsgForeFont()->DrawFormat(hText,m_hForeSurf,0,0,(uint32)width,kWhite); m_bVisible = LTTRUE; @@ -241,6 +242,8 @@ void CSubtitle::ScreenDimsChanged() if (!m_bVisible) return; if (g_vtSubtitles.GetFloat() == 0.0f) return; + m_nLineHeight = g_pInterfaceResMgr->GetMsgForeFont()->GetHeight(); + uint32 width = 0; if (g_pGameClientShell->IsUsingExternalCamera()) { diff --git a/UNPACKED ASSETS/Fonts/SQR721B.TTF b/UNPACKED ASSETS/Fonts/SQR721B.TTF new file mode 100644 index 0000000..43e652e Binary files /dev/null and b/UNPACKED ASSETS/Fonts/SQR721B.TTF differ diff --git a/UNPACKED ASSETS/Fonts/SQR721KN.TTF b/UNPACKED ASSETS/Fonts/SQR721KN.TTF new file mode 100644 index 0000000..8230077 Binary files /dev/null and b/UNPACKED ASSETS/Fonts/SQR721KN.TTF differ diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0a9f605..c6fafc8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -38,12 +38,24 @@ steps: Contents: '**' TargetFolder: '$(Pipeline.Workspace)\\Artifacts\\Modernizer' +- task: CopyFiles@2 + inputs: + SourceFolder: 'UNPACKED ASSETS\\Fonts' + Contents: '**' + TargetFolder: '$(Pipeline.Workspace)\\Artifacts\\Fonts' + - task: CopyFiles@2 inputs: SourceFolder: 'LIBS\\SDL2-2.0.10\\lib\\x86\\' Contents: 'SDL2.dll' TargetFolder: '$(Pipeline.Workspace)\\Artifacts' +- task: CopyFiles@2 + inputs: + SourceFolder: 'LIBS\\SDL2_ttf-2.0.15\\lib\\x86\\' + Contents: '*.dll' + TargetFolder: '$(Pipeline.Workspace)\\Artifacts' + - task: CmdLine@2 inputs: script: 'mkdir $(Pipeline.Workspace)\\Artifacts\\Custom' diff --git a/osslicenses.txt b/osslicenses.txt index 265b203..85032bb 100644 --- a/osslicenses.txt +++ b/osslicenses.txt @@ -16,3 +16,25 @@ freely, subject to the following restrictions: 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. +-- +SDL TTF https://www.libsdl.org/projects/SDL_ttf/ +/* + SDL_ttf: A companion library to SDL for working with TrueType (tm) fonts + Copyright (C) 1997-2019 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/