- move font code to 'common'.

- fix use of translation slot 0, used for internal translations.
This commit is contained in:
Christoph Oelckers 2020-04-11 19:11:59 +02:00
parent 32300f7d26
commit 940f1dc9a2
11 changed files with 12 additions and 8 deletions

View file

@ -611,6 +611,7 @@ file( GLOB HEADER_FILES
common/console/*.h common/console/*.h
common/utility/*.h common/utility/*.h
common/engine/*.h common/engine/*.h
common/fonts/*.h
common/filesystem/*.h common/filesystem/*.h
common/textures/hires/hqnx/*.h common/textures/hires/hqnx/*.h
common/textures/hires/hqnx_asm/*.h common/textures/hires/hqnx_asm/*.h
@ -1003,12 +1004,6 @@ set (PCH_SOURCES
gamedata/textures/animations.cpp gamedata/textures/animations.cpp
gamedata/textures/anim_switches.cpp gamedata/textures/anim_switches.cpp
gamedata/textures/buildloader.cpp gamedata/textures/buildloader.cpp
gamedata/fonts/singlelumpfont.cpp
gamedata/fonts/singlepicfont.cpp
gamedata/fonts/specialfont.cpp
gamedata/fonts/font.cpp
gamedata/fonts/hexfont.cpp
gamedata/fonts/v_font.cpp
gamedata/fonts/v_text.cpp gamedata/fonts/v_text.cpp
gamedata/p_xlat.cpp gamedata/p_xlat.cpp
gamedata/xlat/parse_xlat.cpp gamedata/xlat/parse_xlat.cpp
@ -1078,6 +1073,12 @@ set (PCH_SOURCES
common/audio/music/i_soundfont.cpp common/audio/music/i_soundfont.cpp
common/audio/music/music_config.cpp common/audio/music/music_config.cpp
common/thirdparty/sfmt/SFMT.cpp common/thirdparty/sfmt/SFMT.cpp
common/fonts/singlelumpfont.cpp
common/fonts/singlepicfont.cpp
common/fonts/specialfont.cpp
common/fonts/font.cpp
common/fonts/hexfont.cpp
common/fonts/v_font.cpp
common/textures/hw_ihwtexture.cpp common/textures/hw_ihwtexture.cpp
common/textures/hw_material.cpp common/textures/hw_material.cpp
common/textures/bitmap.cpp common/textures/bitmap.cpp
@ -1239,6 +1240,7 @@ include_directories( .
common/utility common/utility
common/console common/console
common/engine common/engine
common/fonts
g_statusbar g_statusbar
console console
playsim playsim
@ -1435,6 +1437,7 @@ source_group("Common\\Audio\\Music" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_
source_group("Common\\Console" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/console/.+") source_group("Common\\Console" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/console/.+")
source_group("Common\\Utility" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/utility/.+") source_group("Common\\Utility" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/utility/.+")
source_group("Common\\Engine" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/engine/.+") source_group("Common\\Engine" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/engine/.+")
source_group("Common\\Fonts" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/fonts/.+")
source_group("Common\\File System" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/filesystem/.+") source_group("Common\\File System" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/filesystem/.+")
source_group("Common\\Textures\\Hires" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/textures/hires/.+") source_group("Common\\Textures\\Hires" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/textures/hires/.+")
source_group("Common\\Textures\\Hires\\HQ Resize" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/textures/hires/hqnx/.+") source_group("Common\\Textures\\Hires\\HQ Resize" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/textures/hires/hqnx/.+")

View file

@ -53,14 +53,15 @@ extern uint8_t IcePalette[16][3];
void PaletteContainer::Init(int numslots) // This cannot be a constructor!!! void PaletteContainer::Init(int numslots) // This cannot be a constructor!!!
{ {
if (numslots < 1) numslots = 1;
Clear(); Clear();
HasGlobalBrightmap = false; HasGlobalBrightmap = false;
// Make sure that index 0 is always the identity translation. // Make sure that index 0 is always the identity translation.
FRemapTable remap; FRemapTable remap;
remap.MakeIdentity(); remap.MakeIdentity();
remap.Inactive = true; remap.Inactive = true;
AddRemap(&remap);
TranslationTables.Resize(numslots); TranslationTables.Resize(numslots);
StoreTranslation(0, &remap); // make sure that translation ID 0 is the identity.
ColorMatcher.SetPalette(BaseColors); ColorMatcher.SetPalette(BaseColors);
} }
@ -263,7 +264,7 @@ FRemapTable *PaletteContainer::TranslationToTable(int translation)
unsigned int type = GetTranslationType(translation); unsigned int type = GetTranslationType(translation);
unsigned int index = GetTranslationIndex(translation); unsigned int index = GetTranslationIndex(translation);
if (type <= 0 || type >= TranslationTables.Size() || index >= NumTranslations(type)) if (type < 0 || type >= TranslationTables.Size() || index >= NumTranslations(type))
{ {
return uniqueRemaps[0]; // this is the identity table. return uniqueRemaps[0]; // this is the identity table.
} }