Added a new example mod gl_auto_closebox

Updated gl_highlighting_lite example mod.
Updated engine structs.
This commit is contained in:
NovaRain
2021-01-20 10:21:48 +08:00
parent d2b3cac835
commit 8e66b82f76
10 changed files with 84 additions and 12 deletions
+1 -1
View File
@@ -638,8 +638,8 @@ PipboyTimeAnimDelay=50
;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 ControlCombatPIDList line and set a comma delimited list of PIDs
ControlCombat=0 ControlCombat=0
;If you want to control only specific critters, uncomment the ControlCombatPIDList line and set a comma delimited list of PIDs
;ControlCombatPIDList=62,89,97,107,160,161 ;ControlCombatPIDList=62,89,97,107,160,161
;Set to 1 to stack empty identical weapons, no matter what type of ammo was loaded before ;Set to 1 to stack empty identical weapons, no matter what type of ammo was loaded before
@@ -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
@@ -100,8 +100,16 @@ procedure KeyPressHandler begin
end end
end end
// visual glitch fix - for 3.8.29+
procedure GameModeChangeHandler begin
if isHighlight and (get_game_mode bwand (INTFACELOOT bwor BARTER)) then begin
isHighlight := false;
call ToggleHighlight(false);
end
end
procedure InventoryMoveHandler begin procedure InventoryMoveHandler begin
// remove item outline when player picks up the item // remove item outline when player picks up the item - for 3.8.18+
if (isHighlight and get_sfall_arg == 7) then set_outline(get_sfall_arg, 0); if (isHighlight and get_sfall_arg == 7) then set_outline(get_sfall_arg, 0);
end end
@@ -121,6 +129,7 @@ procedure start begin
highlightFailMsg2 := Translate("HighlightFail2", "Your motion sensor is out of charge."); highlightFailMsg2 := Translate("HighlightFail2", "Your motion sensor is out of charge.");
register_hook_proc(HOOK_KEYPRESS, KeyPressHandler); register_hook_proc(HOOK_KEYPRESS, KeyPressHandler);
register_hook_proc(HOOK_GAMEMODECHANGE, GameModeChangeHandler);
register_hook_proc(HOOK_INVENTORYMOVE, InventoryMoveHandler); register_hook_proc(HOOK_INVENTORYMOVE, InventoryMoveHandler);
end end
end end
@@ -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 -1
View File
@@ -3593,7 +3593,7 @@ void BugFixes_Init()
// Fix broken Print() script function // Fix broken Print() script function
HookCall(0x461AD4, (void*)windowOutput_); HookCall(0x461AD4, (void*)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);
} }
+28 -8
View File
@@ -70,7 +70,7 @@ struct TGameObj {
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;
@@ -84,15 +84,15 @@ struct TGameObj {
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
@@ -105,14 +105,27 @@ struct TGameObj {
long health; long health;
long rads; long rads;
long poison; long poison;
inline bool IsDead() {
return ((damageFlags & DAM_DEAD) != 0);
}
inline bool IsNotDead() {
return ((damageFlags & DAM_DEAD) == 0);
}
inline bool IsActive() {
return ((damageFlags & (DAM_KNOCKED_OUT | DAM_LOSE_TURN)) == 0);
}
inline bool IsNotActive() {
return ((damageFlags & (DAM_KNOCKED_OUT | 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
TGameObj* owner; TGameObj* owner;
long scriptIndex; long scriptIndex;
@@ -122,6 +135,13 @@ struct TGameObj {
inline char TypeFid() { inline char TypeFid() {
return ((artFid >> 24) & 0x0F); return ((artFid >> 24) & 0x0F);
} }
inline bool IsItem() {
return (Type() == OBJ_TYPE_ITEM);
}
inline bool IsCritter() {
return (Type() == OBJ_TYPE_CRITTER);
}
}; };
// Results of compute_attack_() function. // Results of compute_attack_() function.
@@ -664,7 +684,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)