diff --git a/artifacts/scripting/hookscripts.txt b/artifacts/scripting/hookscripts.txt index 923f0326..6cf7a176 100644 --- a/artifacts/scripting/hookscripts.txt +++ b/artifacts/scripting/hookscripts.txt @@ -421,7 +421,7 @@ What you can do: - add AP costs for all inventory movement including reloading - apply or remove some special scripted effects depending on PC's armor -int arg1 - Target slot (0 - main backpack, 1 - left hand, 2 - right hand, 3 - armor slot, 4 - weapon, when reloading it by dropping ammo, 5 - container, like bag/backpack, 6 - dropping on the ground, 7 - picking up item) +int arg1 - Target slot (0 - main backpack, 1 - left hand, 2 - right hand, 3 - armor slot, 4 - weapon, when reloading it by dropping ammo, 5 - container, like bag/backpack, 6 - dropping on the ground, 7 - picking up item, 8 - dropping item on the character portrait) Item arg2 - Item being moved Item arg3 - Item being replaced, weapon being reloaded, or container being filled (can be 0) diff --git a/sfall/Modules/Combat.cpp b/sfall/Modules/Combat.cpp index 24e22fa6..64f1141d 100644 --- a/sfall/Modules/Combat.cpp +++ b/sfall/Modules/Combat.cpp @@ -57,7 +57,7 @@ static DWORD __fastcall add_check_for_item_ammo_cost(register fo::GameObject* we rounds = fo::func::item_w_rounds(weapon); // ammo in burst } if (HookScripts::IsInjectHook(HOOK_AMMOCOST)) { - AmmoCostHook_Script(1, weapon, &rounds); // get rounds cost from hook + AmmoCostHook_Script(1, weapon, rounds); // get rounds cost from hook } else if (rounds == 1) { fo::func::item_w_compute_ammo_cost(weapon, &rounds); } @@ -125,7 +125,7 @@ static DWORD __fastcall divide_burst_rounds_by_ammo_cost(fo::GameObject* weapon, if (HookScripts::IsInjectHook(HOOK_AMMOCOST)) { rounds = burstRounds; // rounds in burst - AmmoCostHook_Script(2, weapon, &rounds); + AmmoCostHook_Script(2, weapon, rounds); } DWORD cost = burstRounds * rounds; // so much ammo is required for this burst diff --git a/sfall/Modules/DamageMod.cpp b/sfall/Modules/DamageMod.cpp index 953399dd..2eb383ad 100644 --- a/sfall/Modules/DamageMod.cpp +++ b/sfall/Modules/DamageMod.cpp @@ -32,7 +32,7 @@ int DamageMod::formula; // Damage Fix v5 (with v5.1 Damage Multiplier tweak) by Glovz 2014.04.16.xx.xx // TODO: rewrite in C++ -void DamageMod::DamageGlovz(fo::ComputeAttackResult &ctd, DWORD* accumulatedDamage, int rounds, int armorDT, int armorDR, int bonusRangedDamage, int multiplyDamage, int difficulty) { +void DamageMod::DamageGlovz(fo::ComputeAttackResult &ctd, DWORD &accumulatedDamage, int rounds, int armorDT, int armorDR, int bonusRangedDamage, int multiplyDamage, int difficulty) { if (rounds <= 0) return; int ammoY = fo::func::item_w_dam_div(ctd.weapon); // ammoY value (divisor) @@ -231,7 +231,7 @@ noDamageJmp: } // YAAM -void DamageMod::DamageYAAM(fo::ComputeAttackResult &ctd, DWORD* accumulatedDamage, int rounds, int armorDT, int armorDR, int bonusRangedDamage,int multiplyDamage, int difficulty) { +void DamageMod::DamageYAAM(fo::ComputeAttackResult &ctd, DWORD &accumulatedDamage, int rounds, int armorDT, int armorDR, int bonusRangedDamage,int multiplyDamage, int difficulty) { int ammoDiv = fo::func::item_w_dam_div(ctd.weapon); // Retrieve Ammo Divisor int ammoMult = fo::func::item_w_dam_mult(ctd.weapon); // Retrieve Ammo Dividend @@ -277,7 +277,7 @@ void DamageMod::DamageYAAM(fo::ComputeAttackResult &ctd, DWORD* accumulatedDamag resistedDamage /= 100; // Resisted Damage = Resisted Damage / 100 rawDamage -= resistedDamage; // Raw Damage = Raw Damage - Resisted Damage - if (rawDamage > 0) *accumulatedDamage += rawDamage; // Accumulated Damage = Accumulated Damage + Raw Damage + if (rawDamage > 0) accumulatedDamage += rawDamage; // Accumulated Damage = Accumulated Damage + Raw Damage } } //////////////////////////////////////////////////////////////////////////////// diff --git a/sfall/Modules/DamageMod.h b/sfall/Modules/DamageMod.h index 1589a397..91d8ec26 100644 --- a/sfall/Modules/DamageMod.h +++ b/sfall/Modules/DamageMod.h @@ -29,8 +29,8 @@ public: void init(); static int formula; - static void DamageGlovz(fo::ComputeAttackResult &ctd, DWORD* accumulatedDamage, int rounds, int armorDT, int armorDR, int bonusRangedDamage, int multiplyDamage, int difficulty); - static void DamageYAAM(fo::ComputeAttackResult &ctd, DWORD* accumulatedDamage, int rounds, int armorDT, int armorDR, int bonusRangedDamage,int multiplyDamage, int difficulty); + static void DamageGlovz(fo::ComputeAttackResult &ctd, DWORD &accumulatedDamage, int rounds, int armorDT, int armorDR, int bonusRangedDamage, int multiplyDamage, int difficulty); + static void DamageYAAM(fo::ComputeAttackResult &ctd, DWORD &accumulatedDamage, int rounds, int armorDT, int armorDR, int bonusRangedDamage,int multiplyDamage, int difficulty); }; } diff --git a/sfall/Modules/HookScripts.h b/sfall/Modules/HookScripts.h index 61485585..f36c3b85 100644 --- a/sfall/Modules/HookScripts.h +++ b/sfall/Modules/HookScripts.h @@ -98,7 +98,7 @@ void HookScriptClear(); void LoadHookScripts(); extern DWORD initingHookScripts; -extern int __fastcall AmmoCostHook_Script(DWORD hookType, fo::GameObject* weapon, DWORD* rounds); +extern int __fastcall AmmoCostHook_Script(DWORD hookType, fo::GameObject* weapon, DWORD &rounds); void _stdcall RunHookScriptsAtProc(DWORD procId); } diff --git a/sfall/Modules/HookScripts/CombatHs.cpp b/sfall/Modules/HookScripts/CombatHs.cpp index 7ca4d8d3..7013ee60 100644 --- a/sfall/Modules/HookScripts/CombatHs.cpp +++ b/sfall/Modules/HookScripts/CombatHs.cpp @@ -178,7 +178,7 @@ static void __declspec(naked) ComputeDamageHook() { } } -static void __fastcall SubComputeDamageHook_Script(fo::ComputeAttackResult &ctd, DWORD armorDR, DWORD* accumulatedDamage, DWORD armorDT, DWORD bonusRangedDamage, DWORD rounds, DWORD multiplyDamage, DWORD difficulty) { +static void __fastcall SubComputeDamageHook_Script(fo::ComputeAttackResult &ctd, DWORD armorDR, DWORD &accumulatedDamage, DWORD armorDT, DWORD bonusRangedDamage, DWORD rounds, DWORD multiplyDamage, DWORD difficulty) { // calculated internal ammo mod damage switch (DamageMod::formula) { case 1: @@ -203,12 +203,12 @@ static void __fastcall SubComputeDamageHook_Script(fo::ComputeAttackResult &ctd, args[7] = bonusRangedDamage; args[8] = multiplyDamage; args[9] = difficulty; - args[10] = *accumulatedDamage; + args[10] = accumulatedDamage; args[11] = (DWORD)&ctd; RunHookScript(HOOK_SUBCOMBATDAMAGE); - if (cRet == 1) *accumulatedDamage = rets[0]; + if (cRet == 1) accumulatedDamage = rets[0]; EndHook(); } @@ -295,27 +295,27 @@ static void __declspec(naked) ItemDamageHook() { _asm jmp fo::funcoffs::roll_random_; } -int __fastcall AmmoCostHook_Script(DWORD hookType, fo::GameObject* weapon, DWORD* rounds) { +int __fastcall AmmoCostHook_Script(DWORD hookType, fo::GameObject* weapon, DWORD &rounds) { int result = 0; BeginHook(); argCount = 4; args[0] = (DWORD)weapon; - args[1] = *rounds; // rounds in attack + args[1] = rounds; // rounds in attack args[3] = hookType; if (hookType == 2) { // burst hook - *rounds = 1; // set default multiply for check burst attack + rounds = 1; // set default multiply for check burst attack } else { - result = fo::func::item_w_compute_ammo_cost(weapon, rounds); + result = fo::func::item_w_compute_ammo_cost(weapon, &rounds); if (result == -1) goto failed; // failed computed } - args[2] = *rounds; // rounds as computed by game (cost) + args[2] = rounds; // rounds as computed by game (cost) RunHookScript(HOOK_AMMOCOST); - if (cRet > 0) *rounds = rets[0]; // override rounds + if (cRet > 0) rounds = rets[0]; // override rounds failed: EndHook(); diff --git a/sfall/Modules/HookScripts/InventoryHs.cpp b/sfall/Modules/HookScripts/InventoryHs.cpp index 2142f861..18be7a3b 100644 --- a/sfall/Modules/HookScripts/InventoryHs.cpp +++ b/sfall/Modules/HookScripts/InventoryHs.cpp @@ -64,23 +64,6 @@ static void __declspec(naked) MoveCostHook() { } } -/* Common inventory move hook */ -static int __fastcall InventoryMoveHook_Script(DWORD itemReplace, DWORD item, int type) { - BeginHook(); - argCount = 3; - - args[0] = type; // event type - args[1] = item; // item being dropped - args[2] = itemReplace; // item being replaced here - - RunHookScript(HOOK_INVENTORYMOVE); - - int result = (cRet > 0) ? rets[0] : -1; - EndHook(); - - return result; -} - static int __fastcall SwitchHandHook_Script(fo::GameObject* item, fo::GameObject* itemReplaced, DWORD addr) { if (itemReplaced && fo::GetItemType(itemReplaced) == fo::item_type_weapon && fo::GetItemType(item) == fo::item_type_ammo) { return -1; // to prevent inappropriate hook call after dropping ammo on weapon @@ -111,21 +94,38 @@ static int __fastcall SwitchHandHook_Script(fo::GameObject* item, fo::GameObject */ static void _declspec(naked) SwitchHandHook() { __asm { - pushad; + pushadc; mov ecx, eax; // item being moved mov edx, [edx]; // other item - mov eax, [esp + 32]; // back address + mov eax, [esp + 12]; // back address push eax; call SwitchHandHook_Script; cmp eax, -1; // ret value - popad; + popadc; jne skip; - call fo::funcoffs::switch_hand_; + jmp fo::funcoffs::switch_hand_; skip: retn; } } +/* Common inventory move hook */ +static int __fastcall InventoryMoveHook_Script(DWORD itemReplace, DWORD item, int type) { + BeginHook(); + argCount = 3; + + args[0] = type; // event type + args[1] = item; // item being dropped + args[2] = itemReplace; // item being replaced here + + RunHookScript(HOOK_INVENTORYMOVE); + + int result = (cRet > 0) ? rets[0] : -1; + EndHook(); + + return result; +} + static const DWORD UseArmorHack_back = 0x4713AF; // normal operation (old 0x4713A9) static const DWORD UseArmorHack_skip = 0x471481; // skip code, prevent wearing armor // This hack is called when an armor is dropped into the armor slot at inventory screen @@ -133,34 +133,34 @@ static void _declspec(naked) UseArmorHack() { __asm { mov ecx, ds:[FO_VAR_i_worn]; // replacement item (override code) mov edx, [esp + 0x58 - 0x40]; // item - pushad; + push ecx; push 3; // event: armor slot - call InventoryMoveHook_Script; + call InventoryMoveHook_Script; // ecx - replacement item cmp eax, -1; // ret value - popad; - jne skip; - jmp UseArmorHack_back; + pop ecx; + jne skip; + jmp UseArmorHack_back; skip: - jmp UseArmorHack_skip; + jmp UseArmorHack_skip; } } static void _declspec(naked) MoveInventoryHook() { __asm { - pushad; - xor ecx, ecx; // no item replace - mov ebx, ecx; + pushadc; + xor eax, eax; + mov ecx, eax; // no item replace cmp dword ptr ds:[FO_VAR_curr_stack], 0; jle noCont; mov ecx, eax; // contaner ptr - mov ebx, 5; + mov eax, 5; noCont: - push ebx; // event: 0 - main backpack, 5 - contaner + push eax; // event: 0 - main backpack, 5 - contaner call InventoryMoveHook_Script; // edx - item cmp eax, -1; // ret value - popad; + popadc; jne skip; - call fo::funcoffs::item_add_force_; + jmp fo::funcoffs::item_add_force_; skip: retn; } @@ -307,6 +307,27 @@ runHook: } } +static void __declspec(naked) InvenPickupHook() { + __asm { + call fo::funcoffs::mouse_click_in_; + test eax, eax; + jnz runHook; + retn; +runHook: + cmp dword ptr ds:[FO_VAR_curr_stack], 0; + jnz skip; + mov edx, [esp + 0x58 - 0x40 + 4]; // item + xor ecx, ecx; // no itemReplace + push 8; // event: drop item on character portrait + call InventoryMoveHook_Script; + cmp eax, -1; // ret value + je skip; + xor eax, eax; // 0 - cancel, otherwise engine handler +skip: + retn; + } +} + /* Common InvenWield hook */ static bool InvenWieldHook_Script(int flag) { argCount = 4; @@ -453,6 +474,8 @@ void Inject_InventoryMoveHook() { SafeWrite32(0x49B665, 0x850FD285); // test edx, edx SafeWrite32(0x49B669, 0xC2); // jnz 0x49B72F SafeWrite8(0x49B66E, 0xFE); // cmp edi > cmp esi + + HookCall(0x471457, InvenPickupHook); } void Inject_InvenWieldHook() { diff --git a/sfall/Modules/HookScripts/MiscHs.cpp b/sfall/Modules/HookScripts/MiscHs.cpp index 8b7c964c..c1398c55 100644 --- a/sfall/Modules/HookScripts/MiscHs.cpp +++ b/sfall/Modules/HookScripts/MiscHs.cpp @@ -474,13 +474,13 @@ skip: } } -static int __fastcall ExplosiveTimerHook_Script(DWORD* type, DWORD item, DWORD time) { +static int __fastcall ExplosiveTimerHook_Script(DWORD &type, DWORD item, DWORD time) { BeginHook(); argCount = 3; args[0] = time; args[1] = item; - args[2] = (*type == 11) ? fo::ROLL_FAILURE : fo::ROLL_SUCCESS; + args[2] = (type == 11) ? fo::ROLL_FAILURE : fo::ROLL_SUCCESS; RunHookScript(HOOK_EXPLOSIVETIMER); @@ -490,7 +490,7 @@ static int __fastcall ExplosiveTimerHook_Script(DWORD* type, DWORD item, DWORD t if (cRet > 1) { int typeRet = rets[1]; if (typeRet >= fo::ROLL_CRITICAL_FAILURE && typeRet <= fo::ROLL_CRITICAL_SUCCESS) { - *type = (typeRet > fo::ROLL_FAILURE) ? 8 : 11; // returned new type (8 = SUCCESS, 11 = FAILURE) + type = (typeRet > fo::ROLL_FAILURE) ? 8 : 11; // returned new type (8 = SUCCESS, 11 = FAILURE) } } } diff --git a/sfall/Modules/HookScripts/ObjectHs.cpp b/sfall/Modules/HookScripts/ObjectHs.cpp index 62268cec..5e3727c0 100644 --- a/sfall/Modules/HookScripts/ObjectHs.cpp +++ b/sfall/Modules/HookScripts/ObjectHs.cpp @@ -169,24 +169,24 @@ skip: } } -static bool __fastcall SetLightingHook_Script(DWORD* intensity, DWORD* radius, DWORD object) { +static bool __fastcall SetLightingHook_Script(DWORD &intensity, DWORD &radius, DWORD object) { BeginHook(); argCount = 3; args[0] = object; - args[1] = *intensity; - args[2] = *radius; + args[1] = intensity; + args[2] = radius; RunHookScript(HOOK_SETLIGHTING); bool result = false; if (cRet > 0) { int light = rets[0]; if (light < 0) light = 0; - *intensity = light; + intensity = light; if (cRet > 1 && object != -1) { int dist = rets[1]; if (dist < 0) dist = 0; - *radius = dist; + radius = dist; } result = true; } diff --git a/sfall/Modules/Inventory.cpp b/sfall/Modules/Inventory.cpp index 5666dbae..ea819e1b 100644 --- a/sfall/Modules/Inventory.cpp +++ b/sfall/Modules/Inventory.cpp @@ -748,7 +748,7 @@ void Inventory::init() { BlockCall(0x4768A3); // mov ebx, 1 } - // Move items out of bag/backpack and back into the main inventory list by dragging them to character's image (similar to Fallout 1 behavior) + // Move items from bag/backpack to the main inventory list by dragging them on the character portrait (similar to Fallout 1 behavior) MakeCall(0x471452, inven_pickup_hack); // Move items to player's main inventory instead of the opened bag/backpack when confirming a trade diff --git a/sfall/Modules/MiscPatches.cpp b/sfall/Modules/MiscPatches.cpp index e1ebc99d..83209493 100644 --- a/sfall/Modules/MiscPatches.cpp +++ b/sfall/Modules/MiscPatches.cpp @@ -59,50 +59,14 @@ static const DWORD walkDistanceAddr[] = { 0x411FF0, 0x4121C4, 0x412475, 0x412906, }; -static void __declspec(naked) Combat_p_procFix() { +static void __declspec(naked) apply_damage_hack() { __asm { - push eax; - - mov eax, dword ptr ds:[FO_VAR_combat_state]; - cmp eax, 3; - jnz end_cppf; - - push esi; - push ebx; - push edx; - - mov esi, FO_VAR_main_ctd; - mov eax, [esi]; - mov ebx, [esi + 0x20]; - xor edx, edx; - mov eax, [eax + 0x78]; - call fo::funcoffs::scr_set_objs_; - mov eax, [esi]; - - cmp dword ptr ds:[esi + 0x2c], +0x0; - jng jmp1; - - test byte ptr ds:[esi + 0x15], 0x1; - jz jmp1; - mov edx, 0x2; - jmp jmp2; -jmp1: - mov edx, 0x1; -jmp2: - mov eax, [eax + 0x78]; - call fo::funcoffs::scr_set_ext_param_; - mov eax, [esi]; - mov edx, 0xd; - mov eax, [eax + 0x78]; - call fo::funcoffs::exec_script_proc_; - pop edx; - pop ebx; - pop esi; - -end_cppf: - pop eax; - call fo::funcoffs::stat_level_; - + xor edx, edx; + inc edx; // COMBAT_SUBTYPE_WEAPON_USED + test [esi + 0x15], dl; // ctd.flags2Source & DAM_HIT_ + jz end; // no hit + inc edx; // COMBAT_SUBTYPE_HIT_SUCCEEDED +end: retn; } } @@ -110,9 +74,9 @@ end_cppf: static void __declspec(naked) WeaponAnimHook() { __asm { cmp edx, 11; - je c11; + je c11; cmp edx, 15; - je c15; + je c15; jmp fo::funcoffs::art_get_code_; c11: mov edx, 16; @@ -609,10 +573,9 @@ void DontTurnOffSneakIfYouRunPatch() { void CombatProcFix() { //Ray's combat_p_proc fix - dlog("Applying combat_p_proc fix.", DL_INIT); - HookCall(0x425252, Combat_p_procFix); - SafeWrite8(0x424DBC, 0xE9); - SafeWrite32(0x424DBD, 0x00000034); + dlog("Applying Ray's combat_p_proc patch.", DL_INIT); + MakeCall(0x424DD9, apply_damage_hack); + SafeWrite8(0x424DC7, 0x0); dlogr(" Done", DL_INIT); } diff --git a/sfall/Modules/Scripting/Handlers/Misc.cpp b/sfall/Modules/Scripting/Handlers/Misc.cpp index 154129d0..9663bedc 100644 --- a/sfall/Modules/Scripting/Handlers/Misc.cpp +++ b/sfall/Modules/Scripting/Handlers/Misc.cpp @@ -543,106 +543,30 @@ static int ParseIniSetting(const char* iniString, const char* &key, char section return 1; } -static char IniStrBuffer[128]; -static DWORD _stdcall GetIniSetting2(const char* c, DWORD string) { +static char IniStrBuffer[256]; +static DWORD GetIniSetting(const char* str, bool isString) { const char* key; char section[33], file[67]; - if (ParseIniSetting(c, key, section, file) < 0) { + if (ParseIniSetting(str, key, section, file) < 0) { return -1; } - if (string) { + if (isString) { IniStrBuffer[0] = 0; - GetPrivateProfileStringA(section, key, "", IniStrBuffer, 128, file); + GetPrivateProfileStringA(section, key, "", IniStrBuffer, 256, file); return (DWORD)&IniStrBuffer[0]; } else { return GetPrivateProfileIntA(section, key, -1, file); } } -void __declspec(naked) op_get_ini_setting() { - __asm { - push ebx; - push ecx; - push edx; - push edi; - mov edi, eax; - call fo::funcoffs::interpretPopShort_; - mov edx, eax; - mov eax, edi; - call fo::funcoffs::interpretPopLong_; - cmp dx, VAR_TYPE_STR2; - jz next; - cmp dx, VAR_TYPE_STR; - jnz error; -next: - mov ebx, eax; - mov eax, edi; - call fo::funcoffs::interpretGetString_; - push 0; - push eax; - call GetIniSetting2; - mov edx, eax; - jmp result; -error: - mov edx, -1; -result: - mov eax, edi; - call fo::funcoffs::interpretPushLong_; - mov edx, VAR_TYPE_INT; - mov eax, edi; - call fo::funcoffs::interpretPushShort_; - pop edi; - pop edx; - pop ecx; - pop ebx; - retn; - } +void sf_get_ini_setting(OpcodeContext& ctx) { + ctx.setReturn(GetIniSetting(ctx.arg(0).strValue(), false)); } -void __declspec(naked) op_get_ini_string() { - __asm { - push ebx; - push ecx; - push edx; - push edi; - mov edi, eax; - call fo::funcoffs::interpretPopShort_; - mov edx, eax; - mov eax, edi; - call fo::funcoffs::interpretPopLong_; - cmp dx, VAR_TYPE_STR2; - jz next; - cmp dx, VAR_TYPE_STR; - jnz error; -next: - mov ebx, eax; - mov eax, edi; - call fo::funcoffs::interpretGetString_; - push 1; - push eax; - call GetIniSetting2; - mov edx, eax; - mov eax, edi; - call fo::funcoffs::interpretAddString_; - mov edx, eax; - mov ebx, VAR_TYPE_STR; - jmp result; -error: - xor edx, edx; - mov ebx, VAR_TYPE_INT -result: - mov eax, edi; - call fo::funcoffs::interpretPushLong_; - mov edx, ebx; - mov eax, edi; - call fo::funcoffs::interpretPushShort_; - pop edi; - pop edx; - pop ecx; - pop ebx; - retn; - } +void sf_get_ini_string(OpcodeContext& ctx) { + DWORD result = GetIniSetting(ctx.arg(0).strValue(), true); + ctx.setReturn(result, (result != -1) ? DataType::STR : DataType::INT); } void __declspec(naked) op_get_uptime() { @@ -1326,20 +1250,20 @@ void sf_exec_map_update_scripts(OpcodeContext& ctx) { } void sf_set_ini_setting(OpcodeContext& ctx) { - const char* iniString = ctx.arg(0).asString(); const ScriptValue &argVal = ctx.arg(1); + const char* saveValue; if (argVal.isInt()) { _itoa_s(argVal.rawValue(), IniStrBuffer, 10); + saveValue = IniStrBuffer; } else { - strcpy_s(IniStrBuffer, argVal.asString()); + saveValue = argVal.strValue(); } - const char* key; char section[33], file[67]; - int result = ParseIniSetting(iniString, key, section, file); + int result = ParseIniSetting(ctx.arg(0).strValue(), key, section, file); if (result > 0) { - result = WritePrivateProfileString(section, key, IniStrBuffer, file); + result = WritePrivateProfileString(section, key, saveValue, file); } switch (result) { diff --git a/sfall/Modules/Scripting/Handlers/Misc.h b/sfall/Modules/Scripting/Handlers/Misc.h index 799ca360..5a29beff 100644 --- a/sfall/Modules/Scripting/Handlers/Misc.h +++ b/sfall/Modules/Scripting/Handlers/Misc.h @@ -66,9 +66,9 @@ void sf_inc_npc_level(OpcodeContext&); void sf_get_npc_level(OpcodeContext&); -void __declspec() op_get_ini_setting(); +void sf_get_ini_setting(OpcodeContext&); -void __declspec() op_get_ini_string(); +void sf_get_ini_string(OpcodeContext&); void __declspec() op_get_uptime(); diff --git a/sfall/Modules/Scripting/Opcodes.cpp b/sfall/Modules/Scripting/Opcodes.cpp index 10cae0bd..22694036 100644 --- a/sfall/Modules/Scripting/Opcodes.cpp +++ b/sfall/Modules/Scripting/Opcodes.cpp @@ -84,6 +84,7 @@ static SfallOpcodeInfo opcodeInfoArray[] = { {0x19e, "get_sfall_global_int", sf_get_sfall_global_int, 1, true, {ARG_INTSTR}}, {0x19f, "get_sfall_global_float", sf_get_sfall_global_float, 1, true, {ARG_INTSTR}}, {0x1a5, "inc_npc_level", sf_inc_npc_level, 1, false, {ARG_INTSTR}}, + {0x1ac, "get_ini_setting", sf_get_ini_setting, 1, true, {ARG_STRING}}, {0x1c1, "has_fake_perk", sf_has_fake_perk, 1, true, {ARG_INTSTR}}, @@ -93,6 +94,7 @@ static SfallOpcodeInfo opcodeInfoArray[] = { {0x1e1, "set_critical_table", sf_set_critical_table, 5, false, {ARG_INT, ARG_INT, ARG_INT, ARG_INT, ARG_INT}}, {0x1e2, "get_critical_table", sf_get_critical_table, 4, true, {ARG_INT, ARG_INT, ARG_INT, ARG_INT}}, {0x1e3, "reset_critical_table", sf_reset_critical_table, 4, false, {ARG_INT, ARG_INT, ARG_INT, ARG_INT}}, + {0x1eb, "get_ini_string", sf_get_ini_string, 1, true, {ARG_STRING}}, {0x1ec, "sqrt", sf_sqrt, 1, true, {ARG_NUMBER}}, {0x1ed, "abs", sf_abs, 1, true, {ARG_NUMBER}}, {0x1ee, "sin", sf_sin, 1, true, {ARG_NUMBER}}, @@ -314,7 +316,6 @@ void InitNewOpcodes() { opcodes[0x1a9] = op_set_viewport_y; opcodes[0x1aa] = op_set_xp_mod; opcodes[0x1ab] = op_set_perk_level_mod; - opcodes[0x1ac] = op_get_ini_setting; opcodes[0x1ad] = op_get_shader_version; opcodes[0x1ae] = op_set_shader_mode; opcodes[0x1af] = op_get_game_mode; @@ -365,7 +366,6 @@ void InitNewOpcodes() { opcodes[0x1e8] = op_set_unspent_ap_perk_bonus; opcodes[0x1e9] = op_get_unspent_ap_perk_bonus; opcodes[0x1ea] = op_init_hook; - opcodes[0x1eb] = op_get_ini_string; opcodes[0x1f2] = op_set_palette; opcodes[0x1f3] = op_remove_script; opcodes[0x1f4] = op_set_script;