X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=7e678bfbd4f063ea04e37486abb4c7143f408f2d;hb=e7f36cd97c8580345714b4a22d6b4ad291e50ed6;hp=9c152d05f7e91c9d9a370ebcf46bdbc769537397;hpb=3836649c663e70e503686c52c67f71d21c00bb84;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 9c152d05..7e678bfb 100644 --- a/src/game.c +++ b/src/game.c @@ -72,8 +72,13 @@ void InitGame() player->index_nr = i; player->element_nr = EL_SPIELER1 + i; + + player->present = FALSE; player->active = FALSE; + + /* player->local = FALSE; + */ player->score = 0; player->gems_still_needed = level.edelsteine; @@ -129,25 +134,17 @@ void InitGame() player->GameOver = FALSE; } + /* local_player->active = TRUE; local_player->local = TRUE; + */ network_player_action_received = FALSE; - - /* initial null action */ if (network_playing) SendToServer_MovePlayer(MV_NO_MOVING); - - - /* - printf("BLURB\n"); - */ - - - ZX = ZY = -1; MampferNr = 0; @@ -191,16 +188,30 @@ void InitGame() struct PlayerInfo *player = &stored_player[Feld[x][y] - EL_SPIELER1]; int jx = player->jx, jy = player->jy; - /* remove duplicate players */ + /* + player->active = TRUE; + */ + + player->present = TRUE; + if (player->connected) + { + player->active = TRUE; + + printf("Player %d activated.\n", player->element_nr); + printf("[Local player is %d and currently %s.]\n", + local_player->element_nr, + local_player->active ? "active" : "not active"); + } + + /* remove potentially duplicate players */ if (StorePlayer[jx][jy] == Feld[x][y]) StorePlayer[jx][jy] = 0; - player->active = TRUE; - StorePlayer[x][y] = Feld[x][y]; Feld[x][y] = EL_LEERRAUM; player->jx = player->last_jx = x; player->jy = player->last_jy = y; + break; } case EL_BADEWANNE: @@ -278,6 +289,52 @@ void InitGame() } } + /* check if any connected player was not found in playfield */ + for(i=0; iconnected && !player->present) + { + printf("Oops!\n"); + + + for(j=0; jjx, jy = some_player->jy; + + /* assign first free player found that is present in the playfield */ + if (some_player->present && !some_player->connected) + { + player->present = TRUE; + player->active = TRUE; + some_player->present = FALSE; + + StorePlayer[jx][jy] = player->element_nr; + player->jx = player->last_jx = jx; + player->jy = player->last_jy = jy; + + break; + } + } + } + } + + for(i=0; ipresent, + player->connected, + player->active); + if (local_player == player) + printf("Player %d is local player.\n", i+1); + } + + game_emulation = (emulate_bd ? EMU_BOULDERDASH : emulate_sb ? EMU_SOKOBAN : EMU_NONE); @@ -334,6 +391,12 @@ void InitGame() PlaySoundLoop(background_loop[level_nr % num_bg_loops]); XAutoRepeatOff(display); + + + for (i=0;i<4;i++) + printf("Spieler %d %saktiv.\n", + i+1, (stored_player[i].active ? "" : "nicht ")); + } void InitMovDir(int x, int y)