X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=92a181bbc49ddeea03a43289e0991947c09a04dd;hb=f01bf775110c477482734c49edcc695c26d04800;hp=19fcafdd74fa3acdef0094efc3d36877daa621ec;hpb=89ce36da9108b04faf263cd2624db2a2d9fc8f27;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 19fcafdd..92a181bb 100644 --- a/src/game.c +++ b/src/game.c @@ -832,6 +832,9 @@ static void InitPlayerField(int x, int y, int element, boolean init_game) else { stored_player[0].use_murphy = TRUE; + + if (!level.use_artwork_element[0]) + stored_player[0].artwork_element = EL_SP_MURPHY; } Feld[x][y] = EL_PLAYER_1; @@ -1933,7 +1936,7 @@ void InitGame() 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++) { @@ -2099,7 +2102,7 @@ void InitGame() if (tape.playing) { - /* when playing a tape, eliminate all players which do not participate */ + /* when playing a tape, eliminate all players who do not participate */ for (i = 0; i < MAX_PLAYERS; i++) { @@ -3143,23 +3146,21 @@ void DrawRelocatePlayer(struct PlayerInfo *player, boolean quick_relocation) } else { - int scroll_xx = -999, scroll_yy = -999; + int scroll_xx = (player->jx < SBX_Left + MIDPOSX ? SBX_Left : + player->jx > SBX_Right + MIDPOSX ? SBX_Right : + player->jx - MIDPOSX); + + int scroll_yy = (player->jy < SBY_Upper + MIDPOSY ? SBY_Upper : + player->jy > SBY_Lower + MIDPOSY ? SBY_Lower : + player->jy - MIDPOSY); ScrollScreen(NULL, SCROLL_GO_ON); /* scroll last frame to full tile */ - while (scroll_xx != scroll_x || scroll_yy != scroll_y) + while (scroll_x != scroll_xx || scroll_y != scroll_yy) { int dx = 0, dy = 0; int fx = FX, fy = FY; - scroll_xx = (player->jx < SBX_Left + MIDPOSX ? SBX_Left : - player->jx > SBX_Right + MIDPOSX ? SBX_Right : - player->jx - MIDPOSX); - - scroll_yy = (player->jy < SBY_Upper + MIDPOSY ? SBY_Upper : - player->jy > SBY_Lower + MIDPOSY ? SBY_Lower : - player->jy - MIDPOSY); - dx = (scroll_xx < scroll_x ? +1 : scroll_xx > scroll_x ? -1 : 0); dy = (scroll_yy < scroll_y ? +1 : scroll_yy > scroll_y ? -1 : 0); @@ -3266,8 +3267,14 @@ void RelocatePlayer(int jx, int jy, int el_player_raw) 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); @@ -3524,6 +3531,11 @@ void Explode(int ex, int ey, int phase, int mode) Feld[x][y] = EL_EXPLOSION; GfxElement[x][y] = artwork_element; +#if 0 + printf(":: setting gfx(%d,%d) to %d ['%s']\n", + x, y, artwork_element, EL_NAME(artwork_element)); +#endif + ExplodePhase[x][y] = 1; ExplodeDelay[x][y] = last_phase; @@ -3558,6 +3570,11 @@ void Explode(int ex, int ey, int phase, int mode) #endif #if 1 +#if 1 + /* this can happen if the player leaves an explosion just in time */ + if (GfxElement[x][y] == EL_UNDEFINED) + GfxElement[x][y] = EL_EMPTY; +#else if (GfxElement[x][y] == EL_UNDEFINED) { printf("\n\n"); @@ -3567,6 +3584,8 @@ void Explode(int ex, int ey, int phase, int mode) GfxElement[x][y] = EL_EMPTY; } +#endif + #endif border_element = Store2[x][y]; @@ -8811,16 +8830,22 @@ void GameActions() 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; } } @@ -9652,7 +9677,11 @@ boolean MovePlayerOneStep(struct PlayerInfo *player, #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 @@ -9800,7 +9829,8 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) #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)) @@ -9859,7 +9889,15 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) 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;