/* file names and filename extensions */
#if !defined(PLATFORM_MSDOS)
-#define USERDATA_DIRECTORY ".rocksndiamonds"
#define LEVELSETUP_DIRECTORY "levelsetup"
#define SETUP_FILENAME "setup.conf"
#define LEVELSETUP_FILENAME "levelsetup.conf"
#define TAPEFILE_EXTENSION "tape"
#define SCOREFILE_EXTENSION "score"
#else
-#define USERDATA_DIRECTORY "userdata"
#define LEVELSETUP_DIRECTORY "lvlsetup"
#define SETUP_FILENAME "setup.cnf"
#define LEVELSETUP_FILENAME "lvlsetup.cnf"
#define SCOREFILE_EXTENSION "sco"
#endif
-#if !defined(PLATFORM_UNIX)
-#define ERROR_FILENAME "error.out"
-#endif
-
#if defined(PLATFORM_WIN32)
#ifndef S_IRGRP
#define S_IRGRP S_IRUSR
#define MODE_R_ALL (S_IRUSR | S_IRGRP | S_IROTH)
#define MODE_W_ALL (S_IWUSR | S_IWGRP | S_IWOTH)
#define MODE_X_ALL (S_IXUSR | S_IXGRP | S_IXOTH)
-#define USERDATA_DIR_MODE (MODE_R_ALL | MODE_X_ALL | S_IWUSR)
#define LEVEL_PERMS (MODE_R_ALL | MODE_W_ALL)
#define SCORE_PERMS LEVEL_PERMS
#define TAPE_PERMS LEVEL_PERMS
static void SaveUserLevelInfo(); /* for 'InitUserLevelDir()' */
static char *getSetupLine(char *, int); /* for 'SaveUserLevelInfo()' */
-char *getUserDataDir()
-{
- static char *userdata_dir = NULL;
-
- if (!userdata_dir)
- {
- char *home_dir = getHomeDir();
- char *data_dir = USERDATA_DIRECTORY;
-
- userdata_dir = getPath2(home_dir, data_dir);
- }
-
- return userdata_dir;
-}
-
static char *getSetupDir()
{
return getUserDataDir();
return filename;
}
-static void createDirectory(char *dir, char *text)
-{
- if (access(dir, F_OK) != 0)
-#if defined(PLATFORM_WIN32)
- if (mkdir(dir) != 0)
-#else
- if (mkdir(dir, USERDATA_DIR_MODE) != 0)
-#endif
- Error(ERR_WARN, "cannot create %s directory '%s'", text, dir);
-}
-
-static void InitUserDataDirectory()
-{
- createDirectory(getUserDataDir(), "user data");
-}
-
static void InitTapeDirectory(char *level_subdir)
{
createDirectory(getUserDataDir(), "user data");
chmod(filename, SETUP_PERMS);
}
-
-#if !defined(PLATFORM_UNIX)
-void initErrorFile()
-{
- char *filename;
-
- InitUserDataDirectory();
-
- filename = getPath2(getUserDataDir(), ERROR_FILENAME);
- unlink(filename);
- free(filename);
-}
-
-FILE *openErrorFile()
-{
- char *filename;
- FILE *error_file;
-
- filename = getPath2(getUserDataDir(), ERROR_FILENAME);
- error_file = fopen(filename, "a");
- free(filename);
-
- return error_file;
-}
-
-void dumpErrorFile()
-{
- char *filename;
- FILE *error_file;
-
- filename = getPath2(getUserDataDir(), ERROR_FILENAME);
- error_file = fopen(filename, "r");
- free(filename);
-
- if (error_file != NULL)
- {
- while (!feof(error_file))
- fputc(fgetc(error_file), stderr);
-
- fclose(error_file);
- }
-}
-#endif
void LoadLevelSetup_SeriesInfo(void);
void SaveLevelSetup_SeriesInfo(void);
-#if !defined(PLATFORM_UNIX)
-void initErrorFile();
-FILE *openErrorFile();
-void dumpErrorFile();
-#endif
-
#endif /* FILES_H */
static void InitGadgets(void);
static void InitElementProperties(void);
-void OpenAll(int argc, char *argv[])
+void OpenAll(void)
{
#if !defined(PLATFORM_UNIX)
initErrorFile();
exit(0);
}
+ InitProgramInfo(UNIX_USERDATA_DIRECTORY,
+ PROGRAM_TITLE_STRING, WINDOW_TITLE_STRING,
+ ICON_TITLE_STRING, X11_ICON_FILENAME, X11_ICONMASK_FILENAME,
+ MSDOS_POINTER_FILENAME);
+
InitPlayerInfo();
InitCounter();
void InitDisplay()
{
- char *gfx_dir = getPath2(options.ro_base_directory, GRAPHICS_DIRECTORY);
- char *x11_icon_filename = getPath2(gfx_dir, X11_ICON_FILENAME);
- char *x11_iconmask_filename = getPath2(gfx_dir, X11_ICONMASK_FILENAME);
- char *msdos_pointer_filename = getPath2(gfx_dir, MSDOS_POINTER_FILENAME);
-
- free(gfx_dir);
-
- InitProgramInfo(program_name, PROGRAM_TITLE_STRING, WINDOW_TITLE_STRING,
- ICON_TITLE_STRING, x11_icon_filename, x11_iconmask_filename,
- msdos_pointer_filename);
-
InitVideoDisplay();
InitVideoBuffer(&backbuffer, &window, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH,
setup.fullscreen);
};
#endif
- /* initialize screen properties */
+ /* initialize some global variables */
+ global.frames_per_second = 0;
+ global.fps_slowdown = FALSE;
+ global.fps_slowdown_factor = 1;
+ /* initialize screen properties */
InitGfxFieldInfo(SX, SY, SXSIZE, SYSIZE,
REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE);
InitGfxScrollbufferInfo(FXSIZE, FYSIZE);
/* create additional image buffers for double-buffering */
-
pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
#include "main.h"
-void OpenAll(int, char **);
+void OpenAll(void);
void CloseAllAndExit(int);
void InitJoysticks(void);
***********************************************************/
#include <stdarg.h>
+#include <string.h>
#include "libgame.h"
-#if 0
-#include "main_TMP.h"
-#endif
-
#include "gadgets.h"
***********************************************************/
#include "libgame.h"
+
+
+/* ========================================================================= */
+/* exported variables */
+/* ========================================================================= */
+
+struct ProgramInfo program;
+struct OptionInfo options;
+struct VideoSystemInfo video;
+struct AudioSystemInfo audio;
+struct GfxInfo gfx;
+
+struct LevelDirInfo *leveldir_first = NULL;
+struct LevelDirInfo *leveldir_current = NULL;
+
+Display *display = NULL;
+Visual *visual = NULL;
+int screen = 0;
+Colormap cmap = None;
+
+DrawWindow window = NULL;
+DrawBuffer backbuffer = NULL;
+DrawBuffer drawto = NULL;
+
+int button_status = MB_NOT_PRESSED;
+boolean motion_status = FALSE;
+
+int redraw_mask = REDRAW_NONE;
+int redraw_tiles = 0;
+
+int FrameCounter = 0;
#include "misc.h"
+/* default name for empty highscore entry */
+#define EMPTY_PLAYER_NAME "no name"
+
+/* default name for unknown player names */
+#define ANONYMOUS_NAME "anonymous"
+
+/* default name for new levels */
+#define NAMELESS_LEVEL_NAME "nameless level"
+
+/* definitions for game sub-directories */
+#ifndef RO_GAME_DIR
+#define RO_GAME_DIR "."
+#endif
+
+#ifndef RW_GAME_DIR
+#define RW_GAME_DIR "."
+#endif
+
+#define RO_BASE_PATH RO_GAME_DIR
+#define RW_BASE_PATH RW_GAME_DIR
+
+#define GRAPHICS_DIRECTORY "graphics"
+#define SOUNDS_DIRECTORY "sounds"
+#define LEVELS_DIRECTORY "levels"
+#define TAPES_DIRECTORY "tapes"
+#define SCORES_DIRECTORY "scores"
+
/* areas in bitmap PIX_DOOR */
/* meaning in PIX_DB_DOOR: (3 PAGEs)
PAGEX1: 1. buffer for DOOR_1
#define DOOR_GFX_PAGEY1 (0)
#define DOOR_GFX_PAGEY2 (gfx.dysize)
+struct LevelDirInfo
+{
+ char *filename; /* level series single directory name */
+ char *fullpath; /* complete path relative to level directory */
+ char *basepath; /* absolute base path of level directory */
+ char *name; /* level series name, as displayed on main screen */
+ char *name_short; /* optional short name for level selection screen */
+ char *name_sorting; /* optional sorting name for correct level sorting */
+ char *author; /* level series author name levels without author */
+ char *imported_from; /* optional comment for imported level series */
+ int levels; /* number of levels in level series */
+ int first_level; /* first level number (to allow start with 0 or 1) */
+ int last_level; /* last level number (automatically calculated) */
+ int sort_priority; /* sort levels by 'sort_priority' and then by name */
+ boolean level_group; /* directory contains more level series directories */
+ boolean parent_link; /* entry links back to parent directory */
+ boolean user_defined; /* user defined levels are stored in home directory */
+ boolean readonly; /* readonly levels can not be changed with editor */
+ int color; /* color to use on selection screen for this level */
+ char *class_desc; /* description of level series class */
+ int handicap_level; /* number of the lowest unsolved level */
+ int cl_first; /* internal control field for "choose level" screen */
+ int cl_cursor; /* internal control field for "choose level" screen */
+
+ struct LevelDirInfo *node_parent; /* parent level directory info */
+ struct LevelDirInfo *node_group; /* level group sub-directory info */
+ struct LevelDirInfo *next; /* next level series structure node */
+};
+
+
+/* ========================================================================= */
+/* exported variables */
+/* ========================================================================= */
+
+extern struct ProgramInfo program;
+extern struct OptionInfo options;
+extern struct VideoSystemInfo video;
+extern struct AudioSystemInfo audio;
+extern struct GfxInfo gfx;
+
+extern struct LevelDirInfo *leveldir_first;
+extern struct LevelDirInfo *leveldir_current;
+
+extern Display *display;
+extern Visual *visual;
+extern int screen;
+extern Colormap cmap;
+
+extern DrawWindow window;
+extern DrawBuffer backbuffer;
+extern DrawBuffer drawto;
+
+extern int button_status;
+extern boolean motion_status;
+
+extern int redraw_mask;
+extern int redraw_tiles;
+
+extern int FrameCounter;
+
#endif /* LIBGAME_H */
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <stdarg.h>
#include <ctype.h>
+#include <string.h>
+#include <unistd.h>
#include "platform.h"
#include "libgame.h"
-#include "main_TMP.h"
-
#include "misc.h"
#if 0
return s_copy;
}
-void MarkTileDirty(int x, int y)
-{
- int xx = redraw_x1 + x;
- int yy = redraw_y1 + y;
-
- if (!redraw[xx][yy])
- redraw_tiles++;
-
- redraw[xx][yy] = TRUE;
- redraw_mask |= REDRAW_TILES;
-}
-
-void SetBorderElement()
-{
- int x, y;
-
- BorderElement = EL_LEERRAUM;
-
- for(y=0; y<lev_fieldy && BorderElement == EL_LEERRAUM; y++)
- {
- for(x=0; x<lev_fieldx; x++)
- {
- if (!IS_MASSIVE(Feld[x][y]))
- BorderElement = EL_BETON;
-
- if (y != 0 && y != lev_fieldy - 1 && x != lev_fieldx - 1)
- x = lev_fieldx - 2;
- }
- }
-}
-
void GetOptions(char *argv[])
{
char **options_left = &argv[1];
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)
{
char option_str[MAX_OPTION_LEN];
" -s, --serveronly only start network server\n"
" -n, --network network multiplayer game\n"
" -v, --verbose verbose mode\n",
- program_name);
+ program.command_basename);
exit(0);
}
else if (strncmp(option, "-display", option_len) == 0)
if ((error = openErrorFile()) == NULL)
{
printf("Cannot write to error output file!\n");
- CloseAllAndExit(1);
+ program.exit_function(1);
}
#endif
{
va_list ap;
- fprintf(error, "%s%s: ", program_name, process_name);
+ fprintf(error, "%s%s: ", program.command_basename, process_name);
if (mode & ERR_WARN)
fprintf(error, "warning: ");
if (mode & ERR_HELP)
fprintf(error, "%s: Try option '--help' for more information.\n",
- program_name);
+ program.command_basename);
if (mode & ERR_EXIT)
- fprintf(error, "%s%s: aborting\n", program_name, process_name);
+ fprintf(error, "%s%s: aborting\n", program.command_basename, process_name);
if (error != stderr)
fclose(error);
if (mode & ERR_FROM_SERVER)
exit(1); /* child process: normal exit */
else
- CloseAllAndExit(1); /* main process: clean up stuff */
+ program.exit_function(1); /* main process: clean up stuff */
}
}
}
-/* ------------------------------------------------------------------------- */
+/* ========================================================================= */
+/* some stuff from "files.c" */
+/* ========================================================================= */
+
+#define MODE_R_ALL (S_IRUSR | S_IRGRP | S_IROTH)
+#define MODE_W_ALL (S_IWUSR | S_IWGRP | S_IWOTH)
+#define MODE_X_ALL (S_IXUSR | S_IXGRP | S_IXOTH)
+#define USERDATA_DIR_MODE (MODE_R_ALL | MODE_X_ALL | S_IWUSR)
+
+char *getUserDataDir(void)
+{
+ static char *userdata_dir = NULL;
+
+ if (!userdata_dir)
+ {
+ char *home_dir = getHomeDir();
+ char *data_dir = program.userdata_directory;
+
+ userdata_dir = getPath2(home_dir, data_dir);
+ }
+
+ return userdata_dir;
+}
+
+void createDirectory(char *dir, char *text)
+{
+ if (access(dir, F_OK) != 0)
+#if defined(PLATFORM_WIN32)
+ if (mkdir(dir) != 0)
+#else
+ if (mkdir(dir, USERDATA_DIR_MODE) != 0)
+#endif
+ Error(ERR_WARN, "cannot create %s directory '%s'", text, dir);
+}
+
+void InitUserDataDirectory()
+{
+ createDirectory(getUserDataDir(), "user data");
+}
+
+
+/* ========================================================================= */
+/* functions only needed for non-Unix (non-command-line) systems */
+/* ========================================================================= */
+
+#if !defined(PLATFORM_UNIX)
+
+#define ERROR_FILENAME "error.out"
+
+void initErrorFile()
+{
+ char *filename;
+
+ InitUserDataDirectory();
+
+ filename = getPath2(getUserDataDir(), ERROR_FILENAME);
+ unlink(filename);
+ free(filename);
+}
+
+FILE *openErrorFile()
+{
+ char *filename;
+ FILE *error_file;
+
+ filename = getPath2(getUserDataDir(), ERROR_FILENAME);
+ error_file = fopen(filename, "a");
+ free(filename);
+
+ return error_file;
+}
+
+void dumpErrorFile()
+{
+ char *filename;
+ FILE *error_file;
+
+ filename = getPath2(getUserDataDir(), ERROR_FILENAME);
+ error_file = fopen(filename, "r");
+ free(filename);
+
+ if (error_file != NULL)
+ {
+ while (!feof(error_file))
+ fputc(fgetc(error_file), stderr);
+
+ fclose(error_file);
+ }
+}
+#endif
+
+
+/* ========================================================================= */
/* the following is only for debugging purpose and normally not used */
-/* ------------------------------------------------------------------------- */
+/* ========================================================================= */
#define DEBUG_NUM_TIMESTAMPS 3
char *getPath3(char *, char *, char*);
char *getStringCopy(char *);
char *getStringToLower(char *);
-void MarkTileDirty(int, int);
-void SetBorderElement();
void GetOptions(char **);
void Error(int, char *, ...);
void *checked_malloc(unsigned long);
inline void swap_numbers(int *, int *);
inline void swap_number_pairs(int *, int *, int *, int *);
+char *getUserDataDir(void);
+void createDirectory(char *, char *);
+void InitUserDataDirectory(void);
+
+#if !defined(PLATFORM_UNIX)
+void initErrorFile();
+FILE *openErrorFile();
+void dumpErrorFile();
+#endif
+
void debug_print_timestamp(int, char *);
#endif /* MISC_H */
#ifndef MSDOS_H
#define MSDOS_H
-#include <allegro.h>
#include <time.h>
+#include "allegro.h"
/* symbol 'window' is defined in DJGPP cross-compiler in libc.a(conio.o) */
#define window window_djgpp
* system.c *
***********************************************************/
-#include "libgame.h"
+#include <string.h>
+
+#include "platform.h"
+#if defined(PLATFORM_MSDOS)
+#include <fcntl.h>
+#endif
+#include "libgame.h"
+
+#if 0
/* ========================================================================= */
/* exported variables */
/* ========================================================================= */
int FrameCounter = 0;
+#endif
/* ========================================================================= */
-/* video functions */
+/* init functions */
/* ========================================================================= */
-inline void InitProgramInfo(char *command_name, char *program_title,
- char *window_title, char *icon_title,
- char *x11_icon_filename,
- char *x11_iconmask_filename,
- char *msdos_pointer_filename)
+void InitCommandName(char *argv0)
+{
+ program.command_basename =
+ (strrchr(argv0, '/') ? strrchr(argv0, '/') + 1 : argv0);
+}
+
+void InitExitFunction(void (*exit_function)(int))
+{
+ program.exit_function = exit_function;
+}
+
+void InitPlatformDependantStuff(void)
{
- program.command_name = command_name;
+#if defined(PLATFORM_MSDOS)
+ _fmode = O_BINARY;
+#endif
+}
+
+void InitProgramInfo(char *unix_userdata_directory, char *program_title,
+ char *window_title, char *icon_title,
+ char *x11_icon_basename, char *x11_iconmask_basename,
+ char *msdos_pointer_basename)
+{
+ char *gfx_dir = getPath2(options.ro_base_directory, GRAPHICS_DIRECTORY);
+ char *x11_icon_filename = getPath2(gfx_dir, x11_icon_basename);
+ char *x11_iconmask_filename = getPath2(gfx_dir, x11_iconmask_basename);
+ char *msdos_pointer_filename = getPath2(gfx_dir, msdos_pointer_basename);
+
+ free(gfx_dir);
+
+#if defined(PLATFORM_UNIX)
+ program.userdata_directory = unix_userdata_directory;
+#else
+ program.userdata_directory = "userdata";
+#endif
+
program.program_title = program_title;
program.window_title = window_title;
program.icon_title = icon_title;
program.msdos_pointer_filename = msdos_pointer_filename;
}
-inline void InitGfxFieldInfo(int sx, int sy, int sxsize, int sysize,
- int real_sx, int real_sy,
- int full_sxsize, int full_sysize)
+void InitGfxFieldInfo(int sx, int sy, int sxsize, int sysize,
+ int real_sx, int real_sy,
+ int full_sxsize, int full_sysize)
{
gfx.sx = sx;
gfx.sy = sy;
gfx.full_sysize = full_sysize;
}
-inline void InitGfxDoor1Info(int dx, int dy, int dxsize, int dysize)
+void InitGfxDoor1Info(int dx, int dy, int dxsize, int dysize)
{
gfx.dx = dx;
gfx.dy = dy;
gfx.dysize = dysize;
}
-inline void InitGfxDoor2Info(int vx, int vy, int vxsize, int vysize)
+void InitGfxDoor2Info(int vx, int vy, int vxsize, int vysize)
{
gfx.vx = vx;
gfx.vy = vy;
gfx.vysize = vysize;
}
-inline void InitGfxScrollbufferInfo(int scrollbuffer_width,
- int scrollbuffer_height)
+void InitGfxScrollbufferInfo(int scrollbuffer_width, int scrollbuffer_height)
{
/* currently only used by MSDOS code to alloc VRAM buffer, if available */
gfx.scrollbuffer_width = scrollbuffer_width;
gfx.scrollbuffer_height = scrollbuffer_height;
}
+
+/* ========================================================================= */
+/* video functions */
+/* ========================================================================= */
+
inline static int GetRealDepth(int depth)
{
return (depth == DEFAULT_DEPTH ? video.default_depth : depth);
struct ProgramInfo
{
- char *command_name;
+ char *command_basename;
+ char *userdata_directory;
+
char *program_title;
char *window_title;
char *icon_title;
char *x11_icon_filename;
char *x11_iconmask_filename;
char *msdos_pointer_filename;
+
+ void (*exit_function)(int);
};
struct OptionInfo
};
+#if 0
/* ========================================================================= */
/* exported variables */
/* ========================================================================= */
extern int FrameCounter;
+#endif
/* function definitions */
-inline void InitProgramInfo(char *, char *, char *, char *, char *, char *,
- char *);
+void InitCommandName(char *);
+void InitExitFunction(void (*exit_function)(int));
+void InitPlatformDependantStuff(void);
+
+void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *);
-inline void InitGfxFieldInfo(int, int, int, int, int, int, int, int);
-inline void InitGfxDoor1Info(int, int, int, int);
-inline void InitGfxDoor2Info(int, int, int, int);
-inline void InitGfxScrollbufferInfo(int, int);
+void InitGfxFieldInfo(int, int, int, int, int, int, int, int);
+void InitGfxDoor1Info(int, int, int, int);
+void InitGfxDoor2Info(int, int, int, int);
+void InitGfxScrollbufferInfo(int, int);
inline void InitVideoDisplay(void);
inline void InitVideoBuffer(DrawBuffer *,DrawWindow *, int, int, int, boolean);
wm_hints.icon_mask = iconmask_pixmap;
wm_hints.flags = StateHint | IconPixmapHint | IconMaskHint | InputHint;
- class_hints.res_name = program.command_name;
+ class_hints.res_name = program.command_basename;
class_hints.res_class = program.program_title;
XSetWMProperties(display, new_window->drawable, &windowName, &iconName,
#include "events.h"
#include "joystick.h"
+#if 0
#if defined(PLATFORM_MSDOS)
#include <fcntl.h>
#endif
+#endif
#if 0
DrawWindow window = None;
DEV_JOYSTICK_3
};
+#if 0
char *program_name = NULL;
+#endif
int game_status = MAINMENU;
boolean level_editor_test_game = FALSE;
boolean network_player_action_received = FALSE;
+#if 0
struct LevelDirInfo *leveldir_first = NULL, *leveldir_current = NULL;
+#endif
struct LevelInfo level;
struct PlayerInfo stored_player[MAX_PLAYERS], *local_player = NULL;
struct HiScore highscore[MAX_SCORE_ENTRIES];
int main(int argc, char *argv[])
{
+#if 0
program_name = (strrchr(argv[0],'/') ? strrchr(argv[0],'/') + 1 : argv[0]);
+#endif
+
+ InitCommandName(argv[0]);
+ InitExitFunction(CloseAllAndExit);
+ InitPlatformDependantStuff();
+#if 0
#if defined(PLATFORM_MSDOS)
_fmode = O_BINARY;
#endif
+#endif
#if 1
GetOptions(argv);
- OpenAll(argc,argv);
+ OpenAll();
#endif
#if 0
boolean gravity;
};
-struct LevelDirInfo
-{
- char *filename; /* level series single directory name */
- char *fullpath; /* complete path relative to level directory */
- char *basepath; /* absolute base path of level directory */
- char *name; /* level series name, as displayed on main screen */
- char *name_short; /* optional short name for level selection screen */
- char *name_sorting; /* optional sorting name for correct level sorting */
- char *author; /* level series author name levels without author */
- char *imported_from; /* optional comment for imported level series */
- int levels; /* number of levels in level series */
- int first_level; /* first level number (to allow start with 0 or 1) */
- int last_level; /* last level number (automatically calculated) */
- int sort_priority; /* sort levels by 'sort_priority' and then by name */
- boolean level_group; /* directory contains more level series directories */
- boolean parent_link; /* entry links back to parent directory */
- boolean user_defined; /* user defined levels are stored in home directory */
- boolean readonly; /* readonly levels can not be changed with editor */
- int color; /* color to use on selection screen for this level */
- char *class_desc; /* description of level series class */
- int handicap_level; /* number of the lowest unsolved level */
- int cl_first; /* internal control field for "choose level" screen */
- int cl_cursor; /* internal control field for "choose level" screen */
-
- struct LevelDirInfo *node_parent; /* parent level directory info */
- struct LevelDirInfo *node_group; /* level group sub-directory info */
- struct LevelDirInfo *next; /* next level series structure node */
-};
-
struct TapeInfo
{
int level_nr;
extern int joystick_device;
extern char *joystick_device_name[];
+#if 0
extern char *program_name;
+#endif
extern int game_status;
extern boolean level_editor_test_game;
extern boolean network_player_action_received;
+#if 0
extern struct LevelDirInfo *leveldir_first, *leveldir_current;
+#endif
extern struct LevelInfo level;
extern struct PlayerInfo stored_player[], *local_player;
extern struct HiScore highscore[];
#define SETUPINPUT 9
#define CALIBRATION 10
+#if 0
#ifndef RO_GAME_DIR
#define RO_GAME_DIR "."
#endif
#define LEVELS_DIRECTORY "levels"
#define TAPES_DIRECTORY "tapes"
#define SCORES_DIRECTORY "scores"
+#endif
#define PROGRAM_VERSION_STRING "1.5.0"
#define PROGRAM_TITLE_STRING "Rocks'n'Diamonds"
#define WINDOW_TITLE_STRING PROGRAM_TITLE_STRING " " PROGRAM_IDENT_STRING
#define WINDOW_SUBTITLE_STRING PROGRAM_RIGHTS_STRING " " PROGRAM_AUTHOR_STRING
#define ICON_TITLE_STRING PROGRAM_TITLE_STRING
+#define UNIX_USERDATA_DIRECTORY ".rocksndiamonds"
#define X11_ICON_FILENAME "rocks_icon.xbm"
#define X11_ICONMASK_FILENAME "rocks_iconmask.xbm"
#define MSDOS_POINTER_FILENAME "mouse.pcx"
+#if 0
/* default name for empty highscore entry */
#define EMPTY_PLAYER_NAME "no name"
/* default name for new levels */
#define NAMELESS_LEVEL_NAME "nameless level"
+#endif
#if 0
/* values for button_status */
#endif
+void MarkTileDirty(int x, int y)
+{
+ int xx = redraw_x1 + x;
+ int yy = redraw_y1 + y;
+
+ if (!redraw[xx][yy])
+ redraw_tiles++;
+
+ redraw[xx][yy] = TRUE;
+ redraw_mask |= REDRAW_TILES;
+}
+
+void SetBorderElement()
+{
+ int x, y;
+
+ BorderElement = EL_LEERRAUM;
+
+ for(y=0; y<lev_fieldy && BorderElement == EL_LEERRAUM; y++)
+ {
+ for(x=0; x<lev_fieldx; x++)
+ {
+ if (!IS_MASSIVE(Feld[x][y]))
+ BorderElement = EL_BETON;
+
+ if (y != 0 && y != lev_fieldy - 1 && x != lev_fieldx - 1)
+ x = lev_fieldx - 2;
+ }
+ }
+}
+
void DrawAllPlayers()
{
int i;
void DrawTextExt(DrawBuffer, GC, int, int, char *, int, int);
#endif
+void MarkTileDirty(int, int);
+void SetBorderElement();
+
void DrawAllPlayers(void);
void DrawPlayerField(int, int);
void DrawPlayer(struct PlayerInfo *);