Compare commits

...
75 Commits
Author SHA1 Message Date
NovaRain 8af87a5252 Merge branch 'develop' 2018-10-01 21:14:00 +08:00
NovaRain 96cb6c51ea Updated version number. 2018-10-01 21:10:21 +08:00
NovaRain 5874450f60 AllowDShowSound improvements from Mr.Stalin:
* Added volume control support for alternative sound files.
* Added mode 2 to play alternative music files even if original acm files are not present in the music folder.
* Added AllowDShowMovies option to separate avi files playback from enabling DX9 mode.
* Fixed initialization bug when DX9 mode is disabled.
* Small refactoring on ASM code.

Added missing FadeMultiplier option to ddraw.ini.
2018-09-30 21:34:35 +08:00
NovaRain f088c9bb70 Fixed the mood argument of start_gdialog function being ignored for talking heads. (from Crafty)
Simplified the code of disabling losing unused perks.
2018-09-30 16:24:15 +08:00
NovaRain 7f8481d03a Added "get/set_rest_on_map" script functions (from Mr.Stalin) 2018-09-28 13:59:09 +08:00
NovaRain f162a5ab0c Moved item_count function fix from Inventory.cpp to BugFixes.cpp.
Minor edit to document.
2018-09-25 14:12:06 +08:00
NovaRain ce69e8123e Fixed the max text width of player name in inventory.
Added an 8 lines limit to the underline position fix.
Removed obsoleted WorldMapEncPatch* functions from Worldmap.cpp (forgot to remove during commit 0f1072c302)
Some minor ASM code edits.
2018-09-25 12:19:30 +08:00
NovaRain b5e85f2f89 Changed the implementation of fs_* opcodes from ASM blocks to handler functions. 2018-09-24 12:20:42 +08:00
NovaRain f7fe463f42 Added "create_win" script function and InterfaceDontMoveOnTop option (from Mr.Stalin) 2018-09-23 16:13:20 +08:00
NovaRain 27f2d57ebd Fixed ai_retrieve_object_ engine function not returning the requested object when there are different objects with the same ID (from Mr.Stalin)
Added info about map_*_p_proc procedures to the global script section in notes.txt (#197)
2018-09-23 08:13:35 +08:00
NovaRain bbe789d013 Added "get_current_inven_size" script function. 2018-09-21 19:23:35 +08:00
NovaRain 76ea3ed383 Added inventory size check to "Take All" button (from Mr.Stalin)
Added additional note to CritterInvSizeLimitMode in ddraw.ini, and changed CritterInvSizeLimit to its default value.
2018-09-20 09:41:49 +08:00
NovaRain c6f3dbfcf6 Changed item_total_weight/item_c_curr_size engine functions to return the weight and size of equipped(hidden) items on NPCs when exchanging/bartering items (from Mr.Stalin)
Fixed CritterInvSizeLimitMode not properly checking the weight of equipped items when mode is set to 4+.
2018-09-19 22:49:05 +08:00
NovaRain 49ce654d72 Excluded inventory size features for NPCs when CritterInvSizeLimitMode is set to PC only. 2018-09-16 10:24:49 +08:00
NovaRain b2a1160492 Removed UTF-8 BOM in Inventory.cpp. 2018-09-15 10:13:25 +08:00
NovaRain 5da2ec76de Refactored CritterInvSizeLimitMode option and fixed some bugs (from Mr.Stalin)
Added party member's current/max inventory size info to the combat control panel.
2018-09-15 09:49:07 +08:00
NovaRain 123f69268d Fixed the underline position in the inventory display window when the item name is longer than one line (from Mr.Stalin)
Simplified the code of SuperStimExploitFix and corrected the return value for the change.
2018-09-12 22:39:18 +08:00
NovaRain 6d0c84e783 Fixed broken get/reset_critical_table functions (from Mr.Stalin) 2018-09-11 09:55:38 +08:00
NovaRain c652fae849 Fixed the encounter description being displayed in two lines instead of one (from Crafty) 2018-09-09 23:09:26 +08:00
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
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
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
75 changed files with 4162 additions and 2471 deletions
+2 -1
View File
@@ -39,7 +39,8 @@ MotionScanner=0
Mode=0
;PIDList=62,89,97,107,160,161
;Displays the name of the controlled critter in a notification box above the interface bar. Must be between 5 and 9
;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
+68 -8
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v4.0.7
;v4.1.1
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -17,7 +17,8 @@ NumSoundBuffers=0
;Set to 1 to allow attaching sound files to combat float messages
AllowSoundForFloats=1
;Set to 1 to automatically search for alternative formats when Fallout tries to play an acm
;Set to 1 to automatically search for alternative formats (mp3/wma/wav) when Fallout tries to play an acm
;Set to 2 to play alternative music files even if original acm files are not present in the music folder
;This does not effect the play_sfall_sound and stop_sfall_sound script functions
AllowDShowSound=0
@@ -70,6 +71,14 @@ GPUBlt=0
;Requires graphics mode 4 or 5, and GPUBlt set to 1
Use32BitHeadGraphics=0
;Set to 1 to automatically search for alternative avi video files when Fallout tries to play the game movies
;Requires graphics mode 4 or 5
AllowDShowMovies=0
;Fade effect time length percentage modifier
;Default is 100. Larger values make it slower, smaller values make it faster
FadeMultiplier=100
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Input]
;Set to 1 to enable the mouse scroll wheel to scroll through inventory, barter, and loot screens
@@ -195,6 +204,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 +358,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 +383,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 +407,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 +431,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.
@@ -445,10 +479,10 @@ BoostScriptDialogLimit=0
;These options modify the checks to see if a critter can carry an additional item, changing which items are counted towards the weight limit and adding an additional size check
;Set the mode to 0 to disable the size check, 1 to apply to the PC only, 2 to apply to the PC and party members, or 3 to apply to all critters
;Only the PC uses CritterInvSizeLimit. Other critters will use the extra unused stat (STAT_unused = 10)
;Only the PC uses CritterInvSizeLimit. Other critters will use the unused stat (STAT_unused = 10) or have the size limit of 100 if the stat is not set
;Add 4 to the mode to limit the weight check to used items only
CritterInvSizeLimitMode=0
CritterInvSizeLimit=200
CritterInvSizeLimit=100
;Some bit flags to alter behaviour of the motion sensor
;1 - Allow sensor use on automap when motion sensor is in pack rather than hands
@@ -478,6 +512,13 @@ 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 fix the mood argument of start_gdialog script function to be available for talking heads
;If the argument value is -1, the mood will be determined by the local variable 0 of the script (vanilla behavior)
StartGDialogFix=0
;Set to 1 to enable the balanced bullet distribution formula for burst attacks
ComputeSprayMod=0
@@ -551,12 +592,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 +611,18 @@ 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 allow windows created by vanilla script function to be placed on top of inventory/loot/automap interfaces
InterfaceDontMoveOnTop=0
;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 +676,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
+10
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)
@@ -220,16 +223,22 @@
#define attack_is_aimed sfall_func0("attack_is_aimed")
#define car_gas_amount sfall_func0("car_gas_amount")
#define create_win(winName, x, y, w, h) sfall_func5("create_win", winName, x, y, w, h)
#define create_win_flag(winName, x, y, w, h, flag) sfall_func6("create_win", winName, x, y, w, h, flag)
#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)
#define get_can_rest_on_map(map, elev) sfall_func2("get_can_rest_on_map", map, elev)
#define get_current_inven_size(obj) sfall_func1("get_current_inven_size", obj)
#define get_cursor_mode sfall_func0("get_cursor_mode")
#define get_flags(obj) sfall_func1("get_flags", obj)
#define get_ini_section(file, sect) sfall_func2("get_ini_section", file, sect)
#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")
@@ -239,6 +248,7 @@
#define lock_is_jammed(obj) sfall_func1("lock_is_jammed", obj)
#define outlined_object sfall_func0("outlined_object")
#define real_dude_obj sfall_func0("real_dude_obj")
#define set_can_rest_on_map(map, elev, value) sfall_func3("set_can_rest_on_map", map, elev, value)
#define set_car_intface_art(artIndex) sfall_func1("set_car_intface_art", artIndex)
#define set_cursor_mode(mode) sfall_func1("set_cursor_mode", mode)
#define set_dude_obj(critter) sfall_func1("set_dude_obj", critter)
+41 -3
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)
@@ -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
+29 -3
View File
@@ -2,7 +2,7 @@
---------- GLOBAL SCRIPTS -----------
-------------------------------------
As well as the new functions, sfall also adds global scripts. These run independent of any loaded maps, but do not have an attached object. (i.e. using self_obj without using set_self first will crash the script.) To use a global script, the script must have a name which begins with 'gl' and contains a procedure called 'start'. This procedure will be executed once when the player loads a saved game or starts a new game. If you wish the script to be executed repeatedly, call set_global_script_repeat on this first run using the number of frames between each run as the argument. (0 disables the script, 1 runs it every frame, 2 runs it every other frame etc.)
As well as the new functions, sfall also adds global scripts. These run independent of any loaded maps, but do not have an attached object. (i.e. using self_obj without using set_self first will crash the script.) To use a global script, the script must have a name which begins with 'gl' and contains a procedure called 'start', 'map_enter_p_proc', 'map_exit_p_proc', or 'map_update_p_proc'. The start procedure will be executed once when the player loads a saved game or starts a new game. The map_*_p_proc procedures will be executed once when a map is being entered/left/updated. If you wish the script to be executed repeatedly, call set_global_script_repeat on the first run of the start procedure using the number of frames between each run as the argument. (0 disables the script, 1 runs it every frame, 2 runs it every other frame etc.)
Global scripts have multiple modes, which can be set using the set_global_script_type function. In the default mode (i.e. mode 0) their execution is linked to the local map game loop, so the script will not run in dialogs or on the world map. In mode 1 their execution is linked to the player input, and so they will run whenever the mouse cursor is visible on screen, including the world map, character dialogs etc. In mode 2, execution is linked to the world map loop, so the script will only be executed on the world map and not on the local map or in any dialog windows. Mode 3 is a combination of modes 0 and 2, so scripts will be executed on both local maps and the world map, but not in dialog windows. Using mode 1 requires the input wrapper to be enabled. Use available_global_script_types to check what is available.
@@ -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,7 +483,7 @@ 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
@@ -490,6 +491,31 @@ Some utility/math functions are available:
- 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
> int sfall_func1("get_current_inven_size", object)
- returns the current inventory size of the container or the critter
> void sfall_func5("create_win", string winName, int x, int y, int width, int height)
> void sfall_func6("create_win", string winName, int x, int y, int width, int height, int flags)
- works just like vanilla CreateWin function, but creates a window with MoveOnTop flag if flags argument is not specified, and allows to set additional flags for the created window
- MoveOnTop flag allows the created window to be placed on top of the game interface
> void sfall_func3("set_can_rest_on_map", int mapNum, int elev, bool value)
- allows/disallows to rest on the map for the specified level, overrides the can_rest_here values in maps.txt
- mapNum is the map index from maps.txt
- passing -1 to the elev argument will set the rest value for all map elevations
- the set rest value will be stored in sfalldb.sav file (in savegame)
> int sfall_func2("get_can_rest_on_map", int mapNum, int elev)
- returns the set rest value of the map after using the set_can_rest_on_map function
- returns -1 if the rest value of the map was not previously set (i.e. no data for the map in sfalldb.sav)
- the can_rest_here values in maps.txt are ignored
------------------------
------ 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
+97
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,68 @@ 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,
};
}
namespace WinFlags {
enum WinButtonFlags : long
{
OwnerFlag = 0x1,
UnknownFlag2 = 0x2,
MoveOnTop = 0x4,
Hidden = 0x8,
Exclusive = 0x10,
Transparent = 0x20,
UnknownFlag40 = 0x40,
UnknownFlag80 = 0x80,
scriptWindow = 0x100,
itsButton = 0x10000,
};
}
}
@@ -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)
+14
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)
@@ -379,6 +388,11 @@ long __stdcall win_register_button(DWORD winRef, long xPos, long yPos, long widt
WRAP_WATCOM_CALL6(name##_, arg1, arg2, arg3, arg4, arg5, arg6) \
}
#define WRAP_WATCOM_FUNC7(retType, name, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5, arg6t, arg6, arg7t, arg7) \
retType __stdcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5, arg6t arg6, arg7t arg7) { \
WRAP_WATCOM_CALL7(name##_, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
}
#include "Functions_def.h"
}
+6 -1
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);
@@ -217,6 +219,9 @@ long __stdcall win_register_button(DWORD winRef, long xPos, long yPos, long widt
#define WRAP_WATCOM_FUNC6(retType, name, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5, arg6t, arg6) \
retType __stdcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5, arg6t arg6);
#define WRAP_WATCOM_FUNC7(retType, name, arg1t, arg1, arg2t, arg2, arg3t, arg3, arg4t, arg4, arg5t, arg5, arg6t, arg6, arg7t, arg7) \
retType __stdcall name(arg1t arg1, arg2t arg2, arg3t arg3, arg4t arg4, arg5t arg5, arg6t arg6, arg7t arg7);
#include "Functions_def.h"
#undef WRAP_WATCOM_FUNC0
@@ -226,7 +231,7 @@ long __stdcall win_register_button(DWORD winRef, long xPos, long yPos, long widt
#undef WRAP_WATCOM_FUNC4
#undef WRAP_WATCOM_FUNC5
#undef WRAP_WATCOM_FUNC6
//#undef WRAP_WATCOM_FUNC7
#undef WRAP_WATCOM_FUNC7
}
}
+15 -1
View File
@@ -24,6 +24,8 @@ 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_FUNC7(long, createWindow, const char*, winName, long, x, long, y, long, width, long, height, long, bgColorIndex, long, flags)
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)
@@ -38,6 +40,7 @@ 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)
@@ -45,8 +48,16 @@ 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_c_curr_size, GameObject*, critter)
WRAP_WATCOM_FUNC1(long, item_caps_total, GameObject*, object)
WRAP_WATCOM_FUNC1(long, item_size, GameObject*, item)
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)
@@ -57,9 +68,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];
};
}
+21 -1
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,11 @@
#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_background_volume 0x518E88
#define FO_VAR_bboxslot 0x5970E0
#define FO_VAR_bckgnd 0x5707A4
#define FO_VAR_black_palette 0x663FD0
#define FO_VAR_BlueColor 0x6A38EF
@@ -58,6 +64,7 @@
#define FO_VAR_game_user_wants_to_quit 0x5186CC
#define FO_VAR_gcsd 0x51094C
#define FO_VAR_gdBarterMod 0x51873C
#define FO_VAR_gDialogMusicVol 0x5187D8
#define FO_VAR_gdNumOptions 0x5186D8
#define FO_VAR_gIsSteal 0x51D430
#define FO_VAR_glblmode 0x5709D0
@@ -68,6 +75,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
@@ -103,8 +111,10 @@
#define FO_VAR_main_window 0x5194F0
#define FO_VAR_map_elevation 0x519578
#define FO_VAR_map_global_vars 0x51956C
#define FO_VAR_map_number 0x631D88
#define FO_VAR_map_state 0x631D28
#define FO_VAR_master_db_handle 0x58E948
#define FO_VAR_master_volume 0x518E84
#define FO_VAR_max 0x56FB50
#define FO_VAR_maxScriptNum 0x51C7CC
#define FO_VAR_Meet_Frank_Horrigan 0x672E04
@@ -124,6 +134,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
@@ -151,6 +167,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
@@ -163,7 +180,10 @@
#define FO_VAR_scriptListInfo 0x51C7C8
#define FO_VAR_skill_data 0x51D118
#define FO_VAR_slot_cursor 0x5193B8
#define FO_VAR_sneak_working 0x56D77C // DWORD var
#define FO_VAR_sndfx_volume 0x518E90
#define FO_VAR_sneak_working 0x56D77C // DWORD var
#define FO_VAR_sound_music_path1 0x518E78
#define FO_VAR_sound_music_path2 0x518E7C
#define FO_VAR_square 0x631E40
#define FO_VAR_squares 0x66BE08
#define FO_VAR_stack 0x59E86C
+9 -1
View File
@@ -120,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)
@@ -157,7 +163,9 @@ VAR_(scr_size, DWORD)
VAR_(scriptListInfo, ScriptListInfoItem*) // dynamic array
VARA(skill_data, SkillInfo, SKILL_count)
VAR_(slot_cursor, DWORD)
VAR_(sneak_working, DWORD) // DWORD var
VAR_(sneak_working, DWORD) // DWORD var
VAR_(sound_music_path1, char*)
VAR_(sound_music_path2, char*)
VAR_(square, DWORD)
VAR_(squares, DWORD*)
VAR_(stack, 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;
}
}
+10 -4
View File
@@ -4,15 +4,21 @@ namespace sfall
{
class BarBoxes : public Module {
private:
static int boxCount;
public:
const char* name() { return "BarBoxes"; }
void init();
void exit() override;
static int MaxBox() { return boxCount - 1; }
static void SetText(int box, const char* text, DWORD color);
static bool GetBox(int);
static void AddBox(int);
static void RemoveBox(int);
};
int _stdcall GetBox(int i);
void _stdcall AddBox(int i);
void _stdcall RemoveBox(int i);
}
+617 -113
View File
File diff suppressed because it is too large Load Diff

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