Skip to content

Commit

Permalink
Update compatibility with various UI mods
Browse files Browse the repository at this point in the history
- Added support for Pecca's Dragonspear UI++ (BG2EE version)
- Added compatibility checks for Pecca's Infinity UI
- Added compatibility checks for K4f4r's Classic BG UI
- Added compatibility checks for Tipun's User Interface
- Internal code restructures and optimizations
  • Loading branch information
Argent77 committed May 31, 2023
1 parent 649c433 commit fd06d72
Show file tree
Hide file tree
Showing 12 changed files with 412 additions and 228 deletions.
145 changes: 112 additions & 33 deletions HiddenGameplayOptions/HiddenGameplayOptions.tp2

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions HiddenGameplayOptions/languages/english/setup.tra
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@
@509 = ~Requires Tweaks Anthology's "Create interval saves" to be installed.~
@510 = ~Requires component "Improved Cheat Menu" to be installed.~
@511 = ~This component is intended to be called separately if needed.~
@512 = ~This component is not compatible with Pecca's Infinity UI.~
@513 = ~This component is not compatible with K4f4r's Classic BG UI.~
@514 = ~This component is not compatible with Tipun's User Interface.~
4 changes: 3 additions & 1 deletion HiddenGameplayOptions/languages/german/setup.tra
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
@509 = ~Benoetigt Tweaks Anthologys Modkomponente "Regelmaessige Spielstaende erzeugen".~
@510 = ~Benoetigt die Modkomponente "Verbessertes Cheatmenu".~
@511 = ~Diese Komponente ist dafuer gedacht, bei Bedarf separat aufgerufen zu werden.~

@512 = ~Diese Komponente ist nicht mit Peccas Infinity UI kompatibel.~
@513 = ~Diese Komponente ist nicht mit K4f4rs Classic BG UI kompatibel.~
@514 = ~Diese Komponente ist nicht mit Tipuns User Interface kompatibel.~

// WeiDU prompts
@-1000= "Die %TP2_FILE_NAME%-Mod besitzt"
Expand Down
26 changes: 26 additions & 0 deletions HiddenGameplayOptions/lib/functions.tph
Original file line number Diff line number Diff line change
Expand Up @@ -515,3 +515,29 @@ BEGIN
SET start_ofs = end_ofs
END
END


