rnd-20030729-1-src
authorHolger Schemel <info@artsoft.org>
Mon, 28 Jul 2003 22:46:12 +0000 (00:46 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:42:52 +0000 (10:42 +0200)
src/conf_gfx.c
src/conftime.h
src/game.c
src/init.c
src/libgame/image.c
src/libgame/setup.c
src/main.c
src/main.h
src/screens.c

index 60b7c875fce55b3b039d17c76a7e09471b3f0182..2e4691128dab9fbc03527772ec29355a7e710169 100644 (file)
@@ -3454,6 +3454,8 @@ struct ConfigInfo image_config[] =
   { "menu.draw_xoffset.SETUP",                 "0"                     },
   { "menu.draw_yoffset.SETUP",                 "0"                     },
 
+  { "menu.scrollbar_xoffset",                  "0"                     },
+
   { "menu.list_size",                          "-1"                    },
   { "menu.list_size.LEVELS",                   "-1"                    },
   { "menu.list_size.SCORES",                   "-1"                    },
index 0a2e58145a5f3c05f3618b3626a76bb5f445fa67..8fc196670b36a0635d61a43aaaa40aeb3f00d25f 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-07-26 03:06]"
+#define COMPILE_DATE_STRING "[2003-07-29 00:38]"
index 5b22dcbd4f7d511af5972303033fe20a6f5bae44..54d678499801233dd497952ba799c00004722253 100644 (file)
@@ -2695,7 +2695,7 @@ void Impact(int x, int y)
     return;
   }
 #if 1
-  else if (impact && CheckElementChange(x, y, element, ACTION_IMPACT))
+  else if (impact && CheckElementChange(x, y, element, CE_IMPACT))
   {
     PlaySoundLevelElementAction(x, y, element, ACTION_IMPACT);
 
@@ -3840,7 +3840,9 @@ void StartMoving(int x, int y)
        return;
       }
 
+#if 0
       GfxAction[x][y] = ACTION_MOVING;
+#endif
     }
 
     /* now make next step */
@@ -5226,6 +5228,8 @@ static void ChangeElementNow(int x, int y, int element)
 
     if (!change->only_complete || complete_change)
     {
+      boolean something_has_changed = FALSE;
+
       if (change->only_complete && change->use_random_change &&
          RND(100) < change->random)
        return;
@@ -5243,17 +5247,24 @@ static void ChangeElementNow(int x, int y, int element)
 
          ChangeElementNowExt(ex, ey, change->content[xx][yy]);
 
+         something_has_changed = TRUE;
+
          /* for symmetry reasons, stop newly created border elements */
          if (ex != x || ey != y)
            Stop[ex][ey] = TRUE;
        }
       }
 
-      return;
+      if (something_has_changed)
+       PlaySoundLevelElementAction(x, y, element, ACTION_CHANGING);
     }
   }
+  else
+  {
+    ChangeElementNowExt(x, y, change->target_element);
 
-  ChangeElementNowExt(x, y, change->target_element);
+    PlaySoundLevelElementAction(x, y, element, ACTION_CHANGING);
+  }
 }
 
 static void ChangeElement(int x, int y)
index 20a84d1e0b400be248f5db6ff50844f8946a16a5..b859112c771a04c6ac5d2a23ab9879d637efb77e 100644 (file)
@@ -998,7 +998,7 @@ static void InitSoundInfo()
     sound_info[i].loop = FALSE;
 
 #if 0
-    printf("::: sound: '%s'\n", sound->token);
+    printf("::: sound %d: '%s'\n", i, sound->token);
 #endif
 
     /* determine all loop sounds and identify certain sound classes */
@@ -1012,9 +1012,9 @@ static void InitSoundInfo()
                 element_action_info[j].suffix) == 0)
       {
        sound_effect_properties[i] = element_action_info[j].value;
+       sound_info[i].loop = element_action_info[j].is_loop_sound;
 
-       if (element_action_info[j].is_loop_sound)
-         sound_info[i].loop = TRUE;
+       break;
       }
     }
 
