mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Moved highlighting-related settings into new "sfall-mods.ini", dedicated for scripted sfall mods;
Reverted description for MotionScannerFlags 1 and 2, it was actually correct before.
This commit is contained in:
+2
-9
@@ -127,13 +127,6 @@ SpeedKey9=0x00
|
||||
;Set to -1 for either ctrl key, -2 for either alt key or -3 for either shift key
|
||||
WindowScrollKey=0
|
||||
|
||||
;A key to press to toggle the highlighting of all items on the ground on the current map
|
||||
ToggleItemHighlightsKey=42
|
||||
|
||||
;Set to 1 to also highlight containers
|
||||
;Set to 2 for purple outlines
|
||||
HighlightContainers=0
|
||||
|
||||
;A key to press to reload your currently equipped weapon
|
||||
ReloadWeaponKey=0
|
||||
|
||||
@@ -448,8 +441,8 @@ CritterInvSizeLimitMode=0
|
||||
CritterInvSizeLimit=200
|
||||
|
||||
;Some bit flags to alter behaviour of the motion sensor
|
||||
;2 - Motion sensor require charges when using highlight feature
|
||||
;4 - Motion sensor is required to use the item highlight feature
|
||||
;1 - Allow sensor use on automap when motion sensor is in pack rather than hands
|
||||
;2 - Motion sensor doesn't require charges
|
||||
MotionScannerFlags=1
|
||||
|
||||
;Set to non-0 to adjust the maximum encounter table size
|
||||
|
||||
Binary file not shown.
@@ -8,7 +8,10 @@
|
||||
- configurable hotkey is used to trigger highlight
|
||||
- only objects in direct line-of-sight of player are highlighted
|
||||
- motion scanner is required to enable highlight (optional)
|
||||
- motion scanner charges are decreesed on each use (optional)
|
||||
- motion scanner charges are decreased on each use (optional)
|
||||
|
||||
NOTE: this script requires compiler from sfall modderspack with -s option
|
||||
(short circuit evaluation)
|
||||
|
||||
**/
|
||||
|
||||
@@ -19,91 +22,84 @@
|
||||
#define PID_MOTION_SENSOR (59)
|
||||
#define NO_HIGHLIGHT(obj) (get_flags(obj) bwand FLAG_NOHIGHLIGHT)
|
||||
|
||||
variable configSection := "Highlighting";
|
||||
variable highlightKey;
|
||||
variable highlightContainers;
|
||||
variable colorContainers;
|
||||
variable motionScannerFlags;
|
||||
variable ignoreFlags;
|
||||
variable outlineColor;
|
||||
variable motionScanner;
|
||||
variable highlightFailMsg1;
|
||||
variable highlightFailMsg2;
|
||||
|
||||
procedure toggle_highlight_object(variable obj, variable enable) begin
|
||||
procedure ToggleHighlightObject(variable obj, variable enable) begin
|
||||
if obj
|
||||
and (not enable or not obj_blocking_line(dude_obj, tile_num(obj), BLOCKING_TYPE_SHOOT))
|
||||
and (highlightContainers or not NO_HIGHLIGHT(obj)) then begin
|
||||
set_outline(
|
||||
obj,
|
||||
enable and (NO_HIGHLIGHT(obj) and colorContainers or OUTLINE_DARK_YELLOW) or 0
|
||||
);
|
||||
and (ignoreFlags or not NO_HIGHLIGHT(obj)) then begin
|
||||
if (enable) then set_outline(obj, outlineColor);
|
||||
else set_outline(obj, 0);
|
||||
end
|
||||
end
|
||||
|
||||
procedure toggle_highlight(variable enable) begin
|
||||
procedure ToggleHighlight(variable enable) begin
|
||||
variable obj;
|
||||
foreach obj in list_as_array(LIST_GROUNDITEMS) begin
|
||||
if obj != outlined_object then begin
|
||||
call toggle_highlight_object(obj, enable);
|
||||
call ToggleHighlightObject(obj, enable);
|
||||
end
|
||||
end
|
||||
foreach obj in list_as_array(LIST_CRITTERS) begin
|
||||
if critter_state(obj) == CRITTER_IS_DEAD then begin
|
||||
call toggle_highlight_object(obj, enable);
|
||||
call ToggleHighlightObject(obj, enable);
|
||||
end
|
||||
end
|
||||
tile_refresh_display;
|
||||
end
|
||||
|
||||
procedure key_press_handler begin
|
||||
procedure KeyPressHandler begin
|
||||
variable pressed := get_sfall_arg,
|
||||
scanCode := get_sfall_arg,
|
||||
scanner, charges;
|
||||
|
||||
if scanCode == highlightKey then begin
|
||||
if pressed then begin
|
||||
if motionScannerFlags bwand 4 then begin
|
||||
if motionScanner then begin
|
||||
scanner := obj_carrying_pid_obj(dude_obj, PID_MOTION_SENSOR);
|
||||
if scanner then begin
|
||||
if motionScannerFlags bwand 2 then begin
|
||||
if motionScanner >= 2 then begin
|
||||
charges := get_weapon_ammo_count(scanner);
|
||||
if charges > 0 then begin
|
||||
set_weapon_ammo_count(scanner, charges - 1);
|
||||
intface_redraw;
|
||||
call toggle_highlight(true);
|
||||
call ToggleHighlight(true);
|
||||
end else begin
|
||||
display_msg(highlightFailMsg2);
|
||||
end
|
||||
end else begin
|
||||
call toggle_highlight(true);
|
||||
call ToggleHighlight(true);
|
||||
end
|
||||
end else begin
|
||||
display_msg(highlightFailMsg1);
|
||||
end
|
||||
end else begin
|
||||
call toggle_highlight(true);
|
||||
call ToggleHighlight(true);
|
||||
end
|
||||
end else begin
|
||||
call toggle_highlight(false);
|
||||
call ToggleHighlight(false);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
procedure start begin
|
||||
if game_loaded then begin
|
||||
translationIni := GetConfigStr("Main", "TranslationsINI", "./Translations.ini");
|
||||
call InitConfigs;
|
||||
|
||||
highlightKey := GetConfig("Input", "ToggleItemHighlightsKey", 0);
|
||||
display_msg("key= " + highlightKey);
|
||||
highlightContainers := GetConfig("Input", "HighlightContainers", 0);
|
||||
if highlightContainers == 1 then begin
|
||||
colorContainers := OUTLINE_DARK_YELLOW;
|
||||
end else if highlightContainers == 2 then begin
|
||||
colorContainers := OUTLINE_PURPLE;
|
||||
end
|
||||
motionScannerFlags := GetConfig("Misc", "MotionScannerFlags", 1);
|
||||
debug_msg("Flags=" + motionScannerFlags + ", ini=" + translationIni);
|
||||
highlightKey := GetConfig(configSection, "Key", 0);
|
||||
ignoreFlags := GetConfig(configSection, "IgnoreFlags", 0);
|
||||
outlineColor := GetConfig(configSection, "OutlineColor", 0);
|
||||
motionScanner := GetConfig(configSection, "MotionScanner", 1);
|
||||
|
||||
highlightFailMsg1 := translate("HighlightFail1", "You aren't carrying a motion sensor.");
|
||||
highlightFailMsg2 := translate("HighlightFail2", "Your motion sensor is out of charge.");
|
||||
highlightFailMsg1 := Translate("HighlightFail1", "You aren't carrying a motion sensor.");
|
||||
highlightFailMsg2 := Translate("HighlightFail2", "Your motion sensor is out of charge.");
|
||||
|
||||
register_hook_proc(HOOK_KEYPRESS, key_press_handler);
|
||||
register_hook_proc(HOOK_KEYPRESS, KeyPressHandler);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "..\scripting\headers\sfall.h"
|
||||
#include "..\scripting\headers\define_extra.h"
|
||||
|
||||
variable ini := "ddraw.ini";
|
||||
variable ini := "sfall-mods.ini";
|
||||
variable translationIni;
|
||||
|
||||
// Gets the integer value from ddraw.ini
|
||||
@@ -20,7 +20,7 @@ procedure GetConfigStr(variable section, variable key, variable def) begin
|
||||
end
|
||||
|
||||
// Translates given string using Translations.ini
|
||||
procedure translate(variable id, variable def) begin
|
||||
procedure Translate(variable id, variable def) begin
|
||||
variable str := get_ini_string(translationIni + "|Sfall|" + id);
|
||||
if not str or (strlen(str) == 0) then begin
|
||||
str := def;
|
||||
@@ -28,3 +28,6 @@ procedure translate(variable id, variable def) begin
|
||||
return str;
|
||||
end
|
||||
|
||||
procedure InitConfigs begin
|
||||
translationIni := GetConfigStr("Main", "TranslationsINI", "./Translations.ini");
|
||||
end
|
||||
|
||||
@@ -161,11 +161,11 @@
|
||||
#define OUTLINE_NONE (0)
|
||||
#define OUTLINE_RED_GLOW (0x01)
|
||||
#define OUTLINE_RED (0x02)
|
||||
#define OUTLINE_PURPLE (0x03)
|
||||
#define OUTLINE_GREY (0x04)
|
||||
#define OUTLINE_GREEN_GLOW (0x08)
|
||||
#define OUTLINE_YELLOW (0x10)
|
||||
#define OUTLINE_DARK_YELLOW (0x20)
|
||||
#define OUTLINE_PURPLE (0x40)
|
||||
|
||||
#define mstr_combat(x) (message_str_game(GAME_MSG_COMBAT, x))
|
||||
#define mstr_ai(x) (message_str_game(GAME_MSG_AI, x))
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
[Highlighting]
|
||||
|
||||
; DX scandode of a key to press to highlight items on the ground
|
||||
; 207 - END key
|
||||
Key=207
|
||||
|
||||
; Set to 1 to ignore NO_HIGHLIGHT flag present on most containers
|
||||
IgnoreFlags=1
|
||||
|
||||
; Set the color of outlines, available colors:
|
||||
; 1 - glowing red
|
||||
; 2 - red
|
||||
; 4 - grey
|
||||
; 8 - glowing green
|
||||
; 16 - bright yellow
|
||||
; 32 - dark yellow
|
||||
; 64 - purple
|
||||
OutlineColor=32
|
||||
|
||||
; 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=2
|
||||
Reference in New Issue
Block a user