mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24cb02b7d8 | ||
|
|
48ce358451 | ||
|
|
c293a826bc | ||
|
|
0da7c7b266 | ||
|
|
d74df7fc78 | ||
|
|
df816bcd47 | ||
|
|
068988caad | ||
|
|
24c9499021 | ||
|
|
7f3de8d19a | ||
|
|
87f7fe4a54 | ||
|
|
01ba18100e | ||
|
|
8b26573073 | ||
|
|
1839790dfb | ||
|
|
cb1d5d359f | ||
|
|
b781e117a2 | ||
|
|
a7d9716b68 | ||
|
|
cdd2bfe338 | ||
|
|
7decec4a2c | ||
|
|
e3af4f5754 | ||
|
|
1b61bca702 | ||
|
|
f0f00a77ea | ||
|
|
58d41487fd | ||
|
|
73ccba22bf | ||
|
|
1f8b3636f3 | ||
|
|
b7e80d445e | ||
|
|
e404684f58 | ||
|
|
4c78ba595c | ||
|
|
1f1d6eb6f0 | ||
|
|
9935553bce | ||
|
|
cd4d3b5b2f | ||
|
|
a61ff5b626 | ||
|
|
bc2e8e4362 | ||
|
|
136404a723 | ||
|
|
1a17ac5ac8 | ||
|
|
07543dd29d | ||
|
|
4243bead5d | ||
|
|
f80e933889 | ||
|
|
7cbde234c6 | ||
|
|
f6ae7c5f2c | ||
|
|
58060a8c5f | ||
|
|
22140e2a0c | ||
|
|
1c6f8cc255 | ||
|
|
e479609581 | ||
|
|
ab11c0422a | ||
|
|
09752c98a4 | ||
|
|
aab04764ae | ||
|
|
0ba3b62eff | ||
|
|
0c0d1dd73e | ||
|
|
0fd45aa37a | ||
|
|
00a6e4f0f9 | ||
|
|
36ef55ddd0 | ||
|
|
db2435416d | ||
|
|
0120e46782 | ||
|
|
eddefd6bd5 | ||
|
|
f9cbab3d55 | ||
|
|
e3168946ba | ||
|
|
8bb660ff11 | ||
|
|
8a7d9cbd78 | ||
|
|
008fdb12b7 | ||
|
|
3609f2e309 | ||
|
|
517c2e6825 | ||
|
|
4bc687922a | ||
|
|
5230ca9cbf | ||
|
|
5a5c65291d | ||
|
|
e153819bcd | ||
|
|
8ab5b9b7e7 | ||
|
|
abe3b01213 | ||
|
|
15019ffe81 | ||
|
|
eacd1e5682 | ||
|
|
84204d97d8 | ||
|
|
3b85596ca1 | ||
|
|
21bf1056ac | ||
|
|
1354467059 | ||
|
|
8d720185a7 | ||
|
|
87864d9ef6 | ||
|
|
0d5c88fded | ||
|
|
555b3a9504 | ||
|
|
f8cd74cc49 | ||
|
|
408661f42b | ||
|
|
893847cc6a | ||
|
|
6b1fffded1 | ||
|
|
3b2e23fda6 | ||
|
|
c9b1a1b583 | ||
|
|
d13cd9267d | ||
|
|
5a638f48ff | ||
|
|
df1d147a4f | ||
|
|
e733954e65 | ||
|
|
36b3b6a2c7 | ||
|
|
ceba5d1da2 | ||
|
|
d6486008f4 | ||
|
|
9f140cf3ca | ||
|
|
f2670deb6f | ||
|
|
6e6e01ea7f | ||
|
|
dccd735454 | ||
|
|
21004e3e63 | ||
|
|
d12db2be28 | ||
|
|
3d335231a2 | ||
|
|
d4eb1ee539 | ||
|
|
61c0964c98 | ||
|
|
58532fd902 | ||
|
|
aafc030f8e | ||
|
|
c652982a06 | ||
|
|
1e0b048e9e | ||
|
|
28dc256f61 | ||
|
|
18e1e06d28 | ||
|
|
6871e6f673 | ||
|
|
9ef670161d | ||
|
|
c26cd45b5b | ||
|
|
0b5c61cb72 | ||
|
|
11261ca9be | ||
|
|
4d435ca143 | ||
|
|
35d9b9439c | ||
|
|
a1968f7f86 | ||
|
|
85a5ee2a52 | ||
|
|
310c392759 | ||
|
|
3a24d0bdfd | ||
|
|
a9ad1a62eb | ||
|
|
d73859fa5f | ||
|
|
04043989c6 | ||
|
|
3b82232b46 | ||
|
|
5e704d206f | ||
|
|
5e65510797 | ||
|
|
b4dac84ddd | ||
|
|
cbc822c9e0 | ||
|
|
6cc68ed3de | ||
|
|
6d4aea216b | ||
|
|
569790acb2 | ||
|
|
7016690f99 | ||
|
|
eeb97a4299 | ||
|
|
66c237d297 | ||
|
|
3629c90fa9 | ||
|
|
1f99855500 | ||
|
|
cdf0bdf23e | ||
|
|
2c67058016 | ||
|
|
29f0affd72 | ||
|
|
e01569637d | ||
|
|
78f0ac473d | ||
|
|
bbe9a2d26d | ||
|
|
7bcb76e70c | ||
|
|
3348d8b716 | ||
|
|
4767ad2753 | ||
|
|
04ebbaa182 | ||
|
|
3c5dc6853a | ||
|
|
a70a776e46 | ||
|
|
83c3d6b1a8 | ||
|
|
6a566087ca | ||
|
|
e62b5c03db | ||
|
|
29da6d7071 | ||
|
|
ec4a58e19e | ||
|
|
b023999c5e | ||
|
|
ee711d8f81 | ||
|
|
d26a06872a | ||
|
|
c4f8912490 | ||
|
|
d9a440f667 | ||
|
|
49bc2d3241 | ||
|
|
d07603f1b0 | ||
|
|
76346c24b3 | ||
|
|
dee3e2f596 | ||
|
|
648eb9b2f1 | ||
|
|
fcbf4d3972 | ||
|
|
3ef6056a77 | ||
|
|
ac10bce231 | ||
|
|
6780a21b07 | ||
|
|
25fabde434 | ||
|
|
da7cd2a060 | ||
|
|
8924257aee | ||
|
|
90ef9e273d | ||
|
|
b447e8e9b8 | ||
|
|
3744c0b165 | ||
|
|
c98af496b3 | ||
|
|
c7eaff7ff5 | ||
|
|
37acec7115 | ||
|
|
f6ec543f40 | ||
|
|
5cfd5f99e3 | ||
|
|
dafee58c77 | ||
|
|
4cf0c6688f | ||
|
|
27ec2d24fe | ||
|
|
e3a3ff2540 | ||
|
|
e6a51f965f | ||
|
|
552a2a185e | ||
|
|
04d47d10ad |
@@ -1,8 +1,8 @@
|
||||
# sfall
|
||||
|
||||
A set of engine modifications for the classic game Fallout 2 in form of a DLL, which modifies executable in memory without changing anything in EXE file itself.
|
||||
A set of engine modifications for the classic game Fallout 2 in form of a DLL, which modifies executable in memory without changing anything in EXE file itself.
|
||||
|
||||
Engine modifications include:
|
||||
**Engine modifications include:**
|
||||
- Better support for modern operating systems
|
||||
- Externalizing many settings like starting map and game time, skills, perks, critical hit tables, books, etc.
|
||||
- Bug fixes
|
||||
@@ -10,7 +10,7 @@ Engine modifications include:
|
||||
- Extended scripting capabilities for modders (many new opcodes to control sfall features as well as previously unavailable vanilla engine functions)
|
||||
|
||||
|
||||
Original author: timeslip
|
||||
Original author: timeslip
|
||||
|
||||
Original description: A set of engine modifications for the classic game Fallout 2 by Interplay. Includes fixes for bugs in the original engine, allows fallout to run correctly on modern operating systems, and adds additional features for modders.
|
||||
Original description: A set of engine modifications for the classic game Fallout 2 by Interplay. Includes fixes for bugs in the original engine, allows fallout to run correctly on modern operating systems, and adds additional features for modders.
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@ WeaponAccurateBonus=20
|
||||
WeaponHandlingBonus=3
|
||||
|
||||
;##############################################################################
|
||||
[Perks]
|
||||
;Set to 1 to enable the modifications for perks
|
||||
Enable=0
|
||||
|
||||
;Name=The name of the perk (max 63 characters)
|
||||
;Desc=The description of the perk (max 255 characters)
|
||||
;Image=The line number (0-indexed) of the corresponding FRM in skilldex.lst
|
||||
@@ -78,6 +82,11 @@ INT=0
|
||||
AGL=0
|
||||
LCK=0
|
||||
|
||||
;##############################################################################
|
||||
[Traits]
|
||||
;Set to 1 to enable the modifications for traits
|
||||
Enable=0
|
||||
|
||||
;This is a modification to trait 0
|
||||
[t0]
|
||||
NoHardcode=0
|
||||
|
||||
+150
-98
@@ -1,30 +1,12 @@
|
||||
;sfall configuration settings
|
||||
;v3.8.20
|
||||
;v3.8.25
|
||||
|
||||
[Main]
|
||||
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
|
||||
UseCommandLine=0
|
||||
|
||||
;Uncomment and point to a file to get alternate translations for some sfall messages
|
||||
;TranslationsINI=.\Translations.ini
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
[Sound]
|
||||
;Sets the number of allowed simultaneous sound effects
|
||||
;Set to 0 to leave the default unchanged (i.e. 4)
|
||||
NumSoundBuffers=0
|
||||
|
||||
;Set to 1 to allow attaching sound files to combat float messages
|
||||
AllowSoundForFloats=0
|
||||
|
||||
;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
|
||||
|
||||
;Set to 1 to override the music path used by default (i.e. data\sound\music\) if not present in the cfg
|
||||
;Set to 2 to overwrite all occurances of the music path
|
||||
OverrideMusicDir=2
|
||||
;TranslationsINI=sfall\Translations.ini
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
[Speed]
|
||||
@@ -54,6 +36,7 @@ AffectPlayback=0
|
||||
;Set to 0 for 8 bit fullscreen
|
||||
;Set to 4 for DX9 fullscreen
|
||||
;Set to 5 for DX9 windowed
|
||||
;Set to 6 for DX9 fullscreen windowed (the resolution in f2_res.ini should be set to the same aspect ratio as your desktop resolution)
|
||||
;A DX9 mode is required for any graphics related script extender functions to work (i.e. fullscreen shaders)
|
||||
;Modes 1, 2 and 3 are no longer supported
|
||||
Mode=0
|
||||
@@ -64,6 +47,14 @@ Mode=0
|
||||
GraphicsWidth=0
|
||||
GraphicsHeight=0
|
||||
|
||||
;Window position data. Do not modify
|
||||
;Set to 0 to reset if the window position is incorrect
|
||||
WindowData=0
|
||||
|
||||
;Uncomment the option to use a hardware shader (requires DX9 graphics mode)
|
||||
;The shader file <name>.fx must be placed in <GameRoot>\<master_patches>\shaders\ and must contain one technique with one or more passes
|
||||
;GlobalShaderFile=global.fx
|
||||
|
||||
;Set to 1 to do the palette conversion on the GPU
|
||||
;Set to 2 to do the palette conversion on the CPU
|
||||
;Set to 0 to pick automatically
|
||||
@@ -78,13 +69,45 @@ GPUBlt=0
|
||||
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
|
||||
;Requires DX9 graphics mode
|
||||
AllowDShowMovies=0
|
||||
|
||||
;Fade effect time percentage modifier
|
||||
;Default is 100. Decrease/increase this value to speed up/slow down fade effects
|
||||
FadeMultiplier=100
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
[Interface]
|
||||
;Set to 1 to draw a dotted line while traveling on the world map (similar to Fallout 1)
|
||||
WorldMapTravelMarkers=0
|
||||
;Uncomment these lines to change the appearance of the markers
|
||||
;The color index in Fallout default palette (valid range: 1..228; default is 134)
|
||||
;TravelMarkerColor=134
|
||||
;The length and spacing of the dots in pixels for each type of terrain in worldmap.txt
|
||||
;Syntax is 'length:spacing', with each pair separated by a comma (valid range: 1..10; default is 2)
|
||||
;TravelMarkerStyles=2:2,2:2,2:2,2:2
|
||||
|
||||
;Set to 1 to display terrain types when hovering the cursor over the player's marker on the world map
|
||||
WorldMapTerrainInfo=0
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
[Sound]
|
||||
;Sets the number of allowed simultaneous sound effects
|
||||
;Set to 0 to leave the default unchanged (i.e. 4). The maximum is 32
|
||||
NumSoundBuffers=0
|
||||
|
||||
;Set to 1 to allow attaching sound files to combat float messages
|
||||
AllowSoundForFloats=0
|
||||
|
||||
;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
|
||||
|
||||
;Set to 1 to override the music path used by default (i.e. data\sound\music\) if not present in the cfg
|
||||
;Set to 2 to overwrite all occurances of the music path
|
||||
OverrideMusicDir=1
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
[Input]
|
||||
;Set to 1 to enable the mouse scroll wheel to scroll through the inventory, barter, and loot screens
|
||||
@@ -137,7 +160,7 @@ SpeedKey7=0x00
|
||||
SpeedKey8=0x00
|
||||
SpeedKey9=0x00
|
||||
|
||||
;A key to hold down to move the window around when using graphics mode 5
|
||||
;A key to hold down to move the window around when using DX9 graphics mode 5
|
||||
;Set to 0 if you don't want to use a modifier key, or a DX scancode otherwise
|
||||
;Set to -1 for either ctrl key, -2 for either alt key or -3 for either shift key
|
||||
WindowScrollKey=0
|
||||
@@ -149,17 +172,20 @@ ToggleItemHighlightsKey=42
|
||||
;Set to 1 to also highlight containers
|
||||
HighlightContainers=1
|
||||
|
||||
;Set the color of outlines, available colors:
|
||||
;0x01 - glowing red
|
||||
;0x02 - red
|
||||
;0x04 - grey
|
||||
;0x08 - glowing green
|
||||
;0x10 - bright yellow
|
||||
;0x20 - dark yellow
|
||||
;0x40 - purple
|
||||
OutlineColor=0x10
|
||||
;Set to 1 to also highlight lootable corpses
|
||||
HighlightCorpses=1
|
||||
|
||||
;A key to press to reload your currently equipped weapon
|
||||
;Set the color of outlines, available colors:
|
||||
;1 - glowing red
|
||||
;2 - red
|
||||
;4 - grey
|
||||
;8 - glowing green
|
||||
;16 - bright yellow
|
||||
;32 - dark yellow
|
||||
;64 - purple
|
||||
OutlineColor=16
|
||||
|
||||
;A key to press to reload your currently equipped weapon or use the active item
|
||||
;Set to 0 if you don't want a reload key, or a DX scancode otherwise
|
||||
ReloadWeaponKey=0
|
||||
|
||||
@@ -173,7 +199,7 @@ FastMoveFromContainer=0
|
||||
|
||||
;A key to press to open a debug game editor
|
||||
;Set to 0 to disable, or a DX scancode otherwise
|
||||
;Requires sfall debugging mode to be enabled and FalloutClient.exe from the modders pack
|
||||
;Requires sfall debugging mode and FalloutClient.exe from the modders pack
|
||||
DebugEditorKey=0
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
@@ -181,6 +207,7 @@ DebugEditorKey=0
|
||||
;Changes some of Fallout 2 engine functions to Fallout 1 behavior:
|
||||
;- disables playing the final movie/credits after the endgame slideshow
|
||||
;- disables halving the weight for power armor items
|
||||
;- endgame_movie script function plays movie 10 or 11 based on the player's gender before the credits
|
||||
Fallout1Behavior=0
|
||||
|
||||
;Time limit in years. Must be between -3 and 13
|
||||
@@ -271,9 +298,6 @@ Movie17=credits.mve
|
||||
;LocalMapXLimit=480
|
||||
;LocalMapYLimit=400
|
||||
|
||||
;To add additional perks to the game, uncomment the next line and set it to point to a file containing perk information
|
||||
;PerksFile=Perks.ini
|
||||
|
||||
;Set to 1 if you want the pipboy to be available at the start of the game
|
||||
;Set to 2 to make the pipboy available by only skipping the vault suit movie check
|
||||
PipBoyAvailableAtGameStart=0
|
||||
@@ -320,13 +344,10 @@ SingleCore=1
|
||||
OverrideArtCacheSize=0
|
||||
|
||||
;Prevents you from saving in combat except at the start of your turn to avoid a few bugs
|
||||
;Note that even with this option enabled, it is still not advisable to save in combat at all.
|
||||
;Note that even with this option enabled, it is still not advisable to save in combat at all (obsolete information)
|
||||
;Set to 2 to block all saving in combat
|
||||
SaveInCombatFix=1
|
||||
|
||||
;Point to an ini file containing elevator data
|
||||
;ElevatorsFile=Elevators.ini
|
||||
|
||||
;Uncomment and set a comma delimited list of numbers to use a custom xp table.
|
||||
;Player's level is capped once the highest specified level is reached
|
||||
;XPTable=50,100,200
|
||||
@@ -355,8 +376,6 @@ AdditionalWeaponAnims=1
|
||||
;If the ExtraKillTypes option is enabled, this should be set to 3, with containing entries for any new types
|
||||
;Must be non-zero to use the edit/get/reset_critical script functions
|
||||
OverrideCriticalTable=2
|
||||
;To change the path and filename of the critical table file, uncomment the next line
|
||||
;OverrideCriticalFile=CriticalOverrides.ini
|
||||
|
||||
;Set to 1 to get notification of karma changes in the notification window
|
||||
DisplayKarmaChanges=0
|
||||
@@ -367,9 +386,6 @@ AlwaysReloadMsgs=0
|
||||
;Set to 1 to force the player to play the idle animation when reloading their weapon
|
||||
PlayIdleAnimOnReload=0
|
||||
|
||||
;Set to 1 to prevent corpses from blocking line of fire
|
||||
CorpseLineOfFireFix=1
|
||||
|
||||
;Changes the timer (in days) for deleting corpses on a map after you leave (valid range: 0..13)
|
||||
;The corpses of critters with 'Ages' flag or on maps with 'dead_bodies_age=No' set in maps.txt will not disappear
|
||||
;Default is 6. Set to 0 for a 12-hour timer
|
||||
@@ -377,12 +393,12 @@ CorpseDeleteTime=6
|
||||
|
||||
;Set a number of milliseconds to idle each input loop
|
||||
;Set to -1 to disable
|
||||
;Set to 0 to idle only if other processes are waiting for processor time
|
||||
;Set to 1 (or some higher number if needed, the maximum is 127) to prevent 100% CPU use
|
||||
;Set to 0 to idle only if other processes are waiting for processor time (WinXP/2000: if processes have equal priority)
|
||||
;Set to 1 (or some higher number if needed) to prevent 100% CPU use. The maximum is 127
|
||||
ProcessorIdle=-1
|
||||
|
||||
;Set to 1 if using the hero appearance mod
|
||||
;Set to 2 for backward compatibility with old scripts that manually fix obj_art_fid script function for dude_obj
|
||||
;Set to 2 for backward compatibility with scripts that manually fix obj_art_fid/art_change_fid_num script functions for dude_obj
|
||||
;You can add AppChCrt.frm and AppChEdt.frm files to art\intrface\ to set a custom background for the character screen
|
||||
EnableHeroAppearanceMod=0
|
||||
|
||||
@@ -395,8 +411,9 @@ 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
|
||||
;Set to 1 to fix NPCs not checking weapon perks properly when choosing the best weapon in combat
|
||||
;Set to 2 to change the priority multiplier for having weapon perk to 3x (the original is 5x)
|
||||
;Note that enabling this option can significantly affect the weapon of choice for some NPCs
|
||||
AIBestWeaponFix=0
|
||||
|
||||
;Set to 1 to fix NPCs not taking chem_primary_desire in AI.txt as drug use preference when using drugs in their inventory
|
||||
@@ -420,6 +437,9 @@ Doctor=293
|
||||
Science=293
|
||||
Repair=293
|
||||
|
||||
;Set to 1 to remove window position rounding for script-created windows
|
||||
RemoveWindowRounding=1
|
||||
|
||||
;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
|
||||
@@ -431,20 +451,28 @@ UseScrollingQuestsList=1
|
||||
|
||||
;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
|
||||
;Each name in PremadePaths is limited to 11 characters
|
||||
;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.
|
||||
;CityRepsCount=19
|
||||
;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
|
||||
;ConsoleOutputPath="bingle.txt"
|
||||
;ConsoleOutputPath=console.txt
|
||||
|
||||
;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 the current selected page 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
|
||||
;Set to 3 to update the AC counter instantly when switching to other controlled critters in combat
|
||||
@@ -452,7 +480,6 @@ SpeedInterfaceCounterAnims=0
|
||||
|
||||
;These lines allow you to control the karma FRMs displayed on the character screen
|
||||
;Number of KarmaPoints should be 1 less than number of KarmaFRMs
|
||||
;KarmaFRMsCount=3
|
||||
;KarmaFRMs=47,48,49
|
||||
;KarmaPoints=-100,100
|
||||
|
||||
@@ -463,8 +490,11 @@ ScienceOnCritters=0
|
||||
;Default is 166
|
||||
SpeedInventoryPCRotation=166
|
||||
|
||||
;Uncomment to set the text colour of the extra 5 interface boxes
|
||||
;The line must contain 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.
|
||||
@@ -473,18 +503,12 @@ BonusHtHDamageFix=1
|
||||
;Set to 1 to display additional points of damage from Bonus HtH/Ranged Damage perks in the inventory
|
||||
DisplayBonusDamage=0
|
||||
|
||||
;Set to 1 to display the range of the second attack mode in the inventory when you switch weapon modes in active item slots
|
||||
DisplaySecondWeaponRange=1
|
||||
|
||||
;Modify the maximum number of animations allowed to run on a map. (Default is 32, and the maximum is 127)
|
||||
AnimationsAtOnceLimit=120
|
||||
|
||||
;Set to 1 to remove the limits that stop the player rolling critical successes/misses in the first few days of game time
|
||||
RemoveCriticalTimelimits=0
|
||||
|
||||
;Set to 1 to enable party members with level 6 protos to reach level 6
|
||||
NPCStage6Fix=0
|
||||
|
||||
;Change the colour of the font used on the main menu for the Fallout/sfall version number and copyright text
|
||||
;It's the last byte ('3C' by default) that picks the colour used. The first byte supplies additional flags for this option
|
||||
;MainMenuFontColour=0x00003C
|
||||
@@ -500,19 +524,11 @@ FastShotFix=1
|
||||
;Set to 1 to boost the maximum number of script names from 1450 to 10000
|
||||
BoostScriptDialogLimit=0
|
||||
|
||||
;Allows you to edit the skill tables
|
||||
;Point the next line to an ini file containing the replacement skill data
|
||||
;SkillsFile=Skills.ini
|
||||
|
||||
;To change the relationship between SPECIAL stats and derived stats, uncomment the next line
|
||||
;See the Stats.ini in the modders pack for an example file
|
||||
;DerivedStats=Stats.ini
|
||||
|
||||
;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 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
|
||||
;You can use line number 542/543 in proto.msg and line number 35 in inventry.msg to set up custom messages for item size
|
||||
;You can use message number 542/543 in proto.msg and message number 35 in inventry.msg to set up custom messages for item size
|
||||
CritterInvSizeLimitMode=0
|
||||
CritterInvSizeLimit=100
|
||||
|
||||
@@ -560,6 +576,10 @@ StartGDialogFix=0
|
||||
;attacker_results - unused, must be 0 or not equal to the target_results argument when specifying result flags for the target
|
||||
AttackComplexFix=0
|
||||
|
||||
;Set to 1 to fix the issue with the division operator treating negative integers as unsigned
|
||||
;Note: To perform the unsigned integer division, use the new 'div' operator
|
||||
DivisionOperatorFix=1
|
||||
|
||||
;Set to 1 to enable the balanced bullet distribution formula for burst attacks
|
||||
ComputeSprayMod=0
|
||||
|
||||
@@ -589,17 +609,13 @@ ExplosionsEmitLight=0
|
||||
;MovieTimer_artimer3=270
|
||||
;MovieTimer_artimer4=360
|
||||
|
||||
;Set to 1 to enable the new arrays behavior
|
||||
;Set to 1 to enable the new arrays behavior (default behavior)
|
||||
;Set to 0 for backward compatibility with pre-3.4 scripts
|
||||
arraysBehavior=1
|
||||
|
||||
;Set to 1 to add proper checks if there is enough ammo to use weapons that use multiple ammo per shot
|
||||
CheckWeaponAmmoCost=0
|
||||
|
||||
;To add additional books to the game, uncomment the next line and point to a file containing book information
|
||||
;See the Books.ini in the modders pack for an example file
|
||||
;BooksFile=Books.ini
|
||||
|
||||
;Controls the speed of combat panel animations (lower - faster; valid range: 0..65535)
|
||||
CombatPanelAnimDelay=1000
|
||||
;Controls the speed of dialog panel animations (lower - faster; valid range: 0..255)
|
||||
@@ -625,7 +641,7 @@ StackEmptyWeapons=0
|
||||
;If the amount of ammo boxes in the inventory is less than or equal to the reserve, only one box will be used
|
||||
ReloadReserve=-1
|
||||
|
||||
;Set to 1 to change the counter in the 'Move Items' window to start with maximum number except in the barter screen
|
||||
;Set to 1 to change the counter in the 'Move Items' window to start with maximum number, except in the barter screen
|
||||
ItemCounterDefaultMax=0
|
||||
|
||||
;Set to 1 to leave the music playing in dialogue with talking heads
|
||||
@@ -638,6 +654,13 @@ DontTurnOffSneakIfYouRun=0
|
||||
;Set to 0 to disable switching. (Default is 3)
|
||||
UseWalkDistance=3
|
||||
|
||||
;Changes the displayed message when you recover from the negative effects of radiation exposure
|
||||
;The value is the message number in misc.msg (Default is 3003: 'You feel better')
|
||||
RadEffectsRemovalMsg=3003
|
||||
|
||||
;Set to 1 to display messages about radiation for the active geiger counter
|
||||
ActiveGeigerMsgs=1
|
||||
|
||||
;Set to 1 to fix the bug of being unable to sell used geiger counters or stealth boys
|
||||
CanSellUsedGeiger=1
|
||||
|
||||
@@ -671,6 +694,10 @@ DisplaySwiftLearnerExp=1
|
||||
;Set to 1 to display party member's current level/AC/addict flag on the combat control panel
|
||||
PartyMemberExtraInfo=0
|
||||
|
||||
;Set to 1 to skip loading all game settings except the game/combat difficulty from saved games
|
||||
;Set to 2 to also skip loading the game/combat difficulty settings
|
||||
SkipLoadingGameSettings=0
|
||||
|
||||
;Set to 1 to prevent the inventory/loot/automap interfaces from being placed on top of other script-created windows
|
||||
InterfaceDontMoveOnTop=0
|
||||
|
||||
@@ -689,6 +716,31 @@ KnockoutTime=35
|
||||
;Set to 1 to display sfall built-in credits at the bottom of credits.txt contents instead of at the top
|
||||
CreditsAtBottom=0
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
; Configuration ini files
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
|
||||
;To change the path and filename of the critical table file, uncomment the next line
|
||||
;OverrideCriticalFile=sfall\CriticalOverrides.ini
|
||||
|
||||
;To change the relationship between SPECIAL stats and derived stats, uncomment the next line
|
||||
;See the Stats.ini in the modders pack for an example file
|
||||
;DerivedStats=sfall\Stats.ini
|
||||
|
||||
;Allows you to edit the skill tables
|
||||
;Point the next line to an ini file containing the replacement skill data
|
||||
;SkillsFile=sfall\Skills.ini
|
||||
|
||||
;To add additional perks to the game, uncomment the next line and set it to point to a file containing perk information
|
||||
;PerksFile=sfall\Perks.ini
|
||||
|
||||
;To add additional books to the game, uncomment the next line and point to a file containing book information
|
||||
;See the Books.ini in the modders pack for an example file
|
||||
;BooksFile=sfall\Books.ini
|
||||
|
||||
;Point to an ini file containing elevator data
|
||||
;ElevatorsFile=sfall\Elevators.ini
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
[Debugging]
|
||||
;Extra sfall configuration settings that can be used by modders
|
||||
@@ -697,10 +749,27 @@ CreditsAtBottom=0
|
||||
;Set to 1 to enable sfall debugging mode
|
||||
Enable=0
|
||||
|
||||
;Set to 1 to give scripts direct access to Fallout's address space, and to make arbitrary calls into Fallout's code
|
||||
;Set to 2 to also disable the memory address check in unsafe script functions
|
||||
;Does not require sfall debugging mode
|
||||
AllowUnsafeScripting=0
|
||||
|
||||
;If you're testing changes to the Fallout exe, you can override the CRC that sfall looks for here
|
||||
;You can use several hex values, separated by commas
|
||||
;Does not require sfall debugging mode
|
||||
;ExtraCRC=0x00000000,0x00000000
|
||||
|
||||
;Set to 1 to skip the executable file size check
|
||||
;Does not require sfall debugging mode
|
||||
SkipSizeCheck=0
|
||||
|
||||
;Change to 1 to skip the compatibility mode check
|
||||
SkipCompatModeCheck=0
|
||||
|
||||
;Fallout 2 Debug Patch
|
||||
;Set to 1 to send debug output to the screen, 2 to a debug.log file, or 3 to both the screen and a debug.log file
|
||||
;Does not require enabling sfall debugging mode
|
||||
;While you don't need to create an environment variable, you do still need to set the appropriate lines in fallout2.cfg:
|
||||
;Set to 1 to send debug output to the screen, 2 to a debug.log file, or 3 to both the screen and debug.log
|
||||
;Does not require sfall debugging mode
|
||||
;While you don't need to create an environment variable, you do still need to set the appropriate lines in fallout2.cfg
|
||||
;-------
|
||||
;[debug]
|
||||
;mode=environment
|
||||
@@ -709,40 +778,23 @@ Enable=0
|
||||
;show_script_messages=1
|
||||
;show_tile_num=1
|
||||
;[sound]
|
||||
;debug=1
|
||||
;debug_sfxc=1
|
||||
;debug=0
|
||||
;debug_sfxc=0
|
||||
;-------
|
||||
DebugMode=0
|
||||
|
||||
;Set to 1 to hide error messages in debug output when a null value is passed to the function as an object
|
||||
;Requires DebugMode to be enabled
|
||||
HideObjIsNullMsg=0
|
||||
|
||||
;Change to 1 to skip the compatibility mode check
|
||||
SkipCompatModeCheck=0
|
||||
|
||||
;Set to 1 to skip the executable file size check
|
||||
;Does not require enabling sfall debugging mode
|
||||
SkipSizeCheck=0
|
||||
|
||||
;If you're testing changes to the Fallout exe, you can override the CRC that sfall looks for here
|
||||
;You can use several hex values, separated by commas
|
||||
;Does not require enabling sfall debugging mode
|
||||
;ExtraCRC=0x00000000,0x00000000
|
||||
|
||||
;Set to 1 to stop Fallout from deleting non read-only protos at startup
|
||||
;Has pretty nasty side effects when saving/reloading, so don't use for regular gameplay
|
||||
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 critters to display combat float messages
|
||||
;Requires AllowSoundForFloats to be enabled
|
||||
Test_ForceFloats=0
|
||||
|
||||
;These options control what output is saved in the debug log (sfall-log.txt)
|
||||
|
||||
;Prints messages duing sfall initialization
|
||||
Init=0
|
||||
;Prints messages relating to hook scripts
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
// Status: WIP
|
||||
|
||||
texture bloomMap;
|
||||
sampler s0;
|
||||
|
||||
sampler BloomSampler : samplerstate
|
||||
{
|
||||
Texture = bloomMap;
|
||||
MinFilter = Linear;
|
||||
MagFilter = Linear;
|
||||
AddressU = Clamp;
|
||||
AddressV = Clamp;
|
||||
};
|
||||
|
||||
// pseudo gauss blur
|
||||
static const float2 offsets[12] = {
|
||||
-0.326212, -0.405805,
|
||||
-0.840144, -0.073580,
|
||||
-0.695914, 0.457137,
|
||||
-0.203345, 0.620716,
|
||||
0.962340, -0.194983,
|
||||
0.473434, -0.480026,
|
||||
0.519456, 0.767022,
|
||||
0.185461, -0.893124,
|
||||
0.507431, 0.064425,
|
||||
0.896420, 0.412458,
|
||||
-0.321940, -0.932615,
|
||||
-0.791559, -0.597705,
|
||||
};
|
||||
|
||||
float w;
|
||||
float h;
|
||||
static const float2 resolution = float2(w, h);
|
||||
|
||||
// blur setting
|
||||
static const float blurFalloff = 8;
|
||||
static const float sharpness = 4;
|
||||
|
||||
float4 AdjustSaturation(float4 color, float saturation) {
|
||||
float grey = dot(color, float3(0.3, 0.59, 0.11));
|
||||
|
||||
return lerp(grey, color, saturation);
|
||||
}
|
||||
|
||||
float Brightness(float3 color)
|
||||
{
|
||||
return color.r * color.g - 0.75 * color.b;
|
||||
}
|
||||
|
||||
float3 BlurFunction(float2 uv, float brightness, inout float totalWeight)
|
||||
{
|
||||
float3 pointColor =(tex2Dlod(s0, float4(uv, 0, 0)).rgb);
|
||||
float diff = abs(brightness - Brightness(pointColor));
|
||||
float weight = exp2(-0.25 * blurFalloff - diff * sharpness);
|
||||
totalWeight += weight;
|
||||
|
||||
return pointColor * weight;
|
||||
}
|
||||
|
||||
float4 BlurPS(float2 uv : TEXCOORD0, uniform float2 delta) : COLOR0
|
||||
{
|
||||
float3 sumColor = (tex2D(s0, uv).rgb);
|
||||
float totalWeight = 1;
|
||||
float brightness = Brightness(sumColor);
|
||||
delta *= (1 / resolution);
|
||||
float radius = 1;
|
||||
|
||||
float2 pointUV = uv + delta * radius;
|
||||
sumColor += BlurFunction(pointUV, brightness, totalWeight);
|
||||
pointUV = uv - delta * radius;
|
||||
sumColor += BlurFunction(pointUV, brightness, totalWeight);
|
||||
|
||||
return float4((sumColor / totalWeight),1);
|
||||
// return AdjustSaturation(Color, 0.5);
|
||||
}
|
||||
|
||||
float4 BloomT(float2 texCoord : TEXCOORD0) : COLOR0 {
|
||||
float4 c = tex2D(s0, texCoord);
|
||||
float BloomThreshold = 0.2;
|
||||
|
||||
return saturate((c - BloomThreshold) / (1 - BloomThreshold));
|
||||
}
|
||||
|
||||
float4 Bloom(float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0 {
|
||||
float BaseIntensity = 1.0;
|
||||
float BaseSaturation = 1;
|
||||
float BloomIntensity = 1; // 0.4
|
||||
float BloomSaturation = 0.5;
|
||||
float BlurPower = 0.01;
|
||||
float BloomThreshold = 0.5;
|
||||
|
||||
float4 original = tex2D(s0, texCoord);
|
||||
|
||||
// blur
|
||||
float4 sum = tex2D(s0, texCoord);
|
||||
for(int i = 0; i < 12; i++){
|
||||
sum += tex2D(s0, texCoord + BlurPower * offsets[i]);
|
||||
}
|
||||
sum /= 13;
|
||||
|
||||
original = AdjustSaturation(original, BaseSaturation) * BaseIntensity;
|
||||
sum = AdjustSaturation(sum, BloomSaturation) * BloomIntensity;
|
||||
|
||||
sum = saturate((sum - BloomThreshold) / (1 - BloomThreshold));
|
||||
|
||||
return sum + original;
|
||||
// return sum;
|
||||
}
|
||||
|
||||
technique Blur
|
||||
{
|
||||
// pass P2 { PixelShader = compile ps_2_0 BloomT(); }
|
||||
// pass P3 { PixelShader = compile ps_2_0 Bloom(); }
|
||||
Pass P0 { PixelShader = compile ps_3_0 BlurPS(float2(1, 0)); }
|
||||
Pass P1 { PixelShader = compile ps_3_0 BlurPS(float2(0, 1)); }
|
||||
}
|
||||
Binary file not shown.
@@ -1,11 +1,15 @@
|
||||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
#include "..\scripting\headers\sfall.h"
|
||||
#include "..\scripting\headers\define_lite.h"
|
||||
#include "..\scripting\headers\define_extra.h"
|
||||
|
||||
#include "..\scripting\headers\dik.h"
|
||||
/*
|
||||
#include "..\scripting\headers\lib.arrays.h"
|
||||
#include "..\scripting\headers\lib.strings.h"
|
||||
// #include "..\scripting\headers\lib.inven.h"
|
||||
#include "..\scripting\headers\lib.inven.h"
|
||||
*/
|
||||
|
||||
variable ini := "sfall-mods.ini";
|
||||
variable translationIni;
|
||||
@@ -69,3 +73,5 @@ end
|
||||
procedure InitConfigs begin
|
||||
translationIni := GetIniConfigStr("Main", "TranslationsINI", "Translations.ini", "ddraw.ini");
|
||||
end
|
||||
|
||||
#endif
|
||||
|
||||
Binary file not shown.
@@ -45,6 +45,7 @@ procedure start begin
|
||||
tap_key(DIK_A);
|
||||
tap_key(DIK_CAPITAL);
|
||||
end else if (mode bwand BARTER) then begin
|
||||
play_sfx("IB2P1XX1");
|
||||
tap_key(DIK_M);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -155,7 +155,7 @@ Example:
|
||||
- creates permanent array (but not "saved")
|
||||
- if size is >= 0, creates list with given size
|
||||
- if size == -1, creates map (associative array)
|
||||
- if size == -1 and flags == 2, creates a "lookup" map in which the values of existing keys are read-only and can't be updated.
|
||||
- if size == -1 and flags == 2, creates a "lookup" map (associative array) in which the values of existing keys are read-only and can't be updated.
|
||||
This type of array allows you to store a zero (0) key value
|
||||
- NOTE: in earlier versions (up to 4.1.3/3.8.13) the second argument is not used, just use 0
|
||||
- returns arrayID (valid until array is deleted)
|
||||
@@ -212,9 +212,11 @@ use macros sort_array, sort_array_reverse, reverse_array, shuffle_array from sfa
|
||||
- always returns 0
|
||||
|
||||
> void save_array(mixed key, int arrayID):
|
||||
- makes the array saveable; it will be saved in sfallgv.sav file when saving the game
|
||||
- arrayID is associated with given "key"
|
||||
- array becomes permanent (if it was temporary) and "saved"
|
||||
- key can be of any type (int, float or string)
|
||||
- if you specify 0 as the key for the array ID, it will make the array "unsaved"
|
||||
|
||||
> int load_array(mixed key):
|
||||
- load array from savegame data by the same key provided in "save_array"
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
The executation speed of scripts is not typically important in an unmodded game, given the difference in performance between a modern computer and what Fallout was designed for. When you start adding mods to the mix there's the potential for problems again, since sfall's global script system means that you can have a large amount of scripts being run every single frame.
|
||||
|
||||
======================
|
||||
=== sslc -O option ===
|
||||
======================
|
||||
|
||||
The sfall build of sslc supports a -O command line option to perform an optimization pass over the generated code. This isn't a magic make-my-code-go-faster bullet; most of what it does is very limited in scope. It's primary purpose was to strip out the procedures and variables which get automatically pulled into every script that includes define.h, whether you use them or not, and to do something about the additional variables that get created by foreach loops.
|
||||
|
||||
There are several levels of optimization available:
|
||||
-O1 - Basic, only removes unreferenced globals variables and procedures, code itself remains untouched.
|
||||
-O2 - Full, most code optimizations are on, but only those that were tested on complex scripts.
|
||||
-O3 - Experimental, provides most efficiency, but tend to break some complex code due to bugs.
|
||||
|
||||
The following optimizations are performed:
|
||||
|
||||
> constant expression folding: if an expression depends only on values which are known at compile time, then the expression is replaced by its result.
|
||||
|
||||
a:=2+2; -> a:=4;
|
||||
|
||||
> constant variable initialization: All variables are initialised to some value, ('0', if you don't specify anything else,) so sslc attempts to make use of that fact to remove the first assignment to a variable if the first assignment is a constant expression.
|
||||
|
||||
variable a; -> variable a:=4;
|
||||
a:=4; ->
|
||||
|
||||
> constant propagation: checks for values assigned to variables which can be computed at compile time, and replaces relevent references to the symbol by the constant. The original store is not removed by this optimization. Global variables are considered for this optimization only if they are not marked import or export, and are not assigned to anywhere in the script.
|
||||
|
||||
a:=4 -> a:=4
|
||||
foo(a); -> foo(4);
|
||||
|
||||
> dead code removal: Checks for and removes code which cannot be reached, either because it is hidden behind a return or because the argument to an if statement can be computed at compile time.
|
||||
|
||||
if 1 then begin -> display_msg("foo");
|
||||
display_msg("foo"); ->
|
||||
end else begin ->
|
||||
display_msg("bar"); ->
|
||||
end ->
|
||||
|
||||
> unreferenced variable elimination: Checks for variables which are never referenced, and removes them. Also applies to global variables, as long as they are not marked for export.
|
||||
|
||||
variable i, j, k; -> variable i;
|
||||
i:=1; -> i:=1;
|
||||
return; -> return;
|
||||
|
||||
> unreferenced procedure elimination: Checks for any procedures which are never called, and removes them.
|
||||
|
||||
procedure foo begin return "foo"; end -> procedure foo begin return "foo"; end
|
||||
procedure bar begin return "bar"; end -> procedure start begin
|
||||
procedure start begin -> display_msg(foo);
|
||||
display_msg(foo); -> end
|
||||
end ->
|
||||
|
||||
> dead store removal: Removes variable assignments if the result of the variable is unused, and if the expression used to compute the value of the variable is provably free of side effects. (See 'pure' keyword)
|
||||
|
||||
a:="moo"; -> a:="foo";
|
||||
a:="foo"; -> display_msg(a);
|
||||
display_msg(a); ->
|
||||
a:="bar"; ->
|
||||
|
||||
> store combination: Where there are two stores in a row to the same variable, the two expressions are combined.
|
||||
|
||||
var1 := var2; -> var1 := var2 + var3;
|
||||
var1 += var3; ->
|
||||
|
||||
> variable combination: Where usage regions of variables do not overlap, combine the variables to provide additional candidates for unreferenced variable elimination. Very useful for scripts containing multiple foreach loops, which generate 2 or 3 hidden variables each.
|
||||
|
||||
a:="foo"; -> a:="foo";
|
||||
display_msg(a); -> display_msg(a);
|
||||
b:="bar"; -> a:="bar";
|
||||
display_msg(b); -> display_msg(a);
|
||||
|
||||
> namelist compression: Fallout stores the names of all file scope variables and procedures in a namelist which is saved into the .int. Any of these that are unreferenced can be removed, and the names of global variables can be modified to make them shorter.
|
||||
|
||||
=============================
|
||||
=== writing your own code ===
|
||||
=============================
|
||||
|
||||
Don't have global scripts running any more often that you need them to. Not everything needs to be run every single frame.
|
||||
|
||||
Never concat constant strings with the '+' operator, as it forces the operation to be done at runtime. The compiler can cope with constant strings being placed next to each other without the need for a +, which results in far more efficient code as the combination is done at lex time.
|
||||
|
||||
#define GLOB_PREFIX "ts__" -> #define GLOB_PREFIX "ts__"
|
||||
|
||||
procedure start begin -> procedure start begin
|
||||
set_sfall_global(GLOB_PREFIX + "foo1", 0); -> set_sfall_global(GLOB_PREFIX "foo1", 0);
|
||||
end -> end
|
||||
|
||||
|
||||
Avoid function calls in while loops. function calls are expensive in comparison to variable lookups, so it's more efficient to move the function call out of the loop and store the result in a variable
|
||||
|
||||
while i < len_array(array) do begin -> tmp:= len_array(array);
|
||||
... -> while i < tmp do begin
|
||||
end -> ...
|
||||
-> end
|
||||
|
||||
Mark functions with pure or inline where relevent.
|
||||
|
||||
'pure' is a hint to the optimizer that a procedure has no side effects. (i.e. there's no way to tell that it's been called aside from its return value.) Pure procedures cannot modify global variables, or call any other procedure that isn't itself pure. Functions marked with pure can only be used in expressions (i.e. you cannot use the 'call <procedure>' syntax to call them.) If there are non-pure terms in an expression, it prevents that expression being considered for dead store removal. Where no such optimizations can be performed, or if optimization is disabled, marking a procedure with pure will have no effect on the compiled code.
|
||||
|
||||
'inline' is an instruction to the compiler to replace calls to the marked procedure with a copy of the procedures code instead of having a seperate call. inlined procedures cannot use the 'return' command, cannot be predefined, and cannot be used as part of an expression. inlining if a procedure is only going to be called once is always a win, but if there are multiple calls to a procedure you will end up bloating the size of the generated code.
|
||||
@@ -0,0 +1,405 @@
|
||||
This is a modified copy of sslc, that has a few bugfixes from the original, that will recognise and compile the additional scripting functions provided by sfall, that can also understand some additional syntax, and that has an integrated preprocessor and optimizer.
|
||||
|
||||
Unlike the original script compiler, this has not been compiled as a dos program. When using this in place of the original compile.exe but still using p.bat, you need to either get rid of the dos4gw.exe reference from p.bat or replace the original dos4gw.exe with the one in this archive.
|
||||
|
||||
If you use fallout script editor, you can extract compile.exe and dos4gw.exe to its \binary folder, or extract them somewhere else and change your preferences in FSE to point there. FSE doesn't seem to be able to tell when errors occur when using this compiler though, so I'd recommend either using sfall's script editor instead or compiling by hand if possible.
|
||||
|
||||
When compiling global or hook scripts for sfall 3.4 or below, you _must_ include the line 'procedure start;' before any #includes that define procedures to avoid a few weird problems. (this is no longer required starting from 3.5)
|
||||
|
||||
This version of compiler was designed primarily for new sfall functions, but it can safely (and is recommended) to be used with non-sfall scripts as well, as long as you don't use any of the arrays syntax and any sfall scripting functions.
|
||||
|
||||
The original unmodified sslc source is over here:
|
||||
http://www.teamx.ru/eng/files/srcs/index.shtml
|
||||
|
||||
============================
|
||||
=== command line options ===
|
||||
============================
|
||||
|
||||
-q don't wait for input on error
|
||||
-n no warnings
|
||||
-b backward compatibility mode
|
||||
-l no logo
|
||||
-p preprocess source
|
||||
-O optimize code (full, see optimization.txt)
|
||||
-O<N> set specific level of optimization (0 - off, 1 - basic, 2 - full, 3 - experimental)
|
||||
-d print debug messages
|
||||
-D output an abstract syntax tree of the program
|
||||
-o set output path (follows the input file name)
|
||||
-s enable short-circuit evaluation for all AND, OR operators
|
||||
-m<macro[=val]> define a macro named "macro" for conditional compilation
|
||||
-I<path> specify an additional directory to search for include files
|
||||
|
||||
The original command line option -w to turn on warnings no longer has an effect, since warnings are now on by default
|
||||
|
||||
===================================
|
||||
=== Additional supported syntax ===
|
||||
===================================
|
||||
|
||||
Syntax which requires sfall for compiled scripts to be interpreted, is marked by asterix (*).
|
||||
|
||||
> Optional arguments in user-defined procedures. You can only use constants for default values. It basically puts those constants in place of omitted arguments.
|
||||
|
||||
new:
|
||||
procedure test(variable x, variable y := 0, variable z := -1) begin
|
||||
...
|
||||
end
|
||||
...
|
||||
call test("value");
|
||||
|
||||
old:
|
||||
procedure test(variable x, variable y, variable z) begin
|
||||
...
|
||||
end
|
||||
...
|
||||
call test("value", 0, -1);
|
||||
|
||||
|
||||
> New logical operators "AndAlso", "OrElse" for short-circuit evaluation of logical expressions.
|
||||
Using these operators allow the right part of logical expressions not to be evaluated (executed, computed) if the result is already known. This can improve the performance of running scripts.
|
||||
|
||||
Example:
|
||||
if (obj andAlso obj_pid(obj) == PID_STIMPAK) then ...
|
||||
|
||||
if obj is null, the second condition will not be checked and your script won't fail with "obj is null" error in debug.log
|
||||
|
||||
This also has an effect that a value of last computed argument is returned as a result of whole expressions, instead of always 0 (false) or 1 (true):
|
||||
obj := false;
|
||||
display_msg(obj orElse "something"); // will print "something"
|
||||
|
||||
You can also use the -s option to enable short-circuit evaluation for all the AND, OR operators in the script.
|
||||
NOTE: Be aware that it may break some old scripts because operators behavior is changed slightly.
|
||||
|
||||
|
||||
> Conditional expressions (Python-inspired), also known as ternary operator:
|
||||
|
||||
new:
|
||||
X := value1 if condition else value2
|
||||
|
||||
old:
|
||||
if (condition) then
|
||||
X := value1;
|
||||
else
|
||||
X := value2;
|
||||
|
||||
|
||||
> To assign values, you can use the alternative assignment operator from C/Java instead of Pascal syntax.
|
||||
|
||||
new:
|
||||
x = 5;
|
||||
old:
|
||||
x := 5;
|
||||
|
||||
|
||||
> Multiple variable decleration: Multiple variables can be declared on one line, seperated by commas. This is an alterative to the ugly begin/end block, or the bulky single variable per line style.
|
||||
|
||||
new:
|
||||
variable a, b, c;
|
||||
old:
|
||||
variable begin a; b; c; end
|
||||
|
||||
|
||||
> Variable initialization with expressions: You can now initialize local variables with complex expressions instead of constants.
|
||||
|
||||
new:
|
||||
variable tile := tile_num(dude_obj);
|
||||
|
||||
old:
|
||||
variable tile;
|
||||
tile := tile_num(dude_obj);
|
||||
|
||||
NOTE: if your expression starts with a constant (eg. 2+2), enclose it in parentheses, otherwise compiler will be confused and give you errors.
|
||||
|
||||
|
||||
> Hexadecimal numerical constants: Simply prefix a number with 0x to create a hexadecimal. The numbers 0 to 9 and a-f are allowed in the number. The number may not have a decimal point.
|
||||
|
||||
new:
|
||||
a := 0x1000;
|
||||
old:
|
||||
a := 4096;
|
||||
|
||||
|
||||
> increment/decrement operators: ++ and -- can be used as shorthand for +=1 and -=1 respectively. They are mearly a syntactic shorthand to improve readability, and so their use is only allowed where +=1 would normally be allowed.
|
||||
|
||||
new:
|
||||
a++;
|
||||
old:
|
||||
a += 1;
|
||||
|
||||
|
||||
> "break" & "continue" statements: they work just like in most high-level languages. "break" jumps out of the loop. "continue" jumps right to the beginning of the next iteration (see "for" and "foreach" sections for additional details).
|
||||
|
||||
new:
|
||||
while (i < N) begin
|
||||
// ...
|
||||
if (/* some condition */) then break;
|
||||
// ...
|
||||
end
|
||||
|
||||
old:
|
||||
while (i < N and not(breakFlag)) begin
|
||||
// ...
|
||||
if (/* condition */) then breakFlag := true;
|
||||
// ...
|
||||
end
|
||||
|
||||
new:
|
||||
for (i := 0; i < N; i++) begin
|
||||
// ...
|
||||
if (/* condition */) then begin
|
||||
// action
|
||||
continue;
|
||||
end
|
||||
// else actions
|
||||
end
|
||||
|
||||
old:
|
||||
for (i := 0; i < N; i++) begin
|
||||
// ...
|
||||
if (/* condition */) then begin
|
||||
// action
|
||||
end else begin
|
||||
// else actions
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
> "for" loops: Another piece of syntactic shorthand, to shorten while loops in many cases. Parentheses around the loop statements are recommended but not required (when not using parentheses, a semicolon is required after the 3rd loop statement).
|
||||
new:
|
||||
for (i := 0; i < 5; i++) begin
|
||||
display_msg("i = "+i);
|
||||
end
|
||||
old
|
||||
i := 0;
|
||||
while (i < 5) do begin
|
||||
display_msg("i = "+i);
|
||||
i++;
|
||||
end
|
||||
|
||||
NOTE: "continue" statement in a "for" loop will recognize increment statement (third statement in parentheses) and will execute it before jumping back to the beginning of loop. This way you will not get an endless loop.
|
||||
|
||||
|
||||
> switch statements: A shorthand way of writing big 'if then else if...' blocks
|
||||
new:
|
||||
switch get_attack_type begin
|
||||
case ATKTYPE_PUNCH: display_msg("punch");
|
||||
case ATKTYPE_KICK: display_msg("kick");
|
||||
default: display_msg("something else");
|
||||
end
|
||||
old:
|
||||
variable tmp;
|
||||
tmp := get_attack_type;
|
||||
if tmp == ATKTYPE_PUNCH then begin
|
||||
display_msg("punch");
|
||||
end else if tmp == ATKTYPE_KICK then begin
|
||||
display_msg("kick");
|
||||
end else begin
|
||||
display_msg("something else");
|
||||
end
|
||||
|
||||
|
||||
> empty statements in blocks are allowed: This is just a convenience to save scripters a bit of memory. Some of the macros in the fallout headers include their own semicolons while others do not. With the original compiler you had to remember which was which, and if you got it wrong the script would not compile. Now it's always safe to include your own semicolon, even if the macro already had its own. For example, this would not compile with the original sslc, but will with the sfall edition:
|
||||
|
||||
#define my_macro diplay_msg("foo");
|
||||
|
||||
procedure start begin
|
||||
my_macro;
|
||||
end
|
||||
|
||||
|
||||
> Procedure stringify operator "@": designed to make callback-procedures a better option and allow for basic functional programming. Basically it replaces procedure names preceeded by "@" by a string constant.
|
||||
Not many people know that since vanilla Fallout you can call procedures by "calling a variable" containing it's name as a string value. There was a couple of problems using this:
|
||||
- optimizer wasn't aware that you are referencing a procedure, and could remove it, if you don't call it explicitly (can be solved by adding making procedure "critical")
|
||||
- you couldn't see all references of a procedure from a Script Editor
|
||||
- it was completely not obvious that you could do such a thing, it was a confusing syntax
|
||||
|
||||
old:
|
||||
callbackVar := "Node000";
|
||||
callbackVar();
|
||||
|
||||
new:
|
||||
callbackVar := @Node000;
|
||||
callbackVar();
|
||||
|
||||
|
||||
|
||||
> *arrays: In vanilla fallout arrays had to be constructed by reserving a block of global/map variables. Since sfall 2.7, specific array targeted functions have been available, but they are fairly messy and long winded to use. The compiler provides additional syntactic shorthand for accessing and setting array variables, as well as for array creation. When declaring an array variable, put a constant integer in []'s to give the number of elements in the array. (before sfall 3.4 you had to specify size in bytes for array elements, now it's not required, see "arrays.txt" for more information)
|
||||
|
||||
new:
|
||||
procedure bingle begin
|
||||
variable a[2];
|
||||
a[0] := 5;
|
||||
a[a[0] - 4] := a[0] + 4;
|
||||
display_msg("a[0]=" + a[0] + ", a[1]=" + a[1]);
|
||||
end
|
||||
old:
|
||||
procedure bingle begin
|
||||
variable a;
|
||||
a := temp_array(2, 4);
|
||||
set_array(a, 0, 5);
|
||||
set_array(a, get_array(a, 0) - 4, get_array(a, 0) + 4);
|
||||
display_msg("a[0]=" + get_array(a, 0) + ", a[1]=" + get_array(a, 1));
|
||||
end
|
||||
|
||||
|
||||
> *array expressions: sometimes you need to construct an array of elements and you will probably want to do it in just one expression. This is now possible:
|
||||
new:
|
||||
list := ["A", "B", "C", "D"];
|
||||
|
||||
old:
|
||||
list := temp_array(4, 2);
|
||||
list[0] := "A";
|
||||
list[1] := "B";
|
||||
list[2] := "C";
|
||||
list[3] := "D";
|
||||
|
||||
|
||||
Syntax specific for associative arrays is also available. (see "arrays.txt" for full introduction to this type of arrays).
|
||||
|
||||
> *map array expressions:
|
||||
|
||||
map := {5: "five", 10: "ten", 15: "fifteen", 20: "twelve"};
|
||||
|
||||
|
||||
> * "dot" syntax to access elements of associative arrays. "dot" syntax allows to work with arrays like objects:
|
||||
trap.radius := 3;
|
||||
trap.tile := tile_num(dude_obj);
|
||||
|
||||
you can chain dot and bracket syntax to access elements of multi-dimensional arrays:
|
||||
collectionList[5].objectList[5].name += " foo";
|
||||
|
||||
NOTE: when using incremental operators like +=, *=, ++, -- compiler will use additional temp variable to get an array at penultimate level in order to avoid making the same chain of "get_array" calls twice.
|
||||
|
||||
|
||||
> * "foreach" loops: A shorthand method of looping over all elements in an array. Syntax is 'foreach (<symbol> in <expression>) '
|
||||
new:
|
||||
procedure bingle begin
|
||||
variable critter;
|
||||
foreach (critter in list_as_array(LIST_CRITTERS)) begin
|
||||
display_msg(""+critter);
|
||||
end
|
||||
end
|
||||
old:
|
||||
procedure bingle begin
|
||||
variable begin critter; array; len; count; end
|
||||
array := list_as_array(LIST_CRITTERS);
|
||||
len := len_array(array);
|
||||
count := 0;
|
||||
while count < len do begin
|
||||
critter := array[count];
|
||||
display_msg("" + critter);
|
||||
end
|
||||
end
|
||||
|
||||
If you want an index array element (or key for "maps") at each iteration, use syntax: 'foreach (<symbol>: <symbol> in <expression>) '
|
||||
foreach (pid: price in itemPriceMap) begin
|
||||
if (itemPid == pid) then
|
||||
itemPrice := price;
|
||||
end
|
||||
|
||||
If you want to add additional condition for continuing the loop, use syntax: 'foreach (<symbol> in <expression> while <expression>) '. In this case loop will iterate over elements of an array until last element or until "while" expression is true (whatever comes first).
|
||||
|
||||
NOTE: just like "for" loop, "continue" statement will respect increments of a hidden counter variable, so you can safely use it inside "foreach".
|
||||
|
||||
|
||||
|
||||
|
||||
====================
|
||||
=== int2ssl note ===
|
||||
====================
|
||||
|
||||
int2ssl by Anchorite (TeamX) is included in sfall modderspack package. It was updated to support all additional opcodes of sfall, along with some syntax features. You can use it to decompile any sfall or non-sfall script.
|
||||
|
||||
=============
|
||||
=== Fixes ===
|
||||
=============
|
||||
|
||||
playmoviealpharect was using the token for playmoviealpha, breaking both functions in the process.
|
||||
|
||||
addbuttonflag had an entry in the token table, and could be parsed, but was missing an entry in the emit list. This resulted in the compiler accepting it as a valid function, but not outputting any code for it into the compiled script.
|
||||
|
||||
The function tokenize was missing an entry in the token table, and so would not be recognised by the compiler.
|
||||
|
||||
fixed the check for the 'call "foo"' syntax so that non-string constants will no longer be accepted.
|
||||
|
||||
==============================
|
||||
=== Backward compatibility ===
|
||||
==============================
|
||||
|
||||
There are several changes in this version of sslc which may result in problems for previously working scripts. A new command line option '-b' is available, which will turn off all new fixes and features which have the possibility of causing a previously compiling script to change its behaviour. (And only those features; anything which would not compile under the old sslc is not affected.) This includes the following:
|
||||
|
||||
- Since 'for', 'foreach', 'break', 'continue', 'in' and 'tokenize' are now hardcoded names, existing scripts that use any of them as a variable or procedure name will no longer compile.
|
||||
|
||||
- Missing a semicolon after a variable declaration is now a hard error. (Originally sslc would check for the semicolon, but would not complain if it was missing.)
|
||||
|
||||
- The function addbuttonflag used to be recognised by the compiler, but would not emit any code into the int file.
|
||||
|
||||
- The function playmoviealpharect compiled as playmoviealpha
|
||||
|
||||
|
||||
=================
|
||||
=== Changelog ===
|
||||
=================
|
||||
|
||||
> sfall 4.2.3
|
||||
- fixed compiler giving "assignment operator expected" error when a variable-like macro is not being defined properly
|
||||
- added new logical operators "AndAlso", "OrElse" for short-circuit evaluation of logical expressions
|
||||
- added an alternative (C/Java-style) assignment operator "="
|
||||
- added support for new "div" operator (unsigned integer division)
|
||||
|
||||
> sfall 4.2.2
|
||||
- added support for new opcode "reg_anim_callback"
|
||||
|
||||
> sfall 4.2.1
|
||||
- the basic optimization is now enabled by default when not specifying any optimization options
|
||||
- added -m<macro[=val]> option to define a macro named "macro" for conditional compilation
|
||||
- added -I<path> option to specify an additional directory to search for include files
|
||||
- unreferenced "critical" procedures and procedures with the names "Node998" and "Node999" are now removed by the optimizer
|
||||
|
||||
> sfall 4.2
|
||||
- now it is possible to run preprocess or optimization passes in backward compatibility mode
|
||||
- added support for new opcode "register_hook_proc_spec"
|
||||
|
||||
> sfall 4.0:
|
||||
- enabled code for "ceil" math function
|
||||
- fixed missing argument for "how_much" function
|
||||
- added "desc_p_proc" (from Fallout 1) to protected procedures that should not be removed by the optimizer
|
||||
- fixed compiler giving "division by zero" error when using zero as the second factor in multiplication
|
||||
|
||||
> sfall 3.8
|
||||
- added support for new universal opcodes sfall_funcX
|
||||
|
||||
> sfall 3.6:
|
||||
- added Python-style ternary operator (conditional expression)
|
||||
- added -s short-circuit evalution option for AND, OR expressions
|
||||
- int2ssl will detect and decompile conditional expressions and short-circuit logical operators
|
||||
- added -F option to include full file paths in "#line" directives after preprocessing
|
||||
- added -D option to write abstract syntax tree into .txt file
|
||||
- fixed compiler crash when number of arguments in procedure declaration does not match definition
|
||||
- fixed incorrect constant folding of "bwnot" operator
|
||||
- fixed more invalid results in constant folding
|
||||
- implemented optional arguments for user-defined procedures
|
||||
- implemented stringify procedure names using @ operator, which is helpful to pass procedures around to call them from variables (it will properly handle references)
|
||||
- logic for procedures passed as arguments to scripting functions was moved from code generation to parsing stage
|
||||
- now it is possible to call user-defined procedures inside argument list of scripting functions, without compiler attempting to treat them as procedure references and probably fail (procedures will still be passed, but only to appropriate scripting functions at appropriate argument positions)
|
||||
- int2ssl will now place empty parantheses after a call to user-defined procedure - this will distinct calls from passing procedures to some scripting functions (like giq_option)
|
||||
- fixed inline procedure "calls" not working when optimization is enabled
|
||||
- added column numbers to error/warning output
|
||||
- added code to simplify adding sfall opcodes into compiler (need to add code in 3 places, instead of 7 places for each opcode)
|
||||
- fixed bug when initializing variable with expression starting from a symbol
|
||||
- added division by zero constant check
|
||||
|
||||
> sfall 3.5:
|
||||
- completed namespace compression optimization with respect to imported/exported variables
|
||||
- changed 'for' and 'foreach' syntax to allow parentheses which are easier to read IMHO
|
||||
- heavy code refactoring - split "parse.c" into several files, replaced all dirty workaround code in "lex()" (some syntax features) with parser-level equivalents
|
||||
- added syntax to reference elements in multi-dimensional arrays (unlimited sequence of brackets [] and dots . )
|
||||
- added fully featured "break" and "continue" statements for loops
|
||||
- moved some optimizations (namely constant propagation and variable reuse) to "experimental" because they were breaking my scripts
|
||||
- added ability to initialize variables with expressions
|
||||
|
||||
> sfall 3.4:
|
||||
- added "foreach .. while .." syntax
|
||||
- added array expressions for lists and maps
|
||||
- added "foreach (key: value in ...)" syntax for convenience
|
||||
- fixed crash bug in "for" loop parsing function
|
||||
- added ability to access array elements with string keys using OOP-like dot (".") syntax
|
||||
File diff suppressed because it is too large
Load Diff
@@ -87,19 +87,34 @@
|
||||
#define FLAG_SEEN (0x40000000)
|
||||
#define FLAG_SHOOTTHRU (0x80000000)
|
||||
|
||||
|
||||
/* Critter Flags */
|
||||
/* Critter flags */
|
||||
#define CFLG_BARTER 2 // 0x00000002 - Barter (can trade with)
|
||||
#define CFLG_NOSTEAL 32 // 0x00000020 - Steal (cannot steal from)
|
||||
#define CFLG_NOSTEAL 32 // 0x00000020 - Steal (cannot be stolen from)
|
||||
#define CFLG_NODROP 64 // 0x00000040 - Drop (doesn't drop items)
|
||||
#define CFLG_NOLIMBS 128 // 0x00000080 - Limbs (cannot lose limbs)
|
||||
#define CFLG_NOAGES 256 // 0x00000100 - Ages (dead body does not disappear)
|
||||
#define CFLG_NOHEAL 512 // 0x00000200 - Heal (damage is not cured with time)
|
||||
#define CFLG_NOHEAL 512 // 0x00000200 - Heal (damage is not healed with time)
|
||||
#define CFLG_INVULN 1024 // 0x00000400 - Invulnerable (cannot be hurt)
|
||||
#define CFLG_FLATTN 2048 // 0x00000800 - Flatten (leaves no dead body)
|
||||
#define CFLG_SPECIAL 4096 // 0x00001000 - Special (there is a special type of death)
|
||||
#define CFLG_RANGED 8192 // 0x00002000 - Range (melee attack is possible at a distance)
|
||||
#define CFLG_NOKNOCKDOWN 16384 // 0x00004000 - Knock (cannot be knocked down)
|
||||
#define CFLG_SPECIAL 4096 // 0x00001000 - Special (has a special type of death)
|
||||
#define CFLG_RANGED 8192 // 0x00002000 - Range (has extra hand-to-hand range)
|
||||
#define CFLG_NOKNOCKBACK 16384 // 0x00004000 - Knock (cannot be knocked back)
|
||||
#define CFLG_NOKNOCKDOWN CFLG_NOKNOCKBACK // obsolete
|
||||
|
||||
/* Window flags */
|
||||
#define WIN_FLAG_MOVEONTOP (0x4)
|
||||
#define WIN_FLAG_HIDDEN (0x8)
|
||||
#define WIN_FLAG_EXCLUSIVE (0x10)
|
||||
#define WIN_FLAG_TRANSPARENT (0x20)
|
||||
|
||||
/* Message window flags */
|
||||
#define MSGBOX_AUTOSIZE (0x0)
|
||||
#define MSGBOX_NORMAL (0x1)
|
||||
#define MSGBOX_SMALL (0x2)
|
||||
#define MSGBOX_ALIGN_LEFT (0x4) // text aligned to left
|
||||
#define MSGBOX_ALIGN_TOP (0x8) // text aligned to top
|
||||
#define MSGBOX_YESNO (0x10) // use YES/NO buttons instead of DONE
|
||||
#define MSGBOX_CLEAN (0x20) // no buttons
|
||||
|
||||
//remove inven obj defines
|
||||
#define RMOBJ_CONSUME_DRUG 4666772
|
||||
@@ -120,7 +135,7 @@
|
||||
#define RMOBJ_RM_MULT_OBJS 4563866
|
||||
#define RMOBJ_REPLACE_WEAPON 4658526
|
||||
#define RMOBJ_THROW 4266040
|
||||
#define RMOBJ_SUB_CONTAINER 4683191 // search and remove the item from a container inside of an inventory
|
||||
#define RMOBJ_SUB_CONTAINER 4683191 // search and remove the item from nested containers in the inventory
|
||||
|
||||
// common prototype offsets for get/set_proto_data
|
||||
#define PROTO_PID (1)
|
||||
@@ -311,14 +326,15 @@
|
||||
#define OBJ_DATA_FID (0x20)
|
||||
#define OBJ_DATA_ELEVATION (0x28)
|
||||
#define OBJ_DATA_PID (0x64)
|
||||
#define OBJ_DATA_CID (0x68) // combat id, used for savegame
|
||||
#define OBJ_DATA_SID (0x78)
|
||||
#define OBJ_DATA_CID (0x68) // combat ID, used for savegame
|
||||
#define OBJ_DATA_SID (0x78) // script ID
|
||||
#define OBJ_DATA_SCRIPT_INDEX (0x80) // script index number in scripts.lst
|
||||
// items
|
||||
#define OBJ_DATA_CUR_CHARGES (0x3C)
|
||||
#define OBJ_DATA_CUR_CHARGES (0x3C) // for key items it's the key code
|
||||
// critters
|
||||
#define OBJ_DATA_COMBAT_STATE (0x3C) // flags: 1 - combat, 2 - target is out of range, 4 - flee
|
||||
#define OBJ_DATA_CUR_ACTION_POINT (0x40)
|
||||
#define OBJ_DATA_DAMAGE_LAST_TURN (0x48)
|
||||
#define OBJ_DATA_WHO_HIT_ME (0x54)
|
||||
#define OBJ_DATA_WHO_HIT_ME (0x54) // current target of the critter
|
||||
|
||||
#endif // DEFINE_EXTRA_H
|
||||
|
||||
@@ -5,6 +5,17 @@
|
||||
Numbers...
|
||||
*/
|
||||
|
||||
#define above(a, b) (unsigned_comp(a, b) > 0)
|
||||
#define above_equal(a, b) (unsigned_comp(a, b) >= 0)
|
||||
#define below(a, b) (unsigned_comp(a, b) < 0)
|
||||
#define below_equal(a, b) (unsigned_comp(a, b) <= 0)
|
||||
|
||||
// for sfall 4.2.3/3.8.23
|
||||
pure procedure unsigned_comp(variable a, variable b) begin
|
||||
if ((a bwxor b) == 0) then return 0; // a == b
|
||||
return 1 if ((b == 0) orElse a div b) else -1;
|
||||
end
|
||||
|
||||
#define MAX(x, y) ((x > y) * x + (x <= y) * y)
|
||||
#define MIN(x, y) ((x < y) * x + (x >= y) * y)
|
||||
#define in_range(x, from, to) (x >= from and x <= to)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef SFALL_H
|
||||
#define SFALL_H
|
||||
|
||||
//Recognised modes for set_shader_mode and get_game_mode
|
||||
#define WORLDMAP (0x1)
|
||||
#define LOCALMAP (0x2) //No point hooking this: would always be 1 at any point at which scripts are running
|
||||
#define DIALOG (0x4)
|
||||
#define ESCMENU (0x8)
|
||||
#define SAVEGAME (0x10)
|
||||
@@ -54,14 +56,27 @@
|
||||
#define LIST_GROUNDITEMS (1)
|
||||
#define LIST_SCENERY (2)
|
||||
#define LIST_WALLS (3)
|
||||
//#define LIST_TILES (4) //Not listable via sfall list functions
|
||||
//#define LIST_TILES (4) //Not listable via sfall list functions
|
||||
#define LIST_MISC (5)
|
||||
#define LIST_SPATIAL (6)
|
||||
#define LIST_ALL (9)
|
||||
|
||||
//Valid window types for get_window_attribute
|
||||
#define WINTYPE_INVENTORY (0) // any inventory window (player/loot/use/barter)
|
||||
#define WINTYPE_DIALOG (1)
|
||||
#define WINTYPE_PIPBOY (2)
|
||||
#define WINTYPE_WORLDMAP (3)
|
||||
#define WINTYPE_IFACEBAR (4) // the interface bar
|
||||
#define WINTYPE_CHARACTER (5)
|
||||
#define WINTYPE_SKILLDEX (6)
|
||||
#define WINTYPE_ESCMENU (7) // escape menu
|
||||
|
||||
//Valid flags for force_encounter_with_flags
|
||||
#define ENCOUNTER_FLAG_NO_CAR (1)
|
||||
#define ENCOUNTER_FLAG_LOCK (2) // block new forced encounter by the next function call until the current specified encounter occurs
|
||||
#define ENCOUNTER_FLAG_NO_CAR (0x1)
|
||||
#define ENCOUNTER_FLAG_LOCK (0x2) // block new forced encounter by the next function call until the current specified encounter occurs
|
||||
#define ENCOUNTER_FLAG_NO_ICON (0x4) // disable displaying the flashing icon
|
||||
#define ENCOUNTER_FLAG_ICON_SP (0x8) // use special encounter icon
|
||||
#define ENCOUNTER_FLAG_FADEOUT (0x10) // fade out the screen on encounter (Note: you yourself should restore the fade screen when entering the encounter)
|
||||
|
||||
//The attack types returned by get_attack_type
|
||||
#define ATKTYPE_LWEP1 (0)
|
||||
@@ -221,9 +236,18 @@
|
||||
// fake perks/traits add mode flags
|
||||
#define ADD_PERK_MODE_TRAIT (1) // add to the player's traits
|
||||
#define ADD_PERK_MODE_PERK (2) // add to the player's perks
|
||||
#define ADD_PERK_MODE_REMOVE (4) // remove from the list of selectable perks
|
||||
#define ADD_PERK_MODE_REMOVE (4) // remove from the list of selectable perks (after added to the player)
|
||||
|
||||
// instantly apply the item to dude_obj (w/o animation)
|
||||
#define use_item_on_dude(item) set_self(dude_obj); \
|
||||
set_self(dude_obj); \
|
||||
use_obj_on_obj(item, dude_obj); \
|
||||
set_self(0)
|
||||
|
||||
// sfall_funcX macros
|
||||
#define add_global_timer_event(time, fixedParam) sfall_func2("add_g_timer_event", time, fixedParam)
|
||||
#define add_iface_tag sfall_func0("add_iface_tag")
|
||||
#define add_trait(traitID) sfall_func1("add_trait", traitID)
|
||||
#define art_cache_clear sfall_func0("art_cache_clear")
|
||||
#define attack_is_aimed sfall_func0("attack_is_aimed")
|
||||
#define create_win(winName, x, y, w, h) sfall_func5("create_win", winName, x, y, w, h)
|
||||
@@ -231,36 +255,64 @@
|
||||
#define critter_inven_obj2(obj, type) sfall_func2("critter_inven_obj2", obj, type)
|
||||
#define dialog_obj sfall_func0("dialog_obj")
|
||||
#define display_stats sfall_func0("display_stats")
|
||||
#define draw_image(pathFile, frame, x, y, noTrans) sfall_func5("draw_image", pathFile, frame, x, y, noTrans)
|
||||
#define draw_image_scaled(pathFile, frame, x, y, w, h) sfall_func6("draw_image_scaled", pathFile, frame, x, y, w, h)
|
||||
#define exec_map_update_scripts sfall_func0("exec_map_update_scripts")
|
||||
#define floor2(value) sfall_func1("floor2", value)
|
||||
#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_interface_x(winType) sfall_func2("get_window_attribute", winType, 1)
|
||||
#define get_interface_y(winType) sfall_func2("get_window_attribute", winType, 2)
|
||||
#define get_inven_ap_cost sfall_func0("get_inven_ap_cost")
|
||||
#define get_map_enter_position sfall_func0("get_map_enter_position")
|
||||
#define get_metarule_table sfall_func0("get_metarule_table")
|
||||
#define get_object_data(obj, offset) sfall_func2("get_object_data", obj, offset)
|
||||
#define get_outline(obj) sfall_func1("get_outline", obj)
|
||||
#define get_sfall_arg_at(argNum) sfall_func1("get_sfall_arg_at", argNum)
|
||||
#define get_text_width(text) sfall_func1("get_text_width", text)
|
||||
#define hide_window(winName) sfall_func1("hide_window", winName)
|
||||
#define intface_hide sfall_func0("intface_hide")
|
||||
#define intface_is_hidden sfall_func0("intface_is_hidden")
|
||||
#define intface_is_shown(winType) sfall_func1("get_window_attribute", winType)
|
||||
#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 loot_obj sfall_func0("loot_obj")
|
||||
#define metarule_exist(metarule) sfall_func1("metarule_exist", metarule)
|
||||
#define message_box(text) sfall_func1("message_box", text)
|
||||
#define metarule_exist(metaruleName) sfall_func1("metarule_exist", metaruleName)
|
||||
#define npc_engine_level_up(toggle) sfall_func1("npc_engine_level_up", toggle)
|
||||
#define obj_under_cursor(crSwitch, inclDude) sfall_func2("obj_under_cursor", crSwitch, inclDude)
|
||||
#define obj_under_cursor(onlyCritter, includeDude) sfall_func2("obj_under_cursor", onlyCritter, includeDude)
|
||||
#define objects_in_radius(tile, radius, elev, type) sfall_func4("objects_in_radius", tile, radius, elev, type)
|
||||
#define outlined_object sfall_func0("outlined_object")
|
||||
#define real_dude_obj sfall_func0("real_dude_obj")
|
||||
#define remove_all_timer_events sfall_func0("remove_timer_event")
|
||||
#define remove_timer_event(fixedParam) sfall_func1("remove_timer_event", fixedParam)
|
||||
#define set_cursor_mode(mode) sfall_func1("set_cursor_mode", mode)
|
||||
#define set_flags(obj, flags) sfall_func2("set_flags", obj, flags)
|
||||
#define set_iface_tag_text(tag, text, color) sfall_func3("set_iface_tag_text", tag, text, color)
|
||||
#define set_ini_setting(setting, value) sfall_func2("set_ini_setting", setting, value)
|
||||
#define set_map_enter_position(tile, elev, rot) sfall_func3("set_map_enter_position", tile, elev, rot)
|
||||
#define set_object_data(obj, offset, value) sfall_func3("set_object_data", obj, offset, value)
|
||||
#define set_outline(obj, color) sfall_func2("set_outline", obj, color)
|
||||
#define set_terrain_name(x, y, name) sfall_func3("set_terrain_name", x, y, name)
|
||||
#define set_town_title(areaID, title) sfall_func2("set_town_title", areaID, title)
|
||||
#define set_unique_id(obj) sfall_func1("set_unique_id", obj)
|
||||
#define unset_unique_id(obj) sfall_func2("set_unique_id", obj, -1)
|
||||
#define set_unjam_locks_time(time) sfall_func1("set_unjam_locks_time", time)
|
||||
#define set_window_flag(winID, flag, value) sfall_func3("set_window_flag", winID, flag, value)
|
||||
#define show_window(winName) sfall_func1("show_window", winName)
|
||||
#define spatial_radius(obj) sfall_func1("spatial_radius", obj)
|
||||
#define string_compare(str1, str2) sfall_func2("string_compare", str1, str2)
|
||||
#define string_compare_locale(str1, str2, codePage) sfall_func3("string_compare", str1, str2, codePage)
|
||||
#define string_format(format, a1, a2) sfall_func3("string_format", format, a1, a2)
|
||||
#define string_tolower(text) sfall_func2("string_to_case", text, 0)
|
||||
#define string_toupper(text) sfall_func2("string_to_case", text, 1)
|
||||
#define tile_by_position(x, y) sfall_func2("tile_by_position", x, y)
|
||||
#define tile_refresh_display sfall_func0("tile_refresh_display")
|
||||
#define unjam_lock(obj) sfall_func1("unjam_lock", obj)
|
||||
#define unset_unique_id(obj) sfall_func2("set_unique_id", obj, -1)
|
||||
#define unwield_slot(critter, slot) sfall_func2("unwield_slot", critter, slot)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,6 +30,7 @@ The hook script equivalent of game_loaded; it returns 2 when the script is first
|
||||
|
||||
> mixed get_sfall_arg()
|
||||
Gets the next argument from sfall. Each time it's called it returns the next argument, or otherwise it returns 0 if there are no more arguments left.
|
||||
You can arbitrarily get the value of any argument using the sfall_func1("get_sfall_arg_at", argNum) function.
|
||||
|
||||
> array get_sfall_args()
|
||||
Returns all hook arguments as a new temp array.
|
||||
@@ -37,16 +38,16 @@ Returns all hook arguments as a new temp array.
|
||||
> void set_sfall_return(int value)
|
||||
Used to return the new values from the script. Each time it's called it sets the next value, or if you've already set all return values it does nothing.
|
||||
|
||||
> void set_sfall_arg(int argnum, int value)
|
||||
Changes argument value. The argument number (argnum) is 0-indexed. This is useful if you have several hook scripts attached to one hook point (see below).
|
||||
> void set_sfall_arg(int argNum, int value)
|
||||
Changes argument value. The argument number (argNum) is 0-indexed. This is useful if you have several hook scripts attached to one hook point (see below).
|
||||
|
||||
> void register_hook(int hooktype)
|
||||
> void register_hook(int hookID)
|
||||
Used from a normal global script if you want to run it at the same point a full hook script would normally run. In case of this function, "start" proc will be executed in a current global script. You can use all above functions like normal.
|
||||
|
||||
> void register_hook_proc(int hook, procedure proc)
|
||||
> void register_hook_proc(int hookID, procedure proc)
|
||||
The same as register_hook, except that you specifically define which procedure in the current script should be called as a hook (instead of "start" by default). Pass procedure the same as how you use dialog option functions. This IS the recommended way to use hook scripts, as it gives both modularity (each mod logic in a separate global script, no conflicts if you don't use "hs_*.int" scripts) and flexibility (you can place all related hook scripts for specific mod in a single script!).
|
||||
|
||||
> void register_hook_proc_spec(int hook, procedure proc)
|
||||
> void register_hook_proc_spec(int hookID, procedure proc)
|
||||
Works very similar to register_hook_proc, except that it registers the current script at the end of the hook script execution chain (i.e. the script will be executed after all previously registered scripts for the same hook, including the hs_*.int script). All scripts hooked to a single hook point with this function are executed in exact order of how they were registered, as opposed to the description below, which refers to using register_hook/register_hook_proc functions.
|
||||
|
||||
NOTE: you can hook several scripts to a single hook point, for example if it's different mods from different authors or just some different aspects of one larger mod. In this case scripts are executed in reverse order of how they were registered. When one of the scripts in a chain returns value with "set_sfall_return", the next script may override this value if calls "set_sfall_return" again. Sometimes you need to multiply certain value in a chain of hook scripts.
|
||||
@@ -68,7 +69,7 @@ This basically changes hook argument for the next script. Mod B code:
|
||||
So if you combine both mods together, they will run in chain and the end result will be a 75% from original hit chance (hook register order doesn't matter in this case, if you use "set_sfall_arg" in both hooks).
|
||||
|
||||
|
||||
The defines to use for the hooktype are in sfall.h.
|
||||
The defines to use for the hookID are in sfall.h.
|
||||
|
||||
-------------------------------------------
|
||||
----------- HOOK SCRIPT TYPES -------------
|
||||
@@ -125,11 +126,13 @@ int ret1 - The new AP cost
|
||||
HOOK_DEATHANIM1 (hs_deathanim1.int)
|
||||
|
||||
Runs before Fallout tries to calculate the death animation. Lets you switch out which weapon Fallout sees
|
||||
Does not run for critters in the knockdown/out state.
|
||||
|
||||
int arg1 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
|
||||
critter arg2 - The attacker
|
||||
critter arg3 - The target
|
||||
int arg4 - The amount of damage
|
||||
int arg5 - Unused, always -1. Use this if you are using the same procedure for HOOK_DEATHANIM1 and HOOK_DEATHANIM2 (since sfall 4.1/3.8.24)
|
||||
|
||||
int ret1 - The pid of an object to override the attacking weapon with
|
||||
|
||||
@@ -138,7 +141,8 @@ int ret1 - The pid of an object to override the attacking weapon with
|
||||
HOOK_DEATHANIM2 (hs_deathanim2.int)
|
||||
|
||||
Runs after Fallout has calculated the death animation. Lets you set your own custom frame id, so more powerful than hs_deathanim1, but performs no validation.
|
||||
When using critter_dmg function, this script will also run. In that case weapon pid will be -1 and target will point to an object with obj_art_fid == 0x20001F5.
|
||||
When using critter_dmg function, this script will also run. In that case weapon pid will be -1 and attacker will point to an object with obj_art_fid == 0x20001F5.
|
||||
Does not run for critters in the knockdown/out state.
|
||||
|
||||
item arg1 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
|
||||
critter arg2 - The attacker
|
||||
@@ -188,9 +192,17 @@ Critter arg1 - The critter that just died
|
||||
|
||||
HOOK_FINDTARGET (hs_findtarget.int)
|
||||
|
||||
Runs when the ai is trying to pick a target in combat. Fallout first chooses a list of 4 likely suspects, then normally sorts them in order of weakness/distance/etc depending on the ai caps of the attacker. This hook replaces that sorting function, allowing you to sort the targets in some arbitrary way. Use sfall_return to give the 4 targets, in order of preference. If you want to specify less than 4 targets, fill in the extra spaces with 0's. Pass -1 to skip the return value.
|
||||
Runs when the ai is trying to pick a target in combat. Fallout first chooses a list of 4 likely suspects, then normally sorts them in order of weakness/distance/etc depending on the ai caps of the attacker.
|
||||
This hook replaces that sorting function, allowing you to sort the targets in some arbitrary way.
|
||||
|
||||
The return values can include critters that weren't in the list of possible targets, but the additional targets may still be discarded later on in the combat turn if they are out of the attackers perception or the chance of a successful hit is too low. The list of possible targets often includes duplicated entries.
|
||||
The return values can include critters that weren't in the list of possible targets, but the additional targets may still be discarded later on in the combat turn if they are out of the attackers perception or the chance of a successful hit is too low. The list of possible targets often includes duplicated entries, but this is fixed in sfall 4.2.3/3.8.23.
|
||||
Use sfall_return to give the 4 targets, in order of preference. If you want to specify less than 4 targets, fill in the extra spaces with 0's or pass -1 to skip the return value.
|
||||
|
||||
NOTE: The engine can choose targets by the following criteria:
|
||||
1) The nearest enemy to the attacker.
|
||||
2) The enemy that attacked the attacker.
|
||||
3) The enemy that attacked an NPC from the same team as the attacker.
|
||||
4) The enemy that is attacked by an NPC from the same team as the attacker.
|
||||
|
||||
critter arg1 - The attacker
|
||||
critter arg2 - A possible target
|
||||
@@ -285,10 +297,10 @@ int ret1 - the new AP cost
|
||||
-------------------------------------------
|
||||
|
||||
(DEPRECATED)
|
||||
hs_hexmoveblocking.int
|
||||
hs_hexaiblocking.int
|
||||
hs_hexshootblocking.int
|
||||
hs_hexsightblocking.int
|
||||
HOOK_HEXMOVEBLOCKING (hs_hexmoveblocking.int)
|
||||
HOOK_HEXAIBLOCKING (hs_hexaiblocking.int)
|
||||
HOOK_HEXSHOOTBLOCKING (hs_hexshootblocking.int)
|
||||
HOOK_HEXSIGHTBLOCKING (hs_hexsightblocking.int)
|
||||
|
||||
Runs when checking to see if a hex blocks movement or shooting. (or ai-ing, presumably...)
|
||||
|
||||
@@ -431,7 +443,7 @@ int ret1 - Override setting (-1 - use engine handler, any other value - prev
|
||||
|
||||
HOOK_INVENWIELD (hs_invenwield.int)
|
||||
|
||||
Runs before wielding or unwielding an armor or a weapon by a critter (except when using inventory by PC).
|
||||
Runs before causing a critter or the player to wield/unwield an armor or a weapon (except when using the inventory by PC).
|
||||
An example usage would be to change critter art depending on armor being used or to dynamically customize weapon animations.
|
||||
NOTE: when replacing a previously wielded armor or weapon, the unwielding hook will not be executed.
|
||||
If you need to rely on this, try checking if armor/weapon is already equipped when wielding hook is executed.
|
||||
@@ -440,5 +452,6 @@ Critter arg1 - critter
|
||||
Obj arg2 - item being wielded or unwielded (weapon/armor)
|
||||
int arg3 - slot (INVEN_TYPE_*)
|
||||
int arg4 - 1 when wielding, 0 when unwielding
|
||||
int arg5 - 1 when removing an equipped item from inventory, 0 otherwise
|
||||
|
||||
int ret1 - overrides hard-coded handler (-1 - use engine handler, any other value - override) - NOT RECOMMENDED
|
||||
|
||||
@@ -24,7 +24,7 @@ The input functions are only available if the user has the input hook turned on
|
||||
|
||||
The graphics functions are only available if the user is using graphics mode 4 or 5. Use graphics_funcs_available to check; it returns 1 if you can use them or 0 if you can't. Calling graphics functions when graphics_funcs_available returns 0 will do nothing.
|
||||
|
||||
load_shader takes a path relative to the data\shaders\ directory as an argument and returns a shader ID. That ID should be passed as the first argument to all other shader functions, and is valid until free_shader is called on the ID, the player loads a saved game or the player quits to the main menu.
|
||||
load_shader takes a path relative to the <GameRoot>\<master_patches>\shaders\ directory as an argument and returns a shader ID. That ID should be passed as the first argument to all other shader functions, and is valid until free_shader is called on the ID, the player loads a saved game or the player quits to the main menu.
|
||||
|
||||
get_shader_version gives you the highest shader version supported by the player's graphics cards. Possible return values are 11, 12, 13, 14, 20, 21 and 30.
|
||||
|
||||
@@ -36,7 +36,7 @@ The mapper manual lists the functions 'world_map_x_pos' and 'world_map_y_pos', w
|
||||
|
||||
set_pipboy_available will only accept 0 or 1 as an argument. Using any other value will cause the function to have no effect. Use 0 to disable the pipboy, and 1 to enable it.
|
||||
|
||||
get/set_critter_current_ap functions should only be used during the target critters turn while in combat. Calling them outside of combat typically returns the critters max ap, but don't rely on that behaviour. (Specifically, if the critter has never before entered combat, it will probably return the critters base ap ignoring any extra bonuses from perks etc.) Using set_critter_current_ap on the player will not automatically redraw the screen, so the ap bar will be incorrect until the player next clicks.
|
||||
get/set_critter_current_ap functions should only be used during the target critters turn while in combat. Calling them outside of combat typically returns the critters max ap, but don't rely on that behaviour. (Specifically, if the critter has never before entered combat, it will probably return the critters base ap ignoring any extra bonuses from perks etc.)
|
||||
|
||||
The 'type' value in the weapon knockback functions can be 0 or 1. If 0, the value becomes an absolute distance that targets will be knocked back. If 1, the value is multiplied by the distance they would normally have been knocked back. Weapon knockback modifiers are applied in the order weapon -> attacker -> target, so a x2 weapon wielded by an abs 6 attacker hitting a /2 target will knock the target back 3 squares. The knockback functions will not override the stonewall perk or knockdowns resulting from criticals. knockback values set on weapons or critters are not saved, and must be reset each time the player reloads.
|
||||
|
||||
@@ -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 player's traits, if bit 2 is set it is added to the player's 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 its 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. Starting from sfall 3.8.12, is_iface_tag_active can also be used to check 0 for SNEAK, 1 for POISONED, and 2 for RADIATED.
|
||||
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/3.8.12, 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.
|
||||
|
||||
@@ -66,7 +66,7 @@ get/set_proto_data are used to manipulate the in memory copies of the .pro files
|
||||
|
||||
the list_xxx functions can be used to loop over all items on a map. list_begin takes an argument telling sfall what you want to list. (Defined in sfall.h) It returns a list pointer, which you iterate through with list_next. Finally, when you've finished with the list use list_end on it. Not calling list_end will result in a memory leak. Alternatively, use list_as_array to get the whole list at once as a temp array variable, which can be looped over using len_array and which you don't need to remember to free afterwards.
|
||||
|
||||
play_sfall_sound and stop_sfall_sound are used to play mp3/wav/wma files. The path given is relative to the Fallout folder. Specify loop as 1 to loop the file continuously, or 0 otherwise. If you don't wish to loop, play_sfall_sound returns 0. If you do loop, it returns an id which can be passed back to stop_sfall_sound when you want to stop the effect. All sounds effects will be stopped on game reload, looping or not. These functions do not require 'AllowDShowSound' to be set to 1 in ddraw.ini.
|
||||
play_sfall_sound and stop_sfall_sound are used to play mp3/wav/wma files. The path given is relative to the Fallout folder. Specify mode as 1 to loop the file continuously, 2 to replace the current background game music with playing the specified file in loop mode, or 0 to play the file once. If you don't wish to loop, play_sfall_sound returns 0. If you do loop, it returns an id which can be passed back to stop_sfall_sound when you want to stop the effect. All sounds effects will be stopped on game reload, looping or not. These functions do not require 'AllowDShowSound' to be set to 1 in ddraw.ini.
|
||||
|
||||
arrays are created and manipulated with the xxx_array functions. An array must first be created with create_array or temp_array, specifying how many data elements the array can hold. You can store any of ints, floats and strings in an array, and can mix all 3 in a single array. The id returned by create/temp_array can then be used with the other array functions. Arrays are shared between all scripts. (i.e. you can call create_array from one script, and then use the returned id from another script.) They are also saved across savegames. You must remember to free any arrays you create with create_array when you are done with them, or you will leak memory. arrays created with temp_array will be automatically freed at the end of the frame. These functions are safe, in that supplying a bad id or trying to access out of range elements will not crash the script. create_array is the only function that returns a permanent array, all other functions which return arrays (string_split, list_as_array etc,) all return temp arrays. You can use fix_array to make a temp array permanent.
|
||||
|
||||
@@ -137,7 +137,7 @@ array - array ID to be used with array-related functions (actually an integer)
|
||||
- The player will not get an outdoorsman skill check.
|
||||
|
||||
> void force_encounter_with_flags(int map, int flags)
|
||||
- does the same thing as force_encounter, but allows the specification of some extra options.
|
||||
- does the same thing as force_encounter, but allows the specification of some extra options (see sfall.h for available flags).
|
||||
- Forcing a random encounter on a map that is not normally used for random encounters may cause the player to lose the car, if they have it.
|
||||
- In this case use force_encounter_with_flags with the ENCOUNTER_FLAG_NO_CAR flag set.
|
||||
|
||||
@@ -153,12 +153,13 @@ array - array ID to be used with array-related functions (actually an integer)
|
||||
- accepts a pointer to an object and will remove the script from that object.
|
||||
|
||||
> void set_script(object, int scriptid)
|
||||
- accepts a pointer to an object and scriptID, and applies the given script to an object (scriptID accept the same values as create_object_sid from sfall 3.6)
|
||||
- accepts a pointer to an object and scriptID, and applies the given script to an object (scriptID accepts the same values as create_object_sid)
|
||||
- If used on an object that is already scripted, it will remove the existing script first; you cannot have multiple scripts attached to a single object. Calling set_script on self_obj will have all sorts of wacky side effects, and should be avoided.
|
||||
- if you add 0x80000000 to the sid when calling set_script, map_enter_p_proc will be SKIPPED. The start proc will always be run.
|
||||
|
||||
> int get_script(object)
|
||||
- accepts a pointer to an object and returns its scriptID (line number in scripts.lst), or -1 if the object is unscripted.
|
||||
- accepts a pointer to an object and returns its scriptID (line number in scripts.lst), or 0 if the object is unscripted.
|
||||
- returns -1 on argument error.
|
||||
|
||||
> void set_self(int obj)
|
||||
- overrides the scripts self_obj for the next function call.
|
||||
@@ -218,6 +219,9 @@ Some additional reg_anim_* functions were introduced. They all work in the same
|
||||
> void reg_anim_turn_towards(object, tile/target, delay)
|
||||
- makes object change its direction to face given tile num or target object.
|
||||
|
||||
> void reg_anim_callback(procedure proc)
|
||||
- adds the given procedure to an animation sequence-list and executes it in the registered sequence.
|
||||
|
||||
> int metarule2_explosions(int arg1, int arg2, int arg3)
|
||||
was made as a dirty easy hack to allow dynamically change some explosion parameters (ranged attack). All changed parameters are reset to vanilla state automatically after each attack action. Following macros are available in sfall.h:
|
||||
|
||||
@@ -245,7 +249,10 @@ Some utility/math functions are available:
|
||||
- you can use this to search for a substring in a string like this: strlen(get_array(string_split(haystack, needle), 0))
|
||||
|
||||
> string substr(string, start, length)
|
||||
- cuts a substring from a string starting at "start" up to "length" characters. If start is negative - it indicates starting position from the end of the string (for example substr("test", -2, 2) will return last 2 charactes: "st"). If length is negative - it means so many characters will be omitted from the end of string (example: substr("test", 0, -2) will return string without last 2 characters: "te")
|
||||
- cuts a substring from a string starting at "start" up to "length" characters. The first character position is 0 (zero).
|
||||
- If start is negative - it indicates starting position from the end of the string (for example substr("test", -2, 2) will return last 2 charactes: "st").
|
||||
- If length is negative - it means so many characters will be omitted from the end of string (example: substr("test", 0, -2) will return string without last 2 characters: "te").
|
||||
- If length is zero - it will return a string from the starting position to the end of the string **New behavior** for sfall 4.2.2/3.8.22
|
||||
|
||||
> int strlen(string string)
|
||||
- returns string length
|
||||
@@ -260,10 +267,15 @@ Some utility/math functions are available:
|
||||
> int charcode(string string)
|
||||
- returns ASCII code for the first character in given string
|
||||
|
||||
> div operator (unsigned integer division)
|
||||
- use as a division operator, like 3 + (20 div 5)
|
||||
- if both dividend and divisor are integers, they will be treated as unsigned integers
|
||||
- if one of them is a float, div will perform the signed division just like vanilla division operator
|
||||
|
||||
> ^ operator (exponentiation)
|
||||
- use as any other arithmetic operator, like 5^(1/3)
|
||||
- if exponent is integer, you can use negative base, otherwise you will get "nan" with negative base
|
||||
- if both arguments are integers, result will be integer
|
||||
- if exponent is an integer, you can use a negative base, otherwise you will get "NaN" with a negative base
|
||||
- if both arguments are integers, the result will be an integer
|
||||
|
||||
> float log(float x)
|
||||
- natural logarithm of x
|
||||
@@ -443,6 +455,12 @@ Some utility/math functions are available:
|
||||
- unjams a lock immediately without having to wait until the next day, or leave the map and then return after 24 hours
|
||||
- does not work in use_skill_on_p_proc procedure
|
||||
|
||||
> void sfall_func1("set_unjam_locks_time", int time)
|
||||
- sets after how many hours (up to 127 hours) jammed locks will be unjammed if the player leaves the map
|
||||
- also disables the auto unjam that occurs at midnight when the player is on the map
|
||||
- passing 0 will disable the auto unjam mechanism completely
|
||||
- The auto unjam mechanism will be reset each time the player reloads the game
|
||||
|
||||
> array sfall_func0("get_map_enter_position")
|
||||
- returns an array of the player's position data (index 0 - tile, 1 - elevation, 2 - rotation) when entering the map through exit grids
|
||||
- if entering from the world map, the tile value will be -1
|
||||
@@ -456,9 +474,20 @@ Some utility/math functions are available:
|
||||
> int sfall_func0("attack_is_aimed")
|
||||
- returns 1 if the aimed attack mode is selected, 0 otherwise
|
||||
|
||||
> 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 (4 + the value of BoxBarCount in ddraw.ini) or the number of the last custom box added using the add_ifaca_tag function
|
||||
- The text is limited to 19 characters
|
||||
- available colors: 0 - green, 1 - red, 2 - white, 3 - yellow, 4 - dark yellow, 5 - blue, 6 - purple, 7 - dull pink
|
||||
|
||||
> int sfall_func0("add_iface_tag")
|
||||
- adds one custom box to the current boxes, and returns the number of the added tag (-1 if the tags limit is exceeded)
|
||||
- The maximum number of boxes is limited to 126 tags
|
||||
|
||||
> void sfall_func0("inventory_redraw")
|
||||
> 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)
|
||||
- invSide specifies which side needs to be redrawn: 0 - the player, 1 - target (container/NPC in loot/barter screens), -1 - both sides (same as without argument)
|
||||
|
||||
> int sfall_func1("get_current_inven_size", object)
|
||||
- returns the current inventory size of the container or the critter
|
||||
@@ -471,10 +500,11 @@ Some utility/math functions are available:
|
||||
> object sfall_func0("dialog_obj")
|
||||
- returns a pointer to the object (critter) the player is having a conversation or bartering with
|
||||
|
||||
> object sfall_func2("obj_under_cursor", bool crSwitch, bool inclDude)
|
||||
> object sfall_func2("obj_under_cursor", bool onlyCritter, bool includeDude)
|
||||
- returns the object under the cursor on the main game screen
|
||||
- crSwitch: True - only checks critters and ignores their cover (roof tiles, walls, scenery, etc.), False - checks all objects (can't check critters under objects)
|
||||
- passing False to the inclDude argument will ignore dude_obj
|
||||
- onlyCritter: True - only checks critters and ignores their cover (roof tiles, walls, scenery, etc.)
|
||||
False - checks all objects (can't check critters under objects)
|
||||
- passing False to the includeDude argument will ignore dude_obj
|
||||
|
||||
> object sfall_func0("loot_obj")
|
||||
- returns a pointer to the target object (container or critter) of the loot screen
|
||||
@@ -501,6 +531,111 @@ Some utility/math functions are available:
|
||||
- there is also a unique ID number range for the player and party members from 18000 to 83535
|
||||
- to assign a new ID number generated by the engine to the object (i.e. unassign a unique ID), call the function with two arguments and pass -1 for the flag argument
|
||||
|
||||
> void sfall_func5("draw_image", string/int pathFile/artId, int frame, int x, int y, bool noTransparent)
|
||||
> void sfall_func6("draw_image_scaled", string/int pathFile/artId, int frame, int x, int y, int width, int height)
|
||||
- displays the specified PCX or FRM image in the active window created by vanilla CreateWin or sfall's create_win script function
|
||||
- pathFile/artId: path to the PCX/FRM file (e.g. "art\\inven\\5mmap.frm"), or its FRM ID number (e.g. 117440550, see specification of the FID format)
|
||||
optional arguments:
|
||||
- frame: frame number, the first frame starts from zero
|
||||
- x/y: offset relative to the top-left corner of the window
|
||||
- width/height: image size, used to scale the image when displaying it. Pass -1 to either width or height to keep the aspect ratio when scaling
|
||||
- noTransparent: pass true to display an image without transparent background
|
||||
- NOTE: to omit optional arguments starting from the right, call the functions with different sfall_funcX (e.g. sfall_func4("draw_image", pathFile, frame, x, y))
|
||||
- if draw_image_scaled is called without x/y/width/height arguments, the image will be scaled to fit the window without transparent background
|
||||
|
||||
> void sfall_func2("unwield_slot", object critter, int slot)
|
||||
- unequips an item from the specified slot for a critter or the player
|
||||
- can take off player's equipped item when the inventory is opened, or the player is in the barter screen
|
||||
- slot: 0 - armor slot, 1 - right slot, 2 - left slot (see INVEN_TYPE_* in define.h)
|
||||
|
||||
> void sfall_func1("add_trait", int traitID)
|
||||
- adds the specified trait to the player
|
||||
|
||||
> int sfall_func0("get_inven_ap_cost")
|
||||
- returns the current AP cost to access the inventory in combat
|
||||
|
||||
> void sfall_func2("add_g_timer_event", int time, int fixedParam)
|
||||
- adds a timer event that calls the timed_event_p_proc procedure in the current global script
|
||||
- time: the number of ticks after which the event timer is triggered
|
||||
- fixedParam: the value that is passed to the timed_event_p_proc procedure for the fixed_param function
|
||||
|
||||
> void sfall_func0("remove_timer_event")
|
||||
- clears all set timer events for the current global script
|
||||
|
||||
> void sfall_func1("remove_timer_event", int fixedParam)
|
||||
- removes all timer events with the specified 'fixedParam' value for the current global script
|
||||
|
||||
> mixed sfall_func1("get_sfall_arg_at", int argNum)
|
||||
- gets the value of hook argument with the specified argument number (first argument of hook starts from 0)
|
||||
|
||||
> void sfall_func0("hide_window")
|
||||
> void sfall_func1("hide_window", string winName)
|
||||
- hides the specified or currently active (selected) script window
|
||||
- winName: the window name, assigned to the window by the CreateWin/create_win function
|
||||
|
||||
> void sfall_func0("show_window")
|
||||
> void sfall_func1("show_window", string winName)
|
||||
- displays the specified hidden script window or the one previously hidden with the sfall_func0("hide_window") function
|
||||
- winName: the window name, assigned to the window by the CreateWin/create_win function
|
||||
|
||||
> void sfall_func3("set_window_flag", string/int winName/winID, int flag, bool value)
|
||||
- changes the specified flag for the created script or game interface window
|
||||
- winName: the window name, assigned to the window by the CreateWin/create_win function
|
||||
- winID: the ID number of the interface or script window obtained with the get_window_under_mouse function, or 0 for the current game interface
|
||||
- flag: the flag to change (see WIN_FLAG_* constants in define_extra.h)
|
||||
- value: true - set the flag, false - unset the flag
|
||||
|
||||
> int sfall_func1("get_text_width", string text)
|
||||
- returns the text width in pixels for the currently set font
|
||||
|
||||
> bool sfall_func2("string_compare", string str1, string str2)
|
||||
> bool sfall_func3("string_compare", string str1, string str2, int codePage)
|
||||
- compares two strings case-insensitive, and returns True if the two strings are matched
|
||||
- codePage: code page number to properly compare national characters in the range 128-255 of the ASCII code table
|
||||
available encodings: 1250-1252, 866
|
||||
|
||||
> string sfall_func3("string_format", string format, any val1, any val2, ...)
|
||||
- formats given value using standard syntax of C printf function (google "printf" for format details). However it is limited to formatting up to 4 values
|
||||
- formatting is only supported for %s and %d, and the format string is limited to 1024 characters
|
||||
|
||||
> array sfall_func3("objects_in_radius", int tile, int radius, int elevation)
|
||||
> array sfall_func4("objects_in_radius", int tile, int radius, int elevation, int type)
|
||||
- returns an array of objects of a type (see OBJ_TYPE_* constants in define_extra.h) within the specified radius from the given tile
|
||||
- passing -1 to the type argument or not specifying it will return all objects within the radius
|
||||
- the radius is limited to 50 hexes
|
||||
|
||||
> int sfall_func2("tile_by_position", int x, int y)
|
||||
- returns the tile number at the x, y position relative to the top-left corner of the game screen
|
||||
- if the position is outside of the range of tiles, it will return -1
|
||||
|
||||
> string sfall_func2("string_to_case", string text, int toCase)
|
||||
- converts all letters in the given string to the specified case
|
||||
- toCase: 0 - lowercase, 1 - uppercase
|
||||
- NOTE: this function works only for English letters of A-Z/a-z
|
||||
|
||||
> void sfall_func3("set_terrain_name", int x, int y, string name)
|
||||
- overrides the terrain type name for the sub-tile on the world map by the specified coordinates
|
||||
|
||||
> int sfall_func1("get_window_attribute", int winType)
|
||||
> int sfall_func2("get_window_attribute", int winType, int attrType)
|
||||
- returns the attribute of the specified interface window by the attrType argument
|
||||
- winType: the type number of the interface window (see WINTYPE_* constants in sfall.h)
|
||||
- attrType: 0 - checks and returns a value of 1 if the specified interface window is created by the game (same as without the argument)
|
||||
1 - X position, 2 - Y position (relative to the top-left corner of the game screen)
|
||||
- returns -1 if the specified attribute cannot be obtained
|
||||
|
||||
> void sfall_func2("set_town_title", int areaID, string title)
|
||||
- sets a floating text for a town on the world map when hovering the cursor over the player's marker
|
||||
- areaID: the ID number of the town from city.txt
|
||||
|
||||
> int sfall_func4("message_box", string message, int flags, int color1, int color2)
|
||||
- creates a dialog box with text and returns the result of pressing the button: 0 - No (Escape), 1 - Yes/Done (Enter)
|
||||
- returns -1 if for some reason the dialog box cannot be created
|
||||
- message: the text in the dialog box. Use the \n control character to move text to a new line (example: "Hello\nWorld!")
|
||||
optional arguments:
|
||||
- flags: mode flags (see MSGBOX_* constants in define_extra.h). Pass -1 to skip setting the flags (default flags are NORMAL and YESNO)
|
||||
- color1/2: the color index in Fallout palette. color1 sets the text color for the first line, and color2 for all subsequent lines of text (default color is 145)
|
||||
|
||||
------------------------
|
||||
------ MORE INFO -------
|
||||
------------------------
|
||||
|
||||
@@ -296,8 +296,8 @@
|
||||
|
||||
0x8228 - int get_attack_type
|
||||
|
||||
0x822b - int play_sfall_sound(string file, int loop)
|
||||
0x822c - void stop_sfall_sound(int ptr)
|
||||
0x822b - int play_sfall_sound(string file, int mode)
|
||||
0x822c - void stop_sfall_sound(int soundID)
|
||||
|
||||
0x8235 - array string_split(string string, string split)
|
||||
0x8237 - int atoi(string string)
|
||||
@@ -358,6 +358,9 @@
|
||||
0x827c - any sfall_func6(string funcName, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
|
||||
0x827d - void register_hook_proc_spec(int hook, procedure proc)
|
||||
0x827e - void reg_anim_callback(procedure proc)
|
||||
|
||||
0x827f - div operator (unsigned integer division)
|
||||
|
||||
|
||||
* These functions require AllowUnsafeScripting to be enabled in ddraw.ini
|
||||
|
||||
+332
-81
@@ -16,19 +16,36 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <hash_map>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "main.h"
|
||||
#include "FalloutEngine.h"
|
||||
|
||||
#include "HookScripts.h"
|
||||
|
||||
#include "AI.h"
|
||||
#include "Define.h"
|
||||
#include "FalloutEngine.h"
|
||||
#include "SafeWrite.h"
|
||||
|
||||
typedef stdext::hash_map<DWORD, DWORD>::const_iterator iter;
|
||||
typedef std::tr1::unordered_map<TGameObj*, TGameObj*>::const_iterator iter;
|
||||
|
||||
static stdext::hash_map<DWORD, DWORD> targets;
|
||||
static stdext::hash_map<DWORD, DWORD> sources;
|
||||
static std::tr1::unordered_map<TGameObj*, TGameObj*> targets;
|
||||
static std::tr1::unordered_map<TGameObj*, TGameObj*> sources;
|
||||
|
||||
TGameObj* __stdcall sf_check_critters_in_lof(TGameObj* object, DWORD checkTile, DWORD team) {
|
||||
if (object && object->pid >> 24 == OBJ_TYPE_CRITTER && object->teamNum != team) { // not friendly fire
|
||||
if (object->tile == checkTile) return nullptr;
|
||||
TGameObj* obj = nullptr; // continue checking the line of fire from object to checkTile
|
||||
MakeStraightPathFunc(object, object->tile, checkTile, 0, (DWORD*)&obj, 32, (void*)obj_shoot_blocking_at_);
|
||||
if (!sf_check_critters_in_lof(obj, checkTile, team)) return nullptr;
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
// Returns the friendly critter that is in the line of fire
|
||||
TGameObj* __stdcall CheckFriendlyFire(TGameObj* target, TGameObj* attacker) {
|
||||
TGameObj* object = nullptr;
|
||||
MakeStraightPathFunc(attacker, attacker->tile, target->tile, 0, (DWORD*)&object, 32, (void*)obj_shoot_blocking_at_);
|
||||
return sf_check_critters_in_lof(object, target->tile, attacker->teamNum); // 0 if there are no friendly critters
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_try_attack_hook_FleeFix() {
|
||||
__asm {
|
||||
@@ -37,8 +54,8 @@ static void __declspec(naked) ai_try_attack_hook_FleeFix() {
|
||||
}
|
||||
}
|
||||
|
||||
static const DWORD combat_ai_hook_flee_Ret = 0x42B22F;
|
||||
static void __declspec(naked) combat_ai_hook_FleeFix() {
|
||||
static const DWORD combat_ai_hook_flee_Ret = 0x42B22F;
|
||||
__asm {
|
||||
test byte ptr [ebp], 8; // 'ReTarget' flag (critter.combat_state)
|
||||
jnz reTarget;
|
||||
@@ -52,8 +69,8 @@ reTarget:
|
||||
}
|
||||
}
|
||||
|
||||
static const DWORD combat_ai_hack_Ret = 0x42B204;
|
||||
static void __declspec(naked) combat_ai_hack() {
|
||||
static const DWORD combat_ai_hack_Ret = 0x42B204;
|
||||
__asm {
|
||||
mov edx, [ebx + 0x10]; // cap.min_hp
|
||||
cmp eax, edx;
|
||||
@@ -81,11 +98,95 @@ static void __declspec(naked) ai_check_drugs_hook() {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static bool __fastcall TargetExistInList(TGameObj* target, TGameObj** targetList) {
|
||||
char i = 4;
|
||||
do {
|
||||
if (*targetList == target) return true;
|
||||
targetList++;
|
||||
} while (--i);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_find_attackers_hack_target2() {
|
||||
__asm {
|
||||
mov edi, [esp + 0x24 - 0x24 + 4] // critter (target)
|
||||
pushadc;
|
||||
lea edx, [ebp - 4]; // start list of targets
|
||||
mov ecx, edi;
|
||||
call TargetExistInList;
|
||||
test al, al;
|
||||
popadc;
|
||||
jnz skip;
|
||||
inc edx;
|
||||
mov [ebp], edi;
|
||||
skip:
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_find_attackers_hack_target3() {
|
||||
__asm {
|
||||
mov edi, [esp + 0x24 - 0x20 + 4] // critter (target)
|
||||
push eax;
|
||||
push edx;
|
||||
mov eax, 4; // count targets
|
||||
lea edx, [ebp - 4 * 2]; // start list of targets
|
||||
continue:
|
||||
cmp edi, [edx];
|
||||
je break; // target == targetList
|
||||
lea edx, [edx + 4]; // next target in list
|
||||
dec al;
|
||||
jnz continue;
|
||||
break:
|
||||
test al, al;
|
||||
pop edx;
|
||||
pop eax;
|
||||
jz skip;
|
||||
xor edi, edi;
|
||||
retn;
|
||||
skip:
|
||||
inc edx;
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_find_attackers_hack_target4() {
|
||||
__asm {
|
||||
mov eax, [ecx + eax]; // critter (target)
|
||||
pushadc;
|
||||
lea edx, [esi - 4 * 3]; // start list of targets
|
||||
mov ecx, eax;
|
||||
call TargetExistInList;
|
||||
test al, al;
|
||||
popadc;
|
||||
jnz skip;
|
||||
inc edx;
|
||||
mov [esi], eax;
|
||||
skip:
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_danger_source_hack_pm_newfind() {
|
||||
__asm {
|
||||
mov ecx, [ebp + 0x18]; // source combat_data.who_hit_me
|
||||
test ecx, ecx;
|
||||
jnz hasTarget;
|
||||
retn;
|
||||
hasTarget:
|
||||
test [ecx + 0x44], DAM_DEAD;
|
||||
jz isNotDead;
|
||||
xor ecx, ecx;
|
||||
isNotDead:
|
||||
mov dword ptr [ebp + 0x18], 0; // combat_data.who_hit_me (engine code)
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static long RetryCombatMinAP;
|
||||
|
||||
static DWORD RetryCombatLastAP;
|
||||
static DWORD RetryCombatMinAP;
|
||||
static void __declspec(naked) RetryCombatHook() {
|
||||
static DWORD RetryCombatLastAP = 0;
|
||||
__asm {
|
||||
mov RetryCombatLastAP, 0;
|
||||
retry:
|
||||
@@ -110,93 +211,228 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
static long __fastcall sf_ai_weapon_reload(TGameObj* weapon, TGameObj* ammo, TGameObj* critter) {
|
||||
char* proto = nullptr;
|
||||
long result = -1;
|
||||
long maxAmmo;
|
||||
|
||||
TGameObj* _ammo = ammo;
|
||||
|
||||
while (ammo) {
|
||||
result = ItemWReload(weapon, ammo);
|
||||
if (result != 0) return result; // 1 - reload done, -1 - can't reload
|
||||
|
||||
if (!proto) {
|
||||
proto = GetProtoPtr(weapon->pid);
|
||||
maxAmmo = *(long*)(proto + 96); // item.weapon.maxAmmo
|
||||
}
|
||||
if (weapon->itemCharges >= maxAmmo) break; // magazine is full
|
||||
|
||||
long pidAmmo = ammo->pid;
|
||||
ObjDestroy(ammo);
|
||||
ammo = nullptr;
|
||||
|
||||
DWORD currentSlot = -1; // begin find at first slot
|
||||
while (TGameObj* ammoFind = InvenFindType(critter, item_type_ammo, ¤tSlot)) {
|
||||
if (ammoFind->pid == pidAmmo) {
|
||||
ammo = ammoFind;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_ammo != ammo) {
|
||||
ObjDestroy(ammo);
|
||||
return 1; // notifies the engine that the ammo has already been destroyed
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static void __declspec(naked) item_w_reload_hook() {
|
||||
__asm {
|
||||
cmp dword ptr [eax + 0x64], PID_SOLAR_SCORCHER;
|
||||
je skip;
|
||||
push ecx;
|
||||
push esi; // source
|
||||
mov ecx, eax; // weapon
|
||||
call sf_ai_weapon_reload; // edx - ammo
|
||||
pop ecx;
|
||||
retn;
|
||||
skip:
|
||||
jmp item_w_reload_;
|
||||
}
|
||||
}
|
||||
|
||||
static long __fastcall CheckWeaponRangeAndApCost(TGameObj* source, TGameObj* target) {
|
||||
long weaponRange = ItemWRange(source, ATKTYPE_RWEAPON_SECONDARY);
|
||||
long targetDist = ObjDist(source, target);
|
||||
if (targetDist > weaponRange) return 0; // don't use secondary mode
|
||||
|
||||
return (source->critterAP_itemAmmoPid >= sf_item_w_mp_cost(source, ATKTYPE_RWEAPON_SECONDARY, 0)); // 1 - allow secondary mode
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_pick_hit_mode_hook() {
|
||||
__asm {
|
||||
call caiHasWeapPrefType_;
|
||||
test eax, eax;
|
||||
jnz evaluation;
|
||||
retn;
|
||||
evaluation:
|
||||
mov edx, edi;
|
||||
mov ecx, esi;
|
||||
jmp CheckWeaponRangeAndApCost;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_danger_source_hook() {
|
||||
__asm {
|
||||
call combat_check_bad_shot_;
|
||||
cmp dword ptr [esp + 56], 0x42B235 + 5; // called from combat_ai_
|
||||
je fix;
|
||||
retn;
|
||||
fix: // check result
|
||||
cmp eax, 1; // exception: 1 - no ammo
|
||||
setg al; // set 0 for result OK
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) cai_perform_distance_prefs_hack() {
|
||||
__asm {
|
||||
mov ebx, eax; // current distance to target
|
||||
mov ecx, esi;
|
||||
push 0; // no called shot
|
||||
mov edx, ATKTYPE_RWEAPON_PRIMARY;
|
||||
call sf_item_w_mp_cost;
|
||||
mov edx, [esi + 0x40];
|
||||
sub edx, eax; // ap - cost = free AP's
|
||||
jle moveAway; // <= 0
|
||||
lea edx, [edx + ebx - 1];
|
||||
cmp edx, 5; // minimum threshold distance
|
||||
jge skipMove; // distance >= 5?
|
||||
// check combat rating
|
||||
mov eax, esi;
|
||||
call combatai_rating_;
|
||||
mov edx, eax; // source rating
|
||||
mov eax, edi;
|
||||
call combatai_rating_;
|
||||
cmp eax, edx; // target vs source rating
|
||||
jl skipMove; // target rating is low
|
||||
moveAway:
|
||||
mov ebx, 10; // move away max distance
|
||||
retn;
|
||||
skipMove:
|
||||
xor ebx, ebx; // skip moving away at the beginning of the turn
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_move_away_hook() {
|
||||
static const DWORD ai_move_away_hook_Ret = 0x4289DA;
|
||||
__asm {
|
||||
test ebx, ebx;
|
||||
jl fix; // distance arg < 0
|
||||
jmp ai_cap_;
|
||||
fix:
|
||||
neg ebx;
|
||||
mov eax, [esi + 0x40]; // Current Action Points
|
||||
cmp ebx, eax;
|
||||
cmovg ebx, eax; // if (distance > ap) dist = ap
|
||||
add esp, 4;
|
||||
jmp ai_move_away_hook_Ret;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void __fastcall CombatAttackHook(DWORD source, DWORD target) {
|
||||
sources[target] = source;
|
||||
targets[source] = target;
|
||||
static long __fastcall RollFriendlyFire(TGameObj* target, TGameObj* attacker) {
|
||||
if (CheckFriendlyFire(target, attacker)) {
|
||||
long dice = RollRandom(1, 10);
|
||||
return (StatLevel(attacker, STAT_iq) >= dice); // 1 - is friendly
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __declspec(naked) combat_safety_invalidate_weapon_func_hook_check() {
|
||||
static const DWORD safety_invalidate_weapon_burst_friendly = 0x4216C9;
|
||||
__asm {
|
||||
pushadc;
|
||||
mov ecx, esi; // target
|
||||
call RollFriendlyFire;
|
||||
test eax, eax;
|
||||
jnz friendly;
|
||||
popadc;
|
||||
jmp combat_ctd_init_;
|
||||
friendly:
|
||||
lea esp, [esp + 8 + 3 * 4];
|
||||
jmp safety_invalidate_weapon_burst_friendly; // "Friendly was in the way!"
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void __fastcall CombatAttackHook(TGameObj* source, TGameObj* target) {
|
||||
sources[target] = source; // who attacked the 'target' from the last time
|
||||
targets[source] = target; // who was attacked by the 'source' from the last time
|
||||
}
|
||||
|
||||
static void __declspec(naked) combat_attack_hook() {
|
||||
_asm {
|
||||
__asm {
|
||||
push eax;
|
||||
push ecx;
|
||||
push edx;
|
||||
push eax;
|
||||
mov ecx, eax; // source
|
||||
call CombatAttackHook; // edx - target
|
||||
pop eax;
|
||||
pop edx;
|
||||
pop ecx;
|
||||
pop eax;
|
||||
jmp combat_attack_;
|
||||
}
|
||||
}
|
||||
|
||||
static DWORD combatDisabled;
|
||||
void _stdcall AIBlockCombat(DWORD i) {
|
||||
combatDisabled = i ? 1 : 0;
|
||||
}
|
||||
|
||||
static char combatBlockedMessage[128];
|
||||
static void _stdcall CombatBlocked() {
|
||||
DisplayConsoleMessage(combatBlockedMessage);
|
||||
}
|
||||
|
||||
static const DWORD BlockCombatHook1Ret1 = 0x45F6B4;
|
||||
static const DWORD BlockCombatHook1Ret2 = 0x45F6D7;
|
||||
static void __declspec(naked) BlockCombatHook1() {
|
||||
__asm {
|
||||
mov eax, combatDisabled;
|
||||
test eax, eax;
|
||||
jz end;
|
||||
call CombatBlocked;
|
||||
jmp BlockCombatHook1Ret2;
|
||||
end:
|
||||
mov eax, 0x14;
|
||||
jmp BlockCombatHook1Ret1;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) BlockCombatHook2() {
|
||||
__asm {
|
||||
mov eax, dword ptr ds:[_intfaceEnabled];
|
||||
test eax, eax;
|
||||
jz end;
|
||||
mov eax, combatDisabled;
|
||||
test eax, eax;
|
||||
jz succeed;
|
||||
push ecx;
|
||||
push edx;
|
||||
call CombatBlocked;
|
||||
pop edx;
|
||||
pop ecx;
|
||||
xor eax, eax;
|
||||
retn;
|
||||
succeed:
|
||||
inc eax;
|
||||
end:
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
void AIInit() {
|
||||
//HookCall(0x42AE1D, ai_attack_hook);
|
||||
//HookCall(0x42AE5C, ai_attack_hook);
|
||||
HookCall(0x426A95, combat_attack_hook); // combat_attack_this_
|
||||
HookCall(0x42A796, combat_attack_hook); // ai_attack_
|
||||
const DWORD combatAttackAddr[] = {
|
||||
0x426A95, // combat_attack_this_
|
||||
0x42A796 // ai_attack_
|
||||
};
|
||||
HookCalls(combat_attack_hook, combatAttackAddr);
|
||||
|
||||
MakeJump(0x45F6AF, BlockCombatHook1); // intface_use_item_
|
||||
HookCall(0x4432A6, BlockCombatHook2); // game_handle_input_
|
||||
GetPrivateProfileString("sfall", "BlockedCombat", "You cannot enter combat at this time.", combatBlockedMessage, 128, translationIni);
|
||||
|
||||
RetryCombatMinAP = GetPrivateProfileIntA("Misc", "NPCsTryToSpendExtraAP", 0, ini);
|
||||
RetryCombatMinAP = GetConfigInt("Misc", "NPCsTryToSpendExtraAP", 0);
|
||||
if (RetryCombatMinAP > 0) {
|
||||
dlog("Applying retry combat patch.", DL_INIT);
|
||||
HookCall(0x422B94, RetryCombatHook); // combat_turn_
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
// Fix for NPCs not fully reloading a weapon if it has more ammo capacity than a box of ammo
|
||||
const DWORD itemWReloadAddr[] = {
|
||||
0x42AF15, // cai_attempt_w_reload_
|
||||
0x42A970, 0x42AA56, // ai_try_attack_
|
||||
};
|
||||
HookCalls(item_w_reload_hook, itemWReloadAddr);
|
||||
|
||||
// Adds a check for the weapon range and the AP cost when AI is choosing weapon attack modes
|
||||
HookCall(0x429F6D, ai_pick_hit_mode_hook);
|
||||
|
||||
/////////////////////// Combat AI behavior fixes ///////////////////////
|
||||
|
||||
// Fix to reduce friendly fire in burst attacks
|
||||
// Adds a check/roll for friendly critters in the line of fire when AI uses burst attacks
|
||||
HookCall(0x421666, combat_safety_invalidate_weapon_func_hook_check);
|
||||
|
||||
// Fix for duplicate critters being added to the list of potential targets for AI
|
||||
MakeCall(0x428E75, ai_find_attackers_hack_target2, 2);
|
||||
MakeCall(0x428EB5, ai_find_attackers_hack_target3);
|
||||
MakeCall(0x428EE5, ai_find_attackers_hack_target4, 1);
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (iniGetInt("Debugging", "AIBugFixes", 1, ddrawIniDef) == 0) return;
|
||||
#endif
|
||||
|
||||
// Tweak for finding new targets for party members
|
||||
// Save the current target in the "target1" variable and find other potential targets
|
||||
MakeCall(0x429074, ai_danger_source_hack_pm_newfind);
|
||||
SafeWrite16(0x429074 + 5, 0x47EB); // jmp 0x4290C2
|
||||
|
||||
// Fix to allow fleeing NPC to use drugs
|
||||
MakeCall(0x42B1DC, combat_ai_hack);
|
||||
// Fix for AI not checking minimum hp properly for using stimpaks (prevents premature fleeing)
|
||||
@@ -204,28 +440,43 @@ void AIInit() {
|
||||
|
||||
// Fix for NPC stuck in fleeing mode when the hit chance of a target was too low
|
||||
HookCall(0x42B1E3, combat_ai_hook_FleeFix);
|
||||
HookCall(0x42ABA8, ai_try_attack_hook_FleeFix);
|
||||
HookCall(0x42ACE5, ai_try_attack_hook_FleeFix);
|
||||
const DWORD aiTryAttackFleeAddr[] = {0x42ABA8, 0x42ACE5};
|
||||
HookCalls(ai_try_attack_hook_FleeFix, aiTryAttackFleeAddr);
|
||||
// Disable fleeing when NPC cannot move closer to target
|
||||
BlockCall(0x42ADF6); // ai_try_attack_
|
||||
|
||||
// Fix AI target selection for combat_check_bad_shot_ function returning a no_ammo result
|
||||
const DWORD aiDangerSrcBadShotAddr[] = {0x42903A, 0x42918A};
|
||||
HookCalls(ai_danger_source_hook, aiDangerSrcBadShotAddr);
|
||||
|
||||
// Fix AI behavior for "Snipe" distance preference
|
||||
// The attacker will try to shoot the target instead of always running away from it at the beginning of the turn
|
||||
MakeCall(0x42B086, cai_perform_distance_prefs_hack);
|
||||
|
||||
// Fix for ai_move_away_ engine function not working correctly in cases when needing to move a distance away from the target
|
||||
// now the function also takes the distance argument in a negative value for moving away at a distance
|
||||
HookCall(0x4289A7, ai_move_away_hook);
|
||||
// also patch combat_safety_invalidate_weapon_func_ for returning out_range argument in a negative value
|
||||
SafeWrite8(0x421628, 0xD0); // sub edx, eax > sub eax, edx
|
||||
SafeWrite16(0x42162A, 0xFF40); // lea eax, [edx+1] > lea eax, [eax-1]
|
||||
}
|
||||
|
||||
DWORD _stdcall AIGetLastAttacker(DWORD target) {
|
||||
TGameObj* __stdcall AIGetLastAttacker(TGameObj* target) {
|
||||
iter itr = sources.find(target);
|
||||
return (itr != sources.end()) ? itr->second: 0;
|
||||
return (itr != sources.end()) ? itr->second : 0;
|
||||
}
|
||||
|
||||
DWORD _stdcall AIGetLastTarget(DWORD source) {
|
||||
TGameObj* __stdcall AIGetLastTarget(TGameObj* source) {
|
||||
iter itr = targets.find(source);
|
||||
return (itr != targets.end()) ? itr->second : 0;
|
||||
}
|
||||
|
||||
void _stdcall AICombatStart() {
|
||||
void __stdcall AICombatStart() {
|
||||
targets.clear();
|
||||
sources.clear();
|
||||
}
|
||||
|
||||
void _stdcall AICombatEnd() {
|
||||
void __stdcall AICombatEnd() {
|
||||
targets.clear();
|
||||
sources.clear();
|
||||
}
|
||||
|
||||
+11
-5
@@ -16,11 +16,17 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "FalloutEngine.h"
|
||||
|
||||
void AIInit();
|
||||
void _stdcall AICombatStart();
|
||||
void _stdcall AICombatEnd();
|
||||
|
||||
DWORD _stdcall AIGetLastAttacker(DWORD target);
|
||||
DWORD _stdcall AIGetLastTarget(DWORD source);
|
||||
TGameObj* __stdcall sf_check_critters_in_lof(TGameObj* object, DWORD checkTile, DWORD team);
|
||||
TGameObj* __stdcall CheckFriendlyFire(TGameObj* target, TGameObj* attacker);
|
||||
|
||||
void _stdcall AIBlockCombat(DWORD i);
|
||||
void __stdcall AICombatStart();
|
||||
void __stdcall AICombatEnd();
|
||||
|
||||
TGameObj* __stdcall AIGetLastAttacker(TGameObj* target);
|
||||
TGameObj* __stdcall AIGetLastTarget(TGameObj* source);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user