mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
Implemented some trivial IHNM opcodes. I'm not sure if the _ethicsPoints[]
array is large enough though. These opcodes modify what I assume to be the game state, so that information needs to be stored in the savegames. Not for ITE, though, so savegame compatibility is not broken by this. (Not deliberately, at least.) svn-id: r18885
This commit is contained in:
parent
c5e12edfaf
commit
3e99ea96a3
@ -118,6 +118,8 @@ SagaEngine::SagaEngine(GameDetector *detector, OSystem *syst)
|
||||
_puzzle = NULL;
|
||||
|
||||
_frameCount = 0;
|
||||
_globalFlags = 0;
|
||||
memset(_ethicsPoints, 0, sizeof(_ethicsPoints));
|
||||
|
||||
// The Linux version of Inherit the Earth puts all data files in an
|
||||
// 'itedata' sub-directory, except for voices.rsc
|
||||
|
@ -570,6 +570,9 @@ public:
|
||||
return isSaveListFull() ? _saveFilesCount : _saveFilesCount + 1;
|
||||
}
|
||||
|
||||
uint32 _globalFlags;
|
||||
byte _ethicsPoints[5]; // TODO: Verify that this is large enough
|
||||
|
||||
int _soundVolume;
|
||||
int _musicVolume;
|
||||
bool _subtitlesEnabled;
|
||||
|
@ -178,6 +178,12 @@ void SagaEngine::save(const char *fileName, const char *saveName) {
|
||||
// Inset scene
|
||||
out->writeSint32LE(_scene->currentSceneNumber());
|
||||
|
||||
if (getGameType() != GType_ITE) {
|
||||
out->writeUint32LE(_globalFlags);
|
||||
for (int i = 0; i < ARRAYSIZE(_ethicsPoints); i++)
|
||||
out->writeByte(_ethicsPoints[i]);
|
||||
}
|
||||
|
||||
_interface->saveState(out);
|
||||
|
||||
_actor->saveState(out);
|
||||
@ -217,6 +223,12 @@ void SagaEngine::load(const char *fileName) {
|
||||
// Inset scene
|
||||
insetSceneNumber = in->readSint32LE();
|
||||
|
||||
if (getGameType() != GType_ITE) {
|
||||
_globalFlags = in->readUint32LE();
|
||||
for (int i = 0; i < ARRAYSIZE(_ethicsPoints); i++)
|
||||
_ethicsPoints[i] = in->readByte();
|
||||
}
|
||||
|
||||
_interface->loadState(in);
|
||||
|
||||
_actor->loadState(in);
|
||||
|
@ -1921,23 +1921,43 @@ void Script::sfVsetTrack(SCRIPTFUNC_PARAMS) {
|
||||
}
|
||||
|
||||
void Script::sfGetPoints(SCRIPTFUNC_PARAMS) {
|
||||
SF_stub("sfGetPoints", thread, nArgs);
|
||||
int16 index = thread->pop();
|
||||
|
||||
if (index >= 0 && index < ARRAYSIZE(_vm->_ethicsPoints))
|
||||
thread->_returnValue = _vm->_ethicsPoints[index];
|
||||
else
|
||||
thread->_returnValue = 0;
|
||||
}
|
||||
|
||||
void Script::sfSetGlobalFlag(SCRIPTFUNC_PARAMS) {
|
||||
SF_stub("sfSetGlobalFlag", thread, nArgs);
|
||||
int16 flag = thread->pop();
|
||||
|
||||
if (flag >= 0 && flag < 32)
|
||||
_vm->_globalFlags |= (1 << flag);
|
||||
}
|
||||
|
||||
void Script::sfClearGlobalFlag(SCRIPTFUNC_PARAMS) {
|
||||
SF_stub("sfClearGlobalFlag", thread, nArgs);
|
||||
int16 flag = thread->pop();
|
||||
|
||||
if (flag >= 0 && flag < 32)
|
||||
_vm->_globalFlags &= ~(1 << flag);
|
||||
}
|
||||
|
||||
void Script::sfTestGlobalFlag(SCRIPTFUNC_PARAMS) {
|
||||
SF_stub("sfTestGlobalFlag", thread, nArgs);
|
||||
int16 flag = thread->pop();
|
||||
|
||||
if (flag >= 0 && flag < 32 && _vm->_globalFlags & (1 << flag))
|
||||
thread->_returnValue = 1;
|
||||
else
|
||||
thread->_returnValue = 0;
|
||||
}
|
||||
|
||||
void Script::sfSetPoints(SCRIPTFUNC_PARAMS) {
|
||||
SF_stub("sfSetPoints", thread, nArgs);
|
||||
int16 index = thread->pop();
|
||||
int16 points = thread->pop();
|
||||
|
||||
if (index >= 0 && index < ARRAYSIZE(_vm->_ethicsPoints))
|
||||
_vm->_ethicsPoints[index] = points;
|
||||
}
|
||||
|
||||
void Script::sfSetSpeechBox(SCRIPTFUNC_PARAMS) {
|
||||
|
Loading…
Reference in New Issue
Block a user