1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-06 01:28:57 +00:00

Started communicating which copy is being requested.

This commit is contained in:
Thomas Harte 2017-02-26 13:39:25 -05:00
parent 98376de9ad
commit 440467ea3e
2 changed files with 12 additions and 8 deletions

View File

@ -381,7 +381,7 @@ void TIA::set_ball_position()
ball_.position = 0; ball_.position = 0;
// setting the ball position also triggers a draw // setting the ball position also triggers a draw
ball_.reset_pixels(); ball_.reset_pixels(0);
} }
void TIA::set_ball_motion(uint8_t motion) void TIA::set_ball_motion(uint8_t motion)
@ -638,10 +638,10 @@ template<class T> void TIA::perform_motion_step(T &object)
object.is_moving = false; object.is_moving = false;
else else
{ {
if(object.position == 159) object.reset_pixels(); if(object.position == 159) object.reset_pixels(0);
else if(object.position == 15 && object.copy_flags&1) object.reset_pixels(); 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(); 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(); else if(object.position == 63 && object.copy_flags&4) object.reset_pixels(3);
else object.skip_pixels(1); else object.skip_pixels(1);
object.position = (object.position + 1) % 160; object.position = (object.position + 1) % 160;
object.motion_step --; object.motion_step --;
@ -701,17 +701,21 @@ template<class T> void TIA::draw_object_visible(T &object, const uint8_t collisi
// is the next event a graphics trigger? // is the next event a graphics trigger?
int next_copy = 160; int next_copy = 160;
int next_copy_id = 0;
if(object.copy_flags) if(object.copy_flags)
{ {
if(object.position < 16 && object.copy_flags&1) if(object.position < 16 && object.copy_flags&1)
{ {
next_copy = 16; next_copy = 16;
next_copy_id = 1;
} else if(object.position < 32 && object.copy_flags&2) } else if(object.position < 32 && object.copy_flags&2)
{ {
next_copy = 32; next_copy = 32;
next_copy_id = 2;
} else if(object.position < 64 && object.copy_flags&4) } else if(object.position < 64 && object.copy_flags&4)
{ {
next_copy = 64; next_copy = 64;
next_copy_id = 3;
} }
} }
@ -755,7 +759,7 @@ template<class T> void TIA::draw_object_visible(T &object, const uint8_t collisi
// if it's a draw trigger, trigger a draw // if it's a draw trigger, trigger a draw
else if(start == next_copy_time) else if(start == next_copy_time)
{ {
object.reset_pixels(); object.reset_pixels(next_copy_id);
} }
} }
} }

View File

@ -166,7 +166,7 @@ class TIA {
pixel_position = std::min(32, pixel_position + count * adder); pixel_position = std::min(32, pixel_position + count * adder);
} }
inline void reset_pixels() inline void reset_pixels(int copy)
{ {
pixel_position = 0; pixel_position = 0;
} }
@ -245,7 +245,7 @@ class TIA {
pixel_position = std::max(0, pixel_position - count); pixel_position = std::max(0, pixel_position - count);
} }
inline void reset_pixels() inline void reset_pixels(int copy)
{ {
pixel_position = size; pixel_position = size;
} }