X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fmain.c;h=335cee2329c7b391fb16aee053a089fd2da17502;hb=884db54d739f5838243315f390d28634cb99a7d9;hp=181415d49b2168b94f86c4f09b94dda11b8420d4;hpb=d4665f01d15ba3679f378819710a84d6c2348a9c;p=rocksndiamonds.git diff --git a/src/main.c b/src/main.c index 181415d4..335cee23 100644 --- a/src/main.c +++ b/src/main.c @@ -1,72 +1,37 @@ /*********************************************************** -* 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 -#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]; @@ -81,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, leveldir_nr, num_leveldirs; int lev_fieldx,lev_fieldy, scroll_x,scroll_y; int FX = SX, FY = SY, ScrollStepSize; @@ -98,102 +63,91 @@ int SBX_Left, SBX_Right; 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[MAX_LEVDIR_ENTRIES]; 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 SetupFileList *setup_list = NULL; -struct SetupFileList *level_setup_list = NULL; 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" }; -/* background music */ -int background_loop[] = +/* sound effects: setup file identifiers and corresponding default filenames */ +struct +{ + char *identifier; + char *default_filename; +} +sound_effect[NUM_SOUND_EFFECTS] = { - SND_ALCHEMY, - SND_CHASE, - SND_NETWORK, - SND_CZARDASZ, - SND_TYGER, - SND_VOYAGER, - SND_TWILIGHT + { "collecting_infotron", "infotron.wav" }, + { "falling_zonk", "zonkdown.wav" }, + { "pushing_zonk", "zonkpush.wav" } }; -int num_bg_loops = sizeof(background_loop)/sizeof(int); char *element_info[] = { @@ -260,7 +214,7 @@ 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", @@ -302,10 +256,10 @@ char *element_info[] = "unknown", "unknown", "unknown", - "unknown", - "unknown", + "normal wall (BD style)", + "rock (BD style)", "open exit", - "unknown", + "black orb bomb", "amoeba", "mole", /* 110 */ "penguin", @@ -316,7 +270,7 @@ char *element_info[] = "arrow down", "pig", "fire breathing dragon", - "unknown", + "red key (EM style)", "letter ' '", /* 120 */ "letter '!'", "letter '\"'", @@ -397,16 +351,16 @@ char *element_info[] = "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", @@ -428,8 +382,8 @@ char *element_info[] = "yellow disk", "terminal", "red disk", /* 230 */ - "port (vertically)", - "port (horizontally)", + "port (vertical)", + "port (horizontal)", "port (all directions)", "electron", "buggy base", @@ -447,10 +401,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", @@ -463,14 +417,14 @@ char *element_info[] = "white door", /* 260 */ "gray door (opened by white key)", "white key", - "force field", + "shield (passive)", "extra time", "switch gate (open)", "switch gate (closed)", - "switch for switch gate (open)", - "switch for switch gate (closed)", - "time gate", - "time gate with magic wheel", /* 270 */ + "switch for switch gate", + "switch for switch gate", + "-", + "-", /* 270 */ "red conveyor belt (left)", "red conveyor belt (middle)", "red conveyor belt (right)", @@ -497,10 +451,11 @@ char *element_info[] = "switch for blue conveyor belt (right)", "land mine", "mail envelope", - "light switch", + "light switch (off)", + "light switch (on)", "sign (exclamation)", - "sign (radio activity)", - "sign (stop)", /* 300 */ + "sign (radio activity)", /* 300 */ + "sign (stop)", "sign (wheel chair)", "sign (parking)", "sign (one way)", @@ -509,39 +464,76 @@ char *element_info[] = "sign (round)", "sign (exit)", "sign (yin yang)", - "sign (other)", - "mole (starts moving left)", /* 310 */ + "sign (other)", /* 310 */ + "mole (starts moving left)", "mole (starts moving right)", "mole (starts moving up)", "mole (starts moving down)", - "steel (?)", + "steel wall (slanted)", "invisible sand", - "-", - "-", - "-", + "dx unknown 15", + "dx unknown 42", "-", "-", /* 320 */ - "-", - "-", - "-", - "-", + "shield (active, kills enemies)", + "time gate (open)", + "time gate (closed)", + "switch for time gate", + "switch for time gate", + "balloon", + "send balloon to the left", + "send balloon to the right", + "send balloon up", + "send balloon down", /* 330 */ + "send balloon in any direction", + "steel wall", + "steel wall", + "steel wall", + "steel wall", + "normal wall", + "normal wall", + "normal wall", + "normal wall", + "normal wall", /* 340 */ + "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 */