fixed not closing doors simultaneously after solving a level
[rocksndiamonds.git] / src / main.c
index 312cb2cbb1eb5ac170a1ac265faa27c6eb32150a..d36c3f2aca056ddf14f08af9ca1e93498a54aac3 100644 (file)
@@ -33,15 +33,13 @@ int                 game_status = -1;
 boolean                        game_status_last_screen = -1;
 boolean                        level_editor_test_game = FALSE;
 boolean                        network_playing = FALSE;
-
-#if defined(TARGET_SDL)
 boolean                        network_server = FALSE;
 SDL_Thread            *server_thread;
-#endif
 
 int                    key_joystick_mapping = 0;
 
 short                  Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                  Last[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 short                  MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 short                  MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 short                  MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
@@ -125,15 +123,11 @@ int                       BX1, BY1;
 int                    BX2, BY2;
 int                    SBX_Left, SBX_Right;
 int                    SBY_Upper, SBY_Lower;
-int                    ZX, ZY;
-int                    ExitX, ExitY;
-int                    AllPlayersGone;
 
 int                    TimeFrames, TimePlayed, TimeLeft, TapeTime;
 
 boolean                        network_player_action_received = FALSE;
 
-struct LevelSetInfo    levelset;
 struct LevelInfo       level, level_template;
 struct PlayerInfo      stored_player[MAX_PLAYERS], *local_player = NULL;
 struct HiScore         highscore[MAX_SCORE_ENTRIES];
@@ -186,20 +180,20 @@ SetupFileHash            *font_token_hash = NULL;
 SetupFileHash         *hide_setup_hash = NULL;
 
 
-/* ------------------------------------------------------------------------- */
-/* element definitions                                                       */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// element definitions
+// ----------------------------------------------------------------------------
 
 struct ElementInfo element_info[MAX_NUM_ELEMENTS + 1];
 
-/* this contains predefined structure elements to initialize "element_info" */
+// this contains predefined structure elements to initialize "element_info"
 struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
 {
-  /* keyword to start parser: "ELEMENT_INFO_START" <-- do not change! */
+  // keyword to start parser: "ELEMENT_INFO_START" <-- do not change!
 
-  /* ----------------------------------------------------------------------- */
-  /* "real" level file elements                                              */
-  /* ----------------------------------------------------------------------- */
+  // --------------------------------------------------------------------------
+  // "real" level file elements
+  // --------------------------------------------------------------------------
 
   {
     "empty_space",
@@ -6271,9 +6265,9 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "wooden wall (DF style)",
   },
 
-  /* ----------------------------------------------------------------------- */
-  /* "real" (and therefore drawable) runtime elements                        */
-  /* ----------------------------------------------------------------------- */
+  // --------------------------------------------------------------------------
+  // "real" (and therefore drawable) runtime elements
+  // --------------------------------------------------------------------------
 
   {
     "dynabomb_player_1.active",
@@ -6682,9 +6676,9 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "pac man (eating down)"
   },
 
-  /* ----------------------------------------------------------------------- */
-  /* "unreal" (and therefore not drawable) runtime elements                  */
-  /* ----------------------------------------------------------------------- */
+  // --------------------------------------------------------------------------
+  // "unreal" (and therefore not drawable) runtime elements
+  // --------------------------------------------------------------------------
 
   {
     "blocked",
@@ -6807,9 +6801,9 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "-"
   },
 
-  /* ----------------------------------------------------------------------- */
-  /* dummy elements (never used as game elements, only used as graphics)     */
-  /* ----------------------------------------------------------------------- */
+  // --------------------------------------------------------------------------
+  // dummy elements (never used as game elements, only used as graphics)
+  // --------------------------------------------------------------------------
 
   {
     "steelwall_topleft",
@@ -7237,7 +7231,7 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "hide elements used in this level"
   },
 
-  /* keyword to stop parser: "ELEMENT_INFO_END" <-- do not change! */
+  // keyword to stop parser: "ELEMENT_INFO_END" <-- do not change!
 
   {
     NULL,
@@ -7247,9 +7241,9 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
 };
 
 
-/* ------------------------------------------------------------------------- */
-/* element action and direction definitions                                  */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// element action and direction definitions
+// ----------------------------------------------------------------------------
 
 struct ElementActionInfo element_action_info[NUM_ACTIONS + 1 + 1] =
 {
@@ -7372,7 +7366,7 @@ struct ElementActionInfo element_action_info[NUM_ACTIONS + 1 + 1] =
   { ".part_32",                        ACTION_PART_32,                 FALSE   },
   { ".other",                  ACTION_OTHER,                   FALSE   },
 
-  /* empty suffix always matches -- check as last entry in InitSoundInfo() */
+  // empty suffix always matches -- check as last entry in InitSoundInfo()
   { "",                                ACTION_DEFAULT,                 TRUE    },
 
   { NULL,                      0,                              0       }
@@ -7428,25 +7422,26 @@ struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] =
   { ".TOONS",                  GFX_SPECIAL_ARG_TOONS,                  },
   { ".SCORESOLD",              GFX_SPECIAL_ARG_SCORESOLD,              },
   { ".SCORESNEW",              GFX_SPECIAL_ARG_SCORESNEW,              },
+  { ".NO_TITLE",               GFX_SPECIAL_ARG_NO_TITLE,               },
   { ".FADING",                 GFX_SPECIAL_ARG_FADING,                 },
   { ".QUIT",                   GFX_SPECIAL_ARG_QUIT,                   },
 
-  /* empty suffix always matches -- check as last entry in InitMusicInfo() */
+  // empty suffix always matches -- check as last entry in InitMusicInfo()
   { "",                                GFX_SPECIAL_ARG_DEFAULT,                },
 
   { NULL,                      0,                                      }
 };
 
-#include "conf_var.c"  /* include auto-generated data structure definitions */
+#include "conf_var.c"  // include auto-generated data structure definitions
 
 
-/* ------------------------------------------------------------------------- */
-/* font definitions                                                          */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// font definitions
+// ----------------------------------------------------------------------------
 
-/* Important: When one entry is a prefix of another entry, the longer entry
-   must come first, because the dynamic configuration does prefix matching!
-   (These definitions must match the corresponding definitions in "main.h"!) */
+// Important: When one entry is a prefix of another entry, the longer entry
+// must come first, because the dynamic configuration does prefix matching!
+// (These definitions must match the corresponding definitions in "main.h"!)
 
 struct FontInfo font_info[NUM_FONTS + 1] =
 {
@@ -7499,10 +7494,10 @@ struct FontInfo font_info[NUM_FONTS + 1] =
 
 struct GlobalAnimInfo global_anim_info[NUM_GLOBAL_ANIM_TOKENS + 1];
 
-/* this contains predefined structure elements to init "global_anim_info" */
+// this contains predefined structure elements to init "global_anim_info"
 struct GlobalAnimNameInfo global_anim_name_info[NUM_GLOBAL_ANIM_TOKENS + 1] =
 {
-  /* (real) graphic definitions used to define animation graphics */
+  // (real) graphic definitions used to define animation graphics
   { "gfx.global.anim_1",       },
   { "gfx.global.anim_2",       },
   { "gfx.global.anim_3",       },
@@ -7536,7 +7531,7 @@ struct GlobalAnimNameInfo global_anim_name_info[NUM_GLOBAL_ANIM_TOKENS + 1] =
   { "gfx.global.anim_31",      },
   { "gfx.global.anim_32",      },
 
-  /* (dummy) graphic definitions used to define animation controls */
+  // (dummy) graphic definitions used to define animation controls
   { "global.anim_1",           },
   { "global.anim_2",           },
   { "global.anim_3",           },
@@ -7574,9 +7569,9 @@ struct GlobalAnimNameInfo global_anim_name_info[NUM_GLOBAL_ANIM_TOKENS + 1] =
 };
 
 
-/* ------------------------------------------------------------------------- */
-/* music token prefix definitions                                            */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// music token prefix definitions
+// ----------------------------------------------------------------------------
 
 struct MusicPrefixInfo music_prefix_info[NUM_MUSIC_PREFIXES + 1] =
 {
@@ -7586,11 +7581,11 @@ struct MusicPrefixInfo music_prefix_info[NUM_MUSIC_PREFIXES + 1] =
 };
 
 
-/* ========================================================================= */
-/* main()                                                                    */
-/* ========================================================================= */
+// ============================================================================
+// main()
+// ============================================================================
 
-static void print_usage()
+static void print_usage(void)
 {
   Print("\n"
        "Usage: %s [OPTION]... [HOSTNAME [PORT]]\n"
@@ -7629,7 +7624,7 @@ static void print_usage()
        program.command_basename);
 }
 
-static void print_version()
+static void print_version(void)
 {
   Print("%s", getProgramInitString());
 
@@ -7762,5 +7757,5 @@ int main(int argc, char *argv[])
   EventLoop();
   CloseAllAndExit(0);
 
-  return 0;    /* to keep compilers happy */
+  return 0;    // to keep compilers happy
 }