2010-11-22 04:26:23 +00:00
|
|
|
#include "AutoreleasePool.h"
|
2002-08-16 21:54:21 +00:00
|
|
|
#include "menu.h"
|
|
|
|
#include "cmd.h"
|
2003-04-13 20:43:52 +00:00
|
|
|
#include "gib.h"
|
2002-08-16 21:54:21 +00:00
|
|
|
#include "draw.h"
|
|
|
|
#include "key.h"
|
|
|
|
#include "string.h"
|
|
|
|
#include "cbuf.h"
|
|
|
|
#include "options.h"
|
|
|
|
#include "servlist.h"
|
|
|
|
#include "system.h"
|
2020-02-26 04:45:14 +00:00
|
|
|
#include "qfs.h"
|
2003-04-13 20:43:52 +00:00
|
|
|
#include "debug.h"
|
2003-05-14 21:17:32 +00:00
|
|
|
#include "HUD.h"
|
2002-08-16 21:54:21 +00:00
|
|
|
#include "client_menu.h"
|
2007-03-25 02:01:10 +00:00
|
|
|
#include "PropertyList.h"
|
2007-05-13 05:14:32 +00:00
|
|
|
#include "sound.h"
|
2002-08-16 21:54:21 +00:00
|
|
|
|
2004-02-03 08:31:26 +00:00
|
|
|
#include "gui/InputLine.h"
|
|
|
|
#include "gui/Rect.h"
|
|
|
|
|
2004-02-03 05:59:51 +00:00
|
|
|
float () random = #7;
|
2002-08-16 21:54:21 +00:00
|
|
|
|
2011-02-14 14:08:18 +00:00
|
|
|
string dot_name[6] = {
|
2003-03-03 05:24:45 +00:00
|
|
|
"gfx/menudot1.lmp",
|
|
|
|
"gfx/menudot2.lmp",
|
|
|
|
"gfx/menudot3.lmp",
|
|
|
|
"gfx/menudot4.lmp",
|
|
|
|
"gfx/menudot5.lmp",
|
|
|
|
"gfx/menudot6.lmp",
|
2002-08-16 21:54:21 +00:00
|
|
|
};
|
|
|
|
|
2007-05-13 05:14:32 +00:00
|
|
|
void ()
|
|
|
|
menu_enter_sound =
|
|
|
|
{
|
|
|
|
S_LocalSound ("misc/menu2.wav");
|
|
|
|
}
|
|
|
|
|
|
|
|
void ()
|
|
|
|
menu_leave_sound =
|
|
|
|
{
|
|
|
|
S_LocalSound ("misc/menu2.wav");
|
|
|
|
}
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int (int key, int unicode, int down)
|
2007-05-13 05:14:32 +00:00
|
|
|
menu_key_sound =
|
|
|
|
{
|
|
|
|
switch (key) {
|
|
|
|
case QFK_DOWN:
|
|
|
|
case QFM_WHEEL_DOWN:
|
|
|
|
S_LocalSound ("misc/menu1.wav");
|
|
|
|
break;
|
|
|
|
case QFK_UP:
|
|
|
|
case QFM_WHEEL_UP:
|
|
|
|
S_LocalSound ("misc/menu1.wav");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
void (int x, int y) spinner =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
2011-03-25 07:46:32 +00:00
|
|
|
local int i = (int) (time * 10) % 6;
|
2003-03-03 05:24:45 +00:00
|
|
|
local qpic_t p = Draw_CachePic (dot_name[i], 1);
|
2002-08-16 21:54:21 +00:00
|
|
|
|
|
|
|
Draw_Pic (x, y, p);
|
|
|
|
};
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int do_single_player;
|
2002-08-16 21:54:21 +00:00
|
|
|
|
2011-02-14 14:08:18 +00:00
|
|
|
string quitMessage[32] = {
|
2002-08-16 21:54:21 +00:00
|
|
|
/* .........1.........2.... */
|
|
|
|
" Are you gonna quit ",
|
|
|
|
" this game just like ",
|
|
|
|
" everything else? ",
|
|
|
|
" ",
|
|
|
|
|
|
|
|
" Milord, methinks that ",
|
|
|
|
" thou art a lowly ",
|
|
|
|
" quitter. Is this true? ",
|
|
|
|
" ",
|
|
|
|
|
|
|
|
" Do I need to bust your ",
|
|
|
|
" face open for trying ",
|
|
|
|
" to quit? ",
|
|
|
|
" ",
|
|
|
|
|
|
|
|
" Man, I oughta smack you",
|
|
|
|
" for trying to quit! ",
|
|
|
|
" Press Y to get ",
|
|
|
|
" smacked out. ",
|
|
|
|
|
|
|
|
" Press Y to quit like a ",
|
|
|
|
" big loser in life. ",
|
|
|
|
" Press N to stay proud ",
|
|
|
|
" and successful! ",
|
|
|
|
|
|
|
|
" If you press Y to ",
|
|
|
|
" quit, I will summon ",
|
|
|
|
" Satan all over your ",
|
|
|
|
" hard drive! ",
|
|
|
|
|
|
|
|
" Um, Asmodeus dislikes ",
|
|
|
|
" his children trying to ",
|
|
|
|
" quit. Press Y to return",
|
|
|
|
" to your Tinkertoys. ",
|
|
|
|
|
|
|
|
" If you quit now, I'll ",
|
|
|
|
" throw a blanket-party ",
|
|
|
|
" for you next time! ",
|
|
|
|
" "
|
|
|
|
};
|
2011-03-25 07:46:32 +00:00
|
|
|
int quit_index;
|
2002-08-16 21:54:21 +00:00
|
|
|
|
|
|
|
// ********* LOAD / SAVE
|
|
|
|
|
|
|
|
#define MAX_SAVEGAMES 12
|
2012-07-21 13:35:51 +00:00
|
|
|
#define MAX_QUICK 5
|
2011-02-14 14:08:18 +00:00
|
|
|
string filenames[MAX_SAVEGAMES];
|
2011-03-25 07:46:32 +00:00
|
|
|
int loadable[MAX_SAVEGAMES];
|
|
|
|
int load_cursor;
|
|
|
|
int save_cursor;
|
2002-08-16 21:54:21 +00:00
|
|
|
|
2007-03-25 02:01:10 +00:00
|
|
|
string (QFile f) get_comment =
|
|
|
|
{
|
|
|
|
local string line;
|
2011-02-14 14:08:18 +00:00
|
|
|
local PLItem *plist;
|
2007-03-25 02:01:10 +00:00
|
|
|
|
2010-12-16 11:01:49 +00:00
|
|
|
plist = [PLItem fromFile:f];
|
2011-02-14 14:08:18 +00:00
|
|
|
line = [(PLString*) [(PLDictionary*) plist getObjectForKey:"comment"] string];
|
2007-03-25 02:01:10 +00:00
|
|
|
return line;
|
|
|
|
}
|
|
|
|
|
2012-07-21 13:35:51 +00:00
|
|
|
void (int quick) scan_saves =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
2011-03-25 07:46:32 +00:00
|
|
|
local int i;
|
2003-03-03 05:24:45 +00:00
|
|
|
local QFile f;
|
2007-03-25 02:01:10 +00:00
|
|
|
local string line;
|
2012-07-21 13:35:51 +00:00
|
|
|
local int max = MAX_SAVEGAMES;
|
2020-02-26 04:45:14 +00:00
|
|
|
string basename = "s";
|
|
|
|
if (quick) {
|
2012-07-21 13:35:51 +00:00
|
|
|
max = MAX_QUICK;
|
2020-02-26 04:45:14 +00:00
|
|
|
basename = "quick";
|
|
|
|
}
|
2012-07-21 13:35:51 +00:00
|
|
|
for (i = 0; i < max; i++) {
|
2004-01-07 07:36:17 +00:00
|
|
|
if (!filenames[i])
|
|
|
|
filenames[i] = str_new ();
|
2002-08-16 21:54:21 +00:00
|
|
|
loadable[i] = 0;
|
2020-02-26 09:03:00 +00:00
|
|
|
string path = sprintf ("%s%i.sav", basename, i);
|
|
|
|
dprint(path + "\n");
|
|
|
|
f = QFS_OpenFile (path);
|
2004-01-07 07:36:17 +00:00
|
|
|
if (!f) {
|
|
|
|
str_copy (filenames[i], "--- UNUSED SLOT ---");
|
2002-08-16 21:54:21 +00:00
|
|
|
continue;
|
2004-01-07 07:36:17 +00:00
|
|
|
}
|
2007-03-25 02:01:10 +00:00
|
|
|
line = Qgetline (f);
|
|
|
|
if (line == "QuakeForge\n") {
|
|
|
|
str_copy (filenames[i], get_comment (f));
|
|
|
|
} else {
|
|
|
|
str_copy (filenames[i], Qgetline (f));
|
|
|
|
}
|
2002-08-16 21:54:21 +00:00
|
|
|
loadable[i] = 1;
|
2003-02-14 18:17:17 +00:00
|
|
|
Qclose (f);
|
2002-08-16 21:54:21 +00:00
|
|
|
}
|
2012-07-21 13:35:51 +00:00
|
|
|
for (i = max; i < MAX_SAVEGAMES; i++) {
|
|
|
|
loadable[i] = 0;
|
|
|
|
}
|
2002-08-16 21:54:21 +00:00
|
|
|
};
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int (string text, int key) load_f =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
2012-07-21 13:35:51 +00:00
|
|
|
scan_saves (0);
|
2002-08-16 21:54:21 +00:00
|
|
|
Menu_SelectMenu ("load");
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int (string text, int key) save_f =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
2012-07-21 13:35:51 +00:00
|
|
|
scan_saves (0);
|
2002-08-16 21:54:21 +00:00
|
|
|
Menu_SelectMenu ("save");
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
void () load_save_f =
|
|
|
|
{
|
2012-07-21 13:35:51 +00:00
|
|
|
scan_saves (0);
|
2002-08-16 21:54:21 +00:00
|
|
|
if (Cmd_Argv (0) == "menu_load")
|
|
|
|
Menu_SelectMenu ("load");
|
|
|
|
else
|
|
|
|
Menu_SelectMenu ("save");
|
|
|
|
};
|
|
|
|
|
2012-07-21 13:35:51 +00:00
|
|
|
int (int x, int y) load_quickbup_draw =
|
|
|
|
{
|
|
|
|
local int i;
|
|
|
|
|
|
|
|
Draw_CenterPic (x + 160, y + 4, Draw_CachePic ("gfx/p_load.lmp", 1));
|
|
|
|
for (i=0 ; i< MAX_QUICK; i++)
|
|
|
|
Draw_String (x + 16, y + 32 + 8 * i, filenames[i]);
|
|
|
|
Draw_Character (x + 8, y + 32 + load_cursor * 8,
|
|
|
|
12 + ((int) (time * 4) & 1));
|
|
|
|
return 1;
|
|
|
|
};
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int (int x, int y) load_draw =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
2011-03-25 07:46:32 +00:00
|
|
|
local int i;
|
2002-08-16 21:54:21 +00:00
|
|
|
|
2003-05-06 02:19:13 +00:00
|
|
|
Draw_CenterPic (x + 160, y + 4, Draw_CachePic ("gfx/p_load.lmp", 1));
|
2002-08-16 21:54:21 +00:00
|
|
|
for (i=0 ; i< MAX_SAVEGAMES; i++)
|
2003-05-06 02:19:13 +00:00
|
|
|
Draw_String (x + 16, y + 32 + 8 * i, filenames[i]);
|
2012-07-21 13:35:51 +00:00
|
|
|
Draw_String (x + 16, y + 32 + 8 * i, "Quick save backups");
|
2003-05-06 02:19:13 +00:00
|
|
|
Draw_Character (x + 8, y + 32 + load_cursor * 8,
|
2011-03-25 07:46:32 +00:00
|
|
|
12 + ((int) (time * 4) & 1));
|
2002-08-16 21:54:21 +00:00
|
|
|
return 1;
|
|
|
|
};
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int (int x, int y) save_draw =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
2011-03-25 07:46:32 +00:00
|
|
|
local int i;
|
2002-08-16 21:54:21 +00:00
|
|
|
|
2003-05-06 02:19:13 +00:00
|
|
|
Draw_CenterPic (x + 160, y + 4, Draw_CachePic ("gfx/p_save.lmp", 1));
|
2002-08-16 21:54:21 +00:00
|
|
|
for (i=0 ; i< MAX_SAVEGAMES; i++)
|
2003-05-06 02:19:13 +00:00
|
|
|
Draw_String (x + 16, y + 32 + 8 * i, filenames[i]);
|
|
|
|
Draw_Character (x + 8, y + 32 + save_cursor * 8,
|
2011-03-25 07:46:32 +00:00
|
|
|
12 + ((int) (time * 4) & 1));
|
2002-08-16 21:54:21 +00:00
|
|
|
return 1;
|
|
|
|
};
|
|
|
|
|
2012-07-21 13:35:51 +00:00
|
|
|
int (int key, int unicode, int down) load_quickbup_keyevent =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
|
|
|
switch (key) {
|
|
|
|
case QFK_DOWN:
|
|
|
|
case QFM_WHEEL_DOWN:
|
2007-05-13 05:14:32 +00:00
|
|
|
S_LocalSound ("misc/menu1.wav");
|
2002-08-16 21:54:21 +00:00
|
|
|
load_cursor++;
|
2012-07-21 13:35:51 +00:00
|
|
|
load_cursor %= MAX_QUICK;
|
2002-08-16 21:54:21 +00:00
|
|
|
return 1;
|
|
|
|
case QFK_UP:
|
|
|
|
case QFM_WHEEL_UP:
|
2007-05-13 05:14:32 +00:00
|
|
|
S_LocalSound ("misc/menu1.wav");
|
2012-07-21 13:35:51 +00:00
|
|
|
load_cursor += MAX_QUICK - 1;
|
|
|
|
load_cursor %= MAX_QUICK;
|
2002-08-16 21:54:21 +00:00
|
|
|
return 1;
|
|
|
|
case QFK_RETURN:
|
|
|
|
case QFM_BUTTON1:
|
|
|
|
if (loadable[load_cursor]) {
|
2012-07-21 13:35:51 +00:00
|
|
|
S_LocalSound ("misc/menu2.wav");
|
|
|
|
Menu_SelectMenu (nil);
|
|
|
|
Cbuf_AddText (sprintf ("load quick%i.sav\n", load_cursor));
|
|
|
|
load_cursor = MAX_SAVEGAMES;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
int (int key, int unicode, int down) load_keyevent =
|
|
|
|
{
|
|
|
|
switch (key) {
|
|
|
|
case QFK_DOWN:
|
|
|
|
case QFM_WHEEL_DOWN:
|
|
|
|
S_LocalSound ("misc/menu1.wav");
|
|
|
|
load_cursor++;
|
|
|
|
load_cursor %= MAX_SAVEGAMES + 1;
|
|
|
|
return 1;
|
|
|
|
case QFK_UP:
|
|
|
|
case QFM_WHEEL_UP:
|
|
|
|
S_LocalSound ("misc/menu1.wav");
|
|
|
|
load_cursor += MAX_SAVEGAMES;
|
|
|
|
load_cursor %= MAX_SAVEGAMES + 1;
|
|
|
|
return 1;
|
|
|
|
case QFK_RETURN:
|
|
|
|
case QFM_BUTTON1:
|
|
|
|
if (load_cursor == MAX_SAVEGAMES) {
|
|
|
|
load_cursor = 0;
|
|
|
|
scan_saves (1);
|
|
|
|
Menu_SelectMenu ("load_quickbup");
|
|
|
|
} else if (loadable[load_cursor]) {
|
2007-05-13 05:14:32 +00:00
|
|
|
S_LocalSound ("misc/menu2.wav");
|
2011-01-14 03:07:40 +00:00
|
|
|
Menu_SelectMenu (nil);
|
2002-08-16 21:54:21 +00:00
|
|
|
Cbuf_AddText (sprintf ("load s%i.sav\n", load_cursor));
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int (int key, int unicode, int down) save_keyevent =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
|
|
|
switch (key) {
|
|
|
|
case QFK_DOWN:
|
|
|
|
case QFM_WHEEL_DOWN:
|
2007-05-13 05:14:32 +00:00
|
|
|
S_LocalSound ("misc/menu1.wav");
|
2002-08-16 21:54:21 +00:00
|
|
|
save_cursor++;
|
|
|
|
save_cursor %= MAX_SAVEGAMES;
|
|
|
|
return 1;
|
|
|
|
case QFK_UP:
|
|
|
|
case QFM_WHEEL_UP:
|
2007-05-13 05:14:32 +00:00
|
|
|
S_LocalSound ("misc/menu1.wav");
|
2002-08-16 21:54:21 +00:00
|
|
|
save_cursor += MAX_SAVEGAMES - 1;
|
|
|
|
save_cursor %= MAX_SAVEGAMES;
|
|
|
|
return 1;
|
|
|
|
case QFK_RETURN:
|
|
|
|
case QFM_BUTTON1:
|
2011-01-14 03:07:40 +00:00
|
|
|
Menu_SelectMenu (nil);
|
2002-08-16 21:54:21 +00:00
|
|
|
Cbuf_AddText (sprintf ("save s%i.sav\n", save_cursor));
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2012-07-21 13:35:51 +00:00
|
|
|
void () load_quickbup_menu =
|
|
|
|
{
|
|
|
|
Menu_Begin (0, 0, "load_quickbup");
|
|
|
|
Menu_EnterHook (menu_enter_sound);
|
|
|
|
Menu_LeaveHook (menu_leave_sound);
|
|
|
|
Menu_FadeScreen (1);
|
|
|
|
Menu_KeyEvent (load_quickbup_keyevent);
|
|
|
|
Menu_Draw (load_quickbup_draw);
|
|
|
|
Menu_End ();
|
|
|
|
};
|
|
|
|
|
2002-08-16 21:54:21 +00:00
|
|
|
void () load_menu =
|
|
|
|
{
|
|
|
|
Menu_Begin (0, 0, "load");
|
2007-05-13 05:14:32 +00:00
|
|
|
Menu_EnterHook (menu_enter_sound);
|
|
|
|
Menu_LeaveHook (menu_leave_sound);
|
2002-08-16 21:54:21 +00:00
|
|
|
Menu_FadeScreen (1);
|
|
|
|
Menu_KeyEvent (load_keyevent);
|
|
|
|
Menu_Draw (load_draw);
|
|
|
|
Menu_End ();
|
|
|
|
Cmd_AddCommand ("menu_load", load_save_f);
|
|
|
|
};
|
|
|
|
|
|
|
|
void () save_menu =
|
|
|
|
{
|
|
|
|
Menu_Begin (0, 0, "save");
|
2007-05-13 05:14:32 +00:00
|
|
|
Menu_EnterHook (menu_enter_sound);
|
|
|
|
Menu_LeaveHook (menu_leave_sound);
|
2002-08-16 21:54:21 +00:00
|
|
|
Menu_FadeScreen (1);
|
|
|
|
Menu_KeyEvent (save_keyevent);
|
|
|
|
Menu_Draw (save_draw);
|
|
|
|
Menu_End ();
|
|
|
|
Cmd_AddCommand ("menu_save", load_save_f);
|
|
|
|
};
|
|
|
|
|
|
|
|
// ********* QUIT
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int () quit =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
|
|
|
Menu_SelectMenu ("quit");
|
2011-03-25 07:46:32 +00:00
|
|
|
quit_index = (int) (random () * 8);
|
2002-08-16 21:54:21 +00:00
|
|
|
quit_index &= 7;
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int (string text, int key) quit_f =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
|
|
|
quit ();
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int (int key, int unicode, int down) quit_keyevent =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
|
|
|
if (key == 'y') {
|
|
|
|
Menu_Quit ();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (key == 'n') {
|
2011-01-14 03:07:40 +00:00
|
|
|
Menu_SelectMenu (nil);
|
2002-08-16 21:54:21 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int (int x, int y) quit_draw =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
2003-05-06 02:19:13 +00:00
|
|
|
text_box (x + 56, y + 76, 24, 4);
|
|
|
|
Draw_String (x + 64, y + 84, quitMessage[quit_index * 4 + 0]);
|
|
|
|
Draw_String (x + 64, y + 92, quitMessage[quit_index * 4 + 1]);
|
|
|
|
Draw_String (x + 64, y + 100, quitMessage[quit_index * 4 + 2]);
|
|
|
|
Draw_String (x + 64, y + 108, quitMessage[quit_index * 4 + 3]);
|
2002-08-16 21:54:21 +00:00
|
|
|
return 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
void () quit_menu =
|
|
|
|
{
|
|
|
|
Menu_Begin (0, 0, "quit");
|
2007-05-13 05:14:32 +00:00
|
|
|
Menu_EnterHook (menu_enter_sound);
|
|
|
|
Menu_LeaveHook (menu_leave_sound);
|
2002-08-16 21:54:21 +00:00
|
|
|
Menu_FadeScreen (1);
|
|
|
|
Menu_KeyEvent (quit_keyevent);
|
|
|
|
Menu_Draw (quit_draw);
|
|
|
|
Menu_End ();
|
|
|
|
};
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int (string text, int key) sp_start =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
2011-01-14 03:07:40 +00:00
|
|
|
Menu_SelectMenu (nil);
|
2002-08-16 21:54:21 +00:00
|
|
|
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 ("listen 0\n");
|
|
|
|
Cbuf_AddText ("noexit 0\n");
|
|
|
|
Cbuf_AddText ("samelevel 0\n");
|
|
|
|
Cbuf_AddText ("map start\n");
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
void () single_player_menu =
|
|
|
|
{
|
|
|
|
Menu_Begin (54, 32, "");
|
2007-05-13 05:14:32 +00:00
|
|
|
Menu_EnterHook (menu_enter_sound);
|
|
|
|
Menu_LeaveHook (menu_leave_sound);
|
|
|
|
Menu_KeyEvent (menu_key_sound);
|
2002-08-16 21:54:21 +00:00
|
|
|
Menu_FadeScreen (1);
|
|
|
|
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, 0);
|
|
|
|
Menu_Item (54, 52, "", load_f, 0);
|
|
|
|
Menu_Item (54, 72, "", save_f, 0);
|
|
|
|
Menu_End ();
|
|
|
|
};
|
|
|
|
|
|
|
|
// ********* MULTIPLAYER
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int JoiningGame;
|
|
|
|
int lanConfig_cursor;
|
2002-08-16 21:54:21 +00:00
|
|
|
string my_tcpip_address;
|
|
|
|
string lanConfig_portname;
|
|
|
|
string lanConfig_joinname;
|
|
|
|
#define NUM_LANCONFIG_CMDS 3
|
2011-03-25 07:46:32 +00:00
|
|
|
int lanConfig_cursor_table[NUM_LANCONFIG_CMDS] = { 72, 92, 124 };
|
2011-02-14 14:08:18 +00:00
|
|
|
InputLine *lanConfig_port_il;
|
|
|
|
InputLine *lanConfig_join_il;
|
|
|
|
InputLine *input_active;
|
2002-08-16 21:54:21 +00:00
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int (int x, int y) join_draw =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
2011-03-25 07:46:32 +00:00
|
|
|
local int f = x + (320 - 26 * 8) / 2;
|
2003-05-06 02:19:13 +00:00
|
|
|
text_box (f, y + 134, 24, 4);
|
|
|
|
Draw_String (f, y + 142, " Commonly used to play ");
|
|
|
|
Draw_String (f, y + 150, " over the Internet, but ");
|
|
|
|
Draw_String (f, y + 158, " also used on a Local ");
|
|
|
|
Draw_String (f, y + 166, " Area Network. ");
|
2002-08-16 21:54:21 +00:00
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int (int x, int y) lanconfig_draw =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
2011-03-25 07:46:32 +00:00
|
|
|
local int basex = 54 + x;
|
2002-08-16 21:54:21 +00:00
|
|
|
local string startJoin = JoiningGame ? "Join Game" : "New Game";
|
|
|
|
local string protocol = "UDP";
|
|
|
|
|
2003-05-06 02:19:13 +00:00
|
|
|
Draw_String (basex, y + 32, sprintf ("%s - %s", startJoin, protocol));
|
2002-08-16 21:54:21 +00:00
|
|
|
basex += 8;
|
2003-05-06 02:19:13 +00:00
|
|
|
Draw_String (basex, y + 52, "Address:");
|
|
|
|
Draw_String (basex + 9 * 8, y + 52, "127.0.0.1");
|
|
|
|
Draw_String (basex, y + lanConfig_cursor_table[0], "Port");
|
|
|
|
[lanConfig_port_il setBasePos:x y:y];
|
2004-02-13 05:36:35 +00:00
|
|
|
[lanConfig_port_il cursor:lanConfig_cursor == 0 && input_active];
|
|
|
|
[lanConfig_port_il draw];
|
2003-05-06 02:19:13 +00:00
|
|
|
Draw_String (basex + 9 * 8, y + lanConfig_cursor_table[0],
|
|
|
|
lanConfig_portname);
|
2002-08-16 21:54:21 +00:00
|
|
|
|
|
|
|
if (JoiningGame) {
|
2003-08-20 05:43:24 +00:00
|
|
|
Draw_String (basex, y + lanConfig_cursor_table[1], "Search for local "
|
2003-03-03 05:24:45 +00:00
|
|
|
"games...");
|
2003-08-20 05:43:24 +00:00
|
|
|
Draw_String (basex, y + 108, "Join game at:");
|
2003-05-06 02:19:13 +00:00
|
|
|
[lanConfig_join_il setBasePos:x y:y];
|
2004-02-13 05:36:35 +00:00
|
|
|
[lanConfig_join_il cursor:lanConfig_cursor == 2 && input_active];
|
|
|
|
[lanConfig_join_il draw];
|
2003-08-20 05:43:24 +00:00
|
|
|
Draw_String (basex + 16, y + lanConfig_cursor_table[2],
|
2003-03-03 05:24:45 +00:00
|
|
|
lanConfig_joinname);
|
2002-08-16 21:54:21 +00:00
|
|
|
} else {
|
2003-08-20 05:43:24 +00:00
|
|
|
text_box (basex, y + lanConfig_cursor_table[1] - 8, 2, 1);
|
|
|
|
Draw_String (basex + 8, y + lanConfig_cursor_table[1], "OK");
|
2002-08-16 21:54:21 +00:00
|
|
|
}
|
|
|
|
if (!input_active)
|
2003-08-20 05:43:24 +00:00
|
|
|
Draw_Character (basex - 8, y + lanConfig_cursor_table[lanConfig_cursor],
|
2011-03-25 07:46:32 +00:00
|
|
|
12 + ((int) (time * 4) & 1));
|
2002-08-16 21:54:21 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int (int key, int unicode, int down) lanconfig_keyevent =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
|
|
|
if (input_active)
|
2002-08-20 02:09:34 +00:00
|
|
|
[input_active processInput:(key >= 256 ? key : unicode)];
|
2002-08-16 21:54:21 +00:00
|
|
|
switch (key) {
|
|
|
|
case QFK_DOWN:
|
|
|
|
case QFM_WHEEL_DOWN:
|
|
|
|
if (!input_active) {
|
2007-05-13 05:14:32 +00:00
|
|
|
S_LocalSound ("misc/menu2.wav");
|
2002-08-16 21:54:21 +00:00
|
|
|
lanConfig_cursor ++;
|
|
|
|
lanConfig_cursor %= NUM_LANCONFIG_CMDS;
|
|
|
|
}
|
2011-07-07 08:08:21 +00:00
|
|
|
return 1;
|
2002-08-16 21:54:21 +00:00
|
|
|
case QFK_UP:
|
|
|
|
case QFM_WHEEL_UP:
|
|
|
|
if (!input_active) {
|
2007-05-13 05:14:32 +00:00
|
|
|
S_LocalSound ("misc/menu2.wav");
|
2002-08-16 21:54:21 +00:00
|
|
|
lanConfig_cursor += NUM_LANCONFIG_CMDS - 1;
|
|
|
|
lanConfig_cursor %= NUM_LANCONFIG_CMDS;
|
|
|
|
}
|
2011-07-07 08:08:21 +00:00
|
|
|
return 1;
|
2002-08-16 21:54:21 +00:00
|
|
|
case QFK_RETURN:
|
|
|
|
if (input_active) {
|
2011-01-14 03:07:40 +00:00
|
|
|
input_active = nil;
|
2002-08-16 21:54:21 +00:00
|
|
|
} else {
|
|
|
|
if (lanConfig_cursor == 0) {
|
|
|
|
input_active = lanConfig_port_il;
|
|
|
|
} else if (JoiningGame) {
|
|
|
|
if (lanConfig_cursor == 2) {
|
|
|
|
input_active = lanConfig_join_il;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-07-07 08:08:21 +00:00
|
|
|
return 1;
|
2002-08-16 21:54:21 +00:00
|
|
|
}
|
2011-07-07 08:08:21 +00:00
|
|
|
return 0;
|
2002-08-16 21:54:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void () lanconfig_menu =
|
|
|
|
{
|
|
|
|
Menu_Begin (54, 92, "");
|
2007-05-13 05:14:32 +00:00
|
|
|
Menu_EnterHook (menu_enter_sound);
|
|
|
|
Menu_LeaveHook (menu_leave_sound);
|
2002-08-16 21:54:21 +00:00
|
|
|
Menu_FadeScreen (1);
|
|
|
|
Menu_Pic (16, 4, "gfx/qplaque.lmp");
|
|
|
|
Menu_CenterPic (160, 4, "gfx/p_multi.lmp");
|
|
|
|
Menu_Draw (lanconfig_draw);
|
|
|
|
Menu_KeyEvent (lanconfig_keyevent);
|
|
|
|
Menu_End ();
|
|
|
|
};
|
|
|
|
|
|
|
|
void () join_menu =
|
|
|
|
{
|
|
|
|
Menu_Begin (54, 32, "");
|
2007-05-13 05:14:32 +00:00
|
|
|
Menu_EnterHook (menu_enter_sound);
|
|
|
|
Menu_LeaveHook (menu_leave_sound);
|
|
|
|
Menu_KeyEvent (menu_key_sound);
|
2002-08-16 21:54:21 +00:00
|
|
|
Menu_FadeScreen (1);
|
|
|
|
Menu_Pic (16, 4, "gfx/qplaque.lmp");
|
|
|
|
Menu_CenterPic (160, 4, "gfx/p_multi.lmp");
|
|
|
|
Menu_Pic (72, 32, "gfx/dim_modm.lmp");
|
|
|
|
Menu_Pic (72, 51, "gfx/dim_drct.lmp");
|
|
|
|
Menu_Pic (72, 70, "gfx/dim_ipx.lmp");
|
|
|
|
Menu_Pic (72, 89, "gfx/netmen4.lmp");
|
|
|
|
lanconfig_menu ();
|
|
|
|
Menu_Draw (join_draw);
|
|
|
|
Menu_Cursor (spinner);
|
|
|
|
Menu_End ();
|
|
|
|
};
|
|
|
|
|
2011-03-25 07:46:32 +00:00
|
|
|
int (int key, int unicode, int down) multi_player_keyevent =
|
2002-08-16 21:54:21 +00:00
|
|
|
{
|
|
|
|
if (key == QFK_RETURN) {
|
|
|
|
JoiningGame = (Menu_GetIndex () == 0);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
void () multi_player_menu =
|
|
|
|
{
|
|
|
|
Menu_Begin (54, 52, "");
|
2007-05-13 05:14:32 +00:00
|
|
|
Menu_EnterHook (menu_enter_sound);
|
|
|
|
Menu_LeaveHook (menu_leave_sound);
|
2002-08-16 21:54:21 +00:00
|
|
|
Menu_FadeScreen (1);
|
|
|
|
Menu_Pic (16, 4, "gfx/qplaque.lmp");
|
|
|
|
Menu_CenterPic (160, 4, "gfx/p_multi.lmp");
|
|
|
|
Menu_Pic (72, 32, "gfx/mp_menu.lmp");
|
|
|
|
Menu_KeyEvent (multi_player_keyevent);
|
|
|
|
join_menu ();
|
|
|
|
if (do_single_player)
|
|
|
|
Menu_Item (54, 52, "", quit_f, 0);
|
|
|
|
Menu_Item (54, 72, "", quit_f, 0);
|
|
|
|
Menu_Cursor (spinner);
|
|
|
|
Menu_End ();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void () help_menu =
|
|
|
|
{
|
|
|
|
Menu_Item (54, 92, "", quit_f, 0);
|
|
|
|
};
|
|
|
|
|
|
|
|
void () main_menu =
|
|
|
|
{
|
|
|
|
Menu_Begin (0, 0, "main");
|
2007-05-13 05:14:32 +00:00
|
|
|
Menu_EnterHook (menu_enter_sound);
|
|
|
|
Menu_LeaveHook (menu_leave_sound);
|
|
|
|
Menu_KeyEvent (menu_key_sound);
|
2002-08-16 21:54:21 +00:00
|
|
|
Menu_FadeScreen (1);
|
|
|
|
Menu_Pic (16, 4, "gfx/qplaque.lmp");
|
|
|
|
Menu_CenterPic (160, 4, "gfx/ttl_main.lmp");
|
|
|
|
if (do_single_player)
|
|
|
|
Menu_Pic (71,32, "gfx/mainmenu.lmp");
|
|
|
|
else
|
|
|
|
Menu_SubPic (71,52, "gfx/mainmenu.lmp", 0, 20, 240, 92);
|
|
|
|
Menu_Cursor (spinner);
|
|
|
|
if (do_single_player)
|
|
|
|
single_player_menu ();
|
|
|
|
switch (gametype ()) {
|
|
|
|
case "netquake":
|
|
|
|
multi_player_menu ();
|
|
|
|
break;
|
|
|
|
case "quakeworld":
|
|
|
|
server_list_menu ();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
MENU_options ();
|
|
|
|
help_menu ();
|
|
|
|
Menu_Item (54, 112, "", quit_f, 0);
|
|
|
|
Menu_End ();
|
|
|
|
};
|
|
|
|
|
|
|
|
void () menu_init =
|
|
|
|
{
|
2010-11-17 06:50:07 +00:00
|
|
|
lanConfig_port_il = [[InputLineBox alloc] initWithBounds:makeRect (126, lanConfig_cursor_table[0] - 8, 8, 4) promptCharacter:' '];
|
2002-08-20 02:09:34 +00:00
|
|
|
[lanConfig_port_il setWidth:10];
|
2010-11-17 06:50:07 +00:00
|
|
|
lanConfig_join_il = [[InputLineBox alloc] initWithBounds:makeRect (70, lanConfig_cursor_table[2] - 8, 24, 4) promptCharacter:' '];
|
2002-08-20 02:09:34 +00:00
|
|
|
[lanConfig_join_il setWidth:26];
|
2002-08-16 21:54:21 +00:00
|
|
|
switch (gametype ()) {
|
|
|
|
case "netquake":
|
|
|
|
do_single_player = 1;
|
|
|
|
break;
|
|
|
|
case "quakeworld":
|
|
|
|
do_single_player = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
main_menu ();
|
|
|
|
quit_menu ();
|
|
|
|
load_menu ();
|
2012-07-21 13:35:51 +00:00
|
|
|
load_quickbup_menu ();
|
2002-08-16 21:54:21 +00:00
|
|
|
save_menu ();
|
2003-05-14 21:17:32 +00:00
|
|
|
|
2002-08-16 21:54:21 +00:00
|
|
|
Menu_TopMenu ("main");
|
|
|
|
Menu_SetQuit (quit);
|
2003-05-14 21:17:32 +00:00
|
|
|
|
2002-08-16 21:54:21 +00:00
|
|
|
};
|
2004-02-14 05:33:34 +00:00
|
|
|
|
|
|
|
void () menu_draw_hud =
|
|
|
|
{
|
|
|
|
};
|
2010-11-22 04:26:23 +00:00
|
|
|
|
2011-03-21 04:14:14 +00:00
|
|
|
@static AutoreleasePool *autorelease_pool;
|
|
|
|
|
|
|
|
void menu_pre ()
|
|
|
|
{
|
|
|
|
autorelease_pool = [[AutoreleasePool alloc] init];
|
|
|
|
}
|
|
|
|
|
2010-11-22 04:26:23 +00:00
|
|
|
void menu_post ()
|
|
|
|
{
|
2012-11-20 05:53:06 +00:00
|
|
|
//FIXME called too often by the engine?
|
|
|
|
AutoreleasePool *ar;
|
|
|
|
|
|
|
|
ar = autorelease_pool;
|
2011-03-21 04:14:14 +00:00
|
|
|
autorelease_pool = nil;
|
2012-11-20 05:53:06 +00:00
|
|
|
[ar release];
|
2010-11-22 04:26:23 +00:00
|
|
|
}
|