From 0bda53e1091913634e0988925cd16d2f9efbc339 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Sat, 28 Jul 2018 22:27:32 +0800 Subject: [PATCH] Rename the option from previous commit to FullItemDescInBarter and added it to ddraw.ini. Edited info about HOOK_DESCRIPTIONOBJ and the new return value of HOOK_BARTERPRICE to documents. Minor edits to ddraw.ini to avoid misunderstanding. --- artifacts/ddraw.ini | 7 +++++-- artifacts/scripting/hookscripts.txt | 10 +++++----- artifacts/scripting/sfall function notes.txt | 2 +- sfall/Modules/BugFixes.cpp | 17 +++++++++++------ 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index b21358ce..9bbafa22 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -378,7 +378,7 @@ UseScrollingQuestsList=1 ;PremadeFIDs=201,203,202 ;Use this line to modify the list of cities and their associated global variables used for city reputations -;Syntax is 'city id : global id', with each city/global pair separated by a comma. +;Syntax is 'city id:global id', with each city/global pair separated by a comma. ;CityRepsList=0:47,2:48,1:49,4:50,5:51,3:52,8:53,6:54,7:55,13:56,10:57,11:59,14:61,17:63,19:64,18:65,25:66,9:294,20:308 ;Set this to a valid path to save a copy of the console contents @@ -564,7 +564,7 @@ InstantWeaponEquip=0 ;To add additional game msg files, uncomment the next line and set a comma delimited list of filenames without .msg extension ;By default, the files will have consecutive numbers assigned beginning with 0 -;You can use the syntax 'filename : number' to manually assign numbers to specific msg files, with each pair separated by a comma +;You can use the syntax 'filename:number' to manually assign numbers to specific msg files, with each pair separated by a comma ;If a file after the specified pair does not have a number assigned, it will have the next consecutive number from the last pair ;You need to use the message_str_game script function to get messages from the files ;ExtraGameMsgFileList= @@ -578,6 +578,9 @@ WorldMapFontPatch=0 ;Set to 1 to keep the selected attack mode when moving the weapon between active item slots KeepWeaponSelectMode=1 +;Set to 1 to display full item description for weapon/ammo in barter screen +FullItemDescInBarter=0 + ;Set to 1 to display sfall built-in credits at the bottom of credits.txt contents instead of at the top CreditsAtBottom=0 diff --git a/artifacts/scripting/hookscripts.txt b/artifacts/scripting/hookscripts.txt index 303a8eb0..2effe6dd 100644 --- a/artifacts/scripting/hookscripts.txt +++ b/artifacts/scripting/hookscripts.txt @@ -265,7 +265,7 @@ 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, pass -1 for modify only offered goods +int ret1 - the modified value of all of the goods (pass -1 if you just want to modify offered goods) int ret2 - the modified value of all offered goods ------------------------------------------- @@ -537,9 +537,9 @@ int ret2 - overrides the result of engine calculation: 0/1 - failure, 2/3 - HOOK_DESCRIPTIONOBJ (hs_descriptionobj) -Runs while using the item description icon in the player's inventory, or trade window. -Allows to override the description of the item (for example: add additional parameters to the description). +Runs when using the examine action icon to display item description. You can override the description of the item. +An example usage would be to add additional parameters to the description. -Obj arg1 - the item +Obj arg1 - the item -int ret1 - a pointer to the new "text" received using the macro function 'get_string_pointer' from FuncX functions +int ret1 - a pointer to the new text received by using "get_string_pointer" function diff --git a/artifacts/scripting/sfall function notes.txt b/artifacts/scripting/sfall function notes.txt index fe8f9c24..f2e3ff02 100644 --- a/artifacts/scripting/sfall function notes.txt +++ b/artifacts/scripting/sfall function notes.txt @@ -495,7 +495,7 @@ Some utility/math functions are available: - returns a pointer to a string variable or to a text > void sfall_func1("dialog_message", string text) -- displays a message in the NPC response window in dialog or trade mode +- displays a message in the NPC response window in dialog or barter screen ------------------------ ------ MORE INFO ------- diff --git a/sfall/Modules/BugFixes.cpp b/sfall/Modules/BugFixes.cpp index 85767b5f..23519cd0 100644 --- a/sfall/Modules/BugFixes.cpp +++ b/sfall/Modules/BugFixes.cpp @@ -1548,19 +1548,24 @@ void BugFixes::init() MakeJump(0x424BA2, compute_damage_hack); dlogr(" Done", DL_INIT); - // Fix descriptions info items weapon/ammo in barter - dlog("Applying barter item description fix.", DL_INIT); + // Fix missing AC/DR mod stats when examining ammo in barter screen + dlog("Applying fix for displaying ammo stats in barter screen.", DL_INIT); MakeCalls(obj_examine_func_hack_ammo0, {0x49B4AD, 0x49B504}); SafeWrite16(0x49B4B2, 0x9090); SafeWrite16(0x49B509, 0x9090); MakeCall(0x49B563, obj_examine_func_hack_ammo1); SafeWrite16(0x49B568, 0x9090); - showItemDescription = (GetConfigInt("Misc", "BarterItemDescriptions", 1) != 0); - if (showItemDescription) { - HookCall(0x49B452, obj_examine_func_hack_weapon); // it's jump - } dlogr(" Done", DL_INIT); + // Display full item description for weapon/ammo in barter screen + showItemDescription = (GetConfigInt("Misc", "FullItemDescInBarter", 0) != 0); + if (showItemDescription) { + dlog("Applying full item description in barter patch.", DL_INIT); + HookCall(0x49B452, obj_examine_func_hack_weapon); // it's jump + dlogr(" Done", DL_INIT); + } + + } }