/***********************************************************
* Rocks'n'Diamonds -- McDuffin Strikes Back!               *
*----------------------------------------------------------*
* (c) 1995-2002 Artsoft Entertainment                      *
*               Holger Schemel                             *
*               Detmolder Strasse 189                      *
*               33604 Bielefeld                            *
*               Germany                                    *
*               e-mail: info@artsoft.org                   *
*----------------------------------------------------------*
* main.c                                                   *
***********************************************************/

#include "libgame/libgame.h"

#include "main.h"
#include "init.h"
#include "game.h"
#include "events.h"

#if 0
GC			tile_clip_gc;
Bitmap		       *pix[NUM_BITMAPS];
#endif
Bitmap		       *bitmap_db_field, *bitmap_db_door;
#if 0
Pixmap			tile_clipmask[NUM_TILES];
#endif
DrawBuffer	     *fieldbuffer;
DrawBuffer	     *drawto_field;

int			game_status = MAINMENU;
boolean			level_editor_test_game = FALSE;
boolean			network_playing = FALSE;

int			key_joystick_mapping = 0;

boolean			redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
int			redraw_x1 = 0, redraw_y1 = 0;

short			Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
short			Ur[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];
short			Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
short			Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
short			StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
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];
short			AmoebaCnt2[MAX_NUM_AMOEBA];
short			ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
short			ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY];

unsigned long		Properties1[MAX_NUM_ELEMENTS];
unsigned long		Properties2[MAX_NUM_ELEMENTS];

int			GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
int			GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
int 			GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];

int			lev_fieldx, lev_fieldy;
int			scroll_x, scroll_y;

int			FX = SX, FY = SY;
int			ScrollStepSize;
int			ScreenMovDir = MV_NO_MOVING, ScreenMovPos = 0;
int			ScreenGfxPos = 0;
int			BorderElement = EL_STEELWALL;
int			GameFrameDelay = GAME_FRAME_DELAY;
int			FfwdFrameDelay = FFWD_FRAME_DELAY;
int			BX1 = 0, BY1 = 0;
int			BX2 = SCR_FIELDX - 1, BY2 = SCR_FIELDY - 1;
int			SBX_Left, SBX_Right;
int			SBY_Upper, SBY_Lower;
int			ZX, ZY;
int			ExitX, ExitY;
int			AllPlayersGone;

int			TimeFrames, TimePlayed, TimeLeft;

boolean			network_player_action_received = FALSE;

struct LevelInfo	level;
struct PlayerInfo	stored_player[MAX_PLAYERS], *local_player = NULL;
struct HiScore		highscore[MAX_SCORE_ENTRIES];
struct TapeInfo		tape;
struct SetupInfo	setup;
struct GameInfo		game;
struct GlobalInfo	global;
struct GraphicInfo     *graphic_info = NULL;
struct SoundInfo       *sound_info = NULL;


/* ------------------------------------------------------------------------- */
/* element definitions                                                       */
/* ------------------------------------------------------------------------- */

struct ElementInfo element_info[MAX_NUM_ELEMENTS + 1] =
{
  /* ----------------------------------------------------------------------- */
  /* "real" level file elements                                              */
  /* ----------------------------------------------------------------------- */

