+#if USE_NEW_PLAYER_ASSIGNMENTS
+ /* !!! SAME AS init.c:InitPlayerInfo() -- FIX THIS !!! */
+ /* choose default local player */
+ local_player = &stored_player[0];
+
+ for (i = 0; i < MAX_PLAYERS; i++)
+ stored_player[i].connected = FALSE;
+
+ local_player->connected = TRUE;
+ /* !!! SAME AS init.c:InitPlayerInfo() -- FIX THIS !!! */
+
+ if (tape.playing)
+ {
+ /* try to guess locally connected team mode players (needed for correct
+ assignment of player figures from level to locally playing players) */
+
+ for (i = 0; i < MAX_PLAYERS; i++)
+ if (tape.player_participates[i])
+ stored_player[i].connected = TRUE;
+ }
+ else if (setup.team_mode && !options.network)
+ {
+ /* try to guess locally connected team mode players (needed for correct
+ assignment of player figures from level to locally playing players) */
+
+ for (i = 0; i < MAX_PLAYERS; i++)
+ if (setup.input[i].use_joystick ||
+ setup.input[i].key.left != KSYM_UNDEFINED)
+ stored_player[i].connected = TRUE;
+ }
+
+#if 0
+ for (i = 0; i < MAX_PLAYERS; i++)
+ printf("::: player %d: %s\n", i,
+ (stored_player[i].connected ? "connected" : "not connected"));
+
+ for (i = 0; i < MAX_PLAYERS; i++)
+ printf("::: player %d: %s\n", i,
+ (stored_player[i].present ? "present" : "not present"));
+#endif
+
+ /* check if any connected player was not found in playfield */
+ for (i = 0; i < MAX_PLAYERS; i++)
+ {
+ struct PlayerInfo *player = &stored_player[i];
+
+ if (player->connected && !player->present)
+ {
+ struct PlayerInfo *field_player = NULL;
+
+#if 0
+ printf("::: looking for field player for player %d ...\n", i);
+#endif
+
+ /* assign first free player found that is present in the playfield */
+
+ /* first try: look for unmapped playfield player that is not connected */
+ if (field_player == NULL)
+ for (j = 0; j < MAX_PLAYERS; j++)
+ if (stored_player[j].present &&
+ !stored_player[j].mapped &&
+ !stored_player[j].connected)
+ field_player = &stored_player[j];
+
+ /* second try: look for *any* unmapped playfield player */
+ if (field_player == NULL)
+ for (j = 0; j < MAX_PLAYERS; j++)
+ if (stored_player[j].present &&
+ !stored_player[j].mapped)
+ field_player = &stored_player[j];
+
+ if (field_player != NULL)
+ {
+ int jx = field_player->jx, jy = field_player->jy;
+
+#if 0
+ printf("::: found player figure %d\n", field_player->index_nr);
+#endif
+
+ player->present = FALSE;
+ player->active = FALSE;
+
+ field_player->present = TRUE;
+ field_player->active = TRUE;
+
+ /*
+ player->initial_element = field_player->initial_element;
+ player->artwork_element = field_player->artwork_element;
+
+ player->block_last_field = field_player->block_last_field;
+ player->block_delay_adjustment = field_player->block_delay_adjustment;
+ */
+
+ StorePlayer[jx][jy] = field_player->element_nr;
+
+ field_player->jx = field_player->last_jx = jx;
+ field_player->jy = field_player->last_jy = jy;
+
+ if (local_player == player)
+ local_player = field_player;
+
+ map_player_action[field_player->index_nr] = i;
+
+ field_player->mapped = TRUE;
+
+#if 0
+ printf("::: map_player_action[%d] == %d\n",
+ field_player->index_nr, i);
+#endif
+ }
+ }
+
+ if (player->connected && player->present)
+ player->mapped = TRUE;
+ }
+
+#else
+