From d59e7d3da47124f21cd893b34a6ef5f5d9abc883 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 20 Jan 2002 04:11:08 +0000 Subject: [PATCH] you can now start a new single player game via the menus --- cs-code/menu.qc | 26 +++++++++++++++++++++++++- libs/console/menu.c | 4 +++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/cs-code/menu.qc b/cs-code/menu.qc index 4afbab13c..cc6895f84 100644 --- a/cs-code/menu.qc +++ b/cs-code/menu.qc @@ -14,6 +14,11 @@ void () Menu_Quit = #0; void (integer x, integer y, string name) Draw_Pic = #0; void (integer x, integer y, string text) Draw_String = #0; +void (string text) Cbuf_AddText = #0; +void (string text) Cbuf_InsertText = #0; +void () Cbuf_Execute = #0; +void () Cbuf_Execute_Sets = #0; + float () random = #0; string () gametype = #0; @@ -157,9 +162,28 @@ void () quit_draw = Draw_String (64, 108, quitMessage[quit_index *4 + 3]); }; +void (string text, integer key) sp_start = +{ + Menu_SelectMenu (NIL); + Cbuf_AddText ("disconnect\n"); + Cbuf_AddText ("maxplayers 1\n"); + Cbuf_AddText ("coop 0\n"); + Cbuf_AddText ("deathmatch 0\n"); + Cbuf_AddText ("teamplay 0\n"); + Cbuf_AddText ("map start\n"); +}; + void () single_player_menu = { - Menu_Item (54, 32, "", quit_f); + Menu_Begin (54, 32, ""); + Menu_Pic (16, 4, "gfx/qplaque.lmp"); + Menu_CenterPic (160, 4, "gfx/ttl_sgl.lmp"); + Menu_Pic (72, 32, "gfx/sp_menu.lmp"); + Menu_Cursor (spinner); + Menu_Item (54, 32, "", sp_start); + Menu_Item (54, 52, "", quit_f); + Menu_Item (54, 72, "", quit_f); + Menu_End (); }; void () multi_player_menu = diff --git a/libs/console/menu.c b/libs/console/menu.c index 4600363b4..dd5d3b7ce 100644 --- a/libs/console/menu.c +++ b/libs/console/menu.c @@ -103,7 +103,8 @@ menu_free (void *_m, void *unused) int i; for (i = 0; i < m->num_items; i++) - menu_free (m->items[i], 0); + if (m->items[i]->func) + menu_free (m->items[i], 0); free (m->items); } while (m->pics) { @@ -314,6 +315,7 @@ Menu_Init (void) PR_AddBuiltin (&menu_pr_state, "Menu_SetQuit", bi_Menu_SetQuit, -1); PR_AddBuiltin (&menu_pr_state, "Menu_Quit", bi_Menu_Quit, -1); + Cbuf_Progs_Init (&menu_pr_state); PR_Cmds_Init (&menu_pr_state); R_Progs_Init (&menu_pr_state);