int NehGameType;
-enum {m_none, m_main, m_demo, m_singleplayer, m_load, m_save, m_multiplayer, m_setup, m_net, m_options, m_video, m_keys, m_help, m_quit, m_serialconfig, m_modemconfig, m_lanconfig, m_gameoptions, m_search, m_slist} m_state;
+enum {m_none, m_main, m_demo, m_singleplayer, m_load, m_save, m_multiplayer, m_setup, m_net, m_options, m_video, m_keys, m_help, m_quit, m_lanconfig, m_gameoptions, m_search, m_slist} m_state;
void M_Menu_Main_f (void);
void M_Menu_SinglePlayer_f (void);
void M_Menu_Video_f (void);
void M_Menu_Help_f (void);
void M_Menu_Quit_f (void);
-void M_Menu_SerialConfig_f (void);
- void M_Menu_ModemConfig_f (void);
void M_Menu_LanConfig_f (void);
void M_Menu_GameOptions_f (void);
void M_Menu_Search_f (void);
void M_Video_Draw (void);
void M_Help_Draw (void);
void M_Quit_Draw (void);
-void M_SerialConfig_Draw (void);
- void M_ModemConfig_Draw (void);
void M_LanConfig_Draw (void);
void M_GameOptions_Draw (void);
void M_Search_Draw (void);
void M_Video_Key (int key);
void M_Help_Key (int key);
void M_Quit_Key (int key);
-void M_SerialConfig_Key (int key);
- void M_ModemConfig_Key (int key);
void M_LanConfig_Key (int key);
void M_GameOptions_Key (int key);
void M_Search_Key (int key);
#define StartingGame (m_multiplayer_cursor == 1)
#define JoiningGame (m_multiplayer_cursor == 0)
-#define SerialConfig (m_net_cursor == 0)
-#define DirectConfig (m_net_cursor == 1)
-#define IPXConfig (m_net_cursor == 2)
-#define TCPIPConfig (m_net_cursor == 3)
+#define IPXConfig (m_net_cursor == 0)
+#define TCPIPConfig (m_net_cursor == 1)
void M_ConfigureNetSubsystem(void);
}
}
+// LordHavoc: FIXME: finish this menu stuff
+#if 0
+#define MAXMENUITEMS 128
+
+typedef struct menuitem_s
+{
+ char *string; // may be text, or an image to use, or a cvar name, depending on the functions used
+ char *description;
+ char *command; // used by command items mainly (when used, this command is executed)
+ cvar_t *cvar; // used for cvar items (sliders, number boxes), value is retrieved from the cvar itself
+ int selectable; // purely decorative if this is false
+ int selected; // true if this menu item is currently selected, used by funcs so they don't need to know anything but fields in the menuitem
+ float selecttime; // the time that this menu item was activated (copied from realtime), used for animating selection flashs and such
+ float color[4]; // current color for the item (may be different than base color, due to selection flash effects)
+ float basecolor[4]; // the base color
+ float x, y, width, height; // width and height are used for mouse selection
+ void(*drawfunc)(struct menuitem_s *item);
+ void(*activefunc)(struct menuitem_s *item);
+// void(*selectfunc)(struct menuitem_s *item);
+// void(*deselectfunc)(struct menuitem_s *item);
+ void(*usefunc)(struct menuitem_s *item);
+}
+menuitem_t;
+
+menuitem_t menuitem[MAXMENUITEMS];
+int menuitems;
+
+void menuitem_text_drawfunc(struct menuitem_s *item)
+{
+ // FIXME: handle color flashs and such when selected
+ M_Print (item->x, item->y, item->string);
+}
+
+void menuitem_image_drawfunc(struct menuitem_s *item)
+{
+ qpic_t *p = Draw_CachePic (item->string);
+ // FIXME: handle color flashs and such when selected
+ M_DrawPic (item->x, item->y, p);
+}
+
+void menuitem_command_usefunc(struct menuitem_s *item)
+{
+ Cbuf_AddText (item->command);
+}
+#endif
+
int demo_cursor;
void M_Demo_Draw (void)
{
M_DrawPic (54, 32 + m_multiplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
- if (serialAvailable || ipxAvailable || tcpipAvailable)
+ if (ipxAvailable || tcpipAvailable)
return;
M_PrintWhite ((320/2) - ((27*8)/2), 148, "No Communications Available");
}
switch (m_multiplayer_cursor)
{
case 0:
- if (serialAvailable || ipxAvailable || tcpipAvailable)
+ if (ipxAvailable || tcpipAvailable)
M_Menu_Net_f ();
break;
case 1:
- if (serialAvailable || ipxAvailable || tcpipAvailable)
+ if (ipxAvailable || tcpipAvailable)
M_Menu_Net_f ();
break;
char *net_helpMessage [] =
{
/* .........1.........2.... */
- " ",
- " Two computers connected",
- " through two modems. ",
- " ",
-
- " ",
- " Two computers connected",
- " by a null-modem cable. ",
- " ",
-
" Novell network LANs ",
" or Windows 95 DOS-box. ",
" ",
key_dest = key_menu;
m_state = m_net;
m_entersound = true;
- m_net_items = 4;
+ m_net_items = 2;
if (m_net_cursor >= m_net_items)
m_net_cursor = 0;
f = 32;
- if (serialAvailable)
- {
- p = Draw_CachePic ("gfx/netmen1.lmp");
- }
- else
- {
-#ifdef _WIN32
- p = NULL;
-#else
- p = Draw_CachePic ("gfx/dim_modm.lmp");
-#endif
- }
-
- if (p)
- M_DrawPic (72, f, p);
-
- f += 19;
-
- if (serialAvailable)
- {
- p = Draw_CachePic ("gfx/netmen2.lmp");
- }
- else
- {
-#ifdef _WIN32
- p = NULL;
-#else
- p = Draw_CachePic ("gfx/dim_drct.lmp");
-#endif
- }
-
- if (p)
- M_DrawPic (72, f, p);
-
- f += 19;
if (ipxAvailable)
p = Draw_CachePic ("gfx/netmen3.lmp");
else
f += 8;
M_Print (f, 142, net_helpMessage[m_net_cursor*4+0]);
M_Print (f, 150, net_helpMessage[m_net_cursor*4+1]);
- M_Print (f, 158, net_helpMessage[m_net_cursor*4+2]);
- M_Print (f, 166, net_helpMessage[m_net_cursor*4+3]);
f = (int)(host_time * 10)%6;
M_DrawPic (54, 32 + m_net_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
switch (m_net_cursor)
{
case 0:
- M_Menu_SerialConfig_f ();
- break;
-
- case 1:
- M_Menu_SerialConfig_f ();
- break;
-
- case 2:
M_Menu_LanConfig_f ();
break;
- case 3:
+ case 1:
M_Menu_LanConfig_f ();
break;
- case 4:
+ case 2:
// multiprotocol
break;
}
}
- if (m_net_cursor == 0 && !serialAvailable)
- goto again;
- if (m_net_cursor == 1 && !serialAvailable)
+ if (m_net_cursor == 0 && !ipxAvailable)
goto again;
- if (m_net_cursor == 2 && !ipxAvailable)
- goto again;
- if (m_net_cursor == 3 && !tcpipAvailable)
+ if (m_net_cursor == 1 && !tcpipAvailable)
goto again;
}
#endif
}
-//=============================================================================
-
-/* SERIAL CONFIG MENU */
-
-int serialConfig_cursor;
-int serialConfig_cursor_table[] = {48, 64, 80, 96, 112, 132};
-#define NUM_SERIALCONFIG_CMDS 6
-
-static int ISA_uarts[] = {0x3f8,0x2f8,0x3e8,0x2e8};
-static int ISA_IRQs[] = {4,3,4,3};
-int serialConfig_baudrate[] = {9600,14400,19200,28800,38400,57600};
-
-int serialConfig_comport;
-int serialConfig_irq ;
-int serialConfig_baud;
-char serialConfig_phone[16];
-
-void M_Menu_SerialConfig_f (void)
-{
- int n;
- int port;
- int baudrate;
- qboolean useModem;
-
- key_dest = key_menu;
- m_state = m_serialconfig;
- m_entersound = true;
- if (JoiningGame && SerialConfig)
- serialConfig_cursor = 4;
- else
- serialConfig_cursor = 5;
-
- (*GetComPortConfig) (0, &port, &serialConfig_irq, &baudrate, &useModem);
-
- // map uart's port to COMx
- for (n = 0; n < 4; n++)
- if (ISA_uarts[n] == port)
- break;
- if (n == 4)
- {
- n = 0;
- serialConfig_irq = 4;
- }
- serialConfig_comport = n + 1;
-
- // map baudrate to index
- for (n = 0; n < 6; n++)
- if (serialConfig_baudrate[n] == baudrate)
- break;
- if (n == 6)
- n = 5;
- serialConfig_baud = n;
-
- m_return_onerror = false;
- m_return_reason[0] = 0;
-}
-
-
-void M_SerialConfig_Draw (void)
-{
- qpic_t *p;
- int basex;
- char *startJoin;
- char *directModem;
-
- M_DrawPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
- p = Draw_CachePic ("gfx/p_multi.lmp");
- basex = (320-p->width)/2;
- M_DrawPic (basex, 4, p);
-
- if (StartingGame)
- startJoin = "New Game";
- else
- startJoin = "Join Game";
- if (SerialConfig)
- directModem = "Modem";
- else
- directModem = "Direct Connect";
- M_Print (basex, 32, va ("%s - %s", startJoin, directModem));
- basex += 8;
-
- M_Print (basex, serialConfig_cursor_table[0], "Port");
- M_DrawTextBox (160, 40, 4, 1);
- M_Print (168, serialConfig_cursor_table[0], va("COM%u", serialConfig_comport));
-
- M_Print (basex, serialConfig_cursor_table[1], "IRQ");
- M_DrawTextBox (160, serialConfig_cursor_table[1]-8, 1, 1);
- M_Print (168, serialConfig_cursor_table[1], va("%u", serialConfig_irq));
-
- M_Print (basex, serialConfig_cursor_table[2], "Baud");
- M_DrawTextBox (160, serialConfig_cursor_table[2]-8, 5, 1);
- M_Print (168, serialConfig_cursor_table[2], va("%u", serialConfig_baudrate[serialConfig_baud]));
-
- if (SerialConfig)
- {
- M_Print (basex, serialConfig_cursor_table[3], "Modem Setup...");
- if (JoiningGame)
- {
- M_Print (basex, serialConfig_cursor_table[4], "Phone number");
- M_DrawTextBox (160, serialConfig_cursor_table[4]-8, 16, 1);
- M_Print (168, serialConfig_cursor_table[4], serialConfig_phone);
- }
- }
-
- if (JoiningGame)
- {
- M_DrawTextBox (basex, serialConfig_cursor_table[5]-8, 7, 1);
- M_Print (basex+8, serialConfig_cursor_table[5], "Connect");
- }
- else
- {
- M_DrawTextBox (basex, serialConfig_cursor_table[5]-8, 2, 1);
- M_Print (basex+8, serialConfig_cursor_table[5], "OK");
- }
-
- M_DrawCharacter (basex-8, serialConfig_cursor_table [serialConfig_cursor], 12+((int)(realtime*4)&1));
-
- if (serialConfig_cursor == 4)
- M_DrawCharacter (168 + 8*strlen(serialConfig_phone), serialConfig_cursor_table [serialConfig_cursor], 10+((int)(realtime*4)&1));
-
- if (*m_return_reason)
- M_PrintWhite (basex, 148, m_return_reason);
-}
-
-
-void M_SerialConfig_Key (int key)
-{
- int l;
-
- switch (key)
- {
- case K_ESCAPE:
- M_Menu_Net_f ();
- break;
-
- case K_UPARROW:
- S_LocalSound ("misc/menu1.wav");
- serialConfig_cursor--;
- if (serialConfig_cursor < 0)
- serialConfig_cursor = NUM_SERIALCONFIG_CMDS-1;
- break;
-
- case K_DOWNARROW:
- S_LocalSound ("misc/menu1.wav");
- serialConfig_cursor++;
- if (serialConfig_cursor >= NUM_SERIALCONFIG_CMDS)
- serialConfig_cursor = 0;
- break;
-
- case K_LEFTARROW:
- if (serialConfig_cursor > 2)
- break;
- S_LocalSound ("misc/menu3.wav");
-
- if (serialConfig_cursor == 0)
- {
- serialConfig_comport--;
- if (serialConfig_comport == 0)
- serialConfig_comport = 4;
- serialConfig_irq = ISA_IRQs[serialConfig_comport-1];
- }
-
- if (serialConfig_cursor == 1)
- {
- serialConfig_irq--;
- if (serialConfig_irq == 6)
- serialConfig_irq = 5;
- if (serialConfig_irq == 1)
- serialConfig_irq = 7;
- }
-
- if (serialConfig_cursor == 2)
- {
- serialConfig_baud--;
- if (serialConfig_baud < 0)
- serialConfig_baud = 5;
- }
-
- break;
-
- case K_RIGHTARROW:
- if (serialConfig_cursor > 2)
- break;
-forward:
- S_LocalSound ("misc/menu3.wav");
-
- if (serialConfig_cursor == 0)
- {
- serialConfig_comport++;
- if (serialConfig_comport > 4)
- serialConfig_comport = 1;
- serialConfig_irq = ISA_IRQs[serialConfig_comport-1];
- }
-
- if (serialConfig_cursor == 1)
- {
- serialConfig_irq++;
- if (serialConfig_irq == 6)
- serialConfig_irq = 7;
- if (serialConfig_irq == 8)
- serialConfig_irq = 2;
- }
-
- if (serialConfig_cursor == 2)
- {
- serialConfig_baud++;
- if (serialConfig_baud > 5)
- serialConfig_baud = 0;
- }
-
- break;
-
- case K_ENTER:
- if (serialConfig_cursor < 3)
- goto forward;
-
- m_entersound = true;
-
- if (serialConfig_cursor == 3)
- {
- (*SetComPortConfig) (0, ISA_uarts[serialConfig_comport-1], serialConfig_irq, serialConfig_baudrate[serialConfig_baud], SerialConfig);
-
- M_Menu_ModemConfig_f ();
- break;
- }
-
- if (serialConfig_cursor == 4)
- {
- serialConfig_cursor = 5;
- break;
- }
-
- // serialConfig_cursor == 5 (OK/CONNECT)
- (*SetComPortConfig) (0, ISA_uarts[serialConfig_comport-1], serialConfig_irq, serialConfig_baudrate[serialConfig_baud], SerialConfig);
-
- M_ConfigureNetSubsystem ();
-
- if (StartingGame)
- {
- M_Menu_GameOptions_f ();
- break;
- }
-
- m_return_state = m_state;
- m_return_onerror = true;
- key_dest = key_game;
- m_state = m_none;
-
- if (SerialConfig)
- Cbuf_AddText (va ("connect \"%s\"\n", serialConfig_phone));
- else
- Cbuf_AddText ("connect\n");
- break;
-
- case K_BACKSPACE:
- if (serialConfig_cursor == 4)
- {
- if (strlen(serialConfig_phone))
- serialConfig_phone[strlen(serialConfig_phone)-1] = 0;
- }
- break;
-
- default:
- if (key < 32 || key > 127)
- break;
- if (serialConfig_cursor == 4)
- {
- l = strlen(serialConfig_phone);
- if (l < 15)
- {
- serialConfig_phone[l+1] = 0;
- serialConfig_phone[l] = key;
- }
- }
- }
-
- if (DirectConfig && (serialConfig_cursor == 3 || serialConfig_cursor == 4))
- {
- if (key == K_UPARROW)
- serialConfig_cursor = 2;
- else
- serialConfig_cursor = 5;
- }
-
- if (SerialConfig && StartingGame && serialConfig_cursor == 4)
- {
- if (key == K_UPARROW)
- serialConfig_cursor = 3;
- else
- serialConfig_cursor = 5;
- }
-}
-
-//=============================================================================
-/* MODEM CONFIG MENU */
-
-int modemConfig_cursor;
-int modemConfig_cursor_table [] = {40, 56, 88, 120, 156};
-#define NUM_MODEMCONFIG_CMDS 5
-
-char modemConfig_dialing;
-char modemConfig_clear [16];
-char modemConfig_init [32];
-char modemConfig_hangup [16];
-
-void M_Menu_ModemConfig_f (void)
-{
- key_dest = key_menu;
- m_state = m_modemconfig;
- m_entersound = true;
- (*GetModemConfig) (0, &modemConfig_dialing, modemConfig_clear, modemConfig_init, modemConfig_hangup);
-}
-
-
-void M_ModemConfig_Draw (void)
-{
- qpic_t *p;
- int basex;
-
- M_DrawPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
- p = Draw_CachePic ("gfx/p_multi.lmp");
- basex = (320-p->width)/2;
- M_DrawPic (basex, 4, p);
- basex += 8;
-
- if (modemConfig_dialing == 'P')
- M_Print (basex, modemConfig_cursor_table[0], "Pulse Dialing");
- else
- M_Print (basex, modemConfig_cursor_table[0], "Touch Tone Dialing");
-
- M_Print (basex, modemConfig_cursor_table[1], "Clear");
- M_DrawTextBox (basex, modemConfig_cursor_table[1]+4, 16, 1);
- M_Print (basex+8, modemConfig_cursor_table[1]+12, modemConfig_clear);
- if (modemConfig_cursor == 1)
- M_DrawCharacter (basex+8 + 8*strlen(modemConfig_clear), modemConfig_cursor_table[1]+12, 10+((int)(realtime*4)&1));
-
- M_Print (basex, modemConfig_cursor_table[2], "Init");
- M_DrawTextBox (basex, modemConfig_cursor_table[2]+4, 30, 1);
- M_Print (basex+8, modemConfig_cursor_table[2]+12, modemConfig_init);
- if (modemConfig_cursor == 2)
- M_DrawCharacter (basex+8 + 8*strlen(modemConfig_init), modemConfig_cursor_table[2]+12, 10+((int)(realtime*4)&1));
-
- M_Print (basex, modemConfig_cursor_table[3], "Hangup");
- M_DrawTextBox (basex, modemConfig_cursor_table[3]+4, 16, 1);
- M_Print (basex+8, modemConfig_cursor_table[3]+12, modemConfig_hangup);
- if (modemConfig_cursor == 3)
- M_DrawCharacter (basex+8 + 8*strlen(modemConfig_hangup), modemConfig_cursor_table[3]+12, 10+((int)(realtime*4)&1));
-
- M_DrawTextBox (basex, modemConfig_cursor_table[4]-8, 2, 1);
- M_Print (basex+8, modemConfig_cursor_table[4], "OK");
-
- M_DrawCharacter (basex-8, modemConfig_cursor_table [modemConfig_cursor], 12+((int)(realtime*4)&1));
-}
-
-
-void M_ModemConfig_Key (int key)
-{
- int l;
-
- switch (key)
- {
- case K_ESCAPE:
- M_Menu_SerialConfig_f ();
- break;
-
- case K_UPARROW:
- S_LocalSound ("misc/menu1.wav");
- modemConfig_cursor--;
- if (modemConfig_cursor < 0)
- modemConfig_cursor = NUM_MODEMCONFIG_CMDS-1;
- break;
-
- case K_DOWNARROW:
- S_LocalSound ("misc/menu1.wav");
- modemConfig_cursor++;
- if (modemConfig_cursor >= NUM_MODEMCONFIG_CMDS)
- modemConfig_cursor = 0;
- break;
-
- case K_LEFTARROW:
- case K_RIGHTARROW:
- if (modemConfig_cursor == 0)
- {
- if (modemConfig_dialing == 'P')
- modemConfig_dialing = 'T';
- else
- modemConfig_dialing = 'P';
- S_LocalSound ("misc/menu1.wav");
- }
- break;
-
- case K_ENTER:
- if (modemConfig_cursor == 0)
- {
- if (modemConfig_dialing == 'P')
- modemConfig_dialing = 'T';
- else
- modemConfig_dialing = 'P';
- m_entersound = true;
- }
-
- if (modemConfig_cursor == 4)
- {
- (*SetModemConfig) (0, va ("%c", modemConfig_dialing), modemConfig_clear, modemConfig_init, modemConfig_hangup);
- m_entersound = true;
- M_Menu_SerialConfig_f ();
- }
- break;
-
- case K_BACKSPACE:
- if (modemConfig_cursor == 1)
- {
- if (strlen(modemConfig_clear))
- modemConfig_clear[strlen(modemConfig_clear)-1] = 0;
- }
-
- if (modemConfig_cursor == 2)
- {
- if (strlen(modemConfig_init))
- modemConfig_init[strlen(modemConfig_init)-1] = 0;
- }
-
- if (modemConfig_cursor == 3)
- {
- if (strlen(modemConfig_hangup))
- modemConfig_hangup[strlen(modemConfig_hangup)-1] = 0;
- }
- break;
-
- default:
- if (key < 32 || key > 127)
- break;
-
- if (modemConfig_cursor == 1)
- {
- l = strlen(modemConfig_clear);
- if (l < 15)
- {
- modemConfig_clear[l+1] = 0;
- modemConfig_clear[l] = key;
- }
- }
-
- if (modemConfig_cursor == 2)
- {
- l = strlen(modemConfig_init);
- if (l < 29)
- {
- modemConfig_init[l+1] = 0;
- modemConfig_init[l] = key;
- }
- }
-
- if (modemConfig_cursor == 3)
- {
- l = strlen(modemConfig_hangup);
- if (l < 15)
- {
- modemConfig_hangup[l+1] = 0;
- modemConfig_hangup[l] = key;
- }
- }
- }
-}
-
//=============================================================================
/* LAN CONFIG MENU */
M_Quit_Draw ();
break;
- case m_serialconfig:
- M_SerialConfig_Draw ();
- break;
-
- case m_modemconfig:
- M_ModemConfig_Draw ();
- break;
-
case m_lanconfig:
M_LanConfig_Draw ();
break;
M_Quit_Key (key);
return;
- case m_serialconfig:
- M_SerialConfig_Key (key);
- return;
-
- case m_modemconfig:
- M_ModemConfig_Key (key);
- return;
-
case m_lanconfig:
M_LanConfig_Key (key);
return;
// enable/disable net systems to match desired config
Cbuf_AddText ("stopdemo\n");
- if (SerialConfig || DirectConfig)
- {
- Cbuf_AddText ("com1 enable\n");
- }
if (IPXConfig || TCPIPConfig)
net_hostport = lanConfig_port;