/
trilirium
/
Pacman
Обзор
Документация
Войти
/
trilirium
/
Pacman
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
DemoState.cpp
89 строк
2 KB
Trilirium
first commit
19 июн 2026, 11:07
19 июн 2026, 11:07
d44591e
Код
Авторство
О чём код?
// DemoState.cpp // ///////////////////////////////////////////////////////////////////////////// #include <cassert> #include "DemoState.h" #include "DemoSubstates.h" #include "Game.h" #include "Writer.h" using namespace Puckman; GameSubstate *DemoState::substates[0x24]; ///////////////////////////////////////////////////////////////////////////// // initialization and cleanup ///////////////////////////////////////////////////////////////////////////// DemoState::DemoState() { substate = 0; substates[0x00] = new DemoInitSubstate(); substates[0x01] = 0; substates[0x02] = new DemoDrawRedGhostSubstate(); substates[0x03] = 0; substates[0x04] = new DemoPrintRedGhostNameSubstate(); substates[0x05] = 0; substates[0x06] = new DemoPrintRedGhostNicknameSubstate(); substates[0x07] = 0; substates[0x08] = new DemoDrawPinkGhostSubstate(); substates[0x09] = 0; substates[0x0a] = new DemoPrintPinkGhostNameSubstate(); substates[0x0b] = 0; substates[0x0c] = new DemoPrintPinkGhostNicknameSubstate(); substates[0x0d] = 0; substates[0x0e] = new DemoDrawBlueGhostSubstate(); substates[0x0f] = 0; substates[0x10] = new DemoPrintBlueGhostNameSubstate(); substates[0x11] = 0; substates[0x12] = new DemoPrintBlueGhostNicknameSubstate(); substates[0x13] = 0; substates[0x14] = new DemoDrawOrangeGhostSubstate(); substates[0x15] = 0; substates[0x16] = new DemoPrintOrangeGhostNameSubstate(); substates[0x17] = 0; substates[0x18] = new DemoPrintOrangeGhostNicknameSubstate(); substates[0x19] = 0; substates[0x1a] = new DemoDrawPillPointsSubstate(); substates[0x1b] = 0; substates[0x1c] = new DemoInitSimulationSubstate(); substates[0x1d] = 0; substates[0x1e] = new DemoAnim0Substate(); substates[0x1f] = new DemoAnim1Substate(); substates[0x20] = new DemoAnim2Substate(); substates[0x21] = new DemoAnim3Substate(); substates[0x22] = new DemoAnim4Substate(); substates[0x23] = new DemoPlayingSubstate(); } DemoState::~DemoState() { // delete demo substates for (int i = 0; i < 0x24; i++){ delete substates[i]; } } void DemoState::run() { // print actual credit configuration Writer::printCredits(); // check for a new credit if (theGame->settings.credits > 0){ // change state substate = 0; theGame->states[PLAYING]->substate = 0; theGame->state++; } else { assert((substate >= 0) && (substate < 0x24)); // delegate the action to the substate if (substates[substate]){ substates[substate]->run(); } } }