From cb9f759d7147f3c8c44a5a36e361480c5a076fe1 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Mon, 16 Dec 2019 15:31:50 +0800 Subject: [PATCH] Replaced _stricmp in previous commit with strcmp. Minor edits to some code. --- artifacts/scripting/hookscripts.txt | 4 ++-- sfall/Modules/Drugs.cpp | 2 +- sfall/Modules/Elevators.cpp | 6 +++--- sfall/Modules/HookScripts/CombatHs.cpp | 4 ++-- sfall/Modules/Inventory.cpp | 8 ++++---- sfall/Modules/LoadOrder.cpp | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/artifacts/scripting/hookscripts.txt b/artifacts/scripting/hookscripts.txt index 29c6b4ff..691fd1a9 100644 --- a/artifacts/scripting/hookscripts.txt +++ b/artifacts/scripting/hookscripts.txt @@ -653,10 +653,10 @@ int ret1 - pass -1 to cancel the execution of the handler (only for HOOK_STD HOOK_TARGETOBJECT (hs_targetobject.int) -Runs when the targeting cursor moves over an object, or when the player tries to attack the target object. +Runs when the targeting cursor hovers over an object, or when the player tries to attack the target object. You can override the target object or prevent the player from attacking the chosen target. -int arg1 - event type: 0 - when the cursor moves over the object, 1 - when trying to attack the target object +int arg1 - event type: 0 - when the cursor hovers over the object, 1 - when trying to attack the target object int arg2 - 1 when the target object is valid to attack, 0 otherwise Obj arg3 - the target object diff --git a/sfall/Modules/Drugs.cpp b/sfall/Modules/Drugs.cpp index 6b697448..088471e4 100644 --- a/sfall/Modules/Drugs.cpp +++ b/sfall/Modules/Drugs.cpp @@ -278,7 +278,7 @@ void Drugs::init() { int set = -1; char section[4]; for (int i = 1; i <= count; i++) { - _itoa_s(i, section, 10); + _itoa(i, section, 10); int pid = iniGetInt(section, "PID", 0, iniDrugs); if (pid > 0) { CheckEngineNumEffects(set, pid); diff --git a/sfall/Modules/Elevators.cpp b/sfall/Modules/Elevators.cpp index 7c210234..048ef0cc 100644 --- a/sfall/Modules/Elevators.cpp +++ b/sfall/Modules/Elevators.cpp @@ -127,11 +127,11 @@ static void LoadElevators(const char* elevFile) { elevatorsFrms[i].buttons = iniGetInt(section, "ButtonsFrm", elevatorsFrms[i].buttons, elevFile); char setting[32]; for (int j = 0; j < exitsPerElevator; j++) { - sprintf_s(setting, "ID%d", j + 1); + sprintf(setting, "ID%d", j + 1); elevatorExits[i][j].id = iniGetInt(section, setting, elevatorExits[i][j].id, elevFile); - sprintf_s(setting, "Elevation%d", j + 1); + sprintf(setting, "Elevation%d", j + 1); elevatorExits[i][j].elevation = iniGetInt(section, setting, elevatorExits[i][j].elevation, elevFile); - sprintf_s(setting, "Tile%d", j + 1); + sprintf(setting, "Tile%d", j + 1); elevatorExits[i][j].tile = iniGetInt(section, setting, elevatorExits[i][j].tile, elevFile); } } diff --git a/sfall/Modules/HookScripts/CombatHs.cpp b/sfall/Modules/HookScripts/CombatHs.cpp index c8e2c39a..fd2d3671 100644 --- a/sfall/Modules/HookScripts/CombatHs.cpp +++ b/sfall/Modules/HookScripts/CombatHs.cpp @@ -513,7 +513,7 @@ static long __fastcall TargetObjectHook(DWORD isValid, DWORD object, long type) static void __declspec(naked) gmouse_bk_process_hook() { __asm { push 0; // type - mov ecx, eax; // 1 - valid (object) or 0 - invalid + mov ecx, eax; // 1 - valid(object) or 0 - invalid mov edx, edi; // object under mouse call TargetObjectHook; mov edi, eax; @@ -524,7 +524,7 @@ static void __declspec(naked) gmouse_bk_process_hook() { static void __declspec(naked) gmouse_handle_event_hook() { __asm { push 1; // type - mov ecx, eax; // 1 - valid (object) or 0 - invalid + mov ecx, eax; // 1 - valid(object) or 0 - invalid cmp dword ptr ds:[targetRet], 0; je default; // override diff --git a/sfall/Modules/Inventory.cpp b/sfall/Modules/Inventory.cpp index 233852aa..02d805ef 100644 --- a/sfall/Modules/Inventory.cpp +++ b/sfall/Modules/Inventory.cpp @@ -33,12 +33,12 @@ static Delegate onAdjustFid; static DWORD sizeLimitMode; static DWORD invSizeMaxLimit; + static DWORD reloadWeaponKey = 0; static DWORD itemFastMoveKey = 0; static DWORD skipFromContainer = 0; void InventoryKeyPressedHook(DWORD dxKey, bool pressed) { - // TODO: move this out into a script if (pressed && reloadWeaponKey && dxKey == reloadWeaponKey && IsMapLoaded() && (GetLoopFlags() & ~(COMBAT | PCOMBAT)) == 0) { DWORD maxAmmo, curAmmo; fo::GameObject* item = fo::GetActiveItem(); @@ -282,13 +282,13 @@ static const char* _stdcall SizeInfoMessage(fo::GameObject* item) { if (size == 1) { const char* message = fo::MessageSearch(&fo::var::proto_main_msg_file, 543); if (message == nullptr) - strncpy_s(SizeMsgBuf, "It occupies 1 unit.", _TRUNCATE); + strcpy(SizeMsgBuf, "It occupies 1 unit."); else - _snprintf_s(SizeMsgBuf, _TRUNCATE, message, size); + strncpy_s(SizeMsgBuf, message, _TRUNCATE); } else { const char* message = fo::MessageSearch(&fo::var::proto_main_msg_file, 542); if (message == nullptr) - _snprintf_s(SizeMsgBuf, _TRUNCATE, "It occupies %d units.", size); + sprintf(SizeMsgBuf, "It occupies %d units.", size); else _snprintf_s(SizeMsgBuf, _TRUNCATE, message, size); } diff --git a/sfall/Modules/LoadOrder.cpp b/sfall/Modules/LoadOrder.cpp index ee6ee12e..4f51b262 100644 --- a/sfall/Modules/LoadOrder.cpp +++ b/sfall/Modules/LoadOrder.cpp @@ -184,7 +184,7 @@ static void __fastcall game_init_databases_hook1() { fo::PathNode* node = fo::var::paths; while (node->next) { - if (!_stricmp(node->path, masterPatch)) break; + if (!strcmp(node->path, masterPatch)) break; node = node->next; } fo::var::master_db_handle = node; // set pointer to master_patches node