/* maximal allowed length of a command line option */
#define MAX_OPTION_LEN 256
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
static unsigned long mainCounter(int mode)
{
return counter_ms; /* return milliseconds since last init */
}
-#else /* !USE_SDL_LIBRARY */
+#else /* !TARGET_SDL */
#ifndef MSDOS
static unsigned long mainCounter(int mode)
}
#endif /* !MSDOS */
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
void InitCounter() /* set counter back to zero */
{
}
else
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SDL_Delay(milliseconds_delay);
-#else /* !USE_SDL_LIBRARY */
+#else /* !TARGET_SDL */
struct timeval delay;
delay.tv_sec = milliseconds_delay / 1000;
if (select(0, NULL, NULL, NULL, &delay) != 0)
Error(ERR_WARN, "sleep_milliseconds(): select() failed");
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
}
}
unsigned int SimpleRND(unsigned int max)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
static unsigned long root = 654321;
unsigned long current_ms;
root = root * 4253261 + current_ms;
return (root % max);
-#else /* !USE_SDL_LIBRARY */
+#else /* !TARGET_SDL */
static unsigned long root = 654321;
struct timeval current_time;
root = root * 4253261 + current_time.tv_sec + current_time.tv_usec;
return (root % max);
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
}
#ifdef DEBUG
unsigned int InitRND(long seed)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
unsigned long current_ms;
if (seed == NEW_RANDOMIZE)
srandom_linux_libc((unsigned int) seed);
return (unsigned int) seed;
}
-#else /* !USE_SDL_LIBRARY */
+#else /* !TARGET_SDL */
struct timeval current_time;
if (seed == NEW_RANDOMIZE)
srandom_linux_libc((unsigned int) seed);
return (unsigned int) seed;
}
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
}
char *getLoginName()
options.serveronly = FALSE;
options.network = FALSE;
options.verbose = FALSE;
+ options.debug = FALSE;
+
+ /* initialize some more global variables */
+ global.frames_per_second = 0;
+ global.fps_slowdown = FALSE;
+ global.fps_slowdown_factor = 1;
while (*options_left)
{
"Options:\n"
" -d, --display machine:0 X server display\n"
" -b, --basepath directory alternative base directory\n"
- " -l, --level directory alternative level directory\n"
+ " -l, --level directory alternative level directory\n"
" -s, --serveronly only start network server\n"
" -n, --network network multiplayer game\n"
" -v, --verbose verbose mode\n",
{
options.verbose = TRUE;
}
+ else if (strncmp(option, "-debug", option_len) == 0)
+ {
+ options.debug = TRUE;
+ }
else if (*option == '-')
{
Error(ERR_EXIT_HELP, "unrecognized option '%s'", option_str);
struct LevelDirInfo *getFirstValidLevelSeries(struct LevelDirInfo *node)
{
- if (node == NULL) /* start with first level directory entry */
- return getFirstValidLevelSeries(leveldir_first);
+ if (node == NULL)
+ {
+ if (leveldir_first) /* start with first level directory entry */
+ return getFirstValidLevelSeries(leveldir_first);
+ else
+ return NULL;
+ }
else if (node->node_group) /* enter level group (step down into tree) */
return getFirstValidLevelSeries(node->node_group);
else if (node->parent_link) /* skip start entry of level group */