From 0c27626bae90cb1eeea4939de0130a49b9aac507 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 14 Mar 1999 21:48:10 +0100 Subject: [PATCH] rnd-19990314-2-src --- src/Makefile | 18 +++++++++++++++--- src/files.c | 7 +------ src/game.c | 11 +++++++++++ src/init.c | 8 ++++---- src/joystick.c | 2 +- src/main.c | 3 ++- src/main.h | 17 ++++++++++++----- src/misc.c | 11 +++++++---- src/msdos.c | 2 +- src/sound.c | 3 ++- 10 files changed, 56 insertions(+), 26 deletions(-) diff --git a/src/Makefile b/src/Makefile index 4c0a427b..fb7dd26a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -16,8 +16,11 @@ CC = gcc # specify X11 library path on your system XLIB_PATH = /usr/X11/lib -# change this to the directory where you want to install game data like levels -GAME_DIR = . +# choose directory for read-only game data (like graphics, sounds, levels) +# RO_GAME_DIR = /usr/games + +# choose directory for writable game data (like highscore files) +# RW_GAME_DIR = /var/games # uncomment this if your system has no joystick include file # JOYSTICK = -DNO_JOYSTICK @@ -62,9 +65,18 @@ endif CPP = $(CC) -E -CONFIG_GAME_DIR = -DGAME_DIR="\"$(GAME_DIR)\"" +ifdef RO_GAME_DIR +CONFIG_RO_GAME_DIR = -DRO_GAME_DIR="\"$(RO_GAME_DIR)\"" +endif + +ifdef RW_GAME_DIR +CONFIG_RW_GAME_DIR = -DRW_GAME_DIR="\"$(RW_GAME_DIR)\"" +endif + CONFIG_SCORE_ENTRIES = -D$(SCORE_ENTRIES) +CONFIG_GAME_DIR = $(CONFIG_RO_GAME_DIR) $(CONFIG_RW_GAME_DIR) + CONFIG = $(CONFIG_GAME_DIR) $(SOUNDS) $(JOYSTICK) \ $(CONFIG_SCORE_ENTRIES) $(XPM_INCLUDE_FILE) diff --git a/src/files.c b/src/files.c index 34c53f77..a7238908 100644 --- a/src/files.c +++ b/src/files.c @@ -116,11 +116,6 @@ static void SaveUserLevelInfo(); /* for 'InitUserLevelDir()' */ static char *getSetupLine(char *, int); /* for 'SaveUserLevelInfo()' */ -static char *getGlobalDataDir() -{ - return GAME_DIR; -} - char *getUserDataDir() { static char *userdata_dir = NULL; @@ -178,7 +173,7 @@ static char *getTapeDir(char *level_subdir) static char *getScoreDir(char *level_subdir) { static char *score_dir = NULL; - char *data_dir = getGlobalDataDir(); + char *data_dir = options.rw_base_directory; char *score_subdir = SCORES_DIRECTORY; if (score_dir) diff --git a/src/game.c b/src/game.c index 1fbb21a5..48482c90 100644 --- a/src/game.c +++ b/src/game.c @@ -1313,6 +1313,11 @@ void DynaExplode(int ex, int ey) break; element = Feld[x][y]; + + /* do not restart explosions of fields with active bombs */ + if (element == EL_EXPLODING && IS_ACTIVE_BOMB(Store2[x][y])) + continue; + Explode(x, y, EX_PHASE_START, EX_BORDER); if (element != EL_LEERRAUM && @@ -4579,6 +4584,8 @@ int DigField(struct PlayerInfo *player, player->programmed_action = move_direction; DOUBLE_PLAYER_SPEED(player); + PlaySoundLevel(x, y, SND_GATE); + break; case EL_EM_GATE_1X: @@ -4594,6 +4601,8 @@ int DigField(struct PlayerInfo *player, player->programmed_action = move_direction; DOUBLE_PLAYER_SPEED(player); + PlaySoundLevel(x, y, SND_GATE); + break; case EL_SP_PORT1_LEFT: @@ -4635,6 +4644,8 @@ int DigField(struct PlayerInfo *player, player->programmed_action = move_direction; DOUBLE_PLAYER_SPEED(player); + PlaySoundLevel(x, y, SND_GATE); + break; case EL_AUSGANG_ZU: diff --git a/src/init.c b/src/init.c index 4f18c12a..dcd82244 100644 --- a/src/init.c +++ b/src/init.c @@ -388,7 +388,7 @@ void InitWindow(int argc, char *argv[]) PropModePrepend, (unsigned char *) &delete_atom, 1); sprintf(icon_filename, "%s/%s/%s", - options.base_directory, GRAPHICS_DIRECTORY, + options.ro_base_directory, GRAPHICS_DIRECTORY, icon_pic.picture_filename); XReadBitmapFile(display,window,icon_filename, &icon_width,&icon_height, @@ -397,7 +397,7 @@ void InitWindow(int argc, char *argv[]) Error(ERR_EXIT, "cannot read icon bitmap file '%s'", icon_filename); sprintf(icon_filename, "%s/%s/%s", - options.base_directory, GRAPHICS_DIRECTORY, + options.ro_base_directory, GRAPHICS_DIRECTORY, icon_pic.picturemask_filename); XReadBitmapFile(display,window,icon_filename, &icon_width,&icon_height, @@ -696,7 +696,7 @@ void LoadGfx(int pos, struct PictureFileInfo *pic) sprintf(basefilename, "%s%s", pic->picture_filename, picture_ext); DrawInitText(basefilename, 150, FC_YELLOW); sprintf(filename, "%s/%s/%s", - options.base_directory, GRAPHICS_DIRECTORY, basefilename); + options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename); #ifdef MSDOS rest(100); @@ -772,7 +772,7 @@ void LoadGfx(int pos, struct PictureFileInfo *pic) sprintf(basefilename, "%s%s", pic->picture_filename, picturemask_ext); DrawInitText(basefilename, 150, FC_YELLOW); sprintf(filename, "%s/%s/%s", - options.base_directory, GRAPHICS_DIRECTORY, basefilename); + options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename); #if DEBUG_TIMING debug_print_timestamp(1, NULL); /* initialize timestamp function */ diff --git a/src/joystick.c b/src/joystick.c index 3982e0a1..3aeb8e9d 100644 --- a/src/joystick.c +++ b/src/joystick.c @@ -157,7 +157,7 @@ int Joystick(int player_nr) if (joystick_nr < 0) return 0; - /* the allegro global variable ïnum_joysticksï contains the number + /* the allegro global variable 'num_joysticks' contains the number of joysticks found at initialization under MSDOS / Windows */ #if 0 diff --git a/src/main.c b/src/main.c index d7508917..e18599df 100644 --- a/src/main.c +++ b/src/main.c @@ -177,7 +177,8 @@ char *sound_name[NUM_SOUNDS] = "boom", "booom", "exit", - "empty" + "empty", + "gate" }; /* background music */ diff --git a/src/main.h b/src/main.h index 726e58ac..a625102c 100644 --- a/src/main.h +++ b/src/main.h @@ -236,7 +236,8 @@ struct OptionInfo char *display_name; char *server_host; int server_port; - char *base_directory; + char *ro_base_directory; + char *rw_base_directory; char *level_directory; boolean serveronly; boolean network; @@ -1273,8 +1274,9 @@ extern char *element_info[]; #define SND_SP_BOOOM 58 #define SND_SP_EXIT 59 #define SND_EMPTY 60 +#define SND_GATE 61 -#define NUM_SOUNDS 61 +#define NUM_SOUNDS 62 /* default input keys */ #define KEY_UNDEFINDED XK_VoidSymbol @@ -1319,11 +1321,16 @@ extern char *element_info[]; #define SETUPINPUT 9 #define CALIBRATION 10 -#ifndef GAME_DIR -#define GAME_DIR "." +#ifndef RO_GAME_DIR +#define RO_GAME_DIR "." #endif -#define BASE_PATH GAME_DIR +#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" diff --git a/src/misc.c b/src/misc.c index 2200460a..7ff3a947 100644 --- a/src/misc.c +++ b/src/misc.c @@ -379,8 +379,9 @@ void GetOptions(char *argv[]) options.display_name = NULL; options.server_host = NULL; options.server_port = 0; - options.base_directory = BASE_PATH; - options.level_directory = BASE_PATH "/" LEVELS_DIRECTORY; + options.ro_base_directory = RO_BASE_PATH; + options.rw_base_directory = RW_BASE_PATH; + options.level_directory = RO_BASE_PATH "/" LEVELS_DIRECTORY; options.serveronly = FALSE; options.network = FALSE; options.verbose = FALSE; @@ -446,13 +447,15 @@ void GetOptions(char *argv[]) if (option_arg == NULL) Error(ERR_EXIT_HELP, "option '%s' requires an argument", option_str); - options.base_directory = option_arg; + /* this should be extended to separate options for ro and rw data */ + options.ro_base_directory = option_arg; + options.rw_base_directory = option_arg; if (option_arg == next_option) options_left++; /* adjust path for level directory accordingly */ options.level_directory = - getPath2(options.base_directory, LEVELS_DIRECTORY); + getPath2(options.ro_base_directory, LEVELS_DIRECTORY); } else if (strncmp(option, "-levels", option_len) == 0) { diff --git a/src/msdos.c b/src/msdos.c index 5090c55c..df72b8eb 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -294,7 +294,7 @@ Display *XOpenDisplay(char *display_name) BITMAP *mouse_bitmap = NULL; char *filename; - filename = getPath3(options.base_directory, GRAPHICS_DIRECTORY, + filename = getPath3(options.ro_base_directory, GRAPHICS_DIRECTORY, MOUSE_FILENAME); mouse_bitmap = Read_PCX_to_AllegroBitmap(filename); diff --git a/src/sound.c b/src/sound.c index 928a955c..7839902a 100644 --- a/src/sound.c +++ b/src/sound.c @@ -724,7 +724,8 @@ boolean LoadSound(struct SoundInfo *snd_info) #endif sprintf(filename, "%s/%s/%s.%s", - options.base_directory, SOUNDS_DIRECTORY, snd_info->name, sound_ext); + options.ro_base_directory, SOUNDS_DIRECTORY, + snd_info->name, sound_ext); #ifndef MSDOS -- 2.34.1