index 4e30f4c1a4e7792980fa0f90e2fca0da1a7ef855..3fb28c927f104d25a711708f95e4d6b0781c6072 100644 (file)
@@ -718,7 +718,7 @@ static void *Load_PCX(char *filename)
 {
   ImageInfo *img_info;
 
-#if 0
+#if 1
   printf("loading PCX file '%s'\n", filename);
 #endif
 
index 574d37e84262217730ba644439c0a8e38907b255..24e2471b723632f30eff5a570000d2c63973a6a8 100644 (file)
@@ -2117,16 +2117,25 @@ void LoadArtworkInfo()
   /* before sorting, the first entries will be from the user directory */
   artwork.gfx_current =
     getTreeInfoFromIdentifier(artwork.gfx_first, setup.graphics_set);
+  if (artwork.gfx_current == NULL)
+    artwork.gfx_current =
+      getTreeInfoFromIdentifier(artwork.gfx_first, GRAPHICS_SUBDIR);
   if (artwork.gfx_current == NULL)
     artwork.gfx_current = getFirstValidTreeInfoEntry(artwork.gfx_first);
 
   artwork.snd_current =
     getTreeInfoFromIdentifier(artwork.snd_first, setup.sounds_set);
+  if (artwork.snd_current == NULL)
+    artwork.snd_current =
+      getTreeInfoFromIdentifier(artwork.snd_first, SOUNDS_SUBDIR);
   if (artwork.snd_current == NULL)
     artwork.snd_current = getFirstValidTreeInfoEntry(artwork.snd_first);
 
   artwork.mus_current =
     getTreeInfoFromIdentifier(artwork.mus_first, setup.music_set);
+  if (artwork.mus_current == NULL)
+    artwork.mus_current =
+      getTreeInfoFromIdentifier(artwork.mus_first, MUSIC_SUBDIR);
   if (artwork.mus_current == NULL)
     artwork.mus_current = getFirstValidTreeInfoEntry(artwork.mus_first);
 
@@ -2211,6 +2220,9 @@ void LoadLevelArtworkInfo()
   {
     artwork.gfx_current =
       getTreeInfoFromIdentifier(artwork.gfx_first, setup.graphics_set);
+    if (artwork.gfx_current == NULL)
+      artwork.gfx_current =
+       getTreeInfoFromIdentifier(artwork.gfx_first, GRAPHICS_SUBDIR);
     if (artwork.gfx_current == NULL)
       artwork.gfx_current = getFirstValidTreeInfoEntry(artwork.gfx_first);
   }
@@ -2219,6 +2231,9 @@ void LoadLevelArtworkInfo()
   {
     artwork.snd_current =
       getTreeInfoFromIdentifier(artwork.snd_first, setup.sounds_set);
+    if (artwork.snd_current == NULL)
+      artwork.snd_current =
+       getTreeInfoFromIdentifier(artwork.snd_first, SOUNDS_SUBDIR);
     if (artwork.snd_current == NULL)
       artwork.snd_current = getFirstValidTreeInfoEntry(artwork.snd_first);
   }
@@ -2227,6 +2242,9 @@ void LoadLevelArtworkInfo()
   {
     artwork.mus_current =
       getTreeInfoFromIdentifier(artwork.mus_first, setup.music_set);
+    if (artwork.mus_current == NULL)
+      artwork.mus_current =
+       getTreeInfoFromIdentifier(artwork.mus_first, MUSIC_SUBDIR);
     if (artwork.mus_current == NULL)
       artwork.mus_current = getFirstValidTreeInfoEntry(artwork.mus_first);
   }
index 697d1b740fcf607994123ce00f5a25c56ef72b74..beec6a9b79c50816cb6320405eaea80cde5f3627 100644 (file)
@@ -2998,7 +2998,7 @@ struct ElementInfo element_info[MAX_NUM_ELEMENTS + 1] =
 /* element action and direction definitions                                  */
 /* ------------------------------------------------------------------------- */
 
-struct ElementActionInfo element_action_info[NUM_ACTIONS + 1] =
+struct ElementActionInfo element_action_info[NUM_ACTIONS + 1 + 1] =
 {
   { ".[DEFAULT]",      ACTION_DEFAULT,         TRUE    },
   { ".waiting",                ACTION_WAITING,         TRUE    },
@@ -3077,6 +3077,8 @@ struct TokenIntPtrInfo image_config_vars[] =
   { "menu.draw_xoffset.SETUP", &menu.draw_xoffset[GFX_SPECIAL_ARG_SETUP]  },
   { "menu.draw_yoffset.SETUP", &menu.draw_yoffset[GFX_SPECIAL_ARG_SETUP]  },
 
+  { "menu.scrollbar_xoffset",  &menu.scrollbar_xoffset                    },
+
   { "menu.list_size",          &menu.list_size_default                    },
   { "menu.list_size.LEVELS",   &menu.list_size[GFX_SPECIAL_ARG_LEVELS]    },
   { "menu.list_size.SCORES",   &menu.list_size[GFX_SPECIAL_ARG_SCORES]    },
index 8bef96cc876e53bf6b6d627b74751d4fa17dafe5..eb96b6d14ff3141e1adae1cdd98463519acc328e 100644 (file)
@@ -1197,6 +1197,8 @@ struct MenuInfo
   int draw_xoffset[NUM_SPECIAL_GFX_ARGS];
   int draw_yoffset[NUM_SPECIAL_GFX_ARGS];
 
+  int scrollbar_xoffset;
+
   int list_size_default;
   int list_size[NUM_SPECIAL_GFX_ARGS];
 };
index 1a239518c74c6d216363d259198c88725cfd2556..f2c95cec1aaf49d3e654896fbc4f2e4bc92649fd 100644 (file)
@@ -1193,6 +1193,10 @@ void HandleTypeName(int newxpos, Key key)
 static void DrawChooseTree(TreeInfo **ti_ptr)
 {
   UnmapAllGadgets();
+
+  FreeScreenGadgets();
+  CreateScreenGadgets();
+
   CloseDoor(DOOR_CLOSE_2);
 
   ClearWindow();
@@ -1311,12 +1315,18 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
   int step = (button == 1 ? 1 : button == 2 ? 5 : 10);
   int num_entries = numTreeInfoInGroup(ti);
   int num_page_entries;
+  int last_game_status = game_status;  /* save current game status */
+
+  /* force LEVELS draw offset on choose level and artwork setup screen */
+  game_status = GAME_MODE_LEVELS;
 
   if (num_entries <= NUM_MENU_ENTRIES_ON_SCREEN)
     num_page_entries = num_entries;
   else
     num_page_entries = NUM_MENU_ENTRIES_ON_SCREEN;
 
+  game_status = last_game_status;      /* restore current game status */
+
   if (button == MB_MENU_INITIALIZE)
   {
     int num_entries = numTreeInfoInGroup(ti);
@@ -2839,7 +2849,7 @@ static struct
 #else
     IMG_MENU_SCROLLBAR, IMG_MENU_SCROLLBAR_ACTIVE,
 #endif
-    SX + SC_SCROLL_VERTICAL_XPOS, SY + SC_SCROLL_VERTICAL_YPOS,
+    SC_SCROLL_VERTICAL_XPOS, SC_SCROLL_VERTICAL_YPOS,
     SC_SCROLL_VERTICAL_XSIZE, SC_SCROLL_VERTICAL_YSIZE,
     GD_TYPE_SCROLLBAR_VERTICAL,
     SCREEN_CTRL_ID_SCROLL_VERTICAL,
@@ -2861,16 +2871,17 @@ static void CreateScreenScrollbuttons()
     int gd_x1, gd_x2, gd_y1, gd_y2;
     int id = scrollbutton_info[i].gadget_id;
 
-    x = scrollbutton_info[i].x;
-    y = scrollbutton_info[i].y;
-
     event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED;
 
-    x += SX;
-    y += SY;
+    x = mSX + scrollbutton_info[i].x + menu.scrollbar_xoffset;
+    y = mSY + scrollbutton_info[i].y;
     width = SC_SCROLLBUTTON_XSIZE;
     height = SC_SCROLLBUTTON_YSIZE;
 
+    if (id == SCREEN_CTRL_ID_SCROLL_DOWN)
+      y = mSY + (SC_SCROLL_VERTICAL_YPOS +
+                (NUM_MENU_ENTRIES_ON_SCREEN - 2) * SC_SCROLLBUTTON_YSIZE);
+
     gfx_unpressed = scrollbutton_info[i].gfx_unpressed;
     gfx_pressed   = scrollbutton_info[i].gfx_pressed;
     gd_bitmap_unpressed = graphic_info[gfx_unpressed].bitmap;
@@ -2912,6 +2923,7 @@ static void CreateScreenScrollbars()
 #if !defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
     int gfx_unpressed, gfx_pressed;
 #endif
+    int x, y, width, height;
     int gd_x1, gd_x2, gd_y1, gd_y2;
     struct GadgetInfo *gi;
     int items_max, items_visible, item_position;
@@ -2919,12 +2931,20 @@ static void CreateScreenScrollbars()
     int num_page_entries = NUM_MENU_ENTRIES_ON_SCREEN;
     int id = scrollbar_info[i].gadget_id;
 
+    event_mask = GD_EVENT_MOVING | GD_EVENT_OFF_BORDERS;
+
+    x = mSX + scrollbar_info[i].x + menu.scrollbar_xoffset;
+    y = mSY + scrollbar_info[i].y;
+    width  = scrollbar_info[i].width;
+    height = scrollbar_info[i].height;
+
+    if (id == SCREEN_CTRL_ID_SCROLL_VERTICAL)
+      height = (NUM_MENU_ENTRIES_ON_SCREEN - 2) * SC_SCROLLBUTTON_YSIZE;
+
     items_max = num_page_entries;
     items_visible = num_page_entries;
     item_position = 0;
 
-    event_mask = GD_EVENT_MOVING | GD_EVENT_OFF_BORDERS;
-
 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
     gd_bitmap_unpressed = *scrollbar_info[i].gfx_unpressed;
     gd_bitmap_pressed   = *scrollbar_info[i].gfx_pressed;
@@ -2946,10 +2966,10 @@ static void CreateScreenScrollbars()
     gi = CreateGadget(GDI_CUSTOM_ID, id,
                      GDI_CUSTOM_TYPE_ID, i,
                      GDI_INFO_TEXT, scrollbar_info[i].infotext,
-                     GDI_X, scrollbar_info[i].x,
-                     GDI_Y, scrollbar_info[i].y,
-                     GDI_WIDTH, scrollbar_info[i].width,
-                     GDI_HEIGHT, scrollbar_info[i].height,
+                     GDI_X, x,
+                     GDI_Y, y,
+                     GDI_WIDTH, width,
+                     GDI_HEIGHT, height,
                      GDI_TYPE, scrollbar_info[i].type,
                      GDI_SCROLLBAR_ITEMS_MAX, items_max,
                      GDI_SCROLLBAR_ITEMS_VISIBLE, items_visible,
@@ -2971,6 +2991,8 @@ static void CreateScreenScrollbars()
 
 void CreateScreenGadgets()
 {
+  int last_game_status = game_status;  /* save current game status */
+
 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
   int i;
 
@@ -2992,8 +3014,13 @@ void CreateScreenGadgets()
   }
 #endif
 
+  /* force LEVELS draw offset for scrollbar / scrollbutton gadgets */
+  game_status = GAME_MODE_LEVELS;
+
   CreateScreenScrollbuttons();
   CreateScreenScrollbars();
+
+  game_status = last_game_status;      /* restore current game status */
 }
 
 void FreeScreenGadgets()