Added a new example mod gl_auto_closebox

Updated engine structs/functions/variables for future use.
This commit is contained in:
NovaRain
2021-01-20 10:17:01 +08:00
parent 4618776322
commit 88050850f7
10 changed files with 81 additions and 12 deletions
+1 -1
View File
@@ -35,8 +35,8 @@ MotionScanner=0
;Set to 0 to disable ;Set to 0 to disable
;Set to 1 to control all critters in combat ;Set to 1 to control all critters in combat
;Set to 2 to control all party members ;Set to 2 to control all party members
;If you want to control only specific critters, uncomment the PIDList line and set a comma delimited list of PIDs
Mode=0 Mode=0
;If you want to control only specific critters, uncomment the PIDList line and set a comma delimited list of PIDs
;PIDList=62,89,97,107,160,161 ;PIDList=62,89,97,107,160,161
;Set a comma delimited list of perk IDs for perks to be inherited from the player during the combat control ;Set a comma delimited list of perk IDs for perks to be inherited from the player during the combat control
@@ -0,0 +1,33 @@
/*
Auto-Close Containers mod for Fallout 2 by Mr.Stalin
----------------------------------------------------
- automatically closes the container after looting
Requires sfall 4.2.2/3.8.29 or higher
*/
#include "..\headers\sfall\sfall.h"
#include "..\headers\sfall\define_extra.h"
procedure start;
variable lootObject;
procedure start begin
if (game_loaded) then begin
register_hook_proc_spec(HOOK_GAMEMODECHANGE, start);
end else begin
variable mode := get_game_mode;
if (mode andAlso mode != INTFACELOOT) then return;
if (mode == INTFACELOOT) then begin
lootObject := loot_obj;
if (obj_type(lootObject) != OBJ_TYPE_ITEM) then lootObject = 0;
end else if (lootObject andAlso get_sfall_arg_at(1) == INTFACELOOT) then begin
obj_close(lootObject);
lootObject = 0;
end
end
end
@@ -0,0 +1,9 @@
Auto-Close Containers mod for Fallout 2 by Mr.Stalin
----------------------------------------------------
- automatically closes the container after looting
Requires sfall 4.2.2/3.8.29 or higher.
To use, copy gl_auto_closebox.int to your scripts folder.
+1 -1
View File
@@ -1,4 +1,4 @@
Auto Doors mod v1.1 for Fallout 2 by Mr.Stalin Auto Doors mod v1.2 for Fallout 2 by Mr.Stalin
---------------------------------------------- ----------------------------------------------
- allows the player to automatically open/walk through unlocked doors when not in combat - allows the player to automatically open/walk through unlocked doors when not in combat
+1
View File
@@ -4,6 +4,7 @@
#include "..\scripting\headers\sfall.h" #include "..\scripting\headers\sfall.h"
#include "..\scripting\headers\define_lite.h" #include "..\scripting\headers\define_lite.h"
#include "..\scripting\headers\define_extra.h" #include "..\scripting\headers\define_extra.h"
#include "..\scripting\headers\command_lite.h"
#include "..\scripting\headers\dik.h" #include "..\scripting\headers\dik.h"
/* /*
#include "..\scripting\headers\lib.arrays.h" #include "..\scripting\headers\lib.arrays.h"
+1
View File
@@ -59,6 +59,7 @@ WRAP_WATCOM_FFUNC3(const char*, interpretGetString, Program*, scriptPtr, DWORD,
/* stdcall */ /* stdcall */
WRAP_WATCOM_FUNC1(AIcap*, ai_cap, GameObject*, critter) WRAP_WATCOM_FUNC1(AIcap*, ai_cap, GameObject*, critter)
WRAP_WATCOM_FUNC2(void, ai_print_msg, GameObject*, object, long, mode)
WRAP_WATCOM_FUNC1(Program*, allocateProgram, const char*, filePath) WRAP_WATCOM_FUNC1(Program*, allocateProgram, const char*, filePath)
WRAP_WATCOM_FUNC1(bool, art_exists, long, artFid) WRAP_WATCOM_FUNC1(bool, art_exists, long, artFid)
WRAP_WATCOM_FUNC0(void, art_flush) WRAP_WATCOM_FUNC0(void, art_flush)
+29 -9
View File
@@ -121,7 +121,7 @@ struct GameObject {
long y; long y;
long sx; long sx;
long sy; long sy;
long frm; long frm; // current frame
long rotation; long rotation;
long artFid; long artFid;
long flags; long flags;
@@ -135,15 +135,15 @@ struct GameObject {
union { union {
struct { struct {
char updatedFlags[4]; long updatedFlags;
// for weapons - ammo in magazine, for ammo - amount of ammo in last ammo pack // for weapons - ammo in magazine, for ammo - amount of ammo in last ammo pack
long charges; long charges;
// current type of ammo loaded in magazine // current type of ammo loaded in magazine
long ammoPid; long ammoPid;
char gap_44[32]; long unused[8]; // offset 0x44
} item; } item;
struct { struct {
long reaction; long reaction; // unused?
// 1 - combat, 2 - enemies out of sight, 4 - running away // 1 - combat, 2 - enemies out of sight, 4 - running away
long combatState; long combatState;
// aka action points // aka action points
@@ -156,14 +156,27 @@ struct GameObject {
long health; long health;
long rads; long rads;
long poison; long poison;
inline bool IsDead() {
return ((damageFlags & DamageFlag::DAM_DEAD) != 0);
}
inline bool IsNotDead() {
return ((damageFlags & DamageFlag::DAM_DEAD) == 0);
}
inline bool IsActive() {
return ((damageFlags & (DamageFlag::DAM_KNOCKED_OUT | DamageFlag::DAM_LOSE_TURN)) == 0);
}
inline bool IsNotActive() {
return ((damageFlags & (DamageFlag::DAM_KNOCKED_OUT | DamageFlag::DAM_LOSE_TURN)) != 0);
}
} critter; } critter;
}; };
DWORD protoId; DWORD protoId; // object PID
long cid; long cid; // combat ID
long lightDistance; long lightDistance;
long lightIntensity; long lightIntensity;
DWORD outline; DWORD outline;
long scriptId; long scriptId; // SID 0x0Y00XXXX: Y - type: 0=s_system, 1=s_spatial, 2=s_time, 3=s_item, 4=s_critter; XXXX - index in scripts.lst; 0xFFFFFFFF no attached script
GameObject* owner; GameObject* owner;
long scriptIndex; long scriptIndex;
@@ -173,6 +186,13 @@ struct GameObject {
inline char TypeFid() { inline char TypeFid() {
return ((artFid >> 24) & 0x0F); return ((artFid >> 24) & 0x0F);
} }
inline bool IsItem() {
return (Type() == fo::ObjType::OBJ_TYPE_ITEM);
}
inline bool IsCritter() {
return (Type() == fo::ObjType::OBJ_TYPE_CRITTER);
}
}; };
// Results of compute_attack_() function. // Results of compute_attack_() function.
@@ -632,7 +652,7 @@ struct Proto {
long flags; long flags;
long flagsExt; long flagsExt;
long scriptId; // 0x0Y00XXXX: Y - script type (0=s_system, 1=s_spatial, 2=s_time, 3=s_item, 4=s_critter); XXXX - number in scripts.lst. -1 means no script. long scriptId; // SID 0x0Y00XXXX: Y - type: 0=s_system, 1=s_spatial, 2=s_time, 3=s_item, 4=s_critter; XXXX - index in scripts.lst; 0xFFFFFFFF no attached script
ItemType type; ItemType type;
union { union {
@@ -987,7 +1007,7 @@ struct AudioFile {
long length; long length;
long sample_rate; long sample_rate;
long channels; long channels;
long tell; long position;
}; };
#pragma pack(pop) #pragma pack(pop)
+5
View File
@@ -17,6 +17,7 @@
#define FO_VAR_aTextSCuts 0x501A8C #define FO_VAR_aTextSCuts 0x501A8C
#define FO_VAR_aTextSCutsS 0x503530 #define FO_VAR_aTextSCutsS 0x503530
#define FO_VAR_aTextSCutsSS 0x50B01C #define FO_VAR_aTextSCutsSS 0x50B01C
#define FO_VAR_attack_str 0x56D624
#define FO_VAR_background_volume 0x518E88 #define FO_VAR_background_volume 0x518E88
#define FO_VAR_bboxslot 0x5970E0 #define FO_VAR_bboxslot 0x5970E0
#define FO_VAR_bckgnd 0x5707A4 #define FO_VAR_bckgnd 0x5707A4
@@ -99,6 +100,8 @@
#define FO_VAR_gdNumOptions 0x5186D8 #define FO_VAR_gdNumOptions 0x5186D8
#define FO_VAR_gIsSteal 0x51D430 #define FO_VAR_gIsSteal 0x51D430
#define FO_VAR_glblmode 0x5709D0 #define FO_VAR_glblmode 0x5709D0
#define FO_VAR_gmouse_3d_action_nums 0x518D1E
#define FO_VAR_gmouse_3d_current_mode 0x518D38
#define FO_VAR_gmouse_current_cursor 0x518C0C #define FO_VAR_gmouse_current_cursor 0x518C0C
#define FO_VAR_gmovie_played_list 0x596C78 #define FO_VAR_gmovie_played_list 0x596C78
#define FO_VAR_GNW_win_init_flag 0x51E3E0 #define FO_VAR_GNW_win_init_flag 0x51E3E0
@@ -159,6 +162,7 @@
#define FO_VAR_maxScriptNum 0x51C7CC #define FO_VAR_maxScriptNum 0x51C7CC
#define FO_VAR_Meet_Frank_Horrigan 0x672E04 #define FO_VAR_Meet_Frank_Horrigan 0x672E04
#define FO_VAR_Move_on_Car 0x672E64 #define FO_VAR_Move_on_Car 0x672E64
#define FO_VAR_mouse_buttons 0x6AC7B0
#define FO_VAR_mouse_hotx 0x6AC7D0 #define FO_VAR_mouse_hotx 0x6AC7D0
#define FO_VAR_mouse_hoty 0x6AC7CC #define FO_VAR_mouse_hoty 0x6AC7CC
#define FO_VAR_mouse_is_hidden 0x6AC790 #define FO_VAR_mouse_is_hidden 0x6AC790
@@ -275,6 +279,7 @@
#define FO_VAR_view_page 0x664520 #define FO_VAR_view_page 0x664520
#define FO_VAR_wd_obj 0x59E98C #define FO_VAR_wd_obj 0x59E98C
#define FO_VAR_window 0x6ADE58 #define FO_VAR_window 0x6ADE58
#define FO_VAR_window_index 0x6ADD90
#define FO_VAR_wmAreaInfoList 0x51DDF8 #define FO_VAR_wmAreaInfoList 0x51DDF8
#define FO_VAR_wmBkWin 0x51DE14 #define FO_VAR_wmBkWin 0x51DE14
#define FO_VAR_wmBkWinBuf 0x51DE24 #define FO_VAR_wmBkWinBuf 0x51DE24
+1 -1
View File
@@ -3598,7 +3598,7 @@ void BugFixes::init()
// Fix broken Print() script function // Fix broken Print() script function
HookCall(0x461AD4, (void*)fo::funcoffs::windowOutput_); HookCall(0x461AD4, (void*)fo::funcoffs::windowOutput_);
// Fix obj_close/open functions setting/unsetting incorrect flags for non-door objects // Fix for the flags of non-door objects being set/unset when opening/closing objects (e.g. using obj_close/open functions)
MakeCall(0x49CBF7, check_door_state_hack_close, 2); MakeCall(0x49CBF7, check_door_state_hack_close, 2);
MakeCall(0x49CB30, check_door_state_hack_open, 1); MakeCall(0x49CB30, check_door_state_hack_open, 1);
} }