rnd-20020407-1-src
authorHolger Schemel <info@artsoft.org>
Sun, 7 Apr 2002 11:16:10 +0000 (13:16 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:36:51 +0000 (10:36 +0200)
16 files changed:
src/files.c
src/init.c
src/init.h
src/libgame/msdos.c
src/libgame/sdl.c
src/libgame/sdl.h
src/libgame/setup.c
src/libgame/setup.h
src/libgame/system.c
src/libgame/system.h
src/libgame/x11.c
src/libgame/x11.h
src/screens.c
src/timestamp.h
src/tools.c
src/tools.h

index e39ba56759eeabca5e2455482130a2b00cb81999..b0a6dd7fd2787dce0715b60871a66ea03e2bc053 100644 (file)
@@ -1181,9 +1181,9 @@ void SaveScore(int level_nr)
 #define SETUP_TOKEN_TIME_LIMIT         13
 #define SETUP_TOKEN_FULLSCREEN         14
 #define SETUP_TOKEN_ASK_ON_ESCAPE      15
-#define SETUP_TOKEN_GRAPHICS_DIR       16
-#define SETUP_TOKEN_SOUNDS_DIR         17
-#define SETUP_TOKEN_MUSIC_DIR          18
+#define SETUP_TOKEN_GRAPHICS_SET       16
+#define SETUP_TOKEN_SOUNDS_SET         17
+#define SETUP_TOKEN_MUSIC_SET          18
 
 #define NUM_GLOBAL_SETUP_TOKENS                19
 
@@ -1236,9 +1236,9 @@ static struct TokenInfo global_setup_tokens[] =
   { TYPE_SWITCH, &si.time_limit,       "time_limit"                    },
   { TYPE_SWITCH, &si.fullscreen,       "fullscreen"                    },
   { TYPE_SWITCH, &si.ask_on_escape,    "ask_on_escape"                 },
-  { TYPE_STRING, &si.graphics_dir,     "graphics_dir"                  },
-  { TYPE_STRING, &si.sounds_dir,       "sounds_dir"                    },
-  { TYPE_STRING, &si.music_dir,                "music_dir"                     },
+  { TYPE_STRING, &si.graphics_set,     "graphics_set"                  },
+  { TYPE_STRING, &si.sounds_set,       "sounds_set"                    },
+  { TYPE_STRING, &si.music_set,                "music_set"                     },
 };
 
 static struct TokenInfo shortcut_setup_tokens[] =
@@ -1293,9 +1293,9 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->fullscreen = FALSE;
   si->ask_on_escape = TRUE;
 
-  si->graphics_dir = getStringCopy(GRAPHICS_DIRECTORY);
-  si->sounds_dir = getStringCopy(SOUNDS_DIRECTORY);
-  si->music_dir = getStringCopy(MUSIC_DIRECTORY);
+  si->graphics_set = getStringCopy(GRAPHICS_SUBDIR);
+  si->sounds_set = getStringCopy(SOUNDS_SUBDIR);
+  si->music_set = getStringCopy(MUSIC_SUBDIR);
 
   si->shortcut.save_game = DEFAULT_KEY_SAVE_GAME;
   si->shortcut.load_game = DEFAULT_KEY_LOAD_GAME;
@@ -1422,7 +1422,7 @@ void SaveSetup()
     fprintf(file, "%s\n", getSetupLine(global_setup_tokens, "", i));
 
     /* just to make things nicer :) */
-    if (i == SETUP_TOKEN_PLAYER_NAME || i == SETUP_TOKEN_GRAPHICS_DIR - 1)
+    if (i == SETUP_TOKEN_PLAYER_NAME || i == SETUP_TOKEN_GRAPHICS_SET - 1)
       fprintf(file, "\n");
   }
 
index b45aa038385e924a91343f2c841e5c5a593f617f..3118aa35a76b2d294e2b62d3495f8860a02d96ed 100644 (file)
@@ -366,6 +366,36 @@ void InitGfxBackground()
   redraw_mask = REDRAW_ALL;
 }
 
