/***********************************************************
-* Rocks'n'Diamonds -- McDuffin Strikes Back! *
+* Rocks'n'Diamonds -- McDuffin Strikes Back! *
*----------------------------------------------------------*
-* (c) 1995-98 Artsoft Entertainment *
-* Holger Schemel *
-* Oststrasse 11a *
-* 33604 Bielefeld *
-* phone: ++49 +521 290471 *
-* email: aeglos@valinor.owl.de *
+* (c) 1995-2001 Artsoft Entertainment *
+* Holger Schemel *
+* Detmolder Strasse 189 *
+* 33604 Bielefeld *
+* Germany *
+* e-mail: info@artsoft.org *
*----------------------------------------------------------*
-* main.c *
+* main.c *
***********************************************************/
+#include "libgame/libgame.h"
+
#include "main.h"
#include "init.h"
#include "game.h"
#include "events.h"
-#include "sound.h"
-#include "joystick.h"
-#include "misc.h"
-
-#ifdef MSDOS
-#include <fcntl.h>
-#endif
-Display *display;
-Visual *visual;
-int screen;
-Window window;
-GC gc, clip_gc[NUM_PIXMAPS], tile_clip_gc;
-Pixmap pix[NUM_PIXMAPS];
-Pixmap clipmask[NUM_PIXMAPS], tile_clipmask[NUM_TILES];
-
-#ifdef USE_XPM_LIBRARY
-XpmAttributes xpm_att[NUM_PICTURES];
-#endif
-
-Drawable drawto, drawto_field, backbuffer, fieldbuffer;
-Colormap cmap;
-
-int sound_pipe[2];
-int sound_device;
-char *sound_device_name = SOUND_DEVICE;
-int joystick_device = 0;
-char *joystick_device_name[MAX_PLAYERS] =
-{
- DEV_JOYSTICK_0,
- DEV_JOYSTICK_1,
- DEV_JOYSTICK_2,
- DEV_JOYSTICK_3
-};
-
-char *program_name = NULL;
+GC tile_clip_gc;
+Bitmap *pix[NUM_BITMAPS];
+Pixmap tile_clipmask[NUM_TILES];
+DrawBuffer *fieldbuffer;
+DrawBuffer *drawto_field;
int game_status = MAINMENU;
boolean level_editor_test_game = FALSE;
boolean network_playing = FALSE;
-int button_status = MB_NOT_PRESSED;
-boolean motion_status = FALSE;
+
int key_joystick_mapping = 0;
-int global_joystick_status = JOYSTICK_STATUS;
-int joystick_status = JOYSTICK_STATUS;
-int sound_status = SOUND_STATUS;
-boolean sound_loops_allowed = FALSE;
boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
int redraw_x1 = 0, redraw_y1 = 0;
-int redraw_mask;
-int redraw_tiles;
short Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
short Ur[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;
int SBY_Upper, SBY_Lower;
int ZX,ZY, ExitX,ExitY;
int AllPlayersGone;
-int FrameCounter, TimeFrames, TimePlayed, TimeLeft;
+
+int TimeFrames, TimePlayed, TimeLeft;
boolean network_player_action_received = FALSE;
-struct LevelDirInfo *leveldir_first = NULL, *leveldir_current = NULL;
struct LevelInfo level;
struct PlayerInfo stored_player[MAX_PLAYERS], *local_player = NULL;
struct HiScore highscore[MAX_SCORE_ENTRIES];
-struct SoundInfo Sound[NUM_SOUNDS];
struct TapeInfo tape;
-struct OptionInfo options;
struct SetupInfo setup;
struct GameInfo game;
struct GlobalInfo global;
-/* data needed for playing sounds */
+/* filenames of sound effects */
char *sound_name[NUM_SOUNDS] =
{
- "alchemy",
- "amoebe",
- "antigrav",
- "autsch",
- "blurb",
- "bong",
- "buing",
- "chase",
- "czardasz",
- "deng",
- "fuel",
- "gong",
- "halloffame",
- "holz",
- "hui",
- "kabumm",
- "kink",
- "klapper",
- "kling",
- "klopf",
- "klumpf",
- "knack",
- "knurk",
- "krach",
- "lachen",
- "laser",
- "miep",
- "network",
- "njam",
- "oeffnen",
- "pling",
- "pong",
- "pusch",
- "quiek",
- "quirk",
- "rhythmloop",
- "roaaar",
- "roehr",
- "rumms",
- "schlopp",
- "schlurf",
- "schrff",
- "schwirr",
- "sirr",
- "slurp",
- "sproing",
- "twilight",
- "tyger",
- "voyager",
- "warnton",
- "whoosh",
- "zisch",
- "base",
- "infotron",
- "zonkdown",
- "zonkpush",
- "bug",
- "boom",
- "booom",
- "exit",
- "empty",
- "gate"
+ "amoebe.wav",
+ "antigrav.wav",
+ "autsch.wav",
+ "blurb.wav",
+ "bong.wav",
+ "buing.wav",
+ "deng.wav",
+ "fuel.wav",
+ "gong.wav",
+ "halloffame.wav",
+ "holz.wav",
+ "hui.wav",
+ "kabumm.wav",
+ "kink.wav",
+ "klapper.wav",
+ "kling.wav",
+ "klopf.wav",
+ "klumpf.wav",
+ "knack.wav",
+ "knurk.wav",
+ "krach.wav",
+ "lachen.wav",
+ "laser.wav",
+ "miep.wav",
+ "njam.wav",
+ "oeffnen.wav",
+ "pling.wav",
+ "pong.wav",
+ "pusch.wav",
+ "quiek.wav",
+ "quirk.wav",
+ "rhythmloop.wav",
+ "roaaar.wav",
+ "roehr.wav",
+ "rumms.wav",
+ "schlopp.wav",
+ "schlurf.wav",
+ "schrff.wav",
+ "schwirr.wav",
+ "sirr.wav",
+ "slurp.wav",
+ "sproing.wav",
+ "warnton.wav",
+ "whoosh.wav",
+ "zisch.wav",
+ "base.wav",
+ "infotron.wav",
+ "zonkdown.wav",
+ "zonkpush.wav",
+ "bug.wav",
+ "boom.wav",
+ "booom.wav",
+ "exit.wav",
+ "empty.wav",
+ "gate.wav"
+};
+
+/* 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" }
};
-/* background music */
-int background_loop[] =
+struct SoundEffectInfo sound_effects_NEW[] =
{
- SND_ALCHEMY,
- SND_CHASE,
- SND_NETWORK,
- SND_CZARDASZ,
- SND_TYGER,
- SND_VOYAGER,
- SND_TWILIGHT
+ { "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
+ { "[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[] =
{
"dark yam yam", /* 60 */
"magic wall (BD style)",
"invisible steel wall",
- "dynabomb",
+ "-",
"increases number of bombs",
"increases explosion size",
"increases power of explosion",
"unknown",
"unknown",
"unknown",
- "unknown",
- "unknown",
+ "normal wall (BD style)",
+ "rock (BD style)",
"open exit",
- "unknown",
+ "black orb bomb",
"amoeba",
"mole", /* 110 */
"penguin",
"arrow down",
"pig",
"fire breathing dragon",
- "unknown",
+ "red key (EM style)",
"letter ' '", /* 120 */
"letter '!'",
"letter '\"'",
"letter ''",
"letter ''",
"letter ''",
- "growing wall (horizontally)", /* 200 */
- "growing wall (vertically)",
+ "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",
"yellow disk",
"terminal",
"red disk", /* 230 */
- "port (vertically)",
- "port (horizontally)",
+ "port (vertical)",
+ "port (horizontal)",
"port (all directions)",
"electron",
"buggy base",
"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",
"normal wall",
"normal wall",
"normal wall",
+ "tube (all directions)",
+ "tube (vertical)",
+ "tube (horizontal)",
+ "tube (vertical & left)",
+ "tube (vertical & right)",
+ "tube (horizontal & up)",
+ "tube (horizontal & down)", /* 350 */
+ "tube (left & up)",
+ "tube (left & down)",
+ "tube (right & up)",
+ "tube (right & down)",
+ "spring",
+ "trap",
+ "stable bomb (DX style)",
"-"
/*
"-------------------------------",
*/
};
+int num_element_info = sizeof(element_info)/sizeof(char *);
+
+
+/* ========================================================================= */
+/* main() */
+/* ========================================================================= */
int main(int argc, char *argv[])
{
- program_name = (strrchr(argv[0],'/') ? strrchr(argv[0],'/') + 1 : argv[0]);
-
-#ifdef MSDOS
- _fmode = O_BINARY;
-#endif
+ InitCommandName(argv[0]);
+ InitExitFunction(CloseAllAndExit);
+ InitPlatformDependantStuff();
GetOptions(argv);
- OpenAll(argc,argv);
+ OpenAll();
+
EventLoop();
CloseAllAndExit(0);
exit(0); /* to keep compilers happy */