diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index f8dc30f7..780f6ca7 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -4,7 +4,7 @@ [Main] ;Set to 1 to enable the built-in High Resolution Patch mode that is similar to the hi-res patch by Mash ;The required settings will be read from the f2_res.ini configuration file of the original hi-res patch -;This option is always read from the main ini file (i.e. ddraw.ini) +;This option is always read from the main ddraw.ini file HiResMode=1 ;Set to 1 if you want to use command line arguments to tell sfall to use another ini file @@ -58,7 +58,7 @@ SpeedMultiInitial=100 ;Set to 6 for DX9 fullscreen windowed (the resolution in f2_res.ini should be set to the same aspect ratio as your desktop resolution) ;A DX9 mode is required for any graphics related script extender functions to work (i.e. fullscreen shaders) ;Modes 1, 2 and 3 are no longer supported -;This option will always be read from the main ini file (i.e. ddraw.ini) when using the hi-res patch by Mash +;This option will always be read from the main ddraw.ini file when using the hi-res patch by Mash Mode=0 ;If using a DX9 mode, this changes the resolution @@ -823,7 +823,7 @@ GlobalScriptPaths=scripts\gl*.int,scripts\sfall\gl*.int ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX [Debugging] ;Extra sfall configuration settings that can be used by modders -;This section is not affected by the 'UseCommandLine' option. It will always be read from the main ini file (i.e. ddraw.ini) +;This section is not affected by the 'UseCommandLine' option. It will always be read from the main ddraw.ini file ;Set to 1 to enable sfall debugging mode Enable=0 diff --git a/sfall/FalloutEngine/EngineUtils.cpp b/sfall/FalloutEngine/EngineUtils.cpp index 64c151e7..0057a130 100644 --- a/sfall/FalloutEngine/EngineUtils.cpp +++ b/sfall/FalloutEngine/EngineUtils.cpp @@ -214,6 +214,21 @@ fo::AttackSubType GetWeaponType(DWORD weaponFlag) { return (type < 9) ? weapon_types[type] : fo::AttackSubType::NONE; } +// Returns the distance a critter can move in combat based on current APs +long __fastcall GetCombatMoveDistance(fo::GameObject* critter, long freeMove) { + freeMove += critter->critter.movePoints; + long flags = critter->critter.damageFlags & (fo::DamageFlag::DAM_CRIP_LEG_LEFT | fo::DamageFlag::DAM_CRIP_LEG_RIGHT); + + // both legs crippled (8 AP per hex) + if (flags == (fo::DamageFlag::DAM_CRIP_LEG_LEFT | fo::DamageFlag::DAM_CRIP_LEG_RIGHT)) return (freeMove / 8); + + // not crippled + if (flags == 0) return freeMove; + + // one leg crippled (4 AP per hex) + return (freeMove / 4); +} + long ObjIsOpenable(fo::GameObject* object) { long result = 0; if (fo::func::obj_is_openable(object)) { diff --git a/sfall/FalloutEngine/EngineUtils.h b/sfall/FalloutEngine/EngineUtils.h index 72e23fb0..042cb377 100644 --- a/sfall/FalloutEngine/EngineUtils.h +++ b/sfall/FalloutEngine/EngineUtils.h @@ -101,6 +101,9 @@ long GetCurrentAttackMode(); fo::AttackSubType GetWeaponType(DWORD weaponFlag); +// Returns the distance a critter can move in combat based on current APs +long __fastcall GetCombatMoveDistance(fo::GameObject* critter, long freeMove); + long ObjIsOpenable(fo::GameObject* object); bool HeroIsFemale(); diff --git a/sfall/Modules/BugFixes.cpp b/sfall/Modules/BugFixes.cpp index 4686830a..700393c7 100644 --- a/sfall/Modules/BugFixes.cpp +++ b/sfall/Modules/BugFixes.cpp @@ -3151,7 +3151,7 @@ static long __fastcall CheckBarterAndBodyType(fo::GameObject* critter) { !(proto->critter.critterFlags & fo::CritterFlags::Barter) && proto->critter.bodyType); } -static void __declspec(naked) item_add_mult_hook_body_type() { +static void __declspec(naked) item_add_mult_hook() { __asm { push edx; push ecx; @@ -3998,7 +3998,7 @@ void BugFixes::init() SafeWrite8(0x4B039F, 20); // text_object_create_ (was 19) // Fix for being unable to plant items on non-biped critters with the "Barter" flag set (e.g. Skynet and Goris) - HookCall(0x477183, item_add_mult_hook_body_type); + HookCall(0x477183, item_add_mult_hook); // Fix for being able to use the "Push" action on members of the player's team in combat when they are knocked down HookCall(0x413718, action_can_be_pushed_hook);