|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* $Id: menu.c,v 1.7 2003/05/06 20:48:54 stpohle Exp $ */
|
|
|
|
|
/* $Id: menu.c,v 1.8 2003/05/06 21:45:08 stpohle Exp $ */
|
|
|
|
|
/* menu's for the game */
|
|
|
|
|
|
|
|
|
|
#include <SDL.h>
|
|
|
|
@ -356,72 +356,4 @@ menu_displaymessage (char *title, char *text)
|
|
|
|
|
#define DIRSCRMAX 10
|
|
|
|
|
static char menu_selectedfile[LEN_PATHFILENAME];
|
|
|
|
|
|
|
|
|
|
/* draws the selection on the screen..
|
|
|
|
|
dirstart - first entry do display
|
|
|
|
|
flags - flags what should be shown directorys or files
|
|
|
|
|
selected - Selected file in the list
|
|
|
|
|
*/
|
|
|
|
|
int menu_dir_draw (_direntry *dirstart, signed char dirflags, _direntry *select) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *menu_dir_select (char *path, signed char dirflags) {
|
|
|
|
|
_direntry *destart, *de;
|
|
|
|
|
int max = 0, sel = -1, done = 0;
|
|
|
|
|
|
|
|
|
|
/* get the directory list and count the numbers */
|
|
|
|
|
destart = s_getdir (path);
|
|
|
|
|
for (max = 0, de = destart; de != NULL; de = de->next)
|
|
|
|
|
if (de->name[0] != '.' && (de->flags & dirflags) != 0)
|
|
|
|
|
max++;
|
|
|
|
|
if (max <= 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
while (done == 0 || (done == 1 && keypressed == 1)) {
|
|
|
|
|
|
|
|
|
|
/* do the network loop if we have to */
|
|
|
|
|
if (bman.gametype == GT_multi && bman.sock != -1)
|
|
|
|
|
network_loop ();
|
|
|
|
|
|
|
|
|
|
if (SDL_PollEvent (&event) != 0)
|
|
|
|
|
switch (event.type) {
|
|
|
|
|
case (SDL_QUIT):
|
|
|
|
|
menuselect = -1;
|
|
|
|
|
bman.state = GS_quit;
|
|
|
|
|
done = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* keyboard handling */
|
|
|
|
|
keys = SDL_GetKeyState (NULL);
|
|
|
|
|
if (keys[SDLK_DOWN] && event.type == SDL_KEYDOWN && keypressed == 0) {
|
|
|
|
|
keypressed = 1;
|
|
|
|
|
menuselect++;
|
|
|
|
|
if (menuselect >= lastentry)
|
|
|
|
|
menuselect = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (keys[SDLK_UP] && event.type == SDL_KEYDOWN && keypressed == 0) {
|
|
|
|
|
keypressed = 1;
|
|
|
|
|
menuselect--;
|
|
|
|
|
if (menuselect < 0)
|
|
|
|
|
menuselect = lastentry - 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (keys[SDLK_ESCAPE] && event.type == SDL_KEYDOWN) {
|
|
|
|
|
keypressed = 1;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (!keys[SDLK_ESCAPE] && event.type == SDL_KEYUP)
|
|
|
|
|
keypressed = 0;
|
|
|
|
|
|
|
|
|
|
if (keys[SDLK_RETURN] && event.type == SDL_KEYDOWN) {
|
|
|
|
|
done = 1;
|
|
|
|
|
keypressed = 1;
|
|
|
|
|
}
|
|
|
|
|
if (!keys[SDLK_RETURN] && event.type == SDL_KEYUP)
|
|
|
|
|
keypressed = 0;
|
|
|
|
|
|
|
|
|
|
s_delay (100);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
#undef DIRSCRMAX
|
|
|
|
|