Added options for toggling corpse highlighting and LOS check.

Changed default settings in sfall-mod.ini to be in line with the default  ddraw.ini in previous versions of sfall.
This commit is contained in:
NovaRain
2017-04-09 20:58:36 +08:00
parent d484be45c8
commit dc785d010e
4 changed files with 55 additions and 34 deletions
+10 -4
View File
@@ -4,8 +4,14 @@
; 42 - SHIFT key
Key=42
; Set to 1 also highlight containers
Containers=1
; Set to 1 to also highlight containers
Containers=0
; Set to 1 to also highlight corpses
Corpses=0
; Set to 1 to only highlight objects in the player's line-of-sight
CheckLOS=0
; Set the color of outlines, available colors:
; 1 - glowing red
@@ -15,13 +21,13 @@ Containers=1
; 16 - bright yellow
; 32 - dark yellow
; 64 - purple
OutlineColor=32
OutlineColor=16
; Motion Scanner mode:
; 0 - ignored
; 1 - requires Motion Scanner present in player inventory to activate highlighting
; 2 - requires Motion Scanner and also requires 1 charge on every use (depleted scanner will not work anymore)
MotionScanner=1
MotionScanner=0
[CombatControl]
Binary file not shown.
+19 -4
View File
@@ -4,9 +4,9 @@
Previously was part of sfall itself, now a separate mod.
Features:
- highlighting items, containers (optional) and dead bodies on the ground
- highlighting items, containers (optional) and dead bodies (optional) on the ground
- configurable hotkey is used to trigger highlight
- only objects in direct line-of-sight of player are highlighted
- only objects in direct line-of-sight of player are highlighted (optional)
- motion scanner is required to enable highlight (optional)
- motion scanner charges are decreased on each use (optional)
@@ -27,18 +27,29 @@
variable configSection := "Highlighting";
variable highlightKey;
variable alsoContainer;
variable alsoCorpse;
variable checkLOS;
variable outlineColor;
variable motionScanner;
variable highlightFailMsg1;
variable highlightFailMsg2;
procedure ToggleHighlightObject(variable obj, variable enable) begin
if (checkLOS) then begin
if obj and (not enable or not obj_blocking_line(dude_obj, tile_num(obj), BLOCKING_TYPE_SHOOT)) then begin
if (alsoContainer and obj_item_subtype(obj) == item_type_container) or (not NO_HIGHLIGHT(obj)) then begin
if (enable) then set_outline(obj, outlineColor);
else set_outline(obj, 0);
end
end
end else begin
if obj then begin
if (alsoContainer and obj_item_subtype(obj) == item_type_container) or (not NO_HIGHLIGHT(obj)) then begin
if (enable) then set_outline(obj, outlineColor);
else set_outline(obj, 0);
end
end
end
end
procedure ToggleHighlight(variable enable) begin
@@ -48,11 +59,13 @@ procedure ToggleHighlight(variable enable) begin
call ToggleHighlightObject(obj, enable);
end
end
if (alsoCorpse) then begin
foreach obj in list_as_array(LIST_CRITTERS) begin
if critter_state(obj) == CRITTER_IS_DEAD then begin
call ToggleHighlightObject(obj, enable);
end
end
end
tile_refresh_display;
end
@@ -96,8 +109,10 @@ procedure start begin
highlightKey := GetConfig(configSection, "Key", 0);
alsoContainer := GetConfig(configSection, "Containers", 0);
outlineColor := GetConfig(configSection, "OutlineColor", 0);
motionScanner := GetConfig(configSection, "MotionScanner", 1);
alsoCorpse := GetConfig(configSection, "Corpses", 0);
checkLOS := GetConfig(configSection, "CheckLOS", 0);
outlineColor := GetConfig(configSection, "OutlineColor", 16);
motionScanner := GetConfig(configSection, "MotionScanner", 0);
highlightFailMsg1 := Translate("HighlightFail1", "You aren't carrying a motion sensor.");
highlightFailMsg2 := Translate("HighlightFail2", "Your motion sensor is out of charge.");