rnd-20020430-2-src
[rocksndiamonds.git] / src / main.c
index 0ef3af3bf416752680d24a6bf2b7bc030059b613..9a1b0a8b6be6709ef00f2e37dfe0bb44ae50712f 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2000 Artsoft Entertainment                      *
+* (c) 1995-2001 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -17,7 +17,6 @@
 #include "init.h"
 #include "game.h"
 #include "events.h"
-#include "joystick.h"
 
 GC             tile_clip_gc;
 Bitmap        *pix[NUM_BITMAPS];
@@ -25,22 +24,11 @@ Pixmap              tile_clipmask[NUM_TILES];
 DrawBuffer     *fieldbuffer;
 DrawBuffer     *drawto_field;
 
-int            joystick_device = 0;
-char          *joystick_device_name[MAX_PLAYERS] =
-{
-  DEV_JOYSTICK_0,
-  DEV_JOYSTICK_1,
-  DEV_JOYSTICK_2,
-  DEV_JOYSTICK_3
-};
-
 int            game_status = MAINMENU;
 boolean                level_editor_test_game = FALSE;
 boolean                network_playing = FALSE;
 
 int            key_joystick_mapping = 0;
-int            global_joystick_status = JOYSTICK_STATUS;
-int            joystick_status = JOYSTICK_STATUS;
 
 boolean                redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
 int            redraw_x1 = 0, redraw_y1 = 0;
@@ -58,10 +46,10 @@ boolean             Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 short          JustStopped[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 short          AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 short          AmoebaCnt[MAX_NUM_AMOEBA], AmoebaCnt2[MAX_NUM_AMOEBA];
+short          ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 unsigned long  Elementeigenschaften1[MAX_ELEMENTS];
 unsigned long  Elementeigenschaften2[MAX_ELEMENTS];
 
-int            level_nr;
 int            lev_fieldx,lev_fieldy, scroll_x,scroll_y;
 
 int            FX = SX, FY = SY, ScrollStepSize;
@@ -148,20 +136,134 @@ char *sound_name[NUM_SOUNDS] =
   "gate.wav"
 };
 
