@@ -9,6 +9,7 @@ static RenderTreeItem rti_root("root");
99static RenderTreeItem rti_screen (" screen" );
1010static RenderTreeItem rti_mmap (" mmap" );
1111static RenderTreeItem rti_tooltip (" tooltip" );
12+ static RenderTreeItem rti_tint (" tint" );
1213
1314static int zc_gui_mouse_x ()
1415{
@@ -44,13 +45,17 @@ static void init_render_tree()
4445 rti_tooltip.transparency_index = 0 ;
4546 clear_bitmap (rti_tooltip.a4_bitmap );
4647
48+ rti_tint.bitmap = create_a5_bitmap (screen->w , screen->h );
49+ rti_tint.visible = false ;
50+
4751 set_bitmap_create_flags (true );
4852 rti_mmap.bitmap = create_a5_bitmap (screen->w , screen->h );
4953
5054 rti_screen.add_child (&rti_mmap);
5155
5256 rti_root.add_child (&rti_screen);
5357 rti_root.add_child (&rti_tooltip);
58+ rti_root.add_child (&rti_tint);
5459 rti_root.add_child (&rti_dialogs);
5560
5661 gui_mouse_x = zc_gui_mouse_x;
@@ -64,7 +69,7 @@ static void init_render_tree()
6469static void configure_render_tree ()
6570{
6671 static bool scaling_force_integer = zc_get_config (" zquest" , " scaling_force_integer" , 0 ) != 0 ;
67-
72+
6873 int resx = al_get_display_width (all_get_display ());
6974 int resy = al_get_display_height (all_get_display ());
7075
@@ -107,9 +112,38 @@ static void configure_render_tree()
107112 .xscale = xscale,
108113 .yscale = yscale,
109114 });
115+ rti_tint.set_transform ({
116+ .x = (int )(resx - w*xscale) / 2 ,
117+ .y = (int )(resy - h*yscale) / 2 ,
118+ .xscale = xscale,
119+ .yscale = yscale,
120+ });
110121 }
111-
122+
112123 rti_dialogs.visible = rti_dialogs.has_children ();
124+ rti_tint.visible = rti_dialogs.visible && !dlg_tint_paused ();
125+
126+ if (rti_dialogs.visible )
127+ {
128+ auto & tint = get_dlg_tint ();
129+ if (!override_dlg_tint)
130+ {
131+ tint = al_premul_rgba (
132+ zc_get_config (" ZQ_GUI" ," dlg_tint_r" ,0 ),
133+ zc_get_config (" ZQ_GUI" ," dlg_tint_g" ,0 ),
134+ zc_get_config (" ZQ_GUI" ," dlg_tint_b" ,0 ),
135+ zc_get_config (" ZQ_GUI" ," dlg_tint_a" ,128 )
136+ );
137+ }
138+
139+ ALLEGRO_STATE oldstate;
140+ al_store_state (&oldstate, ALLEGRO_STATE_TARGET_BITMAP);
141+ al_set_target_bitmap (rti_tint.bitmap );
142+ al_clear_to_color (tint);
143+ al_restore_state (&oldstate);
144+ }
145+
146+ reload_dialog_tints ();
113147}
114148
115149ALLEGRO_BITMAP* get_overlay_bmp ()
0 commit comments