-#define COMPILE_DATE_STRING "[2006-02-22 23:30]"
+#define COMPILE_DATE_STRING "[2006-02-25 18:03]"
extern void SetBitmaps_EM(Bitmap **);
extern void UpdateEngineValues(int, int);
extern void DrawAllGameValues(int, int, int, int, int);
+
extern int getGameFrameDelay_EM(int);
-extern int getCenteredPlayer_EM();
+extern int getCenteredPlayerNr_EM();
+
extern void PlayLevelSound_EM(int, int, int, int);
extern void InitGraphicInfo_EM(void);
if (game_status == GAME_MODE_PLAYING)
{
- for (i = 0; i < MAX_PLAYERS; i++)
- if (key == KSYM_1 + i)
- game.centered_to_player_next = i;
+ if (key == KSYM_5)
+ game.centered_player_nr_next = -1;
+ else
+ for (i = 0; i < MAX_PLAYERS; i++)
+ if (key == KSYM_1 + i)
+ game.centered_player_nr_next = i;
}
HandleKeysSpecial(key);
game.envelope_active = FALSE;
- game.centered_to_player = game.centered_to_player_next = 0; /* player_1 */
+ game.centered_player_nr = game.centered_player_nr_next = -1; /* focus all */
for (i = 0; i < NUM_BELTS; i++)
{
InitField(jx, jy, FALSE);
}
+#if 1
+ /* only visually relocate centered player */
+ if (player->index_nr == game.centered_player_nr)
+ DrawRelocatePlayer(player, level.instant_relocation);
+#else
if (player == local_player) /* only visually relocate local player */
DrawRelocatePlayer(player, level.instant_relocation);
+#endif
TestIfPlayerTouchesBadThing(jx, jy);
TestIfPlayerTouchesCustomElement(jx, jy);
if (ScreenMovPos == 0) /* screen currently aligned at tile position */
{
- struct PlayerInfo *player = &stored_player[game.centered_to_player_next];
+ struct PlayerInfo *player;
+ int player_nr = game.centered_player_nr_next;
+
+ if (game.centered_player_nr_next == -1)
+ player_nr = local_player->index_nr;
+
+ player = &stored_player[player_nr];
if (!player->active)
- game.centered_to_player_next = game.centered_to_player;
+ game.centered_player_nr_next = game.centered_player_nr;
- if (game.centered_to_player != game.centered_to_player_next)
+ if (game.centered_player_nr != game.centered_player_nr_next)
{
DrawRelocatePlayer(player, setup.quick_switch);
- game.centered_to_player = game.centered_to_player_next;
+ game.centered_player_nr = game.centered_player_nr_next;
}
}
#endif
}
-#if 0
+#if 1
+ if (!options.network && game.centered_player_nr == -1 &&
+ !AllPlayersInSight(player, new_jx, new_jy))
+ return MP_NO_ACTION;
+#else
if (!options.network && !AllPlayersInSight(player, new_jx, new_jy))
return MP_NO_ACTION;
#endif
#if 1
if (moved & MP_MOVING && !ScreenMovPos &&
- player->index_nr == game.centered_to_player)
+ (player->index_nr == game.centered_player_nr ||
+ game.centered_player_nr == -1))
#else
if (moved & MP_MOVING && !ScreenMovPos &&
(player == local_player || !options.network))
if (scroll_x != old_scroll_x || scroll_y != old_scroll_y)
{
-#if 0
+#if 1
+ if (!options.network && game.centered_player_nr == -1 &&
+ !AllPlayersInVisibleScreen())
+ {
+ scroll_x = old_scroll_x;
+ scroll_y = old_scroll_y;
+ }
+ else
+#else
if (!options.network && !AllPlayersInVisibleScreen())
{
scroll_x = old_scroll_x;
static boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
-static int centered_to_player;
+static int centered_player_nr;
/* copy the entire screen to the window at the scroll position
*
int dynamite_state = ply[0].dynamite; /* !!! ONLY PLAYER 1 !!! */
int all_keys_state = ply[0].keys | ply[1].keys | ply[2].keys | ply[3].keys;
#if 1
- int player_nr = getCenteredPlayer_EM();
+ int player_nr;
+#else
+#if 1
+ int player_nr = getCenteredPlayerNr_EM();
#else
int player_nr = 0; /* !!! FIX THIS (CENTERED TO PLAYER 1) !!! */
#endif
+#endif
+
+ centered_player_nr = getCenteredPlayerNr_EM();
- centered_to_player = player_nr;
+ player_nr = (centered_player_nr != -1 ? centered_player_nr : 0);
frame = 6;
#if 1
void RedrawPlayfield_EM(boolean force_redraw)
{
#if 1
- int player_nr = getCenteredPlayer_EM();
+ int centered_player_nr_next = getCenteredPlayerNr_EM();
+ int player_nr = (centered_player_nr_next != -1 ? centered_player_nr_next :0);
boolean draw_new_player_location = FALSE;
boolean quick_relocation = setup.quick_switch;
#else
if (!scrolling) /* screen currently aligned at tile position */
{
- if (player_nr != centered_to_player)
+ if (centered_player_nr != centered_player_nr_next)
{
- centered_to_player = player_nr;
+ centered_player_nr = centered_player_nr_next;
draw_new_player_location = TRUE;
force_redraw = TRUE;
/* ------------------------------------------------------------------------- */
-/* some functions to handle lists of level directories */
+/* some functions to handle lists of level and artwork directories */
/* ------------------------------------------------------------------------- */
TreeInfo *newTreeInfo()
return NULL;
}
+TreeInfo *cloneTreeNode(TreeInfo **node_top, TreeInfo *node_parent,
+ TreeInfo *node, boolean skip_sets_without_levels)
+{
+ TreeInfo *node_new;
+
+ if (node == NULL)
+ return NULL;
+
+ if (!node->parent_link && !node->level_group &&
+ skip_sets_without_levels && node->levels == 0)
+ return cloneTreeNode(node_top, node_parent, node->next,
+ skip_sets_without_levels);
+
+ node_new = newTreeInfo();
+
+ *node_new = *node; /* copy complete node */
+
+ node_new->node_top = node_top; /* correct top node link */
+ node_new->node_parent = node_parent; /* correct parent node link */
+
+ if (node->level_group)
+ node_new->node_group = cloneTreeNode(node_top, node_new, node->node_group,
+ skip_sets_without_levels);
+
+ node_new->next = cloneTreeNode(node_top, node_parent, node->next,
+ skip_sets_without_levels);
+
+ return node_new;
+}
+
+void cloneTree(TreeInfo **ti_new, TreeInfo *ti, boolean skip_empty_sets)
+{
+ TreeInfo *ti_cloned = cloneTreeNode(ti_new, NULL, ti, skip_empty_sets);
+
+ *ti_new = ti_cloned;
+}
+
void dumpTreeInfo(TreeInfo *node, int depth)
{
int i;
(leveldir_new->user_defined || !leveldir_new->handicap ?
leveldir_new->last_level : leveldir_new->first_level);
+#if 0
+ /* !!! don't skip sets without levels (else artwork base sets are missing) */
#if 1
if (leveldir_new->levels < 1 && !leveldir_new->level_group)
{
return FALSE;
}
+#endif
#endif
pushTreeInfo(node_first, leveldir_new);
LoadLevelInfoFromLevelDir(&leveldir_first, NULL, options.level_directory);
LoadLevelInfoFromLevelDir(&leveldir_first, NULL, getUserLevelDir(NULL));
+#if 1
+ leveldir_first_all = leveldir_first;
+ cloneTree(&leveldir_first, leveldir_first_all, TRUE);
+#endif
+
/* before sorting, the first entries will be from the user directory */
leveldir_current = getFirstValidTreeInfoEntry(leveldir_first);
{
DrawInitText("Looking for custom level artwork:", 120, FC_GREEN);
- LoadArtworkInfoFromLevelInfo(&artwork.gfx_first, leveldir_first);
- LoadArtworkInfoFromLevelInfo(&artwork.snd_first, leveldir_first);
- LoadArtworkInfoFromLevelInfo(&artwork.mus_first, leveldir_first);
+ LoadArtworkInfoFromLevelInfo(&artwork.gfx_first, leveldir_first_all);
+ LoadArtworkInfoFromLevelInfo(&artwork.snd_first, leveldir_first_all);
+ LoadArtworkInfoFromLevelInfo(&artwork.mus_first, leveldir_first_all);
/* needed for reloading level artwork not known at ealier stage */
struct JoystickInfo joystick;
struct SetupInfo setup;
+LevelDirTree *leveldir_first_all = NULL;
LevelDirTree *leveldir_first = NULL;
LevelDirTree *leveldir_current = NULL;
int level_nr;
extern struct JoystickInfo joystick;
extern struct SetupInfo setup;
+extern LevelDirTree *leveldir_first_all;
extern LevelDirTree *leveldir_first;
extern LevelDirTree *leveldir_current;
extern int level_nr;
boolean restart_level;
/* values for special game control */
- int centered_to_player;
- int centered_to_player_next;
+ int centered_player_nr;
+ int centered_player_nr_next;
};
struct GlobalInfo
return game_frame_delay_value;
}
-int getCenteredPlayer_EM()
+int getCenteredPlayerNr_EM()
{
- if (!native_em_level.ply[game.centered_to_player_next]->alive)
- game.centered_to_player_next = game.centered_to_player;
+ if (game.centered_player_nr_next >= 0 &&
+ !native_em_level.ply[game.centered_player_nr_next]->alive)
+ game.centered_player_nr_next = game.centered_player_nr;
- if (game.centered_to_player != game.centered_to_player_next)
- game.centered_to_player = game.centered_to_player_next;
+ if (game.centered_player_nr != game.centered_player_nr_next)
+ game.centered_player_nr = game.centered_player_nr_next;
- return game.centered_to_player;
+ return game.centered_player_nr;
}
unsigned int InitRND(long seed)