  {
    "empty_space",
    "empty_space",
    "empty space"
  },
  {
    "sand",
    "sand",
    "sand"
  },
  {
    "wall",
    "wall",
    "normal wall"
  },
  {
    "wall_crumbled",
    "wall",
    "round wall"
  },
  {
    "rock",
    "rock",
    "rock"
  },
  {
    "key_obsolete",
    "key",
    "key"
  },
  {
    "emerald",
    "emerald",
    "emerald"
  },
  {
    "exit_closed",
    "exit",
    "closed exit"
  },
  {
    "player_obsolete",
    "player",
    "player"
  },
  {
    "bug",
    "bug",
    "bug"
  },
  {
    "spaceship",
    "spaceship",
    "spaceship"
  },
  {
    "yamyam",
    "yamyam",
    "yam yam"
  },
  {
    "robot",
    "robot",
    "robot"
  },
  {
    "steelwall",
    "wall",
    "steel wall"
  },
  {
    "diamond",
    "diamond",
    "diamond"
  },
  {
    "amoeba_dead",
    "amoeba",
    "dead amoeba"
  },
  {
    "quicksand_empty",
    "quicksand",
    "empty quicksand"
  },
  {
    "quicksand_full",
    "quicksand",
    "quicksand with rock"
  },
  {
    "amoeba_drop",
    "amoeba",
    "amoeba drop"
  },
  {
    "bomb",
    "bomb",
    "bomb"
  },
  {
    "magic_wall",
    "magic_wall",
    "magic wall"
  },
  {
    "speed_pill",
    "speed_pill",
    "speed pill"
  },
  {
    "acid",
    "acid",
    "acid"
  },
  {
    "amoeba_wet",
    "amoeba",
    "dropping amoeba"
  },
  {
    "amoeba_dry",
    "amoeba",
    "normal amoeba"
  },
  {
    "nut",
    "nut",
    "nut with emerald"
  },
  {
    "gameoflife",
    "gameoflife",
    "Conway's wall of life"
  },
  {
    "biomaze",
    "biomaze",
    "biomaze"
  },
  {
    "dynamite_active",
    "dynamite",
    "burning dynamite"
  },
  {
    "stoneblock",
    "wall",
    "wall"
  },
  {
    "robot_wheel",
    "robot_wheel",
    "magic wheel"
  },
  {
    "robot_wheel_active",
    "robot_wheel",
    "magic wheel (running)"
  },
  {
    "key1",
    "key",
    "red key"
  },
  {
    "key2",
    "key",
    "yellow key"
  },
  {
    "key3",
    "key",
    "green key"
  },
  {
    "key4",
    "key",
    "blue key"
  },
  {
    "gate1",
    "gate",
    "red door"
  },
  {
    "gate2",
    "gate",
    "yellow door"
  },
  {
    "gate3",
    "gate",
    "green door"
  },
  {
    "gate4",
    "gate",
    "blue door"
  },
  {
    "gate1_gray",
    "gate",
    "gray door (opened by red key)"
  },
  {
    "gate2_gray",
    "gate",
    "gray door (opened by yellow key)"},
  {
    "gate3_gray",
    "gate",
    "gray door (opened by green key)"},
  {
    "gate4_gray",
    "gate",
    "gray door (opened by blue key)"},
  {
    "dynamite",
    "dynamite",
    "dynamite"
  },
  {
    "pacman",
    "pacman",
    "pac man"
  },
  {
    "invisible_wall",
    "wall",
    "invisible normal wall"
  },
  {
    "lamp",
    "lamp",
    "lamp (off)"
  },
  {
    "lamp_active",
    "lamp",
    "lamp (on)"
  },
  {
    "wall_emerald",
    "wall",
    "wall with emerald"
  },
  {
    "wall_diamond",
    "wall",
    "wall with diamond"
  },
  {
    "amoeba_full",
    "amoeba",
    "amoeba with content"
  },
  {
    "bd_amoeba",
    "bd_amoeba",
    "amoeba (BD style)"
  },
  {
    "time_orb_full",
    "time_orb_full",
    "time orb (full)"
  },
  {
    "time_orb_empty",
    "time_orb_empty",
    "time orb (empty)"
  },
  {
    "wall_growing",
    "wall",
    "growing wall"
  },
  {
    "bd_diamond",
    "bd_diamond",
    "diamond (BD style)"
  },
  {
    "emerald_yellow",
    "emerald",
    "yellow emerald"
  },
  {
    "wall_bd_diamond",
    "wall",
    "wall with BD style diamond"
  },
  {
    "wall_emerald_yellow",
    "wall",
    "wall with yellow emerald"
  },
  {
    "dark_yamyam",
    "dark_yamyam",
    "dark yam yam"
  },
  {
    "bd_magic_wall",
    "bd_magic_wall",
    "magic wall (BD style)"
  },
  {
    "invisible_steelwall",
    "wall",
    "invisible steel wall"
  },
  {
    "unused_63",
    "unused",
    "(not used)"
  },
  {
    "dynabomb_nr",
    "dynabomb_nr",
    "increases number of bombs"
  },
  {
    "dynabomb_sz",
    "dynabomb_sz",
    "increases explosion size"
  },
  {
    "dynabomb_xl",
    "dynabomb_xl",
    "increases power of explosion"
  },
  {
    "sokoban_object",
    "sokoban_object",
    "sokoban object"
  },
  {
    "sokoban_field_empty",
    "sokoban_field",
    "sokoban empty field"
  },
  {
    "sokoban_field_full",
    "sokoban_field",
    "sokoban field with object"
  },
  {
    "bd_butterfly_right",
    "bd_butterfly",
    "butterfly (starts moving right)"},
  {
    "bd_butterfly_up",
    "bd_butterfly",
    "butterfly (starts moving up)"
  },
  {
    "bd_butterfly_left",
    "bd_butterfly",
    "butterfly (starts moving left)"},
  {
    "bd_butterfly_down",
    "bd_butterfly",
    "butterfly (starts moving down)"},
  {
    "bd_firefly_right",
    "bd_firefly",
    "firefly (starts moving right)"
  },
  {
    "bd_firefly_up",
    "bd_firefly",
    "firefly (starts moving up)"
  },
  {
    "bd_firefly_left",
    "bd_firefly",
    "firefly (starts moving left)"
  },
  {
    "bd_firefly_down",
    "bd_firefly",
    "firefly (starts moving down)"
  },
  {
    "bd_butterfly",
    "bd_butterfly",
    "butterfly"
  },
  {
    "bd_firefly",
    "bd_firefly",
    "firefly"
  },
  {
    "player1",
    "player",
    "yellow player"
  },
  {
    "player2",
    "player",
    "red player"
  },
  {
    "player3",
    "player",
    "green player"
  },
  {
    "player4",
    "player",
    "blue player"
  },
  {
    "bug_right",
    "bug",
    "bug (starts moving right)"
  },
  {
    "bug_up",
    "bug",
    "bug (starts moving up)"
  },
  {
    "bug_left",
    "bug",
    "bug (starts moving left)"
  },
  {
    "bug_down",
    "bug",
    "bug (starts moving down)"
  },
  {
    "spaceship_right",
    "spaceship",
    "spaceship (starts moving right)"},
  {
    "spaceship_up",
    "spaceship",
    "spaceship (starts moving up)"
  },
  {
    "spaceship_left",
    "spaceship",
    "spaceship (starts moving left)"},
  {
    "spaceship_down",
    "spaceship",
    "spaceship (starts moving down)"},
  {
    "pacman_right",
    "pacman",
    "pac man (starts moving right)"
  },
  {
    "pacman_up",
    "pacman",
    "pac man (starts moving up)"
  },
  {
    "pacman_left",
    "pacman",
    "pac man (starts moving left)"
  },
  {
    "pacman_down",
    "pacman",
    "pac man (starts moving down)"
  },
  {
    "emerald_red",
    "emerald",
    "red emerald"
  },
  {
    "emerald_purple",
    "emerald",
    "purple emerald"
  },
  {
    "wall_emerald_red",
    "wall",
    "wall with red emerald"
  },
  {
    "wall_emerald_purple",
    "wall",
    "wall with purple emerald"
  },
  {
    "acidpool_topleft",
    "wall",
    "acid pool (top left)"
  },
  {
    "acidpool_topright",
    "wall",
    "acid pool (top right)"
  },
  {
    "acidpool_bottomleft",
    "wall",
    "acid pool (bottom left)"
  },
  {
    "acidpool_bottom",
    "wall",
    "acid pool (bottom)"
  },
  {
    "acidpool_bottomright",
    "wall",
    "acid pool (bottom right)"
  },
  {
    "bd_wall",
    "wall",
    "normal wall (BD style)"
  },
  {
    "bd_rock",
    "bd_rock",
    "rock (BD style)"
  },
  {
    "exit_open",
    "exit",
    "open exit"
  },
  {
    "black_orb",
    "black_orb",
    "black orb bomb"
  },
  {
    "amoeba_to_diamond",
    "amoeba",
    "amoeba"
  },
  {
    "mole",
    "mole",
    "mole"
  },
  {
    "penguin",
    "penguin",
    "penguin"
  },
  {
    "satellite",
    "satellite",
    "satellite"
  },
  {
    "arrow_blue_left",
    "arrow",
    "arrow left"
  },
  {
    "arrow_blue_right",
    "arrow",
    "arrow right"
  },
  {
    "arrow_blue_up",
    "arrow",
    "arrow up"
  },
  {
    "arrow_blue_down",
    "arrow",
    "arrow down"
  },
  {
    "pig",
    "pig",
    "pig"
  },
  {
    "dragon",
    "dragon",
    "fire breathing dragon"
  },
  {
    "em_key1_file",
    "key",
    "red key (EM style)"
  },
  {
    "char_space",
    "char",
    "letter ' '"
  },
  {
    "char_exclam",
    "char",
    "letter '!'"
  },
  {
    "char_quotedbl",
    "char",
    "letter '\"'"
  },
  {
    "char_numbersign",
    "char",
    "letter '#'"
  },
  {
    "char_dollar",
    "char",
    "letter '$'"
  },
  {
    "char_procent",
    "char",
    "letter '%'"
  },
  {
    "char_ampersand",
    "char",
    "letter '&'"
  },
  {
    "char_apostrophe",
    "char",
    "letter '''"
  },
  {
    "char_parenleft",
    "char",
    "letter '('"
  },
  {
    "char_parenright",
    "char",
    "letter ')'"
  },
  {
    "char_asterisk",
    "char",
    "letter '*'"
  },
  {
    "char_plus",
    "char",
    "letter '+'"
  },
  {
    "char_comma",
    "char",
    "letter ','"
  },
  {
    "char_minus",
    "char",
    "letter '-'"
  },
  {
    "char_period",
    "char",
    "letter '.'"
  },
  {
    "char_slash",
    "char",
    "letter '/'"
  },
  {
    "char_0",
    "char",
    "letter '0'"
  },
  {
    "char_1",
    "char",
    "letter '1'"
  },
  {
    "char_2",
    "char",
    "letter '2'"
  },
  {
    "char_3",
    "char",
    "letter '3'"
  },
  {
    "char_4",
    "char",
    "letter '4'"
  },
  {
    "char_5",
    "char",
    "letter '5'"
  },
  {
    "char_6",
    "char",
    "letter '6'"
  },
  {
    "char_7",
    "char",
    "letter '7'"
  },
  {
    "char_8",
    "char",
    "letter '8'"
  },
  {
    "char_9",
    "char",
    "letter '9'"
  },
  {
    "char_colon",
    "char",
    "letter ':'"
  },
  {
    "char_semicolon",
    "char",
    "letter ';'"
  },
  {
    "char_less",
    "char",
    "letter '<'"
  },
  {
    "char_equal",
    "char",
    "letter '='"
  },
  {
    "char_greater",
    "char",
    "letter '>'"
  },
  {
    "char_question",
    "char",
    "letter '?'"
  },
  {
    "char_at",
    "char",
    "letter '@'"
  },
  {
    "char_a",
    "char",
    "letter 'A'"
  },
  {
    "char_b",
    "char",
    "letter 'B'"
  },
  {
    "char_c",
    "char",
    "letter 'C'"
  },
  {
    "char_d",
    "char",
    "letter 'D'"
  },
  {
    "char_e",
    "char",
    "letter 'E'"
  },
  {
    "char_f",
    "char",
    "letter 'F'"
  },
  {
    "char_g",
    "char",
    "letter 'G'"
  },
  {
    "char_h",
    "char",
    "letter 'H'"
  },
  {
    "char_i",
    "char",
    "letter 'I'"
  },
  {
    "char_j",
    "char",
    "letter 'J'"
  },
  {
    "char_k",
    "char",
    "letter 'K'"
  },
  {
    "char_l",
    "char",
    "letter 'L'"
  },
  {
    "char_m",
    "char",
    "letter 'M'"
  },
  {
    "char_n",
    "char",
    "letter 'N'"
  },
  {
    "char_o",
    "char",
    "letter 'O'"
  },
  {
    "char_p",
    "char",
    "letter 'P'"
  },
  {
    "char_q",
    "char",
    "letter 'Q'"
  },
  {
    "char_r",
    "char",
    "letter 'R'"
  },
  {
    "char_s",
    "char",
    "letter 'S'"
  },
  {
    "char_t",
    "char",
    "letter 'T'"
  },
  {
    "char_u",
    "char",
    "letter 'U'"
  },
  {
    "char_v",
    "char",
    "letter 'V'"
  },
  {
    "char_w",
    "char",
    "letter 'W'"
  },
  {
    "char_x",
    "char",
    "letter 'X'"
  },
  {
    "char_y",
    "char",
    "letter 'Y'"
  },
  {
    "char_z",
    "char",
    "letter 'Z'"
  },
  {
    "char_ae",
    "char",
    "letter 'Ä'"
  },
  {
    "char_oe",
    "char",
    "letter 'Ö'"
  },
  {
    "char_ue",
    "char",
    "letter 'Ü'"
  },
  {
    "char_copyright",
    "char",
    "letter '^'"
  },
  {
    "char_underscore",
    "char",
    "letter ''"
  },
  {
    "char_empty",
    "char",
    "letter ''"
  },
  {
    "char_degree",
    "char",
    "letter ''"
  },
  {
    "char_tm",
    "char",
    "letter ''"
  },
  {
    "char_cursor",
    "char",
    "letter ''"
  },
  {
    "char_unused",
    "char",
    "letter ''"
  },
  {
    "char_unused",
    "char",
    "letter ''"
  },
  {
    "char_unused",
    "char",
    "letter ''"
  },
  {
    "char_unused",
    "char",
    "letter ''"
  },
  {
    "char_unused",
    "char",
    "letter ''"
  },
  {
    "char_unused",
    "char",
    "letter ''"
  },
  {
    "char_unused",
    "char",
    "letter ''"
  },
  {
    "char_unused",
    "char",
    "letter ''"
  },
  {
    "char_unused",
    "char",
    "letter ''"
  },
  {
    "char_unused",
    "char",
    "letter ''"
  },
  {
    "char_unused",
    "char",
    "letter ''"
  },
  {
    "char_unused",
    "char",
    "letter ''"
  },
  {
    "wall_growing_x",
    "wall",
    "growing wall (horizontal)"
  },
  {
    "wall_growing_y",
    "wall",
    "growing wall (vertical)"
  },
  {
    "wall_growing_xy",
    "wall",
    "growing wall (all directions)"
  },
  {
    "em_gate1",
    "gate",
    "red door (EM style)"
  },
  {
    "em_gate2",
    "gate",
    "yellow door (EM style)"
  },
  {
    "em_gate3",
    "gate",
    "green door (EM style)"
  },
  {
    "em_gate4",
    "gate",
    "blue door (EM style)"
  },
  {
    "em_key2_file",
    "key",
    "yellow key (EM style)"
  },
  {
    "em_key3_file",
    "key",
    "green key (EM style)"
  },
  {
    "em_key4_file",
    "key",
    "blue key (EM style)"
  },
  {
    "sp_empty_space",
    "empty_space",
    "empty space"
  },
  {
    "sp_zonk",
    "sp_zonk",
    "zonk"
  },
  {
    "sp_base",
    "sp_base",
    "base"
  },
  {
    "sp_murphy",
    "player",
    "murphy"
  },
  {
    "sp_infotron",
    "sp_infotron",
    "infotron"
  },
  {
    "sp_chip_single",
    "wall",
    "chip (single)"
  },
  {
    "sp_hard_gray",
    "wall",
    "hardware"
  },
  {
    "sp_exit_closed",
    "sp_exit",
    "exit"
  },
  {
    "sp_disk_orange",
    "sp_disk_orange",
    "orange disk"
  },
  {
    "sp_port1_right",
    "sp_port",
    "port (leading right)"
  },
  {
    "sp_port1_down",
    "sp_port",
    "port (leading down)"
  },
  {
    "sp_port1_left",
    "sp_port",
    "port (leading left)"
  },
  {
    "sp_port1_up",
    "sp_port",
    "port (leading up)"
  },
  {
    "sp_port2_right",
    "sp_port",
    "port (leading right)"
  },
  {
    "sp_port2_down",
    "sp_port",
    "port (leading down)"
  },
  {
    "sp_port2_left",
    "sp_port",
    "port (leading left)"
  },
  {
    "sp_port2_up",
    "sp_port",
    "port (leading up)"
  },
  {
    "sp_sniksnak",
    "sp_sniksnak",
    "snik snak"
  },
  {
    "sp_disk_yellow",
    "sp_disk_yellow",
    "yellow disk"
  },
  {
    "sp_terminal",
    "sp_terminal",
    "terminal"
  },
  {
    "sp_disk_red",
    "sp_disk_red",
    "red disk"
  },
  {
    "sp_port_y",
    "sp_port",
    "port (vertical)"
  },
  {
    "sp_port_x",
    "sp_port",
    "port (horizontal)"
  },
  {
    "sp_port_xy",
    "sp_port",
    "port (all directions)"
  },
  {
    "sp_electron",
    "sp_electron",
    "electron"
  },
  {
    "sp_buggy_base",
    "sp_buggy_base",
    "buggy base"
  },
  {
    "sp_chip_left",
    "wall",
    "chip (left half)"
  },
  {
    "sp_chip_right",
    "wall",
    "chip (right half)"
  },
  {
    "sp_hard_base1",
    "wall",
    "hardware"
  },
  {
    "sp_hard_green",
    "wall",
    "hardware"
  },
  {
    "sp_hard_blue",
    "wall",
    "hardware"
  },
  {
    "sp_hard_red",
    "wall",
    "hardware"
  },
  {
    "sp_hard_yellow",
    "wall",
    "hardware"
  },
  {
    "sp_hard_base2",
    "wall",
    "hardware"
  },
  {
    "sp_hard_base3",
    "wall",
    "hardware"
  },
  {
    "sp_hard_base4",
    "wall",
    "hardware"
  },
  {
    "sp_hard_base5",
    "wall",
    "hardware"
  },
  {
    "sp_hard_base6",
    "wall",
    "hardware"
  },
  {
    "sp_chip_upper",
    "wall",
    "chip (upper half)"
  },
  {
    "sp_chip_lower",
    "wall",
    "chip (lower half)"
  },
  {
    "em_gate1_gray",
    "gate",
    "gray door (EM style, red key)"
  },
  {
    "em_gate2_gray",
    "gate",
    "gray door (EM style, yellow key)"
  },
  {
    "em_gate3_gray",
    "gate",
    "gray door (EM style, green key)"
  },
  {
    "em_gate4_gray",
    "gate",
    "gray door (EM style, blue key)"
  },
  {
    "unused_254",
    "unused",
    "(not used)"
  },
  {
    "unused_255",
    "unused",
    "(not used)"
  },
  {
    "pearl",
    "pearl",
    "pearl"
  },
  {
    "crystal",
    "crystal",
    "crystal"
  },
  {
    "wall_pearl",
    "wall",
    "wall with pearl"
  },
  {
    "wall_crystal",
    "wall",
    "wall with crystal"
  },
  {
    "door_white",
    "gate",
    "white door"
  },
  {
    "door_white_gray",
    "gate",
    "gray door (opened by white key)"
  },
  {
    "key_white",
    "key",
    "white key"
  },
  {
    "shield_normal",
    "shield_normal",
    "shield (normal)"
  },
  {
    "extra_time",
    "extra_time",
    "extra time"
  },
  {
    "switchgate_open",
    "switchgate",
    "switch gate (open)"
  },
  {
    "switchgate_closed",
    "switchgate",
    "switch gate (closed)"
  },
  {
    "switchgate_switch_up",
    "switchgate_switch",
    "switch for switch gate"
  },
  {
    "switchgate_switch_down",
    "switchgate_switch",
    "switch for switch gate"
  },
  {
    "unused_269",
    "unused",
    "-"
  },
  {
    "unused_270",
    "unused",
    "-"
  },
  {
    "conveyor_belt1_left",
    "conveyor_belt",
    "red conveyor belt (left)"
  },
  {
    "conveyor_belt1_middle",
    "conveyor_belt",
    "red conveyor belt (middle)"
  },
  {
    "conveyor_belt1_right",
    "conveyor_belt",
    "red conveyor belt (right)"
  },
  {
    "conveyor_belt1_switch_left",
    "conveyor_belt_switch",
    "switch for red conveyor belt (left)"
  },
  {
    "conveyor_belt1_switch_middle",
    "conveyor_belt_switch",
    "switch for red conveyor belt (middle)"
  },
  {
    "conveyor_belt1_switch_right",
    "conveyor_belt_switch",
    "switch for red conveyor belt (right)"
  },
  {
    "conveyor_belt2_left",
    "conveyor_belt",
    "yellow conveyor belt (left)"
  },
  {
    "conveyor_belt2_middle",
    "conveyor_belt",
    "yellow conveyor belt (middle)"
  },
  {
    "conveyor_belt2_right",
    "conveyor_belt",
    "yellow conveyor belt (right)"
  },
  {
    "conveyor_belt2_switch_left",
    "conveyor_belt_switch",
    "switch for yellow conveyor belt (left)"
  },
  {
    "conveyor_belt2_switch_middle",
    "conveyor_belt_switch",
    "switch for yellow conveyor belt (middle)"
  },
  {
    "conveyor_belt2_switch_right",
    "conveyor_belt_switch",
    "switch for yellow conveyor belt (right)"
  },
  {
    "conveyor_belt3_left",
    "conveyor_belt",
    "green conveyor belt (left)"
  },
  {
    "conveyor_belt3_middle",
    "conveyor_belt",
    "green conveyor belt (middle)"
  },
  {
    "conveyor_belt3_right",
    "conveyor_belt",
    "green conveyor belt (right)"
  },
  {
    "conveyor_belt3_switch_left",
    "conveyor_belt_switch",
    "switch for green conveyor belt (left)"
  },
  {
    "conveyor_belt3_switch_middle",
    "conveyor_belt_switch",
    "switch for green conveyor belt (middle)"
  },
  {
    "conveyor_belt3_switch_right",
    "conveyor_belt_switch",
    "switch for green conveyor belt (right)"
  },
  {
    "conveyor_belt4_left",
    "conveyor_belt",
    "blue conveyor belt (left)"
  },
  {
    "conveyor_belt4_middle",
    "conveyor_belt",
    "blue conveyor belt (middle)"
  },
  {
    "conveyor_belt4_right",
    "conveyor_belt",
    "blue conveyor belt (right)"
  },
  {
    "conveyor_belt4_switch_left",
    "conveyor_belt_switch",
    "switch for blue conveyor belt (left)"
  },
  {
    "conveyor_belt4_switch_middle",
    "conveyor_belt_switch",
    "switch for blue conveyor belt (middle)"
  },
  {
    "conveyor_belt4_switch_right",
    "conveyor_belt_switch",
    "switch for blue conveyor belt (right)"
  },
  {
    "landmine",
    "sand",
    "land mine"
  },
  {
    "envelope",
    "envelope",
    "mail envelope"
  },
  {
    "light_switch",
    "light_switch",
    "light switch (off)"
  },
  {
    "light_switch_active",
    "light_switch",
    "light switch (on)"
  },
  {
    "sign_exclamation",
    "wall",
    "sign (exclamation)"
  },
  {
    "sign_radioactivity",
    "wall",
    "sign (radio activity)"
  },
  {
    "sign_stop",
    "wall",
    "sign (stop)"
  },
  {
    "sign_wheelchair",
    "wall",
    "sign (wheel chair)"
  },
  {
    "sign_parking",
    "wall",
    "sign (parking)"
  },
  {
    "sign_oneway",
    "wall",
    "sign (one way)"
  },
  {
    "sign_heart",
    "wall",
    "sign (heart)"
  },
  {
    "sign_triangle",
    "wall",
    "sign (triangle)"
  },
  {
    "sign_round",
    "wall",
    "sign (round)"
  },
  {
    "sign_exit",
    "wall",
    "sign (exit)"
  },
  {
    "sign_yinyang",
    "wall",
    "sign (yin yang)"
  },
  {
    "sign_other",
    "wall",
    "sign (other)"
  },
  {
    "mole_left",
    "mole",
    "mole (starts moving left)"
  },
  {
    "mole_right",
    "mole",
    "mole (starts moving right)"
  },
  {
    "mole_up",
    "mole",
    "mole (starts moving up)"
  },
  {
    "mole_down",
    "mole",
    "mole (starts moving down)"
  },
  {
    "steelwall_slanted",
    "wall",
    "steel wall (slanted)"
  },
  {
    "invisible_sand",
    "sand",
    "invisible sand"
  },
  {
    "dx_unknown_15",
    "unknown",
    "dx unknown element 15"
  },
  {
    "dx_unknown_42",
    "unknown",
    "dx unknown element 42"
  },
  {
    "unused_319",
    "unused",
    "(not used)"
  },
  {
    "unused_320",
    "unused",
    "(not used)"
  },
  {
    "shield_deadly",
    "shield_deadly",
    "shield (deadly, kills enemies)"
  },
  {
    "timegate_open",
    "timegate",
    "time gate (open)"
  },
  {
    "timegate_closed",
    "timegate",
    "time gate (closed)"
  },
  {
    "timegate_switch_active",
    "timegate_switch",
    "switch for time gate"
  },
  {
    "timegate_switch",
    "timegate_switch",
    "switch for time gate"
  },
  {
    "balloon",
    "balloon",
    "balloon"
  },
  {
    "balloon_send_left",
    "balloon_switch",
    "send balloon to the left"
  },
  {
    "balloon_send_right",
    "balloon_switch",
    "send balloon to the right"
  },
  {
    "balloon_send_up",
    "balloon_switch",
    "send balloon up"
  },
  {
    "balloon_send_down",
    "balloon_switch",
    "send balloon down"
  },
  {
    "balloon_send_any_direction",
    "balloon_switch",
    "send balloon in any direction"
  },
  {
    "emc_steelwall1",
    "wall",
    "steel wall"
  },
  {
    "emc_steelwall2",
    "wall",
    "steel wall"
  },
  {
    "emc_steelwall3",
    "wall",
    "steel wall"
  },
  {
    "emc_steelwall4",
    "wall",
    "steel wall"
  },
  {
    "emc_wall_pillar_upper",
    "wall",
    "normal wall"
  },
  {
    "emc_wall_pillar_middle",
    "wall",
    "normal wall"
  },
  {
    "emc_wall_pillar_lower",
    "wall",
    "normal wall"
  },
  {
    "emc_wall4",
    "wall",
    "normal wall"
  },
  {
    "emc_wall5",
    "wall",
    "normal wall"
  },
  {
    "emc_wall6",
    "wall",
    "normal wall"
  },
  {
    "emc_wall7",
    "wall",
    "normal wall"
  },
  {
    "emc_wall8",
    "wall",
    "normal wall"
  },
  {
    "tube_all",
    "tube",
    "tube (all directions)"
  },
  {
    "tube_vertical",
    "tube",
    "tube (vertical)"
  },
  {
    "tube_horizontal",
    "tube",
    "tube (horizontal)"
  },
  {
    "tube_vertical_left",
    "tube",
    "tube (vertical & left)"
  },
  {
    "tube_vertical_right",
    "tube",
    "tube (vertical & right)"
  },
  {
    "tube_horizontal_up",
    "tube",
    "tube (horizontal & up)"
  },
  {
    "tube_horizontal_down",
    "tube",
    "tube (horizontal & down)"
  },
  {
    "tube_left_up",
    "tube",
    "tube (left & up)"
  },
  {
    "tube_left_down",
    "tube",
    "tube (left & down)"
  },
  {
    "tube_right_up",
    "tube",
    "tube (right & up)"
  },
  {
    "tube_right_down",
    "tube",
    "tube (right & down)"
  },
  {
    "spring",
    "spring",
    "spring"
  },
  {
    "trap",
    "trap",
    "trap"
  },
  {
    "dx_supabomb",
    "dx_bomb",
    "stable bomb (DX style)"
  },
  {
    "unused_358",
    "unused",
    "-"
  },
  {
    "unused_359",
    "unused",
    "-"
  },
  {
    "custom_1",
    "custom_1",
    "custom element 1"
  },
  {
    "custom_2",
    "custom_2",
    "custom element 2"
  },
  {
    "custom_3",
    "custom_3",
    "custom element 3"
  },
  {
    "custom_4",
    "custom_4",
    "custom element 4"
  },
  {
    "custom_5",
    "custom_5",
    "custom element 5"
  },
  {
    "custom_6",
    "custom_6",
    "custom element 6"
  },
  {
    "custom_7",
    "custom_7",
    "custom element 7"
  },
  {
    "custom_8",
    "custom_8",
    "custom element 8"
  },
  {
    "custom_9",
    "custom_9",
    "custom element 9"
  },
  {
    "custom_10",
    "custom_10",
    "custom element 10"
  },
  {
    "custom_11",
    "custom_11",
    "custom element 11"
  },
  {
    "custom_12",
    "custom_12",
    "custom element 12"
  },
  {
    "custom_13",
    "custom_13",
    "custom element 13"
  },
  {
    "custom_14",
    "custom_14",
    "custom element 14"
  },
  {
    "custom_15",
    "custom_15",
    "custom element 15"
  },
  {
    "custom_16",
    "custom_16",
    "custom element 16"
  },
  {
    "custom_17",
    "custom_17",
    "custom element 17"
  },
  {
    "custom_18",
    "custom_18",
    "custom element 18"
  },
  {
    "custom_19",
    "custom_19",
    "custom element 19"
  },
  {
    "custom_20",
    "custom_20",
    "custom element 20"
  },
  {
    "custom_21",
    "custom_21",
    "custom element 21"
  },
  {
    "custom_22",
    "custom_22",
    "custom element 22"
  },
  {
    "custom_23",
    "custom_23",
    "custom element 23"
  },
  {
    "custom_24",
    "custom_24",
    "custom element 24"
  },
  {
    "custom_25",
    "custom_25",
    "custom element 25"
  },
  {
    "custom_26",
    "custom_26",
    "custom element 26"
  },
  {
    "custom_27",
    "custom_27",
    "custom element 27"
  },
  {
    "custom_28",
    "custom_28",
    "custom element 28"
  },
  {
    "custom_29",
    "custom_29",
    "custom element 29"
  },
  {
    "custom_30",
    "custom_30",
    "custom element 30"
  },
  {
    "custom_31",
    "custom_31",
    "custom element 31"
  },
  {
    "custom_32",
    "custom_32",
    "custom element 32"
  },
  {
    "custom_33",
    "custom_33",
    "custom element 33"
  },
  {
    "custom_34",
    "custom_34",
    "custom element 34"
  },
  {
    "custom_35",
    "custom_35",
    "custom element 35"
  },
  {
    "custom_36",
    "custom_36",
    "custom element 36"
  },
  {
    "custom_37",
    "custom_37",
    "custom element 37"
  },
  {
    "custom_38",
    "custom_38",
    "custom element 38"
  },
  {
    "custom_39",
    "custom_39",
    "custom element 39"
  },
  {
    "custom_40",
    "custom_40",
    "custom element 40"
  },
  {
    "custom_41",
    "custom_41",
    "custom element 41"
  },
  {
    "custom_42",
    "custom_42",
    "custom element 42"
  },
  {
    "custom_43",
    "custom_43",
    "custom element 43"
  },
  {
    "custom_44",
    "custom_44",
    "custom element 44"
  },
  {
    "custom_45",
    "custom_45",
    "custom element 45"
  },
  {
    "custom_46",
    "custom_46",
    "custom element 46"
  },
  {
    "custom_47",
    "custom_47",
    "custom element 47"
  },
  {
    "custom_48",
    "custom_48",
    "custom element 48"
  },
  {
    "custom_49",
    "custom_49",
    "custom element 49"
  },
  {
    "custom_50",
    "custom_50",
    "custom element 50"
  },
  {
    "custom_51",
    "custom_51",
    "custom element 51"
  },
  {
    "custom_52",
    "custom_52",
    "custom element 52"
  },
  {
    "custom_53",
    "custom_53",
    "custom element 53"
  },
  {
    "custom_54",
    "custom_54",
    "custom element 54"
  },
  {
    "custom_55",
    "custom_55",
    "custom element 55"
  },
  {
    "custom_56",
    "custom_56",
    "custom element 56"
  },
  {
    "custom_57",
    "custom_57",
    "custom element 57"
  },
  {
    "custom_58",
    "custom_58",
    "custom element 58"
  },
  {
    "custom_59",
    "custom_59",
    "custom element 59"
  },
  {
    "custom_60",
    "custom_60",
    "custom element 60"
  },
  {
    "custom_61",
    "custom_61",
    "custom element 61"
  },
  {
    "custom_62",
    "custom_62",
    "custom element 62"
  },
  {
    "custom_63",
    "custom_63",
    "custom element 63"
  },
  {
    "custom_64",
    "custom_64",
    "custom element 64"
  },
  {
    "custom_65",
    "custom_65",
    "custom element 65"
  },
  {
    "custom_66",
    "custom_66",
    "custom element 66"
  },
  {
    "custom_67",
    "custom_67",
    "custom element 67"
  },
  {
    "custom_68",
    "custom_68",
    "custom element 68"
  },
  {
    "custom_69",
    "custom_69",
    "custom element 69"
  },
  {
    "custom_70",
    "custom_70",
    "custom element 70"
  },
  {
    "custom_71",
    "custom_71",
    "custom element 71"
  },
  {
    "custom_72",
    "custom_72",
    "custom element 72"
  },
  {
    "custom_73",
    "custom_73",
    "custom element 73"
  },
  {
    "custom_74",
    "custom_74",
    "custom element 74"
  },
  {
    "custom_75",
    "custom_75",
    "custom element 75"
  },
  {
    "custom_76",
    "custom_76",
    "custom element 76"
  },
  {
    "custom_77",
    "custom_77",
    "custom element 77"
  },
  {
    "custom_78",
    "custom_78",
    "custom element 78"
  },
  {
    "custom_79",
    "custom_79",
    "custom element 79"
  },
  {
    "custom_80",
    "custom_80",
    "custom element 80"
  },
  {
    "custom_81",
    "custom_81",
    "custom element 81"
  },
  {
    "custom_82",
    "custom_82",
    "custom element 82"
  },
  {
    "custom_83",
    "custom_83",
    "custom element 83"
  },
  {
    "custom_84",
    "custom_84",
    "custom element 84"
  },
  {
    "custom_85",
    "custom_85",
    "custom element 85"
  },
  {
    "custom_86",
    "custom_86",
    "custom element 86"
  },
  {
    "custom_87",
    "custom_87",
    "custom element 87"
  },
  {
    "custom_88",
    "custom_88",
    "custom element 88"
  },
  {
    "custom_89",
    "custom_89",
    "custom element 89"
  },
  {
    "custom_90",
    "custom_90",
    "custom element 90"
  },
  {
    "custom_91",
    "custom_91",
    "custom element 91"
  },
  {
    "custom_92",
    "custom_92",
    "custom element 92"
  },
  {
    "custom_93",
    "custom_93",
    "custom element 93"
  },
  {
    "custom_94",
    "custom_94",
    "custom element 94"
  },
  {
    "custom_95",
    "custom_95",
    "custom element 95"
  },
  {
    "custom_96",
    "custom_96",
    "custom element 96"
  },
  {
    "custom_97",
    "custom_97",
    "custom element 97"
  },
  {
    "custom_98",
    "custom_98",
    "custom element 98"
  },
  {
    "custom_99",
    "custom_99",
    "custom element 99"
  },
  {
    "custom_100",
    "custom_100",
    "custom element 100"
  },
  {
    "custom_101",
    "custom_101",
    "custom element 101"
  },
  {
    "custom_102",
    "custom_102",
    "custom element 102"
  },
  {
    "custom_103",
    "custom_103",
    "custom element 103"
  },
  {
    "custom_104",
    "custom_104",
    "custom element 104"
  },
  {
    "custom_105",
    "custom_105",
    "custom element 105"
  },
  {
    "custom_106",
    "custom_106",
    "custom element 106"
  },
  {
    "custom_107",
    "custom_107",
    "custom element 107"
  },
  {
    "custom_108",
    "custom_108",
    "custom element 108"
  },
  {
    "custom_109",
    "custom_109",
    "custom element 109"
  },
  {
    "custom_110",
    "custom_110",
    "custom element 110"
  },
  {
    "custom_111",
    "custom_111",
    "custom element 111"
  },
  {
    "custom_112",
    "custom_112",
    "custom element 112"
  },
  {
    "custom_113",
    "custom_113",
    "custom element 113"
  },
  {
    "custom_114",
    "custom_114",
    "custom element 114"
  },
  {
    "custom_115",
    "custom_115",
    "custom element 115"
  },
  {
    "custom_116",
    "custom_116",
    "custom element 116"
  },
  {
    "custom_117",
    "custom_117",
    "custom element 117"
  },
  {
    "custom_118",
    "custom_118",
    "custom element 118"
  },
  {
    "custom_119",
    "custom_119",
    "custom element 119"
  },
  {
    "custom_120",
    "custom_120",
    "custom element 120"
  },
  {
    "custom_121",
    "custom_121",
    "custom element 121"
  },
  {
    "custom_122",
    "custom_122",
    "custom element 122"
  },
  {
    "custom_123",
    "custom_123",
    "custom element 123"
  },
  {
    "custom_124",
    "custom_124",
    "custom element 124"
  },
  {
    "custom_125",
    "custom_125",
    "custom element 125"
  },
  {
    "custom_126",
    "custom_126",
    "custom element 126"
  },
  {
    "custom_127",
    "custom_127",
    "custom element 127"
  },
  {
    "custom_128",
    "custom_128",
    "custom element 128"
  },

