From 94b124e87edbd2e12d7b83f45254fcbfff8554cd Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 3 Dec 2000 22:06:26 +0100 Subject: [PATCH] rnd-20001203-4-src --- src/files.c | 81 ----------------------- src/files.h | 6 -- src/init.c | 25 ++++--- src/init.h | 2 +- src/libgame/gadgets.c | 5 +- src/libgame/libgame.c | 31 +++++++++ src/libgame/libgame.h | 87 ++++++++++++++++++++++++ src/libgame/misc.c | 149 +++++++++++++++++++++++++++++------------- src/libgame/misc.h | 12 +++- src/libgame/msdos.h | 2 +- src/libgame/system.c | 72 +++++++++++++++----- src/libgame/system.h | 23 +++++-- src/libgame/x11.c | 2 +- src/main.c | 16 ++++- src/main.h | 38 +++-------- src/tools.c | 31 +++++++++ src/tools.h | 3 + 17 files changed, 377 insertions(+), 208 deletions(-) diff --git a/src/files.c b/src/files.c index f8bbea80..2c0117dd 100644 --- a/src/files.c +++ b/src/files.c @@ -47,7 +47,6 @@ /* 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" @@ -56,7 +55,6 @@ #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" @@ -66,10 +64,6 @@ #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 @@ -95,7 +89,6 @@ #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 @@ -211,21 +204,6 @@ char *getLevelClassDescription(struct LevelDirInfo *ldi) 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(); @@ -345,22 +323,6 @@ static char *getScoreFilename(int nr) 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"); @@ -2216,46 +2178,3 @@ void SaveLevelSetup_SeriesInfo() 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 diff --git a/src/files.h b/src/files.h index e920328e..994a503e 100644 --- a/src/files.h +++ b/src/files.h @@ -33,10 +33,4 @@ void SaveLevelSetup_LastSeries(void); void LoadLevelSetup_SeriesInfo(void); void SaveLevelSetup_SeriesInfo(void); -#if !defined(PLATFORM_UNIX) -void initErrorFile(); -FILE *openErrorFile(); -void dumpErrorFile(); -#endif - #endif /* FILES_H */ diff --git a/src/init.c b/src/init.c index 241849ce..8f30094d 100644 --- a/src/init.c +++ b/src/init.c @@ -45,7 +45,7 @@ static void LoadGfx(int, struct PictureFileInfo *); static void InitGadgets(void); static void InitElementProperties(void); -void OpenAll(int argc, char *argv[]) +void OpenAll(void) { #if !defined(PLATFORM_UNIX) initErrorFile(); @@ -63,6 +63,11 @@ void OpenAll(int argc, char *argv[]) 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(); @@ -310,17 +315,6 @@ void InitJoysticks() 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); @@ -420,8 +414,12 @@ void InitGfx() }; #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); @@ -429,7 +427,6 @@ void InitGfx() 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); diff --git a/src/init.h b/src/init.h index b8bc9b0b..71407836 100644 --- a/src/init.h +++ b/src/init.h @@ -16,7 +16,7 @@ #include "main.h" -void OpenAll(int, char **); +void OpenAll(void); void CloseAllAndExit(int); void InitJoysticks(void); diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index aeb5ec9c..bace632b 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -12,13 +12,10 @@ ***********************************************************/ #include +#include #include "libgame.h" -#if 0 -#include "main_TMP.h" -#endif - #include "gadgets.h" diff --git a/src/libgame/libgame.c b/src/libgame/libgame.c index 8c000c20..00d7c13e 100644 --- a/src/libgame/libgame.c +++ b/src/libgame/libgame.c @@ -12,3 +12,34 @@ ***********************************************************/ #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; diff --git a/src/libgame/libgame.h b/src/libgame/libgame.h index fd613b9c..e8956034 100644 --- a/src/libgame/libgame.h +++ b/src/libgame/libgame.h @@ -27,6 +27,33 @@ #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 @@ -46,4 +73,64 @@ #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 */ diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 771918ea..b2ee4717 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -14,8 +14,11 @@ #include #include #include +#include #include #include +#include +#include #include "platform.h" @@ -26,8 +29,6 @@ #include "libgame.h" -#include "main_TMP.h" - #include "misc.h" #if 0 @@ -417,37 +418,6 @@ char *getStringToLower(char *s) 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 #include +#include "allegro.h" /* symbol 'window' is defined in DJGPP cross-compiler in libc.a(conio.o) */ #define window window_djgpp diff --git a/src/libgame/system.c b/src/libgame/system.c index 471c614f..0304be81 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -12,9 +12,17 @@ * system.c * ***********************************************************/ -#include "libgame.h" +#include + +#include "platform.h" +#if defined(PLATFORM_MSDOS) +#include +#endif +#include "libgame.h" + +#if 0 /* ========================================================================= */ /* exported variables */ /* ========================================================================= */ @@ -42,18 +50,48 @@ int redraw_tiles = 0; 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; @@ -62,9 +100,9 @@ inline void InitProgramInfo(char *command_name, char *program_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; @@ -76,7 +114,7 @@ inline void InitGfxFieldInfo(int sx, int sy, int sxsize, int sysize, 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; @@ -84,7 +122,7 @@ inline void InitGfxDoor1Info(int dx, int dy, int dxsize, int dysize) 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; @@ -92,14 +130,18 @@ inline void InitGfxDoor2Info(int vx, int vy, int vxsize, int vysize) 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); diff --git a/src/libgame/system.h b/src/libgame/system.h index a16fb4c5..9899f728 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -82,13 +82,17 @@ typedef int (*EventFilter)(const Event *); 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 @@ -139,6 +143,7 @@ struct GfxInfo }; +#if 0 /* ========================================================================= */ /* exported variables */ /* ========================================================================= */ @@ -166,16 +171,20 @@ extern int redraw_tiles; 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); diff --git a/src/libgame/x11.c b/src/libgame/x11.c index 4ac4f4fd..fef8bcf9 100644 --- a/src/libgame/x11.c +++ b/src/libgame/x11.c @@ -185,7 +185,7 @@ static DrawWindow X11InitWindow() 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, diff --git a/src/main.c b/src/main.c index c31ace49..40a19333 100644 --- a/src/main.c +++ b/src/main.c @@ -19,9 +19,11 @@ #include "events.h" #include "joystick.h" +#if 0 #if defined(PLATFORM_MSDOS) #include #endif +#endif #if 0 DrawWindow window = None; @@ -65,7 +67,9 @@ char *joystick_device_name[MAX_PLAYERS] = DEV_JOYSTICK_3 }; +#if 0 char *program_name = NULL; +#endif int game_status = MAINMENU; boolean level_editor_test_game = FALSE; @@ -132,7 +136,9 @@ int TimeFrames, TimePlayed, TimeLeft; 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]; @@ -988,15 +994,23 @@ void TEST_SDL_JOYSTICK() 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 diff --git a/src/main.h b/src/main.h index fc70fcc9..b41c3829 100644 --- a/src/main.h +++ b/src/main.h @@ -368,35 +368,6 @@ struct LevelInfo 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; @@ -474,7 +445,9 @@ extern char *sound_device_name; 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; @@ -541,7 +514,9 @@ extern int SiebCount; 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[]; @@ -1671,6 +1646,7 @@ extern int num_element_info; #define SETUPINPUT 9 #define CALIBRATION 10 +#if 0 #ifndef RO_GAME_DIR #define RO_GAME_DIR "." #endif @@ -1687,6 +1663,7 @@ extern int num_element_info; #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" @@ -1697,11 +1674,13 @@ extern int num_element_info; #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" @@ -1710,6 +1689,7 @@ extern int num_element_info; /* default name for new levels */ #define NAMELESS_LEVEL_NAME "nameless level" +#endif #if 0 /* values for button_status */ diff --git a/src/tools.c b/src/tools.c index 521328f6..13512839 100644 --- a/src/tools.c +++ b/src/tools.c @@ -494,6 +494,37 @@ void DrawTextExt(DrawBuffer d, GC gc, int x, int y, #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