Compare commits

...
30 Commits
Author SHA1 Message Date
NovaRain 8c2483a289 Merge branch 'develop' 2018-06-12 21:01:12 +08:00
NovaRain e14ac89463 Added more info to the comments of various keys in [Input] section of ddraw.ini. 2018-06-12 20:52:03 +08:00
Mr.StalinandNovaRain d5a38eb3aa Fix for inventory moving hook - an item drop into container when it is in the slot of the hands. (#167) 2018-06-12 12:13:42 +08:00
NovaRain 177137f2ee Edited the description in hookscripts.txt for changes to HOOK_INVENTORYMOVE and HOKK_INVENWIELD.
Fixed a bug in DisplaySecondWeaponRange that didn't display correct weapon range when the secondary mode is aimed (e.g. spear and throwing knife)
Removed trilling spaces in previous commit.
2018-06-11 13:40:09 +08:00
Mr.StalinandNovaRain 76f88eae18 Added new events to HOOK_INVENTORYMOVE. Added possible to get a pointer to an weapon item in HOOK_INVENWIELD before unweld it. (#163)
Refactoring the hooks code of the inventory.
2018-06-11 13:14:52 +08:00
NovaRain 28962f428f Added ItemFastMoveKey and ItemCounterDefaultMax options to ddraw.ini.
Set ReloadReserve to be disabled by default.
2018-06-06 06:33:46 +08:00
Mr.StalinandNovaRain aaa76cb3d1 Quickly moving items in inventory. (#162)
* Added an option for quickly moving items (w/o dialog box) in inventory.

* An separate option is added to set the counter of maximum number of items when moving items.
2018-06-06 06:23:07 +08:00
NovaRain ea1c00ec91 Added the ability to define allowed weapon animations for NPCs to NPC armor appearance mod (#159) 2018-06-05 22:08:39 +08:00
NovaRain 410c7ab417 Minor edits to documents. 2018-06-04 21:21:32 +08:00
VladandNovaRain ab3ddc68b6 Retarget project to use VS2017 build tools, fix deprecation warnings (#161) 2018-06-03 16:35:08 +08:00
NovaRain 1652072391 Fixed a bug that critters killed in combat by scripting still being able to move in their combat turn if the distance parameter in their AI packages is set to stay_close/charge, or NPCsTryToSpendExtraAP is enabled (from Mr.Stalin) 2018-06-02 18:15:53 +08:00
NovaRain 051b1c98aa Edited the added comments in AnimationsAtOnceLimit.cpp.
Renamed obj_move_hack to object_move_hack because it hooks on object_move_ engine function.
2018-06-01 23:36:56 +08:00
Mr.StalinandNovaRain 56945c7437 Fixed crash game when playing animation when the critter/pc goes through the door. Refactoring code. (#158) 2018-06-01 23:30:37 +08:00
NovaRain 2f6f0d8b28 Added the description of new metarule2_explosions mode to function notes.txt.
Fixed a typo in metarule2_explosions error message.
2018-05-30 21:07:51 +08:00
Mr.StalinandNovaRain 0e715236bf Added an additional mode to the function 'metarule2_explosions', sets a constant radius of the explosion grenades and rockets. (#146) 2018-05-30 21:02:35 +08:00
NovaRain b24a860d40 Renamed WorldMapFont to WorldMapFontPatch and changed its description in ddraw.ini. 2018-05-30 09:27:58 +08:00
NovaRain 120a8cd964 Added WorldMapFont option to use Fallout font on the world map instead of system font. (#48) 2018-05-29 16:22:58 +08:00
Mr.StalinandNovaRain 62d4577152 Adding to the function get_mouse_buttons the return of pressing the middle mouse button (#114). (#157)
Change the type of argument checking for the len_array function to remove an unwanted error message (# 128).
2018-05-29 09:29:11 +08:00
NovaRain 2d8ea2b44c Added description of HOOK_GAMEMODECHANGE to hookscripts.txt.
Fixed the line break for debug.log message of GameReset.
Minor edits to Tiles.cpp code format.
2018-05-28 23:37:45 +08:00
Mr.StalinandNovaRain 4ef20c3526 Added new hook for function get_game_mode, when the game mode changes. (#86) (#153) 2018-05-28 23:32:14 +08:00
NovaRain 5e0e8dd2f1 Added MoreTiles option to ddraw.ini.
Changed MoreTiles to work independently of HRP 4.1.8 and removed the redundant define.
Added sfall log messages to both options in Tiles.cpp.
Implemented HookCalls in TimeLimitPatch().
Fixed a minor typo in function notes.txt.
2018-05-28 09:27:53 +08:00
Mr.StalinandNovaRain 04bd88cdc2 Added MoreTiles option to increase the limit of FRM images for tiles from 4096 to 16383 (from Crafty) (#156) 2018-05-28 09:18:55 +08:00
NovaRain 839e86ed26 Added the description and setting for the previous commit to ddraw.ini.
Improved DisablePipboyAlarm so that when the player press Z key they won't see a blank Pipboy screen.
2018-05-27 15:08:46 +08:00
Mr.StalinandNovaRain eeef8759d3 Display statistics of the weapon's range for the second attack mode in player inventory. (#154) 2018-05-27 14:48:09 +08:00
NovaRain c4903abd4c Added the description of set_iface_tag_text to notes.txt.
Fixed compilation error in BarBoxes.cpp.
Updated version number.
2018-05-21 10:51:12 +08:00
Mr.StalinandNovaRain e0c0b9ba19 Added function 'set_iface_tag_text' - sets custom text and color to bar boxes. (#152) 2018-05-21 10:41:59 +08:00
NovaRain b9c7f5ea82 Fixed commit 470a0b3386. 2018-05-15 20:20:07 +08:00
NovaRain 56fdec8b37 Reverted the previous changes of ASM code due to the bug that AppChCrt.frm overwrites AppChEdt.frm. 2018-05-14 21:14:50 +08:00
NovaRain 470a0b3386 Simplified the code from previous commit. 2018-05-14 20:52:26 +08:00
NovaRain 279c524da9 Added support for adding custom background image to the character creation/screen of the hero appearance mod (From Mr.Stalin)
AppChCrt.frm (for the character creation) and AppChEdt.frm (for the character screen) should be in art/intrface, and the image size must be 640x480.
2018-05-14 10:05:49 +08:00
42 changed files with 994 additions and 398 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
[sfall]
SaveInCombat=Cannot save at this time
SaveInCombat=Cannot save at this time.
KarmaGain=You gained %d karma.
KarmaLoss=You lost %d karma.
HighlightFail1=You aren't carrying a motion sensor.
+6
View File
@@ -19,6 +19,7 @@ Robe=16777218
; Sulik
[1]
PID=16777313
WeaponAnims=1,3,4,6
Default=16777280
Leather=16777325
Power=16777324
@@ -29,6 +30,7 @@ Combat=16777322
; Vic
[2]
PID=16777278
WeaponAnims=1,5,7
Default=16777307
Jacket=16777329
Combat=16777330
@@ -39,6 +41,7 @@ Leather=16777333
; Cassidy
[3]
PID=16777305
WeaponAnims=4,5,7
Default=16777354
Leather=16777260
Power=16777328
@@ -49,6 +52,7 @@ Combat=16777326
; Myron
[4]
PID=16777376
WeaponAnims=1,5
Default=16777304
Leather=
Power=16777349
@@ -57,6 +61,7 @@ Combat=16777350
; Cat Jules
[5]
PID=16777734
WeaponAnims=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Default=16777353
Leather=16777347
Metal=16777348
@@ -66,6 +71,7 @@ Combat=16777226
; Kitsune
[6]
PID=16777724
WeaponAnims=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Default=16777222
Leather=16777221
Metal=16777223
+25 -7
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v4.0.4
;v4.0.5
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -107,7 +107,7 @@ SpeedModKey=-1
;A key to press to toggle the speed tweak on or off
;Specify 0 if you don't want a toggle key, or a DX scancode otherwise
SpeedToggleKey=0x00
SpeedToggleKey=0
;The keys corresponding to the 10 speed slots
;Set to 0 to disable a slot, otherwise specify the DX scancode of the key you want to use
@@ -128,9 +128,15 @@ SpeedKey9=0x00
WindowScrollKey=0
;A key to press to reload your currently equipped weapon
;Set to 0 if you don't want a reload key, or a DX scancode otherwise
ReloadWeaponKey=0
;A key to press to open a debug game editor
;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
;A key to press to open a debug game editor (requires FalloutClient.exe from the modders pack)
;Set to 0 to disable, or a DX scancode otherwise
DebugEditorKey=0
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@@ -164,7 +170,7 @@ WorldMapEncounterRate=5
;The number of slots available in the locations list panel of the world map
;Set to 0 to leave unchanged. 17 is default.
;Setting this greater than 17 requires a replacement background frm, or you'll get glitched graphics
;Setting this greater than 17 requires a replacement background FRM, or you'll get glitched graphics
WorldMapSlots=0
;To start a new game somewhere other than artemple.map, uncomment the next line and set it to the map you want to load
@@ -288,7 +294,7 @@ SaveInCombatFix=1
;Player's level is capped once the highest specified level is reached
;XPTable=50,100,200
;Set to 1 to enable additional weapon animations codes from o-t
;Set to 1 to enable additional weapon animation codes from o-t
;The 4 byte value at 0x39 of weapon protos may range from 0 to 15 rather than 0 to 10
;Since the letters 'n' and 'r' are in use for other animations, an animation code of 11 corrisponds to 's' and 15 to 't'
AdditionalWeaponAnims=1
@@ -344,7 +350,10 @@ NPCsTryToSpendExtraAP=0
;Set to 2 if you provide a XLtiles.lst file in art/tiles/ containing a list of the tile ids that need checking
AllowLargeTiles=0
;Change the Skilldex cursor frm numbers
;Set to 1 to boost the maximum number of tile FRMs from 4096 to 16383
MoreTiles=0
;Change the Skilldex cursor FRM numbers
;Default is 293 for all skills
Lockpick=293
Steal=293
@@ -379,7 +388,7 @@ ExtraSaveSlots=0
;Set to 2 to update the HP/AC counters instantly
SpeedInterfaceCounterAnims=0
;These lines allow you to control the karma frm's displayed on the character screen
;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
;KarmaFRMs=47,48,49
;KarmaPoints=-100,100
@@ -401,6 +410,9 @@ 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
@@ -523,6 +535,9 @@ 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 at the maximum number of items
ItemCounterDefaultMax=0
;Allows 9 options (lines of text) to be displayed correctly in a dialog window
DialogOptions9Lines=1
@@ -548,6 +563,9 @@ InstantWeaponEquip=0
;Set to 1 to display numbered dialogue options
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 sfall built-in credits at the bottom of credits.txt contents instead of at the top
CreditsAtBottom=0
Binary file not shown.
+44 -4
View File
@@ -4,18 +4,19 @@
Used to replace the scripted part of B-Team mod.
Appropriate graphics are required for this mod to work.
Can be adopted to any mod by adjusting armor PIDs, NPC PIDs and NPC FIDs in INI file.
Can be adopted to any mod by adjusting armor PIDs, allowed weapon anim codes, NPC PIDs and NPC FIDs in INI file.
NOTE: this script requires compiler from sfall modderspack with -s option
(short circuit evaluation)
version 1.0
version 1.1
*/
#include "main.h"
#define IS_ARMOR(item) (obj_type(item) == OBJ_TYPE_ITEM and obj_item_subtype(item) == item_type_armor)
#define IS_WEAPON(item) (obj_type(item) == OBJ_TYPE_ITEM and obj_item_subtype(item) == item_type_weapon)
variable
modIni := "npcarmor.ini",
@@ -41,9 +42,28 @@ procedure check_armor_change(variable critter, variable item, variable isWorn) b
return -1;
end
// for NPCs when they change armor themselves
procedure check_weapon_change(variable critter, variable item, variable isWield) begin
variable npc, newWeaponAnim, weaponAnimList, i;
if (npcMap[obj_pid(critter)]) then begin
npc := npcMap[obj_pid(critter)];
if isWield then begin
newWeaponAnim := get_proto_data(obj_pid(item), PROTO_WP_ANIM);
weaponAnimList := string_split(npc["WeaponAnims"], ",");
if newWeaponAnim then begin
foreach (i in weaponAnimList) begin
if (newWeaponAnim == atoi(i)) then return -1;
end
end else begin // anim code 0 - none/unarmed
return -1;
end
end
end
return 0;
end
// for NPCs when they change armor/weapon themselves
procedure invenwield_handler begin
variable critter, item, fid, slot, isWorn;
variable critter, item, fid, slot, isWorn, canWield;
critter := get_sfall_arg;
item := get_sfall_arg;
slot := get_sfall_arg;
@@ -55,6 +75,11 @@ procedure invenwield_handler begin
art_change_fid_num(critter, fid);
end
end
if (critter and item and (slot == INVEN_TYPE_RIGHT_HAND or slot == INVEN_TYPE_LEFT_HAND)) then begin
canWield := check_weapon_change(critter, item, isWorn);
set_sfall_return(canWield);
end
end
// when changing armor from inventory while controlling other NPCs
@@ -69,12 +94,26 @@ procedure adjustfid_handler begin
end
end
// when changing weapon from inventory while controlling other NPCs
procedure inventorymove_handler begin
variable slot, item, canWield;
slot := get_sfall_arg;
item := get_sfall_arg;
if (dude_obj != real_dude_obj) then begin
if (IS_WEAPON(item) and (slot == INVEN_TYPE_RIGHT_HAND or slot == INVEN_TYPE_LEFT_HAND)) then begin
canWield := check_weapon_change(dude_obj, item, item != 0);
set_sfall_return(canWield);
end
end
end
procedure start begin
variable sect, sects, armorTypes, armorType, npc, pid, pids, i;
if game_loaded and (sfall_ver_major >= 4) then begin
register_hook_proc(HOOK_INVENWIELD, invenwield_handler);
register_hook_proc(HOOK_ADJUSTFID, adjustfid_handler);
register_hook_proc(HOOK_INVENTORYMOVE, inventorymove_handler);
defaultFids := get_ini_section(modIni, "Default");
fix_array(defaultFids);
@@ -97,6 +136,7 @@ procedure start begin
sect := get_ini_section(modIni, ""+i);
while (sect.PID) do begin
npc := create_array_map;
npc["WeaponAnims"] := sect["WeaponAnims"];
npc["Default"] := atoi(sect["Default"]);
foreach (armorType: pids in armorTypes) begin
if (sect[armorType]) then begin
+3
View File
@@ -51,6 +51,7 @@
#define HOOK_CARTRAVEL (28)
#define HOOK_SETGLOBALVAR (29)
#define HOOK_RESTTIMER (30)
#define HOOK_GAMEMODECHANGE (31)
//Valid arguments to list_begin
#define LIST_CRITTERS (0)
@@ -138,6 +139,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)
@@ -240,6 +242,7 @@
#define set_cursor_mode(mode) sfall_func1("set_cursor_mode", mode)
#define set_dude_obj(critter) sfall_func1("set_dude_obj", critter)
#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_outline(obj, color) sfall_func2("set_outline", obj, color)
+13 -5
View File
@@ -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.
@@ -312,7 +312,7 @@ int arg2 - The default max damage
Item arg3 - The weapon used. (0 if unarmed)
Critter arg4 - The critter doing the attacking
int arg5 - The type of attack
int arg6 - non zero if this is an attack using a melee weapon
int arg6 - non-zero if this is an attack using a melee weapon
int ret1 - Either the damage to be used, if ret2 isn't given, or the new minimum damage if it is
int ret2 - The new maximum damage
@@ -416,9 +416,9 @@ What you can do:
- add AP costs for all inventory movement including reloading
- apply or remove some special scripted effects depending on PC's armor
int arg1 - Target slot (0 - main backpack, 1 - left hand, 2 - right hand, 3 - armor slot, 4 - weapon, when reloading it by dropping ammo)
int arg1 - Target slot (0 - main backpack, 1 - left hand, 2 - right hand, 3 - armor slot, 4 - weapon, when reloading it by dropping ammo, 5 - container, like bag/backpack, 6 - dropping on the ground)
Item arg2 - Item being moved
Item arg3 - Item being replaced or weapon being reloaded (can be 0)
Item arg3 - Item being replaced, weapon being reloaded, or container being filled (can be 0)
int ret1 - Override setting (-1 - use engine handler, any other value - prevent relocation of item/reloading weapon)
@@ -432,7 +432,7 @@ NOTE: when replacing a previously wielded armor or weapon, the unwielding hook w
If you need to rely on this, try checking if armor/weapon already equipped when wielding hook is executed.
Critter arg1 - critter
Obj arg2 - item being wielded or unwielded (weapon/armor), may be 0 when unwielding
Obj arg2 - item being wielded or unwielded (weapon/armor)
int arg3 - slot (INVEN_TYPE_*)
int arg4 - 1 when wielding, 0 when unwielding
@@ -498,3 +498,11 @@ int arg3 - the hour part of the length of resting time
int arg4 - the minute part of the length of resting time
int ret1 - pass 1 to interrupt the resting
-------------------------------------------
HOOK_GAMEMODECHANGE (hs_gamemodechange.int)
Runs once every time when the game mode was changed, like opening/closing the inventory, character screen, pipboy, etc.
int arg1 - event type: 1 - when the player exits the game, 0 - otherwise
+14 -4
View File
@@ -50,7 +50,7 @@ has_fake_trait and has_fake_perk return the number of levels the player has of t
perk_add_mode, set_selectable_perk, set_perkbox_title, hide_real_perks, show_real_perks and clear_selectable_perks control the behaviour of the select a perk box. set_selectable_perk can be used to add additional items by setting the 'active' parameter to 1, and to remove them again by setting it to 0. set_perkbox_title can be used to change the title of the box, or by using "" it will be set back to the default. hide and show_real_perks can be used to prevent the dialog from displaying any of the original 119 perks. perk_add_mode modifies what happens when a fake perk is selected from the perks dialog. It is treated as a set of flags - if bit 1 is set then it is added to the players traits, if bit 2 is set it is added to the players perks, and if bit 3 is set it is removed from the list of selectable perks. The default is 0x2. clear_selectable_perks restores the dialog to it's default state.
show_iface_tag, hide_iface_tag and is_iface_tag_active relate to the boxes that appear above the interface such as SNEAK and LEVEL. You can use 3 for LEVEL and 4 for ADDICT, or the range from 5 to 9 for custom boxes. Remember to add your messages to intrface.msg and setup 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.
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.
@@ -72,7 +72,7 @@ arrays are created and manipulated with the xxx_array functions. An array must f
NOTE: the above description only applies when "arraysBehavior" is set to 0 in ddraw.ini. Refer to "arrays.txt" for detailed description of new arrays behavior.
force_aimed_shots and disable_aimed_shots allow overriding the normal rules regarding which weapons are allowed to make aimed attacks. (e.g. weapons that cause explosive damage normally cannot normally make aimed shots.) force_aimed_shots will allow a weapon to make aimed shots even if it normally couldn't, and disable_aimed_shots stops a weapon from making aimed shots even if it normally could. Both of these functions affect player and npcs alike. force_aimed_shots does not override the effects of the fast shot trait. The list of edited weapons is not saved over game loads, so you need to call the functions once at each reload. Use a pid of 0 to represent unarmed.
force_aimed_shots and disable_aimed_shots allow overriding the normal rules regarding which weapons are allowed to make aimed attacks. (e.g. weapons that cause explosive damage normally cannot normally make aimed shots.) force_aimed_shots will allow a weapon to make aimed shots even if it normally couldn't, and disable_aimed_shots stops a weapon from making aimed shots even if it normally could. Both of these functions affect player and NPCs alike. force_aimed_shots does not override the effects of the fast shot trait. The list of edited weapons is not saved over game loads, so you need to call the functions once at each reload. Use a pid of 0 to represent unarmed.
get/set_critter_skill_points will get/set the number of additional points a critter has in a skill, on top of whatever they have from their stats and other bonuses. Note that skill points are part of the proto, so calling set_skill_points on a critter will affect all critters that share the same proto.
@@ -101,10 +101,10 @@ array - array ID to be used with array-related functions (actually an integer)
- 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.
> 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.
- 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.
> int get_npc_level(string npc)
- also takes the npc name as an argument, and returns the npc's current level. Again, the npc needs to be in your party.
- also takes the NPC name as an argument, and returns the NPC's current level. Again, the NPC needs to be in your party.
> void set_car_current_town(int town)
- changes the current town index for the player's car
@@ -231,6 +231,10 @@ was made as a dirty easy hack to allow dynamically change some explosion paramet
> 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.
> 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:
@@ -476,6 +480,12 @@ 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 9 (custom boxes)
- The text is limited to 19 characters
- available colors: 0 - green, 1 - red, 2 - white, 3 - yellow, 4 - dark yellow, 5 - blue, 6 - purple
------------------------
------ MORE INFO -------
------------------------
+18
View File
@@ -74,7 +74,25 @@ void SkillSetTags(long* tags, long num) {
fo::func::skill_set_tags(tags, num);
}
int _fastcall GetItemType(GameObject* item) {
return fo::func::item_get_type(item);
}
_declspec(noinline) GameObject* GetItemPtrSlot(GameObject* critter, InvenType slot) {
GameObject* itemPtr = 0;
switch (slot) {
case fo::INVEN_TYPE_LEFT_HAND :
itemPtr = fo::func::inven_left_hand(critter);
break;
case fo::INVEN_TYPE_RIGHT_HAND :
itemPtr = fo::func::inven_right_hand(critter);
break;
case fo::INVEN_TYPE_WORN :
itemPtr = fo::func::inven_worn(critter);
break;
}
return itemPtr;
}
//---------------------------------------------------------
//print text to surface
+4
View File
@@ -50,6 +50,10 @@ void SkillGetTags(long* result, long num);
// wrapper for skill_set_tags with bounds checking
void SkillSetTags(long* tags, long num);
int _fastcall GetItemType(GameObject* item);
_declspec(noinline) GameObject* GetItemPtrSlot(GameObject* critter, InvenType slot);
// Print text to surface
void PrintText(char *displayText, BYTE colorIndex, DWORD x, DWORD y, DWORD textWidth, DWORD destWidth, BYTE *surface);
// gets the height of the currently selected font
+10 -2
View File
@@ -420,8 +420,8 @@ enum Trait : long
enum class ScenerySubType : long
{
DOOR = 0,
STAIRS = 1,
ELEVATOR = 2,
STAIRS = 1,
ELEVATOR = 2,
LADDER_BOTTOM = 3,
LADDER_TOP = 4,
GENERIC = 5
@@ -579,6 +579,14 @@ enum ItemType : long
item_type_key = 6,
};
// Inventory Equates
enum InvenType : long
{
INVEN_TYPE_WORN = 0,
INVEN_TYPE_RIGHT_HAND = 1,
INVEN_TYPE_LEFT_HAND = 2,
};
#define OBJFLAG_CAN_WEAR_ITEMS (0xf000000)
#define OBJFLAG_HELD_IN_RIGHT (0x10000)
+1
View File
@@ -30,6 +30,7 @@ WRAP_WATCOM_FUNC3(long, db_freadShortCount, DbFile*, file, WORD*, dest, long, co
WRAP_WATCOM_FUNC3(long, db_freadIntCount, DbFile*, file, DWORD*, dest, long, count)
WRAP_WATCOM_FUNC2(long, db_fwriteByte, DbFile*, file, long, value)
WRAP_WATCOM_FUNC2(long, db_fwriteInt, DbFile*, file, long, value)
WRAP_WATCOM_FUNC0(void, display_stats)
// perform combat turn for a given critter
WRAP_WATCOM_FUNC2(long, combat_turn, GameObject*, critter, long, isDudeTurn)
WRAP_WATCOM_FUNC1(long, critter_is_dead, GameObject*, critter)
+5
View File
@@ -14,6 +14,7 @@
#define FO_VAR_art_vault_person_nums 0x5108A8
#define FO_VAR_bckgnd 0x5707A4
#define FO_VAR_black_palette 0x663FD0
#define FO_VAR_BlueColor 0x6A38EF
#define FO_VAR_bottom_line 0x664524
#define FO_VAR_btable 0x59E944
#define FO_VAR_btncnt 0x43EA1C
@@ -61,6 +62,7 @@
#define FO_VAR_glblmode 0x5709D0
#define FO_VAR_gmouse_current_cursor 0x518C0C
#define FO_VAR_gmovie_played_list 0x596C78
#define FO_VAR_GoodColor 0x6AB4EF
#define FO_VAR_GreenColor 0x6A3CB0
#define FO_VAR_gsound_initialized 0x518E30
#define FO_VAR_hit_location_penalty 0x510954
@@ -136,6 +138,7 @@
#define FO_VAR_pc_proto 0x51C370
#define FO_VAR_pc_trait 0x66BE40
#define FO_VAR_pc_trait2 0x66BE44
#define FO_VAR_PeanutButter 0x6A82F3
#define FO_VAR_perk_data 0x519DCC
#define FO_VAR_perkLevelDataList 0x51C120
#define FO_VAR_pip_win 0x6644C4
@@ -153,6 +156,7 @@
#define FO_VAR_RedColor 0x6AB4D0
#define FO_VAR_retvals 0x43EA7C
#define FO_VAR_rotation 0x631D34
#define FO_VAR_sad 0x530014
#define FO_VAR_script_path_base 0x51C710
#define FO_VAR_scr_size 0x6AC9F0
#define FO_VAR_scriptListInfo 0x51C7C8
@@ -187,6 +191,7 @@
#define FO_VAR_trait_data 0x51DB84
#define FO_VAR_view_page 0x664520
#define FO_VAR_wd_obj 0x59E98C
#define FO_VAR_WhiteColor 0x6AB8CF
#define FO_VAR_wmAreaInfoList 0x51DDF8
#define FO_VAR_wmLastRndTime 0x51DEA0
#define FO_VAR_wmWorldOffsetX 0x51DE2C
+4
View File
@@ -12,6 +12,7 @@ VAR_(art_vault_guy_num, DWORD)
VAR_(art_vault_person_nums, DWORD)
VAR_(bckgnd, BYTE*)
VAR_(black_palette, DWORD)
VAR_(BlueColor, BYTE)
VAR_(bottom_line, DWORD)
VAR_(btable, DWORD)
VAR_(btncnt, DWORD)
@@ -58,6 +59,7 @@ VAR_(gIsSteal, DWORD)
VAR_(glblmode, DWORD)
VAR_(gmouse_current_cursor, long)
VARA(gmovie_played_list, BYTE, 17)
VAR_(GoodColor, BYTE)
VAR_(GreenColor, BYTE)
VAR_(gsound_initialized, DWORD)
VARA(hit_location_penalty, long, 9)
@@ -131,6 +133,7 @@ VAR_(pc_kill_counts, DWORD)
VARA(pc_name, char, 32)
VAR_(pc_proto, Proto)
VARA(pc_trait, long, 2) // 2 of them
VAR_(PeanutButter, BYTE)
VARA(perk_data, PerkInfo, PERK_count)
VAR_(perkLevelDataList, long*) // dynamic array, limited to PERK_Count
VAR_(pip_win, DWORD)
@@ -182,6 +185,7 @@ VAR_(title_font, DWORD)
VARA(trait_data, TraitInfo, TRAIT_count)
VAR_(view_page, DWORD)
VAR_(wd_obj, DWORD)
VAR_(WhiteColor, BYTE)
VAR_(wmAreaInfoList, DWORD)
VAR_(wmLastRndTime, DWORD)
VAR_(wmWorldOffsetX, DWORD)
+1 -1
View File
@@ -36,7 +36,7 @@ static DWORD wheelMod;
static bool reverseMouse;
static bool middleMouseDown;
bool middleMouseDown;
static DWORD middleMouseKey;
static bool backgroundKeyboard;
+1
View File
@@ -26,6 +26,7 @@ namespace sfall
{
extern bool useScrollWheel;
extern bool middleMouseDown;
void SetMDown(bool down, bool right);
void SetMPos(int x, int y);
+53 -13
View File
@@ -18,10 +18,11 @@
#include "..\main.h"
#include "..\FalloutEngine\Fallout2.h"
#include "LoadGameHook.h"
#include "AnimationsAtOnceLimit.h"
namespace sfall
namespace sfall
{
static constexpr int animRecordSize = sizeof(fo::AnimationSet);
@@ -33,7 +34,8 @@ static int animationLimit = 32;
static std::vector<fo::AnimationSet> new_anim_set;
static std::vector<BYTE> new_sad;
static DWORD animSetAddr, sadAddr;
static DWORD animSetAddr = FO_VAR_anim_set;
static DWORD sadAddr = FO_VAR_sad;
static const DWORD animPCMove[] = {
0x416E11, 0x416F64, 0x417143, 0x41725C, 0x4179CC,
@@ -151,24 +153,58 @@ static const DWORD sad_28[] = {
0x4173CE, 0x4174C1, 0x4175F1, 0x417730,
};
static DWORD __fastcall AnimCombatFix(DWORD* scr, BYTE combatFlag) {
DWORD animAddr = animSetAddr;
if (animationLimit > 32) {
animAddr += animRecordSize; // include a dummy
}
if (combatFlag & 2) { // combat flag is set
_asm call fo::funcoffs::combat_anim_finished_;
}
return animAddr;
}
static void __declspec(naked) anim_set_end_hack() {
__asm {
mov edi, FO_VAR_anim_set;
cmp dword ptr animationLimit, 32;
jle skip;
mov edi, animSetAddr;
add edi, animRecordSize; // Include a dummy
skip:
test dl, 0x2; // Is the combat flag set?
jz end; // No
call fo::funcoffs::combat_anim_finished_;
end:
mov [edi][esi], ebx;
call AnimCombatFix;
mov [eax][esi], ebx;
push 0x415DF2;
retn;
}
}
static DWORD __fastcall CheckSetSad(BYTE openFlag, DWORD valueMul) {
bool result = false;
int offset = (sadSize * valueMul) + 32;
if (*(DWORD*)(sadAddr + offset) == -1000) {
result = true;
} else if (!InCombat() && !(openFlag & 1)) {
*(DWORD*)(sadAddr + offset) = -1000;
result = true;
}
return result;
}
static void __declspec(naked) object_move_hack() {
__asm {
mov ecx, ds:[ecx + 0x3C]; // openFlag
mov edx, [esp + 0x4C - 0x20]; // valueMul
call CheckSetSad;
test eax, eax;
jz end;
push 0x417611; // fixed jump
retn;
end:
push 0x417616; // default
retn;
}
}
void ApplyAnimationsAtOncePatches(signed char aniMax) {
if (aniMax <= 32) return;
@@ -278,7 +314,11 @@ void AnimationsAtOnce::init() {
ApplyAnimationsAtOncePatches(animationLimit);
dlogr(" Done", DL_INIT);
}
// Fix for calling anim() functions in combat
MakeJump(0x415DE2, anim_set_end_hack);
// Fix crash when the critter goes through a door with animation trigger
MakeJump(0x41755E, object_move_hack);
}
void AnimationsAtOnce::exit() {
+142 -16
View File
@@ -18,14 +18,18 @@
#include "..\main.h"
#include "..\FalloutEngine\Fallout2.h"
#include "LoadGameHook.h"
#include "BarBoxes.h"
namespace sfall
namespace sfall
{
static const DWORD DisplayBoxesRet1 = 0x4615A8;
static const DWORD DisplayBoxesRet2 = 0x4615BE;
static const DWORD SetIndexBoxRet = 0x4612E8;
#define sSize (12)
struct sBox {
DWORD msg;
DWORD colour;
@@ -34,6 +38,21 @@ struct sBox {
static sBox boxes[10];
static DWORD boxesEnabled[5];
#define tSize (28)
struct tBox {
DWORD hasText;
DWORD color;
char text[tSize - 8];
};
static tBox boxText[5];
static DWORD clrBakup[5];
static bool setCustomBoxText;
static const DWORD bboxMemAddr[] = {
0x461266, 0x4612AC, 0x461374, 0x4613E8, 0x461479, 0x46148C, 0x4616BB,
};
static void __declspec(naked) DisplayBoxesHook() {
__asm {
mov ebx, 0;
@@ -56,39 +75,146 @@ fail:
}
}
static void __declspec(naked) BarBoxesTextHack() {
__asm {
//mov ecx, [esp + 0x440 - 0x1C];
push ecx; // ecx = BoxIndex
sub ecx, 5;
imul ecx, tSize;
cmp boxText[ecx], 1; // .hasText
jnz end;
// get color
mov ebx, boxText[ecx + 4]; // .color
// set text
lea eax, [boxText + ecx + 8]; // .text
// set color
pop ecx;
imul ecx, sSize;
cmp boxes[ecx + 4], 2; // .colour
jb skip;
mov [esp + 0x440 - 0x20], ebx; // Color
skip:
retn;
end:
add esp, 4;
jmp fo::funcoffs::getmsg_;
}
}
static void __declspec(naked) BarBoxesIndexHack() {
__asm {
mov eax, ds:[0x4612E2]; // fontnum
mov ecx, 5; // start index
mov edx, ecx;
jmp SetIndexBoxRet;
}
}
static void ReconstructBarBoxes() {
__asm {
call fo::funcoffs::refresh_box_bar_win_;
call fo::funcoffs::reset_box_bar_win_;
call fo::funcoffs::construct_box_bar_win_;
}
}
static void ResetBoxes() {
for (int i = 0; i < 5; i++) {
boxesEnabled[i] = 0;
boxes[i + 5].colour = clrBakup[i];
}
if (!setCustomBoxText) return;
//Restore boxes
SafeWrite32(0x461343, 0x00023D05); // call getmsg_
ReconstructBarBoxes();
SafeWrite8(0x461243, 0x31);
SafeWrite32(0x461244, 0x249489D2);
setCustomBoxText = false;
}
void BarBoxes::SetText(int box, const char* text, DWORD color) {
boxes[box].colour = color;
box -= 5;
boxText[box].hasText = 1;
strncpy_s(boxText[box].text, text, _TRUNCATE);
DWORD clr;
switch (color) {
case 2:
clr = fo::var::WhiteColor;
break;
case 3:
clr = fo::var::YellowColor;
break;
case 4:
clr = fo::var::PeanutButter;
break;
case 5:
clr = fo::var::BlueColor;
break;
case 6:
clr = fo::var::GoodColor;
break;
default:
clr = fo::var::GreenColor;
}
boxText[box].color = clr;
int enabled[5];
for (int i = 0; i < 5; i++) {
enabled[i] = boxesEnabled[i];
boxesEnabled[i] = 0;
}
if (!setCustomBoxText) {
MakeCall(0x461342, BarBoxesTextHack);
MakeJump(0x461243, BarBoxesIndexHack);
setCustomBoxText = true;
}
ReconstructBarBoxes();
for (int i = 0; i < 5; i++) {
boxesEnabled[i] = enabled[i];
}
__asm call fo::funcoffs::refresh_box_bar_win_;
}
void BarBoxes::init() {
SafeWrite32(0x461266, (DWORD)boxes + 8);
SafeWrite32(0x4612AC, (DWORD)boxes + 8);
SafeWrite32(0x4612FE, (DWORD)boxes + 4);
SafeWrite32(0x46133C, (DWORD)boxes + 0);
SafeWrite32(0x461374, (DWORD)boxes + 8);
SafeWrite32(0x4613E8, (DWORD)boxes + 8);
SafeWriteBatch<DWORD>((DWORD)boxes + 8, bboxMemAddr); //.mem
SafeWrite32(0x4612FE, (DWORD)boxes + 4); //.colour
SafeWrite32(0x46133C, (DWORD)boxes); //.msg
SafeWrite32(0x461479, (DWORD)boxes + 8);
SafeWrite32(0x46148C, (DWORD)boxes + 8);
SafeWrite32(0x4616BB, (DWORD)boxes + 8);
memset(boxes, 0, 12 * 10);
int size = sSize * 10;
memset(boxes, 0, size);
memset(boxesEnabled, 0, 5 * 4);
memcpy(boxes, (void*)0x518FE8, 12 * 5);
memcpy(boxes, (void*)0x518FE8, sSize * 5);
for (int i = 5; i < 10; i++) {
boxes[i].msg = 0x69 + i - 5;
boxes[i].msg = 100 + i;
}
SafeWrite8(0x46127C, 10);
SafeWrite8(0x46140B, 10);
SafeWrite8(0x461495, 0x78);
SafeWrite8(0x461495, size);
MakeJump(0x4615A3, DisplayBoxesHook);
auto boxBarColors = GetConfigString("Misc", "BoxBarColours", "", 6);
if (boxBarColors.size() == 5) {
if (boxBarColors.size() >= 5) {
for (int i = 0; i < 5; i++) {
if (boxBarColors[i] == '1') {
boxes[i + 5].colour = 1;
clrBakup[i] = 1;
} else {
clrBakup[i] = 0;
}
}
}
LoadGameHook::OnGameReset() += ResetBoxes;
}
int _stdcall GetBox(int i) {
+2
View File
@@ -7,6 +7,8 @@ class BarBoxes : public Module {
public:
const char* name() { return "BarBoxes"; }
void init();
static void SetText(int box, const char* text, DWORD color);
};
int _stdcall GetBox(int i);
+16
View File
@@ -1109,6 +1109,18 @@ map_leave:
}
}
static void __declspec(naked) ai_move_steps_closer_hook() {
__asm {
call fo::funcoffs::combat_turn_run_;
movzx dx, word ptr [esi + 0x44]; // combat_data.results
test dx, DAM_DEAD or DAM_KNOCKED_OUT or DAM_LOSE_TURN;
jz end;
mov [esi + 0x40], 0; // pobj.curr_mp (source reset ap)
end:
retn;
}
}
void BugFixes::init()
{
@@ -1420,6 +1432,10 @@ void BugFixes::init()
// Fix for being at incorrect hex after map change when the exit hex in source map is at the same position as
// some exit hex in destination map
MakeCall(0x48A704, obj_move_to_tile_hack);
// Fix for critters killed in combat by scripting still being able to move in their combat turn if the distance parameter
// in their AI packages is set to stay_close/charge, or NPCsTryToSpendExtraAP is enabled
HookCall(0x42A1A8, ai_move_steps_closer_hook); // 0x42B24D
}
}

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