aboutsummaryrefslogtreecommitdiff
path: root/engines/access
diff options
context:
space:
mode:
Diffstat (limited to 'engines/access')
-rw-r--r--engines/access/access.cpp45
-rw-r--r--engines/access/access.h39
-rw-r--r--engines/access/room.cpp44
-rw-r--r--engines/access/room.h3
-rw-r--r--engines/access/scripts.cpp9
-rw-r--r--engines/access/scripts.h4
-rw-r--r--engines/access/sound.cpp9
-rw-r--r--engines/access/sound.h5
8 files changed, 121 insertions, 37 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index e175b1c081..6b805e4069 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -48,11 +48,13 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
_mouseMode = 0;
_currentMan = 0;
_currentManOld = -1;
+ _man = nullptr;
_man1 = nullptr;
_inactive = nullptr;
_manPal1 = nullptr;
_music = nullptr;
_playField = nullptr;
+ _tile = nullptr;
_anim = nullptr;
_title = nullptr;
_converseMode = 0;
@@ -127,6 +129,17 @@ AccessEngine::~AccessEngine() {
_buffer1.free();
_buffer2.free();
+
+ freeCells();
+ delete[] _man;
+ delete[] _man1;
+ delete[] _inactive;
+ delete[] _manPal1;
+ delete[] _music;
+ delete[] _playField;
+ delete[] _tile;
+ delete[] _anim;
+ delete[] _title;
}
void AccessEngine::setVGA() {
@@ -183,4 +196,36 @@ void AccessEngine::clearCellTable() {
Common::fill(&_objectsTable[0], &_objectsTable[100], (byte *)nullptr);
}
+void AccessEngine::freeCells() {
+ for (int i = 0; i < 100; ++i) {
+ delete[] _objectsTable[i];
+ _objectsTable[i] = nullptr;
+ }
+}
+
+void AccessEngine::freeAnimationData() {
+ delete[] _anim;
+ _anim = nullptr;
+}
+
+void AccessEngine::freePlayField() {
+ delete[] _playField;
+ _playField = nullptr;
+}
+
+void AccessEngine::freeTileData() {
+ delete[] _tile;
+ _tile = nullptr;
+}
+
+void AccessEngine::freeInactiveData() {
+ delete[] _inactive;
+ _inactive = nullptr;
+}
+
+void AccessEngine::freeManData() {
+ delete[] _man;
+ _man = nullptr;
+}
+
} // End of namespace Access
diff --git a/engines/access/access.h b/engines/access/access.h
index 21f8072311..2e605e49ab 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -85,11 +85,6 @@ protected:
Common::RandomSource _randomSource;
/**
- * Clear the cell table
- */
- void clearCellTable();
-
- /**
* Main handler for showing game rooms
*/
void doRoom();
@@ -128,11 +123,13 @@ public:
int _nextImage;
int _currentManOld;
+ byte *_man;
byte *_man1;
byte *_inactive;
byte *_manPal1;
byte *_music;
byte *_playField;
+ byte *_tile;
byte *_anim;
byte *_title;
int _converseMode;
@@ -202,6 +199,38 @@ public:
uint32 getGameFeatures() const;
int getRandomNumber(int maxNumber);
+
+ void freeAnimationData();
+
+ /**
+ * Clear the cell table
+ */
+ void clearCellTable();
+
+ /**
+ * Free the cell data
+ */
+ void freeCells();
+
+ /**
+ * Free the playfield data
+ */
+ void freePlayField();
+
+ /**
+ * Free tile data
+ */
+ void freeTileData();
+
+ /**
+ * Free the inactive data
+ */
+ void freeInactiveData();
+
+ /**
+ * Free animation data
+ */
+ void freeManData();
};
} // End of namespace Access
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index c3a3a9f8e2..0515b50ab2 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -113,41 +113,21 @@ void Room::doRoom() {
}
void Room::clearRoom() {
- // TODO
-}
-
-void Room::reloadRoom() {
- loadRoom(_vm->_roomNumber);
-
- if (_roomFlag != 1) {
- _vm->_currentMan = _roomFlag;
- _vm->_currentManOld = _roomFlag;
- _vm->_manScaleOff = 0;
-
- switch (_vm->_currentMan) {
- case 0:
- _vm->_man1 = _vm->_files->loadFile("MAN.LZ");
- break;
-
- case 2:
- _vm->_man1 = _vm->_files->loadFile("JMAN.LZ");
- break;
-
- case 3:
- _vm->_man1 = _vm->_files->loadFile("OVERHEAD.LZ");
- _vm->_manScaleOff = 1;
- break;
-
- default:
- break;
- }
+ if (_vm->_sound->_music) {
+ _vm->_sound->stopSong();
+ delete[] _vm->_sound->_music;
+ _vm->_sound->_music = nullptr;
}
- reloadRoom1();
-}
+ _vm->_sound->freeSounds();
+ _vm->_numAnimTimers = 0;
-void Room::reloadRoom1() {
- // TODO
+ _vm->freeAnimationData();
+ _vm->_scripts->freeScriptData();
+ _vm->freeCells();
+ _vm->freePlayField();
+ _vm->freeInactiveData();
+ _vm->freeManData();
}
void Room::loadRoom(int room) {
diff --git a/engines/access/room.h b/engines/access/room.h
index fd5e602348..28506db7d6 100644
--- a/engines/access/room.h
+++ b/engines/access/room.h
@@ -52,6 +52,9 @@ public:
void doCommands();
+ /**
+ * Clear all the data used by the room
+ */
void clearRoom();
void loadRoom(int room);
diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp
index e31cd0cf5c..bd480b8b64 100644
--- a/engines/access/scripts.cpp
+++ b/engines/access/scripts.cpp
@@ -31,6 +31,10 @@ Scripts::Scripts(AccessEngine *vm) : _vm(vm) {
_sequence = 0;
}
+Scripts::~Scripts() {
+ freeScriptData();
+}
+
void Scripts::searchForSeq() {
// TODO
}
@@ -39,4 +43,9 @@ void Scripts::executeCommand() {
// TODO
}
+void Scripts::freeScriptData() {
+ delete[] _script;
+ _script = nullptr;
+}
+
} // End of namespace Access
diff --git a/engines/access/scripts.h b/engines/access/scripts.h
index b3e898f512..995f12930f 100644
--- a/engines/access/scripts.h
+++ b/engines/access/scripts.h
@@ -38,9 +38,13 @@ public:
public:
Scripts(AccessEngine *vm);
+ virtual ~Scripts();
+
void searchForSeq();
void executeCommand();
+
+ void freeScriptData();
};
} // End of namespace Access
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index 2a008d8c53..2f64465f8f 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -32,6 +32,8 @@ SoundManager::SoundManager(AccessEngine *vm, Audio::Mixer *mixer) :
Common::fill(&_soundPriority[0], &_soundPriority[MAX_SOUNDS], 0);
for (int i = 0; i < MAX_SOUNDS; ++i)
_soundTable[i]._data = nullptr;
+
+ _music = nullptr;
}
SoundManager::~SoundManager() {
@@ -68,5 +70,12 @@ void SoundManager::midiRepeat() {
// TODO
}
+void SoundManager::stopSong() {
+ // TODO
+}
+
+void SoundManager::freeSounds() {
+ // TODO
+}
} // End of namespace Access
diff --git a/engines/access/sound.h b/engines/access/sound.h
index 613eca49ab..37d263eecd 100644
--- a/engines/access/sound.h
+++ b/engines/access/sound.h
@@ -48,6 +48,7 @@ private:
public:
SoundEntry _soundTable[MAX_SOUNDS];
int _soundPriority[MAX_SOUNDS];
+ byte *_music;
public:
SoundManager(AccessEngine *vm, Audio::Mixer *mixer);
~SoundManager();
@@ -57,6 +58,10 @@ public:
void playSound(int soundIndex);
void midiRepeat();
+
+ void stopSong();
+
+ void freeSounds();
};
} // End of namespace Access