Close #17050: Transparency can be toggled directly (#17075)

This commit is contained in:
Hielke Morsink 2022-04-27 13:30:58 +02:00 committed by GitHub
parent cfb8a1463e
commit 1c55e6ee7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 18 deletions

View File

@ -1,6 +1,7 @@
0.4.1 (in development)
------------------------------------------------------------------------
- Fix: [#16974] Small scenery ghosts can be deleted.
- Improved: [#17050] Transparency can be enabled directly without needing see-through enabled first.
- Removed: [#16864] Title sequence editor (replaced by plug-in).
0.4.0 (2022-04-25)

View File

@ -156,6 +156,17 @@ public:
}
private:
uint32_t ToggleTransparency(uint32_t wflags, uint32_t transparencyFlag, uint32_t seeThroughFlag)
{
wflags ^= transparencyFlag;
if (wflags & transparencyFlag)
{
wflags |= seeThroughFlag;
}
SaveInConfig(wflags);
return wflags;
}
void ToggleViewportFlag(rct_widgetindex widgetIndex)
{
uint32_t wflags = 0;
@ -187,34 +198,22 @@ private:
wflags ^= VIEWPORT_FLAG_HIDE_SUPPORTS;
break;
case WIDX_INVISIBLE_RIDES:
wflags ^= VIEWPORT_FLAG_INVISIBLE_RIDES;
gConfigGeneral.invisible_rides = wflags & VIEWPORT_FLAG_INVISIBLE_RIDES;
config_save_default();
wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_RIDES, VIEWPORT_FLAG_HIDE_RIDES);
break;
case WIDX_INVISIBLE_VEHICLES:
wflags ^= VIEWPORT_FLAG_INVISIBLE_VEHICLES;
gConfigGeneral.invisible_vehicles = wflags & VIEWPORT_FLAG_INVISIBLE_VEHICLES;
config_save_default();
wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_VEHICLES, VIEWPORT_FLAG_HIDE_VEHICLES);
break;
case WIDX_INVISIBLE_SCENERY:
wflags ^= VIEWPORT_FLAG_INVISIBLE_SCENERY;
gConfigGeneral.invisible_scenery = wflags & VIEWPORT_FLAG_INVISIBLE_SCENERY;
config_save_default();
wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_SCENERY, VIEWPORT_FLAG_HIDE_SCENERY);
break;
case WIDX_INVISIBLE_VEGETATION:
wflags ^= VIEWPORT_FLAG_INVISIBLE_VEGETATION;
gConfigGeneral.invisible_trees = wflags & VIEWPORT_FLAG_INVISIBLE_VEGETATION;
config_save_default();
wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_VEGETATION, VIEWPORT_FLAG_HIDE_VEGETATION);
break;
case WIDX_INVISIBLE_PATHS:
wflags ^= VIEWPORT_FLAG_INVISIBLE_PATHS;
gConfigGeneral.invisible_paths = wflags & VIEWPORT_FLAG_INVISIBLE_PATHS;
config_save_default();
wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_PATHS, VIEWPORT_FLAG_HIDE_PATHS);
break;
case WIDX_INVISIBLE_SUPPORTS:
wflags ^= VIEWPORT_FLAG_INVISIBLE_SUPPORTS;
gConfigGeneral.invisible_supports = wflags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS;
config_save_default();
wflags = ToggleTransparency(wflags, VIEWPORT_FLAG_INVISIBLE_SUPPORTS, VIEWPORT_FLAG_HIDE_SUPPORTS);
break;
case WIDX_HIDE_GUESTS:
wflags ^= VIEWPORT_FLAG_HIDE_GUESTS;
@ -232,6 +231,17 @@ private:
w->viewport->flags = wflags;
w->Invalidate();
}
void SaveInConfig(uint32_t wflags)
{
gConfigGeneral.invisible_rides = wflags & VIEWPORT_FLAG_INVISIBLE_RIDES;
gConfigGeneral.invisible_vehicles = wflags & VIEWPORT_FLAG_INVISIBLE_VEHICLES;
gConfigGeneral.invisible_scenery = wflags & VIEWPORT_FLAG_INVISIBLE_SCENERY;
gConfigGeneral.invisible_trees = wflags & VIEWPORT_FLAG_INVISIBLE_VEGETATION;
gConfigGeneral.invisible_paths = wflags & VIEWPORT_FLAG_INVISIBLE_PATHS;
gConfigGeneral.invisible_supports = wflags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS;
config_save_default();
}
};
rct_window* WindowTransparencyOpen()