Merge branch 'master' into releases 3.2.1
authorHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:53:04 +0000 (10:53 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:53:04 +0000 (10:53 +0200)
96 files changed:
ChangeLog
Makefile
src/Makefile
src/cartoons.c
src/cartoons.h
src/conf_chr.c
src/conf_chr.h
src/conf_cus.c
src/conf_cus.h
src/conf_e2g.c
src/conf_e2s.c
src/conf_esg.c
src/conf_fnt.c
src/conf_g2m.c
src/conf_g2s.c
src/conf_gfx.c
src/conf_gfx.h
src/conf_grp.c
src/conf_grp.h
src/conf_hlp.c
src/conf_mus.c
src/conf_mus.h
src/conf_snd.c
src/conf_snd.h
src/config.c
src/config.h
src/conftime.h
src/editor.c
src/editor.h
src/engines.h
src/events.c
src/events.h
src/files.c
src/files.h
src/game.c
src/game.h
src/game_em/cave.c
src/game_em/convert.c
src/game_em/export.h
src/game_em/game_em.h
src/game_em/global.h
src/game_em/graphics.c
src/game_em/input.c
src/game_em/main_em.h
src/game_em/synchro_1.c
src/game_em/synchro_2.c
src/init.c
src/init.h
src/libgame/Makefile
src/libgame/gadgets.c
src/libgame/gadgets.h
src/libgame/hash.c
src/libgame/hash.h
src/libgame/image.c
src/libgame/image.h
src/libgame/joystick.c
src/libgame/joystick.h
src/libgame/libgame.h
src/libgame/macosx.h
src/libgame/misc.c
src/libgame/misc.h
src/libgame/msdos.c
src/libgame/msdos.h
src/libgame/pcx.c
src/libgame/pcx.h
src/libgame/platform.h
src/libgame/random.c
src/libgame/random.h
src/libgame/sdl.c
src/libgame/sdl.h
src/libgame/setup.c
src/libgame/setup.h
src/libgame/sound.c
src/libgame/sound.h
src/libgame/system.c
src/libgame/system.h
src/libgame/text.c
src/libgame/text.h
src/libgame/toons.c
src/libgame/toons.h
src/libgame/types.h
src/libgame/windows.h
src/libgame/x11.c
src/libgame/x11.h
src/main.c
src/main.h
src/netserv.c
src/netserv.h
src/network.c
src/network.h
src/screens.c
src/screens.h
src/tape.c
src/tape.h
src/tools.c
src/tools.h

index c3ac63a28215d1bebd9d4994cf16150697c30bc5..da91536c00adb4284cedab77bffa7c07b6b10633 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,93 @@
+2006-08-20
+       * version 3.2.1 released
+
+2006-08-20
+       * fixed nasty bugs with handling error message file on Mac OS X systems
+
+2006-08-19
+       * general code cleanup (removing many annoying "#if 0" blocks etc.)
+
+2006-08-18
+       * fixed bug that caused broken tapes when manually appending to tapes
+         using the "pause before death" functionality, followed by recording
+       * added setup option to disable fading of screens for faster testing
+
+2006-08-16
+       * code cleanup of new fading functions
+
+2006-08-15
+       * changed behaviour after solved game -- do not immediately stop engine
+       * added some more smooth screen fadings (game start, hall of fame etc.)
+
+2006-08-14
+       * fixed bug with displaying pushed CE with value/score/delay anim_mode
+
+2006-08-12
+       * added configurable level preview position, tile size and dimensions
+       * added configurable game panel value positions (gems, time, score etc.)
+
+2006-08-10
+       * fixed small bug with time displayed incorrectly when collecting CEs
+
+2006-08-07
+       * fixed bug with bumpy scrolling with EM engine in double player mode
+
+2006-08-05
+       * added compatibility code to fix "Snake Bite" style levels that were
+         broken due to a bugfix regarding EL_SOKOBAN_FIELD_PLAYER in 3.2.0
+
+2006-08-04
+       * fixed bug with scrollbars inside editor when using the Windows mouse
+         enhancement tool "True X-Mouse" (which injects key events to the event
+         queue to insert selected stuff into the Windows clipboard, which gets
+         confused with the "Insert" key for jumping to the last editor cascade
+         block in the element list)
+       * added Rocks'n'Diamonds icon for use as window icon to SDL version
+       * added key shortcut "Alt + Enter" to toggle fullscreen mode at any time
+
+2006-08-01
+       * added selection of preferred fullscreen mode to setup / graphics menu
+         (useful if default mode 800 x 600 does not match screen aspect ratio)
+
+2006-07-30
+       * improved down-scaling of images for better level and preview graphics
+       * changed user data directory for Mac OS X from Unix style to new place
+
+2006-07-26
+       * improved level number selection in main menu and player selection in
+         setup menu (input devices section) by using standard button gadgets
+       * added support for mouse scroll wheel (caused buggy behaviour before)
+       * added support for scrolling horizontal scrollbars with mouse wheel by
+         holding "Shift" key pressed while scrolling the wheel
+       * added support for single step mouse wheel scrolling by holding "Alt"
+         key pressed while scrolling the wheel (can be combined with "Shift")
+       * changed output file "stderr.txt" on Windows platform now always to be
+         created in the R'n'D sub-directory of the personal documents directory
+       * added Windows message box to direct to "stderr.txt" after error aborts
+
+2006-07-25
+       * improved general scrollbar handling (when jump-scrolling scrollbars)
+
+2006-07-23
+       * changed scrollbars to always show last line as first after scrolling
+         (that means jumping n - 1 screen lines instead of n screen lines)
+
+2006-07-22
+       * fixed level versions of EMC level loader (from V4 to V1, V2 and V3)
+       * fixed level time for EMC levels for V2 engine (V2 and V5 levels)
+       * fixed special handling of vertically stacked acid becoming fake acid
+
+2006-07-16
+       * fixed bug (very special case) with CE_SCORE_GETS_ZERO, which can
+         affect multiple instances of the same CE, although this kind of
+         change condition usually only affects one single custom element
+
+2006-07-16
+       * version number set to 3.2.1
+
+2006-07-16
+       * version 3.2.0 released
+
 2006-06-23
        * reorganized level editor element list a bit to match engines better
 
index f98a1211c870d8adf3217a90e080fc4939722b44..7e91482df7e3f66286206c7a806fe3c110068e56 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # =============================================================================
 # Rocks'n'Diamonds Makefile
 # -----------------------------------------------------------------------------
-# (c) 1995-2005 Holger Schemel <info@artsoft.org>
+# (c) 1995-2006 Holger Schemel <info@artsoft.org>
 # =============================================================================
 
 # -----------------------------------------------------------------------------
index 973fdeadd74f539c7f5525d0a08a5585da101790..7b6345e1a61c7a2631f3fc8fb1bd0dbff47cf1db 100644 (file)
@@ -1,7 +1,7 @@
 # =============================================================================
 # Rocks'n'Diamonds Makefile (src)
 # -----------------------------------------------------------------------------
-# (c) 1995-2005 Holger Schemel <info@artsoft.org>
+# (c) 1995-2006 Holger Schemel <info@artsoft.org>
 # =============================================================================
 
 # -----------------------------------------------------------------------------
index 9b6626b6cc777b76cb8f06908b968007adc09269..c2b6e76a6b7d56698b8217cc402ffab25aae2975 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 44cfb6d21582bb4aac46242149271c348f450699..073cc52bdd710307aafdacaeffcd06e96c72ffbc 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 63aee714a82c871e112ea1c94bb5b7e51bbabc15..a3f0ed1b6d493b8fe6746b14236344f6b34e4ed4 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index af90160a42fe0ed0b0328c20e0c2f1c4aafc0979..5c586bb31df85cf77ea233dde39028a81787dfed 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index dd54ef34fe0767ea4cf4d9d2c7ca8d0c1d7463ff..06f91a75b05df05b12807a3f4985f8d6f25dea2e 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 867cd125152a4d9efc6ca89ecc07fe00aa1fb85b..dfc8e51940e16885410af3c92da0f2ac5eb99126 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 212e86bf5bef60c38728c4e675b92c6825adb4c4..d597d1b376f8c8fe74bab97f8c4cfffa5423ffcc 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -2829,6 +2829,78 @@ element_to_graphic[] =
     EL_CURRENT_CE_SCORE,               -1, -1, FALSE,
     IMG_CURRENT_CE_SCORE
   },
+  {
+    EL_LAST_CE_1,                      -1, -1, FALSE,
+    IMG_LAST_CE_1
+  },
+  {
+    EL_LAST_CE_2,                      -1, -1, FALSE,
+    IMG_LAST_CE_2
+  },
+  {
+    EL_LAST_CE_3,                      -1, -1, FALSE,
+    IMG_LAST_CE_3
+  },
+  {
+    EL_LAST_CE_4,                      -1, -1, FALSE,
+    IMG_LAST_CE_4
+  },
+  {
+    EL_LAST_CE_5,                      -1, -1, FALSE,
+    IMG_LAST_CE_5
+  },
+  {
+    EL_LAST_CE_6,                      -1, -1, FALSE,
+    IMG_LAST_CE_6
+  },
+  {
+    EL_LAST_CE_7,                      -1, -1, FALSE,
+    IMG_LAST_CE_7
+  },
+  {
+    EL_LAST_CE_8,                      -1, -1, FALSE,
+    IMG_LAST_CE_8
+  },
+  {
+    EL_NEXT_CE_1,                      -1, -1, FALSE,
+    IMG_NEXT_CE_1
+  },
+  {
+    EL_NEXT_CE_2,                      -1, -1, FALSE,
+    IMG_NEXT_CE_2
+  },
+  {
+    EL_NEXT_CE_3,                      -1, -1, FALSE,
+    IMG_NEXT_CE_3
+  },
+  {
+    EL_NEXT_CE_4,                      -1, -1, FALSE,
+    IMG_NEXT_CE_4
+  },
+  {
+    EL_NEXT_CE_5,                      -1, -1, FALSE,
+    IMG_NEXT_CE_5
+  },
+  {
+    EL_NEXT_CE_6,                      -1, -1, FALSE,
+    IMG_NEXT_CE_6
+  },
+  {
+    EL_NEXT_CE_7,                      -1, -1, FALSE,
+    IMG_NEXT_CE_7
+  },
+  {
+    EL_NEXT_CE_8,                      -1, -1, FALSE,
+    IMG_NEXT_CE_8
+  },
+  {
+    EL_SELF,                           -1, -1, FALSE,
+    IMG_SELF
+  },
+  {
+    EL_ANY_ELEMENT,                    -1, -1, FALSE,
+    IMG_ANY_ELEMENT
+  },
   {
     EL_EMC_KEY_5,                      -1, -1, FALSE,
     IMG_EMC_KEY_5
index 825dc7a687bd840b147cfbcb18fa1498e5ab749e..e671b394a8f7bf80f952484ce78685727b71566d 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 74b6a1cc6ca78071ff12d4ec2715398298b1968c..267069019954fee1ef4cd05433408c0fcfec9d56 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 404adc6f0b8628ca10672923024398d74f322560..bc2f1d017cd43f6453c2797d47e08597db5dad1b 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 1ad1b39ef8f5289265f122bdf4555781f23ffd65..1be3ed4fd7f81d8f406bb08c7d3907075839c394 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 703f1453dbb59ccfcf1c5d18a89963568b2b37b2..059f81187b79139cc768e555ec005f9203adab0d 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index a0ce19ebb8ce5c2d26e78c5ff6c2c2c9def749cc..3596063daf7e129e9721f55927b7a32fa7d1d682 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -3484,6 +3484,96 @@ struct ConfigInfo image_config[] =
   { "current_ce_score.ypos",                   "12"                    },
   { "current_ce_score.frames",                 "1"                     },
 
+  { "last_ce_1",                               "RocksMore.pcx"         },
+  { "last_ce_1.xpos",                          "0"                     },
+  { "last_ce_1.ypos",                          "7"                     },
+  { "last_ce_1.frames",                                "1"                     },
+
+  { "last_ce_2",                               "RocksMore.pcx"         },
+  { "last_ce_2.xpos",                          "1"                     },
+  { "last_ce_2.ypos",                          "7"                     },
+  { "last_ce_2.frames",                                "1"                     },
+
+  { "last_ce_3",                               "RocksMore.pcx"         },
+  { "last_ce_3.xpos",                          "2"                     },
+  { "last_ce_3.ypos",                          "7"                     },
+  { "last_ce_3.frames",                                "1"                     },
+
+  { "last_ce_4",                               "RocksMore.pcx"         },
+  { "last_ce_4.xpos",                          "3"                     },
+  { "last_ce_4.ypos",                          "7"                     },
+  { "last_ce_4.frames",                                "1"                     },
+
+  { "last_ce_5",                               "RocksMore.pcx"         },
+  { "last_ce_5.xpos",                          "4"                     },
+  { "last_ce_5.ypos",                          "7"                     },
+  { "last_ce_5.frames",                                "1"                     },
+
+  { "last_ce_6",                               "RocksMore.pcx"         },
+  { "last_ce_6.xpos",                          "5"                     },
+  { "last_ce_6.ypos",                          "7"                     },
+  { "last_ce_6.frames",                                "1"                     },
+
+  { "last_ce_7",                               "RocksMore.pcx"         },
+  { "last_ce_7.xpos",                          "6"                     },
+  { "last_ce_7.ypos",                          "7"                     },
+  { "last_ce_7.frames",                                "1"                     },
+
+  { "last_ce_8",                               "RocksMore.pcx"         },
+  { "last_ce_8.xpos",                          "7"                     },
+  { "last_ce_8.ypos",                          "7"                     },
+  { "last_ce_8.frames",                                "1"                     },
+
+  { "next_ce_1",                               "RocksMore.pcx"         },
+  { "next_ce_1.xpos",                          "0"                     },
+  { "next_ce_1.ypos",                          "8"                     },
+  { "next_ce_1.frames",                                "1"                     },
+
+  { "next_ce_2",                               "RocksMore.pcx"         },
+  { "next_ce_2.xpos",                          "1"                     },
+  { "next_ce_2.ypos",                          "8"                     },
+  { "next_ce_2.frames",                                "1"                     },
+
+  { "next_ce_3",                               "RocksMore.pcx"         },
+  { "next_ce_3.xpos",                          "2"                     },
+  { "next_ce_3.ypos",                          "8"                     },
+  { "next_ce_3.frames",                                "1"                     },
+
+  { "next_ce_4",                               "RocksMore.pcx"         },
+  { "next_ce_4.xpos",                          "3"                     },
+  { "next_ce_4.ypos",                          "8"                     },
+  { "next_ce_4.frames",                                "1"                     },
+
+  { "next_ce_5",                               "RocksMore.pcx"         },
+  { "next_ce_5.xpos",                          "4"                     },
+  { "next_ce_5.ypos",                          "8"                     },
+  { "next_ce_5.frames",                                "1"                     },
+
+  { "next_ce_6",                               "RocksMore.pcx"         },
+  { "next_ce_6.xpos",                          "5"                     },
+  { "next_ce_6.ypos",                          "8"                     },
+  { "next_ce_6.frames",                                "1"                     },
+
+  { "next_ce_7",                               "RocksMore.pcx"         },
+  { "next_ce_7.xpos",                          "6"                     },
+  { "next_ce_7.ypos",                          "8"                     },
+  { "next_ce_7.frames",                                "1"                     },
+
+  { "next_ce_8",                               "RocksMore.pcx"         },
+  { "next_ce_8.xpos",                          "7"                     },
+  { "next_ce_8.ypos",                          "8"                     },
+  { "next_ce_8.frames",                                "1"                     },
+
+  { "self",                                    "RocksMore.pcx"         },
+  { "self.xpos",                               "8"                     },
+  { "self.ypos",                               "7"                     },
+  { "self.frames",                             "1"                     },
+
+  { "any_element",                             "RocksMore.pcx"         },
+  { "any_element.xpos",                                "9"                     },
+  { "any_element.ypos",                                "7"                     },
+  { "any_element.frames",                      "1"                     },
+
   { "emc_key_5",                               "RocksEMC.pcx"          },
   { "emc_key_5.xpos",                          "0"                     },
   { "emc_key_5.ypos",                          "5"                     },
@@ -4445,6 +4535,9 @@ struct ConfigInfo image_config[] =
   { "menu.list_size.SCORES",                   "-1"                    },
   { "menu.list_size.INFO",                     "-1"                    },
 
+  { "menu.fade_delay",                         "250"                   },
+  { "menu.post_delay",                         "125"                   },
+
   { "door_1.width",                            "-1"                    },
   { "door_1.height",                           "-1"                    },
   { "door_1.step_offset",                      "2"                     },
@@ -4457,6 +4550,27 @@ struct ConfigInfo image_config[] =
   { "door_2.step_delay",                       "10"                    },
   { "door_2.anim_mode",                                "default"               },
 
+  { "preview.x",                               "148"                   },
+  { "preview.y",                               "388"                   },
+  { "preview.xsize",                           "66"                    },
+  { "preview.ysize",                           "34"                    },
+  { "preview.tile_size",                       "4"                     },
+  { "preview.step_offset",                     "1"                     },
+  { "preview.step_delay",                      "50"                    },
+
+  { "game.panel.level.x",                      "37"                    },
+  { "game.panel.level.y",                      "20"                    },
+  { "game.panel.gems.x",                       "29"                    },
+  { "game.panel.gems.y",                       "54"                    },
+  { "game.panel.inventory.x",                  "29"                    },
+  { "game.panel.inventory.y",                  "89"                    },
+  { "game.panel.keys.x",                       "18"                    },
+  { "game.panel.keys.y",                       "123"                   },
+  { "game.panel.score.x",                      "15"                    },
+  { "game.panel.score.y",                      "159"                   },
+  { "game.panel.time.x",                       "29"                    },
+  { "game.panel.time.y",                       "194"                   },
+
   { "[player].boring_delay_fixed",             "1000"                  },
   { "[player].boring_delay_random",            "1000"                  },
   { "[player].sleeping_delay_fixed",           "2000"                  },
index 49ea014a80b412fbd007b19315f5d72229087d39..06f4ffe6352c63f1ce4991234980e7a4b475ad21 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
 #define IMG_TRIGGER_CE_SCORE                           703
 #define IMG_CURRENT_CE_VALUE                           704
 #define IMG_CURRENT_CE_SCORE                           705
-#define IMG_EMC_KEY_5                                  706
-#define IMG_EMC_KEY_6                                  707
-#define IMG_EMC_KEY_7                                  708
-#define IMG_EMC_KEY_8                                  709
-#define IMG_EMC_GATE_5                                 710
-#define IMG_EMC_GATE_6                                 711
-#define IMG_EMC_GATE_7                                 712
-#define IMG_EMC_GATE_8                                 713
-#define IMG_EMC_GATE_5_GRAY                            714
-#define IMG_EMC_GATE_5_GRAY_EDITOR                     715
-#define IMG_EMC_GATE_5_GRAY_ACTIVE                     716
-#define IMG_EMC_GATE_6_GRAY                            717
-#define IMG_EMC_GATE_6_GRAY_EDITOR                     718
-#define IMG_EMC_GATE_6_GRAY_ACTIVE                     719
-#define IMG_EMC_GATE_7_GRAY                            720
-#define IMG_EMC_GATE_7_GRAY_EDITOR                     721
-#define IMG_EMC_GATE_7_GRAY_ACTIVE                     722
-#define IMG_EMC_GATE_8_GRAY                            723
-#define IMG_EMC_GATE_8_GRAY_EDITOR                     724
-#define IMG_EMC_GATE_8_GRAY_ACTIVE                     725
-#define IMG_EMC_ANDROID                                        726
-#define IMG_EMC_ANDROID_SHRINKING_UPLEFT               727
-#define IMG_EMC_ANDROID_GROWING_DOWNRIGHT              728
-#define IMG_EMC_ANDROID_SHRINKING_DOWNLEFT             729
-#define IMG_EMC_ANDROID_GROWING_UPRIGHT                        730
-#define IMG_EMC_ANDROID_SHRINKING_UPRIGHT              731
-#define IMG_EMC_ANDROID_GROWING_DOWNLEFT               732
-#define IMG_EMC_ANDROID_SHRINKING_DOWNRIGHT            733
-#define IMG_EMC_ANDROID_GROWING_UPLEFT                 734
-#define IMG_EMC_GRASS                                  735
-#define IMG_EMC_GRASS_CRUMBLED                         736
-#define IMG_EMC_GRASS_DIGGING_LEFT                     737
-#define IMG_EMC_GRASS_DIGGING_RIGHT                    738
-#define IMG_EMC_GRASS_DIGGING_UP                       739
-#define IMG_EMC_GRASS_DIGGING_DOWN                     740
-#define IMG_EMC_GRASS_DIGGING_LEFT_CRUMBLED            741
-#define IMG_EMC_GRASS_DIGGING_RIGHT_CRUMBLED           742
-#define IMG_EMC_GRASS_DIGGING_UP_CRUMBLED              743
-#define IMG_EMC_GRASS_DIGGING_DOWN_CRUMBLED            744
-#define IMG_EMC_MAGIC_BALL                             745
-#define IMG_EMC_MAGIC_BALL_ACTIVE                      746
-#define IMG_EMC_MAGIC_BALL_DROPPING                    747
-#define IMG_EMC_MAGIC_BALL_SWITCH                      748
-#define IMG_EMC_MAGIC_BALL_SWITCH_ACTIVE               749
-#define IMG_EMC_SPRING_BUMPER                          750
-#define IMG_EMC_SPRING_BUMPER_ACTIVE                   751
-#define IMG_EMC_PLANT                                  752
-#define IMG_EMC_PLANT_CRUMBLED                         753
-#define IMG_EMC_LENSES                                 754
-#define IMG_EMC_MAGNIFIER                              755
-#define IMG_EMC_WALL_9                                 756
-#define IMG_EMC_WALL_10                                        757
-#define IMG_EMC_WALL_11                                        758
-#define IMG_EMC_WALL_12                                        759
-#define IMG_EMC_WALL_13                                        760
-#define IMG_EMC_WALL_14                                        761
-#define IMG_EMC_WALL_15                                        762
-#define IMG_EMC_WALL_16                                        763
-#define IMG_EMC_WALL_SLIPPERY_1                                764
-#define IMG_EMC_WALL_SLIPPERY_2                                765
-#define IMG_EMC_WALL_SLIPPERY_3                                766
-#define IMG_EMC_WALL_SLIPPERY_4                                767
-#define IMG_EMC_FAKE_GRASS                             768
-#define IMG_EMC_FAKE_GRASS_CRUMBLED                    769
-#define IMG_EMC_FAKE_GRASS_ACTIVE                      770
-#define IMG_EMC_FAKE_GRASS_ACTIVE_CRUMBLED             771
-#define IMG_EMC_FAKE_GRASS_EDITOR                      772
-#define IMG_EMC_FAKE_ACID                              773
-#define IMG_EMC_DRIPPER                                        774
-#define IMG_EMC_DRIPPER_EDITOR                         775
-#define IMG_EMC_DRIPPER_ACTIVE                         776
-#define IMG_CHAR_SPACE                                 777
-#define IMG_CHAR_EXCLAM                                        778
-#define IMG_CHAR_QUOTEDBL                              779
-#define IMG_CHAR_NUMBERSIGN                            780
-#define IMG_CHAR_DOLLAR                                        781
-#define IMG_CHAR_PERCENT                               782
-#define IMG_CHAR_AMPERSAND                             783
-#define IMG_CHAR_APOSTROPHE                            784
-#define IMG_CHAR_PARENLEFT                             785
-#define IMG_CHAR_PARENRIGHT                            786
-#define IMG_CHAR_ASTERISK                              787
-#define IMG_CHAR_PLUS                                  788
-#define IMG_CHAR_COMMA                                 789
-#define IMG_CHAR_MINUS                                 790
-#define IMG_CHAR_PERIOD                                        791
-#define IMG_CHAR_SLASH                                 792
-#define IMG_CHAR_0                                     793
-#define IMG_CHAR_1                                     794
-#define IMG_CHAR_2                                     795
-#define IMG_CHAR_3                                     796
-#define IMG_CHAR_4                                     797
-#define IMG_CHAR_5                                     798
-#define IMG_CHAR_6                                     799
-#define IMG_CHAR_7                                     800
-#define IMG_CHAR_8                                     801
-#define IMG_CHAR_9                                     802
-#define IMG_CHAR_COLON                                 803
-#define IMG_CHAR_SEMICOLON                             804
-#define IMG_CHAR_LESS                                  805
-#define IMG_CHAR_EQUAL                                 806
-#define IMG_CHAR_GREATER                               807
-#define IMG_CHAR_QUESTION                              808
-#define IMG_CHAR_AT                                    809
-#define IMG_CHAR_A                                     810
-#define IMG_CHAR_B                                     811
-#define IMG_CHAR_C                                     812
-#define IMG_CHAR_D                                     813
-#define IMG_CHAR_E                                     814
-#define IMG_CHAR_F                                     815
-#define IMG_CHAR_G                                     816
-#define IMG_CHAR_H                                     817
-#define IMG_CHAR_I                                     818
-#define IMG_CHAR_J                                     819
-#define IMG_CHAR_K                                     820
-#define IMG_CHAR_L                                     821
-#define IMG_CHAR_M                                     822
-#define IMG_CHAR_N                                     823
-#define IMG_CHAR_O                                     824
-#define IMG_CHAR_P                                     825
-#define IMG_CHAR_Q                                     826
-#define IMG_CHAR_R                                     827
-#define IMG_CHAR_S                                     828
-#define IMG_CHAR_T                                     829
-#define IMG_CHAR_U                                     830
-#define IMG_CHAR_V                                     831
-#define IMG_CHAR_W                                     832
-#define IMG_CHAR_X                                     833
-#define IMG_CHAR_Y                                     834
-#define IMG_CHAR_Z                                     835
-#define IMG_CHAR_BRACKETLEFT                           836
-#define IMG_CHAR_BACKSLASH                             837
-#define IMG_CHAR_BRACKETRIGHT                          838
-#define IMG_CHAR_ASCIICIRCUM                           839
-#define IMG_CHAR_UNDERSCORE                            840
-#define IMG_CHAR_COPYRIGHT                             841
-#define IMG_CHAR_AUMLAUT                               842
-#define IMG_CHAR_OUMLAUT                               843
-#define IMG_CHAR_UUMLAUT                               844
-#define IMG_CHAR_DEGREE                                        845
-#define IMG_CHAR_TRADEMARK                             846
-#define IMG_CHAR_CURSOR                                        847
-#define IMG_CUSTOM_1                                   848
-#define IMG_CUSTOM_1_EDITOR                            849
-#define IMG_CUSTOM_2                                   850
-#define IMG_CUSTOM_2_EDITOR                            851
-#define IMG_CUSTOM_3                                   852
-#define IMG_CUSTOM_3_EDITOR                            853
-#define IMG_CUSTOM_4                                   854
-#define IMG_CUSTOM_4_EDITOR                            855
-#define IMG_CUSTOM_5                                   856
-#define IMG_CUSTOM_5_EDITOR                            857
-#define IMG_CUSTOM_6                                   858
-#define IMG_CUSTOM_6_EDITOR                            859
-#define IMG_CUSTOM_7                                   860
-#define IMG_CUSTOM_7_EDITOR                            861
-#define IMG_CUSTOM_8                                   862
-#define IMG_CUSTOM_8_EDITOR                            863
-#define IMG_CUSTOM_9                                   864
-#define IMG_CUSTOM_9_EDITOR                            865
-#define IMG_CUSTOM_10                                  866
-#define IMG_CUSTOM_10_EDITOR                           867
-#define IMG_CUSTOM_11                                  868
-#define IMG_CUSTOM_11_EDITOR                           869
-#define IMG_CUSTOM_12                                  870
-#define IMG_CUSTOM_12_EDITOR                           871
-#define IMG_CUSTOM_13                                  872
-#define IMG_CUSTOM_13_EDITOR                           873
-#define IMG_CUSTOM_14                                  874
-#define IMG_CUSTOM_14_EDITOR                           875
-#define IMG_CUSTOM_15                                  876
-#define IMG_CUSTOM_15_EDITOR                           877
-#define IMG_CUSTOM_16                                  878
-#define IMG_CUSTOM_16_EDITOR                           879
-#define IMG_CUSTOM_17                                  880
-#define IMG_CUSTOM_17_EDITOR                           881
-#define IMG_CUSTOM_18                                  882
-#define IMG_CUSTOM_18_EDITOR                           883
-#define IMG_CUSTOM_19                                  884
-#define IMG_CUSTOM_19_EDITOR                           885
-#define IMG_CUSTOM_20                                  886
-#define IMG_CUSTOM_20_EDITOR                           887
-#define IMG_CUSTOM_21                                  888
-#define IMG_CUSTOM_21_EDITOR                           889
-#define IMG_CUSTOM_22                                  890
-#define IMG_CUSTOM_22_EDITOR                           891
-#define IMG_CUSTOM_23                                  892
-#define IMG_CUSTOM_23_EDITOR                           893
-#define IMG_CUSTOM_24                                  894
-#define IMG_CUSTOM_24_EDITOR                           895
-#define IMG_CUSTOM_25                                  896
-#define IMG_CUSTOM_25_EDITOR                           897
-#define IMG_CUSTOM_26                                  898
-#define IMG_CUSTOM_26_EDITOR                           899
-#define IMG_CUSTOM_27                                  900
-#define IMG_CUSTOM_27_EDITOR                           901
-#define IMG_CUSTOM_28                                  902
-#define IMG_CUSTOM_28_EDITOR                           903
-#define IMG_CUSTOM_29                                  904
-#define IMG_CUSTOM_29_EDITOR                           905
-#define IMG_CUSTOM_30                                  906
-#define IMG_CUSTOM_30_EDITOR                           907
-#define IMG_CUSTOM_31                                  908
-#define IMG_CUSTOM_31_EDITOR                           909
-#define IMG_CUSTOM_32                                  910
-#define IMG_CUSTOM_32_EDITOR                           911
-#define IMG_CUSTOM_33                                  912
-#define IMG_CUSTOM_33_EDITOR                           913
-#define IMG_CUSTOM_34                                  914
-#define IMG_CUSTOM_34_EDITOR                           915
-#define IMG_CUSTOM_35                                  916
-#define IMG_CUSTOM_35_EDITOR                           917
-#define IMG_CUSTOM_36                                  918
-#define IMG_CUSTOM_36_EDITOR                           919
-#define IMG_CUSTOM_37                                  920
-#define IMG_CUSTOM_37_EDITOR                           921
-#define IMG_CUSTOM_38                                  922
-#define IMG_CUSTOM_38_EDITOR                           923
-#define IMG_CUSTOM_39                                  924
-#define IMG_CUSTOM_39_EDITOR                           925
-#define IMG_CUSTOM_40                                  926
-#define IMG_CUSTOM_40_EDITOR                           927
-#define IMG_CUSTOM_41                                  928
-#define IMG_CUSTOM_41_EDITOR                           929
-#define IMG_CUSTOM_42                                  930
-#define IMG_CUSTOM_42_EDITOR                           931
-#define IMG_CUSTOM_43                                  932
-#define IMG_CUSTOM_43_EDITOR                           933
-#define IMG_CUSTOM_44                                  934
-#define IMG_CUSTOM_44_EDITOR                           935
-#define IMG_CUSTOM_45                                  936
-#define IMG_CUSTOM_45_EDITOR                           937
-#define IMG_CUSTOM_46                                  938
-#define IMG_CUSTOM_46_EDITOR                           939
-#define IMG_CUSTOM_47                                  940
-#define IMG_CUSTOM_47_EDITOR                           941
-#define IMG_CUSTOM_48                                  942
-#define IMG_CUSTOM_48_EDITOR                           943
-#define IMG_CUSTOM_49                                  944
-#define IMG_CUSTOM_49_EDITOR                           945
-#define IMG_CUSTOM_50                                  946
-#define IMG_CUSTOM_50_EDITOR                           947
-#define IMG_CUSTOM_51                                  948
-#define IMG_CUSTOM_51_EDITOR                           949
-#define IMG_CUSTOM_52                                  950
-#define IMG_CUSTOM_52_EDITOR                           951
-#define IMG_CUSTOM_53                                  952
-#define IMG_CUSTOM_53_EDITOR                           953
-#define IMG_CUSTOM_54                                  954
-#define IMG_CUSTOM_54_EDITOR                           955
-#define IMG_CUSTOM_55                                  956
-#define IMG_CUSTOM_55_EDITOR                           957
-#define IMG_CUSTOM_56                                  958
-#define IMG_CUSTOM_56_EDITOR                           959
-#define IMG_CUSTOM_57                                  960
-#define IMG_CUSTOM_57_EDITOR                           961
-#define IMG_CUSTOM_58                                  962
-#define IMG_CUSTOM_58_EDITOR                           963
-#define IMG_CUSTOM_59                                  964
-#define IMG_CUSTOM_59_EDITOR                           965
-#define IMG_CUSTOM_60                                  966
-#define IMG_CUSTOM_60_EDITOR                           967
-#define IMG_CUSTOM_61                                  968
-#define IMG_CUSTOM_61_EDITOR                           969
-#define IMG_CUSTOM_62                                  970
-#define IMG_CUSTOM_62_EDITOR                           971
-#define IMG_CUSTOM_63                                  972
-#define IMG_CUSTOM_63_EDITOR                           973
-#define IMG_CUSTOM_64                                  974
-#define IMG_CUSTOM_64_EDITOR                           975
-#define IMG_CUSTOM_65                                  976
-#define IMG_CUSTOM_65_EDITOR                           977
-#define IMG_CUSTOM_66                                  978
-#define IMG_CUSTOM_66_EDITOR                           979
-#define IMG_CUSTOM_67                                  980
-#define IMG_CUSTOM_67_EDITOR                           981
-#define IMG_CUSTOM_68                                  982
-#define IMG_CUSTOM_68_EDITOR                           983
-#define IMG_CUSTOM_69                                  984
-#define IMG_CUSTOM_69_EDITOR                           985
-#define IMG_CUSTOM_70                                  986
-#define IMG_CUSTOM_70_EDITOR                           987
-#define IMG_CUSTOM_71                                  988
-#define IMG_CUSTOM_71_EDITOR                           989
-#define IMG_CUSTOM_72                                  990
-#define IMG_CUSTOM_72_EDITOR                           991
-#define IMG_CUSTOM_73                                  992
-#define IMG_CUSTOM_73_EDITOR                           993
-#define IMG_CUSTOM_74                                  994
-#define IMG_CUSTOM_74_EDITOR                           995
-#define IMG_CUSTOM_75                                  996
-#define IMG_CUSTOM_75_EDITOR                           997
-#define IMG_CUSTOM_76                                  998
-#define IMG_CUSTOM_76_EDITOR                           999
-#define IMG_CUSTOM_77                                  1000
-#define IMG_CUSTOM_77_EDITOR                           1001
-#define IMG_CUSTOM_78                                  1002
-#define IMG_CUSTOM_78_EDITOR                           1003
-#define IMG_CUSTOM_79                                  1004
-#define IMG_CUSTOM_79_EDITOR                           1005
-#define IMG_CUSTOM_80                                  1006
-#define IMG_CUSTOM_80_EDITOR                           1007
-#define IMG_CUSTOM_81                                  1008
-#define IMG_CUSTOM_81_EDITOR                           1009
-#define IMG_CUSTOM_82                                  1010
-#define IMG_CUSTOM_82_EDITOR                           1011
-#define IMG_CUSTOM_83                                  1012
-#define IMG_CUSTOM_83_EDITOR                           1013
-#define IMG_CUSTOM_84                                  1014
-#define IMG_CUSTOM_84_EDITOR                           1015
-#define IMG_CUSTOM_85                                  1016
-#define IMG_CUSTOM_85_EDITOR                           1017
-#define IMG_CUSTOM_86                                  1018
-#define IMG_CUSTOM_86_EDITOR                           1019
-#define IMG_CUSTOM_87                                  1020
-#define IMG_CUSTOM_87_EDITOR                           1021
-#define IMG_CUSTOM_88                                  1022
-#define IMG_CUSTOM_88_EDITOR                           1023
-#define IMG_CUSTOM_89                                  1024
-#define IMG_CUSTOM_89_EDITOR                           1025
-#define IMG_CUSTOM_90                                  1026
-#define IMG_CUSTOM_90_EDITOR                           1027
-#define IMG_CUSTOM_91                                  1028
-#define IMG_CUSTOM_91_EDITOR                           1029
-#define IMG_CUSTOM_92                                  1030
-#define IMG_CUSTOM_92_EDITOR                           1031
-#define IMG_CUSTOM_93                                  1032
-#define IMG_CUSTOM_93_EDITOR                           1033
-#define IMG_CUSTOM_94                                  1034
-#define IMG_CUSTOM_94_EDITOR                           1035
-#define IMG_CUSTOM_95                                  1036
-#define IMG_CUSTOM_95_EDITOR                           1037
-#define IMG_CUSTOM_96                                  1038
-#define IMG_CUSTOM_96_EDITOR                           1039
-#define IMG_CUSTOM_97                                  1040
-#define IMG_CUSTOM_97_EDITOR                           1041
-#define IMG_CUSTOM_98                                  1042
-#define IMG_CUSTOM_98_EDITOR                           1043
-#define IMG_CUSTOM_99                                  1044
-#define IMG_CUSTOM_99_EDITOR                           1045
-#define IMG_CUSTOM_100                                 1046
-#define IMG_CUSTOM_100_EDITOR                          1047
-#define IMG_CUSTOM_101                                 1048
-#define IMG_CUSTOM_101_EDITOR                          1049
-#define IMG_CUSTOM_102                                 1050
-#define IMG_CUSTOM_102_EDITOR                          1051
-#define IMG_CUSTOM_103                                 1052
-#define IMG_CUSTOM_103_EDITOR                          1053
-#define IMG_CUSTOM_104                                 1054
-#define IMG_CUSTOM_104_EDITOR                          1055
-#define IMG_CUSTOM_105                                 1056
-#define IMG_CUSTOM_105_EDITOR                          1057
-#define IMG_CUSTOM_106                                 1058
-#define IMG_CUSTOM_106_EDITOR                          1059
-#define IMG_CUSTOM_107                                 1060
-#define IMG_CUSTOM_107_EDITOR                          1061
-#define IMG_CUSTOM_108                                 1062
-#define IMG_CUSTOM_108_EDITOR                          1063
-#define IMG_CUSTOM_109                                 1064
-#define IMG_CUSTOM_109_EDITOR                          1065
-#define IMG_CUSTOM_110                                 1066
-#define IMG_CUSTOM_110_EDITOR                          1067
-#define IMG_CUSTOM_111                                 1068
-#define IMG_CUSTOM_111_EDITOR                          1069
-#define IMG_CUSTOM_112                                 1070
-#define IMG_CUSTOM_112_EDITOR                          1071
-#define IMG_CUSTOM_113                                 1072
-#define IMG_CUSTOM_113_EDITOR                          1073
-#define IMG_CUSTOM_114                                 1074
-#define IMG_CUSTOM_114_EDITOR                          1075
-#define IMG_CUSTOM_115                                 1076
-#define IMG_CUSTOM_115_EDITOR                          1077
-#define IMG_CUSTOM_116                                 1078
-#define IMG_CUSTOM_116_EDITOR                          1079
-#define IMG_CUSTOM_117                                 1080
-#define IMG_CUSTOM_117_EDITOR                          1081
-#define IMG_CUSTOM_118                                 1082
-#define IMG_CUSTOM_118_EDITOR                          1083
-#define IMG_CUSTOM_119                                 1084
-#define IMG_CUSTOM_119_EDITOR                          1085
-#define IMG_CUSTOM_120                                 1086
-#define IMG_CUSTOM_120_EDITOR                          1087
-#define IMG_CUSTOM_121                                 1088
-#define IMG_CUSTOM_121_EDITOR                          1089
-#define IMG_CUSTOM_122                                 1090
-#define IMG_CUSTOM_122_EDITOR                          1091
-#define IMG_CUSTOM_123                                 1092
-#define IMG_CUSTOM_123_EDITOR                          1093
-#define IMG_CUSTOM_124                                 1094
-#define IMG_CUSTOM_124_EDITOR                          1095
-#define IMG_CUSTOM_125                                 1096
-#define IMG_CUSTOM_125_EDITOR                          1097
-#define IMG_CUSTOM_126                                 1098
-#define IMG_CUSTOM_126_EDITOR                          1099
-#define IMG_CUSTOM_127                                 1100
-#define IMG_CUSTOM_127_EDITOR                          1101
-#define IMG_CUSTOM_128                                 1102
-#define IMG_CUSTOM_128_EDITOR                          1103
-#define IMG_CUSTOM_129                                 1104
-#define IMG_CUSTOM_129_EDITOR                          1105
-#define IMG_CUSTOM_130                                 1106
-#define IMG_CUSTOM_130_EDITOR                          1107
-#define IMG_CUSTOM_131                                 1108
-#define IMG_CUSTOM_131_EDITOR                          1109
-#define IMG_CUSTOM_132                                 1110
-#define IMG_CUSTOM_132_EDITOR                          1111
-#define IMG_CUSTOM_133                                 1112
-#define IMG_CUSTOM_133_EDITOR                          1113
-#define IMG_CUSTOM_134                                 1114
-#define IMG_CUSTOM_134_EDITOR                          1115
-#define IMG_CUSTOM_135                                 1116
-#define IMG_CUSTOM_135_EDITOR                          1117
-#define IMG_CUSTOM_136                                 1118
-#define IMG_CUSTOM_136_EDITOR                          1119
-#define IMG_CUSTOM_137                                 1120
-#define IMG_CUSTOM_137_EDITOR                          1121
-#define IMG_CUSTOM_138                                 1122
-#define IMG_CUSTOM_138_EDITOR                          1123
-#define IMG_CUSTOM_139                                 1124
-#define IMG_CUSTOM_139_EDITOR                          1125
-#define IMG_CUSTOM_140                                 1126
-#define IMG_CUSTOM_140_EDITOR                          1127
-#define IMG_CUSTOM_141                                 1128
-#define IMG_CUSTOM_141_EDITOR                          1129
-#define IMG_CUSTOM_142                                 1130
-#define IMG_CUSTOM_142_EDITOR                          1131
-#define IMG_CUSTOM_143                                 1132
-#define IMG_CUSTOM_143_EDITOR                          1133
-#define IMG_CUSTOM_144                                 1134
-#define IMG_CUSTOM_144_EDITOR                          1135
-#define IMG_CUSTOM_145                                 1136
-#define IMG_CUSTOM_145_EDITOR                          1137
-#define IMG_CUSTOM_146                                 1138
-#define IMG_CUSTOM_146_EDITOR                          1139
-#define IMG_CUSTOM_147                                 1140
-#define IMG_CUSTOM_147_EDITOR                          1141
-#define IMG_CUSTOM_148                                 1142
-#define IMG_CUSTOM_148_EDITOR                          1143
-#define IMG_CUSTOM_149                                 1144
-#define IMG_CUSTOM_149_EDITOR                          1145
-#define IMG_CUSTOM_150                                 1146
-#define IMG_CUSTOM_150_EDITOR                          1147
-#define IMG_CUSTOM_151                                 1148
-#define IMG_CUSTOM_151_EDITOR                          1149
-#define IMG_CUSTOM_152                                 1150
-#define IMG_CUSTOM_152_EDITOR                          1151
-#define IMG_CUSTOM_153                                 1152
-#define IMG_CUSTOM_153_EDITOR                          1153
-#define IMG_CUSTOM_154                                 1154
-#define IMG_CUSTOM_154_EDITOR                          1155
-#define IMG_CUSTOM_155                                 1156
-#define IMG_CUSTOM_155_EDITOR                          1157
-#define IMG_CUSTOM_156                                 1158
-#define IMG_CUSTOM_156_EDITOR                          1159
-#define IMG_CUSTOM_157                                 1160
-#define IMG_CUSTOM_157_EDITOR                          1161
-#define IMG_CUSTOM_158                                 1162
-#define IMG_CUSTOM_158_EDITOR                          1163
-#define IMG_CUSTOM_159                                 1164
-#define IMG_CUSTOM_159_EDITOR                          1165
-#define IMG_CUSTOM_160                                 1166
-#define IMG_CUSTOM_160_EDITOR                          1167
-#define IMG_CUSTOM_161                                 1168
-#define IMG_CUSTOM_161_EDITOR                          1169
-#define IMG_CUSTOM_162                                 1170
-#define IMG_CUSTOM_162_EDITOR                          1171
-#define IMG_CUSTOM_163                                 1172
-#define IMG_CUSTOM_163_EDITOR                          1173
-#define IMG_CUSTOM_164                                 1174
-#define IMG_CUSTOM_164_EDITOR                          1175
-#define IMG_CUSTOM_165                                 1176
-#define IMG_CUSTOM_165_EDITOR                          1177
-#define IMG_CUSTOM_166                                 1178
-#define IMG_CUSTOM_166_EDITOR                          1179
-#define IMG_CUSTOM_167                                 1180
-#define IMG_CUSTOM_167_EDITOR                          1181
-#define IMG_CUSTOM_168                                 1182
-#define IMG_CUSTOM_168_EDITOR                          1183
-#define IMG_CUSTOM_169                                 1184
-#define IMG_CUSTOM_169_EDITOR                          1185
-#define IMG_CUSTOM_170                                 1186
-#define IMG_CUSTOM_170_EDITOR                          1187
-#define IMG_CUSTOM_171                                 1188
-#define IMG_CUSTOM_171_EDITOR                          1189
-#define IMG_CUSTOM_172                                 1190
-#define IMG_CUSTOM_172_EDITOR                          1191
-#define IMG_CUSTOM_173                                 1192
-#define IMG_CUSTOM_173_EDITOR                          1193
-#define IMG_CUSTOM_174                                 1194
-#define IMG_CUSTOM_174_EDITOR                          1195
-#define IMG_CUSTOM_175                                 1196
-#define IMG_CUSTOM_175_EDITOR                          1197
-#define IMG_CUSTOM_176                                 1198
-#define IMG_CUSTOM_176_EDITOR                          1199
-#define IMG_CUSTOM_177                                 1200
-#define IMG_CUSTOM_177_EDITOR                          1201
-#define IMG_CUSTOM_178                                 1202
-#define IMG_CUSTOM_178_EDITOR                          1203
-#define IMG_CUSTOM_179                                 1204
-#define IMG_CUSTOM_179_EDITOR                          1205
-#define IMG_CUSTOM_180                                 1206
-#define IMG_CUSTOM_180_EDITOR                          1207
-#define IMG_CUSTOM_181                                 1208
-#define IMG_CUSTOM_181_EDITOR                          1209
-#define IMG_CUSTOM_182                                 1210
-#define IMG_CUSTOM_182_EDITOR                          1211
-#define IMG_CUSTOM_183                                 1212
-#define IMG_CUSTOM_183_EDITOR                          1213
-#define IMG_CUSTOM_184                                 1214
-#define IMG_CUSTOM_184_EDITOR                          1215
-#define IMG_CUSTOM_185                                 1216
-#define IMG_CUSTOM_185_EDITOR                          1217
-#define IMG_CUSTOM_186                                 1218
-#define IMG_CUSTOM_186_EDITOR                          1219
-#define IMG_CUSTOM_187                                 1220
-#define IMG_CUSTOM_187_EDITOR                          1221
-#define IMG_CUSTOM_188                                 1222
-#define IMG_CUSTOM_188_EDITOR                          1223
-#define IMG_CUSTOM_189                                 1224
-#define IMG_CUSTOM_189_EDITOR                          1225
-#define IMG_CUSTOM_190                                 1226
-#define IMG_CUSTOM_190_EDITOR                          1227
-#define IMG_CUSTOM_191                                 1228
-#define IMG_CUSTOM_191_EDITOR                          1229
-#define IMG_CUSTOM_192                                 1230
-#define IMG_CUSTOM_192_EDITOR                          1231
-#define IMG_CUSTOM_193                                 1232
-#define IMG_CUSTOM_193_EDITOR                          1233
-#define IMG_CUSTOM_194                                 1234
-#define IMG_CUSTOM_194_EDITOR                          1235
-#define IMG_CUSTOM_195                                 1236
-#define IMG_CUSTOM_195_EDITOR                          1237
-#define IMG_CUSTOM_196                                 1238
-#define IMG_CUSTOM_196_EDITOR                          1239
-#define IMG_CUSTOM_197                                 1240
-#define IMG_CUSTOM_197_EDITOR                          1241
-#define IMG_CUSTOM_198                                 1242
-#define IMG_CUSTOM_198_EDITOR                          1243
-#define IMG_CUSTOM_199                                 1244
-#define IMG_CUSTOM_199_EDITOR                          1245
-#define IMG_CUSTOM_200                                 1246
-#define IMG_CUSTOM_200_EDITOR                          1247
-#define IMG_CUSTOM_201                                 1248
-#define IMG_CUSTOM_201_EDITOR                          1249
-#define IMG_CUSTOM_202                                 1250
-#define IMG_CUSTOM_202_EDITOR                          1251
-#define IMG_CUSTOM_203                                 1252
-#define IMG_CUSTOM_203_EDITOR                          1253
-#define IMG_CUSTOM_204                                 1254
-#define IMG_CUSTOM_204_EDITOR                          1255
-#define IMG_CUSTOM_205                                 1256
-#define IMG_CUSTOM_205_EDITOR                          1257
-#define IMG_CUSTOM_206                                 1258
-#define IMG_CUSTOM_206_EDITOR                          1259
-#define IMG_CUSTOM_207                                 1260
-#define IMG_CUSTOM_207_EDITOR                          1261
-#define IMG_CUSTOM_208                                 1262
-#define IMG_CUSTOM_208_EDITOR                          1263
-#define IMG_CUSTOM_209                                 1264
-#define IMG_CUSTOM_209_EDITOR                          1265
-#define IMG_CUSTOM_210                                 1266
-#define IMG_CUSTOM_210_EDITOR                          1267
-#define IMG_CUSTOM_211                                 1268
-#define IMG_CUSTOM_211_EDITOR                          1269
-#define IMG_CUSTOM_212                                 1270
-#define IMG_CUSTOM_212_EDITOR                          1271
-#define IMG_CUSTOM_213                                 1272
-#define IMG_CUSTOM_213_EDITOR                          1273
-#define IMG_CUSTOM_214                                 1274
-#define IMG_CUSTOM_214_EDITOR                          1275
-#define IMG_CUSTOM_215                                 1276
-#define IMG_CUSTOM_215_EDITOR                          1277
-#define IMG_CUSTOM_216                                 1278
-#define IMG_CUSTOM_216_EDITOR                          1279
-#define IMG_CUSTOM_217                                 1280
-#define IMG_CUSTOM_217_EDITOR                          1281
-#define IMG_CUSTOM_218                                 1282
-#define IMG_CUSTOM_218_EDITOR                          1283
-#define IMG_CUSTOM_219                                 1284
-#define IMG_CUSTOM_219_EDITOR                          1285
-#define IMG_CUSTOM_220                                 1286
-#define IMG_CUSTOM_220_EDITOR                          1287
-#define IMG_CUSTOM_221                                 1288
-#define IMG_CUSTOM_221_EDITOR                          1289
-#define IMG_CUSTOM_222                                 1290
-#define IMG_CUSTOM_222_EDITOR                          1291
-#define IMG_CUSTOM_223                                 1292
-#define IMG_CUSTOM_223_EDITOR                          1293
-#define IMG_CUSTOM_224                                 1294
-#define IMG_CUSTOM_224_EDITOR                          1295
-#define IMG_CUSTOM_225                                 1296
-#define IMG_CUSTOM_225_EDITOR                          1297
-#define IMG_CUSTOM_226                                 1298
-#define IMG_CUSTOM_226_EDITOR                          1299
-#define IMG_CUSTOM_227                                 1300
-#define IMG_CUSTOM_227_EDITOR                          1301
-#define IMG_CUSTOM_228                                 1302
-#define IMG_CUSTOM_228_EDITOR                          1303
-#define IMG_CUSTOM_229                                 1304
-#define IMG_CUSTOM_229_EDITOR                          1305
-#define IMG_CUSTOM_230                                 1306
-#define IMG_CUSTOM_230_EDITOR                          1307
-#define IMG_CUSTOM_231                                 1308
-#define IMG_CUSTOM_231_EDITOR                          1309
-#define IMG_CUSTOM_232                                 1310
-#define IMG_CUSTOM_232_EDITOR                          1311
-#define IMG_CUSTOM_233                                 1312
-#define IMG_CUSTOM_233_EDITOR                          1313
-#define IMG_CUSTOM_234                                 1314
-#define IMG_CUSTOM_234_EDITOR                          1315
-#define IMG_CUSTOM_235                                 1316
-#define IMG_CUSTOM_235_EDITOR                          1317
-#define IMG_CUSTOM_236                                 1318
-#define IMG_CUSTOM_236_EDITOR                          1319
-#define IMG_CUSTOM_237                                 1320
-#define IMG_CUSTOM_237_EDITOR                          1321
-#define IMG_CUSTOM_238                                 1322
-#define IMG_CUSTOM_238_EDITOR                          1323
-#define IMG_CUSTOM_239                                 1324
-#define IMG_CUSTOM_239_EDITOR                          1325
-#define IMG_CUSTOM_240                                 1326
-#define IMG_CUSTOM_240_EDITOR                          1327
-#define IMG_CUSTOM_241                                 1328
-#define IMG_CUSTOM_241_EDITOR                          1329
-#define IMG_CUSTOM_242                                 1330
-#define IMG_CUSTOM_242_EDITOR                          1331
-#define IMG_CUSTOM_243                                 1332
-#define IMG_CUSTOM_243_EDITOR                          1333
-#define IMG_CUSTOM_244                                 1334
-#define IMG_CUSTOM_244_EDITOR                          1335
-#define IMG_CUSTOM_245                                 1336
-#define IMG_CUSTOM_245_EDITOR                          1337
-#define IMG_CUSTOM_246                                 1338
-#define IMG_CUSTOM_246_EDITOR                          1339
-#define IMG_CUSTOM_247                                 1340
-#define IMG_CUSTOM_247_EDITOR                          1341
-#define IMG_CUSTOM_248                                 1342
-#define IMG_CUSTOM_248_EDITOR                          1343
-#define IMG_CUSTOM_249                                 1344
-#define IMG_CUSTOM_249_EDITOR                          1345
-#define IMG_CUSTOM_250                                 1346
-#define IMG_CUSTOM_250_EDITOR                          1347
-#define IMG_CUSTOM_251                                 1348
-#define IMG_CUSTOM_251_EDITOR                          1349
-#define IMG_CUSTOM_252                                 1350
-#define IMG_CUSTOM_252_EDITOR                          1351
-#define IMG_CUSTOM_253                                 1352
-#define IMG_CUSTOM_253_EDITOR                          1353
-#define IMG_CUSTOM_254                                 1354
-#define IMG_CUSTOM_254_EDITOR                          1355
-#define IMG_CUSTOM_255                                 1356
-#define IMG_CUSTOM_255_EDITOR                          1357
-#define IMG_CUSTOM_256                                 1358
-#define IMG_CUSTOM_256_EDITOR                          1359
-#define IMG_GROUP_1                                    1360
-#define IMG_GROUP_1_EDITOR                             1361
-#define IMG_GROUP_2                                    1362
-#define IMG_GROUP_2_EDITOR                             1363
-#define IMG_GROUP_3                                    1364
-#define IMG_GROUP_3_EDITOR                             1365
-#define IMG_GROUP_4                                    1366
-#define IMG_GROUP_4_EDITOR                             1367
-#define IMG_GROUP_5                                    1368
-#define IMG_GROUP_5_EDITOR                             1369
-#define IMG_GROUP_6                                    1370
-#define IMG_GROUP_6_EDITOR                             1371
-#define IMG_GROUP_7                                    1372
-#define IMG_GROUP_7_EDITOR                             1373
-#define IMG_GROUP_8                                    1374
-#define IMG_GROUP_8_EDITOR                             1375
-#define IMG_GROUP_9                                    1376
-#define IMG_GROUP_9_EDITOR                             1377
-#define IMG_GROUP_10                                   1378
-#define IMG_GROUP_10_EDITOR                            1379
-#define IMG_GROUP_11                                   1380
-#define IMG_GROUP_11_EDITOR                            1381
-#define IMG_GROUP_12                                   1382
-#define IMG_GROUP_12_EDITOR                            1383
-#define IMG_GROUP_13                                   1384
-#define IMG_GROUP_13_EDITOR                            1385
-#define IMG_GROUP_14                                   1386
-#define IMG_GROUP_14_EDITOR                            1387
-#define IMG_GROUP_15                                   1388
-#define IMG_GROUP_15_EDITOR                            1389
-#define IMG_GROUP_16                                   1390
-#define IMG_GROUP_16_EDITOR                            1391
-#define IMG_GROUP_17                                   1392
-#define IMG_GROUP_17_EDITOR                            1393
-#define IMG_GROUP_18                                   1394
-#define IMG_GROUP_18_EDITOR                            1395
-#define IMG_GROUP_19                                   1396
-#define IMG_GROUP_19_EDITOR                            1397
-#define IMG_GROUP_20                                   1398
-#define IMG_GROUP_20_EDITOR                            1399
-#define IMG_GROUP_21                                   1400
-#define IMG_GROUP_21_EDITOR                            1401
-#define IMG_GROUP_22                                   1402
-#define IMG_GROUP_22_EDITOR                            1403
-#define IMG_GROUP_23                                   1404
-#define IMG_GROUP_23_EDITOR                            1405
-#define IMG_GROUP_24                                   1406
-#define IMG_GROUP_24_EDITOR                            1407
-#define IMG_GROUP_25                                   1408
-#define IMG_GROUP_25_EDITOR                            1409
-#define IMG_GROUP_26                                   1410
-#define IMG_GROUP_26_EDITOR                            1411
-#define IMG_GROUP_27                                   1412
-#define IMG_GROUP_27_EDITOR                            1413
-#define IMG_GROUP_28                                   1414
-#define IMG_GROUP_28_EDITOR                            1415
-#define IMG_GROUP_29                                   1416
-#define IMG_GROUP_29_EDITOR                            1417
-#define IMG_GROUP_30                                   1418
-#define IMG_GROUP_30_EDITOR                            1419
-#define IMG_GROUP_31                                   1420
-#define IMG_GROUP_31_EDITOR                            1421
-#define IMG_GROUP_32                                   1422
-#define IMG_GROUP_32_EDITOR                            1423
-#define IMG_EMC_OBJECT                                 1424
-#define IMG_EMC_SPRITE                                 1425
-#define IMG_TOON_1                                     1426
-#define IMG_TOON_2                                     1427
-#define IMG_TOON_3                                     1428
-#define IMG_TOON_4                                     1429
-#define IMG_TOON_5                                     1430
-#define IMG_TOON_6                                     1431
-#define IMG_TOON_7                                     1432
-#define IMG_TOON_8                                     1433
-#define IMG_TOON_9                                     1434
-#define IMG_TOON_10                                    1435
-#define IMG_TOON_11                                    1436
-#define IMG_TOON_12                                    1437
-#define IMG_TOON_13                                    1438
-#define IMG_TOON_14                                    1439
-#define IMG_TOON_15                                    1440
-#define IMG_TOON_16                                    1441
-#define IMG_TOON_17                                    1442
-#define IMG_TOON_18                                    1443
-#define IMG_TOON_19                                    1444
-#define IMG_TOON_20                                    1445
-#define IMG_MENU_CALIBRATE_RED                         1446
-#define IMG_MENU_CALIBRATE_BLUE                                1447
-#define IMG_MENU_CALIBRATE_YELLOW                      1448
-#define IMG_MENU_BUTTON                                        1449
-#define IMG_MENU_BUTTON_ACTIVE                         1450
-#define IMG_MENU_BUTTON_LEFT                           1451
-#define IMG_MENU_BUTTON_LEFT_ACTIVE                    1452
-#define IMG_MENU_BUTTON_RIGHT                          1453
-#define IMG_MENU_BUTTON_RIGHT_ACTIVE                   1454
-#define IMG_MENU_BUTTON_UP                             1455
-#define IMG_MENU_BUTTON_UP_ACTIVE                      1456
-#define IMG_MENU_BUTTON_DOWN                           1457
-#define IMG_MENU_BUTTON_DOWN_ACTIVE                    1458
-#define IMG_MENU_BUTTON_ENTER_MENU                     1459
-#define IMG_MENU_BUTTON_ENTER_MENU_ACTIVE              1460
-#define IMG_MENU_BUTTON_LEAVE_MENU                     1461
-#define IMG_MENU_BUTTON_LEAVE_MENU_ACTIVE              1462
-#define IMG_MENU_BUTTON_NEXT_LEVEL                     1463
-#define IMG_MENU_BUTTON_NEXT_LEVEL_ACTIVE              1464
-#define IMG_MENU_BUTTON_LAST_LEVEL                     1465
-#define IMG_MENU_BUTTON_LAST_LEVEL_ACTIVE              1466
-#define IMG_MENU_SCROLLBAR                             1467
-#define IMG_MENU_SCROLLBAR_ACTIVE                      1468
-#define IMG_FONT_INITIAL_1                             1469
-#define IMG_FONT_INITIAL_2                             1470
-#define IMG_FONT_INITIAL_3                             1471
-#define IMG_FONT_INITIAL_4                             1472
-#define IMG_FONT_TITLE_1                               1473
-#define IMG_FONT_TITLE_2                               1474
-#define IMG_FONT_MENU_1                                        1475
-#define IMG_FONT_MENU_2                                        1476
-#define IMG_FONT_TEXT_1                                        1477
-#define IMG_FONT_TEXT_1_LEVELS                         1478
-#define IMG_FONT_TEXT_1_PREVIEW                                1479
-#define IMG_FONT_TEXT_1_SCORES                         1480
-#define IMG_FONT_TEXT_1_ACTIVE_SCORES                  1481
-#define IMG_FONT_TEXT_2                                        1482
-#define IMG_FONT_TEXT_2_LEVELS                         1483
-#define IMG_FONT_TEXT_2_PREVIEW                                1484
-#define IMG_FONT_TEXT_2_SCORES                         1485
-#define IMG_FONT_TEXT_2_ACTIVE_SCORES                  1486
-#define IMG_FONT_TEXT_3                                        1487
-#define IMG_FONT_TEXT_3_LEVELS                         1488
-#define IMG_FONT_TEXT_3_PREVIEW                                1489
-#define IMG_FONT_TEXT_3_SCORES                         1490
-#define IMG_FONT_TEXT_3_ACTIVE_SCORES                  1491
-#define IMG_FONT_TEXT_4                                        1492
-#define IMG_FONT_TEXT_4_LEVELS                         1493
-#define IMG_FONT_TEXT_4_SCORES                         1494
-#define IMG_FONT_TEXT_4_ACTIVE_SCORES                  1495
-#define IMG_FONT_ENVELOPE_1                            1496
-#define IMG_FONT_ENVELOPE_2                            1497
-#define IMG_FONT_ENVELOPE_3                            1498
-#define IMG_FONT_ENVELOPE_4                            1499
-#define IMG_FONT_INPUT_1                               1500
-#define IMG_FONT_INPUT_1_MAIN                          1501
-#define IMG_FONT_INPUT_1_ACTIVE                                1502
-#define IMG_FONT_INPUT_1_ACTIVE_MAIN                   1503
-#define IMG_FONT_INPUT_1_ACTIVE_SETUP                  1504
-#define IMG_FONT_INPUT_2                               1505
-#define IMG_FONT_INPUT_2_ACTIVE                                1506
-#define IMG_FONT_OPTION_OFF                            1507
-#define IMG_FONT_OPTION_ON                             1508
-#define IMG_FONT_VALUE_1                               1509
-#define IMG_FONT_VALUE_2                               1510
-#define IMG_FONT_VALUE_OLD                             1511
-#define IMG_FONT_LEVEL_NUMBER                          1512
-#define IMG_FONT_TAPE_RECORDER                         1513
-#define IMG_FONT_GAME_INFO                             1514
-#define IMG_GLOBAL_BORDER                              1515
-#define IMG_GLOBAL_DOOR                                        1516
-#define IMG_EDITOR_ELEMENT_BORDER                      1517
-#define IMG_EDITOR_ELEMENT_BORDER_INPUT                        1518
-#define IMG_EDITOR_CASCADE_LIST                                1519
-#define IMG_EDITOR_CASCADE_LIST_ACTIVE                 1520
-#define IMG_BACKGROUND_ENVELOPE_1                      1521
-#define IMG_BACKGROUND_ENVELOPE_2                      1522
-#define IMG_BACKGROUND_ENVELOPE_3                      1523
-#define IMG_BACKGROUND_ENVELOPE_4                      1524
-#define IMG_TITLESCREEN_1                              1525
-#define IMG_TITLESCREEN_2                              1526
-#define IMG_TITLESCREEN_3                              1527
-#define IMG_TITLESCREEN_4                              1528
-#define IMG_TITLESCREEN_5                              1529
-#define IMG_BACKGROUND                                 1530
-#define IMG_BACKGROUND_TITLE                           1531
-#define IMG_BACKGROUND_MAIN                            1532
-#define IMG_BACKGROUND_LEVELS                          1533
-#define IMG_BACKGROUND_SCORES                          1534
-#define IMG_BACKGROUND_EDITOR                          1535
-#define IMG_BACKGROUND_INFO                            1536
-#define IMG_BACKGROUND_INFO_ELEMENTS                   1537
-#define IMG_BACKGROUND_INFO_MUSIC                      1538
-#define IMG_BACKGROUND_INFO_CREDITS                    1539
-#define IMG_BACKGROUND_INFO_PROGRAM                    1540
-#define IMG_BACKGROUND_INFO_LEVELSET                   1541
-#define IMG_BACKGROUND_SETUP                           1542
-#define IMG_BACKGROUND_DOOR                            1543
+#define IMG_LAST_CE_1                                  706
+#define IMG_LAST_CE_2                                  707
+#define IMG_LAST_CE_3                                  708
+#define IMG_LAST_CE_4                                  709
+#define IMG_LAST_CE_5                                  710
+#define IMG_LAST_CE_6                                  711
+#define IMG_LAST_CE_7                                  712
+#define IMG_LAST_CE_8                                  713
+#define IMG_NEXT_CE_1                                  714
+#define IMG_NEXT_CE_2                                  715
+#define IMG_NEXT_CE_3                                  716
+#define IMG_NEXT_CE_4                                  717
+#define IMG_NEXT_CE_5                                  718
+#define IMG_NEXT_CE_6                                  719
+#define IMG_NEXT_CE_7                                  720
+#define IMG_NEXT_CE_8                                  721
+#define IMG_SELF                                       722
+#define IMG_ANY_ELEMENT                                        723
+#define IMG_EMC_KEY_5                                  724
+#define IMG_EMC_KEY_6                                  725
+#define IMG_EMC_KEY_7                                  726
+#define IMG_EMC_KEY_8                                  727
+#define IMG_EMC_GATE_5                                 728
+#define IMG_EMC_GATE_6                                 729
+#define IMG_EMC_GATE_7                                 730
+#define IMG_EMC_GATE_8                                 731
+#define IMG_EMC_GATE_5_GRAY                            732
+#define IMG_EMC_GATE_5_GRAY_EDITOR                     733
+#define IMG_EMC_GATE_5_GRAY_ACTIVE                     734
+#define IMG_EMC_GATE_6_GRAY                            735
+#define IMG_EMC_GATE_6_GRAY_EDITOR                     736
+#define IMG_EMC_GATE_6_GRAY_ACTIVE                     737
+#define IMG_EMC_GATE_7_GRAY                            738
+#define IMG_EMC_GATE_7_GRAY_EDITOR                     739
+#define IMG_EMC_GATE_7_GRAY_ACTIVE                     740
+#define IMG_EMC_GATE_8_GRAY                            741
+#define IMG_EMC_GATE_8_GRAY_EDITOR                     742
+#define IMG_EMC_GATE_8_GRAY_ACTIVE                     743
+#define IMG_EMC_ANDROID                                        744
+#define IMG_EMC_ANDROID_SHRINKING_UPLEFT               745
+#define IMG_EMC_ANDROID_GROWING_DOWNRIGHT              746
+#define IMG_EMC_ANDROID_SHRINKING_DOWNLEFT             747
+#define IMG_EMC_ANDROID_GROWING_UPRIGHT                        748
+#define IMG_EMC_ANDROID_SHRINKING_UPRIGHT              749
+#define IMG_EMC_ANDROID_GROWING_DOWNLEFT               750
+#define IMG_EMC_ANDROID_SHRINKING_DOWNRIGHT            751
+#define IMG_EMC_ANDROID_GROWING_UPLEFT                 752
+#define IMG_EMC_GRASS                                  753
+#define IMG_EMC_GRASS_CRUMBLED                         754
+#define IMG_EMC_GRASS_DIGGING_LEFT                     755
+#define IMG_EMC_GRASS_DIGGING_RIGHT                    756
+#define IMG_EMC_GRASS_DIGGING_UP                       757
+#define IMG_EMC_GRASS_DIGGING_DOWN                     758
+#define IMG_EMC_GRASS_DIGGING_LEFT_CRUMBLED            759
+#define IMG_EMC_GRASS_DIGGING_RIGHT_CRUMBLED           760
+#define IMG_EMC_GRASS_DIGGING_UP_CRUMBLED              761
+#define IMG_EMC_GRASS_DIGGING_DOWN_CRUMBLED            762
+#define IMG_EMC_MAGIC_BALL                             763
+#define IMG_EMC_MAGIC_BALL_ACTIVE                      764
+#define IMG_EMC_MAGIC_BALL_DROPPING                    765
+#define IMG_EMC_MAGIC_BALL_SWITCH                      766
+#define IMG_EMC_MAGIC_BALL_SWITCH_ACTIVE               767
+#define IMG_EMC_SPRING_BUMPER                          768
+#define IMG_EMC_SPRING_BUMPER_ACTIVE                   769
+#define IMG_EMC_PLANT                                  770
+#define IMG_EMC_PLANT_CRUMBLED                         771
+#define IMG_EMC_LENSES                                 772
+#define IMG_EMC_MAGNIFIER                              773
+#define IMG_EMC_WALL_9                                 774
+#define IMG_EMC_WALL_10                                        775
+#define IMG_EMC_WALL_11                                        776
+#define IMG_EMC_WALL_12                                        777
+#define IMG_EMC_WALL_13                                        778
+#define IMG_EMC_WALL_14                                        779
+#define IMG_EMC_WALL_15                                        780
+#define IMG_EMC_WALL_16                                        781
+#define IMG_EMC_WALL_SLIPPERY_1                                782
+#define IMG_EMC_WALL_SLIPPERY_2                                783
+#define IMG_EMC_WALL_SLIPPERY_3                                784
+#define IMG_EMC_WALL_SLIPPERY_4                                785
+#define IMG_EMC_FAKE_GRASS                             786
+#define IMG_EMC_FAKE_GRASS_CRUMBLED                    787
+#define IMG_EMC_FAKE_GRASS_ACTIVE                      788
+#define IMG_EMC_FAKE_GRASS_ACTIVE_CRUMBLED             789
+#define IMG_EMC_FAKE_GRASS_EDITOR                      790
+#define IMG_EMC_FAKE_ACID                              791
+#define IMG_EMC_DRIPPER                                        792
+#define IMG_EMC_DRIPPER_EDITOR                         793
+#define IMG_EMC_DRIPPER_ACTIVE                         794
+#define IMG_CHAR_SPACE                                 795
+#define IMG_CHAR_EXCLAM                                        796
+#define IMG_CHAR_QUOTEDBL                              797
+#define IMG_CHAR_NUMBERSIGN                            798
+#define IMG_CHAR_DOLLAR                                        799
+#define IMG_CHAR_PERCENT                               800
+#define IMG_CHAR_AMPERSAND                             801
+#define IMG_CHAR_APOSTROPHE                            802
+#define IMG_CHAR_PARENLEFT                             803
+#define IMG_CHAR_PARENRIGHT                            804
+#define IMG_CHAR_ASTERISK                              805
+#define IMG_CHAR_PLUS                                  806
+#define IMG_CHAR_COMMA                                 807
+#define IMG_CHAR_MINUS                                 808
+#define IMG_CHAR_PERIOD                                        809
+#define IMG_CHAR_SLASH                                 810
+#define IMG_CHAR_0                                     811
+#define IMG_CHAR_1                                     812
+#define IMG_CHAR_2                                     813
+#define IMG_CHAR_3                                     814
+#define IMG_CHAR_4                                     815
+#define IMG_CHAR_5                                     816
+#define IMG_CHAR_6                                     817
+#define IMG_CHAR_7                                     818
+#define IMG_CHAR_8                                     819
+#define IMG_CHAR_9                                     820
+#define IMG_CHAR_COLON                                 821
+#define IMG_CHAR_SEMICOLON                             822
+#define IMG_CHAR_LESS                                  823
+#define IMG_CHAR_EQUAL                                 824
+#define IMG_CHAR_GREATER                               825
+#define IMG_CHAR_QUESTION                              826
+#define IMG_CHAR_AT                                    827
+#define IMG_CHAR_A                                     828
+#define IMG_CHAR_B                                     829
+#define IMG_CHAR_C                                     830
+#define IMG_CHAR_D                                     831
+#define IMG_CHAR_E                                     832
+#define IMG_CHAR_F                                     833
+#define IMG_CHAR_G                                     834
+#define IMG_CHAR_H                                     835
+#define IMG_CHAR_I                                     836
+#define IMG_CHAR_J                                     837
+#define IMG_CHAR_K                                     838
+#define IMG_CHAR_L                                     839
+#define IMG_CHAR_M                                     840
+#define IMG_CHAR_N                                     841
+#define IMG_CHAR_O                                     842
+#define IMG_CHAR_P                                     843
+#define IMG_CHAR_Q                                     844
+#define IMG_CHAR_R                                     845
+#define IMG_CHAR_S                                     846
+#define IMG_CHAR_T                                     847
+#define IMG_CHAR_U                                     848
+#define IMG_CHAR_V                                     849
+#define IMG_CHAR_W                                     850
+#define IMG_CHAR_X                                     851
+#define IMG_CHAR_Y                                     852
+#define IMG_CHAR_Z                                     853
+#define IMG_CHAR_BRACKETLEFT                           854
+#define IMG_CHAR_BACKSLASH                             855
+#define IMG_CHAR_BRACKETRIGHT                          856
+#define IMG_CHAR_ASCIICIRCUM                           857
+#define IMG_CHAR_UNDERSCORE                            858
+#define IMG_CHAR_COPYRIGHT                             859
+#define IMG_CHAR_AUMLAUT                               860
+#define IMG_CHAR_OUMLAUT                               861
+#define IMG_CHAR_UUMLAUT                               862
+#define IMG_CHAR_DEGREE                                        863
+#define IMG_CHAR_TRADEMARK                             864
+#define IMG_CHAR_CURSOR                                        865
+#define IMG_CUSTOM_1                                   866
+#define IMG_CUSTOM_1_EDITOR                            867
+#define IMG_CUSTOM_2                                   868
+#define IMG_CUSTOM_2_EDITOR                            869
+#define IMG_CUSTOM_3                                   870
+#define IMG_CUSTOM_3_EDITOR                            871
+#define IMG_CUSTOM_4                                   872
+#define IMG_CUSTOM_4_EDITOR                            873
+#define IMG_CUSTOM_5                                   874
+#define IMG_CUSTOM_5_EDITOR                            875
+#define IMG_CUSTOM_6                                   876
+#define IMG_CUSTOM_6_EDITOR                            877
+#define IMG_CUSTOM_7                                   878
+#define IMG_CUSTOM_7_EDITOR                            879
+#define IMG_CUSTOM_8                                   880
+#define IMG_CUSTOM_8_EDITOR                            881
+#define IMG_CUSTOM_9                                   882
+#define IMG_CUSTOM_9_EDITOR                            883
+#define IMG_CUSTOM_10                                  884
+#define IMG_CUSTOM_10_EDITOR                           885
+#define IMG_CUSTOM_11                                  886
+#define IMG_CUSTOM_11_EDITOR                           887
+#define IMG_CUSTOM_12                                  888
+#define IMG_CUSTOM_12_EDITOR                           889
+#define IMG_CUSTOM_13                                  890
+#define IMG_CUSTOM_13_EDITOR                           891
+#define IMG_CUSTOM_14                                  892
+#define IMG_CUSTOM_14_EDITOR                           893
+#define IMG_CUSTOM_15                                  894
+#define IMG_CUSTOM_15_EDITOR                           895
+#define IMG_CUSTOM_16                                  896
+#define IMG_CUSTOM_16_EDITOR                           897
+#define IMG_CUSTOM_17                                  898
+#define IMG_CUSTOM_17_EDITOR                           899
+#define IMG_CUSTOM_18                                  900
+#define IMG_CUSTOM_18_EDITOR                           901
+#define IMG_CUSTOM_19                                  902
+#define IMG_CUSTOM_19_EDITOR                           903
+#define IMG_CUSTOM_20                                  904
+#define IMG_CUSTOM_20_EDITOR                           905
+#define IMG_CUSTOM_21                                  906
+#define IMG_CUSTOM_21_EDITOR                           907
+#define IMG_CUSTOM_22                                  908
+#define IMG_CUSTOM_22_EDITOR                           909
+#define IMG_CUSTOM_23                                  910
+#define IMG_CUSTOM_23_EDITOR                           911
+#define IMG_CUSTOM_24                                  912
+#define IMG_CUSTOM_24_EDITOR                           913
+#define IMG_CUSTOM_25                                  914
+#define IMG_CUSTOM_25_EDITOR                           915
+#define IMG_CUSTOM_26                                  916
+#define IMG_CUSTOM_26_EDITOR                           917
+#define IMG_CUSTOM_27                                  918
+#define IMG_CUSTOM_27_EDITOR                           919
+#define IMG_CUSTOM_28                                  920
+#define IMG_CUSTOM_28_EDITOR                           921
+#define IMG_CUSTOM_29                                  922
+#define IMG_CUSTOM_29_EDITOR                           923
+#define IMG_CUSTOM_30                                  924
+#define IMG_CUSTOM_30_EDITOR                           925
+#define IMG_CUSTOM_31                                  926
+#define IMG_CUSTOM_31_EDITOR                           927
+#define IMG_CUSTOM_32                                  928
+#define IMG_CUSTOM_32_EDITOR                           929
+#define IMG_CUSTOM_33                                  930
+#define IMG_CUSTOM_33_EDITOR                           931
+#define IMG_CUSTOM_34                                  932
+#define IMG_CUSTOM_34_EDITOR                           933
+#define IMG_CUSTOM_35                                  934
+#define IMG_CUSTOM_35_EDITOR                           935
+#define IMG_CUSTOM_36                                  936
+#define IMG_CUSTOM_36_EDITOR                           937
+#define IMG_CUSTOM_37                                  938
+#define IMG_CUSTOM_37_EDITOR                           939
+#define IMG_CUSTOM_38                                  940
+#define IMG_CUSTOM_38_EDITOR                           941
+#define IMG_CUSTOM_39                                  942
+#define IMG_CUSTOM_39_EDITOR                           943
+#define IMG_CUSTOM_40                                  944
+#define IMG_CUSTOM_40_EDITOR                           945
+#define IMG_CUSTOM_41                                  946
+#define IMG_CUSTOM_41_EDITOR                           947
+#define IMG_CUSTOM_42                                  948
+#define IMG_CUSTOM_42_EDITOR                           949
+#define IMG_CUSTOM_43                                  950
+#define IMG_CUSTOM_43_EDITOR                           951
+#define IMG_CUSTOM_44                                  952
+#define IMG_CUSTOM_44_EDITOR                           953
+#define IMG_CUSTOM_45                                  954
+#define IMG_CUSTOM_45_EDITOR                           955
+#define IMG_CUSTOM_46                                  956
+#define IMG_CUSTOM_46_EDITOR                           957
+#define IMG_CUSTOM_47                                  958
+#define IMG_CUSTOM_47_EDITOR                           959
+#define IMG_CUSTOM_48                                  960
+#define IMG_CUSTOM_48_EDITOR                           961
+#define IMG_CUSTOM_49                                  962
+#define IMG_CUSTOM_49_EDITOR                           963
+#define IMG_CUSTOM_50                                  964
+#define IMG_CUSTOM_50_EDITOR                           965
+#define IMG_CUSTOM_51                                  966
+#define IMG_CUSTOM_51_EDITOR                           967
+#define IMG_CUSTOM_52                                  968
+#define IMG_CUSTOM_52_EDITOR                           969
+#define IMG_CUSTOM_53                                  970
+#define IMG_CUSTOM_53_EDITOR                           971
+#define IMG_CUSTOM_54                                  972
+#define IMG_CUSTOM_54_EDITOR                           973
+#define IMG_CUSTOM_55                                  974
+#define IMG_CUSTOM_55_EDITOR                           975
+#define IMG_CUSTOM_56                                  976
+#define IMG_CUSTOM_56_EDITOR                           977
+#define IMG_CUSTOM_57                                  978
+#define IMG_CUSTOM_57_EDITOR                           979
+#define IMG_CUSTOM_58                                  980
+#define IMG_CUSTOM_58_EDITOR                           981
+#define IMG_CUSTOM_59                                  982
+#define IMG_CUSTOM_59_EDITOR                           983
+#define IMG_CUSTOM_60                                  984
+#define IMG_CUSTOM_60_EDITOR                           985
+#define IMG_CUSTOM_61                                  986
+#define IMG_CUSTOM_61_EDITOR                           987
+#define IMG_CUSTOM_62                                  988
+#define IMG_CUSTOM_62_EDITOR                           989
+#define IMG_CUSTOM_63                                  990
+#define IMG_CUSTOM_63_EDITOR                           991
+#define IMG_CUSTOM_64                                  992
+#define IMG_CUSTOM_64_EDITOR                           993
+#define IMG_CUSTOM_65                                  994
+#define IMG_CUSTOM_65_EDITOR                           995
+#define IMG_CUSTOM_66                                  996
+#define IMG_CUSTOM_66_EDITOR                           997
+#define IMG_CUSTOM_67                                  998
+#define IMG_CUSTOM_67_EDITOR                           999
+#define IMG_CUSTOM_68                                  1000
+#define IMG_CUSTOM_68_EDITOR                           1001
+#define IMG_CUSTOM_69                                  1002
+#define IMG_CUSTOM_69_EDITOR                           1003
+#define IMG_CUSTOM_70                                  1004
+#define IMG_CUSTOM_70_EDITOR                           1005
+#define IMG_CUSTOM_71                                  1006
+#define IMG_CUSTOM_71_EDITOR                           1007
+#define IMG_CUSTOM_72                                  1008
+#define IMG_CUSTOM_72_EDITOR                           1009
+#define IMG_CUSTOM_73                                  1010
+#define IMG_CUSTOM_73_EDITOR                           1011
+#define IMG_CUSTOM_74                                  1012
+#define IMG_CUSTOM_74_EDITOR                           1013
+#define IMG_CUSTOM_75                                  1014
+#define IMG_CUSTOM_75_EDITOR                           1015
+#define IMG_CUSTOM_76                                  1016
+#define IMG_CUSTOM_76_EDITOR                           1017
+#define IMG_CUSTOM_77                                  1018
+#define IMG_CUSTOM_77_EDITOR                           1019
+#define IMG_CUSTOM_78                                  1020
+#define IMG_CUSTOM_78_EDITOR                           1021
+#define IMG_CUSTOM_79                                  1022
+#define IMG_CUSTOM_79_EDITOR                           1023
+#define IMG_CUSTOM_80                                  1024
+#define IMG_CUSTOM_80_EDITOR                           1025
+#define IMG_CUSTOM_81                                  1026
+#define IMG_CUSTOM_81_EDITOR                           1027
+#define IMG_CUSTOM_82                                  1028
+#define IMG_CUSTOM_82_EDITOR                           1029
+#define IMG_CUSTOM_83                                  1030
+#define IMG_CUSTOM_83_EDITOR                           1031
+#define IMG_CUSTOM_84                                  1032
+#define IMG_CUSTOM_84_EDITOR                           1033
+#define IMG_CUSTOM_85                                  1034
+#define IMG_CUSTOM_85_EDITOR                           1035
+#define IMG_CUSTOM_86                                  1036
+#define IMG_CUSTOM_86_EDITOR                           1037
+#define IMG_CUSTOM_87                                  1038
+#define IMG_CUSTOM_87_EDITOR                           1039
+#define IMG_CUSTOM_88                                  1040
+#define IMG_CUSTOM_88_EDITOR                           1041
+#define IMG_CUSTOM_89                                  1042
+#define IMG_CUSTOM_89_EDITOR                           1043
+#define IMG_CUSTOM_90                                  1044
+#define IMG_CUSTOM_90_EDITOR                           1045
+#define IMG_CUSTOM_91                                  1046
+#define IMG_CUSTOM_91_EDITOR                           1047
+#define IMG_CUSTOM_92                                  1048
+#define IMG_CUSTOM_92_EDITOR                           1049
+#define IMG_CUSTOM_93                                  1050
+#define IMG_CUSTOM_93_EDITOR                           1051
+#define IMG_CUSTOM_94                                  1052
+#define IMG_CUSTOM_94_EDITOR                           1053
+#define IMG_CUSTOM_95                                  1054
+#define IMG_CUSTOM_95_EDITOR                           1055
+#define IMG_CUSTOM_96                                  1056
+#define IMG_CUSTOM_96_EDITOR                           1057
+#define IMG_CUSTOM_97                                  1058
+#define IMG_CUSTOM_97_EDITOR                           1059
+#define IMG_CUSTOM_98                                  1060
+#define IMG_CUSTOM_98_EDITOR                           1061
+#define IMG_CUSTOM_99                                  1062
+#define IMG_CUSTOM_99_EDITOR                           1063
+#define IMG_CUSTOM_100                                 1064
+#define IMG_CUSTOM_100_EDITOR                          1065
+#define IMG_CUSTOM_101                                 1066
+#define IMG_CUSTOM_101_EDITOR                          1067
+#define IMG_CUSTOM_102                                 1068
+#define IMG_CUSTOM_102_EDITOR                          1069
+#define IMG_CUSTOM_103                                 1070
+#define IMG_CUSTOM_103_EDITOR                          1071
+#define IMG_CUSTOM_104                                 1072
+#define IMG_CUSTOM_104_EDITOR                          1073
+#define IMG_CUSTOM_105                                 1074
+#define IMG_CUSTOM_105_EDITOR                          1075
+#define IMG_CUSTOM_106                                 1076
+#define IMG_CUSTOM_106_EDITOR                          1077
+#define IMG_CUSTOM_107                                 1078
+#define IMG_CUSTOM_107_EDITOR                          1079
+#define IMG_CUSTOM_108                                 1080
+#define IMG_CUSTOM_108_EDITOR                          1081
+#define IMG_CUSTOM_109                                 1082
+#define IMG_CUSTOM_109_EDITOR                          1083
+#define IMG_CUSTOM_110                                 1084
+#define IMG_CUSTOM_110_EDITOR                          1085
+#define IMG_CUSTOM_111                                 1086
+#define IMG_CUSTOM_111_EDITOR                          1087
+#define IMG_CUSTOM_112                                 1088
+#define IMG_CUSTOM_112_EDITOR                          1089
+#define IMG_CUSTOM_113                                 1090
+#define IMG_CUSTOM_113_EDITOR                          1091
+#define IMG_CUSTOM_114                                 1092
+#define IMG_CUSTOM_114_EDITOR                          1093
+#define IMG_CUSTOM_115                                 1094
+#define IMG_CUSTOM_115_EDITOR                          1095
+#define IMG_CUSTOM_116                                 1096
+#define IMG_CUSTOM_116_EDITOR                          1097
+#define IMG_CUSTOM_117                                 1098
+#define IMG_CUSTOM_117_EDITOR                          1099
+#define IMG_CUSTOM_118                                 1100
+#define IMG_CUSTOM_118_EDITOR                          1101
+#define IMG_CUSTOM_119                                 1102
+#define IMG_CUSTOM_119_EDITOR                          1103
+#define IMG_CUSTOM_120                                 1104
+#define IMG_CUSTOM_120_EDITOR                          1105
+#define IMG_CUSTOM_121                                 1106
+#define IMG_CUSTOM_121_EDITOR                          1107
+#define IMG_CUSTOM_122                                 1108
+#define IMG_CUSTOM_122_EDITOR                          1109
+#define IMG_CUSTOM_123                                 1110
+#define IMG_CUSTOM_123_EDITOR                          1111
+#define IMG_CUSTOM_124                                 1112
+#define IMG_CUSTOM_124_EDITOR                          1113
+#define IMG_CUSTOM_125                                 1114
+#define IMG_CUSTOM_125_EDITOR                          1115
+#define IMG_CUSTOM_126                                 1116
+#define IMG_CUSTOM_126_EDITOR                          1117
+#define IMG_CUSTOM_127                                 1118
+#define IMG_CUSTOM_127_EDITOR                          1119
+#define IMG_CUSTOM_128                                 1120
+#define IMG_CUSTOM_128_EDITOR                          1121
+#define IMG_CUSTOM_129                                 1122
+#define IMG_CUSTOM_129_EDITOR                          1123
+#define IMG_CUSTOM_130                                 1124
+#define IMG_CUSTOM_130_EDITOR                          1125
+#define IMG_CUSTOM_131                                 1126
+#define IMG_CUSTOM_131_EDITOR                          1127
+#define IMG_CUSTOM_132                                 1128
+#define IMG_CUSTOM_132_EDITOR                          1129
+#define IMG_CUSTOM_133                                 1130
+#define IMG_CUSTOM_133_EDITOR                          1131
+#define IMG_CUSTOM_134                                 1132
+#define IMG_CUSTOM_134_EDITOR                          1133
+#define IMG_CUSTOM_135                                 1134
+#define IMG_CUSTOM_135_EDITOR                          1135
+#define IMG_CUSTOM_136                                 1136
+#define IMG_CUSTOM_136_EDITOR                          1137
+#define IMG_CUSTOM_137                                 1138
+#define IMG_CUSTOM_137_EDITOR                          1139
+#define IMG_CUSTOM_138                                 1140
+#define IMG_CUSTOM_138_EDITOR                          1141
+#define IMG_CUSTOM_139                                 1142
+#define IMG_CUSTOM_139_EDITOR                          1143
+#define IMG_CUSTOM_140                                 1144
+#define IMG_CUSTOM_140_EDITOR                          1145
+#define IMG_CUSTOM_141                                 1146
+#define IMG_CUSTOM_141_EDITOR                          1147
+#define IMG_CUSTOM_142                                 1148
+#define IMG_CUSTOM_142_EDITOR                          1149
+#define IMG_CUSTOM_143                                 1150
+#define IMG_CUSTOM_143_EDITOR                          1151
+#define IMG_CUSTOM_144                                 1152
+#define IMG_CUSTOM_144_EDITOR                          1153
+#define IMG_CUSTOM_145                                 1154
+#define IMG_CUSTOM_145_EDITOR                          1155
+#define IMG_CUSTOM_146                                 1156
+#define IMG_CUSTOM_146_EDITOR                          1157
+#define IMG_CUSTOM_147                                 1158
+#define IMG_CUSTOM_147_EDITOR                          1159
+#define IMG_CUSTOM_148                                 1160
+#define IMG_CUSTOM_148_EDITOR                          1161
+#define IMG_CUSTOM_149                                 1162
+#define IMG_CUSTOM_149_EDITOR                          1163
+#define IMG_CUSTOM_150                                 1164
+#define IMG_CUSTOM_150_EDITOR                          1165
+#define IMG_CUSTOM_151                                 1166
+#define IMG_CUSTOM_151_EDITOR                          1167
+#define IMG_CUSTOM_152                                 1168
+#define IMG_CUSTOM_152_EDITOR                          1169
+#define IMG_CUSTOM_153                                 1170
+#define IMG_CUSTOM_153_EDITOR                          1171
+#define IMG_CUSTOM_154                                 1172
+#define IMG_CUSTOM_154_EDITOR                          1173
+#define IMG_CUSTOM_155                                 1174
+#define IMG_CUSTOM_155_EDITOR                          1175
+#define IMG_CUSTOM_156                                 1176
+#define IMG_CUSTOM_156_EDITOR                          1177
+#define IMG_CUSTOM_157                                 1178
+#define IMG_CUSTOM_157_EDITOR                          1179
+#define IMG_CUSTOM_158                                 1180
+#define IMG_CUSTOM_158_EDITOR                          1181
+#define IMG_CUSTOM_159                                 1182
+#define IMG_CUSTOM_159_EDITOR                          1183
+#define IMG_CUSTOM_160                                 1184
+#define IMG_CUSTOM_160_EDITOR                          1185
+#define IMG_CUSTOM_161                                 1186
+#define IMG_CUSTOM_161_EDITOR                          1187
+#define IMG_CUSTOM_162                                 1188
+#define IMG_CUSTOM_162_EDITOR                          1189
+#define IMG_CUSTOM_163                                 1190
+#define IMG_CUSTOM_163_EDITOR                          1191
+#define IMG_CUSTOM_164                                 1192
+#define IMG_CUSTOM_164_EDITOR                          1193
+#define IMG_CUSTOM_165                                 1194
+#define IMG_CUSTOM_165_EDITOR                          1195
+#define IMG_CUSTOM_166                                 1196
+#define IMG_CUSTOM_166_EDITOR                          1197
+#define IMG_CUSTOM_167                                 1198
+#define IMG_CUSTOM_167_EDITOR                          1199
+#define IMG_CUSTOM_168                                 1200
+#define IMG_CUSTOM_168_EDITOR                          1201
+#define IMG_CUSTOM_169                                 1202
+#define IMG_CUSTOM_169_EDITOR                          1203
+#define IMG_CUSTOM_170                                 1204
+#define IMG_CUSTOM_170_EDITOR                          1205
+#define IMG_CUSTOM_171                                 1206
+#define IMG_CUSTOM_171_EDITOR                          1207
+#define IMG_CUSTOM_172                                 1208
+#define IMG_CUSTOM_172_EDITOR                          1209
+#define IMG_CUSTOM_173                                 1210
+#define IMG_CUSTOM_173_EDITOR                          1211
+#define IMG_CUSTOM_174                                 1212
+#define IMG_CUSTOM_174_EDITOR                          1213
+#define IMG_CUSTOM_175                                 1214
+#define IMG_CUSTOM_175_EDITOR                          1215
+#define IMG_CUSTOM_176                                 1216
+#define IMG_CUSTOM_176_EDITOR                          1217
+#define IMG_CUSTOM_177                                 1218
+#define IMG_CUSTOM_177_EDITOR                          1219
+#define IMG_CUSTOM_178                                 1220
+#define IMG_CUSTOM_178_EDITOR                          1221
+#define IMG_CUSTOM_179                                 1222
+#define IMG_CUSTOM_179_EDITOR                          1223
+#define IMG_CUSTOM_180                                 1224
+#define IMG_CUSTOM_180_EDITOR                          1225
+#define IMG_CUSTOM_181                                 1226
+#define IMG_CUSTOM_181_EDITOR                          1227
+#define IMG_CUSTOM_182                                 1228
+#define IMG_CUSTOM_182_EDITOR                          1229
+#define IMG_CUSTOM_183                                 1230
+#define IMG_CUSTOM_183_EDITOR                          1231
+#define IMG_CUSTOM_184                                 1232
+#define IMG_CUSTOM_184_EDITOR                          1233
+#define IMG_CUSTOM_185                                 1234
+#define IMG_CUSTOM_185_EDITOR                          1235
+#define IMG_CUSTOM_186                                 1236
+#define IMG_CUSTOM_186_EDITOR                          1237
+#define IMG_CUSTOM_187                                 1238
+#define IMG_CUSTOM_187_EDITOR                          1239
+#define IMG_CUSTOM_188                                 1240
+#define IMG_CUSTOM_188_EDITOR                          1241
+#define IMG_CUSTOM_189                                 1242
+#define IMG_CUSTOM_189_EDITOR                          1243
+#define IMG_CUSTOM_190                                 1244
+#define IMG_CUSTOM_190_EDITOR                          1245
+#define IMG_CUSTOM_191                                 1246
+#define IMG_CUSTOM_191_EDITOR                          1247
+#define IMG_CUSTOM_192                                 1248
+#define IMG_CUSTOM_192_EDITOR                          1249
+#define IMG_CUSTOM_193                                 1250
+#define IMG_CUSTOM_193_EDITOR                          1251
+#define IMG_CUSTOM_194                                 1252
+#define IMG_CUSTOM_194_EDITOR                          1253
+#define IMG_CUSTOM_195                                 1254
+#define IMG_CUSTOM_195_EDITOR                          1255
+#define IMG_CUSTOM_196                                 1256
+#define IMG_CUSTOM_196_EDITOR                          1257
+#define IMG_CUSTOM_197                                 1258
+#define IMG_CUSTOM_197_EDITOR                          1259
+#define IMG_CUSTOM_198                                 1260
+#define IMG_CUSTOM_198_EDITOR                          1261
+#define IMG_CUSTOM_199                                 1262
+#define IMG_CUSTOM_199_EDITOR                          1263
+#define IMG_CUSTOM_200                                 1264
+#define IMG_CUSTOM_200_EDITOR                          1265
+#define IMG_CUSTOM_201                                 1266
+#define IMG_CUSTOM_201_EDITOR                          1267
+#define IMG_CUSTOM_202                                 1268
+#define IMG_CUSTOM_202_EDITOR                          1269
+#define IMG_CUSTOM_203                                 1270
+#define IMG_CUSTOM_203_EDITOR                          1271
+#define IMG_CUSTOM_204                                 1272
+#define IMG_CUSTOM_204_EDITOR                          1273
+#define IMG_CUSTOM_205                                 1274
+#define IMG_CUSTOM_205_EDITOR                          1275
+#define IMG_CUSTOM_206                                 1276
+#define IMG_CUSTOM_206_EDITOR                          1277
+#define IMG_CUSTOM_207                                 1278
+#define IMG_CUSTOM_207_EDITOR                          1279
+#define IMG_CUSTOM_208                                 1280
+#define IMG_CUSTOM_208_EDITOR                          1281
+#define IMG_CUSTOM_209                                 1282
+#define IMG_CUSTOM_209_EDITOR                          1283
+#define IMG_CUSTOM_210                                 1284
+#define IMG_CUSTOM_210_EDITOR                          1285
+#define IMG_CUSTOM_211                                 1286
+#define IMG_CUSTOM_211_EDITOR                          1287
+#define IMG_CUSTOM_212                                 1288
+#define IMG_CUSTOM_212_EDITOR                          1289
+#define IMG_CUSTOM_213                                 1290
+#define IMG_CUSTOM_213_EDITOR                          1291
+#define IMG_CUSTOM_214                                 1292
+#define IMG_CUSTOM_214_EDITOR                          1293
+#define IMG_CUSTOM_215                                 1294
+#define IMG_CUSTOM_215_EDITOR                          1295
+#define IMG_CUSTOM_216                                 1296
+#define IMG_CUSTOM_216_EDITOR                          1297
+#define IMG_CUSTOM_217                                 1298
+#define IMG_CUSTOM_217_EDITOR                          1299
+#define IMG_CUSTOM_218                                 1300
+#define IMG_CUSTOM_218_EDITOR                          1301
+#define IMG_CUSTOM_219                                 1302
+#define IMG_CUSTOM_219_EDITOR                          1303
+#define IMG_CUSTOM_220                                 1304
+#define IMG_CUSTOM_220_EDITOR                          1305
+#define IMG_CUSTOM_221                                 1306
+#define IMG_CUSTOM_221_EDITOR                          1307
+#define IMG_CUSTOM_222                                 1308
+#define IMG_CUSTOM_222_EDITOR                          1309
+#define IMG_CUSTOM_223                                 1310
+#define IMG_CUSTOM_223_EDITOR                          1311
+#define IMG_CUSTOM_224                                 1312
+#define IMG_CUSTOM_224_EDITOR                          1313
+#define IMG_CUSTOM_225                                 1314
+#define IMG_CUSTOM_225_EDITOR                          1315
+#define IMG_CUSTOM_226                                 1316
+#define IMG_CUSTOM_226_EDITOR                          1317
+#define IMG_CUSTOM_227                                 1318
+#define IMG_CUSTOM_227_EDITOR                          1319
+#define IMG_CUSTOM_228                                 1320
+#define IMG_CUSTOM_228_EDITOR                          1321
+#define IMG_CUSTOM_229                                 1322
+#define IMG_CUSTOM_229_EDITOR                          1323
+#define IMG_CUSTOM_230                                 1324
+#define IMG_CUSTOM_230_EDITOR                          1325
+#define IMG_CUSTOM_231                                 1326
+#define IMG_CUSTOM_231_EDITOR                          1327
+#define IMG_CUSTOM_232                                 1328
+#define IMG_CUSTOM_232_EDITOR                          1329
+#define IMG_CUSTOM_233                                 1330
+#define IMG_CUSTOM_233_EDITOR                          1331
+#define IMG_CUSTOM_234                                 1332
+#define IMG_CUSTOM_234_EDITOR                          1333
+#define IMG_CUSTOM_235                                 1334
+#define IMG_CUSTOM_235_EDITOR                          1335
+#define IMG_CUSTOM_236                                 1336
+#define IMG_CUSTOM_236_EDITOR                          1337
+#define IMG_CUSTOM_237                                 1338
+#define IMG_CUSTOM_237_EDITOR                          1339
+#define IMG_CUSTOM_238                                 1340
+#define IMG_CUSTOM_238_EDITOR                          1341
+#define IMG_CUSTOM_239                                 1342
+#define IMG_CUSTOM_239_EDITOR                          1343
+#define IMG_CUSTOM_240                                 1344
+#define IMG_CUSTOM_240_EDITOR                          1345
+#define IMG_CUSTOM_241                                 1346
+#define IMG_CUSTOM_241_EDITOR                          1347
+#define IMG_CUSTOM_242                                 1348
+#define IMG_CUSTOM_242_EDITOR                          1349
+#define IMG_CUSTOM_243                                 1350
+#define IMG_CUSTOM_243_EDITOR                          1351
+#define IMG_CUSTOM_244                                 1352
+#define IMG_CUSTOM_244_EDITOR                          1353
+#define IMG_CUSTOM_245                                 1354
+#define IMG_CUSTOM_245_EDITOR                          1355
+#define IMG_CUSTOM_246                                 1356
+#define IMG_CUSTOM_246_EDITOR                          1357
+#define IMG_CUSTOM_247                                 1358
+#define IMG_CUSTOM_247_EDITOR                          1359
+#define IMG_CUSTOM_248                                 1360
+#define IMG_CUSTOM_248_EDITOR                          1361
+#define IMG_CUSTOM_249                                 1362
+#define IMG_CUSTOM_249_EDITOR                          1363
+#define IMG_CUSTOM_250                                 1364
+#define IMG_CUSTOM_250_EDITOR                          1365
+#define IMG_CUSTOM_251                                 1366
+#define IMG_CUSTOM_251_EDITOR                          1367
+#define IMG_CUSTOM_252                                 1368
+#define IMG_CUSTOM_252_EDITOR                          1369
+#define IMG_CUSTOM_253                                 1370
+#define IMG_CUSTOM_253_EDITOR                          1371
+#define IMG_CUSTOM_254                                 1372
+#define IMG_CUSTOM_254_EDITOR                          1373
+#define IMG_CUSTOM_255                                 1374
+#define IMG_CUSTOM_255_EDITOR                          1375
+#define IMG_CUSTOM_256                                 1376
+#define IMG_CUSTOM_256_EDITOR                          1377
+#define IMG_GROUP_1                                    1378
+#define IMG_GROUP_1_EDITOR                             1379
+#define IMG_GROUP_2                                    1380
+#define IMG_GROUP_2_EDITOR                             1381
+#define IMG_GROUP_3                                    1382
+#define IMG_GROUP_3_EDITOR                             1383
+#define IMG_GROUP_4                                    1384
+#define IMG_GROUP_4_EDITOR                             1385
+#define IMG_GROUP_5                                    1386
+#define IMG_GROUP_5_EDITOR                             1387
+#define IMG_GROUP_6                                    1388
+#define IMG_GROUP_6_EDITOR                             1389
+#define IMG_GROUP_7                                    1390
+#define IMG_GROUP_7_EDITOR                             1391
+#define IMG_GROUP_8                                    1392
+#define IMG_GROUP_8_EDITOR                             1393
+#define IMG_GROUP_9                                    1394
+#define IMG_GROUP_9_EDITOR                             1395
+#define IMG_GROUP_10                                   1396
+#define IMG_GROUP_10_EDITOR                            1397
+#define IMG_GROUP_11                                   1398
+#define IMG_GROUP_11_EDITOR                            1399
+#define IMG_GROUP_12                                   1400
+#define IMG_GROUP_12_EDITOR                            1401
+#define IMG_GROUP_13                                   1402
+#define IMG_GROUP_13_EDITOR                            1403
+#define IMG_GROUP_14                                   1404
+#define IMG_GROUP_14_EDITOR                            1405
+#define IMG_GROUP_15                                   1406
+#define IMG_GROUP_15_EDITOR                            1407
+#define IMG_GROUP_16                                   1408
+#define IMG_GROUP_16_EDITOR                            1409
+#define IMG_GROUP_17                                   1410
+#define IMG_GROUP_17_EDITOR                            1411
+#define IMG_GROUP_18                                   1412
+#define IMG_GROUP_18_EDITOR                            1413
+#define IMG_GROUP_19                                   1414
+#define IMG_GROUP_19_EDITOR                            1415
+#define IMG_GROUP_20                                   1416
+#define IMG_GROUP_20_EDITOR                            1417
+#define IMG_GROUP_21                                   1418
+#define IMG_GROUP_21_EDITOR                            1419
+#define IMG_GROUP_22                                   1420
+#define IMG_GROUP_22_EDITOR                            1421
+#define IMG_GROUP_23                                   1422
+#define IMG_GROUP_23_EDITOR                            1423
+#define IMG_GROUP_24                                   1424
+#define IMG_GROUP_24_EDITOR                            1425
+#define IMG_GROUP_25                                   1426
+#define IMG_GROUP_25_EDITOR                            1427
+#define IMG_GROUP_26                                   1428
+#define IMG_GROUP_26_EDITOR                            1429
+#define IMG_GROUP_27                                   1430
+#define IMG_GROUP_27_EDITOR                            1431
+#define IMG_GROUP_28                                   1432
+#define IMG_GROUP_28_EDITOR                            1433
+#define IMG_GROUP_29                                   1434
+#define IMG_GROUP_29_EDITOR                            1435
+#define IMG_GROUP_30                                   1436
+#define IMG_GROUP_30_EDITOR                            1437
+#define IMG_GROUP_31                                   1438
+#define IMG_GROUP_31_EDITOR                            1439
+#define IMG_GROUP_32                                   1440
+#define IMG_GROUP_32_EDITOR                            1441
+#define IMG_EMC_OBJECT                                 1442
+#define IMG_EMC_SPRITE                                 1443
+#define IMG_TOON_1                                     1444
+#define IMG_TOON_2                                     1445
+#define IMG_TOON_3                                     1446
+#define IMG_TOON_4                                     1447
+#define IMG_TOON_5                                     1448
+#define IMG_TOON_6                                     1449
+#define IMG_TOON_7                                     1450
+#define IMG_TOON_8                                     1451
+#define IMG_TOON_9                                     1452
+#define IMG_TOON_10                                    1453
+#define IMG_TOON_11                                    1454
+#define IMG_TOON_12                                    1455
+#define IMG_TOON_13                                    1456
+#define IMG_TOON_14                                    1457
+#define IMG_TOON_15                                    1458
+#define IMG_TOON_16                                    1459
+#define IMG_TOON_17                                    1460
+#define IMG_TOON_18                                    1461
+#define IMG_TOON_19                                    1462
+#define IMG_TOON_20                                    1463
+#define IMG_MENU_CALIBRATE_RED                         1464
+#define IMG_MENU_CALIBRATE_BLUE                                1465
+#define IMG_MENU_CALIBRATE_YELLOW                      1466
+#define IMG_MENU_BUTTON                                        1467
+#define IMG_MENU_BUTTON_ACTIVE                         1468
+#define IMG_MENU_BUTTON_LEFT                           1469
+#define IMG_MENU_BUTTON_LEFT_ACTIVE                    1470
+#define IMG_MENU_BUTTON_RIGHT                          1471
+#define IMG_MENU_BUTTON_RIGHT_ACTIVE                   1472
+#define IMG_MENU_BUTTON_UP                             1473
+#define IMG_MENU_BUTTON_UP_ACTIVE                      1474
+#define IMG_MENU_BUTTON_DOWN                           1475
+#define IMG_MENU_BUTTON_DOWN_ACTIVE                    1476
+#define IMG_MENU_BUTTON_ENTER_MENU                     1477
+#define IMG_MENU_BUTTON_ENTER_MENU_ACTIVE              1478
+#define IMG_MENU_BUTTON_LEAVE_MENU                     1479
+#define IMG_MENU_BUTTON_LEAVE_MENU_ACTIVE              1480
+#define IMG_MENU_BUTTON_NEXT_LEVEL                     1481
+#define IMG_MENU_BUTTON_NEXT_LEVEL_ACTIVE              1482
+#define IMG_MENU_BUTTON_LAST_LEVEL                     1483
+#define IMG_MENU_BUTTON_LAST_LEVEL_ACTIVE              1484
+#define IMG_MENU_SCROLLBAR                             1485
+#define IMG_MENU_SCROLLBAR_ACTIVE                      1486
+#define IMG_FONT_INITIAL_1                             1487
+#define IMG_FONT_INITIAL_2                             1488
+#define IMG_FONT_INITIAL_3                             1489
+#define IMG_FONT_INITIAL_4                             1490
+#define IMG_FONT_TITLE_1                               1491
+#define IMG_FONT_TITLE_2                               1492
+#define IMG_FONT_MENU_1                                        1493
+#define IMG_FONT_MENU_2                                        1494
+#define IMG_FONT_TEXT_1                                        1495
+#define IMG_FONT_TEXT_1_LEVELS                         1496
+#define IMG_FONT_TEXT_1_PREVIEW                                1497
+#define IMG_FONT_TEXT_1_SCORES                         1498
+#define IMG_FONT_TEXT_1_ACTIVE_SCORES                  1499
+#define IMG_FONT_TEXT_2                                        1500
+#define IMG_FONT_TEXT_2_LEVELS                         1501
+#define IMG_FONT_TEXT_2_PREVIEW                                1502
+#define IMG_FONT_TEXT_2_SCORES                         1503
+#define IMG_FONT_TEXT_2_ACTIVE_SCORES                  1504
+#define IMG_FONT_TEXT_3                                        1505
+#define IMG_FONT_TEXT_3_LEVELS                         1506
+#define IMG_FONT_TEXT_3_PREVIEW                                1507
+#define IMG_FONT_TEXT_3_SCORES                         1508
+#define IMG_FONT_TEXT_3_ACTIVE_SCORES                  1509
+#define IMG_FONT_TEXT_4                                        1510
+#define IMG_FONT_TEXT_4_LEVELS                         1511
+#define IMG_FONT_TEXT_4_SCORES                         1512
+#define IMG_FONT_TEXT_4_ACTIVE_SCORES                  1513
+#define IMG_FONT_ENVELOPE_1                            1514
+#define IMG_FONT_ENVELOPE_2                            1515
+#define IMG_FONT_ENVELOPE_3                            1516
+#define IMG_FONT_ENVELOPE_4                            1517
+#define IMG_FONT_INPUT_1                               1518
+#define IMG_FONT_INPUT_1_MAIN                          1519
+#define IMG_FONT_INPUT_1_ACTIVE                                1520
+#define IMG_FONT_INPUT_1_ACTIVE_MAIN                   1521
+#define IMG_FONT_INPUT_1_ACTIVE_SETUP                  1522
+#define IMG_FONT_INPUT_2                               1523
+#define IMG_FONT_INPUT_2_ACTIVE                                1524
+#define IMG_FONT_OPTION_OFF                            1525
+#define IMG_FONT_OPTION_ON                             1526
+#define IMG_FONT_VALUE_1                               1527
+#define IMG_FONT_VALUE_2                               1528
+#define IMG_FONT_VALUE_OLD                             1529
+#define IMG_FONT_LEVEL_NUMBER                          1530
+#define IMG_FONT_TAPE_RECORDER                         1531
+#define IMG_FONT_GAME_INFO                             1532
+#define IMG_GLOBAL_BORDER                              1533
+#define IMG_GLOBAL_DOOR                                        1534
+#define IMG_EDITOR_ELEMENT_BORDER                      1535
+#define IMG_EDITOR_ELEMENT_BORDER_INPUT                        1536
+#define IMG_EDITOR_CASCADE_LIST                                1537
+#define IMG_EDITOR_CASCADE_LIST_ACTIVE                 1538
+#define IMG_BACKGROUND_ENVELOPE_1                      1539
+#define IMG_BACKGROUND_ENVELOPE_2                      1540
+#define IMG_BACKGROUND_ENVELOPE_3                      1541
+#define IMG_BACKGROUND_ENVELOPE_4                      1542
+#define IMG_TITLESCREEN_1                              1543
+#define IMG_TITLESCREEN_2                              1544
+#define IMG_TITLESCREEN_3                              1545
+#define IMG_TITLESCREEN_4                              1546
+#define IMG_TITLESCREEN_5                              1547
+#define IMG_BACKGROUND                                 1548
+#define IMG_BACKGROUND_TITLE                           1549
+#define IMG_BACKGROUND_MAIN                            1550
+#define IMG_BACKGROUND_LEVELS                          1551
+#define IMG_BACKGROUND_SCORES                          1552
+#define IMG_BACKGROUND_EDITOR                          1553
+#define IMG_BACKGROUND_INFO                            1554
+#define IMG_BACKGROUND_INFO_ELEMENTS                   1555
+#define IMG_BACKGROUND_INFO_MUSIC                      1556
+#define IMG_BACKGROUND_INFO_CREDITS                    1557
+#define IMG_BACKGROUND_INFO_PROGRAM                    1558
+#define IMG_BACKGROUND_INFO_LEVELSET                   1559
+#define IMG_BACKGROUND_SETUP                           1560
+#define IMG_BACKGROUND_DOOR                            1561
 
-#define NUM_IMAGE_FILES                                        1544
+#define NUM_IMAGE_FILES                                        1562
 
 #endif /* CONF_GFX_H */
index fa80f985feecbd50401aceb0c1cb615ce143bb55..bf92917f0bd0689ead93033620ce03c44dddc115 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index ef1ca99feb997c5cee288ba6692a488afd486bb4..564b5fbe733f60fea1efc16bd19f53e949926023 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 7f2b5bb6375b1fe8be306b81d0e79d1e147ab719..0733cb7b5b546bcb979c7c1171bd1de72a85f2eb 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index bb5f5e79d7e75efc52710aa2a6b9d3d0246824e2..834041710a3d668791229dff8709b49df573681d 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index a8d757b82a60a561c45d9969bf6f421248cabf32..8fce300ce5f487f16710803d225bf67384a33ff8 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index c15e0dec81385f29360c24201a7755b51bb1bc4c..1c3ce29a083677a45da67addc203c8ed9825072c 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 6663812dcf9af83155c617565fc674f30ae629c7..3c2fa46db458b93d6c841fed5fbdae73b1dfcffe 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index ec09d32961a64f0073f6dea76e7c0efd9fc27bcc..deea1f84983a704c3986ffd58dbfeda10ead15ca 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 01ea5064c5b0a2199551e5b7c29bd15df9aa6699..326ca2760971adf2845266157c03a69a8caaa00f 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 98dea38ddf34182ee7dafc2f7ede5bb653b508e9..0fba9bbe0d552857ecabfab1f39ab18e520e83f5 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2006-07-16 02:28]"
+#define COMPILE_DATE_STRING "[2006-08-20 20:05]"
index f80d82e09c4aa220e55af9f4abff1640bf43d3e6..6ec3cd8f53d473e8e17c423275fbf8f7044828c7 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -2402,6 +2402,8 @@ static struct
   int gd_x, gd_y;
   int x, y;
   int width, height;
+  int wheel_x, wheel_y;
+  int wheel_width, wheel_height;
   int type;
   int gadget_id;
   char *infotext;
@@ -2411,6 +2413,8 @@ static struct
     ED_SCROLLBAR_XPOS,                 ED_SCROLLBAR_YPOS,
     SX + ED_SCROLL_HORIZONTAL_XPOS,    SY + ED_SCROLL_HORIZONTAL_YPOS,
     ED_SCROLL_HORIZONTAL_XSIZE,                ED_SCROLL_HORIZONTAL_YSIZE,
+    0,                                 0,
+    SX + SXSIZE + SX,                  WIN_YSIZE,
     GD_TYPE_SCROLLBAR_HORIZONTAL,
     GADGET_ID_SCROLL_HORIZONTAL,
     "scroll level editing area horizontally"
@@ -2419,6 +2423,8 @@ static struct
     ED_SCROLLBAR_XPOS,                 ED_SCROLLBAR_YPOS,
     SX + ED_SCROLL_VERTICAL_XPOS,      SY + ED_SCROLL_VERTICAL_YPOS,
     ED_SCROLL_VERTICAL_XSIZE,          ED_SCROLL_VERTICAL_YSIZE,
+    0,                                 0,
+    SX + SXSIZE + SX,                  WIN_YSIZE,
     GD_TYPE_SCROLLBAR_VERTICAL,
     GADGET_ID_SCROLL_VERTICAL,
     "scroll level editing area vertically"
@@ -2427,6 +2433,8 @@ static struct
     ED_SCROLLBAR2_XPOS,                        ED_SCROLLBAR2_YPOS,
     DX + ED_SCROLL2_VERTICAL_XPOS,     DY + ED_SCROLL2_VERTICAL_YPOS,
     ED_SCROLL2_VERTICAL_XSIZE,         ED_SCROLL2_VERTICAL_YSIZE,
+    SX + SXSIZE + SX,                  0,
+    WIN_XSIZE - (SX + SXSIZE + SX),    WIN_YSIZE,
     GD_TYPE_SCROLLBAR_VERTICAL,
     GADGET_ID_SCROLL_LIST_VERTICAL,
     "scroll element list vertically"
@@ -3127,28 +3135,10 @@ static int editor_hl_boulderdash[] =
   EL_CHAR('B'),
   EL_CHAR('D'),
   EL_EMPTY,
-
-#if 0
-  EL_CHAR('B'),
-  EL_CHAR('O'),
-  EL_CHAR('U'),
-  EL_CHAR('L'),
-
-  EL_CHAR('-'),
-  EL_CHAR('D'),
-  EL_CHAR('E'),
-  EL_CHAR('R'),
-
-  EL_CHAR('D'),
-  EL_CHAR('A'),
-  EL_CHAR('S'),
-  EL_CHAR('H'),
-#endif
 };
 
 static int editor_el_boulderdash[] =
 {
-#if 1
   EL_EMPTY,
   EL_SAND,
   EL_BD_ROCK,
@@ -3173,34 +3163,6 @@ static int editor_el_boulderdash[] =
   EL_BD_BUTTERFLY_DOWN,
   EL_BD_FIREFLY_DOWN,
   EL_EXIT_OPEN,
-
-#else
-
-  EL_PLAYER_1,
-  EL_EMPTY,
-  EL_SAND,
-  EL_STEELWALL,
-
-  EL_BD_WALL,
-  EL_BD_MAGIC_WALL,
-  EL_EXIT_CLOSED,
-  EL_EXIT_OPEN,
-
-  EL_BD_DIAMOND,
-  EL_BD_BUTTERFLY_UP,
-  EL_BD_FIREFLY_UP,
-  EL_BD_ROCK,
-
-  EL_BD_BUTTERFLY_LEFT,
-  EL_BD_FIREFLY_LEFT,
-  EL_BD_BUTTERFLY_RIGHT,
-  EL_BD_FIREFLY_RIGHT,
-
-  EL_BD_AMOEBA,
-  EL_BD_BUTTERFLY_DOWN,
-  EL_BD_FIREFLY_DOWN,
-  EL_BD_EXPANDABLE_WALL,
-#endif
 };
 static int *editor_hl_boulderdash_ptr = editor_hl_boulderdash;
 static int *editor_el_boulderdash_ptr = editor_el_boulderdash;
@@ -3213,28 +3175,10 @@ static int editor_hl_emerald_mine[] =
   EL_CHAR('E'),
   EL_CHAR('M'),
   EL_EMPTY,
-
-#if 0
-  EL_CHAR('E'),
-  EL_CHAR('M'),
-  EL_CHAR('E'),
-  EL_CHAR('-'),
-
-  EL_CHAR('R'),
-  EL_CHAR('A'),
-  EL_CHAR('L'),
-  EL_CHAR('D'),
-
-  EL_CHAR('M'),
-  EL_CHAR('I'),
-  EL_CHAR('N'),
-  EL_CHAR('E'),
-#endif
 };
 
 static int editor_el_emerald_mine[] =
 {
-#if 1
   EL_SAND,
   EL_ROCK,
   EL_QUICKSAND_EMPTY,
@@ -3294,79 +3238,6 @@ static int editor_el_emerald_mine[] =
   EL_EM_GATE_2_GRAY,
   EL_EM_GATE_3_GRAY,
   EL_EM_GATE_4_GRAY,
-
-#else
-
-  EL_PLAYER_1,
-  EL_PLAYER_2,
-  EL_SAND,
-  EL_ROCK,
-
-  EL_STEELWALL,
-  EL_WALL,
-  EL_WALL_SLIPPERY,
-  EL_MAGIC_WALL,
-
-  EL_EMERALD,
-  EL_DIAMOND,
-  EL_NUT,
-  EL_BOMB,
-
-  EL_WALL_EMERALD,
-  EL_WALL_DIAMOND,
-  EL_QUICKSAND_EMPTY,
-  EL_QUICKSAND_FULL,
-
-  EL_DYNAMITE,
-  EL_DYNAMITE_ACTIVE,
-  EL_EXIT_CLOSED,
-  EL_EXIT_OPEN,
-
-  EL_YAMYAM,
-  EL_BUG_UP,
-  EL_SPACESHIP_UP,
-  EL_ROBOT,
-
-  EL_BUG_LEFT,
-  EL_SPACESHIP_LEFT,
-  EL_BUG_RIGHT,
-  EL_SPACESHIP_RIGHT,
-
-  EL_ROBOT_WHEEL,
-  EL_BUG_DOWN,
-  EL_SPACESHIP_DOWN,
-  EL_INVISIBLE_WALL,
-
-  EL_ACID_POOL_TOPLEFT,
-  EL_ACID,
-  EL_ACID_POOL_TOPRIGHT,
-  EL_EMPTY,
-
-  EL_ACID_POOL_BOTTOMLEFT,
-  EL_ACID_POOL_BOTTOM,
-  EL_ACID_POOL_BOTTOMRIGHT,
-  EL_EMPTY,
-
-  EL_AMOEBA_DROP,
-  EL_AMOEBA_DEAD,
-  EL_AMOEBA_WET,
-  EL_AMOEBA_DRY,
-
-  EL_EM_KEY_1,
-  EL_EM_KEY_2,
-  EL_EM_KEY_3,
-  EL_EM_KEY_4,
-
-  EL_EM_GATE_1,
-  EL_EM_GATE_2,
-  EL_EM_GATE_3,
-  EL_EM_GATE_4,
-
-  EL_EM_GATE_1_GRAY,
-  EL_EM_GATE_2_GRAY,
-  EL_EM_GATE_3_GRAY,
-  EL_EM_GATE_4_GRAY,
-#endif
 };
 static int *editor_hl_emerald_mine_ptr = editor_hl_emerald_mine;
 static int *editor_el_emerald_mine_ptr = editor_el_emerald_mine;
@@ -3379,33 +3250,10 @@ static int editor_hl_emerald_mine_club[] =
   EL_CHAR('E'),
   EL_CHAR('M'),
   EL_CHAR('C'),
-
-#if 0
-  EL_CHAR('E'),
-  EL_CHAR('M'),
-  EL_CHAR('E'),
-  EL_CHAR('-'),
-
-  EL_CHAR('R'),
-  EL_CHAR('A'),
-  EL_CHAR('L'),
-  EL_CHAR('D'),
-
-  EL_CHAR('M'),
-  EL_CHAR('I'),
-  EL_CHAR('N'),
-  EL_CHAR('E'),
-
-  EL_CHAR('C'),
-  EL_CHAR('L'),
-  EL_CHAR('U'),
-  EL_CHAR('B'),
-#endif
 };
 
 static int editor_el_emerald_mine_club[] =
 {
-#if 1
   EL_EMC_KEY_5,
   EL_EMC_KEY_6,
   EL_EMC_KEY_7,
@@ -3480,89 +3328,6 @@ static int editor_el_emerald_mine_club[] =
   EL_YAMYAM_DOWN,
   EL_BALLOON_SWITCH_DOWN,
   EL_BALLOON_SWITCH_NONE,
-
-#else
-
-  EL_EMC_KEY_5,
-  EL_EMC_KEY_6,
-  EL_EMC_KEY_7,
-  EL_EMC_KEY_8,
-
-  EL_EMC_GATE_5,
-  EL_EMC_GATE_6,
-  EL_EMC_GATE_7,
-  EL_EMC_GATE_8,
-
-  EL_EMC_GATE_5_GRAY,
-  EL_EMC_GATE_6_GRAY,
-  EL_EMC_GATE_7_GRAY,
-  EL_EMC_GATE_8_GRAY,
-
-  EL_EMC_STEELWALL_1,
-  EL_EMC_STEELWALL_2,
-  EL_EMC_STEELWALL_3,
-  EL_EMC_STEELWALL_4,
-
-  EL_EMC_WALL_13,
-  EL_EMC_WALL_14,
-  EL_EMC_WALL_15,
-  EL_EMC_WALL_16,
-
-  EL_EMC_WALL_SLIPPERY_1,
-  EL_EMC_WALL_SLIPPERY_2,
-  EL_EMC_WALL_SLIPPERY_3,
-  EL_EMC_WALL_SLIPPERY_4,
-
-  EL_EMC_WALL_1,
-  EL_EMC_WALL_2,
-  EL_EMC_WALL_3,
-  EL_EMC_WALL_4,
-
-  EL_EMC_WALL_5,
-  EL_EMC_WALL_6,
-  EL_EMC_WALL_7,
-  EL_EMC_WALL_8,
-
-  EL_EMC_WALL_9,
-  EL_EMC_WALL_10,
-  EL_EMC_WALL_11,
-  EL_EMC_WALL_12,
-
-  EL_EMC_ANDROID,
-  EL_BALLOON,
-  EL_BALLOON_SWITCH_ANY,
-  EL_BALLOON_SWITCH_NONE,
-
-  EL_BALLOON_SWITCH_LEFT,
-  EL_BALLOON_SWITCH_RIGHT,
-  EL_BALLOON_SWITCH_UP,
-  EL_BALLOON_SWITCH_DOWN,
-
-  EL_EMC_GRASS,
-  EL_EMC_PLANT,
-  EL_EMC_LENSES,
-  EL_EMC_MAGNIFIER,
-
-  EL_EMC_MAGIC_BALL,
-  EL_EMC_MAGIC_BALL_SWITCH,
-  EL_SPRING,
-  EL_EMC_SPRING_BUMPER,
-
-  EL_EMC_DRIPPER,
-  EL_EMC_FAKE_GRASS,
-  EL_EMPTY,
-  EL_EMPTY,
-
-  EL_EM_DYNAMITE,
-  EL_EM_DYNAMITE_ACTIVE,
-  EL_EMPTY,
-  EL_EMPTY,
-
-  EL_YAMYAM_LEFT,
-  EL_YAMYAM_RIGHT,
-  EL_YAMYAM_UP,
-  EL_YAMYAM_DOWN,
-#endif
 };
 static int *editor_hl_emerald_mine_club_ptr = editor_hl_emerald_mine_club;
 static int *editor_el_emerald_mine_club_ptr = editor_el_emerald_mine_club;
@@ -3575,18 +3340,10 @@ static int editor_hl_rnd[] =
   EL_CHAR('R'),
   EL_CHAR('N'),
   EL_CHAR('D'),
-
-#if 0
-  EL_CHAR('M'),
-  EL_CHAR('O'),
-  EL_CHAR('R'),
-  EL_CHAR('E'),
-#endif
 };
 
 static int editor_el_rnd[] =
 {
-#if 1
   EL_KEY_1,
   EL_KEY_2,
   EL_KEY_3,
@@ -3666,99 +3423,11 @@ static int editor_el_rnd[] =
   EL_EXPANDABLE_WALL_HORIZONTAL,
   EL_EXPANDABLE_WALL_VERTICAL,
   EL_EXPANDABLE_WALL_ANY,
-
-#else
-
-  EL_KEY_1,
-  EL_KEY_2,
-  EL_KEY_3,
-  EL_KEY_4,
-
-  EL_GATE_1,
-  EL_GATE_2,
-  EL_GATE_3,
-  EL_GATE_4,
-
-  EL_GATE_1_GRAY,
-  EL_GATE_2_GRAY,
-  EL_GATE_3_GRAY,
-  EL_GATE_4_GRAY,
-
-  EL_ARROW_LEFT,
-  EL_ARROW_RIGHT,
-  EL_ARROW_UP,
-  EL_ARROW_DOWN,
-
-  EL_AMOEBA_DEAD,
-  EL_AMOEBA_DRY,
-  EL_AMOEBA_FULL,
-  EL_EMPTY,
-
-  EL_EMPTY,
-  EL_EMERALD_YELLOW,
-  EL_EMERALD_RED,
-  EL_EMERALD_PURPLE,
-
-  EL_WALL_BD_DIAMOND,
-  EL_WALL_EMERALD_YELLOW,
-  EL_WALL_EMERALD_RED,
-  EL_WALL_EMERALD_PURPLE,
-
-  EL_GAME_OF_LIFE,
-  EL_PACMAN_UP,
-  EL_TIME_ORB_FULL,
-  EL_TIME_ORB_EMPTY,
-
-  EL_PACMAN_LEFT,
-  EL_DARK_YAMYAM,
-  EL_PACMAN_RIGHT,
-  EL_EXPANDABLE_WALL,
-
-  EL_BIOMAZE,
-  EL_PACMAN_DOWN,
-  EL_LAMP,
-  EL_LAMP_ACTIVE,
-
-  EL_DYNABOMB_INCREASE_NUMBER,
-  EL_DYNABOMB_INCREASE_SIZE,
-  EL_DYNABOMB_INCREASE_POWER,
-  EL_STONEBLOCK,
-
-  EL_MOLE,
-  EL_PENGUIN,
-  EL_PIG,
-  EL_DRAGON,
-
-  EL_BUG,
-  EL_MOLE_UP,
-  EL_BD_BUTTERFLY,
-  EL_BD_FIREFLY,
-
-  EL_MOLE_LEFT,
-  EL_EMPTY,
-  EL_MOLE_RIGHT,
-  EL_PACMAN,
-
-  EL_SPACESHIP,
-  EL_MOLE_DOWN,
-  EL_EMPTY,
-  EL_EMPTY,
-
-  EL_SATELLITE,
-  EL_EXPANDABLE_WALL_HORIZONTAL,
-  EL_EXPANDABLE_WALL_VERTICAL,
-  EL_EXPANDABLE_WALL_ANY,
-
-  EL_INVISIBLE_STEELWALL,
-  EL_INVISIBLE_WALL,
-  EL_SPEED_PILL,
-  EL_BLACK_ORB,
-#endif
-};
-static int *editor_hl_rnd_ptr = editor_hl_rnd;
-static int *editor_el_rnd_ptr = editor_el_rnd;
-static int num_editor_hl_rnd = SIZEOF_ARRAY_INT(editor_hl_rnd);
-static int num_editor_el_rnd = SIZEOF_ARRAY_INT(editor_el_rnd);
+};
+static int *editor_hl_rnd_ptr = editor_hl_rnd;
+static int *editor_el_rnd_ptr = editor_el_rnd;
+static int num_editor_hl_rnd = SIZEOF_ARRAY_INT(editor_hl_rnd);
+static int num_editor_el_rnd = SIZEOF_ARRAY_INT(editor_el_rnd);
 
 static int editor_hl_sokoban[] =
 {
@@ -3766,18 +3435,6 @@ static int editor_hl_sokoban[] =
   EL_CHAR('S'),
   EL_CHAR('B'),
   EL_EMPTY,
-
-#if 0
-  EL_CHAR('S'),
-  EL_CHAR('O'),
-  EL_CHAR('K'),
-  EL_CHAR('O'),
-
-  EL_CHAR('-'),
-  EL_CHAR('B'),
-  EL_CHAR('A'),
-  EL_CHAR('N'),
-#endif
 };
 
 static int editor_el_sokoban[] =
@@ -3798,23 +3455,10 @@ static int editor_hl_supaplex[] =
   EL_CHAR('S'),
   EL_CHAR('P'),
   EL_EMPTY,
-
-#if 0
-  EL_CHAR('S'),
-  EL_CHAR('U'),
-  EL_CHAR('P'),
-  EL_CHAR('A'),
-
-  EL_CHAR('P'),
-  EL_CHAR('L'),
-  EL_CHAR('E'),
-  EL_CHAR('X'),
-#endif
 };
 
 static int editor_el_supaplex[] =
 {
-#if 1
   EL_SP_MURPHY,
   EL_EMPTY,
   EL_SP_BASE,
@@ -3864,63 +3508,6 @@ static int editor_el_supaplex[] =
   EL_SP_CHIP_LEFT,
   EL_SP_CHIP_RIGHT,
   EL_SP_CHIP_BOTTOM,
-
-#else
-
-#if 1
-  EL_EMPTY,
-#else
-  EL_SP_EMPTY,
-#endif
-  EL_SP_ZONK,
-  EL_SP_BASE,
-  EL_SP_MURPHY,
-
-  EL_SP_INFOTRON,
-  EL_SP_CHIP_SINGLE,
-  EL_SP_HARDWARE_GRAY,
-  EL_SP_EXIT_CLOSED,
-
-  EL_SP_DISK_ORANGE,
-  EL_SP_PORT_RIGHT,
-  EL_SP_PORT_DOWN,
-  EL_SP_PORT_LEFT,
-
-  EL_SP_PORT_UP,
-  EL_SP_GRAVITY_PORT_RIGHT,
-  EL_SP_GRAVITY_PORT_DOWN,
-  EL_SP_GRAVITY_PORT_LEFT,
-
-  EL_SP_GRAVITY_PORT_UP,
-  EL_SP_SNIKSNAK,
-  EL_SP_DISK_YELLOW,
-  EL_SP_TERMINAL,
-
-  EL_SP_DISK_RED,
-  EL_SP_PORT_VERTICAL,
-  EL_SP_PORT_HORIZONTAL,
-  EL_SP_PORT_ANY,
-
-  EL_SP_ELECTRON,
-  EL_SP_BUGGY_BASE,
-  EL_SP_CHIP_LEFT,
-  EL_SP_CHIP_RIGHT,
-
-  EL_SP_HARDWARE_BASE_1,
-  EL_SP_HARDWARE_GREEN,
-  EL_SP_HARDWARE_BLUE,
-  EL_SP_HARDWARE_RED,
-
-  EL_SP_HARDWARE_YELLOW,
-  EL_SP_HARDWARE_BASE_2,
-  EL_SP_HARDWARE_BASE_3,
-  EL_SP_HARDWARE_BASE_4,
-
-  EL_SP_HARDWARE_BASE_5,
-  EL_SP_HARDWARE_BASE_6,
-  EL_SP_CHIP_TOP,
-  EL_SP_CHIP_BOTTOM,
-#endif
 };
 static int *editor_hl_supaplex_ptr = editor_hl_supaplex;
 static int *editor_el_supaplex_ptr = editor_el_supaplex;
@@ -3933,33 +3520,10 @@ static int editor_hl_diamond_caves[] =
   EL_CHAR('D'),
   EL_CHAR('C'),
   EL_CHAR('2'),
-
-#if 0
-  EL_CHAR('D'),
-  EL_CHAR('I'),
-  EL_CHAR('A'),
-  EL_CHAR('-'),
-
-  EL_CHAR('M'),
-  EL_CHAR('O'),
-  EL_CHAR('N'),
-  EL_CHAR('D'),
-
-  EL_CHAR('C'),
-  EL_CHAR('A'),
-  EL_CHAR('V'),
-  EL_CHAR('E'),
-
-  EL_CHAR('S'),
-  EL_CHAR(' '),
-  EL_CHAR('I'),
-  EL_CHAR('I'),
-#endif
 };
 
 static int editor_el_diamond_caves[] =
 {
-#if 1
   EL_PEARL,
   EL_CRYSTAL,
   EL_WALL_PEARL,
@@ -4024,75 +3588,6 @@ static int editor_el_diamond_caves[] =
   EL_ENVELOPE_2,
   EL_ENVELOPE_3,
   EL_ENVELOPE_4,
-
-#else
-
-  EL_PEARL,
-  EL_CRYSTAL,
-  EL_WALL_PEARL,
-  EL_WALL_CRYSTAL,
-
-  EL_CONVEYOR_BELT_1_LEFT,
-  EL_CONVEYOR_BELT_1_MIDDLE,
-  EL_CONVEYOR_BELT_1_RIGHT,
-  EL_CONVEYOR_BELT_1_SWITCH_MIDDLE,
-
-  EL_CONVEYOR_BELT_2_LEFT,
-  EL_CONVEYOR_BELT_2_MIDDLE,
-  EL_CONVEYOR_BELT_2_RIGHT,
-  EL_CONVEYOR_BELT_2_SWITCH_MIDDLE,
-
-  EL_CONVEYOR_BELT_3_LEFT,
-  EL_CONVEYOR_BELT_3_MIDDLE,
-  EL_CONVEYOR_BELT_3_RIGHT,
-  EL_CONVEYOR_BELT_3_SWITCH_MIDDLE,
-
-  EL_CONVEYOR_BELT_4_LEFT,
-  EL_CONVEYOR_BELT_4_MIDDLE,
-  EL_CONVEYOR_BELT_4_RIGHT,
-  EL_CONVEYOR_BELT_4_SWITCH_MIDDLE,
-
-  EL_CONVEYOR_BELT_1_SWITCH_LEFT,
-  EL_CONVEYOR_BELT_2_SWITCH_LEFT,
-  EL_CONVEYOR_BELT_3_SWITCH_LEFT,
-  EL_CONVEYOR_BELT_4_SWITCH_LEFT,
-
-  EL_CONVEYOR_BELT_1_SWITCH_RIGHT,
-  EL_CONVEYOR_BELT_2_SWITCH_RIGHT,
-  EL_CONVEYOR_BELT_3_SWITCH_RIGHT,
-  EL_CONVEYOR_BELT_4_SWITCH_RIGHT,
-
-  EL_SWITCHGATE_OPEN,
-  EL_SWITCHGATE_CLOSED,
-  EL_SWITCHGATE_SWITCH_UP,
-  EL_SWITCHGATE_SWITCH_DOWN,
-
-  EL_ENVELOPE_1,
-  EL_ENVELOPE_2,
-  EL_ENVELOPE_3,
-  EL_ENVELOPE_4,
-
-  EL_TIMEGATE_CLOSED,
-  EL_TIMEGATE_OPEN,
-  EL_TIMEGATE_SWITCH,
-  EL_EMPTY,
-
-  EL_LANDMINE,
-  EL_INVISIBLE_SAND,
-  EL_STEELWALL_SLIPPERY,
-  EL_EMPTY,
-
-  EL_SIGN_EXCLAMATION,
-  EL_SIGN_STOP,
-  EL_LIGHT_SWITCH,
-  EL_LIGHT_SWITCH_ACTIVE,
-
-  EL_SHIELD_NORMAL,
-  EL_SHIELD_DEADLY,
-  EL_EXTRA_TIME,
-  EL_EMPTY,
-
-#endif
 };
 static int *editor_hl_diamond_caves_ptr = editor_hl_diamond_caves;
 static int *editor_el_diamond_caves_ptr = editor_el_diamond_caves;
@@ -4105,28 +3600,6 @@ static int editor_hl_dx_boulderdash[] =
   EL_CHAR('D'),
   EL_CHAR('X'),
   EL_EMPTY,
-
-#if 0
-  EL_CHAR('D'),
-  EL_CHAR('X'),
-  EL_CHAR('-'),
-  EL_CHAR(' '),
-
-  EL_CHAR('B'),
-  EL_CHAR('O'),
-  EL_CHAR('U'),
-  EL_CHAR('L'),
-
-  EL_CHAR('-'),
-  EL_CHAR('D'),
-  EL_CHAR('E'),
-  EL_CHAR('R'),
-
-  EL_CHAR('D'),
-  EL_CHAR('A'),
-  EL_CHAR('S'),
-  EL_CHAR('H'),
-#endif
 };
 
 static int editor_el_dx_boulderdash[] =
@@ -4162,13 +3635,6 @@ static int editor_hl_chars[] =
   EL_CHAR('T'),
   EL_CHAR('X'),
   EL_CHAR('T'),
-
-#if 0
-  EL_CHAR('T'),
-  EL_CHAR('E'),
-  EL_CHAR('X'),
-  EL_CHAR('T'),
-#endif
 };
 
 static int editor_el_chars[] =
@@ -4259,43 +3725,21 @@ static int editor_el_chars[] =
   EL_CHAR('Ãœ'),
 
   EL_CHAR('°'),
-  EL_CHAR('®'),
-  EL_CHAR(FONT_ASCII_CURSOR),
-  EL_CHAR(' ')
-};
-static int *editor_hl_chars_ptr = editor_hl_chars;
-static int *editor_el_chars_ptr = editor_el_chars;
-static int num_editor_hl_chars = SIZEOF_ARRAY_INT(editor_hl_chars);
-static int num_editor_el_chars = SIZEOF_ARRAY_INT(editor_el_chars);
-
-static int editor_hl_custom[] =
-{
-  EL_INTERNAL_CASCADE_CE_ACTIVE,
-  EL_CHAR('C'),
-  EL_CHAR('E'),
-  EL_EMPTY,
-
-#if 0
-  EL_CHAR('C'),
-  EL_CHAR('U'),
-  EL_CHAR('S'),
-  EL_CHAR('-'),
-
-  EL_CHAR('T'),
-  EL_CHAR('O'),
-  EL_CHAR('M'),
-  EL_CHAR(' '),
-
-  EL_CHAR('E'),
-  EL_CHAR('L'),
-  EL_CHAR('E'),
-  EL_CHAR('M'),
+  EL_CHAR('®'),
+  EL_CHAR(FONT_ASCII_CURSOR),
+  EL_CHAR(' ')
+};
+static int *editor_hl_chars_ptr = editor_hl_chars;
+static int *editor_el_chars_ptr = editor_el_chars;
+static int num_editor_hl_chars = SIZEOF_ARRAY_INT(editor_hl_chars);
+static int num_editor_el_chars = SIZEOF_ARRAY_INT(editor_el_chars);
 
+static int editor_hl_custom[] =
+{
+  EL_INTERNAL_CASCADE_CE_ACTIVE,
+  EL_CHAR('C'),
   EL_CHAR('E'),
-  EL_CHAR('N'),
-  EL_CHAR('T'),
-  EL_CHAR('S'),
-#endif
+  EL_EMPTY,
 };
 
 static int editor_el_custom[] =
@@ -4625,59 +4069,12 @@ static int *editor_el_custom_ptr = editor_el_custom;
 static int num_editor_hl_custom = SIZEOF_ARRAY_INT(editor_hl_custom);
 static int num_editor_el_custom = SIZEOF_ARRAY_INT(editor_el_custom);
 
-static int editor_hl_reference[] =
-{
-  EL_INTERNAL_CASCADE_REF_ACTIVE,
-  EL_CHAR('R'),
-  EL_CHAR('E'),
-  EL_CHAR('F')
-};
-
-static int editor_el_reference[] =
-{
-  EL_TRIGGER_PLAYER,
-  EL_TRIGGER_ELEMENT,
-  EL_TRIGGER_CE_VALUE,
-  EL_TRIGGER_CE_SCORE,
-
-  EL_EMPTY,
-  EL_EMPTY,
-  EL_CURRENT_CE_VALUE,
-  EL_CURRENT_CE_SCORE
-};
-static int *editor_hl_reference_ptr = editor_hl_reference;
-static int *editor_el_reference_ptr = editor_el_reference;
-static int num_editor_hl_reference = SIZEOF_ARRAY_INT(editor_hl_reference);
-static int num_editor_el_reference = SIZEOF_ARRAY_INT(editor_el_reference);
-
 static int editor_hl_group[] =
 {
   EL_INTERNAL_CASCADE_GE_ACTIVE,
   EL_CHAR('G'),
   EL_CHAR('E'),
   EL_EMPTY,
-
-#if 0
-  EL_CHAR('G'),
-  EL_CHAR('R'),
-  EL_CHAR('O'),
-  EL_CHAR('U'),
-
-  EL_CHAR('P'),
-  EL_CHAR(' '),
-  EL_CHAR(' '),
-  EL_CHAR(' '),
-
-  EL_CHAR('E'),
-  EL_CHAR('L'),
-  EL_CHAR('E'),
-  EL_CHAR('M'),
-
-  EL_CHAR('E'),
-  EL_CHAR('N'),
-  EL_CHAR('T'),
-  EL_CHAR('S'),
-#endif
 };
 
 static int editor_el_group[] =
@@ -4727,29 +4124,57 @@ static int *editor_el_group_ptr = editor_el_group;
 static int num_editor_hl_group = SIZEOF_ARRAY_INT(editor_hl_group);
 static int num_editor_el_group = SIZEOF_ARRAY_INT(editor_el_group);
 
+static int editor_hl_reference[] =
+{
+  EL_INTERNAL_CASCADE_REF_ACTIVE,
+  EL_CHAR('R'),
+  EL_CHAR('E'),
+  EL_CHAR('F')
+};
+
+static int editor_el_reference[] =
+{
+  EL_TRIGGER_PLAYER,
+  EL_TRIGGER_ELEMENT,
+  EL_TRIGGER_CE_VALUE,
+  EL_TRIGGER_CE_SCORE,
+
+  EL_SELF,
+  EL_ANY_ELEMENT,
+  EL_CURRENT_CE_VALUE,
+  EL_CURRENT_CE_SCORE,
+
+  EL_LAST_CE_8,
+  EL_LAST_CE_7,
+  EL_LAST_CE_6,
+  EL_LAST_CE_5,
+
+  EL_LAST_CE_4,
+  EL_LAST_CE_3,
+  EL_LAST_CE_2,
+  EL_LAST_CE_1,
+
+  EL_NEXT_CE_1,
+  EL_NEXT_CE_2,
+  EL_NEXT_CE_3,
+  EL_NEXT_CE_4,
+
+  EL_NEXT_CE_5,
+  EL_NEXT_CE_6,
+  EL_NEXT_CE_7,
+  EL_NEXT_CE_8,
+};
+static int *editor_hl_reference_ptr = editor_hl_reference;
+static int *editor_el_reference_ptr = editor_el_reference;
+static int num_editor_hl_reference = SIZEOF_ARRAY_INT(editor_hl_reference);
+static int num_editor_el_reference = SIZEOF_ARRAY_INT(editor_el_reference);
+
 static int editor_hl_user_defined[] =
 {
   EL_INTERNAL_CASCADE_USER_ACTIVE,
   EL_CHAR('M'),
   EL_CHAR('Y'),
   EL_EMPTY,
-
-#if 0
-  EL_CHAR('U'),
-  EL_CHAR('S'),
-  EL_CHAR('E'),
-  EL_CHAR('R'),
-
-  EL_CHAR('D'),
-  EL_CHAR('E'),
-  EL_CHAR('F'),
-  EL_CHAR('I'),
-
-  EL_CHAR('-'),
-  EL_CHAR('N'),
-  EL_CHAR('E'),
-  EL_CHAR('D'),
-#endif
 };
 
 static int *editor_hl_user_defined_ptr = editor_hl_user_defined;
@@ -4871,18 +4296,18 @@ editor_elements_info[] =
     &editor_hl_custom_ptr,             &num_editor_hl_custom,
     &editor_el_custom_ptr,             &num_editor_el_custom
   },
-  {
-    &setup.editor.el_custom,
-    &setup.editor_cascade.el_ref,
-    &editor_hl_reference_ptr,          &num_editor_hl_reference,
-    &editor_el_reference_ptr,          &num_editor_el_reference
-  },
   {
     &setup.editor.el_custom,
     &setup.editor_cascade.el_ge,
     &editor_hl_group_ptr,              &num_editor_hl_group,
     &editor_el_group_ptr,              &num_editor_el_group
   },
+  {
+    &setup.editor.el_custom,
+    &setup.editor_cascade.el_ref,
+    &editor_hl_reference_ptr,          &num_editor_hl_reference,
+    &editor_el_reference_ptr,          &num_editor_el_reference
+  },
   {
     &setup.editor.el_user_defined,
     &setup.editor_cascade.el_user,
@@ -4946,11 +4371,7 @@ static char *getElementInfoText(int element)
 {
   char *info_text = NULL;
 
-#if 1
   if (element < MAX_NUM_ELEMENTS)
-#else
-  if (element < NUM_FILE_ELEMENTS)
-#endif
   {
     if (strlen(element_info[element].description) > 0)
       info_text = element_info[element].description;
@@ -6140,6 +5561,10 @@ static void CreateScrollbarGadgets()
                      GDI_SCROLLBAR_ITEMS_MAX, items_max,
                      GDI_SCROLLBAR_ITEMS_VISIBLE, items_visible,
                      GDI_SCROLLBAR_ITEM_POSITION, item_position,
+                     GDI_WHEEL_AREA_X, scrollbar_info[i].wheel_x,
+                     GDI_WHEEL_AREA_Y, scrollbar_info[i].wheel_y,
+                     GDI_WHEEL_AREA_WIDTH, scrollbar_info[i].wheel_width,
+                     GDI_WHEEL_AREA_HEIGHT, scrollbar_info[i].wheel_height,
                      GDI_STATE, GD_BUTTON_UNPRESSED,
                      GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
                      GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
@@ -6332,11 +5757,7 @@ static void MapCounterButtons(int id)
   int yoffset_above = MINI_TILEX + ED_GADGET_DISTANCE;
   int yoffset = ED_BORDER_SIZE;
   int x_left = gi_down->x - xoffset_left;
-#if 1
   int x_right; /* set after gadget position was modified */
-#else
-  int x_right = gi_up->x + gi_up->width + xoffset_right;
-#endif
   int y_above = gi_down->y - yoffset_above;
   int x = gi_down->x;
   int y;       /* set after gadget position was modified */
@@ -6796,22 +6217,12 @@ static void setSelectboxSpecialActionVariablesIfNeeded()
       /* only change if corresponding selectbox has changed */
       if (selectbox_info[ED_SELECTBOX_ID_ACTION_MODE].options !=
          action_arg_modes[mode])
-#if 0
-       custom_element_change.action_mode =
-         (action_arg_modes[mode])[0].value;
-#else
        custom_element_change.action_mode = -1;
-#endif
 
       /* only change if corresponding selectbox has changed */
       if (selectbox_info[ED_SELECTBOX_ID_ACTION_ARG].options !=
          action_arg_options[i].options)
-#if 0
-       custom_element_change.action_arg =
-         action_arg_options[i].options[0].value;
-#else
        custom_element_change.action_arg = -1;
-#endif
 
       break;
     }
@@ -6843,8 +6254,6 @@ static void setSelectboxSpecialActionOptions()
   }
 }
 
-#if 1
-
 static void copy_custom_element_settings(int element_from, int element_to)
 {
   struct ElementInfo *ei_from = &element_info[element_from];
@@ -6853,85 +6262,6 @@ static void copy_custom_element_settings(int element_from, int element_to)
   copyElementInfo(ei_from, ei_to);
 }
 
-#else
-
-static void copy_custom_element_settings(int element_from, int element_to)
-{
-  struct ElementInfo *ei_from = &element_info[element_from];
-  struct ElementInfo *ei_to = &element_info[element_to];
-  int i, x, y;
-
-  /* ---------- copy element description ---------- */
-  for (i = 0; i < MAX_ELEMENT_NAME_LEN + 1; i++)
-    ei_to->description[i] = ei_from->description[i];
-
-  /* ---------- copy element base properties ---------- */
-#if 1
-  ei_to->properties[EP_BITFIELD_BASE_NR] =
-    ei_from->properties[EP_BITFIELD_BASE_NR];
-#else
-  Properties[element_to][EP_BITFIELD_BASE_NR] =
-    Properties[element_from][EP_BITFIELD_BASE_NR];
-#endif
-
-  /* ---------- copy custom property values ---------- */
-
-  ei_to->use_gfx_element = ei_from->use_gfx_element;
-  ei_to->gfx_element = ei_from->gfx_element;
-
-  ei_to->access_direction = ei_from->access_direction;
-
-  ei_to->collect_score_initial = ei_from->collect_score_initial;
-  ei_to->collect_count_initial = ei_from->collect_count_initial;
-
-  ei_to->ce_value_fixed_initial = ei_from->ce_value_fixed_initial;
-  ei_to->ce_value_random_initial = ei_from->ce_value_random_initial;
-  ei_to->use_last_ce_value = ei_from->use_last_ce_value;
-
-  ei_to->push_delay_fixed = ei_from->push_delay_fixed;
-  ei_to->push_delay_random = ei_from->push_delay_random;
-  ei_to->drop_delay_fixed = ei_from->drop_delay_fixed;
-  ei_to->drop_delay_random = ei_from->drop_delay_random;
-  ei_to->move_delay_fixed = ei_from->move_delay_fixed;
-  ei_to->move_delay_random = ei_from->move_delay_random;
-
-  ei_to->move_pattern = ei_from->move_pattern;
-  ei_to->move_direction_initial = ei_from->move_direction_initial;
-  ei_to->move_stepsize = ei_from->move_stepsize;
-
-  ei_to->move_enter_element = ei_from->move_enter_element;
-  ei_to->move_leave_element = ei_from->move_leave_element;
-  ei_to->move_leave_type = ei_from->move_leave_type;
-
-  ei_to->slippery_type = ei_from->slippery_type;
-
-  ei_to->explosion_type = ei_from->explosion_type;
-  ei_to->explosion_delay = ei_from->explosion_delay;
-  ei_to->ignition_delay = ei_from->ignition_delay;
-
-  for (y = 0; y < 3; y++)
-    for (x = 0; x < 3; x++)
-      ei_to->content.e[x][y] = ei_from->content.e[x][y];
-
-  /* ---------- reinitialize and copy change pages ---------- */
-
-  ei_to->num_change_pages = ei_from->num_change_pages;
-  ei_to->current_change_page = ei_from->current_change_page;
-
-  setElementChangePages(ei_to, ei_to->num_change_pages);
-
-  for (i = 0; i < ei_to->num_change_pages; i++)
-    ei_to->change_page[i] = ei_from->change_page[i];
-
-  /* ---------- copy group element info ---------- */
-  if (ei_from->group != NULL && ei_to->group != NULL)  /* group or internal */
-    *ei_to->group = *ei_from->group;
-
-  /* mark this custom element as modified */
-  ei_to->modified_settings = TRUE;
-}
-#endif
-
 static void replace_custom_element_in_settings(int element_from,
                                               int element_to)
 {
@@ -8072,7 +7402,6 @@ static void DrawPropertiesInfo()
   int screen_line = 0;
   int i, x, y;
 
-#if 1
   if (setup.editor.show_element_token)
   {
     DrawTextF(pad_x, pad_y + screen_line++ * font2_height, FONT_TEXT_3,
@@ -8080,24 +7409,6 @@ static void DrawPropertiesInfo()
     screen_line++;
   }
 
-#else
-
-#if DEBUG
-  if (IS_CUSTOM_ELEMENT(properties_element))
-  {
-    DrawTextF(pad_x, pad_y + screen_line++ * font2_height, FONT_TEXT_3,
-             "[Custom Element %d]", properties_element - EL_CUSTOM_START + 1);
-    screen_line++;
-  }
-  else if (IS_GROUP_ELEMENT(properties_element))
-  {
-    DrawTextF(pad_x, pad_y + screen_line++ * font2_height, FONT_TEXT_3,
-             "[Group Element %d]", properties_element - EL_GROUP_START + 1);
-    screen_line++;
-  }
-#endif
-#endif
-
   /* ----- print number of elements / percentage of this element in level */
 
   num_elements_in_level = 0;
@@ -8238,7 +7549,6 @@ static struct
   { EL_BD_MAGIC_WALL,  &level.time_magic_wall,         TEXT_DURATION   },
   { EL_ROBOT_WHEEL,    &level.time_wheel,              TEXT_DURATION   },
 
-#if 1
   { EL_TIMEGATE_SWITCH,        &level.time_timegate,           TEXT_DURATION   },
   { EL_LIGHT_SWITCH,   &level.time_light,              TEXT_DURATION   },
   { EL_LIGHT_SWITCH_ACTIVE, &level.time_light,         TEXT_DURATION   },
@@ -8254,9 +7564,7 @@ static struct
   { EL_BIOMAZE,                &level.biomaze[1],              TEXT_GAME_OF_LIFE_2 },
   { EL_BIOMAZE,                &level.biomaze[2],              TEXT_GAME_OF_LIFE_3 },
   { EL_BIOMAZE,                &level.biomaze[3],              TEXT_GAME_OF_LIFE_4 },
-#endif
 
-#if 1
   { EL_EMC_ANDROID,    &level.android_move_time,       TEXT_MOVE_SPEED },
   { EL_EMC_ANDROID,    &level.android_clone_time,      TEXT_CLONE_SPEED },
   { EL_EMC_MAGIC_BALL, &level.ball_time,               TEXT_BALL_DELAY },
@@ -8265,7 +7573,6 @@ static struct
   { EL_SPRING,         &level.slurp_score,             TEXT_SLURPING   },
   { EL_EMC_LENSES,     &level.lenses_time,             TEXT_DURATION   },
   { EL_EMC_MAGNIFIER,  &level.magnify_time,            TEXT_DURATION   },
-#endif
 
   { -1,                        NULL,                           NULL            }
 };
@@ -8441,11 +7748,6 @@ static void DrawPropertiesConfig()
   if (properties_element == EL_TIME_ORB_FULL)
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_USE_TIME_ORB_BUG);
 
-#if 0
-  if (properties_element == EL_BALLOON)
-    MapSelectboxGadget(ED_SELECTBOX_ID_WIND_DIRECTION);
-#endif
-
   if (CAN_GROW(properties_element))
   {
     checkbutton_info[ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE].y =
@@ -8697,26 +7999,14 @@ static void DrawPropertiesWindow()
           "Element Settings", FONT_TITLE_1);
 #endif
 
-#if 1
   FrameCounter = 0;    /* restart animation frame counter */
-#endif
 
   DrawElementBorder(SX + xstart * MINI_TILEX,
                    SY + ystart * MINI_TILEY + MINI_TILEY / 2,
                    TILEX, TILEY, FALSE);
-#if 1
+
   DrawEditorElementAnimation(SX + xstart * MINI_TILEX,
                             SY + ystart * MINI_TILEY + MINI_TILEY / 2);
-#else
-  DrawGraphicAnimationExt(drawto,
-                         SX + xstart * MINI_TILEX,
-                         SY + ystart * MINI_TILEY + MINI_TILEY / 2,
-                         el2img(properties_element), -1, NO_MASKING);
-#endif
-
-#if 0
-  FrameCounter = 0;    /* restart animation frame counter */
-#endif
 
   DrawEditorElementName((xstart + 3) * MINI_TILEX + 1,
                        (ystart + 1) * MINI_TILEY + 1,
@@ -9459,10 +8749,8 @@ static void HandleDrawingAreas(struct GadgetInfo *gi)
   if (!started_inside_drawing_area)
     return;
 
-#if 1
   if (!IS_VALID_BUTTON(button))
     return;
-#endif
 
   if (!button && !button_release_event)
     return;
@@ -9803,14 +9091,7 @@ static void HandleSelectboxGadgets(struct GadgetInfo *gi)
     {
       /* when changing action type, also check action mode and action arg */
       if (value_old != value_new)
-      {
-#if 1
        setSelectboxSpecialActionVariablesIfNeeded();
-#else
-       custom_element_change.action_mode = -1;
-       custom_element_change.action_arg = -1;
-#endif
-      }
 
       DrawPropertiesChange();
     }
@@ -9983,14 +9264,6 @@ static void HandleControlButtons(struct GadgetInfo *gi)
   int new_element = BUTTON_ELEMENT(button);
   int x, y;
 
-#if 0
-  /* MAKES PROBLEMS WITH ELEMENT LIST SCROLLBAR AND IS PROBABLY NOT NEEDED */
-  /* !!! CHECK WHAT HAPPENS WHEN MOUSE WHEEL IS USED OVER ELEMENT LIST !!! */
-
-  if (!IS_VALID_BUTTON(button))
-    return;
-#endif
-
   if (edit_mode == ED_MODE_DRAWING && drawing_function == GADGET_ID_TEXT)
     DrawLevelText(0, 0, 0, TEXT_END);
 
@@ -10455,8 +9728,12 @@ void HandleLevelEditorKeyInput(Key key)
 
       case KSYM_Insert:
       case KSYM_Delete:
-#if 1
-       /* IS_EDITOR_CASCADE */
+
+       /* this is needed to prevent interference with running "True X-Mouse" */
+       if (GetKeyModStateFromEvents() & KMOD_Control)
+         break;
+
+       /* check for last or next editor cascade block in element list */
        for (i = 0; i < num_editor_elements; i++)
        {
          if ((key == KSYM_Insert && i == element_shift) ||
@@ -10480,36 +9757,6 @@ void HandleLevelEditorKeyInput(Key key)
 
        ModifyEditorElementList();
 
-#else
-
-       for (i = 0; i < num_editor_elements; i++)
-       {
-         int e = editor_elements[i];
-
-         if ((key == KSYM_Insert &&
-              (e == EL_INTERNAL_CASCADE_CE ||
-               e == EL_INTERNAL_CASCADE_CE_ACTIVE)) ||
-             (key == KSYM_Delete &&
-              (e == EL_INTERNAL_CASCADE_GE ||
-               e == EL_INTERNAL_CASCADE_GE_ACTIVE)))
-           break;
-       }
-
-       if (i < num_editor_elements)
-       {
-         element_shift = i;
-
-         if (element_shift > num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS)
-           element_shift = num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS;
-
-         ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL],
-                      GDI_SCROLLBAR_ITEM_POSITION,
-                      element_shift / ED_ELEMENTLIST_BUTTONS_HORIZ, GDI_END);
-
-         ModifyEditorElementList();
-       }
-#endif
-
        break;
 
       case KSYM_Escape:
@@ -10530,6 +9777,7 @@ void HandleLevelEditorKeyInput(Key key)
          DrawDrawingWindow();
          edit_mode = ED_MODE_DRAWING;
        }
+
         break;
 
       default:
@@ -10562,15 +9810,8 @@ void HandleLevelEditorIdle()
   if (!DelayReached(&action_delay, action_delay_value))
     return;
 
-#if 1
   DrawEditorElementAnimation(SX + xpos * TILEX,
                             SY + ypos * TILEY + MINI_TILEY / 2);
-#else
-  DrawGraphicAnimationExt(drawto,
-                         SX + xpos * TILEX,
-                         SY + ypos * TILEY + MINI_TILEY / 2,
-                         el2img(properties_element), -1, NO_MASKING);
-#endif
 
   MarkTileDirty(xpos, ypos);
   MarkTileDirty(xpos, ypos + 1);
@@ -10622,11 +9863,6 @@ void PrintEditorGadgetInfoText(struct GadgetInfo *gi)
 void HandleEditorGadgetInfoText(void *ptr)
 {
   struct GadgetInfo *gi = (struct GadgetInfo *)ptr;
-#if 0
-  char infotext[MAX_OUTPUT_LINESIZE + 1];
-  char shortcut[MAX_OUTPUT_LINESIZE + 1];
-  int max_infotext_len = getMaxInfoTextLength();
-#endif
 
   if (game_status != GAME_MODE_EDITOR)
     return;
@@ -10640,38 +9876,7 @@ void HandleEditorGadgetInfoText(void *ptr)
   if (edit_mode == ED_MODE_DRAWING && draw_with_brush)
     DeleteBrushFromCursor();
 
-#if 1
   PrintEditorGadgetInfoText(gi);
-#else
-  if (gi == NULL || gi->info_text == NULL)
-    return;
-
-  strncpy(infotext, gi->info_text, max_infotext_len);
-  infotext[max_infotext_len] = '\0';
-
-  if (gi->custom_id < ED_NUM_CTRL_BUTTONS)
-  {
-    int key = control_info[gi->custom_id].shortcut;
-
-    if (key)
-    {
-      if (gi->custom_id == GADGET_ID_SINGLE_ITEMS)     /* special case 1 */
-       sprintf(shortcut, " ('.' or '%c')", key);
-      else if (gi->custom_id == GADGET_ID_PICK_ELEMENT)        /* special case 2 */
-       sprintf(shortcut, " ('%c' or 'Ctrl')", key);
-      else if (gi->custom_id == GADGET_ID_TEST)                /* special case 3 */
-       sprintf(shortcut, " ('Enter' or 'Shift-%c')", key);
-      else                                             /* normal case */
-       sprintf(shortcut, " ('%s%c')",
-               (key >= 'A' && key <= 'Z' ? "Shift-" : ""), key);
-
-      if (strlen(infotext) + strlen(shortcut) <= max_infotext_len)
-       strcat(infotext, shortcut);
-    }
-  }
-
-  DrawText(INFOTEXT_XPOS, INFOTEXT_YPOS, infotext, FONT_TEXT_2);
-#endif
 }
 
 static void HandleDrawingAreaInfo(struct GadgetInfo *gi)
@@ -10835,12 +10040,8 @@ void RequestExitLevelEditor(boolean ask_if_level_has_changed)
       Request("Level has changed ! Exit without saving ?",
              REQ_ASK | REQ_STAY_OPEN))
   {
-#if 1
     CloseDoor(DOOR_CLOSE_1);
     SetDoorState(DOOR_CLOSE_2);
-#else
-    CloseDoor(DOOR_CLOSE_ALL);
-#endif
     game_status = GAME_MODE_MAIN;
     DrawMainMenu();
   }
index 62617108c26776cc2fe827ff51c2b72437ed26b2..245e056685fe00856f3dcaa783a3d7ab12260612 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
 
 #include "main.h"
 
-/* number of element button columns and rows in the edit window */
-#define MAX_ELEM_X             4
-#define MAX_ELEM_Y             10
-
 void CreateLevelEditorGadgets();
 void FreeLevelEditorGadgets();
 void UnmapLevelEditorGadgets();
index 8559dc55b043de334efe694ee0cdfc8cfc7124cc..4f894e926880cbf2646f359dc095add5367669ec 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2004 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 134a5e73f536a54d9ac7288c7502df7a69a62ce5..d42acf56eff9f1d436eef48395d162c97b1eaa9e 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -24,6 +24,9 @@
 #include "network.h"
 
 
+#define        DEBUG_EVENTS            0
+
+
 static boolean cursor_inside_playfield = FALSE;
 static boolean playfield_cursor_set = FALSE;
 static unsigned long playfield_cursor_delay = 0;
@@ -315,6 +318,11 @@ void HandleExposeEvent(ExposeEvent *event)
 
 void HandleButtonEvent(ButtonEvent *event)
 {
+#if DEBUG_EVENTS
+  printf("::: BUTTON EVENT: button %d %s\n", event->button,
+        event->type == EVENT_BUTTONPRESS ? "pressed" : "released");
+#endif
+
   motion_status = FALSE;
 
   if (event->type == EVENT_BUTTONPRESS)
@@ -322,7 +330,7 @@ void HandleButtonEvent(ButtonEvent *event)
   else
     button_status = MB_RELEASED;
 
-  HandleButton(event->x, event->y, button_status);
+  HandleButton(event->x, event->y, button_status, event->button);
 }
 
 void HandleMotionEvent(MotionEvent *event)
@@ -335,7 +343,7 @@ void HandleMotionEvent(MotionEvent *event)
 
   motion_status = TRUE;
 
-  HandleButton(event->x, event->y, button_status);
+  HandleButton(event->x, event->y, button_status, button_status);
 }
 
 void HandleKeyEvent(KeyEvent *event)
@@ -345,6 +353,11 @@ void HandleKeyEvent(KeyEvent *event)
   Key key = GetEventKey(event, with_modifiers);
   Key keymod = (with_modifiers ? GetEventKey(event, FALSE) : key);
 
+#if DEBUG_EVENTS
+  printf("::: KEY EVENT: %d %s\n", GetEventKey(event, TRUE),
+        event->type == EVENT_KEYPRESS ? "pressed" : "released");
+#endif
+
   HandleKeyModState(keymod, key_status);
   HandleKey(key, key_status);
 }
@@ -396,7 +409,7 @@ void HandleClientMessageEvent(ClientMessageEvent *event)
     CloseAllAndExit(0);
 }
 
-void HandleButton(int mx, int my, int button)
+void HandleButton(int mx, int my, int button, int button_nr)
 {
   static int old_mx = 0, old_my = 0;
 
@@ -418,14 +431,18 @@ void HandleButton(int mx, int my, int button)
     mx = my = -32;     /* force mouse event to be outside screen tiles */
   }
 
-  switch(game_status)
+  /* do not use scroll wheel button events for anything other than gadgets */
+  if (IS_WHEEL_BUTTON(button_nr))
+    return;
+
+  switch (game_status)
   {
     case GAME_MODE_TITLE:
-      HandleTitleScreen(mx,my, 0,0, button);
+      HandleTitleScreen(mx, my, 0, 0, button);
       break;
 
     case GAME_MODE_MAIN:
-      HandleMainMenu(mx,my, 0,0, button);
+      HandleMainMenu(mx, my, 0, 0, button);
       break;
 
     case GAME_MODE_PSEUDO_TYPENAME:
@@ -433,11 +450,11 @@ void HandleButton(int mx, int my, int button)
       break;
 
     case GAME_MODE_LEVELS:
-      HandleChooseLevel(mx,my, 0,0, button);
+      HandleChooseLevel(mx, my, 0, 0, button);
       break;
 
     case GAME_MODE_SCORES:
-      HandleHallOfFame(0,0, 0,0, button);
+      HandleHallOfFame(0, 0, 0, 0, button);
       break;
 
     case GAME_MODE_EDITOR:
@@ -445,11 +462,11 @@ void HandleButton(int mx, int my, int button)
       break;
 
     case GAME_MODE_INFO:
-      HandleInfoScreen(mx,my, 0,0, button);
+      HandleInfoScreen(mx, my, 0, 0, button);
       break;
 
     case GAME_MODE_SETUP:
-      HandleSetupScreen(mx,my, 0,0, button);
+      HandleSetupScreen(mx, my, 0, 0, button);
       break;
 
     case GAME_MODE_PLAYING:
@@ -498,7 +515,7 @@ static void HandleKeysSpecial(Key key)
   cheat_input[cheat_input_len++] = letter;
   cheat_input[cheat_input_len] = '\0';
 
-#if 0
+#if DEBUG_EVENTS
   printf("::: '%s' [%d]\n", cheat_input, cheat_input_len);
 #endif
 
@@ -673,12 +690,20 @@ void HandleKey(Key key, int key_status)
   if (key_status == KEY_RELEASED)
     return;
 
+  if ((key == KSYM_Return || key == KSYM_KP_Enter) &&
+      (GetKeyModState() & KMOD_Alt) && video.fullscreen_available)
+  {
+    setup.fullscreen = !setup.fullscreen;
+
+    ToggleFullscreenIfNeeded();
+
+    return;
+  }
+
   if (game_status == GAME_MODE_PLAYING && AllPlayersGone &&
       (key == KSYM_Return || key == setup.shortcut.toggle_pause))
   {
-    CloseDoor(DOOR_CLOSE_1);
-    game_status = GAME_MODE_MAIN;
-    DrawMainMenu();
+    GameEnd();
 
     return;
   }
@@ -744,54 +769,58 @@ void HandleKey(Key key, int key_status)
     case GAME_MODE_LEVELS:
     case GAME_MODE_SETUP:
     case GAME_MODE_INFO:
+    case GAME_MODE_SCORES:
       switch(key)
       {
-#if 1
-       case KSYM_space:
-#else
-       /* !!! only use "space" key to start game from main menu !!! */
        case KSYM_space:
-#endif
        case KSYM_Return:
          if (game_status == GAME_MODE_TITLE)
-           HandleTitleScreen(0,0, 0,0, MB_MENU_CHOICE);
+           HandleTitleScreen(0, 0, 0, 0, MB_MENU_CHOICE);
          else if (game_status == GAME_MODE_MAIN)
-           HandleMainMenu(0,0, 0,0, MB_MENU_CHOICE);
+           HandleMainMenu(0, 0, 0, 0, MB_MENU_CHOICE);
           else if (game_status == GAME_MODE_LEVELS)
-            HandleChooseLevel(0,0, 0,0, MB_MENU_CHOICE);
+            HandleChooseLevel(0, 0, 0, 0, MB_MENU_CHOICE);
          else if (game_status == GAME_MODE_SETUP)
-           HandleSetupScreen(0,0, 0,0, MB_MENU_CHOICE);
+           HandleSetupScreen(0, 0, 0, 0, MB_MENU_CHOICE);
          else if (game_status == GAME_MODE_INFO)
-           HandleInfoScreen(0,0, 0,0, MB_MENU_CHOICE);
+           HandleInfoScreen(0, 0, 0, 0, MB_MENU_CHOICE);
+         else if (game_status == GAME_MODE_SCORES)
+           HandleHallOfFame(0, 0, 0, 0, MB_MENU_CHOICE);
          break;
 
        case KSYM_Escape:
          if (game_status == GAME_MODE_TITLE)
-           HandleTitleScreen(0,0, 0,0, MB_MENU_LEAVE);
+           HandleTitleScreen(0, 0, 0, 0, MB_MENU_LEAVE);
           else if (game_status == GAME_MODE_LEVELS)
-            HandleChooseLevel(0,0, 0,0, MB_MENU_LEAVE);
+            HandleChooseLevel(0, 0, 0, 0, MB_MENU_LEAVE);
          else if (game_status == GAME_MODE_SETUP)
-           HandleSetupScreen(0,0, 0,0, MB_MENU_LEAVE);
+           HandleSetupScreen(0, 0, 0, 0, MB_MENU_LEAVE);
          else if (game_status == GAME_MODE_INFO)
-           HandleInfoScreen(0,0, 0,0, MB_MENU_LEAVE);
+           HandleInfoScreen(0, 0, 0, 0, MB_MENU_LEAVE);
+         else if (game_status == GAME_MODE_SCORES)
+           HandleHallOfFame(0, 0, 0, 0, MB_MENU_LEAVE);
          break;
 
         case KSYM_Page_Up:
           if (game_status == GAME_MODE_LEVELS)
-            HandleChooseLevel(0,0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK);
+            HandleChooseLevel(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK);
          else if (game_status == GAME_MODE_SETUP)
-           HandleSetupScreen(0,0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK);
+           HandleSetupScreen(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK);
          else if (game_status == GAME_MODE_INFO)
-           HandleInfoScreen(0,0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK);
+           HandleInfoScreen(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK);
+         else if (game_status == GAME_MODE_SCORES)
+           HandleHallOfFame(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK);
          break;
 
         case KSYM_Page_Down:
           if (game_status == GAME_MODE_LEVELS)
-            HandleChooseLevel(0,0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK);
+            HandleChooseLevel(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK);
          else if (game_status == GAME_MODE_SETUP)
-           HandleSetupScreen(0,0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK);
+           HandleSetupScreen(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK);
          else if (game_status == GAME_MODE_INFO)
-           HandleInfoScreen(0,0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK);
+           HandleInfoScreen(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK);
+         else if (game_status == GAME_MODE_SCORES)
+           HandleHallOfFame(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK);
          break;
 
 #ifdef DEBUG
@@ -805,29 +834,6 @@ void HandleKey(Key key, int key_status)
       }
       break;
 
-    case GAME_MODE_SCORES:
-      switch(key)
-      {
-       case KSYM_space:
-       case KSYM_Return:
-       case KSYM_Escape:
-         game_status = GAME_MODE_MAIN;
-         DrawMainMenu();
-         break;
-
-        case KSYM_Page_Up:
-         HandleHallOfFame(0,0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK);
-         break;
-
-        case KSYM_Page_Down:
-         HandleHallOfFame(0,0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK);
-         break;
-
-       default:
-         break;
-      }
-      break;
-
     case GAME_MODE_EDITOR:
       if (!anyTextGadgetActiveOrJustFinished || key == KSYM_Escape)
        HandleLevelEditorKeyInput(key);
@@ -947,7 +953,8 @@ void HandleNoEvent()
 {
   if (button_status && game_status != GAME_MODE_PLAYING)
   {
-    HandleButton(0, 0, -button_status);
+    HandleButton(0, 0, -button_status, button_status);
+
     return;
   }
 
@@ -1014,20 +1021,20 @@ void HandleJoystick()
        newbutton = dx = dy = 0;
 
       if (game_status == GAME_MODE_TITLE)
-       HandleTitleScreen(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
+       HandleTitleScreen(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
       else if (game_status == GAME_MODE_MAIN)
-       HandleMainMenu(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
+       HandleMainMenu(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
       else if (game_status == GAME_MODE_LEVELS)
-        HandleChooseLevel(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
+        HandleChooseLevel(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
       else if (game_status == GAME_MODE_SETUP)
-       HandleSetupScreen(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
+       HandleSetupScreen(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
       else if (game_status == GAME_MODE_INFO)
-       HandleInfoScreen(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
+       HandleInfoScreen(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
       break;
     }
 
     case GAME_MODE_SCORES:
-      HandleHallOfFame(0,0, dx,dy, !newbutton);
+      HandleHallOfFame(0, 0, dx, dy, !newbutton);
       break;
 
     case GAME_MODE_EDITOR:
@@ -1040,9 +1047,8 @@ void HandleJoystick()
 
       if (AllPlayersGone && newbutton)
       {
-       CloseDoor(DOOR_CLOSE_1);
-       game_status = GAME_MODE_MAIN;
-       DrawMainMenu();
+       GameEnd();
+
        return;
       }
 
index 8c5d74df1dcd5690a84369a79579b75498e26ad7..16b15ebdf747b2f96944c83b70a93ddb14811d22 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -32,7 +32,7 @@ void HandleClientMessageEvent(ClientMessageEvent *event);
 
 void HandleNoEvent(void);
 
-void HandleButton(int, int, int);
+void HandleButton(int, int, int, int);
 void HandleKey(Key, int);
 void HandleJoystick();
 
index 152d6528b6648dcb164d9f1b7f41a4ca66f104a5..deff36d69d6824171a8b05abd1aa573c420f5100 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -1398,16 +1398,10 @@ static void copyConfigFromConfigList(struct LevelFileConfigInfo *conf)
   }
 }
 
-#if 1
 void copyElementInfo(struct ElementInfo *ei_from, struct ElementInfo *ei_to)
 {
-#if 1
   int i;
-#else
-  int i, x, y;
-#endif
 
-#if 1
   xx_ei = *ei_from;    /* copy element data into temporary buffer */
   yy_ei = *ei_to;      /* copy element data into temporary buffer */
 
@@ -1415,56 +1409,6 @@ void copyElementInfo(struct ElementInfo *ei_from, struct ElementInfo *ei_to)
 
   *ei_from = xx_ei;
   *ei_to   = yy_ei;
-#endif
-
-#if 0
-  /* ---------- copy element description ---------- */
-  for (i = 0; i < MAX_ELEMENT_NAME_LEN + 1; i++)
-    ei_to->description[i] = ei_from->description[i];
-
-  /* ---------- copy element base properties ---------- */
-  ei_to->properties[EP_BITFIELD_BASE_NR] =
-    ei_from->properties[EP_BITFIELD_BASE_NR];
-
-  /* ---------- copy custom property values ---------- */
-
-  ei_to->use_gfx_element = ei_from->use_gfx_element;
-  ei_to->gfx_element = ei_from->gfx_element;
-
-  ei_to->access_direction = ei_from->access_direction;
-
-  ei_to->collect_score_initial = ei_from->collect_score_initial;
-  ei_to->collect_count_initial = ei_from->collect_count_initial;
-
-  ei_to->ce_value_fixed_initial = ei_from->ce_value_fixed_initial;
-  ei_to->ce_value_random_initial = ei_from->ce_value_random_initial;
-  ei_to->use_last_ce_value = ei_from->use_last_ce_value;
-
-  ei_to->push_delay_fixed = ei_from->push_delay_fixed;
-  ei_to->push_delay_random = ei_from->push_delay_random;
-  ei_to->drop_delay_fixed = ei_from->drop_delay_fixed;
-  ei_to->drop_delay_random = ei_from->drop_delay_random;
-  ei_to->move_delay_fixed = ei_from->move_delay_fixed;
-  ei_to->move_delay_random = ei_from->move_delay_random;
-
-  ei_to->move_pattern = ei_from->move_pattern;
-  ei_to->move_direction_initial = ei_from->move_direction_initial;
-  ei_to->move_stepsize = ei_from->move_stepsize;
-
-  ei_to->move_enter_element = ei_from->move_enter_element;
-  ei_to->move_leave_element = ei_from->move_leave_element;
-  ei_to->move_leave_type = ei_from->move_leave_type;
-
-  ei_to->slippery_type = ei_from->slippery_type;
-
-  ei_to->explosion_type = ei_from->explosion_type;
-  ei_to->explosion_delay = ei_from->explosion_delay;
-  ei_to->ignition_delay = ei_from->ignition_delay;
-
-  for (y = 0; y < 3; y++)
-    for (x = 0; x < 3; x++)
-      ei_to->content.e[x][y] = ei_from->content.e[x][y];
-#endif
 
   /* ---------- reinitialize and copy change pages ---------- */
 
@@ -1483,7 +1427,6 @@ void copyElementInfo(struct ElementInfo *ei_from, struct ElementInfo *ei_to)
   /* mark this custom element as modified */
   ei_to->modified_settings = TRUE;
 }
-#endif
 
 void setElementChangePages(struct ElementInfo *ei, int change_pages)
 {
@@ -1502,11 +1445,6 @@ void setElementChangePages(struct ElementInfo *ei, int change_pages)
 
 void setElementChangeInfoToDefaults(struct ElementChangeInfo *change)
 {
-#if 0
-  int i, x, y;
-#endif
-
-#if 1
   xx_change = *change;         /* copy change data into temporary buffer */
   xx_num_contents = 1;
 
@@ -1515,42 +1453,6 @@ void setElementChangeInfoToDefaults(struct ElementChangeInfo *change)
   *change = xx_change;
 
   resetEventFlags(change);
-#endif
-
-#if 0
-  change->can_change = FALSE;
-
-  for (i = 0; i < NUM_CHANGE_EVENTS; i++)
-    change->has_event[i] = FALSE;
-
-  change->trigger_player = CH_PLAYER_ANY;
-  change->trigger_side = CH_SIDE_ANY;
-  change->trigger_page = CH_PAGE_ANY;
-
-  change->target_element = EL_EMPTY_SPACE;
-
-  change->delay_fixed = 0;
-  change->delay_random = 0;
-  change->delay_frames = FRAMES_PER_SECOND;
-
-  change->trigger_element = EL_EMPTY_SPACE;
-
-  change->explode = FALSE;
-  change->use_target_content = FALSE;
-  change->only_if_complete = FALSE;
-  change->use_random_replace = FALSE;
-  change->random_percentage = 100;
-  change->replace_when = CP_WHEN_EMPTY;
-
-  change->has_action = FALSE;
-  change->action_type = CA_NO_ACTION;
-  change->action_mode = CA_MODE_UNDEFINED;
-  change->action_arg = CA_ARG_UNDEFINED;
-
-  for (x = 0; x < 3; x++)
-    for (y = 0; y < 3; y++)
-      change->target_content.e[x][y] = EL_EMPTY_SPACE;
-#endif
 
   change->direct_action = 0;
   change->other_action = 0;
@@ -1563,142 +1465,34 @@ void setElementChangeInfoToDefaults(struct ElementChangeInfo *change)
 static void setLevelInfoToDefaults(struct LevelInfo *level)
 {
   static boolean clipboard_elements_initialized = FALSE;
-#if 0
-  int i, j, x, y;
-#else
   int i, x, y;
-#endif
 
-#if 1
   InitElementPropertiesStatic();
-#endif
 
-#if 1
   li = *level;         /* copy level data into temporary buffer */
 
   setConfigToDefaultsFromConfigList(chunk_config_INFO);
   setConfigToDefaultsFromConfigList(chunk_config_ELEM);
 
   *level = li;         /* copy temporary buffer back to level data */
-#endif
 
   setLevelInfoToDefaults_EM();
 
   level->native_em_level = &native_em_level;
 
-#if 0
-  level->game_engine_type = GAME_ENGINE_TYPE_RND;
-#endif
-
   level->file_version = FILE_VERSION_ACTUAL;
   level->game_version = GAME_VERSION_ACTUAL;
 
   level->creation_date = getCurrentDate();
 
-#if 1
   level->encoding_16bit_field  = TRUE;
   level->encoding_16bit_yamyam = TRUE;
   level->encoding_16bit_amoeba = TRUE;
-#else
-  level->encoding_16bit_field  = FALSE;        /* default: only 8-bit elements */
-  level->encoding_16bit_yamyam = FALSE;        /* default: only 8-bit elements */
-  level->encoding_16bit_amoeba = FALSE;        /* default: only 8-bit elements */
-#endif
-
-#if 0
-  level->fieldx = STD_LEV_FIELDX;
-  level->fieldy = STD_LEV_FIELDY;
-#endif
 
   for (x = 0; x < MAX_LEV_FIELDX; x++)
     for (y = 0; y < MAX_LEV_FIELDY; y++)
       level->field[x][y] = EL_SAND;
 
-#if 0
-  level->time = 100;
-  level->gems_needed = 0;
-
-  level->amoeba_speed = 10;
-
-  level->time_magic_wall = 10;
-  level->time_wheel = 10;
-#endif
-#if 0
-  level->time_light = 10;
-  level->time_timegate = 10;
-#endif
-
-#if 0
-  level->amoeba_content = EL_DIAMOND;
-#endif
-
-#if 0
-  level->game_of_life[0] = 2;
-  level->game_of_life[1] = 3;
-  level->game_of_life[2] = 3;
-  level->game_of_life[3] = 3;
-
-  level->biomaze[0] = 2;
-  level->biomaze[1] = 3;
-  level->biomaze[2] = 3;
-  level->biomaze[3] = 3;
-#endif
-
-#if 0
-  level->double_speed = FALSE;
-#endif
-#if 0
-  level->initial_gravity = FALSE;
-  level->em_slippery_gems = FALSE;
-  level->instant_relocation = FALSE;
-  level->can_pass_to_walkable = FALSE;
-  level->grow_into_diggable = TRUE;
-#endif
-
-#if 0
-  level->block_snap_field = TRUE;
-#endif
-
-#if 0
-  level->block_last_field = FALSE;     /* EM does not block by default */
-  level->sp_block_last_field = TRUE;   /* SP blocks the last field */
-
-  level->can_move_into_acid_bits = ~0; /* everything can move into acid */
-  level->dont_collide_with_bits = ~0;  /* always deadly when colliding */
-
-  level->use_spring_bug = FALSE;
-  level->use_time_orb_bug = FALSE;
-
-  level->use_step_counter = FALSE;
-#endif
-
-  /* values for the new EMC elements */
-#if 0
-  level->android_move_time = 10;
-  level->android_clone_time = 10;
-  level->ball_time = 10;
-  level->lenses_score = 10;
-  level->lenses_time = 10;
-  level->magnify_score = 10;
-  level->magnify_time = 10;
-  level->slurp_score = 10;
-  level->wind_direction_initial = MV_NONE;
-  level->ball_random = FALSE;
-  level->ball_state_initial = FALSE;
-
-  for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
-    for (x = 0; x < 3; x++)
-      for (y = 0; y < 3; y++)
-       level->ball_content[i].e[x][y] = EL_EMPTY;
-
-  for (i = 0; i < 16; i++)
-    level->android_array[i] = FALSE;
-#endif
-
-#if 0
-  level->use_custom_template = FALSE;
-#endif
-
   for (i = 0; i < MAX_LEVEL_NAME_LEN; i++)
     level->name[i] = '\0';
   for (i = 0; i < MAX_LEVEL_AUTHOR_LEN; i++)
@@ -1707,29 +1501,6 @@ static void setLevelInfoToDefaults(struct LevelInfo *level)
   strcpy(level->name, NAMELESS_LEVEL_NAME);
   strcpy(level->author, ANONYMOUS_NAME);
 
-#if 0
-  for (i = 0; i < 4; i++)
-  {
-    level->envelope_text[i][0] = '\0';
-    level->envelope_xsize[i] = MAX_ENVELOPE_XSIZE;
-    level->envelope_ysize[i] = MAX_ENVELOPE_YSIZE;
-  }
-#endif
-
-#if 0
-  for (i = 0; i < LEVEL_SCORE_ELEMENTS; i++)
-    level->score[i] = (i == SC_TIME_BONUS ? 1 : 10);
-#endif
-
-#if 0
-  level->num_yamyam_contents = STD_ELEMENT_CONTENTS;
-  for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
-    for (x = 0; x < 3; x++)
-      for (y = 0; y < 3; y++)
-       level->yamyam_content[i].e[x][y] =
-         (i < STD_ELEMENT_CONTENTS ? EL_ROCK : EL_EMPTY);
-#endif
-
   level->field[0][0] = EL_PLAYER_1;
   level->field[STD_LEV_FIELDX - 1][STD_LEV_FIELDY - 1] = EL_EXIT_CLOSED;
 
@@ -1752,7 +1523,6 @@ static void setLevelInfoToDefaults(struct LevelInfo *level)
       level->envelope[envelope_nr] = xx_envelope;
     }
 
-#if 1
     if (IS_CUSTOM_ELEMENT(element) ||
        IS_GROUP_ELEMENT(element) ||
        IS_INTERNAL_ELEMENT(element))
@@ -1763,7 +1533,6 @@ static void setLevelInfoToDefaults(struct LevelInfo *level)
 
       *ei = xx_ei;
     }
-#endif
 
     setElementChangePages(ei, 1);
     setElementChangeInfoToDefaults(ei->change);
@@ -1772,22 +1541,7 @@ static void setLevelInfoToDefaults(struct LevelInfo *level)
        IS_GROUP_ELEMENT(element) ||
        IS_INTERNAL_ELEMENT(element))
     {
-#if 1
       setElementDescriptionToDefault(ei);
-#else
-      for (j = 0; j < MAX_ELEMENT_NAME_LEN + 1; j++)
-       ei->description[j] = '\0';
-
-      if (ei->custom_description != NULL)
-       strncpy(ei->description, ei->custom_description,MAX_ELEMENT_NAME_LEN);
-      else
-       strcpy(ei->description, ei->editor_description);
-#endif
-
-#if 0
-      ei->use_gfx_element = FALSE;
-      ei->gfx_element = EL_EMPTY_SPACE;
-#endif
 
       ei->modified_settings = FALSE;
     }
@@ -1795,46 +1549,6 @@ static void setLevelInfoToDefaults(struct LevelInfo *level)
     if (IS_CUSTOM_ELEMENT(element) ||
        IS_INTERNAL_ELEMENT(element))
     {
-#if 0
-      ei->access_direction = MV_ALL_DIRECTIONS;
-
-      ei->collect_score_initial = 10;  /* special default */
-      ei->collect_count_initial = 1;   /* special default */
-
-      ei->ce_value_fixed_initial = 0;
-      ei->ce_value_random_initial = 0;
-      ei->use_last_ce_value = FALSE;
-
-#endif
-#if 0
-      ei->push_delay_fixed = -1;       /* initialize later */
-      ei->push_delay_random = -1;      /* initialize later */
-#endif
-#if 0
-      ei->drop_delay_fixed = 0;
-      ei->drop_delay_random = 0;
-      ei->move_delay_fixed = 0;
-      ei->move_delay_random = 0;
-
-      ei->move_pattern = MV_ALL_DIRECTIONS;
-      ei->move_direction_initial = MV_START_AUTOMATIC;
-      ei->move_stepsize = TILEX / 8;
-
-      ei->move_enter_element = EL_EMPTY_SPACE;
-      ei->move_leave_element = EL_EMPTY_SPACE;
-      ei->move_leave_type = LEAVE_TYPE_UNLIMITED;
-
-      ei->slippery_type = SLIPPERY_ANY_RANDOM;
-
-      ei->explosion_type = EXPLODES_3X3;
-      ei->explosion_delay = 16;
-      ei->ignition_delay = 8;
-
-      for (x = 0; x < 3; x++)
-       for (y = 0; y < 3; y++)
-         ei->content.e[x][y] = EL_EMPTY_SPACE;
-#endif
-
       /* internal values used in level editor */
 
       ei->access_type = 0;
@@ -1849,24 +1563,6 @@ static void setLevelInfoToDefaults(struct LevelInfo *level)
       ei->can_explode_impact = FALSE;
 
       ei->current_change_page = 0;
-
-#if 0
-      /* !!! now done in InitElementPropertiesStatic() (see above) !!! */
-      /* !!! (else properties set there will be overwritten here)  !!! */
-      /* start with no properties at all */
-#if 1
-      for (j = 0; j < NUM_EP_BITFIELDS; j++)
-       ei->properties[j] = EP_BITMASK_DEFAULT;
-#else
-      for (j = 0; j < NUM_EP_BITFIELDS; j++)
-       Properties[element][j] = EP_BITMASK_DEFAULT;
-#endif
-#endif
-
-#if 0
-      /* now set default properties */
-      SET_PROPERTY(element, EP_CAN_MOVE_INTO_ACID, TRUE);
-#endif
     }
 
     if (IS_GROUP_ELEMENT(element) ||
@@ -1880,23 +1576,11 @@ static void setLevelInfoToDefaults(struct LevelInfo *level)
 
       group = ei->group;
 
-#if 1
       xx_group = *group;       /* copy group data into temporary buffer */
 
       setConfigToDefaultsFromConfigList(chunk_config_GRPX);
 
       *group = xx_group;
-#endif
-
-#if 0
-      for (j = 0; j < MAX_ELEMENTS_IN_GROUP; j++)
-       group->element[j] = EL_EMPTY_SPACE;
-
-      /* default: only one element in group */
-      group->num_elements = 1;
-
-      group->choice_mode = ANIM_RANDOM;
-#endif
     }
   }
 
@@ -1953,15 +1637,9 @@ static void setFileInfoToDefaults(struct LevelFileInfo *level_file_info)
 
 static void ActivateLevelTemplate()
 {
-#if 1
   /* Currently there is no special action needed to activate the template
      data, because 'element_info' property settings overwrite the original
      level data, while all other variables do not change. */
-#else
-  /* Currently there is no special action needed to activate the template
-     data, because 'element_info' and 'Properties' overwrite the original
-     level data, while all other variables do not change. */
-#endif
 }
 
 static char *getLevelFilenameFromBasename(char *basename)
@@ -2569,28 +2247,15 @@ static int LoadLevel_CUS1(FILE *file, int chunk_size, struct LevelInfo *level)
     int element = getMappedElement(getFile16BitBE(file));
     int properties = getFile32BitBE(file);
 
-#if 1
     if (IS_CUSTOM_ELEMENT(element))
       element_info[element].properties[EP_BITFIELD_BASE_NR] = properties;
     else
       Error(ERR_WARN, "invalid custom element number %d", element);
-#else
-    if (IS_CUSTOM_ELEMENT(element))
-      Properties[element][EP_BITFIELD_BASE_NR] = properties;
-    else
-      Error(ERR_WARN, "invalid custom element number %d", element);
-#endif
 
-#if 1
     /* older game versions that wrote level files with CUS1 chunks used
        different default push delay values (not yet stored in level file) */
     element_info[element].push_delay_fixed = 2;
     element_info[element].push_delay_random = 8;
-#else
-    /* needed for older levels (see src/init.c for details) */
-    element_info[element].push_delay_fixed = -1;       /* initialize later */
-    element_info[element].push_delay_random = -1;      /* initialize later */
-#endif
   }
 
   return chunk_size;
@@ -2651,11 +2316,7 @@ static int LoadLevel_CUS3(FILE *file, int chunk_size, struct LevelInfo *level)
       ei->description[j] = getFile8Bit(file);
     ei->description[MAX_ELEMENT_NAME_LEN] = 0;
 
-#if 1
     ei->properties[EP_BITFIELD_BASE_NR] = getFile32BitBE(file);
-#else
-    Properties[element][EP_BITFIELD_BASE_NR] = getFile32BitBE(file);
-#endif
 
     /* some free bytes for future properties and padding */
     ReadUnusedBytesFromFile(file, 7);
@@ -2742,11 +2403,8 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level)
     ei->description[i] = getFile8Bit(file);
   ei->description[MAX_ELEMENT_NAME_LEN] = 0;
 
-#if 1
   ei->properties[EP_BITFIELD_BASE_NR] = getFile32BitBE(file);
-#else
-  Properties[element][EP_BITFIELD_BASE_NR] = getFile32BitBE(file);
-#endif
+
   ReadUnusedBytesFromFile(file, 4);    /* reserved for more base properties */
 
   ei->num_change_pages = getFile8Bit(file);
@@ -2928,10 +2586,6 @@ static int LoadLevel_MicroChunk(FILE *file, struct LevelFileConfigInfo *conf,
     int num_bytes = getFile16BitBE(file);
     byte *buffer = checked_malloc(num_bytes);
 
-#if 0
-    printf("::: - found multi bytes\n");
-#endif
-
     ReadBytesFromFile(file, buffer, num_bytes);
 
     for (i = 0; conf[i].data_type != -1; i++)
@@ -3001,10 +2655,6 @@ static int LoadLevel_MicroChunk(FILE *file, struct LevelFileConfigInfo *conf,
                 byte_mask == CONF_MASK_2_BYTE ? getFile16BitBE(file) :
                 byte_mask == CONF_MASK_4_BYTE ? getFile32BitBE(file) : 0);
 
-#if 0
-    printf("::: - found single bytes\n");
-#endif
-
     for (i = 0; conf[i].data_type != -1; i++)
     {
       if (conf[i].element == element &&
@@ -3091,131 +2741,20 @@ static int LoadLevel_ELEM(FILE *file, int chunk_size, struct LevelInfo *level)
 {
   int real_chunk_size = 0;
 
-#if 1
   li = *level;         /* copy level data into temporary buffer */
-#endif
 
   while (!feof(file))
   {
     int element = getMappedElement(getFile16BitBE(file));
-#if 1
+
     real_chunk_size += 2;
     real_chunk_size += LoadLevel_MicroChunk(file, chunk_config_ELEM,
                                            element, element);
-#else
-    int conf_type = getFile8Bit(file);
-    int byte_mask = conf_type & CONF_MASK_BYTES;
-    boolean element_found = FALSE;
-    int i;
-
-    real_chunk_size += 3;
-
-#if 0
-    li = *level;       /* copy level data into temporary buffer */
-#endif
-
-    if (byte_mask == CONF_MASK_MULTI_BYTES)
-    {
-      int num_bytes = getFile16BitBE(file);
-      byte *buffer = checked_malloc(num_bytes);
-
-      ReadBytesFromFile(file, buffer, num_bytes);
-
-      for (i = 0; chunk_config_ELEM[i].data_type != -1; i++)
-      {
-       if (chunk_config_ELEM[i].element == element &&
-           chunk_config_ELEM[i].conf_type == conf_type)
-       {
-         int data_type = chunk_config_ELEM[i].data_type;
-         int num_entities = num_bytes / CONF_ENTITY_NUM_BYTES(data_type);
-         int max_num_entities = chunk_config_ELEM[i].max_num_entities;
-
-         if (num_entities > max_num_entities)
-         {
-           Error(ERR_WARN,
-                 "truncating number of entities for element %d from %d to %d",
-                 element, num_entities, max_num_entities);
-
-           num_entities = max_num_entities;
-         }
-
-         *(int *)(chunk_config_ELEM[i].num_entities) = num_entities;
-
-         element_found = TRUE;
-
-         if (data_type == TYPE_ELEMENT_LIST)
-         {
-           int *element_array = (int *)(chunk_config_ELEM[i].value);
-           int j;
-
-           for (j = 0; j < num_entities; j++)
-             element_array[j] =
-               getMappedElement(CONF_ELEMENTS_ELEMENT(buffer, j));
-         }
-         else if (data_type == TYPE_CONTENT_LIST)
-         {
-           struct Content *content= (struct Content *)(chunk_config_ELEM[i].value);
-           int c, x, y;
-
-           for (c = 0; c < num_entities; c++)
-             for (y = 0; y < 3; y++)
-               for (x = 0; x < 3; x++)
-                 content[c].e[x][y] =
-                   getMappedElement(CONF_CONTENTS_ELEMENT(buffer, c, x, y));
-         }
-         else
-           element_found = FALSE;
-
-         break;
-       }
-      }
-
-      checked_free(buffer);
-
-      real_chunk_size += 2 + num_bytes;
-    }
-    else       /* constant size configuration data (1, 2 or 4 bytes) */
-    {
-      int value = (byte_mask == CONF_MASK_1_BYTE ? getFile8Bit   (file) :
-                  byte_mask == CONF_MASK_2_BYTE ? getFile16BitBE(file) :
-                  byte_mask == CONF_MASK_4_BYTE ? getFile32BitBE(file) : 0);
-
-      for (i = 0; chunk_config_ELEM[i].data_type != -1; i++)
-      {
-       if (chunk_config_ELEM[i].element == element &&
-           chunk_config_ELEM[i].conf_type == conf_type)
-       {
-         int data_type = chunk_config_ELEM[i].data_type;
-
-         if (data_type == TYPE_BOOLEAN)
-           *(boolean *)(chunk_config_ELEM[i].value) = value;
-         else
-           *(int *)    (chunk_config_ELEM[i].value) = value;
-
-         element_found = TRUE;
-
-         break;
-       }
-      }
-
-      real_chunk_size += CONF_VALUE_NUM_BYTES(byte_mask);
-    }
-
-    if (!element_found)
-      Error(ERR_WARN, "cannot load CONF value for element %d", element);
-#endif
-
-#if 0
-    *level = li;       /* copy temporary buffer back to level data */
-#endif
-
     if (real_chunk_size >= chunk_size)
       break;
   }
 
-#if 1
   *level = li;         /* copy temporary buffer back to level data */
-#endif
 
   return real_chunk_size;
 }
@@ -3247,10 +2786,6 @@ static int LoadLevel_CUSX(FILE *file, int chunk_size, struct LevelInfo *level)
   struct ElementInfo *ei = &element_info[element];
   int i;
 
-#if 0
-  printf("::: CUSX: loading element '%s' ...\n", EL_NAME(element));
-#endif
-
   xx_ei = *ei;         /* copy element data into temporary buffer */
 
   xx_ei.num_change_pages = -1;
@@ -3259,11 +2794,6 @@ static int LoadLevel_CUSX(FILE *file, int chunk_size, struct LevelInfo *level)
   {
     real_chunk_size += LoadLevel_MicroChunk(file, chunk_config_CUSX_base,
                                            -1, element);
-
-#if 0
-    printf("::: - real_chunk_size now %d\n", real_chunk_size);
-#endif
-
     if (xx_ei.num_change_pages != -1)
       break;
 
@@ -3930,14 +3460,6 @@ void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
   struct PLAYER **ply = level_em->ply;
   int i, j, x, y;
 
-#if 0
-  printf("::: A\n");
-  for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
-    for (j = 0; j < 8; j++)
-      printf("::: ball %d, %d: %d\n", i, j,
-            level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]);
-#endif
-
   lev->width  = MIN(level->fieldx, EM_MAX_CAVE_WIDTH);
   lev->height = MIN(level->fieldy, EM_MAX_CAVE_HEIGHT);
 
@@ -3990,41 +3512,13 @@ void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
        map_element_RND_to_EM(level->
                              ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]);
 
-#if 0
-  for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
-    for (j = 0; j < 8; j++)
-      printf("::: ball %d, %d: %d\n", i, j,
-            level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]);
-#endif
-
   map_android_clone_elements_RND_to_EM(level);
 
-#if 0
-  for (i = 0; i < 16; i++)
-    lev->android_array[i] = FALSE;     /* !!! YET TO COME !!! */
-#endif
-
   /* first fill the complete playfield with the default border element */
   for (y = 0; y < EM_MAX_CAVE_HEIGHT; y++)
     for (x = 0; x < EM_MAX_CAVE_WIDTH; x++)
       level_em->cave[x][y] = ZBORDER;
 
-#if 1
-
-#if 0
-#if 1
-  LoadLevel_InitPlayfield();
-#else
-  lev_fieldx = lev->width;     /* !!! also in LoadLevel_InitPlayfield() !!! */
-  lev_fieldy = lev->height;    /* !!! also in LoadLevel_InitPlayfield() !!! */
-  SetBorderElement();          /* !!! also in LoadLevel_InitPlayfield() !!! */
-#endif
-#endif
-
-#if 0
-  printf("::: BorderElement == %d\n", BorderElement);
-#endif
-
   if (BorderElement == EL_STEELWALL)
   {
     for (y = 0; y < lev->height + 2; y++)
@@ -4046,44 +3540,15 @@ void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
     level_em->cave[xx][yy] = new_element;
   }
 
-#else
-
-  /* then copy the real level contents from level file into the playfield */
-  for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++)
-  {
-    int new_element = map_element_RND_to_EM(level->field[x][y]);
-
-    if (level->field[x][y] == EL_AMOEBA_DEAD)
-      new_element = map_element_RND_to_EM(EL_AMOEBA_WET);
-
-    level_em->cave[x + 1][y + 1] = new_element;
-  }
-
-#endif
-
-#if 1
-
   for (i = 0; i < MAX_PLAYERS; i++)
   {
     ply[i]->x_initial = 0;
     ply[i]->y_initial = 0;
   }
 
-#else
-
-  ply1->x_initial = 0;
-  ply1->y_initial = 0;
-
-  ply2->x_initial = 0;
-  ply2->y_initial = 0;
-
-#endif
-
   /* initialize player positions and delete players from the playfield */
   for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++)
   {
-
-#if 1
     if (ELEM_IS_PLAYER(level->field[x][y]))
     {
       int player_nr = GET_PLAYER_NR(level->field[x][y]);
@@ -4096,43 +3561,12 @@ void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
 
       level_em->cave[xx][yy] = map_element_RND_to_EM(EL_EMPTY);
     }
-
-#else
-
-#if 1
-    /* !!! CURRENTLY ONLY SUPPORT FOR ONE PLAYER !!! */
-    if (ELEM_IS_PLAYER(level->field[x][y]))
-    {
-      ply1->x_initial = x + 1;
-      ply1->y_initial = y + 1;
-      level_em->cave[x + 1][y + 1] = map_element_RND_to_EM(EL_EMPTY);
-    }
-#else
-    /* !!! ADD SUPPORT FOR MORE THAN ONE PLAYER !!! */
-    if (level->field[x][y] == EL_PLAYER_1)
-    {
-      ply1->x_initial = x + 1;
-      ply1->y_initial = y + 1;
-      level_em->cave[x + 1][y + 1] = map_element_RND_to_EM(EL_EMPTY);
-    }
-    else if (level->field[x][y] == EL_PLAYER_2)
-    {
-      ply2->x_initial = x + 1;
-      ply2->y_initial = y + 1;
-      level_em->cave[x + 1][y + 1] = map_element_RND_to_EM(EL_EMPTY);
-    }
-#endif
-
-#endif
-
   }
 
   if (BorderElement == EL_STEELWALL)
   {
-#if 1
     lev->width  += 2;
     lev->height += 2;
-#endif
   }
 }
 
@@ -4202,34 +3636,13 @@ void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
   level->wind_direction_initial =
     map_direction_EM_to_RND(lev->wind_direction_initial);
 
-#if 0
-  printf("::: foo\n");
-  for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
-    for (j = 0; j < 8; j++)
-      printf("::: ball %d, %d: %d\n", i, j,
-            level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]);
-#endif
-
   for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
     for (j = 0; j < 8; j++)
       level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]] =
        map_element_EM_to_RND(lev->ball_array[i][j]);
 
-#if 0
-  printf("::: bar\n");
-  for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
-    for (j = 0; j < 8; j++)
-      printf("::: ball %d, %d: %d\n", i, j,
-            level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]);
-#endif
-
   map_android_clone_elements_EM_to_RND(level);
 
-#if 0
-  for (i = 0; i < 16; i++)
-    level->android_array[i] = FALSE;   /* !!! YET TO COME !!! */
-#endif
-
   /* convert the playfield (some elements need special treatment) */
   for (y = 0; y < level->fieldy; y++) for (x = 0; x < level->fieldx; x++)
   {
@@ -4241,16 +3654,6 @@ void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
     level->field[x][y] = new_element;
   }
 
-#if 0
-  printf("::: bar 0\n");
-  for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
-    for (j = 0; j < 8; j++)
-      printf("::: ball %d, %d: %d\n", i, j,
-            level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]);
-#endif
-
-#if 1
-
   for (i = 0; i < MAX_PLAYERS; i++)
   {
     /* in case of all players set to the same field, use the first player */
@@ -4258,33 +3661,9 @@ void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
     int jx = ply[nr]->x_initial - 1;
     int jy = ply[nr]->y_initial - 1;
 
-#if 0
-    printf("::: player %d: %d, %d\n", nr, jx, jy);
-#endif
-
     if (jx != -1 && jy != -1)
       level->field[jx][jy] = EL_PLAYER_1 + nr;
   }
-
-#else
-
-  /* in case of both players set to the same field, use the first player */
-  level->field[ply2->x_initial - 1][ply2->y_initial - 1] = EL_PLAYER_2;
-  level->field[ply1->x_initial - 1][ply1->y_initial - 1] = EL_PLAYER_1;
-
-#endif
-
-#if 0
-  printf("::: native Emerald Mine file version: %d\n", level_em->file_version);
-#endif
-
-#if 0
-  printf("::: bar 2\n");
-  for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
-    for (j = 0; j < 8; j++)
-      printf("::: ball %d, %d: %d\n", i, j,
-            level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]);
-#endif
 }
 
 static void LoadLevelFromFileInfo_EM(struct LevelInfo *level,
@@ -4302,30 +3681,6 @@ void CopyNativeLevel_RND_to_Native(struct LevelInfo *level)
 
 void CopyNativeLevel_Native_to_RND(struct LevelInfo *level)
 {
-
-#if 0
-  {
-    static int ball_xy[8][2] =
-      {
-       { 0, 0 },
-       { 1, 0 },
-       { 2, 0 },
-       { 0, 1 },
-       { 2, 1 },
-       { 0, 2 },
-       { 1, 2 },
-       { 2, 2 },
-      };
-    int i, j;
-
-    printf("::: A6\n");
-    for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
-      for (j = 0; j < 8; j++)
-       printf("::: ball %d, %d: %d\n", i, j,
-              level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]);
-  }
-#endif
-
   if (level->game_engine_type == GAME_ENGINE_TYPE_EM)
     CopyNativeLevel_EM_to_RND(level);
 }
@@ -4490,7 +3845,7 @@ static void LoadLevelFromFileStream_SP(FILE *file, struct LevelInfo *level,
   /* original Supaplex does not use score values -- use default values */
 #else
   for (i = 0; i < LEVEL_SCORE_ELEMENTS; i++)
-    level->score[i] = 0;               /* !!! CORRECT THIS !!! */
+    level->score[i] = 0;
 #endif
 
   /* there are no yamyams in supaplex levels */
@@ -4716,15 +4071,8 @@ void LoadLevelFromFileInfo(struct LevelInfo *level,
   if (level->game_engine_type == GAME_ENGINE_TYPE_UNKNOWN)
     level->game_engine_type = GAME_ENGINE_TYPE_RND;
 
-#if 1
   if (level_file_info->type != LEVEL_FILE_TYPE_RND)
     CopyNativeLevel_Native_to_RND(level);
-#else
-  if (level_file_info->type == LEVEL_FILE_TYPE_RND)
-    CopyNativeLevel_RND_to_Native(level);
-  else
-    CopyNativeLevel_Native_to_RND(level);
-#endif
 }
 
 void LoadLevelFromFilename(struct LevelInfo *level, char *filename)
@@ -4743,19 +4091,17 @@ void LoadLevelFromFilename(struct LevelInfo *level, char *filename)
 
 static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename)
 {
-  int i;
+  int i, j;
 
   if (leveldir_current == NULL)                /* only when dumping level */
     return;
 
   /* all engine modifications also valid for levels which use latest engine */
-#if 1
   if (level->game_version < VERSION_IDENT(3,2,0,5))
   {
     /* time bonus score was given for 10 s instead of 1 s before 3.2.0-5 */
     level->score[SC_TIME_BONUS] /= 10;
   }
-#endif
 
 #if 0
   leveldir_current->latest_engine = TRUE;      /* !!! TEST ONLY !!! */
@@ -4840,8 +4186,6 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename)
   /* trigger settings did not exist before 3.1.0; set to default "any" */
   if (level->game_version < VERSION_IDENT(3,1,0,0))
   {
-    int i, j;
-
     /* correct "can move into acid" settings (all zero in old levels) */
 
     level->can_move_into_acid_bits = 0; /* nothing can move into acid */
@@ -4871,6 +4215,28 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename)
       }
     }
   }
+
+  /* try to detect and fix "Snake Bite" levels, which are broken with 3.2.0 */
+  {
+    int element = EL_CUSTOM_START + 255;
+    struct ElementInfo *ei = &element_info[element];
+    struct ElementChangeInfo *change = &ei->change_page[0];
+
+    /* This is needed to fix a problem that was caused by a bugfix in function
+       game.c/CreateFieldExt() introduced with 3.2.0 that corrects the behaviour
+       when a custom element changes to EL_SOKOBAN_FIELD_PLAYER (before, it did
+       not replace walkable elements, but instead just placed the player on it,
+       without placing the Sokoban field under the player). Unfortunately, this
+       breaks "Snake Bite" style levels when the snake is halfway through a door
+       that just closes (the snake head is still alive and can be moved in this
+       case). This can be fixed by replacing the EL_SOKOBAN_FIELD_PLAYER by the
+       player (without Sokoban element) which then gets killed as designed). */
+
+    if ((strncmp(leveldir_current->identifier, "snake_bite", 10) == 0 ||
+        strncmp(ei->description, "pause b4 death", 14) == 0) &&
+       change->target_element == EL_SOKOBAN_FIELD_PLAYER)
+      change->target_element = EL_PLAYER_1;
+  }
 }
 
 static void LoadLevel_InitElements(struct LevelInfo *level, char *filename)
@@ -4932,20 +4298,9 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename)
 
       if (ei->access_direction == MV_NO_DIRECTION)
        ei->access_direction = MV_ALL_DIRECTIONS;
-
-#if 0
-      for (j = 0; j < ei->num_change_pages; j++)
-      {
-       struct ElementChangeInfo *change = &ei->change_page[j];
-
-       if (change->trigger_side == CH_SIDE_NONE)
-         change->trigger_side = CH_SIDE_ANY;
-      }
-#endif
     }
   }
 
-#if 1
   /* correct custom element values (fix invalid values for all versions) */
   if (1)
   {
@@ -4966,7 +4321,6 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename)
       }
     }
   }
-#endif
 
   /* initialize "can_explode" field for old levels which did not store this */
   /* !!! CHECK THIS -- "<= 3,1,0,0" IS PROBABLY WRONG !!! */
@@ -5043,15 +4397,8 @@ static void LoadLevel_InitNativeEngines(struct LevelInfo *level,char *filename)
 {
   struct LevelFileInfo *level_file_info = &level->file_info;
 
-#if 1
   if (level_file_info->type == LEVEL_FILE_TYPE_RND)
     CopyNativeLevel_RND_to_Native(level);
-#else
-  if (level_file_info->type == LEVEL_FILE_TYPE_RND)
-    CopyNativeLevel_RND_to_Native(level);
-  else
-    CopyNativeLevel_Native_to_RND(level);
-#endif
 }
 
 void LoadLevelTemplate(int nr)
@@ -5320,7 +4667,6 @@ static void SaveLevel_CUS1(FILE *file, struct LevelInfo *level,
   {
     int element = EL_CUSTOM_START + i;
 
-#if 1
     struct ElementInfo *ei = &element_info[element];
 
     if (ei->properties[EP_BITFIELD_BASE_NR] != EP_BITMASK_DEFAULT)
@@ -5333,18 +4679,6 @@ static void SaveLevel_CUS1(FILE *file, struct LevelInfo *level,
 
       check++;
     }
-#else
-    if (Properties[element][EP_BITFIELD_BASE_NR] != EP_BITMASK_DEFAULT)
-    {
-      if (check < num_changed_custom_elements)
-      {
-       putFile16BitBE(file, element);
-       putFile32BitBE(file, Properties[element][EP_BITFIELD_BASE_NR]);
-      }
-
-      check++;
-    }
-#endif
   }
 
   if (check != num_changed_custom_elements)    /* should not happen */
@@ -5403,11 +4737,7 @@ static void SaveLevel_CUS3(FILE *file, struct LevelInfo *level,
        for (j = 0; j < MAX_ELEMENT_NAME_LEN; j++)
          putFile8Bit(file, ei->description[j]);
 
-#if 1
        putFile32BitBE(file, ei->properties[EP_BITFIELD_BASE_NR]);
-#else
-       putFile32BitBE(file, Properties[element][EP_BITFIELD_BASE_NR]);
-#endif
 
        /* some free bytes for future properties and padding */
        WriteUnusedBytesToFile(file, 7);
@@ -5481,11 +4811,8 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element)
   for (i = 0; i < MAX_ELEMENT_NAME_LEN; i++)
     putFile8Bit(file, ei->description[i]);
 
-#if 1
   putFile32BitBE(file, ei->properties[EP_BITFIELD_BASE_NR]);
-#else
-  putFile32BitBE(file, Properties[element][EP_BITFIELD_BASE_NR]);
-#endif
+
   WriteUnusedBytesToFile(file, 4);     /* reserved for more base properties */
 
   putFile8Bit(file, ei->num_change_pages);
@@ -5737,116 +5064,6 @@ static int SaveLevel_MicroChunk(FILE *file, struct LevelFileConfigInfo *entry,
   return num_bytes;
 }
 
-#if 0
-
-static int SaveLevel_MicroChunk_SingleValue(FILE *file,
-                                           struct LevelFileConfigInfo *entry)
-{
-  int default_value = entry->default_value;
-  int element = entry->element;
-  int data_type = entry->data_type;
-  int conf_type = entry->conf_type;
-  int byte_mask = conf_type & CONF_MASK_BYTES;
-  void *value_ptr = entry->value;
-  int value = (data_type == TYPE_BOOLEAN ? *(boolean *)value_ptr :
-              *(int *)value_ptr);
-  int num_bytes = 0;
-  boolean modified = FALSE;
-
-  /* check if any settings have been modified before saving them */
-  if (value != default_value)
-    modified = TRUE;
-
-  if (!modified)               /* do not save unmodified default settings */
-    return 0;
-
-#if 0
-  printf("::: %02x, %d: %d != %d\n",
-        byte_mask, conf_type & CONF_MASK_TOKEN,
-        value, default_value);
-#endif
-
-  if (element != -1)
-    num_bytes += putFile16BitBE(file, element);
-
-  num_bytes += putFile8Bit(file, conf_type);
-  num_bytes += (byte_mask == CONF_MASK_1_BYTE ? putFile8Bit   (file, value) :
-               byte_mask == CONF_MASK_2_BYTE ? putFile16BitBE(file, value) :
-               byte_mask == CONF_MASK_4_BYTE ? putFile32BitBE(file, value) :0);
-
-  return num_bytes;
-}
-
-static int SaveLevel_MicroChunk_ElementList(FILE *file,
-                                           struct LevelFileConfigInfo *entry)
-{
-  int *element_array = (int *)(entry->value);
-  int num_elements = *(int *)(entry->num_entities);
-  int default_value = entry->default_value;
-  int element = entry->element;
-  int conf_type = entry->conf_type;
-  int num_bytes = 0;
-  boolean modified = FALSE;
-  int i;
-
-  /* check if any settings have been modified before saving them */
-  for (i = 0; i < num_elements; i++)
-    if (element_array[i] != default_value)
-      modified = TRUE;
-
-  if (!modified)               /* do not save unmodified default settings */
-    return 0;
-
-  if (element != -1)
-    num_bytes += putFile16BitBE(file, element);
-
-  num_bytes += putFile8Bit(file, conf_type);
-  num_bytes += putFile16BitBE(file, num_elements * CONF_ELEMENT_NUM_BYTES);
-
-  for (i = 0; i < num_elements; i++)
-    num_bytes += putFile16BitBE(file, element_array[i]);
-
-  return num_bytes;
-}
-
-static int SaveLevel_MicroChunk_ContentList(FILE *file,
-                                           struct LevelFileConfigInfo *entry)
-{
-  struct Content *content = (struct Content *)(entry->value);
-  int num_contents = *(int *)(entry->num_entities);
-  int default_value = entry->default_value;
-  int element = entry->element;
-  int conf_type = entry->conf_type;
-  int num_bytes = 0;
-  boolean modified = FALSE;
-  int i, x, y;
-
-  /* check if any settings have been modified before saving them */
-  for (i = 0; i < num_contents; i++)
-    for (y = 0; y < 3; y++)
-      for (x = 0; x < 3; x++)
-       if (content[i].e[x][y] != default_value)
-         modified = TRUE;
-
-  if (!modified)               /* do not save unmodified default settings */
-    return 0;
-
-  if (element != -1)
-    num_bytes += putFile16BitBE(file, element);
-
-  num_bytes += putFile8Bit(file, conf_type);
-  num_bytes += putFile16BitBE(file, num_contents * CONF_CONTENT_NUM_BYTES);
-
-  for (i = 0; i < num_contents; i++)
-    for (y = 0; y < 3; y++)
-      for (x = 0; x < 3; x++)
-       num_bytes += putFile16BitBE(file, content[i].e[x][y]);
-
-  return num_bytes;
-}
-
-#endif
-
 static int SaveLevel_INFO(FILE *file, struct LevelInfo *level)
 {
   int chunk_size = 0;
@@ -5868,23 +5085,7 @@ static int SaveLevel_ELEM(FILE *file, struct LevelInfo *level)
   li = *level;         /* copy level data into temporary buffer */
 
   for (i = 0; chunk_config_ELEM[i].data_type != -1; i++)
-  {
-#if 1
     chunk_size += SaveLevel_MicroChunk(file, &chunk_config_ELEM[i], TRUE);
-#else
-    struct LevelFileConfigInfo *conf = &chunk_config_ELEM[i];
-    int data_type = conf->data_type;
-    int conf_type = conf->conf_type;
-    int byte_mask = conf_type & CONF_MASK_BYTES;
-
-    if (byte_mask != CONF_MASK_MULTI_BYTES)
-      chunk_size += SaveLevel_MicroChunk_SingleValue(file, conf);
-    else if (data_type == TYPE_ELEMENT_LIST)
-      chunk_size += SaveLevel_MicroChunk_ElementList(file, conf);
-    else if (data_type == TYPE_CONTENT_LIST)
-      chunk_size += SaveLevel_MicroChunk_ContentList(file, conf);
-#endif
-  }
 
   return chunk_size;
 }
@@ -5922,17 +5123,9 @@ static int SaveLevel_CUSX(FILE *file, struct LevelInfo *level, int element)
   /* set (fixed) number of content areas (may have been overwritten earlier) */
   xx_num_contents = 1;
 
-#if 0
-  printf("::: - element config\n");
-#endif
-
   for (i = 0; chunk_config_CUSX_base[i].data_type != -1; i++)
     chunk_size += SaveLevel_MicroChunk(file, &chunk_config_CUSX_base[i], FALSE);
 
-#if 0
-  printf("::: - change pages\n");
-#endif
-
   for (i = 0; i < ei->num_change_pages; i++)
   {
     struct ElementChangeInfo *change = &ei->change_page[i];
@@ -5941,25 +5134,12 @@ static int SaveLevel_CUSX(FILE *file, struct LevelInfo *level, int element)
 
     xx_change = *change;       /* copy change data into temporary buffer */
 
-#if 0
-    printf(":::   %d: xx_change.action_mode == %d\n",
-          i, xx_change.action_mode);
-    printf(":::   %d: xx_change.action_arg == %d\n",
-          i, xx_change.action_arg);
-#endif
-
     resetEventBits();
     setEventBitsFromEventFlags(change);
 
     for (j = 0; chunk_config_CUSX_change[j].data_type != -1; j++)
       chunk_size += SaveLevel_MicroChunk(file, &chunk_config_CUSX_change[j],
                                         FALSE);
-
-#if 0
-    if (element == EL_CUSTOM_START)
-      printf("::: - saving change page %d / %d (%d bytes)\n",
-            i, ei->num_change_pages, chunk_size);
-#endif
   }
 
   return chunk_size;
@@ -5989,11 +5169,7 @@ static int SaveLevel_GRPX(FILE *file, struct LevelInfo *level, int element)
 static void SaveLevelFromFilename(struct LevelInfo *level, char *filename)
 {
   int chunk_size;
-#if 1
   int i;
-#else
-  int i, x, y;
-#endif
   FILE *file;
 
   if (!(file = fopen(filename, MODE_WRITE)))
@@ -6007,38 +5183,6 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename)
 
   level->creation_date = getCurrentDate();
 
-#if 0
-  /* check level field for 16-bit elements */
-  level->encoding_16bit_field = FALSE;
-  for (y = 0; y < level->fieldy; y++) 
-    for (x = 0; x < level->fieldx; x++) 
-      if (level->field[x][y] > 255)
-       level->encoding_16bit_field = TRUE;
-#endif
-
-#if 0
-  /* check yamyam content for 16-bit elements */
-  level->encoding_16bit_yamyam = FALSE;
-  for (i = 0; i < level->num_yamyam_contents; i++)
-    for (y = 0; y < 3; y++)
-      for (x = 0; x < 3; x++)
-       if (level->yamyam_content[i].e[x][y] > 255)
-         level->encoding_16bit_yamyam = TRUE;
-#endif
-
-#if 0
-  /* check amoeba content for 16-bit elements */
-  level->encoding_16bit_amoeba = FALSE;
-  if (level->amoeba_content > 255)
-    level->encoding_16bit_amoeba = TRUE;
-#endif
-
-#if 0
-  /* calculate size of "BODY" chunk */
-  body_chunk_size =
-    level->fieldx * level->fieldy * (level->encoding_16bit_field ? 2 : 1);
-#endif
-
   putFileChunkBE(file, "RND1", CHUNK_SIZE_UNDEFINED);
   putFileChunkBE(file, "CAVE", CHUNK_SIZE_NONE);
 
@@ -6050,11 +5194,6 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename)
   putFileChunkBE(file, "DATE", chunk_size);
   SaveLevel_DATE(file, level);
 
-#if 0
-  putFileChunkBE(file, "HEAD", LEVEL_CHUNK_HEAD_SIZE);
-  SaveLevel_HEAD(file, level);
-#endif
-
   chunk_size = SaveLevel_NAME(NULL, level);
   putFileChunkBE(file, "NAME", chunk_size);
   SaveLevel_NAME(file, level);
@@ -6071,65 +5210,6 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename)
   putFileChunkBE(file, "BODY", chunk_size);
   SaveLevel_BODY(file, level);
 
-#if 0
-  if (level->encoding_16bit_yamyam ||
-      level->num_yamyam_contents != STD_ELEMENT_CONTENTS)
-  {
-    putFileChunkBE(file, "CNT2", LEVEL_CHUNK_CNT2_SIZE);
-    SaveLevel_CNT2(file, level, EL_YAMYAM);
-  }
-
-  if (level->encoding_16bit_amoeba)
-  {
-    putFileChunkBE(file, "CNT2", LEVEL_CHUNK_CNT2_SIZE);
-    SaveLevel_CNT2(file, level, EL_BD_AMOEBA);
-  }
-#endif
-
-#if 0
-  /* check for envelope content */
-  for (i = 0; i < 4; i++)
-  {
-    if (strlen(level->envelope_text[i]) > 0)
-    {
-      int envelope_len = strlen(level->envelope_text[i]) + 1;
-
-      putFileChunkBE(file, "CNT3", LEVEL_CHUNK_CNT3_SIZE(envelope_len));
-      SaveLevel_CNT3(file, level, EL_ENVELOPE_1 + i);
-    }
-  }
-#endif
-
-#if 0
-  /* if not using template level, check for non-default custom/group elements */
-  if (!level->use_custom_template)
-  {
-    for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
-    {
-      int element = EL_CUSTOM_START + i;
-
-      if (element_info[element].modified_settings)
-      {
-       int num_change_pages = element_info[element].num_change_pages;
-
-       putFileChunkBE(file, "CUS4", LEVEL_CHUNK_CUS4_SIZE(num_change_pages));
-       SaveLevel_CUS4(file, level, element);
-      }
-    }
-
-    for (i = 0; i < NUM_GROUP_ELEMENTS; i++)
-    {
-      int element = EL_GROUP_START + i;
-
-      if (element_info[element].modified_settings)
-      {
-       putFileChunkBE(file, "GRP1", LEVEL_CHUNK_GRP1_SIZE);
-       SaveLevel_GRP1(file, level, element);
-      }
-    }
-  }
-#endif
-
   chunk_size = SaveLevel_ELEM(NULL, level);
   if (chunk_size > LEVEL_CHUNK_ELEM_UNCHANGED)         /* save if changed */
   {
@@ -6137,7 +5217,6 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename)
     SaveLevel_ELEM(file, level);
   }
 
-#if 1
   for (i = 0; i < NUM_ENVELOPES; i++)
   {
     int element = EL_ENVELOPE_1 + i;
@@ -6149,9 +5228,7 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename)
       SaveLevel_NOTE(file, level, element);
     }
   }
-#endif
 
-#if 1
   /* if not using template level, check for non-default custom/group elements */
   if (!level->use_custom_template)
   {
@@ -6179,7 +5256,6 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename)
       }
     }
   }
-#endif
 
   fclose(file);
 
@@ -6230,11 +5306,6 @@ void DumpLevel(struct LevelInfo *level)
   printf("Amoeba speed: %d\n", level->amoeba_speed);
   printf("\n");
 
-#if 0
-  printf("Initial gravity:             %s\n", (level->initial_gravity ? "yes" : "no"));
-  printf("Initial player stepsize:     %d\n", level->initial_player_stepsize);
-#endif
-
   printf("EM style slippery gems:      %s\n", (level->em_slippery_gems ? "yes" : "no"));
   printf("Player blocks last field:    %s\n", (level->block_last_field ? "yes" : "no"));
   printf("SP player blocks last field: %s\n", (level->sp_block_last_field ? "yes" : "no"));
@@ -6844,7 +5915,7 @@ void SaveScore(int nr)
 #define SETUP_TOKEN_TOONS                      5
 #define SETUP_TOKEN_SCROLL_DELAY               6
 #define SETUP_TOKEN_SOFT_SCROLLING             7
-#define SETUP_TOKEN_FADING                     8
+#define SETUP_TOKEN_FADE_SCREENS               8
 #define SETUP_TOKEN_AUTORECORD                 9
 #define SETUP_TOKEN_SHOW_TITLESCREEN           10
 #define SETUP_TOKEN_QUICK_DOORS                        11
@@ -6853,19 +5924,20 @@ void SaveScore(int nr)
 #define SETUP_TOKEN_SKIP_LEVELS                        14
 #define SETUP_TOKEN_TIME_LIMIT                 15
 #define SETUP_TOKEN_FULLSCREEN                 16
-#define SETUP_TOKEN_ASK_ON_ESCAPE              17
-#define SETUP_TOKEN_ASK_ON_ESCAPE_EDITOR       18
-#define SETUP_TOKEN_QUICK_SWITCH               19
-#define SETUP_TOKEN_INPUT_ON_FOCUS             20
-#define SETUP_TOKEN_PREFER_AGA_GRAPHICS                21
-#define SETUP_TOKEN_GRAPHICS_SET               22
-#define SETUP_TOKEN_SOUNDS_SET                 23
-#define SETUP_TOKEN_MUSIC_SET                  24
-#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS    25
-#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS      26
-#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC       27
-
-#define NUM_GLOBAL_SETUP_TOKENS                        28
+#define SETUP_TOKEN_FULLSCREEN_MODE            17
+#define SETUP_TOKEN_ASK_ON_ESCAPE              18
+#define SETUP_TOKEN_ASK_ON_ESCAPE_EDITOR       19
+#define SETUP_TOKEN_QUICK_SWITCH               20
+#define SETUP_TOKEN_INPUT_ON_FOCUS             21
+#define SETUP_TOKEN_PREFER_AGA_GRAPHICS                22
+#define SETUP_TOKEN_GRAPHICS_SET               23
+#define SETUP_TOKEN_SOUNDS_SET                 24
+#define SETUP_TOKEN_MUSIC_SET                  25
+#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS    26
+#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS      27
+#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC       28
+
+#define NUM_GLOBAL_SETUP_TOKENS                        29
 
 /* editor setup */
 #define SETUP_TOKEN_EDITOR_EL_BOULDERDASH      0
@@ -6967,7 +6039,7 @@ static struct TokenInfo global_setup_tokens[] =
   { TYPE_SWITCH, &si.toons,            "toons"                         },
   { TYPE_SWITCH, &si.scroll_delay,     "scroll_delay"                  },
   { TYPE_SWITCH, &si.soft_scrolling,   "soft_scrolling"                },
-  { TYPE_SWITCH, &si.fading,           "screen_fading"                 },
+  { TYPE_SWITCH, &si.fade_screens,     "fade_screens"                  },
   { TYPE_SWITCH, &si.autorecord,       "automatic_tape_recording"      },
   { TYPE_SWITCH, &si.show_titlescreen, "show_titlescreen"              },
   { TYPE_SWITCH, &si.quick_doors,      "quick_doors"                   },
@@ -6976,6 +6048,7 @@ static struct TokenInfo global_setup_tokens[] =
   { TYPE_SWITCH, &si.skip_levels,      "skip_levels"                   },
   { TYPE_SWITCH, &si.time_limit,       "time_limit"                    },
   { TYPE_SWITCH, &si.fullscreen,       "fullscreen"                    },
+  { TYPE_STRING, &si.fullscreen_mode,  "fullscreen_mode"               },
   { TYPE_SWITCH, &si.ask_on_escape,    "ask_on_escape"                 },
   { TYPE_SWITCH, &si.ask_on_escape_editor, "ask_on_escape_editor"      },
   { TYPE_SWITCH, &si.quick_switch,     "quick_player_switch"           },
@@ -7116,7 +6189,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->direct_draw = !si->double_buffering;
   si->scroll_delay = TRUE;
   si->soft_scrolling = TRUE;
-  si->fading = FALSE;
+  si->fade_screens = TRUE;
   si->autorecord = TRUE;
   si->show_titlescreen = TRUE;
   si->quick_doors = FALSE;
@@ -7125,6 +6198,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->skip_levels = TRUE;
   si->time_limit = TRUE;
   si->fullscreen = FALSE;
+  si->fullscreen_mode = getStringCopy(DEFAULT_FULLSCREEN_MODE);
   si->ask_on_escape = TRUE;
   si->ask_on_escape_editor = TRUE;
   si->quick_switch = FALSE;
@@ -7527,7 +6601,6 @@ void LoadSpecialMenuDesignSettings()
          get_auto_parameter_value(image_config_vars[i].token,
                                   image_config[j].value);
 
-#if 1
   if (!SETUP_OVERRIDE_ARTWORK(setup, ARTWORK_TYPE_GRAPHICS))
   {
     /* first look for special settings configured in level series config */
@@ -7541,13 +6614,6 @@ void LoadSpecialMenuDesignSettings()
 
   if (filename_local != NULL && !strEqual(filename_base, filename_local))
     LoadSpecialMenuDesignSettingsFromFilename(filename_local);
-
-#else
-
-  filename_local = getCustomArtworkConfigFilename(ARTWORK_TYPE_GRAPHICS);
-
-  LoadSpecialMenuDesignSettingsFromFilename(filename_local);
-#endif
 }
 
 void LoadUserDefinedEditorElementList(int **elements, int *num_elements)
index 1eadf1eb0420592d40e4fa6112560c600488f59e..a3781bed2ea7fb2cc06b493bdf97c74366764aa9 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index f06c86d855c06673b6c050100ba3bb9aafc7947c..fea0d6ce8e1588f28bfc94634545cf5e5a180c74 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
 
 #define USE_QUICKSAND_IMPACT_BUGFIX    (USE_NEW_STUFF          * 0)
 
+#define USE_CODE_THAT_BREAKS_SNAKE_BITE        (USE_NEW_STUFF          * 1)
+
+#define USE_UFAST_PLAYER_EXIT_BUGFIX   (USE_NEW_STUFF          * 1)
+
+
 /* for DigField() */
 #define DF_NO_PUSH             0
 #define DF_DIG                 1
 #define EX_TYPE_DYNA           (1 << 4)
 #define EX_TYPE_SINGLE_TILE    (EX_TYPE_CENTER | EX_TYPE_BORDER)
 
+#define        PANEL_DEACTIVATED(p)    ((p).x < 0 || (p).y < 0)
+
 /* special positions in the game control window (relative to control window) */
-#define XX_LEVEL               37
-#define YY_LEVEL               20
-#define XX_EMERALDS            29
-#define YY_EMERALDS            54
-#define XX_DYNAMITE            29
-#define YY_DYNAMITE            89
-#define XX_KEYS                        18
-#define YY_KEYS                        123
-#define XX_SCORE               15
-#define YY_SCORE               159
-#define XX_TIME1               29
-#define XX_TIME2               30
-#define YY_TIME                        194
+#define XX_LEVEL1              (game.panel.level.x)
+#define XX_LEVEL2              (game.panel.level.x - 1)
+#define YY_LEVEL               (game.panel.level.y)
+#define XX_EMERALDS            (game.panel.gems.x)
+#define YY_EMERALDS            (game.panel.gems.y)
+#define XX_DYNAMITE            (game.panel.inventory.x)
+#define YY_DYNAMITE            (game.panel.inventory.y)
+#define XX_KEYS                        (game.panel.keys.x)
+#define YY_KEYS                        (game.panel.keys.y)
+#define XX_SCORE               (game.panel.score.x)
+#define YY_SCORE               (game.panel.score.y)
+#define XX_TIME1               (game.panel.time.x)
+#define XX_TIME2               (game.panel.time.x + 1)
+#define YY_TIME                        (game.panel.time.y)
 
 /* special positions in the game control window (relative to main window) */
-#define DX_LEVEL               (DX + XX_LEVEL)
+#define DX_LEVEL1              (DX + XX_LEVEL1)
+#define DX_LEVEL2              (DX + XX_LEVEL2)
 #define DY_LEVEL               (DY + YY_LEVEL)
 #define DX_EMERALDS            (DX + XX_EMERALDS)
 #define DY_EMERALDS            (DY + YY_EMERALDS)
 #define MOVE_DELAY_HIGH_SPEED  4
 #define MOVE_DELAY_MAX_SPEED   1
 
-#if 0
-#define DOUBLE_MOVE_DELAY(x)   (x = (x <= MOVE_DELAY_HIGH_SPEED ? x * 2 : x))
-#define HALVE_MOVE_DELAY(x)    (x = (x >= MOVE_DELAY_HIGH_SPEED ? x / 2 : x))
-#else
 #define DOUBLE_MOVE_DELAY(x)   (x = (x < MOVE_DELAY_MIN_SPEED ? x * 2 : x))
 #define HALVE_MOVE_DELAY(x)    (x = (x > MOVE_DELAY_MAX_SPEED ? x / 2 : x))
-#endif
-#define DOUBLE_PLAYER_SPEED(p) (HALVE_MOVE_DELAY((p)->move_delay_value))
+
+#define DOUBLE_PLAYER_SPEED(p) (HALVE_MOVE_DELAY( (p)->move_delay_value))
 #define HALVE_PLAYER_SPEED(p)  (DOUBLE_MOVE_DELAY((p)->move_delay_value))
 
 /* values for other actions */
                                 RND((c)->delay_random))
 
 
-#if 1
 #define GET_VALID_RUNTIME_ELEMENT(e)                                   \
         ((e) >= NUM_RUNTIME_ELEMENTS ? EL_UNKNOWN : (e))
-#else
-#define GET_VALID_FILE_ELEMENT(e)                                      \
-       ((e) >= NUM_FILE_ELEMENTS ? EL_UNKNOWN : (e))
-#endif
 
-#define GET_TARGET_ELEMENT(e, ch, cv, cs)                              \
+#define RESOLVED_REFERENCE_ELEMENT(be, e)                              \
+       ((be) + (e) - EL_SELF < EL_CUSTOM_START ? EL_CUSTOM_START :     \
+        (be) + (e) - EL_SELF > EL_CUSTOM_END   ? EL_CUSTOM_END :       \
+        (be) + (e) - EL_SELF)
+
+#define GET_TARGET_ELEMENT(be, e, ch, cv, cs)                          \
        ((e) == EL_TRIGGER_PLAYER   ? (ch)->actual_trigger_player    :  \
         (e) == EL_TRIGGER_ELEMENT  ? (ch)->actual_trigger_element   :  \
         (e) == EL_TRIGGER_CE_VALUE ? (ch)->actual_trigger_ce_value  :  \
         (e) == EL_TRIGGER_CE_SCORE ? (ch)->actual_trigger_ce_score  :  \
         (e) == EL_CURRENT_CE_VALUE ? (cv) :                            \
-        (e) == EL_CURRENT_CE_SCORE ? (cs) : (e))
+        (e) == EL_CURRENT_CE_SCORE ? (cs) :                            \
+        (e) >= EL_LAST_CE_8 && (e) <= EL_NEXT_CE_8 ?                   \
+        RESOLVED_REFERENCE_ELEMENT(be, e) :                            \
+        (e))
 
 #define CAN_GROW_INTO(e)                                               \
        ((e) == EL_SAND || (IS_DIGGABLE(e) && level.grow_into_diggable))
        (IN_LEV_FIELD(x, y) && (Feld[x][y] == EL_EMC_SPRING_BUMPER ||   \
                                Feld[x][y] == EL_EMC_SPRING_BUMPER_ACTIVE))
 
-#if 0
-#define GROUP_NR(e)            ((e) - EL_GROUP_START)
-#define IS_IN_GROUP(e, nr)     (element_info[e].in_group[nr] == TRUE)
-#define IS_IN_GROUP_EL(e, ge)  (IS_IN_GROUP(e, (ge) - EL_GROUP_START))
-
-#define IS_EQUAL_OR_IN_GROUP(e, ge)                                    \
-       (IS_GROUP_ELEMENT(ge) ? IS_IN_GROUP(e, GROUP_NR(ge)) : (e) == (ge))
-#endif
-
 #define MOVE_ENTER_EL(e)       (element_info[e].move_enter_element)
 
 #define CE_ENTER_FIELD_COND(e, x, y)                                   \
@@ -397,8 +396,6 @@ static void RunTimegateWheel(int, int);
 static void InitMagicBallDelay(int, int);
 static void ActivateMagicBall(int, int);
 
-static void InitDiagonalMovingElement(int, int);
-
 struct ChangingElementInfo
 {
   int element;
@@ -594,7 +591,7 @@ static struct ChangingElementInfo change_delay_list[] =
     0,
     NULL,
     NULL,
-    InitDiagonalMovingElement
+    NULL,
   },
 
   {
@@ -1155,7 +1152,6 @@ static void InitField(int x, int y, boolean init_game)
       break;
 
     default:
-#if 1
       if (IS_CUSTOM_ELEMENT(element))
       {
        if (CAN_MOVE(element))
@@ -1166,59 +1162,18 @@ static void InitField(int x, int y, boolean init_game)
          CustomValue[x][y] = GET_NEW_CE_VALUE(Feld[x][y]);
 #endif
       }
-#else
-      if (IS_CUSTOM_ELEMENT(element) && CAN_MOVE(element))
-       InitMovDir(x, y);
-#endif
       else if (IS_GROUP_ELEMENT(element))
       {
-#if 1
        Feld[x][y] = get_element_from_group_element(element);
 
        InitField(x, y, init_game);
-#else
-       struct ElementGroupInfo *group = element_info[element].group;
-       int last_anim_random_frame = gfx.anim_random_frame;
-       int element_pos;
-
-       if (group->choice_mode == ANIM_RANDOM)
-         gfx.anim_random_frame = RND(group->num_elements_resolved);
-
-       element_pos = getAnimationFrame(group->num_elements_resolved, 1,
-                                       group->choice_mode, 0,
-                                       group->choice_pos);
-
-       if (group->choice_mode == ANIM_RANDOM)
-         gfx.anim_random_frame = last_anim_random_frame;
-
-       group->choice_pos++;
-
-       Feld[x][y] = group->element_resolved[element_pos];
-
-       InitField(x, y, init_game);
-#endif
       }
+
       break;
   }
 
-#if 1
   if (!init_game)
     CheckTriggeredElementChange(x, y, element, CE_CREATION_OF_X);
-#endif
-
-#if 0
-
-#if USE_NEW_CUSTOM_VALUE
-
-#if 1
-  CustomValue[x][y] = GET_NEW_CE_VALUE(Feld[x][y]);
-#else
-  CustomValue[x][y] = element_info[Feld[x][y]].custom_value_initial;
-#endif
-
-#endif
-
-#endif
 }
 
 static inline void InitField_WithBug1(int x, int y, boolean init_game)
@@ -1256,6 +1211,9 @@ inline void DrawGameValue_Emeralds(int value)
 {
   int xpos = (3 * 14 - 3 * getFontWidth(FONT_TEXT_2)) / 2;
 
+  if (PANEL_DEACTIVATED(game.panel.gems))
+    return;
+
   DrawText(DX_EMERALDS + xpos, DY_EMERALDS, int2str(value, 3), FONT_TEXT_2);
 }
 
@@ -1263,6 +1221,9 @@ inline void DrawGameValue_Dynamite(int value)
 {
   int xpos = (3 * 14 - 3 * getFontWidth(FONT_TEXT_2)) / 2;
 
+  if (PANEL_DEACTIVATED(game.panel.inventory))
+    return;
+
   DrawText(DX_DYNAMITE + xpos, DY_DYNAMITE, int2str(value, 3), FONT_TEXT_2);
 }
 
@@ -1271,19 +1232,23 @@ inline void DrawGameValue_Keys(int key[MAX_NUM_KEYS])
   int base_key_graphic = EL_KEY_1;
   int i;
 
+  if (PANEL_DEACTIVATED(game.panel.keys))
+    return;
+
   if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
     base_key_graphic = EL_EM_KEY_1;
 
   /* currently only 4 of 8 possible keys are displayed */
   for (i = 0; i < STD_NUM_KEYS; i++)
   {
+    int x = XX_KEYS + i * MINI_TILEX;
+    int y = YY_KEYS;
+
     if (key[i])
-      DrawMiniGraphicExt(drawto, DX_KEYS + i * MINI_TILEX, DY_KEYS,
-                        el2edimg(base_key_graphic + i));
+      DrawMiniGraphicExt(drawto, DX + x,DY + y, el2edimg(base_key_graphic + i));
     else
       BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
-                DOOR_GFX_PAGEX5 + XX_KEYS + i * MINI_TILEX, YY_KEYS,
-                MINI_TILEX, MINI_TILEY, DX_KEYS + i * MINI_TILEX, DY_KEYS);
+                DOOR_GFX_PAGEX5 + x, y, MINI_TILEX, MINI_TILEY, DX + x,DY + y);
   }
 }
 
@@ -1291,6 +1256,9 @@ inline void DrawGameValue_Score(int value)
 {
   int xpos = (5 * 14 - 5 * getFontWidth(FONT_TEXT_2)) / 2;
 
+  if (PANEL_DEACTIVATED(game.panel.score))
+    return;
+
   DrawText(DX_SCORE + xpos, DY_SCORE, int2str(value, 5), FONT_TEXT_2);
 }
 
@@ -1299,9 +1267,12 @@ inline void DrawGameValue_Time(int value)
   int xpos3 = (3 * 14 - 3 * getFontWidth(FONT_TEXT_2)) / 2;
   int xpos4 = (4 * 10 - 4 * getFontWidth(FONT_LEVEL_NUMBER)) / 2;
 
+  if (PANEL_DEACTIVATED(game.panel.time))
+    return;
+
   /* clear background if value just changed its size */
   if (value == 999 || value == 1000)
-    ClearRectangle(drawto, DX_TIME1, DY_TIME, 14 * 3, 14);
+    ClearRectangleOnBackground(drawto, DX_TIME1, DY_TIME, 14 * 3, 14);
 
   if (value < 1000)
     DrawText(DX_TIME1 + xpos3, DY_TIME, int2str(value, 3), FONT_TEXT_2);
@@ -1311,26 +1282,13 @@ inline void DrawGameValue_Time(int value)
 
 inline void DrawGameValue_Level(int value)
 {
+  if (PANEL_DEACTIVATED(game.panel.level))
+    return;
+
   if (level_nr < 100)
-    DrawText(DX_LEVEL, DY_LEVEL, int2str(value, 2), FONT_TEXT_2);
+    DrawText(DX_LEVEL1, DY_LEVEL, int2str(value, 2), FONT_TEXT_2);
   else
-  {
-    /* misuse area for displaying emeralds to draw bigger level number */
-    DrawTextExt(drawto, DX_EMERALDS, DY_EMERALDS,
-               int2str(value, 3), FONT_LEVEL_NUMBER, BLIT_OPAQUE);
-
-    /* now copy it to the area for displaying level number */
-    BlitBitmap(drawto, drawto,
-              DX_EMERALDS, DY_EMERALDS + 1,
-              getFontWidth(FONT_LEVEL_NUMBER) * 3,
-              getFontHeight(FONT_LEVEL_NUMBER) - 1,
-              DX_LEVEL - 1, DY_LEVEL + 1);
-
-    /* restore the area for displaying emeralds */
-    DrawGameValue_Emeralds(local_player->gems_still_needed);
-
-    /* yes, this is all really ugly :-) */
-  }
+    DrawText(DX_LEVEL2, DY_LEVEL, int2str(value, 3), FONT_LEVEL_NUMBER);
 }
 
 void DrawAllGameValues(int emeralds, int dynamite, int score, int time,
@@ -1339,6 +1297,11 @@ void DrawAllGameValues(int emeralds, int dynamite, int score, int time,
   int key[MAX_NUM_KEYS];
   int i;
 
+  /* prevent EM engine from updating time/score values parallel to GameWon() */
+  if (level.game_engine_type == GAME_ENGINE_TYPE_EM &&
+      local_player->LevelSolved)
+    return;
+
   for (i = 0; i < MAX_NUM_KEYS; i++)
     key[i] = key_bits & (1 << i);
 
@@ -1354,7 +1317,11 @@ void DrawAllGameValues(int emeralds, int dynamite, int score, int time,
 
 void DrawGameDoorValues()
 {
-  int dynamite_state = 0;
+  int time_value = (level.time == 0 ? TimePlayed : TimeLeft);
+  int dynamite_value = 0;
+  int score_value = (local_player->LevelSolved ? local_player->score_final :
+                    local_player->score);
+  int gems_value = local_player->gems_still_needed;
   int key_bits = 0;
   int i, j;
 
@@ -1365,16 +1332,6 @@ void DrawGameDoorValues()
     return;
   }
 
-#if 0
-  DrawGameValue_Level(level_nr);
-
-  DrawGameValue_Emeralds(local_player->gems_still_needed);
-  DrawGameValue_Dynamite(local_player->inventory_size);
-  DrawGameValue_Score(local_player->score);
-  DrawGameValue_Time(TimeLeft);
-
-#else
-
   if (game.centered_player_nr == -1)
   {
     for (i = 0; i < MAX_PLAYERS; i++)
@@ -1383,12 +1340,8 @@ void DrawGameDoorValues()
        if (stored_player[i].key[j])
          key_bits |= (1 << j);
 
-      dynamite_state += stored_player[i].inventory_size;
+      dynamite_value += stored_player[i].inventory_size;
     }
-
-#if 0
-    DrawGameValue_Keys(stored_player[i].key);
-#endif
   }
   else
   {
@@ -1398,59 +1351,13 @@ void DrawGameDoorValues()
       if (stored_player[player_nr].key[i])
        key_bits |= (1 << i);
 
-    dynamite_state = stored_player[player_nr].inventory_size;
+    dynamite_value = stored_player[player_nr].inventory_size;
   }
 
-  DrawAllGameValues(local_player->gems_still_needed, dynamite_state,
-                   local_player->score, TimeLeft, key_bits);
-#endif
+  DrawAllGameValues(gems_value, dynamite_value, score_value, time_value,
+                   key_bits);
 }
 
-#if 0
-static void resolve_group_element(int group_element, int recursion_depth)
-{
-  static int group_nr;
-  static struct ElementGroupInfo *group;
-  struct ElementGroupInfo *actual_group = element_info[group_element].group;
-  int i;
-
-  if (recursion_depth > NUM_GROUP_ELEMENTS)    /* recursion too deep */
-  {
-    Error(ERR_WARN, "recursion too deep when resolving group element %d",
-         group_element - EL_GROUP_START + 1);
-
-    /* replace element which caused too deep recursion by question mark */
-    group->element_resolved[group->num_elements_resolved++] = EL_UNKNOWN;
-
-    return;
-  }
-
-  if (recursion_depth == 0)                    /* initialization */
-  {
-    group = element_info[group_element].group;
-    group_nr = group_element - EL_GROUP_START;
-
-    group->num_elements_resolved = 0;
-    group->choice_pos = 0;
-  }
-
-  for (i = 0; i < actual_group->num_elements; i++)
-  {
-    int element = actual_group->element[i];
-
-    if (group->num_elements_resolved == NUM_FILE_ELEMENTS)
-      break;
-
-    if (IS_GROUP_ELEMENT(element))
-      resolve_group_element(element, recursion_depth + 1);
-    else
-    {
-      group->element_resolved[group->num_elements_resolved++] = element;
-      element_info[element].in_group[group_nr] = TRUE;
-    }
-  }
-}
-#endif
 
 /*
   =============================================================================
@@ -1582,29 +1489,12 @@ static void InitGameEngine()
   printf("       => game.engine_version == %06d\n", game.engine_version);
 #endif
 
-#if 0
-  /* ---------- recursively resolve group elements ------------------------- */
-
-  for (i = 0; i < MAX_NUM_ELEMENTS; i++)
-    for (j = 0; j < NUM_GROUP_ELEMENTS; j++)
-      element_info[i].in_group[j] = FALSE;
-
-  for (i = 0; i < NUM_GROUP_ELEMENTS; i++)
-    resolve_group_element(EL_GROUP_START + i, 0);
-#endif
-
   /* ---------- initialize player's initial move delay --------------------- */
 
-#if 1
   /* dynamically adjust player properties according to level information */
   for (i = 0; i < MAX_PLAYERS; i++)
     game.initial_move_delay_value[i] =
       get_move_delay_from_stepsize(level.initial_player_stepsize[i]);
-#else
-  /* dynamically adjust player properties according to level information */
-  game.initial_move_delay_value =
-    (level.double_speed ? MOVE_DELAY_HIGH_SPEED : MOVE_DELAY_NORMAL_SPEED);
-#endif
 
   /* dynamically adjust player properties according to game engine version */
   for (i = 0; i < MAX_PLAYERS; i++)
@@ -1754,6 +1644,9 @@ static void InitGameEngine()
              for (l = 0; l < group->num_elements_resolved; l++)
                trigger_events[group->element_resolved[l]][k] = TRUE;
            }
+           else if (trigger_element == EL_ANY_ELEMENT)
+             for (l = 0; l < MAX_NUM_ELEMENTS; l++)
+               trigger_events[l][k] = TRUE;
            else
              trigger_events[trigger_element][k] = TRUE;
          }
@@ -1769,7 +1662,6 @@ static void InitGameEngine()
   {
     if (!IS_CUSTOM_ELEMENT(i))
     {
-#if 1
       /* set default push delay values (corrected since version 3.0.7-1) */
       if (game.engine_version < VERSION_IDENT(3,0,7,1))
       {
@@ -1781,10 +1673,6 @@ static void InitGameEngine()
        element_info[i].push_delay_fixed = 8;
        element_info[i].push_delay_random = 8;
       }
-#else
-      element_info[i].push_delay_fixed  = game.default_push_delay_fixed;
-      element_info[i].push_delay_random = game.default_push_delay_random;
-#endif
     }
   }
 
@@ -1913,13 +1801,10 @@ int get_num_special_action(int element, int action_first, int action_last)
       break;
   }
 
-#if 0
-  printf("::: %d->%d: %d\n", action_first, action_last, num_special_action);
-#endif
-
   return num_special_action;
 }
 
+
 /*
   =============================================================================
   InitGame()
@@ -1933,8 +1818,11 @@ void InitGame()
   boolean emulate_bd = TRUE;   /* unless non-BOULDERDASH elements found */
   boolean emulate_sb = TRUE;   /* unless non-SOKOBAN     elements found */
   boolean emulate_sp = TRUE;   /* unless non-SUPAPLEX    elements found */
+  boolean do_fading = (game_status == GAME_MODE_MAIN);
   int i, j, x, y;
 
+  game_status = GAME_MODE_PLAYING;
+
   InitGameEngine();
 
   /* don't play tapes over network */
@@ -1956,6 +1844,8 @@ void InitGame()
     player->programmed_action = 0;
 
     player->score = 0;
+    player->score_final = 0;
+
     player->gems_still_needed = level.gems_needed;
     player->sokobanfields_still_needed = 0;
     player->lights_still_needed = 0;
@@ -2023,18 +1913,6 @@ void InitGame()
     player->special_action_bored = ACTION_DEFAULT;
     player->special_action_sleeping = ACTION_DEFAULT;
 
-#if 1
-    /* cannot be set here -- could be modified in Init[Player]Field() below */
-#else
-    /* set number of special actions for bored and sleeping animation */
-    player->num_special_action_bored =
-      get_num_special_action(player->artwork_element,
-                            ACTION_BORING_1, ACTION_BORING_LAST);
-    player->num_special_action_sleeping =
-      get_num_special_action(player->artwork_element,
-                            ACTION_SLEEPING_1, ACTION_SLEEPING_LAST);
-#endif
-
     player->switch_x = -1;
     player->switch_y = -1;
 
@@ -2043,18 +1921,7 @@ void InitGame()
 
     player->show_envelope = 0;
 
-#if 1
     SetPlayerMoveSpeed(player, level.initial_player_stepsize[i], TRUE);
-#else
-    player->move_delay       = game.initial_move_delay;
-    player->move_delay_value = game.initial_move_delay_value;
-
-    player->move_delay_value_next = -1;
-
-    player->move_delay_reset_counter = 0;
-
-    player->cannot_move = FALSE;
-#endif
 
     player->push_delay       = -1;     /* initialized when pushing starts */
     player->push_delay_value = game.initial_push_delay_value;
@@ -2076,6 +1943,10 @@ void InitGame()
 
     player->LevelSolved = FALSE;
     player->GameOver = FALSE;
+
+    player->LevelSolved_GameEnd = FALSE;
+    player->LevelSolved_SaveTape = FALSE;
+    player->LevelSolved_SaveScore = FALSE;
   }
 
   network_player_action_received = FALSE;
@@ -2112,11 +1983,7 @@ void InitGame()
   game.wind_direction = level.wind_direction_initial;
 
 #if !USE_PLAYER_GRAVITY
-#if 1
   game.gravity = FALSE;
-#else
-  game.gravity = level.initial_gravity;
-#endif
   game.explosions_delayed = TRUE;
 #endif
 
@@ -2140,11 +2007,6 @@ void InitGame()
     tape.set_centered_player = TRUE;
   }
 
-#if 0
-  printf("::: focus set to player %d [%d]\n",
-        game.centered_player_nr, local_player->index_nr);
-#endif
-
   for (i = 0; i < NUM_BELTS; i++)
   {
     game.belt_dir[i] = MV_NONE;
@@ -2154,11 +2016,7 @@ void InitGame()
   for (i = 0; i < MAX_NUM_AMOEBA; i++)
     AmoebaCnt[i] = AmoebaCnt2[i] = 0;
 
-#if 1
   SCAN_PLAYFIELD(x, y)
-#else
-  for (x = 0; x < lev_fieldx; x++) for (y = 0; y < lev_fieldy; y++)
-#endif
   {
     Feld[x][y] = level.field[x][y];
     MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
@@ -2192,11 +2050,7 @@ void InitGame()
     GfxDir[x][y] = MV_NONE;
   }
 
-#if 1
   SCAN_PLAYFIELD(x, y)
-#else
-  for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
-#endif
   {
     if (emulate_bd && !IS_BD_ELEMENT(Feld[x][y]))
       emulate_bd = FALSE;
@@ -2214,7 +2068,6 @@ void InitGame()
   {
     struct PlayerInfo *player = &stored_player[i];
 
-#if 1
     /* set number of special actions for bored and sleeping animation */
     player->num_special_action_bored =
       get_num_special_action(player->artwork_element,
@@ -2222,8 +2075,6 @@ void InitGame()
     player->num_special_action_sleeping =
       get_num_special_action(player->artwork_element,
                             ACTION_SLEEPING_1, ACTION_SLEEPING_LAST);
-#endif
-
   }
 
   game.emulation = (emulate_bd ? EMU_BOULDERDASH :
@@ -2304,10 +2155,6 @@ void InitGame()
          some_player->present = FALSE;
          some_player->active = FALSE;
 
-#if 0
-         player->element_nr = some_player->element_nr;
-#endif
-
          player->artwork_element = some_player->artwork_element;
 
          player->block_last_field       = some_player->block_last_field;
@@ -2420,11 +2267,7 @@ void InitGame()
     int found_element = EL_UNDEFINED;
     int player_nr = local_player->index_nr;
 
-#if 1
     SCAN_PLAYFIELD(x, y)
-#else
-    for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
-#endif
     {
       int element = Feld[x][y];
       int content;
@@ -2521,13 +2364,21 @@ void InitGame()
                local_player->jy - MIDPOSY);
   }
 
+  StopAnimation();
+
   if (!game.restart_level)
     CloseDoor(DOOR_CLOSE_1);
 
+  if (do_fading)
+    FadeOut(REDRAW_FIELD);
+
   /* !!! FIX THIS (START) !!! */
   if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
   {
     InitGameEngine_EM();
+
+    /* blit playfield from scroll buffer to normal back buffer for fading in */
+    BlitScreenToBitmap_EM(backbuffer);
   }
   else
   {
@@ -2538,14 +2389,19 @@ void InitGame()
     if (game.timegate_time_left == 0)
       CloseAllOpenTimegates();
 
+    /* blit playfield from scroll buffer to normal back buffer for fading in */
     if (setup.soft_scrolling)
       BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
 
     redraw_mask |= REDRAW_FROM_BACKBUFFER;
-    FadeToFront();
   }
   /* !!! FIX THIS (END) !!! */
 
+  if (do_fading)
+    FadeIn(REDRAW_FIELD);
+
+  BackToFront();
+
   if (!game.restart_level)
   {
     /* copy default game door content to main double buffer */
@@ -2553,6 +2409,9 @@ void InitGame()
               DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
   }
 
+  SetPanelBackground();
+  SetDrawBackgroundMask(REDRAW_DOOR_1);
+
   DrawGameDoorValues();
 
   if (!game.restart_level)
@@ -2571,7 +2430,7 @@ void InitGame()
 
     OpenDoor(DOOR_OPEN_ALL);
 
-    PlaySoundStereo(SND_GAME_STARTING, SOUND_MIDDLE);
+    PlaySound(SND_GAME_STARTING);
 
     if (setup.sound_music)
       PlayLevelMusic();
@@ -2796,123 +2655,144 @@ void InitAmoebaNr(int x, int y)
   AmoebaCnt2[group_nr]++;
 }
 
+static void PlayerWins(struct PlayerInfo *player)
+{
+  player->LevelSolved = TRUE;
+  player->GameOver = TRUE;
+
+  player->score_final = (level.game_engine_type == GAME_ENGINE_TYPE_EM ?
+                        level.native_em_level->lev->score : player->score);
+}
+
 void GameWon()
 {
-  int hi_pos;
-  boolean raise_level = FALSE;
+  static int time, time_final;
+  static int score, score_final;
+  static int game_over_delay = 0;
+  int game_over_delay_value = 50;
 
+  /* do not start end game actions before the player stops moving (to exit) */
   if (local_player->MovPos)
     return;
 
-  if (tape.auto_play)          /* tape might already be stopped here */
-    tape.auto_play_level_solved = TRUE;
+  if (!local_player->LevelSolved_GameEnd)
+  {
+    local_player->LevelSolved_GameEnd = TRUE;
+    local_player->LevelSolved_SaveTape = tape.recording;
+    local_player->LevelSolved_SaveScore = !tape.playing;
 
-  local_player->LevelSolved = FALSE;
+    if (tape.auto_play)                /* tape might already be stopped here */
+      tape.auto_play_level_solved = TRUE;
 
-  PlaySoundStereo(SND_GAME_WINNING, SOUND_MIDDLE);
+    game_over_delay = game_over_delay_value;
 
-  if (TimeLeft)
-  {
-    if (!tape.playing && setup.sound_loops)
-      PlaySoundExt(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_VOLUME, SOUND_MIDDLE,
-                  SND_CTRL_PLAY_LOOP);
+    time = time_final = (level.time == 0 ? TimePlayed : TimeLeft);
+    score = score_final = local_player->score_final;
 
-    while (TimeLeft > 0)
+    if (TimeLeft > 0)
     {
-      if (!tape.playing && !setup.sound_loops)
-       PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_MIDDLE);
-
-      if (TimeLeft > 100 && TimeLeft % 10 == 0)
-      {
-       TimeLeft -= 10;
-       RaiseScore(level.score[SC_TIME_BONUS] * 10);
-      }
-      else
-      {
-       TimeLeft--;
-       RaiseScore(level.score[SC_TIME_BONUS]);
-      }
+      time_final = 0;
+      score_final += TimeLeft * level.score[SC_TIME_BONUS];
+    }
+    else if (level.time == 0 && TimePlayed < 999)
+    {
+      time_final = 999;
+      score_final += (999 - TimePlayed) * level.score[SC_TIME_BONUS];
+    }
 
-      DrawGameValue_Time(TimeLeft);
+    local_player->score_final = score_final;
 
-      BackToFront();
+    if (level_editor_test_game)
+    {
+      time = time_final;
+      score = score_final;
 
-      if (!tape.playing)
-       Delay(10);
+      DrawGameValue_Time(time);
+      DrawGameValue_Score(score);
     }
 
-    if (!tape.playing && setup.sound_loops)
-      StopSound(SND_GAME_LEVELTIME_BONUS);
-  }
-  else if (level.time == 0)            /* level without time limit */
-  {
-    if (!tape.playing && setup.sound_loops)
-      PlaySoundExt(SND_GAME_LEVELTIME_BONUS, SOUND_MAX_VOLUME, SOUND_MIDDLE,
-                  SND_CTRL_PLAY_LOOP);
-
-    while (TimePlayed < 999)
+    if (ExitX >= 0 && ExitY >= 0)      /* local player has left the level */
     {
-      if (!tape.playing && !setup.sound_loops)
-       PlaySoundStereo(SND_GAME_LEVELTIME_BONUS, SOUND_MIDDLE);
-
-      if (TimePlayed < 900 && TimePlayed % 10 == 0)
-      {
-       TimePlayed += 10;
-       RaiseScore(level.score[SC_TIME_BONUS] * 10);
-      }
-      else
+      /* close exit door after last player */
+      if (AllPlayersGone &&
+         (Feld[ExitX][ExitY] == EL_EXIT_OPEN ||
+          Feld[ExitX][ExitY] == EL_SP_EXIT_OPEN))
       {
-       TimePlayed++;
-       RaiseScore(level.score[SC_TIME_BONUS]);
-      }
+       int element = Feld[ExitX][ExitY];
 
-      DrawGameValue_Time(TimePlayed);
+       Feld[ExitX][ExitY] = (element == EL_EXIT_OPEN ? EL_EXIT_CLOSING :
+                             EL_SP_EXIT_CLOSING);
 
-      BackToFront();
+       PlayLevelSoundElementAction(ExitX, ExitY, element, ACTION_CLOSING);
+      }
 
-      if (!tape.playing)
-       Delay(10);
+      /* player disappears */
+      DrawLevelField(ExitX, ExitY);
     }
 
-    if (!tape.playing && setup.sound_loops)
-      StopSound(SND_GAME_LEVELTIME_BONUS);
+    PlaySound(SND_GAME_WINNING);
   }
 
-  /* close exit door after last player */
-  if (AllPlayersGone && ExitX >= 0 && ExitY >= 0 &&
-      (Feld[ExitX][ExitY] == EL_EXIT_OPEN ||
-       Feld[ExitX][ExitY] == EL_SP_EXIT_OPEN))
+  if (game_over_delay > 0)
   {
-    int element = Feld[ExitX][ExitY];
+    game_over_delay--;
 
-    Feld[ExitX][ExitY] = (element == EL_EXIT_OPEN ? EL_EXIT_CLOSING :
-                         EL_SP_EXIT_CLOSING);
-
-    PlayLevelSoundElementAction(ExitX, ExitY, element, ACTION_CLOSING);
+    return;
   }
 
-  /* player disappears */
-  if (ExitX >= 0 && ExitY >= 0)
-    DrawLevelField(ExitX, ExitY);
+  if (time != time_final)
+  {
+    int time_to_go = ABS(time_final - time);
+    int time_count_dir = (time < time_final ? +1 : -1);
+    int time_count_steps = (time_to_go > 100 && time_to_go % 10 == 0 ? 10 : 1);
 
-  BackToFront();
+    time  += time_count_steps * time_count_dir;
+    score += time_count_steps * level.score[SC_TIME_BONUS];
 
-#if 0
-  if (tape.playing)
-    printf("::: TAPE PLAYING -> DO NOT SAVE SCORE\n");
-  else
-    printf("::: NO TAPE PLAYING -> SAVING SCORE\n");
-#endif
+    DrawGameValue_Time(time);
+    DrawGameValue_Score(score);
 
-  if (tape.playing)
-    return;
+    if (time == time_final)
+      StopSound(SND_GAME_LEVELTIME_BONUS);
+    else if (setup.sound_loops)
+      PlaySoundLoop(SND_GAME_LEVELTIME_BONUS);
+    else
+      PlaySound(SND_GAME_LEVELTIME_BONUS);
+  }
+}
+
+void GameEnd()
+{
+  int hi_pos;
+  boolean raise_level = FALSE;
 
   CloseDoor(DOOR_CLOSE_1);
 
-  if (tape.recording)
+  if (local_player->LevelSolved_SaveTape)
   {
     TapeStop();
-    SaveTape(tape.level_nr);           /* Ask to save tape */
+
+    SaveTape(tape.level_nr);           /* ask to save tape */
+  }
+
+  if (level_editor_test_game)
+  {
+    game_status = GAME_MODE_MAIN;
+
+    DrawMainMenu();
+
+    return;
+  }
+
+  if (!local_player->LevelSolved_SaveScore)
+  {
+    FadeOut(REDRAW_FIELD);
+
+    game_status = GAME_MODE_MAIN;
+
+    DrawAndFadeInMainMenu(REDRAW_FIELD);
+
+    return;
   }
 
   if (level_nr == leveldir_current->handicap_level)
@@ -2921,15 +2801,15 @@ void GameWon()
     SaveLevelSetup_SeriesInfo();
   }
 
-  if (level_editor_test_game)
-    local_player->score = -1;  /* no highscore when playing from editor */
-  else if (level_nr < leveldir_current->last_level)
-    raise_level = TRUE;                /* advance to next level */
+  if (level_nr < leveldir_current->last_level)
+    raise_level = TRUE;                        /* advance to next level */
 
   if ((hi_pos = NewHiScore()) >= 0) 
   {
     game_status = GAME_MODE_SCORES;
+
     DrawHallOfFame(hi_pos);
+
     if (raise_level)
     {
       level_nr++;
@@ -2938,16 +2818,18 @@ void GameWon()
   }
   else
   {
+    FadeOut(REDRAW_FIELD);
+
     game_status = GAME_MODE_MAIN;
+
     if (raise_level)
     {
       level_nr++;
       TapeErase();
     }
-    DrawMainMenu();
-  }
 
-  BackToFront();
+    DrawAndFadeInMainMenu(REDRAW_FIELD);
+  }
 }
 
 int NewHiScore()
@@ -2958,12 +2840,12 @@ int NewHiScore()
   LoadScore(level_nr);
 
   if (strEqual(setup.player_name, EMPTY_PLAYER_NAME) ||
-      local_player->score < highscore[MAX_SCORE_ENTRIES - 1].Score) 
+      local_player->score_final < highscore[MAX_SCORE_ENTRIES - 1].Score) 
     return -1;
 
   for (k = 0; k < MAX_SCORE_ENTRIES; k++) 
   {
-    if (local_player->score > highscore[k].Score)
+    if (local_player->score_final > highscore[k].Score)
     {
       /* player has made it to the hall of fame */
 
@@ -2991,7 +2873,7 @@ int NewHiScore()
 #endif
       strncpy(highscore[k].Name, setup.player_name, MAX_PLAYER_NAME_LEN);
       highscore[k].Name[MAX_PLAYER_NAME_LEN] = '\0';
-      highscore[k].Score = local_player->score; 
+      highscore[k].Score = local_player->score_final
       position = k;
       break;
     }
@@ -3023,19 +2905,11 @@ inline static int getElementMoveStepsize(int x, int y)
   /* special values for move stepsize for spring and things on conveyor belt */
   if (horiz_move)
   {
-#if 0
-    if (element == EL_SPRING)
-      step = sign * MOVE_STEPSIZE_NORMAL * 2;
-    else if (CAN_FALL(element) && !CAN_MOVE(element) &&
-            y < lev_fieldy - 1 && IS_BELT_ACTIVE(Feld[x][y + 1]))
-      step = sign * MOVE_STEPSIZE_NORMAL / 2;
-#else
     if (CAN_FALL(element) &&
        y < lev_fieldy - 1 && IS_BELT_ACTIVE(Feld[x][y + 1]))
       step = sign * MOVE_STEPSIZE_NORMAL / 2;
     else if (element == EL_SPRING)
       step = sign * MOVE_STEPSIZE_NORMAL * 2;
-#endif
   }
 
   return step;
@@ -3080,28 +2954,10 @@ static void ResetGfxFrame(int x, int y, boolean redraw)
 
 static void ResetGfxAnimation(int x, int y)
 {
-#if 0
-  int element, graphic;
-#endif
-
   GfxAction[x][y] = ACTION_DEFAULT;
   GfxDir[x][y] = MovDir[x][y];
   GfxFrame[x][y] = 0;
 
-#if 0
-  element = Feld[x][y];
-  graphic = el_act_dir2img(element, GfxAction[x][y], GfxDir[x][y]);
-
-  if (graphic_info[graphic].anim_global_sync)
-    GfxFrame[x][y] = FrameCounter;
-  else if (ANIM_MODE(graphic) == ANIM_CE_VALUE)
-    GfxFrame[x][y] = CustomValue[x][y];
-  else if (ANIM_MODE(graphic) == ANIM_CE_SCORE)
-    GfxFrame[x][y] = element_info[element].collect_score;
-  else if (ANIM_MODE(graphic) == ANIM_CE_DELAY)
-    GfxFrame[x][y] = ChangeDelay[x][y];
-#endif
-
 #if USE_GFX_RESET_GFX_ANIMATION
   ResetGfxFrame(x, y, FALSE);
 #endif
@@ -3115,9 +2971,6 @@ static void ResetRandomAnimationValue(int x, int y)
 void InitMovingField(int x, int y, int direction)
 {
   int element = Feld[x][y];
-#if 0
-  int graphic;
-#endif
   int dx = (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0);
   int dy = (direction == MV_UP   ? -1 : direction == MV_DOWN  ? +1 : 0);
   int newx = x + dx;
@@ -3131,19 +2984,6 @@ void InitMovingField(int x, int y, int direction)
   GfxAction[x][y] = (direction == MV_DOWN && CAN_FALL(element) ?
                     ACTION_FALLING : ACTION_MOVING);
 
-#if 0
-  graphic = el_act_dir2img(element, GfxAction[x][y], GfxDir[x][y]);
-
-  if (graphic_info[graphic].anim_global_sync)
-    GfxFrame[x][y] = FrameCounter;
-  else if (ANIM_MODE(graphic) == ANIM_CE_VALUE)
-    GfxFrame[x][y] = CustomValue[x][y];
-  else if (ANIM_MODE(graphic) == ANIM_CE_SCORE)
-    GfxFrame[x][y] = element_info[element].collect_score;
-  else if (ANIM_MODE(graphic) == ANIM_CE_DELAY)
-    GfxFrame[x][y] = ChangeDelay[x][y];
-#endif
-
   /* this is needed for CEs with property "can move" / "not moving" */
 
   if (getElementMoveStepsize(x, y) != 0)       /* moving or being moved */
@@ -3167,13 +3007,8 @@ void InitMovingField(int x, int y, int direction)
 void Moving2Blocked(int x, int y, int *goes_to_x, int *goes_to_y)
 {
   int direction = MovDir[x][y];
-#if 1
   int newx = x + (direction & MV_LEFT ? -1 : direction & MV_RIGHT ? +1 : 0);
   int newy = y + (direction & MV_UP   ? -1 : direction & MV_DOWN  ? +1 : 0);
-#else
-  int newx = x + (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0);
-  int newy = y + (direction == MV_UP   ? -1 : direction == MV_DOWN  ? +1 : 0);
-#endif
 
   *goes_to_x = newx;
   *goes_to_y = newy;
@@ -3360,8 +3195,6 @@ void CheckDynamite(int x, int y)
   Bang(x, y);
 }
 
-#if 1
-
 static void setMinimalPlayerBoundaries(int *sx1, int *sy1, int *sx2, int *sy2)
 {
   boolean num_checked_players = 0;
@@ -3412,33 +3245,6 @@ static void setScreenCenteredToAllPlayers(int *sx, int *sy)
   *sy = (sy1 + sy2) / 2;
 }
 
-#if 0
-static void setMaxCenterDistanceForAllPlayers(int *max_dx, int *max_dy,
-                                             int center_x, int center_y)
-{
-  int sx1 = center_x, sy1 = center_y, sx2 = center_x, sy2 = center_y;
-
-  setMinimalPlayerBoundaries(&sx1, &sy1, &sx2, &sy2);
-
-  *max_dx = MAX(ABS(sx1 - center_x), ABS(sx2 - center_x));
-  *max_dy = MAX(ABS(sy1 - center_y), ABS(sy2 - center_y));
-}
-
-static boolean checkIfAllPlayersAreVisible(int center_x, int center_y)
-{
-  int max_dx, max_dy;
-
-  setMaxCenterDistanceForAllPlayers(&max_dx, &max_dy, center_x, center_y);
-
-  return (max_dx <= SCR_FIELDX / 2 &&
-         max_dy <= SCR_FIELDY / 2);
-}
-#endif
-
-#endif
-
-#if 1
-
 void DrawRelocateScreen(int x, int y, int move_dir, boolean center_screen,
                        boolean quick_relocation)
 {
@@ -3451,11 +3257,6 @@ void DrawRelocateScreen(int x, int y, int move_dir, boolean center_screen,
   {
     int offset = (setup.scroll_delay ? 3 : 0);
 
-#if 0
-    if (center_screen)
-      offset = 0;
-#endif
-
     if (!IN_VIS_FIELD(SCREENX(x), SCREENY(y)) || center_screen)
     {
       scroll_x = (x < SBX_Left  + MIDPOSX ? SBX_Left :
@@ -3535,102 +3336,6 @@ void DrawRelocateScreen(int x, int y, int move_dir, boolean center_screen,
   }
 }
 
-#else
-
-void DrawRelocatePlayer(struct PlayerInfo *player, boolean quick_relocation)
-{
-  boolean ffwd_delay = (tape.playing && tape.fast_forward);
-  boolean no_delay = (tape.warp_forward);
-  int frame_delay_value = (ffwd_delay ? FfwdFrameDelay : GameFrameDelay);
-  int wait_delay_value = (no_delay ? 0 : frame_delay_value);
-  int jx = player->jx;
-  int jy = player->jy;
-
-  if (quick_relocation)
-  {
-    int offset = (setup.scroll_delay ? 3 : 0);
-
-    if (!IN_VIS_FIELD(SCREENX(jx), SCREENY(jy)))
-    {
-      scroll_x = (player->jx < SBX_Left  + MIDPOSX ? SBX_Left :
-                 player->jx > SBX_Right + MIDPOSX ? SBX_Right :
-                 player->jx - MIDPOSX);
-
-      scroll_y = (player->jy < SBY_Upper + MIDPOSY ? SBY_Upper :
-                 player->jy > SBY_Lower + MIDPOSY ? SBY_Lower :
-                 player->jy - MIDPOSY);
-    }
-    else
-    {
-      if ((player->MovDir == MV_LEFT  && scroll_x > jx - MIDPOSX + offset) ||
-         (player->MovDir == MV_RIGHT && scroll_x < jx - MIDPOSX - offset))
-       scroll_x = jx - MIDPOSX + (scroll_x < jx-MIDPOSX ? -offset : +offset);
-
-      if ((player->MovDir == MV_UP  && scroll_y > jy - MIDPOSY + offset) ||
-         (player->MovDir == MV_DOWN && scroll_y < jy - MIDPOSY - offset))
-       scroll_y = jy - MIDPOSY + (scroll_y < jy-MIDPOSY ? -offset : +offset);
-
-      /* don't scroll over playfield boundaries */
-      if (scroll_x < SBX_Left || scroll_x > SBX_Right)
-       scroll_x = (scroll_x < SBX_Left ? SBX_Left : SBX_Right);
-
-      /* don't scroll over playfield boundaries */
-      if (scroll_y < SBY_Upper || scroll_y > SBY_Lower)
-       scroll_y = (scroll_y < SBY_Upper ? SBY_Upper : SBY_Lower);
-    }
-
-    RedrawPlayfield(TRUE, 0,0,0,0);
-  }
-  else
-  {
-    int scroll_xx = (player->jx < SBX_Left  + MIDPOSX ? SBX_Left :
-                    player->jx > SBX_Right + MIDPOSX ? SBX_Right :
-                    player->jx - MIDPOSX);
-
-    int scroll_yy = (player->jy < SBY_Upper + MIDPOSY ? SBY_Upper :
-                    player->jy > SBY_Lower + MIDPOSY ? SBY_Lower :
-                    player->jy - MIDPOSY);
-
-    ScrollScreen(NULL, SCROLL_GO_ON);  /* scroll last frame to full tile */
-
-    while (scroll_x != scroll_xx || scroll_y != scroll_yy)
-    {
-      int dx = 0, dy = 0;
-      int fx = FX, fy = FY;
-
-      dx = (scroll_xx < scroll_x ? +1 : scroll_xx > scroll_x ? -1 : 0);
-      dy = (scroll_yy < scroll_y ? +1 : scroll_yy > scroll_y ? -1 : 0);
-
-      if (dx == 0 && dy == 0)          /* no scrolling needed at all */
-       break;
-
-      scroll_x -= dx;
-      scroll_y -= dy;
-
-      fx += dx * TILEX / 2;
-      fy += dy * TILEY / 2;
-
-      ScrollLevel(dx, dy);
-      DrawAllPlayers();
-
-      /* scroll in two steps of half tile size to make things smoother */
-      BlitBitmap(drawto_field, window, fx, fy, SXSIZE, SYSIZE, SX, SY);
-      FlushDisplay();
-      Delay(wait_delay_value);
-
-      /* scroll second step to align at full tile size */
-      BackToFront();
-      Delay(wait_delay_value);
-    }
-
-    DrawPlayer(player);
-    BackToFront();
-    Delay(wait_delay_value);
-  }
-}
-
-#endif
-
 void RelocatePlayer(int jx, int jy, int el_player_raw)
 {
   int el_player = GET_PLAYER_ELEMENT(el_player_raw);
@@ -3706,19 +3411,9 @@ void RelocatePlayer(int jx, int jy, int el_player_raw)
     InitField(jx, jy, FALSE);
   }
 
-#if 1
   /* only visually relocate centered player */
-#if 1
   DrawRelocateScreen(player->jx, player->jy, player->MovDir, FALSE,
                     level.instant_relocation);
-#else
-  if (player->index_nr == game.centered_player_nr)
-    DrawRelocatePlayer(player, level.instant_relocation);
-#endif
-#else
-  if (player == local_player)  /* only visually relocate local player */
-    DrawRelocatePlayer(player, level.instant_relocation);
-#endif
 
   TestIfPlayerTouchesBadThing(jx, jy);
   TestIfPlayerTouchesCustomElement(jx, jy);
@@ -3804,11 +3499,7 @@ void Explode(int ex, int ey, int phase, int mode)
       PlayLevelSoundElementAction(ex, ey, artwork_element, ACTION_EXPLODING);
 #endif
 
-#if 1
     last_phase = element_info[explosion_element].explosion_delay + 1;
-#else
-    last_phase = element_info[center_element].explosion_delay + 1;
-#endif
 
     for (y = ey - 1; y <= ey + 1; y++) for (x = ex - 1; x <= ex + 1; x++)
     {
@@ -3881,33 +3572,14 @@ void Explode(int ex, int ey, int phase, int mode)
 
       if (IS_PLAYER(ex, ey) && !PLAYER_EXPLOSION_PROTECTED(ex, ey))
       {
-#if 1
        int player_nr = StorePlayer[ex][ey] - EL_PLAYER_1;
 
        Store[x][y] = EL_PLAYER_IS_EXPLODING_1 + player_nr;
-#else
-       switch(StorePlayer[ex][ey])
-       {
-         case EL_PLAYER_2:
-           Store[x][y] = EL_PLAYER_IS_EXPLODING_2;
-           break;
-         case EL_PLAYER_3:
-           Store[x][y] = EL_PLAYER_IS_EXPLODING_3;
-           break;
-         case EL_PLAYER_4:
-           Store[x][y] = EL_PLAYER_IS_EXPLODING_4;
-           break;
-         case EL_PLAYER_1:
-         default:
-           Store[x][y] = EL_PLAYER_IS_EXPLODING_1;
-           break;
-       }
-#endif
 
        if (PLAYERINFO(ex, ey)->use_murphy)
          Store[x][y] = EL_EMPTY;
       }
-#if 1
+
       /* !!! check this case -- currently needed for rnd_rado_negundo_v,
         !!! levels 015 018 019 020 021 022 023 026 027 028 !!! */
       else if (ELEM_IS_PLAYER(center_element))
@@ -3928,45 +3600,6 @@ void Explode(int ex, int ey, int phase, int mode)
 #endif
       else
        Store[x][y] = EL_EMPTY;
-#else
-      else if (center_element == EL_MOLE)
-       Store[x][y] = EL_EMERALD_RED;
-      else if (center_element == EL_PENGUIN)
-       Store[x][y] = EL_EMERALD_PURPLE;
-      else if (center_element == EL_BUG)
-       Store[x][y] = ((x == ex && y == ey) ? EL_DIAMOND : EL_EMERALD);
-      else if (center_element == EL_BD_BUTTERFLY)
-       Store[x][y] = EL_BD_DIAMOND;
-      else if (center_element == EL_SP_ELECTRON)
-       Store[x][y] = EL_SP_INFOTRON;
-      else if (center_element == EL_AMOEBA_TO_DIAMOND)
-       Store[x][y] = level.amoeba_content;
-      else if (center_element == EL_YAMYAM)
-       Store[x][y] = level.yamyam_content[game.yamyam_content_nr].e[xx][yy];
-      else if (IS_CUSTOM_ELEMENT(center_element) &&
-              element_info[center_element].content.e[xx][yy] != EL_EMPTY)
-       Store[x][y] = element_info[center_element].content.e[xx][yy];
-      else if (element == EL_WALL_EMERALD)
-       Store[x][y] = EL_EMERALD;
-      else if (element == EL_WALL_DIAMOND)
-       Store[x][y] = EL_DIAMOND;
-      else if (element == EL_WALL_BD_DIAMOND)
-       Store[x][y] = EL_BD_DIAMOND;
-      else if (element == EL_WALL_EMERALD_YELLOW)
-       Store[x][y] = EL_EMERALD_YELLOW;
-      else if (element == EL_WALL_EMERALD_RED)
-       Store[x][y] = EL_EMERALD_RED;
-      else if (element == EL_WALL_EMERALD_PURPLE)
-       Store[x][y] = EL_EMERALD_PURPLE;
-      else if (element == EL_WALL_PEARL)
-       Store[x][y] = EL_PEARL;
-      else if (element == EL_WALL_CRYSTAL)
-       Store[x][y] = EL_CRYSTAL;
-      else if (IS_CUSTOM_ELEMENT(element) && !CAN_EXPLODE(element))
-       Store[x][y] = element_info[element].content.e[1][1];
-      else
-       Store[x][y] = EL_EMPTY;
-#endif
 
       if (x != ex || y != ey || mode == EX_TYPE_BORDER ||
          center_element == EL_AMOEBA_TO_DIAMOND)
@@ -3975,11 +3608,6 @@ void Explode(int ex, int ey, int phase, int mode)
       Feld[x][y] = EL_EXPLOSION;
       GfxElement[x][y] = artwork_element;
 
-#if 0
-      printf(":: setting gfx(%d,%d) to %d ['%s']\n",
-            x, y, artwork_element, EL_NAME(artwork_element));
-#endif
-
       ExplodePhase[x][y] = 1;
       ExplodeDelay[x][y] = last_phase;
 
@@ -4317,11 +3945,7 @@ static void InitBeltMovement()
     }
   }
 
-#if 1
   SCAN_PLAYFIELD(x, y)
-#else
-  for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
-#endif
   {
     int element = Feld[x][y];
 
@@ -4401,11 +4025,7 @@ static void ToggleBeltSwitch(int x, int y)
       graphic_info[graphic].anim_mode |=  ANIM_REVERSE;
   }
 
-#if 1
   SCAN_PLAYFIELD(xx, yy)
-#else
-  for (yy = 0; yy < lev_fieldy; yy++) for (xx = 0; xx < lev_fieldx; xx++)
-#endif
   {
     int element = Feld[xx][yy];
 
@@ -4452,11 +4072,7 @@ static void ToggleSwitchgateSwitch(int x, int y)
 
   game.switchgate_pos = !game.switchgate_pos;
 
-#if 1
   SCAN_PLAYFIELD(xx, yy)
-#else
-  for (yy = 0; yy < lev_fieldy; yy++) for (xx = 0; xx < lev_fieldx; xx++)
-#endif
   {
     int element = Feld[xx][yy];
 
@@ -4516,11 +4132,7 @@ static void RedrawAllLightSwitchesAndInvisibleElements()
 {
   int x, y;
 
-#if 1
   SCAN_PLAYFIELD(x, y)
-#else
-  for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
-#endif
   {
     int element = Feld[x][y];
 
@@ -4581,11 +4193,7 @@ static void RedrawAllInvisibleElementsForLenses()
 {
   int x, y;
 
-#if 1
   SCAN_PLAYFIELD(x, y)
-#else
-  for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
-#endif
   {
     int element = Feld[x][y];
 
@@ -4634,11 +4242,7 @@ static void RedrawAllInvisibleElementsForMagnifier()
 {
   int x, y;
 
-#if 1
   SCAN_PLAYFIELD(x, y)
-#else
-  for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
-#endif
   {
     int element = Feld[x][y];
 
@@ -4698,11 +4302,7 @@ static void ActivateTimegateSwitch(int x, int y)
 
   game.timegate_time_left = level.time_timegate * FRAMES_PER_SECOND;
 
-#if 1
   SCAN_PLAYFIELD(xx, yy)
-#else
-  for (yy = 0; yy < lev_fieldy; yy++) for (xx = 0; xx < lev_fieldx; xx++)
-#endif
   {
     int element = Feld[xx][yy];
 
@@ -4829,11 +4429,7 @@ void Impact(int x, int y)
         EL_BD_MAGIC_WALL_ACTIVE);
 
       /* activate magic wall / mill */
-#if 1
       SCAN_PLAYFIELD(xx, yy)
-#else
-      for (yy = 0; yy < lev_fieldy; yy++) for (xx = 0; xx < lev_fieldx; xx++)
-#endif
        if (Feld[xx][yy] == smashed)
          Feld[xx][yy] = activated_magic_wall;
 
@@ -5784,9 +5380,6 @@ inline static void TurnRoundExt(int x, int y)
 static void TurnRound(int x, int y)
 {
   int direction = MovDir[x][y];
-#if 0
-  int element, graphic;
-#endif
 
   TurnRoundExt(x, y);
 
@@ -5798,21 +5391,7 @@ static void TurnRound(int x, int y)
   if (MovDelay[x][y])
     GfxAction[x][y] = ACTION_TURNING_FROM_LEFT + MV_DIR_TO_BIT(direction);
 
-#if 1
   ResetGfxFrame(x, y, FALSE);
-#else
-  element = Feld[x][y];
-  graphic = el_act_dir2img(element, GfxAction[x][y], GfxDir[x][y]);
-
-  if (graphic_info[graphic].anim_global_sync)
-    GfxFrame[x][y] = FrameCounter;
-  else if (ANIM_MODE(graphic) == ANIM_CE_VALUE)
-    GfxFrame[x][y] = CustomValue[x][y];
-  else if (ANIM_MODE(graphic) == ANIM_CE_SCORE)
-    GfxFrame[x][y] = element_info[element].collect_score;
-  else if (ANIM_MODE(graphic) == ANIM_CE_DELAY)
-    GfxFrame[x][y] = ChangeDelay[x][y];
-#endif
 }
 
 static boolean JustBeingPushed(int x, int y)
@@ -6337,7 +5916,7 @@ void StartMoving(int x, int y)
        local_player->friends_still_needed--;
        if (!local_player->friends_still_needed &&
            !local_player->GameOver && AllPlayersGone)
-         local_player->LevelSolved = local_player->GameOver = TRUE;
+         PlayerWins(local_player);
 
        return;
       }
@@ -6833,29 +6412,17 @@ void ContinueMoving(int x, int y)
 
   MovDelay[newx][newy] = 0;
 
-#if 1
   if (CAN_CHANGE_OR_HAS_ACTION(element))
-#else
-  if (CAN_CHANGE(element))
-#endif
   {
     /* copy element change control values to new field */
     ChangeDelay[newx][newy] = ChangeDelay[x][y];
     ChangePage[newx][newy]  = ChangePage[x][y];
     ChangeCount[newx][newy] = ChangeCount[x][y];
     ChangeEvent[newx][newy] = ChangeEvent[x][y];
-
-#if 0
-#if USE_NEW_CUSTOM_VALUE
-    CustomValue[newx][newy] = CustomValue[x][y];
-#endif
-#endif
   }
 
-#if 1
 #if USE_NEW_CUSTOM_VALUE
     CustomValue[newx][newy] = CustomValue[x][y];
-#endif
 #endif
 
   ChangeDelay[x][y] = 0;
@@ -7021,12 +6588,10 @@ void ContinueMoving(int x, int y)
   TestIfPlayerTouchesCustomElement(newx, newy);
   TestIfElementTouchesCustomElement(newx, newy);
 
-#if 1
   if (IS_CUSTOM_ELEMENT(element) && ei->move_enter_element != EL_EMPTY &&
       IS_EQUAL_OR_IN_GROUP(stored_new, ei->move_enter_element))
     CheckElementChangeBySide(newx, newy, element, stored_new, CE_DIGGING_X,
                                      MV_DIR_OPPOSITE(direction));
-#endif
 }
 
 int AmoebeNachbarNr(int ax, int ay)
@@ -7095,11 +6660,7 @@ void AmoebenVereinigen(int ax, int ay)
       AmoebaCnt2[new_group_nr] += AmoebaCnt2[old_group_nr];
       AmoebaCnt2[old_group_nr] = 0;
 
-#if 1
       SCAN_PLAYFIELD(xx, yy)
-#else
-      for (yy = 0; yy < lev_fieldy; yy++) for (xx = 0; xx < lev_fieldx; xx++)
-#endif
       {
        if (AmoebaNr[xx][yy] == old_group_nr)
          AmoebaNr[xx][yy] = new_group_nr;
@@ -7125,11 +6686,7 @@ void AmoebeUmwandeln(int ax, int ay)
     }
 #endif
 
-#if 1
     SCAN_PLAYFIELD(x, y)
-#else
-    for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
-#endif
     {
       if (Feld[x][y] == EL_AMOEBA_DEAD && AmoebaNr[x][y] == group_nr)
       {
@@ -7187,11 +6744,7 @@ void AmoebeUmwandelnBD(int ax, int ay, int new_element)
   }
 #endif
 
-#if 1
   SCAN_PLAYFIELD(x, y)
-#else
-  for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
-#endif
   {
     if (AmoebaNr[x][y] == group_nr &&
        (Feld[x][y] == EL_AMOEBA_DEAD ||
@@ -7440,9 +6993,6 @@ void AmoebeAbleger(int ax, int ay)
 void Life(int ax, int ay)
 {
   int x1, y1, x2, y2;
-#if 0
-  static int life[4] = { 2, 3, 3, 3 }; /* parameters for "game of life" */
-#endif
   int life_time = 40;
   int element = Feld[ax][ay];
   int graphic = el2img(element);
@@ -7587,13 +7137,6 @@ static void ActivateMagicBall(int bx, int by)
   game.ball_content_nr = (game.ball_content_nr + 1) % level.num_ball_contents;
 }
 
-static void InitDiagonalMovingElement(int x, int y)
-{
-#if 0
-  MovDelay[x][y] = level.android_move_time;
-#endif
-}
-
 void CheckExit(int x, int y)
 {
   if (local_player->gems_still_needed > 0 ||
@@ -7642,11 +7185,7 @@ static void CloseAllOpenTimegates()
 {
   int x, y;
 
-#if 1
   SCAN_PLAYFIELD(x, y)
-#else
-  for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
-#endif
   {
     int element = Feld[x][y];
 
@@ -8041,7 +7580,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
      action_type == CA_SET_LEVEL_GEMS ? level.gems_needed :
      action_type == CA_SET_LEVEL_TIME ? level.time :
      action_type == CA_SET_LEVEL_SCORE ? 0 :
-#if 1
+#if USE_NEW_CUSTOM_VALUE
      action_type == CA_SET_CE_VALUE ? GET_NEW_CE_VALUE(element) :
 #else
      action_type == CA_SET_CE_VALUE ? ei->custom_value_initial :
@@ -8197,7 +7736,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
     {
       for (i = 0; i < MAX_PLAYERS; i++)
        if (action_arg_player_bits & (1 << i))
-         stored_player[i].LevelSolved = stored_player[i].GameOver = TRUE;
+         PlayerWins(&stored_player[i]);
 
       break;
     }
@@ -8225,13 +7764,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
          {
            stored_player[i].key[KEY_NR(element)] = key_state;
 
-#if 1
            DrawGameDoorValues();
-#else
-           DrawGameValue_Keys(stored_player[i].key);
-#endif
-
-           redraw_mask |= REDRAW_DOOR_1;
          }
        }
       }
@@ -8271,18 +7804,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
                                    action_arg_number_min,
                                    action_arg_number_max);
 
-#if 1
          SetPlayerMoveSpeed(&stored_player[i], move_stepsize, FALSE);
-#else
-         /* make sure that value is power of 2 */
-         move_stepsize = (1 << log_2(move_stepsize));
-
-         /* do no immediately change -- the player might just be moving */
-         stored_player[i].move_delay_value_next = TILEX / move_stepsize;
-
-         stored_player[i].cannot_move =
-           (action_arg == CA_ARG_SPEED_NOT_MOVING ? TRUE : FALSE);
-#endif
        }
       }
 
@@ -8373,30 +7895,17 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
 
       CustomValue[x][y] = action_arg_number_new;
 
-#if 0
-      printf("::: CE value == %d\n", CustomValue[x][y]);
-#endif
-
       if (CustomValue[x][y] != last_ce_value)
       {
        CheckElementChange(x, y, element, EL_UNDEFINED, CE_VALUE_CHANGES);
        CheckTriggeredElementChange(x, y, element, CE_VALUE_CHANGES_OF_X);
 
-       if (CustomValue[x][y] == 0)
-       {
-#if 0
-         printf("::: CE_VALUE_GETS_ZERO\n");
-#endif
-
+       if (CustomValue[x][y] == 0)
+       {
          CheckElementChange(x, y, element, EL_UNDEFINED, CE_VALUE_GETS_ZERO);
          CheckTriggeredElementChange(x, y, element, CE_VALUE_GETS_ZERO_OF_X);
-
-#if 0
-         printf("::: RESULT: %d, %d\n", Feld[x][y], ChangePage[x][y]);
-#endif
        }
       }
-
 #endif
 
       break;
@@ -8409,10 +7918,6 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
 
       ei->collect_score = action_arg_number_new;
 
-#if 0
-      printf("::: CE score == %d\n", ei->collect_score);
-#endif
-
       if (ei->collect_score != last_ce_score)
       {
        CheckElementChange(x, y, element, EL_UNDEFINED, CE_SCORE_CHANGES);
@@ -8420,19 +7925,30 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
 
        if (ei->collect_score == 0)
        {
-#if 0
-         printf("::: CE_SCORE_GETS_ZERO\n");
-#endif
+         int xx, yy;
 
          CheckElementChange(x, y, element, EL_UNDEFINED, CE_SCORE_GETS_ZERO);
          CheckTriggeredElementChange(x, y, element, CE_SCORE_GETS_ZERO_OF_X);
 
-#if 0
-         printf("::: RESULT: %d, %d\n", Feld[x][y], ChangePage[x][y]);
-#endif
+         /*
+           This is a very special case that seems to be a mixture between
+           CheckElementChange() and CheckTriggeredElementChange(): while
+           the first one only affects single elements that are triggered
+           directly, the second one affects multiple elements in the playfield
+           that are triggered indirectly by another element. This is a third
+           case: Changing the CE score always affects multiple identical CEs,
+           so every affected CE must be checked, not only the single CE for
+           which the CE score was changed in the first place (as every instance
+           of that CE shares the same CE score, and therefore also can change)!
+         */
+         SCAN_PLAYFIELD(xx, yy)
+         {
+           if (Feld[xx][yy] == element)
+             CheckElementChange(xx, yy, element, EL_UNDEFINED,
+                                CE_SCORE_GETS_ZERO);
+         }
        }
       }
-
 #endif
 
       break;
@@ -8462,7 +7978,12 @@ static void CreateFieldExt(int x, int y, int element, boolean is_change)
 #endif
   boolean new_element_is_player = ELEM_IS_PLAYER(new_element);
   boolean add_player_onto_element = (new_element_is_player &&
+#if USE_CODE_THAT_BREAKS_SNAKE_BITE
+                                    /* this breaks SnakeBite when a snake is
+                                       halfway through a door that closes */
+                                    /* NOW FIXED AT LEVEL INIT IN files.c */
                                     new_element != EL_SOKOBAN_FIELD_PLAYER &&
+#endif
                                     IS_WALKABLE(old_element));
 
 #if 0
@@ -8689,7 +8210,7 @@ static boolean ChangeElement(int x, int y, int element, int page)
          ChangeEvent[ex][ey] = ChangeEvent[x][y];
 
          content_element = change->target_content.e[xx][yy];
-         target_element = GET_TARGET_ELEMENT(content_element, change,
+         target_element = GET_TARGET_ELEMENT(element, content_element, change,
                                              ce_value, ce_score);
 
          CreateElementFromChange(ex, ey, target_element);
@@ -8711,7 +8232,7 @@ static boolean ChangeElement(int x, int y, int element, int page)
   }
   else
   {
-    target_element = GET_TARGET_ELEMENT(change->target_element, change,
+    target_element = GET_TARGET_ELEMENT(element, change->target_element, change,
                                        ce_value, ce_score);
 
     if (element == EL_DIAGONAL_GROWING ||
@@ -8952,11 +8473,7 @@ static boolean CheckTriggeredElementChangeExt(int trigger_x, int trigger_y,
        {
          int x, y;
 
-#if 1
          SCAN_PLAYFIELD(x, y)
-#else
-         for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
-#endif
          {
            if (Feld[x][y] == element)
            {
@@ -9161,11 +8678,7 @@ static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting)
        game.player_sleeping_delay_fixed +
        SimpleRND(game.player_sleeping_delay_random);
 
-#if 1
       InitPlayerGfxAnimation(player, ACTION_WAITING, move_dir);
-#else
-      InitPlayerGfxAnimation(player, ACTION_WAITING, player->MovDir);
-#endif
     }
 
     if (game.player_sleeping_delay_fixed +
@@ -9183,7 +8696,6 @@ static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting)
                              player->is_bored ? ACTION_BORING :
                              ACTION_WAITING);
 
-#if 1
     if (player->is_sleeping && player->use_murphy)
     {
       /* special case for sleeping Murphy when leaning against non-free tile */
@@ -9201,7 +8713,6 @@ static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting)
 
       player->dir_waiting = move_dir;
     }
-#endif
 
     if (player->is_sleeping)
     {
@@ -9363,7 +8874,8 @@ static void CheckLevelTime()
   {
     if (level.native_em_level->lev->home == 0) /* all players at home */
     {
-      local_player->LevelSolved = TRUE;
+      PlayerWins(local_player);
+
       AllPlayersGone = TRUE;
 
       level.native_em_level->lev->home = -1;
@@ -9394,7 +8906,7 @@ static void CheckLevelTime()
       }
     }
 
-    if (!level.use_step_counter)
+    if (!local_player->LevelSolved && !level.use_step_counter)
     {
       TimePlayed++;
 
@@ -9403,7 +8915,7 @@ static void CheckLevelTime()
        TimeLeft--;
 
        if (TimeLeft <= 10 && setup.time_limit)
-         PlaySoundStereo(SND_GAME_RUNNING_OUT_OF_TIME, SOUND_MIDDLE);
+         PlaySound(SND_GAME_RUNNING_OUT_OF_TIME);
 
        DrawGameValue_Time(TimeLeft);
 
@@ -9432,11 +8944,6 @@ void AdvanceFrameAndPlayerCounters(int player_nr)
 {
   int i;
 
-#if 0
-  Error(ERR_NETWORK_CLIENT, "advancing frame counter from %d to %d",
-       FrameCounter, FrameCounter + 1);
-#endif
-
   /* advance frame counters (global frame counter and time frame counter) */
   FrameCounter++;
   TimeFrames++;
@@ -9501,10 +9008,6 @@ void StartGameActions(boolean init_network_game, boolean record_tape,
   }
 #endif
 
-  StopAnimation();
-
-  game_status = GAME_MODE_PLAYING;
-
   InitGame();
 }
 
@@ -9524,7 +9027,8 @@ void GameActions()
   {
     if (level.native_em_level->lev->home == 0) /* all players at home */
     {
-      local_player->LevelSolved = TRUE;
+      PlayerWins(local_player);
+
       AllPlayersGone = TRUE;
 
       level.native_em_level->lev->home = -1;
@@ -9580,12 +9084,17 @@ void GameActions()
 
   /* at this point we know that we really continue executing the game */
 
-#if 1
   network_player_action_received = FALSE;
-#endif
 
+  /* when playing tape, read previously recorded player input from tape data */
   recorded_player_action = (tape.playing ? TapePlayAction() : NULL);
 
+#if 1
+  /* TapePlayAction() may return NULL when toggling to "pause before death" */
+  if (tape.pausing)
+    return;
+#endif
+
   if (tape.set_centered_player)
   {
     game.centered_player_nr_next = tape.centered_player_nr_next;
@@ -9676,7 +9185,6 @@ void GameActions_RND()
   }
 #endif
 
-#if 1
   if (game.set_centered_player)
   {
     boolean all_players_fit_to_screen = checkIfAllPlayersFitToScreen_RND();
@@ -9718,7 +9226,6 @@ void GameActions_RND()
     DrawRelocateScreen(sx, sy, MV_NONE, TRUE, setup.quick_switch);
     DrawGameDoorValues();
   }
-#endif
 
   for (i = 0; i < MAX_PLAYERS; i++)
   {
@@ -9739,22 +9246,11 @@ void GameActions_RND()
     if (stored_player[i].programmed_action)
       actual_player_action = stored_player[i].programmed_action;
 
-#if 1
     PlayerActions(&stored_player[i], actual_player_action);
-#else
-    tape_action[i] = PlayerActions(&stored_player[i], actual_player_action);
-
-    if (tape.recording && tape_action[i] && !tape.player_participates[i])
-      tape.player_participates[i] = TRUE;    /* player just appeared from CE */
-#endif
 
     ScrollPlayer(&stored_player[i], SCROLL_GO_ON);
   }
 
-#if 0
-  network_player_action_received = FALSE;
-#endif
-
   ScrollScreen(NULL, SCROLL_GO_ON);
 
   /* for backwards compatibility, the following code emulates a fixed bug that
@@ -9789,11 +9285,7 @@ void GameActions_RND()
     }
   }
 
-#if 1
   SCAN_PLAYFIELD(x, y)
-#else
-  for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
-#endif
   {
     ChangeCount[x][y] = 0;
     ChangeEvent[x][y] = -1;
@@ -9865,61 +9357,12 @@ void GameActions_RND()
 #endif
   }
 
-#if 1
   SCAN_PLAYFIELD(x, y)
-#else
-  for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
-#endif
   {
     element = Feld[x][y];
     graphic = el_act_dir2img(element, GfxAction[x][y], GfxDir[x][y]);
 
-#if 0
-    printf("::: %d,%d\n", x, y);
-
-    if (element == EL_ROCK)
-      printf("::: Yo man! Rocks can fall!\n");
-#endif
-
-#if 1
     ResetGfxFrame(x, y, TRUE);
-#else
-    if (graphic_info[graphic].anim_global_sync)
-      GfxFrame[x][y] = FrameCounter;
-    else if (ANIM_MODE(graphic) == ANIM_CE_VALUE)
-    {
-      int old_gfx_frame = GfxFrame[x][y];
-
-      GfxFrame[x][y] = CustomValue[x][y];
-
-#if 1
-      if (GfxFrame[x][y] != old_gfx_frame)
-#endif
-       DrawLevelGraphicAnimation(x, y, graphic);
-    }
-    else if (ANIM_MODE(graphic) == ANIM_CE_SCORE)
-    {
-      int old_gfx_frame = GfxFrame[x][y];
-
-      GfxFrame[x][y] = element_info[element].collect_score;
-
-#if 1
-      if (GfxFrame[x][y] != old_gfx_frame)
-#endif
-       DrawLevelGraphicAnimation(x, y, graphic);
-    }
-    else if (ANIM_MODE(graphic) == ANIM_CE_DELAY)
-    {
-      int old_gfx_frame = GfxFrame[x][y];
-
-      GfxFrame[x][y] = ChangeDelay[x][y];
-
-#if 1
-      if (GfxFrame[x][y] != old_gfx_frame)
-#endif
-       DrawLevelGraphicAnimation(x, y, graphic);
-    }
-#endif
 
     if (ANIM_MODE(graphic) == ANIM_RANDOM &&
        IS_NEXT_FRAME(GfxFrame[x][y], graphic))
@@ -9942,18 +9385,6 @@ void GameActions_RND()
        (game.engine_version < VERSION_IDENT(3,0,7,1) || !Stop[x][y]))
     {
       int page = element_info[element].event_page_nr[CE_DELAY];
-#if 0
-      HandleElementChange(x, y, ChangePage[x][y] != -1 ? ChangePage[x][y] : page);
-#else
-
-#if 0
-      printf("::: ChangeDelay == %d\n", ChangeDelay[x][y]);
-#endif
-
-#if 0
-      if (element == EL_CUSTOM_255)
-       printf("::: ChangeDelay == %d\n", ChangeDelay[x][y]);
-#endif
 
 #if 1
       HandleElementChange(x, y, page);
@@ -9963,8 +9394,6 @@ void GameActions_RND()
 
       if (HAS_ACTION(element))
        ExecuteCustomElementAction(x, y, element, page);
-#endif
-
 #endif
 
       element = Feld[x][y];
@@ -10032,21 +9461,13 @@ void GameActions_RND()
             element == EL_DIAGONAL_SHRINKING ||
             element == EL_DIAGONAL_GROWING)
     {
-#if 1
       graphic = el_act_dir2img(GfxElement[x][y], GfxAction[x][y],GfxDir[x][y]);
 
       DrawLevelGraphicAnimationIfNeeded(x, y, graphic);
-#endif
     }
     else if (IS_ANIMATED(graphic) && !IS_CHANGING(x, y))
       DrawLevelGraphicAnimationIfNeeded(x, y, graphic);
 
-#if 0
-    if (element == EL_CUSTOM_255 ||
-       element == EL_CUSTOM_256)
-      DrawLevelGraphicAnimation(x, y, graphic);
-#endif
-
     if (IS_BELT_ACTIVE(element))
       PlayLevelSoundAction(x, y, ACTION_ACTIVE);
 
@@ -10106,11 +9527,7 @@ void GameActions_RND()
   {
     game.explosions_delayed = FALSE;
 
-#if 1
     SCAN_PLAYFIELD(x, y)
-#else
-    for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
-#endif
     {
       element = Feld[x][y];
 
@@ -10144,11 +9561,7 @@ void GameActions_RND()
       game.magic_wall_time_left--;
       if (!game.magic_wall_time_left)
       {
-#if 1
        SCAN_PLAYFIELD(x, y)
-#else
-       for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
-#endif
        {
          element = Feld[x][y];
 
@@ -10375,7 +9788,7 @@ static void CheckGravityMovement(struct PlayerInfo *player)
   {
     int move_dir_horizontal = player->effective_action & MV_HORIZONTAL;
     int move_dir_vertical   = player->effective_action & MV_VERTICAL;
-    boolean player_is_snapping = player->effective_action & JOY_BUTTON_1;
+    boolean player_is_snapping = (player->effective_action & JOY_BUTTON_1);
     int jx = player->jx, jy = player->jy;
     boolean player_is_moving_to_valid_field =
       (!player_is_snapping &&
@@ -10443,7 +9856,6 @@ boolean MovePlayerOneStep(struct PlayerInfo *player,
 
   if (!player_can_move)
   {
-#if 1
     if (player->MovPos == 0)
     {
       player->is_moving = FALSE;
@@ -10452,14 +9864,6 @@ boolean MovePlayerOneStep(struct PlayerInfo *player,
       player->is_snapping = FALSE;
       player->is_pushing = FALSE;
     }
-#else
-    DigField(player, 0, 0, 0, 0, 0, 0, DF_NO_PUSH);
-    SnapField(player, 0, 0);
-#endif
-
-#if 0
-    return MP_NO_ACTION;
-#endif
   }
 
 #if 1
@@ -10494,18 +9898,9 @@ boolean MovePlayerOneStep(struct PlayerInfo *player,
 #endif
 
   can_move = DigField(player, jx, jy, new_jx, new_jy, real_dx,real_dy, DF_DIG);
-#if 0
-#if USE_FIXED_DONT_RUN_INTO
-  if (can_move == MP_DONT_RUN_INTO)
-    return MP_MOVING;
-#endif
-#endif
   if (can_move != MP_MOVING)
     return can_move;
 
-#if USE_FIXED_DONT_RUN_INTO
-#endif
-
   /* check if DigField() has caused relocation of the player */
   if (player->jx != jx || player->jy != jy)
     return MP_NO_ACTION;       /* <-- !!! CHECK THIS [-> MP_ACTION ?] !!! */
@@ -10530,7 +9925,14 @@ boolean MovePlayerOneStep(struct PlayerInfo *player,
 
   PlayerVisit[jx][jy] = FrameCounter;
 
+#if USE_UFAST_PLAYER_EXIT_BUGFIX
+  player->is_moving = TRUE;
+#endif
+
+#if 1
+  /* should better be called in MovePlayer(), but this breaks some tapes */
   ScrollPlayer(player, SCROLL_INIT);
+#endif
 
   return MP_MOVING;
 }
@@ -10728,6 +10130,11 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy)
     player->is_dropping = FALSE;
     player->is_dropping_pressed = FALSE;
     player->drop_pressed_delay = 0;
+
+#if 0
+    /* should better be called here than above, but this breaks some tapes */
+    ScrollPlayer(player, SCROLL_INIT);
+#endif
   }
   else
   {
@@ -10819,12 +10226,6 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
   else if (!FrameReached(&player->actual_frame_counter, 1))
     return;
 
-#if 0
-  printf("::: player->MovPos: %d -> %d\n",
-        player->MovPos,
-        player->MovPos + (player->MovPos > 0 ? -1 : 1) * move_stepsize);
-#endif
-
 #if USE_NEW_PLAYER_SPEED
   if (player->MovPos != 0)
   {
@@ -10846,10 +10247,6 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
 
   if (player->MovPos == 0)     /* player reached destination field */
   {
-#if 0
-    printf("::: player reached destination field\n");
-#endif
-
     if (player->move_delay_reset_counter > 0)
     {
       player->move_delay_reset_counter--;
@@ -10876,7 +10273,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
 
       if (local_player->friends_still_needed == 0 ||
          IS_SP_ELEMENT(Feld[jx][jy]))
-       player->LevelSolved = player->GameOver = TRUE;
+       PlayerWins(player);
     }
 
     /* this breaks one level: "machine", level 000 */
@@ -10924,7 +10321,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
        RemovePlayer(player);
     }
 
-    if (level.use_step_counter)
+    if (!local_player->LevelSolved && level.use_step_counter)
     {
       int i;
 
@@ -10935,7 +10332,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
        TimeLeft--;
 
        if (TimeLeft <= 10 && setup.time_limit)
-         PlaySoundStereo(SND_GAME_RUNNING_OUT_OF_TIME, SOUND_MIDDLE);
+         PlaySound(SND_GAME_RUNNING_OUT_OF_TIME);
 
        DrawGameValue_Time(TimeLeft);
 
@@ -11721,31 +11118,6 @@ int DigField(struct PlayerInfo *player,
           game.engine_version >= VERSION_IDENT(2,2,0,0))
     old_element = Back[jx][jy];
 
-  /* checking here causes player to move into acid even if the current field
-     cannot be left to that direction */
-#if 0
-#if USE_FIXED_DONT_RUN_INTO
-  if (player_can_move && DONT_RUN_INTO(element))
-  {
-    if (element == EL_ACID && dx == 0 && dy == 1)
-    {
-      SplashAcid(x, y);
-      Feld[jx][jy] = EL_PLAYER_1;
-      InitMovingField(jx, jy, MV_DOWN);
-      Store[jx][jy] = EL_ACID;
-      ContinueMoving(jx, jy);
-      BuryPlayer(player);
-    }
-    else
-      TestIfPlayerRunsIntoBadThing(jx, jy, player->MovDir);
-
-    return MP_DONT_RUN_INTO;
-  }
-#endif
-#endif
-
-#if 1  /* ------------------------------ NEW ------------------------------ */
-
   if (IS_WALKABLE(old_element) && !ACCESS_FROM(old_element, move_direction))
     return MP_NO_ACTION;       /* field has no opening in this direction */
 
@@ -11756,11 +11128,8 @@ int DigField(struct PlayerInfo *player,
   if (player_can_move && element == EL_ACID && move_direction == MV_DOWN)
   {
     SplashAcid(x, y);
-#if 1
+
     Feld[jx][jy] = player->artwork_element;
-#else
-    Feld[jx][jy] = EL_PLAYER_1;
-#endif
     InitMovingField(jx, jy, MV_DOWN);
     Store[jx][jy] = EL_ACID;
     ContinueMoving(jx, jy);
@@ -11779,65 +11148,6 @@ int DigField(struct PlayerInfo *player,
   }
 #endif
 
-#else  /* ------------------------------ OLD ------------------------------ */
-
-#if 1
-#if USE_FIXED_DONT_RUN_INTO
-  if (player_can_move && DONT_RUN_INTO(element))
-  {
-    TestIfPlayerRunsIntoBadThing(jx, jy, player->MovDir);
-
-    return MP_DONT_RUN_INTO;
-  }
-#endif
-#endif
-
-  if (IS_WALKABLE(old_element) && !ACCESS_FROM(old_element, move_direction))
-    return MP_NO_ACTION;       /* field has no opening in this direction */
-
-  if (IS_PASSABLE(old_element) && !ACCESS_FROM(old_element,opposite_direction))
-    return MP_NO_ACTION;       /* field has no opening in this direction */
-
-  /* checking here causes player to explode when moving into acid */
-#if 1
-#if USE_FIXED_DONT_RUN_INTO
-  if (player_can_move && element == EL_ACID && move_direction == MV_DOWN)
-  {
-    SplashAcid(x, y);
-    Feld[jx][jy] = EL_PLAYER_1;
-    InitMovingField(jx, jy, MV_DOWN);
-    Store[jx][jy] = EL_ACID;
-    ContinueMoving(jx, jy);
-    BuryPlayer(player);
-
-    return MP_DONT_RUN_INTO;
-  }
-#endif
-#endif
-
-#endif /* ------------------------------ END ------------------------------ */
-
-#if 0
-#if USE_FIXED_DONT_RUN_INTO
-  if (player_can_move && DONT_RUN_INTO(element))
-  {
-    if (element == EL_ACID && dx == 0 && dy == 1)
-    {
-      SplashAcid(x, y);
-      Feld[jx][jy] = EL_PLAYER_1;
-      InitMovingField(jx, jy, MV_DOWN);
-      Store[jx][jy] = EL_ACID;
-      ContinueMoving(jx, jy);
-      BuryPlayer(player);
-    }
-    else
-      TestIfPlayerRunsIntoBadThing(jx, jy, player->MovDir);
-
-    return MP_DONT_RUN_INTO;
-  }
-#endif
-#endif
-
 #if USE_FIXED_DONT_RUN_INTO
   if (IS_MOVING(x, y) || IS_PLAYER(x, y))
     return MP_NO_ACTION;
@@ -12063,11 +11373,7 @@ int DigField(struct PlayerInfo *player,
       if (player->inventory_size < MAX_INVENTORY_SIZE)
        player->inventory_element[player->inventory_size++] = element;
 
-#if 1
       DrawGameDoorValues();
-#else
-      DrawGameValue_Dynamite(local_player->inventory_size);
-#endif
     }
     else if (element == EL_DYNABOMB_INCREASE_NUMBER)
     {
@@ -12086,13 +11392,7 @@ int DigField(struct PlayerInfo *player,
     {
       player->key[KEY_NR(element)] = TRUE;
 
-#if 1
       DrawGameDoorValues();
-#else
-      DrawGameValue_Keys(player->key);
-#endif
-
-      redraw_mask |= REDRAW_DOOR_1;
     }
     else if (IS_ENVELOPE(element))
     {
@@ -12122,11 +11422,7 @@ int DigField(struct PlayerInfo *player,
          if (player->inventory_size < MAX_INVENTORY_SIZE)
            player->inventory_element[player->inventory_size++] = element;
 
-#if 1
       DrawGameDoorValues();
-#else
-      DrawGameValue_Dynamite(local_player->inventory_size);
-#endif
     }
     else if (collect_count > 0)
     {
@@ -12259,7 +11555,8 @@ int DigField(struct PlayerInfo *player,
       if (local_player->sokobanfields_still_needed == 0 &&
          game.emulation == EMU_SOKOBAN)
       {
-       player->LevelSolved = player->GameOver = TRUE;
+       PlayerWins(player);
+
        PlayLevelSound(x, y, SND_GAME_SOKOBAN_SOLVING);
       }
     }
@@ -12319,11 +11616,7 @@ int DigField(struct PlayerInfo *player,
     {
       int xx, yy;
 
-#if 1
       SCAN_PLAYFIELD(xx, yy)
-#else
-      for (yy = 0; yy < lev_fieldy; yy++) for (xx = 0; xx < lev_fieldx; xx++)
-#endif
       {
        if (Feld[xx][yy] == EL_SP_DISK_YELLOW)
          Bang(xx, yy);
@@ -12391,11 +11684,7 @@ int DigField(struct PlayerInfo *player,
 
       game.ball_state = !game.ball_state;
 
-#if 1
       SCAN_PLAYFIELD(xx, yy)
-#else
-      for (yy = 0; yy < lev_fieldy; yy++) for (xx = 0; xx < lev_fieldx; xx++)
-#endif
       {
        int e = Feld[xx][yy];
 
@@ -12616,11 +11905,7 @@ boolean DropElement(struct PlayerInfo *player)
     {
       player->inventory_size--;
 
-#if 1
       DrawGameDoorValues();
-#else
-      DrawGameValue_Dynamite(local_player->inventory_size);
-#endif
 
       if (new_element == EL_DYNAMITE)
        new_element = EL_DYNAMITE_ACTIVE;
@@ -12813,9 +12098,12 @@ static void PlayLevelMusic()
     PlayMusic(MAP_NOCONF_MUSIC(level_nr));     /* from music dir */
 }
 
-void PlayLevelSound_EM(int x, int y, int element_em, int sample)
+void PlayLevelSound_EM(int xx, int yy, int element_em, int sample)
 {
   int element = (element_em > -1 ? map_element_EM_to_RND(element_em) : 0);
+  int offset = (BorderElement == EL_STEELWALL ? 1 : 0);
+  int x = xx - 1 - offset;
+  int y = yy - 1 - offset;
 
   switch (sample)
   {
@@ -12961,7 +12249,7 @@ void PlayLevelSound_EM(int x, int y, int element_em, int sample)
       break;
 
     case SAMPLE_time:
-      PlaySoundStereo(SND_GAME_RUNNING_OUT_OF_TIME, SOUND_MIDDLE);
+      PlaySound(SND_GAME_RUNNING_OUT_OF_TIME);
       break;
 
     default:
@@ -12970,6 +12258,31 @@ void PlayLevelSound_EM(int x, int y, int element_em, int sample)
   }
 }
 
+#if 0
+void ChangeTime(int value)
+{
+  int *time = (level.time == 0 ? &TimePlayed : &TimeLeft);
+
+  *time += value;
+
+  /* EMC game engine uses value from time counter of RND game engine */
+  level.native_em_level->lev->time = *time;
+
+  DrawGameValue_Time(*time);
+}
+
+void RaiseScore(int value)
+{
+  /* EMC game engine and RND game engine have separate score counters */
+  int *score = (level.game_engine_type == GAME_ENGINE_TYPE_EM ?
+               &level.native_em_level->lev->score : &local_player->score);
+
+  *score += value;
+
+  DrawGameValue_Score(*score);
+}
+#endif
+
 void RaiseScore(int value)
 {
   local_player->score += value;
@@ -13070,8 +12383,20 @@ void RequestQuitGame(boolean ask_if_really_quit)
     else
 #endif
     {
-      game_status = GAME_MODE_MAIN;
-      DrawMainMenu();
+      if (!ask_if_really_quit || level_editor_test_game)
+      {
+       game_status = GAME_MODE_MAIN;
+
+       DrawMainMenu();
+      }
+      else
+      {
+       FadeOut(REDRAW_FIELD);
+
+       game_status = GAME_MODE_MAIN;
+
+       DrawAndFadeInMainMenu(REDRAW_FIELD);
+      }
     }
   }
   else
index 71ad7a0a3b8084c0296b9464c340b8522f15613d..57621e88d9d9d9e9db8c0eb3f7092a41bf46db07 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
 #define MAX_NUM_KEYS           8
 
 
+struct GamePanelInfo
+{
+  struct XY level;
+  struct XY gems;
+  struct XY inventory;
+  struct XY keys;
+  struct XY score;
+  struct XY time;
+};
+
 struct GameInfo
 {
+  /* values for control panel */
+  struct GamePanelInfo panel;
+
   /* values for engine initialization */
   int default_push_delay_fixed;
   int default_push_delay_random;
@@ -54,13 +67,11 @@ struct GameInfo
   boolean explosions_delayed;
   boolean envelope_active;
 
-#if 1
   /* values for the new EMC elements */
   int lenses_time_left;
   int magnify_time_left;
   boolean ball_state;
   int ball_content_nr;
-#endif
 
   /* values for player idle animation (no effect on engine) */
   int player_boring_delay_fixed;
@@ -113,6 +124,10 @@ struct PlayerInfo
 
   boolean LevelSolved, GameOver;
 
+  boolean LevelSolved_GameEnd;
+  boolean LevelSolved_SaveTape;
+  boolean LevelSolved_SaveScore;
+
   int last_move_dir;
 
   boolean is_active;
@@ -168,6 +183,8 @@ struct PlayerInfo
   int step_counter;
 
   int score;
+  int score_final;
+
   int gems_still_needed;
   int sokobanfields_still_needed;
   int lights_still_needed;
@@ -197,10 +214,11 @@ void DrawGameValue_Time(int);
 void DrawGameDoorValues(void);
 
 void InitGameSound();
-void InitGame(void);
+void InitGame();
 
 void UpdateEngineValues(int, int);
 void GameWon(void);
+void GameEnd(void);
 
 void InitPlayerGfxAnimation(struct PlayerInfo *, int, int);
 void Moving2Blocked(int, int, int *, int *);
index ab8e5c346fa76cba403bac73d3f45c7dd877f164..5fb55dc5bc73cf43b4ff7d3ca5c8b940377e4a08 100644 (file)
@@ -102,7 +102,9 @@ boolean LoadNativeLevel_EM(char *filename)
     return FALSE;
   }
 
-  if (!(file_version = cleanup_em_level(raw_leveldata, raw_leveldata_length)))
+  file_version = cleanup_em_level(raw_leveldata, raw_leveldata_length,filename);
+
+  if (file_version == FILE_VERSION_EM_UNKNOWN)
   {
     Error(ERR_WARN, "unknown EM level '%s' -- using empty level", filename);
 
index 8a44053cabfa187cfe24cff148c6729a8b160d69..a3553a791009571aa57043c5aadcf3a3d7baae19 100644 (file)
@@ -101,20 +101,31 @@ static unsigned char remap_v4eater[28] =
   146,147,175,65,66,64,2,18
 };
 
-int cleanup_em_level(unsigned char *src, int length)
+static boolean filename_has_v1_format(char *filename)
 {
-  int file_version = 0;
+  char *basename = getBaseNamePtr(filename);
+
+  return (strlen(basename) == 3 &&
+         basename[0] == 'a' &&
+         basename[1] >= 'a' && basename[1] <= 'k' &&
+         basename[2] >= '0' && basename[2] <= '9');
+}
+
+int cleanup_em_level(unsigned char *src, int length, char *filename)
+{
+  int file_version = FILE_VERSION_EM_UNKNOWN;
   int i;
 
   if (length >= 2172 &&
-      src[2106] == 255 &&
-      src[2107] == 54 &&
-      src[2108] == 48 &&
-      src[2109] == 48)
+      src[2106] == 255 &&              /* version id: */
+      src[2107] == 54 &&               /* '6' */
+      src[2108] == 48 &&               /* '0' */
+      src[2109] == 48)                 /* '0' */
   {
     /* ---------- this cave has V6 file format ---------- */
     file_version = FILE_VERSION_EM_V6;
 
+    /* remap elements to internal EMC level format */
     for (i = 0; i < 2048; i++)
       src[i] = remap_v6[src[i]];
     for (i = 2048; i < 2084; i++)
@@ -123,14 +134,15 @@ int cleanup_em_level(unsigned char *src, int length)
       src[i] = remap_v6[src[i]];
   }
   else if (length >= 2110 &&
-          src[2106] == 255 &&
-          src[2107] == 53 &&
-          src[2108] == 48 &&
-          src[2109] == 48)
+          src[2106] == 255 &&          /* version id: */
+          src[2107] == 53 &&           /* '5' */
+          src[2108] == 48 &&           /* '0' */
+          src[2109] == 48)             /* '0' */
   {
     /* ---------- this cave has V5 file format ---------- */
     file_version = FILE_VERSION_EM_V5;
 
+    /* remap elements to internal EMC level format */
     for (i = 0; i < 2048; i++)
       src[i] = remap_v5[src[i]];
     for (i = 2048; i < 2084; i++)
@@ -138,6 +150,95 @@ int cleanup_em_level(unsigned char *src, int length)
     for (i = 2112; i < 2148; i++)
       src[i] = src[i - 64];
   }
+
+#if 1  /* ================================================================== */
+
+  else if (length >= 2106 &&
+          (src[1983] == 27 ||          /* encrypted (only EM I/II/III) */
+           src[1983] == 116 ||         /* unencrypted (usual case) */
+           src[1983] == 131))          /* unencrypted (rare case) */
+  {
+    /* ---------- this cave has V1, V2 or V3 file format ---------- */
+
+    boolean fix_copyright = FALSE;
+
+    /*
+      byte at position 1983 (0x07bf) is used as "magic byte":
+      - 27  (0x1b)     => encrypted level (V3 only / Kingsoft original games)
+      - 116 (0x74)     => unencrypted level (byte is corrected to 131 (0x83))
+      - 131 (0x83)     => unencrypted level (happens only in very rare cases)
+    */
+
+    if (src[1983] == 27)       /* (0x1b) -- after decryption: 116 (0x74) */
+    {
+      /* this is original (encrypted) Emerald Mine I, II or III level file */
+
+      int first_byte = src[0];
+      unsigned char code0 = 0x65;
+      unsigned char code1 = 0x11;
+
+      /* decode encrypted level data */
+      for (i = 0; i < 2106; i++)
+      {
+       src[i] ^= code0;
+       src[i] -= code1;
+
+       code0 = (code0 + 7) & 0xff;
+      }
+
+      src[1] = 131;            /* needed for all Emerald Mine levels */
+
+      /* first byte is either 0xf1 (EM I and III) or 0xf5 (EM II) */
+      if (first_byte == 0xf5)
+      {
+       src[0] = 131;           /* only needed for Emerald Mine II levels */
+
+       fix_copyright = TRUE;
+      }
+
+      /* ---------- this cave has V3 file format ---------- */
+      file_version = FILE_VERSION_EM_V3;
+    }
+    else if (filename_has_v1_format(filename))
+    {
+      /* ---------- this cave has V1 file format ---------- */
+      file_version = FILE_VERSION_EM_V1;
+    }
+    else
+    {
+      /* ---------- this cave has V2 file format ---------- */
+      file_version = FILE_VERSION_EM_V2;
+    }
+
+    /* remap elements to internal EMC level format */
+    for (i = 0; i < 2048; i++)
+      src[i] = remap_v4[src[i]];
+    for (i = 2048; i < 2084; i++)
+      src[i] = remap_v4eater[src[i] >= 28 ? 0 : src[i]];
+    for (i = 2112; i < 2148; i++)
+      src[i] = src[i - 64];
+
+    if (fix_copyright)         /* fix "(c)" sign in Emerald Mine II levels */
+    {
+      for (i = 0; i < 2048; i++)
+       if (src[i] == 241)
+         src[i] = 254;         /* replace 'Xdecor_1' with 'Xalpha_copyr' */
+    }
+  }
+  else
+  {
+    /* ---------- this cave has unknown file format ---------- */
+
+    /* if file has length of old-style level file, print (wrong) magic byte */
+    if (length < 2110)
+      Error(ERR_WARN, "unknown magic byte 0x%02x at position 0x%04x",
+           src[1983], 1983);
+
+    return FILE_VERSION_EM_UNKNOWN;
+  }
+
+#else  /* ================================================================== */
+
 #if 0
   else if (length >= 2106)     /* !!! TEST ONLY: SHOW BROKEN LEVELS !!! */
 #else
@@ -148,14 +249,16 @@ int cleanup_em_level(unsigned char *src, int length)
     /* ---------- this cave has V4 file format ---------- */
     file_version = FILE_VERSION_EM_V4;
 
+    /* remap elements to internal EMC level format */
     for (i = 0; i < 2048; i++)
       src[i] = remap_v4[src[i]];
     for (i = 2048; i < 2084; i++)
       src[i] = remap_v4eater[src[i] >= 28 ? 0 : src[i]];
-    for (i = 2112; i < 2148; i++) src[i] = src[i - 64];
+    for (i = 2112; i < 2148; i++)
+      src[i] = src[i - 64];
   }
   else if (length >= 2106 &&
-          src[0] == 241 &&     /* <-- Emerald Mine I levels */
+          src[0] == 241 &&     /* <-- Emerald Mine I and III levels */
           src[1983] == 27)
   {
     unsigned char j = 94;
@@ -163,9 +266,13 @@ int cleanup_em_level(unsigned char *src, int length)
     /* ---------- this cave has V3 file format ---------- */
     file_version = FILE_VERSION_EM_V3;
 
+    /* decrypt encrypted level file */
     for (i = 0; i < 2106; i++)
       src[i] = (src[i] ^ (j += 7)) - 0x11;
+
     src[1] = 131;
+
+    /* remap elements to internal EMC level format */
     for (i = 0; i < 2048; i++)
       src[i] = remap_v4[src[i]];
     for (i = 2048; i < 2084; i++)
@@ -183,10 +290,14 @@ int cleanup_em_level(unsigned char *src, int length)
     /* ---------- this cave has V3 file format ---------- */
     file_version = FILE_VERSION_EM_V3;
 
+    /* decrypt encrypted level file */
     for (i = 0; i < 2106; i++)
       src[i] = (src[i] ^ (j += 7)) - 0x11;
+
     src[0] = 131;              /* needed for Emerald Mine II levels */
     src[1] = 131;
+
+    /* remap elements to internal EMC level format */
     for (i = 0; i < 2048; i++)
       src[i] = remap_v4[src[i]];
     for (i = 2048; i < 2084; i++)
@@ -211,16 +322,23 @@ int cleanup_em_level(unsigned char *src, int length)
     return 0;
   }
 
+#endif /* ================================================================== */
+
   if (file_version < FILE_VERSION_EM_V6)
   {
     /* id */
-    src[2106] = 255;
-    src[2107] = 54;
-    src[2108] = 48;
-    src[2109] = 48;
+    src[2106] = 255;           /* version id: */
+    src[2107] = 54;            /* '6' */
+    src[2108] = 48;            /* '0' */
+    src[2109] = 48;            /* '0' */
 
     /* time */
     i = src[2094] * 10;
+    /* stored level time of levels for the V2 player was changed to 50% of the
+       time for the V1 player (original V3 levels already considered this) */
+    if (file_version != FILE_VERSION_EM_V1 &&
+       file_version != FILE_VERSION_EM_V3)
+      i /= 2;
     src[2110] = i >> 8;
     src[2111] = i;
 
@@ -229,7 +347,17 @@ int cleanup_em_level(unsigned char *src, int length)
 
     /* ball data */
     src[2159] = 128;
+
+#if 0
+    printf("::: STORED TIME (< V6): %d s\n", src[2094] * 10);
+#endif
   }
+#if 0
+  else
+  {
+    printf("::: STORED TIME (>= V6): %d s\n", src[2110] * 256 + src[2111]);
+  }
+#endif
 
   /* ---------- at this stage, the cave data always has V6 format ---------- */
 
@@ -242,11 +370,34 @@ int cleanup_em_level(unsigned char *src, int length)
       src[i] = 147;
 
 #if 0
+
+  /* fix acid */
+  for (i = 64; i < 2048; i++)
+    if (src[i] == 63)          /* replace element above 'Xacid_s' ... */
+      src[i - 64] = 101;       /* ... with 'Xacid_1' */
+
+#else
+
+#if 1
   /* fix acid */
   for (i = 64; i < 2048; i++)
     if (src[i] == 63)          /* replace element above 'Xacid_s' ... */
       src[i - 64] = 101;       /* ... with 'Xacid_1' */
 
+  /* fix acid with no base beneath it (see below for details (*)) */
+  for (i = 64; i < 2048 - 1; i++)
+  {
+    if (file_version <= FILE_VERSION_EM_V2 &&
+       src[i - 64] == 101 && src[i] != 63)     /* acid without base */
+    {
+      if (src[i - 1] == 101 ||                 /* remove acid over acid row */
+         src[i + 1] == 101)
+       src[i - 64] = 6;        /* replace element above with 'Xblank' */
+      else
+       src[i - 64] = 255;      /* replace element above with 'Xfake_acid_1' */
+    }
+  }
+
 #else
 
   /* fix acid */
@@ -254,13 +405,25 @@ int cleanup_em_level(unsigned char *src, int length)
   {
     if (src[i] == 63)          /* 'Xacid_s' (acid pool, bottom middle) */
     {
-      if (file_version == FILE_VERSION_EM_V4 &&
+      if (file_version <= FILE_VERSION_EM_V2 &&
          i < 2048 - 64 && src[i + 64] == 63)
-       src[i - 64] = 255;      /* replace element above with 'Xfake_acid_1' */
+      {
+       int obj_left  = remap_emerald[src[i - 1]];
+       int obj_right = remap_emerald[src[i + 1]];
+
+       if (obj_left == Xblank || obj_right == Xblank ||
+           obj_left == Xplant || obj_right == Xplant)
+         src[i - 64] = 6;      /* replace element above with 'Xblank' */
+       else
+         src[i - 64] = 255;    /* replace element above with 'Xfake_acid_1' */
+      }
       else
+      {
        src[i - 64] = 101;      /* replace element above with 'Xacid_1' */
+      }
     }
   }
+#endif
 #endif
 
   /* fix acid in eater 1 */
@@ -391,8 +554,10 @@ int cleanup_em_level(unsigned char *src, int length)
   /* size of v6 cave */
   length = 2172;
 
+#if 1
 #if 1
   if (options.debug)
+#endif
     printf("::: EM level file version: %d\n", file_version);
 #endif
 
@@ -418,6 +583,9 @@ int cleanup_em_level(unsigned char *src, int length)
  *   in eater.
  * - acid is always deadly even with no base beneath it (this breaks cave 0 in
  *   downunder mine 16)
+ *   (*) fixed (see above):
+ *       - downunder mine 16, level 0, works again
+ *       - downunder mine 11, level 71, corrected (only cosmetically)
  *
  * so far all below have not broken any caves:
  *
@@ -568,9 +736,9 @@ static int get_em_element(unsigned short em_element_raw, int file_version)
 {
   int em_element = remap_emerald[em_element_raw];
 
-  if (file_version <= FILE_VERSION_EM_V4)
+  if (file_version < FILE_VERSION_EM_V5)
   {
-    /* versions up to V4 had no grass, but only sand/dirt */
+    /* versions below V5 had no grass, but only sand/dirt */
     if (em_element == Xgrass)
       em_element = Xdirt;
   }
@@ -1065,4 +1233,6 @@ void prepare_em_level(void)
 
   for (i = 0; i < MAX_PLAYERS; i++)
     game_em.last_player_direction[i] = MV_NONE;
+
+  lev.exit_x = lev.exit_y = -1;        /* kludge for playing player exit sound */
 }
index 9801d0cb55b94f84f1cd42464606b26f976f226a..e7cfae0e67480342295a6ebff9c4ea4f36e3632f 100644 (file)
@@ -616,6 +616,8 @@ struct LEVEL
   short ball_array[8][8];      /* ball data */
   short android_array[TILE_MAX];/* android clone table */
   int num_ball_arrays;         /* number of ball data arrays used */
+
+  int exit_x, exit_y;          /* kludge for playing player exit sound */
 };
 
 struct PLAYER
@@ -710,6 +712,7 @@ extern unsigned int InitEngineRND_EM(long);
 extern void setLevelInfoToDefaults_EM();
 extern boolean LoadNativeLevel_EM(char *);
 
+extern void BackToFront_EM(void);
 extern void BlitScreenToBitmap_EM(Bitmap *);
 extern void RedrawPlayfield_EM(boolean);
 extern void DrawGameDoorValues_EM();
index 0407fa5ca699ebaec4e4e585bd8c6180bf4ccd81..41747810631f72623ee9455b0944cfb6a92cf463 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 2f062e512625d78d5b3412ba2fe44c50154af41a..8cd8624a341deaeb42cd696614dc81e666d9df8b 100644 (file)
@@ -51,7 +51,7 @@ void synchro_1(void);
 void synchro_2(void);
 void synchro_3(void);
 
-int  cleanup_em_level(unsigned char *, int);
+int  cleanup_em_level(unsigned char *, int, char *);
 void convert_em_level(unsigned char *, int);
 void prepare_em_level(void);
 
index deee45a380a905e09b93cb2f02609659b33edfa2..21ca0964ec8bfbeebc4bc190137ee2db6f07710d 100644 (file)
@@ -93,7 +93,7 @@ void BlitScreenToBitmap_EM(Bitmap *target_bitmap)
   }
 }
 
-void blitscreen(void)
+void BackToFront_EM(void)
 {
   static boolean scrolling_last = FALSE;
   int left = screen_x / TILEX;
@@ -101,6 +101,8 @@ void blitscreen(void)
   boolean scrolling = (screen_x % TILEX != 0 || screen_y % TILEY != 0);
   int x, y;
 
+  SyncDisplay();
+
   if (redraw_tiles > REDRAWTILES_THRESHOLD || scrolling || scrolling_last)
   {
     /* blit all (up to four) parts of the scroll buffer to the backbuffer */
@@ -126,6 +128,8 @@ void blitscreen(void)
     }
   }
 
+  FlushDisplay();
+
   for (x = 0; x < MAX_BUF_XSIZE; x++)
     for (y = 0; y < MAX_BUF_YSIZE; y++)
       redraw[x][y] = FALSE;
@@ -134,6 +138,11 @@ void blitscreen(void)
   scrolling_last = scrolling;
 }
 
+void blitscreen(void)
+{
+  BackToFront_EM();
+}
+
 static void DrawLevelField_EM(int x, int y, int sx, int sy,
                              boolean draw_masked)
 {
@@ -869,14 +878,16 @@ void RedrawPlayfield_EM(boolean force_redraw)
        blitplayer(&ply[i]);
 
       blitscreen();
-      FlushDisplay();
+
       Delay(wait_delay_value);
 
       /* scroll second step to align at full tile size */
       screen_x -= dxx;
       screen_y -= dyy;
 
+#if 0
       SyncDisplay();
+#endif
 
       animscreen();
 
@@ -884,7 +895,7 @@ void RedrawPlayfield_EM(boolean force_redraw)
        blitplayer(&ply[i]);
 
       blitscreen();
-      FlushDisplay();
+
       Delay(wait_delay_value);
     }
 
@@ -912,7 +923,36 @@ void RedrawPlayfield_EM(boolean force_redraw)
                            sy - offset_y > screen_y ? sy - offset_y :
                            screen_y);
 
+#if 0
+  printf("::: (%d, %d) => (%d, %d) [(%d, %d), (%d, %d)] [%d, %d] [%d / %d]\n",
+        screen_x_old, screen_y_old,
+        screen_x, screen_y,
+        ply[max_center_distance_player_nr].oldx,
+        ply[max_center_distance_player_nr].x,
+        ply[max_center_distance_player_nr].oldy,
+        ply[max_center_distance_player_nr].y,
+        sx, sy,
+        ABS(screen_x - screen_x_old),
+        ABS(screen_y - screen_y_old));
+#endif
+
+#if 1
+
 #if 1
+  /* prevent scrolling further than double player step size when scrolling */
+  if (ABS(screen_x - screen_x_old) > 2 * stepsize)
+  {
+    int dx = SIGN(screen_x - screen_x_old);
+
+    screen_x = screen_x_old + dx * 2 * stepsize;
+  }
+  if (ABS(screen_y - screen_y_old) > 2 * stepsize)
+  {
+    int dy = SIGN(screen_y - screen_y_old);
+
+    screen_y = screen_y_old + dy * 2 * stepsize;
+  }
+#else
   /* prevent scrolling further than double player step size when scrolling */
   if (ABS(screen_x - screen_x_old) > 2 * stepsize ||
       ABS(screen_y - screen_y_old) > 2 * stepsize)
@@ -923,6 +963,8 @@ void RedrawPlayfield_EM(boolean force_redraw)
     screen_x = screen_x_old + dx * 2 * stepsize;
     screen_y = screen_y_old + dy * 2 * stepsize;
   }
+#endif
+
 #else
   /* prevent scrolling further than player step size when scrolling */
   if (ABS(screen_x - screen_x_old) > stepsize ||
@@ -997,11 +1039,13 @@ void RedrawPlayfield_EM(boolean force_redraw)
   for (i = 0; i < MAX_PLAYERS; i++)
     blitplayer(&ply[i]);
 
+#if 0
+#if 0
   SyncDisplay();
+#endif
 
   blitscreen();
-
-  FlushDisplay();
+#endif
 }
 
 void game_animscreen(void)
index 353b36eec71687f862d7a44fd7b2f7a0061c9b16..0dd2bb3b95f99f1621b0d1c426a09a28c690fcb5 100644 (file)
@@ -62,14 +62,43 @@ void InitGameEngine_EM()
 
   game_initscreen();
   game_animscreen();
+
+#if 0
+  /* blit playfield from scroll buffer to normal back buffer for fading in */
+  BlitScreenToBitmap_EM(backbuffer);
+#endif
 }
 
 void GameActions_EM(byte action[MAX_PLAYERS], boolean warp_mode)
 {
   int i;
 
+#if 0
+  static int foo = -1;
+
+  if (action[0] == 0 && foo != 0)
+    printf("KEY RELEASED @ %05d\n", FrameCounter);
+
+  foo = action[0];
+#endif
+
+#if 0
+#if 1
+  if (FrameCounter % 10 == 0)
+#endif
+    printf("::: %05d: %lu, %d\n", FrameCounter, RandomEM, frame);
+#endif
+
   game_animscreen();
 
+#if 1
+#if 0
+  SyncDisplay();
+#endif
+
+  blitscreen();
+#endif
+
   RandomEM = RandomEM * 129 + 1;
 
   frame = (frame - 1) & 7;
index d6a768786ee70591cfd486bf88f397f52fd22bbb..87e9d9527fb147a470eddbf8684cb25adc0ae20d 100644 (file)
 /* ------------------------------------------------------------------------- */
 
 /* values for native Emerald Mine game version */
+#define FILE_VERSION_EM_UNKNOWN        0
+#define FILE_VERSION_EM_V1     1
+#define FILE_VERSION_EM_V2     2
 #define FILE_VERSION_EM_V3     3
-#define FILE_VERSION_EM_V4     4
+#define FILE_VERSION_EM_V4     4       /* (there really was no version 4) */
 #define FILE_VERSION_EM_V5     5
 #define FILE_VERSION_EM_V6     6
 
@@ -80,6 +83,9 @@
 #define SXSIZE                 (SCR_FIELDX * TILEX)
 #define SYSIZE                 (SCR_FIELDY * TILEY)
 
+/* other settings */
+#define PLAY_ELEMENT_SOUND     FALSE
+
 
 /* ------------------------------------------------------------------------- */
 /* macro function definitions                                                */
index 5f0929875b67b59ca711d4c89839cfd2da4eec6d..3a469fdfcdb1f4a44d2cc811429aafd0703c779f 100644 (file)
@@ -296,7 +296,9 @@ static void kill_player(struct PLAYER *ply)
     case Xbug_gow:
       Cave[y-1][x] = Xboom_bug;
 #if 0
+#if PLAY_ELEMENT_SOUND
       play_element_sound(x, y, SAMPLE_boom, Zplayer);
+#endif
 #endif
       break;
 
@@ -310,7 +312,9 @@ static void kill_player(struct PLAYER *ply)
     case Xtank_gow:
       Cave[y-1][x] = Xboom_bomb;
 #if 0
+#if PLAY_ELEMENT_SOUND
       play_element_sound(x, y, SAMPLE_boom, Zplayer);
+#endif
 #endif
       break;
   }
@@ -327,7 +331,9 @@ static void kill_player(struct PLAYER *ply)
     case Xbug_gow:
       Cave[y][x+1] = Xboom_bug;
 #if 0
+#if PLAY_ELEMENT_SOUND
       play_element_sound(x, y, SAMPLE_boom, Zplayer);
+#endif
 #endif
       break;
 
@@ -341,7 +347,9 @@ static void kill_player(struct PLAYER *ply)
     case Xtank_gow:
       Cave[y][x+1] = Xboom_bomb;
 #if 0
+#if PLAY_ELEMENT_SOUND
       play_element_sound(x, y, SAMPLE_boom, Zplayer);
+#endif
 #endif
       break;
   }
@@ -358,7 +366,9 @@ static void kill_player(struct PLAYER *ply)
     case Xbug_gow:
       Cave[y+1][x] = Xboom_bug;
 #if 0
+#if PLAY_ELEMENT_SOUND
       play_element_sound(x, y, SAMPLE_boom, Zplayer);
+#endif
 #endif
       break;
 
@@ -372,7 +382,9 @@ static void kill_player(struct PLAYER *ply)
     case Xtank_gow:
       Cave[y+1][x] = Xboom_bomb;
 #if 0
+#if PLAY_ELEMENT_SOUND
       play_element_sound(x, y, SAMPLE_boom, Zplayer);
+#endif
 #endif
       break;
   }
@@ -389,7 +401,9 @@ static void kill_player(struct PLAYER *ply)
     case Xbug_gow:
       Cave[y][x-1] = Xboom_bug;
 #if 0
+#if PLAY_ELEMENT_SOUND
       play_element_sound(x, y, SAMPLE_boom, Zplayer);
+#endif
 #endif
       break;
 
@@ -403,7 +417,9 @@ static void kill_player(struct PLAYER *ply)
     case Xtank_gow:
       Cave[y][x-1] = Xboom_bomb;
 #if 0
+#if PLAY_ELEMENT_SOUND
       play_element_sound(x, y, SAMPLE_boom, Zplayer);
+#endif
 #endif
       break;
   }
@@ -413,10 +429,15 @@ static void kill_player(struct PLAYER *ply)
     case Xexit_1:
     case Xexit_2:
     case Xexit_3:
+      lev.exit_x = x;
+      lev.exit_y = y;
       play_element_sound(x, y, SAMPLE_exit_leave, Xexit_1);
       break;
 
     default:
+#if PLAY_ELEMENT_SOUND
+      play_element_sound(x, y, SAMPLE_boom, Zplayer);
+#endif
       play_element_sound(x, y, SAMPLE_die, Zplayer);
       break;
   }
@@ -1245,7 +1266,10 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy)
       case Xexit_1:
       case Xexit_2:
       case Xexit_3:
+#if 0
+       /* !!! already played in kill_player !!! */
        play_element_sound(x, y, SAMPLE_exit_leave, Xexit_1);
+#endif
 
        lev.home--;
 
index 1ab59546bc14d613ef83c50f0916f547bb32707a..7657bf8ddfda096fbbf52f131f4bd540900ec8a8 100644 (file)
@@ -611,7 +611,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xemerald;
          Boom[y+2][x] = Xemerald;
          Boom[y+2][x+1] = Xemerald;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          score += lev.bug_score;
@@ -637,7 +637,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          score += lev.tank_score;
@@ -697,7 +697,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
          Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
          Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          lev.eater_pos = (lev.eater_pos + 1) & 7;
@@ -718,7 +718,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          score += lev.alien_score;
@@ -799,7 +799,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          goto loop;
@@ -2838,7 +2838,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          goto loop;
@@ -2863,7 +2863,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xemerald;
          Boom[y+2][x] = Xemerald;
          Boom[y+2][x+1] = Xemerald;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          score += lev.bug_score;
@@ -2889,7 +2889,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          score += lev.tank_score;
@@ -2911,7 +2911,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = lev.eater_array[lev.eater_pos][6];
          Boom[y+2][x] = lev.eater_array[lev.eater_pos][7];
          Boom[y+2][x+1] = lev.eater_array[lev.eater_pos][8];
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          lev.eater_pos = (lev.eater_pos + 1) & 7;
@@ -2932,7 +2932,7 @@ void synchro_2(void)
          Boom[y+2][x-1] = Xblank;
          Boom[y+2][x] = Xblank;
          Boom[y+2][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          score += lev.alien_score;
@@ -4189,7 +4189,7 @@ void synchro_2(void)
          Boom[y+1][x-1] = Xblank;
          Boom[y+1][x] = Xblank;
          Boom[y+1][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
          play_element_sound(x, y, SAMPLE_boom, element);
 #endif
          goto loop;
@@ -4878,7 +4878,7 @@ void synchro_2(void)
       Boom[y+1][x-1] = Xemerald;
       Boom[y+1][x] = Xemerald;
       Boom[y+1][x+1] = Xemerald;
-#if 0
+#if PLAY_ELEMENT_SOUND
       play_element_sound(x, y, SAMPLE_boom, element);
 #endif
       goto loop;
@@ -4897,19 +4897,22 @@ void synchro_2(void)
       Boom[y+1][x-1] = Xblank;
       Boom[y+1][x] = Xblank;
       Boom[y+1][x+1] = Xblank;
-#if 0
+#if PLAY_ELEMENT_SOUND
       play_element_sound(x, y, SAMPLE_boom, element);
 #endif
       goto loop;
 
     case Xboom_android:
-#if 0
+#if PLAY_ELEMENT_SOUND
       play_element_sound(x, y, SAMPLE_boom, Xandroid);
 #endif
     case Xboom_1:
       Next[y][x] = Xboom_2;
-#if 1
-      play_sound(x, y, SAMPLE_boom);
+#if !PLAY_ELEMENT_SOUND
+      if (x != lev.exit_x && y != lev.exit_y)
+       play_sound(x, y, SAMPLE_boom);
+      else
+       lev.exit_x = lev.exit_y = -1;
 #endif
       goto loop;
 
index c975ec616a5d194cf485ef238d3027fd15c7f362..f55818968233c212c9537b76b37b8ec2c1998acf 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -295,7 +295,7 @@ void InitFontGraphicInfo()
       if (graphic_info[graphic].anim_frames < MIN_NUM_CHARS_PER_FONT)
       {
        graphic_info[graphic].anim_frames = DEFAULT_NUM_CHARS_PER_FONT;
-       graphic_info[graphic].anim_frames_per_line= DEFAULT_NUM_CHARS_PER_LINE;
+       graphic_info[graphic].anim_frames_per_line = DEFAULT_NUM_CHARS_PER_LINE;
       }
 
       /* copy font relevant information from graphics information */
@@ -1817,7 +1817,6 @@ boolean getBitfieldProperty(int *bitfield, int property_bit_nr, int element)
   return FALSE;
 }
 
-#if 1
 static void resolve_group_element(int group_element, int recursion_depth)
 {
   static int group_nr;
@@ -1864,7 +1863,6 @@ static void resolve_group_element(int group_element, int recursion_depth)
     }
   }
 }
-#endif
 
 void InitElementPropertiesStatic()
 {
@@ -3712,7 +3710,6 @@ void InitElementPropertiesEngine(int engine_version)
      property (which means that conditional property changes must be set to
      a reliable default value before) */
 
-#if 1
   /* ---------- recursively resolve group elements ------------------------- */
 
   for (i = 0; i < MAX_NUM_ELEMENTS; i++)
@@ -3721,7 +3718,6 @@ void InitElementPropertiesEngine(int engine_version)
 
   for (i = 0; i < NUM_GROUP_ELEMENTS; i++)
     resolve_group_element(EL_GROUP_START + i, 0);
-#endif
 
   /* set all special, combined or engine dependent element properties */
   for (i = 0; i < MAX_NUM_ELEMENTS; i++)
@@ -3924,58 +3920,6 @@ void InitElementPropertiesEngine(int engine_version)
                  engine_version > VERSION_IDENT(2,0,1,0)));
   }
 
-#if 0
-  /* set default push delay values (corrected since version 3.0.7-1) */
-  if (engine_version < VERSION_IDENT(3,0,7,1))
-  {
-    game.default_push_delay_fixed = 2;
-    game.default_push_delay_random = 8;
-  }
-  else
-  {
-    game.default_push_delay_fixed = 8;
-    game.default_push_delay_random = 8;
-  }
-#endif
-
-#if 0
-  /* set uninitialized push delay values of custom elements in older levels */
-  for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
-  {
-    int element = EL_CUSTOM_START + i;
-
-    if (element_info[element].push_delay_fixed == -1)
-      element_info[element].push_delay_fixed = game.default_push_delay_fixed;
-    if (element_info[element].push_delay_random == -1)
-      element_info[element].push_delay_random = game.default_push_delay_random;
-  }
-#endif
-
-#if 0
-  /* set some other uninitialized values of custom elements in older levels */
-  if (engine_version < VERSION_IDENT(3,1,0,0))
-  {
-    for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
-    {
-      int element = EL_CUSTOM_START + i;
-
-      element_info[element].access_direction = MV_ALL_DIRECTIONS;
-
-      element_info[element].explosion_delay = 17;
-      element_info[element].ignition_delay = 8;
-    }
-  }
-#endif
-
-#if 0
-  /* set element properties that were handled incorrectly in older levels */
-  if (engine_version < VERSION_IDENT(3,1,0,0))
-  {
-    SET_PROPERTY(EL_SP_SNIKSNAK, EP_DONT_COLLIDE_WITH, FALSE);
-    SET_PROPERTY(EL_SP_ELECTRON, EP_DONT_COLLIDE_WITH, FALSE);
-  }
-#endif
-
   /* this is needed because some graphics depend on element properties */
   if (game_status == GAME_MODE_PLAYING)
     InitElementGraphicInfo();
@@ -3985,34 +3929,6 @@ void InitElementPropertiesAfterLoading(int engine_version)
 {
   int i;
 
-#if 0
-  /* set default push delay values (corrected since version 3.0.7-1) */
-  if (engine_version < VERSION_IDENT(3,0,7,1))
-  {
-    game.default_push_delay_fixed = 2;
-    game.default_push_delay_random = 8;
-  }
-  else
-  {
-    game.default_push_delay_fixed = 8;
-    game.default_push_delay_random = 8;
-  }
-#endif
-
-#if 0
-  /* set uninitialized push delay values of custom elements in older levels */
-  for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
-  {
-    int element = EL_CUSTOM_START + i;
-
-    if (element_info[element].push_delay_fixed == -1)
-      element_info[element].push_delay_fixed = game.default_push_delay_fixed;
-    if (element_info[element].push_delay_random == -1)
-      element_info[element].push_delay_random = game.default_push_delay_random;
-  }
-#endif
-
-#if 1
   /* set some other uninitialized values of custom elements in older levels */
   if (engine_version < VERSION_IDENT(3,1,0,0))
   {
@@ -4026,7 +3942,6 @@ void InitElementPropertiesAfterLoading(int engine_version)
       element_info[element].ignition_delay = 8;
     }
   }
-#endif
 }
 
 static void InitGlobal()
@@ -4221,6 +4136,45 @@ void Execute_Command(char *command)
       global.convert_level_nr = atoi(str_ptr); /* get level_nr value */
     }
   }
+
+#if DEBUG
+#if defined(TARGET_SDL)
+  else if (strEqual(command, "SDL_ListModes"))
+  {
+    SDL_Rect **modes;
+    int i;
+
+    SDL_Init(SDL_INIT_VIDEO);
+
+    /* get available fullscreen/hardware modes */
+    modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE);
+
+    /* check if there are any modes available */
+    if (modes == NULL)
+    {
+      printf("No modes available!\n");
+
+      exit(-1);
+    }
+
+    /* check if our resolution is restricted */
+    if (modes == (SDL_Rect **)-1)
+    {
+      printf("All resolutions available.\n");
+    }
+    else
+    {
+      printf("Available Modes:\n");
+
+      for(i = 0; modes[i]; i++)
+       printf("  %d x %d\n", modes[i]->w, modes[i]->h);
+    }
+
+    exit(0);
+  }
+#endif
+#endif
+
   else
   {
     Error(ERR_EXIT_HELP, "unrecognized command '%s'", command);
@@ -4416,6 +4370,7 @@ void InitGfx()
 {
   char *filename_font_initial = NULL;
   Bitmap *bitmap_font_initial = NULL;
+  int font_height;
   int i, j;
 
   /* determine settings for initial font (for displaying startup messages) */
@@ -4456,8 +4411,9 @@ void InitGfx()
     Error(ERR_EXIT, "cannot get filename for '%s'", CONFIG_TOKEN_FONT_INITIAL);
 
   /* create additional image buffers for double-buffering and cross-fading */
-  bitmap_db_title = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH);
+  bitmap_db_cross = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH);
   bitmap_db_field = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
+  bitmap_db_panel = CreateBitmap(DXSIZE, DYSIZE, DEFAULT_DEPTH);
   bitmap_db_door  = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
 
   /* initialize screen properties */
@@ -4475,8 +4431,11 @@ void InitGfx()
 
   InitFontGraphicInfo();
 
+  font_height = getFontHeight(FC_RED);
+
   DrawInitText(getProgramInitString(), 20, FC_YELLOW);
   DrawInitText(PROGRAM_COPYRIGHT_STRING, 50, FC_RED);
+  DrawInitText(PROGRAM_WEBSITE_STRING, WIN_YSIZE - 20 - font_height, FC_RED);
 
   DrawInitText("Loading graphics:", 120, FC_GREEN);
 }
@@ -4755,11 +4714,7 @@ void ReloadCustomArtwork(int force_reload)
 
   if (redraw_screen)
   {
-#if 1
     RedrawBackground();
-#else
-    InitGfxBackground();
-#endif
 
     /* force redraw of (open or closed) door graphics */
     SetDoorState(DOOR_OPEN_ALL);
@@ -4831,6 +4786,10 @@ void OpenAll()
 
   InitGfxBackground();
 
+#if 1
+  em_open_all();
+#endif
+
   if (global.autoplay_leveldir)
   {
     AutoPlayTape();
@@ -4844,10 +4803,6 @@ void OpenAll()
 
   game_status = GAME_MODE_MAIN;
 
-#if 1
-  em_open_all();
-#endif
-
   DrawMainMenu();
 
   InitNetworkServer();
@@ -4874,5 +4829,8 @@ void CloseAllAndExit(int exit_value)
   CloseVideoDisplay();
   ClosePlatformDependentStuff();
 
+  if (exit_value != 0)
+    NotifyUserAboutErrorFile();
+
   exit(exit_value);
 }
index 1bfd49bc32333c93f3a03c082a6b963f433d70a9..165c2a787b3c86345ee05c3cfb026376b49d9ad5 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 497fb24e79e6f0bb0a9ba33dd93e40b780d3e528..6148a9850eea68621ed487abca8a02bc2927eecb 100644 (file)
@@ -1,7 +1,7 @@
 # =============================================================================
 # Rocks'n'Diamonds Makefile (libgame)
 # -----------------------------------------------------------------------------
-# (c) 1995-2005 Holger Schemel <info@artsoft.org>
+# (c) 1995-2006 Holger Schemel <info@artsoft.org>
 # =============================================================================
 
 # -----------------------------------------------------------------------------
index ede8cfc7f54cad4888b0209ef96a99db72a93f24..7c140cbedffbaf8d7cb742cd6cc5f3e741327b7c 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -65,10 +65,33 @@ static int getNewGadgetID()
   return id;
 }
 
-static struct GadgetInfo *getGadgetInfoFromMousePosition(int mx, int my)
+static struct GadgetInfo *getGadgetInfoFromMousePosition(int mx, int my,
+                                                        int button)
 {
   struct GadgetInfo *gi;
 
+  /* first check for scrollbars in case of mouse scroll wheel button events */
+  if (IS_WHEEL_BUTTON(button))
+  {
+    /* real horizontal wheel or vertical wheel with modifier key pressed */
+    boolean check_horizontal = (IS_WHEEL_BUTTON_HORIZONTAL(button) ||
+                               GetKeyModState() & KMOD_Shift);
+
+    /* check for the first active scrollbar with matching mouse wheel area */
+    for (gi = gadget_list_first_entry; gi != NULL; gi = gi->next)
+    {
+      if (gi->mapped && gi->active &&
+         ((gi->type & GD_TYPE_SCROLLBAR_HORIZONTAL && check_horizontal) ||
+          (gi->type & GD_TYPE_SCROLLBAR_VERTICAL && !check_horizontal)) &&
+         mx >= gi->wheelarea.x && mx < gi->wheelarea.x + gi->wheelarea.width &&
+         my >= gi->wheelarea.y && my < gi->wheelarea.y + gi->wheelarea.height)
+       return gi;
+    }
+
+    /* no active scrollbar found -- ignore this scroll wheel button event */
+    return NULL;
+  }
+
   /* open selectboxes may overlap other active gadgets, so check them first */
   for (gi = gadget_list_first_entry; gi != NULL; gi = gi->next)
   {
@@ -745,20 +768,14 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
        break;
 
       case GDI_ACTIVE:
-       /* take care here: "boolean" is typedef'ed as "unsigned char",
-          which gets promoted to "int" */
        gi->active = (boolean)va_arg(ap, int);
        break;
 
       case GDI_DIRECT_DRAW:
-       /* take care here: "boolean" is typedef'ed as "unsigned char",
-          which gets promoted to "int" */
        gi->direct_draw = (boolean)va_arg(ap, int);
        break;
 
       case GDI_CHECKED:
-       /* take care here: "boolean" is typedef'ed as "unsigned char",
-          which gets promoted to "int" */
        gi->checked = (boolean)va_arg(ap, int);
        break;
 
@@ -976,6 +993,22 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap)
        gi->scrollbar.item_position = va_arg(ap, int);
        break;
 
+      case GDI_WHEEL_AREA_X:
+       gi->wheelarea.x = va_arg(ap, int);
+       break;
+
+      case GDI_WHEEL_AREA_Y:
+       gi->wheelarea.y = va_arg(ap, int);
+       break;
+
+      case GDI_WHEEL_AREA_WIDTH:
+       gi->wheelarea.width = va_arg(ap, int);
+       break;
+
+      case GDI_WHEEL_AREA_HEIGHT:
+       gi->wheelarea.height = va_arg(ap, int);
+       break;
+
       case GDI_CALLBACK_INFO:
        gi->callback_info = va_arg(ap, gadget_function);
        break;
@@ -1382,10 +1415,12 @@ void ClickOnGadget(struct GadgetInfo *gi, int button)
 boolean HandleGadgets(int mx, int my, int button)
 {
   static unsigned long pressed_delay = 0;
+  static unsigned long pressed_delay_value = GADGET_FRAME_DELAY;
   static int last_button = 0;
   static int last_mx = 0, last_my = 0;
   static int pressed_mx = 0, pressed_my = 0;
   static boolean keep_selectbox_open = FALSE;
+  static boolean gadget_stopped = FALSE;
   int scrollbar_mouse_pos = 0;
   struct GadgetInfo *new_gi, *gi;
   boolean press_event;
@@ -1398,9 +1433,12 @@ boolean HandleGadgets(int mx, int my, int button)
   boolean gadget_pressed_repeated;
   boolean gadget_pressed_off_borders;
   boolean gadget_pressed_inside_select_line;
+  boolean gadget_pressed_delay_reached;
   boolean gadget_moving;
   boolean gadget_moving_inside;
   boolean gadget_moving_off_borders;
+  boolean gadget_draggable;
+  boolean gadget_dragging;
   boolean gadget_released;
   boolean gadget_released_inside;
   boolean gadget_released_inside_select_line;
@@ -1420,10 +1458,10 @@ boolean HandleGadgets(int mx, int my, int button)
   }
 
   /* check which gadget is under the mouse pointer */
-  new_gi = getGadgetInfoFromMousePosition(mx, my);
+  new_gi = getGadgetInfoFromMousePosition(mx, my, button);
 
   /* check if button state has changed since last invocation */
-  press_event = (button != 0 && last_button == 0);
+  press_event   = (button != 0 && last_button == 0);
   release_event = (button == 0 && last_button != 0);
   last_button = button;
 
@@ -1457,7 +1495,7 @@ boolean HandleGadgets(int mx, int my, int button)
        (gadget_pressed_inside_select_line && !mouse_inside_select_area)))
   {
     struct GadgetInfo *gi = last_gi;
-    boolean gadget_changed = (gi->event_mask & GD_EVENT_TEXT_LEAVING);
+    boolean gadget_changed = ((gi->event_mask & GD_EVENT_TEXT_LEAVING) != 0);
 
     /* check if text gadget has changed its value */
     if (gi->type & GD_TYPE_TEXT_INPUT)
@@ -1492,6 +1530,9 @@ boolean HandleGadgets(int mx, int my, int button)
   gadget_pressed_repeated =
     (button != 0 && last_gi != NULL && new_gi == last_gi);
 
+  gadget_pressed_delay_reached =
+    DelayReached(&pressed_delay, pressed_delay_value);
+
   gadget_released =            (release_event && last_gi != NULL);
   gadget_released_inside =     (gadget_released && new_gi == last_gi);
   gadget_released_off_borders =        (gadget_released && new_gi != last_gi);
@@ -1549,6 +1590,14 @@ boolean HandleGadgets(int mx, int my, int button)
   if (button == 0 && !release_event)
     gi = new_gi;
 
+  /* if new gadget or if no gadget was pressed, release stopped processing */
+  if (gadget_pressed || new_gi == NULL)
+    gadget_stopped = FALSE;
+
+  /* if gadget was stopped while being handled, stop gadget processing here */
+  if (gadget_stopped)
+    return TRUE;
+
   if (gi != NULL)
   {
     int last_x = gi->event.x;
@@ -1633,65 +1682,68 @@ boolean HandleGadgets(int mx, int my, int button)
     last_info_gi = new_gi;
   }
 
-  if (gadget_pressed)
-  {
-    if (gi->type == GD_TYPE_CHECK_BUTTON)
-    {
-      gi->checked = !gi->checked;
-    }
-    else if (gi->type == GD_TYPE_RADIO_BUTTON)
-    {
-      struct GadgetInfo *rgi = gadget_list_first_entry;
+  gadget_draggable = (gi && gi->type & GD_TYPE_SCROLLBAR);
 
-      while (rgi)
-      {
-       if (rgi->mapped &&
-           rgi->type == GD_TYPE_RADIO_BUTTON &&
-           rgi->radio_nr == gi->radio_nr &&
-           rgi != gi)
-       {
-         rgi->checked = FALSE;
-         DrawGadget(rgi, DG_UNPRESSED, rgi->direct_draw);
-       }
+  /* reset drag position for newly pressed scrollbar to "not dragging" */
+  if (gadget_pressed && gadget_draggable)
+    gi->scrollbar.drag_position = -1;
 
-       rgi = rgi->next;
-      }
+  gadget_dragging = (gadget_draggable && gi->scrollbar.drag_position != -1);
 
-      gi->checked = TRUE;
+  /* clicking next to a scrollbar to move it is not considered "moving" */
+  if (gadget_draggable && !gadget_dragging)
+    gadget_moving = FALSE;
+
+  /* when leaving scrollbar area when jump-scrolling, stop gadget processing */
+  if (gadget_draggable && !gadget_dragging && gadget_moving_off_borders)
+    gadget_stopped = TRUE;
+
+  if ((gadget_pressed) ||
+      (gadget_pressed_repeated && gadget_pressed_delay_reached))
+  {
+    if (gadget_pressed)                /* gadget pressed the first time */
+    {
+      /* initialize delay counter */
+      DelayReached(&pressed_delay, 0);
+
+      /* start gadget delay with longer delay after first click on gadget */
+      pressed_delay_value = GADGET_FRAME_DELAY_FIRST;
     }
-    else if (gi->type & GD_TYPE_SCROLLBAR)
+    else                       /* gadget hold pressed for some time */
     {
-      int mpos, gpos;
+      /* after first repeated gadget click, continue with shorter delay value */
+      pressed_delay_value = GADGET_FRAME_DELAY;
+    }
 
-      if (gi->type == GD_TYPE_SCROLLBAR_HORIZONTAL)
-      {
-       mpos = mx;
-       gpos = gi->x;
-      }
-      else
-      {
-       mpos = my;
-       gpos = gi->y;
-      }
+    if (gi->type & GD_TYPE_SCROLLBAR && !gadget_dragging)
+    {
+      int mpos = (gi->type == GD_TYPE_SCROLLBAR_HORIZONTAL ? mx    : my);
+      int gpos = (gi->type == GD_TYPE_SCROLLBAR_HORIZONTAL ? gi->x : gi->y);
+      int slider_start = gpos + gi->scrollbar.position;
+      int slider_end   = gpos + gi->scrollbar.position + gi->scrollbar.size - 1;
+      boolean inside_slider = (mpos >= slider_start && mpos <= slider_end);
 
-      if (mpos >= gpos + gi->scrollbar.position &&
-         mpos < gpos + gi->scrollbar.position + gi->scrollbar.size)
-      {
-       /* drag scrollbar */
-       gi->scrollbar.drag_position =
-         scrollbar_mouse_pos - gi->scrollbar.position;
-      }
-      else
+      if (IS_WHEEL_BUTTON(button) || !inside_slider)
       {
        /* click scrollbar one scrollbar length up/left or down/right */
 
        struct GadgetScrollbar *gs = &gi->scrollbar;
        int old_item_position = gs->item_position;
+       int item_steps = gs->items_visible - 1;
+       int item_direction = (mpos < gpos + gi->scrollbar.position ? -1 : +1);
+
+       if (IS_WHEEL_BUTTON(button))
+       {
+         boolean scroll_single_step = ((GetKeyModState() & KMOD_Alt) != 0);
+
+         item_steps = (scroll_single_step ? 1 : DEFAULT_WHEEL_STEPS);
+         item_direction = (button == MB_WHEEL_UP ||
+                           button == MB_WHEEL_LEFT ? -1 : +1);
+       }
 
        changed_position = FALSE;
 
-       gs->item_position +=
-         gs->items_visible * (mpos < gpos + gi->scrollbar.position ? -1 : +1);
+       gs->item_position += item_steps * item_direction;
 
        if (gs->item_position < 0)
          gs->item_position = 0;
@@ -1714,11 +1766,61 @@ boolean HandleGadgets(int mx, int my, int button)
        if (gi->event_mask & GD_EVENT_MOVING && changed_position)
          gi->callback_action(gi);
 
-       /* don't handle this scrollbar anymore while mouse button pressed */
-       last_gi = NULL;
-
        return TRUE;
       }
+      else
+      {
+       /* don't handle this scrollbar anymore when mouse position reached */
+       if (gadget_pressed_repeated)
+       {
+         gadget_stopped = TRUE;
+
+         return TRUE;
+       }
+      }
+    }
+  }
+
+  if (gadget_pressed)
+  {
+    if (gi->type == GD_TYPE_CHECK_BUTTON)
+    {
+      gi->checked = !gi->checked;
+    }
+    else if (gi->type == GD_TYPE_RADIO_BUTTON)
+    {
+      struct GadgetInfo *rgi = gadget_list_first_entry;
+
+      while (rgi)
+      {
+       if (rgi->mapped &&
+           rgi->type == GD_TYPE_RADIO_BUTTON &&
+           rgi->radio_nr == gi->radio_nr &&
+           rgi != gi)
+       {
+         rgi->checked = FALSE;
+         DrawGadget(rgi, DG_UNPRESSED, rgi->direct_draw);
+       }
+
+       rgi = rgi->next;
+      }
+
+      gi->checked = TRUE;
+    }
+    else if (gi->type & GD_TYPE_SCROLLBAR)
+    {
+      int mpos = (gi->type == GD_TYPE_SCROLLBAR_HORIZONTAL ? mx    : my);
+      int gpos = (gi->type == GD_TYPE_SCROLLBAR_HORIZONTAL ? gi->x : gi->y);
+      int slider_start = gpos + gi->scrollbar.position;
+      int slider_end   = gpos + gi->scrollbar.position + gi->scrollbar.size - 1;
+      boolean inside_slider = (mpos >= slider_start && mpos <= slider_end);
+
+      if (!IS_WHEEL_BUTTON(button) && inside_slider)
+      {
+       /* start dragging scrollbar */
+       gi->scrollbar.drag_position =
+         scrollbar_mouse_pos - gi->scrollbar.position;
+      }
     }
     else if (gi->type & GD_TYPE_SELECTBOX)
     {
@@ -1734,9 +1836,6 @@ boolean HandleGadgets(int mx, int my, int button)
     gi->event.button = button;
     gi->event.off_borders = FALSE;
 
-    /* initialize delay counter */
-    DelayReached(&pressed_delay, 0);
-
     if (gi->event_mask & GD_EVENT_PRESSED)
       gi->callback_action(gi);
   }
@@ -1745,8 +1844,7 @@ boolean HandleGadgets(int mx, int my, int button)
   {
     gi->event.type = GD_EVENT_PRESSED;
 
-    if (gi->event_mask & GD_EVENT_REPEATED &&
-       DelayReached(&pressed_delay, GADGET_FRAME_DELAY))
+    if (gi->event_mask & GD_EVENT_REPEATED && gadget_pressed_delay_reached)
       gi->callback_action(gi);
   }
 
@@ -1814,7 +1912,7 @@ boolean HandleGadgets(int mx, int my, int button)
       DrawGadget(gi, DG_PRESSED, gi->direct_draw);
     }
 
-    gi->state = (gadget_moving_inside || gi->type & GD_TYPE_SCROLLBAR ?
+    gi->state = (gadget_moving_inside || gadget_draggable ?
                 GD_BUTTON_PRESSED : GD_BUTTON_UNPRESSED);
     gi->event.type = GD_EVENT_MOVING;
     gi->event.off_borders = gadget_moving_off_borders;
@@ -1863,6 +1961,7 @@ boolean HandleGadgets(int mx, int my, int button)
     if (gi->type & GD_TYPE_SCROLLBAR)
       DrawGadget(gi, DG_UNPRESSED, gi->direct_draw);
 
+    gi->state = GD_BUTTON_UNPRESSED;
     gi->event.type = GD_EVENT_RELEASED;
 
     if (gi->event_mask & GD_EVENT_RELEASED &&
@@ -1905,7 +2004,7 @@ boolean HandleGadgetsKeyInput(Key key)
 
   if (key == KSYM_Return)      /* valid for both text input and selectbox */
   {
-    boolean gadget_changed = (gi->event_mask & GD_EVENT_TEXT_RETURN);
+    boolean gadget_changed = ((gi->event_mask & GD_EVENT_TEXT_RETURN) != 0);
 
     if (gi->type & GD_TYPE_TEXT_INPUT)
     {
index ac14cb81f2b1d0e9dfecd733629c1c63799caa33..7f352a87b5d49b61d4fe8817aaeb8dd864dea6f3 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -17,7 +17,8 @@
 #include "system.h"
 
 
-#define GADGET_FRAME_DELAY     150     /* delay between gadget actions */
+#define GADGET_FRAME_DELAY_FIRST       250     /* delay after first click */
+#define GADGET_FRAME_DELAY             100     /* delay for pressed butten */
 
 /* gadget types */
 #define GD_TYPE_NORMAL_BUTTON          (1 << 0)
 #define GDI_SCROLLBAR_ITEMS_MAX                37
 #define GDI_SCROLLBAR_ITEMS_VISIBLE    38
 #define GDI_SCROLLBAR_ITEM_POSITION    39
-#define GDI_INFO_TEXT                  40
-#define GDI_ACTIVE                     41
-#define GDI_DIRECT_DRAW                        42
+#define GDI_WHEEL_AREA_X               40
+#define GDI_WHEEL_AREA_Y               41
+#define GDI_WHEEL_AREA_WIDTH           42
+#define GDI_WHEEL_AREA_HEIGHT          43
+#define GDI_INFO_TEXT                  44
+#define GDI_ACTIVE                     45
+#define GDI_DIRECT_DRAW                        46
 
 typedef void (*gadget_function)(void *);
 
@@ -205,6 +210,12 @@ struct GadgetScrollbar
   int correction;                      /* scrollbar position correction */
 };
 
+struct GadgetWheelArea
+{
+  int x, y;                            /* active area for wheel (start) */
+  int width, height;                   /* active area for wheel (size) */ 
+};
+
 struct GadgetInfo
 {
   int id;                              /* internal gadget identifier */
@@ -236,6 +247,7 @@ struct GadgetInfo
   struct GadgetTextArea textarea;      /* fields for text area gadget */
   struct GadgetSelectbox selectbox;    /* fields for selectbox gadget */
   struct GadgetScrollbar scrollbar;    /* fields for scrollbar gadget */
+  struct GadgetWheelArea wheelarea;    /* fields for scroll wheel area */
   struct GadgetInfo *next;             /* next list entry */
 };
 
index bce20519104494443774eb0988a8049e39af274c..e44313a87ba8a323bb0ca1d62c8807ea29fb4626 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2003 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 4be5cc8db5b73e5558b37116699eed351104ca25..c8836fda09ed95becf261d02e8daa1324a0710a0 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2003 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index cb8de4c87ed46ab8397a46f8f6a852843cb3344b..6cfa44f4d0a1f11463a71a928138afda63374968 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 3791c4bc8578be5944fee672044813d45eaeca5d..89f4f7c41d36ac7029fc9d39d05e6d792d18ad3b 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 8cf04cf69be4fe6d0c8dd7f57d0461389b8f765d..b286de23732f769a220d7775d45b2efbfaadbd63 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index d571a1303fb296aafed0c35ab0eda3e949814cec..efaaf5b8974440571dc1d6cc97e071c3f42158f4 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 6c1dd346f0cb0323124628dee840e9684b8e94d3..6f4c20c29e248d3f77eea1c9ec1fc04436c32926 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 7cccf5716bfac600781757dc92d4dbf39dff1a0f..c4818e76a4d3448c15e785b2a76ca5f56988f454 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2003 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index c04c256dd4989c54d363fb06fb958e90732f581b..f9ec87fe5b15cf9c1206f7f6b83bade9c302e0df 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
 #include "image.h"
 
 
-/* ------------------------------------------------------------------------- */
+/* ========================================================================= */
 /* some generic helper functions                                             */
+/* ========================================================================= */
+
+/* ------------------------------------------------------------------------- */
+/* platform independent wrappers for printf() et al. (newline aware)         */
 /* ------------------------------------------------------------------------- */
 
-void fprintf_line(FILE *stream, char *line_string, int line_length)
+static void vfprintf_newline(FILE *stream, char *format, va_list ap)
+{
+  char *newline = STRING_NEWLINE;
+
+  vfprintf(stream, format, ap);
+
+  fprintf(stream, "%s", newline);
+}
+
+static void fprintf_newline(FILE *stream, char *format, ...)
+{
+  if (format)
+  {
+    va_list ap;
+
+    va_start(ap, format);
+    vfprintf_newline(stream, format, ap);
+    va_end(ap);
+  }
+}
+
+void fprintf_line(FILE *stream, char *line_chars, int line_length)
 {
   int i;
 
   for (i = 0; i < line_length; i++)
-    fprintf(stream, "%s", line_string);
+    fprintf(stream, "%s", line_chars);
 
-  fprintf(stream, "\n");
+  fprintf_newline(stream, "");
 }
 
-void printf_line(char *line_string, int line_length)
+void printf_line(char *line_chars, int line_length)
 {
-  fprintf_line(stdout, line_string, line_length);
+  fprintf_line(stdout, line_chars, line_length);
 }
 
-void printf_line_with_prefix(char *prefix, char *line_string, int line_length)
+void printf_line_with_prefix(char *prefix, char *line_chars, int line_length)
 {
   fprintf(stdout, "%s", prefix);
-  fprintf_line(stdout, line_string, line_length);
+  fprintf_line(stdout, line_chars, line_length);
 }
 
 
+/* ------------------------------------------------------------------------- */
+/* string functions                                                          */
+/* ------------------------------------------------------------------------- */
+
 /* int2str() returns a number converted to a string;
    the used memory is static, but will be overwritten by later calls,
    so if you want to save the result, copy it to a private string buffer;
@@ -421,38 +450,6 @@ char *getRealName()
   return real_name;
 }
 
-char *getHomeDir()
-{
-  static char *dir = NULL;
-
-#if defined(PLATFORM_WIN32)
-  if (dir == NULL)
-  {
-    dir = checked_malloc(MAX_PATH + 1);
-
-    if (!SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, dir)))
-      strcpy(dir, ".");
-  }
-#elif defined(PLATFORM_UNIX)
-  if (dir == NULL)
-  {
-    if ((dir = getenv("HOME")) == NULL)
-    {
-      struct passwd *pwd;
-
-      if ((pwd = getpwuid(getuid())) != NULL)
-       dir = getStringCopy(pwd->pw_dir);
-      else
-       dir = ".";
-    }
-  }
-#else
-  dir = ".";
-#endif
-
-  return dir;
-}
-
 
 /* ------------------------------------------------------------------------- */
 /* path manipulation functions                                               */
@@ -460,17 +457,15 @@ char *getHomeDir()
 
 static char *getLastPathSeparatorPtr(char *filename)
 {
-  char *last_separator = strrchr(filename, '/');
+  char *last_separator = strrchr(filename, CHAR_PATH_SEPARATOR_UNIX);
 
-#if !defined(PLATFORM_UNIX)
   if (last_separator == NULL)  /* also try DOS/Windows variant */
-    last_separator = strrchr(filename, '\\');
-#endif
+    last_separator = strrchr(filename, CHAR_PATH_SEPARATOR_DOS);
 
   return last_separator;
 }
 
-static char *getBaseNamePtr(char *filename)
+char *getBaseNamePtr(char *filename)
 {
   char *last_separator = getLastPathSeparatorPtr(filename);
 
@@ -505,21 +500,23 @@ char *getBasePath(char *filename)
 
 char *getPath2(char *path1, char *path2)
 {
+  char *sep = STRING_PATH_SEPARATOR;
   char *complete_path = checked_malloc(strlen(path1) + 1 +
                                       strlen(path2) + 1);
 
-  sprintf(complete_path, "%s/%s", path1, path2);
+  sprintf(complete_path, "%s%s%s", path1, sep, path2);
 
   return complete_path;
 }
 
 char *getPath3(char *path1, char *path2, char *path3)
 {
+  char *sep = STRING_PATH_SEPARATOR;
   char *complete_path = checked_malloc(strlen(path1) + 1 +
                                       strlen(path2) + 1 +
                                       strlen(path3) + 1);
 
-  sprintf(complete_path, "%s/%s/%s", path1, path2, path3);
+  sprintf(complete_path, "%s%s%s%s%s", path1, sep, path2, sep, path3);
 
   return complete_path;
 }
@@ -797,8 +794,6 @@ void Error(int mode, char *format, ...)
 {
   static boolean last_line_was_separator = FALSE;
   char *process_name = "";
-  FILE *error = stderr;
-  char *newline = "\n";
 
   /* display warnings only when running in verbose mode */
   if (mode & ERR_WARN && !options.verbose)
@@ -807,7 +802,7 @@ void Error(int mode, char *format, ...)
   if (mode == ERR_RETURN_LINE)
   {
     if (!last_line_was_separator)
-      fprintf_line(error, format, 79);
+      fprintf_line(program.error_file, format, 79);
 
     last_line_was_separator = TRUE;
 
@@ -816,16 +811,6 @@ void Error(int mode, char *format, ...)
 
   last_line_was_separator = FALSE;
 
-#if defined(PLATFORM_MSDOS)
-  newline = "\r\n";
-
-  if ((error = openErrorFile()) == NULL)
-  {
-    printf("Cannot write to error output file!%s", newline);
-    program.exit_function(1);
-  }
-#endif
-
   if (mode & ERR_SOUND_SERVER)
     process_name = " sound server";
   else if (mode & ERR_NETWORK_SERVER)
@@ -837,28 +822,25 @@ void Error(int mode, char *format, ...)
   {
     va_list ap;
 
-    fprintf(error, "%s%s: ", program.command_basename, process_name);
+    fprintf(program.error_file, "%s%s: ", program.command_basename,
+           process_name);
 
     if (mode & ERR_WARN)
-      fprintf(error, "warning: ");
+      fprintf(program.error_file, "warning: ");
 
     va_start(ap, format);
-    vfprintf(error, format, ap);
+    vfprintf_newline(program.error_file, format, ap);
     va_end(ap);
-  
-    fprintf(error, "%s", newline);
   }
   
   if (mode & ERR_HELP)
-    fprintf(error, "%s: Try option '--help' for more information.%s",
-           program.command_basename, newline);
+    fprintf_newline(program.error_file,
+                   "%s: Try option '--help' for more information.",
+                   program.command_basename);
 
   if (mode & ERR_EXIT)
-    fprintf(error, "%s%s: aborting%s",
-           program.command_basename, process_name, newline);
-
-  if (error != stderr)
-    fclose(error);
+    fprintf_newline(program.error_file, "%s%s: aborting",
+                   program.command_basename, process_name);
 
   if (mode & ERR_EXIT)
   {
@@ -1255,13 +1237,8 @@ void translate_keyname(Key *keysym, char **x11name, char **name, int mode)
       sprintf(name_buffer, "%c", '0' + (char)(key - KSYM_0));
     else if (key >= KSYM_KP_0 && key <= KSYM_KP_9)
       sprintf(name_buffer, "keypad %c", '0' + (char)(key - KSYM_KP_0));
-#if 1
     else if (key >= KSYM_FKEY_FIRST && key <= KSYM_FKEY_LAST)
       sprintf(name_buffer, "F%d", (int)(key - KSYM_FKEY_FIRST + 1));
-#else
-    else if (key >= KSYM_FKEY_FIRST && key <= KSYM_FKEY_LAST)
-      sprintf(name_buffer, "function F%d", (int)(key - KSYM_FKEY_FIRST + 1));
-#endif
     else if (key == KSYM_UNDEFINED)
       strcpy(name_buffer, "(undefined)");
     else
@@ -1835,6 +1812,48 @@ int get_auto_parameter_value(char *token, char *value_raw)
   return get_parameter_value(value_raw, suffix, TYPE_INTEGER);
 }
 
+struct ScreenModeInfo *get_screen_mode_from_string(char *screen_mode_string)
+{
+  static struct ScreenModeInfo screen_mode;
+  char *screen_mode_string_x = strchr(screen_mode_string, 'x');
+  char *screen_mode_string_copy;
+  char *screen_mode_string_pos_w;
+  char *screen_mode_string_pos_h;
+
+  if (screen_mode_string_x == NULL)    /* invalid screen mode format */
+    return NULL;
+
+  screen_mode_string_copy = getStringCopy(screen_mode_string);
+
+  screen_mode_string_pos_w = screen_mode_string_copy;
+  screen_mode_string_pos_h = strchr(screen_mode_string_copy, 'x');
+  *screen_mode_string_pos_h++ = '\0';
+
+  screen_mode.width  = atoi(screen_mode_string_pos_w);
+  screen_mode.height = atoi(screen_mode_string_pos_h);
+
+  return &screen_mode;
+}
+
+void get_aspect_ratio_from_screen_mode(struct ScreenModeInfo *screen_mode,
+                                      int *x, int *y)
+{
+  float aspect_ratio = (float)screen_mode->width / (float)screen_mode->height;
+  float aspect_ratio_new;
+  int i = 1;
+
+  do
+  {
+    *x = i * aspect_ratio + 0.000001;
+    *y = i;
+
+    aspect_ratio_new = (float)*x / (float)*y;
+
+    i++;
+  }
+  while (aspect_ratio_new != aspect_ratio && *y < screen_mode->height);
+}
+
 static void FreeCustomArtworkList(struct ArtworkListInfo *,
                                  struct ListNodeInfo ***, int *);
 
@@ -2697,25 +2716,32 @@ void FreeCustomArtworkLists(struct ArtworkListInfo *artwork_info)
 /* ------------------------------------------------------------------------- */
 /* functions only needed for non-Unix (non-command-line) systems             */
 /* (MS-DOS only; SDL/Windows creates files "stdout.txt" and "stderr.txt")    */
+/* (now also added for Windows, to create files in user data directory)      */
 /* ------------------------------------------------------------------------- */
 
-#if defined(PLATFORM_MSDOS)
-
-#define ERROR_FILENAME         "stderr.txt"
+char *getErrorFilename(char *basename)
+{
+  return getPath2(getUserGameDataDir(), basename);
+}
 
-void initErrorFile()
+void openErrorFile()
 {
-  unlink(ERROR_FILENAME);
+  InitUserDataDirectory();
+
+  if ((program.error_file = fopen(program.error_filename, MODE_WRITE)) == NULL)
+    fprintf_newline(stderr, "ERROR: cannot open file '%s' for writing!",
+                   program.error_filename);
 }
 
-FILE *openErrorFile()
+void closeErrorFile()
 {
-  return fopen(ERROR_FILENAME, MODE_APPEND);
+  if (program.error_file != stderr)    /* do not close stream 'stderr' */
+    fclose(program.error_file);
 }
 
 void dumpErrorFile()
 {
-  FILE *error_file = fopen(ERROR_FILENAME, MODE_READ);
+  FILE *error_file = fopen(program.error_filename, MODE_READ);
 
   if (error_file != NULL)
   {
@@ -2725,7 +2751,18 @@ void dumpErrorFile()
     fclose(error_file);
   }
 }
+
+void NotifyUserAboutErrorFile()
+{
+#if defined(PLATFORM_WIN32)
+  char *title_text = getStringCat2(program.program_title, " Error Message");
+  char *error_text = getStringCat2("The program was aborted due to an error; "
+                                  "for details, see the following error file:"
+                                  STRING_NEWLINE, program.error_filename);
+
+  MessageBox(NULL, error_text, title_text, MB_OK);
 #endif
+}
 
 
 /* ------------------------------------------------------------------------- */
index fa4c1e97ed51996709cac6b4aababc1245b00ab1..1bafb463efe04bdd3a3661b7067075996b862079 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -81,22 +81,15 @@ boolean FrameReached(unsigned long *, unsigned long);
 boolean DelayReached(unsigned long *, unsigned long);
 void WaitUntilDelayReached(unsigned long *, unsigned long);
 
-#if 0
-unsigned int SimpleRND(unsigned int);
-unsigned int InitSimpleRND(long);
-unsigned int RND(unsigned int);
-unsigned int InitRND(long);
-#endif
-
 unsigned int init_random_number(int, long);
 unsigned int get_random_number(int, int);
 
 char *getLoginName(void);
 char *getRealName(void);
-char *getHomeDir(void);
 
 char *getBasePath(char *);
 char *getBaseName(char *);
+char *getBaseNamePtr(char *);
 
 char *getPath2(char *, char *);
 char *getPath3(char *, char *, char*);
@@ -180,6 +173,9 @@ char *get_mapped_token(char *);
 int get_parameter_value(char *, char *, int);
 int get_auto_parameter_value(char *, char *);
 
+struct ScreenModeInfo *get_screen_mode_from_string(char *);
+void get_aspect_ratio_from_screen_mode(struct ScreenModeInfo *, int *x, int *y);
+
 struct FileInfo *getFileListFromConfigList(struct ConfigInfo *,
                                           struct ConfigTypeInfo *,
                                           char **, int);
@@ -187,11 +183,11 @@ void LoadArtworkConfig(struct ArtworkListInfo *);
 void ReloadCustomArtworkList(struct ArtworkListInfo *);
 void FreeCustomArtworkLists(struct ArtworkListInfo *);
 
-#if !defined(PLATFORM_UNIX)
-void initErrorFile();
-FILE *openErrorFile();
+char *getErrorFilename(char *);
+void openErrorFile();
+void closeErrorFile();
 void dumpErrorFile();
-#endif
+void NotifyUserAboutErrorFile();
 
 void debug_print_timestamp(int, char *);
 
index a82da6cda9b3006e06b44ee4cea20a8d8e8fe3b7..60728bef8b6fdb69390d4c9b1d5c879e97be0486 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 8307a054dd0e57b523eff5a8927d17c3ee6d269a..95e0dbc0f3afdc140ca6808c08cb289925962ba1 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 8bf4d6c1424a2ca62fc61a8ccbfe68ef6ade2111..4c93e39cc9a803701106fad69d97c33bb70ac8d5 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index bf5bacfab5a535343569b87d111f7e83324bc26e..566c28d3eaf470b8f5112cbe85deb547b1131761 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index baabd7e102080c53bae2efeb6eb7f610bd205bce..d8773420bb4a8b18cf23398364d16f49d178f15e 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 1bf4ce316f1021e05c602ef9953b0d092f99f109..92f6ca3a440d4600388331420eeee03ec7c20464 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index ed01196dee47358e80d7de178bc7b5f45cee0950..bde1214d7175ebde3ecc64da2677360b109f851e 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index df3a0e349dddbd31c74a9ad5f0f9424c1f50e099..d06cca94da5646c067e79efca76810e78daa0209 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -15,6 +15,7 @@
 #include "sound.h"
 #include "joystick.h"
 #include "misc.h"
+#include "setup.h"
 
 
 #if defined(TARGET_SDL)
 /* functions from SGE library */
 void sge_Line(SDL_Surface *, Sint16, Sint16, Sint16, Sint16, Uint32);
 
-/* #ifdef PLATFORM_WIN32 */
-#define FULLSCREEN_BUG
-/* #endif */
-
 /* stuff needed to work around SDL/Windows fullscreen drawing bug */
 static int fullscreen_width;
 static int fullscreen_height;
@@ -38,6 +35,63 @@ static int fullscreen_yoffset;
 static int video_xoffset;
 static int video_yoffset;
 
+static void setFullscreenParameters()
+{
+  struct ScreenModeInfo *fullscreen_mode;
+  int i;
+
+  fullscreen_mode = get_screen_mode_from_string(setup.fullscreen_mode);
+
+  if (fullscreen_mode == NULL)
+    return;
+
+  for (i = 0; video.fullscreen_modes[i].width != -1; i++)
+  {
+    if (fullscreen_mode->width  == video.fullscreen_modes[i].width &&
+       fullscreen_mode->height == video.fullscreen_modes[i].height)
+    {
+      fullscreen_width  = fullscreen_mode->width;
+      fullscreen_height = fullscreen_mode->height;
+
+      fullscreen_xoffset = (fullscreen_width  - video.width)  / 2;
+      fullscreen_yoffset = (fullscreen_height - video.height) / 2;
+
+      break;
+    }
+  }
+}
+
+static void SDLSetWindowIcon(char *basename)
+{
+  /* (setting the window icon on Mac OS X would replace the high-quality
+     dock icon with the currently smaller (and uglier) icon from file) */
+
+#if !defined(PLATFORM_MACOSX)
+  char *filename = getCustomImageFilename(basename);
+  SDL_Surface *surface;
+
+  if (filename == NULL)
+  {
+    Error(ERR_WARN, "SDLSetWindowIcon(): cannot find file '%s'", basename);
+
+    return;
+  }
+
+  if ((surface = IMG_Load(filename)) == NULL)
+  {
+    Error(ERR_WARN, "IMG_Load() failed: %s", SDL_GetError());
+
+    return;
+  }
+
+  /* set transparent color */
+  SDL_SetColorKey(surface, SDL_SRCCOLORKEY,
+                 SDL_MapRGB(surface->format, 0x00, 0x00, 0x00));
+
+  SDL_WM_SetIcon(surface, NULL);
+#endif
+}
+
 void SDLInitVideoDisplay(void)
 {
   putenv("SDL_VIDEO_CENTERED=1");
@@ -53,8 +107,6 @@ void SDLInitVideoDisplay(void)
 void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
                        boolean fullscreen)
 {
-#ifdef FULLSCREEN_BUG
-  int i;
   static int screen_xy[][2] =
   {
     {  640, 480 },
@@ -62,7 +114,8 @@ void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
     { 1024, 768 },
     {   -1,  -1 }
   };
-#endif
+  SDL_Rect **modes;
+  int i, j;
 
   /* default: normal game window size */
   fullscreen_width = video.width;
@@ -70,20 +123,86 @@ void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
   fullscreen_xoffset = 0;
   fullscreen_yoffset = 0;
 
-#ifdef FULLSCREEN_BUG
   for (i = 0; screen_xy[i][0] != -1; i++)
   {
-    if (video.width <= screen_xy[i][0] && video.height <= screen_xy[i][1])
+    if (screen_xy[i][0] >= video.width && screen_xy[i][1] >= video.height)
     {
-      fullscreen_width = screen_xy[i][0];
+      fullscreen_width  = screen_xy[i][0];
       fullscreen_height = screen_xy[i][1];
+
       break;
     }
   }
 
-  fullscreen_xoffset = (fullscreen_width - video.width) / 2;
+  fullscreen_xoffset = (fullscreen_width  - video.width)  / 2;
   fullscreen_yoffset = (fullscreen_height - video.height) / 2;
-#endif
+
+  /* get available hardware supported fullscreen modes */
+  modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE);
+
+  if (modes == NULL)
+  {
+    /* no screen modes available => no fullscreen mode support */
+    video.fullscreen_available = FALSE;
+  }
+  else if (modes == (SDL_Rect **)-1)
+  {
+    /* fullscreen resolution is not restricted -- all resolutions available */
+    video.fullscreen_modes = checked_calloc(2 * sizeof(struct ScreenModeInfo));
+
+    /* use native video buffer size for fullscreen mode */
+    video.fullscreen_modes[0].width  = video.width;
+    video.fullscreen_modes[0].height = video.height;
+
+    video.fullscreen_modes[1].width  = -1;
+    video.fullscreen_modes[1].height = -1;
+  }
+  else
+  {
+    /* in this case, a certain number of screen modes is available */
+    int num_modes = 0;
+
+    for(i = 0; modes[i] != NULL; i++)
+    {
+      boolean found_mode = FALSE;
+
+      /* screen mode is smaller than video buffer size -- skip it */
+      if (modes[i]->w < video.width || modes[i]->h < video.height)
+       continue;
+
+      if (video.fullscreen_modes != NULL)
+       for (j = 0; video.fullscreen_modes[j].width != -1; j++)
+         if (modes[i]->w == video.fullscreen_modes[j].width &&
+             modes[i]->h == video.fullscreen_modes[j].height)
+           found_mode = TRUE;
+
+      if (found_mode)          /* screen mode already stored -- skip it */
+       continue;
+
+      /* new mode found; add it to list of available fullscreen modes */
+
+      num_modes++;
+
+      video.fullscreen_modes = checked_realloc(video.fullscreen_modes,
+                                              (num_modes + 1) *
+                                              sizeof(struct ScreenModeInfo));
+
+      video.fullscreen_modes[num_modes - 1].width  = modes[i]->w;
+      video.fullscreen_modes[num_modes - 1].height = modes[i]->h;
+
+      video.fullscreen_modes[num_modes].width  = -1;
+      video.fullscreen_modes[num_modes].height = -1;
+    }
+
+    if (num_modes == 0)
+    {
+      /* no appropriate screen modes available => no fullscreen mode support */
+      video.fullscreen_available = FALSE;
+    }
+  }
+
+  /* set window icon */
+  SDLSetWindowIcon(program.sdl_icon_filename);
 
   /* open SDL video output device (window or fullscreen mode) */
   if (!SDLSetVideoMode(backbuffer, fullscreen))
@@ -121,6 +240,8 @@ boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen)
 
   if (fullscreen && !video.fullscreen_enabled && video.fullscreen_available)
   {
+    setFullscreenParameters();
+
     video_xoffset = fullscreen_xoffset;
     video_yoffset = fullscreen_yoffset;
 
@@ -207,26 +328,22 @@ void SDLCopyArea(Bitmap *src_bitmap, Bitmap *dst_bitmap,
   Bitmap *real_dst_bitmap = (dst_bitmap == window ? backbuffer : dst_bitmap);
   SDL_Rect src_rect, dst_rect;
 
-#ifdef FULLSCREEN_BUG
   if (src_bitmap == backbuffer)
   {
     src_x += video_xoffset;
     src_y += video_yoffset;
   }
-#endif
 
   src_rect.x = src_x;
   src_rect.y = src_y;
   src_rect.w = width;
   src_rect.h = height;
 
-#ifdef FULLSCREEN_BUG
   if (dst_bitmap == backbuffer || dst_bitmap == window)
   {
     dst_x += video_xoffset;
     dst_y += video_yoffset;
   }
-#endif
 
   dst_rect.x = dst_x;
   dst_rect.y = dst_y;
@@ -242,19 +359,17 @@ void SDLCopyArea(Bitmap *src_bitmap, Bitmap *dst_bitmap,
     SDL_UpdateRect(backbuffer->surface, dst_x, dst_y, width, height);
 }
 
-void SDLFillRectangle(Bitmap *dst_bitmap, int x, int y,
-                     int width, int height, Uint32 color)
+void SDLFillRectangle(Bitmap *dst_bitmap, int x, int y, int width, int height,
+                     Uint32 color)
 {
   Bitmap *real_dst_bitmap = (dst_bitmap == window ? backbuffer : dst_bitmap);
   SDL_Rect rect;
 
-#ifdef FULLSCREEN_BUG
   if (dst_bitmap == backbuffer || dst_bitmap == window)
   {
     x += video_xoffset;
     y += video_yoffset;
   }
-#endif
 
   rect.x = x;
   rect.y = y;
@@ -267,51 +382,34 @@ void SDLFillRectangle(Bitmap *dst_bitmap, int x, int y,
     SDL_UpdateRect(backbuffer->surface, x, y, width, height);
 }
 
-void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay,
-                  int post_delay)
+void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height,
+                     int fade_mode, int fade_delay, int post_delay)
 {
   static boolean initialization_needed = TRUE;
-  static SDL_Surface *surface_screen_copy = NULL;
+  static SDL_Surface *surface_source = NULL;
+  static SDL_Surface *surface_target = NULL;
   static SDL_Surface *surface_black = NULL;
   SDL_Surface *surface_screen = backbuffer->surface;
-  SDL_Surface *surface_cross;          /* initialized later */
+  SDL_Surface *surface_cross = (bitmap_cross ? bitmap_cross->surface : NULL);
   SDL_Rect src_rect, dst_rect;
-  int src_x = 0, src_y = 0;
-  int dst_x = 0, dst_y = 0;
-  boolean fade_reverse = (fade_mode == FADE_MODE_FADE_IN ? TRUE : FALSE);
+  int src_x = x, src_y = y;
+  int dst_x = x, dst_y = y;
   unsigned int time_last, time_current;
   float alpha;
   int alpha_final;
 
   src_rect.x = src_x;
   src_rect.y = src_y;
-  src_rect.w = video.width;
-  src_rect.h = video.height;
+  src_rect.w = width;
+  src_rect.h = height;
 
-#ifdef FULLSCREEN_BUG
   dst_x += video_xoffset;
   dst_y += video_yoffset;
-#endif
 
   dst_rect.x = dst_x;
   dst_rect.y = dst_y;
-  dst_rect.w = video.width;
-  dst_rect.h = video.height;
-
-#if 0
-  if (!initialization_needed)
-  {
-    /* check if screen size has changed (can happen when toggling fullscreen) */
-    if (surface_screen_copy->w != surface_screen->w ||
-       surface_screen_copy->h != surface_screen->h)
-    {
-      SDL_FreeSurface(surface_screen_copy);
-      SDL_FreeSurface(surface_black);
-
-      initialization_needed = TRUE;
-    }
-  }
-#endif
+  dst_rect.w = width;
+  dst_rect.h = height;
 
   if (initialization_needed)
   {
@@ -323,39 +421,41 @@ void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay,
     else
       flags |= SDL_SWSURFACE;
 
-    /* create surface for temporary copy of screen buffer */
-    if ((surface_screen_copy =
+    /* create surface for temporary copy of screen buffer (source) */
+    if ((surface_source =
         SDL_CreateRGBSurface(flags,
-#if 1
                              video.width,
                              video.height,
-#else
-                             surface_screen->w,
-                             surface_screen->h,
-#endif
                              surface_screen->format->BitsPerPixel,
                              surface_screen->format->Rmask,
                              surface_screen->format->Gmask,
                              surface_screen->format->Bmask,
                              surface_screen->format->Amask)) == NULL)
-      Error(ERR_EXIT, "SDL_CreateRGBSurface(   ) failed: %s", SDL_GetError());
+      Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
+
+    /* create surface for cross-fading screen buffer (target) */
+    if ((surface_target =
+        SDL_CreateRGBSurface(flags,
+                             video.width,
+                             video.height,
+                             surface_screen->format->BitsPerPixel,
+                             surface_screen->format->Rmask,
+                             surface_screen->format->Gmask,
+                             surface_screen->format->Bmask,
+                             surface_screen->format->Amask)) == NULL)
+      Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
 
     /* create black surface for fading from/to black */
     if ((surface_black =
         SDL_CreateRGBSurface(flags,
-#if 1
                              video.width,
                              video.height,
-#else
-                             surface_screen->w,
-                             surface_screen->h,
-#endif
                              surface_screen->format->BitsPerPixel,
                              surface_screen->format->Rmask,
                              surface_screen->format->Gmask,
                              surface_screen->format->Bmask,
                              surface_screen->format->Amask)) == NULL)
-      Error(ERR_EXIT, "SDL_CreateRGBSurface(   ) failed: %s", SDL_GetError());
+      Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
 
     /* completely fill the surface with black color pixels */
     SDL_FillRect(surface_black, NULL,
@@ -364,11 +464,22 @@ void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay,
     initialization_needed = FALSE;
   }
 
-  /* copy the current screen backbuffer to the temporary screen copy buffer */
-  SDL_BlitSurface(surface_screen, &dst_rect, surface_screen_copy, &src_rect);
-
-  surface_cross = (fade_mode == FADE_MODE_CROSSFADE ? bitmap_cross->surface :
-                  surface_black);
+  /* copy source and target surfaces to temporary surfaces for fading */
+  if (fade_mode == FADE_MODE_CROSSFADE)
+  {
+    SDL_BlitSurface(surface_cross,  &src_rect, surface_source, &src_rect);
+    SDL_BlitSurface(surface_screen, &dst_rect, surface_target, &src_rect);
+  }
+  else if (fade_mode == FADE_MODE_FADE_IN)
+  {
+    SDL_BlitSurface(surface_black,  &src_rect, surface_source, &src_rect);
+    SDL_BlitSurface(surface_screen, &dst_rect, surface_target, &src_rect);
+  }
+  else         /* FADE_MODE_FADE_OUT */
+  {
+    SDL_BlitSurface(surface_screen, &dst_rect, surface_source, &src_rect);
+    SDL_BlitSurface(surface_black,  &src_rect, surface_target, &src_rect);
+  }
 
   time_current = SDL_GetTicks();
 
@@ -377,18 +488,21 @@ void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay,
     time_last = time_current;
     time_current = SDL_GetTicks();
     alpha += 255 * ((float)(time_current - time_last) / fade_delay);
-    alpha_final = (int)(fade_reverse ? 255.0 - alpha : alpha);
-    alpha_final = MIN(MAX(0, alpha_final), 255);
+    alpha_final = MIN(MAX(0, alpha), 255);
 
-    /* draw existing image to screen buffer */
-    SDL_BlitSurface(surface_screen_copy, &src_rect, surface_screen, &dst_rect);
+    /* draw existing (source) image to screen buffer */
+    SDL_BlitSurface(surface_source, &src_rect, surface_screen, &dst_rect);
 
-    /* draw new image to screen buffer using alpha blending */
-    SDL_SetAlpha(surface_cross, SDL_SRCALPHA, alpha_final);
-    SDL_BlitSurface(surface_cross, &src_rect, surface_screen, &dst_rect);
+    /* draw new (target) image to screen buffer using alpha blending */
+    SDL_SetAlpha(surface_target, SDL_SRCALPHA, alpha_final);
+    SDL_BlitSurface(surface_target, &src_rect, surface_screen, &dst_rect);
 
-    /* draw screen buffer to visible display */
+#if 1
+    /* only update the region of the screen that is affected from fading */
+    SDL_UpdateRect(surface_screen, dst_x, dst_y, width, height);
+#else
     SDL_Flip(surface_screen);
+#endif
   }
 
   Delay(post_delay);
@@ -411,13 +525,11 @@ void SDLDrawSimpleLine(Bitmap *dst_bitmap, int from_x, int from_y,
   rect.w = (to_x - from_x + 1);
   rect.h = (to_y - from_y + 1);
 
-#ifdef FULLSCREEN_BUG
   if (dst_bitmap == backbuffer || dst_bitmap == window)
   {
     rect.x += video_xoffset;
     rect.y += video_yoffset;
   }
-#endif
 
   SDL_FillRect(surface, &rect, color);
 }
@@ -425,7 +537,6 @@ void SDLDrawSimpleLine(Bitmap *dst_bitmap, int from_x, int from_y,
 void SDLDrawLine(Bitmap *dst_bitmap, int from_x, int from_y,
                 int to_x, int to_y, Uint32 color)
 {
-#ifdef FULLSCREEN_BUG
   if (dst_bitmap == backbuffer || dst_bitmap == window)
   {
     from_x += video_xoffset;
@@ -433,7 +544,6 @@ void SDLDrawLine(Bitmap *dst_bitmap, int from_x, int from_y,
     to_x += video_xoffset;
     to_y += video_yoffset;
   }
-#endif
 
   sge_Line(dst_bitmap->surface, from_x, from_y, to_x, to_y, color);
 }
@@ -472,13 +582,11 @@ Pixel SDLGetPixel(Bitmap *src_bitmap, int x, int y)
 {
   SDL_Surface *surface = src_bitmap->surface;
 
-#ifdef FULLSCREEN_BUG
   if (src_bitmap == backbuffer || src_bitmap == window)
   {
     x += video_xoffset;
     y += video_yoffset;
   }
-#endif
 
   switch (surface->format->BytesPerPixel)
   {
@@ -971,13 +1079,11 @@ void sge_LineRGB(SDL_Surface *Surface, Sint16 x1, Sint16 y1, Sint16 x2,
 
 void SDLPutPixel(Bitmap *dst_bitmap, int x, int y, Pixel pixel)
 {
-#ifdef FULLSCREEN_BUG
   if (dst_bitmap == backbuffer || dst_bitmap == window)
   {
     x += video_xoffset;
     y += video_yoffset;
   }
-#endif
 
   sge_PutPixel(dst_bitmap->surface, x, y, pixel);
 }
@@ -1046,12 +1152,69 @@ typedef struct
   Uint8 a;
 } tColorRGBA;
 
+int zoomSurfaceRGBA_scaleDownBy2(SDL_Surface *src, SDL_Surface *dst)
+{
+  int x, y;
+  tColorRGBA *sp, *csp, *dp;
+  int sgap, dgap;
+
+  /* pointer setup */
+  sp = csp = (tColorRGBA *) src->pixels;
+  dp = (tColorRGBA *) dst->pixels;
+  sgap = src->pitch - src->w * 4;
+  dgap = dst->pitch - dst->w * 4;
+
+  for (y = 0; y < dst->h; y++)
+  {
+    sp = csp;
+
+    for (x = 0; x < dst->w; x++)
+    {
+      tColorRGBA *sp0 = sp;
+      tColorRGBA *sp1 = (tColorRGBA *) ((Uint8 *) sp + src->pitch);
+      tColorRGBA *sp00 = &sp0[0];
+      tColorRGBA *sp01 = &sp0[1];
+      tColorRGBA *sp10 = &sp1[0];
+      tColorRGBA *sp11 = &sp1[1];
+      tColorRGBA new;
+
+      /* create new color pixel from all four source color pixels */
+      new.r = (sp00->r + sp01->r + sp10->r + sp11->r) / 4;
+      new.g = (sp00->g + sp01->g + sp10->g + sp11->g) / 4;
+      new.b = (sp00->b + sp01->b + sp10->b + sp11->b) / 4;
+      new.a = (sp00->a + sp01->a + sp10->a + sp11->a) / 4;
+
+      /* draw */
+      *dp = new;
+
+      /* advance source pointers */
+      sp += 2;
+
+      /* advance destination pointer */
+      dp++;
+    }
+
+    /* advance source pointer */
+    csp = (tColorRGBA *) ((Uint8 *) csp + 2 * src->pitch);
+
+    /* advance destination pointers */
+    dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
+  }
+
+  return 0;
+}
+
 int zoomSurfaceRGBA(SDL_Surface *src, SDL_Surface *dst)
 {
   int x, y, sx, sy, *sax, *say, *csax, *csay, csx, csy;
   tColorRGBA *sp, *csp, *dp;
   int sgap, dgap;
 
+  /* use specialized zoom function when scaling down to exactly half size */
+  if (src->w == 2 * dst->w &&
+      src->h == 2 * dst->h)
+    return zoomSurfaceRGBA_scaleDownBy2(src, dst);
+
   /* variable setup */
   sx = (int) (65536.0 * (float) src->w / (float) dst->w);
   sy = (int) (65536.0 * (float) src->h / (float) dst->h);
@@ -1338,6 +1501,7 @@ Bitmap *SDLLoadImage(char *filename)
   if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
   {
     SetError("IMG_Load(): %s", SDL_GetError());
+
     return NULL;
   }
 
@@ -1345,6 +1509,7 @@ Bitmap *SDLLoadImage(char *filename)
   if ((new_bitmap->surface = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
   {
     SetError("SDL_DisplayFormat(): %s", SDL_GetError());
+
     return NULL;
   }
 
@@ -1354,6 +1519,7 @@ Bitmap *SDLLoadImage(char *filename)
   if ((new_bitmap->surface_masked = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
   {
     SetError("SDL_DisplayFormat(): %s", SDL_GetError());
+
     return NULL;
   }
 
@@ -1458,7 +1624,6 @@ void SDLNextEvent(Event *event)
 {
   SDL_WaitEvent(event);
 
-#ifdef FULLSCREEN_BUG
   if (event->type == EVENT_BUTTONPRESS ||
       event->type == EVENT_BUTTONRELEASE)
   {
@@ -1482,7 +1647,6 @@ void SDLNextEvent(Event *event)
     else
       ((MotionEvent *)event)->y = 0;
   }
-#endif
 }
 
 
index f817e3294b34cc403d9ea2b78fb0cf2a03093c38..625b89e6fb756d90ab2ea62fdb762e6ec2f67526 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -82,11 +82,6 @@ struct MouseCursorInfo
   char mask[CURSOR_MAX_WIDTH * CURSOR_MAX_HEIGHT / 8];
 };
 
-struct XY
-{
-  short x, y;
-};
-
 
 /* SDL symbol definitions */
 
@@ -359,7 +354,7 @@ void SDLCreateBitmapContent(Bitmap *, int, int, int);
 void SDLFreeBitmapPointers(Bitmap *);
 void SDLCopyArea(Bitmap *, Bitmap *, int, int, int, int, int, int, int);
 void SDLFillRectangle(Bitmap *, int, int, int, int, Uint32);
-void SDLFadeScreen(Bitmap *, int, int, int);
+void SDLFadeRectangle(Bitmap *, int, int, int, int, int, int, int);
 void SDLDrawSimpleLine(Bitmap *, int, int, int, int, Uint32);
 void SDLDrawLine(Bitmap *, int, int, int, int, Uint32);
 Pixel SDLGetPixel(Bitmap *, int, int);
index a004bc82fda34659823eb1b50811b43d578098a4..4f00449473f8cadcb520d70c9a0ea542c40f4797 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
 #include <string.h>
 #include <unistd.h>
 
+#include "platform.h"
+
+#if !defined(PLATFORM_WIN32)
+#include <pwd.h>
+#include <sys/param.h>
+#endif
+
 #include "setup.h"
 #include "joystick.h"
 #include "text.h"
@@ -79,6 +86,9 @@ static char *levelclass_desc[NUM_LEVELCLASS_DESC] =
 
 #define MAX_COOKIE_LEN                         256
 
+static void setTreeInfoToDefaults(TreeInfo *, int);
+static int compareTreeInfoEntries(const void *, const void *);
+
 static int token_value_position   = TOKEN_VALUE_POSITION_DEFAULT;
 static int token_comment_position = TOKEN_COMMENT_POSITION_DEFAULT;
 
@@ -87,9 +97,9 @@ static int token_comment_position = TOKEN_COMMENT_POSITION_DEFAULT;
 /* file functions                                                            */
 /* ------------------------------------------------------------------------- */
 
-static char *getLevelClassDescription(TreeInfo *ldi)
+static char *getLevelClassDescription(TreeInfo *ti)
 {
-  int position = ldi->sort_priority / 100;
+  int position = ti->sort_priority / 100;
 
   if (position >= 0 && position < NUM_LEVELCLASS_DESC)
     return levelclass_desc[position];
@@ -100,7 +110,7 @@ static char *getLevelClassDescription(TreeInfo *ldi)
 static char *getUserLevelDir(char *level_subdir)
 {
   static char *userlevel_dir = NULL;
-  char *data_dir = getUserDataDir();
+  char *data_dir = getUserGameDataDir();
   char *userlevel_subdir = LEVELS_DIRECTORY;
 
   checked_free(userlevel_dir);
@@ -132,7 +142,7 @@ static char *getScoreDir(char *level_subdir)
 static char *getLevelSetupDir(char *level_subdir)
 {
   static char *levelsetup_dir = NULL;
-  char *data_dir = getUserDataDir();
+  char *data_dir = getUserGameDataDir();
   char *levelsetup_subdir = LEVELSETUP_DIRECTORY;
 
   checked_free(levelsetup_dir);
@@ -168,7 +178,7 @@ char *getCurrentLevelDir()
 static char *getTapeDir(char *level_subdir)
 {
   static char *tape_dir = NULL;
-  char *data_dir = getUserDataDir();
+  char *data_dir = getUserGameDataDir();
   char *tape_subdir = TAPES_DIRECTORY;
 
   checked_free(tape_dir);
@@ -258,7 +268,7 @@ static char *getUserGraphicsDir()
   static char *usergraphics_dir = NULL;
 
   if (usergraphics_dir == NULL)
-    usergraphics_dir = getPath2(getUserDataDir(), GRAPHICS_DIRECTORY);
+    usergraphics_dir = getPath2(getUserGameDataDir(), GRAPHICS_DIRECTORY);
 
   return usergraphics_dir;
 }
@@ -268,7 +278,7 @@ static char *getUserSoundsDir()
   static char *usersounds_dir = NULL;
 
   if (usersounds_dir == NULL)
-    usersounds_dir = getPath2(getUserDataDir(), SOUNDS_DIRECTORY);
+    usersounds_dir = getPath2(getUserGameDataDir(), SOUNDS_DIRECTORY);
 
   return usersounds_dir;
 }
@@ -278,7 +288,7 @@ static char *getUserMusicDir()
   static char *usermusic_dir = NULL;
 
   if (usermusic_dir == NULL)
-    usermusic_dir = getPath2(getUserDataDir(), MUSIC_DIRECTORY);
+    usermusic_dir = getPath2(getUserGameDataDir(), MUSIC_DIRECTORY);
 
   return usermusic_dir;
 }
@@ -764,7 +774,7 @@ char *getCustomMusicDirectory(void)
 
 void InitTapeDirectory(char *level_subdir)
 {
-  createDirectory(getUserDataDir(), "user data", PERMS_PRIVATE);
+  createDirectory(getUserGameDataDir(), "user data", PERMS_PRIVATE);
   createDirectory(getTapeDir(NULL), "main tape", PERMS_PRIVATE);
   createDirectory(getTapeDir(level_subdir), "level tape", PERMS_PRIVATE);
 }
@@ -782,7 +792,7 @@ void InitUserLevelDirectory(char *level_subdir)
 {
   if (!fileExists(getUserLevelDir(level_subdir)))
   {
-    createDirectory(getUserDataDir(), "user data", PERMS_PRIVATE);
+    createDirectory(getUserGameDataDir(), "user data", PERMS_PRIVATE);
     createDirectory(getUserLevelDir(NULL), "main user level", PERMS_PRIVATE);
     createDirectory(getUserLevelDir(level_subdir), "user level",PERMS_PRIVATE);
 
@@ -792,7 +802,7 @@ void InitUserLevelDirectory(char *level_subdir)
 
 void InitLevelSetupDirectory(char *level_subdir)
 {
-  createDirectory(getUserDataDir(), "user data", PERMS_PRIVATE);
+  createDirectory(getUserGameDataDir(), "user data", PERMS_PRIVATE);
   createDirectory(getLevelSetupDir(NULL), "main level setup", PERMS_PRIVATE);
   createDirectory(getLevelSetupDir(level_subdir), "level setup",PERMS_PRIVATE);
 }
@@ -807,6 +817,15 @@ TreeInfo *newTreeInfo()
   return checked_calloc(sizeof(TreeInfo));
 }
 
+TreeInfo *newTreeInfo_setDefaults(int type)
+{
+  TreeInfo *ti = newTreeInfo();
+
+  setTreeInfoToDefaults(ti, type);
+
+  return ti;
+}
+
 void pushTreeInfo(TreeInfo **node_first, TreeInfo *node_new)
 {
   node_new->next = *node_first;
@@ -1013,8 +1032,9 @@ void dumpTreeInfo(TreeInfo *node, int depth)
   }
 }
 
-void sortTreeInfo(TreeInfo **node_first,
-                 int (*compare_function)(const void *, const void *))
+void sortTreeInfoBySortFunction(TreeInfo **node_first,
+                               int (*compare_function)(const void *,
+                                                       const void *))
 {
   int num_nodes = numTreeInfo(*node_first);
   TreeInfo **sort_array;
@@ -1055,12 +1075,17 @@ void sortTreeInfo(TreeInfo **node_first,
   while (node)
   {
     if (node->node_group != NULL)
-      sortTreeInfo(&node->node_group, compare_function);
+      sortTreeInfoBySortFunction(&node->node_group, compare_function);
 
     node = node->next;
   }
 }
 
+void sortTreeInfo(TreeInfo **node_first)
+{
+  sortTreeInfoBySortFunction(node_first, compareTreeInfoEntries);
+}
+
 
 /* ========================================================================= */
 /* some stuff from "files.c"                                                 */
@@ -1108,14 +1133,36 @@ void sortTreeInfo(TreeInfo **node_first,
 #define FILE_PERMS_PRIVATE     (MODE_R_ALL | MODE_W_PRIVATE)
 #define FILE_PERMS_PUBLIC      (MODE_R_ALL | MODE_W_PUBLIC)
 
-char *getUserDataDir(void)
+char *getHomeDir()
 {
-  static char *userdata_dir = NULL;
+  static char *dir = NULL;
+
+#if defined(PLATFORM_WIN32)
+  if (dir == NULL)
+  {
+    dir = checked_malloc(MAX_PATH + 1);
 
-  if (userdata_dir == NULL)
-    userdata_dir = getPath2(getHomeDir(), program.userdata_directory);
+    if (!SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, dir)))
+      strcpy(dir, ".");
+  }
+#elif defined(PLATFORM_UNIX)
+  if (dir == NULL)
+  {
+    if ((dir = getenv("HOME")) == NULL)
+    {
+      struct passwd *pwd;
 
-  return userdata_dir;
+      if ((pwd = getpwuid(getuid())) != NULL)
+       dir = getStringCopy(pwd->pw_dir);
+      else
+       dir = ".";
+    }
+  }
+#else
+  dir = ".";
+#endif
+
+  return dir;
 }
 
 char *getCommonDataDir(void)
@@ -1129,7 +1176,7 @@ char *getCommonDataDir(void)
 
     if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_DOCUMENTS, NULL, 0, dir))
        && !strEqual(dir, ""))          /* empty for Windows 95/98 */
-      common_data_dir = getPath2(dir, program.userdata_directory);
+      common_data_dir = getPath2(dir, program.userdata_subdir);
     else
       common_data_dir = options.rw_base_directory;
   }
@@ -1141,9 +1188,59 @@ char *getCommonDataDir(void)
   return common_data_dir;
 }
 
+char *getPersonalDataDir(void)
+{
+  static char *personal_data_dir = NULL;
+
+#if defined(PLATFORM_MACOSX)
+  if (personal_data_dir == NULL)
+    personal_data_dir = getPath2(getHomeDir(), "Documents");
+#else
+  if (personal_data_dir == NULL)
+    personal_data_dir = getHomeDir();
+#endif
+
+  return personal_data_dir;
+}
+
+char *getUserGameDataDir(void)
+{
+  static char *user_game_data_dir = NULL;
+
+  if (user_game_data_dir == NULL)
+    user_game_data_dir = getPath2(getPersonalDataDir(),
+                                 program.userdata_subdir);
+
+  return user_game_data_dir;
+}
+
+void updateUserGameDataDir()
+{
+#if defined(PLATFORM_MACOSX)
+  char *userdata_dir_old = getPath2(getHomeDir(), program.userdata_subdir_unix);
+  char *userdata_dir_new = getUserGameDataDir();       /* do not free() this */
+
+  /* convert old Unix style game data directory to Mac OS X style, if needed */
+  if (fileExists(userdata_dir_old) && !fileExists(userdata_dir_new))
+  {
+    if (rename(userdata_dir_old, userdata_dir_new) != 0)
+    {
+      Error(ERR_WARN, "cannot move game data directory '%s' to '%s'",
+           userdata_dir_old, userdata_dir_new);
+
+      /* continue using Unix style data directory -- this should not happen */
+      program.userdata_path = getPath2(getPersonalDataDir(),
+                                      program.userdata_subdir_unix);
+    }
+  }
+
+  free(userdata_dir_old);
+#endif
+}
+
 char *getSetupDir()
 {
-  return getUserDataDir();
+  return getUserGameDataDir();
 }
 
 static mode_t posix_umask(mode_t mask)
@@ -1183,7 +1280,7 @@ void createDirectory(char *dir, char *text, int permission_class)
 
 void InitUserDataDirectory()
 {
-  createDirectory(getUserDataDir(), "user data", PERMS_PRIVATE);
+  createDirectory(getUserGameDataDir(), "user data", PERMS_PRIVATE);
 }
 
 void SetFilePermissions(char *filename, int permission_class)
@@ -1690,164 +1787,170 @@ static struct TokenInfo levelinfo_tokens[] =
   { TYPE_BOOLEAN,      &ldi.skip_levels,       "skip_levels"           }
 };
 
-static void setTreeInfoToDefaults(TreeInfo *ldi, int type)
+static void setTreeInfoToDefaults(TreeInfo *ti, int type)
 {
-  ldi->type = type;
+  ti->type = type;
+
+  ti->node_top = (ti->type == TREE_TYPE_LEVEL_DIR    ? &leveldir_first :
+                 ti->type == TREE_TYPE_GRAPHICS_DIR ? &artwork.gfx_first :
+                 ti->type == TREE_TYPE_SOUNDS_DIR   ? &artwork.snd_first :
+                 ti->type == TREE_TYPE_MUSIC_DIR    ? &artwork.mus_first :
+                 NULL);
 
-  ldi->node_top = (ldi->type == TREE_TYPE_LEVEL_DIR ? &leveldir_first :
-                  ldi->type == TREE_TYPE_GRAPHICS_DIR ? &artwork.gfx_first :
-                  ldi->type == TREE_TYPE_SOUNDS_DIR ? &artwork.snd_first :
-                  ldi->type == TREE_TYPE_MUSIC_DIR ? &artwork.mus_first :
-                  NULL);
+  ti->node_parent = NULL;
+  ti->node_group = NULL;
+  ti->next = NULL;
 
-  ldi->node_parent = NULL;
-  ldi->node_group = NULL;
-  ldi->next = NULL;
+  ti->cl_first = -1;
+  ti->cl_cursor = -1;
 
-  ldi->cl_first = -1;
-  ldi->cl_cursor = -1;
+  ti->subdir = NULL;
+  ti->fullpath = NULL;
+  ti->basepath = NULL;
+  ti->identifier = NULL;
+  ti->name = getStringCopy(ANONYMOUS_NAME);
+  ti->name_sorting = NULL;
+  ti->author = getStringCopy(ANONYMOUS_NAME);
 
-  ldi->subdir = NULL;
-  ldi->fullpath = NULL;
-  ldi->basepath = NULL;
-  ldi->identifier = NULL;
-  ldi->name = getStringCopy(ANONYMOUS_NAME);
-  ldi->name_sorting = NULL;
-  ldi->author = getStringCopy(ANONYMOUS_NAME);
+  ti->sort_priority = LEVELCLASS_UNDEFINED;    /* default: least priority */
+  ti->latest_engine = FALSE;                   /* default: get from level */
+  ti->parent_link = FALSE;
+  ti->in_user_dir = FALSE;
+  ti->user_defined = FALSE;
+  ti->color = 0;
+  ti->class_desc = NULL;
 
-  ldi->sort_priority = LEVELCLASS_UNDEFINED;   /* default: least priority */
-  ldi->latest_engine = FALSE;                  /* default: get from level */
-  ldi->parent_link = FALSE;
-  ldi->in_user_dir = FALSE;
-  ldi->user_defined = FALSE;
-  ldi->color = 0;
-  ldi->class_desc = NULL;
+  ti->infotext = getStringCopy(TREE_INFOTEXT(ti->type));
 
-  if (ldi->type == TREE_TYPE_LEVEL_DIR)
+  if (ti->type == TREE_TYPE_LEVEL_DIR)
   {
-    ldi->imported_from = NULL;
-    ldi->imported_by = NULL;
+    ti->imported_from = NULL;
+    ti->imported_by = NULL;
 
-    ldi->graphics_set_ecs = NULL;
-    ldi->graphics_set_aga = NULL;
-    ldi->graphics_set = NULL;
-    ldi->sounds_set = NULL;
-    ldi->music_set = NULL;
-    ldi->graphics_path = getStringCopy(UNDEFINED_FILENAME);
-    ldi->sounds_path = getStringCopy(UNDEFINED_FILENAME);
-    ldi->music_path = getStringCopy(UNDEFINED_FILENAME);
+    ti->graphics_set_ecs = NULL;
+    ti->graphics_set_aga = NULL;
+    ti->graphics_set = NULL;
+    ti->sounds_set = NULL;
+    ti->music_set = NULL;
+    ti->graphics_path = getStringCopy(UNDEFINED_FILENAME);
+    ti->sounds_path = getStringCopy(UNDEFINED_FILENAME);
+    ti->music_path = getStringCopy(UNDEFINED_FILENAME);
 
-    ldi->level_filename = NULL;
-    ldi->level_filetype = NULL;
+    ti->level_filename = NULL;
+    ti->level_filetype = NULL;
 
-    ldi->levels = 0;
-    ldi->first_level = 0;
-    ldi->last_level = 0;
-    ldi->level_group = FALSE;
-    ldi->handicap_level = 0;
-    ldi->readonly = TRUE;
-    ldi->handicap = TRUE;
-    ldi->skip_levels = FALSE;
+    ti->levels = 0;
+    ti->first_level = 0;
+    ti->last_level = 0;
+    ti->level_group = FALSE;
+    ti->handicap_level = 0;
+    ti->readonly = TRUE;
+    ti->handicap = TRUE;
+    ti->skip_levels = FALSE;
   }
 }
 
-static void setTreeInfoToDefaultsFromParent(TreeInfo *ldi, TreeInfo *parent)
+static void setTreeInfoToDefaultsFromParent(TreeInfo *ti, TreeInfo *parent)
 {
   if (parent == NULL)
   {
     Error(ERR_WARN, "setTreeInfoToDefaultsFromParent(): parent == NULL");
 
-    setTreeInfoToDefaults(ldi, TREE_TYPE_UNDEFINED);
+    setTreeInfoToDefaults(ti, TREE_TYPE_UNDEFINED);
 
     return;
   }
 
   /* copy all values from the parent structure */
 
-  ldi->type = parent->type;
+  ti->type = parent->type;
+
+  ti->node_top = parent->node_top;
+  ti->node_parent = parent;
+  ti->node_group = NULL;
+  ti->next = NULL;
 
-  ldi->node_top = parent->node_top;
-  ldi->node_parent = parent;
-  ldi->node_group = NULL;
-  ldi->next = NULL;
+  ti->cl_first = -1;
+  ti->cl_cursor = -1;
 
-  ldi->cl_first = -1;
-  ldi->cl_cursor = -1;
+  ti->subdir = NULL;
+  ti->fullpath = NULL;
+  ti->basepath = NULL;
+  ti->identifier = NULL;
+  ti->name = getStringCopy(ANONYMOUS_NAME);
+  ti->name_sorting = NULL;
+  ti->author = getStringCopy(parent->author);
 
-  ldi->subdir = NULL;
-  ldi->fullpath = NULL;
-  ldi->basepath = NULL;
-  ldi->identifier = NULL;
-  ldi->name = getStringCopy(ANONYMOUS_NAME);
-  ldi->name_sorting = NULL;
-  ldi->author = getStringCopy(parent->author);
+  ti->sort_priority = parent->sort_priority;
+  ti->latest_engine = parent->latest_engine;
+  ti->parent_link = FALSE;
+  ti->in_user_dir = parent->in_user_dir;
+  ti->user_defined = parent->user_defined;
+  ti->color = parent->color;
+  ti->class_desc = getStringCopy(parent->class_desc);
 
-  ldi->sort_priority = parent->sort_priority;
-  ldi->latest_engine = parent->latest_engine;
-  ldi->parent_link = FALSE;
-  ldi->in_user_dir = parent->in_user_dir;
-  ldi->user_defined = parent->user_defined;
-  ldi->color = parent->color;
-  ldi->class_desc = getStringCopy(parent->class_desc);
+  ti->infotext = getStringCopy(parent->infotext);
 
-  if (ldi->type == TREE_TYPE_LEVEL_DIR)
+  if (ti->type == TREE_TYPE_LEVEL_DIR)
   {
-    ldi->imported_from = getStringCopy(parent->imported_from);
-    ldi->imported_by = getStringCopy(parent->imported_by);
+    ti->imported_from = getStringCopy(parent->imported_from);
+    ti->imported_by = getStringCopy(parent->imported_by);
 
-    ldi->graphics_set_ecs = NULL;
-    ldi->graphics_set_aga = NULL;
-    ldi->graphics_set = NULL;
-    ldi->sounds_set = NULL;
-    ldi->music_set = NULL;
-    ldi->graphics_path = getStringCopy(UNDEFINED_FILENAME);
-    ldi->sounds_path = getStringCopy(UNDEFINED_FILENAME);
-    ldi->music_path = getStringCopy(UNDEFINED_FILENAME);
+    ti->graphics_set_ecs = NULL;
+    ti->graphics_set_aga = NULL;
+    ti->graphics_set = NULL;
+    ti->sounds_set = NULL;
+    ti->music_set = NULL;
+    ti->graphics_path = getStringCopy(UNDEFINED_FILENAME);
+    ti->sounds_path = getStringCopy(UNDEFINED_FILENAME);
+    ti->music_path = getStringCopy(UNDEFINED_FILENAME);
 
-    ldi->level_filename = NULL;
-    ldi->level_filetype = NULL;
+    ti->level_filename = NULL;
+    ti->level_filetype = NULL;
 
-    ldi->levels = 0;
-    ldi->first_level = 0;
-    ldi->last_level = 0;
-    ldi->level_group = FALSE;
-    ldi->handicap_level = 0;
-    ldi->readonly = TRUE;
-    ldi->handicap = TRUE;
-    ldi->skip_levels = FALSE;
+    ti->levels = 0;
+    ti->first_level = 0;
+    ti->last_level = 0;
+    ti->level_group = FALSE;
+    ti->handicap_level = 0;
+    ti->readonly = TRUE;
+    ti->handicap = TRUE;
+    ti->skip_levels = FALSE;
   }
 }
 
-static void freeTreeInfo(TreeInfo *ldi)
+static void freeTreeInfo(TreeInfo *ti)
 {
-  checked_free(ldi->subdir);
-  checked_free(ldi->fullpath);
-  checked_free(ldi->basepath);
-  checked_free(ldi->identifier);
+  checked_free(ti->subdir);
+  checked_free(ti->fullpath);
+  checked_free(ti->basepath);
+  checked_free(ti->identifier);
 
-  checked_free(ldi->name);
-  checked_free(ldi->name_sorting);
-  checked_free(ldi->author);
+  checked_free(ti->name);
+  checked_free(ti->name_sorting);
+  checked_free(ti->author);
 
-  checked_free(ldi->class_desc);
+  checked_free(ti->class_desc);
 
-  if (ldi->type == TREE_TYPE_LEVEL_DIR)
+  checked_free(ti->infotext);
+
+  if (ti->type == TREE_TYPE_LEVEL_DIR)
   {
-    checked_free(ldi->imported_from);
-    checked_free(ldi->imported_by);
+    checked_free(ti->imported_from);
+    checked_free(ti->imported_by);
 
-    checked_free(ldi->graphics_set_ecs);
-    checked_free(ldi->graphics_set_aga);
-    checked_free(ldi->graphics_set);
-    checked_free(ldi->sounds_set);
-    checked_free(ldi->music_set);
+    checked_free(ti->graphics_set_ecs);
+    checked_free(ti->graphics_set_aga);
+    checked_free(ti->graphics_set);
+    checked_free(ti->sounds_set);
+    checked_free(ti->music_set);
 
-    checked_free(ldi->graphics_path);
-    checked_free(ldi->sounds_path);
-    checked_free(ldi->music_path);
+    checked_free(ti->graphics_path);
+    checked_free(ti->sounds_path);
+    checked_free(ti->music_path);
 
-    checked_free(ldi->level_filename);
-    checked_free(ldi->level_filetype);
+    checked_free(ti->level_filename);
+    checked_free(ti->level_filetype);
   }
 }
 
@@ -2183,14 +2286,12 @@ void LoadLevelInfo()
   LoadLevelInfoFromLevelDir(&leveldir_first, NULL, options.level_directory);
   LoadLevelInfoFromLevelDir(&leveldir_first, NULL, getUserLevelDir(NULL));
 
-#if 1
   /* after loading all level set information, clone the level directory tree
      and remove all level sets without levels (these may still contain artwork
      to be offered in the setup menu as "custom artwork", and are therefore
      checked for existing artwork in the function "LoadLevelArtworkInfo()") */
   leveldir_first_all = leveldir_first;
   cloneTree(&leveldir_first, leveldir_first_all, TRUE);
-#endif
 
   AdjustGraphicsForEMC();
 
@@ -2200,7 +2301,7 @@ void LoadLevelInfo()
   if (leveldir_first == NULL)
     Error(ERR_EXIT, "cannot find any valid level series in any directory");
 
-  sortTreeInfo(&leveldir_first, compareTreeInfoEntries);
+  sortTreeInfo(&leveldir_first);
 
 #if 0
   dumpTreeInfo(leveldir_first, 0);
@@ -2495,9 +2596,9 @@ void LoadArtworkInfo()
   printf("music set == %s\n\n", artwork.mus_current_identifier);
 #endif
 
-  sortTreeInfo(&artwork.gfx_first, compareTreeInfoEntries);
-  sortTreeInfo(&artwork.snd_first, compareTreeInfoEntries);
-  sortTreeInfo(&artwork.mus_first, compareTreeInfoEntries);
+  sortTreeInfo(&artwork.gfx_first);
+  sortTreeInfo(&artwork.snd_first);
+  sortTreeInfo(&artwork.mus_first);
 
 #if 0
   dumpTreeInfo(artwork.gfx_first, 0);
@@ -2590,9 +2691,9 @@ void LoadLevelArtworkInfo()
       artwork.mus_current = getFirstValidTreeInfoEntry(artwork.mus_first);
   }
 
-  sortTreeInfo(&artwork.gfx_first, compareTreeInfoEntries);
-  sortTreeInfo(&artwork.snd_first, compareTreeInfoEntries);
-  sortTreeInfo(&artwork.mus_first, compareTreeInfoEntries);
+  sortTreeInfo(&artwork.gfx_first);
+  sortTreeInfo(&artwork.snd_first);
+  sortTreeInfo(&artwork.mus_first);
 
 #if 0
   dumpTreeInfo(artwork.gfx_first, 0);
index ab46527686333faf1190cb5be99b16d7505be880..55440806ab4592f26d810f9bf261a30bf3c9374e 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
 
 /* additional values for setup screen */
 #define TYPE_ENTER_SCREEN              (1 << 9)
-#define TYPE_ENTER_MENU                        (1 << 10)
-#define TYPE_LEAVE_MENU                        (1 << 11)
-#define TYPE_EMPTY                     (1 << 12)
-#define TYPE_KEYTEXT                   (1 << 13)
+#define TYPE_LEAVE_SCREEN              (1 << 10)
+#define TYPE_ENTER_MENU                        (1 << 11)
+#define TYPE_LEAVE_MENU                        (1 << 12)
+#define TYPE_ENTER_LIST                        (1 << 13)
+#define TYPE_LEAVE_LIST                        (1 << 14)
+#define TYPE_EMPTY                     (1 << 15)
+#define TYPE_KEYTEXT                   (1 << 16)
 
-#define TYPE_GHOSTED                   (1 << 14)
-#define TYPE_QUERY                     (1 << 15)
+#define TYPE_GHOSTED                   (1 << 17)
+#define TYPE_QUERY                     (1 << 18)
 
 /* additional values for internal purposes */
-#define TYPE_BITFIELD                  (1 << 16)
-#define TYPE_ELEMENT                   (1 << 17)
-#define TYPE_CONTENT                   (1 << 18)
-#define TYPE_ELEMENT_LIST              (1 << 19)
-#define TYPE_CONTENT_LIST              (1 << 20)
+#define TYPE_BITFIELD                  (1 << 19)
+#define TYPE_ELEMENT                   (1 << 20)
+#define TYPE_CONTENT                   (1 << 21)
+#define TYPE_ELEMENT_LIST              (1 << 22)
+#define TYPE_CONTENT_LIST              (1 << 23)
 
 /* derived values for setup file handling */
 #define TYPE_BOOLEAN_STYLE             (TYPE_BOOLEAN | \
 
 #define TYPE_SKIP_ENTRY                        (TYPE_EMPTY             | \
                                         TYPE_KEY               | \
-                                        TYPE_STRING)
+                                        TYPE_STRING            | \
+                                        TYPE_GHOSTED)
 
-#define TYPE_ENTER_OR_LEAVE_MENU       (TYPE_ENTER_SCREEN      | \
+#define TYPE_ENTER                     (TYPE_ENTER_SCREEN      | \
                                         TYPE_ENTER_MENU        | \
-                                        TYPE_LEAVE_MENU)
+                                        TYPE_ENTER_LIST)
+
+#define TYPE_LEAVE                     (TYPE_LEAVE_SCREEN      | \
+                                        TYPE_LEAVE_MENU        | \
+                                        TYPE_LEAVE_LIST)
+
+#define TYPE_ENTER_OR_LEAVE            (TYPE_ENTER | TYPE_LEAVE)
 
 /* cookie token for file identifier and version number */
 #define TOKEN_STR_FILE_IDENTIFIER      "file_identifier"
@@ -235,6 +245,7 @@ void InitUserLevelDirectory(char *);
 void InitLevelSetupDirectory(char *);
 
 TreeInfo *newTreeInfo();
+TreeInfo *newTreeInfo_setDefaults(int);
 void pushTreeInfo(TreeInfo **, TreeInfo *);
 int numTreeInfo(TreeInfo *);
 boolean validLevelSeries(TreeInfo *);
@@ -245,14 +256,20 @@ int posTreeInfo(TreeInfo *);
 TreeInfo *getTreeInfoFromPos(TreeInfo *, int);
 TreeInfo *getTreeInfoFromIdentifier(TreeInfo *, char *);
 void dumpTreeInfo(TreeInfo *, int);
-void sortTreeInfo(TreeInfo **,
-                 int (*compare_function)(const void *, const void *));
+void sortTreeInfoBySortFunction(TreeInfo **,
+                               int (*compare_function)(const void *,
+                                                       const void *));
+void sortTreeInfo(TreeInfo **);
 
-char *getUserDataDir(void);
+char *getHomeDir(void);
 char *getCommonDataDir(void);
+char *getPersonalDataDir(void);
+char *getUserGameDataDir(void);
 char *getSetupDir(void);
 char *getCurrentLevelDir(void);
 
+void updateUserGameDataDir(void);
+
 void createDirectory(char *, char *, int);
 void InitUserDataDirectory(void);
 void SetFilePermissions(char *, int);
index d75acaf3f0c5b186f204147702f0eddf7d4311a0..be88d8e105196a769f585d32f2505effff036eb8 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index ca1e26a6009dc1cc98750396cb2ac7ea2de89299..fc111e9ba6697ecd36f01361620cd848417e5450 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 3c460375b03aa4ec67d7a0474413726a298a5d2f..f3696277749fe3c6a987c18e77118d1306a0247d 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -69,22 +69,27 @@ int                 FrameCounter = 0;
 /* ========================================================================= */
 
 void InitProgramInfo(char *argv0,
-                    char *userdata_directory, char *program_title,
-                    char *window_title, char *icon_title,
+                    char *userdata_subdir, char *userdata_subdir_unix,
+                    char *program_title, char *window_title, char *icon_title,
                     char *x11_icon_filename, char *x11_iconmask_filename,
-                    char *msdos_cursor_filename,
+                    char *sdl_icon_filename, char *msdos_cursor_filename,
                     char *cookie_prefix, char *filename_prefix,
                     int program_version)
 {
   program.command_basepath = getBasePath(argv0);
   program.command_basename = getBaseName(argv0);
 
-  program.userdata_directory = userdata_directory;
+  program.userdata_subdir = userdata_subdir;
+  program.userdata_subdir_unix = userdata_subdir_unix;
+  program.userdata_path = getUserGameDataDir();
+
   program.program_title = program_title;
   program.window_title = window_title;
   program.icon_title = icon_title;
+
   program.x11_icon_filename = x11_icon_filename;
   program.x11_iconmask_filename = x11_iconmask_filename;
+  program.sdl_icon_filename = sdl_icon_filename;
   program.msdos_cursor_filename = msdos_cursor_filename;
 
   program.cookie_prefix = cookie_prefix;
@@ -93,6 +98,9 @@ void InitProgramInfo(char *argv0,
   program.version_major = VERSION_MAJOR(program_version);
   program.version_minor = VERSION_MINOR(program_version);
   program.version_patch = VERSION_PATCH(program_version);
+
+  program.error_filename = getErrorFilename(ERROR_BASENAME);
+  program.error_file = stderr;
 }
 
 void InitExitFunction(void (*exit_function)(int))
@@ -113,7 +121,14 @@ void InitPlatformDependentStuff(void)
 {
 #if defined(PLATFORM_MSDOS)
   _fmode = O_BINARY;
-  initErrorFile();
+#endif
+
+#if defined(PLATFORM_MACOSX)
+  updateUserGameDataDir();
+#endif
+
+#if !defined(PLATFORM_UNIX) || defined(PLATFORM_MACOSX)
+  openErrorFile();
 #endif
 
 #if defined(TARGET_SDL)
@@ -126,6 +141,10 @@ void InitPlatformDependentStuff(void)
 
 void ClosePlatformDependentStuff(void)
 {
+#if defined(PLATFORM_WIN32) || defined(PLATFORM_MSDOS)
+  closeErrorFile();
+#endif
+
 #if defined(PLATFORM_MSDOS)
   dumpErrorFile();
 #endif
@@ -308,8 +327,11 @@ void InitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
   video.width = width;
   video.height = height;
   video.depth = GetRealDepth(depth);
+
   video.fullscreen_available = FULLSCREEN_STATUS;
   video.fullscreen_enabled = FALSE;
+  video.fullscreen_modes = NULL;
+  video.fullscreen_mode_current = NULL;
 
 #if defined(TARGET_SDL)
   SDLInitVideoBuffer(backbuffer, window, fullscreen);
@@ -436,13 +458,15 @@ void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap,
              dst_x, dst_y, BLIT_OPAQUE);
 }
 
-void FadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay,
-               int post_delay)
+void FadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height,
+                  int fade_mode, int fade_delay, int post_delay)
 {
 #if defined(TARGET_SDL)
-  SDLFadeScreen(bitmap_cross, fade_mode, fade_delay, post_delay);
+  SDLFadeRectangle(bitmap_cross, x, y, width, height,
+                  fade_mode, fade_delay, post_delay);
 #else
-  X11FadeScreen(bitmap_cross, fade_mode, fade_delay, post_delay);
+  X11FadeRectangle(bitmap_cross, x, y, width, height,
+                  fade_mode, fade_delay, post_delay);
 #endif
 }
 
@@ -804,8 +828,8 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor,
                                boolean create_small_bitmaps)
 {
   Bitmap swap_bitmap;
-  Bitmap *new_bitmap, *tmp_bitmap_1, *tmp_bitmap_2, *tmp_bitmap_8;
-  int width_1, height_1, width_2, height_2, width_8, height_8;
+  Bitmap *new_bitmap, *tmp_bitmap_1, *tmp_bitmap_2, *tmp_bitmap_4,*tmp_bitmap_8;
+  int width_1, height_1, width_2, height_2, width_4, height_4, width_8,height_8;
   int new_width, new_height;
 
   /* calculate new image dimensions for normal sized image */
@@ -819,13 +843,15 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor,
     tmp_bitmap_1 = old_bitmap;
 
   /* this is only needed to make compilers happy */
-  tmp_bitmap_2 = tmp_bitmap_8 = NULL;
+  tmp_bitmap_2 = tmp_bitmap_4 = tmp_bitmap_8 = NULL;
 
   if (create_small_bitmaps)
   {
     /* calculate new image dimensions for small images */
     width_2  = width_1  / 2;
     height_2 = height_1 / 2;
+    width_4  = width_1  / 4;
+    height_4 = height_1 / 4;
     width_8  = width_1  / 8;
     height_8 = height_1 / 8;
 
@@ -835,9 +861,15 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor,
     else
       tmp_bitmap_2 = old_bitmap;
 
+    /* get image with 1/4 of normal size (for use in the level editor) */
+    if (zoom_factor != 4)
+      tmp_bitmap_4 = ZoomBitmap(tmp_bitmap_2, width_2 / 2, height_2 / 2);
+    else
+      tmp_bitmap_4 = old_bitmap;
+
     /* get image with 1/8 of normal size (for use on the preview screen) */
     if (zoom_factor != 8)
-      tmp_bitmap_8 = ZoomBitmap(tmp_bitmap_1, width_1 / 8, height_1 / 8);
+      tmp_bitmap_8 = ZoomBitmap(tmp_bitmap_4, width_4 / 2, height_4 / 2);
     else
       tmp_bitmap_8 = old_bitmap;
   }
@@ -877,6 +909,8 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor,
     BlitBitmap(tmp_bitmap_1, new_bitmap, 0, 0, width_1, height_1, 0, 0);
     BlitBitmap(tmp_bitmap_2, new_bitmap, 0, 0, width_1 / 2, height_1 / 2,
               0, height_1);
+    BlitBitmap(tmp_bitmap_4, new_bitmap, 0, 0, width_1 / 4, height_1 / 4,
+              width_1 / 2, height_1);
     BlitBitmap(tmp_bitmap_8, new_bitmap, 0, 0, width_1 / 8, height_1 / 8,
               3 * width_1 / 4, height_1);
   }
@@ -897,11 +931,14 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor,
     if (zoom_factor != 2)
       FreeBitmap(tmp_bitmap_2);
 
+    if (zoom_factor != 4)
+      FreeBitmap(tmp_bitmap_4);
+
     if (zoom_factor != 8)
       FreeBitmap(tmp_bitmap_8);
   }
 
-  /* replace image with extended image (containing normal, 1/2 and 1/8 size) */
+  /* replace image with extended image (containing 1/1, 1/2, 1/4, 1/8 size) */
 #if defined(TARGET_SDL)
   swap_bitmap.surface = old_bitmap->surface;
   old_bitmap->surface = new_bitmap->surface;
@@ -1196,7 +1233,6 @@ KeyMod HandleKeyModState(Key key, int key_status)
 {
   static KeyMod current_modifiers = KMOD_None;
 
-#if !defined(TARGET_SDL)
   if (key != KSYM_UNDEFINED)   /* new key => check for modifier key change */
   {
     KeyMod new_modifier = KMOD_None;
@@ -1236,7 +1272,6 @@ KeyMod HandleKeyModState(Key key, int key_status)
     else
       current_modifiers &= ~new_modifier;
   }
-#endif
 
   return current_modifiers;
 }
@@ -1250,6 +1285,17 @@ KeyMod GetKeyModState()
 #endif
 }
 
+KeyMod GetKeyModStateFromEvents()
+{
+  /* always use key modifier state as tracked from key events (this is needed
+     if the modifier key event was injected into the event queue, but the key
+     was not really pressed on keyboard -- SDL_GetModState() seems to directly
+     query the keys as held pressed on the keyboard) -- this case is currently
+     only used to filter out clipboard insert events from "True X-Mouse" tool */
+
+  return HandleKeyModState(KSYM_UNDEFINED, 0);
+}
+
 boolean CheckCloseWindowEvent(ClientMessageEvent *event)
 {
   if (event->type != EVENT_CLIENTMESSAGE)
index 9d90cd9969e29540aa0548cec0a51b01435dcd88..99d7c59deaadd253fa089649b09480745bbf2942 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
 #define MB_LEFTBUTTON                  1
 #define MB_MIDDLEBUTTON                        2
 #define MB_RIGHTBUTTON                 3
-
+#define MB_WHEEL_UP                    4
+#define MB_WHEEL_DOWN                  5
+#define MB_WHEEL_LEFT                  6
+#define MB_WHEEL_RIGHT                 7
+#define IS_WHEEL_BUTTON_VERTICAL(b)    ((b) >= MB_WHEEL_UP &&          \
+                                        (b) <= MB_WHEEL_DOWN)
+#define IS_WHEEL_BUTTON_HORIZONTAL(b)  ((b) >= MB_WHEEL_LEFT &&        \
+                                        (b) <= MB_WHEEL_RIGHT)
+#define IS_WHEEL_BUTTON(b)             ((b) >= MB_WHEEL_UP &&          \
+                                        (b) <= MB_WHEEL_DOWN)
+#define DEFAULT_WHEEL_STEPS            3
 
 /* values for move directions */
 #define MV_BIT_LEFT                    0
 #define SCOREFILE_EXTENSION    "sco"
 #endif
 
+#define ERROR_BASENAME         "stderr.txt"
+
+#define CHAR_PATH_SEPARATOR_UNIX       '/'
+#define CHAR_PATH_SEPARATOR_DOS                '\\'
+
+#define STRING_PATH_SEPARATOR_UNIX     "/"
+#define STRING_PATH_SEPARATOR_DOS      "\\"
+
+#define STRING_NEWLINE_UNIX            "\n"
+#define STRING_NEWLINE_DOS             "\r\n"
+
+#if defined(PLATFORM_WIN32) || defined(PLATFORM_MSDOS)
+#define CHAR_PATH_SEPARATOR    CHAR_PATH_SEPARATOR_DOS
+#define STRING_PATH_SEPARATOR  STRING_PATH_SEPARATOR_DOS
+#define STRING_NEWLINE         STRING_NEWLINE_DOS
+#else
+#define CHAR_PATH_SEPARATOR    CHAR_PATH_SEPARATOR_UNIX
+#define STRING_PATH_SEPARATOR  STRING_PATH_SEPARATOR_UNIX
+#define STRING_NEWLINE         STRING_NEWLINE_UNIX
+#endif
+
 
 /* areas in bitmap PIX_DOOR */
 /* meaning in PIX_DB_DOOR: (3 PAGEs)
 
 #define NUM_TREE_TYPES         4
 
+#define INFOTEXT_UNDEFINED     ""
+#define INFOTEXT_GRAPHICS_DIR  "Custom Graphics"
+#define INFOTEXT_SOUNDS_DIR    "Custom Sounds"
+#define INFOTEXT_MUSIC_DIR     "Custom Music"
+#define INFOTEXT_LEVEL_DIR     "Level Sets"
+
+#define TREE_INFOTEXT(t)       ((t) == TREE_TYPE_LEVEL_DIR ?           \
+                                INFOTEXT_LEVEL_DIR :                   \
+                                (t) == TREE_TYPE_GRAPHICS_DIR ?        \
+                                INFOTEXT_GRAPHICS_DIR :                \
+                                (t) == TREE_TYPE_SOUNDS_DIR ?          \
+                                INFOTEXT_SOUNDS_DIR :                  \
+                                (t) == TREE_TYPE_MUSIC_DIR ?           \
+                                INFOTEXT_MUSIC_DIR :                   \
+                                INFOTEXT_UNDEFINED)
 
 /* values for artwork handling */
 #define LEVELDIR_ARTWORK_SET_PTR(leveldir, type)                       \
@@ -495,7 +541,10 @@ struct ProgramInfo
 {
   char *command_basepath;      /* directory that contains the program */
   char *command_basename;      /* base filename of the program binary */
-  char *userdata_directory;    /* personal user data directory */
+
+  char *userdata_subdir;       /* personal user game data directory */
+  char *userdata_subdir_unix;  /* personal user game data directory (Unix) */
+  char *userdata_path;         /* resulting full path to game data directory */
 
   char *program_title;
   char *window_title;
@@ -503,11 +552,15 @@ struct ProgramInfo
 
   char *x11_icon_filename;
   char *x11_iconmask_filename;
+  char *sdl_icon_filename;
   char *msdos_cursor_filename;
 
   char *cookie_prefix;
   char *filename_prefix;       /* prefix to cut off from DOS filenames */
 
+  char *error_filename;                /* filename where to write error messages to */
+  FILE *error_file;            /* (used instead of 'stderr' on some systems) */
+
   int version_major;
   int version_minor;
   int version_patch;
@@ -536,12 +589,20 @@ struct OptionInfo
   boolean debug;
 };
 
+struct ScreenModeInfo
+{
+  int width, height;
+};
+
 struct VideoSystemInfo
 {
   int default_depth;
   int width, height, depth;
+
   boolean fullscreen_available;
   boolean fullscreen_enabled;
+  struct ScreenModeInfo *fullscreen_modes;
+  char *fullscreen_mode_current;
 };
 
 struct AudioSystemInfo
@@ -708,7 +769,7 @@ struct SetupInfo
   boolean direct_draw;         /* !double_buffering (redundant!) */
   boolean scroll_delay;
   boolean soft_scrolling;
-  boolean fading;
+  boolean fade_screens;
   boolean autorecord;
   boolean show_titlescreen;
   boolean quick_doors;
@@ -717,6 +778,7 @@ struct SetupInfo
   boolean skip_levels;
   boolean time_limit;
   boolean fullscreen;
+  char *fullscreen_mode;
   boolean ask_on_escape;
   boolean ask_on_escape_editor;
   boolean quick_switch;
@@ -792,6 +854,8 @@ struct TreeInfo
   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 */
+
+  char *infotext;      /* optional text to describe the tree type (headline) */
 };
 
 typedef struct TreeInfo TreeInfo;
@@ -915,6 +979,11 @@ struct ArtworkListInfo
   void (*free_artwork)(void *);                        /* destructor function */
 };
 
+struct XY
+{
+  int x, y;
+};
+
 
 /* ========================================================================= */
 /* exported variables                                                        */
@@ -956,7 +1025,7 @@ extern int                 FrameCounter;
 /* function definitions */
 
 void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
-                    char *, char *, char *, int);
+                    char *, char *, char *, char *, char *, int);
 
 void InitExitFunction(void (*exit_function)(int));
 void InitPlatformDependentStuff(void);
@@ -978,7 +1047,7 @@ Bitmap *CreateBitmapStruct(void);
 Bitmap *CreateBitmap(int, int, int);
 void FreeBitmap(Bitmap *);
 void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int);
-void FadeScreen(Bitmap *bitmap, int, int, int);
+void FadeRectangle(Bitmap *bitmap, int, int, int, int, int, int, int);
 void FillRectangle(Bitmap *, int, int, int, int, Pixel);
 void ClearRectangle(Bitmap *, int, int, int, int);
 void ClearRectangleOnBackground(Bitmap *, int, int, int, int);
@@ -1023,6 +1092,7 @@ void PeekEvent(Event *event);
 Key GetEventKey(KeyEvent *, boolean);
 KeyMod HandleKeyModState(Key, int);
 KeyMod GetKeyModState();
+KeyMod GetKeyModStateFromEvents();
 boolean CheckCloseWindowEvent(ClientMessageEvent *);
 
 void InitJoysticks();
index 45de4987c279401ae4654f72b73a915e7a8817e7..bfd2a7c4bdf0dde187a768591dba61ea32776b57 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 7c331d572a89d3eb45ea2ee87e0445286cb37ee4..f49346e4b24542fc44f113391f1dfc18e77bfde9 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 855e54f74192ce194174007d061c10afba9f79e9..0b7ca5522c8db2391bb2751b50a3d2d35ae6e812 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 4d3e0be8a08d2579177c915d82fe38bb17756871..2f1044b6b5e77008b710b8315a6a2278cf41d628 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 22790dc84d96cb511599da53ab68829df0ef1d6a..f4d0e820847c59c9a0aef9240014d02dcf288a3f 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -20,7 +20,7 @@
 #include <string.h>
 #include <sys/types.h>
 
-typedef unsigned char boolean;
+typedef int boolean;
 
 #if !defined(PLATFORM_WIN32)
 typedef unsigned char byte;
index d96d4b71fdf5e999c97d1458b64dde157e3af0cd..7aaa69a28bcbce6696d16dccb88ebbea96bb4bd4 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2003 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index b0d70d55d7e57738cadfe9bd1c094548713ecc3e..a9f2343101993f08c5473efc9e4336ebf674a5c7 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -362,16 +362,15 @@ void X11FillRectangle(Bitmap *bitmap, int x, int y,
   XFillRectangle(display, bitmap->drawable, bitmap->gc, x, y, width, height);
 }
 
-void X11FadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay,
-                  int post_delay)
+void X11FadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height,
+                     int fade_mode, int fade_delay, int post_delay)
 {
-  /* fading currently not supported -- simply copy target image to screen */
+  /* fading currently not supported -- simply copy backbuffer to screen */
 
   if (fade_mode == FADE_MODE_FADE_OUT)
-    X11FillRectangle(window, 0, 0, video.width, video.height, BLACK_PIXEL);
+    X11FillRectangle(window, x, y, width, height, BLACK_PIXEL);
   else
-    X11CopyArea(bitmap_cross != NULL ? bitmap_cross : backbuffer, window,
-               0, 0, video.width, video.height, 0, 0, BLIT_OPAQUE);
+    X11CopyArea(backbuffer, window, x, y, width, height, 0, 0, BLIT_OPAQUE);
 
   /* as we currently cannot use the fade delay, also do not use post delay */
 }
index 2519955ff530d1f00ee05091943b552ffd6010d8..0e2ba46e2aa567b6b2d7930446b73f6100b36969 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Artsoft Retro-Game Library                               *
 *----------------------------------------------------------*
-* (c) 1994-2002 Artsoft Entertainment                      *
+* (c) 1994-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -93,11 +93,6 @@ struct MouseCursorInfo
   char mask[CURSOR_MAX_WIDTH * CURSOR_MAX_HEIGHT / 8];
 };
 
-struct XY
-{
-  short x, y;
-};
-
 
 /* X11 symbol definitions */
 
@@ -344,7 +339,7 @@ void X11CreateBitmapContent(Bitmap *, int, int, int);
 void X11FreeBitmapPointers(Bitmap *);
 void X11CopyArea(Bitmap *, Bitmap *, int, int, int, int, int, int, int);
 void X11FillRectangle(Bitmap *, int, int, int, int, Pixel);
-void X11FadeScreen(Bitmap *, int, int, int);
+void X11FadeRectangle(Bitmap *, int, int, int, int, int, int, int);
 void X11DrawSimpleLine(Bitmap *, int, int, int, int, Pixel);
 Pixel X11GetPixel(Bitmap *, int, int);
 Pixel X11GetPixelFromRGB(unsigned int, unsigned int, unsigned int);
index 4506c8e373868b40e790a09fa5068ad70cf032fc..ccf8e42ab76e719ebbef4e5964d58ccf43b9f968 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -20,8 +20,9 @@
 #include "events.h"
 #include "config.h"
 
-Bitmap                *bitmap_db_title;
+Bitmap                *bitmap_db_cross;
 Bitmap                *bitmap_db_field;
+Bitmap                *bitmap_db_panel;
 Bitmap                *bitmap_db_door;
 DrawBuffer            *fieldbuffer;
 DrawBuffer            *drawto_field;
@@ -67,10 +68,6 @@ short                        ExplodeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 int                    RunnerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 int                    PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 
-#if 0
-unsigned long          Properties[MAX_NUM_ELEMENTS][NUM_EP_BITFIELDS];
-#endif
-
 int                    GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 int                    GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 int                    GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
@@ -109,6 +106,7 @@ struct GameInfo             game;
 struct GlobalInfo      global;
 struct MenuInfo                menu;
 struct DoorInfo                door_1, door_2;
+struct PreviewInfo     preview;
 struct GraphicInfo     *graphic_info = NULL;
 struct SoundInfo       *sound_info = NULL;
 struct MusicInfo       *music_info = NULL;
@@ -3696,6 +3694,96 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "wall",
     "growing wall (horizontal, BD style)"
   },
+  {
+    "last_ce_8",
+    "last_ce",
+    "CE 8 positions earlier in list"
+  },
+  {
+    "last_ce_7",
+    "last_ce",
+    "CE 7 positions earlier in list"
+  },
+  {
+    "last_ce_6",
+    "last_ce",
+    "CE 6 positions earlier in list"
+  },
+  {
+    "last_ce_5",
+    "last_ce",
+    "CE 5 positions earlier in list"
+  },
+  {
+    "last_ce_4",
+    "last_ce",
+    "CE 4 positions earlier in list"
+  },
+  {
+    "last_ce_3",
+    "last_ce",
+    "CE 3 positions earlier in list"
+  },
+  {
+    "last_ce_2",
+    "last_ce",
+    "CE 2 positions earlier in list"
+  },
+  {
+    "last_ce_1",
+    "last_ce",
+    "CE 1 position earlier in list"
+  },
+  {
+    "self",
+    "self",
+    "the current custom element"
+  },
+  {
+    "next_ce_1",
+    "next_ce",
+    "CE 1 position later in list"
+  },
+  {
+    "next_ce_2",
+    "next_ce",
+    "CE 2 positions later in list"
+  },
+  {
+    "next_ce_3",
+    "next_ce",
+    "CE 3 positions later in list"
+  },
+  {
+    "next_ce_4",
+    "next_ce",
+    "CE 4 positions later in list"
+  },
+  {
+    "next_ce_5",
+    "next_ce",
+    "CE 5 positions later in list"
+  },
+  {
+    "next_ce_6",
+    "next_ce",
+    "CE 6 positions later in list"
+  },
+  {
+    "next_ce_7",
+    "next_ce",
+    "CE 7 positions later in list"
+  },
+  {
+    "next_ce_8",
+    "next_ce",
+    "CE 8 positions later in list"
+  },
+  {
+    "any_element",
+    "any_element",
+    "this element matches any element"
+  },
 
   /* ----------------------------------------------------------------------- */
   /* "real" (and therefore drawable) runtime elements                        */
@@ -4548,47 +4636,71 @@ struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] =
 
 struct TokenIntPtrInfo image_config_vars[] =
 {
-  { "global.num_toons",                &global.num_toons                          },
+  { "global.num_toons",                &global.num_toons                           },
+
+  { "menu.draw_xoffset",       &menu.draw_xoffset[GFX_SPECIAL_ARG_DEFAULT] },
+  { "menu.draw_yoffset",       &menu.draw_yoffset[GFX_SPECIAL_ARG_DEFAULT] },
+  { "menu.draw_xoffset.MAIN",  &menu.draw_xoffset[GFX_SPECIAL_ARG_MAIN]    },
+  { "menu.draw_yoffset.MAIN",  &menu.draw_yoffset[GFX_SPECIAL_ARG_MAIN]    },
+  { "menu.draw_xoffset.LEVELS",        &menu.draw_xoffset[GFX_SPECIAL_ARG_LEVELS]  },
+  { "menu.draw_yoffset.LEVELS",        &menu.draw_yoffset[GFX_SPECIAL_ARG_LEVELS]  },
+  { "menu.draw_xoffset.SCORES",        &menu.draw_xoffset[GFX_SPECIAL_ARG_SCORES]  },
+  { "menu.draw_yoffset.SCORES",        &menu.draw_yoffset[GFX_SPECIAL_ARG_SCORES]  },
+  { "menu.draw_xoffset.EDITOR",        &menu.draw_xoffset[GFX_SPECIAL_ARG_EDITOR]  },
+  { "menu.draw_yoffset.EDITOR",        &menu.draw_yoffset[GFX_SPECIAL_ARG_EDITOR]  },
+  { "menu.draw_xoffset.INFO",  &menu.draw_xoffset[GFX_SPECIAL_ARG_INFO]    },
+  { "menu.draw_yoffset.INFO",  &menu.draw_yoffset[GFX_SPECIAL_ARG_INFO]    },
+  { "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.draw_xoffset",       &menu.draw_xoffset[GFX_SPECIAL_ARG_DEFAULT]},
-  { "menu.draw_yoffset",       &menu.draw_yoffset[GFX_SPECIAL_ARG_DEFAULT]},
-  { "menu.draw_xoffset.MAIN",  &menu.draw_xoffset[GFX_SPECIAL_ARG_MAIN]   },
-  { "menu.draw_yoffset.MAIN",  &menu.draw_yoffset[GFX_SPECIAL_ARG_MAIN]   },
-  { "menu.draw_xoffset.LEVELS",        &menu.draw_xoffset[GFX_SPECIAL_ARG_LEVELS] },
-  { "menu.draw_yoffset.LEVELS",        &menu.draw_yoffset[GFX_SPECIAL_ARG_LEVELS] },
-  { "menu.draw_xoffset.SCORES",        &menu.draw_xoffset[GFX_SPECIAL_ARG_SCORES] },
-  { "menu.draw_yoffset.SCORES",        &menu.draw_yoffset[GFX_SPECIAL_ARG_SCORES] },
-  { "menu.draw_xoffset.EDITOR",        &menu.draw_xoffset[GFX_SPECIAL_ARG_EDITOR] },
-  { "menu.draw_yoffset.EDITOR",        &menu.draw_yoffset[GFX_SPECIAL_ARG_EDITOR] },
-  { "menu.draw_xoffset.INFO",  &menu.draw_xoffset[GFX_SPECIAL_ARG_INFO]   },
-  { "menu.draw_yoffset.INFO",  &menu.draw_yoffset[GFX_SPECIAL_ARG_INFO]   },
-  { "menu.draw_xoffset.SETUP", &menu.draw_xoffset[GFX_SPECIAL_ARG_SETUP]  },
-  { "menu.draw_yoffset.SETUP", &menu.draw_yoffset[GFX_SPECIAL_ARG_SETUP]  },
+  { "menu.list_size",          &menu.list_size[GFX_SPECIAL_ARG_DEFAULT]    },
+  { "menu.list_size.LEVELS",   &menu.list_size[GFX_SPECIAL_ARG_LEVELS]     },
+  { "menu.list_size.SCORES",   &menu.list_size[GFX_SPECIAL_ARG_SCORES]     },
+  { "menu.list_size.INFO",     &menu.list_size[GFX_SPECIAL_ARG_INFO]       },
 
-  { "menu.scrollbar_xoffset",  &menu.scrollbar_xoffset                    },
+  { "menu.fade_delay",         &menu.fade_delay                            },
+  { "menu.post_delay",         &menu.post_delay                            },
 
-  { "menu.list_size",          &menu.list_size[GFX_SPECIAL_ARG_DEFAULT]   },
-  { "menu.list_size.LEVELS",   &menu.list_size[GFX_SPECIAL_ARG_LEVELS]    },
-  { "menu.list_size.SCORES",   &menu.list_size[GFX_SPECIAL_ARG_SCORES]    },
-  { "menu.list_size.INFO",     &menu.list_size[GFX_SPECIAL_ARG_INFO]      },
+  { "door_1.width",            &door_1.width                               },
+  { "door_1.height",           &door_1.height                              },
+  { "door_1.step_offset",      &door_1.step_offset                         },
+  { "door_1.step_delay",       &door_1.step_delay                          },
+  { "door_1.anim_mode",                &door_1.anim_mode                           },
+  { "door_2.width",            &door_2.width                               },
+  { "door_2.height",           &door_2.height                              },
+  { "door_2.step_offset",      &door_2.step_offset                         },
+  { "door_2.step_delay",       &door_2.step_delay                          },
+  { "door_2.anim_mode",                &door_2.anim_mode                           },
 
-  { "door_1.width",            &door_1.width                              },
-  { "door_1.height",           &door_1.height                             },
-  { "door_1.step_offset",      &door_1.step_offset                        },
-  { "door_1.step_delay",       &door_1.step_delay                         },
-  { "door_1.anim_mode",                &door_1.anim_mode                          },
-  { "door_2.width",            &door_2.width                              },
-  { "door_2.height",           &door_2.height                             },
-  { "door_2.step_offset",      &door_2.step_offset                        },
-  { "door_2.step_delay",       &door_2.step_delay                         },
-  { "door_2.anim_mode",                &door_2.anim_mode                          },
+  { "preview.x",               &preview.x                                  },
+  { "preview.y",               &preview.y                                  },
+  { "preview.xsize",           &preview.xsize                              },
+  { "preview.ysize",           &preview.ysize                              },
+  { "preview.tile_size",       &preview.tile_size                          },
+  { "preview.step_offset",     &preview.step_offset                        },
+  { "preview.step_delay",      &preview.step_delay                         },
 
-  { "[player].boring_delay_fixed",     &game.player_boring_delay_fixed    },
-  { "[player].boring_delay_random",    &game.player_boring_delay_random   },
-  { "[player].sleeping_delay_fixed",   &game.player_sleeping_delay_fixed  },
-  { "[player].sleeping_delay_random",  &game.player_sleeping_delay_random },
+  { "game.panel.level.x",      &game.panel.level.x                         },
+  { "game.panel.level.y",      &game.panel.level.y                         },
+  { "game.panel.gems.x",       &game.panel.gems.x                          },
+  { "game.panel.gems.y",       &game.panel.gems.y                          },
+  { "game.panel.inventory.x",  &game.panel.inventory.x                     },
+  { "game.panel.inventory.y",  &game.panel.inventory.y                     },
+  { "game.panel.keys.x",       &game.panel.keys.x                          },
+  { "game.panel.keys.y",       &game.panel.keys.y                          },
+  { "game.panel.score.x",      &game.panel.score.x                         },
+  { "game.panel.score.y",      &game.panel.score.y                         },
+  { "game.panel.time.x",       &game.panel.time.x                          },
+  { "game.panel.time.y",       &game.panel.time.y                          },
 
-  { NULL,                      NULL,                                      }
+  { "[player].boring_delay_fixed",     &game.player_boring_delay_fixed     },
+  { "[player].boring_delay_random",    &game.player_boring_delay_random    },
+  { "[player].sleeping_delay_fixed",   &game.player_sleeping_delay_fixed   },
+  { "[player].sleeping_delay_random",  &game.player_sleeping_delay_random  },
+
+  { NULL,                      NULL,                                       }
 };
 
 
@@ -4688,9 +4800,11 @@ static void print_usage()
 
 int main(int argc, char *argv[])
 {
-  InitProgramInfo(argv[0], USERDATA_DIRECTORY,
-                 PROGRAM_TITLE_STRING, getWindowTitleString(),
-                 ICON_TITLE_STRING, X11_ICON_FILENAME, X11_ICONMASK_FILENAME,
+  char * window_title_string = getWindowTitleString();
+
+  InitProgramInfo(argv[0], USERDATA_DIRECTORY, USERDATA_DIRECTORY_UNIX,
+                 PROGRAM_TITLE_STRING, window_title_string, ICON_TITLE_STRING,
+                 X11_ICON_FILENAME, X11_ICONMASK_FILENAME, SDL_ICON_FILENAME,
                  MSDOS_POINTER_FILENAME,
                  COOKIE_PREFIX, FILENAME_PREFIX, GAME_VERSION_ACTUAL);
 
index 645adfd82b8ccdb3c1fe8b1fcc4dbc75bc22486a..9ba274dd06c1ba8bf8b3c6f2e64d5d8a76eab307 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -42,6 +42,8 @@
 #define WIN_XSIZE                      672
 #define WIN_YSIZE                      560
 
+#define DEFAULT_FULLSCREEN_MODE                "800x600"
+
 #define SCR_FIELDX                     17
 #define SCR_FIELDY                     17
 #define MAX_BUF_XSIZE                  (SCR_FIELDX + 2)
 #define EP_BITMASK_DEFAULT             0
 
 #define PROPERTY_BIT(p)                        (1 << ((p) % 32))
-#if 1
 #define PROPERTY_VAR(e,p)              (element_info[e].properties[(p) / 32])
-#else
-#define PROPERTY_VAR(e,p)              (Properties[e][(p) / 32])
-#endif
 #define HAS_PROPERTY(e,p)      ((PROPERTY_VAR(e, p) & PROPERTY_BIT(p)) != 0)
 #define SET_PROPERTY(e,p,v)    ((v) ?                                     \
                                 (PROPERTY_VAR(e,p) |=  PROPERTY_BIT(p)) : \
 #define SND_ELEMENT(e)         (e)
 #endif
 
-#if 1
 #define GROUP_NR(e)            ((e) - EL_GROUP_START)
 #define IS_IN_GROUP(e, nr)     (element_info[e].in_group[nr] == TRUE)
 #define IS_IN_GROUP_EL(e, ge)  (IS_IN_GROUP(e, (ge) - EL_GROUP_START))
 
 #define IS_EQUAL_OR_IN_GROUP(e, ge)                                    \
-       (IS_GROUP_ELEMENT(ge) ? IS_IN_GROUP(e, GROUP_NR(ge)) : (e) == (ge))
-#endif
+       (ge == EL_ANY_ELEMENT ? TRUE :                                  \
+        IS_GROUP_ELEMENT(ge) ? IS_IN_GROUP(e, GROUP_NR(ge)) : (e) == (ge))
 
 #define IS_PLAYER(x, y)                (ELEM_IS_PLAYER(StorePlayer[x][y]))
 
 #define ANIM_DELAY(g)          (graphic_info[g].anim_delay)
 #define ANIM_MODE(g)           (graphic_info[g].anim_mode)
 
+#define IS_ANIM_MODE_CE(g)     (graphic_info[g].anim_mode & (ANIM_CE_VALUE |  \
+                                                             ANIM_CE_SCORE |  \
+                                                             ANIM_CE_DELAY))
 #define IS_ANIMATED(g)         (ANIM_FRAMES(g) > 1)
 #define IS_NEW_DELAY(f, g)     ((f) % ANIM_DELAY(g) == 0)
 #define IS_NEW_FRAME(f, g)     (IS_ANIMATED(g) && IS_NEW_DELAY(f, g))
 
 #define MAX_NUM_AMOEBA         100
 
-#if 0  /* game.h */
-#define MAX_INVENTORY_SIZE     1000
-#define STD_NUM_KEYS           4
-#define MAX_NUM_KEYS           8
-#endif
-
 #define NUM_BELTS              4
 #define NUM_BELT_PARTS         3
 #define NUM_ENVELOPES          4
 #define MICROLEVEL_XSIZE       ((STD_LEV_FIELDX + 2) * MICRO_TILEX)
 #define MICROLEVEL_YSIZE       ((STD_LEV_FIELDY + 2) * MICRO_TILEY)
 #define MICROLEVEL_XPOS                (SX + (SXSIZE - MICROLEVEL_XSIZE) / 2)
-#define MICROLEVEL_YPOS                (SX + 12 * TILEY - MICRO_TILEY)
+#define MICROLEVEL_YPOS                (SY + 12 * TILEY - MICRO_TILEY)
 #define MICROLABEL1_YPOS       (MICROLEVEL_YPOS - 36)
 #define MICROLABEL2_YPOS       (MICROLEVEL_YPOS + MICROLEVEL_YSIZE + 7)
 
 
 #define EL_BD_EXPANDABLE_WALL          713
 
-#define NUM_FILE_ELEMENTS              714
+#define EL_LAST_CE_8                   714
+#define EL_LAST_CE_7                   715
+#define EL_LAST_CE_6                   716
+#define EL_LAST_CE_5                   717
+#define EL_LAST_CE_4                   718
+#define EL_LAST_CE_3                   719
+#define EL_LAST_CE_2                   720
+#define EL_LAST_CE_1                   721
+#define EL_SELF                                722
+#define EL_NEXT_CE_1                   723
+#define EL_NEXT_CE_2                   724
+#define EL_NEXT_CE_3                   725
+#define EL_NEXT_CE_4                   726
+#define EL_NEXT_CE_5                   727
+#define EL_NEXT_CE_6                   728
+#define EL_NEXT_CE_7                   729
+#define EL_NEXT_CE_8                   730
+#define EL_ANY_ELEMENT                 731
+
+#define NUM_FILE_ELEMENTS              732
 
 
 /* "real" (and therefore drawable) runtime elements */
 /* program information and versioning definitions */
 #define PROGRAM_VERSION_MAJOR          3
 #define PROGRAM_VERSION_MINOR          2
-#define PROGRAM_VERSION_PATCH          0
-#define PROGRAM_VERSION_BUILD          9
+#define PROGRAM_VERSION_PATCH          1
+#define PROGRAM_VERSION_BUILD          0
 
 #define PROGRAM_TITLE_STRING           "Rocks'n'Diamonds"
 #define PROGRAM_AUTHOR_STRING          "Holger Schemel"
-#define PROGRAM_COPYRIGHT_STRING       "Copyright Â©1995-2006 by Holger Schemel"
+#define PROGRAM_COPYRIGHT_STRING       "Copyright Â©1995-2006 by Holger Schemel"
+#define PROGRAM_EMAIL_STRING           "info@artsoft.org"
+#define PROGRAM_WEBSITE_STRING         "http://www.artsoft.org/"
 
 #define ICON_TITLE_STRING              PROGRAM_TITLE_STRING
 #define COOKIE_PREFIX                  "ROCKSNDIAMONDS"
 #define FILENAME_PREFIX                        "Rocks"
 
-#if defined(PLATFORM_UNIX)
-#define USERDATA_DIRECTORY             ".rocksndiamonds"
-#elif defined(PLATFORM_WIN32)
-#define USERDATA_DIRECTORY             PROGRAM_TITLE_STRING
+#define USERDATA_DIRECTORY_WIN32       PROGRAM_TITLE_STRING
+#define USERDATA_DIRECTORY_MACOSX      PROGRAM_TITLE_STRING
+#define USERDATA_DIRECTORY_UNIX                ".rocksndiamonds"
+#define USERDATA_DIRECTORY_DOS         "userdata"
+
+#if defined(PLATFORM_WIN32)
+#define USERDATA_DIRECTORY             USERDATA_DIRECTORY_WIN32
+#elif defined(PLATFORM_MACOSX)
+#define USERDATA_DIRECTORY             USERDATA_DIRECTORY_MACOSX
+#elif defined(PLATFORM_UNIX)
+#define USERDATA_DIRECTORY             USERDATA_DIRECTORY_UNIX
 #else
-#define USERDATA_DIRECTORY             "userdata"
+#define USERDATA_DIRECTORY             USERDATA_DIRECTORY_DOS
 #endif
 
 #define X11_ICON_FILENAME              "rocks_icon.xbm"
 #define X11_ICONMASK_FILENAME          "rocks_iconmask.xbm"
+#define SDL_ICON_FILENAME              "rocks_icon_32x32.pcx"
 #define MSDOS_POINTER_FILENAME         "mouse.pcx"
 
 /* file version numbers for resource files (levels, tapes, score, setup, etc.)
@@ -1801,6 +1824,9 @@ struct MenuInfo
 
   int list_size[NUM_SPECIAL_GFX_ARGS];
 
+  int fade_delay;
+  int post_delay;
+
   int sound[NUM_SPECIAL_GFX_ARGS];
   int music[NUM_SPECIAL_GFX_ARGS];
 };
@@ -1814,6 +1840,15 @@ struct DoorInfo
   int anim_mode;
 };
 
+struct PreviewInfo
+{
+  int x, y;
+  int xsize, ysize;
+  int tile_size;
+  int step_offset;
+  int step_delay;
+};
+
 struct HiScore
 {
   char Name[MAX_PLAYER_NAME_LEN + 1];
@@ -1915,7 +1950,6 @@ struct LevelInfo
   int explosion_element[MAX_PLAYERS];
   boolean use_explosion_element[MAX_PLAYERS];
 
-#if 1
   /* values for the new EMC elements */
   int android_move_time;
   int android_clone_time;
@@ -1932,12 +1966,8 @@ struct LevelInfo
   struct Content ball_content[MAX_ELEMENT_CONTENTS];
   int num_ball_contents;
 
-#if 0
-  boolean android_array[16];
-#endif
   int num_android_clone_elements;
   int android_clone_element[MAX_ANDROID_ELEMENTS];
-#endif
 
   int can_move_into_acid_bits; /* bitfield to store property for elements */
   int dont_collide_with_bits;  /* bitfield to store property for elements */
@@ -2183,20 +2213,28 @@ struct GraphicInfo
 
   int src_x, src_y;            /* start position of animation frames */
   int width, height;           /* width/height of each animation frame */
+
   int offset_x, offset_y;      /* x/y offset to next animation frame */
   int offset2_x, offset2_y;    /* x/y offset to second movement tile */
+
   boolean double_movement;     /* animation has second movement tile */
   int swap_double_tiles;       /* explicitely force or forbid tile swapping */
+
   int anim_frames;
   int anim_frames_per_line;
   int anim_start_frame;
   int anim_delay;              /* important: delay of 1 means "no delay"! */
   int anim_mode;
+
   boolean anim_global_sync;
+
   int crumbled_like;           /* element for cloning crumble graphics */
   int diggable_like;           /* element for cloning digging graphics */
+
   int border_size;             /* border size for "crumbled" graphics */
+
   int scale_up_factor;         /* optional factor for scaling image up */
+
   int clone_from;              /* graphic for cloning *all* settings */
 
   int anim_delay_fixed;                /* optional delay values for bored and   */
@@ -2286,8 +2324,9 @@ struct HelpAnimInfo
 };
 
 
-extern Bitmap                 *bitmap_db_title;
+extern Bitmap                 *bitmap_db_cross;
 extern Bitmap                 *bitmap_db_field;
+extern Bitmap                 *bitmap_db_panel;
 extern Bitmap                 *bitmap_db_door;
 extern Pixmap                  tile_clipmask[];
 extern DrawBuffer             *fieldbuffer;
@@ -2334,10 +2373,6 @@ extern short                     ExplodeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern int                     RunnerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern int                     PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 
-#if 0
-extern unsigned long           Properties[MAX_NUM_ELEMENTS][NUM_EP_BITFIELDS];
-#endif
-
 extern int                     GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern int                     GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern int                     GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
@@ -2376,6 +2411,7 @@ extern struct TapeInfo            tape;
 extern struct GlobalInfo       global;
 extern struct MenuInfo         menu;
 extern struct DoorInfo         door_1, door_2;
+extern struct PreviewInfo      preview;
 extern struct ElementInfo      element_info[];
 extern struct ElementNameInfo  element_name_info[];
 extern struct ElementActionInfo        element_action_info[];
index 8a41aee586b8caa48be7d43acee1ce6e1c34578c..4e65cf3d293838016f2656625bd780f829d11b1d 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 5efcb80339f8055386c60f4257d0ee3efbc7ea06..69eeaefa03d70fba9b8ed9568dae894220afd0b9 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index feb79bd9769d58098d75a5120d8aa457025a8fc5..412d2bd820a842bf35d107bdebfa0325ae4cccc4 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -431,18 +431,11 @@ static void Handle_OP_NUMBER_WANTED()
   }
   else if (old_client_nr == first_player.nr)   /* failed -- local player? */
   {
-#if 0
-    char *color[] = { "yellow", "red", "green", "blue" };
-#endif
     char request[100];
 
-#if 1
     sprintf(request, "Sorry ! Player %d already exists ! You are player %d !",
            index_nr_wanted + 1, new_index_nr + 1);
-#else
-    sprintf(request, "Sorry ! %s player still exists ! You are %s player !",
-           color[index_nr_wanted], color[new_index_nr]);
-#endif
+
     Request(request, REQ_CONFIRM);
 
     Error(ERR_NETWORK_CLIENT, "cannot switch -- you keep client # %d",
@@ -541,20 +534,7 @@ static void Handle_OP_START_PLAYING()
   LoadTape(level_nr);
   LoadLevel(level_nr);
 
-#if 1
   StartGameActions(FALSE, setup.autorecord, new_random_seed);
-#else
-  if (setup.autorecord)
-    TapeStartRecording();
-
-  if (tape.recording)
-    tape.random_seed = new_random_seed;
-
-  InitRND(new_random_seed);
-
-  game_status = GAME_MODE_PLAYING;
-  InitGame();
-#endif
 }
 
 static void Handle_OP_PAUSE_PLAYING()
@@ -615,16 +595,11 @@ static void Handle_OP_MOVE_PLAYER(unsigned int len)
     Error(ERR_RETURN, "client and servers frame counters out of sync");
     Error(ERR_RETURN, "frame counter of client is %d", FrameCounter);
     Error(ERR_RETURN, "frame counter of server is %d", server_frame_counter);
-
-#if 1
     Error(ERR_RETURN, "this should not happen -- please debug");
 
     stop_network_game = TRUE;
 
     return;
-#else
-    Error(ERR_EXIT,   "this should not happen -- please debug");
-#endif
   }
 
   /* copy valid player actions */
index 72c58445d24e0509727e1e043e32f292dcbb6f9a..569ad5bba499dc01da311d185a5b0e46e8ecb9dc 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 831b8489ad38879940474d214b470830a5279167..09e029690df32868e6848f03384501f8afab262b 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
 #define SETUP_MODE_SHORTCUT_1          4
 #define SETUP_MODE_SHORTCUT_2          5
 #define SETUP_MODE_GRAPHICS            6
-#define SETUP_MODE_SOUND               7
-#define SETUP_MODE_ARTWORK             8
-#define SETUP_MODE_CHOOSE_GRAPHICS     9
-#define SETUP_MODE_CHOOSE_SOUNDS       10
-#define SETUP_MODE_CHOOSE_MUSIC                11
+#define SETUP_MODE_CHOOSE_SCREEN_MODE  7
+#define SETUP_MODE_SOUND               8
+#define SETUP_MODE_ARTWORK             9
+#define SETUP_MODE_CHOOSE_GRAPHICS     10
+#define SETUP_MODE_CHOOSE_SOUNDS       11
+#define SETUP_MODE_CHOOSE_MUSIC                12
 
-#define MAX_SETUP_MODES                        12
+#define MAX_SETUP_MODES                        13
 
 /* for input setup functions */
 #define SETUPINPUT_SCREEN_POS_START    0
 #define MAX_MENU_TEXT_LENGTH_MEDIUM    (MAX_MENU_TEXT_LENGTH_BIG * 2)
 
 /* buttons and scrollbars identifiers */
-#define SCREEN_CTRL_ID_SCROLL_UP       0
-#define SCREEN_CTRL_ID_SCROLL_DOWN     1
-#define SCREEN_CTRL_ID_SCROLL_VERTICAL 2
+#define SCREEN_CTRL_ID_LAST_LEVEL      0
+#define SCREEN_CTRL_ID_NEXT_LEVEL      1
+#define SCREEN_CTRL_ID_LAST_PLAYER     2
+#define SCREEN_CTRL_ID_NEXT_PLAYER     3
+#define SCREEN_CTRL_ID_SCROLL_UP       4
+#define SCREEN_CTRL_ID_SCROLL_DOWN     5
+#define SCREEN_CTRL_ID_SCROLL_VERTICAL 6
 
+#define NUM_SCREEN_GADGETS             7
+
+#define NUM_SCREEN_MENUBUTTONS         4
 #define NUM_SCREEN_SCROLLBUTTONS       2
 #define NUM_SCREEN_SCROLLBARS          1
-#define NUM_SCREEN_GADGETS             3
+
+#define SCREEN_MASK_MAIN               (1 << 0)
+#define SCREEN_MASK_INPUT              (1 << 1)
 
 /* graphic position and size values for buttons and scrollbars */
+#define SC_MENUBUTTON_XSIZE            TILEX
+#define SC_MENUBUTTON_YSIZE            TILEY
+
 #define SC_SCROLLBUTTON_XSIZE          TILEX
 #define SC_SCROLLBUTTON_YSIZE          TILEY
 
@@ -109,6 +122,7 @@ static void HandleSetupScreen_Generic(int, int, int, int, int);
 static void HandleSetupScreen_Input(int, int, int, int, int);
 static void CustomizeKeyboard(int);
 static void CalibrateJoystick(int);
+static void execSetupGraphics(void);
 static void execSetupArtwork(void);
 static void HandleChooseTree(int, int, int, int, int, TreeInfo **);
 
@@ -127,12 +141,16 @@ static void HandleInfoScreen_Music(int);
 static void HandleInfoScreen_Credits(int);
 static void HandleInfoScreen_Program(int);
 
-static void MapChooseTreeGadgets(TreeInfo *);
+static void MapScreenMenuGadgets(int);
+static void MapScreenTreeGadgets(TreeInfo *);
 
 static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS];
 static int setup_mode = SETUP_MODE_MAIN;
 static int info_mode = INFO_MODE_MAIN;
 
+static TreeInfo *screen_modes = NULL;
+static TreeInfo *screen_mode_current = NULL;
+
 #define DRAW_OFFSET_MODE(x)    (x >= GAME_MODE_MAIN &&                 \
                                 x <= GAME_MODE_SETUP ? x :             \
                                 x == GAME_MODE_PSEUDO_TYPENAME ?       \
@@ -211,30 +229,6 @@ void DrawHeadline()
   DrawTextSCentered(MENU_TITLE2_YPOS, FONT_TITLE_2, PROGRAM_COPYRIGHT_STRING);
 }
 
-static void ToggleFullscreenIfNeeded()
-{
-  if (setup.fullscreen != video.fullscreen_enabled)
-  {
-    /* save old door content */
-    BlitBitmap(backbuffer, bitmap_db_door,
-              DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
-
-    /* toggle fullscreen */
-    ChangeVideoModeIfNeeded(setup.fullscreen);
-    setup.fullscreen = video.fullscreen_enabled;
-
-    /* redraw background to newly created backbuffer */
-    BlitBitmap(graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer,
-              0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
-
-    /* restore old door content */
-    BlitBitmap(bitmap_db_door, backbuffer,
-              DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
-
-    redraw_mask = REDRAW_ALL;
-  }
-}
-
 static int getLastLevelButtonPos()
 {
   return 10;
@@ -305,16 +299,12 @@ void DrawTitleScreen()
   StopAnimation();
 }
 
-static void DrawMainMenuExt(int fade_delay)
+void DrawMainMenuExt(int redraw_mask, boolean do_fading)
 {
   static LevelDirTree *leveldir_last_valid = NULL;
   boolean levelset_has_changed = FALSE;
   char *name_text = (!options.network && setup.team_mode ? "Team:" : "Name:");
-#if 1
   char *level_text = "Levelset";
-#else
-  char *level_text = "Level:";
-#endif
   int name_width, level_width;
   int i;
 
@@ -329,9 +319,7 @@ static void DrawMainMenuExt(int fade_delay)
 
   audio.sound_deactivated = FALSE;
 
-#if 1
   GetPlayerConfig();
-#endif
 
   /* needed if last screen was the playing screen, invoked from level editor */
   if (level_editor_test_game)
@@ -375,18 +363,10 @@ static void DrawMainMenuExt(int fade_delay)
     return;
   }
 
-#if 0
-  /* map gadgets for main menu screen */
-  MapTapeButtons();
-#endif
-
   /* level_nr may have been set to value over handicap with level editor */
   if (setup.handicap && level_nr > leveldir_current->handicap_level)
     level_nr = leveldir_current->handicap_level;
 
-#if 0
-  GetPlayerConfig();
-#endif
   LoadLevel(level_nr);
 
   SetMainBackgroundImage(IMG_BACKGROUND_MAIN);
@@ -405,44 +385,19 @@ static void DrawMainMenuExt(int fade_delay)
 
   /* calculated after (possible) reload of custom artwork */
   name_width  = getTextWidth(name_text,  FONT_MENU_1);
-#if 1
   level_width = 9 * 32;
-#else
-#if 1
-  level_width = 9 * getFontWidth(FONT_MENU_1);
-#else
-  level_width = getTextWidth(level_text, FONT_MENU_1);
-#endif
-#endif
 
   DrawText(mSX + 32 + name_width, mSY + 2 * 32, setup.player_name,
           FONT_INPUT_1);
 
-#if 1
   DrawText(mSX + getCurrentLevelTextPos() * 32, mSY + 3 * 32,
           int2str(level_nr, 3), FONT_VALUE_1);
-#else
-#if 1
-  DrawText(mSX + level_width + 2 * 32, mSY + 3 * 32, int2str(level_nr, 3),
-          FONT_VALUE_1);
-#else
-  DrawText(mSX + level_width + 5 * 32, mSY + 3 * 32, int2str(level_nr, 3),
-          FONT_VALUE_1);
-#endif
-#endif
 
-  DrawMicroLevel(MICROLEVEL_XPOS, MICROLEVEL_YPOS, TRUE);
+  DrawPreviewLevel(TRUE);
 
-#if 1
-
-#if 1
   {
     int text_height = getFontHeight(FONT_TEXT_3);
-#if 1
     int xpos = getLevelRangeTextPos() * 32;
-#else
-    int xpos = level_width + 6 * 32;
-#endif
     int ypos2 = -SY + 3 * 32 + 16;
     int ypos1 = ypos2 - text_height;
 
@@ -451,52 +406,13 @@ static void DrawMainMenuExt(int fade_delay)
     DrawTextF(mSX + xpos, mSY + ypos2, FONT_TEXT_3,
              "%03d", leveldir_current->last_level);
   }
-#else
-  DrawTextF(mSX + level_width + 6 * 32, mSY + 3 * 32 + 1, FONT_TEXT_3,
-           "%d", leveldir_current->levels);
-#endif
-
-#else
-  DrawTextF(mSX + 32 + level_width - 2, mSY + 3 * 32 + 1, FONT_TEXT_3, "%d-%d",
-           leveldir_current->first_level, leveldir_current->last_level);
-#endif
-
-#if 0
-  if (leveldir_current->readonly)
-  {
-    DrawTextS(mSX + level_width + 9 * 32 - 2,
-             mSY + 3 * 32 + 1 - 7, FONT_TEXT_3, "READ");
-    DrawTextS(mSX + level_width + 9 * 32 - 2,
-             mSY + 3 * 32 + 1 + 7, FONT_TEXT_3, "ONLY");
-  }
-#endif
 
   for (i = 0; i < 8; i++)
     initCursor(i, (i == 1 || i == 4 || i == 6 ? IMG_MENU_BUTTON_ENTER_MENU :
                   IMG_MENU_BUTTON));
 
-#if 1
-  drawCursorXY(getLastLevelButtonPos(), 1, IMG_MENU_BUTTON_LAST_LEVEL);
-  drawCursorXY(getNextLevelButtonPos(), 1, IMG_MENU_BUTTON_NEXT_LEVEL);
-#else
-#if 1
-  drawCursorXY(level_width / 32 + 1, 1, IMG_MENU_BUTTON_LEFT);
-  drawCursorXY(level_width / 32 + 5, 1, IMG_MENU_BUTTON_RIGHT);
-#else
-  drawCursorXY(level_width / 32 + 4, 1, IMG_MENU_BUTTON_LEFT);
-  drawCursorXY(level_width / 32 + 8, 1, IMG_MENU_BUTTON_RIGHT);
-#endif
-#endif
-
   DrawTextSCentered(326, FONT_TITLE_2, "A Game by Artsoft Entertainment");
 
-#if 0
-  FadeToFront();
-#endif
-#if 0
-  InitAnimation();
-#endif
-
   HandleMainMenu(0, 0, 0, 0, MB_MENU_INITIALIZE);
 
   TapeStop();
@@ -507,46 +423,32 @@ static void DrawMainMenuExt(int fade_delay)
   PlayMenuSound();
   PlayMenuMusic();
 
-#if 0
-#if 1
-  OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2);
-#else
-  if (fade_delay > 0)
-    OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
-  else
-    OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2);
-#endif
-#endif
-
-#if 0
-  InitAnimation();
-#endif
+  /* create gadgets for main menu screen */
+  FreeScreenGadgets();
+  CreateScreenGadgets();
 
-#if 1
   /* map gadgets for main menu screen */
   MapTapeButtons();
-#endif
+  MapScreenMenuGadgets(SCREEN_MASK_MAIN);
 
-#if 1
-#if 1
-  FadeIn(fade_delay);
-#else
-  BackToFront();
-#endif
-#endif
+  if (do_fading)
+    FadeIn(redraw_mask);
+  else
+    BackToFront();
 
-#if 1
   InitAnimation();
-#endif
 
-#if 1
   OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2);
-#endif
+}
+
+void DrawAndFadeInMainMenu(int redraw_mask)
+{
+  DrawMainMenuExt(redraw_mask, TRUE);
 }
 
 void DrawMainMenu()
 {
-  DrawMainMenuExt(0);
+  DrawMainMenuExt(REDRAW_ALL, FALSE);
 }
 
 #if 0
@@ -586,8 +488,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
   boolean return_to_main_menu = FALSE;
   boolean use_fading_main_menu = TRUE;
   boolean use_cross_fading = TRUE;
-  int fade_delay = 500;
-  int post_delay = fade_delay / 2;
 
   if (button == MB_MENU_INITIALIZE)
   {
@@ -606,7 +506,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
 
       FadeSoundsAndMusic();
 
-      FadeOut(fade_delay, post_delay);
+      FadeOut(REDRAW_ALL);
     }
 
     /* force TITLE music on title info screen */
@@ -619,7 +519,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
 
     DrawTitleScreenImage(title_nr);
 
-    FadeIn(fade_delay);
+    FadeIn(REDRAW_ALL);
 
     return;
   }
@@ -642,30 +542,26 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
     title_nr++;
 
     if (!use_cross_fading)
-      FadeOut(fade_delay, post_delay);
+      FadeOut(REDRAW_ALL);
 
     if (title_nr < MAX_NUM_TITLE_SCREENS &&
        graphic_info[IMG_TITLESCREEN_1 + title_nr].bitmap != NULL)
     {
-      Bitmap *drawto_last = drawto;
-
       if (use_cross_fading)
-       drawto = bitmap_db_title;
+       FadeCrossSaveBackbuffer();
 
       DrawTitleScreenImage(title_nr);
 
-      drawto = drawto_last;
-
       if (use_cross_fading)
-       FadeCross(fade_delay);
+       FadeCross(REDRAW_ALL);
       else
-       FadeIn(fade_delay);
+       FadeIn(REDRAW_ALL);
     }
     else
     {
       FadeSoundsAndMusic();
 
-      FadeOut(fade_delay, post_delay);
+      FadeOut(REDRAW_ALL);
 
       return_to_main_menu = TRUE;
     }
@@ -673,8 +569,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
 
   if (return_to_main_menu)
   {
-    int menu_fade_delay = (use_fading_main_menu ? fade_delay : 0);
-
     RedrawBackground();
 
     if (game_status == GAME_MODE_INFO)
@@ -682,21 +576,63 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
       OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
 
       info_mode = INFO_MODE_MAIN;
-      DrawInfoScreenExt(menu_fade_delay);
+      DrawInfoScreenExt(use_fading_main_menu);
     }
     else       /* default: return to main menu */
     {
       OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
 
       game_status = GAME_MODE_MAIN;
-      DrawMainMenuExt(menu_fade_delay);
+      DrawMainMenuExt(REDRAW_ALL, use_fading_main_menu);
     }
   }
 }
 
+void HandleMainMenu_SelectLevel(int step, int direction)
+{
+  int old_level_nr = level_nr;
+  int new_level_nr;
+
+  new_level_nr = old_level_nr + step * direction;
+  if (new_level_nr < leveldir_current->first_level)
+    new_level_nr = leveldir_current->first_level;
+  if (new_level_nr > leveldir_current->last_level)
+    new_level_nr = leveldir_current->last_level;
+
+  if (setup.handicap && new_level_nr > leveldir_current->handicap_level)
+  {
+    /* skipping levels is only allowed when trying to skip single level */
+    if (setup.skip_levels && step == 1 &&
+       Request("Level still unsolved ! Skip despite handicap ?", REQ_ASK))
+    {
+      leveldir_current->handicap_level++;
+      SaveLevelSetup_SeriesInfo();
+    }
+
+    new_level_nr = leveldir_current->handicap_level;
+  }
+
+  if (new_level_nr != old_level_nr)
+  {
+    level_nr = new_level_nr;
+
+    DrawText(mSX + 11 * 32, mSY + 3 * 32, int2str(level_nr, 3), FONT_VALUE_1);
+
+    LoadLevel(level_nr);
+    DrawPreviewLevel(TRUE);
+
+    TapeErase();
+    LoadTape(level_nr);
+    DrawCompleteVideoDisplay();
+
+    /* needed because DrawPreviewLevel() takes some time */
+    BackToFront();
+    SyncDisplay();
+  }
+}
+
 void HandleMainMenu(int mx, int my, int dx, int dy, int button)
 {
-  static unsigned long level_delay = 0;
   static int choice = 5;
   int x = 0;
   int y = choice;
@@ -725,52 +661,9 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
       y = choice + dy;
   }
 
-  if (y == 1 && ((x == 10 && level_nr > leveldir_current->first_level) ||
-                (x == 14 && level_nr < leveldir_current->last_level)) &&
-      button && DelayReached(&level_delay, GADGET_FRAME_DELAY))
+  if (y == 1 && dx != 0 && button)
   {
-    int step = (button == 1 ? 1 : button == 2 ? 5 : 10);
-    int old_level_nr = level_nr;
-    int new_level_nr;
-
-    new_level_nr = level_nr + (x == 10 ? -step : +step);
-    if (new_level_nr < leveldir_current->first_level)
-      new_level_nr = leveldir_current->first_level;
-    if (new_level_nr > leveldir_current->last_level)
-      new_level_nr = leveldir_current->last_level;
-
-    if (setup.handicap && new_level_nr > leveldir_current->handicap_level)
-    {
-      /* skipping levels is only allowed when trying to skip single level */
-      if (setup.skip_levels && step == 1 &&
-         Request("Level still unsolved ! Skip despite handicap ?", REQ_ASK))
-      {
-       leveldir_current->handicap_level++;
-       SaveLevelSetup_SeriesInfo();
-      }
-
-      new_level_nr = leveldir_current->handicap_level;
-    }
-
-    if (new_level_nr != old_level_nr)
-    {
-      level_nr = new_level_nr;
-
-      DrawText(mSX + 11 * 32, mSY + 3 * 32, int2str(level_nr, 3),
-              FONT_VALUE_1);
-
-      LoadLevel(level_nr);
-      DrawMicroLevel(MICROLEVEL_XPOS, MICROLEVEL_YPOS, TRUE);
-
-      TapeErase();
-      LoadTape(level_nr);
-      DrawCompleteVideoDisplay();
-
-      /* needed because DrawMicroLevel() takes some time */
-      BackToFront();
-      SyncDisplay();
-      DelayReached(&level_delay, 0);   /* reset delay counter */
-    }
+    HandleMainMenu_SelectLevel(1, dx < 0 ? -1 : +1);
   }
   else if (IN_VIS_FIELD(x, y) &&
           y >= 0 && y <= 7 && (y != 1 || x < 10))
@@ -849,7 +742,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
 
   if (game_status == GAME_MODE_MAIN)
   {
-    DrawMicroLevel(MICROLEVEL_XPOS, MICROLEVEL_YPOS, FALSE);
+    DrawPreviewLevel(FALSE);
     DoAnimation();
   }
 }
@@ -918,7 +811,7 @@ static struct TokenInfo info_info_main[] =
   { 0,                 NULL,                   NULL                    }
 };
 
-static void DrawInfoScreen_Main(int fade_delay)
+static void DrawInfoScreen_Main(boolean do_fading)
 {
   int i;
 
@@ -927,11 +820,7 @@ static void DrawInfoScreen_Main(int fade_delay)
 
   ClearWindow();
 
-#if 1
   DrawTextSCentered(mSY - SY + 16, FONT_TITLE_1, "Info Screen");
-#else
-  DrawText(mSX + 16, mSY + 16, "Info Screen", FONT_TITLE_1);
-#endif
 
   info_info = info_info_main;
   num_info_info = 0;
@@ -944,9 +833,9 @@ static void DrawInfoScreen_Main(int fade_delay)
 
     DrawText(mSX + xpos * 32, mSY + ypos * 32, info_info[i].text, font_nr);
 
-    if (info_info[i].type & TYPE_ENTER_MENU)
+    if (info_info[i].type & (TYPE_ENTER_MENU|TYPE_ENTER_LIST))
       initCursor(i, IMG_MENU_BUTTON_ENTER_MENU);
-    else if (info_info[i].type & TYPE_LEAVE_MENU)
+    else if (info_info[i].type & (TYPE_LEAVE_MENU|TYPE_LEAVE_LIST))
       initCursor(i, IMG_MENU_BUTTON_LEAVE_MENU);
     else if (info_info[i].type & ~TYPE_SKIP_ENTRY)
       initCursor(i, IMG_MENU_BUTTON);
@@ -954,26 +843,17 @@ static void DrawInfoScreen_Main(int fade_delay)
     num_info_info++;
   }
 
-#if 1
-
   HandleInfoScreen_Main(0, 0, 0, 0, MB_MENU_INITIALIZE);
 
   PlayMenuSound();
   PlayMenuMusic();
 
-  FadeIn(fade_delay);
-  InitAnimation();
-
-#else
+  if (do_fading)
+    FadeIn(REDRAW_ALL);
+  else
+    BackToFront();
 
-  FadeToFront();
   InitAnimation();
-
-  PlayMenuSound();
-  PlayMenuMusic();
-
-  HandleInfoScreen_Main(0, 0, 0, 0, MB_MENU_INITIALIZE);
-#endif
 }
 
 void HandleInfoScreen_Main(int mx, int my, int dx, int dy, int button)
@@ -1019,7 +899,7 @@ void HandleInfoScreen_Main(int mx, int my, int dx, int dy, int button)
   {
     if (dx)
     {
-      int menu_navigation_type = (dx < 0 ? TYPE_LEAVE_MENU : TYPE_ENTER_MENU);
+      int menu_navigation_type = (dx < 0 ? TYPE_LEAVE : TYPE_ENTER);
 
       if (info_info[choice].type & menu_navigation_type ||
          info_info[choice].type & TYPE_ENTER_SCREEN ||
@@ -1049,7 +929,7 @@ void HandleInfoScreen_Main(int mx, int my, int dx, int dy, int button)
     }
     else if (!(info_info[y].type & TYPE_GHOSTED))
     {
-      if (info_info[y].type & TYPE_ENTER_OR_LEAVE_MENU)
+      if (info_info[y].type & TYPE_ENTER_OR_LEAVE)
       {
        void (*menu_callback_function)(void) = info_info[choice].value;
 
@@ -1388,6 +1268,9 @@ void HandleInfoScreen_Music(int button)
 
     FadeSoundsAndMusic();
 
+    if (button != MB_MENU_INITIALIZE)
+      FadeCrossSaveBackbuffer();
+
     ClearWindow();
     DrawHeadline();
 
@@ -1449,6 +1332,9 @@ void HandleInfoScreen_Music(int button)
 
     DrawTextSCentered(ybottom, FONT_TEXT_4,
                      "Press any key or button for next page");
+
+    if (button != MB_MENU_INITIALIZE)
+      FadeCross(REDRAW_FIELD);
   }
 
   if (list != NULL && list->is_sound && sound_info[list->music].loop)
@@ -1653,9 +1539,19 @@ void HandleInfoScreen_Credits(int button)
   }
   else if (button == MB_MENU_CHOICE)
   {
+    boolean show_screen;
+
     screen_nr++;
 
-    if (!DrawInfoScreen_CreditsScreen(screen_nr))
+    FadeCrossSaveBackbuffer();
+
+    show_screen = DrawInfoScreen_CreditsScreen(screen_nr);
+  
+    if (show_screen)
+    {
+      FadeCross(REDRAW_FIELD);
+    }
+    else
     {
       FadeSoundsAndMusic();
 
@@ -1686,7 +1582,7 @@ void DrawInfoScreen_Program()
   DrawTextSCentered(ystart + 1 * ystep, FONT_TEXT_2,
                    "If you like it, send e-mail to:");
   DrawTextSCentered(ystart + 2 * ystep, FONT_TEXT_3,
-                   "info@artsoft.org");
+                   PROGRAM_EMAIL_STRING);
   DrawTextSCentered(ystart + 3 * ystep, FONT_TEXT_2,
                    "or SnailMail to:");
   DrawTextSCentered(ystart + 4 * ystep + 0, FONT_TEXT_3,
@@ -1697,12 +1593,15 @@ void DrawInfoScreen_Program()
                    "33604 Bielefeld");
   DrawTextSCentered(ystart + 4 * ystep + 60, FONT_TEXT_3,
                    "Germany");
-
   DrawTextSCentered(ystart + 7 * ystep, FONT_TEXT_2,
+                   "More information and levels:");
+  DrawTextSCentered(ystart + 8 * ystep, FONT_TEXT_3,
+                   PROGRAM_WEBSITE_STRING);
+  DrawTextSCentered(ystart + 9 * ystep, FONT_TEXT_2,
                    "If you have created new levels,");
-  DrawTextSCentered(ystart + 8 * ystep, FONT_TEXT_2,
+  DrawTextSCentered(ystart + 10 * ystep, FONT_TEXT_2,
                    "send them to me to include them!");
-  DrawTextSCentered(ystart + 9 * ystep, FONT_TEXT_2,
+  DrawTextSCentered(ystart + 11 * ystep, FONT_TEXT_2,
                    ":-)");
 
   DrawTextSCentered(ybottom, FONT_TEXT_4,
@@ -1792,7 +1691,7 @@ void HandleInfoScreen_LevelSet(int button)
   }
 }
 
-static void DrawInfoScreenExt(int fade_delay)
+static void DrawInfoScreenExt(boolean do_fading)
 {
   SetMainBackgroundImage(IMG_BACKGROUND_INFO);
 
@@ -1809,7 +1708,7 @@ static void DrawInfoScreenExt(int fade_delay)
   else if (info_mode == INFO_MODE_LEVELSET)
     DrawInfoScreen_LevelSet();
   else
-    DrawInfoScreen_Main(fade_delay);
+    DrawInfoScreen_Main(do_fading);
 
   if (info_mode != INFO_MODE_MAIN &&
       info_mode != INFO_MODE_TITLE &&
@@ -1920,7 +1819,7 @@ static void DrawChooseTree(TreeInfo **ti_ptr)
   ClearWindow();
 
   HandleChooseTree(0, 0, 0, 0, MB_MENU_INITIALIZE, ti_ptr);
-  MapChooseTreeGadgets(*ti_ptr);
+  MapScreenTreeGadgets(*ti_ptr);
 
   FadeToFront();
   InitAnimation();
@@ -1948,38 +1847,15 @@ static void drawChooseTreeList(int first_entry, int num_page_entries,
 {
   int i;
   char *title_string = NULL;
-#if 0
-  int xoffset_sets = 16;
-#endif
   int yoffset_sets = MENU_TITLE1_YPOS;
-#if 0
-  int xoffset_setup = 16;
-#endif
   int yoffset_setup = 16;
-#if 1
-#if 0
-  int xoffset = (ti->type == TREE_TYPE_LEVEL_DIR ? xoffset_sets :
-                xoffset_setup);
-#endif
   int yoffset = (ti->type == TREE_TYPE_LEVEL_DIR ? yoffset_sets :
                 yoffset_setup);
-#else
-  int xoffset = (ti->type == TREE_TYPE_LEVEL_DIR ? 0 : xoffset_setup);
-  int yoffset = (ti->type == TREE_TYPE_LEVEL_DIR ? 0 : yoffset_setup);
-#endif
   int last_game_status = game_status;  /* save current game status */
 
-  title_string =
-    (ti->type == TREE_TYPE_LEVEL_DIR ? "Level Sets" :
-     ti->type == TREE_TYPE_GRAPHICS_DIR ? "Custom Graphics" :
-     ti->type == TREE_TYPE_SOUNDS_DIR ? "Custom Sounds" :
-     ti->type == TREE_TYPE_MUSIC_DIR ? "Custom Music" : "");
+  title_string = ti->infotext;
 
-#if 1
   DrawTextSCentered(mSY - SY + yoffset, FONT_TITLE_1, title_string);
-#else
-  DrawText(SX + xoffset, SY + yoffset, title_string, FONT_TITLE_1);
-#endif
 
   /* force LEVELS font on artwork setup screen */
   game_status = GAME_MODE_LEVELS;
@@ -2030,11 +1906,7 @@ static void drawChooseTreeInfo(int entry_pos, TreeInfo *ti)
 {
   TreeInfo *node, *node_first;
   int x, last_redraw_mask = redraw_mask;
-#if 1
   int ypos = MENU_TITLE2_YPOS;
-#else
-  int ypos = 40;
-#endif
 
   if (ti->type != TREE_TYPE_LEVEL_DIR)
     return;
@@ -2123,7 +1995,13 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
     }
     else if (game_status == GAME_MODE_SETUP)
     {
-      execSetupArtwork();
+      if (game_status == GAME_MODE_SETUP)
+      {
+       if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
+         execSetupGraphics();
+       else
+         execSetupArtwork();
+      }
     }
     else
     {
@@ -2276,7 +2154,10 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
 
        if (game_status == GAME_MODE_SETUP)
        {
-         execSetupArtwork();
+         if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
+           execSetupGraphics();
+         else
+           execSetupArtwork();
        }
        else
        {
@@ -2314,13 +2195,16 @@ void DrawHallOfFame(int highlight_position)
   if (highlight_position < 0) 
     LoadScore(level_nr);
 
-  FadeToFront();
+  FadeOut(REDRAW_FIELD);
+
   InitAnimation();
 
   PlayMenuSound();
   PlayMenuMusic();
 
   HandleHallOfFame(highlight_position, 0, 0, 0, MB_MENU_INITIALIZE);
+
+  FadeIn(REDRAW_FIELD);
 }
 
 static void drawHallOfFameList(int first_entry, int highlight_position)
@@ -2330,15 +2214,9 @@ static void drawHallOfFameList(int first_entry, int highlight_position)
   SetMainBackgroundImage(IMG_BACKGROUND_SCORES);
   ClearWindow();
 
-#if 1
   DrawTextSCentered(MENU_TITLE1_YPOS, FONT_TITLE_1, "Hall Of Fame");
   DrawTextFCentered(MENU_TITLE2_YPOS, FONT_TITLE_2,
                    "HighScores of Level %d", level_nr);
-#else
-  DrawText(mSX + 80, mSY + MENU_TITLE1_YPOS, "Hall Of Fame", FONT_TITLE_1);
-  DrawTextFCentered(MENU_TITLE2_YPOS, FONT_TITLE_2,
-                   "HighScores of Level %d", level_nr);
-#endif
 
   for (i = 0; i < NUM_MENU_ENTRIES_ON_SCREEN; i++)
   {
@@ -2371,7 +2249,6 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
   static int first_entry = 0;
   static int highlight_position = 0;
   int step = (button == 1 ? 1 : button == 2 ? 5 : 10);
-  int button_released = !button;
 
   if (button == MB_MENU_INITIALIZE)
   {
@@ -2407,12 +2284,23 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
       drawHallOfFameList(first_entry, highlight_position);
     }
   }
-  else if (button_released)
+  else if (button == MB_MENU_LEAVE)
   {
     FadeSound(SND_BACKGROUND_SCORES);
+
     game_status = GAME_MODE_MAIN;
+
     DrawMainMenu();
   }
+  else if (button == MB_MENU_CHOICE)
+  {
+    FadeSound(SND_BACKGROUND_SCORES);
+    FadeOut(REDRAW_FIELD);
+
+    game_status = GAME_MODE_MAIN;
+
+    DrawAndFadeInMainMenu(REDRAW_FIELD);
+  }
 
   if (game_status == GAME_MODE_SCORES)
     PlayMenuSoundIfLoop();
@@ -2428,6 +2316,7 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
 static struct TokenInfo *setup_info;
 static int num_setup_info;
 
+static char *screen_mode_text;
 static char *graphics_set_name;
 static char *sounds_set_name;
 static char *music_set_name;
@@ -2452,10 +2341,75 @@ static void execSetupEditor()
 
 static void execSetupGraphics()
 {
+  if (video.fullscreen_available && screen_modes == NULL)
+  {
+    int i;
+
+    for (i = 0; video.fullscreen_modes[i].width != -1; i++)
+    {
+      TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED);
+      char identifier[32], name[32];
+      int x = video.fullscreen_modes[i].width;
+      int y = video.fullscreen_modes[i].height;
+      int xx, yy;
+
+      get_aspect_ratio_from_screen_mode(&video.fullscreen_modes[i], &xx, &yy);
+
+      ti->node_top = &screen_modes;
+      ti->sort_priority = x * 10000 + y;
+
+      sprintf(identifier, "%dx%d", x, y);
+      sprintf(name,     "%d x %d [%d:%d]", x, y, xx, yy);
+
+      setString(&ti->identifier, identifier);
+      setString(&ti->name, name);
+      setString(&ti->name_sorting, name);
+      setString(&ti->infotext, "Fullscreen Mode");
+
+      pushTreeInfo(&screen_modes, ti);
+    }
+
+    /* sort fullscreen modes to start with lowest available screen resolution */
+    sortTreeInfo(&screen_modes);
+
+    /* set current screen mode for fullscreen mode to configured setup value */
+    screen_mode_current = getTreeInfoFromIdentifier(screen_modes,
+                                                   setup.fullscreen_mode);
+
+    /* if that fails, set current screen mode to reliable default value */
+    if (screen_mode_current == NULL)
+      screen_mode_current = getTreeInfoFromIdentifier(screen_modes,
+                                                     DEFAULT_FULLSCREEN_MODE);
+
+    /* if that also fails, set current screen mode to first available mode */
+    if (screen_mode_current == NULL)
+      screen_mode_current = screen_modes;
+
+    if (screen_mode_current == NULL)
+      video.fullscreen_available = FALSE;
+  }
+
+  if (video.fullscreen_available)
+  {
+    setup.fullscreen_mode = screen_mode_current->identifier;
+
+    /* needed for displaying screen mode name instead of identifier */
+    screen_mode_text = screen_mode_current->name;
+  }
+
   setup_mode = SETUP_MODE_GRAPHICS;
   DrawSetupScreen();
 }
 
+static void execSetupChooseScreenMode()
+{
+  if (!video.fullscreen_available)
+    return;
+
+  setup_mode = SETUP_MODE_CHOOSE_SCREEN_MODE;
+  DrawSetupScreen();
+}
+
 static void execSetupSound()
 {
   setup_mode = SETUP_MODE_SOUND;
@@ -2593,13 +2547,15 @@ static struct TokenInfo setup_info_editor[] =
 
 static struct TokenInfo setup_info_graphics[] =
 {
-  { TYPE_SWITCH,       &setup.fullscreen,      "Fullscreen Mode:"      },
+  { TYPE_SWITCH,       &setup.fullscreen,      "Fullscreen:"           },
+  { TYPE_ENTER_LIST,   execSetupChooseScreenMode, "Fullscreen Mode:"   },
+  { TYPE_STRING,       &screen_mode_text,      ""                      },
   { TYPE_SWITCH,       &setup.scroll_delay,    "Delayed Scrolling:"    },
 #if 0
   { TYPE_SWITCH,       &setup.soft_scrolling,  "Soft Scrolling:"       },
   { TYPE_SWITCH,       &setup.double_buffering,"Double-Buffering:"     },
-  { TYPE_SWITCH,       &setup.fading,          "Fading:"               },
 #endif
+  { TYPE_SWITCH,       &setup.fade_screens,    "Fade Screens:"         },
   { TYPE_SWITCH,       &setup.quick_switch,    "Quick Player Focus Switch:" },
   { TYPE_SWITCH,       &setup.quick_doors,     "Quick Menu Doors:"     },
   { TYPE_SWITCH,       &setup.show_titlescreen,"Show Title Screens:"   },
@@ -2624,11 +2580,11 @@ static struct TokenInfo setup_info_sound[] =
 
 static struct TokenInfo setup_info_artwork[] =
 {
-  { TYPE_ENTER_MENU,   execSetupChooseGraphics,"Custom Graphics"       },
+  { TYPE_ENTER_LIST,   execSetupChooseGraphics,"Custom Graphics:"      },
   { TYPE_STRING,       &graphics_set_name,     ""                      },
-  { TYPE_ENTER_MENU,   execSetupChooseSounds,  "Custom Sounds"         },
+  { TYPE_ENTER_LIST,   execSetupChooseSounds,  "Custom Sounds:"        },
   { TYPE_STRING,       &sounds_set_name,       ""                      },
-  { TYPE_ENTER_MENU,   execSetupChooseMusic,   "Custom Music"          },
+  { TYPE_ENTER_LIST,   execSetupChooseMusic,   "Custom Music:"         },
   { TYPE_STRING,       &music_set_name,        ""                      },
   { TYPE_EMPTY,                NULL,                   ""                      },
 #if 1
@@ -2735,7 +2691,8 @@ static int getSetupTextFont(int type)
              TYPE_YES_NO |
              TYPE_STRING |
              TYPE_ECS_AGA |
-             TYPE_KEYTEXT))
+             TYPE_KEYTEXT |
+             TYPE_ENTER_LIST))
     return FONT_MENU_2;
   else
     return FONT_MENU_1;
@@ -2774,18 +2731,11 @@ static void drawSetupValue(int pos)
 
   if (type & TYPE_KEY)
   {
-#if 1
     xpos = MENU_SCREEN_START_XPOS;
-#else
-    xpos = 3;
-#endif
 
     if (type & TYPE_QUERY)
     {
       value_string = "<press key>";
-#if 0
-      font_nr = FONT_INPUT_1_ACTIVE;
-#endif
     }
   }
   else if (type & TYPE_STRING)
@@ -2793,25 +2743,10 @@ static void drawSetupValue(int pos)
     int max_value_len = (SCR_FIELDX - 2) * 2;
 
     xpos = MENU_SCREEN_START_XPOS;
-#if 0
-    font_nr = FONT_VALUE_2;
-#endif
 
     if (strlen(value_string) > max_value_len)
       value_string[max_value_len] = '\0';
   }
-  else if (type & TYPE_ECS_AGA)
-  {
-#if 0
-    font_nr = FONT_VALUE_1;
-#endif
-  }
-  else if (type & TYPE_BOOLEAN_STYLE)
-  {
-#if 0
-    font_nr = (*(boolean *)value ? FONT_OPTION_ON : FONT_OPTION_OFF);
-#endif
-  }
 
   startx = mSX + xpos * 32;
   starty = mSY + ypos * 32;
@@ -2838,12 +2773,6 @@ static void drawSetupValue(int pos)
        startx + font2_xoffset < text_startx + text_width + text_font_xoffset)
       correct_font_draw_xoffset = TRUE;
 
-#if 0
-    printf("::: %d + %d < %d + %d + %d\n",
-          startx, font_xoffset, text_startx, text_width, text_font_xoffset);
-    printf("::: => need correction == %d\n", correct_font_draw_xoffset);
-#endif
-
     /* check if setup value would overlap with setup text when printed */
     /* (this can happen for extreme/wrong values for font draw offset) */
     if (correct_font_draw_xoffset)
@@ -2859,18 +2788,8 @@ static void drawSetupValue(int pos)
     }
   }
 
-#if 1
   for (i = 0; i <= MENU_SCREEN_MAX_XPOS - xpos; i++)
     DrawText(startx + i * font_width, starty, " ", font_nr);
-#else
-#if 1
-  for (i = xpos; i <= MENU_SCREEN_MAX_XPOS; i++)
-    DrawText(mSX + i * 32, starty, " ", font_nr);
-#else
-  DrawText(startx, starty,
-          (xpos == 3 ? "              " : "   "), font_nr);
-#endif
-#endif
 
   DrawText(startx, starty, value_string, font_nr);
 
@@ -2951,11 +2870,7 @@ static void DrawSetupScreen_Generic()
     title_string = "Setup Shortcuts";
   }
 
-#if 1
   DrawTextSCentered(mSY - SY + 16, FONT_TITLE_1, title_string);
-#else
-  DrawText(mSX + 16, mSY + 16, title_string, FONT_TITLE_1);
-#endif
 
   num_setup_info = 0;
   for (i = 0; setup_info[i].type != 0 && i < NUM_MENU_ENTRIES_ON_SCREEN; i++)
@@ -2963,40 +2878,23 @@ static void DrawSetupScreen_Generic()
     void *value_ptr = setup_info[i].value;
     int xpos = MENU_SCREEN_START_XPOS;
     int ypos = MENU_SCREEN_START_YPOS + i;
-#if 1
     int font_nr;
-#else
-    int font_nr = FONT_MENU_1;
-#endif
 
     /* set some entries to "unchangeable" according to other variables */
     if ((value_ptr == &setup.sound_simple && !audio.sound_available) ||
        (value_ptr == &setup.sound_loops  && !audio.loops_available) ||
        (value_ptr == &setup.sound_music  && !audio.music_available) ||
-       (value_ptr == &setup.fullscreen   && !video.fullscreen_available))
+       (value_ptr == &setup.fullscreen   && !video.fullscreen_available) ||
+       (value_ptr == &screen_mode_text   && !video.fullscreen_available))
       setup_info[i].type |= TYPE_GHOSTED;
 
-#if 1
     font_nr = getSetupTextFont(setup_info[i].type);
-#else
-#if 1
-    if (setup_info[i].type & (TYPE_SWITCH |
-                             TYPE_YES_NO |
-                             TYPE_STRING |
-                             TYPE_ECS_AGA |
-                             TYPE_KEYTEXT))
-      font_nr = FONT_MENU_2;
-#else
-    if (setup_info[i].type & TYPE_STRING)
-      font_nr = FONT_MENU_2;
-#endif
-#endif
 
     DrawText(mSX + xpos * 32, mSY + ypos * 32, setup_info[i].text, font_nr);
 
-    if (setup_info[i].type & TYPE_ENTER_MENU)
+    if (setup_info[i].type & (TYPE_ENTER_MENU|TYPE_ENTER_LIST))
       initCursor(i, IMG_MENU_BUTTON_ENTER_MENU);
-    else if (setup_info[i].type & TYPE_LEAVE_MENU)
+    else if (setup_info[i].type & (TYPE_LEAVE_MENU|TYPE_LEAVE_LIST))
       initCursor(i, IMG_MENU_BUTTON_LEAVE_MENU);
     else if (setup_info[i].type & ~TYPE_SKIP_ENTRY)
       initCursor(i, IMG_MENU_BUTTON);
@@ -3033,6 +2931,7 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
     choice_store[setup_mode] = choice;
 
     drawCursor(choice, FC_RED);
+
     return;
   }
   else if (button == MB_MENU_LEAVE)
@@ -3044,6 +2943,7 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
        void (*menu_callback_function)(void) = setup_info[y].value;
 
        menu_callback_function();
+
        break;  /* absolutely needed because function changes 'setup_info'! */
       }
     }
@@ -3060,7 +2960,7 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
   {
     if (dx)
     {
-      int menu_navigation_type = (dx < 0 ? TYPE_LEAVE_MENU : TYPE_ENTER_MENU);
+      int menu_navigation_type = (dx < 0 ? TYPE_LEAVE : TYPE_ENTER);
 
       if (setup_info[choice].type & menu_navigation_type ||
          setup_info[choice].type & TYPE_BOOLEAN_STYLE)
@@ -3075,12 +2975,11 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
       y += dy;
   }
 
-  if (IN_VIS_FIELD(x, y) &&
-      y >= 0 && y < num_setup_info && setup_info[y].type & ~TYPE_SKIP_ENTRY)
+  if (IN_VIS_FIELD(x, y) && y >= 0 && y < num_setup_info)
   {
     if (button)
     {
-      if (y != choice)
+      if (y != choice && setup_info[y].type & ~TYPE_SKIP_ENTRY)
       {
        drawCursor(y, FC_RED);
        drawCursor(choice, FC_BLUE);
@@ -3089,18 +2988,24 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
     }
     else if (!(setup_info[y].type & TYPE_GHOSTED))
     {
-      if (setup_info[y].type & TYPE_ENTER_OR_LEAVE_MENU)
+      /* when selecting key headline, execute function for key value change */
+      if (setup_info[y].type & TYPE_KEYTEXT &&
+         setup_info[y + 1].type & TYPE_KEY)
+       y++;
+
+      /* when selecting string value, execute function for list selection */
+      if (setup_info[y].type & TYPE_STRING && y > 0 &&
+         setup_info[y - 1].type & TYPE_ENTER_LIST)
+       y--;
+
+      if (setup_info[y].type & TYPE_ENTER_OR_LEAVE)
       {
-       void (*menu_callback_function)(void) = setup_info[choice].value;
+       void (*menu_callback_function)(void) = setup_info[y].value;
 
        menu_callback_function();
       }
       else
       {
-       if (setup_info[y].type & TYPE_KEYTEXT &&
-           setup_info[y + 1].type & TYPE_KEY)
-         y++;
-
        if (setup_info[y].type & TYPE_VALUE)
          changeSetupValue(y);
       }
@@ -3112,20 +3017,13 @@ void DrawSetupScreen_Input()
 {
   ClearWindow();
 
-#if 1
   DrawTextSCentered(mSY - SY + 16, FONT_TITLE_1, "Setup Input");
-#else
-  DrawText(mSX + 16, mSY + 16, "Setup Input", FONT_TITLE_1);
-#endif
 
   initCursor(0,  IMG_MENU_BUTTON);
   initCursor(1,  IMG_MENU_BUTTON);
   initCursor(2,  IMG_MENU_BUTTON_ENTER_MENU);
   initCursor(13, IMG_MENU_BUTTON_LEAVE_MENU);
 
-  drawCursorXY(10, 0, IMG_MENU_BUTTON_LEFT);
-  drawCursorXY(12, 0, IMG_MENU_BUTTON_RIGHT);
-
   DrawText(mSX + 32, mSY +  2 * 32, "Player:", FONT_MENU_1);
   DrawText(mSX + 32, mSY +  3 * 32, "Device:", FONT_MENU_1);
   DrawText(mSX + 32, mSY + 15 * 32, "Back",   FONT_MENU_1);
@@ -3138,6 +3036,13 @@ void DrawSetupScreen_Input()
                    "Joysticks deactivated on this screen");
 #endif
 
+  /* create gadgets for setup input menu screen */
+  FreeScreenGadgets();
+  CreateScreenGadgets();
+
+  /* map gadgets for setup input menu screen */
+  MapScreenMenuGadgets(SCREEN_MASK_INPUT);
+
   HandleSetupScreen_Input(0, 0, 0, 0, MB_MENU_INITIALIZE);
   FadeToFront();
   InitAnimation();
@@ -3241,10 +3146,30 @@ static void drawPlayerSetupInputInfo(int player_nr)
   }
 }
 
+static int input_player_nr = 0;
+
+void HandleSetupScreen_Input_Player(int step, int direction)
+{
+  int old_player_nr = input_player_nr;
+  int new_player_nr;
+
+  new_player_nr = old_player_nr + step * direction;
+  if (new_player_nr < 0)
+    new_player_nr = 0;
+  if (new_player_nr > MAX_PLAYERS - 1)
+    new_player_nr = MAX_PLAYERS - 1;
+
+  if (new_player_nr != old_player_nr)
+  {
+    input_player_nr = new_player_nr;
+
+    drawPlayerSetupInputInfo(input_player_nr);
+  }
+}
+
 void HandleSetupScreen_Input(int mx, int my, int dx, int dy, int button)
 {
   static int choice = 0;
-  static int player_nr = 0;
   int x = 0;
   int y = choice;
   int pos_start  = SETUPINPUT_SCREEN_POS_START;
@@ -3254,7 +3179,7 @@ void HandleSetupScreen_Input(int mx, int my, int dx, int dy, int button)
 
   if (button == MB_MENU_INITIALIZE)
   {
-    drawPlayerSetupInputInfo(player_nr);
+    drawPlayerSetupInputInfo(input_player_nr);
     drawCursor(choice, FC_RED);
 
     return;
@@ -3288,17 +3213,9 @@ void HandleSetupScreen_Input(int mx, int my, int dx, int dy, int button)
       y = (dy > 0 ? pos_empty2 + 1 : pos_empty1 - 1);
   }
 
-  if (IN_VIS_FIELD(x, y) &&
-      y == 0 && ((x < 10 && !button) || ((x == 10 || x == 12) && button)))
+  if (y == 0 && dx != 0 && button)
   {
-    static unsigned long delay = 0;
-
-    if (!DelayReached(&delay, GADGET_FRAME_DELAY))
-      return;
-
-    player_nr = (player_nr + (x == 10 ? -1 : +1) + MAX_PLAYERS) % MAX_PLAYERS;
-
-    drawPlayerSetupInputInfo(player_nr);
+    HandleSetupScreen_Input_Player(1, dx < 0 ? -1 : +1);
   }
   else if (IN_VIS_FIELD(x, y) &&
           y >= pos_start && y <= pos_end &&
@@ -3317,14 +3234,14 @@ void HandleSetupScreen_Input(int mx, int my, int dx, int dy, int button)
     {
       if (y == 1)
       {
-       char *device_name = setup.input[player_nr].joy.device_name;
+       char *device_name = setup.input[input_player_nr].joy.device_name;
 
-       if (!setup.input[player_nr].use_joystick)
+       if (!setup.input[input_player_nr].use_joystick)
        {
          int new_device_nr = (dx >= 0 ? 0 : MAX_PLAYERS - 1);
 
          setJoystickDeviceToNr(device_name, new_device_nr);
-         setup.input[player_nr].use_joystick = TRUE;
+         setup.input[input_player_nr].use_joystick = TRUE;
        }
        else
        {
@@ -3332,22 +3249,22 @@ void HandleSetupScreen_Input(int mx, int my, int dx, int dy, int button)
          int new_device_nr = device_nr + (dx >= 0 ? +1 : -1);
 
          if (new_device_nr < 0 || new_device_nr >= MAX_PLAYERS)
-           setup.input[player_nr].use_joystick = FALSE;
+           setup.input[input_player_nr].use_joystick = FALSE;
          else
            setJoystickDeviceToNr(device_name, new_device_nr);
        }
 
-       drawPlayerSetupInputInfo(player_nr);
+       drawPlayerSetupInputInfo(input_player_nr);
       }
       else if (y == 2)
       {
-       if (setup.input[player_nr].use_joystick)
+       if (setup.input[input_player_nr].use_joystick)
        {
          InitJoysticks();
-         CalibrateJoystick(player_nr);
+         CalibrateJoystick(input_player_nr);
        }
        else
-         CustomizeKeyboard(player_nr);
+         CustomizeKeyboard(input_player_nr);
       }
       else if (y == pos_end)
       {
@@ -3385,11 +3302,7 @@ void CustomizeKeyboard(int player_nr)
 
   ClearWindow();
 
-#if 1
   DrawTextSCentered(mSY - SY + 16, FONT_TITLE_1, "Keyboard Input");
-#else
-  DrawText(mSX + 16, mSY + 16, "Keyboard Input", FONT_TITLE_1);
-#endif
 
   BackToFront();
   InitAnimation();
@@ -3713,6 +3626,8 @@ void DrawSetupScreen()
 
   if (setup_mode == SETUP_MODE_INPUT)
     DrawSetupScreen_Input();
+  else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
+    DrawChooseTree(&screen_mode_current);
   else if (setup_mode == SETUP_MODE_CHOOSE_GRAPHICS)
     DrawChooseTree(&artwork.gfx_current);
   else if (setup_mode == SETUP_MODE_CHOOSE_SOUNDS)
@@ -3730,6 +3645,8 @@ void HandleSetupScreen(int mx, int my, int dx, int dy, int button)
 {
   if (setup_mode == SETUP_MODE_INPUT)
     HandleSetupScreen_Input(mx, my, dx, dy, button);
+  else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
+    HandleChooseTree(mx, my, dx, dy, button, &screen_mode_current);
   else if (setup_mode == SETUP_MODE_CHOOSE_GRAPHICS)
     HandleChooseTree(mx, my, dx, dy, button, &artwork.gfx_current);
   else if (setup_mode == SETUP_MODE_CHOOSE_SOUNDS)
@@ -3756,6 +3673,74 @@ void HandleGameActions()
 
 /* ---------- new screen button stuff -------------------------------------- */
 
+static void getScreenMenuButtonPos(int *x, int *y, int gadget_id)
+{
+  switch (gadget_id)
+  {
+    case SCREEN_CTRL_ID_LAST_LEVEL:
+      *x = mSX + TILEX * getLastLevelButtonPos();
+      *y = mSY + TILEY * (MENU_SCREEN_START_YPOS + 1);
+      break;
+
+    case SCREEN_CTRL_ID_NEXT_LEVEL:
+      *x = mSX + TILEX * getNextLevelButtonPos();
+      *y = mSY + TILEY * (MENU_SCREEN_START_YPOS + 1);
+      break;
+
+    case SCREEN_CTRL_ID_LAST_PLAYER:
+      *x = mSX + TILEX * 10;
+      *y = mSY + TILEY * MENU_SCREEN_START_YPOS;
+      break;
+
+    case SCREEN_CTRL_ID_NEXT_PLAYER:
+      *x = mSX + TILEX * 12;
+      *y = mSY + TILEY * MENU_SCREEN_START_YPOS;
+      break;
+
+    default:
+      Error(ERR_EXIT, "unknown gadget ID %d", gadget_id);
+  }
+}
+
+static struct
+{
+  int gfx_unpressed, gfx_pressed;
+  void (*get_gadget_position)(int *, int *, int);
+  int gadget_id;
+  int screen_mask;
+  char *infotext;
+} menubutton_info[NUM_SCREEN_MENUBUTTONS] =
+{
+  {
+    IMG_MENU_BUTTON_LAST_LEVEL, IMG_MENU_BUTTON_LAST_LEVEL_ACTIVE,
+    getScreenMenuButtonPos,
+    SCREEN_CTRL_ID_LAST_LEVEL,
+    SCREEN_MASK_MAIN,
+    "last level"
+  },
+  {
+    IMG_MENU_BUTTON_NEXT_LEVEL, IMG_MENU_BUTTON_NEXT_LEVEL_ACTIVE,
+    getScreenMenuButtonPos,
+    SCREEN_CTRL_ID_NEXT_LEVEL,
+    SCREEN_MASK_MAIN,
+    "next level"
+  },
+  {
+    IMG_MENU_BUTTON_LEFT, IMG_MENU_BUTTON_LEFT_ACTIVE,
+    getScreenMenuButtonPos,
+    SCREEN_CTRL_ID_LAST_PLAYER,
+    SCREEN_MASK_INPUT,
+    "last player"
+  },
+  {
+    IMG_MENU_BUTTON_RIGHT, IMG_MENU_BUTTON_RIGHT_ACTIVE,
+    getScreenMenuButtonPos,
+    SCREEN_CTRL_ID_NEXT_PLAYER,
+    SCREEN_MASK_INPUT,
+    "next player"
+  },
+};
+
 static struct
 {
   int gfx_unpressed, gfx_pressed;
@@ -3806,6 +3791,59 @@ static struct
   }
 };
 
+static void CreateScreenMenubuttons()
+{
+  struct GadgetInfo *gi;
+  unsigned long event_mask;
+  int i;
+
+  for (i = 0; i < NUM_SCREEN_MENUBUTTONS; i++)
+  {
+    Bitmap *gd_bitmap_unpressed, *gd_bitmap_pressed;
+    int gfx_unpressed, gfx_pressed;
+    int x, y, width, height;
+    int gd_x1, gd_x2, gd_y1, gd_y2;
+    int id = menubutton_info[i].gadget_id;
+
+    event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED;
+
+    menubutton_info[i].get_gadget_position(&x, &y, id);
+
+    width = SC_MENUBUTTON_XSIZE;
+    height = SC_MENUBUTTON_YSIZE;
+
+    gfx_unpressed = menubutton_info[i].gfx_unpressed;
+    gfx_pressed   = menubutton_info[i].gfx_pressed;
+    gd_bitmap_unpressed = graphic_info[gfx_unpressed].bitmap;
+    gd_bitmap_pressed   = graphic_info[gfx_pressed].bitmap;
+    gd_x1 = graphic_info[gfx_unpressed].src_x;
+    gd_y1 = graphic_info[gfx_unpressed].src_y;
+    gd_x2 = graphic_info[gfx_pressed].src_x;
+    gd_y2 = graphic_info[gfx_pressed].src_y;
+
+    gi = CreateGadget(GDI_CUSTOM_ID, id,
+                     GDI_CUSTOM_TYPE_ID, i,
+                     GDI_INFO_TEXT, menubutton_info[i].infotext,
+                     GDI_X, x,
+                     GDI_Y, y,
+                     GDI_WIDTH, width,
+                     GDI_HEIGHT, height,
+                     GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
+                     GDI_STATE, GD_BUTTON_UNPRESSED,
+                     GDI_DESIGN_UNPRESSED, gd_bitmap_unpressed, gd_x1, gd_y1,
+                     GDI_DESIGN_PRESSED, gd_bitmap_pressed, gd_x2, gd_y2,
+                     GDI_DIRECT_DRAW, FALSE,
+                     GDI_EVENT_MASK, event_mask,
+                     GDI_CALLBACK_ACTION, HandleScreenGadgets,
+                     GDI_END);
+
+    if (gi == NULL)
+      Error(ERR_EXIT, "cannot create gadget");
+
+    screen_gadget[id] = gi;
+  }
+}
+
 static void CreateScreenScrollbuttons()
 {
   struct GadgetInfo *gi;
@@ -3924,6 +3962,10 @@ static void CreateScreenScrollbars()
                      GDI_SCROLLBAR_ITEMS_MAX, items_max,
                      GDI_SCROLLBAR_ITEMS_VISIBLE, items_visible,
                      GDI_SCROLLBAR_ITEM_POSITION, item_position,
+                     GDI_WHEEL_AREA_X, 0,
+                     GDI_WHEEL_AREA_Y, 0,
+                     GDI_WHEEL_AREA_WIDTH, WIN_XSIZE,
+                     GDI_WHEEL_AREA_HEIGHT, WIN_YSIZE,
                      GDI_STATE, GD_BUTTON_UNPRESSED,
                      GDI_DESIGN_UNPRESSED, gd_bitmap_unpressed, gd_x1, gd_y1,
                      GDI_DESIGN_PRESSED, gd_bitmap_pressed, gd_x2, gd_y2,
@@ -3965,6 +4007,8 @@ void CreateScreenGadgets()
   }
 #endif
 
+  CreateScreenMenubuttons();
+
   /* force LEVELS draw offset for scrollbar / scrollbutton gadgets */
   game_status = GAME_MODE_LEVELS;
 
@@ -3993,37 +4037,54 @@ void FreeScreenGadgets()
     FreeGadget(screen_gadget[i]);
 }
 
-void MapChooseTreeGadgets(TreeInfo *ti)
+void MapScreenMenuGadgets(int screen_mask)
 {
-  int num_entries = numTreeInfoInGroup(ti);
   int i;
 
-  if (num_entries <= NUM_MENU_ENTRIES_ON_SCREEN)
-    return;
-
-  for (i = 0; i < NUM_SCREEN_GADGETS; i++)
-    MapGadget(screen_gadget[i]);
+  for (i = 0; i < NUM_SCREEN_MENUBUTTONS; i++)
+    if (screen_mask & menubutton_info[i].screen_mask)
+      MapGadget(screen_gadget[menubutton_info[i].gadget_id]);
 }
 
-#if 0
-void UnmapChooseTreeGadgets()
+void MapScreenTreeGadgets(TreeInfo *ti)
 {
+  int num_entries = numTreeInfoInGroup(ti);
   int i;
 
-  for (i = 0; i < NUM_SCREEN_GADGETS; i++)
-    UnmapGadget(screen_gadget[i]);
+  if (num_entries <= NUM_MENU_ENTRIES_ON_SCREEN)
+    return;
+
+  for (i = 0; i < NUM_SCREEN_SCROLLBUTTONS; i++)
+    MapGadget(screen_gadget[scrollbutton_info[i].gadget_id]);
+
+  for (i = 0; i < NUM_SCREEN_SCROLLBARS; i++)
+    MapGadget(screen_gadget[scrollbar_info[i].gadget_id]);
 }
-#endif
 
 static void HandleScreenGadgets(struct GadgetInfo *gi)
 {
   int id = gi->custom_id;
-
-  if (game_status != GAME_MODE_LEVELS && game_status != GAME_MODE_SETUP)
-    return;
+  int button = gi->event.button;
+  int step = (button == 1 ? 1 : button == 2 ? 5 : 10);
 
   switch (id)
   {
+    case SCREEN_CTRL_ID_LAST_LEVEL:
+      HandleMainMenu_SelectLevel(step, -1);
+      break;
+
+    case SCREEN_CTRL_ID_NEXT_LEVEL:
+      HandleMainMenu_SelectLevel(step, +1);
+      break;
+
+    case SCREEN_CTRL_ID_LAST_PLAYER:
+      HandleSetupScreen_Input_Player(step, -1);
+      break;
+
+    case SCREEN_CTRL_ID_NEXT_PLAYER:
+      HandleSetupScreen_Input_Player(step, +1);
+      break;
+
     case SCREEN_CTRL_ID_SCROLL_UP:
       if (game_status == GAME_MODE_LEVELS)
        HandleChooseLevel(0,0, 0, -1 * SCROLL_LINE, MB_MENU_MARK);
index e895c4feefa9610b74200a8b745989bb8308cdad..6f8cb1fb87d192b9cf588d884f20a29bc9cabdfa 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -21,6 +21,8 @@
 #define SCROLL_PAGE    (2 * SCR_FIELDY)
 
 
+void DrawMainMenuExt(int, boolean);
+void DrawAndFadeInMainMenu(int);
 void DrawMainMenu(void);
 void DrawHallOfFame(int);
 
index 2f912cff26e45a63c98338504939b5d6e0a9d964..1259c0d5987ea87b51dbf1831e23d6f2ac24d5a7 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -542,14 +542,14 @@ static void TapeStartGameRecording()
 
 #if defined(NETWORK_AVALIABLE)
   if (options.network)
-    SendToServer_StartPlaying();
-  else
-#endif
   {
-    game_status = GAME_MODE_PLAYING;
-    StopAnimation();
-    InitGame();
+    SendToServer_StartPlaying();
+
+    return;
   }
+#endif
+
+  InitGame();
 }
 
 static void TapeAppendRecording()
@@ -706,8 +706,6 @@ static void TapeStartGamePlaying()
 {
   TapeStartPlaying();
 
-  game_status = GAME_MODE_PLAYING;
-  StopAnimation();
   InitGame();
 }
 
@@ -835,11 +833,6 @@ void TapeStop()
     DrawVideoDisplay(VIDEO_STATE_DATE_ON, tape.date);
     DrawVideoDisplay(VIDEO_STATE_TIME_ON, tape.length_seconds);
   }
-
-#if 0
-  if (tape.auto_play)
-    AutoPlayTape();    /* continue automatically playing next tape */
-#endif
 }
 
 unsigned int GetTapeLength()
index 18107addd01b106324effba8e4f9ba552d8d8fb0..fe636495df8b07380d58bb0fe4ce6c775ddb3023 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
index 3a2b962a3469435f1d8f00d6acf497f5be894d87..298a98bf45d893dba034070266f6296c269104c0 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -140,6 +140,9 @@ void RedrawPlayfield(boolean force_redraw, int x, int y, int width, int height)
     /* currently there is no partial redraw -- always redraw whole playfield */
 
     RedrawPlayfield_EM(TRUE);
+
+    /* blit playfield from scroll buffer to normal back buffer for fading in */
+    BlitScreenToBitmap_EM(backbuffer);
   }
   else if (game_status == GAME_MODE_PLAYING && !game.envelope_active)
   {
@@ -414,48 +417,63 @@ void FadeToFront()
   BackToFront();
 }
 
-void FadeIn(int fade_delay)
+void FadeExt(int fade_mask, int fade_mode)
 {
-  if (fade_delay == 0)
-  {
-    BackToFront();
+  Bitmap *bitmap = (fade_mode == FADE_MODE_CROSSFADE ? bitmap_db_cross : NULL);
+  int fade_delay = menu.fade_delay;
+  int post_delay = (fade_mode == FADE_MODE_FADE_OUT ? menu.post_delay : 0);
+  int x, y, width, height;
 
-    return;
+  if (fade_mask & REDRAW_FIELD)
+  {
+    x = REAL_SX;
+    y = REAL_SY;
+    width  = FULL_SXSIZE;
+    height = FULL_SYSIZE;
+  }
+  else         /* REDRAW_ALL */
+  {
+    x = 0;
+    y = 0;
+    width  = WIN_XSIZE;
+    height = WIN_YSIZE;
   }
 
-  FadeScreen(NULL, FADE_MODE_FADE_IN, fade_delay, 0);
-
-  redraw_mask = REDRAW_NONE;
-}
+  redraw_mask |= fade_mask;
 
-void FadeOut(int fade_delay, int post_delay)
-{
-  if (fade_delay == 0)
+  if (!setup.fade_screens || fade_delay == 0)
   {
-    ClearRectangle(backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE);
+    if (fade_mode == FADE_MODE_FADE_OUT)
+      ClearRectangle(backbuffer, x, y, width, height);
+
     BackToFront();
 
     return;
   }
 
-  FadeScreen(NULL, FADE_MODE_FADE_OUT, fade_delay, post_delay);
+  FadeRectangle(bitmap, x, y, width, height, fade_mode, fade_delay, post_delay);
 
-  redraw_mask = REDRAW_NONE;
+  redraw_mask &= ~fade_mask;
 }
 
-void FadeCross(int fade_delay)
+void FadeIn(int fade_mask)
 {
-  if (fade_delay == 0)
-  {
-    BlitBitmap(bitmap_db_title, backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
-    BackToFront();
+  FadeExt(fade_mask, FADE_MODE_FADE_IN);
+}
 
-    return;
-  }
+void FadeOut(int fade_mask)
+{
+  FadeExt(fade_mask, FADE_MODE_FADE_OUT);
+}
 
-  FadeScreen(bitmap_db_title, FADE_MODE_CROSSFADE, fade_delay, 0);
+void FadeCross(int fade_mask)
+{
+  FadeExt(fade_mask, FADE_MODE_CROSSFADE);
+}
 
-  redraw_mask = REDRAW_NONE;
+void FadeCrossSaveBackbuffer()
+{
+  BlitBitmap(backbuffer, bitmap_db_cross, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
 }
 
 void SetMainBackgroundImageIfDefined(int graphic)
@@ -480,9 +498,21 @@ void SetDoorBackgroundImage(int graphic)
                          graphic_info[IMG_BACKGROUND].bitmap);
 }
 
+void SetPanelBackground()
+{
+  BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, bitmap_db_panel,
+             DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, 0, 0);
+
+  SetDoorBackgroundBitmap(bitmap_db_panel);
+}
+
 void DrawBackground(int dst_x, int dst_y, int width, int height)
 {
+#if 1
+  ClearRectangleOnBackground(drawto, dst_x, dst_y, width, height);
+#else
   ClearRectangleOnBackground(backbuffer, dst_x, dst_y, width, height);
+#endif
 
   redraw_mask |= REDRAW_FIELD;
 }
@@ -548,17 +578,6 @@ inline int getGraphicAnimationFrame(int graphic, int sync_frame)
   if (graphic_info[graphic].anim_global_sync || sync_frame < 0)
     sync_frame = FrameCounter;
 
-#if 0
-  if (graphic == element_info[EL_CUSTOM_START + 255].graphic[ACTION_DEFAULT] &&
-      sync_frame == 0 &&
-      FrameCounter > 10)
-  {
-    int x = 1 / 0;
-
-    printf("::: FOO!\n");
-  }
-#endif
-
   return getAnimationFrame(graphic_info[graphic].anim_frames,
                           graphic_info[graphic].anim_delay,
                           graphic_info[graphic].anim_mode,
@@ -1038,34 +1057,20 @@ static void DrawLevelFieldCrumbledSandExt(int x, int y, int graphic, int frame)
       int sxx = sx + xy[i][0];
       int syy = sy + xy[i][1];
 
-#if 1
       if (!IN_LEV_FIELD(xx, yy) ||
          !IN_SCR_FIELD(sxx, syy) ||
          IS_MOVING(xx, yy))
        continue;
 
-#if 1
       if (Feld[xx][yy] == EL_ELEMENT_SNAPPING)
        continue;
-#endif
 
       element = TILE_GFX_ELEMENT(xx, yy);
 
       if (!GFX_CRUMBLED(element))
        continue;
-#else
-      if (!IN_LEV_FIELD(xx, yy) ||
-         !IN_SCR_FIELD(sxx, syy) ||
-         !GFX_CRUMBLED(Feld[xx][yy]) ||
-         IS_MOVING(xx, yy))
-       continue;
-#endif
 
-#if 1
       graphic = el_act2crm(element, ACTION_DEFAULT);
-#else
-      graphic = el_act2crm(Feld[xx][yy], ACTION_DEFAULT);
-#endif
       crumbled_border_size = graphic_info[graphic].border_size;
 
       getGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
@@ -1480,28 +1485,45 @@ void ShowEnvelope(int envelope_nr)
   BackToFront();
 }
 
-void getMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y)
+void getPreviewGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y,
+                            int tilesize)
 {
+  struct
+  {
+    int width_mult, width_div;
+    int height_mult, height_div;
+  } offset_calc[4] =
+  {
+    { 0, 1,    0, 1    },
+    { 0, 1,    2, 3    },
+    { 1, 2,    2, 3    },
+    { 3, 4,    2, 3    },
+  };
+  int offset_calc_pos = (tilesize < MICRO_TILESIZE || tilesize > TILESIZE ? 3 :
+                        5 - log_2(tilesize));
   Bitmap *src_bitmap = graphic_info[graphic].bitmap;
-  int mini_startx = src_bitmap->width * 3 / 4;
-  int mini_starty = src_bitmap->height * 2 / 3;
-  int src_x = mini_startx + graphic_info[graphic].src_x / 8;
-  int src_y = mini_starty + graphic_info[graphic].src_y / 8;
+  int width_mult = offset_calc[offset_calc_pos].width_mult;
+  int width_div = offset_calc[offset_calc_pos].width_div;
+  int height_mult = offset_calc[offset_calc_pos].height_mult;
+  int height_div = offset_calc[offset_calc_pos].height_div;
+  int mini_startx = src_bitmap->width * width_mult / width_div;
+  int mini_starty = src_bitmap->height * height_mult / height_div;
+  int src_x = mini_startx + graphic_info[graphic].src_x * tilesize / TILESIZE;
+  int src_y = mini_starty + graphic_info[graphic].src_y * tilesize / TILESIZE;
 
   *bitmap = src_bitmap;
   *x = src_x;
   *y = src_y;
 }
 
-void DrawMicroElement(int xpos, int ypos, int element)
+void DrawPreviewElement(int dst_x, int dst_y, int element, int tilesize)
 {
   Bitmap *src_bitmap;
   int src_x, src_y;
   int graphic = el2preimg(element);
 
-  getMicroGraphicSource(graphic, &src_bitmap, &src_x, &src_y);
-  BlitBitmap(src_bitmap, drawto, src_x, src_y, MICRO_TILEX, MICRO_TILEY,
-            xpos, ypos);
+  getPreviewGraphicSource(graphic, &src_bitmap, &src_x, &src_y, tilesize);
+  BlitBitmap(src_bitmap, drawto, src_x, src_y, tilesize, tilesize, dst_x,dst_y);
 }
 
 void DrawLevel()
@@ -1529,33 +1551,36 @@ void DrawMiniLevel(int size_x, int size_y, int scroll_x, int scroll_y)
   redraw_mask |= REDRAW_FIELD;
 }
 
-static void DrawMicroLevelExt(int xpos, int ypos, int from_x, int from_y)
+static void DrawPreviewLevelExt(int from_x, int from_y)
 {
+  boolean show_level_border = (BorderElement != EL_EMPTY);
+  int dst_x = preview.x;
+  int dst_y = preview.y;
+  int level_xsize = lev_fieldx + (show_level_border ? 2 : 0);
+  int level_ysize = lev_fieldy + (show_level_border ? 2 : 0);
+  int tile_size = preview.tile_size;
+  int preview_width  = preview.xsize * tile_size;
+  int preview_height = preview.ysize * tile_size;
+  int real_preview_xsize = MIN(level_xsize, preview.xsize);
+  int real_preview_ysize = MIN(level_ysize, preview.ysize);
   int x, y;
 
-  DrawBackground(xpos, ypos, MICROLEVEL_XSIZE, MICROLEVEL_YSIZE);
+  DrawBackground(dst_x, dst_y, preview_width, preview_height);
 
-  if (lev_fieldx < STD_LEV_FIELDX)
-    xpos += (STD_LEV_FIELDX - lev_fieldx) / 2 * MICRO_TILEX;
-  if (lev_fieldy < STD_LEV_FIELDY)
-    ypos += (STD_LEV_FIELDY - lev_fieldy) / 2 * MICRO_TILEY;
+  dst_x += (preview_width  - real_preview_xsize * tile_size) / 2;
+  dst_y += (preview_height - real_preview_ysize * tile_size) / 2;
 
-  xpos += MICRO_TILEX;
-  ypos += MICRO_TILEY;
-
-  for (x = -1; x <= STD_LEV_FIELDX; x++)
+  for (x = 0; x < real_preview_xsize; x++)
   {
-    for (y = -1; y <= STD_LEV_FIELDY; y++)
+    for (y = 0; y < real_preview_ysize; y++)
     {
-      int lx = from_x + x, ly = from_y + y;
-
-      if (lx >= 0 && lx < lev_fieldx && ly >= 0 && ly < lev_fieldy)
-       DrawMicroElement(xpos + x * MICRO_TILEX, ypos + y * MICRO_TILEY,
-                        level.field[lx][ly]);
-      else if (lx >= -1 && lx < lev_fieldx+1 && ly >= -1 && ly < lev_fieldy+1
-              && BorderElement != EL_EMPTY)
-       DrawMicroElement(xpos + x * MICRO_TILEX, ypos + y * MICRO_TILEY,
-                        getBorderElement(lx, ly));
+      int lx = from_x + x + (show_level_border ? -1 : 0);
+      int ly = from_y + y + (show_level_border ? -1 : 0);
+      int element = (IN_LEV_FIELD(lx, ly) ? level.field[lx][ly] :
+                    getBorderElement(lx, ly));
+
+      DrawPreviewElement(dst_x + x * tile_size, dst_y + y * tile_size,
+                        element, tile_size);
     }
   }
 
@@ -1571,7 +1596,7 @@ static void DrawMicroLevelExt(int xpos, int ypos, int from_x, int from_y)
 #define MICROLABEL_IMPORTED_BY_HEAD    6
 #define MICROLABEL_IMPORTED_BY         7
 
-static void DrawMicroLevelLabelExt(int mode)
+static void DrawPreviewLevelLabelExt(int mode)
 {
   char label_text[MAX_OUTPUT_LINESIZE + 1];
   int max_len_label_text;
@@ -1619,13 +1644,17 @@ static void DrawMicroLevelLabelExt(int mode)
   redraw_mask |= REDRAW_MICROLEVEL;
 }
 
-void DrawMicroLevel(int xpos, int ypos, boolean restart)
+void DrawPreviewLevel(boolean restart)
 {
   static unsigned long scroll_delay = 0;
   static unsigned long label_delay = 0;
   static int from_x, from_y, scroll_direction;
   static int label_state, label_counter;
-  int last_game_status = game_status;  /* save current game status */
+  unsigned long scroll_delay_value = preview.step_delay;
+  boolean show_level_border = (BorderElement != EL_EMPTY);
+  int level_xsize = lev_fieldx + (show_level_border ? 2 : 0);
+  int level_ysize = lev_fieldy + (show_level_border ? 2 : 0);
+  int last_game_status = game_status;          /* save current game status */
 
   /* force PREVIEW font on preview level */
   game_status = GAME_MODE_PSEUDO_PREVIEW;
@@ -1637,8 +1666,8 @@ void DrawMicroLevel(int xpos, int ypos, boolean restart)
     label_state = 1;
     label_counter = 0;
 
-    DrawMicroLevelExt(xpos, ypos, from_x, from_y);
-    DrawMicroLevelLabelExt(label_state);
+    DrawPreviewLevelExt(from_x, from_y);
+    DrawPreviewLevelLabelExt(label_state);
 
     /* initialize delay counters */
     DelayReached(&scroll_delay, 0);
@@ -1665,36 +1694,50 @@ void DrawMicroLevel(int xpos, int ypos, boolean restart)
     return;
   }
 
-  /* scroll micro level, if needed */
-  if ((lev_fieldx > STD_LEV_FIELDX || lev_fieldy > STD_LEV_FIELDY) &&
-      DelayReached(&scroll_delay, MICROLEVEL_SCROLL_DELAY))
+  /* scroll preview level, if needed */
+  if ((level_xsize > preview.xsize || level_ysize > preview.ysize) &&
+      DelayReached(&scroll_delay, scroll_delay_value))
   {
     switch (scroll_direction)
     {
       case MV_LEFT:
        if (from_x > 0)
-         from_x--;
+       {
+         from_x -= preview.step_offset;
+         from_x = (from_x < 0 ? 0 : from_x);
+       }
        else
          scroll_direction = MV_UP;
        break;
 
       case MV_RIGHT:
-       if (from_x < lev_fieldx - STD_LEV_FIELDX)
-         from_x++;
+       if (from_x < level_xsize - preview.xsize)
+       {
+         from_x += preview.step_offset;
+         from_x = (from_x > level_xsize - preview.xsize ?
+                   level_xsize - preview.xsize : from_x);
+       }
        else
          scroll_direction = MV_DOWN;
        break;
 
       case MV_UP:
        if (from_y > 0)
-         from_y--;
+       {
+         from_y -= preview.step_offset;
+         from_y = (from_y < 0 ? 0 : from_y);
+       }
        else
          scroll_direction = MV_RIGHT;
        break;
 
       case MV_DOWN:
-       if (from_y < lev_fieldy - STD_LEV_FIELDY)
-         from_y++;
+       if (from_y < level_ysize - preview.ysize)
+       {
+         from_y += preview.step_offset;
+         from_y = (from_y > level_ysize - preview.ysize ?
+                   level_ysize - preview.ysize : from_y);
+       }
        else
          scroll_direction = MV_LEFT;
        break;
@@ -1703,7 +1746,7 @@ void DrawMicroLevel(int xpos, int ypos, boolean restart)
        break;
     }
 
-    DrawMicroLevelExt(xpos, ypos, from_x, from_y);
+    DrawPreviewLevelExt(from_x, from_y);
   }
 
   /* !!! THIS ALL SUCKS -- SHOULD BE CLEANLY REWRITTEN !!! */
@@ -1744,7 +1787,7 @@ void DrawMicroLevel(int xpos, int ypos, boolean restart)
       label_state = (label_state == MICROLABEL_IMPORTED_FROM_HEAD ?
                     MICROLABEL_IMPORTED_BY_HEAD : MICROLABEL_IMPORTED_BY);
 
-    DrawMicroLevelLabelExt(label_state);
+    DrawPreviewLevelLabelExt(label_state);
   }
 
   game_status = last_game_status;      /* restore current game status */
@@ -1901,12 +1944,10 @@ void DrawPlayer(struct PlayerInfo *player)
   int last_player_frame = player->Frame;
   int frame = 0;
 
-#if 1
   /* GfxElement[][] is set to the element the player is digging or collecting;
      remove also for off-screen player if the player is not moving anymore */
   if (IN_LEV_FIELD(jx, jy) && !player_is_moving)
     GfxElement[jx][jy] = EL_UNDEFINED;
-#endif
 
   if (!player->active || !IN_SCR_FIELD(SCREENX(last_jx), SCREENY(last_jy)))
     return;
@@ -1932,10 +1973,8 @@ void DrawPlayer(struct PlayerInfo *player)
            player->is_dropping   ? ACTION_DROPPING        :
            player->is_waiting    ? player->action_waiting : ACTION_DEFAULT);
 
-#if 1
   if (player->is_waiting)
     move_dir = player->dir_waiting;
-#endif
 
   InitPlayerGfxAnimation(player, action, move_dir);
 
@@ -2011,8 +2050,15 @@ void DrawPlayer(struct PlayerInfo *player)
       GfxElement[jx][jy] = EL_UNDEFINED;
 
       /* make sure that pushed elements are drawn with correct frame rate */
+#if 1
+      graphic = el_act_dir2img(element, ACTION_PUSHING, move_dir);
+
+      if (player->is_pushing && player->is_moving && !IS_ANIM_MODE_CE(graphic))
+       GfxFrame[jx][jy] = player->StepFrame;
+#else
       if (player->is_pushing && player->is_moving)
        GfxFrame[jx][jy] = player->StepFrame;
+#endif
 
       DrawLevelField(jx, jy);
     }
@@ -2072,15 +2118,26 @@ void DrawPlayer(struct PlayerInfo *player)
     int px = SCREENX(jx), py = SCREENY(jy);
     int pxx = (TILEX - ABS(sxx)) * dx;
     int pyy = (TILEY - ABS(syy)) * dy;
+    int gfx_frame = GfxFrame[jx][jy];
 
     int graphic;
+    int sync_frame;
     int frame;
 
     if (!IS_MOVING(jx, jy))            /* push movement already finished */
+    {
       element = Feld[next_jx][next_jy];
+      gfx_frame = GfxFrame[next_jx][next_jy];
+    }
 
     graphic = el_act_dir2img(element, ACTION_PUSHING, move_dir);
+
+#if 1
+    sync_frame = (IS_ANIM_MODE_CE(graphic) ? gfx_frame : player->StepFrame);
+    frame = getGraphicAnimationFrame(graphic, sync_frame);
+#else
     frame = getGraphicAnimationFrame(graphic, player->StepFrame);
+#endif
 
     /* draw background element under pushed element (like the Sokoban field) */
     if (Back[next_jx][next_jy])
@@ -2268,6 +2325,10 @@ boolean Request(char *text, unsigned int req_state)
               DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1);
   }
 
+#if 1
+  SetDoorBackgroundImage(IMG_BACKGROUND_DOOR);
+#endif
+
   SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1);
 
   /* clear door drawing field */
@@ -2337,7 +2398,15 @@ boolean Request(char *text, unsigned int req_state)
 
   if (!(req_state & REQUEST_WAIT_FOR_INPUT))
   {
-    SetDrawBackgroundMask(REDRAW_FIELD);
+    if (game_status == GAME_MODE_PLAYING)
+    {
+      SetPanelBackground();
+      SetDrawBackgroundMask(REDRAW_DOOR_1);
+    }
+    else
+    {
+      SetDrawBackgroundMask(REDRAW_FIELD);
+    }
 
     return FALSE;
   }
@@ -2482,7 +2551,15 @@ boolean Request(char *text, unsigned int req_state)
 
   RemapAllGadgets();
 
-  SetDrawBackgroundMask(REDRAW_FIELD);
+  if (game_status == GAME_MODE_PLAYING)
+  {
+    SetPanelBackground();
+    SetDrawBackgroundMask(REDRAW_DOOR_1);
+  }
+  else
+  {
+    SetDrawBackgroundMask(REDRAW_FIELD);
+  }
 
 #if defined(NETWORK_AVALIABLE)
   /* continue network game after request */
@@ -2621,17 +2698,8 @@ unsigned int MoveDoor(unsigned int door_state)
     int door_size     = (handle_door_1 ? door_size_1     : door_size_2);
     int max_door_size = (handle_door_1 ? max_door_size_1 : max_door_size_2);
     int door_skip = max_door_size - door_size;
-#if 1
     int end = door_size;
-#else
-    int end = (door_state & DOOR_ACTION_1 && door_1.anim_mode & ANIM_VERTICAL ?
-              DYSIZE : DXSIZE);
-#endif
-#if 1
     int start = ((door_state & DOOR_NO_DELAY) ? end : 0);
-#else
-    int start = ((door_state & DOOR_NO_DELAY) ? end : offset_skip);
-#endif
     int k;
 
     if (!(door_state & DOOR_NO_DELAY) && !setup.quick_doors)
@@ -2743,15 +2811,9 @@ unsigned int MoveDoor(unsigned int door_state)
 
       if (door_state & DOOR_ACTION_2)
       {
-#if 1
        int a = MIN(x * door_2.step_offset, door_size);
        int p = (door_state & DOOR_OPEN_2 ? door_size - a : a);
        int i = p + door_skip;
-#else
-       int a = MIN(x * door_2.step_offset, door_size_2);
-       int p = (door_state & DOOR_OPEN_2 ? door_size_2 - a : a);
-       int i = p + door_skip;
-#endif
 
        if (door_2.anim_mode & ANIM_STATIC_PANEL)
        {
@@ -5211,37 +5273,6 @@ int font2baseimg(int font_nr)
   return font_info[font_nr].special_graphic[GFX_SPECIAL_ARG_DEFAULT];
 }
 
-#if 0
-void setCenteredPlayerNr_EM(int centered_player_nr)
-{
-  game.centered_player_nr = game.centered_player_nr_next = centered_player_nr;
-}
-
-int getCenteredPlayerNr_EM()
-{
-#if 0
-  if (game.centered_player_nr_next >= 0 &&
-      !native_em_level.ply[game.centered_player_nr_next]->alive)
-    game.centered_player_nr_next = game.centered_player_nr;
-#endif
-
-  if (game.centered_player_nr != game.centered_player_nr_next)
-    game.centered_player_nr = game.centered_player_nr_next;
-
-  return game.centered_player_nr;
-}
-
-void setSetCenteredPlayer_EM(boolean set_centered_player)
-{
-  game.set_centered_player = set_centered_player;
-}
-
-boolean getSetCenteredPlayer_EM()
-{
-  return game.set_centered_player;
-}
-#endif
-
 int getNumActivePlayers_EM()
 {
   int num_players = 0;
@@ -5257,7 +5288,6 @@ int getNumActivePlayers_EM()
   return num_players;
 }
 
-#if 1
 int getGameFrameDelay_EM(int native_em_game_frame_delay)
 {
   int game_frame_delay_value;
@@ -5272,7 +5302,6 @@ int getGameFrameDelay_EM(int native_em_game_frame_delay)
 
   return game_frame_delay_value;
 }
-#endif
 
 unsigned int InitRND(long seed)
 {
@@ -5677,7 +5706,6 @@ void InitGraphicInfo_EM(void)
        g_em->height = TILEY - cy * step;
       }
 
-#if 1
       /* create unique graphic identifier to decide if tile must be redrawn */
       /* bit 31 - 16 (16 bit): EM style graphic
         bit 15 - 12 ( 4 bit): EM style frame
@@ -5685,29 +5713,12 @@ void InitGraphicInfo_EM(void)
         bit  5 -  0 ( 6 bit): graphic height */
       g_em->unique_identifier =
        (graphic << 16) | (frame << 12) | (g_em->width << 6) | g_em->height;
-#else
-      /* create unique graphic identifier to decide if tile must be redrawn */
-      /* bit 31 - 16 (16 bit): EM style element
-        bit 15 - 12 ( 4 bit): EM style frame
-        bit 11 -  6 ( 6 bit): graphic width
-        bit  5 -  0 ( 6 bit): graphic height */
-      g_em->unique_identifier =
-       (i << 16) | (j << 12) | (g_em->width << 6) | g_em->height;
-#endif
-
-#if 0
-      if (effective_element == EL_ROCK)
-       printf("::: EL_ROCK(%d, %d): %d, %d => %d\n",
-              effective_action, j, graphic, frame, g_em->unique_identifier);
-#endif
 
 #if DEBUG_EM_GFX
 
-#if 1
       /* skip check for EMC elements not contained in original EMC artwork */
       if (element == EL_EMC_FAKE_ACID)
        continue;
-#endif
 
       if (g_em->bitmap != debug_bitmap ||
          g_em->src_x != debug_src_x ||
@@ -5781,13 +5792,8 @@ void InitGraphicInfo_EM(void)
       int action = object_mapping[i].action;
       int direction = object_mapping[i].direction;
       boolean is_backside = object_mapping[i].is_backside;
-#if 1
       int graphic_action  = el_act_dir2img(element, action, direction);
       int graphic_default = el_act_dir2img(element, ACTION_DEFAULT, direction);
-#else
-      int graphic_action  = element_info[element].graphic[action];
-      int graphic_default = element_info[element].graphic[ACTION_DEFAULT];
-#endif
 
       if ((action == ACTION_SMASHED_BY_ROCK ||
           action == ACTION_SMASHED_BY_SPRING ||
@@ -5813,9 +5819,7 @@ void InitGraphicInfo_EM(void)
        g_em->dst_offset_y      = g_xx->dst_offset_y;
        g_em->width             = g_xx->width;
        g_em->height            = g_xx->height;
-#if 1
        g_em->unique_identifier = g_xx->unique_identifier;
-#endif
 
        if (!is_backside)
          g_em->preserve_background = TRUE;
@@ -5871,12 +5875,10 @@ void InitGraphicInfo_EM(void)
 
 #if DEBUG_EM_GFX
 
-#if 1
        /* skip check for EMC elements not contained in original EMC artwork */
        if (element == EL_PLAYER_3 ||
            element == EL_PLAYER_4)
          continue;
-#endif
 
        if (g_em->bitmap != debug_bitmap ||
            g_em->src_x != debug_src_x ||
@@ -5986,3 +5988,33 @@ void PlayMenuMusic()
 
   PlayMusic(music);
 }
+
+void ToggleFullscreenIfNeeded()
+{
+  if (setup.fullscreen != video.fullscreen_enabled ||
+      setup.fullscreen_mode != video.fullscreen_mode_current)
+  {
+    Bitmap *tmp_backbuffer = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH);
+
+    /* save backbuffer content which gets lost when toggling fullscreen mode */
+    BlitBitmap(backbuffer, tmp_backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+
+    if (setup.fullscreen && video.fullscreen_enabled)
+    {
+      /* keep fullscreen mode, but change screen mode */
+      video.fullscreen_mode_current = setup.fullscreen_mode;
+      video.fullscreen_enabled = FALSE;
+    }
+
+    /* toggle fullscreen */
+    ChangeVideoModeIfNeeded(setup.fullscreen);
+    setup.fullscreen = video.fullscreen_enabled;
+
+    /* restore backbuffer content from temporary backbuffer backup bitmap */
+    BlitBitmap(tmp_backbuffer, backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+
+    FreeBitmap(tmp_backbuffer);
+
+    redraw_mask = REDRAW_ALL;
+  }
+}
index f77a594acf99ef1da2b5670b47e8a1ca022a696c..7a29b910c99010587860005723b8a817441ed428 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -68,13 +68,15 @@ void BackToFront();
 void FadeToFront();
 
 void FadeIn(int);
-void FadeOut(int, int);
+void FadeOut(int);
 void FadeCross(int);
+void FadeCrossSaveBackbuffer();
 
 void ClearWindow();
 void SetMainBackgroundImageIfDefined(int);
 void SetMainBackgroundImage(int);
 void SetDoorBackgroundImage(int);
+void SetPanelBackground();
 void DrawBackground(int, int, int, int);
 
 void MarkTileDirty(int, int);
@@ -124,11 +126,9 @@ void DrawMiniElementOrWall(int, int, int, int);
 
 void ShowEnvelope();
 
-void getMicroGraphicSource(int, Bitmap **, int *, int *);
-void DrawMicroElement(int, int, int);
 void DrawLevel(void);
 void DrawMiniLevel(int, int, int, int);
-void DrawMicroLevel(int, int, boolean);
+void DrawPreviewLevel(boolean);
 
 void WaitForEventToContinue();
 boolean Request(char *, unsigned int);
@@ -170,4 +170,6 @@ void PlayMenuSoundStereo(int, int);
 void PlayMenuSoundIfLoop();
 void PlayMenuMusic();
 
+void ToggleFullscreenIfNeeded();
+
 #endif /* TOOLS_H */