From 9c6def5c7d136582f3239e93c374d275d52e6efa Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 29 Jan 2002 22:32:56 +0000 Subject: [PATCH] fade the screen when drawing the menus (this is optional per menu) --- cs-code/menu.qc | 8 ++++++++ cs-code/menu_def.qc | 1 + cs-code/options.qc | 3 +++ libs/console/menu.c | 11 +++++++++++ 4 files changed, 23 insertions(+) diff --git a/cs-code/menu.qc b/cs-code/menu.qc index c685a64b3..b48bc4fa7 100644 --- a/cs-code/menu.qc +++ b/cs-code/menu.qc @@ -215,6 +215,7 @@ integer (integer key, integer unicode, integer down) save_keyevent = void () load_menu = { Menu_Begin (0, 0, "load"); + Menu_FadeScreen (1); Menu_KeyEvent (load_keyevent); Menu_Draw (load_draw); Menu_End (); @@ -223,6 +224,7 @@ void () load_menu = void () save_menu = { Menu_Begin (0, 0, "save"); + Menu_FadeScreen (1); Menu_KeyEvent (save_keyevent); Menu_Draw (save_draw); Menu_End (); @@ -269,6 +271,7 @@ integer () quit_draw = void () quit_menu = { Menu_Begin (0, 0, "quit"); + Menu_FadeScreen (1); Menu_KeyEvent (quit_keyevent); Menu_Draw (quit_draw); Menu_End (); @@ -288,6 +291,7 @@ void (string text, integer key) sp_start = void () single_player_menu = { Menu_Begin (54, 32, ""); + Menu_FadeScreen (1); Menu_Pic (16, 4, "gfx/qplaque.lmp"); Menu_CenterPic (160, 4, "gfx/ttl_sgl.lmp"); Menu_Pic (72, 32, "gfx/sp_menu.lmp"); @@ -370,6 +374,7 @@ integer (integer key, integer unicode, integer down) lanconfig_keyevent = void () lanconfig_menu = { Menu_Begin (54, 92, ""); + Menu_FadeScreen (1); Menu_Pic (16, 4, "gfx/qplaque.lmp"); Menu_CenterPic (160, 4, "gfx/p_multi.lmp"); Menu_Draw (lanconfig_draw); @@ -380,6 +385,7 @@ void () lanconfig_menu = void () join_menu = { Menu_Begin (54, 32, ""); + Menu_FadeScreen (1); Menu_Pic (16, 4, "gfx/qplaque.lmp"); Menu_CenterPic (160, 4, "gfx/p_multi.lmp"); Menu_Pic (72, 32, "gfx/dim_modm.lmp"); @@ -403,6 +409,7 @@ integer (integer key, integer unicode, integer down) multi_player_keyevent = void () multi_player_menu = { Menu_Begin (54, 52, ""); + Menu_FadeScreen (1); Menu_Pic (16, 4, "gfx/qplaque.lmp"); Menu_CenterPic (160, 4, "gfx/p_multi.lmp"); Menu_Pic (72, 32, "gfx/mp_menu.lmp"); @@ -425,6 +432,7 @@ void () help_menu = void () main_menu = { Menu_Begin (0, 0, "main"); + Menu_FadeScreen (1); Menu_Pic (16, 4, "gfx/qplaque.lmp"); Menu_CenterPic (160, 4, "gfx/ttl_main.lmp"); Menu_Pic (71,32, "gfx/mainmenu.lmp"); diff --git a/cs-code/menu_def.qc b/cs-code/menu_def.qc index ae1ec0acd..04a1a20b9 100644 --- a/cs-code/menu_def.qc +++ b/cs-code/menu_def.qc @@ -1,4 +1,5 @@ void (integer x, integer y, string text) Menu_Begin = #0; +void (integer val) Menu_FadeScreen = #0; void (integer () func) Menu_Draw = #0; void (integer x, integer y, string name) Menu_Pic = #0; void (integer x, integer y, string name) Menu_CenterPic = #0; diff --git a/cs-code/options.qc b/cs-code/options.qc index c576ba2d0..304ff4aa8 100644 --- a/cs-code/options.qc +++ b/cs-code/options.qc @@ -76,6 +76,7 @@ integer () options_controls_draw = void () options_controls_menu = { Menu_Begin (54, 40, "Controls"); + Menu_FadeScreen (1); Menu_CenterPic (160, 4, "gfx/p_option.lmp"); Menu_Draw (options_controls_draw); Menu_KeyEvent (options_controls_keyevent); @@ -108,6 +109,7 @@ integer () options_video_draw = void () options_video_menu = { Menu_Begin (54, 50, "Video"); + Menu_FadeScreen (1); Menu_Draw (options_video_draw); Menu_KeyEvent (options_video_keyevent); Menu_Item (54, 60, "fullscreen", video_options_f); @@ -118,6 +120,7 @@ void () options_video_menu = void () options_menu = { Menu_Begin (54, 72, ""); + Menu_FadeScreen (1); Menu_Pic (16, 4, "gfx/qplaque.lmp"); Menu_CenterPic (160, 4, "gfx/p_option.lmp"); options_video_menu (); diff --git a/libs/console/menu.c b/libs/console/menu.c index 6be89b360..578208380 100644 --- a/libs/console/menu.c +++ b/libs/console/menu.c @@ -61,6 +61,7 @@ typedef struct menu_item_s { func_t cursor; func_t keyevent; func_t draw; + unsigned fadescreen:1; const char *text; menu_pic_t *pics; } menu_item_t; @@ -146,6 +147,12 @@ bi_Menu_Begin (progs_t *pr) Hash_Add (menu_hash, m); } +static void +bi_Menu_FadeScreen (progs_t *pr) +{ + menu->fadescreen = G_INT (pr, OFS_PARM0); +} + static void bi_Menu_Draw (progs_t *pr) { @@ -324,6 +331,7 @@ Menu_Init (void) menu_hash = Hash_NewTable (61, menu_get_key, menu_free, 0); PR_AddBuiltin (&menu_pr_state, "Menu_Begin", bi_Menu_Begin, -1); + PR_AddBuiltin (&menu_pr_state, "Menu_FadeScreen", bi_Menu_FadeScreen, -1); PR_AddBuiltin (&menu_pr_state, "Menu_Draw", bi_Menu_Draw, -1); PR_AddBuiltin (&menu_pr_state, "Menu_Pic", bi_Menu_Pic, -1); PR_AddBuiltin (&menu_pr_state, "Menu_CenterPic", bi_Menu_CenterPic, -1); @@ -401,6 +409,9 @@ Menu_Draw (void) if (!menu) return; + if (menu->fadescreen) + Draw_FadeScreen (); + *menu_pr_state.globals.time = *menu_pr_state.time; if (menu->draw) {