// Reads content of an inlined file of the given name.
// Parameters:
// STR_VAR name File name without extension (no default).
// STR_VAR ext File extension without leading dot (default: menu)
// STR_VAR path File path (default: .../inlined/hiddengameplayoptions)
// RET code Content of the specified file.
DEFINE_PATCH_FUNCTION LOAD_INLINED_DATA
STR_VAR
name = ~~
ext = ~menu~
path = ~.../inlined/hiddengameplayoptions~
RET
code
BEGIN
SPRINT code ~~
PATCH_IF (NOT ~%name%~ STR_EQ ~~) BEGIN
INNER_ACTION BEGIN
COPY - ~%path%/%name%.%ext%~ ~%path%/%name%.%ext%~
SET len = BUFFER_LENGTH
READ_ASCII 0 code (len)
BUT_ONLY
END
END
END
239 changes: 128 additions & 111 deletions HiddenGameplayOptions/lib/ui_slider_feedback_actions.tph
Original file line number Diff line number Diff line change
Expand Up @@ -14,69 +14,73 @@ INCLUDE ~%MOD_FOLDER%/lib/functions.tph~
* STR_VAR LUA label text variable: ctl_label
* STR_VAR LUA description variable: ctl_description
*/
OUTER_TEXT_SPRINT codeActionFeedbackText ~%TAB%
%TAB%text
%TAB%{
%TAB%%TAB%area %ctl_label_x% %ctl_label_y% %ctl_label_w% %ctl_label_h%
%TAB%%TAB%text "%ctl_label%"
%TAB%%TAB%text style "label"
%TAB%%TAB%text align right center
%TAB%%TAB%text upper
%TAB%%TAB%text highlight lua "getSelected(selectedSL, %ctl_id%)"
%TAB%%TAB%action
%TAB%%TAB%"
%TAB%%TAB%%TAB%helpString = '%ctl_description%'
%TAB%%TAB%%TAB%selectedOpt = 0
%TAB%%TAB%%TAB%selectedSL = %ctl_id%
%TAB%%TAB%"
%TAB%}
~
OUTER_TEXT_SPRINT codeActionFeedbackSlider ~%TAB%slider
%TAB%{
%TAB%%TAB%area %ctl_slider_x% %ctl_slider_y% %ctl_slider_w% %ctl_slider_h%
%TAB%%TAB%position "renderActionsSLDR"
%TAB%%TAB%bam 'SLDRSTAR'
%TAB%%TAB%mosaic GUISLDR
%TAB%%TAB%sequence 0
%TAB%%TAB%frame 1
%TAB%%TAB%settings %ctl_num_settings%
%TAB%%TAB%pad %ctl_pad_x% %ctl_pad_y% %ctl_pad_w% %ctl_pad_h%
%TAB%%TAB%action
%TAB%%TAB%"
%TAB%%TAB%%TAB%helpString = '%ctl_description%'
%TAB%%TAB%%TAB%selectedOpt = 0
%TAB%%TAB%%TAB%selectedSL = %ctl_id%
%TAB%%TAB%"
%TAB%}
~
OUTER_TEXT_SPRINT codeActionFeedbackSlider25 ~%TAB%slider
%TAB%{
%TAB%%TAB%area %ctl_slider_x% %ctl_slider_y% %ctl_slider_w% %ctl_slider_h%
%TAB%%TAB%position "renderActionsSLDR"
%TAB%%TAB%bam 'SLDRSTAR'
%TAB%%TAB%sliderBackground 'SLDRBACK'
%TAB%%TAB%scaleToClip
%TAB%%TAB%sequence 0
%TAB%%TAB%frame 1
%TAB%%TAB%settings %ctl_num_settings%
%TAB%%TAB%pad %ctl_pad_x% %ctl_pad_y% %ctl_pad_w% %ctl_pad_h%
%TAB%%TAB%action
%TAB%%TAB%"
%TAB%%TAB%%TAB%helpString = '%ctl_description%'
%TAB%%TAB%%TAB%selectedOpt = 0
%TAB%%TAB%%TAB%selectedSL = %ctl_id%
%TAB%%TAB%"
%TAB%}
~
OUTER_TEXT_SPRINT codeActionFeedbackLabel ~%TAB%label
%TAB%{
%TAB%%TAB%area %ctl_info_x% %ctl_info_y% %ctl_info_w% %ctl_info_h%
%TAB%%TAB%text lua "getRenderActions(renderActionsSLDR)"
%TAB%%TAB%text style "label"
%TAB%%TAB%text align center center
%TAB%}
%TAB%
~
<<<<<<<< .../inlined/hiddengameplayoptions/codeActionFeedbackText.menu

text
{
area %ctl_label_x% %ctl_label_y% %ctl_label_w% %ctl_label_h%
text "%ctl_label%"
text style "label"
text align right center
text upper
text highlight lua "getSelected(selectedSL, %ctl_id%)"
action
"
helpString = '%ctl_description%'
selectedOpt = 0
selectedSL = %ctl_id%
"
}
>>>>>>>>
<<<<<<<< .../inlined/hiddengameplayoptions/codeActionFeedbackSlider.menu
slider
{
area %ctl_slider_x% %ctl_slider_y% %ctl_slider_w% %ctl_slider_h%
position "renderActionsSLDR"
bam 'SLDRSTAR'
mosaic GUISLDR
sequence 0
frame 1
settings %ctl_num_settings%
pad %ctl_pad_x% %ctl_pad_y% %ctl_pad_w% %ctl_pad_h%
action
"
helpString = '%ctl_description%'
selectedOpt = 0
selectedSL = %ctl_id%
"
}
>>>>>>>>
<<<<<<<< .../inlined/hiddengameplayoptions/codeActionFeedbackSlider25.menu
slider
{
area %ctl_slider_x% %ctl_slider_y% %ctl_slider_w% %ctl_slider_h%
position "renderActionsSLDR"
bam 'SLDRSTAR'
sliderBackground 'SLDRBACK'
scaleToClip
sequence 0
frame 1
settings %ctl_num_settings%
pad %ctl_pad_x% %ctl_pad_y% %ctl_pad_w% %ctl_pad_h%
action
"
helpString = '%ctl_description%'
selectedOpt = 0
selectedSL = %ctl_id%
"
}
>>>>>>>>
<<<<<<<< .../inlined/hiddengameplayoptions/codeActionFeedbackLabel.menu
label
{
area %ctl_info_x% %ctl_info_y% %ctl_info_w% %ctl_info_h%
text lua "getRenderActions(renderActionsSLDR)"
text style "label"
text align center center
}

>>>>>>>>

/**
* This code snippet adds a new action feedback slider control specifically to PST:EE.
Expand All @@ -90,49 +94,50 @@ OUTER_TEXT_SPRINT codeActionFeedbackLabel ~%TAB%label
* STR_VAR LUA description strref: ctl_desc_strref
* STR_VAR LUA description variable: ctl_description (UNUSED)
*/
OUTER_TEXT_SPRINT codeActionFeedbackSlider_PSTEE ~%TAB%
%TAB%text
%TAB%{
%TAB%%TAB%area %ctl_label_x% %ctl_label_y% %ctl_label_w% %ctl_label_h%
%TAB%%TAB%text "%ctl_label%"
%TAB%%TAB%text style "normal_parchment"
%TAB%%TAB%text useFontZoom 0
%TAB%%TAB%text align left center
%TAB%%TAB%focus color 255 255 255 255
%TAB%%TAB%text color lua "getLabelColor(%ctl_id%)"
%TAB%%TAB%action
%TAB%%TAB%"
%TAB%%TAB%%TAB%helpString = %ctl_desc_strref%
%TAB%%TAB%%TAB%selFeedOpt = 0
%TAB%%TAB%%TAB%selMessageOpt = 0
%TAB%%TAB%%TAB%selectedSL = %ctl_id%
%TAB%%TAB%"
%TAB%}
%TAB%slider
%TAB%{
%TAB%%TAB%area %ctl_slider_x% %ctl_slider_y% %ctl_slider_w% %ctl_slider_h%
%TAB%%TAB%position "renderActionsSLDR"
%TAB%%TAB%bam 'SLDRSTAR'
%TAB%%TAB%mosaic sliderbg
%TAB%%TAB%settings %ctl_num_settings%
%TAB%%TAB%action
%TAB%%TAB%"
%TAB%%TAB%%TAB%helpString = %ctl_desc_strref%
%TAB%%TAB%%TAB%selFeedOpt = 0
%TAB%%TAB%%TAB%selMessageOpt = 0
%TAB%%TAB%%TAB%selectedSL = %ctl_id%
%TAB%%TAB%"
%TAB%}
%TAB%label
%TAB%{
%TAB%%TAB%area %ctl_info_x% %ctl_info_y% %ctl_info_w% %ctl_info_h%
%TAB%%TAB%text lua "getRenderActions(renderActionsSLDR)"
%TAB%%TAB%text style "normal"
%TAB%%TAB%text useFontZoom 0
%TAB%%TAB%text align center center
%TAB%}
%TAB%
~
<<<<<<<< .../inlined/hiddengameplayoptions/codeActionFeedbackSlider_PSTEE.menu

