mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Merge branch '3.8-maintenance'
This commit is contained in:
+5
-17
@@ -1,5 +1,5 @@
|
||||
;sfall configuration settings
|
||||
;v3.8.2
|
||||
;v3.8.3
|
||||
|
||||
[Main]
|
||||
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
|
||||
@@ -169,21 +169,6 @@ WorldMapDelay2=66
|
||||
WorldMapEncounterFix=0
|
||||
WorldMapEncounterRate=5
|
||||
|
||||
;XX OBSOLETE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
;XX
|
||||
;XX ;This will change the physical speed at which you move across the map
|
||||
;XX ;Set to 0 to leave at the default. (i.e. limited by vwait in windowed mode, or by processor speed in fullscreen)
|
||||
;XX ;If set to something other than 0, it enforces a maximum fps on the world map screen.
|
||||
;XX ;Changing this to something other than 0 is not recommended if you've already applied a world map speed patch to your Fallout exe.
|
||||
;XX WorldMapFPS=0
|
||||
;XX
|
||||
;XX ;Only set to 1 if your systems high performance timer is unreliable for some reason
|
||||
;XX ForceLowResolutionTimer=0
|
||||
;XX
|
||||
;XX ;Obsolete, but can still be used if you know what it does.
|
||||
;XX ;WorldMapDelay=0
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
|
||||
;The number of slots available in the locations list panel of the world map
|
||||
;Set to 0 to leave unchanged. 17 is default.
|
||||
;Setting this greater than 17 requires a replacement background frm, or you'll get glitched graphics
|
||||
@@ -403,6 +388,7 @@ ExtraSaveSlots=0
|
||||
SpeedInterfaceCounterAnims=0
|
||||
|
||||
;These lines allow you to control the karma frm's displayed on the character screen
|
||||
;Number of KarmaPoints should be 1 less than number of KarmaFRMs
|
||||
;KarmaFRMsCount=3
|
||||
;KarmaFRMs=47,48,49
|
||||
;KarmaPoints=-100,100
|
||||
@@ -455,7 +441,7 @@ BoostScriptDialogLimit=0
|
||||
;DerivedStats=Stats.ini
|
||||
|
||||
;These options modify the checks to see if a critter can carry an additional item, changing which items are counted towards the weight limit and adding an additional size check
|
||||
;Set the mode to 0 to disable the size check, 1 to apply to pc only, 2 to apply to the pc and party members, or 3 to apply to all critters
|
||||
;Set the mode to 0 to disable the size check, 1 to apply to the PC only, 2 to apply to the PC and party members, or 3 to apply to all critters
|
||||
;Only the PC uses CritterInvSizeLimit. Other critters will use the extra unused stat (STAT_unused = 10)
|
||||
;Add 4 to the mode to limit the weight check to used items only
|
||||
CritterInvSizeLimitMode=0
|
||||
@@ -608,10 +594,12 @@ DebugMode=0
|
||||
SkipCompatModeCheck=0
|
||||
|
||||
;Set to 1 to skip the executable file size check
|
||||
;Does not require enabling sfall debugging mode
|
||||
SkipSizeCheck=0
|
||||
|
||||
;If you're testing changes to the Fallout exe, you can override the CRC that sfall looks for here
|
||||
;You can use several hex values, separated by commas
|
||||
;Does not require enabling sfall debugging mode
|
||||
;ExtraCRC=0x00000000,0x00000000
|
||||
|
||||
;Set to 1 to stop Fallout from deleting non readonly protos at startup
|
||||
|
||||
@@ -224,5 +224,4 @@
|
||||
#define WPN_ANIM_MINIGUN (0x09) // (L)
|
||||
#define WPN_ANIM_ROCKET_LAUNCHER (0x0A) // (M)
|
||||
|
||||
|
||||
#endif // DEFINE_EXTRA_H
|
||||
|
||||
@@ -6,29 +6,48 @@ Hook scripts are specially named scripts that are run by sfall at specific point
|
||||
|
||||
In addition to the bit of code it overrides, the script will be run once when first loaded and again at each player reload to allow for setup. Hook scripts have access to a set of arguments supplied to sfall, but aren't required to use them all. They also return one or more values, but again they're optional, and you only need to return a value if you want to override the default.
|
||||
|
||||
As good practise to aid in mod compatibility, only use the hs_xxx .int script if you are setting return values. For any other scripts, use a normal global script combined with register_hook or register_hook_proc.
|
||||
To aid in mods compatibility, avoid using hs_xxx .int scripts. Instead it is recommended to use a normal global script combined with register_hook_proc or register_hook.
|
||||
|
||||
There are script functions specific to hook scripts:
|
||||
Example setup for a hook-script based mod:
|
||||
|
||||
int init_hook()
|
||||
|
||||
|
||||
procedure tohit_hook_handler begin
|
||||
display_msg("Modifying hit_hook " + get_sfall_arg);
|
||||
set_hit_chance_max(100);
|
||||
set_sfall_return(100);
|
||||
end
|
||||
|
||||
procedure start begin
|
||||
if game_loaded then begin
|
||||
register_hook_proc(HOOK_TOHIT, tohit_hook_handler);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
There are script functions available, specific to hook scripts:
|
||||
|
||||
> int init_hook()
|
||||
The hook script equivilent of game_loaded; it returns 2 when the script is first loaded, 1 when the player reloads and 0 otherwise.
|
||||
|
||||
mixed get_sfall_arg()
|
||||
> mixed get_sfall_arg()
|
||||
Gets the next argument from sfall. Each time it's called it returns the next argument, or otherwise it returns 0 if there are no more arguments left.
|
||||
|
||||
int get_sfall_args()
|
||||
> array get_sfall_args()
|
||||
Returns all hook arguments as a new temp array.
|
||||
|
||||
void set_sfall_return(int value)
|
||||
> void set_sfall_return(int value)
|
||||
Used to return the new values from the script. Each time it's called it sets the next value, or if you've already set all return values it does nothing.
|
||||
|
||||
void set_sfall_arg(int argnum, int value)
|
||||
> void set_sfall_arg(int argnum, int value)
|
||||
Changes argument value. This is usefull if you have several hook scripts attached to one hook point (see below).
|
||||
|
||||
void register_hook(int hooktype)
|
||||
> void register_hook(int hooktype)
|
||||
Used from a normal global script if you want to run it at the same point a full hook script would normally run. In case of this function, "start" proc will be execuded in a current global script. You can use all above functions like normal.
|
||||
|
||||
void register_hook_proc(int hooktype, proc procedure)
|
||||
> void register_hook_proc(int hooktype, proc procedure)
|
||||
The same as register_hook, except that you specifically define which procedure in the current script should be called as a hook (instead of "start"). Pass procedure the same as how you use dialog option functions. This IS the recommended way to use hook scripts, as it gives both modularity (each mod logic in a separate global script, no conflicts if you don't use "hs_*.int" scripts) and flexibility (you can place all related hook scripts for specific mod in a single script!).
|
||||
|
||||
NOTE: you can hook several scripts to a single hook point, for example if it's different mods from different authors or just some different aspects of one larger mod. In this case scripts are executed in reverse order of how they were registered. When one of the scripts in a chain returns value with "set_sfall_return", the next script may override this value if calls "set_sfall_return" again. Sometimes you need to multiply certain value in a chain of hook scripts.
|
||||
@@ -56,7 +75,7 @@ The defines to use for the hooktype are in sfall.h.
|
||||
----------- HOOK SCRIPT TYPES -------------
|
||||
-------------------------------------------
|
||||
|
||||
hs_tohit.int
|
||||
HOOK_TOHIT (hs_tohit.int)
|
||||
|
||||
Runs when fallout is calculating the chances of an attack striking a target
|
||||
Runs after the hit chance is fully calculated normally, including applying the 95% cap
|
||||
@@ -65,12 +84,15 @@ int arg1 - The unmodified hit chance
|
||||
critter arg2 - The attacker
|
||||
critter arg3 - The target of the attack
|
||||
int arg4 - The targeted bodypart
|
||||
int arg5 - Source tile (may differ from attacker's tile, when AI is considering potential fire position)
|
||||
int arg6 - Attack Type (one of ATKTYPE_*)
|
||||
int arg7 - Ranged flag (0 or 1, actually passed 1 even for unarmed attacks, may be a vanilla bug)
|
||||
|
||||
int ret1 - the new hit chance
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_afterhitroll.int
|
||||
HOOK_AFTERHITROLL (hs_afterhitroll.int)
|
||||
|
||||
Runs after fallout has decided if an attack will hit or miss
|
||||
|
||||
@@ -86,7 +108,7 @@ critter ret3 - Override the target of the attack
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_calcapcost.int
|
||||
HOOK_CALCAPCOST (hs_calcapcost.int)
|
||||
|
||||
Runs whenever fallout is calculating the ap cost of using the weapon (or unarmed attack). Doesn't run for using other item types or moving.
|
||||
Note that the first time a game is loaded, this script doesn't run before the initial interface is drawn, so if the script effects the ap cost of whatever is in the players hands at the time the wrong ap cost will be shown. It will be fixed the next time the interface is redrawn.
|
||||
@@ -101,7 +123,7 @@ int ret1 - The new ap cost
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_deathanim1.int
|
||||
HOOK_DEATHANIM1 (hs_deathanim1.int)
|
||||
|
||||
Runs before fallout tries to calculate the death animation. Lets you switch out which weapon fallout sees
|
||||
|
||||
@@ -114,7 +136,7 @@ int ret1 - The pid of an object to override the attacking weapon with
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_deathanim2.int
|
||||
HOOK_DEATHANIM2 (hs_deathanim2.int)
|
||||
|
||||
Runs after fallout has calculated the death animation. Lets you set your own custom frame id, so more powerful than hs_deathanim1, but performs no validation.
|
||||
When using critter_dmg function, this script will also run. In that case weapon pid will be -1 and target will point to an object with obj_art_fid == 0x20001F5.
|
||||
@@ -129,7 +151,7 @@ int ret1 - The death anim id to override with
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_combatdamage.int
|
||||
HOOK_COMBATDAMAGE (hs_combatdamage.int)
|
||||
|
||||
Runs when:
|
||||
1) Game calculates how much damage each target will get. This includes primary target as well as all extras (explosions and bursts). This happens BEFORE the actual attack animation.
|
||||
@@ -156,7 +178,7 @@ int ret5 - The amount of knockback to the target
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_ondeath.int
|
||||
HOOK_ONDEATH (hs_ondeath.int)
|
||||
|
||||
Runs immediately after a critter dies for any reason. No return values; this is just a convinence for when you need to do something after death for a large number of different critters and don't want to have to script each and every one of them.
|
||||
|
||||
@@ -164,7 +186,7 @@ Critter arg1 - The critter that just died
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_findtarget.int
|
||||
HOOK_FINDTARGET (hs_findtarget.int)
|
||||
|
||||
Runs when the ai is trying to pick a target in combat. Fallout first chooses a list of 4 likely suspects, then normally sorts them in order of weakness/distance/etc depending on the ai caps of the attacker. This hook replaces that sorting function, allowing you to sort the targets in some arbitrary way. Use sfall_return to give the 4 targets, in order of preference. All 4 must be given if you want to override normal sorting; if you want to specify less than 4 targets fill in the extra spaces with 0's. If you do not give 4 targets, the npcs normal sorting mechanism will be used.
|
||||
|
||||
@@ -183,7 +205,7 @@ critter ret4 - The fourth choice of target
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_useobjon.int
|
||||
HOOK_USEOBJON (hs_useobjon.int)
|
||||
|
||||
Runs when:
|
||||
1) a critter uses an object on another critter. (Or themselves)
|
||||
@@ -201,7 +223,7 @@ int ret1 - overrides hard-coded handler and selects what should happen with
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_useobj.int
|
||||
HOOK_USEOBJ (hs_useobj.int)
|
||||
|
||||
Runs when:
|
||||
1) a critter uses an object from inventory which have "Use" action flag set or it's an active flare or dynamite.
|
||||
@@ -217,7 +239,7 @@ int ret1 - overrides hard-coded handler and selects what should happen with
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_removeinvenobj.int
|
||||
HOOK_REMOVEINVENOBJ (hs_removeinvenobj.int)
|
||||
|
||||
Runs when an object is removed from a critters inventory for any reason
|
||||
|
||||
@@ -228,22 +250,25 @@ int arg4 - The reason the object is being removed. (Actually, the site from
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_barterprice.int
|
||||
HOOK_BARTERPRICE (hs_barterprice.int)
|
||||
|
||||
Runs whenever the value of goods being purchased is calculated
|
||||
|
||||
critter arg1 - the critter doing the bartering (either dude_obj or inven_dude)
|
||||
critter arg2 - the critter being bartered with
|
||||
int arg3 - the default value of the goods
|
||||
critter arg4 - the barter critter (has all of the goods being traded in its inventory)
|
||||
critter arg4 - table of requested goods (being bought from NPC)
|
||||
int arg5 - the amount of actual caps in the barter stack (as opposed to goods)
|
||||
int arg6 - the value of all goods being traded before skill modifications
|
||||
critter arg7 - table of offered goods (being sold to NPC)
|
||||
int arg8 - the total cost of the goods offered by the player
|
||||
int arg9 - set 1 if the "offers" button was pressed(not for a party member), otherwise 0
|
||||
|
||||
int ret1 - the modified value of all of the goods
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_movecost.int
|
||||
HOOK_MOVECOST (hs_movecost.int)
|
||||
|
||||
Runs when calculating the ap cost of movement
|
||||
|
||||
@@ -277,7 +302,7 @@ object* ret1 - 0 if the hex doesn't block, or any sort of object pointer if it d
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_itemdamage.int
|
||||
HOOK_ITEMDAMAGE (hs_itemdamage.int)
|
||||
|
||||
Runs when retriving the damage rating of the players used weapon. (Which may be their fists.)
|
||||
|
||||
@@ -293,7 +318,7 @@ int ret2 - The new maximum damage
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_ammocost.int
|
||||
HOOK_AMMOCOST (hs_ammocost.int)
|
||||
|
||||
Runs when calculating ammo cost for a weapon. Doesn't affect damage, only how much ammo is spent.
|
||||
By default, weapon will shoot when at least 1 round is left, regardless of ammo cost calculations.
|
||||
@@ -309,7 +334,7 @@ int ret1 - new ammo cost value (set to 0 for unlimited ammo)
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_keypress.int
|
||||
HOOK_KEYPRESS (hs_keypress.int)
|
||||
|
||||
Runs once every time when any key was pressed or released.
|
||||
DX codes: (see dik.h header)
|
||||
@@ -321,7 +346,7 @@ int arg3 - key VK code (very similar to ASCII codes)
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_mouseclick.int
|
||||
HOOK_MOUSECLICK (hs_mouseclick.int)
|
||||
|
||||
Runs once every time when a mouse button was pressed or release.
|
||||
|
||||
@@ -330,7 +355,7 @@ int arg2 - button number (0 - left, 1 - right, up to 7)
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_useskill.int
|
||||
HOOK_USESKILL (hs_useskill.int)
|
||||
|
||||
Runs when using any skill on any object.
|
||||
|
||||
@@ -347,7 +372,7 @@ int ret1 - overrides hard-coded handler (-1 - use engine handler, any other
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_steal.int
|
||||
HOOK_STEAL (hs_steal.int)
|
||||
|
||||
Runs when checking an attempt to steal or plant an item in other inventory using Steal skill.
|
||||
|
||||
@@ -363,7 +388,7 @@ int ret1 - overrides hard-coded handler (1 - force success, 0 - force fail,
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_withinperception.int
|
||||
HOOK_WITHINPERCEPTION (hs_withinperception.int)
|
||||
|
||||
Runs when checking if one critter sees another critter. This is used in different situations like combat AI. You can override the result.
|
||||
|
||||
@@ -379,7 +404,7 @@ int ret1 - overrides the returned result of the function: 0 - not in range (
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_inventorymove.int
|
||||
HOOK_INVENTORYMOVE (hs_inventorymove.int)
|
||||
|
||||
Runs before moving items between inventory slots in dude interface. You can override the action.
|
||||
What you can NOT do with this hook:
|
||||
@@ -398,7 +423,7 @@ int ret1 - Override setting (-1 - use engine handler, any other value - prev
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
hs_invenwield.int
|
||||
HOOK_INVENWIELD (hs_invenwield.int)
|
||||
|
||||
Runs before wielding or unwielding an armor or a weapon by a critter (except when using inventory by PC).
|
||||
An example usage would be to change critter art depending on armor being used or to dynamically customize weapon animations.
|
||||
|
||||
@@ -19,9 +19,11 @@
|
||||
#include "main.h"
|
||||
|
||||
#include "AnimationsAtOnceLimit.h"
|
||||
#include "FalloutEngine.h"
|
||||
|
||||
static const int animRecordSize = 2656;
|
||||
|
||||
static bool AniLimitFixActive = false;
|
||||
static int animationLimit = 32;
|
||||
|
||||
//pointers to new animation struct arrays
|
||||
static BYTE *anim_set;
|
||||
@@ -143,37 +145,54 @@ static const DWORD sad_28[] = {
|
||||
0x4173CE, 0x4174C1, 0x4175F1, 0x417730,
|
||||
};
|
||||
|
||||
void AnimationsAtOnceInit(signed char aniMax) {
|
||||
static void __declspec(naked) anim_set_end_hack() {
|
||||
__asm {
|
||||
mov edi, _anim_set;
|
||||
cmp dword ptr animationLimit, 32;
|
||||
jle skip;
|
||||
mov edi, anim_set;
|
||||
add edi, animRecordSize; // Include a dummy
|
||||
skip:
|
||||
test dl, 0x2; // Is the combat flag set?
|
||||
jz end; // No
|
||||
call combat_anim_finished_;
|
||||
end:
|
||||
mov [edi][esi], ebx;
|
||||
push 0x415DF2;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
if (aniMax <= 32) return;
|
||||
|
||||
AniLimitFixActive = true;
|
||||
void AnimationsAtOnceInit() {
|
||||
animationLimit = GetPrivateProfileIntA("Misc", "AnimationsAtOnceLimit", 32, ini);
|
||||
if (animationLimit > 32) {
|
||||
if (animationLimit > 127) animationLimit = 127;
|
||||
dlog("Applying AnimationsAtOnceLimit patch.", DL_INIT);
|
||||
|
||||
int i;
|
||||
|
||||
//allocate memory to store larger animation struct arrays
|
||||
anim_set = new BYTE[2656*(aniMax+1)];
|
||||
sad = new BYTE[3240*(aniMax+1)];
|
||||
anim_set = new BYTE[animRecordSize * (animationLimit + 1)];
|
||||
sad = new BYTE[3240 * (animationLimit + 1)];
|
||||
|
||||
//set general animation limit check (old 20) aniMax-12 -- +12 reserved for PC movement(4) + other critical animations(8)?
|
||||
SafeWrite8(0x413C07, aniMax-12);
|
||||
//set general animation limit check (old 20) animationLimit-12 -- +12 reserved for PC movement(4) + other critical animations(8)?
|
||||
SafeWrite8(0x413C07, animationLimit - 12);
|
||||
|
||||
//PC movement animation limit checks (old 24) aniMax-8 -- +8 reserved for other critical animations?.
|
||||
//PC movement animation limit checks (old 24) animationLimit-8 -- +8 reserved for other critical animations?.
|
||||
for (i = 0; i < sizeof(AnimPCMove) / 4; i++) {
|
||||
SafeWrite8(AnimPCMove[i], aniMax-8);
|
||||
SafeWrite8(AnimPCMove[i], animationLimit - 8);
|
||||
}
|
||||
|
||||
//Max animation limit checks (old 32) aniMax
|
||||
//Max animation limit checks (old 32) animationLimit
|
||||
for (i = 0; i < sizeof(AnimMaxCheck) / 4; i++) {
|
||||
SafeWrite8(AnimMaxCheck[i], aniMax);
|
||||
SafeWrite8(AnimMaxCheck[i], animationLimit);
|
||||
}
|
||||
|
||||
//Max animations checks - animation struct size * max num of animations (old 2656*32=84992)
|
||||
for (i = 0; i < sizeof(AnimMaxSizeCheck) / 4; i++) {
|
||||
SafeWrite32(AnimMaxSizeCheck[i], 2656*aniMax);
|
||||
SafeWrite32(AnimMaxSizeCheck[i], animRecordSize * animationLimit);
|
||||
}
|
||||
|
||||
|
||||
//divert old animation structure list pointers to newly alocated memory
|
||||
|
||||
//struct array 1///////////////////
|
||||
@@ -188,45 +207,44 @@ void AnimationsAtOnceInit(signed char aniMax) {
|
||||
|
||||
//old addr 0x54CC14
|
||||
for (i = 0; i < sizeof(anim_set_0) / 4; i++) {
|
||||
SafeWrite32(anim_set_0[i], 2656+(DWORD)anim_set);
|
||||
SafeWrite32(anim_set_0[i], animRecordSize + (DWORD)anim_set);
|
||||
}
|
||||
|
||||
//old addr 0x54CC18
|
||||
for (i = 0; i < sizeof(anim_set_4) / 4; i++) {
|
||||
SafeWrite32(anim_set_4[i], 2656+4+(DWORD)anim_set);
|
||||
SafeWrite32(anim_set_4[i], animRecordSize + 4 + (DWORD)anim_set);
|
||||
}
|
||||
|
||||
//old addr 0x54CC1C
|
||||
for (i = 0; i < sizeof(anim_set_8) / 4; i++) {
|
||||
SafeWrite32(anim_set_8[i], 2656+8+(DWORD)anim_set);
|
||||
SafeWrite32(anim_set_8[i], animRecordSize + 8 + (DWORD)anim_set);
|
||||
}
|
||||
|
||||
//old addr 0x54CC20
|
||||
for (i = 0; i < sizeof(anim_set_C) / 4; i++) {
|
||||
SafeWrite32(anim_set_C[i], 2656+12+(DWORD)anim_set);
|
||||
SafeWrite32(anim_set_C[i], animRecordSize + 12 + (DWORD)anim_set);
|
||||
}
|
||||
|
||||
//old addr 0x54CC24
|
||||
for (i = 0; i < sizeof(anim_set_10) / 4; i++) {
|
||||
SafeWrite32(anim_set_10[i], 2656+16+(DWORD)anim_set);
|
||||
SafeWrite32(anim_set_10[i], animRecordSize + 16 + (DWORD)anim_set);
|
||||
}
|
||||
|
||||
//old addr 0x54CC28
|
||||
for (i = 0; i < sizeof(anim_set_14) / 4; i++) {
|
||||
SafeWrite32(anim_set_14[i], 2656+20+(DWORD)anim_set);
|
||||
SafeWrite32(anim_set_14[i], animRecordSize + 20 + (DWORD)anim_set);
|
||||
}
|
||||
|
||||
//old addr 0x54CC38
|
||||
SafeWrite32(0x413F29, 2656+36+(DWORD)anim_set);
|
||||
SafeWrite32(0x413F29, animRecordSize + 36 + (DWORD)anim_set);
|
||||
|
||||
//old addr 0x54CC3C
|
||||
for (i = 0; i < sizeof(anim_set_28) / 4; i++) {
|
||||
SafeWrite32(anim_set_28[i], 2656+40+(DWORD)anim_set);
|
||||
SafeWrite32(anim_set_28[i], animRecordSize + 40 + (DWORD)anim_set);
|
||||
}
|
||||
|
||||
//old addr 0x54CC48
|
||||
SafeWrite32(0x415C35, 2656+52+(DWORD)anim_set);
|
||||
|
||||
SafeWrite32(0x415C35, animRecordSize + 52 + (DWORD)anim_set);
|
||||
|
||||
//struct array 2///////////////////
|
||||
|
||||
@@ -293,10 +311,13 @@ void AnimationsAtOnceInit(signed char aniMax) {
|
||||
SafeWrite32(sad_28[i], 40 + (DWORD)sad);
|
||||
}
|
||||
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
MakeCall(0x415DE2, &anim_set_end_hack, true);
|
||||
}
|
||||
|
||||
void AnimationsAtOnceExit() {
|
||||
if (!AniLimitFixActive) return;
|
||||
if (animationLimit <= 32) return;
|
||||
delete[] anim_set;
|
||||
delete[] sad;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
void AnimationsAtOnceInit(signed char aniMax);
|
||||
void AnimationsAtOnceInit();
|
||||
void AnimationsAtOnceExit();
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -111,6 +111,6 @@ void BooksInit() {
|
||||
}
|
||||
|
||||
MakeCall(0x49B9FB, &obj_use_book_hook, true);
|
||||
dlog_f(" (%d/%d books) Done\r\n", DL_INIT, n, count);
|
||||
dlog_f(" (%d/%d books) Done\n", DL_INIT, n, count);
|
||||
}
|
||||
}
|
||||
+135
-13
@@ -321,6 +321,71 @@ skip:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) is_supper_bonus_hack() {
|
||||
__asm {
|
||||
add eax, ecx
|
||||
test eax, eax
|
||||
jle skip
|
||||
cmp eax, 10
|
||||
jle end
|
||||
skip:
|
||||
pop eax // Destroy the return address
|
||||
xor eax, eax
|
||||
inc eax
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
end:
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) PrintBasicStat_hack() {
|
||||
__asm {
|
||||
test eax, eax
|
||||
jle skip
|
||||
cmp eax, 10
|
||||
jg end
|
||||
pop ebx // Destroy the return address
|
||||
push 0x434C21
|
||||
retn
|
||||
skip:
|
||||
xor eax, eax
|
||||
end:
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) StatButtonUp_hook() {
|
||||
__asm {
|
||||
call inc_stat_
|
||||
test eax, eax
|
||||
jl end
|
||||
test ebx, ebx
|
||||
jge end
|
||||
sub ds:[_character_points], esi
|
||||
dec esi
|
||||
mov [esp+0xC+0x4], esi
|
||||
end:
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) StatButtonDown_hook() {
|
||||
__asm {
|
||||
call stat_level_
|
||||
cmp eax, 1
|
||||
jg end
|
||||
pop eax // Destroy the return address
|
||||
xor eax, eax
|
||||
inc eax
|
||||
mov [esp+0xC], eax
|
||||
push 0x437B41
|
||||
end:
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) loot_container_hack() {
|
||||
__asm {
|
||||
mov eax, [esp+0x114+0x4]
|
||||
@@ -525,13 +590,6 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) item_d_take_drug_hack1() {
|
||||
__asm {
|
||||
push 0x47A168
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) op_wield_obj_critter_adjust_ac_hook() {
|
||||
__asm {
|
||||
call adjust_ac_
|
||||
@@ -597,7 +655,7 @@ static void __declspec(naked) set_new_results_hack() {
|
||||
inc edx // type = knockout
|
||||
jmp queue_remove_this_ // Remove knockout from queue (if there is one)
|
||||
end:
|
||||
pop eax // Destroying return address
|
||||
pop eax // Destroy the return address
|
||||
push 0x424FC6
|
||||
retn
|
||||
}
|
||||
@@ -651,7 +709,7 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) partyMemberPrepLoadInstance_hack() {
|
||||
static void __declspec(naked) partyMemberPrepLoadInstance_hook() {
|
||||
__asm {
|
||||
and word ptr [eax+0x44], 0x7FFD // not (DAM_LOSE_TURN or DAM_KNOCKED_DOWN)
|
||||
jmp dude_stand_
|
||||
@@ -928,11 +986,56 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) use_inventory_on_hack() {
|
||||
__asm {
|
||||
inc ecx
|
||||
mov edx, [eax] // Inventory.inv_size
|
||||
sub edx, ecx
|
||||
jge end
|
||||
mov edx, [eax] // Inventory.inv_size
|
||||
end:
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
int __stdcall ItemCountFixStdcall(TGameObj* who, TGameObj* item) {
|
||||
int count = 0;
|
||||
for (int i = 0; i < who->invenCount; i++) {
|
||||
TInvenRec* tableItem = &who->invenTablePtr[i];
|
||||
if (tableItem->object == item) {
|
||||
count += tableItem->count;
|
||||
} else if (ItemGetType(tableItem->object) == item_type_container) {
|
||||
count += ItemCountFixStdcall(tableItem->object, item);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void __declspec(naked) ItemCountFix() {
|
||||
__asm {
|
||||
push ebx; push ecx; push edx; // save state
|
||||
push edx; // item
|
||||
push eax; // container-object
|
||||
call ItemCountFixStdcall;
|
||||
pop edx; pop ecx; pop ebx; // restore
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) Save_as_ASCII_hack() {
|
||||
__asm {
|
||||
mov edx, STAT_sequence;
|
||||
mov ebx, 626; // line index in EDITOR.MSG
|
||||
push 0x4396FC; // call stat_level_
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BugsInit()
|
||||
{
|
||||
//if (GetPrivateProfileIntA("Misc", "SharpshooterFix", 1, ini)) {
|
||||
dlog("Applying sharpshooter patch.", DL_INIT);
|
||||
dlog("Applying Sharpshooter patch.", DL_INIT);
|
||||
// http://www.nma-fallout.com/threads/fo2-engine-tweaks-sfall.178390/page-119#post-4050162
|
||||
// by Slider2k
|
||||
HookCall(0x4244AB, &SharpShooterFix); // hooks stat_level_() call in detemine_to_hit_func_()
|
||||
@@ -1009,6 +1112,14 @@ void BugsInit()
|
||||
SafeWrite8(0x4AC377, 0x7F); // jg
|
||||
dlogr(" Done", DL_INIT);
|
||||
|
||||
// Fix for negative SPECIAL values in character creation
|
||||
dlog("Applying fix for negative SPECIAL values in character creation.", DL_INIT);
|
||||
MakeCall(0x43DF6F, &is_supper_bonus_hack, false);
|
||||
MakeCall(0x434BFF, &PrintBasicStat_hack, false);
|
||||
HookCall(0x437AB4, &StatButtonUp_hook);
|
||||
HookCall(0x437B26, &StatButtonDown_hook);
|
||||
dlogr(" Done", DL_INIT);
|
||||
|
||||
// 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);
|
||||
@@ -1044,7 +1155,7 @@ void BugsInit()
|
||||
//}
|
||||
|
||||
//if (GetPrivateProfileIntA("Misc", "BlackSkilldexFix", 1, ini)) {
|
||||
dlog("Applying black skilldex patch.", DL_INIT);
|
||||
dlog("Applying black Skilldex patch.", DL_INIT);
|
||||
HookCall(0x497D0F, &PipStatus_AddHotLines_hook);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
@@ -1058,7 +1169,7 @@ void BugsInit()
|
||||
//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);
|
||||
MakeCall(0x47A013, (void*)0x47A168, true);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
@@ -1114,7 +1225,7 @@ void BugsInit()
|
||||
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);
|
||||
HookCall(0x4949B2, &partyMemberPrepLoadInstance_hook);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
@@ -1173,6 +1284,7 @@ void BugsInit()
|
||||
//}
|
||||
|
||||
//if (GetPrivateProfileIntA("Misc", "BagBackpackFix", 1, ini)) {
|
||||
dlog("Applying fix for bag/backpack bugs.", DL_INIT);
|
||||
// Fix for items disappearing from inventory when you try to drag them to bag/backpack in the inventory list
|
||||
// and are overloaded
|
||||
HookCall(0x4764FC, (void*)item_add_force_);
|
||||
@@ -1187,5 +1299,15 @@ void BugsInit()
|
||||
SafeWrite8(0x471C1C, 0x90); // nop
|
||||
// Fix crash when trying to open bag/backpack on the table in the bartering interface
|
||||
MakeCall(0x473191, &inven_action_cursor_hack, false);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
// Fix crash when clicking on empty space in the inventory list opened by "Use Inventory Item On" (backpack) action icon
|
||||
MakeCall(0x471A94, &use_inventory_on_hack, false);
|
||||
|
||||
// Fix item_count function returning incorrect value when there is a container-item inside
|
||||
MakeCall(0x47808C, ItemCountFix, true); // replacing item_count_ function
|
||||
|
||||
// Fix for Sequence stat value not being printed correctly when using "print to file" option
|
||||
MakeCall(0x4396F5, &Save_as_ASCII_hack, true);
|
||||
}
|
||||
|
||||
+2
-2
@@ -77,7 +77,7 @@ void CRC(const char* filepath) {
|
||||
DWORD size = GetFileSize(h, 0), crc;
|
||||
bool sizeMatch = (size == ExpectedSize);
|
||||
|
||||
if (IsDebug && !sizeMatch && GetPrivateProfileIntA("Debugging", "SkipSizeCheck", 0, ".\\ddraw.ini")) {
|
||||
if (!sizeMatch && GetPrivateProfileIntA("Debugging", "SkipSizeCheck", 0, ".\\ddraw.ini")) {
|
||||
sizeMatch = true;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ void CRC(const char* filepath) {
|
||||
|
||||
bool matchedCRC = false;
|
||||
|
||||
if (IsDebug && GetPrivateProfileStringA("Debugging", "ExtraCRC", "", buf, 512, ".\\ddraw.ini") > 0) {
|
||||
if (GetPrivateProfileStringA("Debugging", "ExtraCRC", "", buf, 512, ".\\ddraw.ini") > 0) {
|
||||
char *TestCRC;
|
||||
TestCRC = strtok(buf, ",");
|
||||
while (TestCRC) {
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ static const char* ExtraLines[] = {
|
||||
"MIB88",
|
||||
"Rain man",
|
||||
"Continuum",
|
||||
"Fakeman",
|
||||
"Mr.Stalin",
|
||||
"Drobovik",
|
||||
"Anyone who has used sfall in their own mods",
|
||||
"The bug reporters and feature requesters",
|
||||
|
||||
+2
-3
@@ -133,7 +133,7 @@ void CritLoad() {
|
||||
}
|
||||
}
|
||||
}
|
||||
dlogr("Completed critical hit table", DL_CRITICALS);
|
||||
dlogr("Completed critical hit table.", DL_CRITICALS);
|
||||
}
|
||||
|
||||
#define SetEntry(a,b,c,d,e) defaultTable[a*9*6 + b*6 + c].values[d]=e;
|
||||
@@ -143,12 +143,11 @@ void CritInit() {
|
||||
|
||||
if(!mode) return;
|
||||
|
||||
dlog("Initilizing critical table override.", DL_INIT);
|
||||
dlog("Initializing critical table override.", DL_INIT);
|
||||
critTable=new CritStruct[CritTableSize];
|
||||
playerCrit=&critTable[6*9*38];
|
||||
SafeWrite32(0x423F96, (DWORD)playerCrit);
|
||||
SafeWrite32(0x423FB3, (DWORD)critTable);
|
||||
dlog(". ", DL_INIT);
|
||||
|
||||
if(mode==2 || mode==3) {
|
||||
CritStruct* defaultTable=(CritStruct*)_crit_succ_eff;
|
||||
|
||||
@@ -30,12 +30,15 @@ static const DWORD ranged_attack_lighting_fix_back = 0x4118F8;
|
||||
static void __declspec(naked) ranged_attack_lighting_fix() {
|
||||
__asm {
|
||||
mov eax, [esp+40]; // projectile ptr - 1st arg
|
||||
mov ecx, [esp+1Ch]; // protoPtr of projectile
|
||||
mov ecx, [eax+0x70]; // check existing light intensity
|
||||
cmp ecx, 0; // if non-zero, skip obj_set_light call
|
||||
jnz skip;
|
||||
mov ecx, [esp+0x1C]; // protoPtr of projectile
|
||||
mov edx, [ecx+0x0C]; // light radius - 2nd arg
|
||||
mov ebx, [ecx+0x10]; // light intensity - 4th arg
|
||||
//mov ebx, 0x10000; // light intensity - 4th arg
|
||||
xor ecx, ecx; // unknown(0) - 3rd argument
|
||||
call obj_set_light_;
|
||||
skip:
|
||||
jmp ranged_attack_lighting_fix_back; // jump back
|
||||
}
|
||||
}
|
||||
@@ -189,19 +192,18 @@ DWORD _stdcall ExplosionsMetaruleFunc(DWORD mode, DWORD arg1, DWORD arg2) {
|
||||
}
|
||||
|
||||
void ResetExplosionSettings() {
|
||||
int i;
|
||||
// explosion pattern
|
||||
explosion_effect_starting_dir = 0;
|
||||
SafeWrite8(0x411B54, 6); // last direction
|
||||
// explosion art
|
||||
for (i=0; i<4; i++) {
|
||||
for (int i = 0; i < numArtChecks; i++) {
|
||||
SafeWrite32(explosion_art_adr[i], explosion_art_defaults[i]);
|
||||
}
|
||||
// explosion radiuses
|
||||
SafeWrite32(explosion_radius_grenade, 2);
|
||||
SafeWrite32(explosion_radius_rocket, 3);
|
||||
// explosion dmgtype
|
||||
for (i=0; i<4; i++) {
|
||||
for (int i = 0; i < numDmgChecks; i++) {
|
||||
SafeWrite8(explosion_dmg_check_adr[i], 6);
|
||||
}
|
||||
}
|
||||
@@ -210,7 +212,7 @@ void ExplosionLightingInit() {
|
||||
MakeCall(0x411AB4, &explosion_effect_hook, true); // required for explosions_metarule
|
||||
|
||||
if (GetPrivateProfileIntA("Misc", "ExplosionsEmitLight", 0, ini)) {
|
||||
dlog("Initing Explosion changes.", DL_INIT);
|
||||
dlog("Applying Explosion changes.", DL_INIT);
|
||||
lightingEnabled = true;
|
||||
MakeCall(0x4118E1, &ranged_attack_lighting_fix, true);
|
||||
MakeCall(0x410A4A, &fire_dance_lighting_fix1, true);
|
||||
|
||||
@@ -250,6 +250,7 @@ const DWORD check_death_ = 0x410814;
|
||||
const DWORD Check4Keys_ = 0x43F73C;
|
||||
const DWORD combat_ = 0x422D2C;
|
||||
const DWORD combat_ai_ = 0x42B130;
|
||||
const DWORD combat_anim_finished_ = 0x425E80;
|
||||
const DWORD combat_attack_ = 0x422F3C;
|
||||
const DWORD combat_input_ = 0x4227F4;
|
||||
const DWORD combat_should_end_ = 0x422C60;
|
||||
@@ -343,6 +344,7 @@ const DWORD gsnd_build_weapon_sfx_name_ = 0x451760;
|
||||
const DWORD gsound_play_sfx_file_ = 0x4519A8;
|
||||
const DWORD handle_inventory_ = 0x46E7B0;
|
||||
const DWORD inc_game_time_ = 0x4A34CC;
|
||||
const DWORD inc_stat_ = 0x4AF5D4;
|
||||
const DWORD insert_withdrawal_ = 0x47A290;
|
||||
const DWORD interpret_ = 0x46CCA4;
|
||||
const DWORD interpretAddString_ = 0x467A80; // edx = ptr to string, eax = script
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#define _aiInfoList 0x510948
|
||||
#define _ambient_light 0x51923C
|
||||
#define _anim_set 0x54CC14
|
||||
#define _art 0x510738
|
||||
#define _art_name 0x56C9E4
|
||||
#define _art_vault_guy_num 0x5108A4
|
||||
@@ -41,6 +42,7 @@
|
||||
#define _btable 0x59E944
|
||||
#define _btncnt 0x43EA1C
|
||||
#define _CarCurrArea 0x672E68
|
||||
#define _character_points 0x518538
|
||||
#define _cmap 0x51DF34
|
||||
#define _colorTable 0x6A38D0
|
||||
#define _combat_free_move 0x56D39C
|
||||
@@ -422,6 +424,7 @@ extern const DWORD check_death_;
|
||||
extern const DWORD Check4Keys_;
|
||||
extern const DWORD combat_;
|
||||
extern const DWORD combat_ai_;
|
||||
extern const DWORD combat_anim_finished_;
|
||||
extern const DWORD combat_attack_;
|
||||
extern const DWORD combat_input_;
|
||||
extern const DWORD combat_should_end_;
|
||||
@@ -514,6 +517,7 @@ extern const DWORD gsnd_build_weapon_sfx_name_;
|
||||
extern const DWORD gsound_play_sfx_file_;
|
||||
extern const DWORD handle_inventory_;
|
||||
extern const DWORD inc_game_time_;
|
||||
extern const DWORD inc_stat_;
|
||||
extern const DWORD insert_withdrawal_;
|
||||
extern const DWORD interpret_; // <eax> - programPtr, <edx> - ??? (-1)
|
||||
extern const DWORD interpretAddString_;
|
||||
|
||||
+46
-22
@@ -88,9 +88,10 @@ static void _stdcall RunSpecificHookScript(sHookScript *hook) {
|
||||
else
|
||||
RunScriptProc(&hook->prog, start);
|
||||
}
|
||||
|
||||
static void _stdcall RunHookScript(DWORD hook) {
|
||||
if (hooks[hook].size()) {
|
||||
dlog_f("Running hook %d, which has %0d entries attached\r\n", DL_HOOK, hook, hooks[hook].size());
|
||||
dlog_f("Running hook %d, which has %0d entries attached\n", DL_HOOK, hook, hooks[hook].size());
|
||||
cRet=0;
|
||||
for(int i=hooks[hook].size()-1;i>=0;i--) RunSpecificHookScript(&hooks[hook][i]);
|
||||
} else {
|
||||
@@ -101,13 +102,19 @@ static void _stdcall RunHookScript(DWORD hook) {
|
||||
|
||||
static void __declspec(naked) ToHitHook() {
|
||||
__asm {
|
||||
hookbegin(4);
|
||||
mov args[4], eax;
|
||||
mov args[8], ebx;
|
||||
mov args[12], ecx;
|
||||
hookbegin(7);
|
||||
mov args[4], eax; // attacker
|
||||
mov args[8], ebx; // target
|
||||
mov args[12], ecx; // body part
|
||||
mov args[16], edx; // source tile
|
||||
mov eax, [esp+4]; // attack type
|
||||
mov args[20], eax;
|
||||
mov eax, [esp+8]; // is ranged
|
||||
mov args[24], eax;
|
||||
mov eax, args[4];
|
||||
push [esp+8];
|
||||
push [esp+8];
|
||||
call determine_to_hit_func_
|
||||
call determine_to_hit_func_;
|
||||
mov args[0], eax;
|
||||
pushad;
|
||||
push HOOK_TOHIT;
|
||||
@@ -121,6 +128,7 @@ end:
|
||||
retn 8;
|
||||
}
|
||||
}
|
||||
|
||||
static const DWORD AfterHitRollAddr=0x423898;
|
||||
static void __declspec(naked) AfterHitRollHook() {
|
||||
__asm {
|
||||
@@ -177,6 +185,7 @@ end:
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
// this is for using non-weapon items, always 2 AP in vanilla
|
||||
static void __declspec(naked) CalcApCostHook2() {
|
||||
__asm {
|
||||
@@ -268,6 +277,7 @@ aend:
|
||||
retn 8;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) CalcDeathAnimHook2() {
|
||||
__asm {
|
||||
hookbegin(5);
|
||||
@@ -293,6 +303,7 @@ skip:
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) CombatDamageHook() {
|
||||
__asm {
|
||||
push edx;
|
||||
@@ -520,20 +531,31 @@ static void __declspec(naked) RemoveObjHook() {
|
||||
|
||||
static void __declspec(naked) BarterPriceHook() {
|
||||
__asm {
|
||||
hookbegin(6);
|
||||
hookbegin(9);
|
||||
mov args[0], eax;
|
||||
mov args[4], edx;
|
||||
call barter_compute_value_
|
||||
call barter_compute_value_;
|
||||
mov edx, ds:[_btable]
|
||||
mov args[8], eax;
|
||||
mov args[12], edx;
|
||||
xchg eax, edx;
|
||||
call item_caps_total_
|
||||
call item_caps_total_;
|
||||
mov args[16], eax;
|
||||
mov eax, ds:[_btable]
|
||||
call item_total_cost_
|
||||
mov eax, ds:[_btable];
|
||||
call item_total_cost_;
|
||||
mov args[20], eax;
|
||||
mov eax, edx;
|
||||
mov eax, ds:[_ptable];
|
||||
mov args[24], eax;
|
||||
call item_total_cost_;
|
||||
mov args[28], eax;
|
||||
xor eax, eax;
|
||||
mov edx, [esp]; // check offers button
|
||||
cmp edx, 0x474D51; // last address on call stack
|
||||
jne skip;
|
||||
inc eax;
|
||||
skip:
|
||||
mov args[32], eax;
|
||||
mov eax, args[8];
|
||||
pushad;
|
||||
push HOOK_BARTERPRICE;
|
||||
call RunHookScript;
|
||||
@@ -736,6 +758,7 @@ void __declspec(naked) AmmoCostHookWrapper() {
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
void _stdcall KeyPressHook( DWORD dxKey, bool pressed, DWORD vKey )
|
||||
{
|
||||
BeginHook();
|
||||
@@ -1077,6 +1100,7 @@ void _stdcall SetHSReturn(DWORD d) {
|
||||
if (cRetTmp > cRet)
|
||||
cRet = cRetTmp;
|
||||
}
|
||||
|
||||
void _stdcall RegisterHook( DWORD script, DWORD id, DWORD procNum )
|
||||
{
|
||||
if (id >= numHooks) return;
|
||||
@@ -1088,7 +1112,7 @@ void _stdcall RegisterHook( DWORD script, DWORD id, DWORD procNum )
|
||||
}
|
||||
sScriptProgram *prog = GetGlobalScriptProgram(script);
|
||||
if (prog) {
|
||||
dlog_f("Global script %08x registered as hook id %d\r\n", DL_HOOK, script, id);
|
||||
dlog_f("Global script %08x registered as hook id %d\n", DL_HOOK, script, id);
|
||||
sHookScript hook;
|
||||
hook.prog = *prog;
|
||||
hook.callback = procNum;
|
||||
@@ -1140,14 +1164,14 @@ static void HookScriptInit2() {
|
||||
}
|
||||
|
||||
LoadHookScript("hs_tohit", HOOK_TOHIT);
|
||||
HookCall(0x421686, &ToHitHook);
|
||||
HookCall(0x4231D9, &ToHitHook);
|
||||
HookCall(0x42331F, &ToHitHook);
|
||||
HookCall(0x4237FC, &ToHitHook);
|
||||
HookCall(0x424379, &ToHitHook);
|
||||
HookCall(0x42438D, &ToHitHook);
|
||||
HookCall(0x42439C, &ToHitHook);
|
||||
HookCall(0x42679A, &ToHitHook);
|
||||
HookCall(0x421686, &ToHitHook); // combat_safety_invalidate_weapon_func_
|
||||
HookCall(0x4231D9, &ToHitHook); // check_ranged_miss_
|
||||
HookCall(0x42331F, &ToHitHook); // shoot_along_path_
|
||||
HookCall(0x4237FC, &ToHitHook); // compute_attack_
|
||||
HookCall(0x424379, &ToHitHook); // determine_to_hit_
|
||||
HookCall(0x42438D, &ToHitHook); // determine_to_hit_no_range_
|
||||
HookCall(0x42439C, &ToHitHook); // determine_to_hit_from_tile_
|
||||
HookCall(0x42679A, &ToHitHook); // combat_to_hit_
|
||||
|
||||
LoadHookScript("hs_afterhitroll", HOOK_AFTERHITROLL);
|
||||
MakeCall(0x423893, &AfterHitRollHook, true);
|
||||
@@ -1290,7 +1314,7 @@ static void HookScriptInit2() {
|
||||
call db_free_file_list_
|
||||
}
|
||||
|
||||
dlogr("Finished loading hook scripts", DL_HOOK|DL_INIT);
|
||||
dlogr("Finished loading hook scripts.", DL_HOOK|DL_INIT);
|
||||
}
|
||||
|
||||
void HookScriptClear() {
|
||||
|
||||
+2
-2
@@ -57,7 +57,7 @@ TGameObj* GetActiveItem() {
|
||||
}
|
||||
|
||||
void InventoryKeyPressedHook(DWORD dxKey, bool pressed, DWORD vKey) {
|
||||
if (pressed && ReloadWeaponKey && dxKey == ReloadWeaponKey && (GetCurrentLoops() & ~(COMBAT | PCOMBAT)) == 0) {
|
||||
if (pressed && ReloadWeaponKey && dxKey == ReloadWeaponKey && IsMapLoaded() && (GetCurrentLoops() & ~(COMBAT | PCOMBAT)) == 0) {
|
||||
DWORD maxAmmo, curAmmo;
|
||||
TGameObj* item = GetActiveItem();
|
||||
__asm {
|
||||
@@ -665,7 +665,7 @@ void InventoryInit() {
|
||||
SafeWrite32(0x472632, 150);
|
||||
SafeWrite8(0x472638, 0);
|
||||
|
||||
//Display item weight when examening
|
||||
//Display item weight when examining
|
||||
HookCall(0x472FFE, &InvenObjExamineFuncHook);
|
||||
}
|
||||
|
||||
|
||||
+11
-2
@@ -45,13 +45,20 @@
|
||||
|
||||
static DWORD InLoop = 0;
|
||||
static DWORD SaveInCombatFix;
|
||||
static bool mapLoaded = false;
|
||||
|
||||
bool IsMapLoaded() {
|
||||
return mapLoaded;
|
||||
}
|
||||
|
||||
DWORD InWorldMap() {
|
||||
return (InLoop&WORLDMAP) ? 1 : 0;
|
||||
}
|
||||
|
||||
DWORD InCombat() {
|
||||
return (InLoop&COMBAT) ? 1 : 0;
|
||||
}
|
||||
|
||||
DWORD GetCurrentLoops() {
|
||||
return InLoop;
|
||||
}
|
||||
@@ -83,7 +90,7 @@ static void _stdcall SaveGame2() {
|
||||
char buf[MAX_PATH];
|
||||
GetSavePath(buf, "gv");
|
||||
|
||||
dlog_f("Saving game: %s\r\n", DL_MAIN, buf);
|
||||
dlog_f("Saving game: %s\n", DL_MAIN, buf);
|
||||
|
||||
DWORD size, unused = 0;
|
||||
HANDLE h = CreateFileA(buf, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
|
||||
@@ -170,7 +177,7 @@ static void _stdcall LoadGame2_Before() {
|
||||
char buf[MAX_PATH];
|
||||
GetSavePath(buf, "gv");
|
||||
|
||||
dlog_f("Loading save game: %s\r\n", DL_MAIN, buf);
|
||||
dlog_f("Loading save game: %s\n", DL_MAIN, buf);
|
||||
|
||||
ClearGlobals();
|
||||
HANDLE h = CreateFileA(buf, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
|
||||
@@ -192,6 +199,7 @@ static void _stdcall LoadGame2_After() {
|
||||
LoadGlobalScripts();
|
||||
CritLoad();
|
||||
LoadHeroAppearance();
|
||||
mapLoaded = true;
|
||||
}
|
||||
|
||||
static void __declspec(naked) LoadSlot() {
|
||||
@@ -241,6 +249,7 @@ static void NewGame2() {
|
||||
|
||||
LoadGlobalScripts();
|
||||
CritLoad();
|
||||
mapLoaded = true;
|
||||
}
|
||||
|
||||
static bool DisableHorrigan = false;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
void LoadGameHookInit();
|
||||
|
||||
bool IsMapLoaded();
|
||||
DWORD InWorldMap();
|
||||
DWORD InCombat();
|
||||
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@ void dlog(const char* a, int type) {
|
||||
}
|
||||
void dlogr(const char* a, int type) {
|
||||
if (IsDebug && (type == DL_MAIN || (type & DebugTypes))) {
|
||||
Log << a << "\r\n";
|
||||
Log << a << "\n";
|
||||
Log.flush();
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ void dlog_f(const char *fmt, int type, ...) {
|
||||
va_list args;
|
||||
va_start(args, type);
|
||||
char buf[4096];
|
||||
vsnprintf_s(buf, sizeof buf, _TRUNCATE, fmt, args);
|
||||
vsnprintf_s(buf, sizeof(buf), _TRUNCATE, fmt, args);
|
||||
Log << buf;
|
||||
Log.flush();
|
||||
va_end(args);
|
||||
|
||||
+1
-1
@@ -106,7 +106,7 @@ void ReadExtraGameMsgFiles() {
|
||||
names.resize(256);
|
||||
|
||||
while ((read = GetPrivateProfileStringA("Misc", "ExtraGameMsgFileList", "",
|
||||
(LPSTR)names.data(), names.size(), ".\\ddraw.ini")) == names.size() - 1)
|
||||
(LPSTR)names.data(), names.size(), ini)) == names.size() - 1)
|
||||
names.resize(names.size() + 256);
|
||||
|
||||
if (names.empty())
|
||||
|
||||
@@ -368,7 +368,7 @@ void PartyControlInit() {
|
||||
if (strlen(ptr) > 0)
|
||||
Chars.push_back((WORD)strtoul(ptr, 0, 0));
|
||||
}
|
||||
dlog_f(" Mode %d, Chars read: %d.", DL_INIT, Mode, Chars.size());
|
||||
dlog_f(" Mode %d, Chars read: %d.\n", DL_INIT, Mode, Chars.size());
|
||||
|
||||
HookCall(0x46EBEE, &FidChangeHook);
|
||||
|
||||
@@ -380,7 +380,7 @@ void PartyControlInit() {
|
||||
HookCall(0x4124F1, &pc_flag_toggle_hook);
|
||||
HookCall(0x41279A, &pc_flag_toggle_hook);
|
||||
} else
|
||||
dlog(" Disabled.", DL_INIT);
|
||||
dlogr(" Disabled.", DL_INIT);
|
||||
}
|
||||
|
||||
void __stdcall PartyControlReset() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user