Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
NovaRain committed Jun 12, 2018
2 parents 57c4c0b + e14ac89 commit 8c2483a
Show file tree
Hide file tree
Showing 42 changed files with 1,008 additions and 412 deletions.
2 changes: 1 addition & 1 deletion artifacts/config_files/Translations.ini
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 6 additions & 0 deletions artifacts/config_files/npcarmor.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Robe=16777218
; Sulik
[1]
PID=16777313
WeaponAnims=1,3,4,6
Default=16777280
Leather=16777325
Power=16777324
Expand All @@ -29,6 +30,7 @@ Combat=16777322
; Vic
[2]
PID=16777278
WeaponAnims=1,5,7
Default=16777307
Jacket=16777329
Combat=16777330
Expand All @@ -39,6 +41,7 @@ Leather=16777333
; Cassidy
[3]
PID=16777305
WeaponAnims=4,5,7
Default=16777354
Leather=16777260
Power=16777328
Expand All @@ -49,6 +52,7 @@ Combat=16777326
; Myron
[4]
PID=16777376
WeaponAnims=1,5
Default=16777304
Leather=
Power=16777349
Expand All @@ -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
Expand All @@ -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
Expand Down
32 changes: 25 additions & 7 deletions artifacts/ddraw.ini
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
Binary file modified artifacts/mods/gl_npcarmor.int
Binary file not shown.
48 changes: 44 additions & 4 deletions artifacts/mods/gl_npcarmor.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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);
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions artifacts/scripting/headers/sfall.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
18 changes: 13 additions & 5 deletions artifacts/scripting/hookscripts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand All @@ -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

Expand Down Expand Up @@ -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
Loading

0 comments on commit 8c2483a

Please sign in to comment.