aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/game.cpp
diff options
context:
space:
mode:
authorDenis Kasak2009-07-25 03:28:04 +0000
committerDenis Kasak2009-07-25 03:28:04 +0000
commitd28658984dcceb7c090af9f7040d1490239a820b (patch)
tree93da0bc4e38c273f4c27f7eb4be3e461bcab0493 /engines/draci/game.cpp
parentb7e97efb7fbd26c91693082339466308c52e7e08 (diff)
downloadscummvm-rg350-d28658984dcceb7c090af9f7040d1490239a820b.tar.gz
scummvm-rg350-d28658984dcceb7c090af9f7040d1490239a820b.tar.bz2
scummvm-rg350-d28658984dcceb7c090af9f7040d1490239a820b.zip
* Added DraciEngine::_initArchive and made Game use it. Fixes a memory bug because Game uses pointers from the init archive which should outlive it (but didn't previously).
* Added support for setting loop status to Game. * Made some GPL commands check whether we are in the correct loop status before executing. svn-id: r42731
Diffstat (limited to 'engines/draci/game.cpp')
-rw-r--r--engines/draci/game.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index 3f91bf1697..d7ae538209 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -39,14 +39,13 @@ static double real_to_double(byte real[6]);
Game::Game(DraciEngine *vm) : _vm(vm) {
unsigned int i;
- Common::String path("INIT.DFW");
- BArchive initArchive(path);
+ BArchive *initArchive = _vm->_initArchive;
BAFile *file;
// Read in persons
- file = initArchive.getFile(5);
+ file = initArchive->getFile(5);
Common::MemoryReadStream personData(file->_data, file->_length);
unsigned int numPersons = file->_length / personSize;
@@ -63,7 +62,7 @@ Game::Game(DraciEngine *vm) : _vm(vm) {
// Read in dialog offsets
- file = initArchive.getFile(4);
+ file = initArchive->getFile(4);
Common::MemoryReadStream dialogData(file->_data, file->_length);
unsigned int numDialogs = file->_length / sizeof(uint16);
@@ -80,7 +79,7 @@ Game::Game(DraciEngine *vm) : _vm(vm) {
// Read in game info
- file = initArchive.getFile(3);
+ file = initArchive->getFile(3);
Common::MemoryReadStream gameData(file->_data, file->_length);
_info._startRoom = gameData.readByte() - 1;
@@ -105,7 +104,7 @@ Game::Game(DraciEngine *vm) : _vm(vm) {
// Read in variables
- file = initArchive.getFile(2);
+ file = initArchive->getFile(2);
unsigned int numVariables = file->_length / sizeof (int16);
_variables = new int[numVariables];
@@ -120,13 +119,13 @@ Game::Game(DraciEngine *vm) : _vm(vm) {
// Read in item icon status
- file = initArchive.getFile(1);
+ file = initArchive->getFile(1);
_iconStatus = file->_data;
uint numIcons = file->_length;
// Read in object status
- file = initArchive.getFile(0);
+ file = initArchive->getFile(0);
unsigned int numObjects = file->_length;
_objects = new GameObject[numObjects];
@@ -153,6 +152,8 @@ Game::Game(DraciEngine *vm) : _vm(vm) {
}
void Game::init() {
+ _loopStatus = kStatusOrdinary;
+
loadObject(kDragonObject);
GameObject *dragon = getObject(kDragonObject);
@@ -521,6 +522,14 @@ void Game::changeRoom(uint roomNum) {
loadOverlays();
}
+void Game::setLoopStatus(LoopStatus status) {
+ _loopStatus = status;
+}
+
+LoopStatus Game::getLoopStatus() {
+ return _loopStatus;
+}
+
int Game::getRoomNum() {
return _currentRoom._roomNum;
}