  /* ----------------------------------------------------------------------- */
  /* "real" (and therefore drawable) runtime elements                        */
  /* ----------------------------------------------------------------------- */

  {
    "em_key1",
    "key",
    "-"
    },
  {
    "em_key2",
    "key",
    "-"
    },
  {
    "em_key3",
    "key",
    "-"
  },
  {
    "em_key4",
    "key",
    "-"
  },
  {
    "dynabomb_player1_active",
    "dynabomb",
    "-"
  },
  {
    "dynabomb_player2_active",
    "dynabomb",
    "-"
  },
  {
    "dynabomb_player3_active",
    "dynabomb",
    "-"
  },
  {
    "dynabomb_player4_active",
    "dynabomb",
    "-"
  },
  {
    "switchgate_opening",
    "switchgate",
    "-"
  },
  {
    "switchgate_closing",
    "switchgate",
    "-"
  },
  {
    "timegate_opening",
    "timegate",
    "-"
  },
  {
    "timegate_closing",
    "timegate",
    "-"
  },
  {
    "pearl_breaking",
    "pearl",
    "-"
  },
  {
    "trap_active",
    "trap",
    "-"
  },
  {
    "invisible_steelwall_active",
    "wall",
    "-"
  },
  {
    "invisible_wall_active",
    "wall",
    "-"
  },
  {
    "invisible_sand_active",
    "sand",
    "-"
  },
  {
    "conveyor_belt1_left_active",
    "conveyor_belt",
    "-"
  },
  {
    "conveyor_belt1_middle_active",
    "conveyor_belt",
    "-"
  },
  {
    "conveyor_belt1_right_active",
    "conveyor_belt",
    "-"
  },
  {
    "conveyor_belt2_left_active",
    "conveyor_belt",
    "-"
  },
  {
    "conveyor_belt2_middle_active",
    "conveyor_belt",
    "-"
  },
  {
    "conveyor_belt2_right_active",
    "conveyor_belt",
    "-"
  },
  {
    "conveyor_belt3_left_active",
    "conveyor_belt",
    "-"
  },
  {
    "conveyor_belt3_middle_active",
    "conveyor_belt",
    "-"
  },
  {
    "conveyor_belt3_right_active",
    "conveyor_belt",
    "-"
  },
  {
    "conveyor_belt4_left_active",
    "conveyor_belt",
    "-"
  },
  {
    "conveyor_belt4_middle_active",
    "conveyor_belt",
    "-"
  },
  {
    "conveyor_belt4_right_active",
    "conveyor_belt",
    "-"
  },
  {
    "exit_opening",
    "exit",
    "-"
  },
  {
    "sp_exit_open",
    "sp_exit",
    "-"
  },
  {
    "sp_terminal_active",
    "sp_terminal",
    "-"
  },
  {
    "sp_buggy_base_activating",
    "sp_buggy_base",
    "-"
  },
  {
    "sp_buggy_base_active",
    "sp_buggy_base",
    "-"
  },
  {
    "sp_murphy_clone",
    "murphy_clone",
    "-"
  },
  {
    "amoeba_dripping",
    "amoeba",
    "-"
  },
  {
    "quicksand_emptying",
    "quicksand",
    "-"
  },
  {
    "magic_wall_active",
    "magic_wall",
    "-"
  },
  {
    "bd_magic_wall_active",
    "magic_wall",
    "-"
  },
  {
    "magic_wall_full",
    "magic_wall",
    "-"
  },
  {
    "bd_magic_wall_full",
    "magic_wall",
    "-"
  },
  {
    "magic_wall_emptying",
    "magic_wall",
    "-"
  },
  {
    "bd_magic_wall_emptying",
    "magic_wall",
    "-"
  },
  {
    "magic_wall_dead",
    "magic_wall",
    "-"
  },
  {
    "bd_magic_wall_dead",
    "magic_wall",
    "-"
  },

