diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ab1cd4e9b..928d0f1dc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -611,6 +611,7 @@ file( GLOB HEADER_FILES common/console/*.h common/utility/*.h common/engine/*.h + common/fonts/*.h common/filesystem/*.h common/textures/hires/hqnx/*.h common/textures/hires/hqnx_asm/*.h @@ -1003,12 +1004,6 @@ set (PCH_SOURCES gamedata/textures/animations.cpp gamedata/textures/anim_switches.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/p_xlat.cpp gamedata/xlat/parse_xlat.cpp @@ -1078,6 +1073,12 @@ set (PCH_SOURCES common/audio/music/i_soundfont.cpp common/audio/music/music_config.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_material.cpp common/textures/bitmap.cpp @@ -1239,6 +1240,7 @@ include_directories( . common/utility common/console common/engine + common/fonts g_statusbar console 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\\Utility" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/utility/.+") 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\\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/.+") diff --git a/src/common/engine/palettecontainer.cpp b/src/common/engine/palettecontainer.cpp index 1f8732db9..a4ee23b82 100644 --- a/src/common/engine/palettecontainer.cpp +++ b/src/common/engine/palettecontainer.cpp @@ -53,14 +53,15 @@ extern uint8_t IcePalette[16][3]; void PaletteContainer::Init(int numslots) // This cannot be a constructor!!! { + if (numslots < 1) numslots = 1; Clear(); HasGlobalBrightmap = false; // Make sure that index 0 is always the identity translation. FRemapTable remap; remap.MakeIdentity(); remap.Inactive = true; - AddRemap(&remap); TranslationTables.Resize(numslots); + StoreTranslation(0, &remap); // make sure that translation ID 0 is the identity. ColorMatcher.SetPalette(BaseColors); } @@ -263,7 +264,7 @@ FRemapTable *PaletteContainer::TranslationToTable(int translation) unsigned int type = GetTranslationType(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. } diff --git a/src/gamedata/fonts/font.cpp b/src/common/fonts/font.cpp similarity index 100% rename from src/gamedata/fonts/font.cpp rename to src/common/fonts/font.cpp diff --git a/src/gamedata/fonts/fontinternals.h b/src/common/fonts/fontinternals.h similarity index 100% rename from src/gamedata/fonts/fontinternals.h rename to src/common/fonts/fontinternals.h diff --git a/src/gamedata/fonts/hexfont.cpp b/src/common/fonts/hexfont.cpp similarity index 100% rename from src/gamedata/fonts/hexfont.cpp rename to src/common/fonts/hexfont.cpp diff --git a/src/gamedata/fonts/myiswalpha.h b/src/common/fonts/myiswalpha.h similarity index 100% rename from src/gamedata/fonts/myiswalpha.h rename to src/common/fonts/myiswalpha.h diff --git a/src/gamedata/fonts/singlelumpfont.cpp b/src/common/fonts/singlelumpfont.cpp similarity index 100% rename from src/gamedata/fonts/singlelumpfont.cpp rename to src/common/fonts/singlelumpfont.cpp diff --git a/src/gamedata/fonts/singlepicfont.cpp b/src/common/fonts/singlepicfont.cpp similarity index 100% rename from src/gamedata/fonts/singlepicfont.cpp rename to src/common/fonts/singlepicfont.cpp diff --git a/src/gamedata/fonts/specialfont.cpp b/src/common/fonts/specialfont.cpp similarity index 100% rename from src/gamedata/fonts/specialfont.cpp rename to src/common/fonts/specialfont.cpp diff --git a/src/gamedata/fonts/v_font.cpp b/src/common/fonts/v_font.cpp similarity index 100% rename from src/gamedata/fonts/v_font.cpp rename to src/common/fonts/v_font.cpp diff --git a/src/gamedata/fonts/v_font.h b/src/common/fonts/v_font.h similarity index 100% rename from src/gamedata/fonts/v_font.h rename to src/common/fonts/v_font.h