+void ReloadCustomArtwork()
+{
+  if (artwork.graphics_set_current != artwork.gfx_current->name)
+  {
+    int i;
+
+    for(i=0; i<NUM_PICTURES; i++)
+      ReloadCustomImage(&pix[i], image_filename[i]);
+
+    InitGfxBackground();
+    SetDoorState(DOOR_OPEN_1 | DOOR_CLOSE_2);
+
+    artwork.graphics_set_current = artwork.gfx_current->name;
+  }
+
+  if (artwork.sounds_set_current != artwork.snd_current->name)
+  {
+    printf("reload sounds ...\n");
+
+    artwork.sounds_set_current = artwork.snd_current->name;
+  }
+
+  if (artwork.music_set_current != artwork.mus_current->name)
+  {
+    printf("reload music ...\n");
+
+    artwork.music_set_current = artwork.mus_current->name;
+  }
+}
+
 void InitGadgets()
 {
   CreateLevelEditorGadgets();
index f7f447c14ac318ff0a027ffbd65231f58df3e965..ec3a1eb872f95be789c1f18111fc12b7d5f24483 100644 (file)
@@ -17,6 +17,7 @@
 #include "main.h"
 
 void OpenAll(void);
+void ReloadCustomArtwork();
 void CloseAllAndExit(int);
 
 #endif
index 5ca9768d383f2cefada32a00b221b6625411c205..4c84010f90e4eb59daf90befa3f556a4fefe466a 100644 (file)
@@ -19,6 +19,7 @@
 #include "sound.h"
 #include "joystick.h"
 #include "misc.h"
+#include "setup.h"
 #include "pcx.h"
 
 #define AllegroDefaultScreen() (display->screens[display->default_screen])
@@ -302,9 +303,9 @@ Display *XOpenDisplay(char *display_name)
   Screen *screen;
   Display *display;
   BITMAP *mouse_bitmap = NULL;
+  char *mouse_filename =getCustomImageFilename(program.msdos_pointer_filename);
 
-  mouse_bitmap = Read_PCX_to_AllegroBitmap(program.msdos_pointer_filename);
-  if (mouse_bitmap == NULL)
+  if ((mouse_bitmap = Read_PCX_to_AllegroBitmap(mouse_filename)) == NULL)
     return NULL;
 
   screen = malloc(sizeof(Screen));
index c4e15425714a15688d48be46db37e1762cb58a96..ef68a08e90f408b2658ce2df76c18bed010563ba 100644 (file)
@@ -853,6 +853,9 @@ Bitmap *SDLLoadImage(char *filename)
   /* free temporary surface */
   SDL_FreeSurface(sdl_image_tmp);
 
+  new_bitmap->width = new_bitmap->surface->w;
+  new_bitmap->height = new_bitmap->surface->h;
+
   return new_bitmap;
 }
 
index 543e90ab89965ab304b6a94796810bffbf7d42c2..8507398631f02979dba99b5d85642f24e35b34e6 100644 (file)
@@ -61,6 +61,7 @@ typedef int                   Colormap;
 struct SDLSurfaceInfo
 {
   char *source_filename;
+  int width, height;
   SDL_Surface *surface;
   SDL_Surface *surface_masked;
   GC gc;
index 0f0221aa56caafefb11de21ca000b6e54499b5d7..a5e2e0617aff9c4fbb386d87795f0f90a9715726 100644 (file)
@@ -375,7 +375,7 @@ char *getCustomImageFilename(char *basename)
     return filename;
 
   /* 4th try: look for default artwork in new default artwork directory */
-  filename = getPath2(getDefaultGraphicsDir("gfx_classic"), basename);
+  filename = getPath2(getDefaultGraphicsDir(GRAPHICS_SUBDIR), basename);
   if (fileExists(filename))
     return filename;
 
@@ -499,23 +499,23 @@ boolean validLevelSeries(TreeInfo *node)
   return (node != NULL && !node->node_group && !node->parent_link);
 }
 
