Backported DisplaySecondWeaponRange option from 'develop' branch.

Improved DisablePipboyAlarm so that when the player press Z key they won't see a blank Pipboy screen.
Simplified the HookCall usages in TimeLimit option.
This commit is contained in:
NovaRain
2018-05-27 16:09:21 +08:00
parent 78a29ad556
commit 334e98c4c1
2 changed files with 43 additions and 12 deletions
+7 -1
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v3.8.9
;v3.8.10
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -419,6 +419,9 @@ BonusHtHDamageFix=1
;Set to 1 to display additional points of damage from Bonus HtH/Ranged Damage perks in the inventory
DisplayBonusDamage=0
;Set to 1 to display the range of the second attack mode in the inventory when you switch weapon modes in active item slots
DisplaySecondWeaponRange=1
;Modify the maximum number of animations allowed to run on a map. (Default is 32, and the maximum is 127)
AnimationsAtOnceLimit=120
@@ -565,6 +568,9 @@ CanSellUsedGeiger=1
;Set to 1 to fix the issue with being able to charge the car by using cells on other scenary/critters
CarChargingFix=1
;Set to 1 to display the range of the second attack mode in the inventory when you switch weapon modes in active item slots
DisplaySecondWeaponRange=1
;Set to 1 to skip weapon equip/unequip animations when performing various actions
InstantWeaponEquip=0
+36 -11
View File
@@ -104,10 +104,6 @@ static const DWORD offsetsC[] = {
0x4FE036,
};
static const DWORD origFuncPosA = 0x6C0200;
static const DWORD origFuncPosB = 0x6C03B0;
static const DWORD origFuncPosC = 0x6C0164;
static const DWORD getLocalTimePos = 0x4FDF58;
static const DWORD dinputPos = 0x50FB70;
@@ -119,6 +115,10 @@ static DWORD AddrGetLocalTime;
static DWORD ViewportX;
static DWORD ViewportY;
static const DWORD GetDateAddr[] = {
0x4392F8, 0x443808, 0x47E127, 0x4975A2, 0x497712, 0x4979C9, 0x4C3CB5,
};
static const DWORD FastShotFixF1[] = {
0x478BB8, 0x478BC7, 0x478BD6, 0x478BEA, 0x478BF9, 0x478C08, 0x478C2F,
};
@@ -737,6 +737,28 @@ static void __declspec(naked) gdAddOptionStr_hack() {
}
}
static DWORD __fastcall GetWeaponSlotMode(DWORD itemPtr, DWORD mode) {
int slot = (mode > 0) ? 1 : 0;
DWORD* itemButton = ptr_itemButtonItems;
if (itemButton[slot * 6] == itemPtr && itemButton[(slot * 6) + 4] == 3) {
mode++;
}
return mode;
}
static void __declspec(naked) display_stats_hook() {
__asm {
push eax;
push ecx;
mov ecx, ds:[esp + edi + 0xA8 + 0xC]; // get itemPtr
call GetWeaponSlotMode; // ecx - itemPtr, edx - mode;
mov edx, eax;
pop ecx;
pop eax;
jmp item_w_range_;
}
}
static void DllMain2() {
//SafeWrite8(0x4B15E8, 0xc3);
//SafeWrite8(0x4B30C4, 0xc3); //this is the one I need to override for bigger tiles
@@ -1036,13 +1058,9 @@ static void DllMain2() {
limit = -1;
AddUnarmedStatToGetYear = 1;
HookCall(0x4392F8, &GetDateWrapper);
HookCall(0x443808, &GetDateWrapper);
HookCall(0x47E127, &GetDateWrapper);
HookCall(0x4975A2, &GetDateWrapper);
HookCall(0x497712, &GetDateWrapper);
HookCall(0x4979C9, &GetDateWrapper);
HookCall(0x4C3CB5, &GetDateWrapper);
for (int i = 0; i < sizeof(GetDateAddr) / 4; i++) {
HookCall(GetDateAddr[i], &GetDateWrapper);
}
dlogr(" Done", DL_INIT);
}
if (limit <= 14 && limit >= -1 && limit != 13) {
@@ -1399,6 +1417,7 @@ static void DllMain2() {
if (GetPrivateProfileIntA("Misc", "DisablePipboyAlarm", 0, ini)) {
dlog("Applying Disable Pip-Boy alarm button patch.", DL_INIT);
SafeWrite8(0x499518, 0xC3);
SafeWrite8(0x443601, 0x0);
dlogr(" Done", DL_INIT);
}
@@ -1475,6 +1494,12 @@ static void DllMain2() {
dlogr(" Done", DL_INIT);
}
if (GetPrivateProfileIntA("Misc", "DisplaySecondWeaponRange", 1, ini)) {
dlog("Applying display second weapon range patch.", DL_INIT);
HookCall(0x472201, &display_stats_hook);
dlogr(" Done", DL_INIT);
}
dlogr("Leave DllMain2", DL_MAIN);
}