X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=4bda5189bffd6a07b103a86bebc538edfbd6ad1c;hb=49c6dea89a293093a952b991594980b469dd835a;hp=9c0dcf992585522a1a3ea9a5597aa1f1d98d0788;hpb=24134e1e4ef7e3d582ac4827eb8740261bf5d1b6;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 9c0dcf99..4bda5189 100644 --- a/src/game.c +++ b/src/game.c @@ -39,6 +39,7 @@ #define USE_FIXED_DONT_RUN_INTO (USE_NEW_STUFF * 1) #define USE_NEW_SPRING_BUMPER (USE_NEW_STUFF * 1) #define USE_STOP_CHANGED_ELEMENTS (USE_NEW_STUFF * 1) +#define USE_ELEMENT_TOUCHING_BUGFIX (USE_NEW_STUFF * 1) #define USE_QUICKSAND_IMPACT_BUGFIX (USE_NEW_STUFF * 0) @@ -986,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; @@ -1928,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; @@ -2656,6 +2663,13 @@ void GameWon() BackToFront(); +#if 0 + if (tape.playing) + printf("::: TAPE PLAYING -> DO NOT SAVE SCORE\n"); + else + printf("::: NO TAPE PLAYING -> SAVING SCORE\n"); +#endif + if (tape.playing) return; @@ -3083,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); @@ -3092,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 { @@ -3138,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); @@ -3253,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); @@ -7435,9 +7449,10 @@ static void WarnBuggyBase(int x, int y) for (i = 0; i < NUM_DIRECTIONS; i++) { - int xx = x + xy[i][0], yy = y + xy[i][1]; + int xx = x + xy[i][0]; + int yy = y + xy[i][1]; - if (IS_PLAYER(xx, yy)) + if (IN_LEV_FIELD(xx, yy) && IS_PLAYER(xx, yy)) { PlayLevelSound(x, y, SND_SP_BUGGY_BASE_ACTIVE); @@ -8794,6 +8809,18 @@ void GameActions() InitPlayfieldScanModeVars(); + if (ScreenMovPos == 0) /* screen currently aligned at tile position */ + { + if (game.centered_to_player != game.centered_to_player_next) + { + struct PlayerInfo *player = &stored_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)) { @@ -9622,8 +9649,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); @@ -9766,8 +9795,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); @@ -9822,12 +9856,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); @@ -10176,7 +10212,7 @@ void TestIfPlayerTouchesCustomElement(int x, int y) } } -#if 1 +#if USE_ELEMENT_TOUCHING_BUGFIX void TestIfElementTouchesCustomElement(int x, int y) { @@ -11098,7 +11134,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; @@ -11627,6 +11665,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; } @@ -11858,7 +11898,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: @@ -12020,6 +12060,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: