aboutsummaryrefslogtreecommitdiff
path: root/engines/saga
diff options
context:
space:
mode:
authorFilippos Karapetis2009-01-02 19:10:51 +0000
committerFilippos Karapetis2009-01-02 19:10:51 +0000
commit90d762c2612028892133d4aaf616b9eede9e397f (patch)
treee0c71e2f47c73475e0d769e62a9aa7c27368b053 /engines/saga
parent7c629b5f6a0daf5c9c62708774eefdbebc6dece9 (diff)
downloadscummvm-rg350-90d762c2612028892133d4aaf616b9eede9e397f.tar.gz
scummvm-rg350-90d762c2612028892133d4aaf616b9eede9e397f.tar.bz2
scummvm-rg350-90d762c2612028892133d4aaf616b9eede9e397f.zip
Wrapped more engine-specific code around appropriate ifdefs
svn-id: r35679
Diffstat (limited to 'engines/saga')
-rw-r--r--engines/saga/detection.cpp2
-rw-r--r--engines/saga/displayinfo.h2
-rw-r--r--engines/saga/resource.cpp16
-rw-r--r--engines/saga/saga.h1
-rw-r--r--engines/saga/script.cpp11
-rw-r--r--engines/saga/sfuncs.cpp23
-rw-r--r--engines/saga/sndres.cpp21
7 files changed, 51 insertions, 25 deletions
diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp
index ecda829d09..c54953737c 100644
--- a/engines/saga/detection.cpp
+++ b/engines/saga/detection.cpp
@@ -343,10 +343,12 @@ const GameDisplayInfo &SagaEngine::getDisplayInfo() {
case GID_IHNM:
return IHNM_DisplayInfo;
#endif
+#ifdef ENABLE_SAGA2
case GID_DINO:
return FTA2_DisplayInfo; // TODO
case GID_FTA2:
return FTA2_DisplayInfo;
+#endif
default:
error("getDisplayInfo: Unknown game ID");
return ITE_DisplayInfo; // unreachable
diff --git a/engines/saga/displayinfo.h b/engines/saga/displayinfo.h
index 7c426409ba..092d7d4e91 100644
--- a/engines/saga/displayinfo.h
+++ b/engines/saga/displayinfo.h
@@ -429,6 +429,7 @@ static const GameDisplayInfo IHNM_DisplayInfo = {
};
#endif
+#ifdef ENABLE_SAGA2
// TODO: Fill in missing bits, currently contains IHNM_DisplayInfo
static const GameDisplayInfo FTA2_DisplayInfo = {
640, 480, // logical width&height
@@ -495,6 +496,7 @@ static const GameDisplayInfo FTA2_DisplayInfo = {
ARRAYSIZE(IHNM_SavePanelButtons),
IHNM_SavePanelButtons
};
+#endif
} // End of namespace Saga
diff --git a/engines/saga/resource.cpp b/engines/saga/resource.cpp
index ec0404fcf5..163a049595 100644
--- a/engines/saga/resource.cpp
+++ b/engines/saga/resource.cpp
@@ -238,14 +238,18 @@ bool Resource::createContexts() {
{ "soundsd.cmp", true }
};
+#ifdef ENABLE_IHNM
SoundFileInfo sfxFilesIHNM[] = {
{ "sfx.res", false },
{ "sfx.cmp", true }
};
+#endif
+#ifdef ENABLE_SAGA2
SoundFileInfo sfxFilesFTA2[] = {
{ "ftasound.hrs", false }
};
+#endif
if (!soundFileInArray) {
// If the sound file is not specified in the detector table, add it here
@@ -256,10 +260,13 @@ bool Resource::createContexts() {
curSoundfiles = sfxFilesITE;
maxFile = 4;
break;
+#ifdef ENABLE_IHNM
case GID_IHNM:
curSoundfiles = sfxFilesIHNM;
maxFile = 2;
break;
+#endif
+#ifdef ENABLE_SAGA2
case GID_DINO:
// TODO
curSoundfiles = NULL;
@@ -269,6 +276,7 @@ bool Resource::createContexts() {
curSoundfiles = sfxFilesFTA2;
maxFile = 1;
break;
+#endif
}
for (i = 0; i < maxFile; i++) {
@@ -303,16 +311,20 @@ bool Resource::createContexts() {
{ "ite voices.bin", false }
};
+#ifdef ENABLE_IHNM
SoundFileInfo voiceFilesIHNM[] = {
{ "voicess.res", false },
{ "voicess.cmp", true },
{ "voicesd.res", false },
{ "voicesd.cmp", true },
};
+#endif
+#ifdef ENABLE_SAGA2
SoundFileInfo voiceFilesFTA2[] = {
{ "ftavoice.hrs", false },
};
+#endif
// Detect and add voice files
fileFound = false;
@@ -322,10 +334,13 @@ bool Resource::createContexts() {
curSoundfiles = voiceFilesITE;
maxFile = 7;
break;
+#ifdef ENABLE_IHNM
case GID_IHNM:
curSoundfiles = voiceFilesIHNM;
maxFile = 4;
break;
+#endif
+#ifdef ENABLE_SAGA2
case GID_DINO:
// TODO
curSoundfiles = NULL;
@@ -335,6 +350,7 @@ bool Resource::createContexts() {
curSoundfiles = voiceFilesFTA2;
maxFile = 1;
break;
+#endif
}
for (i = 0; i < maxFile; i++) {
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index 397f262736..62c88f693d 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -84,7 +84,6 @@ using Common::MemoryReadStreamEndian;
#define OBJECT_TYPE_SHIFT 13
#define OBJECT_TYPE_MASK ((1 << OBJECT_TYPE_SHIFT) - 1)
-#define OBJ_SPRITE_BASE 9
#define IHNM_OBJ_PROFILE 0x4000
#define memoryError(Place) error("%s Memory allocation error.", Place)
diff --git a/engines/saga/script.cpp b/engines/saga/script.cpp
index a39f2ddb3d..6bdbed87d6 100644
--- a/engines/saga/script.cpp
+++ b/engines/saga/script.cpp
@@ -305,6 +305,7 @@ void Script::setupScriptOpcodeList() {
OPCODE(opAnimate) // 87
};
+#ifdef ENABLE_SAGA2
static const ScriptOpDescription SAGA2ScriptOpcodes[] = {
OPCODE(opDummy), // 00: Undefined
// Internal operations
@@ -423,11 +424,14 @@ void Script::setupScriptOpcodeList() {
OPCODE(opJmpSeedRandom),// 97: Seeded random jump
OPCODE(opDummy) // 98: Get seeded export number (unused)
};
+#endif
if (!_vm->isSaga2()) {
_scriptOpsList = SAGA1ScriptOpcodes;
+#ifdef ENABLE_SAGA2
} else {
- _scriptOpsList = SAGA2ScriptOpcodes;
+ _scriptOpsList = SAGA2ScriptOpcodes;
+#endif
}
}
@@ -1222,8 +1226,8 @@ int Script::getVerbType(VerbTypes verbType) {
case kVerbOptions:
return kVerbITEOptions;
}
- }
- else {
+#ifdef ENABLE_IHNM
+ } else if (_vm->getGameId() == GID_IHNM) {
switch (verbType) {
case kVerbNone:
return kVerbIHNMNone;
@@ -1252,6 +1256,7 @@ int Script::getVerbType(VerbTypes verbType) {
case kVerbOptions:
return kVerbIHNMOptions;
}
+#endif
}
error("Script::getVerbType() unknown verb type %d", verbType);
}
diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp
index 8467c9f9ed..a274983de1 100644
--- a/engines/saga/sfuncs.cpp
+++ b/engines/saga/sfuncs.cpp
@@ -500,12 +500,8 @@ void Script::sfScriptGotoScene(SCRIPTFUNC_PARAMS) {
void Script::sfSetObjImage(SCRIPTFUNC_PARAMS) {
uint16 objectId = thread->pop();
uint16 spriteId = thread->pop();
- ObjectData *obj = _vm->_actor->getObj(objectId);
- if (_vm->getGameId() == GID_IHNM)
- obj->_spriteListResourceId = spriteId;
- else
- obj->_spriteListResourceId = OBJ_SPRITE_BASE + spriteId;
+ _vm->_actor->getObj(objectId)->_spriteListResourceId = spriteId + (_vm->getGameId() == GID_ITE ? 9 : 0);
_vm->_interface->refreshInventory();
}
@@ -515,21 +511,14 @@ void Script::sfSetObjImage(SCRIPTFUNC_PARAMS) {
void Script::sfSetObjName(SCRIPTFUNC_PARAMS) {
uint16 objectId = thread->pop();
uint16 nameIdx = thread->pop();
- ObjectData *obj = _vm->_actor->getObj(objectId);
-
- obj->_nameIndex = nameIdx;
+ _vm->_actor->getObj(objectId)->_nameIndex = nameIdx;
}
// Script function #19 (0x13)
// Param1: object id
void Script::sfGetObjImage(SCRIPTFUNC_PARAMS) {
uint16 objectId = thread->pop();
- ObjectData *obj = _vm->_actor->getObj(objectId);
-
- if (_vm->getGameId() == GID_IHNM)
- thread->_returnValue = obj->_spriteListResourceId;
- else
- thread->_returnValue = obj->_spriteListResourceId - OBJ_SPRITE_BASE;
+ thread->_returnValue = _vm->_actor->getObj(objectId)->_spriteListResourceId - (_vm->getGameId() == GID_ITE ? 9 : 0);
}
// Script function #20 (0x14)
@@ -732,7 +721,7 @@ void Script::sfDropObject(SCRIPTFUNC_PARAMS) {
if (spriteId > 0 || (spriteId == 0 && objectId == IHNM_OBJ_PROFILE))
obj->_spriteListResourceId = spriteId;
} else {
- obj->_spriteListResourceId = OBJ_SPRITE_BASE + spriteId;
+ obj->_spriteListResourceId = spriteId + 9;
}
}
@@ -1360,7 +1349,8 @@ void Script::sfPlayMusic(SCRIPTFUNC_PARAMS) {
} else {
_vm->_music->stop();
}
- } else {
+#ifdef ENABLE_IHNM
+ } else if (_vm->getGameId() == GID_IHNM) {
int16 param1 = thread->pop();
int16 param2 = thread->pop();
@@ -1382,6 +1372,7 @@ void Script::sfPlayMusic(SCRIPTFUNC_PARAMS) {
_vm->_scene->setChapterPointsChanged(false);
}
}
+#endif
}
}
diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp
index 4b11a8612c..f7c3b07beb 100644
--- a/engines/saga/sndres.cpp
+++ b/engines/saga/sndres.cpp
@@ -38,7 +38,9 @@
#include "sound/wave.h"
#include "sound/adpcm.h"
#include "sound/aiff.h"
+#ifdef ENABLE_SAGA2
#include "sound/shorten.h"
+#endif
#include "sound/audiostream.h"
namespace Saga {
@@ -96,24 +98,29 @@ SndRes::SndRes(SagaEngine *vm) : _vm(vm) {
_fxTable = 0;
_fxTableLen = 0;
#endif
+#ifdef ENABLE_SAGA2
} else if (_vm->getGameId() == GID_DINO) {
// TODO
} else if (_vm->getGameId() == GID_FTA2) {
// TODO
+#endif
}
}
SndRes::~SndRes() {
+#ifdef ENABLE_IHNM
if (_vm->getGameId() == GID_IHNM) {
free(_fxTable);
free(_fxTableIDs);
}
+#endif
}
void SndRes::setVoiceBank(int serial) {
if (_voiceSerial == serial)
return;
+#ifdef ENABLE_IHNM
// If we got the Macintosh version of IHNM, just set the voice bank
// so that we know which voices* subfolder to look for later
if (_vm->getGameId() == GID_IHNM && _vm->isMacResources()) {
@@ -125,6 +132,7 @@ void SndRes::setVoiceBank(int serial) {
_voiceContext->serial = 0;
return;
}
+#endif
// If there are no voice files present, don't set the voice bank
if (!_vm->_voiceFilesExist)
@@ -192,6 +200,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
return false;
}
+#ifdef ENABLE_IHNM
if (_vm->getGameId() == GID_IHNM && _vm->isMacResources()) {
char soundFileName[40];
int dirIndex = resourceId / 64;
@@ -210,14 +219,14 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
file->open(soundFileName);
soundResourceLength = file->size();
- } else {
-
+ } else
+#endif
+ {
ResourceData* resourceData = context->getResourceData(resourceId);
file = context->getFile(resourceData);
file->seek(resourceData->offset);
soundResourceLength = resourceData->size;
-
}
Common::SeekableReadStream& readS = *file;
@@ -314,13 +323,15 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
result = Audio::loadWAVFromStream(readS, size, rate, flags);
} else if (resourceType == kSoundAIFF) {
result = Audio::loadAIFFFromStream(readS, size, rate, flags);
- } else if (resourceType == kSoundShorten) {
- result = Audio::loadShortenFromStream(readS, size, rate, flags);
} else if (resourceType == kSoundVOC) {
data = Audio::loadVOCFromStream(readS, size, rate);
result = (data != 0);
if (onlyHeader)
free(data);
+#ifdef ENABLE_SAGA2
+ } else if (resourceType == kSoundShorten) {
+ result = Audio::loadShortenFromStream(readS, size, rate, flags);
+#endif
}
if (result) {