Added an additional '"Can't Use" flag to misc flags in item objects

* it makes the weapon object unusable in combat.

Updated gl_npcarmor script.
Edits to header files and hookscripts.md.
This commit is contained in:
NovaRain
2021-09-03 21:30:12 +08:00
parent edc2755ef6
commit 806cc765bb
9 changed files with 189 additions and 94 deletions
+26 -21
View File
@@ -120,26 +120,29 @@
#define MSGBOX_YESNO (0x10) // use YES/NO buttons instead of DONE
#define MSGBOX_CLEAN (0x20) // no buttons
//remove inven obj defines
#define RMOBJ_CONSUME_DRUG 4666772
#define RMOBJ_CONTAINER 4683293 // same as RMOBJ_TRADE
#define RMOBJ_USE_OBJ 4666865
#define RMOBJ_EQUIP_ARMOR 4658121
#define RMOBJ_EQUIP_WEAPON 4658675
#define RMOBJ_UNLOAD_WEAPON 4667030
//#define RMOBJ_LOAD_WEAPON 4831349 // same as RMOBJ_DROP
#define RMOBJ_USE_DRUG_ON 4834866
#define RMOBJ_STEAL_VIEW 4668206
//#define RMOBJ_DROP_DYNAMITE 4666865 // same as USE_OBJ
#define RMOBJ_ITEM_DESTROYED 4543215
#define RMOBJ_ITEM_REMOVED 4548572
#define RMOBJ_ARMOR_EQUIPED 4651961
#define RMOBJ_LEFT_HAND_EQUIPED 4651899
#define RMOBJ_RIGHT_HAND_EQUIPED 4651934
#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 nested containers in the inventory
//remove inven obj defines for the 4th argument to hs_removeinvobj
#define RMOBJ_CONSUME_DRUG 4666772 // (inven_action_cursor_)
#define RMOBJ_CONTAINER 4683293 // same as RMOBJ_TRADE (item_move_func_)
#define RMOBJ_USE_OBJ 4666865 // (inven_action_cursor_)
#define RMOBJ_EQUIP_ARMOR 4658121 // (inven_pickup_)
#define RMOBJ_EQUIP_WEAPON 4658675 // (switch_hand_)
#define RMOBJ_UNLOAD_WEAPON 4667030 // (inven_action_cursor_)
//#define RMOBJ_LOAD_WEAPON 4831349 // same as RMOBJ_DROP (obj_remove_from_inven_)
#define RMOBJ_USE_DRUG_ON 4834866 // (obj_use_item_on_)
#define RMOBJ_STEAL_VIEW 4668206 // (loot_container_)
//#define RMOBJ_DROP_DYNAMITE 4666865 // same as RMOBJ_USE_OBJ
#define RMOBJ_ITEM_DESTROYED 4543215 // (op_destroy_object_)
#define RMOBJ_ITEM_REMOVED 4548572 // (op_rm_obj_from_inven_)
#define RMOBJ_ARMOR_EQUIPED 4651961 // (setup_inventory_)
#define RMOBJ_LEFT_HAND_EQUIPED 4651899 // (setup_inventory_)
#define RMOBJ_RIGHT_HAND_EQUIPED 4651934 // (setup_inventory_)
#define RMOBJ_RM_MULT_OBJS 4563866 // (op_rm_mult_objs_from_inven_)
#define RMOBJ_REPLACE_WEAPON 4658526 // (switch_hand_)
#define RMOBJ_THROW 4266040 // (action_ranged_)
#define RMOBJ_SUB_CONTAINER 4683191 // search and remove the item from nested containers in the inventory (item_remove_mult_)
#define RMOBJ_AI_USE_DRUG_ON 4359920 // remove before AI uses the drug in combat (ai_check_drugs_)
//#define RMOBJ_AI_USE_DRUG_ON_1 4359639 // same as RMOBJ_AI_USE_DRUG_ON (obsolete, use only for sfall before 4.3.1/3.8.31)
//#define RMOBJ_AI_USE_DRUG_ON_2 4360176 // same as RMOBJ_AI_USE_DRUG_ON (obsolete, use only for sfall before 4.3.1/3.8.31)
// common prototype offsets for get/set_proto_data
#define PROTO_PID (1)
@@ -330,9 +333,11 @@
#define OBJ_DATA_CUR_FRM (0x18) // current frame number
#define OBJ_DATA_ROTATION (0x1C)
#define OBJ_DATA_FID (0x20)
//#define OBJ_DATA_FLAGS (0x24) // the same flags set in prototypes (PROTO_FLAG)
#define OBJ_DATA_ELEVATION (0x28)
#define OBJ_DATA_MISC_FLAGS (0x38)
#define OBJ_DATA_PID (0x64)
#define OBJ_DATA_CID (0x68) // combat ID, used for savegame
#define OBJ_DATA_CID (0x68) // combat ID, used by critters in savegame (don't change while in combat)
#define OBJ_DATA_SID (0x78) // script ID
#define OBJ_DATA_SCRIPT_INDEX (0x80) // script index number in scripts.lst
// items
+24 -14
View File
@@ -1,7 +1,7 @@
#ifndef SFALL_H
#define SFALL_H
//Recognised modes for set_shader_mode and get_game_mode
// Recognised modes for set_shader_mode and get_game_mode
#define WORLDMAP (0x1)
#define DIALOG (0x4)
#define ESCMENU (0x8)
@@ -24,7 +24,7 @@
#define COUNTERWIN (0x100000) // counter window for moving multiple items or setting a timer
#define SPECIAL (0x80000000)
//Valid arguments to register_hook
// Valid arguments to register_hook
#define HOOK_TOHIT (0)
#define HOOK_AFTERHITROLL (1)
#define HOOK_CALCAPCOST (2)
@@ -54,7 +54,7 @@
#define HOOK_ADJUSTFID (26)
#define HOOK_GAMEMODECHANGE (31)
//Valid arguments to list_begin
// Valid arguments to list_begin
#define LIST_CRITTERS (0)
#define LIST_GROUNDITEMS (1)
#define LIST_SCENERY (2)
@@ -64,7 +64,7 @@
#define LIST_SPATIAL (6)
#define LIST_ALL (9)
//Valid window types for get_window_attribute
// Valid window types for get_window_attribute
#define WINTYPE_INVENTORY (0) // any inventory window (player/loot/use/barter)
#define WINTYPE_DIALOG (1)
#define WINTYPE_PIPBOY (2)
@@ -75,14 +75,14 @@
#define WINTYPE_ESCMENU (7) // escape menu
#define WINTYPE_AUTOMAP (8)
//Valid flags for force_encounter_with_flags
// Valid flags for force_encounter_with_flags
#define ENCOUNTER_FLAG_NO_CAR (0x1)
#define ENCOUNTER_FLAG_LOCK (0x2) // block new forced encounter by the next function call until the current specified encounter occurs
#define ENCOUNTER_FLAG_NO_ICON (0x4) // disable displaying the flashing icon
#define ENCOUNTER_FLAG_ICON_SP (0x8) // use special encounter icon
#define ENCOUNTER_FLAG_FADEOUT (0x10) // fade out the screen on encounter (Note: you yourself should restore the fade screen when entering the encounter)
//The attack types returned by get_attack_type
// The attack types returned by get_attack_type
#define ATKTYPE_LWEP1 (0)
#define ATKTYPE_LWEP2 (1)
#define ATKTYPE_RWEP1 (2)
@@ -104,18 +104,18 @@
#define ATKTYPE_HOOKKICK (18)
#define ATKTYPE_PIERCINGKICK (19)
//Some possible values for the 4th argument to hs_removeinvobj
#define RMOBJ_DROP (0x49B875) //If the object is dropped manually by the player from the inventory screen
#define RMOBJ_TRADE (0x47761D) //If the object is offered up as a trade
#define RMOBJ_DROPMULTI (0x45C1CF) //When dropping a part of a stack (RMOBJ_DROP occures first)
// Some possible values for the 4th argument to hs_removeinvobj
#define RMOBJ_DROP (0x49B875) // If the object is dropped manually by the player from the inventory screen
#define RMOBJ_TRADE (0x47761D) // If the object is offered up as a trade
#define RMOBJ_DROPMULTI (0x45C1CF) // When dropping a part of a stack (RMOBJ_DROP occurs first)
//Return values for "typeof"
// Return values for "typeof"
#define VALTYPE_NONE (0) // not used yet
#define VALTYPE_INT (1)
#define VALTYPE_FLOAT (2)
#define VALTYPE_STR (3)
//Arrays defines
/* ARRAYS FUNCTION DEFINES */
// create persistent list
#define create_array_list(size) (create_array(size, 0))
@@ -246,6 +246,9 @@
#define ADD_PERK_MODE_PERK (2) // add to the player's perks list
#define ADD_PERK_MODE_REMOVE (4) // remove from the list of selectable perks (after added to the player)
/* MISC FUNCTION MACROS */
// instantly apply the item to dude_obj (w/o animation)
#define use_item_on_dude(item) set_self(dude_obj); \
set_self(dude_obj); \
@@ -260,8 +263,14 @@
// checks if the specified PID number exists in the list of registered protos
#define check_pid(pid) (get_proto_data(pid, 0) != -1)
// sets the status of an unusable weapon that cannot be used in combat
#define set_weapon_unusable(item) set_object_data(item, OBJ_DATA_MISC_FLAGS, get_object_data(item, OBJ_DATA_MISC_FLAGS) bwor 0x00000010)
#define set_weapon_usable(item) set_object_data(item, OBJ_DATA_MISC_FLAGS, get_object_data(item, OBJ_DATA_MISC_FLAGS) bwand 0xFFFFFFEF)
#define weapon_is_unusable(item) (get_object_data(item, OBJ_DATA_MISC_FLAGS) bwand 0x00000010)
/* SFALL_FUNCX MACROS */
/* sfall_funcX macros */
#define add_extra_msg_file(name) sfall_func1("add_extra_msg_file", name)
#define add_global_timer_event(time, fixedParam) sfall_func2("add_g_timer_event", time, fixedParam)
#define add_iface_tag sfall_func0("add_iface_tag")
@@ -360,7 +369,8 @@
#define win_fill_color(x, y, width, height, color) sfall_func5("win_fill_color", x, y, width, height, color)
/* sfall metarule3 function macros */
/* SFALL METARULE3 FUNCTION MACROS */
// sets the number of days (range 1...127) for the Frank Horrigan encounter, or disable the encounter if days is set to 0
#define set_horrigan_days(day) metarule3(200, day, 0, 0)
// clears the keyboard input buffer, use it in the HOOK_KEYPRESS hook to clear keyboard events before calling functions that are waiting for keyboard input