rnd-20020825-1-src
authorHolger Schemel <info@artsoft.org>
Sun, 25 Aug 2002 00:51:32 +0000 (02:51 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:38:12 +0000 (10:38 +0200)
CHANGES
src/conftime.h
src/init.c
src/main.c
src/main.h
src/tools.c

diff --git a/CHANGES b/CHANGES
index 3635776709fae4786c845201ec4e5726c37d49f4..07f4ca8825a4ada055a4262f1fec28669a4ca2d7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+Release Version 2.1.2 [?? ??? ????]
+-----------------------------------
+       - level series artwork now configurable via level series config file
+
 Release Version 2.1.1 [13 AUG 2002]
 -----------------------------------
        - sound bug (causing crashes) fixed (reported by Keith Peterston)
index b80ee518ddfdd826f73218ec787c158211c69bde..74e0118a05928f6a0ac8f70aeee773e81657fe6c 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2002-08-24 23:51]"
+#define COMPILE_DATE_STRING "[2002-08-25 02:44]"
index 26f0268c0481651f6f93b384e7bea57cf4513cfd..a06bd295bd99e5e53e82f37004be90b32498624e 100644 (file)
@@ -51,6 +51,7 @@ static void InitSound(void);
 static void InitGfx(void);
 static void InitGfxBackground(void);
 static void InitGadgets(void);
+static void InitElementInfo(void);
 static void InitElementProperties(void);
 static void Execute_Debug_Command(char *);
 
@@ -95,6 +96,7 @@ void OpenAll(void)
   InitEventFilter(FilterMouseMotionEvents);
 
   InitGfx();
+  InitElementInfo();
   InitElementProperties();     /* initializes IS_CHAR() for el2gfx() */
 
   InitLevelInfo();
@@ -533,9 +535,335 @@ void InitGadgets()
   CreateScreenGadgets();
 }
 