-TreeInfo *getFirstValidLevelSeries(TreeInfo *node)
+TreeInfo *getFirstValidTreeInfoEntry(TreeInfo *node)
 {
   if (node == NULL)
   {
-    if (leveldir_first)                /* start with first level directory entry */
-      return getFirstValidLevelSeries(leveldir_first);
+    if (node->node_top)                /* start with first tree entry */
+      return getFirstValidTreeInfoEntry(*node->node_top);
     else
       return NULL;
   }
   else if (node->node_group)   /* enter level group (step down into tree) */
-    return getFirstValidLevelSeries(node->node_group);
+    return getFirstValidTreeInfoEntry(node->node_group);
   else if (node->parent_link)  /* skip start entry of level group */
   {
     if (node->next)            /* get first real level series entry */
-      return getFirstValidLevelSeries(node->next);
+      return getFirstValidTreeInfoEntry(node->next);
     else                       /* leave empty level group and go on */
-      return getFirstValidLevelSeries(node->node_parent->next);
+      return getFirstValidTreeInfoEntry(node->node_parent->next);
   }
   else                         /* this seems to be a regular level series */
     return node;
@@ -1478,7 +1478,8 @@ void LoadLevelInfo()
   LoadLevelInfoFromLevelDir(&leveldir_first, NULL, options.level_directory);
   LoadLevelInfoFromLevelDir(&leveldir_first, NULL, getUserLevelDir(NULL));
 
-  leveldir_current = getFirstValidLevelSeries(leveldir_first);
+  /* before sorting, the first entries will be from the user directory */
+  leveldir_current = getFirstValidTreeInfoEntry(leveldir_first);
 
   if (leveldir_first == NULL)
     Error(ERR_EXIT, "cannot find any valid level series in any directory");
@@ -1506,7 +1507,7 @@ static boolean LoadArtworkInfoFromArtworkConf(TreeInfo **node_first,
   char *check_dir = NULL;
   int i;
 
-  if (access(getUserLevelDir(filename), F_OK) == 0)    /* file exists */
+  if (access(filename, F_OK) == 0)             /* file exists */
     loadSetupFileList(filename);
 
   if (setup_file_list == NULL) /* no config file -- look for artwork files */
@@ -1515,7 +1516,7 @@ static boolean LoadArtworkInfoFromArtworkConf(TreeInfo **node_first,
     struct dirent *dir_entry;
     boolean valid_file_found = FALSE;
 
-    if ((dir = opendir(base_directory)) != NULL)
+    if ((dir = opendir(directory_path)) != NULL)
     {
       while ((dir_entry = readdir(dir)) != NULL)
       {
@@ -1535,7 +1536,8 @@ static boolean LoadArtworkInfoFromArtworkConf(TreeInfo **node_first,
 
     if (!valid_file_found)
     {
-      Error(ERR_WARN, "ignoring artwork directory '%s'", base_directory);
+      if (options.debug)
+       Error(ERR_WARN, "ignoring artwork directory '%s'", base_directory);
 
       free(directory_path);
       free(filename);
@@ -1712,9 +1714,24 @@ void LoadArtworkInfo()
                                TREE_TYPE_MUSIC_DIR);
 
   /* before sorting, the first entries will be from the user directory */
-  artwork.gfx_current = artwork.gfx_first;
-  artwork.snd_current = artwork.snd_first;
-  artwork.mus_current = artwork.mus_first;
+  artwork.gfx_current =
+    getTreeInfoFromFilename(artwork.gfx_first, setup.graphics_set);
+  if (artwork.gfx_current == NULL)
+    artwork.gfx_current = getFirstValidTreeInfoEntry(artwork.gfx_first);
+
+  artwork.snd_current =
+    getTreeInfoFromFilename(artwork.snd_first, setup.sounds_set);
+  if (artwork.snd_current == NULL)
+  artwork.snd_current = getFirstValidTreeInfoEntry(artwork.snd_first);
+
+  artwork.mus_current =
+    getTreeInfoFromFilename(artwork.mus_first, setup.music_set);
+  if (artwork.mus_current == NULL)
+  artwork.mus_current = getFirstValidTreeInfoEntry(artwork.mus_first);
+
+  artwork.graphics_set_current = artwork.gfx_current->name;
+  artwork.sounds_set_current = artwork.snd_current->name;
+  artwork.music_set_current = artwork.mus_current->name;
 
   sortTreeInfo(&artwork.gfx_first, compareTreeInfoEntries);
   sortTreeInfo(&artwork.snd_first, compareTreeInfoEntries);
@@ -1852,7 +1869,7 @@ void LoadLevelSetup_LastSeries()
   struct SetupFileList *level_setup_list = NULL;
 
   /* always start with reliable default values */
-  leveldir_current = getFirstValidLevelSeries(leveldir_first);
+  leveldir_current = getFirstValidTreeInfoEntry(leveldir_first);
 
   /* ----------------------------------------------------------------------- */
   /* ~/.<program>/levelsetup.conf                                            */
@@ -1868,7 +1885,7 @@ void LoadLevelSetup_LastSeries()
     leveldir_current = getTreeInfoFromFilename(leveldir_first,
                                               last_level_series);
     if (leveldir_current == NULL)
-      leveldir_current = leveldir_first;
+      leveldir_current = getFirstValidTreeInfoEntry(leveldir_first);
 
     checkSetupFileListIdentifier(level_setup_list, getCookie("LEVELSETUP"));
 
index 66432a777550f2669817711cb580f430eba8ec38..9837b9e2a2a37d47362041fa5a6a47c0b834dc7b 100644 (file)
@@ -154,7 +154,7 @@ TreeInfo *newTreeInfo();
 void pushTreeInfo(TreeInfo **, TreeInfo *);
 int numTreeInfo(TreeInfo *);
 boolean validLevelSeries(TreeInfo *);
-TreeInfo *getFirstValidLevelSeries(TreeInfo *);
+TreeInfo *getFirstValidTreeInfoEntry(TreeInfo *);
 TreeInfo *getTreeInfoFirstGroupEntry(TreeInfo *);
 int numTreeInfoInGroup(TreeInfo *);
 int posTreeInfo(TreeInfo *);
index 0e221548949504e1a3f65254638f08432cdd70aa..7eaadf68aae617e52ae4c2e56aa9644e178f1f91 100644 (file)
@@ -112,18 +112,11 @@ void ClosePlatformDependantStuff(void)
 
 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 *x11_icon_filename, char *x11_iconmask_filename,
+                    char *msdos_pointer_filename,
                     char *cookie_prefix, char *filename_prefix,
                     int program_version)
 {
-  char *x11_icon_filename =
-    getPath2(options.graphics_directory, x11_icon_basename);
-  char *x11_iconmask_filename =
-    getPath2(options.graphics_directory, x11_iconmask_basename);
-  char *msdos_pointer_filename =
-    getPath2(options.graphics_directory, msdos_pointer_basename);
-
 #if defined(PLATFORM_UNIX)
   program.userdata_directory = unix_userdata_directory;
 #else
@@ -635,6 +628,8 @@ Bitmap *LoadImage(char *filename)
   new_bitmap = X11LoadImage(filename);
 #endif
 
+  new_bitmap->source_filename = getStringCopy(filename);
+
   return new_bitmap;
 }
 
@@ -649,11 +644,55 @@ Bitmap *LoadCustomImage(char *basename)
   if ((new_bitmap = LoadImage(filename)) == NULL)
     Error(ERR_EXIT, "LoadImage() failed: %s", GetError());
 
-  new_bitmap->source_filename = getStringCopy(filename);
-
   return new_bitmap;
 }
 
+void ReloadCustomImage(Bitmap **bitmap, char *basename)
+{
+  char *filename = getCustomImageFilename(basename);
+  Bitmap *old_bitmap = *bitmap;
+  Bitmap *new_bitmap;
+
+  if (filename == NULL)                /* (should never happen) */
+  {
+    Error(ERR_WARN, "ReloadCustomImage(): cannot find file '%s'", basename);
+    return;
+  }
+
+  if (strcmp(filename, old_bitmap->source_filename) == 0)
+  {
+    /* The old and new image are the same (have the same filename and path).
+       This usually means that this image does not exist in this graphic set
+       and a fallback to the existing image is done. */
+
+    return;
+  }
+
+  if ((new_bitmap = LoadImage(filename)) == NULL)
+  {
+    Error(ERR_WARN, "LoadImage() failed: %s", GetError());
+    return;
+  }
+
+  if (old_bitmap->width != new_bitmap->width ||
+      old_bitmap->height != new_bitmap->height)
+  {
+    Error(ERR_WARN, "ReloadCustomImage: new image has wrong dimensions");
+    FreeBitmap(new_bitmap);
+    return;
+  }
+
+  /* copy filename for new image */
+  free(old_bitmap->source_filename);
+  old_bitmap->source_filename = getStringCopy(filename);
+
+  /* copy bitmap data for new image */
+  BlitBitmap(new_bitmap, old_bitmap, 0,0,
+            old_bitmap->width, old_bitmap->height, 0,0);
+
+  FreeBitmap(new_bitmap);
+}
+
 
 /* ========================================================================= */
 /* audio functions                                                           */
index 5f630fa3dd054934651020174b802863b605864e..145bac1dddea768910ff0556548b9b1f6f4065ab 100644 (file)
 #define RW_BASE_PATH           RW_GAME_DIR
 
 #define GRAPHICS_DIRECTORY     "graphics"
-#define MUSIC_DIRECTORY                "music"
 #define SOUNDS_DIRECTORY       "sounds"
+#define MUSIC_DIRECTORY                "music"
 #define LEVELS_DIRECTORY       "levels"
 #define TAPES_DIRECTORY                "tapes"
 #define SCORES_DIRECTORY       "scores"
 
+#if !defined(PLATFORM_MSDOS)
+#define GRAPHICS_SUBDIR                "gfx_classic"
+#define SOUNDS_SUBDIR          "snd_classic"
+#define MUSIC_SUBDIR           "mus_classic"
+#else
+#define GRAPHICS_SUBDIR                "gfx_orig"
+#define SOUNDS_SUBDIR          "snd_orig"
+#define MUSIC_SUBDIR           "mus_orig"
+#endif
+
 /* areas in bitmap PIX_DOOR */
 /* meaning in PIX_DB_DOOR: (3 PAGEs)
    PAGEX1: 1. buffer for DOOR_1
@@ -307,9 +317,9 @@ struct SetupInfo
   boolean fullscreen;
   boolean ask_on_escape;
 
-  char *graphics_dir;
-  char *sounds_dir;
-  char *music_dir;
+  char *graphics_set;
+  char *sounds_set;
+  char *music_set;
 
   struct SetupShortcutInfo shortcut;
   struct SetupInputInfo input[MAX_PLAYERS];
@@ -370,6 +380,10 @@ struct ArtworkInfo
   SoundsDirTree *snd_current;
   MusicDirTree *mus_first;
   MusicDirTree *mus_current;
+
+  char *graphics_set_current;
+  char *sounds_set_current;
+  char *music_set_current;
 };
 
 
@@ -451,6 +465,7 @@ inline boolean ChangeVideoModeIfNeeded(boolean);
 
 Bitmap *LoadImage(char *);
 Bitmap *LoadCustomImage(char *);
+void ReloadCustomImage(Bitmap **, char *);
 
 inline void OpenAudio(void);
 inline void CloseAudio(void);
index fd1d8b80c7f44b15e5af4f56c6e65af627edaeb3..cfa0ce78857abc3ee46afc846e42bd63b201cf45 100644 (file)
@@ -14,6 +14,7 @@
 #include "system.h"
 #include "pcx.h"
 #include "misc.h"
+#include "setup.h"
 
 
 #if defined(TARGET_X11)
@@ -144,7 +145,7 @@ static DrawWindow *X11InitWindow()
          icon_pic.picture_filename);
 #endif
   if (XReadBitmapFile(display, new_window->drawable,
-                     program.x11_icon_filename,
+                     getCustomImageFilename(program.x11_icon_filename),
                      &icon_width, &icon_height, &icon_pixmap,
                      &icon_hot_x, &icon_hot_y) != BitmapSuccess)
     Error(ERR_EXIT, "cannot read icon bitmap file '%s'",
@@ -155,7 +156,7 @@ static DrawWindow *X11InitWindow()
          icon_pic.picturemask_filename);
 #endif
   if (XReadBitmapFile(display, new_window->drawable,
-                     program.x11_iconmask_filename,
+                     getCustomImageFilename(program.x11_iconmask_filename),
                      &icon_width, &icon_height, &iconmask_pixmap,
                      &icon_hot_x, &icon_hot_y) != BitmapSuccess)
     Error(ERR_EXIT, "cannot read icon bitmap file '%s'",
@@ -231,6 +232,16 @@ static DrawWindow *X11InitWindow()
   return new_window;
 }
 
+static void SetImageDimensions(Bitmap *bitmap)
+{
+  Window root;
+  int x, y;
+  unsigned int border_width, depth;
+
+  XGetGeometry(display, bitmap->drawable, &root, &x, &y,
+              &bitmap->width, &bitmap->height, &border_width, &depth);
+}
+
 Bitmap *X11LoadImage(char *filename)
 {
   Bitmap *new_bitmap = CreateBitmapStruct();
@@ -285,6 +296,9 @@ Bitmap *X11LoadImage(char *filename)
   /* set GraphicContext inheritated from Window */
   new_bitmap->gc = window->gc;
 
+  /* set image width and height */
+  SetImageDimensions(new_bitmap);
+
   return new_bitmap;
 }
 
index 76c34d8a2a5c3ef64ff86283ddc8c022bcd08fff..43013b93032744ef9aa1d06ee7bff044d6399651 100644 (file)
@@ -60,6 +60,7 @@ typedef XClientMessageEvent   ClientMessageEvent;
 struct X11DrawableInfo
 {
   char *source_filename;
+  int width, height;
   Drawable drawable;
   Drawable clip_mask;
   GC gc;               /* GC for normal drawing (inheritated from 'window') */
index 46324314fdaf3e008e172b220e23959c47100090..e6556da224aef86a4f328ecd4370c326fc547aef 100644 (file)
@@ -152,6 +152,9 @@ void DrawMainMenu()
   /* needed if last screen was the setup screen and fullscreen state changed */
   ToggleFullscreenIfNeeded();
 
+  /* needed if last screen (setup/level) changed graphics, sounds or music */
+  ReloadCustomArtwork();
+
 #ifdef TARGET_SDL
   SetDrawtoField(DRAW_BACKBUFFER);
 #endif
@@ -161,7 +164,7 @@ void DrawMainMenu()
 
   /* leveldir_current may be invalid (level group, parent link) */
   if (!validLevelSeries(leveldir_current))
-    leveldir_current = getFirstValidLevelSeries(leveldir_last_valid);
+    leveldir_current = getFirstValidTreeInfoEntry(leveldir_last_valid);
 
   /* store valid level series information */
   leveldir_last_valid = leveldir_current;
@@ -1350,7 +1353,6 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
 
 static struct TokenInfo *setup_info;
 static int num_setup_info;
-static char *custom_graphics, *custom_sounds, *custom_music;
 
 static void execSetupMain()
 {
@@ -1360,7 +1362,7 @@ static void execSetupMain()
 
 static void execSetupGraphics()
 {
-  custom_graphics = artwork.gfx_current->name;
+  setup.graphics_set = artwork.gfx_current->name;
 
   setup_mode = SETUP_MODE_GRAPHICS;
   DrawSetupScreen();
@@ -1368,8 +1370,8 @@ static void execSetupGraphics()
 
 static void execSetupSound()
 {
-  custom_sounds = artwork.snd_current->name;
-  custom_music = artwork.mus_current->name;
+  setup.sounds_set = artwork.snd_current->name;
+  setup.music_set = artwork.mus_current->name;
 
   setup_mode = SETUP_MODE_SOUND;
   DrawSetupScreen();
@@ -1452,7 +1454,7 @@ static struct TokenInfo setup_info_main[] =
 static struct TokenInfo setup_info_graphics[] =
 {
   { TYPE_ENTER_MENU,   execSetupChooseGraphics,"Custom Graphics"       },
-  { TYPE_STRING,       &custom_graphics,       ""                      },
+  { TYPE_STRING,       &setup.graphics_set,    ""                      },
   { TYPE_EMPTY,                NULL,                   ""                      },
   { TYPE_SWITCH,       &setup.fullscreen,      "Fullscreen:"           },
   { TYPE_SWITCH,       &setup.scroll_delay,    "Scroll Delay:"         },
@@ -1471,9 +1473,9 @@ static struct TokenInfo setup_info_sound[] =
   { TYPE_SWITCH,       &setup.sound_music,     "Game Music:"           },
   { TYPE_EMPTY,                NULL,                   ""                      },
   { TYPE_ENTER_MENU,   execSetupChooseSounds,  "Custom Sounds"         },
-  { TYPE_STRING,       &custom_sounds,         ""                      },
+  { TYPE_STRING,       &setup.sounds_set,      ""                      },
   { TYPE_ENTER_MENU,   execSetupChooseMusic,   "Custom Music"          },
-  { TYPE_STRING,       &custom_music,          ""                      },
+  { TYPE_STRING,       &setup.music_set,       ""                      },
   { TYPE_EMPTY,                NULL,                   ""                      },
   { TYPE_LEAVE_MENU,   execSetupMain,          "Exit"                  },
   { 0,                 NULL,                   NULL                    }
@@ -1541,7 +1543,8 @@ static void drawSetupValue(int pos)
 {
   int xpos = MENU_SCREEN_VALUE_XPOS;
   int ypos = MENU_SCREEN_START_YPOS + pos;
-  int value_color = FC_YELLOW;
+  int font_size = FS_BIG;
+  int font_color = FC_YELLOW;
   char *value_string = getSetupValue(setup_info[pos].type & ~TYPE_GHOSTED,
                                     setup_info[pos].value);
 
@@ -1552,23 +1555,26 @@ static void drawSetupValue(int pos)
     if (setup_info[pos].type & TYPE_QUERY)
     {
       value_string = "<press key>";
-      value_color = FC_RED;
+      font_color = FC_RED;
     }
   }
   else if (setup_info[pos].type & TYPE_STRING)
   {
-    xpos = 3;
+    int max_value_len = (SCR_FIELDX - 2) * 2;
+
+    xpos = 1;
+    font_size = FS_MEDIUM;
 
-    if (strlen(value_string) > 14)
-      value_string[14] = '\0';
+    if (strlen(value_string) > max_value_len)
+      value_string[max_value_len] = '\0';
   }
   else if (setup_info[pos].type & TYPE_BOOLEAN_STYLE &&
           !*(boolean *)(setup_info[pos].value))
-    value_color = FC_BLUE;
+    font_color = FC_BLUE;
 
   DrawText(SX + xpos * 32, SY + ypos * 32,
           (xpos == 3 ? "              " : "   "), FS_BIG, FC_YELLOW);
-  DrawText(SX + xpos * 32, SY + ypos * 32, value_string, FS_BIG, value_color);
+  DrawText(SX + xpos * 32, SY + ypos * 32, value_string, font_size,font_color);
 }
 
 static void changeSetupValue(int pos)
index bc9167ac4e6ec03b48ee8aac2a973f11f309f17d..078b3c9b4db735ee27c9a8bdd8bfa6c28b286079 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2002-04-06 14:21]"
+#define COMPILE_DATE_STRING "[2002-04-07 13:13]"
index 98292409bee141f5eabf20d92c62136178e9970b..b0ffdcf7b7bc148ca9000f7c87cdc2243780ca6e 100644 (file)
@@ -2054,7 +2054,12 @@ unsigned int CloseDoor(unsigned int door_state)
 
 unsigned int GetDoorState()
 {
-  return(MoveDoor(DOOR_GET_STATE));
+  return MoveDoor(DOOR_GET_STATE);
+}
+
+unsigned int SetDoorState(unsigned int door_state)
+{
+  return MoveDoor(door_state | DOOR_SET_STATE);
 }
 
 unsigned int MoveDoor(unsigned int door_state)
@@ -2068,6 +2073,16 @@ unsigned int MoveDoor(unsigned int door_state)
   if (door_state == DOOR_GET_STATE)
     return(door1 | door2);
 
+  if (door_state & DOOR_SET_STATE)
+  {
+    if (door_state & DOOR_ACTION_1)
+      door1 = door_state & DOOR_ACTION_1;
+    if (door_state & DOOR_ACTION_2)
+      door2 = door_state & DOOR_ACTION_2;
+
+    return(door1 | door2);
+  }
+
   if (door1 == DOOR_OPEN_1 && door_state & DOOR_OPEN_1)
     door_state &= ~DOOR_OPEN_1;
   else if (door1 == DOOR_CLOSE_1 && door_state & DOOR_CLOSE_1)
index 634bed9b217fa93bc232d95b3249638dcc755274..f6a05abb3f8b3b0d52ea89374332e0a69900d056 100644 (file)
@@ -45,6 +45,7 @@
 #define DOOR_COPY_BACK         (1 << 4)
 #define DOOR_NO_DELAY          (1 << 5)
 #define DOOR_GET_STATE         (1 << 6)
+#define DOOR_SET_STATE         (1 << 7)
 
 /* for Request */
 #define REQ_ASK                        (1 << 0)
@@ -104,6 +105,7 @@ boolean Request(char *, unsigned int);
 unsigned int OpenDoor(unsigned int);
 unsigned int CloseDoor(unsigned int);
 unsigned int GetDoorState(void);
+unsigned int SetDoorState(unsigned int);
 unsigned int MoveDoor(unsigned int);
 void DrawSpecialEditorDoor();
 void UndrawSpecialEditorDoor();