1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Started trying to get into a proper structure here. Chickened out.

This commit is contained in:
Thomas Harte 2017-02-11 12:59:13 -05:00
parent 327c19a222
commit 8de6caf6ff
2 changed files with 26 additions and 20 deletions

View File

@ -353,6 +353,7 @@ void TIA::move()
{
horizontal_blank_extend_ = true;
is_moving_[0] = is_moving_[1] = is_moving_[2] = is_moving_[3] = is_moving_[4] = true;
horizontal_move_start_time_ = horizontal_counter_;
}
void TIA::clear_motion()
@ -582,14 +583,17 @@ void TIA::draw_player(Player &player, CollisionType collision_identity, const in
if(end < first_pixel) return;
if(start < first_pixel) start = first_pixel;
int length = end - start;
uint8_t &position = position_[position_identity];
uint8_t &motion = motion_[position_identity];
bool &is_moving = is_moving_[position_identity];
// while(start < end)
// {
int length = end - start;
// quick hack!
if(is_moving_[position_identity])
if(is_moving)
{
int motion = motion_[position_identity] ^ 8;
position += motion;
position += (motion ^ 8);
is_moving_[position_identity] = false;
position = (position + 160)%160;
}
@ -597,7 +601,7 @@ void TIA::draw_player(Player &player, CollisionType collision_identity, const in
// check for initial trigger; player.position is guaranteed to be less than 160 so this is easy
if(player.graphic && position + length >= 160)
{
int trigger_position = 160 - position + 6 + start - first_pixel_cycle;
int trigger_position = 160 - position + 5 + start - first_pixel_cycle;
int terminus = std::min(160, trigger_position+8);
while(trigger_position < terminus)
@ -606,6 +610,7 @@ void TIA::draw_player(Player &player, CollisionType collision_identity, const in
trigger_position++;
}
}
// }
// update position counter
position = (position + end - start) % 160;

View File

@ -143,6 +143,7 @@ class TIA {
// movement
bool horizontal_blank_extend_;
int horizontal_move_start_time_;
uint8_t motion_[5];
uint8_t position_[5];
bool is_moving_[5];