Added outline color options for empty containers and corpses

Updated the script mod in modderspack.
Clarified the description of the get_current_inven_size function.
This commit is contained in:
NovaRain
2026-06-23 23:08:38 +08:00
parent e795b99bb5
commit 1005cfc1d4
6 changed files with 62 additions and 30 deletions
+9 -5
View File
@@ -227,7 +227,7 @@ HighlightContainers=0
;Set to 1 to also highlight lootable corpses
HighlightCorpses=0
;Set the color of outlines for items, available colors:
;Set the outline color for items, available colors:
;1 - glowing red
;2 - red
;4 - grey
@@ -238,11 +238,15 @@ HighlightCorpses=0
;You can set a custom color from the game palette by multiplying the color index value by 256 (in 3.8.27 or later)
OutlineColor=16
;Set the color of outlines for containers
OutlineColorContainers=4
;Set the outline color for containers
;For empty containers, set the color to 0 to disable highlighting
OutlineColorContainers=32
OutlineColorContainersEmpty=4
;Set the color of outlines for corpses
OutlineColorCorpses=4
;Set the outline color for corpses
;For empty corpses, set the color to 0 to disable highlighting
OutlineColorCorpses=32
OutlineColorCorpsesEmpty=4
;A key to press to reload your currently equipped weapon or use the active item
;Set to 0 if you don't want a reload key, or a DX scancode otherwise
@@ -31,20 +31,25 @@
#define REPEAT_FRAMES (10)
#define NO_HIGHLIGHT(obj) (get_flags(obj) bwand FLAG_NOHIGHLIGHT)
#define NO_STEAL(obj) (get_proto_data(obj_pid(obj), PROTO_CR_FLAGS) bwand CFLG_NOSTEAL)
#define IS_EMPTY(obj) (inven_ptr(obj, 0) == 0)
variable configSection := "Highlighting";
variable highlightKey;
variable isHighlight;
variable alsoContainer;
variable alsoCorpse;
variable alsoCritter;
variable checkLOS;
variable outlineColor;
variable outlineColorContainers;
variable outlineColorCorpses;
variable motionScanner;
variable highlightFailMsg1;
variable highlightFailMsg2;
variable begin
configSection := "Highlighting";
highlightKey;
isHighlight;
alsoContainer;
alsoCorpse;
alsoCritter;
checkLOS;
outlineColor;
outlineColorContainers;
outlineColorContainersEmpty;
outlineColorCorpses;
outlineColorCorpsesEmpty;
motionScanner;
highlightFailMsg1;
highlightFailMsg2;
end
procedure DudeCanSee(variable obj) begin
variable block := obj_blocking_line(dude_obj, tile_num(obj), BLOCKING_TYPE_SHOOT);
@@ -72,10 +77,10 @@ procedure GetOutlineColor(variable obj, variable isCritter) begin
return 0;
if obj_type(obj) == OBJ_TYPE_CRITTER then
return outlineColorCorpses;
return outlineColorCorpsesEmpty if IS_EMPTY(obj) else outlineColorCorpses;
if obj_item_subtype(obj) == item_type_container then
return outlineColorContainers;
return outlineColorContainersEmpty if IS_EMPTY(obj) else outlineColorContainers;
return outlineColor;
end
@@ -176,12 +181,18 @@ procedure start begin
alsoCorpse := GetConfig(configSection, "Corpses", 0);
alsoCritter := GetConfig(configSection, "Critters", 0);
checkLOS := GetConfig(configSection, "CheckLOS", 0);
outlineColor := GetConfig(configSection, "OutlineColor", 16);
if (outlineColor < 1) then outlineColor := 64;
outlineColorContainers := GetConfig(configSection, "OutlineColorContainers", 16);
outlineColorContainers := GetConfig(configSection, "OutlineColorContainers", 32);
if (outlineColorContainers < 1) then outlineColorContainers := 64;
outlineColorCorpses := GetConfig(configSection, "OutlineColorCorpses", 16);
outlineColorContainersEmpty := GetConfig(configSection, "OutlineColorContainersEmpty", 4);
if (outlineColorContainersEmpty < 0) then outlineColorContainersEmpty := 64; // allow 0
outlineColorCorpses := GetConfig(configSection, "OutlineColorCorpses", 32);
if (outlineColorCorpses < 1) then outlineColorCorpses := 64;
outlineColorCorpsesEmpty := GetConfig(configSection, "OutlineColorCorpsesEmpty", 4);
if (outlineColorCorpsesEmpty < 0) then outlineColorCorpsesEmpty := 64; // allow 0
motionScanner := GetConfig(configSection, "MotionScanner", 0);
highlightFailMsg1 := Translate("HighlightFail1", "You aren't carrying a motion sensor.");
@@ -15,7 +15,7 @@ Critters=0
; Set to 1 to only highlight objects in the player's line-of-sight
CheckLOS=1
; Set the color of outlines for items; available colors:
; Set the outline color for items; available colors:
; 1 - glowing red
; 2 - red
; 4 - grey
@@ -26,11 +26,15 @@ CheckLOS=1
; You can set a custom color from the game palette by multiplying the color index value by 256 (in 3.8.27 or later)
OutlineColor=16
; Set the color of outlines for containers
OutlineColorContainers=4
; Set the outline color for containers
; For empty containers, set the color to 0 to disable highlighting
OutlineColorContainers=32
OutlineColorContainersEmpty=4
; Set the color of outlines for corpses
OutlineColorCorpses=4
; Set the outline color for corpses
; For empty corpses, set the color to 0 to disable highlighting
OutlineColorCorpses=32
OutlineColorCorpsesEmpty=4
; Motion Scanner mode:
; 0 - ignored
+1 -1
View File
@@ -744,7 +744,7 @@ sfall_funcX metarule functions
----
#### get_current_inven_size
`int sfall_func1("get_current_inven_size", object obj)`
- Returns the current inventory size of the container or the critter
- Returns the total size of items in a container or a critter's inventory
----
#### create_win
+15 -2
View File
@@ -54,7 +54,9 @@ static DWORD highlightCorpses;
static DWORD motionScanner;
static int outlineColor;
static int outlineColorContainers;
static int outlineColorContainersEmpty;
static int outlineColorCorpses;
static int outlineColorCorpsesEmpty;
static char highlightFail1[128];
static char highlightFail2[128];
@@ -479,11 +481,15 @@ isCritter:
test eax, eax; // Can't be stolen from?
jnz nextObject; // Yes
mov eax, outlineColorCorpses; // Set outline color for corpses
cmp dword ptr [ecx + inventory], 0; // Is source inventory empty?
cmove eax, outlineColorCorpsesEmpty; // Set outline color for empty corpses
jmp setOutline;
isContainer:
cmp highlightContainers, 0; // Highlight containers?
je nextObject;
mov eax, outlineColorContainers; // Set outline color for containers
cmp dword ptr [ecx + inventory], 0; // Is source inventory empty?
cmove eax, outlineColorContainersEmpty; // Set outline color for empty containers
jmp setOutline;
normalItem:
mov eax, outlineColor; // Set outline color for items
@@ -1094,13 +1100,20 @@ void ScriptExtender::init() {
if (toggleHighlightsKey) {
highlightContainers = IniReader::GetConfigInt("Input", "HighlightContainers", 0);
highlightCorpses = IniReader::GetConfigInt("Input", "HighlightCorpses", 0);
outlineColor = IniReader::GetConfigInt("Input", "OutlineColor", 16);
if (outlineColor < 1) outlineColor = 64;
outlineColorContainers = IniReader::GetConfigInt("Input", "OutlineColorContainers", 16);
outlineColorContainers = IniReader::GetConfigInt("Input", "OutlineColorContainers", 32);
if (outlineColorContainers < 1) outlineColorContainers = 64;
outlineColorCorpses = IniReader::GetConfigInt("Input", "OutlineColorCorpses", 16);
outlineColorContainersEmpty = IniReader::GetConfigInt("Input", "OutlineColorContainersEmpty", 4);
if (outlineColorContainersEmpty < 0) outlineColorContainersEmpty = 64; // allow 0
outlineColorCorpses = IniReader::GetConfigInt("Input", "OutlineColorCorpses", 32);
if (outlineColorCorpses < 1) outlineColorCorpses = 64;
outlineColorCorpsesEmpty = IniReader::GetConfigInt("Input", "OutlineColorCorpsesEmpty", 4);
if (outlineColorCorpsesEmpty < 0) outlineColorCorpsesEmpty = 64; // allow 0
motionScanner = IniReader::GetConfigInt("Misc", "MotionScannerFlags", 1);
Translate::Get("Sfall", "HighlightFail1", "You aren't carrying a motion sensor.", highlightFail1);
Translate::Get("Sfall", "HighlightFail2", "Your motion sensor is out of charge.", highlightFail2);
const DWORD objRemoveOutlineAddr[] = {