ew-engine/mq engine src/menu_quit.c

92 lines
1.8 KiB
C

/*
Copyright (C) 1996-1997 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 "quakedef.h"
#include "winquake.h"
#include "menu.h"
/*
=========
Quit Menu
=========
*/
int msgNumber;
int m_quit_prevstate;
qboolean wasInMenus;
void M_Menu_Quit_f (void)
{
if (m_state == m_quit)
return;
wasInMenus = (key_dest == key_menu);
key_dest = key_menu;
m_quit_prevstate = m_state;
m_state = m_quit;
m_entersound = true;
msgNumber = rand()&7;
}
void M_Quit_Key (int key)
{
switch (key)
{
case K_ESCAPE:
if (wasInMenus)
{
m_state = m_quit_prevstate;
m_entersound = true;
}
else
{
key_dest = key_game;
m_state = m_none;
}
break;
case K_ENTER:
key_dest = key_console;
Host_Quit_f ();
break;
default:
break;
}
}
void M_Quit_Draw (void)
{
qpic_t *p;
if (wasInMenus)
{
m_state = m_quit_prevstate;
m_recursiveDraw = true;
M_Draw ();
m_state = m_quit;
}
//M_DrawPic (0, 4, Draw_CachePic ("gfx/help5.lmp") );
//menu title
p = Draw_CachePic("gfx/help5.lmp");
C_DrawPic((-1 * (p->width / 2)),(-1 * ((p->height / 2) - 35)),p);
//M_Print (-92, -16, "Really wanna quit? Y / N\n");
}