#include <menuGBottom.h>
Inherits spriteManager.
Inheritance diagram for menuGBottom:
Public Member Functions | |
menuGBottom (u8 newScreen=0) | |
create the status screen and give it a screen to display on | |
virtual | ~menuGBottom () |
void | loadBackground () |
Load the background graphics into this screen. | |
virtual void | gameTick () |
'Tick' function for the status screen that redraws scores and animates pre-emptive Pickup spawning. | |
virtual void | activate () |
give this spriteManager control of its screen, and reset all Pickup spawning related variables | |
virtual void | deactivate () |
Put this spriteManager into a hibernation state so that tick events are no longer executed for it. | |
void | loadMenuSpriteSet (const unsigned short *p, const unsigned char *s) |
load the sprite data for the menu instructions | |
void | loadSpawnerSpriteSet (const unsigned short *p, const unsigned char *s) |
load the sprite data for the Pickup generator | |
void | loadPickupSpriteSet (const unsigned short *p, const unsigned char *s) |
load the sprite data for the Pickup icons | |
void | resetIdleTime (u8 spawnerNum) |
Reset the spawn counter for a pickupSpawner to a random number. | |
void | spawnPickup (u8 i) |
Pick a random Pickup icon to spawn and make it travel down whichever spawner tube is ready. | |
Public Attributes | |
gameManager * | gameTop |
spriteManager which handles the top screen during gameplay | |
spriteManager * | menuTop |
spriteManager which handles the top screen during frontend | |
menuBottom * | menuBase |
spriteManager which handles the bottom screen during frontend | |
bool | gameOver |
if true, we are in 'player wins' screen. | |
bool | gamePaused |
if true, stop executing the main loop for the game screen | |
s16 | spawnerCounters [3] |
countdown timers for Pickup spawners. Set to -1 to disable that spawner. | |
u8 | pickupsActive |
the number of Pickups that are in play | |
spriteObject * | continueMsg |
spriteObject * | quitMsg |
spriteObject * | spawnerSpriteL |
spriteObject * | spawnerSpriteR |
spriteSet | menuSprite |
spriteSet | spawnerSprite |
spriteSet | pickupSprite |
Static Public Attributes | |
static const u8 | _SPAWNERSPRITEMININDEX = 64 |
The minimum OAM index for Pickup icons, so that they are neatly sandwiched between the Pickup generator graphics. |
This spriteManager is non-interactive and serves only as a 'status' screen of sorts. It draws Player scores; the Pickup generator which acts as a forewarning to what will soon happen on the gameManager's screen; and if compiled in debug mode, debug messages. It is also responsible for handling game pausing, since the code to check a 'resume' key needs to be in a separate main loop than that of the game itself.
The main focus of this screen is the Pickup generator, drawn as a metallic cauldron-looking-thing with three tubes coming out of it. Pickups are spawned in the center of the cauldron and travel down the tubes, which correspond to the three Pickup spawners on the top screen. Once a Pickup moves off the screen, it will spawn on the top screen in the game proper. menuGBottom also handles msot of the logic for spawning Pickups on the gameManager screen.
Definition at line 52 of file menuGBottom.h.
menuGBottom::menuGBottom | ( | u8 | newScreen = 0 |
) |
create the status screen and give it a screen to display on
newScreen | the screen this spriteManager should handle. 1 is the top screen, 0 is the bottom. |
Definition at line 30 of file menuGBottom.cpp.
menuGBottom::~menuGBottom | ( | ) | [virtual] |
Definition at line 37 of file menuGBottom.cpp.
void menuGBottom::loadBackground | ( | ) |
Load the background graphics into this screen.
These graphics combine to form the Pickup generator in the center of the screen, and scoreboard at the bottom.
Definition at line 233 of file menuGBottom.cpp.
References _SPAWNERSPRITEMININDEX, macros::getPlayerName(), spriteObject::giveSprite(), spriteObject::makeStatic(), menuBase, menuBottom::player1id, menuBottom::player2id, menuBottom::playerNames, spriteManager::screen, spriteObject::setFlipped(), spriteObject::setFrame(), spriteObject::setLayer(), spriteObject::setPallete(), spriteObject::setPos(), spriteObject::setTransparency(), menuBottom::showPickups, spawnerSprite, spawnerSpriteL, spawnerSpriteR, and spriteObject::updateSprite().
Referenced by activate().
Here is the call graph for this function:
void menuGBottom::gameTick | ( | ) | [virtual] |
'Tick' function for the status screen that redraws scores and animates pre-emptive Pickup spawning.
It also handles the 'game over' screen and pausing of the game.
Reimplemented from spriteManager.
Definition at line 46 of file menuGBottom.cpp.
References menuBottom::activate(), spriteManager::activate(), gameManager::allowPickupSpawning(), continueMsg, deactivate(), gameManager::deactivate(), spriteObject::destroy(), gameOver, gamePaused, spriteManager::gameTick(), gameTop, macros::getPlayerName(), spriteObject::giveSprite(), spriteObject::makeStatic(), menuBase, menuSprite, menuTop, menuBottom::numPickups, gameManager::p1score, gameManager::p2score, gameManager::pickupMask, pickupsActive, gameManager::pickupSpawners, gameManager::player1, menuBottom::player1id, gameManager::player2, menuBottom::player2id, menuBottom::playerNames, gameManager::pointsToWin, quitMsg, spriteManager::screen, spriteObject::setFrame(), spriteObject::setLayer(), spriteObject::setPallete(), spawnerCounters, spawnPickup(), and gameManager::statTimerID.
Referenced by main().
Here is the call graph for this function:
virtual void menuGBottom::activate | ( | ) | [inline, virtual] |
give this spriteManager control of its screen, and reset all Pickup spawning related variables
Reimplemented from spriteManager.
Definition at line 65 of file menuGBottom.h.
References spriteManager::activate(), continueMsg, gameOver, gamePaused, loadBackground(), loadMenuSpriteSet(), loadPickupSpriteSet(), loadSpawnerSpriteSet(), menuSprite, pickupsActive, pickupSprite, quitMsg, resetIdleTime(), spriteManager::resetText(), spawnerCounters, and spawnerSprite.
Here is the call graph for this function:
virtual void menuGBottom::deactivate | ( | ) | [inline, virtual] |
Put this spriteManager into a hibernation state so that tick events are no longer executed for it.
Reimplemented from spriteManager.
Definition at line 90 of file menuGBottom.h.
References spriteManager::deactivate(), gameOver, spawnerCounters, and spriteManager::unloadBackground().
Referenced by gameTick().
Here is the call graph for this function:
void menuGBottom::loadMenuSpriteSet | ( | const unsigned short * | p, | |
const unsigned char * | s | |||
) |
load the sprite data for the menu instructions
Definition at line 311 of file menuGBottom.cpp.
References spriteManager::loadSpriteSet(), and menuSprite.
Referenced by activate(), and main().
Here is the call graph for this function:
void menuGBottom::loadSpawnerSpriteSet | ( | const unsigned short * | p, | |
const unsigned char * | s | |||
) |
load the sprite data for the Pickup generator
Definition at line 317 of file menuGBottom.cpp.
References spriteManager::loadSpriteSet(), and spawnerSprite.
Referenced by activate(), and main().
Here is the call graph for this function:
void menuGBottom::loadPickupSpriteSet | ( | const unsigned short * | p, | |
const unsigned char * | s | |||
) |
load the sprite data for the Pickup icons
Definition at line 323 of file menuGBottom.cpp.
References spriteManager::loadSpriteSet(), and pickupSprite.
Referenced by activate(), and main().
Here is the call graph for this function:
void menuGBottom::resetIdleTime | ( | u8 | spawnerNum | ) |
Reset the spawn counter for a pickupSpawner to a random number.
When this counter reaches zero again, a Pickup is ready to spawn.
spawnerNum | the id of the pickupSpawner in gameManager that should be reset to fire again |
Definition at line 154 of file menuGBottom.cpp.
References pickupSpawner::IDLEMAX, pickupSpawner::IDLEMIN, menuBase, menuBottom::numPickups, spawnerCounters, and spriteObject::TICKSPERFRAME.
Referenced by activate(), gameManager::resetGame(), pickupSpawner::resetIdleTime(), and spawnPickup().
void menuGBottom::spawnPickup | ( | u8 | i | ) |
Pick a random Pickup icon to spawn and make it travel down whichever spawner tube is ready.
i | id of the spawner tube to travel down |
Definition at line 176 of file menuGBottom.cpp.
References spriteObject::addChild(), pickupSpawner::addSpawnTime(), spriteObject::ANIMSPEED, gameTop, spriteObject::giveSprite(), menuBase, gameManager::pickupMask, pickupsActive, gameManager::pickupSpawners, pickupSprite, resetIdleTime(), spriteObject::setAnim(), spriteObject::setArbitraryAnim(), spriteObject::setLayer(), spriteObject::setLifetime(), spriteObject::setPallete(), spriteObject::setPos(), spriteObject::setSpeed(), menuBottom::showPickups, spawnerSpriteL, and spawnerSpriteR.
Referenced by gameTick().
Here is the call graph for this function:
spriteManager which handles the top screen during gameplay
Definition at line 101 of file menuGBottom.h.
Referenced by gameTick(), main(), and spawnPickup().
spriteManager which handles the top screen during frontend
Definition at line 103 of file menuGBottom.h.
Referenced by gameTick(), and main().
spriteManager which handles the bottom screen during frontend
Definition at line 105 of file menuGBottom.h.
Referenced by gameTick(), loadBackground(), main(), resetIdleTime(), and spawnPickup().
if true, we are in 'player wins' screen.
Definition at line 107 of file menuGBottom.h.
Referenced by activate(), deactivate(), gameTick(), and gameManager::resetGame().
if true, stop executing the main loop for the game screen
Definition at line 109 of file menuGBottom.h.
Referenced by activate(), and gameTick().
s16 menuGBottom::spawnerCounters[3] |
countdown timers for Pickup spawners. Set to -1 to disable that spawner.
Definition at line 112 of file menuGBottom.h.
Referenced by activate(), deactivate(), gameTick(), and resetIdleTime().
the number of Pickups that are in play
Definition at line 114 of file menuGBottom.h.
Referenced by activate(), gameTick(), pickupSpawner::resetIdleTime(), and spawnPickup().
spriteSet menuGBottom::menuSprite |
Definition at line 118 of file menuGBottom.h.
Referenced by activate(), gameTick(), and loadMenuSpriteSet().
spriteSet menuGBottom::spawnerSprite |
Definition at line 118 of file menuGBottom.h.
Referenced by activate(), loadBackground(), and loadSpawnerSpriteSet().
spriteSet menuGBottom::pickupSprite |
Definition at line 118 of file menuGBottom.h.
Referenced by activate(), loadPickupSpriteSet(), and spawnPickup().
const u8 menuGBottom::_SPAWNERSPRITEMININDEX = 64 [static] |
The minimum OAM index for Pickup icons, so that they are neatly sandwiched between the Pickup generator graphics.
Definition at line 121 of file menuGBottom.h.
Referenced by loadBackground().