HDB: Completed rendering pipeline

This commit is contained in:
Eugene Sandulenko 2019-07-03 17:20:01 +02:00
parent 74eb242b5a
commit c3c8299962
4 changed files with 78 additions and 23 deletions

View File

@ -55,6 +55,7 @@ HDBGame::HDBGame(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst
_rnd = new Common::RandomSource("hdb");
_currentMapname[0] = _currentLuaName[0] = 0;
_lastMapname[0] = _lastLuaName[0] = 0;
_monkeystone7 = STARS_MONKEYSTONE_7_FAKE;
_monkeystone14 = STARS_MONKEYSTONE_14_FAKE;
@ -84,8 +85,6 @@ bool HDBGame::init() {
Game Subsystem Initializations
*/
_lastMapname[0] = 0;
// Init fileMan
if (!_fileMan->openMPC(getGameFile())) {
@ -94,27 +93,30 @@ bool HDBGame::init() {
if (!_gfx->init()) {
error("Gfx::init: Couldn't initialize Gfx");
}
if (!_input->init()) {
error("Input::init: Couldn't initialize Input");
if (!_sound->init()) {
error("Window::init: Couldn't initialize Sound");
}
if (!_ai->init()) {
error("AI::init: Couldn't initialize AI");
}
if (!_lua->init()) {
error("LuaScript::init: Couldn't load the GLOBAL_LUA code.");
}
if (!_sound->init()) {
error("Window::init: Couldn't initialize Sound");
}
if (!_window->init()) {
error("Window::init: Couldn't initialize Window");
}
if (!_input->init()) {
error("Input::init: Couldn't initialize Input");
}
if (!_lua->init()) {
error("LuaScript::init: Couldn't load the GLOBAL_LUA code.");
}
// REMOVE: Putting this here since Menu hasn't been implemented yet.
// Defaults the game into Action Mode
setActionMode(1);
_menu->init();
_changeLevel = false;
_changeMapname[0] = 0;
_loadInfo.active = _saveInfo.active = false;
_menu->startTitle();
start();
_gameShutdown = false;
_pauseFlag = 0;
_systemInit = true;
@ -122,11 +124,6 @@ bool HDBGame::init() {
return true;
}
void HDBGame::start() {
warning("REMOVE: _gameState initialized to GAME_PLAY");
_gameState = GAME_PLAY;
}
/*
Changes the current GameState to the next one.
Game State Transitions are deterministic: each state can
@ -600,13 +597,32 @@ Common::Error HDBGame::run() {
_map->drawForegrounds();
_ai->animateTargets();
_window->drawDialogChoice();
_window->drawDialog();
_window->drawMessageBar();
_window->drawDialogChoice();
_window->drawInventory();
_window->drawMessageBar();
_window->drawDeliveries();
_window->drawTextOut();
_window->drawPause();
//_gfx->drawBonusStars();
_gfx->drawSnow();
if (_changeLevel == true) {
_changeLevel = false;
startMap(_changeMapname);
}
//
// should we save the game at this point?
//
if (_saveInfo.active == true) {
_sound->playSound(SND_VORTEX_SAVE);
_ai->stopEntity(e);
_menu->fillSavegameSlots();
saveSlot(_saveInfo.slot);
_saveInfo.active = false;
}
}
// Update Timer that's NOT used for in-game Timing

View File

@ -149,13 +149,26 @@ public:
bool init();
void start();
bool restartMap();
bool startMap(char *name);
void changeMap(char *name) {
strcpy(_changeMapname, name);
_changeLevel = true;
}
bool saveSlot(int slot);
void saveWhenReady(int slot) {
_saveInfo.active = true;
_saveInfo.slot = slot;
}
void loadWhenReady(int slot) {
_loadInfo.active = true;
_loadInfo.slot = slot;
}
void setGameState(GameState gs) {
_gameState = gs;
}
@ -200,6 +213,11 @@ public:
char *lastMapname() { return _lastMapname; }
void changeLevel(char *name) {
strcpy(_changeMapname, name);
_changeLevel = true;
}
//
// monkeystone secret stars
//
@ -239,6 +257,15 @@ private:
int32 _monkeystone14;
int32 _monkeystone21;
bool _changeLevel;
char _changeMapname[64];
struct {
bool active;
int slot;
} _saveInfo, _loadInfo;
};
extern HDBGame *g_hdb;

View File

@ -33,6 +33,16 @@ bool Menu::init() {
return true;
}
void Menu::startTitle() {
// REMOVE: Putting this here since Menu hasn't been implemented yet.
// Defaults the game into Action Mode
g_hdb->setActionMode(1);
g_hdb->setGameState(GAME_PLAY);
warning("STUB: Menu::startTitle()");
}
void Menu::fillSavegameSlots() {
warning("STUB: PMenu::fillSavegameSlots()");
}

View File

@ -37,6 +37,8 @@ public:
bool init();
void startTitle();
void fillSavegameSlots();
int _starWarp;