  /* ----------------------------------------------------------------------- */
  /* "unreal" (and therefore not drawable) runtime elements                  */
  /* ----------------------------------------------------------------------- */

  {
    "blocked",
    "-",
    "-"
  },
  {
    "explosion",
    "-",
    "-"
  },
  {
    "nut_cracking",
    "-",
    "-"
  },
  {
    "acid_splash_left",
    "-",
    "-"
  },
  {
    "acid_splash_right",
    "-",
    "-"
  },
  {
    "amoeba_creating",
    "-",
    "-"
  },
  {
    "amoeba_shrinking",
    "-",
    "-"
  },
  {
    "wall_growing_active",
    "-",
    "-"
  },
  {
    "flames",
    "-",
    "-"
  },
  {
    "player_is_leaving",
    "-",
    "-"
  },
  {
    "quicksand_filling",
    "-",
    "-"
  },
  {
    "magic_wall_filling",
    "-",
    "-"
  },
  {
    "bd_magic_wall_filling",
    "-",
    "-"
  },

  /* ----------------------------------------------------------------------- */
  /* dummy elements (never used as game elements, only used as graphics)     */
  /* ----------------------------------------------------------------------- */

  {
    "steelwall_topleft",
    "-",
    "-"
  },
  {
    "steelwall_topright",
    "-",
    "-"
  },
  {
    "steelwall_bottomleft",
    "-",
    "-"
  },
  {
    "steelwall_bottomright",
    "-",
    "-"
  },
  {
    "steelwall_horizontal",
    "-",
    "-"
  },
  {
    "steelwall_vertical",
    "-",
    "-"
  },
  {
    "invisible_steelwall_topleft",
    "-",
    "-"
  },
  {
    "invisible_steelwall_topright",
    "-",
    "-"
  },
  {
    "invisible_steelwall_bottomleft",
    "-",
    "-"
  },
  {
    "invisible_steelwall_bottomright",
    "-",
    "-"
  },
  {
    "invisible_steelwall_horizontal",
    "-",
    "-"
  },
  {
    "invisible_steelwall_vertical",
    "-",
    "-"
  },
  {
    "sand_crumbled",
    "-",
    "-"
  },
  {
    "dynabomb_active",
    "-",
    "-"
  },
  {
    "shield_normal_active",
    "-",
    "-"
  },
  {
    "shield_deadly_active",
    "-",
    "-"
  },
  {
    "arrow_red_left",
    "-",
    "-"
  },
  {
    "arrow_red_right",
    "-",
    "-"
  },
  {
    "arrow_red_up",
    "-",
    "-"
  },
  {
    "arrow_red_down",
    "-",
    "-"
  },

