mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Correction to the previous commit
This commit is contained in:
@@ -388,7 +388,7 @@ static bool bonusHtHDamageFix = false;
|
||||
static bool displayBonusDamage = false;
|
||||
|
||||
static long __fastcall GetHtHDamage(fo::GameObject* source, long &meleeDmg, long handOffset) {
|
||||
long max, min;
|
||||
long min, max;
|
||||
|
||||
fo::AttackType hit = Unarmed::GetStoredHitMode((handOffset == 0) ? fo::HandSlot::Left : fo::HandSlot::Right);
|
||||
long bonus = Unarmed::GetDamage(hit, min, max);
|
||||
@@ -434,14 +434,13 @@ void DamageMod::init() {
|
||||
}
|
||||
}
|
||||
|
||||
int BonusHtHDmgFix = IniReader::GetConfigInt("Misc", "BonusHtHDamageFix", 1);
|
||||
int DisplayBonusDmg = IniReader::GetConfigInt("Misc", "DisplayBonusDamage", 0);
|
||||
bonusHtHDamageFix = IniReader::GetConfigInt("Misc", "BonusHtHDamageFix", 1) != 0;
|
||||
displayBonusDamage = IniReader::GetConfigInt("Misc", "DisplayBonusDamage", 0) != 0;
|
||||
|
||||
if (BonusHtHDmgFix) {
|
||||
bonusHtHDamageFix = true;
|
||||
if (bonusHtHDamageFix) {
|
||||
dlog("Applying Bonus HtH Damage Perk fix.", DL_INIT);
|
||||
// Subtract damage from perk bonus (vanilla displaying)
|
||||
if (DisplayBonusDmg == 0) {
|
||||
if (!displayBonusDamage) {
|
||||
HookCalls(MeleeDmgDisplayPrintFix_hook, {
|
||||
0x435C0C, // DisplayFix (ListDrvdStats_)
|
||||
0x439921 // PrintFix (Save_as_ASCII_)
|
||||
@@ -456,17 +455,16 @@ void DamageMod::init() {
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
if (DisplayBonusDmg) {
|
||||
displayBonusDamage = true;
|
||||
if (displayBonusDamage) {
|
||||
dlog("Applying Display Bonus Damage patch.", DL_INIT);
|
||||
HookCall(0x4722DD, DisplayBonusRangedDmg_hook); // display_stats_
|
||||
if (BonusHtHDmgFix) {
|
||||
if (bonusHtHDamageFix) {
|
||||
HookCall(0x472309, DisplayBonusHtHDmg1_hook); // MeleeWeap (display_stats_)
|
||||
}
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
// Display actual damage values for unarmed attacks (display_stats_)
|
||||
// Display actual damage values for unarmed attacks (display_stats_ hacks)
|
||||
MakeJump(0x472546, DisplayBonusHtHDmg2_hack);
|
||||
SafeWrite32(0x472558, 0x509EDC); // fmt: '%s %d-%d'
|
||||
SafeWrite8(0x472552, 0x98 + 4);
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "Perks.h"
|
||||
#include "ScriptExtender.h"
|
||||
#include "Scripting\Arrays.h"
|
||||
#include "Unarmed.h"
|
||||
#include "Worldmap.h"
|
||||
|
||||
#include "LoadGameHook.h"
|
||||
@@ -608,9 +607,8 @@ static void __declspec(naked) SkilldexHook() {
|
||||
static void __declspec(naked) HandleInventoryHook_Start() {
|
||||
__asm {
|
||||
_InLoop2(1, INVENTORY);
|
||||
call Unarmed::SlotsStoreCurrentHitMode;
|
||||
xor eax, eax;
|
||||
jmp fo::funcoffs::inven_set_mouse_;
|
||||
xor eax, eax;
|
||||
jmp fo::funcoffs::inven_set_mouse_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -347,7 +347,7 @@ static fo::AttackType GetKickingHit() {
|
||||
return GetKickingHit(true);
|
||||
}
|
||||
|
||||
void Unarmed::SlotsStoreCurrentHitMode() {
|
||||
static void SlotsStoreCurrentHitMode() {
|
||||
slotHitData[fo::HandSlot::Left].primaryHit = fo::util::GetHandSlotPrimaryAttack(fo::HandSlot::Left);
|
||||
slotHitData[fo::HandSlot::Left].secondaryHit = fo::util::GetHandSlotSecondaryAttack(fo::HandSlot::Left);
|
||||
slotHitData[fo::HandSlot::Left].mode = fo::util::GetHandSlotMode(fo::HandSlot::Left);
|
||||
@@ -385,6 +385,13 @@ fo::AttackType Unarmed::GetStoredHitMode(fo::HandSlot slot) {
|
||||
return hit;
|
||||
}
|
||||
|
||||
static void __declspec(naked) handle_inventory_hook() {
|
||||
__asm {
|
||||
call SlotsStoreCurrentHitMode;
|
||||
jmp fo::funcoffs::display_stats_;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void __declspec(naked) statPCAddExperienceCheckPMs_hook() {
|
||||
@@ -472,6 +479,9 @@ void Unarmed::init() {
|
||||
MakeCall(0x4248B6, check_unarmed_penetrate, 5);
|
||||
SafeWrite16(0x4248C1, 0x01F8); // cmp eax, 1
|
||||
SafeWrite8(0x4248C8, CodeType::JumpShort);
|
||||
|
||||
// Store the current values of unarmed attack modes when opening the player's inventory
|
||||
HookCall(0x46E8D4, handle_inventory_hook);
|
||||
}
|
||||
|
||||
//void Unarmed::exit() {
|
||||
|
||||
@@ -32,7 +32,6 @@ public:
|
||||
static long GetHitAPCost(fo::AttackType hit);
|
||||
static long GetDamage(fo::AttackType hit, long &minOut, long &maxOut);
|
||||
|
||||
static void SlotsStoreCurrentHitMode();
|
||||
static fo::AttackType GetStoredHitMode(fo::HandSlot slot);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user