openbsd-ports/games/quake/patches/patch-uquake_menu_c
espie 39429549e3 Quake. Needs you to have datafiles to be useful.
Original by Maurices Nonnekes, a few tweaks (sound, i386 optimizations,
longer save menus) by me.

The client/server part probably still needs some work... 
and it is definitely unaudited.

Packaging might be changed to account for docs...

In fact, I really need `common' package files and reference counting...
2001-08-03 13:02:16 +00:00

190 lines
4.3 KiB
Plaintext

$OpenBSD: patch-uquake_menu_c,v 1.1.1.1 2001/08/03 13:02:16 espie Exp $
--- uquake/menu.c.orig Mon Jan 10 17:59:38 2000
+++ uquake/menu.c Fri Aug 3 14:41:45 2001
@@ -316,6 +316,18 @@ void M_Main_Key (int key)
CL_NextDemo ();
break;
+ case K_HOME:
+ case KP_HOME:
+ S_LocalSound ("misc/menu1.wav");
+ m_main_cursor = 0;
+ break;
+
+ case K_END:
+ case KP_END:
+ S_LocalSound ("misc/menu1.wav");
+ m_main_cursor = MAIN_ITEMS-1;
+ break;
+
case KP_DOWNARROW:
case K_DOWNARROW:
S_LocalSound ("misc/menu1.wav");
@@ -398,6 +410,18 @@ void M_SinglePlayer_Key (int key)
M_Menu_Main_f ();
break;
+ case K_HOME:
+ case KP_HOME:
+ S_LocalSound ("misc/menu1.wav");
+ m_singleplayer_cursor = 0;
+ break;
+
+ case K_END:
+ case KP_END:
+ S_LocalSound ("misc/menu1.wav");
+ m_singleplayer_cursor = SINGLEPLAYER_ITEMS-1;
+ break;
+
case KP_DOWNARROW:
case K_DOWNARROW:
S_LocalSound ("misc/menu1.wav");
@@ -444,8 +468,9 @@ void M_SinglePlayer_Key (int key)
/* LOAD/SAVE MENU */
int load_cursor; // 0 < load_cursor < MAX_SAVEGAMES
+int max_savegames; // actual value
-#define MAX_SAVEGAMES 12
+#define MAX_SAVEGAMES 80
char m_filenames[MAX_SAVEGAMES][SAVEGAME_COMMENT_LENGTH+1];
int loadable[MAX_SAVEGAMES];
@@ -456,7 +481,11 @@ void M_ScanSaves (void)
FILE *f;
int version;
- for (i=0 ; i<MAX_SAVEGAMES ; i++)
+ max_savegames = (vid.height - 48)/8;
+ if (max_savegames > MAX_SAVEGAMES)
+ max_savegames = MAX_SAVEGAMES;
+
+ for (i=0 ; i<max_savegames ; i++)
{
strcpy (m_filenames[i], "--- UNUSED SLOT ---");
loadable[i] = false;
@@ -509,7 +538,7 @@ void M_Load_Draw (void)
p = Draw_CachePic ("gfx/p_load.lmp");
M_DrawPic ( (320-p->width)/2, 4, p);
- for (i=0 ; i< MAX_SAVEGAMES; i++)
+ for (i=0 ; i< max_savegames; i++)
M_Print (16, 32 + 8*i, m_filenames[i]);
// line cursor
@@ -525,7 +554,7 @@ void M_Save_Draw (void)
p = Draw_CachePic ("gfx/p_save.lmp");
M_DrawPic ( (320-p->width)/2, 4, p);
- for (i=0 ; i<MAX_SAVEGAMES ; i++)
+ for (i=0 ; i<max_savegames ; i++)
M_Print (16, 32 + 8*i, m_filenames[i]);
// line cursor
@@ -557,6 +586,34 @@ void M_Load_Key (int k)
Cbuf_AddText (va ("load s%i\n", load_cursor) );
return;
+ case K_PGDN:
+ case KP_PGDN:
+ S_LocalSound ("misc/menu1.wav");
+ load_cursor+= 10;
+ if (load_cursor >= max_savegames)
+ load_cursor -= max_savegames;
+ break;
+
+ case K_PGUP:
+ case KP_PGUP:
+ S_LocalSound ("misc/menu1.wav");
+ load_cursor-= 10;
+ if (load_cursor < 0)
+ load_cursor += max_savegames;
+ break;
+
+ case K_HOME:
+ case KP_HOME:
+ S_LocalSound ("misc/menu1.wav");
+ load_cursor = 0;
+ break;
+
+ case K_END:
+ case KP_END:
+ S_LocalSound ("misc/menu1.wav");
+ load_cursor = max_savegames-1;
+ break;
+
case KP_UPARROW:
case K_UPARROW:
case KP_LEFTARROW:
@@ -564,7 +621,7 @@ void M_Load_Key (int k)
S_LocalSound ("misc/menu1.wav");
load_cursor--;
if (load_cursor < 0)
- load_cursor = MAX_SAVEGAMES-1;
+ load_cursor = max_savegames-1;
break;
case KP_DOWNARROW:
@@ -573,7 +630,7 @@ void M_Load_Key (int k)
case K_RIGHTARROW:
S_LocalSound ("misc/menu1.wav");
load_cursor++;
- if (load_cursor >= MAX_SAVEGAMES)
+ if (load_cursor >= max_savegames)
load_cursor = 0;
break;
}
@@ -595,6 +652,34 @@ void M_Save_Key (int k)
Cbuf_AddText (va("save s%i\n", load_cursor));
return;
+ case K_PGDN:
+ case KP_PGDN:
+ S_LocalSound ("misc/menu1.wav");
+ load_cursor+= 10;
+ if (load_cursor >= max_savegames)
+ load_cursor -= max_savegames;
+ break;
+
+ case K_PGUP:
+ case KP_PGUP:
+ S_LocalSound ("misc/menu1.wav");
+ load_cursor-= 10;
+ if (load_cursor < 0)
+ load_cursor += max_savegames;
+ break;
+
+ case K_HOME:
+ case KP_HOME:
+ S_LocalSound ("misc/menu1.wav");
+ load_cursor = 0;
+ break;
+
+ case K_END:
+ case KP_END:
+ S_LocalSound ("misc/menu1.wav");
+ load_cursor = max_savegames-1;
+ break;
+
case KP_UPARROW:
case K_UPARROW:
case KP_LEFTARROW:
@@ -602,7 +687,7 @@ void M_Save_Key (int k)
S_LocalSound ("misc/menu1.wav");
load_cursor--;
if (load_cursor < 0)
- load_cursor = MAX_SAVEGAMES-1;
+ load_cursor = max_savegames-1;
break;
case KP_DOWNARROW:
@@ -611,7 +696,7 @@ void M_Save_Key (int k)
case K_RIGHTARROW:
S_LocalSound ("misc/menu1.wav");
load_cursor++;
- if (load_cursor >= MAX_SAVEGAMES)
+ if (load_cursor >= max_savegames)
load_cursor = 0;
break;
}