menu_height = 200;
menu_x = (vid.conwidth - menu_width) * 0.5;
menu_y = (vid.conheight - menu_height) * 0.5;
- //DrawQ_Fill(menu_x, menu_y, menu_width, menu_height, 0, 0, 0, 0.5, 0);
DrawQ_Fill(0, 0, vid.conwidth, vid.conheight, 0, 0, 0, 0.5, 0);
}
void M_Print (float cx, float cy, char *str)
{
- /*
- while (*str)
- {
- M_DrawCharacter (cx, cy, (*str++)+128);
- cx += 8;
- }
- */
DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
}
void M_ItemPrint (float cx, float cy, char *str, int unghosted)
{
- /*
- while (*str)
- {
- M_DrawCharacter (cx, cy, (*str++)+128);
- cx += 8;
- }
- */
if (unghosted)
DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
else
}
}
-// 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)
-{
- // FIXME: handle color flashs and such when selected
- M_DrawPic (item->x, item->y, item->string);
-}
-
-void menuitem_command_usefunc(struct menuitem_s *item)
-{
- Cbuf_AddText (item->command);
-}
-#endif
int demo_cursor;
void M_Demo_Draw (void)
/* MAIN MENU */
int m_main_cursor;
-//#define MAIN_ITEMS 5
int MAIN_ITEMS = 4; // Nehahra: Menu Disable
void M_DrawCheckbox (int x, int y, int on)
{
-#if 0
- if (on)
- M_DrawCharacter (x, y, 131);
- else
- M_DrawCharacter (x, y, 129);
-#endif
if (on)
M_Print (x, y, "on");
else
M_Print (x, y, "off");
}
-/*
-int m_2dres[] =
-{
- 320, 200,
- 320, 240,
- 400, 300,
- 512, 384,
- 640, 480,
- 800, 600,
- 1024, 768,
- 1280, 960,
- 1600, 1200,
- 2048, 1536
-};
-
-int M_Num2DResolutions(void)
-{
- return sizeof(m_2dres) / sizeof(int[2]);
-};
-
-float M_Classify2DResolution(void)
-{
- int i, num, *res, best, bestdist, diff[3];
- num = M_Num2DResolutions();
- best = -1;
- bestdist = 1000000000;
- for (i = 0;i < num;i++)
- {
- res = m_2dres + i * 2;
- diff[0] = res[0] - vid.conwidth;
- diff[1] = res[1] - vid.conheight;
- diff[2] = 0;
- dist = DotProduct(diff, diff);
- if (bestdist > dist)
- {
- bestdist = dist;
- best = i;
- }
- }
- return i;
-}
-
-void M_Adjust2DResolution(int dir)
-{
- int i, num;
- i = M_Classify2DResolution() + dir;
- num = M_Num2DResolutions() - 1;
- i = bound(0, i, num);
- Cvar_SetValue("v_2dwidth", m_2dres[i*2]);
- Cvar_SetValue("v_2dheight", m_2dres[i*2+1]);
-}
-*/
void M_Options_Draw (void)
{
char *bindnames[][2] =
{
{"+attack", "attack"},
-{"impulse 10", "change weapon"},
+{"impulse 10", "next weapon"},
+{"impulse 12", "previous weapon"},
{"+jump", "jump / swim up"},
{"+forward", "walk forward"},
{"+back", "backpedal"},
#define NUMCOMMANDS (sizeof(bindnames)/sizeof(bindnames[0]))
+/*
+typedef struct binditem_s
+{
+ char *command, *description;
+ struct binditem_s *next;
+}
+binditem_t;
+
+typedef struct bindcategory_s
+{
+ char *name;
+ binditem_t *binds;
+ struct bindcategory_s *next;
+}
+bindcategory_t;
+
+bindcategory_t *bindcategories = NULL;
+
+void M_ClearBinds (void)
+{
+ for (c = bindcategories;c;c = cnext)
+ {
+ cnext = c->next;
+ for (b = c->binds;b;b = bnext)
+ {
+ bnext = b->next;
+ Z_Free(b);
+ }
+ Z_Free(c);
+ }
+ bindcategories = NULL;
+}
+
+void M_AddBindToCategory(bindcategory_t *c, char *command, char *description)
+{
+ for (b = &c->binds;*b;*b = &(*b)->next);
+ *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1);
+ *b->command = (char *)((*b) + 1);
+ *b->description = *b->command + strlen(command) + 1;
+ strcpy(*b->command, command);
+ strcpy(*b->description, description);
+}
+
+void M_AddBind (char *category, char *command, char *description)
+{
+ for (c = &bindcategories;*c;c = &(*c)->next)
+ {
+ if (!strcmp(category, (*c)->name))
+ {
+ M_AddBindToCategory(*c, command, description);
+ return;
+ }
+ }
+ *c = Z_Alloc(sizeof(bindcategory_t));
+ M_AddBindToCategory(*c, command, description);
+}
+
+void M_DefaultBinds (void)
+{
+ M_ClearBinds();
+ M_AddBind("movement", "+jump", "jump / swim up");
+ M_AddBind("movement", "+forward", "walk forward");
+ M_AddBind("movement", "+back", "backpedal");
+ M_AddBind("movement", "+left", "turn left");
+ M_AddBind("movement", "+right", "turn right");
+ M_AddBind("movement", "+speed", "run");
+ M_AddBind("movement", "+moveleft", "step left");
+ M_AddBind("movement", "+moveright", "step right");
+ M_AddBind("movement", "+strafe", "sidestep");
+ M_AddBind("movement", "+lookup", "look up");
+ M_AddBind("movement", "+lookdown", "look down");
+ M_AddBind("movement", "centerview", "center view");
+ M_AddBind("movement", "+mlook", "mouse look");
+ M_AddBind("movement", "+klook", "keyboard look");
+ M_AddBind("movement", "+moveup", "swim up");
+ M_AddBind("movement", "+movedown", "swim down");
+ M_AddBind("weapons", "+attack", "attack");
+ M_AddBind("weapons", "impulse 10", "next weapon");
+ M_AddBind("weapons", "impulse 12", "previous weapon");
+ M_AddBind("weapons", "impulse 1", "select weapon 1 (axe)");
+ M_AddBind("weapons", "impulse 2", "select weapon 2 (shotgun)");
+ M_AddBind("weapons", "impulse 3", "select weapon 3 (super )");
+ M_AddBind("weapons", "impulse 4", "select weapon 4 (nailgun)");
+ M_AddBind("weapons", "impulse 5", "select weapon 5 (super nailgun)");
+ M_AddBind("weapons", "impulse 6", "select weapon 6 (grenade launcher)");
+ M_AddBind("weapons", "impulse 7", "select weapon 7 (rocket launcher)");
+ M_AddBind("weapons", "impulse 8", "select weapon 8 (lightning gun)");
+}
+*/
+
+
int keys_cursor;
int bind_grab;
m_entersound = true;
}
+#define NUMKEYS 5
-void M_FindKeysForCommand (char *command, int *twokeys)
+void M_FindKeysForCommand (char *command, int *keys)
{
int count;
int j;
char *b;
- twokeys[0] = twokeys[1] = -1;
+ for (j = 0;j < NUMKEYS;j++)
+ keys[j] = -1;
+
count = 0;
for (j=0 ; j<256 ; j++)
continue;
if (!strcmp (b, command) )
{
- twokeys[count] = j;
- count++;
- if (count == 2)
+ keys[count++] = j;
+ if (count == NUMKEYS)
break;
}
}
void M_Keys_Draw (void)
{
- int i, l;
- int keys[2];
- char *name;
- int x, y;
+ int i, j;
+ int keys[NUMKEYS];
+ int y;
cachepic_t *p;
+ char keystring[1024];
p = Draw_CachePic ("gfx/ttl_cstm.lmp");
M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
M_Print (16, y, bindnames[i][1]);
- l = strlen (bindnames[i][0]);
-
M_FindKeysForCommand (bindnames[i][0], keys);
+ // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer
if (keys[0] == -1)
- {
- M_Print (140, y, "???");
- }
+ strcpy(keystring, "???");
else
{
- name = Key_KeynumToString (keys[0]);
- M_Print (140, y, name);
- x = strlen(name) * 8;
- if (keys[1] != -1)
+ keystring[0] = 0;
+ for (j = 0;j < NUMKEYS;j++)
{
- M_Print (140 + x + 8, y, "or");
- M_Print (140 + x + 32, y, Key_KeynumToString (keys[1]));
+ if (keys[j] != -1)
+ {
+ if (j > 0)
+ strcat(keystring, " or ");
+ strcat(keystring, Key_KeynumToString (keys[j]));
+ }
}
}
+ M_Print (140, y, keystring);
}
if (bind_grab)
void M_Keys_Key (int k)
{
char cmd[80];
- int keys[2];
+ int keys[NUMKEYS];
if (bind_grab)
{ // defining a key
{
bind_grab = false;
}
- else if (k != '`')
+ else //if (k != '`')
{
sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
Cbuf_InsertText (cmd);
case K_ENTER: // go into bind mode
M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
S_LocalSound ("misc/menu2.wav");
- if (keys[1] != -1)
+ if (keys[NUMKEYS - 1] != -1)
M_UnbindCommand (bindnames[keys_cursor][0]);
bind_grab = true;
break;
int m_quit_prevstate;
qboolean wasInMenus;
-//#ifndef _WIN32
char *quitMessage [] =
{
/* .........1.........2.... */
" 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 ",
" constructive? ",
" ",
};
-//#endif
void M_Menu_Quit_f (void)
{
void M_Quit_Draw (void)
{
-/*
-#ifdef _WIN32
- M_DrawTextBox (0, 0, 38, 23);
- M_PrintWhite (16, 12, " Quake version 1.09 by id Software\n\n");
- M_PrintWhite (16, 28, "Programming Art \n");
- M_Print (16, 36, " John Carmack Adrian Carmack\n");
- M_Print (16, 44, " Michael Abrash Kevin Cloud\n");
- M_Print (16, 52, " John Cash Paul Steed\n");
- M_Print (16, 60, " Dave 'Zoid' Kirsch\n");
- M_PrintWhite (16, 68, "Design Biz\n");
- M_Print (16, 76, " John Romero Jay Wilbur\n");
- M_Print (16, 84, " Sandy Petersen Mike Wilson\n");
- M_Print (16, 92, " American McGee Donna Jackson\n");
- M_Print (16, 100, " Tim Willits Todd Hollenshead\n");
- M_PrintWhite (16, 108, "Support Projects\n");
- M_Print (16, 116, " Barrett Alexander Shawn Green\n");
- M_PrintWhite (16, 124, "Sound Effects\n");
- M_Print (16, 132, " Trent Reznor and Nine Inch Nails\n\n");
- M_PrintWhite (16, 140, "Quake is a trademark of Id Software,\n");
- M_PrintWhite (16, 148, "inc., (c)1996 Id Software, inc. All\n");
- M_PrintWhite (16, 156, "rights reserved. NIN logo is a\n");
- M_PrintWhite (16, 164, "registered trademark licensed to\n");
- M_PrintWhite (16, 172, "Nothing Interactive, Inc. All rights\n");
- M_PrintWhite (16, 180, "reserved. Press y to exit\n");
-#else
-*/
M_DrawTextBox (56, 76, 24, 4);
M_Print (64, 84, quitMessage[msgNumber*4+0]);
M_Print (64, 92, quitMessage[msgNumber*4+1]);
M_Print (64, 100, quitMessage[msgNumber*4+2]);
M_Print (64, 108, quitMessage[msgNumber*4+3]);
-//#endif
}
//=============================================================================
M_Print (x, 154, " First, question your ");
M_Print (x, 162, " sanity, then email ");
M_Print (x, 170, " havoc@gamevisions.com ");
- /*
- M_Print (x, 146, " More than 4 players ");
- M_Print (x, 154, " requires using command ");
- M_Print (x, 162, "line parameters; please ");
- M_Print (x, 170, " see techinfo.txt. ");
- */
}
else
{
if (IPXConfig || TCPIPConfig)
net_hostport = lanConfig_port;
}
+