diff --git a/artifacts/config_files/Perks.ini b/artifacts/config_files/Perks.ini index a04da032..9c951297 100644 --- a/artifacts/config_files/Perks.ini +++ b/artifacts/config_files/Perks.ini @@ -7,6 +7,26 @@ ; have an additional NoHardcode option in this file which can ; be used to remove their hardcoded effects, and add new stat/skill effects +[PerksTweak] +;Change the penalty distance and distance bonus for 'Weapon Scope Range' weapon perk +;0 - no penalty, 8 - default penalty +WeaponScopeRangePenalty=8 +;2 - no bonus, 5 - default bonus +WeaponScopeRangeBonus=5 + +;Changes the distance bonus for 'Weapon Long Range' weapon perk +;2 - no bonus, 4 - default bonus +WeaponLongRangeBonus=4 + +;Changes the hit chance bonus for 'Weapon Accurate' weapon perk +;0 - no bonus, 200 - maximum bonus, 20 - default bonus +WeaponAccurateBonus=20 + +;Changes the strength bonus for 'Weapon Handling' perk +;0 - no bonus, 10 - maximum bonus, 3 - default bonus +WeaponHandlingBonus=3 + +;############################################################################## ;Name=The name of the perk (max 63 characters) ;Desc=The description of the perk (max 255 characters) ;Image=The line number (0-indexed) of the corresponding FRM in skilldex.lst @@ -43,6 +63,7 @@ ;Skill3-Skill5 = The skill to be modified (or -1 for none) ;Skill3Mod-Skill5Mod = The increased/decreased value to the modified skill +;############################################################################## ;This is a modification to vanilla perk 0 [0] Name=Example diff --git a/artifacts/mods/gl_npcarmor.int b/artifacts/mods/gl_npcarmor.int index d31041e9..fe34af49 100644 Binary files a/artifacts/mods/gl_npcarmor.int and b/artifacts/mods/gl_npcarmor.int differ diff --git a/artifacts/mods/gl_npcarmor.ssl b/artifacts/mods/gl_npcarmor.ssl index d0a48cbb..25d062d8 100644 --- a/artifacts/mods/gl_npcarmor.ssl +++ b/artifacts/mods/gl_npcarmor.ssl @@ -125,6 +125,7 @@ procedure adjustfid_handler begin variable weapAnim := get_sfall_arg bwand 0xF000; variable newFid := fid bwand 0xFFFF0FFF bwor weapAnim; if art_exists(newFid) then begin + set_sfall_arg(0, newFid); set_sfall_return(newFid); end else begin debug_msg("Error: NPC Armor mod: missing FID."); diff --git a/sfall/FalloutEngine/EngineUtils.cpp b/sfall/FalloutEngine/EngineUtils.cpp index a8b06869..a3904f18 100644 --- a/sfall/FalloutEngine/EngineUtils.cpp +++ b/sfall/FalloutEngine/EngineUtils.cpp @@ -124,7 +124,7 @@ long GetCurrentAttackMode() { case 3: case 4: // 4 - called shot hitMode = fo::var::itemButtonItems[activeHand].secondaryAttack; - break; + break; case 5: // reload mode hitMode = fo::ATKTYPE_LWEAPON_RELOAD + activeHand; } @@ -181,6 +181,14 @@ long GetScriptLocalVars(long sid) { return (script) ? script->numLocalVars : 0; } +fo::GameObject* __fastcall LineOfSight(fo::GameObject* obj) { + long objTile = obj->tile; + fo::GameObject* object = fo::func::obj_blocking_at_wrapper(obj, objTile, obj->elevation, (void*)fo::funcoffs::obj_sight_blocking_at_); + if (object) objTile = fo::func::tile_num_in_direction(objTile, fo::func::tile_dir(objTile, fo::var::obj_dude->tile), 1); + fo::func::make_straight_path_func(fo::var::obj_dude, fo::var::obj_dude->tile, objTile, 0, (DWORD*)&object, 4, (void*)fo::funcoffs::obj_sight_blocking_at_); + return object; +} + //--------------------------------------------------------- //print text to surface void PrintText(char *DisplayText, BYTE ColourIndex, DWORD Xpos, DWORD Ypos, DWORD TxtWidth, DWORD ToWidth, BYTE *ToSurface) { diff --git a/sfall/FalloutEngine/EngineUtils.h b/sfall/FalloutEngine/EngineUtils.h index 8832ac18..35835cc1 100644 --- a/sfall/FalloutEngine/EngineUtils.h +++ b/sfall/FalloutEngine/EngineUtils.h @@ -76,6 +76,8 @@ bool IsPartyMember(fo::GameObject* critter); // Returns the number of local variables of the object script long GetScriptLocalVars(long sid); +fo::GameObject* __fastcall LineOfSight(fo::GameObject* obj); + // Print text to surface void PrintText(char *displayText, BYTE colorIndex, DWORD x, DWORD y, DWORD textWidth, DWORD destWidth, BYTE *surface); // gets the height of the currently selected font diff --git a/sfall/FalloutEngine/Functions_def.h b/sfall/FalloutEngine/Functions_def.h index 5357592d..b31ba0c5 100644 --- a/sfall/FalloutEngine/Functions_def.h +++ b/sfall/FalloutEngine/Functions_def.h @@ -80,8 +80,8 @@ WRAP_WATCOM_FUNC2(long, item_w_damage, GameObject*, critter, long, hitMode) WRAP_WATCOM_FUNC1(long, item_w_dam_div, GameObject*, item) WRAP_WATCOM_FUNC1(long, item_w_dam_mult, GameObject*, item) WRAP_WATCOM_FUNC1(long, item_w_dr_adjust, GameObject*, item) -WRAP_WATCOM_FUNC1(long, item_w_rounds, GameObject*, item) WRAP_WATCOM_FUNC1(long, item_w_max_ammo, GameObject*, item) +WRAP_WATCOM_FUNC1(long, item_w_rounds, GameObject*, item) WRAP_WATCOM_FUNC1(long, item_weight, GameObject*, item) // returns light level at given tile WRAP_WATCOM_FUNC2(long, light_get_tile, long, elevation, long, tileNum) @@ -135,15 +135,19 @@ WRAP_WATCOM_FUNC1(long, register_object_must_erase, GameObject*, object) // WRAP_WATCOM_FUNC3(long, register_object_run_to_tile_, GameObject*, object; WRAP_WATCOM_FUNC3(long, register_object_take_out, GameObject*, object, long, holdFrameId, long, nothing) WRAP_WATCOM_FUNC3(long, register_object_turn_towards, GameObject*, object, long, tileNum, long, nothing) +WRAP_WATCOM_FUNC2(long, roll_random, long, minValue, long, maxValue) WRAP_WATCOM_FUNC2(long, skill_dec_point_force, GameObject*, critter, long, skill) WRAP_WATCOM_FUNC2(long, skill_inc_point_force, GameObject*, critter, long, skill) WRAP_WATCOM_FUNC1(long, skill_is_tagged, long, skill) +WRAP_WATCOM_FUNC2(long, skill_level, GameObject*, critter, long, statID) WRAP_WATCOM_FUNC2(long, stat_get_base_direct, GameObject*, critter, long, statID) WRAP_WATCOM_FUNC2(long, stat_get_bonus, GameObject*, critter, long, statID) WRAP_WATCOM_FUNC3(long, stat_set_bonus, GameObject*, critter, long, statID, long, amount) // adds experience points to PC WRAP_WATCOM_FUNC1(void, stat_pc_add_experience, long, amount) WRAP_WATCOM_FUNC1(long, text_font, long, fontNum) +WRAP_WATCOM_FUNC2(long, tile_dist, long, scrTile, long, dstTile) +WRAP_WATCOM_FUNC2(long, tile_dir, long, scrTile, long, dstTile) // redraws the whole screen WRAP_WATCOM_FUNC0(void, tile_refresh_display) // redraws the given rectangle on screen diff --git a/sfall/FalloutEngine/VariableOffsets.h b/sfall/FalloutEngine/VariableOffsets.h index 1653b2d8..448418ce 100644 --- a/sfall/FalloutEngine/VariableOffsets.h +++ b/sfall/FalloutEngine/VariableOffsets.h @@ -149,6 +149,7 @@ #define FO_VAR_card_old_fid1 0x5709EC #define FO_VAR_obj_dude 0x6610B8 #define FO_VAR_obj_seen 0x662445 +#define FO_VAR_obj_seen_check 0x6610BC #define FO_VAR_objectTable 0x639DA0 #define FO_VAR_objItemOutlineState 0x519798 #define FO_VAR_optionRect 0x58ECC0 diff --git a/sfall/FalloutEngine/Variables_def.h b/sfall/FalloutEngine/Variables_def.h index 5f3fac8e..6de8226d 100644 --- a/sfall/FalloutEngine/Variables_def.h +++ b/sfall/FalloutEngine/Variables_def.h @@ -123,7 +123,7 @@ VAR_(name_sort_list, DWORD) VAR_(num_game_global_vars, DWORD) VAR_(num_map_global_vars, DWORD) VAR_(obj_dude, GameObject*) -VAR_(objectTable, DWORD) +VARA(objectTable, DWORD*, 40000) VAR_(objItemOutlineState, DWORD) VAR_(optionRect, DWORD) VAR_(optionsButtonDown, DWORD) diff --git a/sfall/Modules/BugFixes.cpp b/sfall/Modules/BugFixes.cpp index 8d685cae..aacfb99a 100644 --- a/sfall/Modules/BugFixes.cpp +++ b/sfall/Modules/BugFixes.cpp @@ -1426,15 +1426,15 @@ mapLeave: static void __declspec(naked) obj_move_to_tile_hack_seen() { __asm { cmp ds:[FO_VAR_loadingGame], 0; // loading saved game - jnz fix; + jnz end; // fix // if (map_state <= 0 && mapEntranceTileNum != -1) then fix cmp dword ptr ds:[FO_VAR_map_state], 0; // map number, -1 exit to worldmap jle skip; cmp dword ptr ds:[FO_VAR_mapEntranceTileNum], -1; - jne fix; + jne end; // fix skip: - or byte ptr ds:[FO_VAR_obj_seen][eax], dl; -fix: + or byte ptr ds:[FO_VAR_obj_seen][eax], dl; +end: retn; } } diff --git a/sfall/Modules/Perks.cpp b/sfall/Modules/Perks.cpp index 738ab498..bdb94555 100644 --- a/sfall/Modules/Perks.cpp +++ b/sfall/Modules/Perks.cpp @@ -1408,8 +1408,29 @@ void Perks::init() { perksFile[0] = '.'; perksFile[1] = '\\'; HookCall(0x44272E, TraitInitWrapper); // game_init_ - } + // Engine perks settings + long enginePerkMod = GetPrivateProfileIntA("PerksTweak", "WeaponScopeRangePenalty", -1, perksFile); + if (enginePerkMod >= 0 && enginePerkMod != 8) SafeWrite32(0x42448E, enginePerkMod); + enginePerkMod = GetPrivateProfileIntA("PerksTweak", "WeaponScopeRangeBonus", -1, perksFile); + if (enginePerkMod >= 2 && enginePerkMod != 5) SafeWrite32(0x424489, enginePerkMod); + + enginePerkMod = GetPrivateProfileIntA("PerksTweak", "WeaponLongRangeBonus", -1, perksFile); + if (enginePerkMod >= 2 && enginePerkMod != 4) SafeWrite32(0x424474, enginePerkMod); + + enginePerkMod = GetPrivateProfileIntA("PerksTweak", "WeaponAccurateBonus", -1, perksFile); + if (enginePerkMod >= 0 && enginePerkMod != 20) { + if (enginePerkMod > 200) enginePerkMod = 200; + SafeWrite8(0x42465D, static_cast(enginePerkMod)); + } + + enginePerkMod = GetPrivateProfileIntA("PerksTweak", "WeaponHandlingBonus", -1, perksFile); + if (enginePerkMod >= 0 && enginePerkMod != 3) { + if (enginePerkMod > 10) enginePerkMod = 10; + SafeWrite8(0x424636, static_cast(enginePerkMod)); + SafeWrite8(0x4251CE, static_cast(-enginePerkMod)); + } + } LoadGameHook::OnGameReset() += PerksReset; } diff --git a/sfall/ddraw.vcxproj b/sfall/ddraw.vcxproj index 4f293bf3..47443b8f 100644 --- a/sfall/ddraw.vcxproj +++ b/sfall/ddraw.vcxproj @@ -83,20 +83,20 @@ true - $(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir) - $(DXSDK_DIR)lib\x86\;$(LibraryPath) + $(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir) + $(DXSDK_DIR)lib\x86;$(LibraryPath) - $(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir) - $(DXSDK_DIR)lib\x86\;$(LibraryPath) + $(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir) + $(DXSDK_DIR)lib\x86;$(LibraryPath) - $(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir) - $(DXSDK_DIR)lib\x86\;$(LibraryPath) + $(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir) + $(DXSDK_DIR)lib\x86;$(LibraryPath) - $(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir) - $(DXSDK_DIR)lib\x86\;$(LibraryPath) + $(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir) + $(DXSDK_DIR)lib\x86;$(LibraryPath) diff --git a/sfall/main.cpp b/sfall/main.cpp index 6ba8ebac..8e9cd81e 100644 --- a/sfall/main.cpp +++ b/sfall/main.cpp @@ -86,7 +86,9 @@ namespace sfall { bool isDebug = false; + bool hrpIsEnabled = false; +//bool hrpVersionValid = false; // HRP 4.1.8 version validation const char ddrawIni[] = ".\\ddraw.ini"; static char ini[65] = ".\\"; @@ -292,6 +294,7 @@ defaultIni: modifiedIni = GetConfigInt("Main", "ModifiedIni", 0); hrpIsEnabled = (*(DWORD*)0x4E4480 != 0x278805C7); // check if HRP is enabled + //if (hrpIsEnabled && strncmp((const char*)0x10039940, "4.1.8", 5) == 0) hrpVersionValid = true; InitModules(); } diff --git a/sfall/main.h b/sfall/main.h index 7cf9bc53..f1760561 100644 --- a/sfall/main.h +++ b/sfall/main.h @@ -92,6 +92,8 @@ size_t Translate(const char* section, const char* setting, const char* defaultVa extern const char ddrawIni[]; extern DWORD modifiedIni; + extern bool hrpIsEnabled; +//extern bool hrpVersionValid; }