From e3ba9f0ec2ac08e89e06e2ad60dfa6659279a9a9 Mon Sep 17 00:00:00 2001 From: stephena Date: Fri, 20 Apr 2012 21:32:24 +0000 Subject: [PATCH] TIA objects and collisions are now toggle with the Alt-period keys, instead of having different keys to turn them on and off separately. This brings the functionality in line with the rest of the objects/ collision key-combos, which were also toggle-only. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2449 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- Changes.txt | 4 ++++ docs/index.html | 16 ++------------ src/emucore/Console.cxx | 32 ++++++++++++++-------------- src/emucore/Console.hxx | 8 +++---- src/emucore/EventHandler.cxx | 11 ++-------- src/emucore/TIA.cxx | 21 +++++++++++++++++- src/emucore/TIA.hxx | 41 ++++++++++++++++++++---------------- 7 files changed, 71 insertions(+), 62 deletions(-) diff --git a/Changes.txt b/Changes.txt index 388634bf2..3ed158917 100644 --- a/Changes.txt +++ b/Changes.txt @@ -36,6 +36,10 @@ - 'Juno First' ROMs now use an AtariVox/SaveKey when possible - 'Astroblast' ROMs now use the paddles by default + * Changed key-combo for enabling TIA objects and collisions to be + toggled on and off with the Alt-period and Shift-Alt-period (instead + of having two separate keys to turn them on and off). + * Updated included PNG library to latest stable version. -Have fun! diff --git a/docs/index.html b/docs/index.html index b49caa635..2a5e56092 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1419,28 +1419,16 @@ - Turn all TIA objects off + Toggle all TIA objects Alt + . Cmd + . - Turn all TIA objects on - Alt + / - Cmd + / - - - - Turn all TIA collisions off + Toggle all TIA collisions Shift-Alt + . Shift-Cmd + . - - - Turn all TIA collisions on - Shift-Alt + / - Shift-Cmd + / -

Other Keys (cannot be remapped, except those marked with '*')

diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 9c2a50ded..59e656929 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -894,6 +894,14 @@ void Console::toggleTIABit(TIABit bit, const string& bitname, bool show) const myOSystem->frameBuffer().showMessage(message); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Console::toggleBits() const +{ + bool enabled = myTIA->toggleBits(); + string message = string("TIA bits") + (enabled ? " enabled" : " disabled"); + myOSystem->frameBuffer().showMessage(message); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Console::toggleTIACollision(TIABit bit, const string& bitname, bool show) const { @@ -902,6 +910,14 @@ void Console::toggleTIACollision(TIABit bit, const string& bitname, bool show) c myOSystem->frameBuffer().showMessage(message); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Console::toggleCollisions() const +{ + bool enabled = myTIA->toggleCollisions(); + string message = string("TIA collisions") + (enabled ? " enabled" : " disabled"); + myOSystem->frameBuffer().showMessage(message); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Console::toggleHMOVE() const { @@ -911,22 +927,6 @@ void Console::toggleHMOVE() const myOSystem->frameBuffer().showMessage("HMOVE blanking disabled"); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Console::enableBits(bool enable) const -{ - myTIA->enableBits(enable); - string message = string("TIA bits") + (enable ? " enabled" : " disabled"); - myOSystem->frameBuffer().showMessage(message); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Console::enableCollisions(bool enable) const -{ - myTIA->enableCollisions(enable); - string message = string("TIA collisions") + (enable ? " enabled" : " disabled"); - myOSystem->frameBuffer().showMessage(message); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Console::toggleFixedColors() const { diff --git a/src/emucore/Console.hxx b/src/emucore/Console.hxx index 789b37a06..36e79d358 100644 --- a/src/emucore/Console.hxx +++ b/src/emucore/Console.hxx @@ -270,7 +270,7 @@ class Console : public Serializable void toggleBLBit() const { toggleTIABit(BLBit, "BL"); } void togglePFBit() const { toggleTIABit(PFBit, "PF"); } void toggleHMOVE() const; - void enableBits(bool enable) const; + void toggleBits() const; /** Toggles the TIA collisions specified in the method name. @@ -281,7 +281,7 @@ class Console : public Serializable void toggleM1Collision() const { toggleTIACollision(M1Bit, "M1"); } void toggleBLCollision() const { toggleTIACollision(BLBit, "BL"); } void togglePFCollision() const { toggleTIACollision(PFBit, "PF"); } - void enableCollisions(bool enable) const; + void toggleCollisions() const; /** Toggles the TIA 'fixed debug colors' mode. @@ -339,11 +339,11 @@ class Console : public Serializable System* mySystem; // Pointer to the Cartridge (the debugger needs it) - Cartridge *myCart; + Cartridge* myCart; // Pointer to the 6532 (aka RIOT) (the debugger needs it) // A RIOT of my own! (...with apologies to The Clash...) - M6532 *myRiot; + M6532* myRiot; // Pointer to CompuMate handler (only used in CompuMate ROMs) CompuMate* myCMHandler; diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 77d3fa873..ed89f64b3 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -434,16 +434,9 @@ void EventHandler::poll(uInt64 time) case KBDK_PERIOD: if(mod & KMOD_SHIFT) - myOSystem->console().enableCollisions(false); + myOSystem->console().toggleCollisions(); else - myOSystem->console().enableBits(false); - break; - - case KBDK_SLASH: - if(mod & KMOD_SHIFT) - myOSystem->console().enableCollisions(true); - else - myOSystem->console().enableBits(true); + myOSystem->console().toggleBits(); break; case KBDK_p: // Alt-p toggles phosphor effect diff --git a/src/emucore/TIA.cxx b/src/emucore/TIA.cxx index c4da90987..092dae397 100644 --- a/src/emucore/TIA.cxx +++ b/src/emucore/TIA.cxx @@ -54,7 +54,10 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings) myColorLossEnabled(false), myPartialFrameFlag(false), myAutoFrameEnabled(false), - myFrameCounter(0) + myFrameCounter(0), + myBitsEnabled(true), + myCollisionsEnabled(true) + { // Allocate buffers for two frame buffers myCurrentFrameBuffer = new uInt8[160 * 320]; @@ -701,6 +704,14 @@ bool TIA::toggleBit(TIABit b, uInt8 mode) return on; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool TIA::toggleBits() +{ + myBitsEnabled = !myBitsEnabled; + enableBits(myBitsEnabled); + return myBitsEnabled; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIA::enableCollisions(bool mode) { @@ -744,6 +755,14 @@ bool TIA::toggleCollision(TIABit b, uInt8 mode) return on; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool TIA::toggleCollisions() +{ + myCollisionsEnabled = !myCollisionsEnabled; + enableCollisions(myCollisionsEnabled); + return myCollisionsEnabled; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool TIA::toggleHMOVEBlank() { diff --git a/src/emucore/TIA.hxx b/src/emucore/TIA.hxx index 0ee3b0d50..b44da279b 100644 --- a/src/emucore/TIA.hxx +++ b/src/emucore/TIA.hxx @@ -270,16 +270,8 @@ class TIA : public Device bool scanlinePos(uInt16& x, uInt16& y) const; /** - Enables/disables all TIABit bits. Note that disabling a graphical - object also disables its collisions. - - @param mode Whether to enable or disable all bits - */ - void enableBits(bool mode); - - /** - Enables/disable/toggle the specified TIA bit. Note that disabling a - graphical object also disables its collisions. + Enables/disable/toggle the specified (or all) TIA bit(s). Note that + disabling a graphical object also disables its collisions. @param mode 1/0 indicates on/off, and values greater than 1 mean flip the bit from its current state @@ -287,16 +279,10 @@ class TIA : public Device @return Whether the bit was enabled or disabled */ bool toggleBit(TIABit b, uInt8 mode = 2); + bool toggleBits(); /** - Enables/disables all TIABit collisions. - - @param mode Whether to enable or disable all collisions - */ - void enableCollisions(bool mode); - - /** - Enables/disable/toggle the specified TIA bit collision. + Enables/disable/toggle the specified (or all) TIA bit collision(s). @param mode 1/0 indicates on/off, and values greater than 1 mean flip the collision from its current state @@ -304,6 +290,7 @@ class TIA : public Device @return Whether the collision was enabled or disabled */ bool toggleCollision(TIABit b, uInt8 mode = 2); + bool toggleCollisions(); /** Toggle the display of HMOVE blanks. @@ -342,6 +329,21 @@ class TIA : public Device #endif private: + /** + Enables/disables all TIABit bits. Note that disabling a graphical + object also disables its collisions. + + @param mode Whether to enable or disable all bits + */ + void enableBits(bool mode); + + /** + Enables/disables all TIABit collisions. + + @param mode Whether to enable or disable all collisions + */ + void enableCollisions(bool mode); + // Update the current frame buffer to the specified color clock void updateFrame(Int32 clock); @@ -615,6 +617,9 @@ class TIA : public Device // The framerate currently in use by the Console float myFramerate; + // Whether TIA bits/collisions are currently enabled/disabled + bool myBitsEnabled, myCollisionsEnabled; + private: // Copy constructor isn't supported by this class so make it private TIA(const TIA&);