Compare commits

..
60 Commits
Author SHA1 Message Date
NovaRain d7d8de5e1a Added "get/set_object_data" script functions (from Mr.Stalin)
Changed read_byte, read_short, read_int, and read_string functions to not require AllowUnsafeScripting.
2018-12-05 10:17:26 +08:00
NovaRain 0a21e4abfa Fixed a bug in the hero appearance mod that caused the player to disappear after saving the game when player's base FID is greater than 255.
Replaced old SafeWrite usages with corresponding Hook/MakeCall functions in HeroAppearance.cpp.
2018-12-04 09:45:55 +08:00
NovaRain 1340eeb0d3 Fixed the return values of a hook getting corrupted if another hook was called during the execution of the current hook (from Mr.Stalin)
Added a fix to prevent hook scripts from being executed when the depth limit is exceeded.
2018-12-03 20:43:03 +08:00
NovaRain a350fed4d1 Added a fix for unable to sell/give items in barter screen when the player/party member is overloaded (from Mr.Stalin)
Added a variant of MakeCall/Jump with 3 arguments to replace some SafeWrite 0x90 code for trailing NOPs.
2018-11-30 11:35:14 +08:00
NovaRain 402d4f40f2 Changed some MakeJump usages to MakeCall in Stats.cpp, Knockback.cpp, and main.cpp.
(see Mr.Stalin's comments in commit c990b6701d)
2018-11-29 09:56:41 +08:00
NovaRain 0f49c7f68d Refactored the code in Knockback.cpp.
Edited part of HookScripts.cpp (ref. commit 0a3745f8f5)
Minor edits to some code files.
2018-11-28 21:35:47 +08:00
NovaRain deb0299776 Added an option to fix AI not taking chem_primary_desire in AI.txt as drug use preference when using drugs in their inventory (from Mr.Stalin)
Minor edits to some code files.
2018-11-26 09:59:14 +08:00
NovaRain 4bb3fa0275 Merged two Glovz's fix functions and reorganized Glovz's/YAAM code layout a bit.
Fixed a bug in Stats.cpp that caused critical hits to ignore critical table roll value and only have the lowest level effect.
Minor edits to MainMenu.cpp.
2018-11-20 23:44:27 +08:00
NovaRain da31455cef Fixed missing AC/DR mod stats when examining ammo in barter screen.
Added an option to display full item description for weapon/ammo in barter screen.
Minor code correction in ScriptExtender.cpp.
Minor edits to document.
Updated version number.
2018-11-20 07:23:25 +08:00
NovaRain 4da10e2fdb Fixed the missing return value of -1 for HOOK_USEOBJON. 2018-11-16 06:34:47 +08:00
NovaRain 5426d043c1 Fixed unable to click the pop-up message box when death from radiation was triggered during resting. 2018-11-14 07:14:39 +08:00
NovaRain 719cec74d1 Added a fix to display a pop-up message box about death from radiation. 2018-11-13 21:37:48 +08:00
NovaRain 627fe11c29 Fixed determine_to_hit_func_ engine function taking distance into account when called from determine_to_hit_no_range_ (from Mr.Stalin) 2018-11-12 13:14:07 +08:00
NovaRain dcca405b89 Added an additional mode to SpeedInterfaceCounterAnims (from Mr.Stalin)
Refactored the code of Stats.cpp.
Unified stat_level_ usages in Inventory.cpp, LoadGameHook.cpp and skills.cpp.
2018-11-10 10:08:08 +08:00
NovaRain cce9437d19 Removed the pop-up message box about not finding the original ddraw.dll, now the error is reported in the log file.
Added a note about setting a custom background for the character screen to the hero appearance mod.
2018-11-09 10:01:10 +08:00
NovaRain 09b3bf3aed Added DisplaySwiftLearnerExp option (from Crafty)
Minor edits to some documents/code.
2018-11-07 09:39:11 +08:00
NovaRain 08a891a0fc Added "obj_under_cursor" script function.
Backported some script functions from 4.0: lock_is_jammed, unjam_lock.
2018-11-04 09:14:02 +08:00
NovaRain e9df81ac78 Changed PartyMemberExtraInfo to not show "Addict" text (in dark green) on the combat control panel if the party member is not addicted to drugs. 2018-11-02 22:49:14 +08:00
NovaRain 3e982be4b6 Removed RemoveWindowRounding option because it doesn't affect anything. 2018-11-01 09:54:37 +08:00
NovaRain 8a888f387d Adjusted the position of ExtraSaveSlots page buttons a bit. 2018-10-31 07:16:17 +08:00
NovaRain 712b4de5f7 Changed the debug editor to require sfall debugging mode.
Some minor code edits.
2018-10-29 11:14:30 +08:00
NovaRain a3b456cf0a Added a new return value to HOOK_KEYPRESS to override the pressed key (from Crafty)
Added check for map being loaded to KeyPress/MouseClick hooks.
2018-10-28 08:51:01 +08:00
NovaRain 9f689863d7 Added a new setting to DebugMode to send debug output to both the screen and the debug log (from Crafty)
Simplified the code for ObjCanSeeObj_ShootThru_Fix a bit (from Mr.Stalin)
Changed sfall to not to create sfallfs.sav when UseFileSystemOverride is disabled.
2018-10-27 09:46:35 +08:00
NovaRain b5306406b3 Replaced some __cdecl calling conventions with __fastcall.
(from Mr.Stalin - Reason: The compiler can use the arguments for its own purposes, which can spoil the stored value on the stack.)
Added extra notes for some options to ddraw.ini.
2018-10-26 06:51:52 +08:00
NovaRain ce3b9c172c Minor edit to the fade patch. 2018-10-24 12:00:52 +08:00
NovaRain b8a77d77fb Added missing functions from the source library ddraw.dll to export from sfall (from Mr.Stalin)
Simplified the code in SuperSave.cpp.
Minor edits to ddraw.ini.
2018-10-23 11:50:55 +08:00
NovaRain a01da656c7 Fixed showing game movies and subtitles for DX9 mode when not using the hi-res patch, and added logging messages for DX9 mode (from Mr.Stalin)
Changed DisplayNPCExtraInfo to PartyMemberExtraInfo.
2018-10-19 11:07:30 +08:00
NovaRain 5eda8dd7a0 Backported a new mode of metarule2_explosions from 4.0. 2018-10-17 22:30:07 +08:00
NovaRain c05babeda7 Added DisplayNPCExtraInfo option to ddraw.ini for previous commit. 2018-10-17 09:34:14 +08:00
NovaRain cc2b95d64e Added displaying party member's current level & AC & addict flag info to the combat control panel (from Mr.Stalin)
Added additional notes to HOOK_COMBATDAMAGE in hookscripts.txt (#204)
2018-10-16 10:14:32 +08:00
NovaRain fb62bd51b5 Simplified some byte writing in a few options. 2018-10-15 09:57:55 +08:00
NovaRain f4d7ccef40 Fixed typo in the previous commit. 2018-10-14 10:15:02 +08:00
NovaRain 85bb34377c Added missing argument validation to refactored fs_* opcodes.
Minor edits to Criticals.cpp.
2018-10-14 10:06:06 +08:00
NovaRain af24c6eae4 Fixed the exploit that allows you to gain excessive skill points from Tag! perk before leaving the character screen (from Mr.Stalin) 2018-10-12 19:27:04 +08:00
NovaRain 930f463000 Backported expanded is_iface_tag_active function from 4.0, and refactored show/hide_iface_tag functions as well.
Minor edits to a couple of documents.
2018-10-11 23:56:11 +08:00
NovaRain e1aefcc1ed Refactored BonusHtHDamageFix/DisplayBonusDamage code in AmmoMod.cpp (from Mr.Stalin)
Fixed DisplayBonusDamage not being applied on Melee Damage stat in the character screen when BonusHtHDamageFix is enabled.
Reimplemented INTFACEUSE/INTFACELOOT/BARTER game mode flags, and backported inventory_redraw script function from 4.0.
2018-10-11 11:19:22 +08:00
NovaRain 25554ff0b2 Added FastMoveFromContainer as the auxiliary option for ItemFastMoveKey (from Mr.Stalin)
Refactored the code of StackEmptyWeapons.
Added missing argument validation for backported script functions.
2018-10-10 18:27:54 +08:00
NovaRain dad0860d6e Changed implementation of StartGDialogFix, additionally fixed the game crash if calling start_gdialog function outside of talk_p_proc procedure for talking heads.
Fixed "Heave Ho!" perk increasing strength stat above 10 when determining the max range of thrown weapons.
Moved SpecialUnarmedAttacksFix to BugFixes.cpp and simplified the code.
Added comments to old ApplyHeaveHoFix in Perks.cpp.
Backported some non-hook related script functions from 4.0: item_weight, get/set_outline, get/set_flags, tile_refresh_display, outlined_object, get/set_cursor_mode, display_stats, get/set_map_enter_position, attack_is_aimed.
2018-10-10 17:24:05 +08:00
NovaRain a7e492a80f Backported get/set_proto_data changes and LoadProtoMaxLimit option from the develop branch.
Added more definitions to define_extra.h.
2018-10-08 21:45:16 +08:00
NovaRain d9b748c261 Backported UseScrollingQuestsList imporvements from 4.1.
Added sound effect to ExtraSaveSlots page buttons (from Mr.Stalin)
2018-10-06 23:18:07 +08:00
NovaRain 0aad511e3e Refactored ASM code in ScriptExtender.cpp according to the develop branch, and edited the code style.
Moved NegateFix to Bugs.cpp and simplified its code.
2018-10-05 10:13:01 +08:00
NovaRain d117296990 Backported "create_win" script function and InterfaceDontMoveOnTop option from the developt branch.
Updated version number.
2018-10-02 12:15:48 +08:00
NovaRain e672db53c7 Backported AllowDShowSound improvements from the develop branch:
* Added volume control support for alternative sound files.
* Added mode 2 to play alternative music files even if original acm files are not present in the music folder.
* Added AllowDShowMovies option to separate avi files playback from enabling DX9 mode.
* Fixed initialization bug when DX9 mode is disabled.
* Small refactoring on ASM code.

Added missing FadeMultiplier option to ddraw.ini.
2018-10-01 12:16:42 +08:00
NovaRain 25bbd91fc5 Fixed the mood argument of start_gdialog function being ignored for talking heads (from Crafty)
Fixed the broken obj_can_hear_obj script function (from Mr.Stalin)
Simplified the code of disabling losing unused perks.
2018-09-30 16:31:29 +08:00
NovaRain 8db528330b Fixed the max text width of player name in inventory.
Added an 8 lines limit to the underline position fix.
Some minor ASM code edits.
Minor edit to document.
2018-09-25 14:17:45 +08:00
NovaRain f761f7834e Refactored fs_* opcodes with ASM macros and opcode handlers. 2018-09-25 12:29:33 +08:00
NovaRain f6c4e5133c Fixed ai_retrieve_object_ engine function not returning the requested object when there are different objects with the same ID (from Mr.Stalin)
Added info about map_*_p_proc procedures to the global script section in notes.txt.
2018-09-23 08:15:52 +08:00
NovaRain 2e30c86467 Added "get_current_inven_size" script function. 2018-09-21 19:27:57 +08:00
NovaRain 1679f7c59d Backported CritterInvSizeLimitMode related fixes/improvements from the develop branch:
* Changed item_total_weight/item_c_curr_size engine functions to return the weight and size of equipped(hidden) items on NPCs when exchanging/bartering items.
* Fixed CritterInvSizeLimitMode not properly checking the weight of equipped items when mode is set to 4+.
* Added inventory size check to "Take All" button.
* Added additional note to CritterInvSizeLimitMode in ddraw.ini, and changed CritterInvSizeLimit to its default value.
2018-09-20 09:48:27 +08:00
NovaRain 9a4cbd4fa9 Excluded inventory size features for NPCs when CritterInvSizeLimitMode is set to PC only. 2018-09-16 10:25:45 +08:00
NovaRain 0c561ba677 Backported refactored CritterInvSizeLimitMode option from the develop branch (from Mr.Stalin)
Added party member's current/max inventory size info to the combat control panel.
Removed redundant functions from FalloutEngine.cpp.
2018-09-15 11:41:46 +08:00
NovaRain 20ccdacee8 Fixed the underline position in the inventory display window when the item name is longer than one line (from Mr.Stalin)
Simplified the code of SuperStimExploitFix and corrected the return value for the change.
2018-09-12 22:45:58 +08:00
NovaRain d44663ce76 Backported two bug fixes from the develop branch:
* Fixed broken get/reset_critical_table functions (from Mr.Stalin)
* Fixed the encounter description being displayed in two lines instead of one (from Crafty)
2018-09-11 16:15:25 +08:00
NovaRain a196160258 Changed the fix for multihex critter moving in combat to a more proper one (from Mr.Stalin)
Added AIBestWeaponFix option to ddraw.ini.
2018-09-02 18:07:05 +08:00
NovaRain 55a97a5793 Fixed multihex critters moving too close and overlapping their targets in combat (from Crafty)
Fixed critters not checking weapon perks properly when searching for the best weapon (from Mr.Stalin)
2018-08-21 07:18:35 +08:00
NovaRain 3eaa64ee16 Added extra comment for CarChargingFix to ddraw.ini. 2018-08-14 23:57:29 +08:00
NovaRain aa9257ab1c Fixed obj_can_see_obj not checking if source and target objects are on the same elevation before calling is_within_perception_ (from Mr.Stalin) 2018-08-10 22:37:55 +08:00
NovaRain 81a8fd4863 Added a fix for the display issue in the pipboy when a quest list is too long with UseScrollingQuestsList diabled (from Mr.Stalin)
Added a fix for the clickability issue of holodisk list in the pipboy (from Mr.Stalin)
2018-08-06 21:10:09 +08:00
NovaRain ed260ad7e5 Minor edit to the description of CityRepsList in ddraw.ini, to avoid misunderstanding.
Updated version number.
2018-07-28 22:33:28 +08:00
NovaRain 9dce3c8d62 Fixed an issue with file IDs of additional game msg files being shifted when a file in ExtraGameMsgFileList is missing. 2018-07-24 09:39:26 +08:00
67 changed files with 6550 additions and 4868 deletions
+3
View File
@@ -7,6 +7,9 @@ HighlightFail2=Your motion sensor is out of charge.
SuperStimExploitMsg=You cannot use a super stim on someone who is not injured!
BlockedCombat=You cannot enter combat at this time.
SaveSfallDataFail=ERROR saving extended savegame information! Check if other programs interfere with savegame files/folders and try again.
PartyLvlMsg=Lvl:
PartyACMsg=AC:
PartyAddictMsg=Addict
[AppearanceMod]
RaceText=Race
+71 -19
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v3.8.10
;v3.8.13
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -17,7 +17,8 @@ NumSoundBuffers=0
;Set to 1 to allow attaching sound files to combat float messages
AllowSoundForFloats=1
;Set to 1 to automatically search for alternative formats when Fallout tries to play an acm
;Set to 1 to automatically search for alternative formats (mp3/wma/wav) when Fallout tries to play an acm
;Set to 2 to play alternative music files even if original acm files are not present in the music folder
;This does not effect the play_sfall_sound and stop_sfall_sound script functions
AllowDShowSound=0
@@ -70,6 +71,14 @@ GPUBlt=0
;Requires graphics mode 4 or 5, and GPUBlt set to 1
Use32BitHeadGraphics=0
;Set to 1 to automatically search for alternative avi video files when Fallout tries to play the game movies
;Requires graphics mode 4 or 5
AllowDShowMovies=0
;Fade effect time percentage modifier
;Default is 100. Decrease/increase this value to speed up/slow down fade effects
FadeMultiplier=100
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Input]
;Set to 1 to enable the mouse scroll wheel to scroll through inventory, barter, and loot screens
@@ -132,7 +141,7 @@ WindowScrollKey=0
ToggleItemHighlightsKey=42
;Set to 1 to also highlight containers
HighlightContainers=0
HighlightContainers=1
;Set the color of outlines, available colors:
;0x01 - glowing red
@@ -150,10 +159,15 @@ ReloadWeaponKey=0
;A key to hold down to let you move/drop a whole stack of items at once without the 'Move Items' window
;Set to 0 if you don't want to use a modifier key, or a DX scancode otherwise
ItemFastMoveKey=0x1d
ItemFastMoveKey=29
;A key to press to open a debug game editor (requires FalloutClient.exe from the modders pack)
;Set to 1 to skip the 'Move Items' window when taking items from containers or corpses and not holding down ItemFastMoveKey
;Requires ItemFastMoveKey to be enabled
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 and FalloutClient.exe from the modders pack
DebugEditorKey=0
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@@ -351,17 +365,29 @@ CorpseLineOfFireFix=0
;Set to 1 (or some higher number if needed, the maximum is 127) to prevent 100% CPU use
ProcessorIdle=-1
;Set a number of how many protos per type can be loaded into memory at once (valid range: 512..4096)
;Set to -1 to let set_proto_data script function automatically increase the limit when needed
LoadProtoMaxLimit=-1
;Set to 1 if using the hero appearance mod
;You can add AppChCrt.frm and AppChEdt.frm files to art/intrface/ to set a custom background for the character screen
EnableHeroAppearanceMod=0
;Set to 1 to skip the 3 opening movies
SkipOpeningMovies=0
;Causes NPCs who complete their combat turn with ap left over will try and find other ways to spend it.
;Only NPCs with ap left equal to or greater than the value given here will be considered.
;Causes NPCs who complete their combat turn with AP left over will try and find other ways to spend it.
;Only NPCs with AP left equal to or greater than the value given here will be considered.
;Set to 0 to disable
NPCsTryToSpendExtraAP=0
;Set to 1 to fix NPCs not checking weapon perks properly when searching for the best weapon
;Note that enabling this option can significantly affect the weapon choice of some NPCs in combat
AIBestWeaponFix=0
;Set to 1 to fix NPCs not taking chem_primary_desire in AI.txt as drug use preference when using drugs in their inventory
AIDrugUsePerfFix=0
;Allows the use of tiles over 80*36 in size. sfall will just split and resave them at startup
;Set to 1 to check all tiles on started (slow)
;Set to 2 if you provide a XLtiles.lst file in art/tiles/ containing a list of the tile ids that need checking
@@ -380,19 +406,22 @@ Doctor=293
Science=293
Repair=293
;Remove window position rounding
RemoveWindowRounding=0
;Set to 1 to add scroll buttons to the pip boy quest list, and remove the quests per area limit
;Set to 1 to add scroll buttons to the pipboy quest list, and remove the quests per area limit
;Set to 2 to use a different set of scroll buttons
UseScrollingQuestsList=1
;To change the location of quest list scroll buttons, uncomment the next two lines
;Defaults are 140 for the X-axis and 334 for the Y-axis
;QuestsScrollButtonsX=140
;QuestsScrollButtonsY=334
;Uncomment these lines to control the premade characters offered when starting a new game
;Multiple options should be separated by commas, and there must be the same number of entries in both lines
;PremadePaths=combat,diplomat,stealth
;PremadeFIDs=201,203,202
;Use this line to modify the list of cities and their associated global variables used for city reputations
;Syntax is 'city id : global id', with each city/global pair separated by a comma.
;Syntax is 'city id:global id', with each city/global pair separated by a comma.
;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
@@ -404,6 +433,7 @@ ExtraSaveSlots=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
SpeedInterfaceCounterAnims=0
;These lines allow you to control the karma FRMs displayed on the character screen
@@ -464,10 +494,11 @@ BoostScriptDialogLimit=0
;These options modify the checks to see if a critter can carry an additional item, changing which items are counted towards the weight limit and adding an additional size check
;Set the mode to 0 to disable the size check, 1 to apply to the PC only, 2 to apply to the PC and party members, or 3 to apply to all critters
;Only the PC uses CritterInvSizeLimit. Other critters will use the extra unused stat (STAT_unused = 10)
;Only the PC uses CritterInvSizeLimit. Other critters will use the unused stat (STAT_unused = 10) or have the size limit of 100 if the stat is not set
;Add 4 to the mode to limit the weight check to used items only
;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
CritterInvSizeLimitMode=0
CritterInvSizeLimit=200
CritterInvSizeLimit=100
;Some bit flags to alter behaviour of the motion sensor
;1 - Allow sensor use on automap when motion sensor is in pack rather than hands
@@ -495,9 +526,17 @@ SuperStimExploitFix=0
InventoryApCost=4
QuickPocketsApCostReduction=2
;Set to 1 to allow objects seeing through other objects with their ShootThru flag set
;Set to 1 to allow objects seeing through other objects that have their ShootThru flag set
;Note that enabling this option can cause unexpected NPC behavior in some situations
ObjCanSeeObj_ShootThru_Fix=0
;Set to 1 to fix the broken obj_can_hear_obj script function
ObjCanHearObjFix=0
;Set to 1 to enable the mood argument of start_gdialog script function to be available for talking heads
;If the argument value is -1, the mood will be determined by the local variable 0 of the script (vanilla behavior)
StartGDialogFix=0
;Set to 1 to enable the balanced bullet distribution formula for burst attacks
ComputeSprayMod=0
@@ -579,6 +618,7 @@ DontTurnOffSneakIfYouRun=0
CanSellUsedGeiger=1
;Set to 1 to fix the issue with being able to charge the car by using cells on other scenary/critters
;Set to 0 if another mod you're using has custom vehicles
CarChargingFix=1
;Set to 1 to skip weapon equip/unequip animations when performing various actions
@@ -594,6 +634,18 @@ NumbersInDialogue=0
;Set to 1 to use Fallout's normal text font instead of DOS-like font on the world map
WorldMapFontPatch=0
;Set to 1 to display full item description for weapon/ammo in barter screen
FullItemDescInBarter=0
;Set to 1 to display experience points with the bonus from Swift Learner perk when gained from non-scripted situations
DisplaySwiftLearnerExp=1
;Set to 1 to display party member's current level/AC/addict flag on the combat control panel
PartyMemberExtraInfo=0
;Set to 1 to prevent the inventory/loot/automap interfaces from being placed on top of other script-created windows
InterfaceDontMoveOnTop=0
;Set to 1 to display sfall built-in credits at the bottom of credits.txt contents instead of at the top
CreditsAtBottom=0
@@ -606,8 +658,8 @@ CreditsAtBottom=0
Enable=0
;Fallout 2 Debug Patch
;Set to 1 to enable debugging output to screen or 2 to create a debug.log file
;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 a debug.log file
;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
@@ -625,12 +677,12 @@ DebugMode=0
SkipCompatModeCheck=0
;Set to 1 to skip the executable file size check
;Does not require enabling sfall debugging mode
;Does not require 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
;Does not require sfall debugging mode
;ExtraCRC=0x00000000,0x00000000
;Set to 1 to stop Fallout from deleting non readonly protos at startup
+88 -29
View File
@@ -10,6 +10,12 @@
#define OBJ_TYPE_MISC (5)
#define OBJ_TYPE_SPATIAL (6)
#define WEAPON_TYPE_NONE (0)
#define WEAPON_TYPE_UNARMED (1)
#define WEAPON_TYPE_MELEE (2)
#define WEAPON_TYPE_THROWN (3)
#define WEAPON_TYPE_GUNS (4)
/* Item Common Flags */
#define HIDDEN_ITEM 134217728 // 0x08000000 - Hidden Item
@@ -21,14 +27,14 @@
#define WEAPON_2HAND 512 // 0x00000200 - 2Hnd (weapon is two-handed)
#define ATKMODE_PRI_NONE 0
#define ATKMODE_PRI_PUNCH 1
#define ATKMODE_PRI_KICK 2
#define ATKMODE_PRI_SWING 3
#define ATKMODE_PRI_THRUST 4
#define ATKMODE_PRI_THROW 5
#define ATKMODE_PRI_SINGLE 6
#define ATKMODE_PRI_BURST 7
#define ATKMODE_PRI_FLAME 8
#define ATKMODE_PRI_PUNCH 1 // 0001
#define ATKMODE_PRI_KICK 2 // 0010
#define ATKMODE_PRI_SWING 3 // 0011
#define ATKMODE_PRI_THRUST 4 // 0100
#define ATKMODE_PRI_THROW 5 // 0101
#define ATKMODE_PRI_SINGLE 6 // 0110
#define ATKMODE_PRI_BURST 7 // 0111
#define ATKMODE_PRI_FLAME 8 // 1000
#define ATKMODE_SEC_NONE 0
#define ATKMODE_SEC_PUNCH 16 // 0x00000010
#define ATKMODE_SEC_KICK 32 // 0x00000020
@@ -39,6 +45,32 @@
#define ATKMODE_SEC_BURST 112 // 0x00000070
#define ATKMODE_SEC_FLAME 128 // 0x00000080
/* Object flags for get/set_flags */
#define FLAG_MOUSE_3D (0x1)
#define FLAG_WALKTHRU (0x4)
#define FLAG_FLAT (0x8)
#define FLAG_NOBLOCK (0x10)
#define FLAG_LIGHTING (0x20)
#define FLAG_TEMP (0x400)
#define FLAG_MULTIHEX (0x800)
#define FLAG_NOHIGHLIGHT (0x1000)
#define FLAG_USED (0x2000)
#define FLAG_TRANSRED (0x4000)
#define FLAG_TRANSNONE (0x8000)
#define FLAG_TRANSWALL (0x10000)
#define FLAG_TRANSGLASS (0x20000)
#define FLAG_TRANSSTEAM (0x40000)
#define FLAG_TRANSENERGY (0x80000)
#define FLAG_LEFT_HAND (0x1000000)
#define FLAG_RIGHT_HAND (0x2000000)
#define FLAG_WORN (0x4000000)
#define FLAG_HIDDENITEM (0x8000000)
#define FLAG_WALLTRANSEND (0x10000000)
#define FLAG_LIGHTTHRU (0x20000000)
#define FLAG_SEEN (0x40000000)
#define FLAG_SHOOTTHRU (0x80000000)
/* Critter Flags */
#define CFLG_BARTER 2 // 0x00000002 - Barter (can trade with)
#define CFLG_NOSTEAL 32 // 0x00000020 - Steal (cannot steal from)
@@ -75,15 +107,21 @@
// offsets for get_proto_data
#define PROTO_PID (1)
#define PROTO_TEXTID (4)
#define PROTO_FID (8)
// items
#define PROTO_IT_LDIST (12)
#define PROTO_IT_LINT (16)
#define PROTO_IT_FLAG (20)
#define PROTO_IT_FLAGS (24)
#define PROTO_IT_SCRIPTID (28)
#define PROTO_IT_TYPE (32)
#define PROTO_IT_MATERIAL (108)
#define PROTO_IT_SIZE (112)
#define PROTO_IT_WEIGHT (116)
#define PROTO_IT_COST (120)
#define PROTO_IT_INV_FID (124)
#define PROTO_IT_SOUND (128) // byte
// weapons
#define PROTO_WP_ANIM (36)
@@ -161,7 +199,11 @@
#define PROTO_DR_ADDICT_DELAY (100)
// critters
#define PROTO_CR_FLAGS (32)
#define PROTO_CR_LDIST (20)
#define PROTO_CR_LINT (24)
#define PROTO_CR_FLAG (28)
#define PROTO_CR_FLAGS (32) // Critter Flags
#define PROTO_CR_SCRIPTID (36)
#define PROTO_CR_HEAD_FID (40)
#define PROTO_CR_AI_PACKET (44)
#define PROTO_CR_TEAM_NUM (48)
@@ -192,26 +234,26 @@
#define CALIBER_7_62MM (18)
// hidden perks
#define PERK_add_nuka (53)
#define PERK_add_buffout (54)
#define PERK_add_mentats (55)
#define PERK_add_psycho (56)
#define PERK_add_radaway (57)
#define PERK_weapon_long_range (58)
#define PERK_weapon_accurate (59)
#define PERK_weapon_penetrate (60)
#define PERK_weapon_knockback (61)
#define PERK_armor_powered (62)
#define PERK_armor_combat (63)
#define PERK_weapon_scope_range (64)
#define PERK_weapon_fast_reload (65)
#define PERK_weapon_night_sight (66)
#define PERK_weapon_flameboy (67)
#define PERK_armor_advanced_1 (68)
#define PERK_armor_advanced_2 (69)
#define PERK_add_jet (70)
#define PERK_add_tragic (71)
#define PERK_armor_charisma (72)
#define PERK_add_nuka (53)
#define PERK_add_buffout (54)
#define PERK_add_mentats (55)
#define PERK_add_psycho (56)
#define PERK_add_radaway (57)
#define PERK_weapon_long_range (58)
#define PERK_weapon_accurate (59)
#define PERK_weapon_penetrate (60)
#define PERK_weapon_knockback (61)
#define PERK_armor_powered (62)
#define PERK_armor_combat (63)
#define PERK_weapon_scope_range (64)
#define PERK_weapon_fast_reload (65)
#define PERK_weapon_night_sight (66)
#define PERK_weapon_flameboy (67)
#define PERK_armor_advanced_1 (68)
#define PERK_armor_advanced_2 (69)
#define PERK_add_jet (70)
#define PERK_add_tragic (71)
#define PERK_armor_charisma (72)
#define WPN_ANIM_NONE (0x00) // (A)
#define WPN_ANIM_KNIFE (0x01) // (D)
@@ -225,4 +267,21 @@
#define WPN_ANIM_MINIGUN (0x09) // (L)
#define WPN_ANIM_ROCKET_LAUNCHER (0x0A) // (M)
// common object data offsets
#define OBJ_DATA_TILENUM (0x04)
#define OBJ_DATA_CUR_FRM (0x18) // current frame number
#define OBJ_DATA_ROTATION (0x1C)
#define OBJ_DATA_FID (0x20)
#define OBJ_DATA_ELEVATION (0x28)
#define OBJ_DATA_PID (0x64)
#define OBJ_DATA_CID (0x68)
#define OBJ_DATA_SID (0x78)
// items
#define OBJ_DATA_CUR_CHARGES (0x3C)
// 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)
#endif // DEFINE_EXTRA_H
+63 -24
View File
@@ -1,19 +1,22 @@
//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)
#define LOADGAME (0x20)
#define COMBAT (0x40)
#define OPTIONS (0x80)
#define HELP (0x100)
#define CHARSCREEN (0x200)
#define PIPBOY (0x400)
#define PCOMBAT (0x800)
#define INVENTORY (0x1000)
#define AUTOMAP (0x2000)
#define SKILLDEX (0x4000)
#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)
#define LOADGAME (0x20)
#define COMBAT (0x40)
#define OPTIONS (0x80)
#define HELP (0x100)
#define CHARSCREEN (0x200)
#define PIPBOY (0x400)
#define PCOMBAT (0x800)
#define INVENTORY (0x1000)
#define AUTOMAP (0x2000)
#define SKILLDEX (0x4000)
#define INTFACEUSE (0x8000)
#define INTFACELOOT (0x10000)
#define BARTER (0x20000)
//Valid arguments to register_hook
#define HOOK_TOHIT (0)
@@ -129,6 +132,7 @@
#define set_attack_explosion_radius(x) metarule2_explosions(3, x, 0)
#define set_attack_is_explosion(x) metarule2_explosions(4, x, 0)
#define set_attack_is_explosion_fire set_attack_is_explosion(DMG_fire)
#define set_explosion_radius(grenade, rocket) metarule2_explosions(5, grenade, rocket)
#define GAME_MSG_COMBAT (0)
@@ -158,6 +162,19 @@
#define GAME_MSG_PRO_TILE (0x1004)
#define GAME_MSG_PRO_MISC (0x1005)
#define OUTLINE_NONE (0)
#define OUTLINE_RED_GLOW (0x01)
#define OUTLINE_RED (0x02)
#define OUTLINE_GREY (0x04)
#define OUTLINE_GREEN_GLOW (0x08)
#define OUTLINE_YELLOW (0x10)
#define OUTLINE_DARK_YELLOW (0x20)
#define OUTLINE_PURPLE (0x40)
#define CURSOR_MOVEMENT (0)
#define CURSOR_COMMAND (1)
#define CURSOR_TARGETING (2)
#define mstr_combat(x) (message_str_game(GAME_MSG_COMBAT, x))
#define mstr_ai(x) (message_str_game(GAME_MSG_AI, x))
#define mstr_scrname(x) (message_str_game(GAME_MSG_SCRNAME, x))
@@ -189,12 +206,34 @@
#define party_member_list_all party_member_list(1)
#define critter_inven_obj2(obj, type) sfall_func2("critter_inven_obj2", obj, type)
#define exec_map_update_scripts sfall_func0("exec_map_update_scripts")
#define floor2(value) sfall_func1("floor2", value)
#define intface_hide sfall_func0("intface_hide")
#define intface_is_hidden sfall_func0("intface_is_hidden")
#define intface_redraw sfall_func0("intface_redraw")
#define intface_show sfall_func0("intface_show")
#define set_ini_setting(setting, value) sfall_func2("set_ini_setting", setting, value)
#define spatial_radius(obj) sfall_func1("spatial_radius", obj)
#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)
#define create_win_flag(winName, x, y, w, h, flag) sfall_func6("create_win", winName, x, y, w, h, flag)
#define critter_inven_obj2(obj, type) sfall_func2("critter_inven_obj2", obj, type)
#define display_stats sfall_func0("display_stats")
#define exec_map_update_scripts sfall_func0("exec_map_update_scripts")
#define floor2(value) sfall_func1("floor2", value)
#define get_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_map_enter_position sfall_func0("get_map_enter_position")
#define get_object_data(obj, offset) sfall_func2("get_object_data", obj, offset)
#define get_outline(obj) sfall_func1("get_outline", obj)
#define intface_hide sfall_func0("intface_hide")
#define intface_is_hidden sfall_func0("intface_is_hidden")
#define intface_redraw sfall_func0("intface_redraw")
#define intface_show sfall_func0("intface_show")
#define inventory_redraw(invSide) sfall_func1("inventory_redraw", invSide)
#define item_weight(obj) sfall_func1("item_weight", obj)
#define lock_is_jammed(obj) sfall_func1("lock_is_jammed", obj)
#define obj_under_cursor(crSwitch, inclDude) sfall_func2("obj_under_cursor", crSwitch, inclDude)
#define outlined_object sfall_func0("outlined_object")
#define set_cursor_mode(mode) sfall_func1("set_cursor_mode", mode)
#define set_flags(obj, flags) sfall_func2("set_flags", obj, flags)
#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 spatial_radius(obj) sfall_func1("spatial_radius", obj)
#define tile_refresh_display sfall_func0("tile_refresh_display")
#define unjam_lock(obj) sfall_func1("unjam_lock", obj)
+10 -7
View File
@@ -111,7 +111,7 @@ critter ret3 - Override the target of the attack
HOOK_CALCAPCOST (hs_calcapcost.int)
Runs whenever Fallout is calculating the AP cost of using the weapon (or unarmed attack). Doesn't run for using other item types or moving.
Note that the first time a game is loaded, this script doesn't run before the initial interface is drawn, so if the script effects the AP cost of whatever is in the players hands at the time the wrong AP cost will be shown. It will be fixed the next time the interface is redrawn.
Note that the first time a game is loaded, this script doesn't run before the initial interface is drawn, so if the script effects the AP cost of whatever is in the player's hands at the time the wrong AP cost will be shown. It will be fixed the next time the interface is redrawn.
You can get the weapon object by checking item slot based on attack type (ATKTYPE_LWEP1, ATKTYPE_LWEP2, etc) and then calling critter_inven_obj().
critter arg1 - The critter performing the action
@@ -162,11 +162,11 @@ critter arg1 - The target
critter arg2 - The attacker
int arg3 - The amount of damage to the target
int arg4 - The amount of damage to the attacker
int arg5 - The special effect flags for the target
int arg6 - The special effect flags for the attacker
int arg5 - The special effect flags for the target (use bwand DAM_* to check specific flags)
int arg6 - The special effect flags for the attacker (use bwand DAM_* to check specific flags)
int arg7 - The weapon used in the attack
int arg8 - The bodypart that was struck
int arg9 - Damage Multiplier (this is divided by 2, so a value of 3 does 1.5x damage, and 8 does 4x damage. Usually it's 2, but with Silent Death perk and the corresponding attack conditions, it's 4; for critical hits, the value is taken from the critical table)
int arg9 - Damage Multiplier (this is divided by 2, so a value of 3 does 1.5x damage, and 8 does 4x damage. Usually it's 2; for critical hits, the value is taken from the critical table; with Silent Death perk and the corresponding attack conditions, the value will be doubled)
int arg10 - Number of bullets actually hit the target (1 for melee attacks)
int arg11 - The amount of knockback to the target
int arg12 - Attack Type (see ATKTYPE_* constants)
@@ -189,7 +189,7 @@ 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. All 4 must be given if you want to override normal sorting; if you want to specify less than 4 targets fill in the extra spaces with 0's. If you do not give 4 targets, the NPCs normal sorting mechanism will be used.
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. All 4 must be given if you want to override normal sorting; if you want to specify less than 4 targets, fill in the extra spaces with 0's. If you do not give 4 targets, the NPCs normal sorting mechanism will be used.
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.
@@ -305,7 +305,7 @@ object* ret1 - 0 if the hex doesn't block, or any sort of object pointer if it d
HOOK_ITEMDAMAGE (hs_itemdamage.int)
Runs when retrieving the damage rating of the players used weapon. (Which may be their fists.)
Runs when retrieving the damage rating of the player's used weapon. (Which may be their fists.)
int arg1 - The default min damage
int arg2 - The default max damage
@@ -340,11 +340,14 @@ HOOK_KEYPRESS (hs_keypress.int)
Runs once every time when any key was pressed or released.
DX codes: (see dik.h header)
VK codes: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx
NOTE: if you want to override a key, the new key DX scancode should be the same for both pressed and released events.
int arg1 - event type: 1 - pressed, 0 - released
int arg2 - key DX scancode
int arg3 - key VK code (very similar to ASCII codes)
int ret1 - overrides the pressed key (a new key DX scancode or 0 for no override)
-------------------------------------------
HOOK_MOUSECLICK (hs_mouseclick.int)
@@ -429,7 +432,7 @@ HOOK_INVENWIELD (hs_invenwield.int)
Runs before wielding or unwielding an armor or a weapon by a critter (except when using 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 already equipped when wielding hook is executed.
If you need to rely on this, try checking if armor/weapon is already equipped when wielding hook is executed.
Critter arg1 - critter
Obj arg2 - item being wielded or unwielded (weapon/armor), may be 0 when unwielding (object is valid only if the item is unwielded by move_obj_inven_to_obj() or rm_obj_from_inven())
+89 -7
View File
@@ -2,7 +2,7 @@
---------- GLOBAL SCRIPTS -----------
-------------------------------------
As well as the new functions, sfall also adds global scripts. These run independent of any loaded maps, but do not have an attached object. (i.e. using self_obj without using set_self first will crash the script.) To use a global script, the script must have a name which begins with 'gl' and contains a procedure called 'start'. This procedure will be executed once when the player loads a saved game or starts a new game. If you wish the script to be executed repeatedly, call set_global_script_repeat on this first run using the number of frames between each run as the argument. (0 disables the script, 1 runs it every frame, 2 runs it every other frame etc.)
As well as the new functions, sfall also adds global scripts. These run independent of any loaded maps, but do not have an attached object. (i.e. using self_obj without using set_self first will crash the script.) To use a global script, the script must have a name which begins with 'gl' and contains a procedure called 'start', 'map_enter_p_proc', 'map_exit_p_proc', or 'map_update_p_proc'. The start procedure will be executed once when the player loads a saved game or starts a new game. The map_*_p_proc procedures will be executed once when a map is being entered/left/updated. If you wish the script to be executed repeatedly, call set_global_script_repeat on the first run of the start procedure using the number of frames between each run as the argument. (0 disables the script, 1 runs it every frame, 2 runs it every other frame etc.)
Global scripts have multiple modes, which can be set using the set_global_script_type function. In the default mode (i.e. mode 0) their execution is linked to the local map game loop, so the script will not run in dialogs or on the world map. In mode 1 their execution is linked to the player input, and so they will run whenever the mouse cursor is visible on screen, including the world map, character dialogs etc. In mode 2, execution is linked to the world map loop, so the script will only be executed on the world map and not on the local map or in any dialog windows. Mode 3 is a combination of modes 0 and 2, so scripts will be executed on both local maps and the world map, but not in dialog windows. Using mode 1 requires the input wrapper to be enabled. Use available_global_script_types to check what is available.
@@ -48,9 +48,9 @@ set_fake_trait and set_fake_perk can be used to add additional traits and perks
has_fake_trait and has_fake_perk return the number of levels the player has of the perks/traits with the given name.
perk_add_mode, set_selectable_perk, set_perkbox_title, hide_real_perks, show_real_perks and clear_selectable_perks control the behaviour of the select a perk box. set_selectable_perk can be used to add additional items by setting the 'active' parameter to 1, and to remove them again by setting it to 0. set_perkbox_title can be used to change the title of the box, or by using "" it will be set back to the default. hide and show_real_perks can be used to prevent the dialog from displaying any of the original 119 perks. perk_add_mode modifies what happens when a fake perk is selected from the perks dialog. It is treated as a set of flags - if bit 1 is set then it is added to the players traits, if bit 2 is set it is added to the players perks, and if bit 3 is set it is removed from the list of selectable perks. The default is 0x2. clear_selectable_perks restores the dialog to it's default state.
perk_add_mode, set_selectable_perk, set_perkbox_title, hide_real_perks, show_real_perks and clear_selectable_perks control the behaviour of the select a perk box. set_selectable_perk can be used to add additional items by setting the 'active' parameter to 1, and to remove them again by setting it to 0. set_perkbox_title can be used to change the title of the box, or by using "" it will be set back to the default. hide and show_real_perks can be used to prevent the dialog from displaying any of the original 119 perks. perk_add_mode modifies what happens when a fake perk is selected from the perks dialog. It is treated as a set of flags - if bit 1 is set then it is added to the players traits, if bit 2 is set it is added to the players perks, and if bit 3 is set it is removed from the list of selectable perks. The default is 0x2. clear_selectable_perks restores the dialog to 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.
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.
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.
@@ -98,7 +98,7 @@ array - array ID to be used with array-related functions (actually an integer)
----------------------------------------------
> int game_loaded()
- returns 1 the first time it is called after a new game or game load, and 0 any time after. It works on an individual basis for each script, so one script wont interfere with others. It's primary use is for global scripts, so that they know when to call set_global_script_repeat, but it can be called from normal scripts too.
- returns 1 the first time it is called after a new game or game load, and 0 any time after. It works on an individual basis for each script, so one script wont interfere with others. Its primary use is for global scripts, so that they know when to call set_global_script_repeat, but it can be called from normal scripts too.
> void inc_npc_level(string npc)
- takes an NPC name as an argument. The NPC must be in your party. This function ignores player level requirements and the minimum 3 player level delay between NPC level gains. It also ignores the random element, regardless of sfall's NPCAutoLevel setting.
@@ -216,20 +216,24 @@ 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.
> int metarule2_explosions(int arg1, int arg2)
> 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:
> void set_attack_explosion_pattern(x, y)
- currently y is not used and x means: 1 - reduced explosion pattern (3 effects are spawned instead of 7), 0 - full pattern
> void set_attack_explosion_art(x, y)
- y not used and x is a misc frame ID (last 3 bytes, without object type) to use for the next explosion.
- y is not used and x is a misc frame ID (last 3 bytes, without object type) to use for the next explosion.
> void set_attack_explosion_radius(x)
- changes radius at which explosion will hit secondary targets for the next attack (from the experiments it is limited to something around 8 by the engine)
> void set_attack_is_explosion_fire
- if you call this right before using a weapon with fire damage type, it will produce explosion effects (and radius damage) just like "explosion" type, but all targets will still receive fire damage.
- if you call this right before using a weapon with fire damage type (e.g. in HOOK_AFTERHITROLL), it will produce explosion effects (and radius damage) just like "explosion" type, but all targets will still receive fire damage.
> void set_explosion_radius(grenade, rocket)
- sets a permanent radius of the explosion for grenades and/or rockets. Passing 0 means not changing the corresponding radius.
- changed radius will be reset each time the player reloads the game.
Some utility/math functions are available:
@@ -385,6 +389,84 @@ Some utility/math functions are available:
- works just like vanilla floor function, but returns correct integers for negative values
- vanilla floor function works exactly the same as ceil for negative values, much like trunc in C/C++
> int sfall_func1("item_weight", object)
- gets the current weight of an object
> int sfall_func1("get_outline", object)
- gets the current outline color for an object
> void sfall_func2("set_outline", object, int color)
- sets the outline color of an object
- 0 means or any value above 0x00FFFFFF disables the outline
- call "tile_refresh_display" after changing outline of objects to properly redraw the scene
> int sfall_func1("get_flags", object)
- gets the current value of object flags (see define_extra.h for available flags)
> void sfall_func2("set_flags", object, int flags)
- sets the current flags of an object
- all flags are rewritten with given integer, so first get current flags with "get_flags" and use bwor/bwand to set/remove specific flag
> void sfall_func0("tile_refresh_display")
- redraws the game scene (tiles, walls, objects, etc.)
> object sfall_func0("outlined_object")
- returns an object that is currently highlighted by hovering the mouse above it
> int sfall_func0("get_cursor_mode")
- returns the current cursor mode (0 - movement cursor, 1 - command cursor, 2 - targeting cursor)
- mode 4 to 10 are Skilldex skills (yellow targeting cursor)
> void sfall_func1("set_cursor_mode", int mode)
- sets the current cursor mode
> void sfall_func0("display_stats")
- displays player stats in the inventory screen display window
- works only in opened inventory
> int sfall_func1("lock_is_jammed", object)
- returns 1 if the lock (container or scenery) is currently jammed, 0 otherwise
> void sfall_func1("unjam_lock", object)
- 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
> 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
- should be called in map_enter_p_proc procedure to get the correct position data
> void sfall_func3("set_map_enter_position", int tile, int elevation, int rotation)
- overrides the player's entry position when entering the map through exit grids
- setting the tile to 0 will put the player on the start hex (default tile and elevation) of the map
- works only in map_enter_p_proc procedure
> int sfall_func0("attack_is_aimed")
- returns 1 if the aimed attack mode is selected, 0 otherwise
> void sfall_func1("inventory_redraw", int invSide)
- redraws inventory list in the inventory/use inventory item on/loot/barter screens
- invSide specifies which side needs to be redrawn: 0 - the player, 1 - target (container/NPC in loot/barter screens)
> int sfall_func1("get_current_inven_size", object)
- returns the current inventory size of the container or the critter
> void sfall_func5("create_win", string winName, int x, int y, int width, int height)
> void sfall_func6("create_win", string winName, int x, int y, int width, int height, int flags)
- works just like vanilla CreateWin function, but creates a window with MoveOnTop flag if the flags argument is not specified, and allows to set additional flags for the created window
- MoveOnTop flag allows the created window to be placed on top of the game interface
> object sfall_func2("obj_under_cursor", bool crSwitch, bool inclDude)
- 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
> int sfall_func2("get_object_data", object, int offset)
- returns the data at the specified offset of an object (see OBJ_DATA_* constants in define_extra.h for offsets)
> void sfall_func3("set_object_data", object, int offset, int data)
- sets the data at the specified offset of an object
------------------------
------ MORE INFO -------
------------------------
+4 -4
View File
@@ -1,8 +1,8 @@
*0x8156 - int read_byte(int address)
*0x8157 - int read_short(int address)
*0x8158 - int read_int(int address)
*0x8159 - string read_string(int address)
0x8156 - int read_byte(int address)
0x8157 - int read_short(int address)
0x8158 - int read_int(int address)
0x8159 - string read_string(int address)
*0x81cf - void write_byte(int address, int value)
*0x81d0 - void write_short(int address, int value)
+10 -7
View File
@@ -40,19 +40,22 @@ DWORD _stdcall AIGetLastTarget(DWORD source) {
else return itr->second;
}
static void _stdcall CombatAttackHook(DWORD source, DWORD target) {
sources[target]=source;
targets[source]=target;
static void __fastcall CombatAttackHook(DWORD source, DWORD target) {
sources[target] = source;
targets[source] = target;
}
static void __declspec(naked) combat_attack_hook() {
_asm {
pushad;
push ecx;
push edx;
push eax;
call CombatAttackHook;
popad;
jmp combat_attack_;
mov ecx, eax; // source
call CombatAttackHook; // edx - target
pop eax;
pop edx;
pop ecx;
jmp combat_attack_;
}
}
+372 -682
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -181,6 +181,8 @@ static DWORD __fastcall CheckSetSad(BYTE openFlag, DWORD valueMul) {
return result;
}
static const DWORD object_move_back0 = 0x417611;
static const DWORD object_move_back1 = 0x417616;
static void __declspec(naked) object_move_hack() {
__asm {
mov ecx, ds:[ecx + 0x3C]; // openFlag
@@ -188,11 +190,9 @@ static void __declspec(naked) object_move_hack() {
call CheckSetSad;
test eax, eax;
jz end;
push 0x417611; // fixed jump
retn;
jmp object_move_back0; // fixed jump
end:
push 0x417616; // default
retn;
jmp object_move_back1; // default
}
}
+7 -5
View File
@@ -88,17 +88,19 @@ void BarBoxesInit() {
}
}
int _stdcall GetBox(int i) {
if (i < 5 || i > 9) return 0;
return boxesEnabled[i - 5];
bool GetBox(int i) {
if (i < 5 || i > 9) return false;
return (boxesEnabled[i - 5] != 0);
}
void _stdcall AddBox(int i) {
void AddBox(int i) {
if (i < 5 || i > 9) return;
boxesEnabled[i - 5] = 1;
__asm call refresh_box_bar_win_;
}
void _stdcall RemoveBox(int i) {
void RemoveBox(int i) {
if (i < 5 || i > 9) return;
boxesEnabled[i - 5] = 0;
__asm call refresh_box_bar_win_;
}
+3 -3
View File
@@ -1,4 +1,4 @@
void BarBoxesInit();
int _stdcall GetBox(int i);
void _stdcall AddBox(int i);
void _stdcall RemoveBox(int i);
bool GetBox(int i);
void AddBox(int i);
void RemoveBox(int i);
+776 -88
View File
File diff suppressed because it is too large Load Diff
+5 -2
View File
@@ -1,5 +1,8 @@
#pragma once
extern DWORD WeightOnBody;
void BugsInit();
void ResetBodyState();
void GameInitialization();
extern int tagSkill4LevelBase;
+140 -131
View File
@@ -23,9 +23,10 @@
#include "FalloutEngine.h"
#include "Logging.h"
static const DWORD CritTableCount=2*19+1; //Number of species in new critical table
//static const DWORD origCritTableSize = 6*9*20; //Number of entries in original table
static const DWORD CritTableSize = 6*9*CritTableCount; //Number of entries in new critical table
static const char* CritTableFile = ".\\CriticalOverrides.ini";
static const DWORD CritTableCount = 2 * 19 + 1; // Number of species in new critical table
//static const DWORD origCritTableSize = 6 * 9 * 20; // Number of entries in original table
static const DWORD CritTableSize = 6 * 9 * CritTableCount; // Number of entries in new critical table
static DWORD mode;
static const char* CritNames[] = {
@@ -53,49 +54,55 @@ struct CritStruct {
};
};
static CritStruct* baseCritTable; // Base critical table set up via enabling OverrideCriticalTable in ddraw.ini
static CritStruct* critTable;
static CritStruct* playerCrit;
static bool Inited=false;
static bool Inited = false;
static const char* errorTable = "\nError: %s - function requires enabling OverrideCriticalTable in ddraw.ini.";
void _stdcall SetCriticalTable(DWORD critter, DWORD bodypart, DWORD slot, DWORD element, DWORD value) {
if(!Inited) return;
if(critter>=CritTableCount||bodypart>=9||slot>=6||element>=7) return;
critTable[critter*9*6+bodypart*6+slot].values[element]=value;
void SetCriticalTable(DWORD critter, DWORD bodypart, DWORD slot, DWORD element, DWORD value) {
if (!Inited) {
DebugPrintf(errorTable, "set_critical_table()");
return;
}
critTable[critter * 9 * 6 + bodypart * 6 + slot].values[element] = value;
}
DWORD _stdcall GetCriticalTable(DWORD critter, DWORD bodypart, DWORD slot, DWORD element) {
if(!Inited) return 0;
if(critter>=CritTableCount||bodypart>=9||slot>=6||element>=7) return 0;
return critTable[critter*9*6+bodypart*6+slot].values[element];
DWORD GetCriticalTable(DWORD critter, DWORD bodypart, DWORD slot, DWORD element) {
if (!Inited) {
DebugPrintf(errorTable, "get_critical_table()");
return 0;
}
return critTable[critter * 9 * 6 + bodypart * 6 + slot].values[element];
}
void _stdcall ResetCriticalTable(DWORD critter, DWORD bodypart, DWORD slot, DWORD element) {
if(!Inited) return;
if(critter>=CritTableCount||bodypart>=9||slot>=6||element>=7) return;
//It's been a long time since we worried about win9x compatibility, so just sprintf it for goodness sake...
char section[16];
sprintf_s(section, "c_%02d_%d_%d", critter, bodypart, slot);
CritStruct* defaultTable=(CritStruct*)_crit_succ_eff;
critTable[slot].values[element]=critTable[slot].DamageMultiplier=GetPrivateProfileIntA(section, CritNames[element], defaultTable[slot].values[element], ".\\CriticalOverrides.ini");
void ResetCriticalTable(DWORD critter, DWORD bodypart, DWORD slot, DWORD element) {
if (!Inited) {
DebugPrintf(errorTable, "reset_critical_table()");
return;
}
critTable[critter * 9 * 6 + bodypart * 6 + slot].values[element] = baseCritTable[critter * 9 * 6 + bodypart * 6 + slot].values[element];
}
void CritLoad() {
if (!Inited) return;
CritStruct* defaultTable=(CritStruct*)_crit_succ_eff;
if (mode==1) {
char section[16];
CritStruct* defaultTable = (CritStruct*)_crit_succ_eff;
if (mode == 1) {
dlogr("Setting up critical hit table using CriticalOverrides.ini", DL_CRITICALS);
memset(critTable, 0, CritTableSize*sizeof(CritStruct));
for (DWORD critter=0;critter<20;critter++) {
for (DWORD part=0;part<9;part++) {
for (DWORD crit=0;crit<6;crit++) {
char section[16];
memset(baseCritTable, 0, CritTableSize * sizeof(CritStruct));
for (DWORD critter = 0; critter < 20; critter++) {
for (DWORD part = 0; part < 9; part++) {
for (DWORD crit = 0; crit < 6; crit++) {
sprintf_s(section, "c_%02d_%d_%d", critter, part, crit);
int slot1=crit+part*6+critter*9*6;
int slot2=crit+part*6+((critter==19)?38:critter)*9*6;
for (int i=0;i<7;i++) {
critTable[slot2].values[i]=GetPrivateProfileIntA(section, CritNames[i], defaultTable[slot1].values[i], ".\\CriticalOverrides.ini");
int slot1 = crit + part * 6 + critter * 9 * 6;
int slot2 = crit + part * 6 + ((critter == 19) ? 38 : critter) * 9 * 6;
for (int i = 0; i < 7; i++) {
baseCritTable[slot2].values[i] = GetPrivateProfileIntA(section, CritNames[i], defaultTable[slot1].values[i], CritTableFile);
if (IsDebug) {
char logmsg[256];
if(critTable[slot2].values[i]!=defaultTable[slot1].values[i]) {
sprintf_s(logmsg, "Entry %s value %d changed from %d to %d", section, i, defaultTable[slot1].values[i], critTable[slot2].values[i]);
if (baseCritTable[slot2].values[i] != defaultTable[slot1].values[i]) {
sprintf_s(logmsg, "Entry %s value %d changed from %d to %d", section, i, defaultTable[slot1].values[i], baseCritTable[slot2].values[i]);
dlogr(logmsg, DL_CRITICALS);
}
}
@@ -105,149 +112,151 @@ void CritLoad() {
}
} else {
dlogr("Setting up critical hit table using RP fixes", DL_CRITICALS);
memcpy(critTable, defaultTable, 6*9*19*sizeof(CritStruct));
memset(&critTable[6*9*19], 0, 6*9*19*sizeof(CritStruct));
memcpy(playerCrit, (void*)_pc_crit_succ_eff, 6*9*sizeof(CritStruct));
memcpy(baseCritTable, defaultTable, 6 * 9 * 19 * sizeof(CritStruct));
memset(&baseCritTable[6 * 9 * 19], 0, 6 * 9 * 19 * sizeof(CritStruct));
memcpy(&baseCritTable[6 * 9 * 38], (void*)_pc_crit_succ_eff, 6 * 9 * sizeof(CritStruct)); // PC crit table
if (mode==3) {
if (mode == 3) {
char buf[32], buf2[32], buf3[32];
for (int critter=0;critter<CritTableCount;critter++) {
for (int critter = 0; critter < CritTableCount; critter++) {
sprintf_s(buf, "c_%02d", critter);
int all;
if(!(all=GetPrivateProfileIntA(buf, "Enabled", 0, ".\\CriticalOverrides.ini"))) continue;
for (int part=0;part<9;part++) {
if (all<2) {
if (!(all = GetPrivateProfileIntA(buf, "Enabled", 0, CritTableFile))) continue;
for (int part = 0; part < 9; part++) {
if (all < 2) {
sprintf_s(buf2, "Part_%d", part);
if (!GetPrivateProfileIntA(buf, buf2, 0, ".\\CriticalOverrides.ini")) continue;
if (!GetPrivateProfileIntA(buf, buf2, 0, CritTableFile)) continue;
}
sprintf_s(buf2, "c_%02d_%d", critter, part);
for (int crit=0;crit<6;crit++) {
int slot=crit+part*6+critter*9*6;
for (int i=0;i<7;i++) {
for (int crit = 0; crit < 6; crit++) {
int slot = crit + part * 6 + critter * 9 * 6;
for (int i = 0; i < 7; i++) {
sprintf_s(buf3, "e%d_%s", crit, CritNames[i]);
critTable[slot].values[i]=GetPrivateProfileIntA(buf2, buf3, critTable[slot].values[i], ".\\CriticalOverrides.ini");
baseCritTable[slot].values[i] = GetPrivateProfileIntA(buf2, buf3, baseCritTable[slot].values[i], CritTableFile);
}
}
}
}
}
}
memcpy(critTable, baseCritTable, CritTableSize * sizeof(CritStruct)); // Apply base critical table
dlogr("Completed critical hit table.", DL_CRITICALS);
}
#define SetEntry(a,b,c,d,e) defaultTable[a*9*6 + b*6 + c].values[d]=e;
#define SetEntry(critter, bodypart, effect, param, value) defaultTable[critter * 9 * 6 + bodypart * 6 + effect].values[param] = value;
void CritInit() {
mode=GetPrivateProfileIntA("Misc", "OverrideCriticalTable", 2, ini);
if(mode<0||mode>3) mode=0;
mode = GetPrivateProfileIntA("Misc", "OverrideCriticalTable", 2, ini);
if (mode < 0 || mode > 3) mode = 0;
if(!mode) return;
if (!mode) return;
dlog("Initializing critical table override.", DL_INIT);
critTable=new CritStruct[CritTableSize];
playerCrit=&critTable[6*9*38];
baseCritTable = new CritStruct[CritTableSize];
critTable = new CritStruct[CritTableSize];
playerCrit = &critTable[6 * 9 * 38];
SafeWrite32(0x423F96, (DWORD)playerCrit);
SafeWrite32(0x423FB3, (DWORD)critTable);
if(mode==2 || mode==3) {
CritStruct* defaultTable=(CritStruct*)_crit_succ_eff;
if (mode == 2 || mode == 3) {
CritStruct* defaultTable = (CritStruct*)_crit_succ_eff;
SetEntry(2,4,1,4,0);
SetEntry(2,4,1,5,5216);
SetEntry(2,4,1,6,5000);
SetEntry(2, 4, 1, 4, 0);
SetEntry(2, 4, 1, 5, 5216);
SetEntry(2, 4, 1, 6, 5000);
SetEntry(2,4,2,4,0);
SetEntry(2,4,2,5,5216);
SetEntry(2,4,2,6,5000);
SetEntry(2,5,1,4,0);
SetEntry(2,5,1,5,5216);
SetEntry(2,5,1,6,5000);
SetEntry(2, 4, 2, 4, 0);
SetEntry(2, 4, 2, 5, 5216);
SetEntry(2, 4, 2, 6, 5000);
SetEntry(2,5,2,4,0);
SetEntry(2,5,2,5,5216);
SetEntry(2,5,2,6,5000);
SetEntry(2, 5, 1, 4, 0);
SetEntry(2, 5, 1, 5, 5216);
SetEntry(2, 5, 1, 6, 5000);
SetEntry(3,5,1,6,5306);
SetEntry(2, 5, 2, 4, 0);
SetEntry(2, 5, 2, 5, 5216);
SetEntry(2, 5, 2, 6, 5000);
SetEntry(4,0,4,2,-1);
SetEntry(3, 5, 1, 6, 5306);
SetEntry(5,0,4,2,-1);
SetEntry(4, 0, 4, 2, -1);
SetEntry(6,4,1,4,2);
SetEntry(5, 0, 4, 2, -1);
SetEntry(6,5,1,4,2);
SetEntry(6, 4, 1, 4, 2);
SetEntry(6,5,2,6,5608);
SetEntry(6, 5, 1, 4, 2);
SetEntry(9,3,3,4,2);
SetEntry(6, 5, 2, 6, 5608);
SetEntry(13,5,1,4,4);
SetEntry(13,5,2,4,4);
SetEntry(13,5,3,4,4);
SetEntry(13,5,4,4,4);
SetEntry(13,5,5,4,4);
SetEntry(9, 3, 3, 4, 2);
SetEntry(18,0,0,5,5001);
SetEntry(18,0,1,5,5001);
SetEntry(18,0,2,5,5001);
SetEntry(18,0,3,5,7105);
SetEntry(18,0,4,5,7101);
SetEntry(18,0,4,6,7104);
SetEntry(18,0,5,5,7101);
SetEntry(13, 5, 1, 4, 4);
SetEntry(13, 5, 2, 4, 4);
SetEntry(13, 5, 3, 4, 4);
SetEntry(13, 5, 4, 4, 4);
SetEntry(13, 5, 5, 4, 4);
SetEntry(18,1,0,5,5008);
SetEntry(18,1,1,5,5008);
SetEntry(18,1,2,5,5009);
SetEntry(18,1,3,5,5009);
SetEntry(18,1,4,5,7102);
SetEntry(18,1,5,5,7102);
SetEntry(18,2,0,5,5008);
SetEntry(18,2,1,5,5008);
SetEntry(18,2,2,5,5009);
SetEntry(18,2,3,5,5009);
SetEntry(18,2,4,5,7102);
SetEntry(18,2,5,5,7102);
SetEntry(18, 0, 0, 5, 5001);
SetEntry(18, 0, 1, 5, 5001);
SetEntry(18, 0, 2, 5, 5001);
SetEntry(18, 0, 3, 5, 7105);
SetEntry(18, 0, 4, 5, 7101);
SetEntry(18, 0, 4, 6, 7104);
SetEntry(18, 0, 5, 5, 7101);
SetEntry(18,3,4,5,7101);
SetEntry(18,3,5,5,7101);
SetEntry(18, 1, 0, 5, 5008);
SetEntry(18, 1, 1, 5, 5008);
SetEntry(18, 1, 2, 5, 5009);
SetEntry(18, 1, 3, 5, 5009);
SetEntry(18, 1, 4, 5, 7102);
SetEntry(18, 1, 5, 5, 7102);
SetEntry(18,4,0,5,5023);
SetEntry(18,4,1,5,7101);
SetEntry(18,4,1,6,7103);
SetEntry(18,4,2,5,7101);
SetEntry(18,4,2,6,7103);
SetEntry(18,4,3,5,7103);
SetEntry(18,4,4,5,7103);
SetEntry(18,4,5,5,7103);
SetEntry(18, 2, 0, 5, 5008);
SetEntry(18, 2, 1, 5, 5008);
SetEntry(18, 2, 2, 5, 5009);
SetEntry(18, 2, 3, 5, 5009);
SetEntry(18, 2, 4, 5, 7102);
SetEntry(18, 2, 5, 5, 7102);
SetEntry(18,5,0,5,5023);
SetEntry(18,5,1,5,7101);
SetEntry(18,5,1,6,7103);
SetEntry(18,5,2,5,7101);
SetEntry(18,5,2,6,7103);
SetEntry(18,5,3,5,7103);
SetEntry(18,5,4,5,7103);
SetEntry(18,5,5,5,7103);
SetEntry(18, 3, 4, 5, 7101);
SetEntry(18, 3, 5, 5, 7101);
SetEntry(18,6,0,5,5027);
SetEntry(18,6,1,5,5027);
SetEntry(18,6,2,5,5027);
SetEntry(18, 4, 0, 5, 5023);
SetEntry(18, 4, 1, 5, 7101);
SetEntry(18, 4, 1, 6, 7103);
SetEntry(18, 4, 2, 5, 7101);
SetEntry(18, 4, 2, 6, 7103);
SetEntry(18, 4, 3, 5, 7103);
SetEntry(18, 4, 4, 5, 7103);
SetEntry(18, 4, 5, 5, 7103);
SetEntry(18, 5, 0, 5, 5023);
SetEntry(18, 5, 1, 5, 7101);
SetEntry(18, 5, 1, 6, 7103);
SetEntry(18, 5, 2, 5, 7101);
SetEntry(18, 5, 2, 6, 7103);
SetEntry(18, 5, 3, 5, 7103);
SetEntry(18, 5, 4, 5, 7103);
SetEntry(18, 5, 5, 5, 7103);
SetEntry(18, 6, 0, 5, 5027);
SetEntry(18, 6, 1, 5, 5027);
SetEntry(18, 6, 2, 5, 5027);
//SetEntry(18,6,2,6,0);
SetEntry(18,6,3,5,5027);
SetEntry(18,6,4,5,7104);
SetEntry(18,6,5,5,7104);
SetEntry(18, 6, 3, 5, 5027);
SetEntry(18, 6, 4, 5, 7104);
SetEntry(18, 6, 5, 5, 7104);
SetEntry(18,7,0,5,5033);
SetEntry(18,7,1,5,5027);
SetEntry(18,7,1,6,7101);
SetEntry(18,7,2,5,7101);
SetEntry(18,7,3,5,7101);
SetEntry(18,7,4,5,7101);
SetEntry(18,7,5,5,7101);
SetEntry(18, 7, 0, 5, 5033);
SetEntry(18, 7, 1, 5, 5027);
SetEntry(18, 7, 1, 6, 7101);
SetEntry(18, 7, 2, 5, 7101);
SetEntry(18, 7, 3, 5, 7101);
SetEntry(18, 7, 4, 5, 7101);
SetEntry(18, 7, 5, 5, 7101);
}
Inited=true;
Inited = true;
dlogr(" Done", DL_INIT);
}
+5 -3
View File
@@ -21,6 +21,8 @@
void CritInit();
void CritLoad();
void _stdcall SetCriticalTable(DWORD critter, DWORD bodypart, DWORD slot, DWORD element, DWORD value);
DWORD _stdcall GetCriticalTable(DWORD critter, DWORD bodypart, DWORD slot, DWORD element);
void _stdcall ResetCriticalTable(DWORD critter, DWORD bodypart, DWORD slot, DWORD element);
extern const DWORD CritTableCount;
void SetCriticalTable(DWORD critter, DWORD bodypart, DWORD slot, DWORD element, DWORD value);
DWORD GetCriticalTable(DWORD critter, DWORD bodypart, DWORD slot, DWORD element);
void ResetCriticalTable(DWORD critter, DWORD bodypart, DWORD slot, DWORD element);
+4 -5
View File
@@ -1,16 +1,15 @@
#pragma once
// PIDS of some items
#define PID_MOTION_SENSOR 59
#define PID_SUPER_STIMPAK 144
#define PID_ACTIVE_GEIGER_COUNTER 207
#define PID_ACTIVE_STEALTH_BOY 210
#define PID_CAR_TRUNK 455
#define PID_DRIVABLE_CAR 33555441
#define PID_JET 259
#define PID_CAR_TRUNK 455
#define PID_JESSE_CONTAINER 467
#define PID_MOTION_SENSOR 59
#define PID_Player 16777216
#define PID_SUPER_STIMPAK 144
#define PID_DRIVABLE_CAR 33555441
//XXXXXXXXXXXXXXXXXXXXX
//XX Critter defines XX
+30 -30
View File
@@ -43,8 +43,8 @@ static sElevator Elevators[ElevatorCount];
static DWORD Menus[ElevatorCount];
void SetElevator(DWORD id, DWORD index, DWORD value) {
if(id>=ElevatorCount||index>=12) return;
*(DWORD*)(((DWORD)&Elevators[id])+index*4)=value;
if (id >= ElevatorCount || index >= 12) return;
*(DWORD*)(((DWORD)&Elevators[id]) + index * 4) = value;
}
static void __declspec(naked) GetMenuHook() {
@@ -70,6 +70,7 @@ static void __declspec(naked) UnknownHook() {
ret;
}
}
static void __declspec(naked) UnknownHook2() {
__asm {
push ebx;
@@ -87,51 +88,50 @@ static void __declspec(naked) GetNumButtonsHook1() {
lea esi, Menus;
mov eax, [esi+edi*4];
mov eax, [_btncnt+eax*4];
push 0x43F064;
retn;
}
}
static void __declspec(naked) GetNumButtonsHook2() {
__asm {
lea edx, Menus;
mov eax, [edx+edi*4];
mov eax, [_btncnt+eax*4];
push 0x43F18B;
retn;
}
}
static void __declspec(naked) GetNumButtonsHook3() {
__asm {
lea eax, Menus;
mov eax, [eax+edi*4];
mov eax, [_btncnt+eax*4];
push 0x43F1EB;
retn;
}
}
void ResetElevators() {
memcpy(Elevators, (void*)_retvals, sizeof(sElevator)*24);
memset(&Elevators[24], 0, sizeof(sElevator)*(ElevatorCount-24));
for(int i=0;i<24;i++) Menus[i]=i;
for(int i=24;i<ElevatorCount;i++) Menus[i]=0;
memcpy(Elevators, (void*)_retvals, sizeof(sElevator) * 24);
memset(&Elevators[24], 0, sizeof(sElevator) * (ElevatorCount - 24));
for (int i = 0; i < 24; i++) Menus[i] = i;
for (int i = 24; i < ElevatorCount; i++) Menus[i] = 0;
char section[4];
if(File) {
for(int i=0;i<ElevatorCount;i++) {
if (File) {
for (int i = 0; i < ElevatorCount; i++) {
_itoa_s(i, section, 10);
Menus[i]=GetPrivateProfileIntA(section, "Image", Menus[i], File);
Elevators[i].ID1=GetPrivateProfileIntA(section, "ID1", Elevators[i].ID1, File);
Elevators[i].ID2=GetPrivateProfileIntA(section, "ID2", Elevators[i].ID2, File);
Elevators[i].ID3=GetPrivateProfileIntA(section, "ID3", Elevators[i].ID3, File);
Elevators[i].ID4=GetPrivateProfileIntA(section, "ID4", Elevators[i].ID4, File);
Elevators[i].Elevation1=GetPrivateProfileIntA(section, "Elevation1", Elevators[i].Elevation1, File);
Elevators[i].Elevation2=GetPrivateProfileIntA(section, "Elevation2", Elevators[i].Elevation2, File);
Elevators[i].Elevation3=GetPrivateProfileIntA(section, "Elevation3", Elevators[i].Elevation3, File);
Elevators[i].Elevation4=GetPrivateProfileIntA(section, "Elevation4", Elevators[i].Elevation4, File);
Elevators[i].Tile1=GetPrivateProfileIntA(section, "Tile1", Elevators[i].Tile1, File);
Elevators[i].Tile2=GetPrivateProfileIntA(section, "Tile2", Elevators[i].Tile2, File);
Elevators[i].Tile3=GetPrivateProfileIntA(section, "Tile3", Elevators[i].Tile3, File);
Elevators[i].Tile4=GetPrivateProfileIntA(section, "Tile4", Elevators[i].Tile4, File);
Menus[i] = GetPrivateProfileIntA(section, "Image", Menus[i], File);
Elevators[i].ID1 = GetPrivateProfileIntA(section, "ID1", Elevators[i].ID1, File);
Elevators[i].ID2 = GetPrivateProfileIntA(section, "ID2", Elevators[i].ID2, File);
Elevators[i].ID3 = GetPrivateProfileIntA(section, "ID3", Elevators[i].ID3, File);
Elevators[i].ID4 = GetPrivateProfileIntA(section, "ID4", Elevators[i].ID4, File);
Elevators[i].Elevation1 = GetPrivateProfileIntA(section, "Elevation1", Elevators[i].Elevation1, File);
Elevators[i].Elevation2 = GetPrivateProfileIntA(section, "Elevation2", Elevators[i].Elevation2, File);
Elevators[i].Elevation3 = GetPrivateProfileIntA(section, "Elevation3", Elevators[i].Elevation3, File);
Elevators[i].Elevation4 = GetPrivateProfileIntA(section, "Elevation4", Elevators[i].Elevation4, File);
Elevators[i].Tile1 = GetPrivateProfileIntA(section, "Tile1", Elevators[i].Tile1, File);
Elevators[i].Tile2 = GetPrivateProfileIntA(section, "Tile2", Elevators[i].Tile2, File);
Elevators[i].Tile3 = GetPrivateProfileIntA(section, "Tile3", Elevators[i].Tile3, File);
Elevators[i].Tile4 = GetPrivateProfileIntA(section, "Tile4", Elevators[i].Tile4, File);
}
}
}
@@ -139,9 +139,11 @@ void ResetElevators() {
void ElevatorsInit(char* file) {
strcpy_s(File, ".\\");
strcat_s(File, file);
HookCall(0x43EF83, GetMenuHook);
HookCall(0x43F141, UnknownHook);
HookCall(0x43F2D2, UnknownHook2);
SafeWrite8(0x43EF76, (BYTE)ElevatorCount);
SafeWrite32(0x43EFA4, (DWORD)Elevators);
SafeWrite32(0x43EFB9, (DWORD)Elevators);
@@ -150,11 +152,9 @@ void ElevatorsInit(char* file) {
SafeWrite32(0x43F309, (DWORD)&Elevators[0].Elevation1);
SafeWrite32(0x43F315, (DWORD)&Elevators[0].Tile1);
SafeWrite8(0x43F05D, 0xe9);
HookCall(0x43F05D, GetNumButtonsHook1);
SafeWrite8(0x43F184, 0xe9);
HookCall(0x43F184, GetNumButtonsHook2);
SafeWrite8(0x43F1E4, 0xe9);
HookCall(0x43F1E4, GetNumButtonsHook3);
MakeCall(0x43F05D, GetNumButtonsHook1, 2);
MakeCall(0x43F184, GetNumButtonsHook2, 2);
MakeCall(0x43F1E4, GetNumButtonsHook3, 2);
ResetElevators();
}
+36 -10
View File
@@ -23,6 +23,7 @@
#include "ScriptExtender.h"
static bool lightingEnabled = false;
static bool explosionsMetaruleReset = false;
static const DWORD ranged_attack_lighting_fix_back = 0x4118F8;
@@ -96,7 +97,6 @@ static void __declspec(naked) explosion_lighting_fix2() {
}
}
DWORD _stdcall LogThis(DWORD value1, DWORD value2, DWORD value3) {
dlog_f("anim_set_check__light_fix: object 0x%X, something 0x%X, radius 0x%X", DL_MAIN, value1, value2, value3);
return value1;
@@ -147,13 +147,15 @@ static void __declspec(naked) fire_dance_lighting_fix1() {
}
static const DWORD explosion_dmg_check_adr[] = {0x411709, 0x4119FC, 0x411C08, 0x4517C1, 0x423BC8};
static const DWORD explosion_dmg_check_adr[] = {0x411709, 0x4119FC, 0x411C08, 0x4517C1, 0x423BC8, 0x42381A};
static const DWORD explosion_art_adr[] = {0x411A19, 0x411A29, 0x411A35, 0x411A3C};
static const DWORD explosion_art_defaults[] = {10, 2, 31, 29};
static const DWORD explosion_radius_grenade = 0x479183;
static const DWORD explosion_radius_rocket = 0x47918B;
static DWORD set_expl_radius_grenade = 2;
static DWORD set_expl_radius_rocket = 3;
static const size_t numArtChecks = sizeof(explosion_art_adr) / sizeof(explosion_art_adr[0]);
static const size_t numDmgChecks = sizeof(explosion_dmg_check_adr) / sizeof(explosion_dmg_check_adr[0]);
@@ -161,8 +163,14 @@ static const size_t numDmgChecks = sizeof(explosion_dmg_check_adr) / sizeof(expl
#define EXPL_FORCE_EXPLOSION_ART (2)
#define EXPL_FORCE_EXPLOSION_RADIUS (3)
#define EXPL_FORCE_EXPLOSION_DMGTYPE (4)
#define EXPL_STATIC_EXPLOSION_RADIUS (5)
DWORD _stdcall ExplosionsMetaruleFunc(DWORD mode, DWORD arg1, DWORD arg2) {
static void SetExplosionRadius(int arg1, int arg2) {
SafeWrite32(explosion_radius_grenade, arg1);
SafeWrite32(explosion_radius_rocket, arg2);
}
int _stdcall ExplosionsMetaruleFunc(int mode, int arg1, int arg2) {
switch (mode) {
case EXPL_FORCE_EXPLOSION_PATTERN:
if (arg1) {
@@ -179,19 +187,27 @@ DWORD _stdcall ExplosionsMetaruleFunc(DWORD mode, DWORD arg1, DWORD arg2) {
}
break;
case EXPL_FORCE_EXPLOSION_RADIUS:
SafeWrite32(explosion_radius_grenade, arg1);
SafeWrite32(explosion_radius_rocket, arg1);
SetExplosionRadius(arg1, arg1);
break;
case EXPL_FORCE_EXPLOSION_DMGTYPE:
for (int i = 0; i < numDmgChecks; i++) {
SafeWrite8(explosion_dmg_check_adr[i], (BYTE)arg1);
}
break;
case EXPL_STATIC_EXPLOSION_RADIUS:
if (arg1 > 0) set_expl_radius_grenade = arg1;
if (arg2 > 0) set_expl_radius_rocket = arg2;
SetExplosionRadius(set_expl_radius_grenade, set_expl_radius_rocket);
break;
default:
return -1;
}
if (mode != EXPL_STATIC_EXPLOSION_RADIUS) explosionsMetaruleReset = true;
return 0;
}
void ResetExplosionSettings() {
if (!explosionsMetaruleReset) return;
// explosion pattern
explosion_effect_starting_dir = 0;
SafeWrite8(0x411B54, 6); // last direction
@@ -200,15 +216,20 @@ void ResetExplosionSettings() {
SafeWrite32(explosion_art_adr[i], explosion_art_defaults[i]);
}
// explosion radiuses
SafeWrite32(explosion_radius_grenade, 2);
SafeWrite32(explosion_radius_rocket, 3);
SetExplosionRadius(set_expl_radius_grenade, set_expl_radius_rocket);
// explosion dmgtype
for (int i = 0; i < numDmgChecks; i++) {
SafeWrite8(explosion_dmg_check_adr[i], 6);
}
explosionsMetaruleReset = false;
}
void ExplosionLightingInit() {
void ResetExplosionRadius() {
if (set_expl_radius_grenade != 2 || set_expl_radius_rocket != 3)
SetExplosionRadius(2, 3);
}
void ExplosionInit() {
MakeJump(0x411AB4, explosion_effect_hook); // required for explosions_metarule
lightingEnabled = GetPrivateProfileIntA("Misc", "ExplosionsEmitLight", 0, ini) != 0;
@@ -217,7 +238,12 @@ void ExplosionLightingInit() {
MakeJump(0x4118E1, ranged_attack_lighting_fix);
MakeJump(0x410A4A, fire_dance_lighting_fix1);
MakeJump(0x415A3F, anim_set_check__light_fix); // this allows to change light intensity
dlogr(" Done", DL_INIT);
}
DWORD tmp;
tmp = SimplePatch<DWORD>(0x4A2873, "Misc", "Dynamite_DmgMax", 50, 0, 9999);
SimplePatch<DWORD>(0x4A2878, "Misc", "Dynamite_DmgMin", 30, 0, tmp);
tmp = SimplePatch<DWORD>(0x4A287F, "Misc", "PlasticExplosive_DmgMax", 80, 0, 9999);
SimplePatch<DWORD>(0x4A2884, "Misc", "PlasticExplosive_DmgMin", 40, 0, tmp);
}
+4 -3
View File
@@ -18,6 +18,7 @@
#pragma once
void ExplosionLightingInit();
DWORD _stdcall ExplosionsMetaruleFunc(DWORD mode, DWORD arg1, DWORD arg2);
void ResetExplosionSettings();
void ExplosionInit();
int _stdcall ExplosionsMetaruleFunc(int mode, int arg1, int arg2);
void ResetExplosionSettings();
void ResetExplosionRadius();

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