mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-26 12:48:16 +00:00
MACVENTURE: Load general settings
This commit is contained in:
parent
61134cf570
commit
c676bb9923
@ -37,6 +37,12 @@ enum {
|
||||
kMaxMenuTitleLength = 30
|
||||
};
|
||||
|
||||
enum {
|
||||
kGlobalSettingsID = 0x80,
|
||||
kDiplomaGeometryID = 0x81,
|
||||
kTextHuffmanTableID = 0x83
|
||||
};
|
||||
|
||||
MacVentureEngine::MacVentureEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst) {
|
||||
_gameDescription = gameDesc;
|
||||
_rnd = new Common::RandomSource("macventure");
|
||||
@ -65,13 +71,13 @@ Common::Error MacVentureEngine::run() {
|
||||
// Additional setup.
|
||||
debug("MacVentureEngine::init");
|
||||
|
||||
// Your main even loop should be (invoked from) here.
|
||||
debug("MacVentureEngine::go: Hello, World!");
|
||||
|
||||
_resourceManager = new Common::MacResManager();
|
||||
if (!_resourceManager->open(getGameFileName()))
|
||||
error("Could not open %s as a resource fork", getGameFileName());
|
||||
|
||||
if (!loadGlobalSettings())
|
||||
error("Could not load the engine settings");
|
||||
|
||||
_gui = new Gui(this, _resourceManager);
|
||||
|
||||
_shouldQuit = false;
|
||||
@ -87,6 +93,51 @@ Common::Error MacVentureEngine::run() {
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
bool MacVentureEngine::loadGlobalSettings() {
|
||||
Common::MacResIDArray resArray;
|
||||
Common::SeekableReadStream *res;
|
||||
|
||||
if ((resArray = _resourceManager->getResIDArray(MKTAG('G', 'N', 'R', 'L'))).size() == 0)
|
||||
return false;
|
||||
|
||||
res = _resourceManager->getResource(MKTAG('G', 'N', 'R', 'L'), kGlobalSettingsID);
|
||||
if (res) {
|
||||
_globalSettings.numObjects = res->readUint16BE();
|
||||
_globalSettings.numGlobals = res->readUint16BE();
|
||||
_globalSettings.numCommands = res->readUint16BE();
|
||||
_globalSettings.numAttributes = res->readUint16BE();
|
||||
_globalSettings.numGroups = res->readUint16BE();
|
||||
res->readUint16BE(); // unknown
|
||||
_globalSettings.invTop = res->readUint16BE();
|
||||
_globalSettings.invLeft = res->readUint16BE();
|
||||
_globalSettings.invWidth = res->readUint16BE();
|
||||
_globalSettings.invHeight = res->readUint16BE();
|
||||
_globalSettings.invOffsetY = res->readUint16BE();
|
||||
_globalSettings.invOffsetX = res->readSint16BE();
|
||||
_globalSettings.defaultFont = res->readUint16BE();
|
||||
_globalSettings.defaultSize = res->readUint16BE();
|
||||
|
||||
_globalSettings.attrIndices = new uint8[_globalSettings.numAttributes];
|
||||
res->read(_globalSettings.attrIndices, _globalSettings.numAttributes);
|
||||
|
||||
_globalSettings.attrMasks = new uint16[_globalSettings.numAttributes];
|
||||
for (int i = 0; i < _globalSettings.numAttributes; i++)
|
||||
_globalSettings.attrMasks[i] = res->readUint16BE();
|
||||
|
||||
_globalSettings.attrShifts = new uint8[_globalSettings.numAttributes];
|
||||
res->read(_globalSettings.attrShifts, _globalSettings.numAttributes);
|
||||
|
||||
_globalSettings.cmdArgCnts = new uint8[_globalSettings.numCommands];
|
||||
res->read(_globalSettings.cmdArgCnts, _globalSettings.numCommands);
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void MacVentureEngine::requestQuit() {
|
||||
_shouldQuit = true;
|
||||
}
|
||||
|
@ -50,6 +50,27 @@ enum {
|
||||
// the current limitation is 32 debug levels (1 << 31 is the last one)
|
||||
};
|
||||
|
||||
struct GlobalSettings {
|
||||
uint16 numObjects; // number of game objects defined
|
||||
uint16 numGlobals; // number of globals defined
|
||||
uint16 numCommands; // number of commands defined
|
||||
uint16 numAttributes; // number of attributes
|
||||
uint16 numGroups; // number of object groups
|
||||
uint16 invTop; // inventory window bounds
|
||||
uint16 invLeft;
|
||||
uint16 invHeight;
|
||||
uint16 invWidth;
|
||||
uint16 invOffsetY; // positioning offset for
|
||||
uint16 invOffsetX; // new inventory windows
|
||||
uint16 defaultFont; // default font
|
||||
uint16 defaultSize; // default font size
|
||||
uint8 *attrIndices; // attribute indices into attribute table
|
||||
uint16 *attrMasks; // attribute masks
|
||||
uint8 *attrShifts; // attribute bit shifts
|
||||
uint8 *cmdArgCnts; // command argument counts
|
||||
uint8 *commands; // command buttons
|
||||
};
|
||||
|
||||
class MacVentureEngine : public Engine {
|
||||
|
||||
public:
|
||||
@ -61,6 +82,9 @@ public:
|
||||
void requestQuit();
|
||||
void requestUnpause();
|
||||
|
||||
// Data loading
|
||||
bool loadGlobalSettings();
|
||||
|
||||
// Data retrieval
|
||||
bool isPaused();
|
||||
Common::String getCommandsPausedString();
|
||||
@ -76,10 +100,12 @@ private: // Attributes
|
||||
Common::MacResManager *_resourceManager;
|
||||
|
||||
Console *_debugger;
|
||||
|
||||
Gui *_gui;
|
||||
|
||||
// Engine state
|
||||
GlobalSettings _globalSettings;
|
||||
bool _shouldQuit;
|
||||
bool _paused;
|
||||
|
||||
private: // Methods
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user