96 lines
3.6 KiB
C++
96 lines
3.6 KiB
C++
#include <assert.h>
|
|
#include "GameStateManager.h"
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
void GameStateManager::AdvanceState()
|
|
{
|
|
//given the AdvanceState event transition to a new state based on current state and gameData
|
|
BEGIN_TRANSITION_MAP // (Next State) // - Current State -
|
|
TRANSITION_MAP_ENTRY (ST_TITLESCREEN) // ST_Init
|
|
TRANSITION_MAP_ENTRY (ST_COREGAME) // ST_TitleScreen
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_Instructions
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_HiScoreList
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_Credits
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_CoreGame
|
|
TRANSITION_MAP_ENTRY (ST_COREGAME) // ST_PauseScreen
|
|
TRANSITION_MAP_ENTRY (ST_INIT) // ST_GameOver
|
|
END_TRANSITION_MAP(NULL)
|
|
}
|
|
|
|
void GameStateManager::PauseGame(GameData* gameData)
|
|
{
|
|
// given the PauseGame event transition to a new state based on current state and gameData
|
|
// printf("gameData->isPaused: %d\n",gameData->isPaused);
|
|
BEGIN_TRANSITION_MAP // - Current State -
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_Init
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_TitleScreen
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_Instructions
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_HiScoreList
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_Credits
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_CoreGame
|
|
TRANSITION_MAP_ENTRY (ST_INSTRUCTIONS) // ST_PauseScreen
|
|
TRANSITION_MAP_ENTRY (CANNOT_HAPPEN) // ST_GameOver
|
|
END_TRANSITION_MAP(gameData)
|
|
|
|
}
|
|
void GameStateManager::GameOver()
|
|
{
|
|
//given the PauseGame event transition to a new state based on current state and gameData
|
|
// printf("GameOver triggered\n");
|
|
BEGIN_TRANSITION_MAP // - Current State -
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_Init
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_TitleScreen
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_Instructions
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_HiScoreList
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_Credits
|
|
TRANSITION_MAP_ENTRY (ST_GAMEOVER) // ST_CoreGame
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_PauseScreen
|
|
TRANSITION_MAP_ENTRY (EVENT_IGNORED) // ST_GameOver
|
|
END_TRANSITION_MAP(NULL)
|
|
}
|
|
|
|
void GameStateManager::ST_Init(EventData*)
|
|
{
|
|
printf("GameStateManager::ST_Init\n");
|
|
// InternalEvent(ST_TITLESCREEN);
|
|
}
|
|
|
|
void GameStateManager::ST_TitleScreen(EventData*)
|
|
{
|
|
printf("GameStateManager::ST_TitleScreen\n");
|
|
// InternalEvent(ST_TITLESCREEN);
|
|
}
|
|
|
|
void GameStateManager::ST_Instructions(GameData*)
|
|
{
|
|
printf("GameStateManager::ST_Instructions\n");
|
|
}
|
|
|
|
void GameStateManager::ST_HiScoreList(GameData*)
|
|
{
|
|
printf("GameStateManager::ST_HiScoreList\n");
|
|
}
|
|
|
|
void GameStateManager::ST_Credits(GameData*)
|
|
{
|
|
printf("GameStateManager::ST_Credits\n");
|
|
}
|
|
|
|
void GameStateManager::ST_CoreGame(EventData*)
|
|
{
|
|
printf("GameStateManager::ST_CoreGame\n");
|
|
}
|
|
|
|
void GameStateManager::ST_PauseScreen(EventData*)
|
|
{
|
|
printf("GameStateManager::ST_PauseScreen\n");
|
|
}
|
|
|
|
void GameStateManager::ST_GameOver(GameData*)
|
|
{
|
|
printf("GameStateManager::ST_GameOver\n");
|
|
}
|
|
|