Added options for tweaking some engine perks to the perks ini file

Added some engine function defines & util func for possible later use.
This commit is contained in:
NovaRain
2019-09-06 13:11:27 +08:00
parent 694b3995ef
commit 19252ba507
13 changed files with 79 additions and 16 deletions
+21
View File
@@ -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
Binary file not shown.
+1
View File
@@ -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.");
+8
View File
@@ -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) {
+2
View File
@@ -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
+5 -1
View File
@@ -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
+1
View File
@@ -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
+1 -1
View File
@@ -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)
+3 -3
View File
@@ -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:
end:
retn;
}
}
+21
View File
@@ -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<BYTE>(enginePerkMod));
}
enginePerkMod = GetPrivateProfileIntA("PerksTweak", "WeaponHandlingBonus", -1, perksFile);
if (enginePerkMod >= 0 && enginePerkMod != 3) {
if (enginePerkMod > 10) enginePerkMod = 10;
SafeWrite8(0x424636, static_cast<char>(enginePerkMod));
SafeWrite8(0x4251CE, static_cast<char>(-enginePerkMod));
}
}
LoadGameHook::OnGameReset() += PerksReset;
}
+4 -4
View File
@@ -84,19 +84,19 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseXP|Win32'">
<IncludePath>$(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir)</IncludePath>
<LibraryPath>$(DXSDK_DIR)lib\x86\;$(LibraryPath)</LibraryPath>
<LibraryPath>$(DXSDK_DIR)lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DevXP|Win32'">
<IncludePath>$(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir)</IncludePath>
<LibraryPath>$(DXSDK_DIR)lib\x86\;$(LibraryPath)</LibraryPath>
<LibraryPath>$(DXSDK_DIR)lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir)</IncludePath>
<LibraryPath>$(DXSDK_DIR)lib\x86\;$(LibraryPath)</LibraryPath>
<LibraryPath>$(DXSDK_DIR)lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(DXSDK_DIR)Include;$(IncludePath);$(ProjectDir)</IncludePath>
<LibraryPath>$(DXSDK_DIR)lib\x86\;$(LibraryPath)</LibraryPath>
<LibraryPath>$(DXSDK_DIR)lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
+3
View File
@@ -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();
}
+2
View File
@@ -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;
}