- fixed bug (missing array boundary check) which could crash the game
- fixed problem with setting mouse cursor in SDL version in fullscreen
- fixed problem with flickering when drawing toon animations
+ - fixed problem with player animation when snapping and moving
Release Version 3.0.2 [22 AUG 2003]
-----------------------------------
FONT_TEXT_1, GFX_SPECIAL_ARG_PREVIEW,
IMG_FONT_TEXT_1_PREVIEW
},
+ {
+ FONT_TEXT_1, GFX_SPECIAL_ARG_PLAYING,
+ IMG_FONT_TEXT_1_PLAYING
+ },
{
FONT_TEXT_1, GFX_SPECIAL_ARG_SCORES,
IMG_FONT_TEXT_1_SCORES
{ "font.text_1.PREVIEW.y", "160" },
{ "font.text_1.PREVIEW.width", "16" },
{ "font.text_1.PREVIEW.height", "16" },
+ { "font.text_1.PLAYING", "RocksFontEM.pcx" },
+ { "font.text_1.PLAYING.x", "0" },
+ { "font.text_1.PLAYING.y", "160" },
+ { "font.text_1.PLAYING.width", "16" },
+ { "font.text_1.PLAYING.height", "16" },
{ "font.text_1.SCORES", "RocksFontMedium.pcx" },
{ "font.text_1.SCORES.x", "0" },
{ "font.text_1.SCORES.y", "480" },
#define IMG_FONT_TEXT_1 1227
#define IMG_FONT_TEXT_1_LEVELS 1228
#define IMG_FONT_TEXT_1_PREVIEW 1229
-#define IMG_FONT_TEXT_1_SCORES 1230
-#define IMG_FONT_TEXT_1_ACTIVE_SCORES 1231
-#define IMG_FONT_TEXT_2 1232
-#define IMG_FONT_TEXT_2_LEVELS 1233
-#define IMG_FONT_TEXT_2_PREVIEW 1234
-#define IMG_FONT_TEXT_2_SCORES 1235
-#define IMG_FONT_TEXT_2_ACTIVE_SCORES 1236
-#define IMG_FONT_TEXT_3 1237
-#define IMG_FONT_TEXT_3_LEVELS 1238
-#define IMG_FONT_TEXT_3_PREVIEW 1239
-#define IMG_FONT_TEXT_3_SCORES 1240
-#define IMG_FONT_TEXT_3_ACTIVE_SCORES 1241
-#define IMG_FONT_TEXT_4 1242
-#define IMG_FONT_TEXT_4_LEVELS 1243
-#define IMG_FONT_TEXT_4_SCORES 1244
-#define IMG_FONT_TEXT_4_ACTIVE_SCORES 1245
-#define IMG_FONT_INPUT_1 1246
-#define IMG_FONT_INPUT_1_MAIN 1247
-#define IMG_FONT_INPUT_1_ACTIVE 1248
-#define IMG_FONT_INPUT_1_ACTIVE_MAIN 1249
-#define IMG_FONT_INPUT_1_ACTIVE_SETUP 1250
-#define IMG_FONT_INPUT_2 1251
-#define IMG_FONT_INPUT_2_ACTIVE 1252
-#define IMG_FONT_OPTION_OFF 1253
-#define IMG_FONT_OPTION_ON 1254
-#define IMG_FONT_VALUE_1 1255
-#define IMG_FONT_VALUE_2 1256
-#define IMG_FONT_VALUE_OLD 1257
-#define IMG_FONT_LEVEL_NUMBER 1258
-#define IMG_FONT_TAPE_RECORDER 1259
-#define IMG_FONT_GAME_INFO 1260
-#define IMG_GLOBAL_BORDER 1261
-#define IMG_GLOBAL_DOOR 1262
-#define IMG_EDITOR_ELEMENT_BORDER 1263
-#define IMG_EDITOR_ELEMENT_BORDER_INPUT 1264
-#define IMG_BACKGROUND 1265
-#define IMG_BACKGROUND_MAIN 1266
-#define IMG_BACKGROUND_LEVELS 1267
-#define IMG_BACKGROUND_SCORES 1268
-#define IMG_BACKGROUND_EDITOR 1269
-#define IMG_BACKGROUND_INFO 1270
-#define IMG_BACKGROUND_SETUP 1271
-#define IMG_BACKGROUND_DOOR 1272
+#define IMG_FONT_TEXT_1_PLAYING 1230
+#define IMG_FONT_TEXT_1_SCORES 1231
+#define IMG_FONT_TEXT_1_ACTIVE_SCORES 1232
+#define IMG_FONT_TEXT_2 1233
+#define IMG_FONT_TEXT_2_LEVELS 1234
+#define IMG_FONT_TEXT_2_PREVIEW 1235
+#define IMG_FONT_TEXT_2_SCORES 1236
+#define IMG_FONT_TEXT_2_ACTIVE_SCORES 1237
+#define IMG_FONT_TEXT_3 1238
+#define IMG_FONT_TEXT_3_LEVELS 1239
+#define IMG_FONT_TEXT_3_PREVIEW 1240
+#define IMG_FONT_TEXT_3_SCORES 1241
+#define IMG_FONT_TEXT_3_ACTIVE_SCORES 1242
+#define IMG_FONT_TEXT_4 1243
+#define IMG_FONT_TEXT_4_LEVELS 1244
+#define IMG_FONT_TEXT_4_SCORES 1245
+#define IMG_FONT_TEXT_4_ACTIVE_SCORES 1246
+#define IMG_FONT_INPUT_1 1247
+#define IMG_FONT_INPUT_1_MAIN 1248
+#define IMG_FONT_INPUT_1_ACTIVE 1249
+#define IMG_FONT_INPUT_1_ACTIVE_MAIN 1250
+#define IMG_FONT_INPUT_1_ACTIVE_SETUP 1251
+#define IMG_FONT_INPUT_2 1252
+#define IMG_FONT_INPUT_2_ACTIVE 1253
+#define IMG_FONT_OPTION_OFF 1254
+#define IMG_FONT_OPTION_ON 1255
+#define IMG_FONT_VALUE_1 1256
+#define IMG_FONT_VALUE_2 1257
+#define IMG_FONT_VALUE_OLD 1258
+#define IMG_FONT_LEVEL_NUMBER 1259
+#define IMG_FONT_TAPE_RECORDER 1260
+#define IMG_FONT_GAME_INFO 1261
+#define IMG_GLOBAL_BORDER 1262
+#define IMG_GLOBAL_DOOR 1263
+#define IMG_EDITOR_ELEMENT_BORDER 1264
+#define IMG_EDITOR_ELEMENT_BORDER_INPUT 1265
+#define IMG_BACKGROUND 1266
+#define IMG_BACKGROUND_MAIN 1267
+#define IMG_BACKGROUND_LEVELS 1268
+#define IMG_BACKGROUND_SCORES 1269
+#define IMG_BACKGROUND_EDITOR 1270
+#define IMG_BACKGROUND_INFO 1271
+#define IMG_BACKGROUND_SETUP 1272
+#define IMG_BACKGROUND_DOOR 1273
-#define NUM_IMAGE_FILES 1273
+#define NUM_IMAGE_FILES 1274
#endif /* CONF_GFX_H */
-#define COMPILE_DATE_STRING "[2003-09-01 19:13]"
+#define COMPILE_DATE_STRING "[2003-09-01 23:03]"
static int element_shift = 0;
-static int editor_el_boulderdash[] =
+static int editor_hl_boulderdash[] =
{
EL_CHAR('B'),
EL_CHAR('O'),
EL_CHAR('A'),
EL_CHAR('S'),
EL_CHAR('H'),
+};
+static int editor_el_boulderdash[] =
+{
EL_PLAYER_1,
EL_EMPTY,
EL_SAND,
EL_BD_FIREFLY_DOWN,
EL_EMPTY,
};
+static int num_editor_hl_boulderdash = SIZEOF_ARRAY_INT(editor_hl_boulderdash);
static int num_editor_el_boulderdash = SIZEOF_ARRAY_INT(editor_el_boulderdash);
-static int editor_el_emerald_mine[] =
+static int editor_hl_emerald_mine[] =
{
EL_CHAR('E'),
EL_CHAR('M'),
EL_CHAR('I'),
EL_CHAR('N'),
EL_CHAR('E'),
+};
+static int editor_el_emerald_mine[] =
+{
EL_PLAYER_1,
EL_PLAYER_2,
EL_PLAYER_3,
EL_EM_GATE_3_GRAY,
EL_EM_GATE_4_GRAY,
};
-static int num_editor_el_emerald_mine = SIZEOF_ARRAY_INT(editor_el_emerald_mine);
+static int num_editor_hl_emerald_mine=SIZEOF_ARRAY_INT(editor_hl_emerald_mine);
+static int num_editor_el_emerald_mine=SIZEOF_ARRAY_INT(editor_el_emerald_mine);
-static int editor_el_more[] =
+static int editor_hl_more[] =
{
EL_CHAR('M'),
EL_CHAR('O'),
EL_CHAR('R'),
EL_CHAR('E'),
+};
+static int editor_el_more[] =
+{
EL_KEY_1,
EL_KEY_2,
EL_KEY_3,
EL_EMC_WALL_6,
EL_EMC_WALL_7,
};
+static int num_editor_hl_more = SIZEOF_ARRAY_INT(editor_hl_more);
static int num_editor_el_more = SIZEOF_ARRAY_INT(editor_el_more);
-static int editor_el_sokoban[] =
+static int editor_hl_sokoban[] =
{
EL_CHAR('S'),
EL_CHAR('O'),
EL_CHAR('B'),
EL_CHAR('A'),
EL_CHAR('N'),
+};
+static int editor_el_sokoban[] =
+{
EL_SOKOBAN_OBJECT,
EL_SOKOBAN_FIELD_EMPTY,
EL_SOKOBAN_FIELD_FULL,
EL_STEELWALL,
};
+static int num_editor_hl_sokoban = SIZEOF_ARRAY_INT(editor_hl_sokoban);
static int num_editor_el_sokoban = SIZEOF_ARRAY_INT(editor_el_sokoban);
-static int editor_el_supaplex[] =
+static int editor_hl_supaplex[] =
{
EL_CHAR('S'),
EL_CHAR('U'),
EL_CHAR('L'),
EL_CHAR('E'),
EL_CHAR('X'),
+};
+static int editor_el_supaplex[] =
+{
EL_SP_EMPTY,
EL_SP_ZONK,
EL_SP_BASE,
EL_SP_CHIP_TOP,
EL_SP_CHIP_BOTTOM,
};
+static int num_editor_hl_supaplex = SIZEOF_ARRAY_INT(editor_hl_supaplex);
static int num_editor_el_supaplex = SIZEOF_ARRAY_INT(editor_el_supaplex);
-static int editor_el_diamond_caves[] =
+static int editor_hl_diamond_caves[] =
{
EL_CHAR('D'),
EL_CHAR('I'),
EL_CHAR(' '),
EL_CHAR('I'),
EL_CHAR('I'),
+};
+static int editor_el_diamond_caves[] =
+{
EL_PEARL,
EL_CRYSTAL,
EL_WALL_PEARL,
EL_EXTRA_TIME,
EL_EMPTY,
};
+static int num_editor_hl_diamond_caves = SIZEOF_ARRAY_INT(editor_hl_diamond_caves);
static int num_editor_el_diamond_caves = SIZEOF_ARRAY_INT(editor_el_diamond_caves);
-static int editor_el_dx_boulderdash[] =
+static int editor_hl_dx_boulderdash[] =
{
EL_CHAR('D'),
EL_CHAR('X'),
EL_CHAR('A'),
EL_CHAR('S'),
EL_CHAR('H'),
+};
+static int editor_el_dx_boulderdash[] =
+{
EL_SPRING,
EL_TUBE_RIGHT_DOWN,
EL_TUBE_HORIZONTAL_DOWN,
EL_EMPTY,
EL_EMPTY
};
+static int num_editor_hl_dx_boulderdash = SIZEOF_ARRAY_INT(editor_hl_dx_boulderdash);
static int num_editor_el_dx_boulderdash = SIZEOF_ARRAY_INT(editor_el_dx_boulderdash);
-static int editor_el_chars[] =
+static int editor_hl_chars[] =
{
EL_CHAR('T'),
EL_CHAR('E'),
EL_CHAR('X'),
EL_CHAR('T'),
+};
+static int editor_el_chars[] =
+{
EL_CHAR(' '),
EL_CHAR('!'),
EL_CHAR('"'),
EL_CHAR(FONT_ASCII_CURSOR),
EL_CHAR(' ')
};
+static int num_editor_hl_chars = SIZEOF_ARRAY_INT(editor_hl_chars);
static int num_editor_el_chars = SIZEOF_ARRAY_INT(editor_el_chars);
-static int editor_el_custom[] =
+static int editor_hl_custom[] =
{
EL_CHAR('C'),
EL_CHAR('U'),
EL_CHAR('N'),
EL_CHAR('T'),
EL_CHAR('S'),
+};
+static int editor_el_custom[] =
+{
EL_CUSTOM_START + 0,
EL_CUSTOM_START + 1,
EL_CUSTOM_START + 2,
EL_CUSTOM_START + 126,
EL_CUSTOM_START + 127
};
+static int num_editor_hl_custom = SIZEOF_ARRAY_INT(editor_hl_custom);
static int num_editor_el_custom = SIZEOF_ARRAY_INT(editor_el_custom);
+static int editor_hl_custom_more[] =
+{
+};
+
static int editor_el_custom_more[] =
{
EL_CUSTOM_START + 128,
EL_CUSTOM_START + 254,
EL_CUSTOM_START + 255
};
+static int num_editor_hl_custom_more = SIZEOF_ARRAY_INT(editor_hl_custom_more);
static int num_editor_el_custom_more = SIZEOF_ARRAY_INT(editor_el_custom_more);
static int *editor_elements = NULL; /* dynamically allocated */
static struct
{
boolean *setup_value;
+
+ int *headline_list;
+ int *headline_list_size;
+
int *element_list;
int *element_list_size;
}
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 },
- { &setup.editor.el_custom_more, editor_el_custom_more,
- &num_editor_el_custom_more },
- { NULL, NULL,
- NULL }
+ {
+ &setup.editor.el_boulderdash,
+ editor_hl_boulderdash, &num_editor_hl_boulderdash,
+ editor_el_boulderdash, &num_editor_el_boulderdash
+ },
+ {
+ &setup.editor.el_emerald_mine,
+ editor_hl_emerald_mine, &num_editor_hl_emerald_mine,
+ editor_el_emerald_mine, &num_editor_el_emerald_mine
+ },
+ {
+ &setup.editor.el_more,
+ editor_hl_more, &num_editor_hl_more,
+ editor_el_more, &num_editor_el_more
+ },
+ {
+ &setup.editor.el_sokoban,
+ editor_hl_sokoban, &num_editor_hl_sokoban,
+ editor_el_sokoban, &num_editor_el_sokoban
+ },
+ {
+ &setup.editor.el_supaplex,
+ editor_hl_supaplex, &num_editor_hl_supaplex,
+ editor_el_supaplex, &num_editor_el_supaplex
+ },
+ {
+ &setup.editor.el_diamond_caves,
+ editor_hl_diamond_caves, &num_editor_hl_diamond_caves,
+ editor_el_diamond_caves, &num_editor_el_diamond_caves
+ },
+ {
+ &setup.editor.el_dx_boulderdash,
+ editor_hl_dx_boulderdash, &num_editor_hl_dx_boulderdash,
+ editor_el_dx_boulderdash, &num_editor_el_dx_boulderdash
+ },
+ {
+ &setup.editor.el_chars,
+ editor_hl_chars, &num_editor_hl_chars,
+ editor_el_chars, &num_editor_el_chars
+ },
+ {
+ &setup.editor.el_custom,
+ editor_hl_custom, &num_editor_hl_custom,
+ editor_el_custom, &num_editor_el_custom
+ },
+ {
+ &setup.editor.el_custom_more,
+ editor_hl_custom_more, &num_editor_hl_custom_more,
+ editor_el_custom_more, &num_editor_el_custom_more
+ },
+ {
+ NULL,
+ NULL, NULL,
+ NULL, NULL
+ }
};
/* determine size of element list */
for (i=0; editor_elements_info[i].setup_value != NULL; i++)
+ {
if (*editor_elements_info[i].setup_value)
+ {
+ if (setup.editor.el_headlines)
+ num_editor_elements += *editor_elements_info[i].headline_list_size;
+
num_editor_elements += *editor_elements_info[i].element_list_size;
+ }
+ }
if (num_editor_elements < ED_NUM_ELEMENTLIST_BUTTONS)
{
/* 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++)
+ {
+ if (setup.editor.el_headlines)
+ for (j=0; j < *editor_elements_info[i].headline_list_size; j++)
+ editor_elements[pos++] = editor_elements_info[i].headline_list[j];
+
+ for (j=0; j < *editor_elements_info[i].element_list_size; j++)
editor_elements[pos++] = editor_elements_info[i].element_list[j];
+ }
+ }
/* correct position of element list scrollbar */
if (element_shift < 0)
static void ReinitializeElementListButtons()
{
+ static boolean last_setup_value_headlines = FALSE;
static boolean initialization_needed = TRUE;
int i;
if (!initialization_needed) /* check if editor element setup has changed */
+ {
+ if (last_setup_value_headlines != setup.editor.el_headlines)
+ initialization_needed = TRUE;
+
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;
CreateLevelEditorGadgets();
/* store current setup values for next invocation of this function */
+ last_setup_value_headlines = setup.editor.el_headlines;
for (i=0; editor_elements_info[i].setup_value != NULL; i++)
editor_elements_info[i].last_setup_value =
*editor_elements_info[i].setup_value;
fclose(file);
}
+#if 1
+
+static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename)
+{
+ if (leveldir_current == NULL) /* only when dumping level */
+ return;
+
+ /* determine correct game engine version of current level */
+ if (IS_LEVELCLASS_CONTRIBUTION(leveldir_current) ||
+ IS_LEVELCLASS_USER(leveldir_current))
+ {
+#if 0
+ printf("\n::: This level is private or contributed: '%s'\n", filename);
+#endif
+
+ /* For user contributed and private levels, use the version of
+ the game engine the levels were created for.
+ Since 2.0.1, the game engine version is now directly stored
+ in the level file (chunk "VERS"), so there is no need anymore
+ to set the game version from the file version (except for old,
+ pre-2.0 levels, where the game version is still taken from the
+ file format version used to store the level -- see above). */
+
+ /* do some special adjustments to support older level versions */
+ if (level->file_version == FILE_VERSION_1_0)
+ {
+ Error(ERR_WARN, "level file '%s'has version number 1.0", filename);
+ Error(ERR_WARN, "using high speed movement for player");
+
+ /* player was faster than monsters in (pre-)1.0 levels */
+ level->double_speed = TRUE;
+ }
+
+ /* Default behaviour for EM style gems was "slippery" only in 2.0.1 */
+ if (level->game_version == VERSION_IDENT(2,0,1))
+ level->em_slippery_gems = TRUE;
+ }
+ else
+ {
+#if 0
+ printf("\n::: ALWAYS USE LATEST ENGINE FOR THIS LEVEL: [%d] '%s'\n",
+ leveldir_current->sort_priority, filename);
+#endif
+
+ /* Always use the latest version of the game engine for all but
+ user contributed and private levels; this allows for actual
+ corrections in the game engine to take effect for existing,
+ converted levels (from "classic" or other existing games) to
+ make the game emulation more accurate, while (hopefully) not
+ breaking existing levels created from other players. */
+
+ level->game_version = GAME_VERSION_ACTUAL;
+
+ /* Set special EM style gems behaviour: EM style gems slip down from
+ normal, steel and growing wall. As this is a more fundamental change,
+ it seems better to set the default behaviour to "off" (as it is more
+ natural) and make it configurable in the level editor (as a property
+ of gem style elements). Already existing converted levels (neither
+ private nor contributed levels) are changed to the new behaviour. */
+
+ if (level->file_version < FILE_VERSION_2_0)
+ level->em_slippery_gems = TRUE;
+ }
+}
+
+static void LoadLevel_InitElements(struct LevelInfo *level, char *filename)
+{
+ int i, j;
+
+ /* map custom element change events that have changed in newer versions
+ (these following values have accidentally changed in version 3.0.1) */
+ if (level->game_version <= VERSION_IDENT(3,0,0))
+ {
+ for (i=0; i < NUM_CUSTOM_ELEMENTS; i++)
+ {
+ int element = EL_CUSTOM_START + i;
+
+ /* order of checking events to be mapped is important */
+ for (j=CE_BY_OTHER; j >= CE_BY_PLAYER; j--)
+ {
+ if (HAS_CHANGE_EVENT(element, j - 2))
+ {
+ SET_CHANGE_EVENT(element, j - 2, FALSE);
+ SET_CHANGE_EVENT(element, j, TRUE);
+ }
+ }
+
+ /* order of checking events to be mapped is important */
+ for (j=CE_OTHER_GETS_COLLECTED; j >= CE_COLLISION; j--)
+ {
+ if (HAS_CHANGE_EVENT(element, j - 1))
+ {
+ SET_CHANGE_EVENT(element, j - 1, FALSE);
+ SET_CHANGE_EVENT(element, j, TRUE);
+ }
+ }
+ }
+ }
+
+ /* initialize "can_change" field for old levels with only one change page */
+ if (level->game_version <= VERSION_IDENT(3,0,2))
+ {
+ for (i=0; i < NUM_CUSTOM_ELEMENTS; i++)
+ {
+ int element = EL_CUSTOM_START + i;
+
+ if (CAN_CHANGE(element))
+ element_info[element].change->can_change = TRUE;
+ }
+ }
+
+ /* initialize element properties for level editor etc. */
+ InitElementPropertiesEngine(level->game_version);
+}
+
+static void LoadLevel_InitPlayfield(struct LevelInfo *level, char *filename)
+{
+ int x, y;
+
+ /* map elements that have changed in newer versions */
+ for(y=0; y<level->fieldy; y++)
+ {
+ for(x=0; x<level->fieldx; x++)
+ {
+ int element = level->field[x][y];
+
+ if (level->game_version <= VERSION_IDENT(2,2,0))
+ {
+ /* map game font elements */
+ element = (element == EL_CHAR('[') ? EL_CHAR_AUMLAUT :
+ element == EL_CHAR('\\') ? EL_CHAR_OUMLAUT :
+ element == EL_CHAR(']') ? EL_CHAR_UUMLAUT :
+ element == EL_CHAR('^') ? EL_CHAR_COPYRIGHT : element);
+ }
+
+ if (level->game_version < VERSION_IDENT(3,0,0))
+ {
+ /* map Supaplex gravity tube elements */
+ element = (element == EL_SP_GRAVITY_PORT_LEFT ? EL_SP_PORT_LEFT :
+ element == EL_SP_GRAVITY_PORT_RIGHT ? EL_SP_PORT_RIGHT :
+ element == EL_SP_GRAVITY_PORT_UP ? EL_SP_PORT_UP :
+ element == EL_SP_GRAVITY_PORT_DOWN ? EL_SP_PORT_DOWN :
+ element);
+ }
+
+ level->field[x][y] = element;
+ }
+ }
+
+ /* copy elements to runtime playfield array */
+ for(x=0; x<MAX_LEV_FIELDX; x++)
+ for(y=0; y<MAX_LEV_FIELDY; y++)
+ Feld[x][y] = level->field[x][y];
+
+ /* initialize level size variables for faster access */
+ lev_fieldx = level->fieldx;
+ lev_fieldy = level->fieldy;
+
+ /* determine border element for this level */
+ SetBorderElement();
+}
+
+#else
+
static void LoadLevel_InitLevel(struct LevelInfo *level, char *filename)
{
int i, j, x, y;
InitElementPropertiesEngine(level->game_version);
}
+#endif
+
void LoadLevelTemplate(int level_nr)
{
char *filename = getLevelFilename(level_nr);
LoadLevelFromFilename(&level_template, filename);
+ LoadLevel_InitVersion(&level, filename);
+ LoadLevel_InitElements(&level, filename);
+
ActivateLevelTemplate();
}
if (level.use_custom_template)
LoadLevelTemplate(-1);
+#if 1
+ LoadLevel_InitVersion(&level, filename);
+ LoadLevel_InitElements(&level, filename);
+ LoadLevel_InitPlayfield(&level, filename);
+#else
LoadLevel_InitLevel(&level, filename);
+#endif
}
static void SaveLevel_VERS(FILE *file, struct LevelInfo *level)
#define SETUP_TOKEN_EDITOR_EL_DX_BOULDERDASH 6
#define SETUP_TOKEN_EDITOR_EL_CHARS 7
#define SETUP_TOKEN_EDITOR_EL_CUSTOM 8
+#define SETUP_TOKEN_EDITOR_EL_HEADLINES 9
-#define NUM_EDITOR_SETUP_TOKENS 9
+#define NUM_EDITOR_SETUP_TOKENS 10
/* shortcut setup */
#define SETUP_TOKEN_SHORTCUT_SAVE_GAME 0
{ TYPE_SWITCH, &sei.el_chars, "editor.el_chars" },
{ TYPE_SWITCH, &sei.el_custom, "editor.el_custom" },
{ TYPE_SWITCH, &sei.el_custom_more, "editor.el_custom_more" },
+ { TYPE_SWITCH, &sei.el_headlines, "editor.el_headlines" },
};
static struct TokenInfo shortcut_setup_tokens[] =
si->editor.el_custom = TRUE;
si->editor.el_custom_more = FALSE;
+ si->editor.el_headlines = TRUE;
+
si->shortcut.save_game = DEFAULT_KEY_SAVE_GAME;
si->shortcut.load_game = DEFAULT_KEY_LOAD_GAME;
si->shortcut.toggle_pause = DEFAULT_KEY_TOGGLE_PAUSE;
Bang(x, y);
}
+void ShowEnvelope()
+{
+ int i, x, y;
+
+ /* open envelope window horizontally */
+ for (i=2; i <= level.envelope_xsize + 2; i += 2)
+ {
+ int startx = (SXSIZE / MINI_TILEX - i) / 2;
+ int starty = (SYSIZE / MINI_TILEY) / 2 - 1;
+
+ SetDrawtoField(DRAW_BUFFERED);
+
+ BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
+
+ SetDrawtoField(DRAW_BACKBUFFER);
+
+ for (y=0; y < 2; y++) for (x=0; x < i; x++)
+ {
+ int ex = (x == 0 ? -1 : x == i - 1 ? +1 : 0);
+ int ey = (y == 0 ? -1 : y == 1 ? +1 : 0);
+
+ DrawEnvelopeBorder(startx + x, starty + y, ex, ey);
+ }
+
+ redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER;
+ BackToFront();
+
+ Delay(GAME_FRAME_DELAY);
+ }
+
+ /* open envelope window vertically */
+ for (i=2; i <= level.envelope_ysize + 2; i += 2)
+ {
+ int xsize = level.envelope_xsize + 2;
+ int startx = (SXSIZE / MINI_TILEX - (xsize - 1)) / 2;
+ int starty = (SYSIZE / MINI_TILEY - i) / 2;
+
+ SetDrawtoField(DRAW_BUFFERED);
+
+ BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
+
+ SetDrawtoField(DRAW_BACKBUFFER);
+
+ for (y=0; y < i; y++) for (x=0; x < xsize; x++)
+ {
+ int ex = (x == 0 ? -1 : x == xsize - 1 ? +1 : 0);
+ int ey = (y == 0 ? -1 : y == i - 1 ? +1 : 0);
+
+ DrawEnvelopeBorder(startx + x, starty + y, ex, ey);
+ }
+
+ DrawTextToTextArea(SX + (startx + 1) * MINI_TILEX,
+ SY + (starty + 1) * MINI_TILEY, level.envelope,
+ FONT_TEXT_1, level.envelope_xsize, i - 2);
+
+ redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER;
+ BackToFront();
+
+ Delay(GAME_FRAME_DELAY);
+ }
+
+ Delay(3000);
+
+ SetDrawtoField(DRAW_BUFFERED);
+
+ redraw_mask |= REDRAW_FIELD;
+ BackToFront();
+}
+
void RelocatePlayer(int x, int y, int element)
{
struct PlayerInfo *player = &stored_player[element - EL_PLAYER_1];
/* check for change of center element (but change it only once) */
if (IS_CUSTOM_ELEMENT(center_element) &&
- element_info[center_element].change_events & CE_OTHER_IS_TOUCHING &&
+ HAS_ANY_CHANGE_EVENT(center_element, CE_OTHER_IS_TOUCHING) &&
!change_center_element)
{
for (j=0; j < element_info[center_element].num_change_pages; j++)
struct ElementChangeInfo *change =
&element_info[center_element].change_page[j];
- if (change->events & CE_OTHER_IS_TOUCHING &&
+ if (change->events & CH_EVENT_BIT(CE_OTHER_IS_TOUCHING) &&
change->trigger_element == border_element)
{
change_center_element = TRUE;
/* check for change of border element */
if (IS_CUSTOM_ELEMENT(border_element) &&
- element_info[border_element].change_events & CE_OTHER_IS_TOUCHING)
+ HAS_ANY_CHANGE_EVENT(border_element, CE_OTHER_IS_TOUCHING))
{
for (j=0; j < element_info[border_element].num_change_pages; j++)
{
struct ElementChangeInfo *change =
&element_info[border_element].change_page[j];
- if (change->events & CE_OTHER_IS_TOUCHING &&
+ if (change->events & CH_EVENT_BIT(CE_OTHER_IS_TOUCHING) &&
change->trigger_element == center_element)
{
CheckElementChangeExt(xx,yy, border_element,CE_OTHER_IS_TOUCHING, j);
el2edimg(EL_KEY_1 + key_nr));
redraw_mask |= REDRAW_DOOR_1;
}
+ else if (element == EL_ENVELOPE)
+ {
+ ShowEnvelope();
+ }
else if (IS_DROPPABLE(element)) /* can be collected and dropped */
{
int i;
boolean el_chars;
boolean el_custom;
boolean el_custom_more;
+
+ boolean el_headlines;
};
struct SetupShortcutInfo
int area_xsize, int area_ysize)
{
int area_line = 0;
- int font_height = getFontWidth(font_nr);
+ int font_height = getFontHeight(font_nr);
if (text == NULL)
return;
{ ".EDITOR", GAME_MODE_EDITOR, },
{ ".INFO", GAME_MODE_INFO, },
{ ".SETUP", GAME_MODE_SETUP, },
+ { ".PLAYING", GAME_MODE_PLAYING, },
{ ".DOOR", GAME_MODE_PSEUDO_DOOR, },
{ ".PREVIEW", GAME_MODE_PSEUDO_PREVIEW, },
{ ".CRUMBLED", GAME_MODE_PSEUDO_CRUMBLED, },
#define GFX_SPECIAL_ARG_EDITOR 3
#define GFX_SPECIAL_ARG_INFO 4
#define GFX_SPECIAL_ARG_SETUP 5
-#define GFX_SPECIAL_ARG_DOOR 6
-#define GFX_SPECIAL_ARG_PREVIEW 7
-#define GFX_SPECIAL_ARG_CRUMBLED 8
+#define GFX_SPECIAL_ARG_PLAYING 6
+#define GFX_SPECIAL_ARG_DOOR 7
+#define GFX_SPECIAL_ARG_PREVIEW 8
+#define GFX_SPECIAL_ARG_CRUMBLED 9
-#define NUM_SPECIAL_GFX_ARGS 9
+#define NUM_SPECIAL_GFX_ARGS 10
/* values for image configuration suffixes */
#define GAME_MODE_EDITOR 3
#define GAME_MODE_INFO 4
#define GAME_MODE_SETUP 5
-#define GAME_MODE_PSEUDO_DOOR 6
-#define GAME_MODE_PSEUDO_PREVIEW 7
-#define GAME_MODE_PSEUDO_CRUMBLED 8
+#define GAME_MODE_PLAYING 6
+#define GAME_MODE_PSEUDO_DOOR 7
+#define GAME_MODE_PSEUDO_PREVIEW 8
+#define GAME_MODE_PSEUDO_CRUMBLED 9
/* there are no special config file suffixes for these modes */
-#define GAME_MODE_PLAYING 9
#define GAME_MODE_PSEUDO_TYPENAME 10
#define GAME_MODE_QUIT 11
{ TYPE_SWITCH, &setup.editor.el_custom, "Custom:" },
{ TYPE_SWITCH, &setup.editor.el_custom_more, "More Custom:" },
{ TYPE_EMPTY, NULL, "" },
+ { TYPE_SWITCH, &setup.editor.el_headlines, "Headlines:" },
+ { TYPE_EMPTY, NULL, "" },
{ TYPE_LEAVE_MENU, execSetupMain, "Back" },
{ 0, NULL, NULL }
};
{ EL_STEELWALL, EL_INVISIBLE_STEELWALL }
};
int steel_type = (BorderElement == EL_STEELWALL ? 0 : 1);
- int steel_position = (x == -1 && y == -1 ? 0 :
- x == lev_fieldx && y == -1 ? 1 :
- x == -1 && y == lev_fieldy ? 2 :
- x == lev_fieldx && y == lev_fieldy ? 3 :
- x == -1 || x == lev_fieldx ? 4 :
- y == -1 || y == lev_fieldy ? 5 : 6);
+ int steel_position = (x == -1 && y == -1 ? 0 :
+ x == lev_fieldx && y == -1 ? 1 :
+ x == -1 && y == lev_fieldy ? 2 :
+ x == lev_fieldx && y == lev_fieldy ? 3 :
+ x == -1 || x == lev_fieldx ? 4 :
+ y == -1 || y == lev_fieldy ? 5 : 6);
return border[steel_position][steel_type];
}
DrawMiniGraphic(sx, sy, el2edimg(getBorderElement(x, y)));
}
+void DrawEnvelopeBorder(int sx, int sy, int ex, int ey)
+{
+ int border[8][2] =
+ {
+ { EL_STEELWALL_TOPLEFT, EL_INVISIBLE_STEELWALL_TOPLEFT },
+ { EL_STEELWALL_TOPRIGHT, EL_INVISIBLE_STEELWALL_TOPRIGHT },
+ { EL_STEELWALL_BOTTOMLEFT, EL_INVISIBLE_STEELWALL_BOTTOMLEFT },
+ { EL_STEELWALL_BOTTOMRIGHT, EL_INVISIBLE_STEELWALL_BOTTOMRIGHT },
+ { EL_STEELWALL_VERTICAL, EL_INVISIBLE_STEELWALL_VERTICAL },
+ { EL_STEELWALL_HORIZONTAL, EL_INVISIBLE_STEELWALL_HORIZONTAL },
+ { EL_STEELWALL, EL_INVISIBLE_STEELWALL },
+ { EL_EMPTY, EL_EMPTY }
+ };
+ int steel_type = (BorderElement == EL_STEELWALL ? 0 : 1);
+ int steel_position = (ex == -1 && ey == -1 ? 0 :
+ ex == +1 && ey == -1 ? 1 :
+ ex == -1 && ey == +1 ? 2 :
+ ex == +1 && ey == +1 ? 3 :
+ ex == -1 || ex == +1 ? 4 :
+ ey == -1 || ey == +1 ? 5 : 7);
+ int element = border[steel_position][steel_type];
+
+ DrawMiniGraphic(sx, sy, el2edimg(element));
+}
+
void getMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y)
{
Bitmap *src_bitmap = graphic_info[graphic].bitmap;
void DrawMiniElement(int, int, int);
void DrawMiniElementOrWall(int, int, int, int);
+void DrawEnvelopeBorder(int, int, int, int);
void getMicroGraphicSource(int, Bitmap **, int *, int *);
void DrawMicroElement(int, int, int);