Compare commits

..
9 Commits
Author SHA1 Message Date
NovaRain 66dd966d8a Made a minor edit on ddraw.ini 2015-12-15 14:05:04 +08:00
NovaRain 8ce9ae89eb Removed TooManyItemsBugFix, InventoryDragIssuesFix, NPCDrugAddictionFix, ArmorCorruptsNPCStatsFix, NPCTurnsIntoContainerFix, CarChargingFix, NPCWeightFix from ddraw.ini
Updated version number.
2015-12-15 12:45:42 +08:00
NovaRain 361e961b38 Merge remote-tracking branch 'origin/master' into develop 2015-12-14 12:33:41 +08:00
Vlad f8c1bf1ebb Merge pull request #32 from burner1024/master
fix usage notes for set_critter_burst_disable
2015-12-14 10:47:01 +07:00
Ilya Ivanov 748cbb030a fix usage notes for set_critter_burst_disable 2015-12-14 10:21:46 +07:00
NovaRain 473fbf81b4 Integrated ReloadReserve setting from Crafty's mod for skipping the 'Move Items' window when using drap and drop to reload weapons in the inventory.
Partially refactored HeroAppearance.cpp to use proper engine function/variable names and unified the indent style across the code.
2015-11-17 12:56:03 +08:00
NovaRain 225f36808d Added an optional bug fix for not counting in the weight of equipped items on NPC when stealing or bartering.
Added an additional fix to InventoryDragIssuesFix for only using one box of ammo when the weapon is before the ammo.
Partially refactored Credits.cpp and QuestList.cpp to use proper engine function/variable names.
2015-11-16 15:07:24 +08:00
NovaRain 879315b4d0 Partially refactored most of the source code to use proper engine function/variable names. 2015-11-16 10:40:26 +08:00
NovaRain 971be61d95 Integrated two bug fixes and a minor feature based on Crafty's code:
1. Added CanSellUsedGeiger to fix the issue that unable to sell used geiger counters or stealth boys.
2. Added TownMapHotkeysFix to prevent players from using number keys to enter unknown areas on a town map. (original DisableHotkeysForUnknownAreasInCity is a bit too long IMO.)
3. Added EnableMusicInDialogue to leave the music playing in dialogue with talking heads.
Removed WieldObjCritterFix from ddraw.ini (was planning to do so in 3.7 but forgot)
Set DialogOptions9Lines enabled by default.
2015-11-03 16:14:27 +08:00
49 changed files with 3520 additions and 4033 deletions
+16 -26
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v3.7
;v3.7a
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -267,6 +267,9 @@ DamageFormula=0
;Prevents you from using 0 to escape from dialogue at any time.
DialogueFix=1
;Prevents you from using number keys to enter unvisited areas on a town map
TownMapHotkeysFix=1
;Set to 1 to disable the horrigan encounter
DisableHorrigan=0
@@ -419,9 +422,6 @@ DisplayBonusDamage=0
;Modify the maximum number of animations allowed to run on a map. (Default is 32)
AnimationsAtOnceLimit=120
;Set to 1 to fix issues with the wield_obj_critter script function.
WieldObjCritterFix=1
;Set to 1 to remove the limits that stop the player rolling critical successes/misses in the first few days of game time
RemoveCriticalTimelimits=0
@@ -536,31 +536,21 @@ ControlCombat=0
;Set to 1 to stack empty identical weapons, no matter what type of ammo was loaded before
StackEmptyWeapons=0
;Changes the way weapon reloading works when you drag ammo onto a weapon in the inventory
;Set to -1 to disable (vanilla behavior with the 'Move Items' window)
;Set to 0 to use all the ammo boxes to reload
;Set to 1 or more to reserve the specified amount of ammo boxes and use all the rest to reload
;If the amount of ammo boxes in the inventory is less than or equal to the reserve, only one box will be used
ReloadReserve=-1
;Allows 9 options (lines of text) to be displayed correctly in a dialog window
DialogOptions9Lines=0
DialogOptions9Lines=1
;Set to 1 to leave the music playing in dialogue with talking heads
EnableMusicInDialogue=0
;Prevents 'Too Many Items' bug from corrupting game saves
TooManyItemsBugFix=1
;Set to 1 to fix a minor visual glitch when picking up a solo item from the top of inventory with a stack of multiple items at the bottom
;Also fixes the inability to reload weapons by dragging ammo onto weapons in the inventory list
InventoryDragIssuesFix=1
;Set to 1 to add proper checks for NPC's addiction instead of always using global variables
;Also fixes Jet Antidote not working on NPCs
NPCDrugAddictionFix=1
;Set to 1 to fix issues with NPC stats being dropped unreasonably if one has mutiple of the same armor in inventory and equips the armor,
;And either you order NPC to remove the armor through dialog or one levels up
ArmorCorruptsNPCStatsFix=1
;Set to 1 to fix the bug that NPCs become unresponsive and act like walking containers if you move to another map while they are under 'lost next turn' critical miss effect
NPCTurnsIntoContainerFix=1
;Set to 1 to fix issues with being able to charge the car with using cells on scenary/critters and cells getting consumed even when the car is already fully charged
CarChargingFix=1
;Set to 1 to fix the bug that unable to sell used geiger counters or stealth boys
CanSellUsedGeiger=1
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Debugging]
+1 -1
View File
@@ -277,7 +277,7 @@ ox816c - int key_pressed(int dxScancode)
0x8214 - void set_hero_race(int style)
0x8215 - void set_hero_style(int style)
0x8216 - void set_critter_burst_disable(int critter, int disable)
0x8216 - void set_critter_burst_disable(objptr critter, int disable)
0x8217 - int get_weapon_ammo_pid(objptr weapon)
0x8218 - void set_weapon_ammo_pid(objptr weapon, int pid)
+4 -6
View File
@@ -18,8 +18,8 @@
#include "main.h"
#include "AI.h"
#include "SafeWrite.h"
#include "FalloutEngine.h"
#include "SafeWrite.h"
#include <hash_map>
@@ -45,8 +45,6 @@ static void _stdcall CombatAttackHook(DWORD source, DWORD target) {
targets[source]=target;
}
//static const DWORD _ai_attack=0x42A748;
static const DWORD _combat_attack=0x422F3C;
static void __declspec(naked) combat_attack_hook() {
_asm {
pushad;
@@ -54,7 +52,7 @@ static void __declspec(naked) combat_attack_hook() {
push eax;
call CombatAttackHook;
popad;
jmp _combat_attack;
jmp combat_attack_;
}
}
@@ -82,7 +80,7 @@ end:
static void __declspec(naked) BlockCombatHook2() {
__asm {
mov eax, dword ptr ds:[0x518F10];
mov eax, dword ptr ds:[_intfaceEnabled];
test eax, eax;
jz end;
mov eax, CombatDisabled;
@@ -123,4 +121,4 @@ void _stdcall AICombatStart() {
void _stdcall AICombatEnd() {
targets.clear();
sources.clear();
}
}
+6 -7
View File
@@ -663,7 +663,6 @@ static void __declspec(naked) DisplayBonusHtHDmg2() {
}
}
static const DWORD roll_random=0x4A30C0;
static const DWORD UnarmedAttacksFixEnd=0x423A0D;
static void __declspec(naked) UnarmedAttacksFix() {
__asm {
@@ -674,7 +673,7 @@ static void __declspec(naked) UnarmedAttacksFix() {
PowKickHPunch:
mov edx,0x64;
mov eax,0x1;
call roll_random;
call roll_random_;
cmp eax,0x5; // 5% chance of critical hit
jle CriticalHit;
jmp end;
@@ -687,7 +686,7 @@ HKickJabCheck:
HKickJab:
mov edx,0x64;
mov eax,0x1;
call roll_random;
call roll_random_;
cmp eax,0xa; // 10% chance of critical hit
jle CriticalHit;
jmp end;
@@ -696,7 +695,7 @@ Haymaker:
jnz PalmStrike;
mov edx,0x64;
mov eax,0x1;
call roll_random;
call roll_random_;
cmp eax,0xf; // 15% chance of critical hit
jle CriticalHit;
jmp end;
@@ -705,7 +704,7 @@ PalmStrike:
jnz PiercingStrike;
mov edx,0x64;
mov eax,0x1;
call roll_random;
call roll_random_;
cmp eax,0x14; // 20% chance of critical hit
jle CriticalHit;
jmp end;
@@ -714,7 +713,7 @@ PiercingStrike:
jnz PiercingKick;
mov edx,0x64;
mov eax,0x1;
call roll_random;
call roll_random_;
cmp eax,0x28; // 40% chance of critical hit
jle CriticalHit;
jmp end;
@@ -723,7 +722,7 @@ PiercingKick:
jnz end;
mov edx,0x64;
mov eax,0x1;
call roll_random;
call roll_random_;
cmp eax,0x32; // 50% chance of critical hit
jg end;
CriticalHit:
+2 -2
View File
@@ -19,10 +19,10 @@
#include "main.h"
#include "BarBoxes.h"
#include "FalloutEngine.h"
static const DWORD DisplayBoxesRet1=0x4615A8;
static const DWORD DisplayBoxesRet2=0x4615BE;
static const DWORD _add_bar_box=0x4616F0;
struct sBox {
DWORD msg;
DWORD colour;
@@ -39,7 +39,7 @@ start:
test eax, eax;
jz next;
lea eax, [ebx+5];
call _add_bar_box;
call add_bar_box_;
add esi, eax;
next:
inc ebx;
+109 -76
View File
@@ -4,7 +4,7 @@
#include "Define.h"
#include "FalloutEngine.h"
//DWORD WeightOnBody = 0;
DWORD WeightOnBody = 0;
static void __declspec(naked) SharpShooterFix() {
__asm {
@@ -22,7 +22,6 @@ end:
}
}
static void __declspec(naked) pipboy_hack() {
__asm {
cmp ebx, 0x210 // Back button?
@@ -181,7 +180,8 @@ itsJet:
mov eax, 0x47A3FB
jmp eax
}
}*/
}
*/
static void __declspec(naked) item_d_load_hack() {
__asm {
@@ -293,7 +293,7 @@ end:
static void __declspec(naked) gdProcessUpdate_hack() {
__asm {
add eax, esi
cmp eax, dword ptr ds:[0x58ECCC] // _optionRect.offy
cmp eax, dword ptr ds:[_optionRect + 0xC] // _optionRect.offy
jge skip
add eax, 2
mov esi, 0x44702D
@@ -304,8 +304,6 @@ skip:
}
}
static void __declspec(naked) invenWieldFunc_item_get_type_hook() {
__asm {
pushad
@@ -341,9 +339,7 @@ noWeapon:
}
}
/*
static void __declspec(naked) loot_container_hook() {
static void __declspec(naked) loot_container_hack() {
__asm {
mov eax, [esp+0x114+0x4]
test eax, eax
@@ -369,10 +365,8 @@ noArmor:
retn
}
}
*/
/*
static void __declspec(naked) barter_inventory_hook() {
static void __declspec(naked) barter_inventory_hack() {
__asm {
mov eax, [esp+0x20+0x4]
test eax, eax
@@ -396,9 +390,6 @@ end:
retn
}
}
*/
/*
static void __declspec(naked) barter_attempt_transaction_hook() {
__asm {
@@ -428,7 +419,6 @@ end:
retn
}
}
*/
static void __declspec(naked) inven_pickup_hack() {
__asm {
@@ -442,9 +432,8 @@ static void __declspec(naked) inven_pickup_hack() {
}
}
static DWORD inven_pickup_loop=-1;
static const DWORD inven_pickup_hook1_Loop = 0x471145;
static const DWORD inven_pickup_hack2_Loop = 0x471145;
static void __declspec(naked) inven_pickup_hack2() {
__asm {
cmp inven_pickup_loop, -1
@@ -462,7 +451,7 @@ nextLoop:
add edx, 35 // y_start
mov ecx, edx
add ecx, 48 // y_end
jmp inven_pickup_hook1_Loop
jmp inven_pickup_hack2_Loop
inLoop:
test eax, eax
mov eax, inven_pickup_loop
@@ -496,7 +485,6 @@ inRange:
}
}
/*
static void __declspec(naked) drop_ammo_into_weapon_hook() {
__asm {
dec esi
@@ -536,7 +524,6 @@ end:
retn
}
}
*/
static void __declspec(naked) PipStatus_AddHotLines_hook() {
__asm {
@@ -583,7 +570,7 @@ static void __declspec(naked) action_melee_hack() {
cmp ebx, OBJ_TYPE_CRITTER // check if object FID type flag is set to critter
jne end // if object not a critter leave jump condition flags
// set to skip dodge animation
test byte ptr [eax+0x44], 3 // (original code) DAM_KNOCKED_OUT or DAM_KNOCKED_DOWN
test byte ptr [eax+0x44], 0x3 // (original code) DAM_KNOCKED_OUT or DAM_KNOCKED_DOWN
jnz end
mov edx, 0x4113FE
end:
@@ -600,7 +587,7 @@ static void __declspec(naked) action_ranged_hack() {
cmp ebx, OBJ_TYPE_CRITTER // check if object FID type flag is set to critter
jne end // if object not a critter leave jump condition flags
// set to skip dodge animation
test byte ptr [eax+0x44], 3 // (original code) DAM_KNOCKED_OUT or DAM_KNOCKED_DOWN
test byte ptr [eax+0x44], 0x3 // (original code) DAM_KNOCKED_OUT or DAM_KNOCKED_DOWN
jnz end
mov edx, 0x411BD2
end:
@@ -608,7 +595,6 @@ end:
}
}
static void __declspec(naked) set_new_results_hack() {
__asm {
test ah, 0x1 // DAM_KNOCKED_OUT?
@@ -680,18 +666,42 @@ static void __declspec(naked) partyMemberPrepLoadInstance_hack() {
}
}
static void __declspec(naked) barter_attempt_transaction_hack() {
__asm {
cmp dword ptr [eax+0x64], PID_ACTIVE_GEIGER_COUNTER
je found
cmp dword ptr [eax+0x64], PID_ACTIVE_STEALTH_BOY
je found
mov eax, 0x474D34
jmp eax
found:
call item_m_turn_off_
mov eax, 0x474D17
jmp eax // Is there any other activated items among the ones being sold?
}
}
static void __declspec(naked) item_m_turn_off_hook() {
__asm {
and byte ptr [eax+0x25], 0xDF // Rest flag of used items
jmp queue_remove_this_
}
}
void BugsInit()
{
dlog("Applying sharpshooter patch.", DL_INIT);
// http://www.nma-fallout.com/showthread.php?178390-FO2-Engine-Tweaks&p=4050162&viewfull=1#post4050162
// by Slider2k
HookCall(0x4244AB, &SharpShooterFix); // hooks stat_level_() call in detemine_to_hit_func_()
// // removes this line by making unconditional jump:
// if ( who == obj_dude )
// dist -= 2 * perk_level_(obj_dude, PERK_sharpshooter);
SafeWrite8(0x424527, 0xEB); // in detemine_to_hit_func_()
dlogr(" Done", DL_INIT);
//if (GetPrivateProfileIntA("Misc", "SharpshooterFix", 1, ini)) {
dlog("Applying sharpshooter patch.", DL_INIT);
// http://www.nma-fallout.com/showthread.php?178390-FO2-Engine-Tweaks&p=4050162&viewfull=1#post4050162
// by Slider2k
HookCall(0x4244AB, &SharpShooterFix); // hooks stat_level_() call in detemine_to_hit_func_()
// // removes this line by making unconditional jump:
// if ( who == obj_dude )
// dist -= 2 * perk_level_(obj_dude, PERK_sharpshooter);
SafeWrite8(0x424527, 0xEB); // in detemine_to_hit_func_()
dlogr(" Done", DL_INIT);
//}
// Fixes for clickability issue in Pip-Boy and exploit that allows to rest in places where you shouldn't be able to rest
dlog("Applying fix for Pip-Boy rest exploit.", DL_INIT);
@@ -700,21 +710,21 @@ void BugsInit()
dlogr(" Done.", DL_INIT);
// Fix for "Too Many Items" bug
if (GetPrivateProfileIntA("Misc", "TooManyItemsBugFix", 1, ini)) {
//if (GetPrivateProfileIntA("Misc", "TooManyItemsBugFix", 1, ini)) {
dlog("Applying preventive patch for \"Too Many Items\" bug.", DL_INIT);
HookCall(0x4A596A, &scr_write_ScriptNode_hook);
HookCall(0x4A59C1, &scr_write_ScriptNode_hook);
dlogr(" Done.", DL_INIT);
}
//}
// Fixes for being able to charge the car with using cells on scenary/critters
// and cells getting consumed even when the car is already fully charged
if (GetPrivateProfileIntA("Misc", "CarChargingFix", 1, ini)) {
//if (GetPrivateProfileIntA("Misc", "CarChargingFix", 1, ini)) {
dlog("Applying car charging issues fix.", DL_INIT);
MakeCall(0x49C36D, &protinst_default_use_item_hack, true);
MakeCall(0x49BE70, &obj_use_power_on_car_hack, false);
dlogr(" Done.", DL_INIT);
}
//}
// makes jet addiction eternal.. why?
//MakeCall(0x47A3A4, &item_wd_process_hook, false);
@@ -731,21 +741,21 @@ void BugsInit()
// Evil bug! If party member has the same armor type in inventory as currently equipped, then
// on level up he loses Armor Class equal to the one received from this armor.
// The same happens if you just order NPC to remove the armor through dialog.
if (GetPrivateProfileIntA("Misc", "ArmorCorruptsNPCStatsFix", 1, ini)) {
// The same happens if you just order NPC to remove the armor through dialogue.
//if (GetPrivateProfileIntA("Misc", "ArmorCorruptsNPCStatsFix", 1, ini)) {
dlog("Applying fix for armor reducing NPC original stats when removed.", DL_INIT);
HookCall(0x495F3B, &partyMemberCopyLevelInfo_stat_level_hook);
HookCall(0x45419B, &correctFidForRemovedItem_adjust_ac_hook);
dlogr(" Done.", DL_INIT);
}
//}
// Fix of invalid stats when party member gains a level while being on drugs
dlog("Applying fix for addicted party member level up bug.", DL_INIT);
HookCall(0x495D5C, &partyMemberCopyLevelInfo_hook);
dlogr(" Done.", DL_INIT);
// Allow for 9 options (lines of text) to be displayed correctly in a dialog window
if (GetPrivateProfileIntA("Misc", "DialogOptions9Lines", 0, ini)) {
// Allow 9 options (lines of text) to be displayed correctly in a dialog window
if (GetPrivateProfileIntA("Misc", "DialogOptions9Lines", 1, ini)) {
dlog("Applying 9 dialog options patch.", DL_INIT);
MakeCall(0x44701C, &gdProcessUpdate_hack, true);
dlogr(" Done.", DL_INIT);
@@ -761,18 +771,22 @@ void BugsInit()
SafeWrite8(0x4AC377, 0x7F); // jg
dlogr(" Done.", DL_INIT);
// Fix for not counting in weight of equipped items
/*MakeCall(0x473B4E, &loot_container_hook, false);
MakeCall(0x47588A, &barter_inventory_hook, false);
HookCall(0x474CB8, &barter_attempt_transaction_hook);
HookCall(0x4742AD, &move_inventory_hook);
HookCall(0x4771B5, &item_add_mult_hook);*/
// Fix for not counting in the weight of equipped items on NPC when stealing or bartering
//if (GetPrivateProfileIntA("Misc", "NPCWeightFix", 1, ini)) {
dlog("Applying fix for not counting in weight of equipped items on NPC.", DL_INIT);
MakeCall(0x473B4E, &loot_container_hack, false);
MakeCall(0x47588A, &barter_inventory_hack, false);
HookCall(0x474CB8, &barter_attempt_transaction_hook);
HookCall(0x4742AD, &move_inventory_hook);
HookCall(0x4771B5, &item_add_mult_hook);
dlogr(" Done.", DL_INIT);
//}
// Corrects "Weight of items" text element width to be 64 (and not 80), which matches container element width
SafeWrite8(0x475541, 64);
SafeWrite8(0x475789, 64);
if (GetPrivateProfileIntA("Misc", "InventoryDragIssuesFix", 1, ini)) {
//if (GetPrivateProfileIntA("Misc", "InventoryDragIssuesFix", 1, ini)) {
dlog("Applying inventory reverse order issues fix.", DL_INIT);
// Fix for minor visual glitch when picking up solo item from the top of inventory
// and there is multiple item stack at the bottom of inventory
@@ -780,56 +794,75 @@ void BugsInit()
// Fix for error in player's inventory, related to IFACE_BAR_MODE=1 in f2_res.ini, and
// also for reverse order error
MakeCall(0x47114A, &inven_pickup_hack2, true);
// Fix for using only one box of ammo when a weapon is above the ammo in the inventory list
HookCall(0x476598, &drop_ammo_into_weapon_hook);
dlogr(" Done", DL_INIT);
}
//}
// Fix for using only one pack of ammo, when the weapon is before the ammo
//HookCall(0x476598, &drop_ammo_into_weapon_hook);
//if (GetPrivateProfileIntA("Misc", "BlackSkilldexFix", 1, ini)) {
dlog("Applying black skilldex patch.", DL_INIT);
HookCall(0x497D0F, &PipStatus_AddHotLines_hook);
dlogr(" Done", DL_INIT);
//}
dlog("Applying black skilldex patch.", DL_INIT);
HookCall(0x497D0F, &PipStatus_AddHotLines_hook);
dlogr(" Done", DL_INIT);
//if (GetPrivateProfileIntA("Misc", "FixWithdrawalPerkDescCrash", 1, ini)) {
dlog("Applying withdrawal perk description crash fix.", DL_INIT);
HookCall(0x47A501, &perform_withdrawal_start_display_print_hook);
dlogr(" Done", DL_INIT);
//}
dlog("Applying withdrawal perk description crash fix.", DL_INIT);
HookCall(0x47A501, &perform_withdrawal_start_display_print_hook);
dlogr(" Done", DL_INIT);
//if (GetPrivateProfileIntA("Misc", "JetAntidoteFix", 1, ini)) {
dlog("Applying Jet Antidote fix.", DL_INIT);
// the original jet antidote fix
MakeCall(0x47A013, &item_d_take_drug_hack1, true);
dlogr(" Done", DL_INIT);
//}
dlog("Applying Jet Antidote fix.", DL_INIT);
// the original jet antidote fix
MakeCall(0x47A013, &item_d_take_drug_hack1, true);
dlogr(" Done", DL_INIT);
if (GetPrivateProfileIntA("Misc", "NPCDrugAddictionFix", 1, ini)) {
//if (GetPrivateProfileIntA("Misc", "NPCDrugAddictionFix", 1, ini)) {
dlog("Applying NPC's drug addiction fix.", DL_INIT);
// proper checks for NPC's addiction instead of always using global vars
MakeCall(0x47A644, &item_d_check_addict_hack, true);
MakeCall(0x479FC5, &item_d_take_drug_hack, true);
dlogr(" Done.", DL_INIT);
}
//}
dlog("Applying shiv patch.", DL_INIT);
SafeWrite8(0x477B2B, 0xEB);
dlogr(" Done", DL_INIT);
//if (GetPrivateProfileInt("Misc", "ShivPatch", 1, ini)) {
dlog("Applying shiv patch.", DL_INIT);
SafeWrite8(0x477B2B, 0xEB);
dlogr(" Done", DL_INIT);
//}
if (GetPrivateProfileIntA("Misc", "WieldObjCritterFix", 1, ini)) {
//if (GetPrivateProfileIntA("Misc", "WieldObjCritterFix", 1, ini)) {
dlog("Applying wield_obj_critter fix.", DL_INIT);
SafeWrite8(0x456912, 0x1E);
HookCall(0x45697F, &op_wield_obj_critter_adjust_ac_hook);
dlogr(" Done", DL_INIT);
}
//}
dlog("Applying Dodgy Door Fix.", DL_INIT);
MakeCall(0x4113D6, &action_melee_hack, true);
MakeCall(0x411BCC, &action_ranged_hack, true);
dlogr(" Done", DL_INIT);
//if (GetPrivateProfileIntA("Misc", "DodgyDoorsFix", 1, ini)) {
dlog("Applying Dodgy Door Fix.", DL_INIT);
MakeCall(0x4113D6, &action_melee_hack, true);
MakeCall(0x411BCC, &action_ranged_hack, true);
dlogr(" Done", DL_INIT);
//}
// Fix for "NPC turns into a container"
if (GetPrivateProfileIntA("Misc", "NPCTurnsIntoContainerFix", 1, ini)) {
// Fix for "NPC turns into a container" bug
//if (GetPrivateProfileIntA("Misc", "NPCTurnsIntoContainerFix", 1, ini)) {
dlog("Applying fix for \"NPC turns into a container\" bug.", DL_INIT);
MakeCall(0x424F8E, &set_new_results_hack, false);
MakeCall(0x42E46E, &critter_wake_clear_hack, true);
MakeCall(0x488EF3, &obj_load_func_hack, true);
HookCall(0x4949B2, &partyMemberPrepLoadInstance_hack);
dlogr(" Done", DL_INIT);
//}
// Fix for unable to sell used geiger counters or stealth boys
if (GetPrivateProfileIntA("Misc", "CanSellUsedGeiger", 1, ini)) {
dlog("Applying fix for unable to sell used geiger counters or stealth boys.", DL_INIT);
SafeWrite8(0x478115, 0xBA);
SafeWrite8(0x478138, 0xBA);
MakeCall(0x474D22, &barter_attempt_transaction_hack, true);
HookCall(0x4798B1, &item_m_turn_off_hook);
dlogr(" Done", DL_INIT);
}
}
+4 -5
View File
@@ -60,10 +60,9 @@ void ConsoleExit() {
/* An attempt to make popup display function.. failed to make it work, though all arguments are there.
/* An attempt to make popup display function.. failed to make it work, though all arguments are there.
I missed something...
static const DWORD dialog_out_Addr = 0x41CF20;
void DisplayAlertPopup(const char* msg, const char* line2) {
__asm {
push 1
@@ -78,6 +77,6 @@ void DisplayAlertPopup(const char* msg, const char* line2) {
mov eax, line2
mov esi, 0FFFFFFFFh
mov edi, 2
call dialog_out_Addr
}
}*/
call dialog_out_
}
}*/
+11 -13
View File
@@ -18,8 +18,9 @@
#include "main.h"
#include "Version.h"
#include <stdio.h>
#include "FalloutEngine.h"
#include "version.h"
static DWORD InCredits=0;
static DWORD CreditsLine=0;
@@ -77,8 +78,7 @@ static void _stdcall ShowCreditsHook() {
CreditsLine=0;
__asm {
mov eax, creditsFile;
mov ebx, 0x42C860;
call ebx;
call credits_;
}
InCredits=0;
}
@@ -89,22 +89,21 @@ static DWORD _stdcall CreditsNextLine(char* buf, DWORD* font, DWORD* colour) {
if(strlen(line)) {
if(line[0]=='#') {
line++;
*font=*(DWORD*)0x56D74C;
*font=*(DWORD*)_name_font;
*colour=*(BYTE*)0x6A7F01;
} else if(line[0]=='@') {
line++;
*font=*(DWORD*)0x56D748;
*colour=*(DWORD*)0x56D750;
*font=*(DWORD*)_title_font;
*colour=*(DWORD*)_title_color;
} else {
*font=*(DWORD*)0x56D74C;
*colour=*(DWORD*)0x56D744;
*font=*(DWORD*)_name_font;
*colour=*(DWORD*)_name_color;
}
}
strcpy_s(buf, 256, line);
return 1;
}
static const DWORD _credits_get_next_line=0x42CE6C;
static void __declspec(naked) CreditsNextLineHook() {
__asm {
pushad;
@@ -113,14 +112,13 @@ static void __declspec(naked) CreditsNextLineHook() {
push eax;
call CreditsNextLine;
test eax, eax;
jz fail;
popad;
jz fail;
xor eax, eax;
inc eax;
retn;
fail:
popad;
jmp _credits_get_next_line;
jmp credits_get_next_line_;
}
}
@@ -128,4 +126,4 @@ void CreditsInit() {
HookCall(0x480C49, &ShowCreditsHook);
HookCall(0x43F881, &ShowCreditsHook);
HookCall(0x42CB49, &CreditsNextLineHook);
}
}
+8 -7
View File
@@ -18,9 +18,10 @@
#include "main.h"
#include "Criticals.h"
#include "Logging.h"
#include <stdio.h>
#include "Criticals.h"
#include "FalloutEngine.h"
#include "Logging.h"
static const DWORD CritTableCount=2*19+1; //Number of species in new critical table
//static const DWORD origCritTableSize = 6*9*20; //Number of entries in original table
@@ -72,13 +73,13 @@ void _stdcall ResetCriticalTable(DWORD critter, DWORD bodypart, DWORD slot, DWOR
//It's been a long time since we worried about win9x compatibility, so just sprintf it for goodness sake...
char section[16];
sprintf_s(section, "c_%02d_%d_%d", critter, bodypart, slot);
CritStruct* defaultTable=(CritStruct*)0x510978;
CritStruct* defaultTable=(CritStruct*)_crit_succ_eff;
critTable[slot].values[element]=critTable[slot].DamageMultiplier=GetPrivateProfileIntA(section, CritNames[element], defaultTable[slot].values[element], ".\\CriticalOverrides.ini");
}
void CritLoad() {
if (!Inited) return;
CritStruct* defaultTable=(CritStruct*)0x510978;
CritStruct* defaultTable=(CritStruct*)_crit_succ_eff;
if (mode==1) {
char section[16];
dlogr("Setting up critical hit table using CriticalOverrides.ini", DL_CRITICALS);
@@ -106,7 +107,7 @@ void CritLoad() {
dlogr("Setting up critical hit table using RP fixes", DL_CRITICALS);
memcpy(critTable, defaultTable, 6*9*19*sizeof(CritStruct));
memset(&critTable[6*9*19], 0, 6*9*19*sizeof(CritStruct));
memcpy(playerCrit, (void*)0x5179B0, 6*9*sizeof(CritStruct));
memcpy(playerCrit, (void*)_pc_crit_succ_eff, 6*9*sizeof(CritStruct));
if (mode==3) {
char buf[32], buf2[32], buf3[32];
@@ -150,7 +151,7 @@ void CritInit() {
dlog(". ", DL_INIT);
if(mode==2 || mode==3) {
CritStruct* defaultTable=(CritStruct*)0x510978;
CritStruct* defaultTable=(CritStruct*)_crit_succ_eff;
SetEntry(2,4,1,4,0);
SetEntry(2,4,1,5,5216);
@@ -250,4 +251,4 @@ void CritInit() {
Inited=true;
dlogr(" Done", DL_INIT);
}
}
+12 -13
View File
@@ -18,10 +18,11 @@
#include "main.h"
#include "DebugEditor.h"
#include "ScriptExtender.h"
#include "Arrays.h"
#include <vector>
#include "Arrays.h"
#include "DebugEditor.h"
#include "FalloutEngine.h"
#include "ScriptExtender.h"
#define CODE_EXIT (254)
#define CODE_SET_GLOBAL (0)
@@ -70,8 +71,6 @@ static bool InternalRecv(SOCKET s, void* _data, int size) {
}
return false;
}
static const DWORD obj_find_first_at_tile=0x48B5A8;
static const DWORD obj_find_next_at_tile=0x48B608;
static void RunEditorInternal(SOCKET &s) {
std::vector<DWORD*> vec = std::vector<DWORD*>();
for(int elv=0;elv<3;elv++) {
@@ -80,7 +79,7 @@ static void RunEditorInternal(SOCKET &s) {
__asm {
mov edx, tile;
mov eax, elv;
call obj_find_first_at_tile;
call obj_find_first_at_tile_;
mov obj, eax;
}
while(obj) {
@@ -88,7 +87,7 @@ static void RunEditorInternal(SOCKET &s) {
otype = (otype&0xff000000) >> 24;
if(otype==1) vec.push_back(obj);
__asm {
call obj_find_next_at_tile;
call obj_find_next_at_tile_;
mov obj, eax;
}
}
@@ -97,8 +96,8 @@ static void RunEditorInternal(SOCKET &s) {
int numCritters=vec.size();
int numGlobals=*(int*)0x5186C4;
int numMapVars=*(int*)0x519574;
int numGlobals=*(int*)_num_game_global_vars;
int numMapVars=*(int*)_num_map_global_vars;
int numSGlobals=GetNumGlobals();
int numArrays=GetNumArrays();
InternalSend(s, &numGlobals, 4);
@@ -112,8 +111,8 @@ static void RunEditorInternal(SOCKET &s) {
int* arrays=new int[numArrays*3];
GetArrays(arrays);
InternalSend(s, *(void**)0x5186C0, 4*numGlobals);
InternalSend(s, *(void**)0x51956C, 4*numMapVars);
InternalSend(s, *(void**)_game_global_vars, 4*numGlobals);
InternalSend(s, *(void**)_map_global_vars, 4*numMapVars);
InternalSend(s, sglobals, sizeof(sGlobalVar)*numSGlobals);
InternalSend(s, arrays, numArrays*3*4);
for(int i=0;i<numCritters;i++) InternalSend(s, &vec[i][25], 4);
@@ -127,12 +126,12 @@ static void RunEditorInternal(SOCKET &s) {
case 0:
InternalRecv(s, &id, 4);
InternalRecv(s, &val, 4);
(*(DWORD**)0x5186C0)[id]=val;
(*(DWORD**)_game_global_vars)[id]=val;
break;
case 1:
InternalRecv(s, &id, 4);
InternalRecv(s, &val, 4);
(*(DWORD**)0x51956C)[id]=val;
(*(DWORD**)_map_global_vars)[id]=val;
break;
case 2:
InternalRecv(s, &id, 4);
+10 -12
View File
@@ -19,8 +19,9 @@
#include "main.h"
#include "Elevators.h"
#include "FalloutEngine.h"
static const int ElevatorCount=50;
static const int ElevatorCount = 50;
static char File[MAX_PATH];
struct sElevator {
@@ -46,39 +47,36 @@ void SetElevator(DWORD id, DWORD index, DWORD value) {
*(DWORD*)(((DWORD)&Elevators[id])+index*4)=value;
}
static const DWORD GetMenuAddress=0x43F324;
static void __declspec(naked) GetMenuHook() {
__asm {
push ebx;
lea ebx, Menus;
shl eax, 2;
mov eax, [ebx+eax];
call GetMenuAddress;
call elevator_start_;
pop ebx;
ret;
}
}
static const DWORD UnknownAddress=0x43F73C;
static void __declspec(naked) UnknownHook() {
__asm {
push ebx;
lea ebx, Menus;
shl eax, 2;
mov eax, [ebx+eax];
call UnknownAddress;
call Check4Keys_;
pop ebx;
ret;
}
}
static const DWORD UnknownAddress2=0x43F6D0;
static void __declspec(naked) UnknownHook2() {
__asm {
push ebx;
lea ebx, Menus;
shl eax, 2;
mov eax, [ebx+eax];
call UnknownAddress2;
call elevator_end_;
pop ebx;
ret;
}
@@ -88,7 +86,7 @@ static void __declspec(naked) GetNumButtonsHook1() {
__asm {
lea esi, Menus;
mov eax, [esi+edi*4];
mov eax, [0x43EA1C+eax*4];
mov eax, [_btncnt+eax*4];
mov esi, 0x43F064;
jmp esi;
}
@@ -97,7 +95,7 @@ static void __declspec(naked) GetNumButtonsHook2() {
__asm {
lea edx, Menus;
mov eax, [edx+edi*4];
mov eax, [0x43EA1C+eax*4];
mov eax, [_btncnt+eax*4];
mov edx, 0x43F18B;
jmp edx;
}
@@ -106,14 +104,14 @@ static void __declspec(naked) GetNumButtonsHook3() {
__asm {
lea eax, Menus;
mov eax, [eax+edi*4];
mov eax, [0x43EA1C+eax*4];
mov eax, [_btncnt+eax*4];
mov ebx, 0x43F1EB;
jmp ebx;
}
}
void ResetElevators() {
memcpy(Elevators, (void*)0x43EA7C, sizeof(sElevator)*24);
memcpy(Elevators, (void*)_retvals, sizeof(sElevator)*24);
memset(&Elevators[24], 0, sizeof(sElevator)*(ElevatorCount-24));
for(int i=0;i<24;i++) Menus[i]=i;
for(int i=24;i<ElevatorCount;i++) Menus[i]=0;
@@ -159,4 +157,4 @@ void ElevatorsInit(char* file) {
SafeWrite8(0x43F1E4, 0xe9);
HookCall(0x43F1E4, GetNumButtonsHook3);
ResetElevators();
}
}
+7 -6
View File
@@ -156,10 +156,10 @@ const DWORD handle_inventory_ = 0x46E7B0;
const DWORD inc_game_time_ = 0x4A34CC;
const DWORD insert_withdrawal_ = 0x47A290;
const DWORD interpret_ = 0x46CCA4;
const DWORD interpretAddString_ = 0x467A80;
const DWORD interpretAddString_ = 0x467A80; // edx = ptr to string, eax = script
const DWORD interpretFindProcedure_ = 0x46DCD0;
const DWORD interpretFreeProgram_ = 0x467614;
const DWORD interpretGetString_ = 0x4678E0;
const DWORD interpretGetString_ = 0x4678E0; // eax = script ptr, edx = var type, ebx = var
const DWORD interpretPopLong_ = 0x467500;
const DWORD interpretPopShort_ = 0x4674F0;
const DWORD interpretPushLong_ = 0x4674DC;
@@ -245,7 +245,7 @@ const DWORD mouse_show_ = 0x4CA34C;
const DWORD move_inventory_ = 0x474708;
const DWORD NixHotLines_ = 0x4999C0;
const DWORD obj_ai_blocking_at_ = 0x48BA20;
const DWORD obj_blocking_at_ = 0x48B848;
const DWORD obj_blocking_at_ = 0x48B848; // (EAX *obj, EDX hexNum, EBX level)
const DWORD obj_bound_ = 0x48B66C;
const DWORD obj_change_fid_ = 0x48AA3C;
const DWORD obj_connect_ = 0x489EC4;
@@ -263,7 +263,7 @@ const DWORD obj_remove_outline_ = 0x48C2F0;
const DWORD obj_save_dude_ = 0x48D59C;
const DWORD obj_scroll_blocking_at_ = 0x48BB44;
const DWORD obj_set_light_ = 0x48AC90; // <eax>(int aObj<eax>, signed int aDist<edx>, int a3<ecx>, int aIntensity<ebx>)
const DWORD obj_shoot_blocking_at_ = 0x48B930;
const DWORD obj_shoot_blocking_at_ = 0x48B930; // (EAX *obj, EDX hexNum, EBX level)
const DWORD obj_sight_blocking_at_ = 0x48BB88;
const DWORD obj_use_book_ = 0x49B9F0;
const DWORD obj_use_power_on_car_ = 0x49BDE8;
@@ -300,7 +300,7 @@ const DWORD protinst_use_item_ = 0x49BF38;
const DWORD protinst_use_item_on_ = 0x49C3CC;
const DWORD proto_dude_update_gender_ = 0x49F984;
const DWORD proto_ptr_ = 0x4A2108; // eax - PID, edx - int** - pointer to a pointer to a proto struct
const DWORD pushLongStack_ = 0x46736C;
const DWORD pushLongStack_ = 0x46736C; // sometimes used instead of "SetResult"
const DWORD qsort_ = 0x4F05B6;
const DWORD queue_add_ = 0x4A258C;
const DWORD queue_clear_type_ = 0x4A2790;
@@ -351,7 +351,8 @@ const DWORD sprintf_ = 0x4F0041;
const DWORD square_num_ = 0x4B1F04;
const DWORD stat_get_base_direct_ = 0x4AF408;
const DWORD stat_get_bonus_ = 0x4AF474;
const DWORD stat_level_ = 0x4AEF48;
const DWORD stat_level_ = 0x4AEF48; // &GetCurrentStat(void* critter, int statID)
const DWORD stat_pc_add_experience_ = 0x4AFAA8;
const DWORD stat_pc_get_ = 0x4AF8FC;
const DWORD stat_pc_set_ = 0x4AF910;
const DWORD strncpy_ = 0x4F014F;
+8
View File
@@ -31,6 +31,7 @@
#define _art_name 0x56C9E4
#define _art_vault_guy_num 0x5108A4
#define _art_vault_person_nums 0x5108A8
#define _bckgnd 0x5707A4
#define _black_palette 0x663FD0
#define _bottom_line 0x664524
#define _btable 0x59E944
@@ -68,6 +69,7 @@
#define _gIsSteal 0x51D430
#define _gmovie_played_list 0x596C78
#define _GreenColor 0x6A3CB0
#define _gsound_initialized 0x518E30
#define _hit_location_penalty 0x510954
#define _holo_flag 0x664529
#define _holopages 0x66445C
@@ -115,6 +117,8 @@
#define _num_game_global_vars 0x5186C4
#define _num_map_global_vars 0x519574
#define _obj_dude 0x6610B8
#define _objItemOutlineState 0x519798
#define _optionRect 0x58ECC0
#define _outlined_object 0x518D94
#define _partyMemberAIOptions 0x519DB8
#define _partyMemberCount 0x519DAC
@@ -127,8 +131,10 @@
#define _pc_crit_succ_eff 0x5179B0
#define _pc_kill_counts 0x56D780
#define _pc_name 0x56D75C
#define _pc_proto 0x51C370
#define _pc_trait 0x66BE40
#define _pc_trait2 0x66BE44
#define _perk_data 0x519DCC
#define _perkLevelDataList 0x51C120
#define _pip_win 0x6644C4
#define _pipboy_message_file 0x664348
@@ -165,6 +171,7 @@
#define _text_width 0x51E3C0
#define _title_color 0x56D750
#define _title_font 0x56D748
#define _trait_data 0x51DB84
#define _view_page 0x664520
#define _wd_obj 0x59E98C
#define _wmLastRndTime 0x51DEA0
@@ -489,6 +496,7 @@ extern const DWORD square_num_;
extern const DWORD stat_get_base_direct_;
extern const DWORD stat_get_bonus_;
extern const DWORD stat_level_;
extern const DWORD stat_pc_add_experience_;
extern const DWORD stat_pc_get_;
extern const DWORD stat_pc_set_;
extern const DWORD strncpy_;
+20 -35
View File
@@ -18,6 +18,7 @@
#include "main.h"
#include "FalloutEngine.h"
#include "FileSystem.h"
#include "vector9x.cpp"
@@ -51,7 +52,6 @@ struct sFile {
openFile* file;
};
static const DWORD ptr_xfclose=0x4DED6C;
static void _stdcall xfclose(sFile* file) {
delete file->file;
delete file;
@@ -70,11 +70,10 @@ static void __declspec(naked) asm_xfclose(sFile* file) {
retn;
end:
popad;
jmp ptr_xfclose;
jmp xfclose_;
}
}
static const DWORD ptr_xfopen=0x4DEE2C;
static sFile* _stdcall xfopen(const char* path, const char* mode) {
for(DWORD i=0;i<files.size();i++) {
if(!_stricmp(path, files[i].name)) {
@@ -100,12 +99,11 @@ static __declspec(naked) sFile* asm_xfopen(const char* path, const char* mode) {
retn;
end:
popad;
jmp ptr_xfopen;
jmp xfopen_;
}
}
//db_fprintf calls xvfprintf, not xfprintf
static const DWORD ptr_xvfprintf=0x4DF1AC;
static int _stdcall xvfprintf() {
return -1;
}
@@ -122,10 +120,9 @@ static __declspec(naked) int asm_xvfprintf(sFile* file, const char* format, void
retn;
end:
popad;
jmp ptr_xvfprintf;
jmp xvfprintf_;
}
}
static const DWORD ptr_xfgetc=0x4DF22C;
static int _stdcall xfgetc(sFile* file) {
if(file->file->pos>=file->file->file->length) return -1;
return file->file->file->data[file->file->pos++];
@@ -144,11 +141,10 @@ static __declspec(naked) int asm_xfgetc(sFile* file) {
retn;
end:
popad;
jmp ptr_xfgetc;
jmp xfgetc_;
}
}
static const DWORD ptr_xfgets=0x4DF280;
static char* _stdcall xfgets(char* buf, int max_count, sFile* file) {
if(file->file->pos>=file->file->file->length) return 0;
for(int i=0;i<max_count;i++) {
@@ -179,10 +175,9 @@ static __declspec(naked) char* asm_xfgets(char* buf, int max_count, sFile* file)
retn;
end:
popad;
jmp ptr_xfgets;
jmp xfgets_;
}
}
static const DWORD ptr_xfputc=0x4DF320;
static int _stdcall xfputc(int c, sFile* file) {
return -1;
}
@@ -201,10 +196,9 @@ static __declspec(naked) int asm_xfputc(int c, sFile* file) {
retn;
end:
popad;
jmp ptr_xfputc;
jmp xfputc_;
}
}
static const DWORD ptr_xfputs=0x4DF380;
static int _stdcall xfputs(const char* str, sFile* file) {
return -1;
}
@@ -223,10 +217,9 @@ static __declspec(naked) int asm_xfputs(const char* str, sFile* file) {
retn;
end:
popad;
jmp ptr_xfputs;
jmp xfputs_;
}
}
static const DWORD ptr_xfungetc=0x4DF3F4;
static int _stdcall xfungetc(int c, sFile* file) {
if(file->file->pos==0) return -1;
if(file->file->file->data[file->file->pos-1]!=c) return -1;
@@ -248,10 +241,9 @@ static __declspec(naked) int asm_xfungetc(int c, sFile* file) {
retn;
end:
popad;
jmp ptr_xfungetc;
jmp xungetc_;
}
}
static const DWORD ptr_xfread=0x4DF44C;
static int _stdcall xfread(void* buf, int elsize, int count, sFile* file) {
for(int i=0;i<count;i++) {
if(file->file->pos+elsize>=file->file->file->length) return i;
@@ -277,10 +269,9 @@ static __declspec(naked) int asm_xfread(void* buf, int elsize, int count, sFile*
retn;
end:
popad;
jmp ptr_xfread;
jmp xfread_;
}
}
static const DWORD ptr_xfwrite=0x4DF4E8;
static int _stdcall xfwrite(const void* buf, int elsize, int count, sFile* file) {
return 0;
}
@@ -301,10 +292,9 @@ static __declspec(naked) int asm_xfwrite(const void* buf, int elsize, int count,
retn;
end:
popad;
jmp ptr_xfwrite;
jmp xfwrite_;
}
}
static const DWORD ptr_xfseek=0x4DF5D8;
static int _stdcall xfseek(sFile* file, long pos, int origin) {
switch(origin) {
case 1:
@@ -335,10 +325,9 @@ static __declspec(naked) int asm_xfseek(sFile* file, long pos, int origin) {
retn;
end:
popad;
jmp ptr_xfseek;
jmp xfseek_;
}
}
static const DWORD ptr_xftell=0x4DF690;
static long _stdcall xftell(sFile* file) {
return file->file->pos;
}
@@ -356,10 +345,9 @@ static __declspec(naked) long asm_xftell(sFile* file) {
retn;
end:
popad;
jmp ptr_xftell;
jmp xftell_;
}
}
static const DWORD ptr_xfrewind=0x4DF6E4;
static void _stdcall xfrewind(sFile* file) {
file->file->pos=0;
}
@@ -377,10 +365,9 @@ static __declspec(naked) void asm_xfrewind(sFile* file) {
retn;
end:
popad;
jmp ptr_xfrewind;
jmp xrewind_;
}
}
static const DWORD ptr_xfeof=0x4DF780;
static int _stdcall xfeof(sFile* file) {
if(file->file->pos>=file->file->file->length) return 1;
else return 0;
@@ -399,10 +386,9 @@ static __declspec(naked) int asm_xfeof(sFile* file) {
retn;
end:
popad;
jmp ptr_xfeof;
jmp xfeof_;
}
}
static const DWORD ptr_xfilelength=0x4DF828;
static int _stdcall xfilelength(sFile* file) {
return file->file->file->length;
}
@@ -420,7 +406,7 @@ static __declspec(naked) int asm_xfilelength(sFile* file) {
retn;
end:
popad;
jmp ptr_xfilelength;
jmp xfilelength_;
}
}
@@ -569,23 +555,22 @@ DWORD _stdcall FScopy(const char* path, const char* source) {
__asm {
mov eax, source;
mov edx, mode;
call ptr_xfopen;
call xfopen_;
mov file, eax;
}
if(!file) return -1;
__asm {
mov eax, file;
call ptr_xfilelength;
call xfilelength_;
mov fsize, eax;
}
char* fdata=new char[fsize];
__asm {
mov eax, file;
call ptr_xfclose;
call xfclose_;
mov eax, source;
mov edx, fdata;
mov ebx, 0x4C5DD4;
call ebx;
call db_read_to_buf_;
}
fsFile* fsfile=0;
for(DWORD i=0;i<files.size();i++) {
+1736 -1841
View File
File diff suppressed because it is too large Load Diff
+22 -41
View File
@@ -1,70 +1,65 @@
#include "FalloutEngine.h"
#include "Imports.h"
int db_fclose(sFile* file) {
DWORD addr=0x4C5EB4;
int result;
_asm {
mov eax, file;
call addr;
call db_fclose_;
mov result, eax;
}
return result;
}
sFile* db_fopen(const char* path, const char* mode) {
DWORD addr=0x4C5EC8;
sFile* result;
_asm {
mov eax, path;
mov edx, mode;
call addr;
call db_fopen_;
mov result, eax;
}
return result;
}
int db_fgetc(sFile* file) {
DWORD addr=0x4C5F24;
int result;
_asm {
mov eax, file;
call addr;
call db_fgetc_;
mov result, eax;
}
return result;
}
char* db_fgets(char* buf, int max_count, sFile* file) {
DWORD addr=0x4C5F70;
char* result;
_asm {
mov eax, buf;
mov edx, max_count;
mov ebx, file;
call addr;
call db_fgets_;
mov result, eax;
}
return result;
}
//int db_ungetc(int c, sFile* file);
int db_fread(void* buf, int elsize, int count, sFile* file) {
DWORD addr=0x4C5FFC;
int result;
_asm {
mov eax, buf;
mov edx, elsize;
mov ebx, count;
mov ecx, file;
call addr;
call db_fread_;
mov result, eax;
}
return result;
}
int db_fseek(sFile* file, long pos, int origin) {
DWORD addr=0x4C60C0;
int result;
_asm {
mov eax, file;
mov edx, pos;
mov ebx, origin;
call addr;
call db_fseek_;
mov result, eax;
}
return result;
@@ -73,45 +68,41 @@ int db_fseek(sFile* file, long pos, int origin) {
//void db_rewind(sFile* file);
//int db_feof(sFile* file);
int db_freadByte(sFile* file, __int8* _out) {
DWORD addr=0x4C60E0;
int result;
_asm {
mov eax, file;
mov edx, _out;
call addr;
call db_freadByte_;
mov result, eax;
}
return result;
}
int db_freadShort(sFile* file, __int16* _out) {
DWORD addr=0x4C60F4;
int result;
_asm {
mov eax, file;
mov edx, _out;
call addr;
call db_freadShort_;
mov result, eax;
}
return result;
}
int db_freadInt(sFile* file, __int32* _out) {
DWORD addr=0x4C614C;
int result;
_asm {
mov eax, file;
mov edx, _out;
call addr;
call db_freadInt_;
mov result, eax;
}
return result;
}
int db_freadFloat(sFile* file, float* _out) {
DWORD addr=0x4C614C;
int result;
_asm {
mov eax, file;
mov edx, _out;
call addr;
call db_freadInt_;
mov result, eax;
}
return result;
@@ -122,107 +113,97 @@ int db_freadFloat(sFile* file, float* _out) {
//int db_freadFloatCount(sFile* file, float* ptr, int count);
int message_init(sMsgFile* file) {
DWORD addr=0x48494C;
int result;
_asm {
mov eax, file;
call addr;
call message_init_;
mov result, eax;
}
return result;
}
int message_exit(sMsgFile* file) {
DWORD addr=0x484964;
int result;
_asm {
mov eax, file;
call addr;
call message_exit_;
mov result, eax;
}
return result;
}
int message_load(sMsgFile* file, char* path) {
DWORD addr=0x484AA4;
int result;
_asm {
mov eax, file;
mov edx, path
call addr;
call message_load_;
mov result, eax;
}
return result;
}
int message_search(sMsgFile* file, sMessage* msg) {
DWORD addr=0x484C30;
int result;
_asm {
mov eax, file;
mov edx, msg;
call addr;
call message_search_;
mov result, eax;
}
return result;
}
int message_make_path(char* outpath, char* path) {
DWORD addr=0x484CB8;
int result;
_asm {
mov eax, outpath;
mov edx, path;
call addr;
call message_make_path_;
mov result, eax;
}
return result;
}
int message_find(sMsgFile* file, DWORD number, DWORD* _out) {
DWORD addr=0x484D10;
int result;
_asm {
mov eax, file;
mov edx, number;
mov ebx, _out;
call addr;
call message_find_;
mov result, eax;
}
return result;
}
int message_add(sMsgFile* file, sMessage* msg) {
DWORD addr=0x484D68;
int result;
_asm {
mov eax, file;
mov edx, msg;
call addr;
call message_add_;
mov result, eax;
}
return result;
}
char* getmsg(sMsgFile* file, sMessage* msg, DWORD num) {
DWORD addr=0x48504C;
char* result;
_asm {
mov eax, file;
mov edx, msg;
mov ebx, num;
call addr;
call getmsg_;
mov result, eax;
}
return result;
}
int message_filter(sMsgFile* file) {
DWORD addr=0x485078;
int result;
_asm {
mov eax, file;
call addr;
call message_filter_;
mov result, eax;
}
return result;
}
void get_input() {
DWORD addr=0x4C8B78;
_asm {
call addr;
call get_input_;
}
}
}
+23 -16
View File
@@ -37,14 +37,13 @@ struct sMessage {
char* audio;
char* message;
};
static const DWORD message_search=0x484C30;
static const char* MsgSearch(int msgno, DWORD file) {
if(!file) return 0;
sMessage msg = { msgno, 0, 0, 0 };
__asm {
lea edx, msg;
mov eax, file;
call message_search;
call message_search_;
}
return msg.message;
}
@@ -100,7 +99,7 @@ void InventoryKeyPressedHook(DWORD dxKey, bool pressed, DWORD vKey) {
DWORD result;
__asm {
mov eax, critter;
call item_total_weight;
call item_total_weight_;
mov result, eax;
}
@@ -373,13 +372,13 @@ static __declspec(naked) void DisplayStatsHook() {
call CritterCheck;
jz nolimit;
push eax;
mov eax, ds:[0x59E86C];
mov eax, ds:[_stack];
push ecx;
push InvenFmt1;
push offset InvenFmt;
call strcpy_wrapper;
pop ecx;
mov eax, ds:[0x59E86C];
mov eax, ds:[_stack];
call item_total_size;
push eax;
push ecx;
@@ -397,7 +396,7 @@ nolimit:
push eax;
push eax;
end:
mov eax, ds:[0x59E86C];
mov eax, ds:[_stack];
mov edx, 0xc;
jmp DisplayStatsEnd;
}
@@ -406,11 +405,11 @@ end:
static char SizeMsgBuf[32];
static const char* _stdcall FmtSizeMsg(int size) {
if(size==1) {
const char* tmp=MsgSearch(543, 0x6647FC);
const char* tmp=MsgSearch(543, _proto_main_msg_file);
if(!tmp) strcpy(SizeMsgBuf, "It occupies 1 unit.");
else sprintf(SizeMsgBuf, tmp, size);
} else {
const char* tmp=MsgSearch(542, 0x6647FC);
const char* tmp=MsgSearch(542, _proto_main_msg_file);
if(!tmp) sprintf(SizeMsgBuf, "It occupies %d units.", size);
else sprintf(SizeMsgBuf, tmp, size);
}
@@ -514,7 +513,7 @@ static void __declspec(naked) add_check_for_item_ammo_cost() {
pushad
push 1 // hook type
call AmmoCostHookWrapper
add esp, 4
add esp, 4
popad
mov eax, [esp]
cmp eax, ebx
@@ -544,7 +543,7 @@ static void __declspec(naked) divide_burst_rounds_by_ammo_cost() {
pushad
push 2
call AmmoCostHookWrapper
add esp, 4
add esp, 4
popad
mov edx, 0
mov eax, ebp // rounds in burst
@@ -600,11 +599,10 @@ static void __declspec(naked) inven_action_cursor_hack() {
}
}
static void __declspec(naked) item_add_mult_hack() {
static void __declspec(naked) item_add_mult_hook() {
__asm {
call SetDefaultAmmo
call item_add_force_
retn
jmp item_add_force_
}
}
@@ -655,11 +653,20 @@ void InventoryInit() {
ReloadWeaponKey = GetPrivateProfileInt("Input", "ReloadWeaponKey", 0, ini);
if(GetPrivateProfileIntA("Misc", "StackEmptyWeapons", 0, ini)) {
if (GetPrivateProfileIntA("Misc", "StackEmptyWeapons", 0, ini)) {
MakeCall(0x4736C6, &inven_action_cursor_hack, true);
HookCall(0x4772AA, &item_add_mult_hack);
HookCall(0x4772AA, &item_add_mult_hook);
}
//Do not call the 'Move Items' window when using drap and drop to reload weapons in the inventory
int ReloadReserve = GetPrivateProfileIntA("Misc", "ReloadReserve", 1, ini);
if (ReloadReserve >= 0) {
SafeWrite32(0x47655F, ReloadReserve); // mov eax, ReloadReserve
SafeWrite32(0x476563, 0x097EC139); // cmp ecx, eax; jle 0x476570
SafeWrite16(0x476567, 0xC129); // sub ecx, eax
SafeWrite8(0x476569, 0x91); // xchg ecx, eax
};
}
void InventoryReset() {
invenapcost=GetPrivateProfileInt("Misc", "InventoryApCost", 4, ini);
}
}
+5 -4
View File
@@ -18,6 +18,7 @@
#include "main.h"
#include "FalloutEngine.h"
#include "version.h"
static int usingExtraKillTypes;
@@ -27,7 +28,7 @@ bool UsingExtraKillTypes() { return usingExtraKillTypes!=0; }
//Might as well do this in asm, or the custom prolog code would end up being longer than the function
static DWORD __declspec(naked) ReadKillCounter(DWORD killtype) {
//if(killtype>38) return 0;
//return ((WORD*)0x0056D780)[killtype];
//return ((WORD*)_pc_kill_counts)[killtype];
__asm {
cmp eax, 38;
jle func;
@@ -35,7 +36,7 @@ static DWORD __declspec(naked) ReadKillCounter(DWORD killtype) {
ret;
func:
push ebx;
lea ebx, ds:[0x0056D780+eax*2];
lea ebx, ds:[_pc_kill_counts+eax*2];
xor eax,eax;
mov ax, word ptr [ebx]
pop ebx;
@@ -45,14 +46,14 @@ func:
static void __declspec(naked) IncKillCounter(DWORD killtype) {
//if(killtype>38) return;
//((WORD*)0x0056D780)[killtype]++;
//((WORD*)_pc_kill_counts)[killtype]++;
__asm {
cmp eax, 38;
jle func;
ret;
func:
push ebx;
lea ebx, ds:[0x0056D780+eax*2];
lea ebx, ds:[_pc_kill_counts+eax*2];
xor eax, eax;
mov ax, word ptr [ebx];
inc ax;
+3 -3
View File
@@ -19,6 +19,7 @@
#include "main.h"
#include <math.h>
#include "FalloutEngine.h"
#include "Knockback.h"
#include "vector9x.cpp"
@@ -47,7 +48,6 @@ static ChanceModifier BaseHitChance;
static ChanceModifier BasePickpocket;
static bool hookedAimedShot;
static const DWORD item_w_damage_type=0x478570;
static const DWORD aimedShotRet1=0x478EE4;
static const DWORD aimedShotRet2=0x478EEA;
static vector<DWORD> disabledAS;
@@ -320,7 +320,7 @@ disable:
realfunc:
pop edx;
pop eax;
jmp item_w_damage_type;
jmp item_w_damage_type_;
}
}
static void HookAimedShots() {
@@ -338,4 +338,4 @@ void _stdcall ForceAimedShots(DWORD pid) {
for(DWORD i=0;i<disabledAS.size();i++) if(disabledAS[i]==pid) disabledAS.remove_at(i--);
for(DWORD i=0;i<forcedAS.size();i++) if(forcedAS[i]==pid) return;
forcedAS.push_back(pid);
}
}
+42 -96
View File
@@ -18,27 +18,27 @@
#include "main.h"
#include "LoadGameHook.h"
#include "FalloutEngine.h"
#include "graphics.h"
#include "ScriptExtender.h"
#include "version.h"
#include "Knockback.h"
#include "input.h"
#include "perks.h"
#include "Criticals.h"
#include "AI.h"
#include "Arrays.h"
#include "Console.h"
#include "Criticals.h"
#include "FalloutEngine.h"
#include "FileSystem.h"
#include "Graphics.h"
#include "HeroAppearance.h"
#include "input.h"
#include "Inventory.h"
#include "Knockback.h"
#include "LoadGameHook.h"
#include "Logging.h"
#include "movies.h"
#include "SuperSave.h"
#include "skills.h"
#include "AI.h"
#include "Inventory.h"
#include "Arrays.h"
#include "sound.h"
#include "PartyControl.h"
#include "perks.h"
#include "ScriptExtender.h"
#include "skills.h"
#include "sound.h"
#include "SuperSave.h"
#include "version.h"
#define MAX_GLOBAL_SIZE (MaxGlobalVars*12 + 4)
@@ -89,7 +89,7 @@ static void _stdcall ResetState(DWORD onLoad) {
}
void GetSavePath(char* buf, int type) {
int saveid = *(int*)0x005193B8 + 1 +LSPageOffset;//add SuperSave Page offset
int saveid = *(int*)_slot_cursor + 1 +LSPageOffset;//add SuperSave Page offset
char buf2[6];
//Fallout saving is independent of working directory
struct sPath {
@@ -98,10 +98,10 @@ void GetSavePath(char* buf, int type) {
int b;
sPath* next;
};
sPath* spath=*(sPath**)0x006B24D0;
sPath* spath=*(sPath**)_paths;
while(spath->a&&spath->next) spath=spath->next;
//strcpy_s(buf, MAX_PATH, **(char***)0x006B24D0);
//strcpy_s(buf, MAX_PATH, **(char***)_paths);
strcpy_s(buf, MAX_PATH, spath->path);
strcat_s(buf, MAX_PATH, "\\savegame\\slot");
_itoa_s(saveid, buf2, 10);
@@ -160,17 +160,15 @@ static DWORD _stdcall combatSaveTest() {
DWORD bonusmove;
__asm {
mov edx, 8;
mov eax, ds:[0x6610B8];
mov ebx, 0x4AEF48;
call ebx;
mov eax, ds:[_obj_dude];
call stat_level_;
mov ap, eax;
mov eax, ds:[0x6610B8];
mov eax, ds:[_obj_dude];
mov edx, 3;
mov ebx, 0x496B78;
call ebx;
call perk_level_;
mov bonusmove, eax;
}
if(*(DWORD*)(*(DWORD*)0x6610B8 + 0x40) != ap || bonusmove*2!=*(DWORD*)0x0056D39C) {
if(*(DWORD*)(*(DWORD*)_obj_dude + 0x40) != ap || bonusmove*2!=*(DWORD*)_combat_free_move) {
DisplayConsoleMessage(SaveFailMsg);
return 0;
}
@@ -248,10 +246,7 @@ static void __declspec(naked) LoadSlot() {
pushad;
call LoadGame2_Before;
popad;
push ebx;
mov ebx, 0x0047DC68;
call ebx;
pop ebx;
call LoadSlot_;
retn;
}
}
@@ -262,8 +257,7 @@ static void __declspec(naked) LoadGame() {
push ecx;
push edx;
or InLoop, LOADGAME;
mov ebx, 0x0047C640;
call ebx;
call LoadGame_;
/*push eax;
push 0x0000101f;
push 0x0045E949;
@@ -312,10 +306,7 @@ static void __declspec(naked) NewGame() {
pushad;
call NewGame2;
popad;
push ebx;
mov ebx, 0x00480E48;
call ebx;
pop ebx;
call main_game_loop_;
retn;
}
}
@@ -327,118 +318,89 @@ static void __declspec(naked) MainMenu() {
call ResetState;
call LoadHeroAppearance;
popad;
push ebx;
mov ebx, 0x00481AEC;
call ebx;
pop ebx;
call main_menu_loop_;
retn;
}
}
static void __declspec(naked) WorldMapHook() {
__asm {
push ebx;
or InLoop, WORLDMAP;
xor eax, eax;
mov ebx, 0x004BFE10;
call ebx;
call wmWorldMapFunc_;
and InLoop, (-1^WORLDMAP);
pop ebx;
retn;
}
}
static void __declspec(naked) WorldMapHook2() {
__asm {
push ebx;
or InLoop, WORLDMAP;
mov ebx, 0x004BFE10;
call ebx;
call wmWorldMapFunc_;
and InLoop, (-1^WORLDMAP);
pop ebx;
retn;
}
}
static void __declspec(naked) CombatHook() {
__asm {
push ebx;
pushad;
call AICombatStart;
popad
or InLoop, COMBAT;
mov ebx, 0x00422D2C;
call ebx;
call combat_;
pushad;
call AICombatEnd;
popad
and InLoop, (-1^COMBAT);
pop ebx;
retn;
}
}
static void __declspec(naked) PlayerCombatHook() {
__asm {
push ebx;
or InLoop, PCOMBAT;
mov ebx, 0x004227F4;
call ebx;
call combat_input_;
and InLoop, (-1^PCOMBAT);
pop ebx;
retn;
}
}
static void __declspec(naked) EscMenuHook() {
__asm {
push ebx;
or InLoop, ESCMENU;
mov ebx, 0x0048FC50;
call ebx;
call do_optionsFunc_;
and InLoop, (-1^ESCMENU);
pop ebx;
retn;
}
}
static void __declspec(naked) EscMenuHook2() {
//Bloody stupid watcom compiler optimizations...
__asm {
push ebx;
or InLoop, ESCMENU;
mov ebx, 0x0048FC48;
call ebx;
call do_options_;
and InLoop, (-1^ESCMENU);
pop ebx;
retn;
}
}
static void __declspec(naked) OptionsMenuHook() {
__asm {
push ebx;
or InLoop, OPTIONS;
mov ebx, 0x00490798;
call ebx;
call do_prefscreen_;
and InLoop, (-1^OPTIONS);
pop ebx;
retn;
}
}
static void __declspec(naked) HelpMenuHook() {
__asm {
push ebx;
or InLoop, HELP;
mov ebx, 0x00443F74;
call ebx;
call game_help_;
and InLoop, (-1^HELP);
pop ebx;
retn;
}
}
static void __declspec(naked) CharacterHook() {
__asm {
push ebx;
or InLoop, CHARSCREEN;
pushad;
call PerksEnterCharScreen;
popad;
mov ebx, 0x00431DF8;
call ebx;
call editor_design_;
pushad;
test eax, eax;
jz success;
@@ -449,62 +411,46 @@ success:
end:
popad;
and InLoop, (-1^CHARSCREEN);
pop ebx;
retn;
}
}
static void __declspec(naked) DialogHook() {
__asm {
push ebx;
or InLoop, DIALOG;
mov ebx, 0x004465C0;
call ebx;
call gdProcess_;
and InLoop, (-1^DIALOG);
pop ebx;
retn;
}
}
static void __declspec(naked) PipboyHook() {
__asm {
push ebx;
or InLoop, PIPBOY;
mov ebx, 0x00497004;
call ebx;
call pipboy_;
and InLoop, (-1^PIPBOY);
pop ebx;
retn;
}
}
static void __declspec(naked) SkilldexHook() {
__asm {
push ebx;
or InLoop, SKILLDEX;
mov ebx, 0x004ABFD0;
call ebx;
call skilldex_select_;
and InLoop, (-1^SKILLDEX);
pop ebx;
retn;
}
}
static void __declspec(naked) InventoryHook() {
__asm {
push ebx;
or InLoop, INVENTORY;
mov ebx, 0x0046E7B0;
call ebx;
call handle_inventory_;
and InLoop, (-1^INVENTORY);
pop ebx;
retn;
}
}
static void __declspec(naked) AutomapHook() {
__asm {
push ebx;
or InLoop, AUTOMAP;
mov ebx, 0x0041B8BC;
call ebx;
call automap_;
and InLoop, (-1^AUTOMAP);
pop ebx;
retn;
}
}
@@ -527,7 +473,7 @@ void LoadGameHookInit() {
HookCall(0x48FD35, LoadGame);
HookCall(0x443AAC, SaveGame);
HookCall(0x443B1C, SaveGame);
HookCall(0x48FcFF, SaveGame);
HookCall(0x48FCFF, SaveGame);
HookCall(0x480A28, MainMenu);

Some files were not shown because too many files have changed in this diff Show More