-/* background music */
-int background_loop[] =
+/* sound effects: setup file identifiers and corresponding default filenames */
+struct SoundEffectInfo sound_effects[NUM_SOUND_EFFECTS] =
+{
+  { "infotron_collecting",     "infotron.wav"  },
+  { "zonk_falling",            "zonkdown.wav"  },
+  { "zonk_pushing",            "zonkpush.wav"  },
+  { "player_screaming",                "autsch.wav"    }
+};
+
+struct SoundEffectInfo sound_effects_NEW[] =
 {
+  { "amoeba_growing",          "amoebe.wav"    },
+  { "player_screaming",                "autsch.wav"    },
+  { "acid_splashing",          "blurb.wav"     },
+  { "mole_eating_amoeba",      "blurb.wav"     },
+  { "penguin_entering_exit",   "buing.wav"     },
+  { "player_entering_exit",    "buing.wav"     },
+  { "player_solving_sokoban",  "buing.wav"     },
+  { "time_orb_full_impact",    "deng.wav"      },
+  { "time_orb_empty_impact",   "deng.wav"      },
+  { "electric_bulb_light",     "deng.wav"      },
+  { "sokoban_field_filling",   "deng.wav"      },
+  { "leveltime_running_out",   "gong.wav"      },
+  { "extra_time_collecting",   "gong.wav"      },
+  { "time_orb_full_collecting",        "gong.wav"      },
+  { "menu_hall_of_fame",       "halloffame.wav"},
+  { "key_impact",              "kink.wav"      },
+  { "em_key_impact",           "kink.wav"      },
+  { "bug_moving",              "klapper.wav"   },
+  { "butterfly_moving",                "klapper.wav"   },
+  { "rock_impact",             "klopf.wav"     },
+  { "bd_rock_impact",          "klopf.wav"     },
+  { "amoeba_turns_to_rock",    "klopf.wav"     },
+  { "nut_impact",              "klumpf.wav"    },
+  { "pearl_breaking",          "knack.wav"     },
+  { "nut_cracking",            "knack.wav"     },
+  { "nut_pushing",             "knurk.wav"     },
+  { "player_laughing_at",      "lachen.wav"    },
+  { "robot_wheel_running",     "miep.wav"      },
+  { "timegate_wheel_running",  "miep.wav"      },
+  { "magic_wall_running",      "miep.wav"      },
+  { "yamyam_waiting",          "njam.wav"      },
+  { "menu_door",               "oeffnen.wav"   },
+  { "switchgate_opening",      "oeffnen.wav"   },
+  { "switchgate_closing",      "oeffnen.wav"   },
+  { "timegate_opening",                "oeffnen.wav"   },
+  { "timegate_closing",                "oeffnen.wav"   },
+  { "exit_opening",            "oeffnen.wav"   },
+  { "emerald_impact",          "pling.wav"     },
+  { "bd_diamond_impact",       "pling.wav"     },
+  { "diamond_impact",          "pling.wav"     },
+  { "infotron_impact",         "pling.wav"     },
+  { "amoeba_turns_to_gem",     "pling.wav"     },
+  { "emerald_collecting",      "pong.wav"      },
+  { "bd_diamond_collecting",   "pong.wav"      },
+  { "diamond_collecting",      "pong.wav"      },
+  { "pearl_collecting",                "pong.wav"      },
+  { "crystal_collecting",      "pong.wav"      },
+  { "speed_pill_collecting",   "pong.wav"      },
+  { "envelope_collecting",     "pong.wav"      },
+  { "shield_passive_collecting","pong.wav"     },
+  { "shield_active_collecting",        "pong.wav"      },
+  { "dynamite_collecting",     "pong.wav"      },
+  { "dynabomb_nr_collecting",  "pong.wav"      },
+  { "dynabomb_sz_collecting",  "pong.wav"      },
+  { "dynabomb_xl_collecting",  "pong.wav"      },
+  { "key_collecting",          "pong.wav"      },
+  { "em_key_collecting",       "pong.wav"      },
+  { "rock_pushing",            "pusch.wav"     },
+  { "bd_rock_pushing",         "pusch.wav"     },
+  { "bomb_pushing",            "pusch.wav"     },
+  { "dx_supabomb_pushing",     "pusch.wav"     },
+  { "time_orb_empty_pushing",  "pusch.wav"     },
+  { "spring_pushing",          "pusch.wav"     },
+  { "sokoban_object_pushing",  "pusch.wav"     },
+  { "satellite_pushing",       "pusch.wav"     },
+  { "sp_disk_yellow_pushing",  "pusch.wav"     },
+  { "diamond_smashing",                "quirk.wav"     },
+  { "magic_wall_activating",   "quirk.wav"     },
+  { "menu_info_screen",                "rhythmloop.wav"},
+  { "explosion",               "roaaar.wav"    },
+  { "spaceship_moving",                "roehr.wav"     },
+  { "firefly_moving",          "roehr.wav"     },
+  { "robot_moving",            "schlurf.wav"   },
+  { "sand_digging",            "schlurf.wav"   },
+  { "sand_invisible_digging",  "schlurf.wav"   },
+  { "trap_inactive_digging",   "schlurf.wav"   },
+  { "balloon_moving",          "schlurf.wav"   },
+  { "leveltime_bonus",         "sirr.wav"      },
+  { "dynamite_burning",                "zisch.wav"     },
+  { "sp_base_digging",         "base.wav"      },
+  { "sp_buggy_base_digging",   "base.wav"      },
+  { "sp_infotron_collecting",  "infotron.wav"  },
+  { "sp_disk_red_collecting",  "infotron.wav"  },
+  { "sp_zonk_impact",          "zonkdown.wav"  },
+  { "sp_zonk_pushing",         "zonkpush.wav"  },
+  { "sp_disk_orange_pushing",  "zonkpush.wav"  },
+  { "sp_buggy_base_passing",   "bug.wav"       },
+  { "sp_explosion",            "booom.wav"     },
+  { "empty_space_digging",     "empty.wav"     },
+  { "em_gate_passing",         "gate.wav"      },
+  { "switchgate_passing",      "gate.wav"      },
+  { "timegate_passing",                "gate.wav"      },
+  { "sp_port_passing",         "gate.wav"      }
+
 #if 0
-  SND_ALCHEMY,
-  SND_CHASE,
-  SND_NETWORK,
-  SND_CZARDASZ,
-  SND_TYGER,
-  SND_VOYAGER,
-  SND_TWILIGHT
+  { "[not used]",              "antigrav.wav"  },
+  { "[not used]",              "bong.wav"      },
+  { "[not used]",              "fuel.wav"      },
+  { "[not used]",              "holz.wav"      },
+  { "[not used]",              "hui.wav"       },
+  { "[not used]",              "kabumm.wav"    },
+  { "[not used]",              "kling.wav"     },
+  { "[not used]",              "krach.wav"     },
+  { "[not used]",              "laser.wav"     },
+  { "[not used]",              "quiek.wav"     },
+  { "[not used]",              "rumms.wav"     },
+  { "[not used]",              "schlopp.wav"   },
+  { "[not used]",              "schrff.wav"    },
+  { "[not used]",              "schwirr.wav"   },
+  { "[not used]",              "slurp.wav"     },
+  { "[not used]",              "sproing.wav"   },
+  { "[not used]",              "warnton.wav"   },
+  { "[not used]",              "whoosh.wav"    },
+  { "[not used]",              "boom.wav"      },
+  { "[not used]",              "exit.wav"      },
 #endif
 };
-int num_bg_loops = sizeof(background_loop)/sizeof(int);
 
 char *element_info[] =
 {
@@ -273,7 +375,7 @@ char *element_info[] =
   "normal wall (BD style)",
   "rock (BD style)",
   "open exit",
-  "unknown",
+  "black orb bomb",
   "amoeba",
   "mole",                                      /* 110 */
   "penguin",
@@ -284,7 +386,7 @@ char *element_info[] =
   "arrow down",
   "pig",
   "fire breathing dragon",
-  "unknown",
+  "red key (EM style)",
   "letter ' '",                                        /* 120 */
   "letter '!'",
   "letter '\"'",
@@ -368,13 +470,13 @@ char *element_info[] =
   "growing wall (horizontal)",                 /* 200 */
   "growing wall (vertical)",
   "growing wall (all directions)",
-  "unused",
-  "unused",
-  "unused",
-  "unused",
-  "unused",
-  "unused",
-  "unused",
+  "red door (EM style)",
+  "yellow door (EM style)",
+  "green door (EM style)",
+  "blue door (EM style)",
+  "yellow key (EM style)",
+  "green key (EM style)",
+  "blue key (EM style)",
   "empty space",                               /* 210 */
   "zonk",
   "base",
@@ -415,10 +517,10 @@ char *element_info[] =
   "hardware",
   "chip (upper half)",
   "chip (lower half)",
-  "unknown",                                   /* 250 */
-  "unknown",
-  "unknown",
-  "unknown",
+  "gray door (EM style, red key)",             /* 250 */
+  "gray door (EM style, yellow key)",
+  "gray door (EM style, green key)",
+  "gray door (EM style, blue key)",
   "unknown",
   "unknown",