mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-19 23:29:05 +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;
|
horizontal_blank_extend_ = true;
|
||||||
is_moving_[0] = is_moving_[1] = is_moving_[2] = is_moving_[3] = is_moving_[4] = 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()
|
void TIA::clear_motion()
|
||||||
@ -582,30 +583,34 @@ void TIA::draw_player(Player &player, CollisionType collision_identity, const in
|
|||||||
if(end < first_pixel) return;
|
if(end < first_pixel) return;
|
||||||
if(start < first_pixel) start = first_pixel;
|
if(start < first_pixel) start = first_pixel;
|
||||||
|
|
||||||
int length = end - start;
|
|
||||||
uint8_t &position = position_[position_identity];
|
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!
|
// quick hack!
|
||||||
if(is_moving_[position_identity])
|
if(is_moving)
|
||||||
{
|
|
||||||
int motion = motion_[position_identity] ^ 8;
|
|
||||||
position += motion;
|
|
||||||
is_moving_[position_identity] = false;
|
|
||||||
position = (position + 160)%160;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 terminus = std::min(160, trigger_position+8);
|
|
||||||
while(trigger_position < terminus)
|
|
||||||
{
|
{
|
||||||
collision_buffer_[trigger_position] |= (uint8_t)collision_identity;
|
position += (motion ^ 8);
|
||||||
trigger_position++;
|
is_moving_[position_identity] = false;
|
||||||
|
position = (position + 160)%160;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// 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 + 5 + start - first_pixel_cycle;
|
||||||
|
|
||||||
|
int terminus = std::min(160, trigger_position+8);
|
||||||
|
while(trigger_position < terminus)
|
||||||
|
{
|
||||||
|
collision_buffer_[trigger_position] |= (uint8_t)collision_identity;
|
||||||
|
trigger_position++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
// update position counter
|
// update position counter
|
||||||
position = (position + end - start) % 160;
|
position = (position + end - start) % 160;
|
||||||
|
@ -143,6 +143,7 @@ class TIA {
|
|||||||
|
|
||||||
// movement
|
// movement
|
||||||
bool horizontal_blank_extend_;
|
bool horizontal_blank_extend_;
|
||||||
|
int horizontal_move_start_time_;
|
||||||
uint8_t motion_[5];
|
uint8_t motion_[5];
|
||||||
uint8_t position_[5];
|
uint8_t position_[5];
|
||||||
bool is_moving_[5];
|
bool is_moving_[5];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user