/***********************************************************
-* 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-2002 Artsoft Entertainment *
+* Holger Schemel *
+* Detmolder Strasse 189 *
+* 33604 Bielefeld *
+* Germany *
+* e-mail: info@artsoft.org *
*----------------------------------------------------------*
-* editor.c *
+* editor.c *
***********************************************************/
#include <math.h>
+#include "libgame/libgame.h"
+
#include "editor.h"
#include "screens.h"
#include "tools.h"
-#include "misc.h"
-#include "buttons.h"
#include "files.h"
#include "game.h"
#include "tape.h"
#define GADGET_ID_DOUBLE_SPEED 73
#define GADGET_ID_GRAVITY 74
#define GADGET_ID_STICK_ELEMENT 75
+#define GADGET_ID_EM_SLIPPERY_GEMS 76
/* another drawing area for random placement */
-#define GADGET_ID_RANDOM_BACKGROUND 76
+#define GADGET_ID_RANDOM_BACKGROUND 77
/* gadgets for buttons in element list */
-#define GADGET_ID_ELEMENTLIST_FIRST 77
-#define GADGET_ID_ELEMENTLIST_LAST (77 + ED_NUM_ELEMENTLIST_BUTTONS - 1)
+#define GADGET_ID_ELEMENTLIST_FIRST 78
+#define GADGET_ID_ELEMENTLIST_LAST (78 + ED_NUM_ELEMENTLIST_BUTTONS - 1)
#define NUM_EDITOR_GADGETS (GADGET_ID_ELEMENTLIST_LAST + 1)
#define ED_CHECKBUTTON_ID_GRAVITY 1
#define ED_CHECKBUTTON_ID_RANDOM_RESTRICTED 2
#define ED_CHECKBUTTON_ID_STICK_ELEMENT 3
+#define ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS 4
-#define ED_NUM_CHECKBUTTONS 4
+#define ED_NUM_CHECKBUTTONS 5
#define ED_CHECKBUTTON_ID_LEVEL_FIRST ED_CHECKBUTTON_ID_DOUBLE_SPEED
#define ED_CHECKBUTTON_ID_LEVEL_LAST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
static int random_placement_value = 10;
static int random_placement_method = RANDOM_USE_QUANTITY;
-static int random_placement_background_element = EL_ERDREICH;
+static int random_placement_background_element = EL_SAND;
static boolean random_placement_background_restricted = FALSE;
static boolean stick_element_properties_window = FALSE;
GADGET_ID_STICK_ELEMENT,
&stick_element_properties_window,
"stick window to edit content", "stick window to edit content"
+ },
+ {
+ ED_SETTINGS_XPOS, ED_COUNTER_YPOS(4),
+ GADGET_ID_EM_SLIPPERY_GEMS,
+ &level.em_slippery_gems,
+ "slip down from certain flat walls","use EM style slipping behaviour"
}
};
#define IN_ED_FIELD(x,y) ((x)>=0 && (x)<ed_fieldx && (y)>=0 &&(y)<ed_fieldy)
/* drawing elements on the three mouse buttons */
-static int new_element1 = EL_MAUERWERK;
-static int new_element2 = EL_LEERRAUM;
-static int new_element3 = EL_ERDREICH;
+static int new_element1 = EL_WALL;
+static int new_element2 = EL_EMPTY;
+static int new_element3 = EL_SAND;
-#define BUTTON_ELEMENT(button) (button == 1 ? new_element1 : \
- button == 2 ? new_element2 : \
- button == 3 ? new_element3 : EL_LEERRAUM)
-#define BUTTON_STEPSIZE(button) (button == 1 ? 1 : button == 2 ? 5 : 10)
+#define BUTTON_ELEMENT(button) ((button) == 1 ? new_element1 : \
+ (button) == 2 ? new_element2 : \
+ (button) == 3 ? new_element3 : EL_EMPTY)
+#define BUTTON_STEPSIZE(button) ((button) == 1 ? 1 : (button) == 2 ? 5 : 10)
/* forward declaration for internal use */
static void ModifyEditorCounter(int, int);
int element_shift = 0;
-int editor_element[] =
+int editor_el_boulderdash[] =
{
EL_CHAR('B'),
EL_CHAR('O'),
EL_CHAR('S'),
EL_CHAR('H'),
- EL_SPIELFIGUR,
- EL_LEERRAUM,
- EL_ERDREICH,
- EL_BETON,
-
- EL_FELSBODEN,
- EL_SIEB2_INAKTIV,
- EL_AUSGANG_ZU,
- EL_AUSGANG_AUF,
-
- EL_EDELSTEIN_BD,
- EL_BUTTERFLY_UP,
- EL_FIREFLY_UP,
- EL_FELSBROCKEN,
-
- EL_BUTTERFLY_LEFT,
- EL_FIREFLY_LEFT,
- EL_BUTTERFLY_RIGHT,
- EL_FIREFLY_RIGHT,
-
- EL_AMOEBE_BD,
- EL_BUTTERFLY_DOWN,
- EL_FIREFLY_DOWN,
- EL_LEERRAUM,
+ EL_PLAYER1,
+ EL_EMPTY,
+ EL_SAND,
+ EL_STEELWALL,
+
+ EL_BD_WALL,
+ EL_BD_MAGIC_WALL,
+ EL_EXIT_CLOSED,
+ EL_EXIT_OPEN,
+
+ EL_BD_DIAMOND,
+ EL_BD_BUTTERFLY_UP,
+ EL_BD_FIREFLY_UP,
+ EL_BD_ROCK,
+
+ EL_BD_BUTTERFLY_LEFT,
+ EL_BD_FIREFLY_LEFT,
+ EL_BD_BUTTERFLY_RIGHT,
+ EL_BD_FIREFLY_RIGHT,
+
+ EL_BD_AMOEBA,
+ EL_BD_BUTTERFLY_DOWN,
+ EL_BD_FIREFLY_DOWN,
+ EL_EMPTY,
+};
+int num_editor_el_boulderdash = SIZEOF_ARRAY_INT(editor_el_boulderdash);
+int editor_el_emerald_mine[] =
+{
EL_CHAR('E'),
EL_CHAR('M'),
EL_CHAR('E'),
EL_CHAR('N'),
EL_CHAR('E'),
- EL_SPIELER1,
- EL_SPIELER2,
- EL_SPIELER3,
- EL_SPIELER4,
+ EL_PLAYER1,
+ EL_PLAYER2,
+ EL_PLAYER3,
+ EL_PLAYER4,
- EL_SPIELFIGUR,
- EL_LEERRAUM,
- EL_ERDREICH,
- EL_FELSBROCKEN,
+ EL_PLAYER1,
+ EL_EMPTY,
+ EL_SAND,
+ EL_ROCK,
- EL_BETON,
- EL_MAUERWERK,
- EL_FELSBODEN,
- EL_SIEB_INAKTIV,
+ EL_STEELWALL,
+ EL_WALL,
+ EL_WALL_CRUMBLED,
+ EL_MAGIC_WALL,
- EL_EDELSTEIN,
- EL_DIAMANT,
- EL_KOKOSNUSS,
- EL_BOMBE,
+ EL_EMERALD,
+ EL_DIAMOND,
+ EL_NUT,
+ EL_BOMB,
- EL_ERZ_EDEL,
- EL_ERZ_DIAM,
- EL_MORAST_LEER,
- EL_MORAST_VOLL,
+ EL_WALL_EMERALD,
+ EL_WALL_DIAMOND,
+ EL_QUICKSAND_EMPTY,
+ EL_QUICKSAND_FULL,
- EL_DYNAMITE_INACTIVE,
+ EL_DYNAMITE,
EL_DYNAMITE_ACTIVE,
- EL_AUSGANG_ZU,
- EL_AUSGANG_AUF,
+ EL_EXIT_CLOSED,
+ EL_EXIT_OPEN,
- EL_MAMPFER,
- EL_KAEFER_UP,
- EL_FLIEGER_UP,
+ EL_YAMYAM,
+ EL_BUG_UP,
+ EL_SPACESHIP_UP,
EL_ROBOT,
- EL_KAEFER_LEFT,
- EL_FLIEGER_LEFT,
- EL_KAEFER_RIGHT,
- EL_FLIEGER_RIGHT,
-
- EL_ABLENK_AUS,
- EL_KAEFER_DOWN,
- EL_FLIEGER_DOWN,
- EL_UNSICHTBAR,
-
- EL_BADEWANNE1,
- EL_SALZSAEURE,
- EL_BADEWANNE2,
- EL_LEERRAUM,
-
- EL_BADEWANNE3,
- EL_BADEWANNE4,
- EL_BADEWANNE5,
- EL_LEERRAUM,
-
- EL_TROPFEN,
- EL_AMOEBE_TOT,
- EL_AMOEBE_NASS,
- EL_AMOEBE_NORM,
-
- EL_EM_KEY_1_FILE,
- EL_EM_KEY_2_FILE,
- EL_EM_KEY_3_FILE,
- EL_EM_KEY_4_FILE,
-
- EL_EM_GATE_1,
- EL_EM_GATE_2,
- EL_EM_GATE_3,
- EL_EM_GATE_4,
-
- EL_EM_GATE_1X,
- EL_EM_GATE_2X,
- EL_EM_GATE_3X,
- EL_EM_GATE_4X,
+ EL_BUG_LEFT,
+ EL_SPACESHIP_LEFT,
+ EL_BUG_RIGHT,
+ EL_SPACESHIP_RIGHT,
+
+ EL_ROBOT_WHEEL,
+ EL_BUG_DOWN,
+ EL_SPACESHIP_DOWN,
+ EL_INVISIBLE_WALL,
+
+ EL_ACIDPOOL_TOPLEFT,
+ EL_ACID,
+ EL_ACIDPOOL_TOPRIGHT,
+ EL_EMPTY,
+
+ EL_ACIDPOOL_BOTTOMLEFT,
+ EL_ACIDPOOL_BOTTOM,
+ EL_ACIDPOOL_BOTTOMRIGHT,
+ EL_EMPTY,
+
+ EL_AMOEBA_DROP,
+ EL_AMOEBA_DEAD,
+ EL_AMOEBA_WET,
+ EL_AMOEBA_DRY,
+
+ EL_EM_KEY1_FILE,
+ EL_EM_KEY2_FILE,
+ EL_EM_KEY3_FILE,
+ EL_EM_KEY4_FILE,
+
+ EL_EM_GATE1,
+ EL_EM_GATE2,
+ EL_EM_GATE3,
+ EL_EM_GATE4,
+
+ EL_EM_GATE1_GRAY,
+ EL_EM_GATE2_GRAY,
+ EL_EM_GATE3_GRAY,
+ EL_EM_GATE4_GRAY,
+};
+int num_editor_el_emerald_mine = SIZEOF_ARRAY_INT(editor_el_emerald_mine);
+int editor_el_more[] =
+{
EL_CHAR('M'),
EL_CHAR('O'),
EL_CHAR('R'),
EL_CHAR('E'),
- EL_SCHLUESSEL1,
- EL_SCHLUESSEL2,
- EL_SCHLUESSEL3,
- EL_SCHLUESSEL4,
-
- EL_PFORTE1,
- EL_PFORTE2,
- EL_PFORTE3,
- EL_PFORTE4,
-
- EL_PFORTE1X,
- EL_PFORTE2X,
- EL_PFORTE3X,
- EL_PFORTE4X,
-
- EL_PFEIL_LEFT,
- EL_PFEIL_RIGHT,
- EL_PFEIL_UP,
- EL_PFEIL_DOWN,
-
- EL_AMOEBE_VOLL,
- EL_EDELSTEIN_GELB,
- EL_EDELSTEIN_ROT,
- EL_EDELSTEIN_LILA,
-
- EL_ERZ_EDEL_BD,
- EL_ERZ_EDEL_GELB,
- EL_ERZ_EDEL_ROT,
- EL_ERZ_EDEL_LILA,
-
- EL_LIFE,
+ EL_KEY1,
+ EL_KEY2,
+ EL_KEY3,
+ EL_KEY4,
+
+ EL_GATE1,
+ EL_GATE2,
+ EL_GATE3,
+ EL_GATE4,
+
+ EL_GATE1_GRAY,
+ EL_GATE2_GRAY,
+ EL_GATE3_GRAY,
+ EL_GATE4_GRAY,
+
+ EL_ARROW_BLUE_LEFT,
+ EL_ARROW_BLUE_RIGHT,
+ EL_ARROW_BLUE_UP,
+ EL_ARROW_BLUE_DOWN,
+
+ EL_AMOEBA_FULL,
+ EL_EMERALD_YELLOW,
+ EL_EMERALD_RED,
+ EL_EMERALD_PURPLE,
+
+ EL_WALL_BD_DIAMOND,
+ EL_WALL_EMERALD_YELLOW,
+ EL_WALL_EMERALD_RED,
+ EL_WALL_EMERALD_PURPLE,
+
+ EL_GAMEOFLIFE,
EL_PACMAN_UP,
- EL_ZEIT_VOLL,
- EL_ZEIT_LEER,
+ EL_TIME_ORB_FULL,
+ EL_TIME_ORB_EMPTY,
EL_PACMAN_LEFT,
- EL_MAMPFER2,
+ EL_DARK_YAMYAM,
EL_PACMAN_RIGHT,
- EL_MAUER_LEBT,
+ EL_WALL_GROWING,
- EL_LIFE_ASYNC,
+ EL_BIOMAZE,
EL_PACMAN_DOWN,
- EL_BIRNE_AUS,
- EL_BIRNE_EIN,
+ EL_LAMP,
+ EL_LAMP_ACTIVE,
EL_DYNABOMB_NR,
EL_DYNABOMB_SZ,
EL_DYNABOMB_XL,
- EL_BADEWANNE,
+ EL_STONEBLOCK,
EL_MOLE,
- EL_PINGUIN,
- EL_SCHWEIN,
- EL_DRACHE,
+ EL_PENGUIN,
+ EL_PIG,
+ EL_DRAGON,
- EL_LEERRAUM,
+ EL_EMPTY,
EL_MOLE_UP,
- EL_LEERRAUM,
- EL_LEERRAUM,
+ EL_EMPTY,
+ EL_EMPTY,
EL_MOLE_LEFT,
- EL_LEERRAUM,
+ EL_EMPTY,
EL_MOLE_RIGHT,
- EL_LEERRAUM,
+ EL_EMPTY,
- EL_LEERRAUM,
+ EL_EMPTY,
EL_MOLE_DOWN,
- EL_LEERRAUM,
- EL_LEERRAUM,
+ EL_BALLOON,
+ EL_BALLOON_SEND_ANY_DIRECTION,
+
+ EL_BALLOON_SEND_LEFT,
+ EL_BALLOON_SEND_RIGHT,
+ EL_BALLOON_SEND_UP,
+ EL_BALLOON_SEND_DOWN,
- EL_SONDE,
- EL_MAUER_X,
- EL_MAUER_Y,
- EL_MAUER_XY,
+ EL_SATELLITE,
+ EL_WALL_GROWING_X,
+ EL_WALL_GROWING_Y,
+ EL_WALL_GROWING_XY,
- EL_INVISIBLE_STEEL,
- EL_UNSICHTBAR,
+ EL_INVISIBLE_STEELWALL,
+ EL_INVISIBLE_WALL,
EL_SPEED_PILL,
EL_BLACK_ORB,
+ EL_EMC_STEELWALL1,
+ EL_EMC_WALL_PILLAR_UPPER,
+ EL_EMC_WALL_PILLAR_MIDDLE,
+ EL_EMC_WALL_PILLAR_LOWER,
+
+ EL_EMC_WALL4,
+ EL_EMC_WALL5,
+ EL_EMC_WALL6,
+ EL_EMC_WALL7,
+};
+int num_editor_el_more = SIZEOF_ARRAY_INT(editor_el_more);
+
+int editor_el_sokoban[] =
+{
EL_CHAR('S'),
EL_CHAR('O'),
EL_CHAR('K'),
EL_CHAR('A'),
EL_CHAR('N'),
- EL_SOKOBAN_OBJEKT,
- EL_SOKOBAN_FELD_LEER,
- EL_SOKOBAN_FELD_VOLL,
- EL_BETON,
+ EL_SOKOBAN_OBJECT,
+ EL_SOKOBAN_FIELD_EMPTY,
+ EL_SOKOBAN_FIELD_FULL,
+ EL_STEELWALL,
+};
+int num_editor_el_sokoban = SIZEOF_ARRAY_INT(editor_el_sokoban);
+int editor_el_supaplex[] =
+{
EL_CHAR('S'),
EL_CHAR('U'),
EL_CHAR('P'),
EL_SP_INFOTRON,
EL_SP_CHIP_SINGLE,
EL_SP_HARD_GRAY,
- EL_SP_EXIT,
+ EL_SP_EXIT_CLOSED,
EL_SP_DISK_ORANGE,
EL_SP_PORT1_RIGHT,
EL_SP_PORT_XY,
EL_SP_ELECTRON,
- EL_SP_BUG,
+ EL_SP_BUGGY_BASE,
EL_SP_CHIP_LEFT,
EL_SP_CHIP_RIGHT,
EL_SP_HARD_BASE6,
EL_SP_CHIP_UPPER,
EL_SP_CHIP_LOWER,
+};
+int num_editor_el_supaplex = SIZEOF_ARRAY_INT(editor_el_supaplex);
+int editor_el_diamond_caves[] =
+{
EL_CHAR('D'),
EL_CHAR('I'),
EL_CHAR('A'),
EL_CHAR('I'),
EL_CHAR('I'),
- EL_BELT1_LEFT,
- EL_BELT1_MIDDLE,
- EL_BELT1_RIGHT,
- EL_BELT1_SWITCH_MIDDLE,
-
- EL_BELT2_LEFT,
- EL_BELT2_MIDDLE,
- EL_BELT2_RIGHT,
- EL_BELT2_SWITCH_MIDDLE,
-
- EL_BELT3_LEFT,
- EL_BELT3_MIDDLE,
- EL_BELT3_RIGHT,
- EL_BELT3_SWITCH_MIDDLE,
-
- EL_BELT4_LEFT,
- EL_BELT4_MIDDLE,
- EL_BELT4_RIGHT,
- EL_BELT4_SWITCH_MIDDLE,
-
- EL_BELT1_SWITCH_LEFT,
- EL_BELT2_SWITCH_LEFT,
- EL_BELT3_SWITCH_LEFT,
- EL_BELT4_SWITCH_LEFT,
-
- EL_BELT1_SWITCH_RIGHT,
- EL_BELT2_SWITCH_RIGHT,
- EL_BELT3_SWITCH_RIGHT,
- EL_BELT4_SWITCH_RIGHT,
+ EL_PEARL,
+ EL_CRYSTAL,
+ EL_WALL_PEARL,
+ EL_WALL_CRYSTAL,
+
+ EL_CONVEYOR_BELT1_LEFT,
+ EL_CONVEYOR_BELT1_MIDDLE,
+ EL_CONVEYOR_BELT1_RIGHT,
+ EL_CONVEYOR_BELT1_SWITCH_MIDDLE,
+
+ EL_CONVEYOR_BELT2_LEFT,
+ EL_CONVEYOR_BELT2_MIDDLE,
+ EL_CONVEYOR_BELT2_RIGHT,
+ EL_CONVEYOR_BELT2_SWITCH_MIDDLE,
+
+ EL_CONVEYOR_BELT3_LEFT,
+ EL_CONVEYOR_BELT3_MIDDLE,
+ EL_CONVEYOR_BELT3_RIGHT,
+ EL_CONVEYOR_BELT3_SWITCH_MIDDLE,
+
+ EL_CONVEYOR_BELT4_LEFT,
+ EL_CONVEYOR_BELT4_MIDDLE,
+ EL_CONVEYOR_BELT4_RIGHT,
+ EL_CONVEYOR_BELT4_SWITCH_MIDDLE,
+
+ EL_CONVEYOR_BELT1_SWITCH_LEFT,
+ EL_CONVEYOR_BELT2_SWITCH_LEFT,
+ EL_CONVEYOR_BELT3_SWITCH_LEFT,
+ EL_CONVEYOR_BELT4_SWITCH_LEFT,
+
+ EL_CONVEYOR_BELT1_SWITCH_RIGHT,
+ EL_CONVEYOR_BELT2_SWITCH_RIGHT,
+ EL_CONVEYOR_BELT3_SWITCH_RIGHT,
+ EL_CONVEYOR_BELT4_SWITCH_RIGHT,
EL_SWITCHGATE_OPEN,
EL_SWITCHGATE_CLOSED,
- EL_SWITCHGATE_SWITCH_1,
+ EL_SWITCHGATE_SWITCH_UP,
EL_ENVELOPE,
EL_TIMEGATE_CLOSED,
EL_TIMEGATE_OPEN,
- EL_TIMEGATE_SWITCH_OFF,
- EL_LEERRAUM,
+ EL_TIMEGATE_SWITCH,
+ EL_EMPTY,
EL_LANDMINE,
- EL_SAND_INVISIBLE,
- EL_STEEL_SLANTED,
- EL_LEERRAUM,
+ EL_INVISIBLE_SAND,
+ EL_STEELWALL_SLANTED,
+ EL_EMPTY,
EL_SIGN_EXCLAMATION,
EL_SIGN_STOP,
- EL_LIGHT_SWITCH_OFF,
- EL_LIGHT_SWITCH_ON,
+ EL_LIGHT_SWITCH,
+ EL_LIGHT_SWITCH_ACTIVE,
- EL_SHIELD_PASSIVE,
- EL_SHIELD_ACTIVE,
+ EL_SHIELD_NORMAL,
+ EL_SHIELD_DEADLY,
EL_EXTRA_TIME,
- EL_LEERRAUM,
+ EL_EMPTY,
+};
+int num_editor_el_diamond_caves = SIZEOF_ARRAY_INT(editor_el_diamond_caves);
- /*
+int editor_el_dx_boulderdash[] =
+{
EL_CHAR('D'),
- EL_CHAR('Y'),
- EL_CHAR('N'),
- EL_CHAR('A'),
+ EL_CHAR('X'),
+ EL_CHAR('-'),
+ EL_CHAR(' '),
EL_CHAR('B'),
+ EL_CHAR('O'),
+ EL_CHAR('U'),
EL_CHAR('L'),
+
+ EL_CHAR('-'),
+ EL_CHAR('D'),
+ EL_CHAR('E'),
+ EL_CHAR('R'),
+
+ EL_CHAR('D'),
EL_CHAR('A'),
EL_CHAR('S'),
+ EL_CHAR('H'),
- EL_CHAR_MINUS,
+ EL_SPRING,
+ EL_TUBE_RIGHT_DOWN,
+ EL_TUBE_HORIZONTAL_DOWN,
+ EL_TUBE_LEFT_DOWN,
+
+ EL_TUBE_HORIZONTAL,
+ EL_TUBE_VERTICAL_RIGHT,
+ EL_TUBE_ALL,
+ EL_TUBE_VERTICAL_LEFT,
+
+ EL_TUBE_VERTICAL,
+ EL_TUBE_RIGHT_UP,
+ EL_TUBE_HORIZONTAL_UP,
+ EL_TUBE_LEFT_UP,
+
+ EL_TRAP,
+ EL_DX_SUPABOMB,
+ EL_EMPTY,
+ EL_EMPTY
+};
+int num_editor_el_dx_boulderdash = SIZEOF_ARRAY_INT(editor_el_dx_boulderdash);
+
+int editor_el_chars[] =
+{
EL_CHAR('T'),
EL_CHAR('E'),
- EL_CHAR('R'),
- */
-
- EL_LEERRAUM,
- EL_LEERRAUM,
- EL_LEERRAUM,
- EL_LEERRAUM,
+ EL_CHAR('X'),
+ EL_CHAR('T'),
EL_CHAR(' '),
EL_CHAR('!'),
EL_CHAR('Ö'),
EL_CHAR('Ü'),
EL_CHAR('^'),
- EL_CHAR(' ')
+ EL_CHAR('_'),
+
+ EL_CHAR(' '),
+ EL_CHAR('°'),
+ EL_CHAR('´'),
+ EL_CHAR('|')
+};
+int num_editor_el_chars = SIZEOF_ARRAY_INT(editor_el_chars);
+
+int editor_el_custom[] =
+{
+ EL_CHAR('C'),
+ EL_CHAR('U'),
+ EL_CHAR('S'),
+ EL_CHAR('-'),
+
+ EL_CHAR('T'),
+ EL_CHAR('O'),
+ EL_CHAR('M'),
+ EL_CHAR(' '),
+
+ EL_CHAR('E'),
+ EL_CHAR('L'),
+ EL_CHAR('E'),
+ EL_CHAR('M'),
+
+ EL_CHAR('E'),
+ EL_CHAR('N'),
+ EL_CHAR('T'),
+ EL_CHAR('S'),
+
+ EL_CUSTOM_START + 0,
+ EL_CUSTOM_START + 1,
+ EL_CUSTOM_START + 2,
+ EL_CUSTOM_START + 3,
+
+ EL_CUSTOM_START + 4,
+ EL_CUSTOM_START + 5,
+ EL_CUSTOM_START + 6,
+ EL_CUSTOM_START + 7,
+
+ EL_CUSTOM_START + 8,
+ EL_CUSTOM_START + 9,
+ EL_CUSTOM_START + 10,
+ EL_CUSTOM_START + 11,
+
+ EL_CUSTOM_START + 12,
+ EL_CUSTOM_START + 13,
+ EL_CUSTOM_START + 14,
+ EL_CUSTOM_START + 15,
+
+ EL_CUSTOM_START + 16,
+ EL_CUSTOM_START + 17,
+ EL_CUSTOM_START + 18,
+ EL_CUSTOM_START + 19,
+
+ EL_CUSTOM_START + 20,
+ EL_CUSTOM_START + 21,
+ EL_CUSTOM_START + 22,
+ EL_CUSTOM_START + 23,
+
+ EL_CUSTOM_START + 24,
+ EL_CUSTOM_START + 25,
+ EL_CUSTOM_START + 26,
+ EL_CUSTOM_START + 27,
+
+ EL_CUSTOM_START + 28,
+ EL_CUSTOM_START + 29,
+ EL_CUSTOM_START + 30,
+ EL_CUSTOM_START + 31,
+
+ EL_CUSTOM_START + 32,
+ EL_CUSTOM_START + 33,
+ EL_CUSTOM_START + 34,
+ EL_CUSTOM_START + 35,
+
+ EL_CUSTOM_START + 36,
+ EL_CUSTOM_START + 37,
+ EL_CUSTOM_START + 38,
+ EL_CUSTOM_START + 39,
+
+ EL_CUSTOM_START + 40,
+ EL_CUSTOM_START + 41,
+ EL_CUSTOM_START + 42,
+ EL_CUSTOM_START + 43,
+
+ EL_CUSTOM_START + 44,
+ EL_CUSTOM_START + 45,
+ EL_CUSTOM_START + 46,
+ EL_CUSTOM_START + 47,
+
+ EL_CUSTOM_START + 48,
+ EL_CUSTOM_START + 49,
+ EL_CUSTOM_START + 50,
+ EL_CUSTOM_START + 51,
+
+ EL_CUSTOM_START + 52,
+ EL_CUSTOM_START + 53,
+ EL_CUSTOM_START + 54,
+ EL_CUSTOM_START + 55,
+
+ EL_CUSTOM_START + 56,
+ EL_CUSTOM_START + 57,
+ EL_CUSTOM_START + 58,
+ EL_CUSTOM_START + 59,
+
+ EL_CUSTOM_START + 60,
+ EL_CUSTOM_START + 61,
+ EL_CUSTOM_START + 62,
+ EL_CUSTOM_START + 63,
+
+ EL_CUSTOM_START + 64,
+ EL_CUSTOM_START + 65,
+ EL_CUSTOM_START + 66,
+ EL_CUSTOM_START + 67,
+
+ EL_CUSTOM_START + 68,
+ EL_CUSTOM_START + 69,
+ EL_CUSTOM_START + 70,
+ EL_CUSTOM_START + 71,
+
+ EL_CUSTOM_START + 72,
+ EL_CUSTOM_START + 73,
+ EL_CUSTOM_START + 74,
+ EL_CUSTOM_START + 75,
+
+ EL_CUSTOM_START + 76,
+ EL_CUSTOM_START + 77,
+ EL_CUSTOM_START + 78,
+ EL_CUSTOM_START + 79,
+
+ EL_CUSTOM_START + 80,
+ EL_CUSTOM_START + 81,
+ EL_CUSTOM_START + 82,
+ EL_CUSTOM_START + 83,
+
+ EL_CUSTOM_START + 84,
+ EL_CUSTOM_START + 85,
+ EL_CUSTOM_START + 86,
+ EL_CUSTOM_START + 87,
+
+ EL_CUSTOM_START + 88,
+ EL_CUSTOM_START + 89,
+ EL_CUSTOM_START + 90,
+ EL_CUSTOM_START + 91,
+
+ EL_CUSTOM_START + 92,
+ EL_CUSTOM_START + 93,
+ EL_CUSTOM_START + 94,
+ EL_CUSTOM_START + 95,
+
+ EL_CUSTOM_START + 96,
+ EL_CUSTOM_START + 97,
+ EL_CUSTOM_START + 98,
+ EL_CUSTOM_START + 99,
+
+ EL_CUSTOM_START + 100,
+ EL_CUSTOM_START + 101,
+ EL_CUSTOM_START + 102,
+ EL_CUSTOM_START + 103,
+
+ EL_CUSTOM_START + 104,
+ EL_CUSTOM_START + 105,
+ EL_CUSTOM_START + 106,
+ EL_CUSTOM_START + 107,
+
+ EL_CUSTOM_START + 108,
+ EL_CUSTOM_START + 109,
+ EL_CUSTOM_START + 110,
+ EL_CUSTOM_START + 111,
+
+ EL_CUSTOM_START + 112,
+ EL_CUSTOM_START + 113,
+ EL_CUSTOM_START + 114,
+ EL_CUSTOM_START + 115,
+
+ EL_CUSTOM_START + 116,
+ EL_CUSTOM_START + 117,
+ EL_CUSTOM_START + 118,
+ EL_CUSTOM_START + 119,
+
+ EL_CUSTOM_START + 120,
+ EL_CUSTOM_START + 121,
+ EL_CUSTOM_START + 122,
+ EL_CUSTOM_START + 123,
+
+ EL_CUSTOM_START + 124,
+ EL_CUSTOM_START + 125,
+ EL_CUSTOM_START + 126,
+ EL_CUSTOM_START + 127
};
-int elements_in_list = sizeof(editor_element)/sizeof(int);
+int num_editor_el_custom = SIZEOF_ARRAY_INT(editor_el_custom);
+
+int *editor_elements = NULL; /* dynamically allocated */
+int num_editor_elements = 0; /* dynamically determined */
+
+struct
+{
+ boolean *setup_value;
+ int *element_list;
+ int *element_list_size;
+
+ boolean last_setup_value;
+}
+editor_elements_info[] =
+{
+ { &setup.editor.el_boulderdash, editor_el_boulderdash,
+ &num_editor_el_boulderdash },
+ { &setup.editor.el_emerald_mine, editor_el_emerald_mine,
+ &num_editor_el_emerald_mine },
+ { &setup.editor.el_more, editor_el_more,
+ &num_editor_el_more },
+ { &setup.editor.el_sokoban, editor_el_sokoban,
+ &num_editor_el_sokoban },
+ { &setup.editor.el_supaplex, editor_el_supaplex,
+ &num_editor_el_supaplex },
+ { &setup.editor.el_diamond_caves, editor_el_diamond_caves,
+ &num_editor_el_diamond_caves },
+ { &setup.editor.el_dx_boulderdash, editor_el_dx_boulderdash,
+ &num_editor_el_dx_boulderdash },
+ { &setup.editor.el_chars, editor_el_chars,
+ &num_editor_el_chars },
+ { &setup.editor.el_custom, editor_el_custom,
+ &num_editor_el_custom },
+ { NULL, NULL,
+ NULL }
+};
+
+static void ReinitializeElementList()
+{
+ int pos = 0;
+ int i, j;
+
+ if (editor_elements != NULL)
+ free(editor_elements);
+
+ num_editor_elements = 0;
+
+ /* determine size of element list */
+ for (i=0; editor_elements_info[i].setup_value != NULL; i++)
+ if (*editor_elements_info[i].setup_value)
+ num_editor_elements += *editor_elements_info[i].element_list_size;
+
+ if (num_editor_elements < ED_NUM_ELEMENTLIST_BUTTONS)
+ {
+ /* workaround: offer at least as many elements as element buttons exist */
+ int list_nr = 1; /* see above: editor_elements_info for Emerald Mine */
+
+ *editor_elements_info[list_nr].setup_value = TRUE;
+ num_editor_elements += *editor_elements_info[list_nr].element_list_size;
+ }
+
+ editor_elements = checked_malloc(num_editor_elements * sizeof(int));
+
+ /* fill element list */
+ for (i=0; editor_elements_info[i].setup_value != NULL; i++)
+ if (*editor_elements_info[i].setup_value)
+ for (j=0; j<*editor_elements_info[i].element_list_size; j++)
+ editor_elements[pos++] = editor_elements_info[i].element_list[j];
+}
+
+static void ReinitializeElementListButtons()
+{
+ static boolean initialization_needed = TRUE;
+ int i;
+
+ if (!initialization_needed) /* check if editor element setup has changed */
+ for (i=0; editor_elements_info[i].setup_value != NULL; i++)
+ if (editor_elements_info[i].last_setup_value !=
+ *editor_elements_info[i].setup_value)
+ initialization_needed = TRUE;
+
+ if (!initialization_needed)
+ return;
+
+ FreeLevelEditorGadgets();
+ CreateLevelEditorGadgets();
+
+ /* store current setup values for next invocation of this function */
+ for (i=0; editor_elements_info[i].setup_value != NULL; i++)
+ editor_elements_info[i].last_setup_value =
+ *editor_elements_info[i].setup_value;
+
+ initialization_needed = FALSE;
+}
+
+static char *getElementInfoText(int element)
+{
+ char *info_text = "unknown";
+
+ if (element < NUM_FILE_ELEMENTS &&
+ element_info[element].editor_description != NULL)
+ info_text = element_info[element].editor_description;
+ else
+ Error(ERR_WARN, "no element description for element %d", element);
+
+ return info_text;
+}
static void ScrollMiniLevel(int from_x, int from_y, int scroll)
{
int dx = (scroll == ED_SCROLL_LEFT ? -1 : scroll == ED_SCROLL_RIGHT ? 1 : 0);
int dy = (scroll == ED_SCROLL_UP ? -1 : scroll == ED_SCROLL_DOWN ? 1 : 0);
- XCopyArea(display, drawto, drawto, gc,
- SX + (dx == -1 ? MINI_TILEX : 0),
- SY + (dy == -1 ? MINI_TILEY : 0),
- (ed_fieldx * MINI_TILEX) - (dx != 0 ? MINI_TILEX : 0),
- (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0),
- SX + (dx == +1 ? MINI_TILEX : 0),
- SY + (dy == +1 ? MINI_TILEY : 0));
+ BlitBitmap(drawto, drawto,
+ SX + (dx == -1 ? MINI_TILEX : 0),
+ SY + (dy == -1 ? MINI_TILEY : 0),
+ (ed_fieldx * MINI_TILEX) - (dx != 0 ? MINI_TILEX : 0),
+ (ed_fieldy * MINI_TILEY) - (dy != 0 ? MINI_TILEY : 0),
+ SX + (dx == +1 ? MINI_TILEX : 0),
+ SY + (dy == +1 ? MINI_TILEY : 0));
if (dx)
{
x = (dx == 1 ? 0 : ed_fieldx - 1);
static void CreateControlButtons()
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
struct GadgetInfo *gi;
unsigned long event_mask;
int i;
GDI_STATE, GD_BUTTON_UNPRESSED,
GDI_RADIO_NR, radio_button_nr,
GDI_CHECKED, checked,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y1,
- GDI_ALT_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y2,
- GDI_ALT_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y1,
+ GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y2,
+ GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
GDI_CALLBACK_ACTION, HandleControlButtons,
GDI_END);
GDI_HEIGHT, height,
GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
GDI_CALLBACK_ACTION, HandleControlButtons,
GDI_END);
/* create buttons for element list */
for (i=0; i<ED_NUM_ELEMENTLIST_BUTTONS; i++)
{
- Pixmap deco_pixmap;
+ Bitmap *deco_bitmap;
int deco_x, deco_y, deco_xpos, deco_ypos;
int gd_xoffset, gd_yoffset;
int gd_x1, gd_x2, gd_y;
int x = i % ED_ELEMENTLIST_BUTTONS_HORIZ;
int y = i / ED_ELEMENTLIST_BUTTONS_HORIZ;
int id = GADGET_ID_ELEMENTLIST_FIRST + i;
+ int element = editor_elements[i];
event_mask = GD_EVENT_RELEASED;
gd_x2 = DOOR_GFX_PAGEX6 + ED_ELEMENTLIST_XPOS;
gd_y = DOOR_GFX_PAGEY1 + ED_ELEMENTLIST_YPOS;
- getMiniGraphicSource(el2gfx(editor_element[i]),
- &deco_pixmap, &deco_x, &deco_y);
+ getMiniGraphicSource(el2img(element), &deco_bitmap, &deco_x, &deco_y);
deco_xpos = (ED_ELEMENTLIST_XSIZE - MINI_TILEX) / 2;
deco_ypos = (ED_ELEMENTLIST_YSIZE - MINI_TILEY) / 2;
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
- GDI_INFO_TEXT, element_info[editor_element[i]],
+ GDI_INFO_TEXT, getElementInfoText(element),
GDI_X, DX + gd_xoffset,
GDI_Y, DY + gd_yoffset,
GDI_WIDTH, ED_ELEMENTLIST_XSIZE,
GDI_HEIGHT, ED_ELEMENTLIST_YSIZE,
GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
- GDI_DECORATION_DESIGN, deco_pixmap, deco_x, deco_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
+ GDI_DECORATION_DESIGN, deco_bitmap, deco_x, deco_y,
GDI_DECORATION_POSITION, deco_xpos, deco_ypos,
GDI_DECORATION_SIZE, MINI_TILEX, MINI_TILEY,
GDI_DECORATION_SHIFTING, 1, 1,
GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
GDI_CALLBACK_ACTION, HandleControlButtons,
GDI_END);
for (j=0; j<2; j++)
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
struct GadgetInfo *gi;
int id = (j == 0 ?
counterbutton_info[i].gadget_id_down :
GDI_HEIGHT, y_size,
GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
GDI_CALLBACK_ACTION, HandleCounterButtons,
GDI_END);
GDI_NUMBER_MAX, counterbutton_info[i].max_value,
GDI_TEXT_SIZE, 3,
GDI_TEXT_FONT, font_type,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x, gd_y,
GDI_BORDER_SIZE, ED_BORDER_SIZE,
GDI_TEXTINPUT_DESIGN_WIDTH, gd_width,
GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
GDI_CALLBACK_ACTION, HandleCounterButtons,
GDI_END);
for (i=0; i<ED_NUM_TEXTINPUT; i++)
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
int gd_x, gd_y;
struct GadgetInfo *gi;
unsigned long event_mask;
GDI_TEXT_VALUE, textinput_info[i].value,
GDI_TEXT_SIZE, textinput_info[i].size,
GDI_TEXT_FONT, FC_YELLOW,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x, gd_y,
GDI_BORDER_SIZE, ED_BORDER_SIZE,
GDI_TEXTINPUT_DESIGN_WIDTH, ED_WIN_COUNT_XSIZE,
GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
GDI_CALLBACK_ACTION, HandleTextInputGadgets,
GDI_END);
for (i=0; i<ED_NUM_SCROLLBARS; i++)
{
int id = scrollbar_info[i].gadget_id;
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
int gd_x1, gd_x2, gd_y1, gd_y2;
struct GadgetInfo *gi;
int items_max, items_visible, item_position;
if (i == ED_SCROLLBAR_ID_LIST_VERTICAL)
{
- items_max = elements_in_list / ED_ELEMENTLIST_BUTTONS_HORIZ;
+ items_max = num_editor_elements / ED_ELEMENTLIST_BUTTONS_HORIZ;
items_visible = ED_ELEMENTLIST_BUTTONS_VERT;
item_position = 0;
}
GDI_SCROLLBAR_ITEMS_VISIBLE, items_visible,
GDI_SCROLLBAR_ITEM_POSITION, item_position,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y1,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y2,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
GDI_BORDER_SIZE, ED_BORDER_SIZE,
GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
GDI_CALLBACK_ACTION, HandleControlButtons,
GDI_END);
static void CreateCheckbuttonGadgets()
{
- Pixmap gd_pixmap = pix[PIX_DOOR];
+ Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
struct GadgetInfo *gi;
unsigned long event_mask;
int gd_x1, gd_x2, gd_x3, gd_x4, gd_y;
GDI_TYPE, GD_TYPE_RADIO_BUTTON,
GDI_RADIO_NR, radiobutton_info[i].radio_button_nr,
GDI_CHECKED, checked,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
- GDI_ALT_DESIGN_UNPRESSED, gd_pixmap, gd_x3, gd_y,
- GDI_ALT_DESIGN_PRESSED, gd_pixmap, gd_x4, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
+ GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x3, gd_y,
+ GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x4, gd_y,
GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
GDI_CALLBACK_ACTION, HandleRadiobuttons,
GDI_END);
GDI_HEIGHT, ED_CHECKBUTTON_YSIZE,
GDI_TYPE, GD_TYPE_CHECK_BUTTON,
GDI_CHECKED, *checkbutton_info[i].value,
- GDI_DESIGN_UNPRESSED, gd_pixmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_pixmap, gd_x2, gd_y,
- GDI_ALT_DESIGN_UNPRESSED, gd_pixmap, gd_x3, gd_y,
- GDI_ALT_DESIGN_PRESSED, gd_pixmap, gd_x4, gd_y,
+ GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
+ GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
+ GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x3, gd_y,
+ GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x4, gd_y,
GDI_EVENT_MASK, event_mask,
+ GDI_CALLBACK_INFO, HandleEditorGadgetInfoText,
GDI_CALLBACK_ACTION, HandleCheckbuttons,
GDI_END);
void CreateLevelEditorGadgets()
{
+ ReinitializeElementList();
+
CreateControlButtons();
CreateCounterButtons();
CreateDrawingAreas();
CreateCheckbuttonGadgets();
}
+void FreeLevelEditorGadgets()
+{
+ int i;
+
+ for (i=0; i<NUM_EDITOR_GADGETS; i++)
+ FreeGadget(level_editor_gadget[i]);
+}
+
static void MapCounterButtons(int id)
{
MapGadget(level_editor_gadget[counterbutton_info[id].gadget_id_down]);
/* map buttons to select level */
counter_id = ED_COUNTER_ID_SELECT_LEVEL;
ModifyEditorCounterLimits(counter_id,
- leveldir[leveldir_nr].first_level,
- leveldir[leveldir_nr].last_level);
+ leveldir_current->first_level,
+ leveldir_current->last_level);
ModifyEditorCounter(counter_id, *counterbutton_info[counter_id].value);
MapCounterButtons(counter_id);
}
for(y=0; y<lev_fieldy; y++)
for(x=0; x<lev_fieldx; x++)
- if (Feld[x][y] == EL_SPIELFIGUR ||
- Feld[x][y] == EL_SPIELER1 ||
+ if (Feld[x][y] == EL_PLAYER1 ||
Feld[x][y] == EL_SP_MURPHY)
player_found = TRUE;
}
/* copy default editor door content to main double buffer */
- XCopyArea(display, pix[PIX_DOOR], drawto, gc,
- DOOR_GFX_PAGEX6, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
+ BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
+ DOOR_GFX_PAGEX6, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
/* draw mouse button brush elements */
- DrawMiniGraphicExt(drawto, gc,
+ DrawMiniGraphicExt(drawto,
DX + ED_WIN_MB_LEFT_XPOS, DY + ED_WIN_MB_LEFT_YPOS,
- el2gfx(new_element1));
- DrawMiniGraphicExt(drawto, gc,
+ el2img(new_element1));
+ DrawMiniGraphicExt(drawto,
DX + ED_WIN_MB_MIDDLE_XPOS, DY + ED_WIN_MB_MIDDLE_YPOS,
- el2gfx(new_element2));
- DrawMiniGraphicExt(drawto, gc,
+ el2img(new_element2));
+ DrawMiniGraphicExt(drawto,
DX + ED_WIN_MB_RIGHT_XPOS, DY + ED_WIN_MB_RIGHT_YPOS,
- el2gfx(new_element3));
+ el2img(new_element3));
/* draw bigger door */
DrawSpecialEditorDoor();
/* draw new control window */
- XCopyArea(display, pix[PIX_DOOR], drawto, gc,
- DOOR_GFX_PAGEX8, 236,
- EXSIZE, EYSIZE,
- EX, EY);
+ BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
+ DOOR_GFX_PAGEX8, 236, EXSIZE, EYSIZE, EX, EY);
redraw_mask |= REDRAW_ALL;
+ ReinitializeElementListButtons(); /* only needed after setup changes */
+
+ UnmapTapeButtons();
MapControlButtons();
/* copy actual editor door content to door double buffer for OpenDoor() */
- XCopyArea(display, drawto, pix[PIX_DB_DOOR], gc,
- DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ BlitBitmap(drawto, bitmap_db_door,
+ DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
DrawEditModeWindow();
if (button == 1)
{
new_element1 = element;
- DrawMiniGraphicExt(drawto, gc,
+ DrawMiniGraphicExt(drawto,
DX + ED_WIN_MB_LEFT_XPOS, DY + ED_WIN_MB_LEFT_YPOS,
- el2gfx(new_element1));
+ el2img(new_element1));
}
else if (button == 2)
{
new_element2 = element;
- DrawMiniGraphicExt(drawto, gc,
+ DrawMiniGraphicExt(drawto,
DX + ED_WIN_MB_MIDDLE_XPOS, DY + ED_WIN_MB_MIDDLE_YPOS,
- el2gfx(new_element2));
+ el2img(new_element2));
}
else
{
new_element3 = element;
- DrawMiniGraphicExt(drawto, gc,
+ DrawMiniGraphicExt(drawto,
DX + ED_WIN_MB_RIGHT_XPOS, DY + ED_WIN_MB_RIGHT_YPOS,
- el2gfx(new_element3));
+ el2img(new_element3));
}
redraw_mask |= REDRAW_DOOR_1;
static void DrawDrawingWindow()
{
ClearWindow();
+
+#if 1
+ ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
+ redraw_mask |= REDRAW_FROM_BACKBUFFER;
+#endif
+
UnmapLevelEditorWindowGadgets();
AdjustDrawingAreaGadgets();
AdjustLevelScrollPosition();
/* draw decorative border for the object */
for (y=0; y<2; y++)
for (x=0; x<2; x++)
- DrawMiniElement(area_x + x, area_y + y, EL_ERDREICH);
+ DrawMiniElement(area_x + x, area_y + y, EL_SAND);
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
area_sx + MINI_TILEX/2 - 1, area_sy + MINI_TILEY/2 - 1,
MINI_TILEX + 2, MINI_TILEY + 2);
/* copy border to the right location */
- XCopyArea(display, drawto, drawto, gc,
- area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
- area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
+ area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
DrawMiniElement(area_x, area_y, ElementContent[0][0][0]);
/* draw decorative border for the object */
for (y=0; y<2; y++)
for (x=0; x<2; x++)
- DrawMiniElement(area_x + x, area_y + y, EL_ERDREICH);
+ DrawMiniElement(area_x + x, area_y + y, EL_SAND);
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
area_sx + MINI_TILEX/2 - 1, area_sy + MINI_TILEY/2 - 1,
MINI_TILEX + 2, MINI_TILEY + 2);
/* copy border to the right location */
- XCopyArea(display, drawto, drawto, gc,
- area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
- area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
+ area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
DrawText(area_sx + TILEX, area_sy + 1, "Content of amoeba",
FS_SMALL, font_color);
MapCounterButtons(counter_id);
/* delete content areas in case of reducing number of them */
- XFillRectangle(display, backbuffer, gc,
+ ClearRectangle(backbuffer,
SX, area_sy - MINI_TILEX,
SXSIZE, 12 * MINI_TILEY);
for (y=0; y<4; y++)
for (x=0; x<4; x++)
DrawMiniElement(area_x + 5 * (i % 4) + x, area_y + 6 * (i / 4) + y,
- EL_ERDREICH);
+ EL_SAND);
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
area_sx + 5 * (i % 4) * MINI_TILEX + MINI_TILEX/2 - 1,
area_sy + 6 * (i / 4) * MINI_TILEY + MINI_TILEY/2 - 1,
3 * MINI_TILEX + 2, 3 * MINI_TILEY + 2);
}
/* copy border to the right location */
- XCopyArea(display, drawto, drawto, gc,
- area_sx, area_sy, (5 * 4 + 1) * MINI_TILEX, 11 * MINI_TILEY,
- area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ area_sx, area_sy, (5 * 4 + 1) * MINI_TILEX, 11 * MINI_TILEY,
+ area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
DrawText(area_sx + (5 * 4 - 1) * MINI_TILEX, area_sy + 0 * MINI_TILEY + 1,
"Content", FS_SMALL, font_color);
MapDrawingArea(GADGET_ID_ELEM_CONTENT_0 + i);
}
+#if 0
+static void DrawPropertiesElement(int xstart, int ystart, int element)
+{
+ int x, y;
+
+ /* draw some decorative border for the object */
+ for (y=0; y<3; y++)
+ for (x=0; x<3; x++)
+ DrawMiniElement(xstart + x , ystart + y, EL_SAND);
+
+ ClearRectangle(drawto,
+ SX + xstart * MINI_TILEX + MINI_TILEX/2 - 1,
+ SY + ystart * MINI_TILEY + MINI_TILEY/2 - 1,
+ TILEX + 2, TILEY + 2);
+
+ /* copy border to the right location */
+ BlitBitmap(drawto, drawto,
+ SX + xstart * MINI_TILEX,
+ SY + ystart * MINI_TILEY,
+ 2 * TILEX, 2 * TILEY,
+ SX + xstart * MINI_TILEX - MINI_TILEX/2,
+ SY + ystart * MINI_TILEY - MINI_TILEY/2);
+
+ DrawGraphicAnimation(xstart / 2, ystart / 2, el2img(element));
+
+ /* copy the whole stuff to the definitive location */
+ BlitBitmap(drawto, drawto,
+ SX + xstart * MINI_TILEX - MINI_TILEX/2,
+ SY + ystart * MINI_TILEY - MINI_TILEY,
+ 2 * TILEX, 2 * TILEY,
+ SX + xstart * MINI_TILEX - MINI_TILEX/2,
+ SY + ystart * MINI_TILEY - MINI_TILEY/2);
+
+ FrameCounter++; /* increase animation frame counter */
+}
+#endif
+
#define TEXT_COLLECTING "Score for collecting"
#define TEXT_SMASHING "Score for smashing"
#define TEXT_CRACKING "Score for cracking"
char *text;
} elements_with_counter[] =
{
- { EL_EDELSTEIN, &level.score[SC_EDELSTEIN], TEXT_COLLECTING },
- { EL_EDELSTEIN_BD, &level.score[SC_EDELSTEIN], TEXT_COLLECTING },
- { EL_EDELSTEIN_GELB,&level.score[SC_EDELSTEIN], TEXT_COLLECTING },
- { EL_EDELSTEIN_ROT, &level.score[SC_EDELSTEIN], TEXT_COLLECTING },
- { EL_EDELSTEIN_LILA,&level.score[SC_EDELSTEIN], TEXT_COLLECTING },
- { EL_DIAMANT, &level.score[SC_DIAMANT], TEXT_COLLECTING },
- { EL_KAEFER_RIGHT, &level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_KAEFER_UP, &level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_KAEFER_LEFT, &level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_KAEFER_DOWN, &level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_BUTTERFLY_RIGHT,&level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_BUTTERFLY_UP, &level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_BUTTERFLY_LEFT,&level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_BUTTERFLY_DOWN,&level.score[SC_KAEFER], TEXT_SMASHING },
- { EL_FLIEGER_RIGHT, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_FLIEGER_UP, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_FLIEGER_LEFT, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_FLIEGER_DOWN, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_FIREFLY_RIGHT, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_FIREFLY_UP, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_FIREFLY_LEFT, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_FIREFLY_DOWN, &level.score[SC_FLIEGER], TEXT_SMASHING },
- { EL_MAMPFER, &level.score[SC_MAMPFER], TEXT_SMASHING },
- { EL_MAMPFER2, &level.score[SC_MAMPFER], TEXT_SMASHING },
+ { EL_EMERALD, &level.score[SC_EDELSTEIN], TEXT_COLLECTING },
+ { EL_BD_DIAMOND, &level.score[SC_EDELSTEIN], TEXT_COLLECTING },
+ { EL_EMERALD_YELLOW,&level.score[SC_EDELSTEIN], TEXT_COLLECTING },
+ { EL_EMERALD_RED, &level.score[SC_EDELSTEIN], TEXT_COLLECTING },
+ { EL_EMERALD_PURPLE,&level.score[SC_EDELSTEIN], TEXT_COLLECTING },
+ { EL_DIAMOND, &level.score[SC_DIAMANT], TEXT_COLLECTING },
+ { EL_BUG_RIGHT, &level.score[SC_KAEFER], TEXT_SMASHING },
+ { EL_BUG_UP, &level.score[SC_KAEFER], TEXT_SMASHING },
+ { EL_BUG_LEFT, &level.score[SC_KAEFER], TEXT_SMASHING },
+ { EL_BUG_DOWN, &level.score[SC_KAEFER], TEXT_SMASHING },
+ { EL_BD_BUTTERFLY_RIGHT,&level.score[SC_KAEFER], TEXT_SMASHING },
+ { EL_BD_BUTTERFLY_UP, &level.score[SC_KAEFER], TEXT_SMASHING },
+ { EL_BD_BUTTERFLY_LEFT, &level.score[SC_KAEFER], TEXT_SMASHING },
+ { EL_BD_BUTTERFLY_DOWN, &level.score[SC_KAEFER], TEXT_SMASHING },
+ { EL_SPACESHIP_RIGHT,&level.score[SC_FLIEGER], TEXT_SMASHING },
+ { EL_SPACESHIP_UP, &level.score[SC_FLIEGER], TEXT_SMASHING },
+ { EL_SPACESHIP_LEFT, &level.score[SC_FLIEGER], TEXT_SMASHING },
+ { EL_SPACESHIP_DOWN, &level.score[SC_FLIEGER], TEXT_SMASHING },
+ { EL_BD_FIREFLY_RIGHT,&level.score[SC_FLIEGER], TEXT_SMASHING },
+ { EL_BD_FIREFLY_UP, &level.score[SC_FLIEGER], TEXT_SMASHING },
+ { EL_BD_FIREFLY_LEFT, &level.score[SC_FLIEGER], TEXT_SMASHING },
+ { EL_BD_FIREFLY_DOWN, &level.score[SC_FLIEGER], TEXT_SMASHING },
+ { EL_YAMYAM, &level.score[SC_MAMPFER], TEXT_SMASHING },
+ { EL_DARK_YAMYAM, &level.score[SC_MAMPFER], TEXT_SMASHING },
{ EL_ROBOT, &level.score[SC_ROBOT], TEXT_SMASHING },
{ EL_PACMAN_RIGHT, &level.score[SC_PACMAN], TEXT_SMASHING },
{ EL_PACMAN_UP, &level.score[SC_PACMAN], TEXT_SMASHING },
{ EL_PACMAN_LEFT, &level.score[SC_PACMAN], TEXT_SMASHING },
{ EL_PACMAN_DOWN, &level.score[SC_PACMAN], TEXT_SMASHING },
- { EL_KOKOSNUSS, &level.score[SC_KOKOSNUSS], TEXT_CRACKING },
- { EL_DYNAMITE_INACTIVE,&level.score[SC_DYNAMIT], TEXT_COLLECTING },
- { EL_SCHLUESSEL1, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_SCHLUESSEL2, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_SCHLUESSEL3, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_SCHLUESSEL4, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_EM_KEY_1_FILE, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_EM_KEY_2_FILE, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_EM_KEY_3_FILE, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_EM_KEY_4_FILE, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
- { EL_AMOEBE_NASS, &level.amoeba_speed, TEXT_SPEED },
- { EL_AMOEBE_NORM, &level.amoeba_speed, TEXT_SPEED },
- { EL_AMOEBE_VOLL, &level.amoeba_speed, TEXT_SPEED },
- { EL_AMOEBE_BD, &level.amoeba_speed, TEXT_SPEED },
- { EL_SIEB_INAKTIV, &level.time_magic_wall, TEXT_DURATION },
- { EL_ABLENK_AUS, &level.time_wheel, TEXT_DURATION },
+ { EL_NUT, &level.score[SC_KOKOSNUSS], TEXT_CRACKING },
+ { EL_DYNAMITE ,&level.score[SC_DYNAMIT], TEXT_COLLECTING },
+ { EL_KEY1, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
+ { EL_KEY2, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
+ { EL_KEY3, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
+ { EL_KEY4, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
+ { EL_EM_KEY1_FILE, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
+ { EL_EM_KEY2_FILE, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
+ { EL_EM_KEY3_FILE, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
+ { EL_EM_KEY4_FILE, &level.score[SC_SCHLUESSEL], TEXT_COLLECTING },
+ { EL_AMOEBA_WET, &level.amoeba_speed, TEXT_SPEED },
+ { EL_AMOEBA_DRY, &level.amoeba_speed, TEXT_SPEED },
+ { EL_AMOEBA_FULL, &level.amoeba_speed, TEXT_SPEED },
+ { EL_BD_AMOEBA, &level.amoeba_speed, TEXT_SPEED },
+ { EL_MAGIC_WALL, &level.time_magic_wall, TEXT_DURATION },
+ { EL_ROBOT_WHEEL, &level.time_wheel, TEXT_DURATION },
{ -1, NULL, NULL }
};
DrawText(SX + ED_SETTINGS2_XPOS, SY + ED_SETTINGS_YPOS,
"Element Settings", FS_BIG, FC_YELLOW);
+#if 1
/* draw some decorative border for the object */
for (y=0; y<3; y++)
for (x=0; x<3; x++)
- DrawMiniElement(xstart + x , ystart + y, EL_ERDREICH);
+ DrawMiniElement(xstart + x , ystart + y, EL_SAND);
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
SX + xstart * MINI_TILEX + MINI_TILEX/2 - 1,
SY + ystart * MINI_TILEY + MINI_TILEY/2 - 1,
TILEX + 2, TILEY + 2);
/* copy border to the right location */
- XCopyArea(display, drawto, drawto, gc,
- SX + xstart * MINI_TILEX,
- SY + ystart * MINI_TILEY,
- 2 * TILEX, 2 * TILEY,
- SX + xstart * MINI_TILEX - MINI_TILEX/2,
- SY + ystart * MINI_TILEY - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ SX + xstart * MINI_TILEX,
+ SY + ystart * MINI_TILEY,
+ 2 * TILEX, 2 * TILEY,
+ SX + xstart * MINI_TILEX - MINI_TILEX/2,
+ SY + ystart * MINI_TILEY - MINI_TILEY/2);
- DrawGraphic(xstart/2, ystart/2, el2gfx(properties_element));
+#if 0
+ DrawGraphic(xstart / 2, ystart / 2, el2img(properties_element), 0);
+#else
+ DrawGraphicAnimation(xstart / 2, ystart / 2, el2img(properties_element));
+#endif
/* copy the whole stuff to the definitive location */
- XCopyArea(display, drawto, drawto, gc,
- SX + xstart * MINI_TILEX - MINI_TILEX/2,
- SY + ystart * MINI_TILEY - MINI_TILEY,
- 2 * TILEX, 2 * TILEY,
- SX + xstart * MINI_TILEX - MINI_TILEX/2,
- SY + ystart * MINI_TILEY - MINI_TILEY/2);
+ BlitBitmap(drawto, drawto,
+ SX + xstart * MINI_TILEX - MINI_TILEX/2,
+ SY + ystart * MINI_TILEY - MINI_TILEY,
+ 2 * TILEX, 2 * TILEY,
+ SX + xstart * MINI_TILEX - MINI_TILEX/2,
+ SY + ystart * MINI_TILEY - MINI_TILEY/2);
+
+ FrameCounter = 0; /* restart animation frame counter */
+
+#else
+
+ FrameCounter = 0; /* restart animation frame counter */
+ DrawPropertiesElement(xstart, ystart, properties_element);
+
+#endif
DrawTextF((xstart + 3) * MINI_TILEX, (ystart + 1) * MINI_TILEY,
- font_color, element_info[properties_element]);
+ font_color, getElementInfoText(properties_element));
num_elements_in_level = 0;
for (y=0; y<lev_fieldy; y++)
else
DrawElementContentAreas();
}
-}
-
-static void swap_numbers(int *i1, int *i2)
-{
- int help = *i1;
-
- *i1 = *i2;
- *i2 = help;
-}
-
-static void swap_number_pairs(int *x1, int *y1, int *x2, int *y2)
-{
- int help_x = *x1;
- int help_y = *y1;
- *x1 = *x2;
- *x2 = help_x;
+ if (IS_GEM(properties_element))
+ {
+ /* draw checkbutton gadget */
+ i = ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS;
+ x = checkbutton_info[i].x + xoffset_right2;
+ y = checkbutton_info[i].y + yoffset_right2;
- *y1 = *y2;
- *y2 = help_y;
+ DrawTextF(x, y, font_color, checkbutton_info[i].text);
+ ModifyGadget(level_editor_gadget[checkbutton_info[i].gadget_id],
+ GDI_CHECKED, *checkbutton_info[i].value, GDI_END);
+ MapCheckbuttonGadget(i);
+ }
}
static void DrawLineElement(int sx, int sy, int element, boolean change_level)
to_sx = SX + to_x * MINI_TILEX + MINI_TILEX - 1;
to_sy = SY + to_y * MINI_TILEY + MINI_TILEY - 1;
- XSetForeground(display, gc, WhitePixel(display, screen));
-
- XDrawLine(display, drawto, gc, from_sx, from_sy, to_sx, from_sy);
- XDrawLine(display, drawto, gc, to_sx, from_sy, to_sx, to_sy);
- XDrawLine(display, drawto, gc, to_sx, to_sy, from_sx, to_sy);
- XDrawLine(display, drawto, gc, from_sx, to_sy, from_sx, from_sy);
-
- XSetForeground(display, gc, BlackPixel(display, screen));
+ DrawSimpleWhiteLine(drawto, from_sx, from_sy, to_sx, from_sy);
+ DrawSimpleWhiteLine(drawto, to_sx, from_sy, to_sx, to_sy);
+ DrawSimpleWhiteLine(drawto, to_sx, to_sy, from_sx, to_sy);
+ DrawSimpleWhiteLine(drawto, from_sx, to_sy, from_sx, from_sy);
if (from_x == to_x && from_y == to_y)
MarkTileDirty(from_x/2, from_y/2);
else if (letter == 'ü' || letter == 'Ü')
letter_element = EL_CHAR_UE;
else if (letter == '^')
- letter_element = EL_CHAR_COPY;
+ letter_element = EL_CHAR_COPYRIGHT;
else
letter_element = EL_CHAR_ASCII0 + letter;
}
else if (new_element != Feld[lx][ly])
{
- if (new_element == EL_SPIELFIGUR)
+ if (new_element == EL_PLAYER1)
{
/* remove player at old position */
for(y=0; y<lev_fieldy; y++)
{
for(x=0; x<lev_fieldx; x++)
{
- if (Feld[x][y] == EL_SPIELFIGUR || Feld[x][y] == EL_SPIELER1)
+ if (Feld[x][y] == EL_PLAYER1)
{
- Feld[x][y] = EL_LEERRAUM;
+ Feld[x][y] = EL_EMPTY;
if (x - level_xpos >= 0 && x - level_xpos < ed_fieldx &&
y - level_ypos >= 0 && y - level_ypos < ed_fieldy)
DrawMiniElement(x - level_xpos, y - level_ypos,
- EL_LEERRAUM);
+ EL_EMPTY);
}
}
}
}
else
{
- DrawMiniGraphicExt(drawto, gc,
+ DrawMiniGraphicExt(drawto,
gi->x + sx * MINI_TILEX,
gi->y + sy * MINI_TILEY,
- el2gfx(new_element));
- DrawMiniGraphicExt(window, gc,
+ el2img(new_element));
+ DrawMiniGraphicExt(window,
gi->x + sx * MINI_TILEX,
gi->y + sy * MINI_TILEY,
- el2gfx(new_element));
+ el2img(new_element));
if (id == GADGET_ID_AMOEBA_CONTENT)
level.amoeba_content = new_element;
{
CopyAreaToBrush(start_sx, start_sy, sx, sy, button);
CopyBrushToCursor(sx, sy);
- ClickOnGadget(level_editor_gadget[GADGET_ID_SINGLE_ITEMS],MB_LEFT);
+ ClickOnGadget(level_editor_gadget[GADGET_ID_SINGLE_ITEMS],
+ MB_LEFTBUTTON);
draw_with_brush = TRUE;
}
else if (drawing_function == GADGET_ID_TEXT)
case GADGET_ID_PICK_ELEMENT:
if (button_release_event)
- ClickOnGadget(level_editor_gadget[last_drawing_function], MB_LEFT);
+ ClickOnGadget(level_editor_gadget[last_drawing_function],
+ MB_LEFTBUTTON);
else
PickDrawingElement(button, Feld[lx][ly]);
case ED_COUNTER_ID_SELECT_LEVEL:
LoadLevel(level_nr);
+ TapeErase();
ResetUndoBuffer();
DrawEditModeWindow();
break;
if (element_shift < 0)
element_shift = 0;
- if (element_shift > elements_in_list - ED_NUM_ELEMENTLIST_BUTTONS)
- element_shift = elements_in_list - ED_NUM_ELEMENTLIST_BUTTONS;
+ if (element_shift > num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS)
+ element_shift = num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS;
ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL],
GDI_SCROLLBAR_ITEM_POSITION,
int gadget_id = GADGET_ID_ELEMENTLIST_FIRST + i;
struct GadgetInfo *gi = level_editor_gadget[gadget_id];
struct GadgetDesign *gd = &gi->deco.design;
- int element = editor_element[element_shift + i];
+ int element = editor_elements[element_shift + i];
UnmapGadget(gi);
- getMiniGraphicSource(el2gfx(element), &gd->pixmap, &gd->x, &gd->y);
- ModifyGadget(gi, GDI_INFO_TEXT, element_info[element], GDI_END);
+ getMiniGraphicSource(el2img(element), &gd->bitmap, &gd->x, &gd->y);
+ ModifyGadget(gi, GDI_INFO_TEXT, getElementInfoText(element), GDI_END);
MapGadget(gi);
}
break;
case GADGET_ID_CLEAR:
for(x=0; x<MAX_LEV_FIELDX; x++)
for(y=0; y<MAX_LEV_FIELDY; y++)
- Feld[x][y] = (button == 1 ? EL_LEERRAUM : new_element);
+ Feld[x][y] = (button == 1 ? EL_EMPTY : new_element);
CopyLevelToUndoBuffer(GADGET_ID_CLEAR);
DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
break;
case GADGET_ID_SAVE:
- if (leveldir[leveldir_nr].readonly)
+ if (leveldir_current->readonly)
{
Request("This level is read only !", REQ_CONFIRM);
break;
Request("No Level without Gregor Mc Duffin please !", REQ_CONFIRM);
else
{
+ if (LevelChanged())
+ level.game_version = GAME_VERSION_ACTUAL;
+
for(x=0; x<lev_fieldx; x++)
for(y=0; y<lev_fieldy; y++)
FieldBackup[x][y] = Ur[x][y];
break;
case GADGET_ID_EXIT:
- if (!LevelChanged() ||
- Request("Level has changed! Exit without saving ?",
- REQ_ASK | REQ_STAY_OPEN))
- {
- CloseDoor(DOOR_CLOSE_1);
-
- /*
- CloseDoor(DOOR_CLOSE_ALL);
- */
-
- game_status = MAINMENU;
- DrawMainMenu();
- }
- else
- {
- CloseDoor(DOOR_CLOSE_1);
- XCopyArea(display, pix[PIX_DB_DOOR], pix[PIX_DB_DOOR], gc,
- DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
- DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
- OpenDoor(DOOR_OPEN_1);
- }
+ RequestExitLevelEditor(TRUE); /* if level has changed, ask user */
break;
default:
id <= GADGET_ID_ELEMENTLIST_LAST)
{
int element_position = id - GADGET_ID_ELEMENTLIST_FIRST;
- int new_element = editor_element[element_position + element_shift];
+ int new_element = editor_elements[element_position + element_shift];
PickDrawingElement(button, new_element);
}
if (drawing_function == GADGET_ID_PICK_ELEMENT)
- ClickOnGadget(level_editor_gadget[last_drawing_function], MB_LEFT);
+ ClickOnGadget(level_editor_gadget[last_drawing_function],
+ MB_LEFTBUTTON);
}
#ifdef DEBUG
else if (gi->event.type == GD_EVENT_PRESSED)
}
}
-void HandleLevelEditorKeyInput(KeySym key)
+void HandleLevelEditorKeyInput(Key key)
{
- char letter = getCharFromKeySym(key);
- int button = MB_LEFT;
+ char letter = getCharFromKey(key);
+ int button = MB_LEFTBUTTON;
if (drawing_function == GADGET_ID_TEXT &&
DrawLevelText(0, 0, 0, TEXT_QUERY_TYPING) == TRUE)
{
if (letter)
DrawLevelText(0, 0, letter, TEXT_WRITECHAR);
- else if (key == XK_Delete || key == XK_BackSpace)
+ else if (key == KSYM_Delete || key == KSYM_BackSpace)
DrawLevelText(0, 0, 0, TEXT_BACKSPACE);
- else if (key == XK_Return)
+ else if (key == KSYM_Return)
DrawLevelText(0, 0, 0, TEXT_NEWLINE);
+ else if (key == KSYM_Escape)
+ DrawLevelText(0, 0, 0, TEXT_END);
}
else if (button_status == MB_RELEASED)
{
- int i, id;
+ int i, id = GADGET_ID_NONE;
switch (key)
{
- case XK_Left:
+ case KSYM_Left:
id = GADGET_ID_SCROLL_LEFT;
break;
- case XK_Right:
+ case KSYM_Right:
id = GADGET_ID_SCROLL_RIGHT;
break;
- case XK_Up:
+ case KSYM_Up:
id = GADGET_ID_SCROLL_UP;
break;
- case XK_Down:
+ case KSYM_Down:
id = GADGET_ID_SCROLL_DOWN;
break;
- case XK_Page_Up:
+ case KSYM_Page_Up:
id = GADGET_ID_SCROLL_LIST_UP;
- button = 3;
+ button = MB_RIGHTBUTTON;
break;
- case XK_Page_Down:
+ case KSYM_Page_Down:
id = GADGET_ID_SCROLL_LIST_DOWN;
- button = 3;
+ button = MB_RIGHTBUTTON;
break;
+ case KSYM_Escape:
+ if (edit_mode == ED_MODE_DRAWING)
+ {
+ RequestExitLevelEditor(setup.ask_on_escape);
+ }
+ else
+ {
+ DrawDrawingWindow();
+ edit_mode = ED_MODE_DRAWING;
+ }
+ break;
+
default:
- id = GADGET_ID_NONE;
break;
}
ClickOnGadget(level_editor_gadget[id], button);
else if (letter == '.')
ClickOnGadget(level_editor_gadget[GADGET_ID_SINGLE_ITEMS], button);
- else if (key == XK_space || key == XK_Return)
+ else if (key == KSYM_Return || key == setup.shortcut.toggle_pause)
ClickOnGadget(level_editor_gadget[GADGET_ID_TEST], button);
else
for (i=0; i<ED_NUM_CTRL_BUTTONS; i++)
}
}
+void HandleLevelEditorIdle()
+{
+ static unsigned long action_delay = 0;
+ unsigned long action_delay_value = GameFrameDelay;
+ int xpos = 1, ypos = 2;
+
+ if (edit_mode != ED_MODE_PROPERTIES)
+ return;
+
+ if (!DelayReached(&action_delay, action_delay_value))
+ return;
+
+ FY += MINI_TILEY / 2;
+#if 1
+ DrawGraphicAnimation(xpos, ypos, el2img(properties_element));
+#else
+ DrawGraphicAnimation(xpos, ypos, el_dir_act2img(properties_element,
+ MV_NO_MOVING,
+ ...));
+#endif
+ FY -= MINI_TILEY / 2;
+ MarkTileDirty(xpos, ypos + 1);
+
+ FrameCounter++; /* increase animation frame counter */
+}
+
void ClearEditorGadgetInfoText()
{
- XFillRectangle(display, drawto, gc,
+ ClearRectangle(drawto,
INFOTEXT_XPOS, INFOTEXT_YPOS, INFOTEXT_XSIZE, INFOTEXT_YSIZE);
redraw_mask |= REDRAW_FIELD;
}
char infotext[MAX_INFOTEXT_LEN + 1];
char shortcut[MAX_INFOTEXT_LEN + 1];
+ if (game_status != LEVELED)
+ return;
+
ClearEditorGadgetInfoText();
+ if (gi->event.type == GD_EVENT_INFO_LEAVING)
+ return;
+
/* misuse this function to delete brush cursor, if needed */
if (edit_mode == ED_MODE_DRAWING && draw_with_brush)
DeleteBrushFromCursor();
ClearEditorGadgetInfoText();
+ if (gi->event.type == GD_EVENT_INFO_LEAVING)
+ return;
+
/* make sure to stay inside drawing area boundaries */
sx = (sx < min_sx ? min_sx : sx > max_sx ? max_sx : sx);
sy = (sy < min_sy ? min_sy : sy > max_sy ? max_sy : sy);
}
else if (drawing_function == GADGET_ID_PICK_ELEMENT)
DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW,
- "%s", element_info[Feld[lx][ly]]);
+ "%s", getElementInfoText(Feld[lx][ly]));
else
DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW,
"Level position: %d, %d", lx, ly);
"Content area %d position: %d, %d",
id - GADGET_ID_ELEM_CONTENT_0 + 1, sx, sy);
}
+
+void RequestExitLevelEditor(boolean ask_if_level_has_changed)
+{
+ if (!ask_if_level_has_changed ||
+ !LevelChanged() ||
+ Request("Level has changed! Exit without saving ?",
+ REQ_ASK | REQ_STAY_OPEN))
+ {
+ CloseDoor(DOOR_CLOSE_1);
+ /*
+ CloseDoor(DOOR_CLOSE_ALL);
+ */
+ game_status = MAINMENU;
+ DrawMainMenu();
+ }
+ else
+ {
+ CloseDoor(DOOR_CLOSE_1);
+ BlitBitmap(bitmap_db_door, bitmap_db_door,
+ DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
+ DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ OpenDoor(DOOR_OPEN_1);
+ }
+}