Merge branch 'main' of https://github.com/alexbatalov/fallout2-ce
This commit is contained in:
commit
46c5f370de
|
@ -235,6 +235,8 @@ add_executable(${EXECUTABLE_NAME} WIN32
|
|||
target_sources(${EXECUTABLE_NAME} PUBLIC
|
||||
"src/fps_limiter.cc"
|
||||
"src/fps_limiter.h"
|
||||
"src/platform_compat.cc"
|
||||
"src/platform_compat.h"
|
||||
"src/sfall_config.cc"
|
||||
"src/sfall_config.h"
|
||||
)
|
||||
|
|
20
src/art.cc
20
src/art.cc
|
@ -74,7 +74,7 @@ char gArtLanguage[32];
|
|||
Cache gArtCache;
|
||||
|
||||
// 0x56C9E4
|
||||
char _art_name[MAX_PATH];
|
||||
char _art_name[COMPAT_MAX_PATH];
|
||||
|
||||
// head_info
|
||||
// 0x56CAE8
|
||||
|
@ -91,7 +91,7 @@ int* gArtCritterFidShoudRunData;
|
|||
// 0x418840
|
||||
int artInit()
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
int i;
|
||||
File* stream;
|
||||
char str[200];
|
||||
|
@ -108,7 +108,7 @@ int artInit()
|
|||
}
|
||||
|
||||
char* language;
|
||||
if (configGetString(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_LANGUAGE_KEY, &language) && stricmp(language, ENGLISH) != 0) {
|
||||
if (configGetString(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_LANGUAGE_KEY, &language) && compat_stricmp(language, ENGLISH) != 0) {
|
||||
strcpy(gArtLanguage, language);
|
||||
gArtLanguageInitialized = true;
|
||||
}
|
||||
|
@ -155,16 +155,16 @@ int artInit()
|
|||
|
||||
ptr = gArtListDescriptions[1].fileNames;
|
||||
for (i = 0; i < gArtListDescriptions[1].fileNamesLength; i++) {
|
||||
if (stricmp(ptr, "hmjmps") == 0) {
|
||||
if (compat_stricmp(ptr, "hmjmps") == 0) {
|
||||
_art_vault_person_nums[DUDE_NATIVE_LOOK_JUMPSUIT][GENDER_MALE] = i;
|
||||
} else if (stricmp(ptr, "hfjmps") == 0) {
|
||||
} else if (compat_stricmp(ptr, "hfjmps") == 0) {
|
||||
_art_vault_person_nums[DUDE_NATIVE_LOOK_JUMPSUIT][GENDER_FEMALE] = i;
|
||||
}
|
||||
|
||||
if (stricmp(ptr, "hmwarr") == 0) {
|
||||
if (compat_stricmp(ptr, "hmwarr") == 0) {
|
||||
_art_vault_person_nums[DUDE_NATIVE_LOOK_TRIBAL][GENDER_MALE] = i;
|
||||
_art_vault_guy_num = i;
|
||||
} else if (stricmp(ptr, "hfprim") == 0) {
|
||||
} else if (compat_stricmp(ptr, "hfprim") == 0) {
|
||||
_art_vault_person_nums[DUDE_NATIVE_LOOK_TRIBAL][GENDER_FEMALE] = i;
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ int artInit()
|
|||
|
||||
ptr = gArtListDescriptions[4].fileNames;
|
||||
for (i = 0; i < gArtListDescriptions[4].fileNamesLength; i++) {
|
||||
if (stricmp(ptr, "grid001.frm") == 0) {
|
||||
if (compat_stricmp(ptr, "grid001.frm") == 0) {
|
||||
_art_mapper_blank_tile = i;
|
||||
}
|
||||
}
|
||||
|
@ -896,7 +896,7 @@ int artCacheGetFileSizeImpl(int fid, int* sizePtr)
|
|||
char* str;
|
||||
char* ptr;
|
||||
int result;
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
bool loaded;
|
||||
int fileSize;
|
||||
|
||||
|
@ -954,7 +954,7 @@ int artCacheReadDataImpl(int fid, int* sizePtr, unsigned char* data)
|
|||
char* str;
|
||||
char* ptr;
|
||||
int result;
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
bool loaded;
|
||||
|
||||
v4 = -1;
|
||||
|
|
|
@ -5,11 +5,9 @@
|
|||
#include "db.h"
|
||||
#include "heap.h"
|
||||
#include "obj_types.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto_types.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
typedef enum Head {
|
||||
HEAD_INVALID,
|
||||
HEAD_MARCUS,
|
||||
|
@ -136,7 +134,7 @@ extern int _art_mapper_blank_tile;
|
|||
|
||||
extern char gArtLanguage[32];
|
||||
extern Cache gArtCache;
|
||||
extern char _art_name[MAX_PATH];
|
||||
extern char _art_name[COMPAT_MAX_PATH];
|
||||
extern HeadDescription* gHeadDescriptions;
|
||||
extern int* _anon_alias;
|
||||
extern int* gArtCritterFidShoudRunData;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "debug.h"
|
||||
#include "memory_manager.h"
|
||||
#include "platform_compat.h"
|
||||
#include "sound.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -9,9 +10,6 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
// 0x5108C0
|
||||
AudioFileIsCompressedProc* _queryCompressedFunc_2 = _defaultCompressionFunc__;
|
||||
|
||||
|
@ -41,7 +39,7 @@ int audioFileSoundDecoderReadHandler(int fileHandle, void* buffer, unsigned int
|
|||
// 0x41A88C
|
||||
int audioFileOpen(const char* fname, int flags, ...)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
strcpy(path, fname);
|
||||
|
||||
int compression;
|
||||
|
|
|
@ -15,12 +15,15 @@
|
|||
#include "map.h"
|
||||
#include "memory.h"
|
||||
#include "object.h"
|
||||
#include "platform_compat.h"
|
||||
#include "text_font.h"
|
||||
#include "window_manager.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// 0x41ADE0
|
||||
const int _defam[AUTOMAP_MAP_COUNT][ELEVATION_COUNT] = {
|
||||
{ -1, -1, -1 },
|
||||
|
@ -232,7 +235,7 @@ void automapExit()
|
|||
{
|
||||
char* masterPatchesPath;
|
||||
if (configGetString(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_MASTER_PATCHES_KEY, &masterPatchesPath)) {
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s\\%s\\%s", masterPatchesPath, "MAPS", AUTOMAP_DB);
|
||||
remove(path);
|
||||
}
|
||||
|
@ -864,7 +867,7 @@ int automapLoadEntry(int map, int elevation)
|
|||
{
|
||||
gAutomapEntry.compressedData = NULL;
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s\\%s", "MAPS", AUTOMAP_DB);
|
||||
|
||||
bool success = true;
|
||||
|
@ -1039,7 +1042,7 @@ int automapCreate()
|
|||
gAutomapHeader.dataSize = 1925;
|
||||
memcpy(gAutomapHeader.offsets, _defam, sizeof(_defam));
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s\\%s", "MAPS", AUTOMAP_DB);
|
||||
|
||||
File* stream = fileOpen(path, "wb");
|
||||
|
@ -1069,7 +1072,7 @@ int _copy_file_data(File* stream1, File* stream2, int length)
|
|||
|
||||
// NOTE: Original code is slightly different, but does the same thing.
|
||||
while (length != 0) {
|
||||
int chunkLength = min(length, 0xFFFF);
|
||||
int chunkLength = std::min(length, 0xFFFF);
|
||||
|
||||
if (fileRead(buffer, chunkLength, 1, stream1) != 1) {
|
||||
break;
|
||||
|
@ -1094,7 +1097,7 @@ int _copy_file_data(File* stream1, File* stream2, int length)
|
|||
// 0x41CE74
|
||||
int automapGetHeader(AutomapHeader** automapHeaderPtr)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s\\%s", "MAPS", AUTOMAP_DB);
|
||||
|
||||
File* stream = fileOpen(path, "rb");
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define AUTORUN_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
|
||||
extern HANDLE gInterplayGenericAutorunMutex;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "object.h"
|
||||
#include "palette.h"
|
||||
#include "perk.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto.h"
|
||||
#include "scripts.h"
|
||||
#include "skill.h"
|
||||
|
@ -679,7 +680,7 @@ int _editor_design(bool isCreationMode)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (stricmp(critterGetName(gDude), "None") == 0) {
|
||||
if (compat_stricmp(critterGetName(gDude), "None") == 0) {
|
||||
soundPlayFile("iisxxxx1");
|
||||
|
||||
// Warning: You haven't changed your player
|
||||
|
@ -987,7 +988,7 @@ int characterEditorWindowInit()
|
|||
int i;
|
||||
int v1;
|
||||
int v3;
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
int fid;
|
||||
char* str;
|
||||
int len;
|
||||
|
@ -1946,7 +1947,7 @@ void editorRenderPerks()
|
|||
// 0x434498
|
||||
int _kills_list_comp(const KillInfo* a, const KillInfo* b)
|
||||
{
|
||||
return stricmp(a->name, b->name);
|
||||
return compat_stricmp(a->name, b->name);
|
||||
}
|
||||
|
||||
// 0x4344A4
|
||||
|
@ -2520,7 +2521,7 @@ void editorRenderSecondaryStats()
|
|||
sprintf(t, "%s", messageListItemText);
|
||||
fontDrawText(characterEditorWindowBuf + 640 * y + 194, t, 640, 640, color);
|
||||
|
||||
itoa(critterGetStat(gDude, STAT_ARMOR_CLASS), t, 10);
|
||||
compat_itoa(critterGetStat(gDude, STAT_ARMOR_CLASS), t, 10);
|
||||
fontDrawText(characterEditorWindowBuf + 640 * y + 288, t, 640, 640, color);
|
||||
|
||||
// Action Points
|
||||
|
@ -2536,7 +2537,7 @@ void editorRenderSecondaryStats()
|
|||
sprintf(t, "%s", messageListItemText);
|
||||
fontDrawText(characterEditorWindowBuf + 640 * y + 194, t, 640, 640, color);
|
||||
|
||||
itoa(critterGetStat(gDude, STAT_MAXIMUM_ACTION_POINTS), t, 10);
|
||||
compat_itoa(critterGetStat(gDude, STAT_MAXIMUM_ACTION_POINTS), t, 10);
|
||||
fontDrawText(characterEditorWindowBuf + 640 * y + 288, t, 640, 640, color);
|
||||
|
||||
// Carry Weight
|
||||
|
@ -2552,7 +2553,7 @@ void editorRenderSecondaryStats()
|
|||
sprintf(t, "%s", messageListItemText);
|
||||
fontDrawText(characterEditorWindowBuf + 640 * y + 194, t, 640, 640, color);
|
||||
|
||||
itoa(critterGetStat(gDude, STAT_CARRY_WEIGHT), t, 10);
|
||||
compat_itoa(critterGetStat(gDude, STAT_CARRY_WEIGHT), t, 10);
|
||||
fontDrawText(characterEditorWindowBuf + 640 * y + 288, t, 640, 640, critterIsEncumbered(gDude) ? _colorTable[31744] : color);
|
||||
|
||||
// Melee Damage
|
||||
|
@ -2568,7 +2569,7 @@ void editorRenderSecondaryStats()
|
|||
sprintf(t, "%s", messageListItemText);
|
||||
fontDrawText(characterEditorWindowBuf + 640 * y + 194, t, 640, 640, color);
|
||||
|
||||
itoa(critterGetStat(gDude, STAT_MELEE_DAMAGE), t, 10);
|
||||
compat_itoa(critterGetStat(gDude, STAT_MELEE_DAMAGE), t, 10);
|
||||
fontDrawText(characterEditorWindowBuf + 640 * y + 288, t, 640, 640, color);
|
||||
|
||||
// Damage Resistance
|
||||
|
@ -2632,7 +2633,7 @@ void editorRenderSecondaryStats()
|
|||
sprintf(t, "%s", messageListItemText);
|
||||
fontDrawText(characterEditorWindowBuf + 640 * y + 194, t, 640, 640, color);
|
||||
|
||||
itoa(critterGetStat(gDude, STAT_SEQUENCE), t, 10);
|
||||
compat_itoa(critterGetStat(gDude, STAT_SEQUENCE), t, 10);
|
||||
fontDrawText(characterEditorWindowBuf + 640 * y + 288, t, 640, 640, color);
|
||||
|
||||
// Healing Rate
|
||||
|
@ -2648,7 +2649,7 @@ void editorRenderSecondaryStats()
|
|||
sprintf(t, "%s", messageListItemText);
|
||||
fontDrawText(characterEditorWindowBuf + 640 * y + 194, t, 640, 640, color);
|
||||
|
||||
itoa(critterGetStat(gDude, STAT_HEALING_RATE), t, 10);
|
||||
compat_itoa(critterGetStat(gDude, STAT_HEALING_RATE), t, 10);
|
||||
fontDrawText(characterEditorWindowBuf + 640 * y + 288, t, 640, 640, color);
|
||||
|
||||
// Critical Chance
|
||||
|
@ -3694,7 +3695,7 @@ int _OptionWindow()
|
|||
// already exists
|
||||
sprintf(dest,
|
||||
"%s %s",
|
||||
strupr(v236),
|
||||
compat_strupr(v236),
|
||||
getmsg(&editorMessageList, &editorMessageListItem, 609));
|
||||
|
||||
char v240[512];
|
||||
|
@ -3717,7 +3718,7 @@ int _OptionWindow()
|
|||
if (characterPrintToFile(dest) == 0) {
|
||||
sprintf(dest,
|
||||
"%s%s",
|
||||
strupr(v236),
|
||||
compat_strupr(v236),
|
||||
getmsg(&editorMessageList, &editorMessageListItem, 607));
|
||||
showDialogBox(dest, NULL, 0, 169, 126, _colorTable[992], NULL, _colorTable[992], 0);
|
||||
} else {
|
||||
|
@ -3726,7 +3727,7 @@ int _OptionWindow()
|
|||
sprintf(dest,
|
||||
"%s%s%s",
|
||||
getmsg(&editorMessageList, &editorMessageListItem, 611),
|
||||
strupr(v236),
|
||||
compat_strupr(v236),
|
||||
"!");
|
||||
showDialogBox(dest, NULL, 0, 169, 126, _colorTable[32328], NULL, _colorTable[992], 0x01);
|
||||
}
|
||||
|
@ -3744,7 +3745,7 @@ int _OptionWindow()
|
|||
}
|
||||
} else if (keyCode == 501 || keyCode == KEY_UPPERCASE_L || keyCode == KEY_LOWERCASE_L) {
|
||||
// LOAD
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
path[0] = '\0';
|
||||
strcat(path, "*.");
|
||||
strcat(path, "GCD");
|
||||
|
@ -3813,7 +3814,7 @@ int _OptionWindow()
|
|||
if (characterFileExists(title)) {
|
||||
sprintf(title,
|
||||
"%s %s",
|
||||
strupr(fileName),
|
||||
compat_strupr(fileName),
|
||||
getmsg(&editorMessageList, &editorMessageListItem, 609));
|
||||
|
||||
char line2[512];
|
||||
|
@ -3838,7 +3839,7 @@ int _OptionWindow()
|
|||
sprintf(title,
|
||||
"%s%s%s",
|
||||
getmsg(&editorMessageList, &editorMessageListItem, 611),
|
||||
strupr(fileName),
|
||||
compat_strupr(fileName),
|
||||
"!");
|
||||
showDialogBox(title, NULL, 0, 169, 126, _colorTable[32328], NULL, _colorTable[32328], 1);
|
||||
}
|
||||
|
@ -4131,7 +4132,7 @@ int characterPrintToFile(const char* fileName)
|
|||
sprintf(title1,
|
||||
" %s: %s (%s)",
|
||||
getmsg(&editorMessageList, &editorMessageListItem, 125),
|
||||
itoa(gGameGlobalVars[GVAR_PLAYER_REPUTATION], title2, 10),
|
||||
compat_itoa(gGameGlobalVars[GVAR_PLAYER_REPUTATION], title2, 10),
|
||||
getmsg(&editorMessageList, &editorMessageListItem, reputationDescription->name));
|
||||
fileWriteString(title1, stream);
|
||||
fileWriteString("\n", stream);
|
||||
|
@ -4489,7 +4490,7 @@ char* _itostndn(int value, char* dest)
|
|||
int v18 = value / v16[index];
|
||||
if (v18 > 0 || v3) {
|
||||
char temp[64]; // TODO: Size is probably wrong.
|
||||
itoa(v18, temp, 10);
|
||||
compat_itoa(v18, temp, 10);
|
||||
strcat(dest, temp);
|
||||
|
||||
v3 = true;
|
||||
|
@ -5102,7 +5103,7 @@ void editorRenderKarma()
|
|||
GenericReputationEntry* reputationDescription = &(gGenericReputationEntries[reputation]);
|
||||
|
||||
char reputationValue[32];
|
||||
itoa(gGameGlobalVars[GVAR_PLAYER_REPUTATION], reputationValue, 10);
|
||||
compat_itoa(gGameGlobalVars[GVAR_PLAYER_REPUTATION], reputationValue, 10);
|
||||
|
||||
sprintf(formattedText,
|
||||
"%s: %s (%s)",
|
||||
|
@ -6490,7 +6491,7 @@ bool editorDrawKillsEntry(const char* name, int kills)
|
|||
color = _colorTable[992];
|
||||
}
|
||||
|
||||
itoa(kills, killsString, 10);
|
||||
compat_itoa(kills, killsString, 10);
|
||||
int v6 = fontGetStringWidth(killsString);
|
||||
|
||||
// TODO: Check.
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#include "stat_defs.h"
|
||||
#include "trait_defs.h"
|
||||
|
||||
#define DIALOG_PICKER_NUM_OPTIONS max(PERK_COUNT, TRAIT_COUNT)
|
||||
// TODO: Should be MAX(PERK_COUNT, TRAIT_COUNT).
|
||||
#define DIALOG_PICKER_NUM_OPTIONS PERK_COUNT
|
||||
#define TOWN_REPUTATION_COUNT 19
|
||||
#define ADDICTION_REPUTATION_COUNT 8
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "object.h"
|
||||
#include "options.h"
|
||||
#include "palette.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto.h"
|
||||
#include "skill.h"
|
||||
#include "stat.h"
|
||||
|
@ -613,7 +614,7 @@ void characterSelectorWindowFree()
|
|||
// 0x4A7D58
|
||||
bool characterSelectorWindowRefresh()
|
||||
{
|
||||
char path[FILENAME_MAX];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s.gcd", gPremadeCharacterDescriptions[gCurrentPremadeCharacter].fileName);
|
||||
if (_proto_dude_init(path) == -1) {
|
||||
debugPrint("\n ** Error in dude init! **\n");
|
||||
|
@ -919,7 +920,7 @@ bool characterSelectorWindowRenderBio()
|
|||
int oldFont = fontGetCurrent();
|
||||
fontSetCurrent(101);
|
||||
|
||||
char path[FILENAME_MAX];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s.bio", gPremadeCharacterDescriptions[gCurrentPremadeCharacter].fileName);
|
||||
|
||||
File* stream = fileOpen(path, "rt");
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// 0x50F930
|
||||
char _aColor_cNoError[] = "color.c: No errors\n";
|
||||
|
||||
|
@ -552,7 +554,7 @@ void colorSetBrightness(double value)
|
|||
|
||||
for (int i = 0; i < 64; i++) {
|
||||
double value = pow(i, gBrightness);
|
||||
_currentGammaTable[i] = (unsigned char)min(max(value, 0.0), 63.0);
|
||||
_currentGammaTable[i] = (unsigned char)std::clamp(value, 0.0, 63.0);
|
||||
}
|
||||
|
||||
_setSystemPalette(_systemCmap);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "object.h"
|
||||
#include "perk.h"
|
||||
#include "pipboy.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto.h"
|
||||
#include "queue.h"
|
||||
#include "random.h"
|
||||
|
@ -1864,7 +1865,7 @@ Attack _explosion_ctd;
|
|||
int combatInit()
|
||||
{
|
||||
int max_action_points;
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
|
||||
_combat_turn_running = 0;
|
||||
_combatNumTurns = 0;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "map.h"
|
||||
#include "memory.h"
|
||||
#include "object.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto.h"
|
||||
#include "proto_instance.h"
|
||||
#include "random.h"
|
||||
|
@ -199,7 +200,7 @@ void _parse_hurt_str(char* str, int* valuePtr)
|
|||
|
||||
*valuePtr = 0;
|
||||
|
||||
str = strlwr(str);
|
||||
str = compat_strlwr(str);
|
||||
while (*str) {
|
||||
v5 = strspn(str, " ");
|
||||
str += v5;
|
||||
|
@ -234,7 +235,7 @@ int _cai_match_str_to_list(const char* str, const char** list, int count, int* v
|
|||
{
|
||||
*valuePtr = -1;
|
||||
for (int index = 0; index < count; index++) {
|
||||
if (stricmp(str, list[index]) == 0) {
|
||||
if (compat_stricmp(str, list[index]) == 0) {
|
||||
*valuePtr = index;
|
||||
}
|
||||
}
|
||||
|
@ -3251,7 +3252,7 @@ int aiMessageListInit()
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "combatai.msg");
|
||||
|
||||
if (!messageListLoad(&gCombatAiMessageList, path)) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "db.h"
|
||||
#include "memory.h"
|
||||
#include "platform_compat.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
@ -243,7 +244,7 @@ bool configGetIntList(Config* config, const char* sectionKey, const char* key, i
|
|||
bool configSetInt(Config* config, const char* sectionKey, const char* key, int value)
|
||||
{
|
||||
char stringValue[20];
|
||||
itoa(value, stringValue, 10);
|
||||
compat_itoa(value, stringValue, 10);
|
||||
|
||||
return configSetString(config, sectionKey, key, stringValue);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "memory.h"
|
||||
#include "message.h"
|
||||
#include "palette.h"
|
||||
#include "platform_compat.h"
|
||||
#include "sound.h"
|
||||
#include "text_font.h"
|
||||
#include "window_manager.h"
|
||||
|
@ -52,7 +53,7 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle)
|
|||
|
||||
soundContinueAll();
|
||||
|
||||
char localizedPath[MAX_PATH];
|
||||
char localizedPath[COMPAT_MAX_PATH];
|
||||
if (_message_make_path(localizedPath, filePath)) {
|
||||
gCreditsFile = fileOpen(localizedPath, "rt");
|
||||
if (gCreditsFile != NULL) {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "memory.h"
|
||||
#include "object.h"
|
||||
#include "party_member.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto.h"
|
||||
#include "queue.h"
|
||||
#include "random.h"
|
||||
|
@ -124,7 +125,7 @@ int critterInit()
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%sscrname.msg", asc_5186C8);
|
||||
|
||||
if (!messageListLoad(&gCritterMessageList, path)) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "db.h"
|
||||
|
||||
#include "platform_compat.h"
|
||||
#include "xfile.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -620,7 +621,7 @@ int fileNameListInit(const char* pattern, char*** fileNameListPtr, int a3, int a
|
|||
|
||||
int fileNamesLength = xlist->fileNamesLength;
|
||||
for (int index = 0; index < fileNamesLength - 1; index++) {
|
||||
if (stricmp(xlist->fileNames[index], xlist->fileNames[index + 1]) == 0) {
|
||||
if (compat_stricmp(xlist->fileNames[index], xlist->fileNames[index + 1]) == 0) {
|
||||
char* temp = xlist->fileNames[index + 1];
|
||||
memmove(&(xlist->fileNames[index + 1]), &(xlist->fileNames[index + 2]), sizeof(*xlist->fileNames) * (xlist->fileNamesLength - index - 1));
|
||||
xlist->fileNames[xlist->fileNamesLength - 1] = temp;
|
||||
|
@ -730,5 +731,5 @@ void _db_enable_hash_table_()
|
|||
// 0x4C68E8
|
||||
int _db_list_compare(const void* p1, const void* p2)
|
||||
{
|
||||
return stricmp(*(const char**)p1, *(const char**)p2);
|
||||
return compat_stricmp(*(const char**)p1, *(const char**)p2);
|
||||
}
|
||||
|
|
11
src/dbox.cc
11
src/dbox.cc
|
@ -8,6 +8,7 @@
|
|||
#include "game.h"
|
||||
#include "game_sound.h"
|
||||
#include "message.h"
|
||||
#include "platform_compat.h"
|
||||
#include "text_font.h"
|
||||
#include "window_manager.h"
|
||||
#include "word_wrap.h"
|
||||
|
@ -15,6 +16,8 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// 0x5108C8
|
||||
const int gDialogBoxBackgroundFrmIds[DIALOG_TYPE_COUNT] = {
|
||||
218, // MEDIALOG.FRM - Medium generic dialog box
|
||||
|
@ -106,7 +109,7 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
|
|||
int linesCount = 0;
|
||||
for (int index = 0; index < bodyLength; index++) {
|
||||
// NOTE: Calls [fontGetStringWidth] twice because of [max] macro.
|
||||
maximumLineWidth = max(fontGetStringWidth(body[index]), maximumLineWidth);
|
||||
maximumLineWidth = std::max(fontGetStringWidth(body[index]), maximumLineWidth);
|
||||
linesCount++;
|
||||
}
|
||||
|
||||
|
@ -205,7 +208,7 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "DBOX.MSG");
|
||||
|
||||
if (!messageListLoad(&messageList, path)) {
|
||||
|
@ -303,7 +306,7 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "DBOX.MSG");
|
||||
|
||||
if (!messageListLoad(&messageList, path)) {
|
||||
|
@ -492,7 +495,7 @@ int _save_file_dialog(char* a1, char** fileList, char* fileName, int fileListLen
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "DBOX.MSG");
|
||||
|
||||
if (!messageListLoad(&messageList, path)) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "debug.h"
|
||||
|
||||
#include "memory.h"
|
||||
#include "platform_compat.h"
|
||||
#include "window_manager_private.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
@ -82,7 +83,7 @@ void _debug_register_env()
|
|||
}
|
||||
|
||||
strcpy(copy, type);
|
||||
strlwr(copy);
|
||||
compat_strlwr(copy);
|
||||
|
||||
if (strcmp(copy, "mono") == 0) {
|
||||
// NOTE: Uninline.
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "dfile.h"
|
||||
|
||||
#include "platform_compat.h"
|
||||
|
||||
#include <fpattern.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -591,7 +593,7 @@ int dbaseFindEntryByFilePath(const void* a1, const void* a2)
|
|||
const char* filePath = (const char*)a1;
|
||||
DBaseEntry* entry = (DBaseEntry*)a2;
|
||||
|
||||
return stricmp(filePath, entry->path);
|
||||
return compat_stricmp(filePath, entry->path);
|
||||
}
|
||||
|
||||
// 0x4E5D9C
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#ifndef DFILE_H
|
||||
#define DFILE_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include "platform_compat.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <zlib.h>
|
||||
|
@ -116,13 +115,13 @@ typedef struct DFile {
|
|||
|
||||
typedef struct DFileFindData {
|
||||
// The name of file that was found during previous search.
|
||||
char fileName[MAX_PATH];
|
||||
char fileName[COMPAT_MAX_PATH];
|
||||
|
||||
// The pattern to search.
|
||||
//
|
||||
// This value is set automatically when [dbaseFindFirstEntry] succeeds so
|
||||
// that subsequent calls to [dbaseFindNextEntry] know what to look for.
|
||||
char pattern[MAX_PATH];
|
||||
char pattern[COMPAT_MAX_PATH];
|
||||
|
||||
// The index of entry that was found during previous search.
|
||||
//
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "core.h"
|
||||
#include "memory_manager.h"
|
||||
#include "movie.h"
|
||||
#include "platform_compat.h"
|
||||
#include "text_font.h"
|
||||
#include "widget.h"
|
||||
#include "window_manager.h"
|
||||
|
@ -450,7 +451,7 @@ int _dialogGotoReply(const char* a1)
|
|||
ptr = &(_dialog[_tods]);
|
||||
for (i = 0; i < ptr->field_8; i++) {
|
||||
v5 = &(ptr->field_4[i]);
|
||||
if (v5->field_4 != NULL && stricmp(v5->field_4, a1) == 0) {
|
||||
if (v5->field_4 != NULL && compat_stricmp(v5->field_4, a1) == 0) {
|
||||
ptr->field_10 = i;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "dictionary.h"
|
||||
|
||||
#include "platform_compat.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -143,7 +145,7 @@ int dictionaryFindIndexForKey(Dictionary* dictionary, const char* key, int* inde
|
|||
while (r >= l) {
|
||||
mid = (l + r) / 2;
|
||||
|
||||
cmp = stricmp(key, dictionary->entries[mid].key);
|
||||
cmp = compat_stricmp(key, dictionary->entries[mid].key);
|
||||
if (cmp == 0) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "electronic_registration.h"
|
||||
|
||||
#include "game_config.h"
|
||||
#include "platform_compat.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
@ -11,7 +12,7 @@ void runElectronicRegistration()
|
|||
int timesRun = 0;
|
||||
configGetInt(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_TIMES_RUN_KEY, ×Run);
|
||||
if (timesRun > 0 && timesRun < 5) {
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
if (GetModuleFileNameA(NULL, path, sizeof(path)) != 0) {
|
||||
char* pch = strrchr(path, '\\');
|
||||
if (pch == NULL) {
|
||||
|
|
|
@ -87,7 +87,7 @@ char gEndgameDeathEndingFileName[40];
|
|||
bool gEndgameEndingVoiceOverSpeechLoaded;
|
||||
|
||||
// 0x570ABC
|
||||
char gEndgameEndingSubtitlesLocalizedPath[MAX_PATH];
|
||||
char gEndgameEndingSubtitlesLocalizedPath[COMPAT_MAX_PATH];
|
||||
|
||||
// The flag used to denote voice over speech for current slide has ended.
|
||||
//
|
||||
|
@ -580,7 +580,7 @@ void endgameEndingSlideshowWindowFree()
|
|||
// 0x4401A0
|
||||
void endgameEndingVoiceOverInit(const char* fileBaseName)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
|
||||
// NOTE: Uninline.
|
||||
endgameEndingVoiceOverFree();
|
||||
|
@ -666,7 +666,7 @@ void endgameEndingLoadPalette(int type, int id)
|
|||
}
|
||||
|
||||
if (strlen(fileName) <= 8) {
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s\\%s.pal", "art\\intrface", fileName);
|
||||
colorPaletteLoad(path);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
#ifndef ENDGAME_H
|
||||
#define ENDGAME_H
|
||||
|
||||
// Provides [MAX_PATH].
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include "platform_compat.h"
|
||||
|
||||
typedef enum EndgameDeathEndingReason {
|
||||
// Dude died.
|
||||
|
@ -46,7 +44,7 @@ extern int gEndgameDeathEndingsLength;
|
|||
|
||||
extern char gEndgameDeathEndingFileName[40];
|
||||
extern bool gEndgameEndingVoiceOverSpeechLoaded;
|
||||
extern char gEndgameEndingSubtitlesLocalizedPath[MAX_PATH];
|
||||
extern char gEndgameEndingSubtitlesLocalizedPath[COMPAT_MAX_PATH];
|
||||
extern bool gEndgameEndingSpeechEnded;
|
||||
extern EndgameEnding* gEndgameEndings;
|
||||
extern char** gEndgameEndingSubtitles;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "interpreter_lib.h"
|
||||
#include "memory_manager.h"
|
||||
#include "platform_compat.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
@ -38,7 +39,7 @@ ExternalProcedure* externalProcedureFind(const char* identifier)
|
|||
|
||||
ExternalProcedure* externalProcedure = &(gExternalProcedures[v1]);
|
||||
if (externalProcedure->program != NULL) {
|
||||
if (stricmp(externalProcedure->name, identifier) == 0) {
|
||||
if (compat_stricmp(externalProcedure->name, identifier) == 0) {
|
||||
return externalProcedure;
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +52,7 @@ ExternalProcedure* externalProcedureFind(const char* identifier)
|
|||
|
||||
externalProcedure = &(gExternalProcedures[v1]);
|
||||
if (externalProcedure->program != NULL) {
|
||||
if (stricmp(externalProcedure->name, identifier) == 0) {
|
||||
if (compat_stricmp(externalProcedure->name, identifier) == 0) {
|
||||
return externalProcedure;
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +96,7 @@ ExternalVariable* externalVariableFind(const char* identifier)
|
|||
unsigned int v2 = v1;
|
||||
|
||||
ExternalVariable* exportedVariable = &(gExternalVariables[v1]);
|
||||
if (stricmp(exportedVariable->name, identifier) == 0) {
|
||||
if (compat_stricmp(exportedVariable->name, identifier) == 0) {
|
||||
return exportedVariable;
|
||||
}
|
||||
|
||||
|
@ -111,7 +112,7 @@ ExternalVariable* externalVariableFind(const char* identifier)
|
|||
}
|
||||
|
||||
exportedVariable = &(gExternalVariables[v1]);
|
||||
if (stricmp(exportedVariable->name, identifier) == 0) {
|
||||
if (compat_stricmp(exportedVariable->name, identifier) == 0) {
|
||||
return exportedVariable;
|
||||
}
|
||||
} while (v1 != v2);
|
||||
|
@ -200,7 +201,7 @@ int externalVariableCreate(Program* program, const char* identifier)
|
|||
ExternalVariable* exportedVariable = externalVariableFind(identifier);
|
||||
|
||||
if (exportedVariable != NULL) {
|
||||
if (stricmp(exportedVariable->programName, programName) != 0) {
|
||||
if (compat_stricmp(exportedVariable->programName, programName) != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
#include "file_find.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
// 0x4E6380
|
||||
bool fileFindFirst(const char* path, DirectoryFileFindData* findData)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
findData->hFind = FindFirstFileA(path, &(findData->ffd));
|
||||
if (findData->hFind == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
}
|
||||
#elif defined(__WATCOMC__)
|
||||
#else
|
||||
findData->dir = opendir(path);
|
||||
if (findData->dir == NULL) {
|
||||
return false;
|
||||
|
@ -19,8 +21,6 @@ bool fileFindFirst(const char* path, DirectoryFileFindData* findData)
|
|||
closedir(findData->dir);
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
#error Not implemented
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
@ -29,18 +29,16 @@ bool fileFindFirst(const char* path, DirectoryFileFindData* findData)
|
|||
// 0x4E63A8
|
||||
bool fileFindNext(DirectoryFileFindData* findData)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
if (!FindNextFileA(findData->hFind, &(findData->ffd))) {
|
||||
return false;
|
||||
}
|
||||
#elif defined(__WATCOMC__)
|
||||
#else
|
||||
findData->entry = readdir(findData->dir);
|
||||
if (findData->entry == NULL) {
|
||||
closedir(findData->dir);
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
#error Not implemented
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
@ -51,12 +49,10 @@ bool findFindClose(DirectoryFileFindData* findData)
|
|||
{
|
||||
#if defined(_MSC_VER)
|
||||
FindClose(findData->hFind);
|
||||
#elif defined(__WATCOMC__)
|
||||
#else
|
||||
if (closedir(findData->dir) != 0) {
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
#error Not implemented
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#ifndef FILE_FIND_H
|
||||
#define FILE_FIND_H
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
// NOTE: This structure is significantly different from what was in the
|
||||
// original code. Watcom provides opendir/readdir/closedir implementations,
|
||||
|
@ -24,14 +29,12 @@
|
|||
// original implementation for Watcom (not tested). I'm not sure it will work
|
||||
// in other compilers, so for now just stick with the error.
|
||||
typedef struct DirectoryFileFindData {
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
HANDLE hFind;
|
||||
WIN32_FIND_DATAA ffd;
|
||||
#elif defined(__WATCOMC__)
|
||||
#else
|
||||
DIR* dir;
|
||||
struct dirent* entry;
|
||||
#else
|
||||
#error Not implemented
|
||||
#endif
|
||||
} DirectoryFileFindData;
|
||||
|
||||
|
@ -39,4 +42,24 @@ bool fileFindFirst(const char* path, DirectoryFileFindData* findData);
|
|||
bool fileFindNext(DirectoryFileFindData* findData);
|
||||
bool findFindClose(DirectoryFileFindData* findData);
|
||||
|
||||
static inline bool fileFindIsDirectory(DirectoryFileFindData* findData)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
return (findData->ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
||||
#elif defined(__WATCOMC__)
|
||||
return (findData->entry->d_attr & _A_SUBDIR) != 0;
|
||||
#else
|
||||
return findData->entry->d_type == DT_DIR;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline char* fileFindGetName(DirectoryFileFindData* findData)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
return findData->ffd.cFileName;
|
||||
#else
|
||||
return findData->entry->d_name;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* FILE_FIND_H */
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
#include <stdio.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <filesystem>
|
||||
|
||||
// 0x452740
|
||||
int fileCopyDecompressed(const char* existingFilePath, const char* newFilePath)
|
||||
|
@ -50,7 +49,7 @@ int fileCopyDecompressed(const char* existingFilePath, const char* newFilePath)
|
|||
return -1;
|
||||
}
|
||||
} else {
|
||||
CopyFileA(existingFilePath, newFilePath, FALSE);
|
||||
fileCopy(existingFilePath, newFilePath, true);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -73,7 +72,7 @@ int fileCopyCompressed(const char* existingFilePath, const char* newFilePath)
|
|||
// Source file is already gzipped, there is no need to do anything
|
||||
// besides copying.
|
||||
fclose(inStream);
|
||||
CopyFileA(existingFilePath, newFilePath, FALSE);
|
||||
fileCopy(existingFilePath, newFilePath, true);
|
||||
} else {
|
||||
gzFile outStream = gzopen(newFilePath, "wb");
|
||||
if (outStream == NULL) {
|
||||
|
@ -136,8 +135,19 @@ int _gzdecompress_file(const char* existingFilePath, const char* newFilePath)
|
|||
gzclose(gzstream);
|
||||
fclose(stream);
|
||||
} else {
|
||||
CopyFileA(existingFilePath, newFilePath, FALSE);
|
||||
fileCopy(existingFilePath, newFilePath, true);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Modelled as replacement for `CopyFileA`, but `overwrite` is the opposite to
|
||||
// `bFailIfExists` param. Update callers accordingly.
|
||||
void fileCopy(const char* existingFilePath, const char* newFilePath, bool overwrite)
|
||||
{
|
||||
std::error_code ec;
|
||||
std::filesystem::copy_options options = overwrite
|
||||
? std::filesystem::copy_options::overwrite_existing
|
||||
: std::filesystem::copy_options::none;
|
||||
std::filesystem::copy_file(std::filesystem::path(existingFilePath), std::filesystem::path(newFilePath), options, ec);
|
||||
}
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
int fileCopyDecompressed(const char* existingFilePath, const char* newFilePath);
|
||||
int fileCopyCompressed(const char* existingFilePath, const char* newFilePath);
|
||||
int _gzdecompress_file(const char* existingFilePath, const char* newFilePath);
|
||||
void fileCopy(const char* existingFilePath, const char* newFilePath, bool overwrite);
|
||||
|
||||
#endif /* FILE_UTILS_H */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <SDL.h>
|
||||
|
||||
FpsLimiter::FpsLimiter(size_t fps)
|
||||
FpsLimiter::FpsLimiter(std::size_t fps)
|
||||
: _fps(fps)
|
||||
, _ticks(0)
|
||||
{
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
#ifndef FPS_LIMITER_H
|
||||
#define FPS_LIMITER_H
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
class FpsLimiter {
|
||||
public:
|
||||
FpsLimiter(size_t fps = 60);
|
||||
FpsLimiter(std::size_t fps = 60);
|
||||
void mark();
|
||||
void throttle() const;
|
||||
|
||||
private:
|
||||
const size_t _fps;
|
||||
size_t _ticks;
|
||||
const std::size_t _fps;
|
||||
std::size_t _ticks;
|
||||
};
|
||||
|
||||
#endif /* FPS_LIMITER_H */
|
||||
|
|
17
src/game.cc
17
src/game.cc
|
@ -39,6 +39,7 @@
|
|||
#include "party_member.h"
|
||||
#include "perk.h"
|
||||
#include "pipboy.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto.h"
|
||||
#include "queue.h"
|
||||
#include "random.h"
|
||||
|
@ -110,7 +111,7 @@ int _critter_db_handle;
|
|||
// 0x442580
|
||||
int gameInitWithOptions(const char* windowTitle, bool isMapper, int font, int a4, int argc, char** argv)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
|
||||
if (gameMemoryInit() == -1) {
|
||||
return -1;
|
||||
|
@ -137,13 +138,13 @@ int gameInitWithOptions(const char* windowTitle, bool isMapper, int font, int a4
|
|||
|
||||
char* language;
|
||||
if (configGetString(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_LANGUAGE_KEY, &language)) {
|
||||
if (stricmp(language, FRENCH) == 0) {
|
||||
if (compat_stricmp(language, FRENCH) == 0) {
|
||||
keyboardSetLayout(KEYBOARD_LAYOUT_FRENCH);
|
||||
} else if (stricmp(language, GERMAN) == 0) {
|
||||
} else if (compat_stricmp(language, GERMAN) == 0) {
|
||||
keyboardSetLayout(KEYBOARD_LAYOUT_GERMAN);
|
||||
} else if (stricmp(language, ITALIAN) == 0) {
|
||||
} else if (compat_stricmp(language, ITALIAN) == 0) {
|
||||
keyboardSetLayout(KEYBOARD_LAYOUT_ITALIAN);
|
||||
} else if (stricmp(language, SPANISH) == 0) {
|
||||
} else if (compat_stricmp(language, SPANISH) == 0) {
|
||||
keyboardSetLayout(KEYBOARD_LAYOUT_SPANISH);
|
||||
}
|
||||
}
|
||||
|
@ -724,7 +725,7 @@ int gameHandleKey(int eventCode, bool isInCombatMode)
|
|||
|
||||
MessageList messageList;
|
||||
if (messageListInit(&messageList)) {
|
||||
char path[FILENAME_MAX];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "editor.msg");
|
||||
|
||||
if (messageListLoad(&messageList, path)) {
|
||||
|
@ -1161,7 +1162,7 @@ int gameDbInit()
|
|||
char* main_file_name;
|
||||
char* patch_file_name;
|
||||
int patch_index;
|
||||
char filename[MAX_PATH];
|
||||
char filename[COMPAT_MAX_PATH];
|
||||
|
||||
hashing = 0;
|
||||
main_file_name = NULL;
|
||||
|
@ -1222,7 +1223,7 @@ void showSplash()
|
|||
|
||||
char path[64];
|
||||
char* language;
|
||||
if (configGetString(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_LANGUAGE_KEY, &language) && stricmp(language, ENGLISH) != 0) {
|
||||
if (configGetString(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_LANGUAGE_KEY, &language) && compat_stricmp(language, ENGLISH) != 0) {
|
||||
sprintf(path, "art\\%s\\splash\\", language);
|
||||
} else {
|
||||
sprintf(path, "art\\splash\\");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "game_config.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "platform_compat.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -19,7 +20,7 @@ Config gGameConfig;
|
|||
// probably means it's size is 264 bytes.
|
||||
//
|
||||
// 0x58E978
|
||||
char gGameConfigFilePath[FILENAME_MAX];
|
||||
char gGameConfigFilePath[COMPAT_MAX_PATH];
|
||||
|
||||
// Inits main game config.
|
||||
//
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "item.h"
|
||||
#include "map.h"
|
||||
#include "object.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto.h"
|
||||
#include "proto_instance.h"
|
||||
#include "skilldex.h"
|
||||
|
@ -2193,7 +2194,7 @@ int _gmouse_3d_move_to(int x, int y, int elevation, Rect* a4)
|
|||
|
||||
char* executable;
|
||||
configGetString(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_EXECUTABLE_KEY, &executable);
|
||||
if (stricmp(executable, "mapper") == 0) {
|
||||
if (compat_stricmp(executable, "mapper") == 0) {
|
||||
if (tileRoofIsVisible()) {
|
||||
if ((gDude->flags & OBJECT_HIDDEN) == 0) {
|
||||
y1 = -83;
|
||||
|
|
|
@ -76,7 +76,7 @@ bool gGameMovieFaded = false;
|
|||
unsigned char gGameMoviesSeen[MOVIE_COUNT];
|
||||
|
||||
// 0x596C89
|
||||
char gGameMovieSubtitlesFilePath[MAX_PATH];
|
||||
char gGameMovieSubtitlesFilePath[COMPAT_MAX_PATH];
|
||||
|
||||
// gmovie_init
|
||||
// 0x44E5C0
|
||||
|
@ -144,11 +144,11 @@ int gameMoviePlay(int movie, int flags)
|
|||
return -1;
|
||||
}
|
||||
|
||||
char movieFilePath[MAX_PATH];
|
||||
char movieFilePath[COMPAT_MAX_PATH];
|
||||
int movieFileSize;
|
||||
bool movieFound = false;
|
||||
|
||||
if (stricmp(language, ENGLISH) != 0) {
|
||||
if (compat_stricmp(language, ENGLISH) != 0) {
|
||||
sprintf(movieFilePath, "art\\%s\\cuts\\%s", language, gMovieFileNames[movie]);
|
||||
movieFound = dbGetFileSize(movieFilePath, &movieFileSize) == 0;
|
||||
}
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
#define GAME_MOVIE_H
|
||||
|
||||
#include "db.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include "platform_compat.h"
|
||||
|
||||
typedef enum GameMovieFlags {
|
||||
GAME_MOVIE_FADE_IN = 0x01,
|
||||
|
@ -41,7 +39,7 @@ extern const char* gMoviePaletteFilePaths[MOVIE_COUNT];
|
|||
extern bool gGameMovieIsPlaying;
|
||||
extern bool gGameMovieFaded;
|
||||
|
||||
extern char gGameMovieSubtitlesFilePath[MAX_PATH];
|
||||
extern char gGameMovieSubtitlesFilePath[COMPAT_MAX_PATH];
|
||||
extern unsigned char gGameMoviesSeen[MOVIE_COUNT];
|
||||
|
||||
int gameMoviesInit();
|
||||
|
|
|
@ -124,7 +124,7 @@ int _detectDevices = -1;
|
|||
int _lastTime_1 = 0;
|
||||
|
||||
// 0x596EB0
|
||||
char _background_fname_copied[MAX_PATH];
|
||||
char _background_fname_copied[COMPAT_MAX_PATH];
|
||||
|
||||
// 0x596FB5
|
||||
char _sfx_file_name[13];
|
||||
|
@ -613,7 +613,7 @@ int backgroundSoundLoad(const char* fileName, int a2, int a3, int a4)
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH + 1];
|
||||
char path[COMPAT_MAX_PATH + 1];
|
||||
if (a3 == 13) {
|
||||
rc = gameSoundFindBackgroundSoundPath(path, fileName);
|
||||
} else if (a3 == 14) {
|
||||
|
@ -837,7 +837,7 @@ int speechGetDuration()
|
|||
// 0x450CA0
|
||||
int speechLoad(const char* fname, int a2, int a3, int a4)
|
||||
{
|
||||
char path[MAX_PATH + 1];
|
||||
char path[COMPAT_MAX_PATH + 1];
|
||||
|
||||
if (!gGameSoundInitialized) {
|
||||
return -1;
|
||||
|
@ -1063,7 +1063,7 @@ Sound* soundEffectLoad(const char* name, Object* object)
|
|||
|
||||
++_gsound_active_effect_counter;
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s%s", _sound_sfx_path, name, ".ACM");
|
||||
|
||||
if (soundLoad(sound, path) == 0) {
|
||||
|
@ -1308,7 +1308,7 @@ char* sfxBuildCharName(Object* a1, int anim, int extra)
|
|||
}
|
||||
|
||||
sprintf(_sfx_file_name, "%s%c%c", v7, v8, v9);
|
||||
strupr(_sfx_file_name);
|
||||
compat_strupr(_sfx_file_name);
|
||||
return _sfx_file_name;
|
||||
}
|
||||
|
||||
|
@ -1317,7 +1317,7 @@ char* sfxBuildCharName(Object* a1, int anim, int extra)
|
|||
char* gameSoundBuildAmbientSoundEffectName(const char* a1)
|
||||
{
|
||||
sprintf(_sfx_file_name, "A%6s%1d", a1, 1);
|
||||
strupr(_sfx_file_name);
|
||||
compat_strupr(_sfx_file_name);
|
||||
return _sfx_file_name;
|
||||
}
|
||||
|
||||
|
@ -1326,7 +1326,7 @@ char* gameSoundBuildAmbientSoundEffectName(const char* a1)
|
|||
char* gameSoundBuildInterfaceName(const char* a1)
|
||||
{
|
||||
sprintf(_sfx_file_name, "N%6s%1d", a1, 1);
|
||||
strupr(_sfx_file_name);
|
||||
compat_strupr(_sfx_file_name);
|
||||
return _sfx_file_name;
|
||||
}
|
||||
|
||||
|
@ -1402,7 +1402,7 @@ char* sfxBuildWeaponName(int effectType, Object* weapon, int hitMode, Object* ta
|
|||
}
|
||||
|
||||
sprintf(_sfx_file_name, "W%c%c%1d%cXX%1d", effectTypeCode, weaponSoundCode, v6, materialCode, 1);
|
||||
strupr(_sfx_file_name);
|
||||
compat_strupr(_sfx_file_name);
|
||||
return _sfx_file_name;
|
||||
}
|
||||
|
||||
|
@ -1414,7 +1414,7 @@ char* sfxBuildSceneryName(int actionType, int action, const char* name)
|
|||
char actionCode = _snd_lookup_scenery_action[action];
|
||||
|
||||
sprintf(_sfx_file_name, "S%c%c%4s%1d", actionTypeCode, actionCode, name, 1);
|
||||
strupr(_sfx_file_name);
|
||||
compat_strupr(_sfx_file_name);
|
||||
|
||||
return _sfx_file_name;
|
||||
}
|
||||
|
@ -1437,7 +1437,7 @@ char* sfxBuildOpenName(Object* object, int action)
|
|||
protoGetProto(object->pid, &proto);
|
||||
sprintf(_sfx_file_name, "I%cCNTNR%c", _snd_lookup_scenery_action[action], proto->item.field_80);
|
||||
}
|
||||
strupr(_sfx_file_name);
|
||||
compat_strupr(_sfx_file_name);
|
||||
return _sfx_file_name;
|
||||
}
|
||||
|
||||
|
@ -1674,7 +1674,7 @@ int _gsound_background_allocate(Sound** soundPtr, int a2, int a3)
|
|||
int gameSoundFindBackgroundSoundPathWithCopy(char* dest, const char* src)
|
||||
{
|
||||
size_t len = strlen(src) + strlen(".ACM");
|
||||
if (strlen(_sound_music_path1) + len > MAX_PATH || strlen(_sound_music_path2) + len > MAX_PATH) {
|
||||
if (strlen(_sound_music_path1) + len > COMPAT_MAX_PATH || strlen(_sound_music_path2) + len > COMPAT_MAX_PATH) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint("Full background path too long.\n");
|
||||
}
|
||||
|
@ -1686,11 +1686,11 @@ int gameSoundFindBackgroundSoundPathWithCopy(char* dest, const char* src)
|
|||
debugPrint(" finding background sound ");
|
||||
}
|
||||
|
||||
char outPath[MAX_PATH];
|
||||
char outPath[COMPAT_MAX_PATH];
|
||||
sprintf(outPath, "%s%s%s", _sound_music_path1, src, ".ACM");
|
||||
if (_gsound_file_exists_f(outPath)) {
|
||||
strncpy(dest, outPath, MAX_PATH);
|
||||
dest[MAX_PATH] = '\0';
|
||||
strncpy(dest, outPath, COMPAT_MAX_PATH);
|
||||
dest[COMPAT_MAX_PATH] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1700,7 +1700,7 @@ int gameSoundFindBackgroundSoundPathWithCopy(char* dest, const char* src)
|
|||
|
||||
gameSoundDeleteOldMusicFile();
|
||||
|
||||
char inPath[MAX_PATH];
|
||||
char inPath[COMPAT_MAX_PATH];
|
||||
sprintf(inPath, "%s%s%s", _sound_music_path2, src, ".ACM");
|
||||
|
||||
FILE* inStream = fopen(inPath, "rb");
|
||||
|
@ -1763,8 +1763,8 @@ int gameSoundFindBackgroundSoundPathWithCopy(char* dest, const char* src)
|
|||
|
||||
strcpy(_background_fname_copied, src);
|
||||
|
||||
strncpy(dest, outPath, MAX_PATH);
|
||||
dest[MAX_PATH] = '\0';
|
||||
strncpy(dest, outPath, COMPAT_MAX_PATH);
|
||||
dest[COMPAT_MAX_PATH] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1772,11 +1772,11 @@ int gameSoundFindBackgroundSoundPathWithCopy(char* dest, const char* src)
|
|||
// 0x451E2C
|
||||
int gameSoundFindBackgroundSoundPath(char* dest, const char* src)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
int len;
|
||||
|
||||
len = strlen(src) + strlen(".ACM");
|
||||
if (strlen(_sound_music_path1) + len > MAX_PATH || strlen(_sound_music_path2) + len > MAX_PATH) {
|
||||
if (strlen(_sound_music_path1) + len > COMPAT_MAX_PATH || strlen(_sound_music_path2) + len > COMPAT_MAX_PATH) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint("Full background path too long.\n");
|
||||
}
|
||||
|
@ -1790,8 +1790,8 @@ int gameSoundFindBackgroundSoundPath(char* dest, const char* src)
|
|||
|
||||
sprintf(path, "%s%s%s", _sound_music_path1, src, ".ACM");
|
||||
if (_gsound_file_exists_f(path)) {
|
||||
strncpy(dest, path, MAX_PATH);
|
||||
dest[MAX_PATH] = '\0';
|
||||
strncpy(dest, path, COMPAT_MAX_PATH);
|
||||
dest[COMPAT_MAX_PATH] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1801,8 +1801,8 @@ int gameSoundFindBackgroundSoundPath(char* dest, const char* src)
|
|||
|
||||
sprintf(path, "%s%s%s", _sound_music_path2, src, ".ACM");
|
||||
if (_gsound_file_exists_f(path)) {
|
||||
strncpy(dest, path, MAX_PATH);
|
||||
dest[MAX_PATH] = '\0';
|
||||
strncpy(dest, path, COMPAT_MAX_PATH);
|
||||
dest[COMPAT_MAX_PATH] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1816,9 +1816,9 @@ int gameSoundFindBackgroundSoundPath(char* dest, const char* src)
|
|||
// 0x451F94
|
||||
int gameSoundFindSpeechSoundPath(char* dest, const char* src)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
|
||||
if (strlen(_sound_speech_path) + strlen(".acm") > MAX_PATH) {
|
||||
if (strlen(_sound_speech_path) + strlen(".acm") > COMPAT_MAX_PATH) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
// FIXME: The message is wrong (notes background path, but here
|
||||
// we're dealing with speech path).
|
||||
|
@ -1844,8 +1844,8 @@ int gameSoundFindSpeechSoundPath(char* dest, const char* src)
|
|||
return -1;
|
||||
}
|
||||
|
||||
strncpy(dest, path, MAX_PATH);
|
||||
dest[MAX_PATH] = '\0';
|
||||
strncpy(dest, path, COMPAT_MAX_PATH);
|
||||
dest[COMPAT_MAX_PATH] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1855,7 +1855,7 @@ int gameSoundFindSpeechSoundPath(char* dest, const char* src)
|
|||
void gameSoundDeleteOldMusicFile()
|
||||
{
|
||||
if (_background_fname_copied[0] != '\0') {
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s%s", "sound\\music\\", _background_fname_copied, ".ACM");
|
||||
if (remove(path)) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
#define GAME_SOUND_H
|
||||
|
||||
#include "obj_types.h"
|
||||
#include "platform_compat.h"
|
||||
#include "sound.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
|
||||
typedef enum WeaponSoundEffect {
|
||||
|
@ -71,7 +73,7 @@ extern int gSoundEffectsVolume;
|
|||
extern int _detectDevices;
|
||||
extern int _lastTime_1;
|
||||
|
||||
extern char _background_fname_copied[MAX_PATH];
|
||||
extern char _background_fname_copied[COMPAT_MAX_PATH];
|
||||
extern char _sfx_file_name[13];
|
||||
extern char gBackgroundSoundFileName[270];
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "item.h"
|
||||
#include "memory.h"
|
||||
#include "object.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto.h"
|
||||
#include "proto_instance.h"
|
||||
#include "proto_types.h"
|
||||
|
@ -2318,7 +2319,7 @@ int indicatorBarInit()
|
|||
rc = -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "intrface.msg");
|
||||
|
||||
if (rc != -1) {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "export.h"
|
||||
#include "interpreter_lib.h"
|
||||
#include "memory_manager.h"
|
||||
#include "platform_compat.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -2967,7 +2968,7 @@ void opLookupStringProc(Program* program)
|
|||
for (int index = 1; index < procedureCount; index++) {
|
||||
int offset = stackReadInt32(procedurePtr, 0);
|
||||
const char* procedureName = programGetIdentifier(program, offset);
|
||||
if (stricmp(procedureName, procedureNameToLookup) == 0) {
|
||||
if (compat_stricmp(procedureName, procedureNameToLookup) == 0) {
|
||||
programStackPushInt32(program, index);
|
||||
programStackPushInt16(program, VALUE_TYPE_INT);
|
||||
return;
|
||||
|
@ -3309,7 +3310,7 @@ int programFindProcedure(Program* program, const char* name)
|
|||
unsigned char* ptr = program->procedures + 4;
|
||||
for (int index = 0; index < procedureCount; index++) {
|
||||
int identifierOffset = stackReadInt32(ptr, offsetof(Procedure, field_0));
|
||||
if (stricmp((char*)(program->identifiers + identifierOffset), name) == 0) {
|
||||
if (compat_stricmp((char*)(program->identifiers + identifierOffset), name) == 0) {
|
||||
return index;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "map.h"
|
||||
#include "object.h"
|
||||
#include "perk.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto.h"
|
||||
#include "proto_instance.h"
|
||||
#include "random.h"
|
||||
|
@ -37,6 +38,8 @@
|
|||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#define INVENTORY_LARGE_SLOT_WIDTH 90
|
||||
#define INVENTORY_LARGE_SLOT_HEIGHT 61
|
||||
|
||||
|
@ -356,7 +359,7 @@ void _inven_reset_dude()
|
|||
// 0x46E73C
|
||||
int inventoryMessageListInit()
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
|
||||
if (!messageListInit(&gInventoryMessageList))
|
||||
return -1;
|
||||
|
@ -1380,7 +1383,7 @@ void _display_body(int fid, int inventoryWindowType)
|
|||
unsigned char* frameData = artGetFrameData(art, frame, rotation);
|
||||
|
||||
int framePitch = artGetWidth(art, frame, rotation);
|
||||
int frameWidth = min(framePitch, INVENTORY_BODY_VIEW_WIDTH);
|
||||
int frameWidth = std::min(framePitch, INVENTORY_BODY_VIEW_WIDTH);
|
||||
|
||||
int frameHeight = artGetHeight(art, frame, rotation);
|
||||
if (frameHeight > INVENTORY_BODY_VIEW_HEIGHT) {
|
||||
|
@ -3632,7 +3635,7 @@ int inventoryOpenLooting(Object* a1, Object* a2)
|
|||
if (!isCaughtStealing) {
|
||||
if (stealingXp > 0) {
|
||||
if (!objectIsPartyMember(a2)) {
|
||||
stealingXp = min(300 - skillGetValue(a1, SKILL_STEAL), stealingXp);
|
||||
stealingXp = std::min(300 - skillGetValue(a1, SKILL_STEAL), stealingXp);
|
||||
debugPrint("\n[[[%d]]]", 300 - skillGetValue(a1, SKILL_STEAL));
|
||||
|
||||
// You gain %d experience points for successfully using your Steal skill.
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "memory.h"
|
||||
#include "object.h"
|
||||
#include "perk.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto.h"
|
||||
#include "proto_instance.h"
|
||||
#include "queue.h"
|
||||
|
@ -110,7 +111,7 @@ int itemsInit()
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "item.msg");
|
||||
|
||||
if (!messageListLoad(&gItemsMessageList, path)) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "debug.h"
|
||||
#include "game_sound.h"
|
||||
#include "memory.h"
|
||||
#include "platform_compat.h"
|
||||
#include "sound.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -393,7 +394,7 @@ int _lips_make_speech()
|
|||
gLipsData.field_14 = NULL;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
char* v1 = _lips_fix_string(gLipsData.field_50, sizeof(gLipsData.field_50));
|
||||
sprintf(path, "%s%s\\%s.%s", "SOUND\\SPEECH\\", _lips_subdir_name, v1, "ACM");
|
||||
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#define LS_WINDOW_WIDTH 640
|
||||
#define LS_WINDOW_HEIGHT 480
|
||||
|
||||
|
@ -190,22 +192,22 @@ unsigned char* gLoadSaveFrmData[LOAD_SAVE_FRM_COUNT];
|
|||
unsigned char* _snapshot;
|
||||
|
||||
// 0x6142F0
|
||||
char _str2[MAX_PATH];
|
||||
char _str2[COMPAT_MAX_PATH];
|
||||
|
||||
// 0x6143F4
|
||||
char _str0[MAX_PATH];
|
||||
char _str0[COMPAT_MAX_PATH];
|
||||
|
||||
// 0x6144F8
|
||||
char _str1[MAX_PATH];
|
||||
char _str1[COMPAT_MAX_PATH];
|
||||
|
||||
// 0x6145FC
|
||||
char _str[MAX_PATH];
|
||||
char _str[COMPAT_MAX_PATH];
|
||||
|
||||
// 0x614700
|
||||
unsigned char* gLoadSaveWindowBuffer;
|
||||
|
||||
// 0x614704
|
||||
char _gmpath[MAX_PATH];
|
||||
char _gmpath[COMPAT_MAX_PATH];
|
||||
|
||||
// 0x614808
|
||||
File* _flptr;
|
||||
|
@ -289,7 +291,7 @@ int lsgSaveGame(int mode)
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "LSGAME.MSG");
|
||||
if (!messageListLoad(&gLoadSaveMessageList, path)) {
|
||||
return -1;
|
||||
|
@ -687,7 +689,7 @@ int lsgLoadGame(int mode)
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s\\%s", asc_5186C8, "LSGAME.MSG");
|
||||
if (!messageListLoad(&gLoadSaveMessageList, path)) {
|
||||
return -1;
|
||||
|
@ -2132,7 +2134,7 @@ int _GameMap2Slot(File* stream)
|
|||
continue;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
if (_proto_list_str(pid, path) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
@ -2268,7 +2270,7 @@ int _SlotMap2Game(File* stream)
|
|||
for (int index = 1; index < gPartyMemberDescriptionsLength; index += 1) {
|
||||
int pid = gPartyMemberPids[index];
|
||||
if (pid != -2) {
|
||||
char protoPath[MAX_PATH];
|
||||
char protoPath[COMPAT_MAX_PATH];
|
||||
if (_proto_list_str(pid, protoPath) == 0) {
|
||||
const char* basePath = pid >> 24 == OBJ_TYPE_CRITTER
|
||||
? "PROTO\\CRITTERS"
|
||||
|
@ -2389,7 +2391,7 @@ int _copy_file(const char* a1, const char* a2)
|
|||
}
|
||||
|
||||
while (length != 0) {
|
||||
chunk_length = min(length, 0xFFFF);
|
||||
chunk_length = std::min(length, 0xFFFF);
|
||||
|
||||
if (fileRead(buf, chunk_length, 1, stream1) != 1) {
|
||||
break;
|
||||
|
@ -2429,7 +2431,7 @@ out:
|
|||
// 0x48000C
|
||||
void lsgInit()
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s\\", "MAPS");
|
||||
_MapDirErase(path, "SAV");
|
||||
}
|
||||
|
@ -2437,7 +2439,7 @@ void lsgInit()
|
|||
// 0x480040
|
||||
int _MapDirErase(const char* relativePath, const char* extension)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s*.%s", relativePath, extension);
|
||||
|
||||
char** fileList;
|
||||
|
@ -2454,7 +2456,7 @@ int _MapDirErase(const char* relativePath, const char* extension)
|
|||
// 0x4800C8
|
||||
int _MapDirEraseFile_(const char* a1, const char* a2)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
|
||||
sprintf(path, "%s\\%s%s", _patches, a1, a2);
|
||||
if (remove(path) != 0) {
|
||||
|
|
|
@ -5,9 +5,7 @@
|
|||
#include "db.h"
|
||||
#include "geometry.h"
|
||||
#include "message.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include "platform_compat.h"
|
||||
|
||||
#define LOAD_SAVE_DESCRIPTION_LENGTH (30)
|
||||
#define LOAD_SAVE_HANDLER_COUNT (27)
|
||||
|
@ -103,12 +101,12 @@ extern int _dbleclkcntr;
|
|||
extern int gLoadSaveWindow;
|
||||
extern unsigned char* gLoadSaveFrmData[LOAD_SAVE_FRM_COUNT];
|
||||
extern unsigned char* _snapshot;
|
||||
extern char _str2[MAX_PATH];
|
||||
extern char _str0[MAX_PATH];
|
||||
extern char _str1[MAX_PATH];
|
||||
extern char _str[MAX_PATH];
|
||||
extern char _str2[COMPAT_MAX_PATH];
|
||||
extern char _str0[COMPAT_MAX_PATH];
|
||||
extern char _str1[COMPAT_MAX_PATH];
|
||||
extern char _str[COMPAT_MAX_PATH];
|
||||
extern unsigned char* gLoadSaveWindowBuffer;
|
||||
extern char _gmpath[MAX_PATH];
|
||||
extern char _gmpath[COMPAT_MAX_PATH];
|
||||
extern File* _flptr;
|
||||
extern int _ls_error_code;
|
||||
extern int gLoadSaveWindowOldFont;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "object.h"
|
||||
#include "options.h"
|
||||
#include "palette.h"
|
||||
#include "platform_compat.h"
|
||||
#include "random.h"
|
||||
#include "scripts.h"
|
||||
#include "sfall_config.h"
|
||||
|
@ -510,7 +511,7 @@ int _mainDeathGrabTextFile(const char* fileName, char* dest)
|
|||
language = _aEnglish_2;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "text\\%s\\cuts\\%s%s", language, p + 1, ".TXT");
|
||||
|
||||
File* stream = fileOpen(path, "rt");
|
||||
|
|
12
src/map.cc
12
src/map.cc
|
@ -130,7 +130,7 @@ char _scratchStr[40];
|
|||
// Last map file name.
|
||||
//
|
||||
// 0x631E78
|
||||
char _map_path[MAX_PATH];
|
||||
char _map_path[COMPAT_MAX_PATH];
|
||||
|
||||
// iso_init
|
||||
// 0x481CA0
|
||||
|
@ -255,12 +255,12 @@ void _map_init()
|
|||
{
|
||||
char* executable;
|
||||
configGetString(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, "executable", &executable);
|
||||
if (stricmp(executable, "mapper") == 0) {
|
||||
if (compat_stricmp(executable, "mapper") == 0) {
|
||||
_map_scroll_refresh = isoWindowRefreshRectMapper;
|
||||
}
|
||||
|
||||
if (messageListInit(&gMapMessageList)) {
|
||||
char path[FILENAME_MAX];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%smap.msg", asc_5186C8);
|
||||
|
||||
if (!messageListLoad(&gMapMessageList, path)) {
|
||||
|
@ -696,7 +696,7 @@ int mapLoadByName(char* fileName)
|
|||
{
|
||||
int rc;
|
||||
|
||||
strupr(fileName);
|
||||
compat_strupr(fileName);
|
||||
|
||||
rc = -1;
|
||||
|
||||
|
@ -875,7 +875,7 @@ int mapLoad(File* stream)
|
|||
gMapHeader.field_34 = mapGetIndexByFileName(gMapHeader.name);
|
||||
|
||||
if ((gMapHeader.flags & 1) == 0) {
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "maps\\%s", gMapHeader.name);
|
||||
|
||||
char* extension = strstr(path, ".MAP");
|
||||
|
@ -1442,7 +1442,7 @@ int _map_save_in_game(bool a1)
|
|||
// 0x483E28
|
||||
void mapMakeMapsDirectory()
|
||||
{
|
||||
char path[FILENAME_MAX];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
|
||||
char* masterPatchesPath;
|
||||
if (configGetString(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_MASTER_PATCHES_KEY, &masterPatchesPath)) {
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
#include "geometry.h"
|
||||
#include "map_defs.h"
|
||||
#include "message.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include "platform_compat.h"
|
||||
|
||||
#define ORIGINAL_ISO_WINDOW_WIDTH 640
|
||||
#define ORIGINAL_ISO_WINDOW_HEIGHT 380
|
||||
|
@ -91,7 +89,7 @@ extern MapHeader gMapHeader;
|
|||
extern TileData* _square[ELEVATION_COUNT];
|
||||
extern int gIsoWindow;
|
||||
extern char _scratchStr[40];
|
||||
extern char _map_path[MAX_PATH];
|
||||
extern char _map_path[COMPAT_MAX_PATH];
|
||||
|
||||
int isoInit();
|
||||
void isoReset();
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "debug.h"
|
||||
#include "game_config.h"
|
||||
#include "memory.h"
|
||||
#include "platform_compat.h"
|
||||
#include "random.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
@ -82,7 +83,7 @@ int badwordsInit()
|
|||
break;
|
||||
}
|
||||
|
||||
strupr(gBadwords[index]);
|
||||
compat_strupr(gBadwords[index]);
|
||||
|
||||
gBadwordsLengths[index] = len;
|
||||
}
|
||||
|
@ -166,7 +167,7 @@ bool messageListFree(MessageList* messageList)
|
|||
bool messageListLoad(MessageList* messageList, const char* path)
|
||||
{
|
||||
char* language;
|
||||
char localized_path[FILENAME_MAX];
|
||||
char localized_path[COMPAT_MAX_PATH];
|
||||
File* file_ptr;
|
||||
char num[1024];
|
||||
char audio[1024];
|
||||
|
@ -523,7 +524,7 @@ bool messageListFilterBadwords(MessageList* messageList)
|
|||
for (int index = 0; index < messageList->entries_num; index++) {
|
||||
MessageListItem* item = &(messageList->entries[index]);
|
||||
strcpy(_bad_copy, item->text);
|
||||
strupr(_bad_copy);
|
||||
compat_strupr(_bad_copy);
|
||||
|
||||
for (int badwordIndex = 0; badwordIndex < gBadwordsCount; badwordIndex++) {
|
||||
// I don't quite understand the loop below. It has no stop
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "memory_manager.h"
|
||||
#include "movie_effect.h"
|
||||
#include "movie_lib.h"
|
||||
#include "platform_compat.h"
|
||||
#include "sound.h"
|
||||
#include "text_font.h"
|
||||
#include "window_manager.h"
|
||||
|
@ -521,7 +522,7 @@ void movieLoadSubtitles(char* filePath)
|
|||
filePath = gMovieBuildSubtitleFilePathProc(filePath);
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
strcpy(path, filePath);
|
||||
|
||||
debugPrint("Opening subtitle file %s\n", path);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "memory.h"
|
||||
#include "movie.h"
|
||||
#include "palette.h"
|
||||
#include "platform_compat.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -92,7 +93,7 @@ int movieEffectsLoad(const char* filePath)
|
|||
|
||||
int rc = -1;
|
||||
|
||||
char path[FILENAME_MAX];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
strcpy(path, filePath);
|
||||
|
||||
char* pch = strrchr(path, '.');
|
||||
|
@ -127,7 +128,7 @@ int movieEffectsLoad(const char* filePath)
|
|||
int movieEffectsCreated = 0;
|
||||
for (int index = 0; index < movieEffectsLength; index++) {
|
||||
char section[20];
|
||||
itoa(movieEffectFrameList[index], section, 10);
|
||||
compat_itoa(movieEffectFrameList[index], section, 10);
|
||||
|
||||
char* fadeTypeString;
|
||||
if (!configGetString(&config, section, "fade_type", &fadeTypeString)) {
|
||||
|
@ -135,9 +136,9 @@ int movieEffectsLoad(const char* filePath)
|
|||
}
|
||||
|
||||
int fadeType = MOVIE_EFFECT_TYPE_NONE;
|
||||
if (stricmp(fadeTypeString, "in") == 0) {
|
||||
if (compat_stricmp(fadeTypeString, "in") == 0) {
|
||||
fadeType = MOVIE_EFFECT_TYPE_FADE_IN;
|
||||
} else if (stricmp(fadeTypeString, "out") == 0) {
|
||||
} else if (compat_stricmp(fadeTypeString, "out") == 0) {
|
||||
fadeType = MOVIE_EFFECT_TYPE_FADE_OUT;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "debug.h"
|
||||
#include "memory_manager.h"
|
||||
#include "platform_compat.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -81,7 +82,7 @@ Nevs* _nevs_find(const char* a1)
|
|||
|
||||
for (int index = 0; index < NEVS_COUNT; index++) {
|
||||
Nevs* nevs = &(_nevs[index]);
|
||||
if (nevs->field_0 != 0 && stricmp(nevs->field_4, a1) == 0) {
|
||||
if (nevs->field_0 != 0 && compat_stricmp(nevs->field_4, a1) == 0) {
|
||||
return nevs;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "grayscale.h"
|
||||
#include "loadsave.h"
|
||||
#include "memory.h"
|
||||
#include "platform_compat.h"
|
||||
#include "scripts.h"
|
||||
#include "text_font.h"
|
||||
#include "text_object.h"
|
||||
|
@ -24,6 +25,8 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#define PREFERENCES_WINDOW_WIDTH 640
|
||||
#define PREFERENCES_WINDOW_HEIGHT 480
|
||||
|
||||
|
@ -453,7 +456,7 @@ int optionsWindowInit()
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "options.msg");
|
||||
if (!messageListLoad(&gOptionsMessageList, path)) {
|
||||
return -1;
|
||||
|
@ -633,7 +636,7 @@ int showPause(bool a1)
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "options.msg");
|
||||
if (!messageListLoad(&gOptionsMessageList, path)) {
|
||||
// FIXME: Leaking graphics.
|
||||
|
@ -918,32 +921,32 @@ void preferencesSetDefaults(bool a1)
|
|||
// 0x4931F8
|
||||
void _JustUpdate_()
|
||||
{
|
||||
gPreferencesGameDifficulty1 = min(max(gPreferencesGameDifficulty1, 0), 2);
|
||||
gPreferencesCombatDifficulty1 = min(max(gPreferencesCombatDifficulty1, 0), 2);
|
||||
gPreferencesViolenceLevel1 = min(max(gPreferencesViolenceLevel1, 0), 3);
|
||||
gPreferencesTargetHighlight1 = min(max(gPreferencesTargetHighlight1, 0), 2);
|
||||
gPreferencesCombatMessages1 = min(max(gPreferencesCombatMessages1, 0), 1);
|
||||
gPreferencesCombatLooks1 = min(max(gPreferencesCombatLooks1, 0), 1);
|
||||
gPreferencesCombatTaunts1 = min(max(gPreferencesCombatTaunts1, 0), 1);
|
||||
gPreferencesLanguageFilter1 = min(max(gPreferencesLanguageFilter1, 0), 1);
|
||||
gPreferencesRunning1 = min(max(gPreferencesRunning1, 0), 1);
|
||||
gPreferencesSubtitles1 = min(max(gPreferencesSubtitles1, 0), 1);
|
||||
gPreferencesItemHighlight1 = min(max(gPreferencesItemHighlight1, 0), 1);
|
||||
gPreferencesCombatSpeed1 = min(max(gPreferencesCombatSpeed1, 0), 50);
|
||||
gPreferencesPlayerSpeedup1 = min(max(gPreferencesPlayerSpeedup1, 0), 1);
|
||||
gPreferencesTextBaseDelay1 = min(max(gPreferencesTextBaseDelay1, 1.0), 6.0);
|
||||
gPreferencesMasterVolume1 = min(max(gPreferencesMasterVolume1, 0), VOLUME_MAX);
|
||||
gPreferencesMusicVolume1 = min(max(gPreferencesMusicVolume1, 0), VOLUME_MAX);
|
||||
gPreferencesSoundEffectsVolume1 = min(max(gPreferencesSoundEffectsVolume1, 0), VOLUME_MAX);
|
||||
gPreferencesSpeechVolume1 = min(max(gPreferencesSpeechVolume1, 0), VOLUME_MAX);
|
||||
gPreferencesBrightness1 = min(max(gPreferencesBrightness1, 1.0), 1.17999267578125);
|
||||
gPreferencesMouseSensitivity1 = min(max(gPreferencesMouseSensitivity1, 1.0), 2.5);
|
||||
gPreferencesGameDifficulty1 = std::clamp(gPreferencesGameDifficulty1, 0, 2);
|
||||
gPreferencesCombatDifficulty1 = std::clamp(gPreferencesCombatDifficulty1, 0, 2);
|
||||
gPreferencesViolenceLevel1 = std::clamp(gPreferencesViolenceLevel1, 0, 3);
|
||||
gPreferencesTargetHighlight1 = std::clamp(gPreferencesTargetHighlight1, 0, 2);
|
||||
gPreferencesCombatMessages1 = std::clamp(gPreferencesCombatMessages1, 0, 1);
|
||||
gPreferencesCombatLooks1 = std::clamp(gPreferencesCombatLooks1, 0, 1);
|
||||
gPreferencesCombatTaunts1 = std::clamp(gPreferencesCombatTaunts1, 0, 1);
|
||||
gPreferencesLanguageFilter1 = std::clamp(gPreferencesLanguageFilter1, 0, 1);
|
||||
gPreferencesRunning1 = std::clamp(gPreferencesRunning1, 0, 1);
|
||||
gPreferencesSubtitles1 = std::clamp(gPreferencesSubtitles1, 0, 1);
|
||||
gPreferencesItemHighlight1 = std::clamp(gPreferencesItemHighlight1, 0, 1);
|
||||
gPreferencesCombatSpeed1 = std::clamp(gPreferencesCombatSpeed1, 0, 50);
|
||||
gPreferencesPlayerSpeedup1 = std::clamp(gPreferencesPlayerSpeedup1, 0, 1);
|
||||
gPreferencesTextBaseDelay1 = std::clamp(gPreferencesTextBaseDelay1, 6.0, 10.0);
|
||||
gPreferencesMasterVolume1 = std::clamp(gPreferencesMasterVolume1, 0, VOLUME_MAX);
|
||||
gPreferencesMusicVolume1 = std::clamp(gPreferencesMusicVolume1, 0, VOLUME_MAX);
|
||||
gPreferencesSoundEffectsVolume1 = std::clamp(gPreferencesSoundEffectsVolume1, 0, VOLUME_MAX);
|
||||
gPreferencesSpeechVolume1 = std::clamp(gPreferencesSpeechVolume1, 0, VOLUME_MAX);
|
||||
gPreferencesBrightness1 = std::clamp(gPreferencesBrightness1, 1.0, 1.17999267578125);
|
||||
gPreferencesMouseSensitivity1 = std::clamp(gPreferencesMouseSensitivity1, 1.0, 2.5);
|
||||
|
||||
textObjectsSetBaseDelay(gPreferencesTextBaseDelay1);
|
||||
gameMouseLoadItemHighlight();
|
||||
|
||||
double textLineDelay = (gPreferencesTextBaseDelay1 + (-1.0)) * 0.2 * 2.0;
|
||||
textLineDelay = min(max(textLineDelay, 0.0), 2.0);
|
||||
textLineDelay = std::clamp(textLineDelay, 0.0, 2.0);
|
||||
|
||||
textObjectsSetLineDelay(textLineDelay);
|
||||
aiMessageListReloadIfNeeded();
|
||||
|
@ -1064,7 +1067,7 @@ void _UpdateThing(int index)
|
|||
case PREF_COMBAT_SPEED:
|
||||
if (1) {
|
||||
double value = *meta->valuePtr;
|
||||
value = min(max(value, 0.0), 50.0);
|
||||
value = std::clamp(value, 0.0, 50.0);
|
||||
|
||||
int x = (int)((value - meta->minValue) * 219.0 / (meta->maxValue - meta->minValue) + 384.0);
|
||||
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
||||
|
@ -1072,13 +1075,13 @@ void _UpdateThing(int index)
|
|||
break;
|
||||
case PREF_TEXT_BASE_DELAY:
|
||||
if (1) {
|
||||
gPreferencesTextBaseDelay1 = min(max(gPreferencesTextBaseDelay1, 1.0), 6.0);
|
||||
gPreferencesTextBaseDelay1 = std::clamp(gPreferencesTextBaseDelay1, 1.0, 6.0);
|
||||
|
||||
int x = (int)((6.0 - gPreferencesTextBaseDelay1) * 43.8 + 384.0);
|
||||
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
||||
|
||||
double value = (gPreferencesTextBaseDelay1 - 1.0) * 0.2 * 2.0;
|
||||
value = min(max(value, 0.0), 2.0);
|
||||
value = std::clamp(value, 0.0, 2.0);
|
||||
|
||||
textObjectsSetBaseDelay(gPreferencesTextBaseDelay1);
|
||||
textObjectsSetLineDelay(value);
|
||||
|
@ -1090,7 +1093,7 @@ void _UpdateThing(int index)
|
|||
case PREF_SPEECH_VOLUME:
|
||||
if (1) {
|
||||
double value = *meta->valuePtr;
|
||||
value = min(max(value, meta->minValue), meta->maxValue);
|
||||
value = std::clamp(value, meta->minValue, meta->maxValue);
|
||||
|
||||
int x = (int)((value - meta->minValue) * 219.0 / (meta->maxValue - meta->minValue) + 384.0);
|
||||
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
||||
|
@ -1113,7 +1116,7 @@ void _UpdateThing(int index)
|
|||
break;
|
||||
case PREF_BRIGHTNESS:
|
||||
if (1) {
|
||||
gPreferencesBrightness1 = min(max(gPreferencesBrightness1, 1.0), 1.17999267578125);
|
||||
gPreferencesBrightness1 = std::clamp(gPreferencesBrightness1, 1.0, 1.17999267578125);
|
||||
|
||||
int x = (int)((gPreferencesBrightness1 - meta->minValue) * (219.0 / (meta->maxValue - meta->minValue)) + 384.0);
|
||||
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
||||
|
@ -1123,7 +1126,7 @@ void _UpdateThing(int index)
|
|||
break;
|
||||
case PREF_MOUSE_SENSITIVIY:
|
||||
if (1) {
|
||||
gPreferencesMouseSensitivity1 = min(max(gPreferencesMouseSensitivity1, 1.0), 2.5);
|
||||
gPreferencesMouseSensitivity1 = std::clamp(gPreferencesMouseSensitivity1, 1.0, 2.5);
|
||||
|
||||
int x = (int)((gPreferencesMouseSensitivity1 - meta->minValue) * (219.0 / (meta->maxValue - meta->minValue)) + 384.0);
|
||||
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "memory.h"
|
||||
#include "object.h"
|
||||
#include "party_member.h"
|
||||
#include "platform_compat.h"
|
||||
#include "skill.h"
|
||||
#include "stat.h"
|
||||
|
||||
|
@ -164,7 +165,7 @@ int perksInit()
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "perk.msg");
|
||||
|
||||
if (!messageListLoad(&gPerksMessageList, path)) {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "map.h"
|
||||
#include "memory.h"
|
||||
#include "object.h"
|
||||
#include "platform_compat.h"
|
||||
#include "queue.h"
|
||||
#include "random.h"
|
||||
#include "scripts.h"
|
||||
|
@ -315,7 +316,7 @@ int pipboyWindowInit(bool forceRest)
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "pipboy.msg");
|
||||
|
||||
if (!(messageListLoad(&gPipboyMessageList, path))) {
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#include "platform_compat.h"
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
int compat_stricmp(const char* string1, const char* string2)
|
||||
{
|
||||
return SDL_strcasecmp(string1, string2);
|
||||
}
|
||||
|
||||
int compat_strnicmp(const char* string1, const char* string2, size_t size)
|
||||
{
|
||||
return SDL_strncasecmp(string1, string2, size);
|
||||
}
|
||||
|
||||
char* compat_strupr(char* string)
|
||||
{
|
||||
return SDL_strupr(string);
|
||||
}
|
||||
|
||||
char* compat_strlwr(char* string)
|
||||
{
|
||||
return SDL_strlwr(string);
|
||||
}
|
||||
|
||||
char* compat_itoa(int value, char* buffer, int radix)
|
||||
{
|
||||
return SDL_itoa(value, buffer, radix);
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef PLATFORM_COMPAT_H
|
||||
#define PLATFORM_COMPAT_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
// TODO: This is compatibility cross-platform layer. Designed to have minimal
|
||||
// impact on the codebase. Remove once it's no longer needed.
|
||||
|
||||
// A naive cross-platform MAX_PATH/PATH_MAX/MAX_PATH drop-in replacement.
|
||||
//
|
||||
// TODO: Remove when we migrate to use std::filesystem::path or std::string to
|
||||
// represent paths across the codebase.
|
||||
#define COMPAT_MAX_PATH 260
|
||||
|
||||
int compat_stricmp(const char* string1, const char* string2);
|
||||
int compat_strnicmp(const char* string1, const char* string2, size_t size);
|
||||
char* compat_strupr(char* string);
|
||||
char* compat_strlwr(char* string);
|
||||
char* compat_itoa(int value, char* buffer, int radix);
|
||||
|
||||
#endif /* PLATFORM_COMPAT_H */
|
12
src/proto.cc
12
src/proto.cc
|
@ -33,7 +33,7 @@ char _aDrugStatSpecia[] = "Drug Stat (Special)";
|
|||
char _aNone_1[] = "None";
|
||||
|
||||
// 0x51C18C
|
||||
char _cd_path_base[MAX_PATH];
|
||||
char _cd_path_base[COMPAT_MAX_PATH];
|
||||
|
||||
// 0x51C290
|
||||
ProtoList _protoLists[11] = {
|
||||
|
@ -173,8 +173,8 @@ char** _critter_stats_list;
|
|||
// 0x49E758
|
||||
int _proto_list_str(int pid, char* proto_path)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char str[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
char str[COMPAT_MAX_PATH];
|
||||
char* pch;
|
||||
File* stream;
|
||||
int i;
|
||||
|
@ -1037,7 +1037,7 @@ int protoInit()
|
|||
char* master_patches;
|
||||
int len;
|
||||
MessageListItem messageListItem;
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
int i;
|
||||
|
||||
if (!configGetString(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_MASTER_PATCHES_KEY, &master_patches)) {
|
||||
|
@ -1215,7 +1215,7 @@ int _proto_header_load()
|
|||
ptr->length = 0;
|
||||
ptr->max_entries_num = 1;
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
strcpy(path, _cd_path_base);
|
||||
strcat(path, _proto_path_base);
|
||||
strcat(path, artGetObjectTypeName(index));
|
||||
|
@ -1654,7 +1654,7 @@ int _proto_save_pid(int pid)
|
|||
// 0x4A1C3C
|
||||
int _proto_load_pid(int pid, Proto** protoPtr)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
strcpy(path, _cd_path_base);
|
||||
|
||||
strcat(path, "proto\\");
|
||||
|
|
|
@ -5,13 +5,11 @@
|
|||
#include "message.h"
|
||||
#include "obj_types.h"
|
||||
#include "perk_defs.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto_types.h"
|
||||
#include "skill_defs.h"
|
||||
#include "stat_defs.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
typedef enum ItemDataMember {
|
||||
ITEM_DATA_MEMBER_PID = 0,
|
||||
ITEM_DATA_MEMBER_NAME = 1,
|
||||
|
@ -97,7 +95,7 @@ typedef enum PrototypeMessage {
|
|||
|
||||
extern char _aProto_0[];
|
||||
|
||||
extern char _cd_path_base[MAX_PATH];
|
||||
extern char _cd_path_base[COMPAT_MAX_PATH];
|
||||
extern ProtoList _protoLists[11];
|
||||
extern const size_t _proto_sizes[11];
|
||||
extern int _protos_been_initialized;
|
||||
|
|
|
@ -6,11 +6,15 @@
|
|||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
// clang-format off
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <timeapi.h>
|
||||
// clang-format on
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
// 0x50D4BA
|
||||
const double dbl_50D4BA = 36.42;
|
||||
|
@ -208,7 +212,13 @@ void randomSeedPrerandomInternal(int seed)
|
|||
// 0x4A3258
|
||||
unsigned int randomGetSeed()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
return timeGetTime();
|
||||
#else
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
return tv.tv_usec / 1000;
|
||||
#endif
|
||||
}
|
||||
|
||||
// 0x4A3264
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "game_movie.h"
|
||||
#include "memory.h"
|
||||
#include "object.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto.h"
|
||||
#include "proto_instance.h"
|
||||
#include "queue.h"
|
||||
|
@ -596,7 +597,7 @@ int scriptSetActionBeingUsed(int sid, int value)
|
|||
// 0x4A3B74
|
||||
Program* scriptsCreateProgramByName(const char* name)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
|
||||
strcpy(path, _cd_path_base);
|
||||
strcat(path, gScriptsBasePath);
|
||||
|
@ -1291,7 +1292,7 @@ bool scriptHasProc(int sid, int proc)
|
|||
// 0x4A4D50
|
||||
int scriptsLoadScriptsList()
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", "scripts\\", "scripts.lst");
|
||||
|
||||
File* stream = fileOpen(path, "rt");
|
||||
|
@ -1477,7 +1478,7 @@ int _scr_reset()
|
|||
int _scr_game_init()
|
||||
{
|
||||
int i;
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
|
||||
if (!messageListInit(&gScrMessageList)) {
|
||||
debugPrint("\nError initing script message file!");
|
||||
|
@ -1666,7 +1667,7 @@ int _scr_header_load()
|
|||
{
|
||||
_num_script_indexes = 0;
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
strcpy(path, _cd_path_base);
|
||||
strcat(path, gScriptsBasePath);
|
||||
strcat(path, "scripts.lst");
|
||||
|
@ -2590,7 +2591,7 @@ int scriptsGetMessageList(int a1, MessageList** messageListPtr)
|
|||
*pch = '\0';
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "dialog\\%s.msg", scriptName);
|
||||
|
||||
if (!messageListLoad(messageList, path)) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "sfall_config.h"
|
||||
|
||||
#include "platform_compat.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -21,7 +23,7 @@ bool sfallConfigInit(int argc, char** argv)
|
|||
// Initialize defaults.
|
||||
configSetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_STARTING_MAP_KEY, "");
|
||||
|
||||
char path[FILENAME_MAX];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
char* executable = argv[0];
|
||||
char* ch = strrchr(executable, '\\');
|
||||
if (ch != NULL) {
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "party_member.h"
|
||||
#include "perk.h"
|
||||
#include "pipboy.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto.h"
|
||||
#include "random.h"
|
||||
#include "scripts.h"
|
||||
|
@ -96,7 +97,7 @@ int skillsInit()
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "skill.msg");
|
||||
|
||||
if (!messageListLoad(&gSkillsMessageList, path)) {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "map.h"
|
||||
#include "memory.h"
|
||||
#include "object.h"
|
||||
#include "platform_compat.h"
|
||||
#include "skill.h"
|
||||
#include "text_font.h"
|
||||
#include "window_manager.h"
|
||||
|
@ -122,7 +123,7 @@ int skilldexWindowInit()
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[FILENAME_MAX];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "skilldex.msg");
|
||||
|
||||
if (!messageListLoad(&gSkilldexMessageList, path)) {
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include <mmsystem.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// 0x51D478
|
||||
STRUCT_51D478* _fadeHead = NULL;
|
||||
|
||||
|
@ -1069,7 +1071,7 @@ int _soundVolumeHMItoDirectSound(int volume)
|
|||
|
||||
if (volume != 0) {
|
||||
normalizedVolume = -1000.0 * log2(32767.0 / volume);
|
||||
normalizedVolume = max(min(normalizedVolume, 0.0), -10000.0);
|
||||
normalizedVolume = std::clamp(normalizedVolume, -10000.0, 0.0);
|
||||
} else {
|
||||
normalizedVolume = -10000.0;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "db.h"
|
||||
#include "debug.h"
|
||||
#include "memory.h"
|
||||
#include "platform_compat.h"
|
||||
#include "sound_decoder.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
@ -49,7 +50,7 @@ bool soundEffectsListIsValidTag(int a1)
|
|||
// 0x4A98F4
|
||||
int soundEffectsListInit(const char* soundEffectsPath, int a2, int debugLevel)
|
||||
{
|
||||
char path[FILENAME_MAX];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
|
||||
// TODO: What for?
|
||||
// memcpy(path, byte_4A97E0, 0xFF);
|
||||
|
@ -164,7 +165,7 @@ void soundEffectsListExit()
|
|||
// 0x4A9C28
|
||||
int soundEffectsListGetTag(char* name, int* tagPtr)
|
||||
{
|
||||
if (strnicmp(gSoundEffectsListPath, name, gSoundEffectsListPathLength) != 0) {
|
||||
if (compat_strnicmp(gSoundEffectsListPath, name, gSoundEffectsListPathLength) != 0) {
|
||||
return SFXL_ERR;
|
||||
}
|
||||
|
||||
|
@ -441,7 +442,7 @@ int soundEffectsListCompareByName(const void* a1, const void* a2)
|
|||
SoundEffectsListEntry* v1 = (SoundEffectsListEntry*)a1;
|
||||
SoundEffectsListEntry* v2 = (SoundEffectsListEntry*)a2;
|
||||
|
||||
return stricmp(v1->name, v2->name);
|
||||
return compat_stricmp(v1->name, v2->name);
|
||||
}
|
||||
|
||||
// read via xfile
|
||||
|
|
11
src/stat.cc
11
src/stat.cc
|
@ -11,6 +11,7 @@
|
|||
#include "memory.h"
|
||||
#include "object.h"
|
||||
#include "perk.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto.h"
|
||||
#include "random.h"
|
||||
#include "scripts.h"
|
||||
|
@ -20,6 +21,8 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// 0x51D53C
|
||||
StatDescription gStatDescriptions[STAT_COUNT] = {
|
||||
{ NULL, NULL, 0, PRIMARY_STAT_MIN, PRIMARY_STAT_MAX, 5 },
|
||||
|
@ -92,7 +95,7 @@ int statsInit()
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "stat.msg");
|
||||
|
||||
if (!messageListLoad(&gStatsMessageList, path)) {
|
||||
|
@ -344,7 +347,7 @@ int critterGetStat(Object* critter, int stat)
|
|||
}
|
||||
}
|
||||
|
||||
value = min(max(value, gStatDescriptions[stat].minimumValue), gStatDescriptions[stat].maximumValue);
|
||||
value = std::clamp(value, gStatDescriptions[stat].minimumValue, gStatDescriptions[stat].maximumValue);
|
||||
} else {
|
||||
switch (stat) {
|
||||
case STAT_CURRENT_HIT_POINTS:
|
||||
|
@ -545,10 +548,10 @@ void critterUpdateDerivedStats(Object* critter)
|
|||
data->baseStats[STAT_MAXIMUM_HIT_POINTS] = critterGetBaseStatWithTraitModifier(critter, STAT_STRENGTH) + critterGetBaseStatWithTraitModifier(critter, STAT_ENDURANCE) * 2 + 15;
|
||||
data->baseStats[STAT_MAXIMUM_ACTION_POINTS] = agility / 2 + 5;
|
||||
data->baseStats[STAT_ARMOR_CLASS] = agility;
|
||||
data->baseStats[STAT_MELEE_DAMAGE] = max(strength - 5, 1);
|
||||
data->baseStats[STAT_MELEE_DAMAGE] = std::max(strength - 5, 1);
|
||||
data->baseStats[STAT_CARRY_WEIGHT] = 25 * strength + 25;
|
||||
data->baseStats[STAT_SEQUENCE] = 2 * perception;
|
||||
data->baseStats[STAT_HEALING_RATE] = max(endurance / 3, 1);
|
||||
data->baseStats[STAT_HEALING_RATE] = std::max(endurance / 3, 1);
|
||||
data->baseStats[STAT_CRITICAL_CHANCE] = luck;
|
||||
data->baseStats[STAT_BETTER_CRITICALS] = 0;
|
||||
data->baseStats[STAT_RADIATION_RESISTANCE] = 2 * endurance;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "string_parsers.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "platform_compat.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -19,7 +20,7 @@ int strParseInt(char** stringPtr, int* valuePtr)
|
|||
|
||||
str = *stringPtr;
|
||||
|
||||
strlwr(str);
|
||||
compat_strlwr(str);
|
||||
|
||||
v1 = strspn(str, " ");
|
||||
str += v1;
|
||||
|
@ -63,7 +64,7 @@ int strParseStrFromList(char** stringPtr, int* valuePtr, const char** stringList
|
|||
|
||||
str = *stringPtr;
|
||||
|
||||
strlwr(str);
|
||||
compat_strlwr(str);
|
||||
|
||||
v1 = strspn(str, " ");
|
||||
str += v1;
|
||||
|
@ -84,7 +85,7 @@ int strParseStrFromList(char** stringPtr, int* valuePtr, const char** stringList
|
|||
}
|
||||
|
||||
for (i = 0; i < stringListLength; i++) {
|
||||
if (stricmp(str, stringList[i]) == 0) {
|
||||
if (compat_stricmp(str, stringList[i]) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +120,7 @@ int strParseStrFromFunc(char** stringPtr, int* valuePtr, StringParserCallback* c
|
|||
|
||||
str = *stringPtr;
|
||||
|
||||
strlwr(str);
|
||||
compat_strlwr(str);
|
||||
|
||||
v1 = strspn(str, " ");
|
||||
str += v1;
|
||||
|
@ -174,7 +175,7 @@ int strParseIntWithKey(char** stringPtr, const char* key, int* valuePtr, const c
|
|||
return -1;
|
||||
}
|
||||
|
||||
strlwr(str);
|
||||
compat_strlwr(str);
|
||||
|
||||
if (*str == ',') {
|
||||
str++;
|
||||
|
@ -225,7 +226,7 @@ int strParseKeyValue(char** stringPtr, char* key, int* valuePtr, const char* del
|
|||
return -1;
|
||||
}
|
||||
|
||||
strlwr(str);
|
||||
compat_strlwr(str);
|
||||
|
||||
if (*str == ',') {
|
||||
str++;
|
||||
|
|
|
@ -3,13 +3,11 @@
|
|||
#include "color.h"
|
||||
#include "db.h"
|
||||
#include "memory.h"
|
||||
#include "platform_compat.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
// 0x4D5530
|
||||
FontManager gTextFontManager = {
|
||||
0,
|
||||
|
@ -112,7 +110,7 @@ int textFontLoad(int font)
|
|||
{
|
||||
int rc = -1;
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "font%d.fon", font);
|
||||
|
||||
// NOTE: Original code is slightly different. It uses deep nesting and
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "light.h"
|
||||
#include "map.h"
|
||||
#include "object.h"
|
||||
#include "platform_compat.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
@ -391,7 +392,7 @@ int tileInit(TileData** a1, int squareGridWidth, int squareGridHeight, int hexGr
|
|||
|
||||
char* executable;
|
||||
configGetString(&gGameConfig, GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_EXECUTABLE_KEY, &executable);
|
||||
if (stricmp(executable, "mapper") == 0) {
|
||||
if (compat_stricmp(executable, "mapper") == 0) {
|
||||
gTileWindowRefreshElevationProc = tileRefreshMapper;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "game.h"
|
||||
#include "object.h"
|
||||
#include "platform_compat.h"
|
||||
#include "skill.h"
|
||||
#include "stat.h"
|
||||
|
||||
|
@ -42,7 +43,7 @@ int traitsInit()
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[FILENAME_MAX];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s%s", asc_5186C8, "trait.msg");
|
||||
|
||||
if (!messageListLoad(&gTraitsMessageList, path)) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define WIN32_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
|
||||
#include <mmreg.h>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "memory_manager.h"
|
||||
#include "mouse_manager.h"
|
||||
#include "movie.h"
|
||||
#include "platform_compat.h"
|
||||
#include "text_font.h"
|
||||
#include "widget.h"
|
||||
#include "window_manager.h"
|
||||
|
@ -162,7 +163,7 @@ int _selectWindow(const char* windowName)
|
|||
{
|
||||
if (gCurrentManagedWindowIndex != -1) {
|
||||
ManagedWindow* managedWindow = &(gManagedWindows[gCurrentManagedWindowIndex]);
|
||||
if (stricmp(managedWindow->name, windowName) == 0) {
|
||||
if (compat_stricmp(managedWindow->name, windowName) == 0) {
|
||||
return gCurrentManagedWindowIndex;
|
||||
}
|
||||
}
|
||||
|
@ -171,7 +172,7 @@ int _selectWindow(const char* windowName)
|
|||
for (index = 0; index < MANAGED_WINDOW_COUNT; index++) {
|
||||
ManagedWindow* managedWindow = &(gManagedWindows[index]);
|
||||
if (managedWindow->window != -1) {
|
||||
if (stricmp(managedWindow->name, windowName) == 0) {
|
||||
if (compat_stricmp(managedWindow->name, windowName) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -497,7 +498,7 @@ void _removeProgramReferences_3(Program* program)
|
|||
// 0x4B9190
|
||||
void _initWindow(int resolution, int a2)
|
||||
{
|
||||
char err[MAX_PATH];
|
||||
char err[COMPAT_MAX_PATH];
|
||||
int rc;
|
||||
int i, j;
|
||||
|
||||
|
@ -666,7 +667,7 @@ bool _windowDeleteButton(const char* buttonName)
|
|||
|
||||
for (int index = 0; index < managedWindow->buttonsLength; index++) {
|
||||
ManagedButton* managedButton = &(managedWindow->buttons[index]);
|
||||
if (stricmp(managedButton->name, buttonName) == 0) {
|
||||
if (compat_stricmp(managedButton->name, buttonName) == 0) {
|
||||
buttonDestroy(managedButton->btn);
|
||||
|
||||
if (managedButton->field_48 != NULL) {
|
||||
|
@ -724,7 +725,7 @@ bool _windowSetButtonFlag(const char* buttonName, int value)
|
|||
|
||||
for (int index = 0; index < managedWindow->buttonsLength; index++) {
|
||||
ManagedButton* managedButton = &(managedWindow->buttons[index]);
|
||||
if (stricmp(managedButton->name, buttonName) == 0) {
|
||||
if (compat_stricmp(managedButton->name, buttonName) == 0) {
|
||||
managedButton->flags |= value;
|
||||
return true;
|
||||
}
|
||||
|
@ -747,7 +748,7 @@ bool _windowAddButtonProc(const char* buttonName, Program* program, int a3, int
|
|||
|
||||
for (int index = 0; index < managedWindow->buttonsLength; index++) {
|
||||
ManagedButton* managedButton = &(managedWindow->buttons[index]);
|
||||
if (stricmp(managedButton->name, buttonName) == 0) {
|
||||
if (compat_stricmp(managedButton->name, buttonName) == 0) {
|
||||
managedButton->field_5C = a3;
|
||||
managedButton->field_60 = a4;
|
||||
managedButton->field_54 = a5;
|
||||
|
@ -774,7 +775,7 @@ bool _windowAddButtonRightProc(const char* buttonName, Program* program, int a3,
|
|||
|
||||
for (int index = 0; index < managedWindow->buttonsLength; index++) {
|
||||
ManagedButton* managedButton = &(managedWindow->buttons[index]);
|
||||
if (stricmp(managedButton->name, buttonName) == 0) {
|
||||
if (compat_stricmp(managedButton->name, buttonName) == 0) {
|
||||
managedButton->field_68 = a4;
|
||||
managedButton->field_64 = a3;
|
||||
managedButton->program = program;
|
||||
|
@ -814,7 +815,7 @@ bool _windowCheckRegionExists(const char* regionName)
|
|||
for (int index = 0; index < managedWindow->regionsLength; index++) {
|
||||
Region* region = managedWindow->regions[index];
|
||||
if (region != NULL) {
|
||||
if (stricmp(regionGetName(region), regionName) == 0) {
|
||||
if (compat_stricmp(regionGetName(region), regionName) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -898,7 +899,7 @@ bool _windowAddRegionProc(const char* regionName, Program* program, int a3, int
|
|||
for (int index = 0; index < managedWindow->regionsLength; index++) {
|
||||
Region* region = managedWindow->regions[index];
|
||||
if (region != NULL) {
|
||||
if (stricmp(region->name, regionName) == 0) {
|
||||
if (compat_stricmp(region->name, regionName) == 0) {
|
||||
region->field_50 = a3;
|
||||
region->field_54 = a4;
|
||||
region->field_48 = a5;
|
||||
|
@ -923,7 +924,7 @@ bool _windowAddRegionRightProc(const char* regionName, Program* program, int a3,
|
|||
for (int index = 0; index < managedWindow->regionsLength; index++) {
|
||||
Region* region = managedWindow->regions[index];
|
||||
if (region != NULL) {
|
||||
if (stricmp(region->name, regionName) == 0) {
|
||||
if (compat_stricmp(region->name, regionName) == 0) {
|
||||
region->field_58 = a3;
|
||||
region->field_5C = a4;
|
||||
region->program = program;
|
||||
|
@ -943,7 +944,7 @@ bool _windowSetRegionFlag(const char* regionName, int value)
|
|||
for (int index = 0; index < managedWindow->regionsLength; index++) {
|
||||
Region* region = managedWindow->regions[index];
|
||||
if (region != NULL) {
|
||||
if (stricmp(region->name, regionName) == 0) {
|
||||
if (compat_stricmp(region->name, regionName) == 0) {
|
||||
regionAddFlag(region, value);
|
||||
return true;
|
||||
}
|
||||
|
@ -971,7 +972,7 @@ bool _windowAddRegionName(const char* regionName)
|
|||
if (index != managedWindow->currentRegionIndex) {
|
||||
Region* other = managedWindow->regions[index];
|
||||
if (other != NULL) {
|
||||
if (stricmp(regionGetName(other), regionName) == 0) {
|
||||
if (compat_stricmp(regionGetName(other), regionName) == 0) {
|
||||
regionDelete(other);
|
||||
managedWindow->regions[index] = NULL;
|
||||
break;
|
||||
|
@ -1003,7 +1004,7 @@ bool _windowDeleteRegion(const char* regionName)
|
|||
for (int index = 0; index < managedWindow->regionsLength; index++) {
|
||||
Region* region = managedWindow->regions[index];
|
||||
if (region != NULL) {
|
||||
if (stricmp(regionGetName(region), regionName) == 0) {
|
||||
if (compat_stricmp(regionGetName(region), regionName) == 0) {
|
||||
regionDelete(region);
|
||||
managedWindow->regions[index] = NULL;
|
||||
managedWindow->field_38++;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#include <SDL.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// 0x50FA30
|
||||
char _path_patches[] = "";
|
||||
|
||||
|
@ -781,10 +783,10 @@ void _GNW_win_refresh(Window* window, Rect* rect, unsigned char* a3)
|
|||
|
||||
v26->next = NULL;
|
||||
|
||||
v26->rect.left = max(window->rect.left, rect->left);
|
||||
v26->rect.top = max(window->rect.top, rect->top);
|
||||
v26->rect.right = min(window->rect.right, rect->right);
|
||||
v26->rect.bottom = min(window->rect.bottom, rect->bottom);
|
||||
v26->rect.left = std::max(window->rect.left, rect->left);
|
||||
v26->rect.top = std::max(window->rect.top, rect->top);
|
||||
v26->rect.right = std::min(window->rect.right, rect->right);
|
||||
v26->rect.bottom = std::min(window->rect.bottom, rect->bottom);
|
||||
|
||||
if (v26->rect.right >= v26->rect.left && v26->rect.bottom >= v26->rect.top) {
|
||||
if (a3) {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <stddef.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
|
||||
#define MAX_WINDOW_COUNT (50)
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// 0x51E414
|
||||
int _wd = -1;
|
||||
|
||||
|
@ -210,7 +212,7 @@ int _calc_max_field_chars_wcursor(int a1, int a2)
|
|||
|
||||
internal_free(str);
|
||||
|
||||
return max(len1, len2) + 1;
|
||||
return std::max(len1, len2) + 1;
|
||||
}
|
||||
|
||||
// 0x4DD3EC
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "object.h"
|
||||
#include "party_member.h"
|
||||
#include "perk.h"
|
||||
#include "platform_compat.h"
|
||||
#include "proto_instance.h"
|
||||
#include "queue.h"
|
||||
#include "random.h"
|
||||
|
@ -611,7 +612,7 @@ int gEncounterTablesLength;
|
|||
// 0x4BC89C
|
||||
int worldmapInit()
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
|
||||
if (_wmGenDataInit() == -1) {
|
||||
return -1;
|
||||
|
@ -1306,7 +1307,7 @@ int worldmapConfigLoadEncounterEntry(EncounterEntry* entry, char* string)
|
|||
int _wmParseEncounterSubEncStr(EncounterEntry* encounterEntry, char** stringPtr)
|
||||
{
|
||||
char* string = *stringPtr;
|
||||
if (strnicmp(string, "enc:", 4) != 0) {
|
||||
if (compat_strnicmp(string, "enc:", 4) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1411,7 +1412,7 @@ int _wmParseFindSubEncTypeMatch(char* str, int* valuePtr)
|
|||
{
|
||||
*valuePtr = 0;
|
||||
|
||||
if (stricmp(str, "player") == 0) {
|
||||
if (compat_stricmp(str, "player") == 0) {
|
||||
*valuePtr = -1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1431,7 +1432,7 @@ int _wmParseFindSubEncTypeMatch(char* str, int* valuePtr)
|
|||
int _wmFindEncBaseTypeMatch(char* str, int* valuePtr)
|
||||
{
|
||||
for (int index = 0; index < _wmMaxEncBaseTypes; index++) {
|
||||
if (stricmp(_wmEncBaseTypeList[index].name, str) == 0) {
|
||||
if (compat_stricmp(_wmEncBaseTypeList[index].name, str) == 0) {
|
||||
*valuePtr = index;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1700,7 +1701,7 @@ int _wmParseTerrainTypes(Config* config, char* string)
|
|||
worldmapTerrainInfoInit(terrain);
|
||||
}
|
||||
|
||||
strlwr(string);
|
||||
compat_strlwr(string);
|
||||
|
||||
pch = string;
|
||||
for (int index = 0; index < gTerrainsLength; index++) {
|
||||
|
@ -1794,7 +1795,7 @@ int worldmapConfigLoadSubtile(TileInfo* tile, int row, int column, char* string)
|
|||
int worldmapFindEncounterTableByLookupName(char* string, int* valuePtr)
|
||||
{
|
||||
for (int index = 0; index < gEncounterTablesLength; index++) {
|
||||
if (stricmp(string, gEncounterTables[index].lookupName) == 0) {
|
||||
if (compat_stricmp(string, gEncounterTables[index].lookupName) == 0) {
|
||||
*valuePtr = index;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1812,7 +1813,7 @@ int worldmapFindTerrainByLookupName(char* string, int* valuePtr)
|
|||
{
|
||||
for (int index = 0; index < gTerrainsLength; index++) {
|
||||
Terrain* terrain = &(gTerrains[index]);
|
||||
if (stricmp(string, terrain->field_0) == 0) {
|
||||
if (compat_stricmp(string, terrain->field_0) == 0) {
|
||||
*valuePtr = index;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1840,7 +1841,7 @@ int _wmParseEncounterItemType(char** stringPtr, ENC_BASE_TYPE_38_48* a2, int* a3
|
|||
return -1;
|
||||
}
|
||||
|
||||
strlwr(string);
|
||||
compat_strlwr(string);
|
||||
|
||||
if (*string == ',') {
|
||||
string++;
|
||||
|
@ -1983,7 +1984,7 @@ int worldmapConfigParseConditionEntry(char** stringPtr, const char* a2, int* typ
|
|||
return -1;
|
||||
}
|
||||
|
||||
strlwr(string);
|
||||
compat_strlwr(string);
|
||||
|
||||
if (*string == ',') {
|
||||
string++;
|
||||
|
@ -2383,7 +2384,7 @@ int worldmapFindMapByLookupName(char* string, int* valuePtr)
|
|||
{
|
||||
for (int index = 0; index < gMapsLength; index++) {
|
||||
MapInfo* map = &(gMaps[index]);
|
||||
if (stricmp(string, map->lookupName) == 0) {
|
||||
if (compat_stricmp(string, map->lookupName) == 0) {
|
||||
*valuePtr = index;
|
||||
return 0;
|
||||
}
|
||||
|
@ -2471,7 +2472,7 @@ int _wmMapInit()
|
|||
exit(1);
|
||||
}
|
||||
|
||||
strlwr(str);
|
||||
compat_strlwr(str);
|
||||
strncpy(map->mapFileName, str, 40);
|
||||
|
||||
if (configGetString(&config, section, "music", &str)) {
|
||||
|
@ -2636,7 +2637,7 @@ int mapGetFileName(int map, char* dest)
|
|||
// 0x4BF9BC
|
||||
int mapGetIndexByFileName(char* name)
|
||||
{
|
||||
strlwr(name);
|
||||
compat_strlwr(name);
|
||||
|
||||
char* pch = name;
|
||||
while (*pch != '\0' && *pch != '.') {
|
||||
|
@ -4027,7 +4028,7 @@ int _wmGrabTileWalkMask(int tile)
|
|||
return -1;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "data\\%s.msk", tileInfo->walkMaskName);
|
||||
|
||||
File* stream = fileOpen(path, "rb");
|
||||
|
@ -6323,7 +6324,7 @@ int worldmapCompareCitiesByName(const void* a1, const void* a2)
|
|||
CityInfo* city1 = &(gCities[v1]);
|
||||
CityInfo* city2 = &(gCities[v2]);
|
||||
|
||||
return stricmp(city1->name, city2->name);
|
||||
return compat_stricmp(city1->name, city2->name);
|
||||
}
|
||||
|
||||
// 0x4C5734
|
||||
|
|
58
src/xfile.cc
58
src/xfile.cc
|
@ -59,7 +59,7 @@ XFile* xfileOpen(const char* filePath, const char* mode)
|
|||
char dir[_MAX_DIR];
|
||||
_splitpath(filePath, drive, dir, NULL, NULL);
|
||||
|
||||
char path[FILENAME_MAX];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
if (drive[0] != '\0' || dir[0] == '\\' || dir[0] == '/' || dir[0] == '.') {
|
||||
// [filePath] is an absolute path. Attempt to open as plain stream.
|
||||
stream->file = fopen(filePath, mode);
|
||||
|
@ -464,7 +464,7 @@ bool xbaseOpen(const char* path)
|
|||
XBase* curr = gXbaseHead;
|
||||
XBase* prev = NULL;
|
||||
while (curr != NULL) {
|
||||
if (stricmp(path, curr->path) == 0) {
|
||||
if (compat_stricmp(path, curr->path) == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -504,8 +504,8 @@ bool xbaseOpen(const char* path)
|
|||
return true;
|
||||
}
|
||||
|
||||
char workingDirectory[FILENAME_MAX];
|
||||
if (getcwd(workingDirectory, FILENAME_MAX) == NULL) {
|
||||
char workingDirectory[COMPAT_MAX_PATH];
|
||||
if (getcwd(workingDirectory, COMPAT_MAX_PATH) == NULL) {
|
||||
// FIXME: Leaking xbase and path.
|
||||
return false;
|
||||
}
|
||||
|
@ -549,18 +549,8 @@ bool xlistEnumerate(const char* pattern, XListEnumerationHandler* handler, XList
|
|||
if (drive[0] != '\0' || dir[0] == '\\' || dir[0] == '/' || dir[0] == '.') {
|
||||
if (fileFindFirst(pattern, &directoryFileFindData)) {
|
||||
do {
|
||||
bool isDirectory;
|
||||
char* entryName;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
isDirectory = (directoryFileFindData.ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
||||
entryName = directoryFileFindData.ffd.cFileName;
|
||||
#elif defined(__WATCOMC__)
|
||||
isDirectory = (directoryFileFindData.entry->d_attr & _A_SUBDIR) != 0;
|
||||
entryName = directoryFileFindData.entry->d_name;
|
||||
#else
|
||||
#error Not implemented
|
||||
#endif
|
||||
bool isDirectory = fileFindIsDirectory(&directoryFileFindData);
|
||||
char* entryName = fileFindGetName(&directoryFileFindData);
|
||||
|
||||
if (isDirectory) {
|
||||
if (strcmp(entryName, "..") == 0 || strcmp(entryName, ".") == 0) {
|
||||
|
@ -599,23 +589,13 @@ bool xlistEnumerate(const char* pattern, XListEnumerationHandler* handler, XList
|
|||
dbaseFindClose(xbase->dbase, &dbaseFindData);
|
||||
}
|
||||
} else {
|
||||
char path[FILENAME_MAX];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
sprintf(path, "%s\\%s", xbase->path, pattern);
|
||||
|
||||
if (fileFindFirst(path, &directoryFileFindData)) {
|
||||
do {
|
||||
bool isDirectory;
|
||||
char* entryName;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
isDirectory = (directoryFileFindData.ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
||||
entryName = directoryFileFindData.ffd.cFileName;
|
||||
#elif defined(__WATCOMC__)
|
||||
isDirectory = (directoryFileFindData.entry->d_attr & _A_SUBDIR) != 0;
|
||||
entryName = directoryFileFindData.entry->d_name;
|
||||
#else
|
||||
#error Not implemented
|
||||
#endif
|
||||
bool isDirectory = fileFindIsDirectory(&directoryFileFindData);
|
||||
char* entryName = fileFindGetName(&directoryFileFindData);
|
||||
|
||||
if (isDirectory) {
|
||||
if (strcmp(entryName, "..") == 0 || strcmp(entryName, ".") == 0) {
|
||||
|
@ -642,18 +622,8 @@ bool xlistEnumerate(const char* pattern, XListEnumerationHandler* handler, XList
|
|||
_splitpath(pattern, drive, dir, fileName, extension);
|
||||
if (fileFindFirst(pattern, &directoryFileFindData)) {
|
||||
do {
|
||||
bool isDirectory;
|
||||
char* entryName;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
isDirectory = (directoryFileFindData.ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
||||
entryName = directoryFileFindData.ffd.cFileName;
|
||||
#elif defined(__WATCOMC__)
|
||||
isDirectory = (directoryFileFindData.entry->d_attr & _A_SUBDIR) != 0;
|
||||
entryName = directoryFileFindData.entry->d_name;
|
||||
#else
|
||||
#error Not implemented
|
||||
#endif
|
||||
bool isDirectory = fileFindIsDirectory(&directoryFileFindData);
|
||||
char* entryName = fileFindGetName(&directoryFileFindData);
|
||||
|
||||
if (isDirectory) {
|
||||
if (strcmp(entryName, "..") == 0 || strcmp(entryName, ".") == 0) {
|
||||
|
@ -703,8 +673,8 @@ void xlistFree(XList* xlist)
|
|||
// 0x4DFFAC
|
||||
int xbaseMakeDirectory(const char* filePath)
|
||||
{
|
||||
char workingDirectory[FILENAME_MAX];
|
||||
if (getcwd(workingDirectory, FILENAME_MAX) == NULL) {
|
||||
char workingDirectory[COMPAT_MAX_PATH];
|
||||
if (getcwd(workingDirectory, COMPAT_MAX_PATH) == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -712,7 +682,7 @@ int xbaseMakeDirectory(const char* filePath)
|
|||
char dir[_MAX_DIR];
|
||||
_splitpath(filePath, drive, dir, NULL, NULL);
|
||||
|
||||
char path[FILENAME_MAX];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
if (drive[0] != '\0' || dir[0] == '\\' || dir[0] == '/' || dir[0] == '.') {
|
||||
// [filePath] is an absolute path.
|
||||
strcpy(path, filePath);
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "dfile.h"
|
||||
|
||||
#include "platform_compat.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <zlib.h>
|
||||
|
||||
|
@ -51,7 +53,7 @@ typedef enum XFileEnumerationEntryType {
|
|||
} XFileEnumerationEntryType;
|
||||
|
||||
typedef struct XListEnumerationContext {
|
||||
char name[FILENAME_MAX];
|
||||
char name[COMPAT_MAX_PATH];
|
||||
unsigned char type;
|
||||
XList* xlist;
|
||||
} XListEnumerationContext;
|
||||
|
|
|
@ -20,5 +20,11 @@ add_library(fpattern STATIC
|
|||
"${fpattern_SOURCE_DIR}/fpattern.h"
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
target_compile_definitions(fpattern PRIVATE
|
||||
"-Dunix"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(FPATTERN_LIBRARY "fpattern" PARENT_SCOPE)
|
||||
set(FPATTERN_INCLUDE_DIR "${fpattern_SOURCE_DIR}" PARENT_SCOPE)
|
||||
|
|
Loading…
Reference in New Issue