rnd-19990314-2-src
authorHolger Schemel <info@artsoft.org>
Sun, 14 Mar 1999 20:48:10 +0000 (21:48 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:33:55 +0000 (10:33 +0200)
src/Makefile
src/files.c
src/game.c
src/init.c
src/joystick.c
src/main.c
src/main.h
src/misc.c
src/msdos.c
src/sound.c

index 4c0a427baea5f9e3ab285213d2227e6449084447..fb7dd26ac40e84ae95e8ce7ea723e86f58d29090 100644 (file)
@@ -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)
 
index 34c53f77c97c76deb60b5cf7c1cfc0b993dc8d17..a7238908437ca22db1bd06af9266af1ce6b4e600 100644 (file)
 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)
index 1fbb21a5cef1115e2672f62d0f3dd47f907f9da4..48482c90e6f63224a69ad8c888811f974a00aa82 100644 (file)
@@ -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:
index 4f18c12a2e613f62bd5a69fd26d7eaf4b7cdf639..dcd822443f976931102c8c6d8c6ef5af084207b4 100644 (file)
@@ -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 */
index 3982e0a1f74c05d219fc562981c712e43f33ef62..3aeb8e9d6163bc6b7dd3ae72e75d3d9c74a06185 100644 (file)
@@ -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
index d75089179f82b15f0217cd4269e917fb4f37afe7..e18599dfd383ca4f1e93fdaa11a761704b3456fb 100644 (file)
@@ -177,7 +177,8 @@ char *sound_name[NUM_SOUNDS] =
   "boom",
   "booom",
   "exit",
-  "empty"
+  "empty",
+  "gate"
 };
 
 /* background music */
index 726e58ac7444fc30e49ccffb2b94baccb22806dc..a625102cc706ac76f1b88198b4b14af8dd878bba 100644 (file)
@@ -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"
index 2200460af29dcdc8783c0844220ddf85e47e5f7c..7ff3a94781e0ed66ab23597f99b5a19935c9484c 100644 (file)
@@ -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)
     {
index 5090c55c1603ed779928c6373ef0538714583206..df72b8eb677c7176d2246ed3deea337c96e5173d 100644 (file)
@@ -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);
index 928a955c61dfdaadfb52de3cbac2fecd145e271a..7839902a50d21f24c7d2080035c3047cc11d6d6d 100644 (file)
@@ -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