- Регистрация
- 10 Июл 2013
- Сообщения
- 6.877
- Реакции
- 9.397
- Баллы
- 816
- Лучшие ответы
- 130



@Estel Randir, нужно что бы Готика и моды его использовали. Нет смысла указывать шрифт, который игра не использует.
xpTextFont=FONT_XP_BAR_TEST.TGA
FONT_XP_BAR_TEST.TGA = HEDIN_HOTBAR.ttf:Size=20:R=255:G=255:B=255:A=255
xpTextFont=FONT_XP_BAR_TEST.TGA
FONT_XP_BAR_TEST.TGA = HEDIN_HOTBAR.ttf:Size=20:R=255:G=255:B=255:A=255
FONT_XP_BAR_TEST.TGA = FONT_XP_BAR_TEST.ttf:Size=20:R=205:G=186:B=156:A=255
float g_lineSpacing = 1.0f;
static void ReadConfigurationFile()
{
char cfgPath[MAX_PATH];
GetModuleFileNameA(GetModuleHandleA(nullptr), cfgPath, sizeof(cfgPath));
PathRemoveFileSpecA(cfgPath);
strcat_s(cfgPath, "\\TTF.ini");
FILE* f;
errno_t err = fopen_s(&f, cfgPath, "r");
if(err == 0)
{
std::string currentSector = "none";
char readedLine[1024];
while(fgets(readedLine, sizeof(readedLine), f) != nullptr)
{
size_t len = strlen(readedLine);
if(len > 0)
{
if(readedLine[len - 1] == '\n' || readedLine[len - 1] == '\r')
len -= 1;
if(len > 0)
{
if(readedLine[len - 1] == '\n' || readedLine[len - 1] == '\r')
len -= 1;
}
}
if(len == 0)
continue;
if(readedLine[0] == '[' && readedLine[len - 1] == ']')
{
currentSector = std::string(readedLine + 1, len - 2);
std::transform(currentSector.begin(), currentSector.end(), currentSector.begin(), toupper);
}
else if(readedLine[0] != ';' && readedLine[0] != '/')
{
std::size_t eqpos;
std::string rLine = std::string(readedLine, len);
std::transform(rLine.begin(), rLine.end(), rLine.begin(), toupper);
if((eqpos = rLine.find("=")) != std::string::npos)
{
std::string lhLine = rLine.substr(0, eqpos);
std::string rhLine = rLine.substr(eqpos + 1);
lhLine.erase(lhLine.find_last_not_of(' ') + 1);
lhLine.erase(0, lhLine.find_first_not_of(' '));
rhLine.erase(rhLine.find_last_not_of(' ') + 1);
rhLine.erase(0, rhLine.find_first_not_of(' '));
if(currentSector == "CONFIGURATION")
{
if(lhLine == "SCALEFONTS")
g_useScaling = (rhLine == "TRUE" || rhLine == "1");
else if(lhLine == "CODEPAGE")
{
if(rhLine == "WINDOWS-1250" || rhLine == "WINDOWS1250" || rhLine == "WINDOWS 1250" || rhLine == "1250")
g_useEncoding = 1250;
else if(rhLine == "WINDOWS-1251" || rhLine == "WINDOWS1251" || rhLine == "WINDOWS 1251" || rhLine == "1251")
g_useEncoding = 1251;
else if(rhLine == "WINDOWS-1252" || rhLine == "WINDOWS1252" || rhLine == "WINDOWS 1252" || rhLine == "1252")
g_useEncoding = 1252;
else if(rhLine == "WINDOWS-1253" || rhLine == "WINDOWS1253" || rhLine == "WINDOWS 1253" || rhLine == "1253")
g_useEncoding = 1253;
else if(rhLine == "WINDOWS-1254" || rhLine == "WINDOWS1254" || rhLine == "WINDOWS 1254" || rhLine == "1254")
g_useEncoding = 1254;
else if(rhLine == "WINDOWS-1255" || rhLine == "WINDOWS1255" || rhLine == "WINDOWS 1255" || rhLine == "1255")
g_useEncoding = 1255;
else if(rhLine == "WINDOWS-1256" || rhLine == "WINDOWS1256" || rhLine == "WINDOWS 1256" || rhLine == "1256")
g_useEncoding = 1256;
else if(rhLine == "WINDOWS-1257" || rhLine == "WINDOWS1257" || rhLine == "WINDOWS 1257" || rhLine == "1257")
g_useEncoding = 1257;
else if(rhLine == "WINDOWS-1258" || rhLine == "WINDOWS1258" || rhLine == "WINDOWS 1258" || rhLine == "1258")
g_useEncoding = 1258;
else
g_useEncoding = 0;
}
// Добавлено: Обработка настройки межстрочного интервала
else if(lhLine == "LINESPACING")
{
// Парсим значение межстрочного интервала из конфига
try { g_lineSpacing = std::stof(rhLine); }
catch(const std::exception&) { g_lineSpacing = 1.0f; } // Значение по умолчанию при ошибке
}
}
else if(currentSector == "FONTS")
g_fontsWrapper.emplace(lhLine, rhLine);
}
}
}
fclose(f);
}
}
int __fastcall G1_zCFont_GetFontY(DWORD zCFont)
{
int baseHeight = *reinterpret_cast<int*>(zCFont + 0x24) - *reinterpret_cast<int*>(zCFont + 0x2C);
return static_cast<int>(baseHeight * g_lineSpacing);
}
int __fastcall G2_zCFont_GetFontY(DWORD zCFont)
{
int baseHeight = *reinterpret_cast<int*>(zCFont + 0x24) - *reinterpret_cast<int*>(zCFont + 0x2C);
return static_cast<int>(baseHeight * g_lineSpacing);
}