#define GADGET_ID_SELECTBOX_FIRST (GADGET_ID_TEXT_AREA_FIRST + 1)
#define GADGET_ID_TIME_OR_STEPS (GADGET_ID_SELECTBOX_FIRST + 0)
-#define GADGET_ID_CUSTOM_WALK_TO_ACTION (GADGET_ID_SELECTBOX_FIRST + 1)
-#define GADGET_ID_CUSTOM_EXPLOSION_TYPE (GADGET_ID_SELECTBOX_FIRST + 2)
-#define GADGET_ID_CUSTOM_DEADLINESS (GADGET_ID_SELECTBOX_FIRST + 3)
-#define GADGET_ID_CUSTOM_MOVE_PATTERN (GADGET_ID_SELECTBOX_FIRST + 4)
-#define GADGET_ID_CUSTOM_MOVE_DIRECTION (GADGET_ID_SELECTBOX_FIRST + 5)
-#define GADGET_ID_CUSTOM_MOVE_STEPSIZE (GADGET_ID_SELECTBOX_FIRST + 6)
-#define GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE (GADGET_ID_SELECTBOX_FIRST + 7)
-#define GADGET_ID_CUSTOM_SMASH_TARGETS (GADGET_ID_SELECTBOX_FIRST + 8)
-#define GADGET_ID_CUSTOM_SLIPPERY_TYPE (GADGET_ID_SELECTBOX_FIRST + 9)
-#define GADGET_ID_CUSTOM_ACCESS_TYPE (GADGET_ID_SELECTBOX_FIRST + 10)
-#define GADGET_ID_CUSTOM_ACCESS_LAYER (GADGET_ID_SELECTBOX_FIRST + 11)
-#define GADGET_ID_CUSTOM_ACCESS_PROTECTED (GADGET_ID_SELECTBOX_FIRST + 12)
-#define GADGET_ID_CUSTOM_ACCESS_DIRECTION (GADGET_ID_SELECTBOX_FIRST + 13)
-#define GADGET_ID_CHANGE_TIME_UNITS (GADGET_ID_SELECTBOX_FIRST + 14)
-#define GADGET_ID_CHANGE_DIRECT_ACTION (GADGET_ID_SELECTBOX_FIRST + 15)
-#define GADGET_ID_CHANGE_OTHER_ACTION (GADGET_ID_SELECTBOX_FIRST + 16)
-#define GADGET_ID_CHANGE_SIDE (GADGET_ID_SELECTBOX_FIRST + 17)
-#define GADGET_ID_CHANGE_PLAYER (GADGET_ID_SELECTBOX_FIRST + 18)
-#define GADGET_ID_CHANGE_PAGE (GADGET_ID_SELECTBOX_FIRST + 19)
-#define GADGET_ID_CHANGE_REPLACE_WHEN (GADGET_ID_SELECTBOX_FIRST + 20)
-#define GADGET_ID_SELECT_CHANGE_PAGE (GADGET_ID_SELECTBOX_FIRST + 21)
-#define GADGET_ID_GROUP_CHOICE_MODE (GADGET_ID_SELECTBOX_FIRST + 22)
+#define GADGET_ID_GAME_ENGINE_TYPE (GADGET_ID_SELECTBOX_FIRST + 1)
+#define GADGET_ID_CUSTOM_WALK_TO_ACTION (GADGET_ID_SELECTBOX_FIRST + 2)
+#define GADGET_ID_CUSTOM_EXPLOSION_TYPE (GADGET_ID_SELECTBOX_FIRST + 3)
+#define GADGET_ID_CUSTOM_DEADLINESS (GADGET_ID_SELECTBOX_FIRST + 4)
+#define GADGET_ID_CUSTOM_MOVE_PATTERN (GADGET_ID_SELECTBOX_FIRST + 5)
+#define GADGET_ID_CUSTOM_MOVE_DIRECTION (GADGET_ID_SELECTBOX_FIRST + 6)
+#define GADGET_ID_CUSTOM_MOVE_STEPSIZE (GADGET_ID_SELECTBOX_FIRST + 7)
+#define GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE (GADGET_ID_SELECTBOX_FIRST + 8)
+#define GADGET_ID_CUSTOM_SMASH_TARGETS (GADGET_ID_SELECTBOX_FIRST + 9)
+#define GADGET_ID_CUSTOM_SLIPPERY_TYPE (GADGET_ID_SELECTBOX_FIRST + 10)
+#define GADGET_ID_CUSTOM_ACCESS_TYPE (GADGET_ID_SELECTBOX_FIRST + 11)
+#define GADGET_ID_CUSTOM_ACCESS_LAYER (GADGET_ID_SELECTBOX_FIRST + 12)
+#define GADGET_ID_CUSTOM_ACCESS_PROTECTED (GADGET_ID_SELECTBOX_FIRST + 13)
+#define GADGET_ID_CUSTOM_ACCESS_DIRECTION (GADGET_ID_SELECTBOX_FIRST + 14)
+#define GADGET_ID_CHANGE_TIME_UNITS (GADGET_ID_SELECTBOX_FIRST + 15)
+#define GADGET_ID_CHANGE_DIRECT_ACTION (GADGET_ID_SELECTBOX_FIRST + 16)
+#define GADGET_ID_CHANGE_OTHER_ACTION (GADGET_ID_SELECTBOX_FIRST + 17)
+#define GADGET_ID_CHANGE_SIDE (GADGET_ID_SELECTBOX_FIRST + 18)
+#define GADGET_ID_CHANGE_PLAYER (GADGET_ID_SELECTBOX_FIRST + 19)
+#define GADGET_ID_CHANGE_PAGE (GADGET_ID_SELECTBOX_FIRST + 20)
+#define GADGET_ID_CHANGE_REPLACE_WHEN (GADGET_ID_SELECTBOX_FIRST + 21)
+#define GADGET_ID_SELECT_CHANGE_PAGE (GADGET_ID_SELECTBOX_FIRST + 22)
+#define GADGET_ID_GROUP_CHOICE_MODE (GADGET_ID_SELECTBOX_FIRST + 23)
/* textbutton identifiers */
-#define GADGET_ID_TEXTBUTTON_FIRST (GADGET_ID_SELECTBOX_FIRST + 23)
+#define GADGET_ID_TEXTBUTTON_FIRST (GADGET_ID_SELECTBOX_FIRST + 24)
#define GADGET_ID_PROPERTIES_INFO (GADGET_ID_TEXTBUTTON_FIRST + 0)
#define GADGET_ID_PROPERTIES_CONFIG (GADGET_ID_TEXTBUTTON_FIRST + 1)
/* values for selectbox gadgets */
#define ED_SELECTBOX_ID_TIME_OR_STEPS 0
-#define ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE 1
-#define ED_SELECTBOX_ID_CUSTOM_ACCESS_LAYER 2
-#define ED_SELECTBOX_ID_CUSTOM_ACCESS_PROTECTED 3
-#define ED_SELECTBOX_ID_CUSTOM_ACCESS_DIRECTION 4
-#define ED_SELECTBOX_ID_CUSTOM_WALK_TO_ACTION 5
-#define ED_SELECTBOX_ID_CUSTOM_MOVE_PATTERN 6
-#define ED_SELECTBOX_ID_CUSTOM_MOVE_DIRECTION 7
-#define ED_SELECTBOX_ID_CUSTOM_MOVE_STEPSIZE 8
-#define ED_SELECTBOX_ID_CUSTOM_MOVE_LEAVE_TYPE 9
-#define ED_SELECTBOX_ID_CUSTOM_SMASH_TARGETS 10
-#define ED_SELECTBOX_ID_CUSTOM_SLIPPERY_TYPE 11
-#define ED_SELECTBOX_ID_CUSTOM_DEADLINESS 12
-#define ED_SELECTBOX_ID_CUSTOM_EXPLOSION_TYPE 13
-#define ED_SELECTBOX_ID_CHANGE_TIME_UNITS 14
-#define ED_SELECTBOX_ID_CHANGE_DIRECT_ACTION 15
-#define ED_SELECTBOX_ID_CHANGE_OTHER_ACTION 16
-#define ED_SELECTBOX_ID_CHANGE_SIDE 17
-#define ED_SELECTBOX_ID_CHANGE_PLAYER 18
-#define ED_SELECTBOX_ID_CHANGE_PAGE 19
-#define ED_SELECTBOX_ID_CHANGE_REPLACE_WHEN 20
-#define ED_SELECTBOX_ID_SELECT_CHANGE_PAGE 21
-#define ED_SELECTBOX_ID_GROUP_CHOICE_MODE 22
-
-#define ED_NUM_SELECTBOX 23
+#define ED_SELECTBOX_ID_GAME_ENGINE_TYPE 1
+#define ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE 2
+#define ED_SELECTBOX_ID_CUSTOM_ACCESS_LAYER 3
+#define ED_SELECTBOX_ID_CUSTOM_ACCESS_PROTECTED 4
+#define ED_SELECTBOX_ID_CUSTOM_ACCESS_DIRECTION 5
+#define ED_SELECTBOX_ID_CUSTOM_WALK_TO_ACTION 6
+#define ED_SELECTBOX_ID_CUSTOM_MOVE_PATTERN 7
+#define ED_SELECTBOX_ID_CUSTOM_MOVE_DIRECTION 8
+#define ED_SELECTBOX_ID_CUSTOM_MOVE_STEPSIZE 9
+#define ED_SELECTBOX_ID_CUSTOM_MOVE_LEAVE_TYPE 10
+#define ED_SELECTBOX_ID_CUSTOM_SMASH_TARGETS 11
+#define ED_SELECTBOX_ID_CUSTOM_SLIPPERY_TYPE 12
+#define ED_SELECTBOX_ID_CUSTOM_DEADLINESS 13
+#define ED_SELECTBOX_ID_CUSTOM_EXPLOSION_TYPE 14
+#define ED_SELECTBOX_ID_CHANGE_TIME_UNITS 15
+#define ED_SELECTBOX_ID_CHANGE_DIRECT_ACTION 16
+#define ED_SELECTBOX_ID_CHANGE_OTHER_ACTION 17
+#define ED_SELECTBOX_ID_CHANGE_SIDE 18
+#define ED_SELECTBOX_ID_CHANGE_PLAYER 19
+#define ED_SELECTBOX_ID_CHANGE_PAGE 20
+#define ED_SELECTBOX_ID_CHANGE_REPLACE_WHEN 21
+#define ED_SELECTBOX_ID_SELECT_CHANGE_PAGE 22
+#define ED_SELECTBOX_ID_GROUP_CHOICE_MODE 23
+
+#define ED_NUM_SELECTBOX 24
#define ED_SELECTBOX_ID_LEVEL_FIRST ED_SELECTBOX_ID_TIME_OR_STEPS
-#define ED_SELECTBOX_ID_LEVEL_LAST ED_SELECTBOX_ID_TIME_OR_STEPS
+#define ED_SELECTBOX_ID_LEVEL_LAST ED_SELECTBOX_ID_GAME_ENGINE_TYPE
#define ED_SELECTBOX_ID_CUSTOM1_FIRST ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE
#define ED_SELECTBOX_ID_CUSTOM1_LAST ED_SELECTBOX_ID_CUSTOM_WALK_TO_ACTION
{ -1, NULL }
};
+static struct ValueTextInfo options_game_engine_type[] =
+{
+ { GAME_ENGINE_TYPE_RND, "RND" },
+ { GAME_ENGINE_TYPE_EM, "EM" },
+
+ { -1, NULL }
+};
+
static struct ValueTextInfo options_access_type[] =
{
{ EP_WALKABLE, "walkable" },
&level.use_step_counter,
NULL, "(0 => no limit)", "time or step limit"
},
+ {
+ ED_SETTINGS_XPOS(0), ED_COUNTER_YPOS(6) + 8,
+ GADGET_ID_GAME_ENGINE_TYPE, GADGET_ID_NONE,
+ -1,
+ options_game_engine_type,
+ &level.game_engine_type,
+ "game engine:", NULL, "game engine"
+ },
/* ---------- element settings: configure 1 (custom elements) ----------- */
ED_SETTINGS_XPOS(0), ED_SETTINGS_YPOS(1),
GADGET_ID_CUSTOM_USE_GRAPHIC, GADGET_ID_NONE,
&custom_element.use_gfx_element,
+
+ /* !!! add separate "use existing element sound" !!! */
#if 0
NULL, "use graphic/sound of element:", "use existing graphic and sound"
#else
#define CHUNK_SIZE_NONE -1 /* do not write chunk size */
#define FILE_VERS_CHUNK_SIZE 8 /* size of file version chunk */
#define LEVEL_HEADER_SIZE 80 /* size of level file header */
-#define LEVEL_HEADER_UNUSED 1 /* unused level header bytes */
+#define LEVEL_HEADER_UNUSED 0 /* unused level header bytes */
#define LEVEL_CHUNK_CNT2_SIZE 160 /* size of level CNT2 chunk */
#define LEVEL_CHUNK_CNT2_UNUSED 11 /* unused CNT2 chunk bytes */
#define LEVEL_CHUNK_CNT3_HEADER 16 /* size of level CNT3 header */
int i, j, x, y;
+ level->game_engine_type = GAME_ENGINE_TYPE_RND;
+
level->file_version = FILE_VERSION_ACTUAL;
level->game_version = GAME_VERSION_ACTUAL;
level->can_pass_to_walkable = (getFile8Bit(file) == 1 ? TRUE : FALSE);
level->grow_into_diggable = (getFile8Bit(file) == 1 ? TRUE : FALSE);
+ level->game_engine_type = getFile8Bit(file);
+
ReadUnusedBytesFromFile(file, LEVEL_HEADER_UNUSED);
return chunk_size;
case LEVEL_FILE_TYPE_EM:
LoadLevelFromFileInfo_EM(level, level_file_info);
+ level->game_engine_type = GAME_ENGINE_TYPE_EM;
break;
case LEVEL_FILE_TYPE_SP:
LoadLevelFromFileInfo_RND(level, level_file_info);
break;
}
+
+ if (level->game_engine_type == GAME_ENGINE_TYPE_UNKNOWN)
+ level->game_engine_type = GAME_ENGINE_TYPE_RND;
}
void LoadLevelFromFilename(struct LevelInfo *level, char *filename)
putFile8Bit(file, (level->can_pass_to_walkable ? 1 : 0));
putFile8Bit(file, (level->grow_into_diggable ? 1 : 0));
+ putFile8Bit(file, level->game_engine_type);
+
WriteUnusedBytesToFile(file, LEVEL_HEADER_UNUSED);
}
return;
/* !!! FIX THIS (START) !!! */
- if (level.file_info.type == LEVEL_FILE_TYPE_EM)
+ if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
{
+ byte *recorded_player_action;
byte summarized_player_action = 0;
+ byte tape_action[MAX_PLAYERS];
int i;
+ if (tape.pausing)
+ return;
+
+ recorded_player_action = (tape.playing ? TapePlayAction() : NULL);
+
for (i = 0; i < MAX_PLAYERS; i++)
+ {
summarized_player_action |= stored_player[i].action;
- if (em_main_handle_game(summarized_player_action) != 0)
+ if (!network_playing)
+ stored_player[i].effective_action = stored_player[i].action;
+ }
+
+ if (!options.network && !setup.team_mode)
+ local_player->effective_action = summarized_player_action;
+
+ if (recorded_player_action != NULL)
+ for (i = 0; i < MAX_PLAYERS; i++)
+ stored_player[i].effective_action = recorded_player_action[i];
+
+ for (i = 0; i < MAX_PLAYERS; i++)
+ {
+ tape_action[i] = stored_player[i].effective_action;
+
+ /* !!! (this does not happen in the EM engine) !!! */
+ if (tape.recording && tape_action[i] && !tape.player_participates[i])
+ tape.player_participates[i] = TRUE; /* player just appeared from CE */
+ }
+
+ /* only save actions from input devices, but not programmed actions */
+ if (tape.recording)
+ TapeRecordAction(tape_action);
+
+ if (em_main_handle_game(local_player->effective_action) != 0)
{
game_status = GAME_MODE_MAIN;
DrawMainMenu();
}
+
+ if (TimeFrames >= FRAMES_PER_SECOND)
+ {
+ TimeFrames = 0;
+ TapeTime++;
+
+ if (tape.recording || tape.playing)
+ DrawVideoDisplay(VIDEO_STATE_TIME_ON, TapeTime);
+ }
+
+ TimeFrames++;
+
+ BackToFront();
}
else
{