Skip to content

[MOD] Infinity UI++ Beta v0.93

PeccaPecca Member Posts: 2,215
edited November 2 in UI Modding
uy0477axs7cc.png
This mod completely overhauls original UI. It has originated from my older mod Dragonspear UI++, but eventually I have decided for it to become a new mod.

This is a Beta release, play at yor own risk!!! I will be glad if you report bugs you come across in this thread.

Summary of the changed content:

General:
-Compatibility:
----BG:EE
----BG2:EE
----IWD:EE
----EET
-Skins:
----Dragonspear
----IWD:EE - work in progress
----BG Stone - work in progress
----BG2 Roots - work in progress
-EEex compatibility:
----UI zoom
----Extended spell menu - not implemented yet/untested
-HD graphical resources (sharp rendering PST:EE-like)

Gameplay screen:
-Layout:
----overhauled basic layout
----modern layout (PoE-like)
-Message box:
----standard bottom centered
----unlocked (freely movable, resizable)
-Overhauled dialog box (classic with scroll-up to see history, quick load, add notes)
-Extended quickloot
-Quickloot junk filter - untested
-Hotkey buttons (freely movable, assignable to a character) - untested
-Script buttons (run scripts from game files) - not implemented yet

Journal:
-Layout:
----large layout (hard paused)
----overhauled small layout (freely movable, resizable height)
-New tabs:
----current and finished quest splitted, standard journal
----bestiary (designed from user notes, keeps track of killed monsters, gradually revealing stats) - wip, bg1 monsters only
----library (designed from user notes, keeps track of history books when opened in inventory)

Inventory:
-Layout:
----overhauled all party inventory
----overhauled all party inventory with character switch on hover
----overhauled single character inventory with item name
-Overhauled item description (not modal)
-Overhauled quantity popup - not implemented yet

Record screen:
-Overhauled layout
-Overhauled experience bars
-Overhauled next level screen and other child screens - not implemented yet

Mage, Priest screen:
-Overhauled layout
-Known spells in 3 columns in one scrollable list
-Memorized spells of all levels in one scrollable list, expandable rows
-Overhauled spell description (not modal)
-Overhauled mage contingency screen
-Improved spell icons - not implemented yet

Options screen:
-Overhauled layout
-All sections on parent screen, no sub-sections
-New section UI++ settings with settings related to this mod

Map screen:
-Overhauled layout
-Extended space of world map

Store screen:
-Overhauled layout
-two modes for buy/sell window - rows and tiles
-automatically sell entire stack

Multiplayer screen:
-Overhauled layout - not implemented yet

Start screen:
-Overhauled layout (SoD-like)
-New background art drawn by @Seldar

Multiplayer connection screen:
-Overhauled layout - not implemented yet

Load game screen:
-saves displayed by rows or tiles
-Filter by character list
-Sorting by time/name

Save game screen:
-Overhauled layout - not implemented yet

New game screen:
-Overhauled layout
-Improved portrait picker
-Improved Race & Class screen
-Auto-roller option
-Overhaul skills and spells screens - not implemented yet
-in IWD:EE, default IWD and (IWD2 thanks to @ineth ) character portraits are used as a background

Chapter screen:
-Overhauled layout

Pop-up windows:
-Overhauled layout - work in progress

Installation:
Download the mod from GitHub and extract the zip file in the game's core folder (the one with a file "chitin.key" in it) and run "setup-infinity_ui++.exe".

If you purchased your BG:EE game from Steam or GoG and you have a SoD expansion installed as well, you need to first install DLC Merger before installing any mod.

Screenshots:
jzlz67fp5kaw.png
fwkgq01dhgu3.png
mirqjooa4ahc.png
z78emfas4d22.png
b98b4py37itw.png
8u794xm8qwno.png
folj41qpcods.png
wfvxxwlwbofp.png
qss9i8o7q2hr.pnga4hr51w7448d.png4ey3uv0f8ypx.pngeftlxspzy8k8.png
4641x9qdq5ui.png
6bc22h9uaqw7.pngurvgyznafxfw.pngjert2obhut25.jpg
Post edited by Pecca on
«13456717

Comments

  • JinashiJinashi Member Posts: 47
    edited March 2023
    The link does not work
  • PeccaPecca Member Posts: 2,215
    Okay try again now, I changed it from private to public.
  • JinashiJinashi Member Posts: 47
    Thank you!
  • JuliusBorisovJuliusBorisov Member, Administrator, Moderator, Developer Posts: 22,753
    This is just <3<3<3 . Really impressive! We'll try to do a mod spotlight post on our socials in the future to highlight this amazing UI take.
  • PeccaPecca Member Posts: 2,215
    This is just <3<3<3 . Really impressive! We'll try to do a mod spotlight post on our socials in the future to highlight this amazing UI take.

    Thank you, but it's still just very beta. :)
  • CahirCahir Member, Moderator, Translator (NDA) Posts: 2,819
    Looks fantastic! I've been waiting for this sooo long. I know it's still beta, but it already looks amazing.
  • BubbBubb Member Posts: 1,005
    Looks awesome, great work Pecca! The floating hotkey menu blew my mind a little bit. I'll try to get the spell menu to properly support it as soon as possible.
  • PeccaPecca Member Posts: 2,215
    edited March 2023
    Bubb wrote: »
    Looks awesome, great work Pecca! The floating hotkey menu blew my mind a little bit. I'll try to get the spell menu to properly support it as soon as possible.

    Thanks. :)
    The idea of hotkey buttons is very old, it predates even your spell menu, as I was trying to solve the same problem at that time. Extended spell menu solves the problem way more efficiently so I decided to implement it mostly for its multi-character selection functionality.
  • EnigmajazzEnigmajazz Member Posts: 17
    Hi Pecca, I think this looks fantastic. I'm confused about what the hotkey menu is supposed to do, I seem to be able to make pluses appear but it doesn't appear to achieve much, so I'm obviously missing something. Are you able to enlighten me please about the functionality of this aspect of the mod
  • SourSour Member Posts: 109
    My character portraits appear larger than they are supposed to. With the advanced UI option the character portraits on the left hand bottom of the screen overlap the central command bar. The classic version is usable but I can tell from the screenshots in the first post that my character portraits are too large in that mode as well. Is there a way to shrink them?
  • PeccaPecca Member Posts: 2,215
    Enigmajazz wrote: »
    Hi Pecca, I think this looks fantastic. I'm confused about what the hotkey menu is supposed to do, I seem to be able to make pluses appear but it doesn't appear to achieve much, so I'm obviously missing something. Are you able to enlighten me please about the functionality of this aspect of the mod

    Hi, you must have hotkeys of spells or abilities assigned. Then they will appear in the menu bar.
    Sour wrote: »
    My character portraits appear larger than they are supposed to. With the advanced UI option the character portraits on the left hand bottom of the screen overlap the central command bar. The classic version is usable but I can tell from the screenshots in the first post that my character portraits are too large in that mode as well. Is there a way to shrink them?

    Modern HUD requires you play with unscaled interface or zoomed out a bit with EEex zoom feature.
  • EndarireEndarire Member Posts: 1,519
    @Pecca
    Thankee for releasing the beta of this as you did! Alleluia!

    We eagerly await full functionality, regardless of how many skins are included!
  • Ludwig_IILudwig_II Member Posts: 379
    This mod looks amazing. I love it based on my initial testing. Thank you Pecca. I especially love the inventory screen with single character option. That's what I was missing the most in dragonspear ui++. This version is awesome.

    One thing I couldn't find is, large character portraits option in ui settings. In dragonspear ui++ we had that option, and it looks much better for solo players like me. Will it be possible to include this in the future?

    Thanks
  • PeccaPecca Member Posts: 2,215
    Ludwig_II wrote: »
    One thing I couldn't find is, large character portraits option in ui settings. In dragonspear ui++ we had that option, and it looks much better for solo players like me. Will it be possible to include this in the future?

    Thanks

    I'm not planning any new features at the moment, only what is described in the OP. DUI's large portrait was a partial solution to the lack of zooming capability, that now presents EEex zooming feature.
  • PeccaPecca Member Posts: 2,215
    Added more screenshots.
  • cdxcdx Member Posts: 94
    Hi Pecca, very nice design for the new UI!

    Some color scheme feedback, If I may, even though it's based on personal taste rather than ideas for improvement. The ruby red is a very pleasant color but it seems to me a bit too saturated, to the point of distraction.
    The original:
    8u794xm8qwno.png

    Compared to a bit more desaturated red:
    0IET6da.png

    The difference isn't big but the red bits are less emphasised, which gives the UI a more "whole" look. On the last screenshot the red bottom row seems maybe a bit too saturated as well, for a near permanent on-screen element of the UI. Then again, it's just a personal preference, high contrast isn't bad in itself, makes things pop out more, the UI feels more dynamic/elaborate.
  • PeccaPecca Member Posts: 2,215
    Thanks for the feedback. I decided for this look a long time ago and yes, it is always a personal preference. I don't plan to change current assets, but I do plan to add more skins.
  • BerinvarBerinvar Member Posts: 19
    Thanks for releasing this @Pecca it looks great!! I'm downloading it as we speak. Can't wait to jump and and test it.
  • EtaminEtamin Member Posts: 830
    edited March 2023
    At installed this mod and found few issues:
    1) Some elements are still not reskined:
    2hlagcx6bhia.png
    40vmz6d1zpin.png
    ss3g8087f1be.png



    2) I got those names in down-left corner:
    v6f1vrirwm3u.png

    3) Books and bestiary tabs in journal have strange names:
    4imkeqry3ali.png

    4) I don't know why, but my dialogue box moved up after conversation:
    eba5wto79l36.png

    5) When i want to buy something i automatically buy all available items. I have to click again to pick only 1.

    6) I got 2 ctd. First time when i wanted to pick voice line during creation of my character and second time when Imoen joined me. She got 32 000 exp and after leveling her i got ctd.

    That was very fast, 10 minutes play. Maybe i will find more later.
  • PeccaPecca Member Posts: 2,215
    @Etamin beta has only english language. What is ctd?
  • ZelixZelix Member Posts: 2
    Anyone installed this on EET with Project Infinity and SCS?

    I'm unable to get SCS Initialize AI to install due to conflicts with the UI.menu and yloc.

    //Including and running function(s) difficulty_controls
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //ERROR: cannot convert feedback_yloc or %feedback_yloc% to an integer
    //ERROR: [ui.menu] -> [override/ui.menu] Patching Failed (COPY) (Not_found)



    I installed with the same order just 2 days with DragonspearUI++, so I'm pretty sure any incompatibilities are with this brand new mod.

    I know this is beta, but I wanted to help, so I didn't get rid of my old copy of my modded run. :)
    I can get whatever logs needed.
  • JinashiJinashi Member Posts: 47
    edited March 2023
    Zelix wrote: »
    Anyone installed this on EET with Project Infinity and SCS?

    I'm unable to get SCS Initialize AI to install due to conflicts with the UI.menu and yloc.

    //Including and running function(s) difficulty_controls
    //Copying and patching 1 file ...
    //Copying and patching 1 file ...
    //ERROR: cannot convert feedback_yloc or %feedback_yloc% to an integer
    //ERROR: [ui.menu] -> [override/ui.menu] Patching Failed (COPY) (Not_found)



    I installed with the same order just 2 days with DragonspearUI++, so I'm pretty sure any incompatibilities are with this brand new mod.

    I know this is beta, but I wanted to help, so I didn't get rid of my old copy of my modded run. :)
    I can get whatever logs needed.

    I've been trying for a good hour to modify the SSC file to correct this error, because the component that is blocking is essential for the rest (the SSC AI). But I'm a bit new to the language so it's difficult.

    EDIT: I managed to modify the concerned file enough for the error to disappear, but I still have about 100 components to install so I can't yet check if my correction will create bugs or not
  • EnigmajazzEnigmajazz Member Posts: 17
    @Pecca
    I think it is not possible to select has in eet. I've noticed it in the middle of a big install so it could be another mod interfering and I've not had the chance to test with just eet installed however I think the code below means the abilities button to select hlas on level up only appears on bg2, whereas eet would need game engine ==4. Am I correct and can I rectify this?

    enabled "chargen.levelingUp and rgGetGameEngine() == 2"
    area 524 661 320 70
    bam rgdmbut1
    ScaleToClip
    text "HIGH_LEVEL_ABILITIES_BUTTON"
    text style "button"
    toggle "levelUpInfoToggle"
    clickable lua "createCharScreen:IsHighLevelAbilitiesButtonClickable()"
    action
    "
    createCharScreen:OnHighLevelAbilitiesButtonClick()
  • EtaminEtamin Member Posts: 830
    Pecca wrote: »
    @Etamin beta has only english language. What is ctd?

    Crash to desktop.
  • PeccaPecca Member Posts: 2,215
    Zelix wrote: »
    /ERROR: [ui.menu] -> [override/ui.menu] Patching Failed (COPY) (Not_found)

    Any mod that patches ui.menu will likely not work until authors make changes to make it compatible. Ui.menu from this mod is completely different from vanilla.
  • PeccaPecca Member Posts: 2,215
    Enigmajazz wrote: »
    @Pecca
    I think it is not possible to select has in eet. I've noticed it in the middle of a big install so it could be another mod interfering and I've not had the chance to test with just eet installed however I think the code below means the abilities button to select hlas on level up only appears on bg2, whereas eet would need game engine ==4. Am I correct and can I rectify this?

    Correct, will fix this.
  • EndarireEndarire Member Posts: 1,519
    Any plans to eventually allow characters to select portraits regardless of sex?
  • EnigmajazzEnigmajazz Member Posts: 17
    edited April 2023
    @Jinashi i'd be interested to know what changes you made to the initialise component to make it work.
    This can actually be bypassed by setting Force_difficulty_widget to 1 in the scs ini, which will prevent the initialise trying to patch the UI and instead you would access changing the difficulties via an innate ability. I've not yet tested this as I've not reached that part of the install but this should stop it interacting with the UI at all.
  • BerinvarBerinvar Member Posts: 19
    Etamin wrote: »
    At installed this mod and found few issues:

    4) I don't know why, but my dialogue box moved up after conversation:
    eba5wto79l36.png

    6) I got 2 ctd. First time when i wanted to pick voice line during creation of my character and second time when Imoen joined me. She got 32 000 exp and after leveling her i got ctd.

    That was very fast, 10 minutes play. Maybe i will find more later.
    I can confirmed the above 2 issues:

    - the message box moves up after conversations or loading a save.

    - I get a Crash To Desktop (ctd) when selecting a voice set at chr creation and pressing the Play button. If I only select a voice set the game doesn't crash, but my selection doesn't get remembered either.

    In addition I noticed the following:

    - the world map is not centered, and I have to double-click on locations to travel there. Single-clicking seems to "select" the location, highlighting it.

    - store windows are a bit messed up. The 3 buttons on the left are stretched, and there seem to be some elements on the top right that are not showing properly.
  • JinashiJinashi Member Posts: 47
    edited April 2023
    For the problem with SSC, I corrected the problem by replacing the file in stratagems/lib/difficulty_controls.tpa with this code.
    To be done before the installation.

    To keep it simple, I replaced OPTIONS_GAMEPLAY with RG_OPTIONS_BAR
    DEFINE_ACTION_FUNCTION difficulty_controls BEGIN
    
        OUTER_SPRINT component_loc lib
    
        // check if we're using the widget
        
        ACTION_IF enhanced_edition BEGIN
           OUTER_SET ui_integration=1
           LAF check_ini STR_VAR ini=Force_Difficulty_Widget RET value END
           ACTION_IF value BEGIN
              OUTER_SET ui_integration=0
           END
        END ELSE BEGIN
           OUTER_SET ui_integration=0
        END
        
        // if not, try fixing the interface
        
        ACTION_IF ui_integration BEGIN
           LAF difficulty_ui RET abort END
           ACTION_IF abort BEGIN 
              OUTER_SET ui_integration=0
           END
        END
     
    // define commonly-held strings
    
       ACTION_DEFINE_ASSOCIATIVE_ARRAY "diff_report_strings" BEGIN
          0 => 1010
          1 => 1011
          2 => 1012
          3 => 1013
          4 => 1014
          5 => 1015
          6 => 1016
          7 => 1017
       END
    
       ACTION_DEFINE_ASSOCIATIVE_ARRAY "diff_choice_strings" BEGIN
          0 => 1020
          1 => 1021
          2 => 1022
          3 => 1023
          4 => 1024
          5 => 1025
          6 => 1026
          7 => 1027
       END
    
       ACTION_DEFINE_ASSOCIATIVE_ARRAY "diff_response_strings" BEGIN
          0 => 1050
          1 => 1051
          2 => 1052
          3 => 1053
          4 => 1054
          5 => 1055
          6 => 1056
          7 => 1057
       END
       ACTION_IF GAME_IS iwdee BEGIN
          OUTER_SET $diff_report_string(7) = 1028
          OUTER_SET $diff_choice_strings(7) = 1029
          OUTER_SET $diff_response_strings(8) = 1058
       END
    
    // build beginning section
    
       <<<<<<<<  .../stratagems-inline/difficulty_dialog.d
    BEGIN ~dw#diffi~
    
    IF ~True()~ THEN BEGIN initial
         SAY @1030
       >>>>>>>>
    
    COPY ".../stratagems-inline/difficulty_dialog.d" "%workspace%"
    
    // add the blocks corresponding to initial choices
    
       LAF process_table STR_VAR table=difficulty_controls.2da function=difficulty_helper_initial END
    
    // finish the block, add exit block and acknowledgement blocks
    
    
    <<<<<<<< .../stratagems-inline/difficulty_dialog_integration.txt
    IF ~~ THEN REPLY @1031 GOTO exit
    END
    
    IF ~~ THEN BEGIN exit
    SAY @1032
    IF ~~ THEN DO ~DestroySelf()~ EXIT
    END
    >>>>>>>>
    
    <<<<<<<< .../stratagems-inline/difficulty_dialog_no_integration.txt
    IF ~Global("DW_difficulty_control_inactive","GLOBAL",0)~ THEN REPLY @1033 DO ~SetGlobal("DW_difficulty_control_inactive","GLOBAL",1)~ GOTO control_off
    IF ~Global("DW_difficulty_control_inactive","GLOBAL",1)~ THEN REPLY @1034 DO ~SetGlobal("DW_difficulty_control_inactive","GLOBAL",0)~ GOTO control_on
    IF ~~ THEN REPLY @1031 GOTO exit
    END
    
    IF ~~ THEN BEGIN control_off
    SAY @1035
    IF ~~ THEN GOTO initial
    END
    
    IF ~~ THEN BEGIN control_on
    SAY @1036
    IF ~~ THEN GOTO initial
    END 
    
    IF ~~ THEN BEGIN exit
    SAY @1032
    IF ~Global("DW_difficulty_control_inactive","GLOBAL",0)~ THEN DO ~ApplySpellRES("dw#diff2",Player1)DestroySelf()~ EXIT
    IF ~Global("DW_difficulty_control_inactive","GLOBAL",1)~ THEN DO ~DestroySelf()~ EXIT
    END
    >>>>>>>>
    
    <<<<<<<< .../stratagems-inline/difficulty_acknowledge.txt
    IF ~~ THEN BEGIN acknowledge_%var% SAY (AT %string%)
    IF ~~ THEN GOTO initial
    END
    >>>>>>>>
    
    COPY "%workspace%/difficulty_dialog.d" "%workspace%"
        PATCH_IF ui_integration BEGIN
           APPEND_FILE TEXT ".../stratagems-inline/difficulty_dialog_integration.txt"
        END ELSE BEGIN
           APPEND_FILE TEXT ".../stratagems-inline/difficulty_dialog_no_integration.txt"
        END
        FOR (var=0;var<=7;var+=1) BEGIN
            SET string=$diff_response_strings("%var%")
            APPEND_FILE_EVALUATE TEXT ".../stratagems-inline/difficulty_acknowledge.txt"
        END
    
    // add the main blocks
    
    LAF process_table STR_VAR table=difficulty_controls.2da function=difficulty_helper_main END
    
    /// compile the dialog file
    
    
    COMPILE "%workspace%/difficulty_dialog.d" EVALUATE_BUFFER
    
    // make the accompanying bits
    
    LAF install STR_VAR file="dw#diffi.cre" location=resource END // basically a tweaked copy of cutspy
    
    LAF check_ini STR_VAR ini=difficulty_icon RET value END
    ACTION_IF FILE_EXISTS "%MOD_FOLDER%/lib/diff_icons/%value%.bam" BEGIN
       COPY "%MOD_FOLDER%/lib/diff_icons/%value%.bam" "override/dw#diffi.bam"
    END ELSE BEGIN
       COPY "%MOD_FOLDER%/lib/diff_icons/v6.bam" "override/dw#diffi.bam"  // default
    END
    
    <<<<<<<< .../stratagems-inline/dw#diffi.baf
    IF
    	NumberOfTimesTalkedTo(0)
    	Detect([PC])
    THEN
    	RESPONSE #100
    		StartDialogueNoSet(LastSeenBy(Myself))
    END
    >>>>>>>>
    COMPILE ".../stratagems-inline/dw#diffi.baf"
    
    
    
    MAKE_PATCH
       say_name=>1018
       add_basic_ability=>null
       patch_ability_inline=>~ability_icon=>dw#diffi ability_target=>5 ability_icon_loc=>4~
       spell_type=>innate
       add_effect_inline=>"opcode=>67 target=>1 duration=>60 resource=>dw#diffi"
       add_effect_inline'=>"opcode=>172 target=>1 timing=>1 resource=>dw#diff1"
    END
    LAF make_spell STR_VAR spell=dw#diff1 edits=patch_data END
    
    MAKE_PATCH
       add_basic_ability=>null
       add_effect_inline=>"opcode=>171 target=>2 timing=>1 resource=>dw#diff1"
    END
    LAF make_spell STR_VAR spell=dw#diff2 edits=patch_data END
    
    // install it in starting areas if we don't have integration
    
    ACTION_IF !ui_integration BEGIN
    
    <<<<<<<< .../stratagems-inline/diff_install.baf
    IF
      !Global("DW_initialise_difficulty_widget","GLOBAL",1)
    THEN
        RESPONSE #100
                 SetGlobal("DW_initialise_difficulty_widget","GLOBAL",1)
                 ApplySpellRES("dw#diff2",Player1)
                 Continue()
    END
    >>>>>>>>
    
    ACTION_IF is_bg2 BEGIN
        LAF extend_area_script STR_VAR area="ar3000 ar4000 ar0602" top=diff_install inline=yes END
    END
    ACTION_IF is_bg1 BEGIN
        LAF extend_area_script STR_VAR area="%Candlekeep%" top=diff_install inline=yes END
    END
    ACTION_IF is_iwd BEGIN
        LAF extend_area_script STR_VAR area="ar1006 ar9100" top=diff_install inline=yes END
    END
    
    END
    
    
    // sort out the difficulty UI strings
    
    // the ones in dialog.tlk (I'm not sure if this is relevant for EE but no harm in doing it)
    
      ACTION_IF GAME_IS bgee BEGIN
             MAKE_PATCH
                help=>24424
                easiest=>24417
                easy=>24418
                normal=>24419
                hard=>11312
                insane=>24420
             END
      END ELSE BEGIN // everything else uses the same strings
             MAKE_PATCH
                help=>18020
                easiest=>11308
                easy=>11309
                normal=>11311
                hard=>11312
                insane=>11313
             END
      END
      ACTION_DEFINE_ASSOCIATIVE_ARRAY diff_strref_lookup BEGIN
         help=>1105
         easiest=>1100
         easy=>1101
         normal=>1102
         hard=>1103
         insane=>1104
      END
      ACTION_PHP_EACH diff_strref_lookup AS key=>tra BEGIN
         OUTER_SET tlk_entry = $patch_data("%key%")
         STRING_SET_EVALUATE tlk_entry (AT tra)
      END
      
    // for EE only, the ones in L_XX_YY
    
       ACTION_IF enhanced_edition BEGIN
        MAKE_PATCH
          DIFFICULTY_DESCRIPTION => 1110
          DIFFICULTY_DESCRIPTION_CORERULES => 1111
          DIFFICULTY_DESCRIPTION_CORERULES_BG2EE => 1111
          DIFFICULTY_DESCRIPTION_CORERULES_BGEE => 1111
          DIFFICULTY_DESCRIPTION_EASY => 1112
          DIFFICULTY_DESCRIPTION_EASY_BG2EE => 1112
          DIFFICULTY_DESCRIPTION_EASY_BGEE => 1112
          DIFFICULTY_DESCRIPTION_HARD => 1133
          DIFFICULTY_DESCRIPTION_HARD_BG2EE => 1113
          DIFFICULTY_DESCRIPTION_HARD_BGEE => 1133
          DIFFICULTY_DESCRIPTION_INSANE => 1134
          DIFFICULTY_DESCRIPTION_INSANE_BG2EE => 1114
          DIFFICULTY_DESCRIPTION_INSANE_BGEE => 1134
          DIFFICULTY_DESCRIPTION_NORMAL => 1115
          DIFFICULTY_DESCRIPTION_NORMAL_BG2EE => 1115
          DIFFICULTY_DESCRIPTION_NORMAL_BGEE => 1115
          DIFFICULTY_LABEL_CORERULES => 1116
          DIFFICULTY_LABEL_CORERULES_MIXED => 1117
          DIFFICULTY_LABEL_EASY => 1118
          DIFFICULTY_LABEL_EASY_MIXED => 1119
          DIFFICULTY_LABEL_HARD => 1120
          DIFFICULTY_LABEL_HARD_MIXED => 1121
          DIFFICULTY_LABEL_NORMAL => 1124
          DIFFICULTY_LABEL_NORMAL_MIXED => 1125
          NO_DAMAGE_INCREASE_LABEL => 1126
          NO_DAMAGE_INCREASE_DESCRIPTION => 1127
          DIFFICULTY_DESCRIPTION_LEGACYOFBHAAL_BG2EE =>1135
          DIFFICULTY_DESCRIPTION_STORYMODE => 1136
          DIFFICULTY_DESCRIPTION_STORYMODE_BG2EE => 1136
          DIFFICULTY_DESCRIPTION_STORYMODE_BGEE => 1136
    
        END
        COPY_EXISTING "L_%EE_LANGUAGE%.lua" override
           PHP_EACH patch_data AS key=>value BEGIN
              SPRINT string (AT value)
              REPLACE_TEXTUALLY ~%key% *=.*~ ~%key% = "%string%",~
           END
        BUT_ONLY
    
       END
    
       // default the difficulty-damage setting to turn off difficulty-based changes
      
      LAF check_ini STR_VAR ini="enable_difficulty_based_damage_changes" RET value END
      ACTION_IF !value BEGIN
       ACTION_IF enhanced_edition BEGIN
          ACTION_IF FILE_EXISTS "%USER_DIRECTORY%/baldur.lua" BEGIN
             COPY "%USER_DIRECTORY%/baldur.lua" "%USER_DIRECTORY%"
                 REPLACE_TEXTUALLY ~SetPrivateProfileString('Game Options','Suppress Extra Difficulty Damage','0')~ ~SetPrivateProfileString('Game Options','Suppress Extra Difficulty Damage','1')~
             BUT_ONLY
          END
       END ELSE BEGIN
          <<<<<<<< .../stratagems-inline/diffmod.2da
    2DA V1.0
    0		
    	DAMAGE_MOD	LUCK_MOD
    EASIEST	0               0
    EASY	0               0
    NORMAL	0	        0
    HARD	0	        0
    HARDEST	0	        0
          >>>>>>>>
          COPY ".../stratagems-inline/diffmod.2da" override
       END
      END
    END
    
    ///////////////////////////////////////////////////////////////////
    //// Helper functions
    ///////////////////////////////////////////////////////////////////
    
    DEFINE_ACTION_FUNCTION difficulty_helper_initial
        STR_VAR codename=""
                string=""
                variable=""
                require=""
                diff_1=""
                diff_2=""
                diff_3=""
                diff_4=""
                diff_5=""
                diff_6=""
                diff_7=""
    BEGIN
        OUTER_FOR (entry=0;entry<=7;entry+=1) BEGIN
           ACTION_IF $diff("%entry%") STRING_COMPARE_CASE "" BEGIN
              OUTER_SPRINT globalstring ~Global("%variable%","GLOBAL",%entry%)Global("DW_%codename%_disable","GLOBAL",99)~
              OUTER_SPRINT append_me "IF ~%globalstring%~ THEN REPLY (AT %string%) GOTO %codename%_%entry%"
              APPEND_OUTER "%workspace%/difficulty_dialog.d" "%append_me%"
           END
        END
    END
    
    DEFINE_ACTION_FUNCTION difficulty_helper_main
        STR_VAR codename=""
                string=""
                variable=""
                require=""
                diff_1=""
                diff_2=""
                diff_3=""
                diff_4=""
                diff_5=""
                diff_6=""
                diff_7=""
    BEGIN
        OUTER_FOR (entry=0;entry<=7;entry+=1) BEGIN
         ACTION_IF $diff("%entry%") STRING_COMPARE_CASE "" BEGIN
           OUTER_SET saystring = $diff_report_strings("%entry%")
           APPEND_OUTER "%workspace%/difficulty_dialog.d" "IF ~~ THEN BEGIN %codename%_%entry% SAY (AT %saystring%)"
           APPEND_OUTER "%workspace%/difficulty_dialog.d" "IF ~~ THEN REPLY @1019 GOTO initial"
           OUTER_FOR (option=0;option<=7;option+=1) BEGIN
             ACTION_IF (option=0 || $diff("%option%")>=0) BEGIN
                 OUTER_SET replystrref = $diff_choice_strings("%option%")
                 OUTER_SPRINT replystring (AT "%replystrref%")
                 OUTER_SPRINT globalstring ~SetGlobal("%variable%","GLOBAL",%option%)~
                 ACTION_IF option>=1 BEGIN
                    OUTER_SET temp_strref="%diff_%option%%"
                    OUTER_SPRINT temp (AT %temp_strref%)
                    OUTER_SPRINT replystring "%replystring%%temp%"
                 END
                 APPEND_OUTER "%workspace%/difficulty_dialog.d" "IF ~~ THEN REPLY ~%replystring%~ DO ~%globalstring%~ GOTO acknowledge_%option%"
             END
           END
           APPEND_OUTER "%workspace%/difficulty_dialog.d" "END"
         END
        END
    
    
    END
    
    DEFINE_ACTION_FUNCTION difficulty_ui
       RET abort
    BEGIN
               // first sort out what 3/4-size BAM we should use (if we have to resize):
               
               OUTER_SET x_rescale=1  // at present everything rescales in the x direction too
               // if one of Lefreut's enhanced UIs is installed, use that to determine the button
               ACTION_IF MOD_IS_INSTALLED "leui-bg1ee/leui-bg1ee.tp2" 0 BEGIN
                  OUTER_SPRINT smaller_bam bg1_button_resized
               END ELSE
               ACTION_IF (MOD_IS_INSTALLED "leui-sod/leui-sod.tp2" 0 || MOD_IS_INSTALLED "dragonspear_ui++/dragonspear_ui++.tp2" 0 || MOD_IS_INSTALLED "infinity_ui/infinity_ui.tp2" 0 ) BEGIN
                  OUTER_SPRINT smaller_bam sod_button_resized
               END ELSE
               ACTION_IF MOD_IS_INSTALLED "leui-iwdee/leui-iwdee.tp2" 0 BEGIN
                  OUTER_SPRINT smaller_bam iwd_button_resized
               END ELSE
               ACTION_IF MOD_IS_INSTALLED "leui/leui.tp2" 0 BEGIN
                  OUTER_SPRINT smaller_bam bg2_button_resized
               END ELSE 
               // otherwise, guess on the basis of the game
               ACTION_IF GAME_IS IWDEE BEGIN
                  OUTER_SPRINT smaller_bam iwd_button_resized
               END ELSE
               ACTION_IF GAME_INCLUDES SOD BEGIN
                  OUTER_SPRINT smaller_bam sod_button_resized
               END ELSE
               ACTION_IF GAME_IS BGEE BEGIN
                  OUTER_SPRINT smaller_bam bg1_button_resized
               END ELSE
               BEGIN
                  OUTER_SPRINT smaller_bam bg2_button_resized
               END
    
               OUTER_SET abort=0
               // get the parameters from the existing menu
               // we assume that the Assign Keys, Auto-Pause and Feedback buttons are in a vertical stack. We don't assume anything about what order they're in (Dragonspear++ breaks
               // the normal order)
               COPY_EXISTING ui.menu override
                    LPF UI_analyze_object STR_VAR object=RG_OPTIONS_BAR object_type=menu object_name_field=name patch=get_feedback_ui_coordinates RET_ARRAY feedback=patch_output END
                    LPF UI_analyze_object STR_VAR object=RG_OPTIONS_BAR object_type=menu object_name_field=name patch=get_assign_keys_ui_coordinates RET_ARRAY keys=patch_output END
                    LPF UI_analyze_object STR_VAR object=RG_OPTIONS_BAR object_type=menu object_name_field=name patch=get_auto_pause_ui_coordinates RET_ARRAY auto=patch_output END
                    PATCH_IF (keys_yloc<feedback_yloc && keys_yloc<auto_yloc) BEGIN
                       SPRINT upper_choice keys
                       PATCH_IF (feedback_yloc<auto_yloc) BEGIN
                          SPRINT lower_choice feedback
                       END ELSE BEGIN
                          SPRINT lower_choice auto
                       END
                    END ELSE BEGIN
                       PATCH_IF (feedback_yloc<auto_yloc) BEGIN
                          SPRINT upper_choice feedback
                          PATCH_IF (keys_yloc<auto_yloc) BEGIN
                             SPRINT lower_choice keys
                          END ELSE BEGIN
                             SPRINT lower_choice auto
                          END
                       END ELSE BEGIN
                          SPRINT upper_choice auto
                          PATCH_IF (keys_yloc<feedback_yloc) BEGIN
                             SPRINT lower_choice keys
                          END ELSE BEGIN
                             SPRINT lower_choice feedback
                          END
                       END
                    END
                    PATCH_FOR_EACH ind IN xloc yloc width height BEGIN
                       SET "lower_%ind%"=EVAL "%lower_choice%_%ind%"
                       SET "upper_%ind%"=EVAL "%upper_choice%_%ind%"
                    END
    
    
                    PATCH_IF !(upper_xloc=lower_xloc) || !(upper_width=lower_width) BEGIN
                       SET abort=1 // in this case the setup is too different from what we're used to
                    END
               BUT_ONLY
               ACTION_IF !abort BEGIN
                 COPY_EXISTING ui.menu override
                    //main patch
                    SET delta=lower_yloc - upper_yloc
                    SET new_yloc=upper_yloc - delta
                    SPRINT area_string "%lower_xloc% %new_yloc% %lower_width% %lower_height%"
                    LPF UI_insert_into_object STR_VAR object=RG_OPTIONS_BAR object_type=menu object_name_field=name insert=".../stratagems-inline/diff_button" END
                    LPF UI_add_function STR_VAR function=".../stratagems-inline/diff_func" END
                    LPF UI_alter_object STR_VAR object=ESC_MENU object_type=menu object_name_field=name patch="ui_sub_true" END
                    LPF UI_alter_object STR_VAR object=START_OPTIONS object_type=menu object_name_field=name patch="ui_sub_false" END
                    // tweaks
                    PATCH_IF (GAME_IS BGEE && !GAME_INCLUDES SOD) BEGIN
                      //   REPLACE_TEXTUALLY "area 44 190 360 262" "area 44 190 360 192"
                      END
                 BUT_ONLY
    
                 // add the identifying string
                 LAF UI_add_string INT_VAR tra_entry=1128 STR_VAR string_id="SCS_DIFFICULTY_BUTTON" END
    
    
    
                 // check if we have a space problem and if so, adjust
                 COPY_EXISTING "ui.menu" "%workspace%"
                               LPF UI_return_object STR_VAR object=RG_OPTIONS_BAR object_name_field=name object_type=menu RET object_data END
                 BUT_ONLY
                 OUTER_SET xmin=upper_xloc
                 OUTER_SET width=upper_width
                 OUTER_SET height=upper_height
                 OUTER_SET xmax=xmin+width
                 OUTER_SET ymax=upper_yloc
                 OUTER_INNER_PATCH "%object_data%" BEGIN
                      LPF check_clearance RET clearance END
                 END
                 ACTION_IF clearance>(height * 11)/10  BEGIN
                      OUTER_SET space=1
                 END ELSE BEGIN
                      OUTER_SET space=0
                 END
                 ACTION_IF !space BEGIN
                     PRINT "smaller_bam is %smaller_bam%"
                     COPY "%MOD_FOLDER%/%component_loc%/resource/%smaller_bam%.bam" "override/dwostcl.bam"
                     COPY_EXISTING ui.menu override
                               LPF UI_alter_object
                                   STR_VAR object=RG_OPTIONS_BAR
                                           object_type=menu
                                           object_name_field=name
                                           patch=rescale_buttons
                               END
                     BUT_ONLY
                 END
    
    
    
            END
    
    
    
    END
    
    
    
    
    /// resources and helper functions for the UI edit
    
    
    
    
    DEFINE_PATCH_FUNCTION get_feedback_ui_coordinates
        RET_ARRAY patch_output
    BEGIN
        LPF UI_analyze_object
            STR_VAR object=FEEDBACK_BUTTON
                    object_type=BUTTON
                    object_name_field=text
                    patch=UI_get_coordinates
            RET_ARRAY patch_output
        END
    END
    
    DEFINE_PATCH_FUNCTION get_assign_keys_ui_coordinates
        RET_ARRAY patch_output
    BEGIN
        LPF UI_analyze_object
            STR_VAR object=ASSIGN_KEYS_BUTTON
                    object_type=BUTTON
                    object_name_field=text
                    patch=UI_get_coordinates
            RET_ARRAY patch_output
        END
    END
    
    DEFINE_PATCH_FUNCTION get_auto_pause_ui_coordinates
        RET_ARRAY patch_output
    BEGIN
        LPF UI_analyze_object
            STR_VAR object=AUTO_PAUSE_BUTTON
                    object_type=BUTTON
                    object_name_field=text
                    patch=UI_get_coordinates
            RET_ARRAY patch_output
        END
    END
    
    
    DEFINE_PATCH_FUNCTION check_clearance
       RET clearance
    BEGIN
    SET clearance=9999
    REPLACE_EVALUATE "area +\([0-9]+\)\( \|%TAB%\)+\([0-9]+\)\( \|%TAB%\)+\([0-9]+\)\( \|%TAB%\)+\([0-9]+\)[^0-9]*"
                  BEGIN
                    SET xloc_here="%MATCH1%"
                    SET yloc_here="%MATCH3%" + "%MATCH7%"
                    SET width="%MATCH5%"
                    SET xmin_here=xloc_here
                    SET xmax_here=xloc_here + width
                    PATCH_IF (xmin_here<=xmax && xmax_here>=xmin) BEGIN
                       SET clearance_here= ymax - yloc_here
                       PATCH_IF clearance_here<0 BEGIN
                          SET clearance_here=9999
                       END
                       SET clearance = clearance < clearance_here ? clearance : clearance_here
                    END
                  END
                  ""
    
    END
    
    DEFINE_PATCH_FUNCTION difficulty_lower
    BEGIN
         LPF shared_lower INT_VAR number=4 END
    END
    
    DEFINE_PATCH_FUNCTION assign_keys_lower
    BEGIN
         LPF shared_lower INT_VAR number=3 END
    END
    
    
    DEFINE_PATCH_FUNCTION auto_feedback_lower
    BEGIN
         LPF shared_lower INT_VAR number=2 END
    END
    
    DEFINE_PATCH_FUNCTION autopause_lower
    BEGIN
         LPF shared_lower INT_VAR number=1 END
    END
    
    DEFINE_PATCH_FUNCTION shared_lower
       INT_VAR number=0
    BEGIN
         REPLACE_EVALUATE "\([0-9]+\)\( \|%TAB%\)+\([0-9]+\)\( \|%TAB%\)+\([0-9]+\)\( \|%TAB%\)+\([0-9]+\)\([^0-9]*\)"
         BEGIN
             SET xloc="%MATCH1%"
             SET yloc="%MATCH3%"
             SET width="%MATCH5%"
             SET height="%MATCH7%"
             SET yloc +=(number * height) / 4
             SET height= (3* height) / 4
             PATCH_IF x_rescale BEGIN
                SET xloc += (width / 8)
                SET width = (3* width) / 4
             END
         END
         " %xloc% %yloc% %width% %height%%MATCH8%"
         REPLACE_TEXTUALLY "bam\( \|%TAB%\)+.*\(%WNL%\|%LNL%\|%MNL%\)" "bam dwostcl\2"
    
    
    END
    
    
    DEFINE_PATCH_FUNCTION rescale_buttons
    BEGIN
        LPF UI_alter_object
            STR_VAR object=SCS_DIFFICULTY_BUTTON
                    object_type=BUTTON
                    object_name_field=text
                    patch=difficulty_lower
        END
        LPF UI_alter_object
            STR_VAR object=ASSIGN_KEYS_BUTTON
                    object_type=BUTTON
                    object_name_field=text
                    patch=assign_keys_lower
        END
        LPF UI_alter_object
            STR_VAR object=AUTO_PAUSE_BUTTON
                    object_type=BUTTON
                    object_name_field=text
                    patch=autopause_lower
        END
        LPF UI_alter_object
            STR_VAR object=FEEDBACK_BUTTON
                    object_type=BUTTON
                    object_name_field=text
                    patch=auto_feedback_lower
        END
    END
    
    DEFINE_PATCH_FUNCTION ui_sub_true BEGIN
       REPLACE_TEXTUALLY "Infinity_PushMenu( *'RG_OPTIONS_BAR' *)" "%WNL%scsInGameVar=true%WNL%Infinity_PushMenu( 'RG_OPTIONS_BAR' )%WNL%"
    END
    
    DEFINE_PATCH_FUNCTION ui_sub_false BEGIN
       REPLACE_TEXTUALLY "Infinity_PushMenu( *'RG_OPTIONS_BAR' *)" "%WNL%scsInGameVar=false%WNL%Infinity_PushMenu( 'RG_OPTIONS_BAR' )%WNL%"
    END
    
       <<<<<<<< .../stratagems-inline/diff_button
    	button
            {
    		enabled         scsInGameVar
                    bam		%feedback_bam%
    		sequence	0
    		area		%area_string%
    		text		"SCS_DIFFICULTY_BUTTON"
    		text style	"button"
    		action
    		"
    			scsSummonWidget()
    			Infinity_PopMenu()
                            e:SelectEngine(worldScreen)
    		"
    	}
       >>>>>>>>
       <<<<<<<< .../stratagems-inline/diff_func
    function scsSummonWidget()
    	  C:Eval('CreateCreatureObject("dw#diffi",Player1,0,0,0)')
    end
       >>>>>>>>
    
Sign In or Register to comment.