⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demostate.cpp

📁 VIGASOCO (VIdeo GAmes SOurce COde) Windows port (v0.01)
💻 CPP
字号:
// DemoState.cpp
//
/////////////////////////////////////////////////////////////////////////////

#include <cassert>
#include "DemoState.h"
#include "DemoSubstates.h"
#include "Game.h"
#include "Writer.h"

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();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -