Compare commits

...
58 Commits
Author SHA1 Message Date
NovaRain 3399e07958 Removed the duplicated sf_inventory_redraw code in Interface.cpp. 2018-09-06 23:01:15 +08:00
NovaRain 044af677d9 Merge branch 'develop' 2018-09-06 21:18:59 +08:00
NovaRain 752ad8ae01 Added notes to AutoQuickSavePage description. 2018-09-06 13:01:57 +08:00
NovaRain 9d9d8ada49 Added options to use more than one save slot for quick saving (from Mr.Stalin) (#186) 2018-09-06 07:01:14 +08:00
NovaRain 6bd7d3ebca Added the description of the new FemaleDialogMsgs setting value to ddraw.ini. 2018-09-03 09:58:27 +08:00
NovaRainandGitHub 9bc71a5d2a Merge pull request #193 from FakelsHub/dev/CutsFemale
Added FemaleDialogMsgs=2 for loading subtitle files from text/language/cuts_female/ for female PC.
2018-09-03 09:51:46 +08:00
Mr.Stalin 6d66232162 Added functional to the option FemaleDialogMsgs for possibility using the 'cuts_female' directory for female phrases. 2018-09-02 22:51:39 +03:00
NovaRain fe5f4bb2aa Changed the fix for multihex critter moving in combat to a more proper one (from Mr.Stalin)
Added AIBestWeaponFix option to ddraw.ini.
2018-09-02 18:08:37 +08:00
NovaRain 8a7d22dd03 Added additional checks to the fix of multihex critters moving in combat (from Mr.Stalin)
Added AIBestWeaponFix option to ddraw.ini.
2018-09-02 10:55:14 +08:00
NovaRain fac0b73d9e Changed the fix for multihex critter moving in combat to a more proper one. 2018-08-29 09:37:55 +08:00
NovaRain 2974210ad3 Minor edit to the description of QuestsScrollButtonsX/Y. 2018-08-26 14:53:47 +08:00
NovaRain bb0f2bb8db Changed the two example hook scripts to global scripts. 2018-08-24 08:10:38 +08:00
NovaRain 715b55dda8 Fixed multihex critters moving too close and overlapping their targets in combat (from Crafty)
Fixed critters not checking weapon perks properly when searching for the best weapon (from Mr.Stalin)
Changed BugFixes module to be initialized at the beginning.
2018-08-21 07:19:51 +08:00
NovaRain 999d818c86 Fixed multihex critters moving too close and overlapping their targets in combat (from Crafty)
Fixed critters not checking weapon perks properly when searching for the best weapon (from Mr.Stalin)
Changed BugFixes module to be initialized at the beginning.
2018-08-21 06:14:16 +08:00
NovaRain 1d7fd442b0 Minor edits to sfall-mods.ini. 2018-08-19 00:41:50 +08:00
NovaRain 3062533492 Added ObjCanHearObjFix to ddraw.ini.
Added extra comment for CarChargingFix to ddraw.ini.
Edited the description of DisplayName in sfall-mods.ini because of the new BoxBarCount option.
Minor edits to hookscripts.txt.
2018-08-19 00:33:10 +08:00
Mr.StalinandNovaRain 032e1d13f3 Fixed the functions of the engine op_obj_can_see_obj_/op_obj_can_hear_obj_ (#189)
Added one additional argument for the hook HOOK_WITHINPERCEPTION.
2018-08-18 23:56:03 +08:00
NovaRain 9f0797f8ad Added extra comment for CarChargingFix to ddraw.ini. 2018-08-14 23:58:09 +08:00
NovaRain a7c66685b9 Added QuestsScrollButtonsX/Y, DisplaySwiftLearnerExp, and additional note for the new mode of UseScrollingQuestsList to ddraw.ini.
Changed a log message in BugFixes.cpp to be a bit more specific.
Edited some comments in QuestList.cpp.
2018-08-12 19:07:52 +08:00
Mr.StalinandNovaRain 118b186d4d Quest list: Added options to specify the location of the buttons and a choice of the buttons type. (#187)
Fixed the clickability issue of holodisk list in the pipboy.

Fixed the display issue in the pipboy when a quest list is too long with UseScrollingQuestsList diabled.

Added an option to display experience points with the bonus from Swift Learner perk when gained from non-scripted situations (from Crafty)
2018-08-12 18:57:21 +08:00
Mr.StalinandNovaRain a8718dab2f Fixed the divided by 0 bug in CheckWeaponAmmoCost option. (#190) 2018-08-12 09:14:28 +08:00
NovaRain ccd897281f Fixed obj_can_see_obj not checking if source and target objects are on the same elevation before calling is_within_perception_ (from Mr.Stalin) 2018-08-10 22:54:07 +08:00
NovaRain d200262a2b Added a fix for the display issue in the pipboy when a quest list is too long with UseScrollingQuestsList diabled (from Mr.Stalin)
Added a fix for the clickability issue of holodisk list in the pipboy (from Mr.Stalin)
2018-08-06 22:04:21 +08:00
Mr.StalinandNovaRain 0ebe3ef1a4 Added new game mode DIALOGVIEW. (#182) 2018-07-29 17:48:33 +08:00
NovaRain d0c97f7118 Fixed an issue with file IDs of additional game msg files being shifted when a file in ExtraGameMsgFileList is missing.
Minor edit to the description of CityRepsList in ddraw.ini, to avoid misunderstanding.
Updated version number.
2018-07-28 22:46:59 +08:00
NovaRain 0bda53e109 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.
2018-07-28 22:27:32 +08:00
Mr.StalinandNovaRain 93cd7a08ad Added new HOOK_DESCRIPTIONOBJ and dialog_message/get_string_pointer functions (#181)
Added the second return value to HOOK_BARTERPRICE to modify the cost of the player's goods.
Fixed missing AC/DR mod stats when examining ammo in barter screen.
Added an option to display full item description for weapon/ammo in barter screen.
2018-07-28 22:14:38 +08:00
NovaRain 44d668f50b Renamed DialogFemaleMsgFile to FemaleDialogMsgs, and added its description to ddraw.ini.
Added additional notes for the new functionality of ExtraGameMsgFileList to documents.
2018-07-24 12:07:02 +08:00
NovaRainandGitHub f368973299 Merge pull request #185 from FakelsHub/devFeature/MessageDialog
Added option for loading alternative dialogue message files.
2018-07-24 11:50:41 +08:00
Mr.Stalin 96802c9642 Added option for loading alternative dialogue message files. (#183)
Fix error of the ExtraGameMsgFileList option, when the absence of a file, the number order was shifted.
To the ExtraGameMsgFileList option, added ability to directly specify the number for the message file.
2018-07-22 20:47:32 +03:00
NovaRain 39221065af Added BoxBarCount to ddraw.ini.
Edited documents for the change of is_iface_tag_active and added BoxBarCount.
Edited the phrasing of debugging message in SafeWrite.cpp.
2018-07-21 08:54:25 +08:00
Mr.StalinandNovaRain 95f95e7b38 BarBoxes: Set used count (#180)
* Added BarBoxesCount option to set the number of additional notification boxes to the interface.
* Expanded is_iface_tag_active function to check tag value of 0/1/2 (sneak/poisoned/radiated)
2018-07-21 08:47:05 +08:00
NovaRain 41c8722179 Merged a couple of fixes and minor improvements for 4.0.x from the develop branch:
* Fixed the game thinking you dropped an active explosive when the dropping is prevented with hs_inventorymove.
* Added "inventory_redraw" script function (from Mr.Stalin)
* NPC combat control mod now centers the screen on the controlled critter and has new options to display critter's name.
* Removed obsoleted WIN2K preprocessor defines.
Updated version number.
2018-07-16 09:14:01 +08:00
NovaRainandGitHub 3b780110ea Merge pull request #177 from FakelsHub/dev/RefHooks
Refactoring hooks.
2018-07-15 21:07:51 +08:00
Mr.Stalin 448dbdb31e Fixed injecting bug for HOOK_DEATHANIM2. 2018-07-14 20:39:15 +03:00
NovaRain 033376000c Fixed the screen flickering during switching critters in NPC combat control.
Now the mod does not center the screen on PC and display name box for the first turn of a player-initiated combat or when there's no other controllable critter in combat.
2018-07-13 11:25:42 +08:00
NovaRain bc2dabc461 Removed redundant function from NPC combat control and tidied up a bit. 2018-07-11 10:03:03 +08:00
NovaRain 08b5e3a769 Improved the functionality of NPC combat control mod (#179)
* centers the screen on controlled critter.

* removes roof tiles to show controlled critter properly.

* additional options to display the name of controller critter.
2018-07-10 12:05:15 +08:00
NovaRain 09c9c5cce0 Added the description of HOOK_EXPLOSIVETIMER to hookscripts.txt.
Edited the example script.
Updated version number.
2018-07-10 06:09:23 +08:00
Mr.StalinandNovaRain b4b1698345 Added new HOOK_EXPLOSIVETIMER (#175) 2018-07-10 06:00:04 +08:00
NovaRain 2a20209bb8 Added "inventory_redraw" script function (from Mr.Stalin) 2018-07-08 00:30:26 +08:00
NovaRain 84c7ac0536 Added InjectAllGameHooks to [Debugging] section in ddraw.ini. 2018-07-05 21:52:53 +08:00
Mr.Stalin 46f8820ecf Refactoring some hooks. 2018-07-04 21:55:52 +03:00
NovaRain 5d4b8fdd7b Added info for new HOOK_AMMOCOST arguments to hookscripts.txt. 2018-07-03 09:38:07 +08:00
Mr.StalinandNovaRain 44603174dd Refactoring combat hooks (#174)
* Fixed and improved the functionality of HOOK_AMMOCOST when CheckWeaponAmmoCost is enabled.

* Fixed the instant death critical fix not working if there's no script using HOOK_COMBATDAMAGE, due to the new hooks injection implementation.
2018-07-03 09:34:47 +08:00
Mr.Stalin d37fbd8390 Implementation detect conflict address for debug mode (#10). 2018-07-02 20:19:21 +03:00
NovaRain 2f22a1e982 Edited the description of HOOK_USEANIMOBJ in hookscripts.txt.
Removed obsoleted WIN2K preprocessor define.
Updated version number.
2018-06-25 22:12:42 +08:00
NovaRainandGitHub 3f03cf3c18 Merge pull request #171 from FakelsHub/devHook/UseObjectMap
* Added new HOOK_USEANIMOBJ.

* Moved some hooks code from MiscHs.cpp to ObjectHs.cpp.
2018-06-25 22:04:18 +08:00
NovaRain 1b3b5dc523 Fixed premature assignment of arguments before the beginning of the hooks in InventoryHs.cpp. (#173)
(cherry picked from commit fff48407c3)
Updated version number.
2018-06-24 12:36:01 +08:00
Mr.StalinandNovaRain fff48407c3 Fix of premature assignment of arguments before the beginning of the hook. (#173) 2018-06-24 09:56:29 +08:00
Mr.Stalin 841e741e91 Fixed calls BeginHook() procedures. 2018-06-24 00:24:27 +03:00
Mr.Stalin d4a501d813 Hook is renamed to HOOK_USEANIMOBJ. 2018-06-20 21:21:46 +03:00
Mr.StalinandNovaRain 5e056f1743 Fixed the drop event for Hook_InventoryMove when dropping an active explosive item on the ground. (#170)
When an armed explosive is dropped from the inventory, the dropped_explosive engine variable is set. If the drop is canceled by scripting, the variable will still be set to 1 without the fix.
2018-06-20 22:26:05 +08:00
Mr.Stalin 35a94b5418 Refactoring: Moving some hooks code from MiscHs.cpp to ObjectHs.cpp 2018-06-19 21:48:18 +03:00
Mr.Stalin 7eaef76f6f Added new script hook HOOK_USEOBJECTMAP. 2018-06-19 21:40:27 +03:00
Mr.StalinandNovaRain 30002664ef Implemented an injection system for hook scripts. (#168)
* Before the code of hooks was always executed even if there's no corresponding hook script, just passing through and doing nothing. Now the code of a hook only gets injected into the game when the corresponding hook script exists.
2018-06-19 14:31:35 +08:00
NovaRain c2f7e38a43 Added KeepWeaponSelectMode option to ddraw.ini. 2018-06-19 06:03:36 +08:00
Mr.StalinandNovaRain 8a5674f2d9 Added the option to keep the selected attack mode for the weapon when the weapon moves to another slot of the hand. (#166) 2018-06-19 06:01:43 +08:00
59 changed files with 2937 additions and 1252 deletions
+15
View File
@@ -38,3 +38,18 @@ MotionScanner=0
;If you want to control only specific critters, uncomment the PIDList line and set a comma delimited list of PIDs
Mode=0
;PIDList=62,89,97,107,160,161
;Choose a notification box to display the name of the controlled critter above the interface bar
;Must be between 5 and (4 + the value of BoxBarCount in ddraw.ini)
;Set to 0 to disable
DisplayName=0
;Set the color of display name, available colors:
;0 - green
;1 - red
;2 - white
;3 - yellow
;4 - dark yellow
;5 - blue
;6 - purple
DisplayNameColor=0
+49 -5
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v4.0.5
;v4.1
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -195,6 +195,10 @@ WorldMapSlots=0
;Modified: master_patches > critter_patches > patchXXX.dat > critter_dat > f2_res_patches > f2_res_dat > master_dat
DataLoadOrderPatch=0
;Set to 1 to enable loading alternative dialog msg files from text/language/dialog_female/ for female PC
;Set to 2 to also load subtitle files from text/language/cuts_female/ for female PC
FemaleDialogMsgs=0
;To change the default and starting player models, uncomment the next four lines.
;The default models can also be changed ingame via script
;MaleStartModel=hmwarr
@@ -345,6 +349,10 @@ SkipOpeningMovies=0
;Set to 0 to disable
NPCsTryToSpendExtraAP=0
;Set to 1 to fix NPCs not checking weapon perks properly when searching for the best weapon
;Note that enabling this option can significantly affect the weapon choice of some NPCs in combat
AIBestWeaponFix=0
;Allows the use of tiles over 80*36 in size. sfall will just split and resave them at startup
;Set to 1 to check all tiles on started (slow)
;Set to 2 if you provide a XLtiles.lst file in art/tiles/ containing a list of the tile ids that need checking
@@ -366,16 +374,22 @@ Repair=293
;Remove window position rounding
RemoveWindowRounding=0
;Set to 1 to add scroll buttons to the pip boy quest list, and remove the quests per area limit
;Set to 1 to add scroll buttons to the pipboy quest list, and remove the quests per area limit
;Set to 2 to use a different set of scroll buttons
UseScrollingQuestsList=1
;To change the location of quest list scroll buttons, uncomment the next two lines
;Defaults are 140 for the X-axis and 334 for the Y-axis
;QuestsScrollButtonsX=140
;QuestsScrollButtonsY=334
;Uncomment these lines to control the premade characters offered when starting a new game
;Multiple options should be separated by commas, and there must be the same number of entries in both lines
;PremadePaths=combat,diplomat,stealth
;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
@@ -384,6 +398,14 @@ UseScrollingQuestsList=1
;Set to 1 to add additional pages of save slots
ExtraSaveSlots=0
;To use more than one save slot for quick saving (F6 key) without picking a slot beforehand, set the next two lines
;AutoQuickSave sets how many save slots on a page you want to use for quick saving (valid range: 1..10)
;AutoQuickSavePage is the page number to use (valid range: 1..1000) if ExtraSaveSlots is enabled
;The quick saves will be rotated from the first slot on the page to the n-th slot
;Set to 0 to disable. AutoQuickSave will use page 1 if AutoQuickSavePage is disabled
AutoQuickSave=0
AutoQuickSavePage=0
;Set to 1 to speed up the HP/AC counter animations
;Set to 2 to update the HP/AC counters instantly
SpeedInterfaceCounterAnims=0
@@ -400,8 +422,11 @@ ScienceOnCritters=0
;Default is 166
SpeedInventoryPCRotation=166
;Uncomment to set the text colour of the extra 5 interface boxes
;The line must contain a 5 digits, each either a 0 for green or 1 for red
;Modify the number of the extra interface boxes available to modders. (Default is 5, and the maximum is 95)
BoxBarCount=5
;Uncomment to set the text colour of the extra interface boxes
;The line must contain the same number of digits as the value of BoxBarCount, each either a 0 for green or 1 for red
;BoxBarColours=00000
;Set to 1 to fix the bug that caused bonus HtH damage to not be applied correctly.
@@ -478,6 +503,9 @@ QuickPocketsApCostReduction=2
;Set to 1 to allow objects seeing through other objects with their ShootThru flag set
ObjCanSeeObj_ShootThru_Fix=0
;Set to 1 to fix the broken obj_can_hear_obj script function
ObjCanHearObjFix=0
;Set to 1 to enable the balanced bullet distribution formula for burst attacks
ComputeSprayMod=0
@@ -551,12 +579,16 @@ DontTurnOffSneakIfYouRun=0
CanSellUsedGeiger=1
;Set to 1 to fix the issue with being able to charge the car by using cells on other scenary/critters
;Set to 0 if another mod you're using has custom vehicles
CarChargingFix=1
;Set to 1 to skip weapon equip/unequip animations when performing various actions
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
;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=
@@ -566,6 +598,15 @@ NumbersInDialogue=0
;Set to 1 to use Fallout's normal text font instead of DOS-like font on the world map
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 experience points with the bonus from Swift Learner perk when gained from non-scripted situations
DisplaySwiftLearnerExp=1
;Set to 1 to display sfall built-in credits at the bottom of credits.txt contents instead of at the top
CreditsAtBottom=0
@@ -619,6 +660,9 @@ DontDeleteProtos=0
;Set to 1 to give scripts direct access to Fallout's address space, and to make arbitrary calls into Fallout's code
AllowUnsafeScripting=0
;Set to 1 to force sfall to inject all hooks code into the game, even if corresponding hook scripts don't exist
InjectAllGameHooks=0
;These options control what output is saved in the debug log (sfall-log.txt)
;Prints messages duing sfall initialization
@@ -0,0 +1,44 @@
/*
Example implementation of the algorithm of how the game engine sets the explosive timer.
*/
#include "..\..\scripting_docs\headers\sfall.h"
#include "..\..\scripting_docs\headers\define_lite.h"
// from CONDTION.H
#define ROLL_CRITICAL_FAILURE (0)
#define ROLL_FAILURE (1)
#define ROLL_SUCCESS (2)
#define ROLL_CRITICAL_SUCCESS (3)
procedure start;
procedure start begin
if game_loaded then begin
register_hook(HOOK_EXPLOSIVETIMER);
end else begin
variable
time := get_sfall_arg,
result := ROLL_CRITICAL_FAILURE;
if has_trait(TRAIT_PERK, dude_obj, PERK_demolition_expert_perk) then
result := ROLL_SUCCESS;
else begin
result := roll_vs_skill(dude_obj, SKILL_TRAPS, 0);
end
if (result) then begin
if (result == ROLL_FAILURE) then
time /= 2;
else begin // success or critical success
result := ROLL_SUCCESS;
end
end else begin // critical failure
time := 0;
result := ROLL_FAILURE;
end
set_sfall_return(time);
set_sfall_return(result); // failure/success
end
end
@@ -0,0 +1,60 @@
/*
Example implementation of the algorithm of how the game engine checks if one critter sees another critter.
NOTE: the AllowUnsafeScripting option must be enabled.
*/
#include "..\headers\define.h"
#include "..\headers\command.h"
#include "..\headers\sfall\sfall.h"
#include "..\headers\sfall\define_extra.h"
#define can_see_(source, target) call_offset_r2(0x412BEC, source, target)
#define obj_dist_(target, source) call_offset_r2(0x48BBD4, target, source)
procedure start;
procedure start begin
if game_loaded then begin
register_hook(HOOK_WITHINPERCEPTION);
end else begin
variable
source := get_sfall_arg,
target := get_sfall_arg,
original := get_sfall_arg,
hookType := get_sfall_arg, /* new arg */
result := 0,
distance;
if target then begin
distance := get_critter_stat(source, STAT_pe);
if can_see_(source, target) then begin
distance *= 5;
if (get_flags(target) bwand FLAG_TRANSGLASS) then distance /= 2;
end else if combat_is_initialized then begin
distance *= 2;
end
if (target == dude_obj) then begin
if sneak_success then begin
distance /= 4;
if has_skill(target, SKILL_SNEAK) > 120 then distance -= 1;
end else if dude_is_sneaking then begin
distance := distance * 2 / 3;
end
end
if obj_dist_(target, source) <= distance then result := 1;
// example
if (result) then begin
display_msg("hs_withinperception: " + obj_name(source) + " sees " + obj_name(target) + " [original: " + original + " script: " + result + "]");
end else begin
display_msg("hs_withinperception: " + obj_name(source) + " does not see " + obj_name(target) + " [original: " + original + " script: " + result + "]");
end
end
//set_sfall_return(result);
end
end
Binary file not shown.
+27 -3
View File
@@ -12,12 +12,16 @@
*/
#include "..\headers\define.h"
#include "..\headers\command.h"
#include "main.h"
variable
configSection := "CombatControl",
controlMode,
pidList,
displayName,
displayNameColor,
inControl := false,
hasGeckoSkinning := false;
@@ -33,25 +37,45 @@ procedure combatturn_handler begin
if (status == 1
and (len_array(pidList) == 0 or scan_array(pidList, pid bwand 0xFFFFFF) != -1)
and (controlMode == 1 or party_member_obj(pid))) then begin
set_dude_obj(critter);
if hasGeckoSkinning then critter_add_trait(critter, TRAIT_PERK, PERK_gecko_skinning_perk, 1);
end else begin
if not(critter == real_dude_obj) then begin
set_dude_obj(critter);
if hasGeckoSkinning then critter_add_trait(critter, TRAIT_PERK, PERK_gecko_skinning_perk, 1);
inControl := true;
end
if inControl then begin
// center the screen on the controlled critter and remove roof tiles
move_to(dude_obj, dude_tile, dude_elevation);
if displayName then begin
set_iface_tag_text(displayName, obj_name(critter), displayNameColor);
show_iface_tag(displayName);
end
end
end else if inControl then begin
set_dude_obj(real_dude_obj);
if displayName then hide_iface_tag(displayName);
end
end
procedure gamemodechange_handler begin
if not(get_game_mode BWAND COMBAT) then inControl := false;
end
procedure start begin
if game_loaded and (sfall_ver_major >= 4) then begin
set_perk_ranks(PERK_gecko_skinning_perk, 1);
set_perk_level(PERK_gecko_skinning_perk, 999); // prevent it from appearing in the perk selection window
controlMode := GetConfig("CombatControl", "Mode", 0);
displayName := GetConfig("CombatControl", "DisplayName", 0);
displayNameColor := GetConfig("CombatControl", "DisplayNameColor", 0);
if (controlMode > 2) then controlMode := 0;
if (displayName < 5 or displayName > 9) then displayName := 0;
if (controlMode > 0) then begin
pidList := GetConfigListInt("CombatControl", "PIDList");
fix_array(pidList);
if has_trait(TRAIT_PERK, dude_obj, PERK_gecko_skinning_perk) then hasGeckoSkinning := true;
register_hook_proc(HOOK_COMBATTURN, combatturn_handler);
register_hook_proc(HOOK_GAMEMODECHANGE, gamemodechange_handler);
end
end
end
+6
View File
@@ -18,6 +18,7 @@
#define INTFACELOOT (0x10000)
#define BARTER (0x20000)
#define HEROWIN (0x40000)
#define DIALOGVIEW (0x80000)
//Valid arguments to register_hook
#define HOOK_TOHIT (0)
@@ -52,6 +53,8 @@
#define HOOK_SETGLOBALVAR (29)
#define HOOK_RESTTIMER (30)
#define HOOK_GAMEMODECHANGE (31)
#define HOOK_USEANIMOBJ (32)
#define HOOK_EXPLOSIVETIMER (33)
//Valid arguments to list_begin
#define LIST_CRITTERS (0)
@@ -221,6 +224,7 @@
#define attack_is_aimed sfall_func0("attack_is_aimed")
#define car_gas_amount sfall_func0("car_gas_amount")
#define critter_inven_obj2(obj, type) sfall_func2("critter_inven_obj2", obj, type)
#define dialog_message(text) sfall_func1("dialog_message", text)
#define display_stats sfall_func0("display_stats")
#define exec_map_update_scripts sfall_func0("exec_map_update_scripts")
#define floor2(value) sfall_func1("floor2", value)
@@ -230,10 +234,12 @@
#define get_ini_sections(file) sfall_func1("get_ini_sections", file)
#define get_map_enter_position sfall_func0("get_map_enter_position")
#define get_outline(obj) sfall_func1("get_outline", obj)
#define get_string_pointer(text) sfall_func1("get_string_pointer", text)
#define intface_hide sfall_func0("intface_hide")
#define intface_is_hidden sfall_func0("intface_is_hidden")
#define intface_redraw sfall_func0("intface_redraw")
#define intface_show sfall_func0("intface_show")
#define inventory_redraw(invSide) sfall_func1("inventory_redraw", invSide)
#define item_weight(obj) sfall_func1("item_weight", obj)
#define lock_is_jammed(obj) sfall_func1("lock_is_jammed", obj)
#define outlined_object sfall_func0("outlined_object")
+42 -4
View File
@@ -265,7 +265,8 @@ 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
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
-------------------------------------------
@@ -323,12 +324,12 @@ 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.
To add proper check for ammo before shooting and proper calculation of number of burst rounds, set Misc.CheckWeaponAmmoCost=1 in ddraw.ini
To add proper check for ammo before shooting and proper calculation of number of burst rounds (hook type 1 and 2 in arg4), set Misc.CheckWeaponAmmoCost=1 in ddraw.ini
Item arg1 - weapon
int arg2 - Number of bullets in burst (1 for single shots)
int arg3 - Ammo cost calculated by original function (this is basically 2 for Super Cattle Prod and Mega Power Fist)
int arg4 - Type of hook (0 - when subtracting ammo after attack, 1 - when checking for "out of ammo" before attack)
int arg4 - Type of hook (0 - when subtracting ammo after single shot attack, 1 - when checking for "out of ammo" before attack, 2 - when calculating number of burst rounds, 3 - when subtracting ammo after burst attack)
int ret1 - new ammo cost value (set to 0 for unlimited ammo)
@@ -400,6 +401,7 @@ This is fired after the default calculation is made.
Critter arg1 - Watcher object
Obj arg2 - Target object
int arg3 - Result of vanilla function: 1 - within perception range, 0 - otherwise
int arg4 - Type of hook: 1 - when being called from obj_can_see_obj script function, 2 when being called from obj_can_hear_obj script function (need to set ObjCanHearObjFix=1 in ddraw.ini), 0 for all other cases
int ret1 - overrides the returned result of the function: 0 - not in range (can't see), 1 - in range (will see if not blocked), 2 - forced detection (will see regardless, only used in obj_can_see_obj scripting function which is called by every critter in the game)
@@ -497,7 +499,7 @@ int arg2 - event type: 1 - when the resting ends normally, -1 - when pressin
int arg3 - the hour part of the length of resting time
int arg4 - the minute part of the length of resting time
int ret1 - pass 1 to interrupt the resting
int ret1 - pass 1 to interrupt the resting, pass 0 to continue the rest if it was interrupted by pressing ESC key
-------------------------------------------
@@ -506,3 +508,39 @@ HOOK_GAMEMODECHANGE (hs_gamemodechange.int)
Runs once every time when the game mode was changed, like opening/closing the inventory, character screen, pipboy, etc.
int arg1 - event type: 1 - when the player exits the game, 0 - otherwise
-------------------------------------------
HOOK_USEANIMOBJ (hs_useanimobj.int)
Runs before playing the "use" (usually "magic hands") animation when a critter uses a scenery/container object on the map, or before walking/running animation if the player is at a distance from the object.
Critter arg1 - the critter that uses an object (usually dude_obj)
Obj arg2 - the object being used
int arg3 - the animation code being used (see ANIM_* in Animcomd.h)
int ret1 - overrides the animation code (pass -1 if you want to skip the animation)
-------------------------------------------
HOOK_EXPLOSIVETIMER (hs_explosivetimer.int)
Runs after setting the explosive timer. You can override the result.
int arg1 - the time in ticks set in the timer
Obj arg2 - the explosive object
int arg3 - the result of engine calculation of whether the timer was set successfully: 1 - failure, 2 - success (similar to ROLL_* in Condtion.h)
int ret1 - overrides the time of the timer (maximum 18000 ticks)
int ret2 - overrides the result of engine calculation: 0/1 - failure, 2/3 - success (similar to ROLL_*), any other value - use engine handler
-------------------------------------------
HOOK_DESCRIPTIONOBJ (hs_descriptionobj.int)
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 an additional description to the item based on player's stats/skills.
Obj arg1 - the item
int ret1 - a pointer to the new text received by using "get_string_pointer" function
+13 -2
View File
@@ -50,7 +50,7 @@ has_fake_trait and has_fake_perk return the number of levels the player has of t
perk_add_mode, set_selectable_perk, set_perkbox_title, hide_real_perks, show_real_perks and clear_selectable_perks control the behaviour of the select a perk box. set_selectable_perk can be used to add additional items by setting the 'active' parameter to 1, and to remove them again by setting it to 0. set_perkbox_title can be used to change the title of the box, or by using "" it will be set back to the default. hide and show_real_perks can be used to prevent the dialog from displaying any of the original 119 perks. perk_add_mode modifies what happens when a fake perk is selected from the perks dialog. It is treated as a set of flags - if bit 1 is set then it is added to the players traits, if bit 2 is set it is added to the players perks, and if bit 3 is set it is removed from the list of selectable perks. The default is 0x2. clear_selectable_perks restores the dialog to it's default state.
show_iface_tag, hide_iface_tag and is_iface_tag_active relate to the boxes that appear above the interface such as SNEAK and LEVEL. You can use 3 for LEVEL and 4 for ADDICT, or the range from 5 to 9 for custom boxes. Remember to add your messages to intrface.msg and set up the font colours in ddraw.ini if you're going to use custom boxes.
show_iface_tag, hide_iface_tag and is_iface_tag_active relate to the boxes that appear above the interface such as SNEAK and LEVEL. You can use 3 for LEVEL and 4 for ADDICT, or the range from 5 to (4 + the value of BoxBarCount in ddraw.ini) for custom boxes. Remember to add your messages to intrface.msg and set up the font colours in ddraw.ini if you're going to use custom boxes. Starting from sfall 4.1, is_iface_tag_active can also be used to check 0 for SNEAK, 1 for POISONED, and 2 for RADIATED.
get/set_bodypart_hit_modifier alter the hit percentage modifiers for aiming at specific bodyparts. Valid bodypart id's are from 0 to 8. Changes are not saved, and will reset to the defaults (or to the values specified in ddraw.ini if they exist) at each reload.
@@ -304,6 +304,7 @@ Some utility/math functions are available:
- works exactly the same as message_str, except you get messages from files in "text/english/game" folder
- use GAME_MSG_* defines or mstr_* macros from sfall.h to use specific msg file
- Additional game msg files added by ExtraGameMsgFileList setting will have consecutive fileIds assigned beginning from 0x2000. (e.g. if you set ExtraGameMsgFileList=foo,bar in ddraw.ini, foo.msg will be associated with 0x2000 and bar.msg with 0x2001.)
- if a file has a specific number assigned in ExtraGameMsgFileList, its fileId will be (0x2000 + assigned number). (e.g. with ExtraGameMsgFileList=foo,bar:2,foobar in ddraw.ini, bar.msg will be associated with 0x2002 and foobar.msg with 0x2003.)
> int sneak_success
- returns 1 if the player is currently sneaking, and last sneak attempt (roll against skill) was successful; 0 otherwise
@@ -482,10 +483,20 @@ Some utility/math functions are available:
> void sfall_func3("set_iface_tag_text", int tag, string text, int color)
- sets the text messages and colors for custom notification boxes to the interface without the need to add messages to intrface.msg and set up the font colors in ddraw.ini
- tag value is the same as used in show_iface_tag, hide_iface_tag, and is_iface_tag_active. The valid range is from 5 to 9 (custom boxes)
- tag value is the same as used in show_iface_tag, hide_iface_tag, and is_iface_tag_active. The valid range is from 5 to (4 + the value of BoxBarCount in ddraw.ini)
- The text is limited to 19 characters
- available colors: 0 - green, 1 - red, 2 - white, 3 - yellow, 4 - dark yellow, 5 - blue, 6 - purple
> void sfall_func1("inventory_redraw", int invSide)
- redraws inventory list in the inventory/use inventory item on/loot/barter screens
- invSide specifies which side needs to be redrawn: 0 - the player, 1 - target (container/NPC in loot/barter screens)
> int sfall_func1("get_string_pointer", string text)
- 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 barter screen
------------------------
------ MORE INFO -------
------------------------
+17 -4
View File
@@ -20,6 +20,7 @@
#include "Functions.h"
#include "Structs.h"
#include "Variables.h"
#include "VariableOffsets.h"
#include "EngineUtils.h"
@@ -79,21 +80,33 @@ int _fastcall GetItemType(GameObject* item) {
}
_declspec(noinline) GameObject* GetItemPtrSlot(GameObject* critter, InvenType slot) {
GameObject* itemPtr = 0;
GameObject* itemPtr = nullptr;
switch (slot) {
case fo::INVEN_TYPE_LEFT_HAND :
case fo::INVEN_TYPE_LEFT_HAND:
itemPtr = fo::func::inven_left_hand(critter);
break;
case fo::INVEN_TYPE_RIGHT_HAND :
case fo::INVEN_TYPE_RIGHT_HAND:
itemPtr = fo::func::inven_right_hand(critter);
break;
case fo::INVEN_TYPE_WORN :
case fo::INVEN_TYPE_WORN:
itemPtr = fo::func::inven_worn(critter);
break;
}
return itemPtr;
}
long& GetActiveItemMode() {
return fo::var::itemButtonItems[fo::var::itemCurrentItem].mode;
}
GameObject* GetActiveItem() {
return fo::var::itemButtonItems[fo::var::itemCurrentItem].item;
}
bool HeroIsFemale() {
return (fo::func::stat_level(fo::var::obj_dude, fo::Stat::STAT_gender) == fo::Gender::GENDER_FEMALE);
}
//---------------------------------------------------------
//print text to surface
void PrintText(char *DisplayText, BYTE ColourIndex, DWORD Xpos, DWORD Ypos, DWORD TxtWidth, DWORD ToWidth, BYTE *ToSurface) {
+6
View File
@@ -54,6 +54,12 @@ int _fastcall GetItemType(GameObject* item);
_declspec(noinline) GameObject* GetItemPtrSlot(GameObject* critter, InvenType slot);
long& GetActiveItemMode();
GameObject* GetActiveItem();
bool HeroIsFemale();
// 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
+81
View File
@@ -213,6 +213,15 @@ enum ObjType : char
OBJ_TYPE_SPATIAL = 6
};
enum ArtType : char
{
OBJ_TYPE_INTRFACE = 6,
OBJ_TYPE_INVEN = 7,
OBJ_TYPE_HEAD = 8,
OBJ_TYPE_BACKGROUND = 9,
OBJ_TYPE_SKILLDEX = 10
};
// Some FO2 PIDs possibly used by engine
enum ProtoId : long
{
@@ -587,6 +596,30 @@ enum InvenType : long
INVEN_TYPE_LEFT_HAND = 2,
};
enum AttackType : long
{
ATKTYPE_LWEAPON_PRIMARY = 0,
ATKTYPE_LWEAPON_SECONDARY = 1,
ATKTYPE_RWEAPON_PRIMARY = 2,
ATKTYPE_RWEAPON_SECONDARY = 3,
ATKTYPE_PUNCH = 4,
ATKTYPE_KICK = 5,
ATKTYPE_LWEAPON_RELOAD = 6,
ATKTYPE_RWEAPON_RELOAD = 7,
ATKTYPE_STRONGPUNCH = 8,
ATKTYPE_HAMMERPUNCH = 9,
ATKTYPE_HAYMAKER = 10,
ATKTYPE_JAB = 11,
ATKTYPE_PALMSTRIKE = 12,
ATKTYPE_PIERCINGSTRIKE = 13,
ATKTYPE_STRONGKICK = 14,
ATKTYPE_SNAPKICK = 15,
ATKTYPE_POWERKICK = 16,
ATKTYPE_HIPKICK = 17,
ATKTYPE_HOOKKICK = 18,
ATKTYPE_PIERCINGKICK = 19
};
#define OBJFLAG_CAN_WEAR_ITEMS (0xf000000)
#define OBJFLAG_HELD_IN_RIGHT (0x10000)
@@ -608,4 +641,52 @@ enum RollResult
ROLL_CRITICAL_SUCCESS = 0x3,
};
namespace Fields {
enum CommonObj : long
{
id = 0x00,
tile = 0x04,
x = 0x08,
y = 0x0C,
sx = 0x10,
sy = 0x14,
frm = 0x18,
rotation = 0x1C,
artFid = 0x20,
flags = 0x24,
elevation = 0x28,
inventory = 0x2C,
protoId = 0x64,
cid = 0x68,
lightDistance = 0x6C,
lightIntensity = 0x70,
outline = 0x74,
scriptId = 0x78,
owner = 0x7C,
scriptIndex = 0x80,
};
enum CritterObj : long
{
reaction = 0x38,
combatState = 0x3C,
movePoints = 0x40,
damageFlags = 0x44,
damageLastTurn = 0x48,
aiPacket = 0x4C,
teamNum = 0x50,
whoHitMe = 0x54,
health = 0x58,
rads = 0x5C,
poison = 0x60,
};
enum ItemObj : long
{
updatedFlags = 0x38,
charges = 0x3C,
ammoPid = 0x40,
};
}
}
@@ -1562,12 +1562,15 @@ FUNC(gsound_internal_effect_callback_, 0x451AD0)
FUNC(gsound_internal_speech_callback_, 0x451A90)
FUNC(gsound_load_sound_, 0x4510DC)
FUNC(gsound_load_sound_volume_, 0x45145C)
FUNC(gsound_med_butt_press_, 0x451988)
FUNC(gsound_med_butt_release_, 0x451990)
FUNC(gsound_open_, 0x451A08)
FUNC(gsound_play_sfx_file_, 0x4519A8)
FUNC(gsound_play_sfx_file_volume_, 0x45108C)
FUNC(gsound_play_sound_, 0x451510)
FUNC(gsound_read_, 0x451A30)
FUNC(gsound_red_butt_press_, 0x451970)
FUNC(gsound_red_butt_release_, 0x451978)
FUNC(gsound_reset_, 0x450164)
FUNC(gsound_seek_, 0x451A4C)
FUNC(gsound_set_master_volume_, 0x4502EC)
+9
View File
@@ -63,6 +63,15 @@ bool __stdcall art_exists(long artFid) {
WRAP_WATCOM_CALL1(art_exists_, artFid)
}
long __fastcall _word_wrap(const char* text, int maxWidth, DWORD* buf, BYTE* count) {
__asm {
mov eax, ecx;
mov ecx, count;
mov ebx, buf;
call fo::funcoffs::_word_wrap_;
}
}
// Returns the name of the critter
const char* __stdcall critter_name(GameObject* critter) {
WRAP_WATCOM_CALL1(critter_name_, critter)
+2
View File
@@ -36,6 +36,8 @@ namespace func
bool __stdcall art_exists(long artFid);
long __fastcall _word_wrap(const char* text, int maxWidth, DWORD* buf, BYTE* count);
// Returns the name of the critter
const char* __stdcall critter_name(GameObject* critter);
+14 -1
View File
@@ -24,6 +24,7 @@ WRAP_WATCOM_FUNC2(FrmFrameData*, art_ptr_lock, long, frmId, DWORD*, lockPtr)
WRAP_WATCOM_FUNC4(BYTE*, art_ptr_lock_data, long, frmId, long, frameNum, long, rotation, DWORD*, lockPtr)
WRAP_WATCOM_FUNC4(BYTE*, art_lock, long, frmId, DWORD*, lockPtr, long*, widthOut, long*, heightOut)
WRAP_WATCOM_FUNC1(long, art_ptr_unlock, DWORD, lockId)
WRAP_WATCOM_FUNC2(long, barter_compute_value, GameObject*, source, GameObject*, target)
WRAP_WATCOM_FUNC1(void*, dbase_open, const char*, fileName)
WRAP_WATCOM_FUNC1(void, dbase_close, void*, dbPtr)
WRAP_WATCOM_FUNC3(long, db_freadShortCount, DbFile*, file, WORD*, dest, long, count)
@@ -31,11 +32,14 @@ WRAP_WATCOM_FUNC3(long, db_freadIntCount, DbFile*, file, DWORD*, dest, long, cou
WRAP_WATCOM_FUNC2(long, db_fwriteByte, DbFile*, file, long, value)
WRAP_WATCOM_FUNC2(long, db_fwriteInt, DbFile*, file, long, value)
WRAP_WATCOM_FUNC0(void, display_stats)
WRAP_WATCOM_FUNC3(void, display_inventory, long, inventoryOffset, long, visibleOffset, long, mode)
WRAP_WATCOM_FUNC4(void, display_target_inventory, long, inventoryOffset, long, visibleOffset, DWORD*, targetInventory, long, mode)
// perform combat turn for a given critter
WRAP_WATCOM_FUNC2(long, combat_turn, GameObject*, critter, long, isDudeTurn)
WRAP_WATCOM_FUNC1(long, critter_is_dead, GameObject*, critter)
WRAP_WATCOM_FUNC1(void, EndLoad, DbFile*, file)
WRAP_WATCOM_FUNC1(long, game_get_global_var, long, globalVar)
WRAP_WATCOM_FUNC1(void, gdialogDisplayMsg, const char*, message)
WRAP_WATCOM_FUNC1(long, gmouse_3d_set_mode, long, mode)
WRAP_WATCOM_FUNC1(long, gmouse_set_cursor, long, picNum)
WRAP_WATCOM_FUNC1(Window*, GNW_find, long, winRef)
@@ -43,8 +47,14 @@ WRAP_WATCOM_FUNC0(long, intface_is_item_right_hand)
WRAP_WATCOM_FUNC0(void, intface_toggle_item_state)
WRAP_WATCOM_FUNC0(void, intface_use_item)
WRAP_WATCOM_FUNC0(long, is_pc_sneak_working)
WRAP_WATCOM_FUNC1(long, item_w_max_ammo, GameObject*, item)
WRAP_WATCOM_FUNC1(long, item_caps_total, GameObject*, object)
WRAP_WATCOM_FUNC1(long, item_total_cost, GameObject*, object)
WRAP_WATCOM_FUNC1(long, item_w_anim_code, GameObject*, item)
WRAP_WATCOM_FUNC2(long, item_w_anim_weap, GameObject*, item, DWORD, hitMode)
WRAP_WATCOM_FUNC2(long, item_w_compute_ammo_cost, GameObject*, item, DWORD*, rounds)
WRAP_WATCOM_FUNC1(long, item_w_curr_ammo, 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_weight, GameObject*, item)
// returns light level at given tile
WRAP_WATCOM_FUNC2(long, light_get_tile, long, elevation, long, tileNum)
@@ -55,9 +65,12 @@ WRAP_WATCOM_FUNC0(void, mouse_hide)
WRAP_WATCOM_FUNC6(long, make_path_func, GameObject*, objectFrom, long, tileFrom, long, tileTo, char*, pathDataBuffer, long, arg5, void*, blockingFunc)
// calculates bounding box (rectangle) for a given object
WRAP_WATCOM_FUNC2(void, obj_bound, GameObject*, object, BoundRect*, boundRect)
WRAP_WATCOM_FUNC2(long, obj_erase_object, GameObject*, object, BoundRect*, boundRect)
WRAP_WATCOM_FUNC2(long, obj_pid_new, fo::GameObject*, object, long, pid)
// checks/unjams jammed locks
WRAP_WATCOM_FUNC1(long, obj_lock_is_jammed, GameObject*, object)
WRAP_WATCOM_FUNC1(void, obj_unjam_lock, GameObject*, object)
WRAP_WATCOM_FUNC6(long, pick_death, GameObject*, attacker, GameObject*, target, GameObject*, weapon, long, amount, long, anim, long, hitFromBack)
WRAP_WATCOM_FUNC3(long, register_object_animate, GameObject*, object, long, anim, long, delay)
WRAP_WATCOM_FUNC3(long, register_object_animate_and_hide, GameObject*, object, long, anim, long, delay)
// WRAP_WATCOM_FUNC3(long, register_object_animate_and_move_straight_, GameObject*, object;
+27 -3
View File
@@ -100,7 +100,7 @@ struct GameObject {
union {
struct {
char gap_38[4];
char updatedFlags[4];
// for weapons - ammo in magazine, for ammo - amount of ammo in last ammo pack
long charges;
// current type of ammo loaded in magazine
@@ -151,8 +151,8 @@ struct ComputeAttackResult {
GameObject* target;
long targetTile;
long bodyPart;
long damage;
long flags;
long targetDamage;
long targetFlags;
long knockbackValue;
GameObject* mainTarget;
long numExtras;
@@ -640,4 +640,28 @@ struct Window {
long drawFuncP;
};
#pragma pack(1)
struct LSData {
char signature[24];
short majorVer;
short minorVer;
char charR;
char playerName[32];
char comment[30];
char unused1;
short realMonth;
short realDay;
short realYear;
short unused2;
long realTime;
short gameMonth;
short gameDay;
short gameYear;
short unused3;
long gameTime;
short mapElev;
short mapNumber;
char mapName[16];
};
}
+14
View File
@@ -5,6 +5,7 @@
// To add another variable, first add FO_VAR_* constant with it's address, then add it in Varaibles_def.h
// PLEASE USE THOSE IN ASM BLOCKS!
#define FO_VAR_aDialogS_msg 0x50DBE8
#define FO_VAR_aiInfoList 0x510948
#define FO_VAR_ambient_light 0x51923C
#define FO_VAR_anim_set 0x54CC14
@@ -12,6 +13,10 @@
#define FO_VAR_art_name 0x56C9E4
#define FO_VAR_art_vault_guy_num 0x5108A4
#define FO_VAR_art_vault_person_nums 0x5108A8
#define FO_VAR_aTextSCuts 0x501A8C
#define FO_VAR_aTextSCutsS 0x503530
#define FO_VAR_aTextSCutsSS 0x50B01C
#define FO_VAR_bboxslot 0x5970E0
#define FO_VAR_bckgnd 0x5707A4
#define FO_VAR_black_palette 0x663FD0
#define FO_VAR_BlueColor 0x6A38EF
@@ -40,6 +45,7 @@
#define FO_VAR_dialogue_switch_mode 0x518718
#define FO_VAR_dialog_target 0x518848
#define FO_VAR_dialog_target_is_party 0x51884C
#define FO_VAR_dropped_explosive 0x5190E0
#define FO_VAR_drugInfoList 0x5191CC
#define FO_VAR_edit_win 0x57060C
#define FO_VAR_Educated 0x57082C
@@ -67,6 +73,7 @@
#define FO_VAR_gsound_initialized 0x518E30
#define FO_VAR_hit_location_penalty 0x510954
#define FO_VAR_holo_flag 0x664529
#define FO_VAR_holodisk 0x6644F4
#define FO_VAR_holopages 0x66445C
#define FO_VAR_hot_line_count 0x6644F8
#define FO_VAR_i_fid 0x59E95C
@@ -123,6 +130,12 @@
#define FO_VAR_objectTable 0x639DA0
#define FO_VAR_objItemOutlineState 0x519798
#define FO_VAR_optionRect 0x58ECC0
#define FO_VAR_optionsButtonDown 0x59D400
#define FO_VAR_optionsButtonDown1 0x570518
#define FO_VAR_optionsButtonDownKey 0x518F2C
#define FO_VAR_optionsButtonUp 0x59D3FC
#define FO_VAR_optionsButtonUp1 0x570514
#define FO_VAR_optionsButtonUpKey 0x518F28
#define FO_VAR_outlined_object 0x518D94
#define FO_VAR_partyMemberAIOptions 0x519DB8
#define FO_VAR_partyMemberCount 0x519DAC
@@ -150,6 +163,7 @@
#define FO_VAR_proto_main_msg_file 0x6647FC
#define FO_VAR_ptable 0x59E934
#define FO_VAR_pud 0x59E960
#define FO_VAR_quest_count 0x51C12C
#define FO_VAR_queue 0x6648C0
#define FO_VAR_quick_done 0x5193BC
#define FO_VAR_read_callback 0x51DEEC
+7
View File
@@ -37,6 +37,7 @@ VAR_(dialogue_state, DWORD)
VAR_(dialogue_switch_mode, DWORD)
VAR_(dialog_target, DWORD)
VAR_(dialog_target_is_party, DWORD)
VAR_(dropped_explosive, DWORD)
VAR_(drugInfoList, DWORD)
VAR_(edit_win, DWORD)
VAR_(Educated, DWORD)
@@ -119,6 +120,12 @@ VAR_(obj_dude, GameObject*)
VAR_(objectTable, DWORD)
VAR_(objItemOutlineState, DWORD)
VAR_(optionRect, DWORD)
VAR_(optionsButtonDown, DWORD)
VAR_(optionsButtonDown1, DWORD)
VAR_(optionsButtonDownKey, DWORD)
VAR_(optionsButtonUp, DWORD)
VAR_(optionsButtonUp1, DWORD)
VAR_(optionsButtonUpKey, DWORD)
VAR_(outlined_object, GameObject*)
VAR_(partyMemberAIOptions, DWORD)
VAR_(partyMemberCount, DWORD)
+110 -67
View File
@@ -29,70 +29,78 @@ static const DWORD DisplayBoxesRet1 = 0x4615A8;
static const DWORD DisplayBoxesRet2 = 0x4615BE;
static const DWORD SetIndexBoxRet = 0x4612E8;
int BarBoxes::boxCount; // total count box
static int actualBoxCount;
static int sizeBox;
#define sSize (12)
struct sBox {
DWORD msg;
DWORD colour;
void* mem;
};
static sBox boxes[10];
static DWORD boxesEnabled[5];
#define tSize (28)
#define tSize (25)
struct tBox {
DWORD hasText;
bool hasText;
DWORD color;
char text[tSize - 8];
char text[tSize - 5];
};
static tBox boxText[5];
static DWORD clrBakup[5];
static sBox* boxes;
static tBox* boxText;
static bool* boxesEnabled;
static DWORD* colorBakup;
static bool setCustomBoxText;
static const DWORD bboxMemAddr[] = {
0x461266, 0x4612AC, 0x461374, 0x4613E8, 0x461479, 0x46148C, 0x4616BB,
};
static void __declspec(naked) DisplayBoxesHook() {
static void __declspec(naked) DisplayBoxesHack() {
__asm {
mov ebx, 0;
mov edx, [boxesEnabled];
mov ebx, 0;
start:
mov eax, boxesEnabled[ebx * 4];
test eax, eax;
jz next;
lea eax, [ebx + 5];
mov al, byte ptr [edx][ebx];
test al, al;
jz next;
lea eax, [ebx + 5];
call fo::funcoffs::add_bar_box_;
add esi, eax;
add esi, eax;
next:
inc ebx;
cmp ebx, 5;
jne start;
cmp esi, 1;
jle fail;
jmp DisplayBoxesRet1;
inc ebx;
cmp ebx, actualBoxCount;
jne start;
// engine code
cmp esi, 1;
jle fail;
jmp DisplayBoxesRet1;
fail:
jmp DisplayBoxesRet2;
jmp DisplayBoxesRet2;
}
}
static void __declspec(naked) BarBoxesTextHack() {
__asm {
//mov ecx, [esp + 0x440 - 0x1C];
push ecx; // ecx = BoxIndex
sub ecx, 5;
push ecx; // ecx = BoxIndex
sub ecx, 5;
imul ecx, tSize;
cmp boxText[ecx], 1; // .hasText
jnz end;
mov esi, [boxText]; // boxText addr
cmp byte ptr [esi][ecx], 1; // .hasText
jnz end;
// get color
mov ebx, boxText[ecx + 4]; // .color
mov ebx, dword ptr [esi][ecx + 1]; // .color
// set text
lea eax, [boxText + ecx + 8]; // .text
lea eax, [esi + ecx + 5]; // .text
// set color
pop ecx;
pop ecx;
imul ecx, sSize;
cmp boxes[ecx + 4], 2; // .colour
jb skip;
mov [esp + 0x440 - 0x20], ebx; // Color
mov esi, [boxes]; // boxes addr
cmp dword ptr [esi][ecx + 4], 2; // .colour
jb skip;
mov [esp + 0x440 - 0x20], ebx; // Color
skip:
retn;
end:
@@ -110,6 +118,18 @@ static void __declspec(naked) BarBoxesIndexHack() {
}
}
static const DWORD SizeLoopBoxRet = 0x461477;
static const DWORD ExitLoopBoxRet = 0x461498;
static void __declspec(naked) BarBoxesSizeHack() {
__asm {
cmp edx, sizeBox;
jz exitLoop;
jmp SizeLoopBoxRet;
exitLoop:
jmp ExitLoopBoxRet;
}
}
static void ReconstructBarBoxes() {
__asm {
call fo::funcoffs::refresh_box_bar_win_;
@@ -119,9 +139,9 @@ static void ReconstructBarBoxes() {
}
static void ResetBoxes() {
for (int i = 0; i < 5; i++) {
boxesEnabled[i] = 0;
boxes[i + 5].colour = clrBakup[i];
for (int i = 0; i < actualBoxCount; i++) {
boxesEnabled[i] = false;
boxes[i + 5].colour = colorBakup[i];
}
if (!setCustomBoxText) return;
@@ -138,7 +158,7 @@ static void ResetBoxes() {
void BarBoxes::SetText(int box, const char* text, DWORD color) {
boxes[box].colour = color;
box -= 5;
boxText[box].hasText = 1;
boxText[box].hasText = true;
strncpy_s(boxText[box].text, text, _TRUNCATE);
DWORD clr;
@@ -163,10 +183,10 @@ void BarBoxes::SetText(int box, const char* text, DWORD color) {
}
boxText[box].color = clr;
int enabled[5];
for (int i = 0; i < 5; i++) {
bool* enabled = new bool[actualBoxCount];
for (int i = 0; i < actualBoxCount; i++) {
enabled[i] = boxesEnabled[i];
boxesEnabled[i] = 0;
boxesEnabled[i] = false;
}
if (!setCustomBoxText) {
@@ -177,59 +197,82 @@ void BarBoxes::SetText(int box, const char* text, DWORD color) {
ReconstructBarBoxes();
for (int i = 0; i < 5; i++) {
for (int i = 0; i < actualBoxCount; i++) {
boxesEnabled[i] = enabled[i];
}
delete[] enabled;
__asm call fo::funcoffs::refresh_box_bar_win_;
}
void BarBoxes::init() {
SafeWriteBatch<DWORD>((DWORD)boxes + 8, bboxMemAddr); //.mem
SafeWrite32(0x4612FE, (DWORD)boxes + 4); //.colour
SafeWrite32(0x46133C, (DWORD)boxes); //.msg
int size = sSize * 10;
memset(boxes, 0, size);
memset(boxesEnabled, 0, 5 * 4);
boxCount = 5 + GetConfigInt("Misc", "BoxBarCount", 5);
if (boxCount < 10) boxCount = 10;
if (boxCount > 100) boxCount = 100;
actualBoxCount = boxCount - 5;
sizeBox = sSize * boxCount;
boxes = new sBox[boxCount]();
boxText = new tBox[actualBoxCount]();
boxesEnabled = new bool[actualBoxCount]();
colorBakup = new DWORD[actualBoxCount]();
memcpy(boxes, (void*)0x518FE8, sSize * 5);
for (int i = 5; i < 10; i++) {
for (int i = 5; i < boxCount; i++) {
boxes[i].msg = 100 + i;
}
SafeWrite8(0x46127C, 10);
SafeWrite8(0x46140B, 10);
SafeWrite8(0x461495, size);
MakeJump(0x4615A3, DisplayBoxesHook);
auto boxBarColors = GetConfigString("Misc", "BoxBarColours", "", 6);
if (boxBarColors.size() >= 5) {
for (int i = 0; i < 5; i++) {
if (boxBarColors[i] == '1') {
boxes[i + 5].colour = 1;
clrBakup[i] = 1;
} else {
clrBakup[i] = 0;
}
auto boxBarColors = GetConfigString("Misc", "BoxBarColours", "", actualBoxCount + 1);
int size = boxBarColors.size();
for (int i = 0; i < size; i++) {
if (boxBarColors[i] == '1') {
boxes[i + 5].colour = 1;
colorBakup[i] = 1;
}
}
SafeWriteBatch<DWORD>((DWORD)boxes + 8, bboxMemAddr); //.mem
SafeWrite32(0x4612FE, (DWORD)boxes + 4); //.colour
SafeWrite32(0x46133C, (DWORD)boxes); //.msg
SafeWrite8(0x46127C, boxCount);
SafeWrite8(0x46140B, boxCount);
if (boxCount > 10) {
MakeJump(0x461493, BarBoxesSizeHack);
} else {
SafeWrite8(0x461495, sizeBox);
}
MakeJump(0x4615A3, DisplayBoxesHack);
LoadGameHook::OnGameReset() += ResetBoxes;
}
int _stdcall GetBox(int i) {
if (i < 5 || i > 9) return 0;
bool BarBoxes::GetBox(int i) {
if (i < 5 || i > BarBoxes::MaxBox()) return false;
return boxesEnabled[i - 5];
}
void _stdcall AddBox(int i) {
if (i < 5 || i > 9) return;
void BarBoxes::AddBox(int i) {
if (i < 5 || i > BarBoxes::MaxBox()) return;
boxesEnabled[i - 5] = 1;
_asm call fo::funcoffs::refresh_box_bar_win_;
}
void _stdcall RemoveBox(int i) {
if (i < 5 || i > 9) return;
void BarBoxes::RemoveBox(int i) {
if (i < 5 || i > BarBoxes::MaxBox()) return;
boxesEnabled[i - 5] = 0;
_asm call fo::funcoffs::refresh_box_bar_win_;
}
void BarBoxes::exit() {
delete[] boxes;
delete[] boxText;
delete[] boxesEnabled;
delete[] colorBakup;
}
}

Some files were not shown because too many files have changed in this diff Show More