diff --git a/artifacts/config_files/Perks.ini b/artifacts/config_files/Perks.ini index 207d4af6..326e2771 100644 --- a/artifacts/config_files/Perks.ini +++ b/artifacts/config_files/Perks.ini @@ -7,6 +7,26 @@ ; have an additional NoHardcode option in this file which can ; be used to remove their hardcoded effects, and add new stat/skill effects +[PerksTweak] +;Change the penalty distance and distance bonus for 'Weapon Scope Range' weapon perk +;0 - no penalty, 8 - default penalty +WeaponScopeRangePenalty=8 +;2 - no bonus, 5 - default bonus +WeaponScopeRangeBonus=5 + +;Changes the distance bonus for 'Weapon Long Range' weapon perk +;2 - no bonus, 4 - default bonus +WeaponLongRangeBonus=4 + +;Changes the hit chance bonus for 'Weapon Accurate' weapon perk +;0 - no bonus, 200 - maximum bonus, 20 - default bonus +WeaponAccurateBonus=20 + +;Changes the strength bonus for 'Weapon Handling' perk +;0 - no bonus, 10 - maximum bonus, 3 - default bonus +WeaponHandlingBonus=3 + +;############################################################################## ;Name=The name of the perk (max 63 characters) ;Desc=The description of the perk (max 255 characters) ;Image=The line number (0-indexed) of the corresponding FRM in skilldex.lst @@ -35,6 +55,7 @@ ;If the value is set to -99999, the variable will be ignored (similar to comment out that line) +;############################################################################## ;This is a modification to perk 119 [119] Name=Example diff --git a/sfall/BugFixes.cpp b/sfall/BugFixes.cpp index e47b71f9..4b1691bf 100644 --- a/sfall/BugFixes.cpp +++ b/sfall/BugFixes.cpp @@ -1415,15 +1415,15 @@ mapLeave: static void __declspec(naked) obj_move_to_tile_hack_seen() { __asm { cmp ds:[_loadingGame], 0; // loading saved game - jnz fix; + jnz end; // fix // if (map_state <= 0 && mapEntranceTileNum != -1) then fix cmp dword ptr ds:[_map_state], 0; // map number, -1 exit to worldmap jle skip; cmp dword ptr ds:[_mapEntranceTileNum], -1; - jne fix; + jne end; // fix skip: - or byte ptr ds:[_obj_seen][eax], dl; -fix: + or byte ptr ds:[_obj_seen][eax], dl; +end: retn; } } diff --git a/sfall/FalloutStructs.h b/sfall/FalloutStructs.h index 0f9a967f..cba742d6 100644 --- a/sfall/FalloutStructs.h +++ b/sfall/FalloutStructs.h @@ -59,7 +59,7 @@ struct TGameObj long itemCharges; long critterAP_weaponAmmoPid; char gap_44[16]; - long lastTarget; + long whoHitMe; char gap_58[12]; DWORD pid; long cid; diff --git a/sfall/Perks.cpp b/sfall/Perks.cpp index 5bed91f2..e427ce94 100644 --- a/sfall/Perks.cpp +++ b/sfall/Perks.cpp @@ -1175,5 +1175,27 @@ void PerksInit() { perksFile[0] = '.'; perksFile[1] = '\\'; HookCall(0x44272E, TraitInitWrapper); // game_init_ + + // Engine perks settings + long enginePerkMod = GetPrivateProfileIntA("PerksTweak", "WeaponScopeRangePenalty", -1, perksFile); + if (enginePerkMod >= 0 && enginePerkMod != 8) SafeWrite32(0x42448E, enginePerkMod); + enginePerkMod = GetPrivateProfileIntA("PerksTweak", "WeaponScopeRangeBonus", -1, perksFile); + if (enginePerkMod >= 2 && enginePerkMod != 5) SafeWrite32(0x424489, enginePerkMod); + + enginePerkMod = GetPrivateProfileIntA("PerksTweak", "WeaponLongRangeBonus", -1, perksFile); + if (enginePerkMod >= 2 && enginePerkMod != 4) SafeWrite32(0x424474, enginePerkMod); + + enginePerkMod = GetPrivateProfileIntA("PerksTweak", "WeaponAccurateBonus", -1, perksFile); + if (enginePerkMod >= 0 && enginePerkMod != 20) { + if (enginePerkMod > 200) enginePerkMod = 200; + SafeWrite8(0x42465D, static_cast(enginePerkMod)); + } + + enginePerkMod = GetPrivateProfileIntA("PerksTweak", "WeaponHandlingBonus", -1, perksFile); + if (enginePerkMod >= 0 && enginePerkMod != 3) { + if (enginePerkMod > 10) enginePerkMod = 10; + SafeWrite8(0x424636, static_cast(enginePerkMod)); + SafeWrite8(0x4251CE, static_cast(-enginePerkMod)); + } } } diff --git a/sfall/ScriptOps/ObjectsOps.hpp b/sfall/ScriptOps/ObjectsOps.hpp index bc2804db..d5ec8ec0 100644 --- a/sfall/ScriptOps/ObjectsOps.hpp +++ b/sfall/ScriptOps/ObjectsOps.hpp @@ -341,15 +341,14 @@ static TGameObj* __fastcall obj_blocking_at_wrapper(TGameObj* obj, DWORD tile, D } } -static DWORD _stdcall make_straight_path_func_wrapper(TGameObj* objFrom, DWORD tileFrom, void* rotationPtr, DWORD tileTo, DWORD* result, long flags, void* func) { +static void __fastcall make_straight_path_func_wrapper(TGameObj* objFrom, DWORD tileFrom, DWORD tileTo, void* rotationPtr, DWORD* result, long flags, void* func) { __asm { - mov eax, objFrom; - mov edx, tileFrom; - mov ecx, rotationPtr; - mov ebx, tileTo; push func; push flags; push result; + mov eax, ecx; + mov ebx, tileTo; + mov ecx, rotationPtr; call make_straight_path_func_; } } @@ -383,7 +382,7 @@ static void _stdcall op_make_straight_path2() { long flag = (type == BLOCKING_TYPE_SHOOT) ? 32 : 0; DWORD resultObj = 0; - make_straight_path_func_wrapper(objFrom, objFrom->tile, 0, tileTo, &resultObj, flag, (void*)getBlockingFunc(type)); + make_straight_path_func_wrapper(objFrom, objFrom->tile, tileTo, 0, &resultObj, flag, (void*)getBlockingFunc(type)); opHandler.setReturn(resultObj, DATATYPE_INT); } diff --git a/sfall/ddraw.vcxproj b/sfall/ddraw.vcxproj index 66b6c57d..7057c377 100644 --- a/sfall/ddraw.vcxproj +++ b/sfall/ddraw.vcxproj @@ -81,6 +81,12 @@ true true false + $(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + $(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) + $(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir) + $(DXSDK_DIR)Lib\x86;$(LibraryPath) diff --git a/sfall/main.cpp b/sfall/main.cpp index ac481549..fcf0aebf 100644 --- a/sfall/main.cpp +++ b/sfall/main.cpp @@ -477,8 +477,8 @@ end: } static DWORD KarmaFrmCount; -static DWORD* KarmaFrms; -static int* KarmaPoints; +static DWORD* KarmaFrms = nullptr; +static int* KarmaPoints = nullptr; static DWORD _stdcall DrawCard() { int rep = **(int**)_game_global_vars; for (DWORD i = 0; i < KarmaFrmCount - 1; i++) { @@ -1180,6 +1180,10 @@ static void _stdcall OnExit() { if (scriptDialog != nullptr) { delete[] scriptDialog; } + if (KarmaFrmCount) { + delete[] KarmaFrms; + delete[] KarmaPoints; + } SpeedPatchExit(); ClearReadExtraGameMsgFiles(); ReputationsExit();