X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgame.c;h=19fcafdd74fa3acdef0094efc3d36877daa621ec;hb=89ce36da9108b04faf263cd2624db2a2d9fc8f27;hp=9e4d2871e0752d6a6b2b0966c6295dd255f64467;hpb=d14ff3d04c44d90b4dc151fd7774946e20da0152;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 9e4d2871..19fcafdd 100644 --- a/src/game.c +++ b/src/game.c @@ -987,6 +987,10 @@ static void InitField(int x, int y, boolean init_game) MovDelay[x][y] = 96; break; + case EL_EM_DYNAMITE_ACTIVE: + MovDelay[x][y] = 32; + break; + case EL_LAMP: local_player->lights_still_needed++; break; @@ -1929,6 +1933,8 @@ void InitGame() game.envelope_active = FALSE; + game.centered_to_player = game.centered_to_player_next = 0; /* player_1 */ + for (i = 0; i < NUM_BELTS; i++) { game.belt_dir[i] = MV_NONE; @@ -3091,7 +3097,7 @@ void CheckDynamite(int x, int y) Bang(x, y); } -void DrawRelocatePlayer(struct PlayerInfo *player) +void DrawRelocatePlayer(struct PlayerInfo *player, boolean quick_relocation) { boolean ffwd_delay = (tape.playing && tape.fast_forward); boolean no_delay = (tape.warp_forward); @@ -3100,19 +3106,19 @@ void DrawRelocatePlayer(struct PlayerInfo *player) int jx = player->jx; int jy = player->jy; - if (level.instant_relocation) + if (quick_relocation) { int offset = (setup.scroll_delay ? 3 : 0); if (!IN_VIS_FIELD(SCREENX(jx), SCREENY(jy))) { - scroll_x = (local_player->jx < SBX_Left + MIDPOSX ? SBX_Left : - local_player->jx > SBX_Right + MIDPOSX ? SBX_Right : - local_player->jx - MIDPOSX); + scroll_x = (player->jx < SBX_Left + MIDPOSX ? SBX_Left : + player->jx > SBX_Right + MIDPOSX ? SBX_Right : + player->jx - MIDPOSX); - scroll_y = (local_player->jy < SBY_Upper + MIDPOSY ? SBY_Upper : - local_player->jy > SBY_Lower + MIDPOSY ? SBY_Lower : - local_player->jy - MIDPOSY); + scroll_y = (player->jy < SBY_Upper + MIDPOSY ? SBY_Upper : + player->jy > SBY_Lower + MIDPOSY ? SBY_Lower : + player->jy - MIDPOSY); } else { @@ -3146,13 +3152,13 @@ void DrawRelocatePlayer(struct PlayerInfo *player) int dx = 0, dy = 0; int fx = FX, fy = FY; - scroll_xx = (local_player->jx < SBX_Left + MIDPOSX ? SBX_Left : - local_player->jx > SBX_Right + MIDPOSX ? SBX_Right : - local_player->jx - MIDPOSX); + scroll_xx = (player->jx < SBX_Left + MIDPOSX ? SBX_Left : + player->jx > SBX_Right + MIDPOSX ? SBX_Right : + player->jx - MIDPOSX); - scroll_yy = (local_player->jy < SBY_Upper + MIDPOSY ? SBY_Upper : - local_player->jy > SBY_Lower + MIDPOSY ? SBY_Lower : - local_player->jy - MIDPOSY); + 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); @@ -3261,7 +3267,7 @@ void RelocatePlayer(int jx, int jy, int el_player_raw) } if (player == local_player) /* only visually relocate local player */ - DrawRelocatePlayer(player); + DrawRelocatePlayer(player, level.instant_relocation); TestIfPlayerTouchesBadThing(jx, jy); TestIfPlayerTouchesCustomElement(jx, jy); @@ -8803,6 +8809,21 @@ void GameActions() InitPlayfieldScanModeVars(); + if (ScreenMovPos == 0) /* screen currently aligned at tile position */ + { + struct PlayerInfo *player = &stored_player[game.centered_to_player_next]; + + if (!player->active) + game.centered_to_player_next = game.centered_to_player; + + if (game.centered_to_player != game.centered_to_player_next) + { + DrawRelocatePlayer(player, setup.quick_switch); + + game.centered_to_player = game.centered_to_player_next; + } + } + #if USE_ONE_MORE_CHANGE_PER_FRAME if (game.engine_version >= VERSION_IDENT(3,2,0,7)) { @@ -9631,8 +9652,10 @@ boolean MovePlayerOneStep(struct PlayerInfo *player, #endif } +#if 0 if (!options.network && !AllPlayersInSight(player, new_jx, new_jy)) return MP_NO_ACTION; +#endif #if !USE_FIXED_DONT_RUN_INTO element = MovingOrBlocked2ElementIfNotLeaving(new_jx, new_jy); @@ -9775,8 +9798,13 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) jx = player->jx; jy = player->jy; +#if 1 + if (moved & MP_MOVING && !ScreenMovPos && + player->index_nr == game.centered_to_player) +#else if (moved & MP_MOVING && !ScreenMovPos && (player == local_player || !options.network)) +#endif { int old_scroll_x = scroll_x, old_scroll_y = scroll_y; int offset = (setup.scroll_delay ? 3 : 0); @@ -9831,12 +9859,14 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) if (scroll_x != old_scroll_x || scroll_y != old_scroll_y) { +#if 0 if (!options.network && !AllPlayersInVisibleScreen()) { scroll_x = old_scroll_x; scroll_y = old_scroll_y; } else +#endif { ScrollScreen(player, SCROLL_INIT); ScrollLevel(old_scroll_x - scroll_x, old_scroll_y - scroll_y); @@ -11107,7 +11137,9 @@ int DigField(struct PlayerInfo *player, if (element == EL_SHIELD_DEADLY) player->shield_deadly_time_left += level.shield_deadly_time; } - else if (element == EL_DYNAMITE || element == EL_SP_DISK_RED) + else if (element == EL_DYNAMITE || + element == EL_EM_DYNAMITE || + element == EL_SP_DISK_RED) { if (player->inventory_size < MAX_INVENTORY_SIZE) player->inventory_element[player->inventory_size++] = element; @@ -11636,6 +11668,8 @@ boolean DropElement(struct PlayerInfo *player) if (new_element == EL_DYNAMITE) new_element = EL_DYNAMITE_ACTIVE; + else if (new_element == EL_EM_DYNAMITE) + new_element = EL_EM_DYNAMITE_ACTIVE; else if (new_element == EL_SP_DISK_RED) new_element = EL_SP_DISK_RED_ACTIVE; } @@ -11867,7 +11901,7 @@ void PlayLevelSound_EM(int x, int y, int element_em, int sample) break; case SAMPLE_slurp: - PlayLevelSoundElementAction(x, y, element, ACTION_SLURPING); + PlayLevelSoundElementAction(x, y, element, ACTION_EATING); break; case SAMPLE_eater: @@ -12029,6 +12063,7 @@ void RaiseScoreElement(int element) RaiseScore(level.score[SC_NUT]); break; case EL_DYNAMITE: + case EL_EM_DYNAMITE: case EL_SP_DISK_RED: case EL_DYNABOMB_INCREASE_NUMBER: case EL_DYNABOMB_INCREASE_SIZE: