From 440467ea3e9ed8e12589fd0a17a839c76d23b107 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 26 Feb 2017 13:39:25 -0500 Subject: [PATCH] Started communicating which copy is being requested. --- Machines/Atari2600/TIA.cpp | 16 ++++++++++------ Machines/Atari2600/TIA.hpp | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Machines/Atari2600/TIA.cpp b/Machines/Atari2600/TIA.cpp index 9e56cbd68..262201d55 100644 --- a/Machines/Atari2600/TIA.cpp +++ b/Machines/Atari2600/TIA.cpp @@ -381,7 +381,7 @@ void TIA::set_ball_position() ball_.position = 0; // setting the ball position also triggers a draw - ball_.reset_pixels(); + ball_.reset_pixels(0); } void TIA::set_ball_motion(uint8_t motion) @@ -638,10 +638,10 @@ template void TIA::perform_motion_step(T &object) object.is_moving = false; else { - if(object.position == 159) object.reset_pixels(); - else if(object.position == 15 && object.copy_flags&1) object.reset_pixels(); - else if(object.position == 31 && object.copy_flags&2) object.reset_pixels(); - else if(object.position == 63 && object.copy_flags&4) object.reset_pixels(); + if(object.position == 159) object.reset_pixels(0); + else if(object.position == 15 && object.copy_flags&1) object.reset_pixels(1); + else if(object.position == 31 && object.copy_flags&2) object.reset_pixels(2); + else if(object.position == 63 && object.copy_flags&4) object.reset_pixels(3); else object.skip_pixels(1); object.position = (object.position + 1) % 160; object.motion_step --; @@ -701,17 +701,21 @@ template void TIA::draw_object_visible(T &object, const uint8_t collisi // is the next event a graphics trigger? int next_copy = 160; + int next_copy_id = 0; if(object.copy_flags) { if(object.position < 16 && object.copy_flags&1) { next_copy = 16; + next_copy_id = 1; } else if(object.position < 32 && object.copy_flags&2) { next_copy = 32; + next_copy_id = 2; } else if(object.position < 64 && object.copy_flags&4) { next_copy = 64; + next_copy_id = 3; } } @@ -755,7 +759,7 @@ template void TIA::draw_object_visible(T &object, const uint8_t collisi // if it's a draw trigger, trigger a draw else if(start == next_copy_time) { - object.reset_pixels(); + object.reset_pixels(next_copy_id); } } } diff --git a/Machines/Atari2600/TIA.hpp b/Machines/Atari2600/TIA.hpp index b8cf5cf76..90148258d 100644 --- a/Machines/Atari2600/TIA.hpp +++ b/Machines/Atari2600/TIA.hpp @@ -166,7 +166,7 @@ class TIA { pixel_position = std::min(32, pixel_position + count * adder); } - inline void reset_pixels() + inline void reset_pixels(int copy) { pixel_position = 0; } @@ -245,7 +245,7 @@ class TIA { pixel_position = std::max(0, pixel_position - count); } - inline void reset_pixels() + inline void reset_pixels(int copy) { pixel_position = size; }