From 36396b3d62d8b1e46e84c46d38902c5a8aadb95a Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 21 Feb 2017 20:45:20 -0500 Subject: [PATCH] Made a slightly better, albeit still inaccurate, version of missile-player lock.Enough for Combat to do reasonable things. --- Machines/Atari2600/TIA.cpp | 12 ++---------- Machines/Atari2600/TIA.hpp | 3 ++- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Machines/Atari2600/TIA.cpp b/Machines/Atari2600/TIA.cpp index badbe4aeb..34944e497 100644 --- a/Machines/Atari2600/TIA.cpp +++ b/Machines/Atari2600/TIA.cpp @@ -355,16 +355,8 @@ void TIA::set_missile_position_to_player(int missile, bool lock) { // TODO: implement this correctly; should be triggered by player counter hitting the appropriate point, and // use additional storage position for enabled - if(lock) - { - missile_[missile].enabled = false; - missile_[missile].position = player_[missile].position + 5; -// printf("%d", missile); - } - else - { - missile_[missile].enabled = true; - } + if(missile_[missile].locked_to_player && !lock) missile_[missile].position = player_[missile].position + 1 + 16/player_[missile].adder; + missile_[missile].locked_to_player = lock; } void TIA::set_missile_motion(int missile, uint8_t motion) diff --git a/Machines/Atari2600/TIA.hpp b/Machines/Atari2600/TIA.hpp index dcd3918b9..7ae5d428d 100644 --- a/Machines/Atari2600/TIA.hpp +++ b/Machines/Atari2600/TIA.hpp @@ -227,12 +227,13 @@ class TIA { // missile state struct Missile: public HorizontalRun { bool enabled; + bool locked_to_player; int copy_flags; inline void draw_pixels(uint8_t *const target, const int count, const uint8_t collision_identity) { if(!pixel_position) return; - if(enabled) + if(enabled && !locked_to_player) { HorizontalRun::draw_pixels(target, count, collision_identity); }