Moved all ini functions inside "IniReader" class

This commit is contained in:
NovaRain
2021-04-11 21:24:33 +08:00
parent 2eefeb4f23
commit ea9037e38a
53 changed files with 427 additions and 447 deletions
+1 -1
View File
@@ -124,7 +124,7 @@ void Stats::init() {
sf::MakeJump(fo::funcoffs::trait_adjust_stat_, trait_adjust_stat_hack); // 0x4B3C7C
// Fix the carry weight penalty of the Small Frame trait not being applied to bonus Strength points
smallFrameTraitFix = (sf::GetConfigInt("Misc", "SmallFrameFix", 0) != 0);
smallFrameTraitFix = (sf::IniReader::GetConfigInt("Misc", "SmallFrameFix", 0) != 0);
}
}
+38 -52
View File
@@ -49,10 +49,47 @@ std::vector<std::string> IniReader::GetListDefaultConfig(const char* section, co
return GetIniList(section, setting, defaultValue, bufSize, delimiter, ddrawIni);
}
int IniReader::iniGetInt(const char* section, const char* setting, int defaultValue, const char* iniFile) {
return GetPrivateProfileIntA(section, setting, defaultValue, iniFile);
}
size_t IniReader::iniGetString(const char* section, const char* setting, const char* defaultValue, char* buf, size_t bufSize, const char* iniFile) {
return GetPrivateProfileStringA(section, setting, defaultValue, buf, bufSize, iniFile);
}
std::string IniReader::GetIniString(const char* section, const char* setting, const char* defaultValue, size_t bufSize, const char* iniFile) {
char* buf = new char[bufSize];
iniGetString(section, setting, defaultValue, buf, bufSize, iniFile);
std::string str(buf);
delete[] buf;
return str;
}
std::vector<std::string> IniReader::GetIniList(const char* section, const char* setting, const char* defaultValue, size_t bufSize, char delimiter, const char* iniFile) {
auto list = split(GetIniString(section, setting, defaultValue, bufSize, iniFile), delimiter);
std::transform(list.cbegin(), list.cend(), list.begin(), trim);
return list;
}
/*
For ddraw.ini config
*/
int IniReader::GetConfigInt(const char* section, const char* setting, int defaultValue) {
return iniGetInt(section, setting, defaultValue, ini);
}
std::string IniReader::GetConfigString(const char* section, const char* setting, const char* defaultValue, size_t bufSize) {
return trim(GetIniString(section, setting, defaultValue, bufSize, ini));
}
size_t IniReader::GetConfigString(const char* section, const char* setting, const char* defaultValue, char* buf, size_t bufSize) {
return iniGetString(section, setting, defaultValue, buf, bufSize, ini);
}
std::vector<std::string> IniReader::GetConfigList(const char* section, const char* setting, const char* defaultValue, size_t bufSize) {
return GetIniList(section, setting, defaultValue, bufSize, ',', ini);
}
size_t IniReader::Translate(const char* section, const char* setting, const char* defaultValue, char* buffer, size_t bufSize) {
return iniGetString(section, setting, defaultValue, buffer, bufSize, translationIni);
}
@@ -72,60 +109,9 @@ int IniReader::SetConfigInt(const char* section, const char* setting, int value)
return result;
}
////////////////////////////////////////////////////////////////////////////////
int iniGetInt(const char* section, const char* setting, int defaultValue, const char* iniFile) {
return GetPrivateProfileIntA(section, setting, defaultValue, iniFile);
}
size_t iniGetString(const char* section, const char* setting, const char* defaultValue, char* buf, size_t bufSize, const char* iniFile) {
return GetPrivateProfileStringA(section, setting, defaultValue, buf, bufSize, iniFile);
}
std::string GetIniString(const char* section, const char* setting, const char* defaultValue, size_t bufSize, const char* iniFile) {
char* buf = new char[bufSize];
iniGetString(section, setting, defaultValue, buf, bufSize, iniFile);
std::string str(buf);
delete[] buf;
return str;
}
std::vector<std::string> GetIniList(const char* section, const char* setting, const char* defaultValue, size_t bufSize, char delimiter, const char* iniFile) {
auto list = split(GetIniString(section, setting, defaultValue, bufSize, iniFile), delimiter);
std::transform(list.cbegin(), list.cend(), list.begin(), trim);
return list;
}
/*
For ddraw.ini config
*/
int GetConfigInt(const char* section, const char* setting, int defaultValue) {
return iniGetInt(section, setting, defaultValue, ini);
}
std::string GetConfigString(const char* section, const char* setting, const char* defaultValue, size_t bufSize) {
return trim(GetIniString(section, setting, defaultValue, bufSize, ini));
}
size_t GetConfigString(const char* section, const char* setting, const char* defaultValue, char* buf, size_t bufSize) {
return iniGetString(section, setting, defaultValue, buf, bufSize, ini);
}
std::vector<std::string> GetConfigList(const char* section, const char* setting, const char* defaultValue, size_t bufSize) {
return GetIniList(section, setting, defaultValue, bufSize, ',', ini);
}
std::string Translate(const char* section, const char* setting, const char* defaultValue, size_t bufSize) {
return GetIniString(section, setting, defaultValue, bufSize, translationIni);
}
size_t Translate(const char* section, const char* setting, const char* defaultValue, char* buffer, size_t bufSize) {
return iniGetString(section, setting, defaultValue, buffer, bufSize, translationIni);
}
void IniReader::init() {
modifiedIni = IniReader::GetConfigInt("Main", "ModifiedIni", 0);
GetConfigString("Main", "TranslationsINI", ".\\Translations.ini", translationIni, 65);
IniReader::GetConfigString("Main", "TranslationsINI", ".\\Translations.ini", translationIni, 65);
}
}
+33 -41
View File
@@ -25,59 +25,51 @@ class IniReader {
public:
static void init();
static DWORD IniReader::modifiedIni;
static DWORD modifiedIni;
static const char* IniReader::GetConfigFile();
static void IniReader::SetDefaultConfigFile();
static void IniReader::SetConfigFile(const char* iniFile);
static const char* GetConfigFile();
static void SetDefaultConfigFile();
static void SetConfigFile(const char* iniFile);
// Gets the integer value from the default config (i.e. ddraw.ini)
static int IniReader::GetIntDefaultConfig(const char* section, const char* setting, int defaultValue);
static int GetIntDefaultConfig(const char* section, const char* setting, int defaultValue);
// Gets a list of values separated by the delimiter from the default config (i.e. ddraw.ini)
static std::vector<std::string> IniReader::GetListDefaultConfig(const char* section, const char* setting, const char* defaultValue, size_t bufSize, char delimiter);
static std::vector<std::string> GetListDefaultConfig(const char* section, const char* setting, const char* defaultValue, size_t bufSize, char delimiter);
// Gets the integer value from given INI file
static int iniGetInt(const char* section, const char* setting, int defaultValue, const char* iniFile);
// Gets the string value from given INI file
static size_t iniGetString(const char* section, const char* setting, const char* defaultValue, char* buf, size_t bufSize, const char* iniFile);
// Gets the string value from given INI file
static std::string GetIniString(const char* section, const char* setting, const char* defaultValue, size_t bufSize, const char* iniFile);
// Parses the comma-separated list setting from given INI file
static std::vector<std::string> GetIniList(const char* section, const char* setting, const char* defaultValue, size_t bufSize, char delimiter, const char* iniFile);
// Gets the integer value from sfall configuration INI file
static int IniReader::GetConfigInt(const char* section, const char* setting, int defaultValue);
static int GetConfigInt(const char* section, const char* setting, int defaultValue);
// Gets the string value from sfall configuration INI file with trim function
static std::string GetConfigString(const char* section, const char* setting, const char* defaultValue, size_t bufSize = 128);
// Loads the string value from sfall configuration INI file into the provided buffer
static size_t GetConfigString(const char* section, const char* setting, const char* defaultValue, char* buffer, size_t bufSize = 128);
// Parses the comma-separated list from the settings from sfall configuration INI file
static std::vector<std::string> GetConfigList(const char* section, const char* setting, const char* defaultValue, size_t bufSize = 128);
// Translates given string using sfall translation INI file and puts the result into given buffer
static size_t IniReader::Translate(const char* section, const char* setting, const char* defaultValue, char* buffer, size_t bufSize);
static size_t Translate(const char* section, const char* setting, const char* defaultValue, char* buffer, size_t bufSize = 128);
static std::string IniReader::Translate(const char* section, const char* setting, const char* defaultValue, size_t bufSize = 128);
// Translates given string using sfall translation INI file
static std::string Translate(const char* section, const char* setting, const char* defaultValue, size_t bufSize = 128);
static std::vector<std::string> IniReader::TranslateList(const char* section, const char* setting, const char* defaultValue, char delimiter, size_t bufSize = 256);
static std::vector<std::string> TranslateList(const char* section, const char* setting, const char* defaultValue, char delimiter, size_t bufSize = 256);
static int IniReader::SetConfigInt(const char* section, const char* setting, int value);
static int SetConfigInt(const char* section, const char* setting, int value);
};
// Gets the integer value from given INI file
int iniGetInt(const char* section, const char* setting, int defaultValue, const char* iniFile);
// Gets the string value from given INI file
size_t iniGetString(const char* section, const char* setting, const char* defaultValue, char* buf, size_t bufSize, const char* iniFile);
// Gets the string value from given INI file
std::string GetIniString(const char* section, const char* setting, const char* defaultValue, size_t bufSize, const char* iniFile);
// Parses the comma-separated list setting from given INI file
std::vector<std::string> GetIniList(const char* section, const char* setting, const char* defaultValue, size_t bufSize, char delimiter, const char* iniFile);
// Gets the integer value from sfall configuration INI file
int GetConfigInt(const char* section, const char* setting, int defaultValue);
// Gets the string value from sfall configuration INI file with trim function
std::string GetConfigString(const char* section, const char* setting, const char* defaultValue, size_t bufSize = 128);
// Loads the string value from sfall configuration INI file into the provided buffer
size_t GetConfigString(const char* section, const char* setting, const char* defaultValue, char* buffer, size_t bufSize = 128);
// Parses the comma-separated list from the settings from sfall configuration INI file
std::vector<std::string> GetConfigList(const char* section, const char* setting, const char* defaultValue, size_t bufSize = 128);
// Translates given string using sfall translation INI file
std::string Translate(const char* section, const char* setting, const char* defaultValue, size_t bufSize = 128);
// Translates given string using sfall translation INI file and puts the result into given buffer
size_t Translate(const char* section, const char* setting, const char* defaultValue, char* buffer, size_t bufSize = 128);
}
+7 -7
View File
@@ -436,11 +436,11 @@ public:
};
inline void InitInputFeatures() {
reverseMouse = GetConfigInt("Input", "ReverseMouseButtons", 0) != 0;
reverseMouse = IniReader::GetConfigInt("Input", "ReverseMouseButtons", 0) != 0;
useScrollWheel = GetConfigInt("Input", "UseScrollWheel", 1) != 0;
wheelMod = GetConfigInt("Input", "ScrollMod", 0);
LONG MouseSpeed = GetConfigInt("Input", "MouseSensitivity", 100);
useScrollWheel = IniReader::GetConfigInt("Input", "UseScrollWheel", 1) != 0;
wheelMod = IniReader::GetConfigInt("Input", "ScrollMod", 0);
LONG MouseSpeed = IniReader::GetConfigInt("Input", "MouseSensitivity", 100);
if (MouseSpeed != 100) {
adjustMouseSpeed = true;
mouseSpeedMod = ((double)MouseSpeed) / 100.0;
@@ -448,11 +448,11 @@ inline void InitInputFeatures() {
mousePartY = 0;
} else adjustMouseSpeed = false;
middleMouseKey = GetConfigInt("Input", "MiddleMouse", 0x30);
middleMouseKey = IniReader::GetConfigInt("Input", "MiddleMouse", 0x30);
middleMouseDown = false;
backgroundKeyboard = GetConfigInt("Input", "BackgroundKeyboard", 0) != 0;
backgroundMouse = GetConfigInt("Input", "BackgroundMouse", 0) != 0;
backgroundKeyboard = IniReader::GetConfigInt("Input", "BackgroundKeyboard", 0) != 0;
backgroundMouse = IniReader::GetConfigInt("Input", "BackgroundMouse", 0) != 0;
keyboardLayout = GetKeyboardLayout(0);
}
+3 -1
View File
@@ -513,6 +513,8 @@ static void __declspec(naked) ai_try_attack_hack_check_safe_weapon() {
}
}
////////////////////////////////////////////////////////////////////////////////
static void __fastcall CombatAttackHook(fo::GameObject* source, fo::GameObject* target) {
sources[target] = source; // who attacked the 'target' from the last time
targets[source] = target; // who was attacked by the 'source' from the last time
@@ -545,7 +547,7 @@ void AI::init() {
LoadGameHook::OnCombatStart() += AICombatClear;
LoadGameHook::OnCombatEnd() += AICombatClear;
RetryCombatMinAP = GetConfigInt("Misc", "NPCsTryToSpendExtraAP", 0);
RetryCombatMinAP = IniReader::GetConfigInt("Misc", "NPCsTryToSpendExtraAP", 0);
if (RetryCombatMinAP > 0) {
dlog("Applying retry combat patch.", DL_INIT);
HookCall(0x422B94, RetryCombatHook); // combat_turn_
+1 -1
View File
@@ -343,7 +343,7 @@ void ApplyAnimationsAtOncePatches(signed char aniMax) {
}
void Animations::init() {
animationLimit = GetConfigInt("Misc", "AnimationsAtOnceLimit", 32);
animationLimit = IniReader::GetConfigInt("Misc", "AnimationsAtOnceLimit", 32);
if (animationLimit > 32) {
if (animationLimit > 127) {
animationLimit = 127;
+3 -3
View File
@@ -262,7 +262,7 @@ static void __declspec(naked) refresh_box_bar_win_hack() {
}
void BarBoxes::init() {
initCount += GetConfigInt("Misc", "BoxBarCount", 5);
initCount += IniReader::GetConfigInt("Misc", "BoxBarCount", 5);
if (initCount < 5) initCount = 5; // exclude the influence of negative values from the config
if (initCount > 100) initCount = 100;
@@ -276,7 +276,7 @@ void BarBoxes::init() {
boxes[i].msg = 100 + i;
}
auto boxBarColors = GetConfigString("Misc", "BoxBarColours", "", actualBoxCount + 1);
auto boxBarColors = IniReader::GetConfigString("Misc", "BoxBarColours", "", actualBoxCount + 1);
for (size_t i = 0; i < boxBarColors.size(); i++) {
if (boxBarColors[i] == '1') {
boxes[i + 5].colour = 1; // red color
@@ -303,7 +303,7 @@ void BarBoxes::init() {
MakeCall(0x4615FA, refresh_box_bar_win_hack);
SafeWriteBatch<DWORD>((DWORD)newBoxSlot, bboxSlotAddr); // _bboxslot
ifaceWidth = iniGetInt("IFACE", "IFACE_BAR_WIDTH", 640, ".\\f2_res.ini");
ifaceWidth = IniReader::iniGetInt("IFACE", "IFACE_BAR_WIDTH", 640, ".\\f2_res.ini");
if (ifaceWidth < 640) ifaceWidth = 640;
LoadGameHook::OnAfterGameInit() += SetMaxSlots;
+6 -6
View File
@@ -86,15 +86,15 @@ static void LoadVanillaBooks() {
}
void Books::init() {
auto booksFile = GetConfigString("Misc", "BooksFile", "", MAX_PATH);
auto booksFile = IniReader::GetConfigString("Misc", "BooksFile", "", MAX_PATH);
if (!booksFile.empty()) {
dlog("Applying books patch...", DL_INIT);
const char* iniBooks = booksFile.insert(0, ".\\").c_str();
bool includeVanilla = (iniGetInt("main", "overrideVanilla", 0, iniBooks) == 0);
bool includeVanilla = (IniReader::iniGetInt("main", "overrideVanilla", 0, iniBooks) == 0);
if (includeVanilla) BooksCount = 5;
int count = iniGetInt("main", "count", 0, iniBooks);
int count = IniReader::iniGetInt("main", "count", 0, iniBooks);
int n = 0;
if (count > 0) {
@@ -106,9 +106,9 @@ void Books::init() {
char section[4];
for (int i = 1; i <= count; i++) {
_itoa_s(i, section, 10);
if (books[BooksCount].bookPid = iniGetInt(section, "PID", 0, iniBooks)) {
books[BooksCount].msgID = iniGetInt(section, "TextID", 0, iniBooks);
books[BooksCount].skill = iniGetInt(section, "Skill", 0, iniBooks);
if (books[BooksCount].bookPid = IniReader::iniGetInt(section, "PID", 0, iniBooks)) {
books[BooksCount].msgID = IniReader::iniGetInt(section, "TextID", 0, iniBooks);
books[BooksCount].skill = IniReader::iniGetInt(section, "Skill", 0, iniBooks);
BooksCount++;
n++;
}
+40 -40
View File
@@ -3026,19 +3026,19 @@ void BugFixes::init()
SafeWrite16(0x46A566, 0x04DB);
SafeWrite16(0x46A4E7, 0x04DB);
// Fix for vanilla division operator treating negative integers as unsigned
if (GetConfigInt("Misc", "DivisionOperatorFix", 1)) {
if (IniReader::GetConfigInt("Misc", "DivisionOperatorFix", 1)) {
dlog("Applying division operator fix.", DL_FIX);
SafeWrite32(0x46A51D, 0xFBF79990); // xor edx, edx; div ebx > cdq; idiv ebx
dlogr(" Done", DL_FIX);
}
//if (GetConfigInt("Misc", "SpecialUnarmedAttacksFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "SpecialUnarmedAttacksFix", 1)) {
dlog("Applying Special Unarmed Attacks fix.", DL_FIX);
MakeJump(0x42394D, compute_attack_hack);
dlogr(" Done", DL_FIX);
//}
//if (GetConfigInt("Misc", "SharpshooterFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "SharpshooterFix", 1)) {
dlog("Applying Sharpshooter patch.", DL_FIX);
// https://www.nma-fallout.com/threads/fo2-engine-tweaks-sfall.178390/page-119#post-4050162
// by Slider2k
@@ -3062,7 +3062,7 @@ void BugFixes::init()
// Fix for "Too Many Items" bug
// http://fforum.kochegarov.com/index.php?showtopic=29288&view=findpost&p=332242
//if (GetConfigInt("Misc", "TooManyItemsBugFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "TooManyItemsBugFix", 1)) {
dlog("Applying preventive patch for \"Too Many Items\" bug.", DL_FIX);
HookCalls(scr_write_ScriptNode_hook, {0x4A596A, 0x4A59C1});
dlogr(" Done", DL_FIX);
@@ -3072,7 +3072,7 @@ void BugFixes::init()
MakeCall(0x49BE70, obj_use_power_on_car_hack);
// Fix for being able to charge the car by using cells on other scenery/critters
if (GetConfigInt("Misc", "CarChargingFix", 1)) {
if (IniReader::GetConfigInt("Misc", "CarChargingFix", 1)) {
dlog("Applying car charging fix.", DL_FIX);
MakeJump(0x49C36D, protinst_default_use_item_hack);
dlogr(" Done", DL_FIX);
@@ -3092,7 +3092,7 @@ void BugFixes::init()
// Evil bug! If party member has the same armor type in inventory as currently equipped, then
// on level up he loses Armor Class equal to the one received from this armor.
// The same happens if you just order NPC to remove the armor through dialogue.
//if (GetConfigInt("Misc", "ArmorCorruptsNPCStatsFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "ArmorCorruptsNPCStatsFix", 1)) {
dlog("Applying fix for armor reducing NPC original stats when removed.", DL_FIX);
HookCall(0x495F3B, partyMemberCopyLevelInfo_hook_stat_level);
HookCall(0x45419B, correctFidForRemovedItem_hook_adjust_ac);
@@ -3111,7 +3111,7 @@ void BugFixes::init()
dlogr(" Done", DL_FIX);
// Allow 9 options (lines of text) to be displayed correctly in a dialog window
//if (GetConfigInt("Misc", "DialogOptions9Lines", 1)) {
//if (IniReader::GetConfigInt("Misc", "DialogOptions9Lines", 1)) {
dlog("Applying 9 dialog options patch.", DL_FIX);
MakeCall(0x447021, gdProcessUpdate_hack, 1);
dlogr(" Done", DL_FIX);
@@ -3136,7 +3136,7 @@ void BugFixes::init()
dlogr(" Done", DL_FIX);
// Fix for not counting in the weight/size of equipped items on NPC when stealing or bartering
//if (GetConfigInt("Misc", "NPCWeightFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "NPCWeightFix", 1)) {
dlog("Applying fix for not counting in weight of equipped items on NPC.", DL_FIX);
MakeCall(0x473B4E, loot_container_hack);
HookCall(0x4758AB, barter_inventory_hook);
@@ -3151,7 +3151,7 @@ void BugFixes::init()
// Corrects the max text width of the player name in inventory to be 140 (was 80), which matches the width for item name
SafeWrite32(0x471E48, 140);
//if (GetConfigInt("Misc", "InventoryDragIssuesFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "InventoryDragIssuesFix", 1)) {
dlog("Applying inventory reverse order issues fix.", DL_FIX);
// Fix for minor visual glitch when picking up solo item from the top of inventory
// and there is multiple item stack at the bottom of inventory
@@ -3165,7 +3165,7 @@ void BugFixes::init()
//}
// Enable party members with level 6 protos to reach level 6
//if (GetConfigInt("Misc", "NPCStage6Fix", 1)) {
//if (IniReader::GetConfigInt("Misc", "NPCStage6Fix", 1)) {
dlog("Applying NPC Stage 6 Fix.", DL_FIX);
MakeJump(0x493CE9, NPCStage6Fix1); // partyMember_init_
MakeJump(0x494224, NPCStage6Fix2); // partyMemberGetAIOptions_
@@ -3174,32 +3174,32 @@ void BugFixes::init()
dlogr(" Done", DL_FIX);
//}
//if (GetConfigInt("Misc", "NPCLevelFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "NPCLevelFix", 1)) {
dlog("Applying NPC level fix.", DL_FIX);
HookCall(0x495BC9, (void*)0x495E51); // jz 0x495E7F > jz 0x495E51
dlogr(" Done", DL_FIX);
//}
//if (GetConfigInt("Misc", "BlackSkilldexFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "BlackSkilldexFix", 1)) {
dlog("Applying black Skilldex patch.", DL_FIX);
HookCall(0x497D0F, PipStatus_AddHotLines_hook);
dlogr(" Done", DL_FIX);
//}
//if (GetConfigInt("Misc", "FixWithdrawalPerkDescCrash", 1)) {
//if (IniReader::GetConfigInt("Misc", "FixWithdrawalPerkDescCrash", 1)) {
dlog("Applying withdrawal perk description crash fix.", DL_FIX);
HookCall(0x47A501, perform_withdrawal_start_display_print_hook);
dlogr(" Done", DL_FIX);
//}
//if (GetConfigInt("Misc", "JetAntidoteFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "JetAntidoteFix", 1)) {
dlog("Applying Jet Antidote fix.", DL_FIX);
// the original jet antidote fix
MakeJump(0x47A013, (void*)0x47A168);
dlogr(" Done", DL_FIX);
//}
//if (GetConfigInt("Misc", "NPCDrugAddictionFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "NPCDrugAddictionFix", 1)) {
dlog("Applying NPC's drug addiction fix.", DL_FIX);
// proper checks for NPC's addiction instead of always using global vars
MakeJump(0x47A644, item_d_check_addict_hack);
@@ -3207,13 +3207,13 @@ void BugFixes::init()
dlogr(" Done", DL_FIX);
//}
//if (GetConfigInt("Misc", "ShivPatch", 1)) {
//if (IniReader::GetConfigInt("Misc", "ShivPatch", 1)) {
dlog("Applying shiv patch.", DL_FIX);
SafeWrite8(0x477B2B, CodeType::JumpShort);
dlogr(" Done", DL_FIX);
//}
//if (GetConfigInt("Misc", "ImportedProcedureFix", 0)) {
//if (IniReader::GetConfigInt("Misc", "ImportedProcedureFix", 0)) {
dlog("Applying imported procedure patch.", DL_FIX);
// http://teamx.ru/site_arc/smf/index.php-topic=398.0.htm
SafeWrite16(0x46B35B, 0x1C60); // Fix problems with the temporary stack
@@ -3226,14 +3226,14 @@ void BugFixes::init()
SafeWrite8(0x46C7AC, 0x76); // jb > jbe
// Update the AC counter
//if (GetConfigInt("Misc", "WieldObjCritterFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "WieldObjCritterFix", 1)) {
dlog("Applying wield_obj_critter fix.", DL_FIX);
SafeWrite8(0x456912, 0x1E); // jnz 0x456931
HookCall(0x45697F, op_wield_obj_critter_adjust_ac_hook);
dlogr(" Done", DL_FIX);
//}
//if (GetConfigInt("Misc", "MultiHexPathingFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "MultiHexPathingFix", 1)) {
dlog("Applying MultiHex Pathing Fix.", DL_FIX);
HookCall(0x416144, make_path_func_hook); // Fix for building the path to the central hex of a multihex object
//MakeCalls(MultiHexFix, {0x42901F, 0x429170}); // obsolete fix
@@ -3247,7 +3247,7 @@ void BugFixes::init()
dlogr(" Done", DL_FIX);
//}
//if (GetConfigInt("Misc", "DodgyDoorsFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "DodgyDoorsFix", 1)) {
dlog("Applying Dodgy Door Fix.", DL_FIX);
MakeCall(0x4113D3, action_melee_hack, 2);
MakeCall(0x411BC9, action_ranged_hack, 2);
@@ -3268,7 +3268,7 @@ void BugFixes::init()
// Fix for "NPC turns into a container" bug
// https://www.nma-fallout.com/threads/fo2-engine-tweaks-sfall.178390/page-123#post-4065716
//if (GetConfigInt("Misc", "NPCTurnsIntoContainerFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "NPCTurnsIntoContainerFix", 1)) {
dlog("Applying fix for \"NPC turns into a container\" bug.", DL_FIX);
MakeJump(0x42E46E, critter_wake_clear_hack);
MakeCall(0x488EF3, obj_load_func_hack, 1);
@@ -3291,7 +3291,7 @@ void BugFixes::init()
dlogr(" Done", DL_FIX);
// Fix for being unable to sell used geiger counters or stealth boys
if (GetConfigInt("Misc", "CanSellUsedGeiger", 1)) {
if (IniReader::GetConfigInt("Misc", "CanSellUsedGeiger", 1)) {
dlog("Applying fix for being unable to sell used geiger counters or stealth boys.", DL_FIX);
SafeWriteBatch<BYTE>(0xBA, {0x478115, 0x478138}); // item_queued_ (will return the found item)
MakeJump(0x474D22, barter_attempt_transaction_hack, 1);
@@ -3314,20 +3314,20 @@ void BugFixes::init()
// Fix for checking the horizontal position on the y-axis instead of x when setting coordinates on the world map
SafeWrite8(0x4C4743, 0xC6); // cmp esi, eax
//if (GetConfigInt("Misc", "PrintToFileFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "PrintToFileFix", 1)) {
dlog("Applying print to file fix.", DL_FIX);
MakeCall(0x4C67D4, db_get_file_list_hack);
dlogr(" Done", DL_FIX);
//}
// Fix for display issues when calling gdialog_mod_barter with critters with no "Barter" flag set
//if (GetConfigInt("Misc", "gdBarterDispFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "gdBarterDispFix", 1)) {
dlog("Applying gdialog_mod_barter display fix.", DL_FIX);
HookCall(0x448250, gdActivateBarter_hook);
dlogr(" Done", DL_FIX);
//}
//if (GetConfigInt("Misc", "BagBackpackFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "BagBackpackFix", 1)) {
dlog("Applying fix for bag/backpack bugs.", DL_FIX);
// Fix for items disappearing from inventory when you try to drag them to bag/backpack in the inventory list
// and are overloaded
@@ -3353,7 +3353,7 @@ void BugFixes::init()
MakeCall(0x4396F5, Save_as_ASCII_hack, 2);
// Fix for Bonus Move APs being replenished when you save and load the game in combat
//if (GetConfigInt("Misc", "BonusMoveFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "BonusMoveFix", 1)) {
dlog("Applying fix for Bonus Move exploit.", DL_FIX);
HookCall(0x420E93, combat_load_hook);
MakeCall(0x422A06, combat_turn_hack);
@@ -3368,7 +3368,7 @@ void BugFixes::init()
MakeCall(0x424CD2, apply_damage_hack);
// Fix for the double damage effect of Silent Death perk not being applied to critical hits
//if (GetConfigInt("Misc", "SilentDeathFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "SilentDeathFix", 1)) {
dlog("Applying Silent Death patch.", DL_FIX);
SafeWrite8(0x4238DF, 0x8C); // jl loc_423A0D
HookCall(0x423A99, compute_attack_hook);
@@ -3409,7 +3409,7 @@ void BugFixes::init()
dlogr(" Done", DL_FIX);
// Display full item description for weapon/ammo in the barter screen
showItemDescription = (GetConfigInt("Misc", "FullItemDescInBarter", 0) != 0);
showItemDescription = (IniReader::GetConfigInt("Misc", "FullItemDescInBarter", 0) != 0);
if (showItemDescription) {
dlog("Applying full item description in barter patch.", DL_FIX);
HookCall(0x49B452, obj_examine_func_hack_weapon); // it's jump
@@ -3417,7 +3417,7 @@ void BugFixes::init()
}
// Display experience points with the bonus from Swift Learner perk when gained from non-scripted situations
if (GetConfigInt("Misc", "DisplaySwiftLearnerExp", 1)) {
if (IniReader::GetConfigInt("Misc", "DisplaySwiftLearnerExp", 1)) {
dlog("Applying Swift Learner exp display patch.", DL_FIX);
MakeCall(0x4AFAEF, statPCAddExperienceCheckPMs_hack);
HookCall(0x4221E2, combat_give_exps_hook);
@@ -3433,7 +3433,7 @@ void BugFixes::init()
SafeWrite16(0x456B76, 0x23EB); // jmp loc_456B9B (skip unused engine code)
// Fix broken obj_can_hear_obj function
if (GetConfigInt("Misc", "ObjCanHearObjFix", 0)) {
if (IniReader::GetConfigInt("Misc", "ObjCanHearObjFix", 0)) {
dlog("Applying obj_can_hear_obj fix.", DL_FIX);
SafeWrite8(0x4583D8, 0x3B); // jz loc_458414
SafeWrite8(0x4583DE, CodeType::JumpZ); // jz loc_458414
@@ -3442,7 +3442,7 @@ void BugFixes::init()
}
// Fix for AI not checking weapon perks properly when searching for the best weapon
int bestWeaponPerkFix = GetConfigInt("Misc", "AIBestWeaponFix", 0);
int bestWeaponPerkFix = IniReader::GetConfigInt("Misc", "AIBestWeaponFix", 0);
if (bestWeaponPerkFix > 0) {
dlog("Applying AI best weapon choice fix.", DL_FIX);
HookCall(0x42954B, ai_best_weapon_hook);
@@ -3478,7 +3478,7 @@ void BugFixes::init()
dlogr(" Done", DL_FIX);
// Fix for the "mood" argument of start_gdialog function being ignored for talking heads
if (GetConfigInt("Misc", "StartGDialogFix", 0)) {
if (IniReader::GetConfigInt("Misc", "StartGDialogFix", 0)) {
dlog("Applying start_gdialog argument fix.", DL_FIX);
MakeCall(0x456F08, op_start_gdialog_hack);
dlogr(" Done", DL_FIX);
@@ -3495,9 +3495,9 @@ void BugFixes::init()
// Radiation fixes
MakeCall(0x42D6C3, process_rads_hack, 1); // prevents player's death if a stat is less than 1 when removing radiation effects
HookCall(0x42D67A, process_rads_hook); // fix for the same effect message being displayed when removing radiation effects
radEffectsMsgNum = GetConfigInt("Misc", "RadEffectsRemovalMsg", radEffectsMsgNum);
radEffectsMsgNum = IniReader::GetConfigInt("Misc", "RadEffectsRemovalMsg", radEffectsMsgNum);
// Display messages about radiation for the active geiger counter
if (GetConfigInt("Misc", "ActiveGeigerMsgs", 1)) {
if (IniReader::GetConfigInt("Misc", "ActiveGeigerMsgs", 1)) {
dlog("Applying active geiger counter messages patch.", DL_FIX);
SafeWriteBatch<BYTE>(CodeType::JumpZ, {0x42D424, 0x42D444}); // jnz > jz
dlogr(" Done", DL_FIX);
@@ -3506,7 +3506,7 @@ void BugFixes::init()
HookCall(0x42D733, process_rads_hook_msg);
// Fix for AI not taking chem_primary_desire in AI.txt as drug use preference when using drugs in their inventory
if (GetConfigInt("Misc", "AIDrugUsePerfFix", 0)) {
if (IniReader::GetConfigInt("Misc", "AIDrugUsePerfFix", 0)) {
dlog("Applying AI drug use preference fix.", DL_FIX);
MakeCall(0x42869D, ai_check_drugs_hack_break);
MakeCall(0x4286AB, ai_check_drugs_hack_check);
@@ -3526,7 +3526,7 @@ void BugFixes::init()
// Fix and repurpose the unused called_shot/num_attack arguments of attack_complex function
// called_shot - additional damage when hitting the target
// num_attacks - the number of free action points on the first turn only
if (GetConfigInt("Misc", "AttackComplexFix", 0)) {
if (IniReader::GetConfigInt("Misc", "AttackComplexFix", 0)) {
dlog("Applying attack_complex arguments fix.", DL_FIX);
HookCall(0x456D4A, op_attack_hook);
SafeWrite8(0x456D61, 0x74); // mov [gcsd.free_move], esi
@@ -3640,7 +3640,7 @@ void BugFixes::init()
MakeCall(0x411DF7, action_climb_ladder_hack); // bug caused by anim_move_to_tile_ fix
// Partial fix for incorrect positioning after exiting small/medium locations (e.g. Ghost Farm)
//if (GetConfigInt("Misc", "SmallLocExitFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "SmallLocExitFix", 1)) {
dlog("Applying fix for incorrect positioning after exiting small/medium locations.", DL_FIX);
MakeJump(0x4C5A41, wmTeleportToArea_hack);
dlogr(" Done", DL_FIX);
@@ -3656,7 +3656,7 @@ void BugFixes::init()
MakeCall(0x4C03AA, wmWorldMap_hack, 2);
// Fix to prevent using number keys to enter unvisited areas on a town map
if (GetConfigInt("Misc", "TownMapHotkeysFix", 1)) {
if (IniReader::GetConfigInt("Misc", "TownMapHotkeysFix", 1)) {
dlog("Applying town map hotkeys patch.", DL_FIX);
MakeCall(0x4C495A, wmTownMapFunc_hack, 1);
dlogr(" Done", DL_FIX);
@@ -3668,7 +3668,7 @@ void BugFixes::init()
// Fix for the car being lost when entering a location via the Town/World button and then leaving on foot
// (sets GVAR_CAR_PLACED_TILE (633) to -1 on exit to the world map)
if (GetConfigInt("Misc", "CarPlacedTileFix", 1)) {
if (IniReader::GetConfigInt("Misc", "CarPlacedTileFix", 1)) {
dlog("Applying car placed tile fix.", DL_FIX);
MakeCall(0x4C2367, wmInterfaceInit_hack);
dlogr(" Done", DL_FIX);
@@ -3683,7 +3683,7 @@ void BugFixes::init()
HookCall(0x458B3D, op_critter_add_trait_hook);
// Fix to prevent corpses from blocking line of fire
//if (GetConfigInt("Misc", "CorpseLineOfFireFix", 1)) {
//if (IniReader::GetConfigInt("Misc", "CorpseLineOfFireFix", 1)) {
dlog("Applying fix for corpses blocking line of fire.", DL_FIX);
MakeJump(0x48B994, obj_shoot_blocking_at_hack0);
MakeJump(0x48BA04, obj_shoot_blocking_at_hack1);
+5 -5
View File
@@ -67,18 +67,18 @@ static void __declspec(naked) compute_spray_rounds_distribution() {
}
void BurstMods::init() {
if (GetConfigInt("Misc", "ComputeSprayMod", 0)) {
if (IniReader::GetConfigInt("Misc", "ComputeSprayMod", 0)) {
dlog("Applying ComputeSpray changes.", DL_INIT);
compute_spray_center_mult = GetConfigInt("Misc", "ComputeSpray_CenterMult", 1);
compute_spray_center_div = GetConfigInt("Misc", "ComputeSpray_CenterDiv", 3);
compute_spray_center_mult = IniReader::GetConfigInt("Misc", "ComputeSpray_CenterMult", 1);
compute_spray_center_div = IniReader::GetConfigInt("Misc", "ComputeSpray_CenterDiv", 3);
if (compute_spray_center_div < 1) {
compute_spray_center_div = 1;
}
if (compute_spray_center_mult > compute_spray_center_div) {
compute_spray_center_mult = compute_spray_center_div;
}
compute_spray_target_mult = GetConfigInt("Misc", "ComputeSpray_TargetMult", 1);
compute_spray_target_div = GetConfigInt("Misc", "ComputeSpray_TargetDiv", 2);
compute_spray_target_mult = IniReader::GetConfigInt("Misc", "ComputeSpray_TargetMult", 1);
compute_spray_target_div = IniReader::GetConfigInt("Misc", "ComputeSpray_TargetDiv", 2);
if (compute_spray_target_div < 1) {
compute_spray_target_div = 1;
}
+10 -10
View File
@@ -459,15 +459,15 @@ static void BodypartHitChances() {
}
static void BodypartHitReadConfig() {
bodyPartHit.Head = static_cast<long>(GetConfigInt("Misc", "BodyHit_Head", -40));
bodyPartHit.Left_Arm = static_cast<long>(GetConfigInt("Misc", "BodyHit_Left_Arm", -30));
bodyPartHit.Right_Arm = static_cast<long>(GetConfigInt("Misc", "BodyHit_Right_Arm", -30));
bodyPartHit.Torso = static_cast<long>(GetConfigInt("Misc", "BodyHit_Torso", 0));
bodyPartHit.Right_Leg = static_cast<long>(GetConfigInt("Misc", "BodyHit_Right_Leg", -20));
bodyPartHit.Left_Leg = static_cast<long>(GetConfigInt("Misc", "BodyHit_Left_Leg", -20));
bodyPartHit.Eyes = static_cast<long>(GetConfigInt("Misc", "BodyHit_Eyes", -60));
bodyPartHit.Groin = static_cast<long>(GetConfigInt("Misc", "BodyHit_Groin", -30));
bodyPartHit.Uncalled = static_cast<long>(GetConfigInt("Misc", "BodyHit_Torso_Uncalled", 0));
bodyPartHit.Head = static_cast<long>(IniReader::GetConfigInt("Misc", "BodyHit_Head", -40));
bodyPartHit.Left_Arm = static_cast<long>(IniReader::GetConfigInt("Misc", "BodyHit_Left_Arm", -30));
bodyPartHit.Right_Arm = static_cast<long>(IniReader::GetConfigInt("Misc", "BodyHit_Right_Arm", -30));
bodyPartHit.Torso = static_cast<long>(IniReader::GetConfigInt("Misc", "BodyHit_Torso", 0));
bodyPartHit.Right_Leg = static_cast<long>(IniReader::GetConfigInt("Misc", "BodyHit_Right_Leg", -20));
bodyPartHit.Left_Leg = static_cast<long>(IniReader::GetConfigInt("Misc", "BodyHit_Left_Leg", -20));
bodyPartHit.Eyes = static_cast<long>(IniReader::GetConfigInt("Misc", "BodyHit_Eyes", -60));
bodyPartHit.Groin = static_cast<long>(IniReader::GetConfigInt("Misc", "BodyHit_Groin", -30));
bodyPartHit.Uncalled = static_cast<long>(IniReader::GetConfigInt("Misc", "BodyHit_Torso_Uncalled", 0));
}
static void __declspec(naked) ai_pick_hit_mode_hook_bodypart() {
@@ -572,7 +572,7 @@ void Combat::init() {
// Disables secondary burst attacks for the critter
MakeCall(0x429E44, ai_pick_hit_mode_hack_noBurst, 1);
checkWeaponAmmoCost = (GetConfigInt("Misc", "CheckWeaponAmmoCost", 0) != 0);
checkWeaponAmmoCost = (IniReader::GetConfigInt("Misc", "CheckWeaponAmmoCost", 0) != 0);
if (checkWeaponAmmoCost) {
MakeCall(0x4234B3, compute_spray_hack, 1);
HookCall(0x4266E9, combat_check_bad_shot_hook);
+1 -1
View File
@@ -48,7 +48,7 @@ static void __declspec(naked) ConsoleHook() {
}
void Console::init() {
auto path = GetConfigString("Misc", "ConsoleOutputPath", "", MAX_PATH);
auto path = IniReader::GetConfigString("Misc", "ConsoleOutputPath", "", MAX_PATH);
if (!path.empty()) {
consoleFile.open(path);
if (consoleFile.is_open()) {
+1 -1
View File
@@ -160,7 +160,7 @@ morelines:
void Credits::init() {
HookCalls(ShowCreditsHook, {0x480C49, 0x43F881});
if (GetConfigInt("Misc", "CreditsAtBottom", 0)) {
if (IniReader::GetConfigInt("Misc", "CreditsAtBottom", 0)) {
HookCall(0x42CB49, CreditsNextLineHook_Bottom);
} else {
HookCall(0x42CB49, CreditsNextLineHook_Top);
+7 -7
View File
@@ -89,7 +89,7 @@ static int CritTableLoad() {
fo::CritInfo& newEffect = baseCritTable[newCritter][part][crit];
fo::CritInfo& defaultEffect = fo::var::crit_succ_eff[critter][part][crit];
for (int i = 0; i < 7; i++) {
newEffect.values[i] = iniGetInt(section, critNames[i], defaultEffect.values[i], critTableFile.c_str());
newEffect.values[i] = IniReader::iniGetInt(section, critNames[i], defaultEffect.values[i], critTableFile.c_str());
if (isDebug) {
char logmsg[256];
if (newEffect.values[i] != defaultEffect.values[i]) {
@@ -114,11 +114,11 @@ static int CritTableLoad() {
for (int critter = 0; critter < Criticals::critTableCount; critter++) {
sprintf_s(buf, "c_%02d", critter);
int all;
if (!(all = iniGetInt(buf, "Enabled", 0, critTableFile.c_str()))) continue;
if (!(all = IniReader::iniGetInt(buf, "Enabled", 0, critTableFile.c_str()))) continue;
for (int part = 0; part < 9; part++) {
if (all < 2) {
sprintf_s(buf2, "Part_%d", part);
if (!iniGetInt(buf, buf2, 0, critTableFile.c_str())) continue;
if (!IniReader::iniGetInt(buf, buf2, 0, critTableFile.c_str())) continue;
}
sprintf_s(buf2, "c_%02d_%d", critter, part);
@@ -126,7 +126,7 @@ static int CritTableLoad() {
fo::CritInfo& effect = baseCritTable[critter][part][crit];
for (int i = 0; i < 7; i++) {
sprintf_s(buf3, "e%d_%s", crit, critNames[i]);
effect.values[i] = iniGetInt(buf2, buf3, effect.values[i], critTableFile.c_str());
effect.values[i] = IniReader::iniGetInt(buf2, buf3, effect.values[i], critTableFile.c_str());
}
}
}
@@ -304,7 +304,7 @@ static void CriticalTableOverride() {
#undef SetEntry
static void RemoveCriticalTimeLimitsPatch() {
if (GetConfigInt("Misc", "RemoveCriticalTimelimits", 0)) {
if (IniReader::GetConfigInt("Misc", "RemoveCriticalTimelimits", 0)) {
dlog("Removing critical time limits.", DL_INIT);
SafeWrite8(0x424118, CodeType::JumpShort); // jump to 0x424131
SafeWriteBatch<WORD>(0x9090, {0x4A3052, 0x4A3093});
@@ -313,10 +313,10 @@ static void RemoveCriticalTimeLimitsPatch() {
}
void Criticals::init() {
mode = GetConfigInt("Misc", "OverrideCriticalTable", 2);
mode = IniReader::GetConfigInt("Misc", "OverrideCriticalTable", 2);
if (mode < 0 || mode > 3) mode = 0;
if (mode) {
critTableFile += GetConfigString("Misc", "OverrideCriticalFile", "CriticalOverrides.ini", MAX_PATH);
critTableFile += IniReader::GetConfigString("Misc", "OverrideCriticalFile", "CriticalOverrides.ini", MAX_PATH);
CriticalTableOverride();
LoadGameHook::OnBeforeGameStart() += []() {
memcpy(critTable, baseCritTable, sizeof(critTable)); // Apply loaded critical table
+3 -3
View File
@@ -400,7 +400,7 @@ static void __declspec(naked) DisplayBonusHtHDmg2_hack() {
}
void DamageMod::init() {
if (formula = GetConfigInt("Misc", "DamageFormula", 0)) {
if (formula = IniReader::GetConfigInt("Misc", "DamageFormula", 0)) {
switch (formula) {
case 1:
case 2:
@@ -412,8 +412,8 @@ void DamageMod::init() {
}
}
int BonusHtHDmgFix = GetConfigInt("Misc", "BonusHtHDamageFix", 1);
int DisplayBonusDmg = GetConfigInt("Misc", "DisplayBonusDamage", 0);
int BonusHtHDmgFix = IniReader::GetConfigInt("Misc", "BonusHtHDamageFix", 1);
int DisplayBonusDmg = IniReader::GetConfigInt("Misc", "DisplayBonusDamage", 0);
if (BonusHtHDmgFix) {
dlog("Applying Bonus HtH Damage Perk fix.", DL_INIT);
if (DisplayBonusDmg == 0) { // Subtract damage from perk bonus (vanilla displaying)
+1 -1
View File
@@ -499,7 +499,7 @@ void DebugEditor::init() {
if (!isDebug) return;
DontDeleteProtosPatch();
debugEditorKey = GetConfigInt("Input", "DebugEditorKey", 0);
debugEditorKey = IniReader::GetConfigInt("Input", "DebugEditorKey", 0);
if (debugEditorKey != 0) {
OnKeyPressed() += [](DWORD scanCode, bool pressed) {
if (scanCode == debugEditorKey && pressed && IsGameLoaded()) {
+9 -9
View File
@@ -282,14 +282,14 @@ long Drugs::SetDrugAddictTimeOff(long pid, long time) {
}
void Drugs::init() {
auto drugsFile = GetConfigString("Misc", "DrugsFile", "", MAX_PATH);
auto drugsFile = IniReader::GetConfigString("Misc", "DrugsFile", "", MAX_PATH);
if (!drugsFile.empty()) {
dlog("Applying drugs patch...", DL_INIT);
const char* iniDrugs = drugsFile.insert(0, ".\\").c_str();
if (iniGetInt("main", "JetWithdrawal", 0, iniDrugs) == 1) SafeWrite8(0x47A3A8, 0);
if (IniReader::iniGetInt("main", "JetWithdrawal", 0, iniDrugs) == 1) SafeWrite8(0x47A3A8, 0);
int count = iniGetInt("main", "Count", 0, iniDrugs);
int count = IniReader::iniGetInt("main", "Count", 0, iniDrugs);
if (count > 0) {
if (count > drugsMax) count = drugsMax;
drugs = new sDrugs[count]();
@@ -298,12 +298,12 @@ void Drugs::init() {
char section[4];
for (int i = 1; i <= count; i++) {
_itoa(i, section, 10);
int pid = iniGetInt(section, "PID", 0, iniDrugs);
int pid = IniReader::iniGetInt(section, "PID", 0, iniDrugs);
if (pid > 0) {
CheckEngineNumEffects(set, pid);
drugs[drugsCount].drugPid = pid;
drugs[drugsCount].addictTimeOff = drugs[drugsCount].iniAddictTimeOff = iniGetInt(section, "AddictTime", 0, iniDrugs);
long ef = iniGetInt(section, "NumEffects", -1, iniDrugs);
drugs[drugsCount].addictTimeOff = drugs[drugsCount].iniAddictTimeOff = IniReader::iniGetInt(section, "AddictTime", 0, iniDrugs);
long ef = IniReader::iniGetInt(section, "NumEffects", -1, iniDrugs);
if (set != -1) {
if (ef < -1) {
ef = -1;
@@ -317,12 +317,12 @@ void Drugs::init() {
drugs[drugsCount].numEffects = ef; // -1 to use the value from the engine
} else {
drugs[drugsCount].numEffects = drugs[drugsCount].iniNumEffects = max(0, ef);
int gvar = iniGetInt(section, "GvarID", 0, iniDrugs);
int gvar = IniReader::iniGetInt(section, "GvarID", 0, iniDrugs);
drugs[drugsCount].gvarID = max(0, gvar); // not allow negative values
if (gvar) {
int msg = iniGetInt(section, "TextID", -1, iniDrugs);
int msg = IniReader::iniGetInt(section, "TextID", -1, iniDrugs);
drugs[drugsCount].msgID = (msg > 0) ? msg : -1;
drugs[drugsCount].frmID = iniGetInt(section, "FrmID", -1, iniDrugs);
drugs[drugsCount].frmID = IniReader::iniGetInt(section, "FrmID", -1, iniDrugs);
addictionGvarCount++;
}
}
+8 -8
View File
@@ -116,23 +116,23 @@ static void LoadElevators(const char* elevFile) {
if (elevFile && GetFileAttributes(elevFile) != INVALID_FILE_ATTRIBUTES) {
for (int i = 0; i < elevatorCount; i++) {
_itoa_s(i, section, 10);
int type = iniGetInt(section, "Image", elevatorType[i], elevFile);
int type = IniReader::iniGetInt(section, "Image", elevatorType[i], elevFile);
elevatorType[i] = min(type, elevatorCount - 1);
if (i >= vanillaElevatorCount) {
int cBtn = iniGetInt(section, "ButtonCount", 2, elevFile);
int cBtn = IniReader::iniGetInt(section, "ButtonCount", 2, elevFile);
if (cBtn < 2) cBtn = 2;
elevatorsBtnCount[i] = min(cBtn, exitsPerElevator);
}
elevatorsFrms[i].main = iniGetInt(section, "MainFrm", elevatorsFrms[i].main, elevFile);
elevatorsFrms[i].buttons = iniGetInt(section, "ButtonsFrm", elevatorsFrms[i].buttons, elevFile);
elevatorsFrms[i].main = IniReader::iniGetInt(section, "MainFrm", elevatorsFrms[i].main, elevFile);
elevatorsFrms[i].buttons = IniReader::iniGetInt(section, "ButtonsFrm", elevatorsFrms[i].buttons, elevFile);
char setting[32];
for (int j = 0; j < exitsPerElevator; j++) {
sprintf(setting, "ID%d", j + 1);
elevatorExits[i][j].id = iniGetInt(section, setting, elevatorExits[i][j].id, elevFile);
elevatorExits[i][j].id = IniReader::iniGetInt(section, setting, elevatorExits[i][j].id, elevFile);
sprintf(setting, "Elevation%d", j + 1);
elevatorExits[i][j].elevation = iniGetInt(section, setting, elevatorExits[i][j].elevation, elevFile);
elevatorExits[i][j].elevation = IniReader::iniGetInt(section, setting, elevatorExits[i][j].elevation, elevFile);
sprintf(setting, "Tile%d", j + 1);
elevatorExits[i][j].tile = iniGetInt(section, setting, elevatorExits[i][j].tile, elevFile);
elevatorExits[i][j].tile = IniReader::iniGetInt(section, setting, elevatorExits[i][j].tile, elevFile);
}
}
}
@@ -159,7 +159,7 @@ static void ElevatorsInit() {
}
void Elevators::init() {
auto elevPath = GetConfigString("Misc", "ElevatorsFile", "", MAX_PATH);
auto elevPath = IniReader::GetConfigString("Misc", "ElevatorsFile", "", MAX_PATH);
if (!elevPath.empty()) {
dlog("Applying elevator patch.", DL_INIT);
ElevatorsInit();
+1 -1
View File
@@ -481,7 +481,7 @@ static void ResetExplosionDamage() {
void Explosions::init() {
MakeJump(0x411AB4, explosion_effect_hook); // required for explosions_metarule
lightingEnabled = GetConfigInt("Misc", "ExplosionsEmitLight", 0) != 0;
lightingEnabled = IniReader::GetConfigInt("Misc", "ExplosionsEmitLight", 0) != 0;
if (lightingEnabled) {
dlog("Applying Explosion changes.", DL_INIT);
MakeJump(0x4118E1, ranged_attack_lighting_fix);
+5 -5
View File
@@ -59,11 +59,11 @@ void LoadPageOffsets() {
sprintf_s(LoadPath, MAX_PATH, filename, fo::var::patches);
fo::var::slot_cursor = iniGetInt("POSITION", "ListNum", 0, LoadPath);
fo::var::slot_cursor = IniReader::iniGetInt("POSITION", "ListNum", 0, LoadPath);
if (fo::var::slot_cursor > 9) {
fo::var::slot_cursor = 0;
}
LSPageOffset = iniGetInt("POSITION", "PageOffset", 0, LoadPath);
LSPageOffset = IniReader::iniGetInt("POSITION", "PageOffset", 0, LoadPath);
if (LSPageOffset > 9990) {
LSPageOffset = 0;
}
@@ -483,20 +483,20 @@ static void __declspec(naked) SaveGame_hack1() {
}
void ExtraSaveSlots::init() {
bool extraSaveSlots = (GetConfigInt("Misc", "ExtraSaveSlots", 0) != 0);
bool extraSaveSlots = (IniReader::GetConfigInt("Misc", "ExtraSaveSlots", 0) != 0);
if (extraSaveSlots) {
dlog("Applying extra save slots patch.", DL_INIT);
EnableSuperSaving();
dlogr(" Done", DL_INIT);
}
autoQuickSave = GetConfigInt("Misc", "AutoQuickSave", 0);
autoQuickSave = IniReader::GetConfigInt("Misc", "AutoQuickSave", 0);
if (autoQuickSave > 0) {
dlog("Applying auto quick save patch.", DL_INIT);
if (autoQuickSave > 10) autoQuickSave = 10;
autoQuickSave--; // reserved slot count
quickSavePage = GetConfigInt("Misc", "AutoQuickSavePage", 0);
quickSavePage = IniReader::GetConfigInt("Misc", "AutoQuickSavePage", 0);
if (quickSavePage > 1000) quickSavePage = 1000;
if (extraSaveSlots && quickSavePage > 0) {

Some files were not shown because too many files have changed in this diff Show More