  {
    NULL,
    NULL,
    "-"
  }
};


/* ------------------------------------------------------------------------- */
/* element action and direction definitions                                  */
/* ------------------------------------------------------------------------- */

struct ElementActionInfo element_action_info[NUM_ACTIONS + 1] =
{
  { ".[DEFAULT]",	ACTION_DEFAULT,		TRUE	},
  { ".waiting",		ACTION_WAITING,		TRUE	},
  { ".falling",		ACTION_FALLING,		TRUE	},
  { ".moving",		ACTION_MOVING,		TRUE	},
  { ".digging",		ACTION_DIGGING,		FALSE	},
  { ".snapping",	ACTION_SNAPPING,	FALSE	},
  { ".collecting",	ACTION_COLLECTING,	FALSE	},
  { ".pushing",		ACTION_PUSHING,		FALSE	},
  { ".passing",		ACTION_PASSING,		FALSE	},
  { ".impact",		ACTION_IMPACT,		FALSE	},
  { ".cracking",	ACTION_CRACKING,	FALSE	},
  { ".breaking",	ACTION_BREAKING,	FALSE	},
  { ".activating",	ACTION_ACTIVATING,	FALSE	},
  { ".opening",		ACTION_OPENING,		FALSE	},
  { ".closing",		ACTION_CLOSING,		FALSE	},
  { ".eating",		ACTION_EATING,		FALSE	},
  { ".attacking",	ACTION_ATTACKING,	TRUE	},
  { ".growing",		ACTION_GROWING,		TRUE	},
  { ".shrinking",	ACTION_SHRINKING,	FALSE	},
  { ".active",		ACTION_ACTIVE,		TRUE	},
  { ".other",		ACTION_OTHER,		FALSE	},

  { NULL,		0,			0	}
};

struct ElementDirectionInfo element_direction_info[NUM_DIRECTIONS + 1] =
{
  { ".left",		MV_BIT_LEFT			},
  { ".right",		MV_BIT_RIGHT			},
  { ".up",		MV_BIT_UP			},
  { ".down",		MV_BIT_DOWN			},

  { NULL,		0				}
};

struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1] =
{
  { ".EDITOR",		0,				},
  { ".PREVIEW",		0,				},

  { NULL,		0,				}
};


/* ========================================================================= */
/* main()                                                                    */
/* ========================================================================= */

int main(int argc, char *argv[])
{
  InitCommandName(argv[0]);
  InitExitFunction(CloseAllAndExit);
  InitPlatformDependantStuff();

  GetOptions(argv);
  OpenAll();

  EventLoop();
  CloseAllAndExit(0);

  return 0;	/* to keep compilers happy */
}
