mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
VOYEUR: Beginnings of Bolt init function array
This commit is contained in:
parent
3c6507812e
commit
aff7c3d9bd
@ -21,10 +21,22 @@
|
||||
*/
|
||||
|
||||
#include "voyeur/events.h"
|
||||
#include "voyeur/voyeur.h"
|
||||
|
||||
namespace Voyeur {
|
||||
|
||||
void EventManager::resetMouse() {
|
||||
void EventsManager::resetMouse() {
|
||||
// No implementation
|
||||
}
|
||||
|
||||
void EventsManager::startMainClockInt() {
|
||||
_mainIntNode._intFunc = mainVoyeurIntFunc;
|
||||
_mainIntNode._flags = 0;
|
||||
_mainIntNode._curTime = 0;
|
||||
_mainIntNode._timeReset = _vm->_graphicsManager._palFlag ? 50 : 60;
|
||||
}
|
||||
|
||||
void EventsManager::mainVoyeurIntFunc() {
|
||||
|
||||
}
|
||||
|
||||
|
@ -24,19 +24,28 @@
|
||||
#define VOYEUR_EVENTS_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "voyeur/game.h"
|
||||
|
||||
namespace Voyeur {
|
||||
|
||||
class VoyeurEngine;
|
||||
|
||||
class EventManager {
|
||||
class EventsManager {
|
||||
private:
|
||||
VoyeurEngine *_vm;
|
||||
|
||||
static void mainVoyeurIntFunc();
|
||||
public:
|
||||
EventManager() {}
|
||||
IntNode _fadeIntNode;
|
||||
IntNode _cycleIntNode;
|
||||
IntNode _evintnode;
|
||||
IntNode _mainIntNode;
|
||||
public:
|
||||
EventsManager() {}
|
||||
void setVm(VoyeurEngine *vm) { _vm = vm; }
|
||||
|
||||
void resetMouse();
|
||||
void startMainClockInt();
|
||||
};
|
||||
|
||||
} // End of namespace Voyeur
|
||||
|
@ -67,6 +67,16 @@ int BoltFile::_runType;
|
||||
int BoltFile::_runValue;
|
||||
int BoltFile::_runOffset;
|
||||
|
||||
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::initDefault, &BoltFile::initFontInfo,
|
||||
&BoltFile::initSoundMap, &BoltFile::initDefault, &BoltFile::initDefault, &BoltFile::initDefault,
|
||||
&BoltFile::initDefault, &BoltFile::initDefault
|
||||
};
|
||||
|
||||
BoltFile::BoltFile() {
|
||||
if (!_curFd.open("bvoy.blt"))
|
||||
error("Could not open buoy.blt");
|
||||
@ -167,15 +177,14 @@ byte *BoltFile::getBoltMember(uint32 id) {
|
||||
|
||||
_decompState = 0;
|
||||
_historyIndex = 0;
|
||||
initType();
|
||||
|
||||
// Initialise the resource
|
||||
assert(_curMemberPtr->_initMethod < 25);
|
||||
(this->*_fnInitType[_curMemberPtr->_initMethod])();
|
||||
|
||||
return _curMemberPtr->_data;
|
||||
}
|
||||
|
||||
void BoltFile::initType() {
|
||||
_curMemberPtr->_data = decompress(0, _curMemberPtr->_size, _curMemberPtr->_mode);
|
||||
}
|
||||
|
||||
#define NEXT_BYTE if (--_bytesLeft <= 0) nextBlock()
|
||||
|
||||
byte *BoltFile::decompress(byte *buf, int size, int mode) {
|
||||
@ -287,6 +296,38 @@ void BoltFile::nextBlock() {
|
||||
_bufPos = _bufStart;
|
||||
}
|
||||
|
||||
void BoltFile::initDefault() {
|
||||
_curMemberPtr->_data = decompress(0, _curMemberPtr->_size, _curMemberPtr->_mode);
|
||||
}
|
||||
|
||||
void BoltFile::sInitPic() {
|
||||
error("TODO: sInitPic not implemented");
|
||||
}
|
||||
|
||||
void BoltFile::vInitCMap() {
|
||||
error("TODO: vInitCMap not implemented");
|
||||
}
|
||||
|
||||
void BoltFile::vInitCycl() {
|
||||
error("TODO: vInitCycl not implemented");
|
||||
}
|
||||
|
||||
void BoltFile::initViewPort() {
|
||||
error("TODO: initViewPort not implemented");
|
||||
}
|
||||
|
||||
void BoltFile::initViewPortList() {
|
||||
error("TODO: initViewPortList not implemented");
|
||||
}
|
||||
|
||||
void BoltFile::initFontInfo() {
|
||||
error("TODO: initFontInfo not implemented");
|
||||
}
|
||||
|
||||
void BoltFile::initSoundMap() {
|
||||
error("TODO: initSoundMap not implemented");
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
BoltGroup::BoltGroup(Common::SeekableReadStream *f): _file(f) {
|
||||
@ -320,7 +361,7 @@ BoltEntry::BoltEntry(Common::SeekableReadStream *f): _file(f) {
|
||||
_file->read(&buffer[0], 16);
|
||||
_mode = buffer[0];
|
||||
_field1 = buffer[1];
|
||||
_field3 = buffer[3];
|
||||
_initMethod = buffer[3];
|
||||
_xorMask = buffer[4] & 0xff; // TODO: Is this right??
|
||||
_size = READ_LE_UINT32(&buffer[4]);
|
||||
_fileOffset = READ_LE_UINT32(&buffer[8]);
|
||||
|
@ -30,10 +30,13 @@
|
||||
namespace Voyeur {
|
||||
|
||||
class VoyeurEngine;
|
||||
class BoltFile;
|
||||
class BoltGroup;
|
||||
class BoltEntry;
|
||||
#define DECOMPRESS_SIZE 0x7000
|
||||
|
||||
typedef void (BoltFile::*BoltMethodPtr)();
|
||||
|
||||
class BoltFile {
|
||||
private:
|
||||
static BoltFile *_curLibPtr;
|
||||
@ -59,10 +62,21 @@ private:
|
||||
static int _runType;
|
||||
static int _runValue;
|
||||
static int _runOffset;
|
||||
static const BoltMethodPtr _fnInitType[25];
|
||||
private:
|
||||
Common::File _curFd;
|
||||
Common::Array<BoltGroup> _groups;
|
||||
|
||||
// initType method table
|
||||
void initDefault();
|
||||
void sInitPic();
|
||||
void vInitCMap();
|
||||
void vInitCycl();
|
||||
void initViewPort();
|
||||
void initViewPortList();
|
||||
void initFontInfo();
|
||||
void initSoundMap();
|
||||
|
||||
// Decompression
|
||||
byte *decompress(byte *buf, int size, int mode);
|
||||
void nextBlock();
|
||||
@ -70,8 +84,7 @@ private:
|
||||
void resolveAll() {}
|
||||
byte *getBoltMember(uint32 id);
|
||||
|
||||
// Methods copied into bolt virtual table
|
||||
void initType();
|
||||
void initType() {}
|
||||
void termType() {}
|
||||
void initMem(int id) {}
|
||||
void termMem() {}
|
||||
@ -108,7 +121,7 @@ private:
|
||||
public:
|
||||
byte _mode;
|
||||
byte _field1;
|
||||
byte _field3;
|
||||
byte _initMethod;
|
||||
int _fileOffset;
|
||||
byte _xorMask;
|
||||
int _size;
|
||||
|
@ -37,17 +37,18 @@ void GraphicsManager::sInitGraphics() {
|
||||
}
|
||||
|
||||
void GraphicsManager::addFadeInt() {
|
||||
_fadeIntNode._intFunc = fadeIntFunc;
|
||||
_fadeIntNode._flags = 0;
|
||||
_fadeIntNode._curTime = 0;
|
||||
_fadeIntNode._timeReset = 1;
|
||||
IntNode &node = _vm->_eventsManager._fadeIntNode;
|
||||
node._intFunc = fadeIntFunc;
|
||||
node._flags = 0;
|
||||
node._curTime = 0;
|
||||
node._timeReset = 1;
|
||||
|
||||
_vm->_intPtr.addIntNode(&_fadeIntNode);
|
||||
_vm->_intPtr.addIntNode(&node);
|
||||
}
|
||||
|
||||
void GraphicsManager::vInitColor() {
|
||||
_fadeIntNode._intFunc = vDoFadeInt;
|
||||
_cycleIntNode._intFunc = vDoCycleInt;
|
||||
_vm->_eventsManager._fadeIntNode._intFunc = vDoFadeInt;
|
||||
_vm->_eventsManager._cycleIntNode._intFunc = vDoCycleInt;
|
||||
// TODO: more
|
||||
}
|
||||
|
||||
@ -63,4 +64,26 @@ void GraphicsManager::vDoCycleInt() {
|
||||
|
||||
}
|
||||
|
||||
void GraphicsManager::setupViewPort() {
|
||||
setupViewPort(&GraphicsManager::setupMCGASaveRect, &GraphicsManager::addRectOptSaveRect,
|
||||
&GraphicsManager::restoreMCGASaveRect);
|
||||
}
|
||||
|
||||
void GraphicsManager::setupViewPort(GraphicMethodPtr setupFn,
|
||||
GraphicMethodPtr addRectFn, GraphicMethodPtr restoreFn) {
|
||||
|
||||
}
|
||||
|
||||
void GraphicsManager::setupMCGASaveRect() {
|
||||
|
||||
}
|
||||
|
||||
void GraphicsManager::restoreMCGASaveRect() {
|
||||
|
||||
}
|
||||
|
||||
void GraphicsManager::addRectOptSaveRect() {
|
||||
|
||||
}
|
||||
|
||||
} // End of namespace Voyeur
|
||||
|
@ -36,22 +36,29 @@ namespace Voyeur {
|
||||
#define PALETTE_SIZE (256 * 3)
|
||||
|
||||
class VoyeurEngine;
|
||||
class GraphicsManager;
|
||||
|
||||
typedef void (GraphicsManager::*GraphicMethodPtr)();
|
||||
|
||||
class GraphicsManager {
|
||||
public:
|
||||
VoyeurEngine *_vm;
|
||||
bool _palFlag;
|
||||
IntNode _fadeIntNode;
|
||||
IntNode _cycleIntNode;
|
||||
IntNode _evintnode;
|
||||
IntNode _mainintnode;
|
||||
byte _VGAColors[PALETTE_SIZE];
|
||||
Common::Array<byte *> _colorChain;
|
||||
byte *_backgroundPage;
|
||||
private:
|
||||
static void fadeIntFunc();
|
||||
static void vDoFadeInt();
|
||||
static void vDoCycleInt();
|
||||
|
||||
void setupMCGASaveRect();
|
||||
void restoreMCGASaveRect();
|
||||
void addRectOptSaveRect();
|
||||
|
||||
void addIntNode(IntNode *node);
|
||||
void setupViewPort(GraphicMethodPtr setupFn, GraphicMethodPtr addRectFn,
|
||||
GraphicMethodPtr restoreFn);
|
||||
public:
|
||||
GraphicsManager();
|
||||
void setVm(VoyeurEngine *vm) { _vm = vm; }
|
||||
@ -59,6 +66,7 @@ public:
|
||||
|
||||
void vInitColor();
|
||||
void addFadeInt();
|
||||
void setupViewPort();
|
||||
};
|
||||
|
||||
} // End of namespace Voyeur
|
||||
|
@ -33,11 +33,13 @@ VoyeurEngine *g_vm;
|
||||
VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) : Engine(syst),
|
||||
_gameDescription(gameDesc), _randomSource("Voyeur") {
|
||||
DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
|
||||
_bVoyBoltFile = NULL;
|
||||
_bVoy = NULL;
|
||||
|
||||
initialiseManagers();
|
||||
}
|
||||
|
||||
VoyeurEngine::~VoyeurEngine() {
|
||||
delete _bVoyBoltFile;
|
||||
delete _bVoy;
|
||||
}
|
||||
|
||||
Common::String VoyeurEngine::generateSaveName(int slot) {
|
||||
@ -77,7 +79,8 @@ Common::Error VoyeurEngine::run() {
|
||||
ESP_Init();
|
||||
globalInitBolt();
|
||||
|
||||
_eventManager.resetMouse();
|
||||
_eventsManager.resetMouse();
|
||||
doHeadTitle();
|
||||
|
||||
//doHeadTitle();
|
||||
|
||||
@ -90,7 +93,7 @@ int VoyeurEngine::getRandomNumber(int maxNumber) {
|
||||
}
|
||||
|
||||
void VoyeurEngine::initialiseManagers() {
|
||||
_eventManager.setVm(this);
|
||||
_eventsManager.setVm(this);
|
||||
_graphicsManager.setVm(this);
|
||||
}
|
||||
|
||||
@ -100,22 +103,22 @@ void VoyeurEngine::ESP_Init() {
|
||||
void VoyeurEngine::globalInitBolt() {
|
||||
initBolt();
|
||||
|
||||
_filesManager.openBoltLib("bvoy.blt", _bVoyBoltFile);
|
||||
_bVoyBoltFile->getBoltGroup(0x10000);
|
||||
_bVoyBoltFile->getBoltGroup(0x10100);
|
||||
_fontPtr = _bVoyBoltFile->memberAddr(0x101);
|
||||
_filesManager.openBoltLib("bvoy.blt", _bVoy);
|
||||
_bVoy->getBoltGroup(0x10000);
|
||||
_bVoy->getBoltGroup(0x10100);
|
||||
_fontPtr = _bVoy->memberAddr(0x101);
|
||||
|
||||
// Setup default flags
|
||||
Common::fill((byte *)&_voy, (byte *)&_voy + sizeof(SVoy), 0);
|
||||
_voy._eCursorOff[0x74 / 2] = 1;
|
||||
_voy._eCursorOff[0x68 / 2] = 0;
|
||||
_voy._eventTable[0x3e6]._data3 = 63;
|
||||
_voy._eventTable[0x3e6]._data4 = 63;
|
||||
_voy._eventTable[998]._data3 = 63;
|
||||
_voy._eventTable[998]._data4 = 63;
|
||||
_voy._evidence[19] = 0;
|
||||
_voy._evidence[17] = 0;
|
||||
_voy._evidence[18] = 9999;
|
||||
|
||||
_voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90;
|
||||
_voy._curICF0 = _graphicsManager._palFlag ? 0xFFFFA5E0 : 0x5F90;
|
||||
_graphicsManager.addFadeInt();
|
||||
}
|
||||
|
||||
@ -133,4 +136,14 @@ void VoyeurEngine::vInitInterrupts() {
|
||||
void VoyeurEngine::initInput() {
|
||||
}
|
||||
|
||||
void VoyeurEngine::doHeadTitle() {
|
||||
char dest[144];
|
||||
|
||||
_eventsManager.startMainClockInt();
|
||||
if (_bVoy->getBoltGroup(0x10500)) {
|
||||
_graphicsManager._backgroundPage = _bVoy->memberAddr(0x502);
|
||||
// _graphicsManager._vPort.setupViewPort();
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Voyeur
|
||||
|
@ -62,11 +62,8 @@ class VoyeurEngine : public Engine {
|
||||
private:
|
||||
const VoyeurGameDescription *_gameDescription;
|
||||
Common::RandomSource _randomSource;
|
||||
EventManager _eventManager;
|
||||
FilesManager _filesManager;
|
||||
GraphicsManager _graphicsManager;
|
||||
|
||||
BoltFile *_bVoyBoltFile;
|
||||
BoltFile *_bVoy;
|
||||
byte *_fontPtr;
|
||||
SVoy _voy;
|
||||
Common::Array<int> _resolves;
|
||||
@ -83,6 +80,9 @@ protected:
|
||||
virtual bool hasFeature(EngineFeature f) const;
|
||||
public:
|
||||
IntData _intPtr;
|
||||
EventsManager _eventsManager;
|
||||
FilesManager _filesManager;
|
||||
GraphicsManager _graphicsManager;
|
||||
public:
|
||||
VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc);
|
||||
virtual ~VoyeurEngine();
|
||||
@ -100,6 +100,8 @@ public:
|
||||
virtual bool canSaveGameStateCurrently();
|
||||
virtual Common::Error loadGameState(int slot);
|
||||
virtual Common::Error saveGameState(int slot, const Common::String &desc);
|
||||
|
||||
void doHeadTitle();
|
||||
};
|
||||
|
||||
} // End of namespace Voyeur
|
||||
|
Loading…
Reference in New Issue
Block a user