setup_editor_el_mirror_magic = FALSE;
setup_editor_el_deflektor = FALSE;
}
+ else if (level.game_engine_type == GAME_ENGINE_TYPE_BD)
+ {
+ setup_editor_el_emerald_mine = FALSE;
+ setup_editor_el_emerald_mine_club = FALSE;
+ setup_editor_el_more = FALSE;
+ setup_editor_el_sokoban = FALSE;
+ setup_editor_el_supaplex = FALSE;
+ setup_editor_el_diamond_caves = FALSE;
+ setup_editor_el_dx_boulderdash = FALSE;
+ setup_editor_el_mirror_magic = FALSE;
+ setup_editor_el_deflektor = FALSE;
+ setup_editor_el_chars = FALSE;
+ setup_editor_el_steel_chars = FALSE;
+
+ setup_editor_el_custom = FALSE;
+ }
else if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
{
setup_editor_el_boulderdash = FALSE;
lev_fieldx = level.fieldx = brush_width;
lev_fieldy = level.fieldy = brush_height;
+ boolean use_bd_engine = TRUE;
boolean use_em_engine = TRUE;
boolean use_sp_engine = TRUE;
boolean use_mm_engine = TRUE;
{
int element = Tile[x][y];
+ if (!IS_BD_ELEMENT(element) && !IS_PLAYER_ELEMENT(element))
+ use_bd_engine = FALSE;
+
if (!IS_EM_ELEMENT(element) && !IS_PLAYER_ELEMENT(element))
use_em_engine = FALSE;
}
}
- level.game_engine_type = (use_em_engine ? GAME_ENGINE_TYPE_EM :
+ level.game_engine_type = (use_bd_engine ? GAME_ENGINE_TYPE_BD :
+ use_em_engine ? GAME_ENGINE_TYPE_EM :
use_sp_engine ? GAME_ENGINE_TYPE_SP :
use_mm_engine ? GAME_ENGINE_TYPE_MM :
GAME_ENGINE_TYPE_RND);
}
+// ----------------------------------------------------------------------------
+// functions for loading BD level
+// ----------------------------------------------------------------------------
+
+static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
+{
+ struct LevelInfo_BD *level_bd = level->native_bd_level;
+
+ level_bd->width = MIN(level->fieldx, MAX_PLAYFIELD_WIDTH);
+ level_bd->height = MIN(level->fieldy, MAX_PLAYFIELD_HEIGHT);
+}
+
+static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
+{
+ struct LevelInfo_BD *level_bd = level->native_bd_level;
+
+ level->fieldx = MIN(level_bd->width, MAX_LEV_FIELDX);
+ level->fieldy = MIN(level_bd->height, MAX_LEV_FIELDY);
+}
+
+
// ----------------------------------------------------------------------------
// functions for loading EM level
// ----------------------------------------------------------------------------
void CopyNativeLevel_RND_to_Native(struct LevelInfo *level)
{
- if (level->game_engine_type == GAME_ENGINE_TYPE_EM)
+ if (level->game_engine_type == GAME_ENGINE_TYPE_BD)
+ CopyNativeLevel_RND_to_BD(level);
+ else if (level->game_engine_type == GAME_ENGINE_TYPE_EM)
CopyNativeLevel_RND_to_EM(level);
else if (level->game_engine_type == GAME_ENGINE_TYPE_SP)
CopyNativeLevel_RND_to_SP(level);
void CopyNativeLevel_Native_to_RND(struct LevelInfo *level)
{
- if (level->game_engine_type == GAME_ENGINE_TYPE_EM)
+ if (level->game_engine_type == GAME_ENGINE_TYPE_BD)
+ CopyNativeLevel_BD_to_RND(level);
+ else if (level->game_engine_type == GAME_ENGINE_TYPE_EM)
CopyNativeLevel_EM_to_RND(level);
else if (level->game_engine_type == GAME_ENGINE_TYPE_SP)
CopyNativeLevel_SP_to_RND(level);
// functions and definitions exported from game_bd to main program
// ============================================================================
+
// ----------------------------------------------------------------------------
// constant definitions
// ----------------------------------------------------------------------------
-// ...
+#define BD_MAX_CAVE_WIDTH MAX_PLAYFIELD_WIDTH
+#define BD_MAX_CAVE_HEIGHT MAX_PLAYFIELD_HEIGHT
// ----------------------------------------------------------------------------
struct GameInfo_BD
{
+ boolean level_solved;
+ boolean game_over;
+
+ // needed for updating panel
+ int time_played;
+ int gems_still_needed;
+ int score;
};
struct LevelInfo_BD
{
+ int width;
+ int height;
+
+ int cave[BD_MAX_CAVE_WIDTH][BD_MAX_CAVE_HEIGHT];
};
struct EngineSnapshotInfo_BD
#include <fcntl.h>
#include "libgame/libgame.h"
+#include "game_bd/game_bd.h"
#include "game_em/game_em.h"
#include "game_sp/game_sp.h"
#include "game_mm/game_mm.h"