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:
parent
327c19a222
commit
8de6caf6ff
@ -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;
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user