/* Copyright (C) 1997-2001 Id Software, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ui_local.h" void M_Menu_Setup_f( void ); void M_Menu_Quit_f( void ); /* ======================================================================= MAIN MENU ======================================================================= */ static menuframework_s s_msgbox_menu; #define M_MSGBOX_LINELEN 64 static char mbtext[MAX_STRING_CHARS]; void M_Msgbox_Init( void ) { menucommon_t *menuitem = NULL; int y = 0; int yoffset = 40; s_msgbox_menu.x = uis.vidWidth / 2; s_msgbox_menu.y = uis.vidHeight / 2 - 138; s_msgbox_menu.nitems = 0; mbtext[0] = 0; if( trap_Cmd_Argc() == 2 ) { Q_strncpyz( mbtext, trap_Cmd_Args(), sizeof(mbtext) ); if( strlen(mbtext) < M_MSGBOX_LINELEN ) { menuitem = UI_InitMenuItem( "m_msgbox_textline", mbtext, 0, y+yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_msgbox_menu, menuitem ); yoffset+=trap_SCR_strHeight( menuitem->font ); } else { // todo: split in lines } } //if we printed something, add one line separation if( menuitem ) yoffset+=trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_msgbox_back", "ok", 0, y+yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, M_genericBackFunc ); Menu_AddItem( &s_msgbox_menu, menuitem ); yoffset+=trap_SCR_strHeight( menuitem->font ); Menu_Init( &s_msgbox_menu ); Menu_SetStatusBar( &s_msgbox_menu, NULL ); } void M_Msgbox_Draw( void ) { Menu_AdjustCursor( &s_msgbox_menu, 1 ); Menu_Draw( &s_msgbox_menu ); } const char *M_Msgbox_Key( int key ) { return Default_MenuKey( &s_msgbox_menu, key ); } const char *M_Msgbox_CharEvent( int key ) { return Default_MenuCharEvent( &s_msgbox_menu, key ); } void M_Menu_MsgBox_f( void ) { M_Msgbox_Init(); M_PushMenu( &s_msgbox_menu, M_Msgbox_Draw, M_Msgbox_Key, M_Msgbox_CharEvent ); }