diff --git a/Machines/Atari2600/TIA.cpp b/Machines/Atari2600/TIA.cpp index 6cbaa663a..b653e8833 100644 --- a/Machines/Atari2600/TIA.cpp +++ b/Machines/Atari2600/TIA.cpp @@ -649,6 +649,11 @@ void TIA::draw_player_visible(Player &player, CollisionType collision_identity, next_event_time = next_motion_time; } + if(player.pixel_delay && start + player.pixel_delay < next_event_time) + { + next_event_time = start + player.pixel_delay; + } + // is the next event a graphics trigger? int next_copy = 160; if(player.graphic[player.graphic_index]) @@ -695,10 +700,17 @@ void TIA::draw_player_visible(Player &player, CollisionType collision_identity, next_motion_time += 4; } + // possibly it's a pixel delay + if(player.pixel_delay) + { + player.pixel_delay -= length; + if(!player.pixel_delay) player.pixel_position = 0; + } + // if it's a draw trigger, trigger a draw if(position == (next_copy % 160)) { - player.pixel_position = 0; + player.pixel_delay = 1; } } } diff --git a/Machines/Atari2600/TIA.hpp b/Machines/Atari2600/TIA.hpp index 903afdc53..02a2e3ab9 100644 --- a/Machines/Atari2600/TIA.hpp +++ b/Machines/Atari2600/TIA.hpp @@ -144,8 +144,9 @@ class TIA { int graphic_index; int pixel_position; + int pixel_delay; - Player() : size(0), copy_flags(0), graphic{0, 0}, reverse_mask(false), pixel_position(32), graphic_index(0) {} + Player() : size(0), copy_flags(0), graphic{0, 0}, reverse_mask(false), pixel_position(32), graphic_index(0), pixel_delay(0) {} } player_[2]; // missile state