Skip to content

Commit c1f9894

Browse files
committed
Custom opacity for centered message box background
1 parent cc3c69f commit c1f9894

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

docs/User-Interface.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ ShowTimer.Priority=0 ; integer
388388
- Now you can set `MessageApplyHoverState` to true,to make the upper left messages not disappear while mouse hovering over the top of display area.
389389
- You can also let task subtitles (created by trigger 11) to display directly in the middle area of the screen instead of the upper left corner, with a semi transparent background, by setting `MessageDisplayInCenter` to true. In this case, all messages within this game can be saved, even after being s/l. The storage capacity of messages can reach thousands.
390390
- If you also set `MessageApplyHoverState` to true, when the mouse hovers over the subtitle area (simply judged as a rectangle), its opacity will increase and it will not disappear during this period. If the area is expanded, disabling this option will not prevent mouse clicking behavior from being restricted to this area.
391+
- `MessageDisplayInCenter.BoardOpacity` controls the opacity of the background.
391392
- `MessageDisplayInCenter.LabelsCount` controls the maximum number of subtitle labels that can automatically pop up at a same time in the middle area of the screen. At least 1.
392393
- `MessageDisplayInCenter.RecordsCount` controls the maximum number of historical messages displayed when this middle area is expanded (not the maximum number that can be stored). At least 4, and it is 8 in the demonstration gif.
393394
- The label can be toggled by ["Toggle Message Label" hotkey](#toggle-message-label) in "Interface" category.
@@ -397,6 +398,7 @@ In `RA2MD.INI`:
397398
[Phobos]
398399
MessageApplyHoverState=false ; boolean
399400
MessageDisplayInCenter=false ; boolean
401+
MessageDisplayInCenter.BoardOpacity=30 ; integer
400402
MessageDisplayInCenter.LabelsCount=6 ; integer
401403
MessageDisplayInCenter.RecordsCount=12 ; integer
402404
```

src/Misc/MessageColumn.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ void MessageScrollClass::DrawShape() const
298298
auto color = MessageColumnClass::Instance.GetColor();
299299
MessageColumnClass::Instance.DecreaseBrightness(color, 3);
300300

301-
DSurface::Composite->FillRectTrans(&drawRect, &color, MessageColumnClass::LowOpacity);
301+
DSurface::Composite->FillRectTrans(&drawRect, &color, Phobos::Config::MessageDisplayInCenter_BoardOpacity);
302302
}
303303
}
304304
else // Scroll_Bar
@@ -1111,7 +1111,7 @@ DEFINE_HOOK(0x623A9F, DSurface_sub_623880_DrawBitFontStrings, 0x5)
11111111
{
11121112
auto color = MessageColumnClass::Instance.GetColor();
11131113
MessageColumnClass::Instance.DecreaseBrightness(color, 3);
1114-
pSurface->FillRectTrans(pRect, &color, MessageColumnClass::LowOpacity);
1114+
pSurface->FillRectTrans(pRect, &color, Phobos::Config::MessageDisplayInCenter_BoardOpacity);
11151115
}
11161116

11171117
return SkipGameCode;

src/Phobos.INI.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ bool Phobos::Config::EnableSelectBox = false;
5555
bool Phobos::Config::DigitalDisplay_Enable = false;
5656
bool Phobos::Config::MessageApplyHoverState = false;
5757
bool Phobos::Config::MessageDisplayInCenter = false;
58+
int Phobos::Config::MessageDisplayInCenter_BoardOpacity = 30;
5859
int Phobos::Config::MessageDisplayInCenter_LabelsCount = 6;
5960
int Phobos::Config::MessageDisplayInCenter_RecordsCount = 12;
6061
bool Phobos::Config::RealTimeTimers = false;
@@ -88,6 +89,7 @@ DEFINE_HOOK(0x5FACDF, OptionsClass_LoadSettings_LoadPhobosSettings, 0x5)
8889
Phobos::Config::ShowPlacementPreview = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "ShowPlacementPreview", true);
8990
Phobos::Config::MessageApplyHoverState = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "MessageApplyHoverState", false);
9091
Phobos::Config::MessageDisplayInCenter = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "MessageDisplayInCenter", false);
92+
Phobos::Config::MessageDisplayInCenter_BoardOpacity = CCINIClass::INI_RA2MD.ReadInteger(phobosSection, "MessageDisplayInCenter.BoardOpacity", 30);
9193
Phobos::Config::MessageDisplayInCenter_LabelsCount = CCINIClass::INI_RA2MD.ReadInteger(phobosSection, "MessageDisplayInCenter.LabelsCount", 6);
9294
Phobos::Config::MessageDisplayInCenter_RecordsCount = CCINIClass::INI_RA2MD.ReadInteger(phobosSection, "MessageDisplayInCenter.RecordsCount", 12);
9395
Phobos::Config::RealTimeTimers = CCINIClass::INI_RA2MD.ReadBool(phobosSection, "RealTimeTimers", false);

src/Phobos.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class Phobos
9090
static bool DigitalDisplay_Enable;
9191
static bool MessageApplyHoverState;
9292
static bool MessageDisplayInCenter;
93+
static int MessageDisplayInCenter_BoardOpacity;
9394
static int MessageDisplayInCenter_LabelsCount;
9495
static int MessageDisplayInCenter_RecordsCount;
9596
static bool RealTimeTimers;

0 commit comments

Comments
 (0)