Merge branch 'develop'

This commit is contained in:
NovaRain
2019-11-05 09:28:03 +08:00
102 changed files with 4164 additions and 1787 deletions
+9
View File
@@ -27,6 +27,10 @@ WeaponAccurateBonus=20
WeaponHandlingBonus=3
;##############################################################################
[Perks]
;Set to 1 to enable the modifications for perks
Enable=0
;Name=The name of the perk (max 63 characters)
;Desc=The description of the perk (max 255 characters)
;Image=The line number (0-indexed) of the corresponding FRM in skilldex.lst
@@ -119,6 +123,11 @@ Skill4Mod=0
Skill5=-1
Skill5Mod=0
;##############################################################################
[Traits]
;Set to 1 to enable the modifications for traits
Enable=0
;This is a modification to trait 0
[t0]
NoHardcode=0
@@ -0,0 +1,82 @@
;NPC armor appearance configuration for vanilla Fallout 2. Does not require any new graphics
;Party members will use player's armor appearance just like old B-Team mod
;WeaponAnims codes
; 1 - Knife (D)
; 2 - Club (E)
; 3 - Sledgehammer (F)
; 4 - Spear (G)
; 5 - Pistol (H)
; 6 - SMG (I)
; 7 - Rifle (J)
; 8 - Big Gun (K)
; 9 - Minigun (L)
; 10 - Rocket Launcher (M)
; 11-15 - sfall additional weapon animation codes
; This section maps 7 armor types to corresponding armor item PIDs
[ArmorTypes]
Jacket = 74,265
Leather = 1,379
Metal = 2,240,380
Power = 3,232
AdvPower = 348,349
Combat = 17,239,381
Robe = 113,524
; Default armor FIDs (the same for all NPCs)
[Default]
Jacket = 16777229
Leather = 16777228
Metal = 16777230
Combat = 16777226
Power = 16777217
AdvPower = 16777287
Robe = 16777218
; Sulik
[1]
PID=16777313
WeaponAnims=1,3,4,6
Default=16777280
; Vic
[2]
PID=16777278
WeaponAnims=1,5,7
Default=16777307
; Cassidy
[3]
PID=16777305
WeaponAnims=4,5,7
Default=16777260
Leather=16777260
; Myron
[4]
PID=16777376
WeaponAnims=1,5
Default=16777304
; Lenny
[5]
PID=16777323
WeaponAnims=1,5,6
Default=16777295
; Davin
[6]
PID=16777379
WeaponAnims=1,2,5
Default=16777264
; Miria
[7]
PID=16777380
WeaponAnims=1,6
Default=16777252
Jacket=16777222
Leather=16777221
Metal=16777223
Combat=16777219
+23 -25
View File
@@ -23,69 +23,67 @@ Robe = 113,524
; Default armor FIDs (the same for all NPCs)
[Default]
Power=16777217
AdvPower=16777287
Robe=16777218
Power = 16777217
AdvPower = 16777287
Robe = 16777218
; Sulik
[1]
PID=16777313
WeaponAnims=1,3,4,6
WeaponAnims=1,3,4,6,14
Default=16777280
Leather=16777325
Power=16777324
Metal=16777323
Jacket=16777321
Leather=16777325
Metal=16777323
Combat=16777322
Power=16777324
; Vic
[2]
PID=16777278
WeaponAnims=1,5,7
WeaponAnims=1,5,7,13,14
Default=16777307
Jacket=16777329
Combat=16777330
Metal=16777331
Power=16777332
Leather=16777333
Metal=16777331
Combat=16777330
Power=16777332
; Cassidy
[3]
PID=16777305
WeaponAnims=4,5,7
WeaponAnims=4,5,7,13
Default=16777354
Leather=16777260
Power=16777328
Metal=16777327
Jacket=16777351
Leather=16777260
Metal=16777327
Combat=16777326
Power=16777328
; Myron
[4]
PID=16777376
WeaponAnims=1,5
WeaponAnims=1,5,14
Default=16777304
Leather=
Power=16777349
Combat=16777350
Power=16777349
; Cat Jules
; Cat Jules (RP)
[5]
PID=16777734
PID=16777720
WeaponAnims=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Default=16777353
Jacket=16777346
Leather=16777347
Metal=16777348
Jacket=16777346
Combat=16777226
; Kitsune
; Kitsune (RP)
[6]
PID=16777724
PID=16777718
WeaponAnims=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Default=16777222
Jacket=16777222
Leather=16777221
Metal=16777223
Jacket=16777222
Combat=16777219
+17 -22
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v4.2
;v4.2.1
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -94,7 +94,7 @@ GPUBlt=0
Use32BitHeadGraphics=0
;Set to 1 to automatically search for alternative avi video files when Fallout tries to play the game movies
;Requires graphics mode 4 or 5
;Requires DX9 graphics mode 4 or 5
AllowDShowMovies=0
;Fade effect time percentage modifier
@@ -186,7 +186,7 @@ FastMoveFromContainer=0
;A key to press to open a debug game editor
;Set to 0 to disable, or a DX scancode otherwise
;Requires sfall debugging mode to be enabled and FalloutClient.exe from the modders pack
;Requires sfall debugging mode and FalloutClient.exe from the modders pack
DebugEditorKey=0
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@@ -384,9 +384,6 @@ AlwaysReloadMsgs=0
;Set to 1 to force the player to play the idle animation when reloading their weapon
PlayIdleAnimOnReload=0
;Set to 1 to prevent corpses from blocking line of fire
CorpseLineOfFireFix=1
;Changes the timer (in days) for deleting corpses on a map after you leave (valid range: 0..13)
;The corpses of critters with 'Ages' flag or on maps with 'dead_bodies_age=No' set in maps.txt will not disappear
;Default is 6. Set to 0 for a 12-hour timer
@@ -399,7 +396,7 @@ CorpseDeleteTime=6
ProcessorIdle=-1
;Set to 1 if using the hero appearance mod
;Set to 2 for backward compatibility with old scripts that manually fix obj_art_fid script function for dude_obj
;Set to 2 for backward compatibility with scripts that manually fix obj_art_fid/art_change_fid_num script functions for dude_obj
;You can add AppChCrt.frm and AppChEdt.frm files to art\intrface\ to set a custom background for the character screen
EnableHeroAppearanceMod=0
@@ -412,8 +409,9 @@ SkipOpeningMovies=0
;Set to 0 to disable
NPCsTryToSpendExtraAP=0
;Set to 1 to fix NPCs not checking weapon perks properly when searching for the best weapon
;Note that enabling this option can significantly affect the weapon choice of some NPCs in combat
;Set to 1 to fix NPCs not checking weapon perks properly when choosing the best weapon in combat
;Set to 2 to change the priority multiplier for having weapon perk to 3x (the original is 5x)
;Note that enabling this option can significantly affect the weapon of choice for some NPCs
AIBestWeaponFix=0
;Set to 1 to fix NPCs not taking chem_primary_desire in AI.txt as drug use preference when using drugs in their inventory
@@ -448,6 +446,7 @@ UseScrollingQuestsList=1
;Uncomment these lines to control the premade characters offered when starting a new game
;Multiple options should be separated by commas, and there must be the same number of entries in both lines
;Each name in PremadePaths is limited to 11 characters
;PremadePaths=combat,diplomat,stealth
;PremadeFIDs=201,203,202
@@ -508,9 +507,6 @@ AnimationsAtOnceLimit=120
;Set to 1 to remove the limits that stop the player rolling critical successes/misses in the first few days of game time
RemoveCriticalTimelimits=0
;Set to 1 to enable party members with level 6 protos to reach level 6
NPCStage6Fix=0
;Change the colour of the font used on the main menu for the Fallout/sfall version number and copyright text
;It's the last byte ('3C' by default) that picks the colour used. The first byte supplies additional flags for this option
;MainMenuFontColour=0x00003C
@@ -646,7 +642,7 @@ StackEmptyWeapons=0
;If the amount of ammo boxes in the inventory is less than or equal to the reserve, only one box will be used
ReloadReserve=-1
;Set to 1 to change the counter in the 'Move Items' window to start with maximum number except in the barter screen
;Set to 1 to change the counter in the 'Move Items' window to start with maximum number, except in the barter screen
ItemCounterDefaultMax=0
;Set to 1 to leave the music playing in dialogue with talking heads
@@ -748,8 +744,8 @@ GlobalScriptPaths=scripts\gl*.int,scripts\sfall\gl*.int
Enable=0
;Fallout 2 Debug Patch
;Set to 1 to send debug output to the screen, 2 to a debug.log file, or 3 to both the screen and a debug.log file
;Does not require enabling sfall debugging mode
;Set to 1 to send debug output to the screen, 2 to a debug.log file, or 3 to both the screen and debug.log
;Does not require sfall debugging mode
;While you don't need to create an environment variable, you do still need to set the appropriate lines in fallout2.cfg:
;-------
;[debug]
@@ -765,19 +761,18 @@ Enable=0
DebugMode=0
;Set to 1 to hide error messages in debug output when a null value is passed to the function as an object
;Requires DebugMode to be enabled
HideObjIsNullMsg=0
;Change to 1 to skip the compatibility mode check
SkipCompatModeCheck=0
;Set to 1 to skip the executable file size check
;Does not require enabling sfall debugging mode
;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 read-only protos at startup
@@ -785,20 +780,20 @@ SkipSizeCheck=0
DontDeleteProtos=0
;Set to 1 to give scripts direct access to Fallout's address space, and to make arbitrary calls into Fallout's code
;Does not require sfall debugging mode
AllowUnsafeScripting=0
;Set to 1 to force sfall to search for global scripts every time the game loads rather than only once on the first game start
AlwaysFindScripts=0
;Set to 1 to force sfall to inject all hooks code into the game, even if corresponding hook scripts don't exist
InjectAllGameHooks=0
;Set to 1 to force sfall to search for global scripts every time the game loads rather than only once on the first game start
AlwaysFindScripts=0
;Set to 1 to force critters to display combat float messages
;Requires AllowSoundForFloats to be enabled
Test_ForceFloats=0
;These options control what output is saved in the debug log (sfall-log.txt)
;Prints messages duing sfall initialization
Init=0
;Prints messages relating to hook scripts
Binary file not shown.
@@ -45,6 +45,7 @@ procedure start begin
tap_key(DIK_A);
tap_key(DIK_CAPITAL);
end else if (mode bwand BARTER) then begin
play_sfx("IB2P1XX1");
tap_key(DIK_M);
end
end
Binary file not shown.
Binary file not shown.
+78 -50
View File
@@ -15,9 +15,13 @@
#include "main.h"
#define IS_ARMOR(item) (obj_type(item) == OBJ_TYPE_ITEM and obj_item_subtype(item) == item_type_armor)
#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)
#define FID_OBJ_CRITTER (0x01000000)
procedure update_armor_apperance;
variable
modIni := "npcarmor.ini",
defaultFids,
@@ -26,44 +30,55 @@ variable
altWeapon,
unWieldWeapon;
procedure check_armor_change(variable critter, variable item, variable isWorn) begin
/*
Returns the FID value set in the config settings for party member armor: Jacket, Leather, etc.
*/
procedure check_armor_change(variable critter, variable armor, variable isWield) begin
variable npc, armorType, fid;
if (npcMap[obj_pid(critter)]) then begin
npc := npcMap[obj_pid(critter)];
if (not isWorn) then begin
npc := npcMap[obj_pid(critter)];
if (npc) then begin
if (isWield == false) then begin
// display_msg("No armor fid: " + npc["Default"]);
return npc["Default"];
end else if (item) then begin
armorType := armorPidMap[obj_pid(item)];
end else if (armor) then begin
armorType := armorPidMap[obj_pid(armor)];
fid := npc[armorType] or defaultFids[armorType];
if (fid == 0 or fid == -1) then fid := npc["Default"];
// display_msg("Change fid: " + fid + ", npc: " + npc[armorType] + ", default:" + defaultFids[armorType]);
return fid;
end
end
return -1;
return -1; // engine default
end
procedure check_weapon_change(variable critter, variable item, variable isWield) begin
/*
Checks if a party member can use the offered weapon
*/
procedure check_weapon_change(variable critter, variable weapon, 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"], ",");
npc := npcMap[obj_pid(critter)];
if (npc) then begin
if (isWield) then begin
newWeaponAnim := get_proto_data(obj_pid(weapon), PROTO_WP_ANIM);
if newWeaponAnim then begin // anim code 0 - none/unarmed
foreach (i in weaponAnimList) begin
if (newWeaponAnim == atoi(i)) then return -1;
weaponAnimList := npc["WeaponAnims"];
if (weaponAnimList != 0) then begin
foreach (i in string_split(weaponAnimList, ",")) begin
if (newWeaponAnim == atoi(i)) then return -1; // can use (engine default)
end
end
return 0;
return 0; // can't use
end
end else begin
unWieldWeapon := obj_pid(item);
unWieldWeapon := obj_pid(weapon);
end
end
return -1;
return -1; // engine default
end
/*
Finds the first weapon which can be used by the party member in the inventory
*/
procedure search_alt_weapon(variable critter) begin
variable obj, res, i := 0;
obj := inven_ptr(critter, 0);
@@ -87,48 +102,47 @@ end
// for NPCs when they change armor/weapon themselves
procedure invenwield_handler begin
variable critter, item, fid, slot, isWorn, canWield;
variable critter, item, fid, slot, isWield, canWield;
critter := get_sfall_arg;
item := get_sfall_arg;
slot := get_sfall_arg;
isWorn := get_sfall_arg;
item := get_sfall_arg;
slot := get_sfall_arg;
isWield := get_sfall_arg;
if (critter and item and slot == INVEN_TYPE_WORN) then begin
fid := check_armor_change(critter, item, isWorn);
if (/*critter and*/ item and slot == INVEN_TYPE_WORN) then begin
fid := check_armor_change(critter, item, isWield);
if (fid != -1) then begin
if art_exists(fid) then begin
art_change_fid_num(critter, fid);
end else begin
debug_msg("Error: NPC Armor mod: missing FID.");
debug_msg("[Error] NPC armor mod: Invenwield missing FID: " + fid);
end
end
return;
end
if (critter and item and slot == INVEN_TYPE_RIGHT_HAND) then begin
end else if (/*critter and*/ item and slot == INVEN_TYPE_RIGHT_HAND) then begin
if (altWeapon == item) then return;
canWield := check_weapon_change(critter, item, isWorn);
canWield := check_weapon_change(critter, item, isWield);
set_sfall_return(canWield);
if (canWield != -1) then begin
call search_alt_weapon(critter);
call search_alt_weapon(critter); // wield weapon by script
end
end
end
// when changing armor from inventory while controlling other NPCs
procedure adjustfid_handler begin
variable fid, armor;
variable fid, armor, weapAnim, currFid, newFid;
if (dude_obj != real_dude_obj) then begin
currFid := get_sfall_arg;
if ((currFid bwand 0x0F000000) != FID_OBJ_CRITTER) then return;
armor := critter_inven_obj(dude_obj, INVEN_TYPE_WORN);
fid := check_armor_change(dude_obj, armor, armor != 0);
if (fid != -1) then begin
variable weapAnim := get_sfall_arg bwand 0xF000;
variable newFid := fid bwand 0xFFFF0FFF bwor weapAnim;
weapAnim := currFid bwand 0xF000;
newFid := fid bwand 0xFFFF0FFF bwor weapAnim;
if art_exists(newFid) then begin
set_sfall_arg(0, newFid);
set_sfall_return(newFid);
end else begin
debug_msg("Error: NPC Armor mod: missing FID.");
debug_msg("[Error] NPC armor mod: Adjust FID missing: " + newFid);
end
end
end
@@ -140,29 +154,18 @@ procedure inventorymove_handler begin
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
if ((slot == INVEN_TYPE_RIGHT_HAND or slot == INVEN_TYPE_LEFT_HAND) and IS_WEAPON(item)) 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);
foreach (armorType: i in defaultFids) begin
defaultFids[armorType] := atoi(i);
end
armorPidMap := create_array_map;
armorTypes := get_ini_section(modIni, "ArmorTypes");
armorPidMap := create_array_map;
foreach (armorType: pids in armorTypes) begin
pids := string_split(pids, ",");
foreach (pid in pids) begin
@@ -170,6 +173,12 @@ procedure start begin
end
end
defaultFids := get_ini_section(modIni, "Default");
fix_array(defaultFids);
foreach (armorType: i in defaultFids) begin
defaultFids[armorType] := atoi(i);
end
npcMap := create_array_map;
i := 1;
@@ -188,7 +197,26 @@ procedure start begin
i += 1;
sect := get_ini_section(modIni, ""+i);
end
end
call update_armor_apperance;
register_hook_proc(HOOK_INVENWIELD, invenwield_handler);
register_hook_proc(HOOK_ADJUSTFID, adjustfid_handler);
register_hook_proc(HOOK_INVENTORYMOVE, inventorymove_handler);
debug_msg("NPC armor appearance mod: Done.");
end
end
procedure update_armor_apperance begin
variable npc, arItem, fid;
foreach (npc in party_member_list_critters) begin
if (npc == dude_obj) then continue;
arItem := critter_inven_obj(npc, INVEN_TYPE_WORN);
if (arItem) then begin
fid := check_armor_change(npc, arItem, true);
if (fid == -1 or art_exists(fid) == false) then continue;
art_change_fid_num(npc, fid);
end
end
end
Binary file not shown.
+10 -1
View File
@@ -38,7 +38,7 @@ procedure combatturn_handler begin
critter := get_sfall_arg,
pid, perkID, level;
//display_msg("Combat Turn: " + status + ", by " + obj_name(critter) + ", arg3: " + get_sfall_arg);
//display_msg("Combat Turn: " + status + ", by " + obj_name(critter) + "/" + critter + ", arg3: " + get_sfall_arg);
if npcControl then begin
if lightInt then lightInt := round((lightInt / 65536.0) * 100); // calc percent of intensity
obj_set_light_level(npcControl, lightInt, lightDist); // restore light for prev. controlled NPC
@@ -68,6 +68,8 @@ procedure combatturn_handler begin
npcControl := 0; // dude control
end
if inControl then begin
// check preference setting _combat_highlight
if (read_byte(0x56D38C)) then set_outline(critter, OUTLINE_GREY);
// center the screen on the controlled critter/dude and remove roof tiles
move_to(dude_obj, dude_tile, dude_elevation);
if (displayName and critter != real_dude_obj) then begin
@@ -77,6 +79,13 @@ procedure combatturn_handler begin
end
end
end else if inControl then begin
// remove perks before switching control (only work with 4.1.8+)
foreach (perkID in perksList) begin
level := has_trait(TRAIT_PERK, real_dude_obj, perkID);
if (level) then begin
critter_rm_trait(critter, TRAIT_PERK, perkID, level);
end
end
if isShowTag then begin
hide_iface_tag(displayName);
isShowTag := false;
+4 -2
View File
@@ -2,10 +2,12 @@
#include "..\scripting\headers\sfall.h"
#include "..\scripting\headers\define_lite.h"
#include "..\scripting\headers\define_extra.h"
#include "..\scripting\headers\dik.h"
/*
#include "..\scripting\headers\lib.arrays.h"
#include "..\scripting\headers\lib.strings.h"
// #include "..\scripting\headers\lib.inven.h"
#include "..\scripting\headers\lib.inven.h"
*/
variable ini := "sfall-mods.ini";
variable translationIni;
+2
View File
@@ -212,9 +212,11 @@ use macros sort_array, sort_array_reverse, reverse_array, shuffle_array from sfa
- always returns 0
> void save_array(mixed key, int arrayID):
- makes the array saveable; it will be saved in sfallgv.sav file when saving the game
- arrayID is associated with given "key"
- array becomes permanent (if it was temporary) and "saved"
- key can be of any type (int, float or string)
- if you specify 0 as the key for the array ID, it will make the array "unsaved"
> int load_array(mixed key):
- load array from savegame data by the same key provided in "save_array"
File diff suppressed because it is too large Load Diff
+5 -4
View File
@@ -120,7 +120,7 @@
#define RMOBJ_RM_MULT_OBJS 4563866
#define RMOBJ_REPLACE_WEAPON 4658526
#define RMOBJ_THROW 4266040
#define RMOBJ_SUB_CONTAINER 4683191 // search and remove the item from a container inside of an inventory
#define RMOBJ_SUB_CONTAINER 4683191 // search and remove the item from nested containers in the inventory
// common prototype offsets for get/set_proto_data
#define PROTO_PID (1)
@@ -385,10 +385,11 @@
#define OBJ_DATA_FID (0x20)
#define OBJ_DATA_ELEVATION (0x28)
#define OBJ_DATA_PID (0x64)
#define OBJ_DATA_CID (0x68) // combat id, used for savegame
#define OBJ_DATA_SID (0x78)
#define OBJ_DATA_CID (0x68) // combat ID, used for savegame
#define OBJ_DATA_SID (0x78) // script ID
#define OBJ_DATA_SCRIPT_INDEX (0x80) // script index number in scripts.lst
// items
#define OBJ_DATA_CUR_CHARGES (0x3C)
#define OBJ_DATA_CUR_CHARGES (0x3C) // for key items it's the key code
// critters
#define OBJ_DATA_COMBAT_STATE (0x3C) // flags: 1 - combat, 2 - target is out of range, 4 - flee
#define OBJ_DATA_CUR_ACTION_POINT (0x40)
+9 -5
View File
@@ -250,6 +250,7 @@
// sfall_funcX macros
#define add_extra_msg_file(name) sfall_func1("add_extra_msg_file", name)
#define add_iface_tag sfall_func0("add_iface_tag")
#define add_trait(traitId) sfall_func1("add_trait", traitId)
#define art_cache_clear sfall_func0("art_cache_clear")
#define attack_is_aimed sfall_func0("attack_is_aimed")
#define car_gas_amount sfall_func0("car_gas_amount")
@@ -259,8 +260,8 @@
#define dialog_message(text) sfall_func1("dialog_message", text)
#define dialog_obj sfall_func0("dialog_obj")
#define display_stats sfall_func0("display_stats")
#define draw_image(frmFile, frame, x, y, noTransparent) sfall_func5("draw_image", frmFile, frame, x, y, noTransparent)
#define draw_image_scaled(frmFile, frame, x, y, w, h) sfall_func6("draw_image_scaled", frmFile, frame, x, y, w, h)
#define draw_image(pathFile, frame, x, y, noTrans) sfall_func5("draw_image", pathFile, frame, x, y, noTrans)
#define draw_image_scaled(pathFile, frame, x, y, w, h) sfall_func6("draw_image_scaled", pathFile, frame, x, y, w, h)
#define exec_map_update_scripts sfall_func0("exec_map_update_scripts")
#define floor2(value) sfall_func1("floor2", value)
#define get_can_rest_on_map(map, elev) sfall_func2("get_can_rest_on_map", map, elev)
@@ -269,6 +270,7 @@
#define get_flags(obj) sfall_func1("get_flags", obj)
#define get_ini_section(file, sect) sfall_func2("get_ini_section", file, sect)
#define get_ini_sections(file) sfall_func1("get_ini_sections", file)
#define get_inven_ap_cost sfall_func0("get_inven_ap_cost")
#define get_map_enter_position sfall_func0("get_map_enter_position")
#define get_metarule_table sfall_func0("get_metarule_table")
#define get_object_ai_data(obj, aiParam) sfall_func2("get_object_ai_data", obj, aiParam)
@@ -296,8 +298,6 @@
#define set_cursor_mode(mode) sfall_func1("set_cursor_mode", mode)
#define set_drugs_data(type, pid, value) sfall_func3("set_drugs_data", type, pid, value)
#define set_dude_obj(critter) sfall_func1("set_dude_obj", critter)
#define set_fake_perk_npc(npc, perk, level, image, desc) sfall_func5("set_fake_perk_npc", npc, perk, level, image, desc)
#define set_fake_trait_npc(npc, trait, active, image, desc) sfall_func5("set_fake_trait_npc", npc, trait, active, image, desc)
#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)
@@ -306,10 +306,14 @@
#define set_outline(obj, color) sfall_func2("set_outline", obj, color)
#define set_rest_heal_time(time) sfall_func1("set_rest_heal_time", time)
#define set_rest_mode(mode) sfall_func1("set_rest_mode", mode)
#define set_selectable_perk_npc(npc, perk, active, image, desc) sfall_func5("set_selectable_perk_npc", npc, perk, active, image, desc)
#define set_unique_id(obj) sfall_func1("set_unique_id", obj)
#define unset_unique_id(obj) sfall_func2("set_unique_id", obj, -1)
#define set_unjam_locks_time(time) sfall_func1("set_unjam_locks_time", time)
#define 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)
#define unwield_slot(critter, slot) sfall_func2("unwield_slot", critter, slot)
#define set_fake_perk_npc(npc, perk, level, image, desc) sfall_func5("set_fake_perk_npc", npc, perk, level, image, desc)
#define set_fake_trait_npc(npc, trait, active, image, desc) sfall_func5("set_fake_trait_npc", npc, trait, active, image, desc)
#define set_selectable_perk_npc(npc, perk, active, image, desc) sfall_func5("set_selectable_perk_npc", npc, perk, active, image, desc)
+2 -1
View File
@@ -431,7 +431,7 @@ int ret1 - Override setting (-1 - use engine handler, any other value - prev
HOOK_INVENWIELD (hs_invenwield.int)
Runs before wielding or unwielding an armor or a weapon by a critter (except when using inventory by PC).
Runs before causing a critter or the player to wield/unwield an armor or a weapon (except when using the inventory by PC).
An example usage would be to change critter art depending on armor being used or to dynamically customize weapon animations.
NOTE: when replacing a previously wielded armor or weapon, the unwielding hook will not be executed.
If you need to rely on this, try checking if armor/weapon is already equipped when wielding hook is executed.
@@ -440,6 +440,7 @@ Critter arg1 - critter
Obj arg2 - item being wielded or unwielded (weapon/armor)
int arg3 - slot (INVEN_TYPE_*)
int arg4 - 1 when wielding, 0 when unwielding
int arg5 - 1 when removing an equipped item from inventory, 0 otherwise
int ret1 - overrides hard-coded handler (-1 - use engine handler, any other value - override) - NOT RECOMMENDED
@@ -622,6 +622,17 @@ optional argument:
- fileNumber: the file ID number for the message_str_game function. The available range is from 0x2000 to 0x2FFF (see ExtraGameMsgFileList setting in ddraw.ini)
use fileNumber only if you want to add a message file without editing ddraw.ini or existing scripts to support the old way
> void sfall_func2("unwield_slot", object critter, int slot)
- unequips an item from the specified slot for a critter or the player
- can take off player's equipped item when the inventory is opened, or the player is in the barter screen
- slot: 0 - armor slot, 1 - right slot, 2 - left slot (see INVEN_TYPE_* in define.h)
> void sfall_func1("add_trait", int traitId)
- adds the specified trait to the player
> int sfall_func0("get_inven_ap_cost")
- returns the current AP cost to access the inventory in combat
------------------------
------ MORE INFO -------
------------------------
Binary file not shown.
+13 -9
View File
@@ -19,9 +19,9 @@
#include <algorithm>
#include <stdio.h>
#include "..\main.h"
#include "..\Version.h"
#include "..\Logging.h"
#include "main.h"
#include "Version.h"
#include "Logging.h"
#include "CRC.h"
@@ -31,7 +31,7 @@ namespace sfall
static const DWORD ExpectedSize = 0x00122800;
static const DWORD ExpectedCRC[] = {0xe1680293, 0xef34f989};
static void inline Fail(const char* a) { MessageBoxA(0, a, "Error", MB_TASKMODAL); ExitProcess(1); }
static void inline Fail(const char* a) { MessageBoxA(0, a, "Error", MB_TASKMODAL | MB_ICONERROR); ExitProcess(1); }
static const DWORD CRC_table[256] = {
0x00000000, 0x0A5F4D75, 0x14BE9AEA, 0x1EE1D79F, 0x14C5EB57, 0x1E9AA622, 0x007B71BD, 0x0A243CC8,
@@ -79,16 +79,18 @@ static DWORD crcInternal(BYTE* data, DWORD size) {
void CRC(const char* filepath) {
char buf[512];
HANDLE h = CreateFileA(filepath, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
if (h == INVALID_HANDLE_VALUE) Fail("Cannot open fallout2.exe for CRC check");
if (h == INVALID_HANDLE_VALUE) Fail("Cannot open fallout2.exe for CRC check.");
DWORD size = GetFileSize(h, 0), crc;
bool sizeMatch = (size == ExpectedSize);
if (!sizeMatch && GetPrivateProfileIntA("Debugging", "SkipSizeCheck", 0, ::sfall::ddrawIni)) {
if (!sizeMatch && iniGetInt("Debugging", "SkipSizeCheck", 0, ::sfall::ddrawIni)) {
sizeMatch = true;
}
if (!sizeMatch) {
sprintf_s(buf, "You're trying to use sfall with an incompatible version of fallout\nWas expecting '" TARGETVERSION "'\n\nfallout2.exe was an unexpected size. Expected 0x%x but got 0x%x", ExpectedSize, size);
sprintf_s(buf, "You're trying to use sfall with an incompatible version of Fallout.\n"
"Was expecting '" TARGETVERSION "'.\n\n"
"fallout2.exe has an unexpected size. Expected %d bytes but got %d bytes.", ExpectedSize, size);
Fail(buf);
}
BYTE* bytes = new BYTE[size];
@@ -98,7 +100,7 @@ void CRC(const char* filepath) {
bool matchedCRC = false;
auto extraCrcList = GetIniList("Debugging", "ExtraCRC", "", 512, ',', ::sfall::ddrawIni);
if (extraCrcList.size() > 0) {
if (!extraCrcList.empty()) {
matchedCRC = std::any_of(extraCrcList.begin(), extraCrcList.end(), [crc](const std::string& testCrcStr) {
auto testedCrc = strtoul(testCrcStr.c_str(), 0, 16);
return testedCrc && crc == testedCrc;
@@ -109,7 +111,9 @@ void CRC(const char* filepath) {
if (crc == ExpectedCRC[i]) matchedCRC = true;
}
if (!matchedCRC) {
sprintf_s(buf, "You're trying to use sfall with an incompatible version of fallout\nWas expecting '" TARGETVERSION "'\n\nfallout2.exe had an unexpected crc. Expected 0x%x but got 0x%x", ExpectedCRC[0], crc);
sprintf_s(buf, "You're trying to use sfall with an incompatible version of Fallout.\n"
"Was expecting '" TARGETVERSION "'.\n\n"
"fallout2.exe has an unexpected CRC. Expected 0x%x but got 0x%x.", ExpectedCRC[0], crc);
Fail(buf);
}

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