+void InitElementInfo()
+{
+  int i;
+
+  static struct
+  {
+    int element;
+    int graphic;
+  }
+  element_to_graphic[] =
+  {
+    { EL_LEERRAUM,                     GFX_LEERRAUM            },
+    { EL_ERDREICH,                     GFX_ERDREICH            },
+    { EL_MAUERWERK,                    GFX_MAUERWERK           },
+    { EL_FELSBODEN,                    GFX_FELSBODEN           },
+    { EL_FELSBROCKEN,                  GFX_FELSBROCKEN         },
+    { EL_SCHLUESSEL,                   GFX_SCHLUESSEL          },
+    { EL_EDELSTEIN,                    GFX_EDELSTEIN           },
+    { EL_AUSGANG_ZU,                   GFX_AUSGANG_ZU          },
+    { EL_AUSGANG_ACT,                  GFX_AUSGANG_ACT         },
+    { EL_AUSGANG_AUF,                  GFX_AUSGANG_AUF         },
+    { EL_SPIELFIGUR,                   GFX_SPIELFIGUR          },
+    { EL_SPIELER1,                     GFX_SPIELER1            },
+    { EL_SPIELER2,                     GFX_SPIELER2            },
+    { EL_SPIELER3,                     GFX_SPIELER3            },
+    { EL_SPIELER4,                     GFX_SPIELER4            },
+    { EL_KAEFER,                       GFX_KAEFER              },
+    { EL_KAEFER_RIGHT,                 GFX_KAEFER_RIGHT        },
+    { EL_KAEFER_UP,                    GFX_KAEFER_UP           },
+    { EL_KAEFER_LEFT,                  GFX_KAEFER_LEFT         },
+    { EL_KAEFER_DOWN,                  GFX_KAEFER_DOWN         },
+    { EL_FLIEGER,                      GFX_FLIEGER             },
+    { EL_FLIEGER_RIGHT,                        GFX_FLIEGER_RIGHT       },
+    { EL_FLIEGER_UP,                   GFX_FLIEGER_UP          },
+    { EL_FLIEGER_LEFT,                 GFX_FLIEGER_LEFT        },
+    { EL_FLIEGER_DOWN,                 GFX_FLIEGER_DOWN        },
+    { EL_BUTTERFLY,                    GFX_BUTTERFLY           },
+    { EL_BUTTERFLY_RIGHT,              GFX_BUTTERFLY_RIGHT     },
+    { EL_BUTTERFLY_UP,                 GFX_BUTTERFLY_UP        },
+    { EL_BUTTERFLY_LEFT,               GFX_BUTTERFLY_LEFT      },
+    { EL_BUTTERFLY_DOWN,               GFX_BUTTERFLY_DOWN      },
+    { EL_FIREFLY,                      GFX_FIREFLY             },
+    { EL_FIREFLY_RIGHT,                        GFX_FIREFLY_RIGHT       },
+    { EL_FIREFLY_UP,                   GFX_FIREFLY_UP          },
+    { EL_FIREFLY_LEFT,                 GFX_FIREFLY_LEFT        },
+    { EL_FIREFLY_DOWN,                 GFX_FIREFLY_DOWN        },
+    { EL_MAMPFER,                      GFX_MAMPFER             },
+    { EL_ROBOT,                                GFX_ROBOT               },
+    { EL_BETON,                                GFX_BETON               },
+    { EL_DIAMANT,                      GFX_DIAMANT             },
+    { EL_MORAST_LEER,                  GFX_MORAST_LEER         },
+    { EL_MORAST_VOLL,                  GFX_MORAST_VOLL         },
+    { EL_QUICKSAND_EMPTYING,           GFX_MORAST_LEER         },
+    { EL_TROPFEN,                      GFX_TROPFEN             },
+    { EL_BOMBE,                                GFX_BOMBE               },
+    { EL_MAGIC_WALL_OFF,               GFX_MAGIC_WALL_OFF      },
+    { EL_MAGIC_WALL_EMPTY,             GFX_MAGIC_WALL_EMPTY    },
+    { EL_MAGIC_WALL_EMPTYING,          GFX_MAGIC_WALL_EMPTY    },
+    { EL_MAGIC_WALL_FULL,              GFX_MAGIC_WALL_FULL     },
+    { EL_MAGIC_WALL_DEAD,              GFX_MAGIC_WALL_DEAD     },
+    { EL_SALZSAEURE,                   GFX_SALZSAEURE          },
+    { EL_AMOEBE_TOT,                   GFX_AMOEBE_TOT          },
+    { EL_AMOEBE_NASS,                  GFX_AMOEBE_NASS         },
+    { EL_AMOEBE_NORM,                  GFX_AMOEBE_NORM         },
+    { EL_AMOEBE_VOLL,                  GFX_AMOEBE_VOLL         },
+    { EL_AMOEBE_BD,                    GFX_AMOEBE_BD           },
+    { EL_AMOEBA2DIAM,                  GFX_AMOEBA2DIAM         },
+    { EL_AMOEBA_DRIPPING,              GFX_AMOEBE_NASS         },
+    { EL_KOKOSNUSS,                    GFX_KOKOSNUSS           },
+    { EL_LIFE,                         GFX_LIFE                },
+    { EL_LIFE_ASYNC,                   GFX_LIFE_ASYNC          },
+    { EL_DYNAMITE_ACTIVE,              GFX_DYNAMIT             },
+    { EL_BADEWANNE,                    GFX_BADEWANNE           },
+    { EL_BADEWANNE1,                   GFX_BADEWANNE1          },
+    { EL_BADEWANNE2,                   GFX_BADEWANNE2          },
+    { EL_BADEWANNE3,                   GFX_BADEWANNE3          },
+    { EL_BADEWANNE4,                   GFX_BADEWANNE4          },
+    { EL_BADEWANNE5,                   GFX_BADEWANNE5          },
+    { EL_ABLENK_AUS,                   GFX_ABLENK_AUS          },
+    { EL_ABLENK_EIN,                   GFX_ABLENK_EIN          },
+    { EL_SCHLUESSEL1,                  GFX_SCHLUESSEL1         },
+    { EL_SCHLUESSEL2,                  GFX_SCHLUESSEL2         },
+    { EL_SCHLUESSEL3,                  GFX_SCHLUESSEL3         },
+    { EL_SCHLUESSEL4,                  GFX_SCHLUESSEL4         },
+    { EL_PFORTE1,                      GFX_PFORTE1             },
+    { EL_PFORTE2,                      GFX_PFORTE2             },
+    { EL_PFORTE3,                      GFX_PFORTE3             },
+    { EL_PFORTE4,                      GFX_PFORTE4             },
+    { EL_PFORTE1X,                     GFX_PFORTE1X            },
+    { EL_PFORTE2X,                     GFX_PFORTE2X            },
+    { EL_PFORTE3X,                     GFX_PFORTE3X            },
+    { EL_PFORTE4X,                     GFX_PFORTE4X            },
+    { EL_DYNAMITE_INACTIVE,            GFX_DYNAMIT_AUS         },
+    { EL_PACMAN,                       GFX_PACMAN              },
+    { EL_PACMAN_RIGHT,                 GFX_PACMAN_RIGHT        },
+    { EL_PACMAN_UP,                    GFX_PACMAN_UP           },
+    { EL_PACMAN_LEFT,                  GFX_PACMAN_LEFT         },
+    { EL_PACMAN_DOWN,                  GFX_PACMAN_DOWN         },
+    { EL_UNSICHTBAR,                   GFX_UNSICHTBAR          },
+    { EL_ERZ_EDEL,                     GFX_ERZ_EDEL            },
+    { EL_ERZ_DIAM,                     GFX_ERZ_DIAM            },
+    { EL_BIRNE_AUS,                    GFX_BIRNE_AUS           },
+    { EL_BIRNE_EIN,                    GFX_BIRNE_EIN           },
+    { EL_ZEIT_VOLL,                    GFX_ZEIT_VOLL           },
+    { EL_ZEIT_LEER,                    GFX_ZEIT_LEER           },
+    { EL_MAUER_LEBT,                   GFX_MAUER_LEBT          },
+    { EL_MAUER_X,                      GFX_MAUER_X             },
+    { EL_MAUER_Y,                      GFX_MAUER_Y             },
+    { EL_MAUER_XY,                     GFX_MAUER_XY            },
+    { EL_EDELSTEIN_BD,                 GFX_EDELSTEIN_BD        },
+    { EL_EDELSTEIN_GELB,               GFX_EDELSTEIN_GELB      },
+    { EL_EDELSTEIN_ROT,                        GFX_EDELSTEIN_ROT       },
+    { EL_EDELSTEIN_LILA,               GFX_EDELSTEIN_LILA      },
+    { EL_ERZ_EDEL_BD,                  GFX_ERZ_EDEL_BD         },
+    { EL_ERZ_EDEL_GELB,                        GFX_ERZ_EDEL_GELB       },
+    { EL_ERZ_EDEL_ROT,                 GFX_ERZ_EDEL_ROT        },
+    { EL_ERZ_EDEL_LILA,                        GFX_ERZ_EDEL_LILA       },
+    { EL_MAMPFER2,                     GFX_MAMPFER2            },
+    { EL_MAGIC_WALL_BD_OFF,            GFX_MAGIC_WALL_BD_OFF   },
+    { EL_MAGIC_WALL_BD_EMPTY,          GFX_MAGIC_WALL_BD_EMPTY },
+    { EL_MAGIC_WALL_BD_EMPTYING,       GFX_MAGIC_WALL_BD_EMPTY },
+    { EL_MAGIC_WALL_BD_FULL,           GFX_MAGIC_WALL_BD_FULL  },
+    { EL_MAGIC_WALL_BD_DEAD,           GFX_MAGIC_WALL_BD_DEAD  },
+    { EL_DYNABOMB_ACTIVE_1,            GFX_DYNABOMB            },
+    { EL_DYNABOMB_ACTIVE_2,            GFX_DYNABOMB            },
+    { EL_DYNABOMB_ACTIVE_3,            GFX_DYNABOMB            },
+    { EL_DYNABOMB_ACTIVE_4,            GFX_DYNABOMB            },
+    { EL_DYNABOMB_NR,                  GFX_DYNABOMB_NR         },
+    { EL_DYNABOMB_SZ,                  GFX_DYNABOMB_SZ         },
+    { EL_DYNABOMB_XL,                  GFX_DYNABOMB_XL         },
+    { EL_SOKOBAN_OBJEKT,               GFX_SOKOBAN_OBJEKT      },
+    { EL_SOKOBAN_FELD_LEER,            GFX_SOKOBAN_FELD_LEER   },
+    { EL_SOKOBAN_FELD_VOLL,            GFX_SOKOBAN_FELD_VOLL   },
+    { EL_MOLE,                         GFX_MOLE                },
+    { EL_PINGUIN,                      GFX_PINGUIN             },
+    { EL_SCHWEIN,                      GFX_SCHWEIN             },
+    { EL_DRACHE,                       GFX_DRACHE              },
+    { EL_SONDE,                                GFX_SONDE               },
+    { EL_PFEIL_LEFT,                   GFX_PFEIL_LEFT          },
+    { EL_PFEIL_RIGHT,                  GFX_PFEIL_RIGHT         },
+    { EL_PFEIL_UP,                     GFX_PFEIL_UP            },
+    { EL_PFEIL_DOWN,                   GFX_PFEIL_DOWN          },
+    { EL_SPEED_PILL,                   GFX_SPEED_PILL          },
+    { EL_SP_TERMINAL_ACTIVE,           GFX_SP_TERMINAL         },
+    { EL_SP_BUG_ACTIVE,                        GFX_SP_BUG_ACTIVE       },
+    { EL_SP_ZONK,                      GFX_SP_ZONK             },
+    { EL_INVISIBLE_STEEL,              GFX_INVISIBLE_STEEL     },
+    { EL_BLACK_ORB,                    GFX_BLACK_ORB           },
+    { EL_EM_GATE_1,                    GFX_EM_GATE_1           },
+    { EL_EM_GATE_2,                    GFX_EM_GATE_2           },
+    { EL_EM_GATE_3,                    GFX_EM_GATE_3           },
+    { EL_EM_GATE_4,                    GFX_EM_GATE_4           },
+    { EL_EM_GATE_1X,                   GFX_EM_GATE_1X          },
+    { EL_EM_GATE_2X,                   GFX_EM_GATE_2X          },
+    { EL_EM_GATE_3X,                   GFX_EM_GATE_3X          },
+    { EL_EM_GATE_4X,                   GFX_EM_GATE_4X          },
+    { EL_EM_KEY_1_FILE,                        GFX_EM_KEY_1            },
+    { EL_EM_KEY_2_FILE,                        GFX_EM_KEY_2            },
+    { EL_EM_KEY_3_FILE,                        GFX_EM_KEY_3            },
+    { EL_EM_KEY_4_FILE,                        GFX_EM_KEY_4            },
+    { EL_EM_KEY_1,                     GFX_EM_KEY_1            },
+    { EL_EM_KEY_2,                     GFX_EM_KEY_2            },
+    { EL_EM_KEY_3,                     GFX_EM_KEY_3            },
+    { EL_EM_KEY_4,                     GFX_EM_KEY_4            },
+    { EL_PEARL,                                GFX_PEARL               },
+    { EL_CRYSTAL,                      GFX_CRYSTAL             },
+    { EL_WALL_PEARL,                   GFX_WALL_PEARL          },
+    { EL_WALL_CRYSTAL,                 GFX_WALL_CRYSTAL        },
+    { EL_DOOR_WHITE,                   GFX_DOOR_WHITE          },
+    { EL_DOOR_WHITE_GRAY,              GFX_DOOR_WHITE_GRAY     },
+    { EL_KEY_WHITE,                    GFX_KEY_WHITE           },
+    { EL_SHIELD_PASSIVE,               GFX_SHIELD_PASSIVE      },
+    { EL_SHIELD_ACTIVE,                        GFX_SHIELD_ACTIVE       },
+    { EL_EXTRA_TIME,                   GFX_EXTRA_TIME          },
+    { EL_SWITCHGATE_OPEN,              GFX_SWITCHGATE_OPEN     },
+    { EL_SWITCHGATE_CLOSED,            GFX_SWITCHGATE_CLOSED   },
+    { EL_SWITCHGATE_SWITCH_1,          GFX_SWITCHGATE_SWITCH_1 },
+    { EL_SWITCHGATE_SWITCH_2,          GFX_SWITCHGATE_SWITCH_2 },
+    { EL_BELT1_LEFT,                   GFX_BELT1_LEFT          },
+    { EL_BELT1_MIDDLE,                 GFX_BELT1_MIDDLE        },
+    { EL_BELT1_RIGHT,                  GFX_BELT1_RIGHT         },
+    { EL_BELT1_SWITCH_LEFT,            GFX_BELT1_SWITCH_LEFT   },
+    { EL_BELT1_SWITCH_MIDDLE,          GFX_BELT1_SWITCH_MIDDLE },
+    { EL_BELT1_SWITCH_RIGHT,           GFX_BELT1_SWITCH_RIGHT  },
+    { EL_BELT2_LEFT,                   GFX_BELT2_LEFT          },
+    { EL_BELT2_MIDDLE,                 GFX_BELT2_MIDDLE        },
+    { EL_BELT2_RIGHT,                  GFX_BELT2_RIGHT         },
+    { EL_BELT2_SWITCH_LEFT,            GFX_BELT2_SWITCH_LEFT   },
+    { EL_BELT2_SWITCH_MIDDLE,          GFX_BELT2_SWITCH_MIDDLE },
+    { EL_BELT2_SWITCH_RIGHT,           GFX_BELT2_SWITCH_RIGHT  },
+    { EL_BELT3_LEFT,                   GFX_BELT3_LEFT          },
+    { EL_BELT3_MIDDLE,                 GFX_BELT3_MIDDLE        },
+    { EL_BELT3_RIGHT,                  GFX_BELT3_RIGHT         },
+    { EL_BELT3_SWITCH_LEFT,            GFX_BELT3_SWITCH_LEFT   },
+    { EL_BELT3_SWITCH_MIDDLE,          GFX_BELT3_SWITCH_MIDDLE },
+    { EL_BELT3_SWITCH_RIGHT,           GFX_BELT3_SWITCH_RIGHT  },
+    { EL_BELT4_LEFT,                   GFX_BELT4_LEFT          },
+    { EL_BELT4_MIDDLE,                 GFX_BELT4_MIDDLE        },
+    { EL_BELT4_RIGHT,                  GFX_BELT4_RIGHT         },
+    { EL_BELT4_SWITCH_LEFT,            GFX_BELT4_SWITCH_LEFT   },
+    { EL_BELT4_SWITCH_MIDDLE,          GFX_BELT4_SWITCH_MIDDLE },
+    { EL_BELT4_SWITCH_RIGHT,           GFX_BELT4_SWITCH_RIGHT  },
+    { EL_LANDMINE,                     GFX_LANDMINE            },
+    { EL_ENVELOPE,                     GFX_ENVELOPE            },
+    { EL_LIGHT_SWITCH_OFF,             GFX_LIGHT_SWITCH_OFF    },
+    { EL_LIGHT_SWITCH_ON,              GFX_LIGHT_SWITCH_ON     },
+    { EL_SIGN_EXCLAMATION,             GFX_SIGN_EXCLAMATION    },
+    { EL_SIGN_RADIOACTIVITY,           GFX_SIGN_RADIOACTIVITY  },
+    { EL_SIGN_STOP,                    GFX_SIGN_STOP           },
+    { EL_SIGN_WHEELCHAIR,              GFX_SIGN_WHEELCHAIR     },
+    { EL_SIGN_PARKING,                 GFX_SIGN_PARKING        },
+    { EL_SIGN_ONEWAY,                  GFX_SIGN_ONEWAY         },
+    { EL_SIGN_HEART,                   GFX_SIGN_HEART          },
+    { EL_SIGN_TRIANGLE,                        GFX_SIGN_TRIANGLE       },
+    { EL_SIGN_ROUND,                   GFX_SIGN_ROUND          },
+    { EL_SIGN_EXIT,                    GFX_SIGN_EXIT           },
+    { EL_SIGN_YINYANG,                 GFX_SIGN_YINYANG        },
+    { EL_SIGN_OTHER,                   GFX_SIGN_OTHER          },
+    { EL_MOLE_LEFT,                    GFX_MOLE_LEFT           },
+    { EL_MOLE_RIGHT,                   GFX_MOLE_RIGHT          },
+    { EL_MOLE_UP,                      GFX_MOLE_UP             },
+    { EL_MOLE_DOWN,                    GFX_MOLE_DOWN           },
+    { EL_STEEL_SLANTED,                        GFX_STEEL_SLANTED       },
+    { EL_SAND_INVISIBLE,               GFX_SAND_INVISIBLE      },
+    { EL_DX_UNKNOWN_15,                        GFX_DX_UNKNOWN_15       },
+    { EL_DX_UNKNOWN_42,                        GFX_DX_UNKNOWN_42       },
+    { EL_TIMEGATE_OPEN,                        GFX_TIMEGATE_OPEN       },
+    { EL_TIMEGATE_CLOSED,              GFX_TIMEGATE_CLOSED     },
+    { EL_TIMEGATE_SWITCH_ON,           GFX_TIMEGATE_SWITCH     },
+    { EL_TIMEGATE_SWITCH_OFF,          GFX_TIMEGATE_SWITCH     },
+    { EL_BALLOON,                      GFX_BALLOON             },
+    { EL_BALLOON_SEND_LEFT,            GFX_BALLOON_SEND_LEFT   },
+    { EL_BALLOON_SEND_RIGHT,           GFX_BALLOON_SEND_RIGHT  },
+    { EL_BALLOON_SEND_UP,              GFX_BALLOON_SEND_UP     },
+    { EL_BALLOON_SEND_DOWN,            GFX_BALLOON_SEND_DOWN   },
+    { EL_BALLOON_SEND_ANY,             GFX_BALLOON_SEND_ANY    },
+    { EL_EMC_STEEL_WALL_1,             GFX_EMC_STEEL_WALL_1    },
+    { EL_EMC_STEEL_WALL_2,             GFX_EMC_STEEL_WALL_2    },
+    { EL_EMC_STEEL_WALL_3,             GFX_EMC_STEEL_WALL_3    },
+    { EL_EMC_STEEL_WALL_4,             GFX_EMC_STEEL_WALL_4    },
+    { EL_EMC_WALL_1,                   GFX_EMC_WALL_1          },
+    { EL_EMC_WALL_2,                   GFX_EMC_WALL_2          },
+    { EL_EMC_WALL_3,                   GFX_EMC_WALL_3          },
+    { EL_EMC_WALL_4,                   GFX_EMC_WALL_4          },
+    { EL_EMC_WALL_5,                   GFX_EMC_WALL_5          },
+    { EL_EMC_WALL_6,                   GFX_EMC_WALL_6          },
+    { EL_EMC_WALL_7,                   GFX_EMC_WALL_7          },
+    { EL_EMC_WALL_8,                   GFX_EMC_WALL_8          },
+    { EL_TUBE_CROSS,                   GFX_TUBE_CROSS          },
+    { EL_TUBE_VERTICAL,                        GFX_TUBE_VERTICAL       },
+    { EL_TUBE_HORIZONTAL,              GFX_TUBE_HORIZONTAL     },
+    { EL_TUBE_VERT_LEFT,               GFX_TUBE_VERT_LEFT      },
+    { EL_TUBE_VERT_RIGHT,              GFX_TUBE_VERT_RIGHT     },
+    { EL_TUBE_HORIZ_UP,                        GFX_TUBE_HORIZ_UP       },
+    { EL_TUBE_HORIZ_DOWN,              GFX_TUBE_HORIZ_DOWN     },
+    { EL_TUBE_LEFT_UP,                 GFX_TUBE_LEFT_UP        },
+    { EL_TUBE_LEFT_DOWN,               GFX_TUBE_LEFT_DOWN      },
+    { EL_TUBE_RIGHT_UP,                        GFX_TUBE_RIGHT_UP       },
+    { EL_TUBE_RIGHT_DOWN,              GFX_TUBE_RIGHT_DOWN     },
+    { EL_SPRING,                       GFX_SPRING              },
+    { EL_SPRING_MOVING,                        GFX_SPRING              },
+    { EL_TRAP_INACTIVE,                        GFX_TRAP_INACTIVE       },
+    { EL_TRAP_ACTIVE,                  GFX_TRAP_ACTIVE         },
+    { EL_BD_WALL,                      GFX_BD_WALL             },
+    { EL_BD_ROCK,                      GFX_BD_ROCK             },
+    { EL_DX_SUPABOMB,                  GFX_DX_SUPABOMB         },
+    { EL_SP_MURPHY_CLONE,              GFX_SP_MURPHY_CLONE     },
+    { -1,                              -1                      }
+  };
+
+  /* always start with reliable default values */
+  for(i=0; i<MAX_ELEMENTS; i++)
+    element_info[i].graphic = GFX_LEERRAUM;
+
+  for (i=EL_CHAR_START; i<=EL_CHAR_END; i++)
+    element_info[i].graphic = GFX_CHAR_START + (i - EL_CHAR_START);
+
+  for (i=EL_SP_START; i<=EL_SP_END; i++)
+  {
+    int nr_element = i - EL_SP_START;
+    int gfx_per_line = 8;
+    int nr_graphic =
+      (nr_element / gfx_per_line) * SP_PER_LINE +
+      (nr_element % gfx_per_line);
+
+    element_info[i].graphic = GFX_START_ROCKSSP + nr_graphic;
+  }
+
+  /* this overrides some of the above default settings (GFX_SP_ZONK etc.) */
+  i = 0;
+  while (element_to_graphic[i].element > -1)
+  {
+    int element = element_to_graphic[i].element;
+    int graphic = element_to_graphic[i].graphic;
+
+    element_info[element].graphic = graphic;
+    i++;
+  }
+}
+
+void InitGraphicInfo()
+{
+  int i;
+
+  /* always start with reliable default values */
+  for(i=0; i<MAX_GRAPHICS; i++)
+  {
+    graphic_info[i].bitmap = pix[PIX_SP];      /* graphic that ... */
+    graphic_info[i].src_x = 0;                 /* ... contains ... */
+    graphic_info[i].src_y = 0;                 /* ... empty space. */
+    graphic_info[i].anim_frames = 1;
+    graphic_info[i].anim_delay = 0;
+    graphic_info[i].anim_mode = ANIM_NORMAL;
+  }
+
+  for(i=0; i<MAX_GRAPHICS; i++)
+  {
+    int bitmap_nr;
+
+    getGraphicSource(i, &bitmap_nr,
+                    &graphic_info[i].src_x, &graphic_info[i].src_y);
+
+    graphic_info[i].bitmap = pix[bitmap_nr];
+  }
+}
+
 void InitElementProperties()
 {
-  int i,j;
+  int i, j;
 
   static int ep_amoebalive[] =
   {
index 2a0d656655036ea0cbab99364b0d171b9245674f..08d246b8a2c6504ec641585c96105abddb29044b 100644 (file)
@@ -353,7 +353,7 @@ struct SoundEffectInfo sound_effects[] =
 #endif
 };
 
-struct ElementInfo element_info[] =
+struct ElementInfo element_info[MAX_ELEMENTS] =
 {
   { "empty_space",             "empty space"                   },      /* 0 */
   { "sand",                    "sand"                          },
@@ -723,6 +723,8 @@ struct ElementInfo element_info[] =
   */
 };
 
+struct GraphicInfo graphic_info[MAX_GRAPHICS];
+
 
 /* ========================================================================= */
 /* main()                                                                    */
index 061fa15e566275d5cbf96201a14bee3eb0ca3644..8e37a2be4838ab9c05dc3d28c623a4ee9f4ec136 100644 (file)
 #define MAX_TAPELEN            (1000 * 50)     /* max. time * framerate */
 #define MAX_SCORE_ENTRIES      100
 #define MAX_ELEMENTS           700             /* 500 static + 200 runtime */
+#define MAX_GRAPHICS           1536            /* see below: NUM_TILES */
 #define MAX_NUM_AMOEBA         100
 
 /* values for elements with content */
@@ -340,8 +341,19 @@ struct GlobalInfo
 
 struct ElementInfo
 {
-  char *sound_class_name;
-  char *editor_description;
+  char *sound_class_name;      /* classification for custom sound effects */
+  char *editor_description;    /* short description for level editor */
+
+  int graphic;
+};
+
+struct GraphicInfo
+{
+  Bitmap *bitmap;
+  int src_x, src_y;
+  int anim_frames;
+  int anim_delay;
+  int anim_mode;
 };
 
 extern GC              tile_clip_gc;
@@ -402,6 +414,7 @@ extern struct TapeInfo              tape;
 extern struct GameInfo         game;
 extern struct GlobalInfo       global;
 extern struct ElementInfo      element_info[];
+extern struct GraphicInfo      graphic_info[];
 extern struct SoundEffectInfo  sound_effects[];
 
 /* often used screen positions */
@@ -900,7 +913,7 @@ extern struct SoundEffectInfo       sound_effects[];
 #define GFX_START_ROCKSMORE    1280
 #define GFX_END_ROCKSMORE      1535
 
-#define NUM_TILES              1536
+#define NUM_TILES              1536            /* see above: MAX_GRAPHICS */
 
 /* graphics from "RocksScreen" */
 /* Zeile 0 (0) */
index e5055eda6513d061b8f6eaab76c1922a3f4f6158..230f529995363fe10f8c762b7d9035b0333f7a0b 100644 (file)
@@ -2433,7 +2433,7 @@ int get_next_element(int element)
   }
 }
 
-int el2gfx(int element)
+int el2gfx_OLD(int element)
 {
   switch(element)
   {
@@ -2714,3 +2714,22 @@ int el2gfx(int element)
     }
   }
 }
+
+int el2gfx(int element)
+{
+  int graphic_OLD = el2gfx_OLD(element);
+  int graphic_NEW = element_info[element].graphic;
+
+  if (element >= MAX_ELEMENTS)
+  {
+    Error(ERR_WARN, "el2gfx: element == %d >= MAX_ELEMENTS", element);
+  }
+
+  if (graphic_NEW != graphic_OLD)
+  {
+    Error(ERR_WARN, "el2gfx: graphic_NEW (%d) != graphic_OLD (%d)",
+         graphic_NEW, graphic_OLD);
+  }
+
+  return graphic_NEW;
+}