Skip to content

Commit bc1773d

Browse files
committed
feat: setting for subscreen widgets to hide during message strings
1 parent 165b421 commit bc1773d

File tree

7 files changed

+27
-28
lines changed

7 files changed

+27
-28
lines changed

scripts/changelog_overrides/generic_changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ subject dabe7c091b89fa2e09217dfb63c652184b78f65e feat(vscode): create VS Code ex
1010
subject 6ecf0775afeac108bb4f806b76f9c1835c0a98d1 feat(vscode): update vscode extension keywords
1111
subject d82a0d8458b3029283385db04f1d935fd0dbce48 misc: add 'std_zh' scope to changelog generation
1212
subject f7228536ad55c2fb4bb20d00bba8b8c06d7e67c2 feat(std_zh): add 'GetLevelSwitchState()'/'SetLevelSwitchState()' helper functions
13+
drop 165b42156443f963f41ce0f5a68638010ff7c137

src/dialog/subscr_props.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,15 @@ std::shared_ptr<GUI::Widget> SubscrPropDialog::view()
383383
{
384384
SETFLAG(local_subref->posflags,sspSCROLLING,state);
385385
}
386+
),
387+
INFOBTN("Hide if a message string is showing."),
388+
Checkbox(
389+
text = "Hide for String", hAlign = 0.0,
390+
checked = local_subref->posflags & sspNOMSGSTR,
391+
onToggleFunc = [=](bool state)
392+
{
393+
SETFLAG(local_subref->posflags,sspNOMSGSTR,state);
394+
}
386395
)
387396
),
388397
g1 = Rows<2>()

src/dialog/subscr_settings.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,7 @@ std::shared_ptr<GUI::Widget> SubscrSettingsDialog::view()
111111
}
112112
case sstOVERLAY:
113113
{
114-
tabs["Basic"] = Rows<2>(
115-
INFOBTN("Hides the overlay while a message string is being displayed"),
116-
Checkbox(
117-
text = "Hide for Message String",
118-
checked = local_subref.flags & SUBFLAG_OVR_HIDEFORSTR,
119-
onToggleFunc = [&](bool state)
120-
{
121-
SETFLAG(local_subref.flags,SUBFLAG_OVR_HIDEFORSTR,state);
122-
}
123-
)
124-
);
114+
tabs["Basic"] = Label(text = "No settings for overlay subscreens yet!");
125115
break;
126116
}
127117
}

src/new_subscr.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#ifdef IS_PLAYER
2121
extern int32_t directItem;
2222
extern sprite_list Lwpns;
23+
extern bool msg_onscreen;
2324
void verifyBothWeapons();
2425
bool zq_ignore_item_ownership = true, zq_view_fullctr = false, zq_view_maxctr = false,
2526
zq_view_noinf = false, zq_view_allinf = false;
@@ -838,7 +839,7 @@ SubscrWidget::SubscrWidget(subscreen_object const& old) : SubscrWidget()
838839
bool SubscrWidget::load_old(subscreen_object const& old)
839840
{
840841
type = old.type;
841-
posflags = old.pos;
842+
posflags = old.pos&0x7;
842843
x = old.x;
843844
y = old.y;
844845
w = old.w;
@@ -889,6 +890,10 @@ void SubscrWidget::draw(BITMAP* dest, int32_t xofs, int32_t yofs, SubscrPage& pa
889890
}
890891
bool SubscrWidget::visible(byte pos, bool showtime) const
891892
{
893+
#ifdef IS_PLAYER
894+
if(msg_onscreen && (posflags&sspNOMSGSTR))
895+
return false;
896+
#endif
892897
return posflags&pos;
893898
}
894899
SubscrWidget* SubscrWidget::clone() const
@@ -901,11 +906,9 @@ bool SubscrWidget::copy_prop(SubscrWidget const* src, bool all)
901906
return false;
902907
flags = src->flags;
903908
genflags = src->genflags;
904-
posflags &= ~(sspUP|sspDOWN|sspSCROLLING);
905-
posflags |= src->posflags&(sspUP|sspDOWN|sspSCROLLING);
909+
posflags = src->posflags;
906910
if(all)
907911
{
908-
posflags = src->posflags;
909912
x = src->x;
910913
y = src->y;
911914
w = src->w;

src/new_subscr.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ enum //PGGOTO modes
210210
PGGOTO_TRG
211211
};
212212

213+
//when to display an element
214+
#define sspUP 0x01
215+
#define sspDOWN 0x02
216+
#define sspSCROLLING 0x04
217+
#define sspNOMSGSTR 0x08
218+
213219
#define SUBSCRFLAG_SELECTABLE 0x00000001
214220
#define SUBSCRFLAG_PGGOTO_NOWRAP 0x00000002
215221

@@ -950,8 +956,6 @@ struct SubscrPage
950956
friend struct ZCSubscreen;
951957
};
952958
#define SUBFLAG_ACT_NOPAGEWRAP 0x00000001
953-
954-
#define SUBFLAG_OVR_HIDEFORSTR 0x00000001
955959
struct ZCSubscreen
956960
{
957961
std::vector<SubscrPage> pages;

src/subscr.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ enum { ssdtOLD, ssdtNEWSUBSCR, ssdtREV2, ssdtBSZELDA, ssdtBSZELDAMODIFIED, ssdtB
4545

4646
enum { sssFULLPUSH, sssFULLSLIDEDOWN, sssMAX };
4747

48-
//when to display an element
49-
#define sspUP 1
50-
#define sspDOWN 2
51-
#define sspSCROLLING 4
52-
5348
struct sso_struct
5449
{
5550
char *s;

src/zc/zc_subscr.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -550,12 +550,9 @@ void put_passive_subscr(BITMAP *dest,int32_t x,int32_t y,bool showtime,int32_t p
550550
destroy_bitmap(subscr);
551551
if(new_subscreen_overlay)
552552
{
553-
if(!(msg_onscreen && (new_subscreen_overlay->flags&SUBFLAG_OVR_HIDEFORSTR)))
554-
{
555-
subscr = create_sub_bitmap(dest,x,0,256,224);
556-
show_custom_subscreen(subscr, new_subscreen_overlay, 0, 0, showtime, pos2);
557-
destroy_bitmap(subscr);
558-
}
553+
subscr = create_sub_bitmap(dest,x,0,256,224);
554+
show_custom_subscreen(subscr, new_subscreen_overlay, 0, 0, showtime, pos2);
555+
destroy_bitmap(subscr);
559556
}
560557
}
561558

0 commit comments

Comments
 (0)