223 lines
No EOL
4.8 KiB
C
223 lines
No EOL
4.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"
|
|
|
|
/*
|
|
=========
|
|
Main Menu
|
|
=========
|
|
*/
|
|
|
|
void setmousexy(MOUSEXY *inm, int imx1, int offx, int imy1, int offy);
|
|
int IsMouseOver(MOUSEXY inm, POINT ptm);
|
|
extern POINT current_pos;
|
|
MOUSEXY mmenuxy[5];
|
|
|
|
int m_save_demonum;
|
|
|
|
int main_cursor;
|
|
#define MAIN_ITEMS 5
|
|
|
|
void M_Menu_Main_f (void)
|
|
{
|
|
if (key_dest != key_menu)
|
|
{
|
|
m_save_demonum = cls.demonum;
|
|
cls.demonum = -1;
|
|
}
|
|
key_dest = key_menu;
|
|
m_state = m_main;
|
|
m_entersound = true;
|
|
|
|
setmousexy(&mmenuxy[0], 98, 130, 60, 19);
|
|
setmousexy(&mmenuxy[1], 228, 117, 60, 19);
|
|
setmousexy(&mmenuxy[2], 345, 66, 60, 19);
|
|
setmousexy(&mmenuxy[3], 411, 83, 60, 19);
|
|
setmousexy(&mmenuxy[4], 494, 55, 60,19);
|
|
}
|
|
|
|
void M_Main_Draw (void)
|
|
{
|
|
/*
|
|
//first menu system
|
|
int f;
|
|
qpic_t *p1, *p2, *p3;
|
|
|
|
f = (int)(host_time * 10)%6;
|
|
|
|
//precache pics
|
|
p1 = Draw_CachePic("gfx/ttl_main.lmp");
|
|
p2 = Draw_CachePic("gfx/mainmenu.lmp");
|
|
p3 = Draw_CachePic(va("gfx/menudot%i.lmp", f+1));
|
|
|
|
Draw_Pic(((vid.width - p1->width)>>1),((vid.height - p1->height - p2->height)>>1), p1);
|
|
Draw_Pic(((vid.width - p2->width)>>1),((vid.height - p2->height + p1->height)>>1), p2);
|
|
Draw_Pic(((vid.width - p3->width - p2->width - 5)>>1),(((vid.height - p2->height + p3->height)>>1) + main_cursor * 20), p3);
|
|
|
|
// cursor
|
|
M_DrawCharacter (-84, -16 + main_cursor*8, 12+((int)(realtime*4)&1));
|
|
*/
|
|
|
|
/*
|
|
//second menu system
|
|
//variable declarations
|
|
qpic_t *p;
|
|
char *menu0, *menu1, *menu2, *menu3;//full version, *menu4;
|
|
|
|
//full version
|
|
menu0 = " Single Player ";
|
|
menu1 = " Multiplayer ";
|
|
menu2 = " Options ";
|
|
menu3 = " Help ";
|
|
menu4 = " Quit ";
|
|
|
|
//demo version
|
|
menu0 = " Single Player ";
|
|
menu1 = " Options ";
|
|
menu2 = " Help ";
|
|
menu3 = " Quit ";
|
|
|
|
//menu title
|
|
p = Draw_CachePic("gfx/ttl_main.lmp");
|
|
C_DrawPic(-104,(-1 * (p->height + 16)),p);
|
|
|
|
//advanced cursor drawing system
|
|
if (main_cursor == 0)
|
|
C_PrintWhite (-92, -16, menu0);
|
|
else
|
|
C_Print (-92, -16, menu0);
|
|
if (main_cursor == 1)
|
|
C_PrintWhite (-92, -8, menu1);
|
|
else
|
|
C_Print (-92, -8, menu1);
|
|
if (main_cursor == 2)
|
|
C_PrintWhite (-92, 0, menu2);
|
|
else
|
|
C_Print (-92, 0, menu2);
|
|
if (main_cursor == 3)
|
|
C_PrintWhite (-92, 8, menu3);
|
|
else
|
|
C_Print (-92, 8, menu3);
|
|
//full version
|
|
if (main_cursor == 4)
|
|
C_PrintWhite (-92, 16, menu4);
|
|
else
|
|
C_Print (-92, 16, menu4);
|
|
*/
|
|
|
|
//third menu system
|
|
int f;
|
|
qpic_t *p[3];
|
|
|
|
f = (int)(host_time * 10)%6;
|
|
|
|
//image setup
|
|
p[0] = Draw_CachePic("gfx/ttl_main.lmp");
|
|
p[1] = Draw_CachePic("gfx/mainmenu.lmp");
|
|
p[2] = Draw_CachePic(va("gfx/menudot%i.lmp", f+1));
|
|
|
|
//draw menu
|
|
C_DrawPic(-104,(-1 * (p[0]->height + p[1]->height - 100)),p[0]);
|
|
C_DrawPic(-104,(-1 * (p[1]->height - 100)),p[1]);
|
|
|
|
//draw cursor
|
|
C_DrawPic (-120,((main_cursor * 20) - p[1]->height + 100),p[2]);
|
|
|
|
}
|
|
|
|
|
|
void M_Main_Key (int key)
|
|
{
|
|
switch (key)
|
|
{
|
|
case K_ESCAPE:
|
|
key_dest = key_game;
|
|
m_state = m_none;
|
|
cls.demonum = m_save_demonum;
|
|
if (cls.demonum != -1 && !cls.demoplayback && cls.state != ca_connected)
|
|
CL_NextDemo ();
|
|
break;
|
|
|
|
case K_DOWNARROW:
|
|
S_LocalSound ("misc/menu1.wav");
|
|
if (++main_cursor >= MAIN_ITEMS)
|
|
main_cursor = 0;
|
|
break;
|
|
|
|
case K_UPARROW:
|
|
S_LocalSound ("misc/menu1.wav");
|
|
if (--main_cursor < 0)
|
|
main_cursor = MAIN_ITEMS - 1;
|
|
break;
|
|
|
|
//demo version
|
|
/*
|
|
case K_ENTER:
|
|
m_entersound = true;
|
|
|
|
switch (main_cursor)
|
|
{
|
|
case 0:
|
|
M_Menu_SinglePlayer_f ();
|
|
break;
|
|
|
|
case 1:
|
|
M_Menu_Options_f ();
|
|
break;
|
|
|
|
case 2:
|
|
M_Menu_Help_f ();
|
|
break;
|
|
|
|
case 3:
|
|
M_Menu_Quit_f ();
|
|
break;
|
|
*/
|
|
|
|
//fullversion
|
|
case K_ENTER:
|
|
m_entersound = true;
|
|
|
|
switch (main_cursor)
|
|
{
|
|
case 0:
|
|
M_Menu_SinglePlayer_f ();
|
|
break;
|
|
|
|
case 1:
|
|
M_Menu_MultiPlayer_f ();
|
|
break;
|
|
|
|
case 2:
|
|
M_Menu_Options_f ();
|
|
break;
|
|
|
|
case 3:
|
|
M_Menu_Help_f ();
|
|
break;
|
|
|
|
case 4:
|
|
M_Menu_Quit_f ();
|
|
break;
|
|
}
|
|
}
|
|
} |