STARK: Update the resource provider to allow changing locations

This commit is contained in:
Bastien Bouclet 2014-12-28 11:50:12 +01:00
parent 642c5476b4
commit 7f2182279a
9 changed files with 284 additions and 113 deletions

View file

@ -25,6 +25,8 @@
#include "engines/stark/console.h"
#include "engines/stark/debug.h"
#include "engines/stark/resourceprovider.h"
#include "engines/stark/resources/level.h"
#include "engines/stark/resources/location.h"
#include "engines/stark/scene.h"
#include "engines/stark/gfx/driver.h"
@ -76,8 +78,12 @@ Common::Error StarkEngine::run() {
_global = new Global();
_resourceProvider = new ResourceProvider(_archiveLoader, _global);
// Load global resources
_resourceProvider->initGlobal();
// Start us up at the house of all worlds
_resourceProvider->requestLocationChange(0x45, 0x00);
// Start running
mainLoop();
@ -91,6 +97,10 @@ void StarkEngine::mainLoop() {
_scene = new Scene(_gfx);
while (!shouldQuit()) {
if (_resourceProvider->hasLocationChangeRequest()) {
_resourceProvider->performLocationChange();
}
// Process events
Common::Event e;
while (g_system->getEventManager()->pollEvent(e)) {
@ -133,6 +143,11 @@ void StarkEngine::updateDisplayScene() {
// Clear the screen
_gfx->clearScreen();
// Update the game resources
_global->getLevel()->onGameLoop(delta);
_global->getCurrent()->getLevel()->onGameLoop(delta);
_global->getCurrent()->getLocation()->onGameLoop(delta);
// Render the current scene
_scene->render(delta);