mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed the previous commit (conflict with INVENWIELD hook)
Moved some option codes from MiscPatches.cpp to other modules. Removed CorpseLineOfFireFix from ddraw.ini (always enabled).
This commit is contained in:
@@ -384,9 +384,6 @@ AlwaysReloadMsgs=0
|
||||
;Set to 1 to force the player to play the idle animation when reloading their weapon
|
||||
PlayIdleAnimOnReload=0
|
||||
|
||||
;Set to 1 to prevent corpses from blocking line of fire
|
||||
CorpseLineOfFireFix=1
|
||||
|
||||
;Changes the timer (in days) for deleting corpses on a map after you leave (valid range: 0..13)
|
||||
;The corpses of critters with 'Ages' flag or on maps with 'dead_bodies_age=No' set in maps.txt will not disappear
|
||||
;Default is 6. Set to 0 for a 12-hour timer
|
||||
|
||||
@@ -61,6 +61,8 @@ static std::vector<HackPair> hackAddr = {
|
||||
// module: ExtraSave
|
||||
//{0x47B923, 6},
|
||||
// module: Inventory
|
||||
// module: Interface
|
||||
{0x460BB6, 4},
|
||||
// module: LoadOrder
|
||||
{0x43FA9F, 4}, {0x44EB5B, 4}, {0x48152E, 4},
|
||||
//{0x480A95, 5}, (it in movies.cpp)
|
||||
@@ -105,7 +107,7 @@ static std::vector<HackPair> hackAddr = {
|
||||
{0x4C2D9B, 4}, {0x499FDE, 4},
|
||||
{0x49952C, 1}, {0x497557, 1}, {0x42E587, 1}, {0x42E588, 4}, {0x499FD4, 2}, {0x499E93, 2},
|
||||
// module: MiscPatches
|
||||
{0x460BB6, 4}, {0x41276A, 1}, {0x480AAA, 4}, {0x444BA5, 4}, {0x444BCA, 4},
|
||||
{0x41276A, 1}, {0x480AAA, 4}, {0x444BA5, 4}, {0x444BCA, 4},
|
||||
};
|
||||
|
||||
//static std::vector<long> jumpAddr = {
|
||||
|
||||
@@ -387,6 +387,15 @@ static void __declspec(naked) queue_clear_type_mem_free_hook() {
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) partyMemberCopyLevelInfo_hack() {
|
||||
__asm {
|
||||
mov eax, esi; // source
|
||||
xor ecx, ecx; // animation
|
||||
mov ebx, 1; // right slot
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) partyMemberCopyLevelInfo_hook_stat_level() {
|
||||
__asm {
|
||||
nextArmor:
|
||||
@@ -2415,10 +2424,41 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) partyMemberCopyLevelInfo_hook_wield() {
|
||||
static const DWORD CorpseShotBlockFix_continue_loop[] = {0x48B99B, 0x48BA0B};
|
||||
static void __declspec(naked) obj_shoot_blocking_at_hack0() {
|
||||
__asm {
|
||||
inc ebx; // slot
|
||||
jmp fo::funcoffs::invenWieldFunc_;
|
||||
mov edx, eax;
|
||||
mov eax, [eax];
|
||||
call fo::funcoffs::critter_is_dead_; // found some object, check if it's a dead critter
|
||||
test eax, eax;
|
||||
jz endLoop; // if not, allow breaking the loop (will return this object)
|
||||
mov eax, edx;
|
||||
jmp CorpseShotBlockFix_continue_loop[0]; // otherwise continue searching
|
||||
endLoop:
|
||||
mov eax, [edx];
|
||||
pop ebp;
|
||||
pop edi;
|
||||
pop esi;
|
||||
pop ecx;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
// same logic as above, for different loop
|
||||
static void __declspec(naked) obj_shoot_blocking_at_hack1() {
|
||||
__asm {
|
||||
mov eax, [edx];
|
||||
call fo::funcoffs::critter_is_dead_;
|
||||
test eax, eax;
|
||||
jz endLoop;
|
||||
jmp CorpseShotBlockFix_continue_loop[1];
|
||||
endLoop:
|
||||
mov eax, [edx];
|
||||
pop ebp;
|
||||
pop edi;
|
||||
pop esi;
|
||||
pop ecx;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3052,8 +3092,16 @@ void BugFixes::init()
|
||||
HookCall(0x458CDB, op_critter_rm_trait_hook);
|
||||
HookCall(0x458B3D, op_critter_add_trait_hook);
|
||||
|
||||
// Fix to prevent corpses from blocking line of fire
|
||||
//if (GetConfigInt("Misc", "CorpseLineOfFireFix", 1)) {
|
||||
dlog("Applying fix for corpses blocking line of fire.", DL_INIT);
|
||||
MakeJump(0x48B994, obj_shoot_blocking_at_hack0);
|
||||
MakeJump(0x48BA04, obj_shoot_blocking_at_hack1);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
// Fix for party member's equipped weapon being placed in the incorrect item slot after leveling up
|
||||
HookCall(0x495FDF, partyMemberCopyLevelInfo_hook_wield);
|
||||
MakeCall(0x495FD9, partyMemberCopyLevelInfo_hack, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ static void __declspec(naked) win_debug_hook() {
|
||||
}
|
||||
}
|
||||
|
||||
void DebugModePatch() {
|
||||
static void DebugModePatch() {
|
||||
DWORD dbgMode = iniGetInt("Debugging", "DebugMode", 0, ::sfall::ddrawIni);
|
||||
if (dbgMode) {
|
||||
dlog("Applying debugmode patch.", DL_INIT);
|
||||
@@ -369,7 +369,7 @@ void DebugModePatch() {
|
||||
}
|
||||
}
|
||||
|
||||
void DontDeleteProtosPatch() {
|
||||
static void DontDeleteProtosPatch() {
|
||||
if (iniGetInt("Debugging", "DontDeleteProtos", 0, ::sfall::ddrawIni)) {
|
||||
dlog("Applying permanent protos patch.", DL_INIT);
|
||||
SafeWrite8(0x48007E, 0xEB);
|
||||
|
||||
@@ -448,9 +448,9 @@ static void WorldMapInterfacePatch() {
|
||||
SafeWrite8(0x4C2D04, 0x46); // dec esi > inc esi
|
||||
|
||||
//if (GetConfigInt("Misc", "WorldMapCitiesListFix", 0)) {
|
||||
dlog("Applying world map cities list patch.", DL_INIT);
|
||||
HookCalls(ScrollCityListFix, {0x4C04B9, 0x4C04C8, 0x4C4A34, 0x4C4A3D});
|
||||
dlogr(" Done", DL_INIT);
|
||||
dlog("Applying world map cities list patch.", DL_INIT);
|
||||
HookCalls(ScrollCityListFix, {0x4C04B9, 0x4C04C8, 0x4C4A34, 0x4C4A3D});
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
DWORD wmSlots = GetConfigInt("Misc", "WorldMapSlots", 0);
|
||||
@@ -476,12 +476,53 @@ static void WorldMapInterfacePatch() {
|
||||
SafeWrite8(0x4C5289, 12);
|
||||
}
|
||||
|
||||
static void __declspec(naked) intface_rotate_numbers_hack() {
|
||||
__asm {
|
||||
push edi;
|
||||
push ebp;
|
||||
sub esp, 0x54;
|
||||
mov edi, 0x460BA6;
|
||||
// ebx - old value, ecx - new value
|
||||
cmp ebx, ecx;
|
||||
je end;
|
||||
mov ebx, ecx;
|
||||
jg decrease;
|
||||
dec ebx;
|
||||
end:
|
||||
jmp edi;
|
||||
decrease:
|
||||
test ecx, ecx;
|
||||
jl negative;
|
||||
inc ebx;
|
||||
jmp edi;
|
||||
negative:
|
||||
xor ebx, ebx;
|
||||
jmp edi;
|
||||
}
|
||||
}
|
||||
|
||||
static void SpeedInterfaceCounterAnimsPatch() {
|
||||
switch (GetConfigInt("Misc", "SpeedInterfaceCounterAnims", 0)) {
|
||||
case 1:
|
||||
dlog("Applying SpeedInterfaceCounterAnims patch.", DL_INIT);
|
||||
MakeJump(0x460BA1, intface_rotate_numbers_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
break;
|
||||
case 2:
|
||||
dlog("Applying SpeedInterfaceCounterAnims patch (Instant).", DL_INIT);
|
||||
SafeWrite32(0x460BB6, 0xDB319090); // xor ebx, ebx
|
||||
dlogr(" Done", DL_INIT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Interface::init() {
|
||||
if (GetConfigInt("Interface", "ActionPointsBar", 0)) {
|
||||
ActionPointsBarPatch();
|
||||
}
|
||||
|
||||
WorldMapInterfacePatch();
|
||||
SpeedInterfaceCounterAnimsPatch();
|
||||
}
|
||||
|
||||
void Interface::exit() {
|
||||
|
||||
@@ -77,7 +77,7 @@ void Karma::DisplayKarma(int value) {
|
||||
fo::func::display_print(buf);
|
||||
}
|
||||
|
||||
void ApplyDisplayKarmaChangesPatch() {
|
||||
static void ApplyDisplayKarmaChangesPatch() {
|
||||
displayKarmaChanges = GetConfigInt("Misc", "DisplayKarmaChanges", 0) != 0;
|
||||
if (displayKarmaChanges) {
|
||||
dlog("Applying display karma changes patch.", DL_INIT);
|
||||
@@ -88,7 +88,7 @@ void ApplyDisplayKarmaChangesPatch() {
|
||||
}
|
||||
}
|
||||
|
||||
void ApplyKarmaFRMsPatch() {
|
||||
static void ApplyKarmaFRMsPatch() {
|
||||
auto karmaFrmList = GetConfigList("Misc", "KarmaFRMs", "", 512);
|
||||
size_t countFrm = karmaFrmList.size();
|
||||
if (countFrm) {
|
||||
@@ -100,8 +100,8 @@ void ApplyKarmaFRMsPatch() {
|
||||
for (size_t i = 0; i < countFrm; i++) {
|
||||
karmaFrms[i].frm = atoi(karmaFrmList[i].c_str());
|
||||
karmaFrms[i].points = (countPoints > i)
|
||||
? atoi(karmaPointsList[i].c_str())
|
||||
: INT_MAX;
|
||||
? atoi(karmaPointsList[i].c_str())
|
||||
: INT_MAX;
|
||||
}
|
||||
HookCall(0x4367A9, DrawInfoWin_hook);
|
||||
|
||||
|
||||
+26
-16
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* sfall
|
||||
* Copyright (C) 2008-2017 The sfall team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* sfall
|
||||
* Copyright (C) 2008-2017 The sfall team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "..\main.h"
|
||||
#include "..\FalloutEngine\Fallout2.h"
|
||||
@@ -227,6 +227,15 @@ static void GetExtraPatches() {
|
||||
}
|
||||
}
|
||||
|
||||
static void MultiPatchesPatch() {
|
||||
//if (GetConfigInt("Misc", "MultiPatches", 0)) {
|
||||
dlog("Applying load multiple patches patch.", DL_INIT);
|
||||
SafeWrite8(0x444354, 0x90); // Change step from 2 to 1
|
||||
SafeWrite8(0x44435C, 0xC4); // Disable check
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
}
|
||||
|
||||
////////////////////////////// SAVE PARTY MEMBER PROTOTYPES //////////////////////////////
|
||||
|
||||
static void __fastcall AddSavPrototype(long pid) {
|
||||
@@ -370,6 +379,7 @@ void LoadOrder::init() {
|
||||
patchFiles.push_back("sfall.dat");
|
||||
|
||||
GetExtraPatches();
|
||||
MultiPatchesPatch();
|
||||
|
||||
if (GetConfigInt("Misc", "DataLoadOrderPatch", 1)) {
|
||||
dlog("Applying data load order patch.", DL_INIT);
|
||||
|
||||
@@ -71,31 +71,6 @@ c15:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) intface_rotate_numbers_hack() {
|
||||
__asm {
|
||||
push edi
|
||||
push ebp
|
||||
sub esp, 0x54
|
||||
// ebx=old value, ecx=new value
|
||||
cmp ebx, ecx
|
||||
je end
|
||||
mov ebx, ecx
|
||||
jg decrease
|
||||
dec ebx
|
||||
jmp end
|
||||
decrease:
|
||||
test ecx, ecx
|
||||
jl negative
|
||||
inc ebx
|
||||
jmp end
|
||||
negative:
|
||||
xor ebx, ebx
|
||||
end:
|
||||
push 0x460BA6
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) register_object_take_out_hack() {
|
||||
__asm {
|
||||
push ecx
|
||||
@@ -165,48 +140,6 @@ static void __declspec(naked) ReloadHook() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const DWORD CorpseHitFix2_continue_loop1 = 0x48B99B;
|
||||
static void __declspec(naked) CorpseHitFix2() {
|
||||
__asm {
|
||||
push eax;
|
||||
mov eax, [eax];
|
||||
call fo::funcoffs::critter_is_dead_; // found some object, check if it's a dead critter
|
||||
test eax, eax;
|
||||
pop eax;
|
||||
jz really_end; // if not, allow breaking the loop (will return this object)
|
||||
jmp CorpseHitFix2_continue_loop1; // otherwise continue searching
|
||||
|
||||
really_end:
|
||||
mov eax, [eax];
|
||||
pop ebp;
|
||||
pop edi;
|
||||
pop esi;
|
||||
pop ecx;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static const DWORD CorpseHitFix2_continue_loop2 = 0x48BA0B;
|
||||
// same logic as above, for different loop
|
||||
static void __declspec(naked) CorpseHitFix2b() {
|
||||
__asm {
|
||||
mov eax, [edx];
|
||||
call fo::funcoffs::critter_is_dead_;
|
||||
test eax, eax;
|
||||
jz really_end;
|
||||
jmp CorpseHitFix2_continue_loop2;
|
||||
|
||||
really_end:
|
||||
mov eax, [edx];
|
||||
pop ebp;
|
||||
pop edi;
|
||||
pop esi;
|
||||
pop ecx;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static const DWORD ScannerHookRet = 0x41BC1D;
|
||||
static const DWORD ScannerHookFail = 0x41BC65;
|
||||
static void __declspec(naked) ScannerAutomapHook() {
|
||||
@@ -386,21 +319,6 @@ void SkilldexImagesPatch() {
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
void SpeedInterfaceCounterAnimsPatch() {
|
||||
switch (GetConfigInt("Misc", "SpeedInterfaceCounterAnims", 0)) {
|
||||
case 1:
|
||||
dlog("Applying SpeedInterfaceCounterAnims patch.", DL_INIT);
|
||||
MakeJump(0x460BA1, intface_rotate_numbers_hack);
|
||||
dlogr(" Done", DL_INIT);
|
||||
break;
|
||||
case 2:
|
||||
dlog("Applying SpeedInterfaceCounterAnims patch. (Instant)", DL_INIT);
|
||||
SafeWrite32(0x460BB6, 0x90DB3190); // xor ebx, ebx
|
||||
dlogr(" Done", DL_INIT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ScienceOnCrittersPatch() {
|
||||
switch (GetConfigInt("Misc", "ScienceOnCritters", 0)) {
|
||||
case 1:
|
||||
@@ -465,15 +383,6 @@ void DontTurnOffSneakIfYouRunPatch() {
|
||||
}
|
||||
}
|
||||
|
||||
void MultiPatchesPatch() {
|
||||
//if (GetConfigInt("Misc", "MultiPatches", 0)) {
|
||||
dlog("Applying load multiple patches patch.", DL_INIT);
|
||||
SafeWrite8(0x444354, 0x90); // Change step from 2 to 1
|
||||
SafeWrite8(0x44435C, 0xC4); // Disable check
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
}
|
||||
|
||||
void PlayIdleAnimOnReloadPatch() {
|
||||
if (GetConfigInt("Misc", "PlayIdleAnimOnReload", 0)) {
|
||||
dlog("Applying idle anim on reload patch.", DL_INIT);
|
||||
@@ -482,15 +391,6 @@ void PlayIdleAnimOnReloadPatch() {
|
||||
}
|
||||
}
|
||||
|
||||
void CorpseLineOfFireFix() {
|
||||
if (GetConfigInt("Misc", "CorpseLineOfFireFix", 1)) {
|
||||
dlog("Applying corpse line of fire patch.", DL_INIT);
|
||||
MakeJump(0x48B994, CorpseHitFix2);
|
||||
MakeJump(0x48BA04, CorpseHitFix2b);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
|
||||
void MotionScannerFlagsPatch() {
|
||||
DWORD flags;
|
||||
if (flags = GetConfigInt("Misc", "MotionScannerFlags", 1)) {
|
||||
@@ -597,8 +497,7 @@ void PipboyAvailableAtStartPatch() {
|
||||
switch (GetConfigInt("Misc", "PipBoyAvailableAtGameStart", 0)) {
|
||||
case 1:
|
||||
LoadGameHook::OnBeforeGameStart() += []() {
|
||||
// PipBoy aquiring video
|
||||
fo::var::gmovie_played_list[3] = true;
|
||||
fo::var::gmovie_played_list[3] = true; // PipBoy aquiring video
|
||||
};
|
||||
break;
|
||||
case 2:
|
||||
@@ -763,14 +662,11 @@ void MiscPatches::init() {
|
||||
F1EngineBehaviorPatch();
|
||||
DialogueFix();
|
||||
AdditionalWeaponAnimsPatch();
|
||||
MultiPatchesPatch();
|
||||
AlwaysReloadMsgs();
|
||||
PlayIdleAnimOnReloadPatch();
|
||||
CorpseLineOfFireFix();
|
||||
|
||||
SkilldexImagesPatch();
|
||||
|
||||
SpeedInterfaceCounterAnimsPatch();
|
||||
ScienceOnCrittersPatch();
|
||||
InventoryCharacterRotationSpeedPatch();
|
||||
|
||||
|
||||
+10
-10
@@ -340,11 +340,11 @@ void WorldLimitsPatches() {
|
||||
}
|
||||
|
||||
//if (GetConfigInt("Misc", "CitiesLimitFix", 0)) {
|
||||
dlog("Applying cities limit patch.", DL_INIT);
|
||||
if (*((BYTE*)0x4BF3BB) != 0xEB) {
|
||||
SafeWrite8(0x4BF3BB, 0xEB);
|
||||
}
|
||||
dlogr(" Done", DL_INIT);
|
||||
dlog("Applying cities limit patch.", DL_INIT);
|
||||
if (*((BYTE*)0x4BF3BB) != 0xEB) {
|
||||
SafeWrite8(0x4BF3BB, 0xEB);
|
||||
}
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -419,11 +419,11 @@ void WorldmapFpsPatch() {
|
||||
|
||||
void PathfinderFixInit() {
|
||||
//if (GetConfigInt("Misc", "PathfinderFix", 0)) {
|
||||
dlog("Applying Pathfinder patch.", DL_INIT);
|
||||
SafeWrite16(0x4C1FF6, 0x9090); // wmPartyWalkingStep_
|
||||
HookCall(0x4C1C78, PathfinderFix); // wmGameTimeIncrement_
|
||||
mapMultiMod = (double)GetConfigInt("Misc", "WorldMapTimeMod", 100) / 100.0;
|
||||
dlogr(" Done", DL_INIT);
|
||||
dlog("Applying Pathfinder patch.", DL_INIT);
|
||||
SafeWrite16(0x4C1FF6, 0x9090); // wmPartyWalkingStep_
|
||||
HookCall(0x4C1C78, PathfinderFix); // wmGameTimeIncrement_
|
||||
mapMultiMod = (double)GetConfigInt("Misc", "WorldMapTimeMod", 100) / 100.0;
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user