aboutsummaryrefslogtreecommitdiff
path: root/engines/voyeur
diff options
context:
space:
mode:
authorPaul Gilbert2013-12-07 20:44:28 -0500
committerPaul Gilbert2013-12-07 20:44:28 -0500
commita6ceaf29854a47785c7a36831bea41411e1bb0cf (patch)
treeedc14c94e5c660fb11bee5dd0b0ba9b746079382 /engines/voyeur
parentb40c34a8836dc12bc541579afad06dfb1e097a95 (diff)
downloadscummvm-rg350-a6ceaf29854a47785c7a36831bea41411e1bb0cf.tar.gz
scummvm-rg350-a6ceaf29854a47785c7a36831bea41411e1bb0cf.tar.bz2
scummvm-rg350-a6ceaf29854a47785c7a36831bea41411e1bb0cf.zip
VOYEUR: Refactoring of BoltFile now that have more than one bolt file
Diffstat (limited to 'engines/voyeur')
-rw-r--r--engines/voyeur/events.cpp1
-rw-r--r--engines/voyeur/events.h3
-rw-r--r--engines/voyeur/files.cpp119
-rw-r--r--engines/voyeur/files.h43
-rw-r--r--engines/voyeur/staticres.cpp10
-rw-r--r--engines/voyeur/staticres.h2
-rw-r--r--engines/voyeur/voyeur.h3
-rw-r--r--engines/voyeur/voyeur_game.cpp23
8 files changed, 150 insertions, 54 deletions
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 5aa00e77f9..5d347d0964 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -73,6 +73,7 @@ EventsManager::EventsManager(): _intPtr(_gameData),
_priorFrameTime = g_system->getMillis();
Common::fill(&_keyState[0], &_keyState[256], false);
+ _v2A0A2 = 0;
_videoComputerNum = 0;
_videoComputerBut1 = 0;
_videoComputerBut4 = 0;
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 47a6c5ab3c..3cfdca4faa 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -66,7 +66,7 @@ public:
int _RTVNum;
int _switchBGNum;
int _group;
- int _resolvePtr;
+ const int *_resolvePtr;
int _seconds;
int _minutes;
int _hours;
@@ -171,6 +171,7 @@ public:
int _fadeCount;
int _fadeStatus;
+ int _v2A0A2;
int _videoComputerNum;
int _videoComputerBut1;
int _videoComputerBut4;
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 5171d581ba..9f7242c0d2 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -185,9 +185,14 @@ bool FilesManager::openBoltLib(const Common::String &filename, BoltFile *&boltFi
return true;
}
- // TODO: Specific library classes for buoy.blt versus stampblt.blt
// Create the bolt file interface object and load the index
- boltFile = _boltFilesState._curLibPtr = new BoltFile(_boltFilesState);
+ if (filename == "bvoy.blt")
+ boltFile = _boltFilesState._curLibPtr = new BVoyBoltFile(_boltFilesState);
+ else if (filename == "stampblt.blt")
+ boltFile = _boltFilesState._curLibPtr = new StampBoltFile(_boltFilesState);
+ else
+ error("Unknown bolt file specified");
+
return true;
}
@@ -212,20 +217,10 @@ byte *FilesManager::fload(const Common::String &filename, int *size) {
/*------------------------------------------------------------------------*/
-const BoltMethodPtr BoltFile::_fnInitType[25] = {
- &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
- &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
- &BoltFile::sInitPic, &BoltFile::initDefault, &BoltFile::vInitCMap, &BoltFile::vInitCycl,
- &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initViewPort,
- &BoltFile::initViewPortList, &BoltFile::initFont, &BoltFile::initFontInfo,
- &BoltFile::initSoundMap, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
- &BoltFile::initDefault, &BoltFile::initDefault
-};
-
-BoltFile::BoltFile(BoltFilesState &state): _state(state) {
+BoltFile::BoltFile(const Common::String &filename, BoltFilesState &state): _state(state) {
_state._curFd = &_file;
- if (!_file.open("bvoy.blt"))
- error("Could not open buoy.blt");
+ if (!_file.open(filename))
+ error("Could not open %s", filename.c_str());
_state._curFilePosition = 0;
// Read in the file header
@@ -403,7 +398,7 @@ byte *BoltFile::getBoltMember(uint32 id) {
if (_state._curGroupPtr->_processed) {
// TODO: Figure out weird access type. Uncompressed read perhaps?
//int fileDiff = _state._curGroupPtr->_fileOffset - _state._curMemberPtr->_fileOffset;
-
+ error("TODO: processed bolt flag");
} else {
_state._bufStart = _state._decompressBuf;
_state._bufSize = DECOMPRESS_SIZE;
@@ -425,7 +420,7 @@ byte *BoltFile::getBoltMember(uint32 id) {
// Initialise the resource
assert(_state._curMemberPtr->_initMethod < 25);
- (this->*_fnInitType[_state._curMemberPtr->_initMethod])();
+ initResource(_state._curMemberPtr->_initMethod);
return _state._curMemberPtr->_data;
}
@@ -435,27 +430,44 @@ void BoltFile::initDefault() {
_state._curMemberPtr->_mode);
}
-void BoltFile::sInitPic() {
- // Read in the header data
- _state._curMemberPtr->_data = _state.decompress(NULL, 24, _state._curMemberPtr->_mode);
- _state._curMemberPtr->_picResource = new PictureResource(_state,
- _state._curMemberPtr->_data);
-}
+/*------------------------------------------------------------------------*/
-void BoltFile::vInitCMap() {
- initDefault();
- _state._curMemberPtr->_cMapResource = new CMapResource(
- _state, _state._curMemberPtr->_data);
+BVoyBoltFile::BVoyBoltFile(BoltFilesState &state): BoltFile("bvoy.blt", state) {
}
-void BoltFile::vInitCycl() {
- initDefault();
- _state._vm->_eventsManager.vStopCycle();
- _state._curMemberPtr->_vInitCyclResource = new VInitCyclResource(
- _state, _state._curMemberPtr->_data);
+void BVoyBoltFile::initResource(int resType) {
+ switch (resType) {
+ case 8:
+ sInitPic();
+ break;
+ case 10:
+ vInitCMap();
+ break;
+ case 11:
+ vInitCycl();
+ break;
+ case 15:
+ initViewPort();
+ break;
+ case 16:
+ initViewPortList();
+ break;
+ case 17:
+ initFont();
+ break;
+ case 18:
+ initFontInfo();
+ break;
+ case 19:
+ initSoundMap();
+ break;
+ default:
+ initDefault();
+ break;
+ }
}
-void BoltFile::initViewPort() {
+void BVoyBoltFile::initViewPort() {
initDefault();
ViewPortResource *viewPort;
@@ -467,7 +479,7 @@ void BoltFile::initViewPort() {
viewPort->_parent = getBoltEntryFromLong(READ_LE_UINT32(src + 2))._viewPortResource;
}
-void BoltFile::initViewPortList() {
+void BVoyBoltFile::initViewPortList() {
initDefault();
ViewPortListResource *res;
@@ -478,19 +490,52 @@ void BoltFile::initViewPortList() {
_state._vm->_graphicsManager._vPort = &res->_entries[0];
}
-void BoltFile::initFontInfo() {
+void BVoyBoltFile::initFontInfo() {
initDefault();
_state._curMemberPtr->_fontInfoResource = new FontInfoResource(
_state, _state._curMemberPtr->_data);
}
-void BoltFile::initFont() {
+void BVoyBoltFile::initFont() {
initDefault();
_state._curMemberPtr->_fontResource = new FontResource(_state, _state._curMemberPtr->_data);
}
-void BoltFile::initSoundMap() {
+void BVoyBoltFile::initSoundMap() {
+ initDefault();
+}
+
+void BVoyBoltFile::sInitPic() {
+ // Read in the header data
+ _state._curMemberPtr->_data = _state.decompress(NULL, 24, _state._curMemberPtr->_mode);
+ _state._curMemberPtr->_picResource = new PictureResource(_state,
+ _state._curMemberPtr->_data);
+}
+
+void BVoyBoltFile::vInitCMap() {
+ initDefault();
+ _state._curMemberPtr->_cMapResource = new CMapResource(
+ _state, _state._curMemberPtr->_data);
+}
+
+void BVoyBoltFile::vInitCycl() {
initDefault();
+ _state._vm->_eventsManager.vStopCycle();
+ _state._curMemberPtr->_vInitCyclResource = new VInitCyclResource(
+ _state, _state._curMemberPtr->_data);
+}
+
+/*------------------------------------------------------------------------*/
+
+StampBoltFile::StampBoltFile(BoltFilesState &state): BoltFile("stampblt.blt", state) {
+}
+
+void StampBoltFile::initResource(int resType) {
+ switch (resType) {
+ default:
+ initDefault();
+ break;
+ }
}
/*------------------------------------------------------------------------*/
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 43836f5fa0..0871a5eeae 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -44,8 +44,6 @@ class VInitCyclResource;
#define DECOMPRESS_SIZE 0x7000
-typedef void (BoltFile::*BoltMethodPtr)();
-
class ResolveEntry {
public:
uint32 _id;
@@ -98,22 +96,13 @@ public:
class BoltFile {
private:
- static const BoltMethodPtr _fnInitType[25];
-private:
- BoltFilesState &_state;
Common::Array<BoltGroup> _groups;
Common::File _file;
+protected:
+ BoltFilesState &_state;
- // initType method table
+ virtual void initResource(int resType) = 0;
void initDefault();
- void sInitPic();
- void vInitCMap();
- void vInitCycl();
- void initViewPort();
- void initViewPortList();
- void initFontInfo();
- void initFont();
- void initSoundMap();
private:
void resolveAll();
byte *getBoltMember(uint32 id);
@@ -124,7 +113,7 @@ private:
void initGro() {} // TODO
void termGro() {} // TODO
public:
- BoltFile(BoltFilesState &state);
+ BoltFile(const Common::String &filename, BoltFilesState &state);
~BoltFile();
bool getBoltGroup(uint32 id);
@@ -140,6 +129,30 @@ public:
CMapResource *getCMapResource(uint32 id);
};
+class BVoyBoltFile: public BoltFile {
+private:
+ // initType method table
+ void sInitPic();
+ void vInitCMap();
+ void vInitCycl();
+ void initViewPort();
+ void initViewPortList();
+ void initFontInfo();
+ void initFont();
+ void initSoundMap();
+protected:
+ virtual void initResource(int resType);
+public:
+ BVoyBoltFile(BoltFilesState &state);
+};
+
+class StampBoltFile: public BoltFile {
+protected:
+ virtual void initResource(int resType);
+public:
+ StampBoltFile(BoltFilesState &state);
+};
+
class BoltGroup {
private:
Common::SeekableReadStream *_file;
diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp
index 23fa3602eb..a3a76b679f 100644
--- a/engines/voyeur/staticres.cpp
+++ b/engines/voyeur/staticres.cpp
@@ -33,4 +33,14 @@ const int COMPUTER_DEFAULTS[] = {
2, 28, 0, 998, -1
};
+const int RESOLVE_TABLE[] = {
+ 0x2A00, 0x4A00, 0x1000, 0x4B00, 0x2C00, 0x4F00, 0x1400, 0x5000,
+ 0x1700, 0x5100, 0x1800, 0x5200, 0x3300, 0x5400, 0x3700, 0x5500,
+ 0x1A00, 0x1C00, 0x1E00, 0x1F00, 0x2100, 0x2200, 0x2400, 0x2700,
+ 0x2B00, 0x1100, 0x4C00, 0x1200, 0x4D00, 0x1300, 0x4E00, 0x2E00,
+ 0x1900, 0x3200, 0x3400, 0x3800, 0x2800, 0x3E00, 0x4100, 0x2900,
+ 0x4400, 0x4600, 0x5300, 0x3900, 0x7600, 0x7200, 0x7300, 0x7400,
+ 0x7500
+};
+
} // End of namespace Voyeur
diff --git a/engines/voyeur/staticres.h b/engines/voyeur/staticres.h
index cd92ae467a..704ea35012 100644
--- a/engines/voyeur/staticres.h
+++ b/engines/voyeur/staticres.h
@@ -29,6 +29,8 @@ namespace Voyeur {
extern const int COMPUTER_DEFAULTS[];
+extern const int RESOLVE_TABLE[];
+
} // End of namespace Voyeur
#endif
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 74bb714e1a..56301e5107 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -66,6 +66,7 @@ private:
Common::Array<int> _resolves;
FontInfoResource _defaultFontInfo;
int _iForceDeath;
+ byte *_stampData;
void ESP_Init();
void initialiseManagers();
@@ -80,7 +81,9 @@ private:
bool doLock();
void showTitleScreen();
void doOpening();
+
void playStamp();
+ void initThreadStruct(int commandId);
protected:
// Engine APIs
virtual Common::Error run();
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 48c65c5045..43227d3dd8 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -21,6 +21,7 @@
*/
#include "voyeur/voyeur.h"
+#include "voyeur/staticres.h"
namespace Voyeur {
@@ -35,7 +36,27 @@ void VoyeurEngine::addVideoEventStart() {
}
void VoyeurEngine::playStamp() {
-
+ BoltFile *boltFile = NULL;
+ _filesManager.openBoltLib("stampblt.blt", boltFile);
+
+ boltFile->getBoltGroup(0x10000);
+ _voy._resolvePtr = &RESOLVE_TABLE[0];
+ byte *commandData = boltFile->memberAddr(3);
+ //uint32 commandId = READ_LE_UINT32(commandData);
+ //initThreadStruct(commandId);
+
+ _voy._delaySecs = 0;
+ _eventsManager._videoComputerNum = 9;
+ _eventsManager._videoComputerBut1 = 0;
+ _eventsManager._v2A0A2 = 0;
+ _voy._eCursorOff[53] = 1;
+
+ bool breakFlag = false;
+ while (!breakFlag && !shouldQuit()) {
+ breakFlag = true;
+ }
+
+ _voy._field4386 = 0;
}
} // End of namespace Voyeur