text
{
area %ctl_label_x% %ctl_label_y% %ctl_label_w% %ctl_label_h%
text "%ctl_label%"
text style "normal_parchment"
text useFontZoom 0
text align left center
focus color 255 255 255 255
text color lua "getLabelColor(%ctl_id%)"
action
"
helpString = %ctl_desc_strref%
selFeedOpt = 0
selMessageOpt = 0
selectedSL = %ctl_id%
"
}
slider
{
area %ctl_slider_x% %ctl_slider_y% %ctl_slider_w% %ctl_slider_h%
position "renderActionsSLDR"
bam 'SLDRSTAR'
mosaic sliderbg
settings %ctl_num_settings%
action
"
helpString = %ctl_desc_strref%
selFeedOpt = 0
selMessageOpt = 0
selectedSL = %ctl_id%
"
}
label
{
area %ctl_info_x% %ctl_info_y% %ctl_info_w% %ctl_info_h%
text lua "getRenderActions(renderActionsSLDR)"
text style "normal"
text useFontZoom 0
text align center center
}

>>>>>>>>

/**
* Adds an action feedback slider to the Gameplay > Feedback section of the game.
Expand Down Expand Up @@ -328,7 +333,7 @@ BEGIN
END
PATCH_IF (success) BEGIN
PATCH_IF (GAME_IS ~bgee~) BEGIN
PATCH_IF (GAME_INCLUDES ~sod~) BEGIN
PATCH_IF (GAME_INCLUDES ~sod~ || INSTALLED_DRAGONSPEAR_UI) BEGIN
// BGEE+SoD
LPF __A7_ADD_SLIDER_ACTION_FEEDBACK_BGSOD RET success END
END ELSE BEGIN
Expand Down Expand Up @@ -518,6 +523,9 @@ BEGIN
TEXT_SPRINT ctl_label ~%optLabelName%~
TEXT_SPRINT ctl_description ~%optDescName%~

LPF LOAD_INLINED_DATA STR_VAR name = ~codeActionFeedbackText~ RET codeActionFeedbackText = code END
LPF LOAD_INLINED_DATA STR_VAR name = ~codeActionFeedbackSlider~ RET codeActionFeedbackSlider = code END
LPF LOAD_INLINED_DATA STR_VAR name = ~codeActionFeedbackLabel~ RET codeActionFeedbackLabel = code END
TEXT_SPRINT code EVAL ~%codeActionFeedbackText%%codeActionFeedbackSlider%%codeActionFeedbackLabel%~
INNER_PATCH_SAVE code ~%code%~ BEGIN
// padding not needed
Expand Down Expand Up @@ -550,7 +558,7 @@ BEGIN
SET ofsEnd = INDEX_BUFFER(~^[ %TAB%]*menu[ %TAB%%WNL%]*{~ ofsStart)
PATCH_IF (ofsEnd > ofsStart) BEGIN
// adjusting vertical position of existing sliders
SET gap = (MOD_IS_INSTALLED ~dragonspear_ui++.tp2~ 1) ? 65 : 75
SET gap = INSTALLED_DRAGONSPEAR_UI ? 65 : 75
LPF __A7_UPDATE_SLIDER_POSITIONS
INT_VAR
ofsStart
Expand All @@ -571,7 +579,7 @@ BEGIN
SET ofs1 = INDEX_BUFFER(~^[ %TAB%]*button[ %TAB%%WNL%]*{~ ofs1)
END
PATCH_IF (ofs1 > ofsStart && ofs1 < ofsEnd) BEGIN
PATCH_IF (MOD_IS_INSTALLED ~dragonspear_ui++.tp2~ 1) BEGIN
PATCH_IF (INSTALLED_DRAGONSPEAR_UI) BEGIN
SET ctl_label_x = 110 SET ctl_label_y = 262 SET ctl_label_w = 186 SET ctl_label_h = 36
SET ctl_slider_x = 300 SET ctl_slider_y = 262 SET ctl_slider_w = 200 SET ctl_slider_h = 36
SET ctl_info_x = 300 SET ctl_info_y = 298 SET ctl_info_w = 200 SET ctl_info_h = 36
Expand All @@ -582,16 +590,18 @@ BEGIN
END
SET isPatch25 = INDEX_BUFFER(~sliderBackground~) >= 0 ? 1 : 0
PATCH_IF (isPatch25) BEGIN
TEXT_SPRINT codeSlider ~%codeActionFeedbackSlider25%~
LPF LOAD_INLINED_DATA STR_VAR name = ~codeActionFeedbackSlider25~ RET codeSlider = code END
SET ctl_pad_x = 5 SET ctl_pad_y = 0 SET ctl_pad_w = 4 SET ctl_pad_h = 0
END ELSE BEGIN
TEXT_SPRINT codeSlider ~%codeActionFeedbackSlider%~
LPF LOAD_INLINED_DATA STR_VAR name = ~codeActionFeedbackSlider~ RET codeSlider = code END
END
SET ctl_id = controlID
SET ctl_num_settings = numSettings
TEXT_SPRINT ctl_label ~%optLabelName%~
TEXT_SPRINT ctl_description ~%optDescName%~

LPF LOAD_INLINED_DATA STR_VAR name = ~codeActionFeedbackText~ RET codeActionFeedbackText = code END
LPF LOAD_INLINED_DATA STR_VAR name = ~codeActionFeedbackLabel~ RET codeActionFeedbackLabel = code END
TEXT_SPRINT code EVAL ~%codeActionFeedbackText%%codeSlider%%codeActionFeedbackLabel%~
PATCH_IF (NOT isPatch25) BEGIN
INNER_PATCH_SAVE code ~%code%~ BEGIN
Expand Down Expand Up @@ -654,6 +664,9 @@ BEGIN
TEXT_SPRINT ctl_label ~%optLabelName%~
TEXT_SPRINT ctl_description ~%optDescName%~

LPF LOAD_INLINED_DATA STR_VAR name = ~codeActionFeedbackText~ RET codeActionFeedbackText = code END
LPF LOAD_INLINED_DATA STR_VAR name = ~codeActionFeedbackSlider~ RET codeActionFeedbackSlider = code END
LPF LOAD_INLINED_DATA STR_VAR name = ~codeActionFeedbackLabel~ RET codeActionFeedbackLabel = code END
TEXT_SPRINT code EVAL ~%codeActionFeedbackText%%codeActionFeedbackSlider%%codeActionFeedbackLabel%~
INNER_PATCH_SAVE code ~%code%~ BEGIN
// padding not needed
Expand Down Expand Up @@ -715,6 +728,9 @@ BEGIN
TEXT_SPRINT ctl_label ~%optLabelName%~
TEXT_SPRINT ctl_description ~%optDescName%~

LPF LOAD_INLINED_DATA STR_VAR name = ~codeActionFeedbackText~ RET codeActionFeedbackText = code END
LPF LOAD_INLINED_DATA STR_VAR name = ~codeActionFeedbackSlider~ RET codeActionFeedbackSlider = code END
LPF LOAD_INLINED_DATA STR_VAR name = ~codeActionFeedbackLabel~ RET codeActionFeedbackLabel = code END
TEXT_SPRINT code EVAL ~%codeActionFeedbackText%%codeActionFeedbackSlider%%codeActionFeedbackLabel%~
SET strlen = STRING_LENGTH ~%code%~
INSERT_BYTES ofs1 strlen
Expand Down Expand Up @@ -760,6 +776,7 @@ BEGIN
SPRINT ctl_description (AT optDescTra)
SET ctl_desc_strref = RESOLVE_STR_REF(~%ctl_description%~)

LPF LOAD_INLINED_DATA STR_VAR name = ~codeActionFeedbackSlider_PSTEE~ RET codeActionFeedbackSlider_PSTEE = code END
TEXT_SPRINT code EVAL ~%codeActionFeedbackSlider_PSTEE%~
SET strlen = STRING_LENGTH ~%code%~
INSERT_BYTES ofs1 strlen
Expand Down
Loading

0 comments on commit fd06d72

Please sign in to comment.