- Added some stubs for the SAGA2 games dino and fta2

- Stopped loading the isomap and puzzle game modules for IHNM, as they are not used for that game (this saves some memory for IHNM)
- Removed getDisplayWidth() and getDisplayHeight()

svn-id: r35473
This commit is contained in:
Filippos Karapetis 2008-12-21 22:52:44 +00:00
parent f6547e0691
commit 2257db88d3
20 changed files with 244 additions and 95 deletions

View File

@ -110,14 +110,14 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) {
_lastTickMsec = 0;
_yCellCount = _vm->_scene->getHeight();
_xCellCount = _vm->getDisplayWidth();
_xCellCount = _vm->getDisplayInfo().logicalWidth;
_pathCell = (int8 *)malloc(_yCellCount * _xCellCount * sizeof(*_pathCell));
_pathRect.left = 0;
_pathRect.right = _vm->getDisplayWidth();
_pathRect.right = _vm->getDisplayInfo().logicalWidth;
_pathRect.top = _vm->getDisplayInfo().pathStartY;
_pathRect.bottom = _vm->_scene->getHeight();
_pathRect.bottom = _vm->getDisplayInfo().logicalHeight;
// Get actor resource file context
_actorContext = _vm->_resource->getContext(GAME_RESOURCEFILE);
@ -820,13 +820,13 @@ void Actor::handleSpeech(int msec) {
height = _vm->_font->getHeight(kKnownFontScript, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
if (_vm->getGameId() == GID_IHNM) {
if (height > _vm->_scene->getHeight(true) / 2 && width < _vm->getDisplayWidth() - 20) {
width = _vm->getDisplayWidth() - 20;
if (height > _vm->_scene->getHeight(true) / 2 && width < _vm->getDisplayInfo().logicalWidth - 20) {
width = _vm->getDisplayInfo().logicalWidth - 20;
height = _vm->_font->getHeight(kKnownFontScript, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
}
} else if (_vm->getGameId() == GID_ITE) {
if (height > 40 && width < _vm->getDisplayWidth() - 100) {
width = _vm->getDisplayWidth() - 100;
if (height > 40 && width < _vm->getDisplayInfo().logicalWidth - 100) {
width = _vm->getDisplayInfo().logicalWidth - 100;
height = _vm->_font->getHeight(kKnownFontScript, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
}
}
@ -837,8 +837,8 @@ void Actor::handleSpeech(int msec) {
actor = getActor(_activeSpeech.actorIds[0]);
_activeSpeech.speechBox.setHeight(height);
if (_activeSpeech.speechBox.right > _vm->getDisplayWidth() - 10) {
_activeSpeech.drawRect.left = _vm->getDisplayWidth() - 10 - width;
if (_activeSpeech.speechBox.right > _vm->getDisplayInfo().logicalWidth - 10) {
_activeSpeech.drawRect.left = _vm->getDisplayInfo().logicalWidth - 10 - width;
} else {
_activeSpeech.drawRect.left = _activeSpeech.speechBox.left;
}
@ -891,7 +891,7 @@ bool Actor::calcScreenPosition(CommonObjectData *commonObjectData) {
}
result = commonObjectData->_screenPosition.x > -64 &&
commonObjectData->_screenPosition.x < _vm->getDisplayWidth() + 64 &&
commonObjectData->_screenPosition.x < _vm->getDisplayInfo().logicalWidth + 64 &&
commonObjectData->_screenPosition.y > -64 &&
commonObjectData->_screenPosition.y < _vm->_scene->getHeight() + 64;
@ -1091,7 +1091,7 @@ void Actor::drawSpeech(void) {
actor = getActor(_activeSpeech.actorIds[i]);
calcScreenPosition(actor);
textPoint.x = CLIP(actor->_screenPosition.x - width / 2, 10, _vm->getDisplayWidth() - 10 - width);
textPoint.x = CLIP(actor->_screenPosition.x - width / 2, 10, _vm->getDisplayInfo().logicalWidth - 10 - width);
if (_vm->getGameId() == GID_ITE)
textPoint.y = CLIP(actor->_screenPosition.y - 58, 10, _vm->_scene->getHeight(true) - 10 - height);
@ -1130,7 +1130,7 @@ void Actor::actorSpeech(uint16 actorId, const char **strings, int stringsCount,
_activeSpeech.playing = false;
_activeSpeech.slowModeCharIndex = 0;
dist = MIN(actor->_screenPosition.x - 10, _vm->getDisplayWidth() - 10 - actor->_screenPosition.x);
dist = MIN(actor->_screenPosition.x - 10, _vm->getDisplayInfo().logicalWidth - 10 - actor->_screenPosition.x);
if (_vm->getGameId() == GID_ITE)
dist = CLIP<int16>(dist, 60, 150);
@ -1144,9 +1144,9 @@ void Actor::actorSpeech(uint16 actorId, const char **strings, int stringsCount,
_activeSpeech.speechBox.right += 10 - _activeSpeech.speechBox.left;
_activeSpeech.speechBox.left = 10;
}
if (_activeSpeech.speechBox.right > _vm->getDisplayWidth() - 10) {
_activeSpeech.speechBox.left -= _activeSpeech.speechBox.right - _vm->getDisplayWidth() - 10;
_activeSpeech.speechBox.right = _vm->getDisplayWidth() - 10;
if (_activeSpeech.speechBox.right > _vm->getDisplayInfo().logicalWidth - 10) {
_activeSpeech.speechBox.left -= _activeSpeech.speechBox.right - _vm->getDisplayInfo().logicalWidth - 10;
_activeSpeech.speechBox.right = _vm->getDisplayInfo().logicalWidth - 10;
}
// HACK for the compact disk in Ellen's chapter

View File

@ -101,7 +101,7 @@ bool Actor::validFollowerLocation(const Location &location) {
Point point;
location.toScreenPointXY(point);
if ((point.x < 5) || (point.x >= _vm->getDisplayWidth() - 5) ||
if ((point.x < 5) || (point.x >= _vm->getDisplayInfo().logicalWidth - 5) ||
(point.y < 0) || (point.y > _vm->_scene->getHeight())) {
return false;
}
@ -856,7 +856,7 @@ bool Actor::followProtagonist(ActorData *actor) {
newLocation.y += _vm->_rnd.getRandomNumber(prefer1.y - 1) - prefer1.y / 2;
}
newLocation.x = CLIP<int>(newLocation.x, -31 * 4, (_vm->getDisplayWidth() + 31) * 4);
newLocation.x = CLIP<int>(newLocation.x, -31 * 4, (_vm->getDisplayInfo().logicalWidth + 31) * 4);
return actorWalkTo(actor->_id, newLocation);
}

View File

@ -540,8 +540,8 @@ void Anim::play(uint16 animId, int vectorTime, bool playing) {
frame = anim->currentFrame;
// FIXME: if start > 0, then this works incorrectly
decodeFrame(anim, anim->frameOffsets[frame], displayBuffer, _vm->getDisplayWidth() * _vm->getDisplayHeight());
_vm->_render->addDirtyRect(Common::Rect(0, 0, _vm->getDisplayWidth(), _vm->getDisplayHeight()));
decodeFrame(anim, anim->frameOffsets[frame], displayBuffer, _vm->getDisplayInfo().logicalWidth * _vm->getDisplayInfo().logicalHeight);
_vm->_render->addDirtyRect(Common::Rect(0, 0, _vm->getDisplayInfo().logicalWidth, _vm->getDisplayInfo().logicalHeight));
_vm->_frameCount++;
anim->currentFrame++;
if (anim->completed != 65535) {

View File

@ -105,12 +105,16 @@ static const PlainGameDescriptor sagaGames[] = {
{"saga", "SAGA Engine game"},
{"ite", "Inherit the Earth: Quest for the Orb"},
{"ihnm", "I Have No Mouth and I Must Scream"},
{"dino", "Dinotopia"},
{"fta2", "Faery Tale Adventure II: Halls of the Dead"},
{0, 0}
};
static const Common::ADObsoleteGameID obsoleteGameIDsTable[] = {
{"ite", "saga", Common::kPlatformUnknown},
{"ihnm", "saga", Common::kPlatformUnknown},
{"dino", "saga", Common::kPlatformUnknown},
{"fta2", "saga", Common::kPlatformUnknown},
{0, 0, Common::kPlatformUnknown}
};
@ -315,17 +319,19 @@ bool SagaEngine::initGame() {
}
const GameDisplayInfo &SagaEngine::getDisplayInfo() {
return _gameDescription->gameId == GID_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo;
}
int SagaEngine::getDisplayWidth() const {
const GameDisplayInfo &di = _gameDescription->gameId == GID_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo;
return di.logicalWidth;
}
int SagaEngine::getDisplayHeight() const {
const GameDisplayInfo &di = _gameDescription->gameId == GID_ITE ? ITE_DisplayInfo : IHNM_DisplayInfo;
return di.logicalHeight;
switch (_gameDescription->gameId) {
case GID_ITE:
return ITE_DisplayInfo;
case GID_IHNM:
return IHNM_DisplayInfo;
case GID_DINO:
return IHNM_DisplayInfo; // TODO
case GID_FTA2:
return FTA2_DisplayInfo;
default:
error("getDisplayInfo: Unknown game ID");
return IHNM_DisplayInfo; // unreachable
}
}
Common::Error SagaEngine::loadGameState(int slot) {

View File

@ -834,6 +834,41 @@ static const SAGAGameDescription gameDescriptions[] = {
&MAC_GameSound,
NULL,
},
// Dinotopia Section //////////////////////////////////////////////////////////////////////////////////////
// TODO
// Faery Tale Adventure II: Halls of the Dead Section /////////////////////////////////////////////////////
// Faery Tale Adventure II: Halls of the Dead - English CD version
{
{
"fta2",
"",
{
// TODO: this is still quite incomplete
{"fta.hrs", GAME_RESOURCEFILE, "c34a5ee5f1a14a87712a35c4a209a033", 213376},
{"scripts.hrs", GAME_SCRIPTFILE, "95f33928f6c4f02ee04d2ec5c3314c30", 1041948},
{"ftasound.hrs", GAME_SOUNDFILE, "ce930cb38922e6a03461f55d51b4e165", 12403350},
{ NULL, 0, NULL, 0}
},
Common::EN_ANY,
Common::kPlatformPC,
Common::ADGF_NO_FLAGS
},
GID_FTA2,
0,
// TODO: fill out the data below
-1, // default scene
NULL, // game resources
0, // number of fonts
NULL, // font array
NULL, // voice info
NULL, // SFX info
NULL,
},
{ AD_TABLE_END_MARKER, 0, 0, 0, NULL, 0, NULL, NULL, NULL, NULL }
};

View File

@ -428,6 +428,74 @@ static const GameDisplayInfo IHNM_DisplayInfo = {
IHNM_SavePanelButtons
};
// TODO: Fill in missing bits, currently contains IHNM_DisplayInfo
static const GameDisplayInfo FTA2_DisplayInfo = {
640, 480, // logical width&height
0, // scene path y offset
304, // scene height
0, // status x offset
304, // status y offset
616, // status width
24, // status height
8, // status text y offset
253, // status text color
250, // status BG color
616, 304, // save reminder pos
24, 24, // save reminder w&h
0, // save reminder first sprite number
16, // number of save reminder sprites
11, 12, // left portrait x, y offset
-1, -1, // right portrait x, y offset
8, 9, // inventory Up & Down button indexes
2, 4, // inventory rows, columns
0, 328, // main panel offsets
ARRAYSIZE(IHNM_MainPanelButtons),
IHNM_MainPanelButtons,
IHNM_CONVERSE_MAX_TEXT_WIDTH,
IHNM_CONVERSE_TEXT_HEIGHT,
IHNM_CONVERSE_TEXT_LINES,
11, 12, // converse Up & Down button indexes
0, 328, // converse panel offsets
ARRAYSIZE(IHNM_ConversePanelButtons),
IHNM_ConversePanelButtons,
11, 0, // save file index
15, // optionSaveFileVisible
92, 46, // option panel offsets
ARRAYSIZE(IHNM_OptionPanelButtons),
IHNM_OptionPanelButtons,
190,94, // quit panel offsets
260,115, // quit panel width & height
ARRAYSIZE(IHNM_QuitPanelButtons),
IHNM_QuitPanelButtons,
190, 94, // load panel offsets
260, 115, // load panel width & height
ARRAYSIZE(IHNM_LoadPanelButtons),
IHNM_LoadPanelButtons,
2, // save edit index
190, 94, // save panel offsets
260, 115, // save panel width & height
ARRAYSIZE(IHNM_SavePanelButtons),
IHNM_SavePanelButtons,
// No protection panel in IHNM
-1, // protect edit index
0, 0, // protect panel offsets
0, 0, // protect panel width & height
ARRAYSIZE(IHNM_SavePanelButtons),
IHNM_SavePanelButtons
};
} // End of namespace Saga
#endif

View File

@ -180,8 +180,8 @@ int Events::handleContinuous(Event *event) {
size_t len;
_vm->_scene->getBGMaskInfo(w, h, maskBuffer, len);
rect.left = (_vm->getDisplayWidth() - w) / 2;
rect.top = (_vm->getDisplayHeight() - h) / 2;
rect.left = (_vm->getDisplayInfo().logicalWidth - w) / 2;
rect.top = (_vm->getDisplayInfo().logicalHeight - h) / 2;
rect.setWidth(w);
rect.setHeight(h);
@ -319,7 +319,7 @@ int Events::handleOneShot(Event *event) {
backGroundSurface->blit(bgInfo.bounds, bgInfo.buffer);
// If it is inset scene then draw black border
if (bgInfo.bounds.width() < _vm->getDisplayWidth() || bgInfo.bounds.height() < _vm->_scene->getHeight()) {
if (bgInfo.bounds.width() < _vm->getDisplayInfo().logicalWidth || bgInfo.bounds.height() < _vm->_scene->getHeight()) {
Common::Rect rect1(2, bgInfo.bounds.height() + 4);
Common::Rect rect2(bgInfo.bounds.width() + 4, 2);
Common::Rect rect3(2, bgInfo.bounds.height() + 4);

View File

@ -1879,7 +1879,7 @@ void Interface::drawStatusBar() {
// Erase background of status bar
rect.left = _vm->getDisplayInfo().statusXOffset;
rect.top = _vm->getDisplayInfo().statusYOffset;
rect.right = rect.left + _vm->getDisplayWidth();
rect.right = rect.left + _vm->getDisplayInfo().logicalWidth;
rect.bottom = rect.top + _vm->getDisplayInfo().statusHeight;
_vm->_gfx->drawRect(rect, _vm->getDisplayInfo().statusBGColor - offset);
@ -2787,7 +2787,7 @@ void Interface::mapPanelDrawCrossHair() {
_mapPanelCrossHairState = !_mapPanelCrossHairState;
Point mapPosition = _vm->_isoMap->getMapPosition();
Rect screen(_vm->getDisplayWidth(), _vm->_scene->getHeight());
Rect screen(_vm->getDisplayInfo().logicalWidth, _vm->_scene->getHeight());
if (screen.contains(mapPosition)) {
_vm->_sprite->draw(_vm->_sprite->_mainSprites,

View File

@ -114,7 +114,7 @@ Event *Scene::ITEQueueDialogue(Event *q_event, int n_dialogues, const IntroDialo
textEntry.effectKnownColor = kKnownColorTransparent;
textEntry.useRect = true;
textEntry.rect.left = 0;
textEntry.rect.right = _vm->getDisplayWidth();
textEntry.rect.right = _vm->getDisplayInfo().logicalWidth;
if (_vm->getLanguage() == Common::DE_DEU) {
textEntry.rect.top = INTRO_DE_CAPTION_Y;
} else if (_vm->getLanguage() == Common::IT_ITA) {
@ -122,7 +122,7 @@ Event *Scene::ITEQueueDialogue(Event *q_event, int n_dialogues, const IntroDialo
} else {
textEntry.rect.top = INTRO_CAPTION_Y;
}
textEntry.rect.bottom = _vm->getDisplayHeight();
textEntry.rect.bottom = _vm->getDisplayInfo().logicalHeight;
textEntry.font = kKnownFontMedium;
textEntry.flags = (FontEffectFlags)(kFontOutline | kFontCentered);

View File

@ -295,7 +295,7 @@ void IsoMap::adjustScroll(bool jump) {
}
playerPoint.y -= 28;
playerPoint.x += _viewScroll.x - _vm->getDisplayWidth()/2;
playerPoint.x += _viewScroll.x - _vm->getDisplayInfo().logicalWidth/2;
playerPoint.y += _viewScroll.y - _vm->_scene->getHeight()/2;
minScrollPos.x = playerPoint.x - SAGA_SCROLL_LIMIT_X1;
@ -401,8 +401,8 @@ void IsoMap::drawSprite(SpriteList &spriteList, int spriteNumber, const Location
spritePointer.x = screenPosition.x + xAlign;
spritePointer.y = screenPosition.y + yAlign;
_tileClip.left = CLIP<int>(spritePointer.x, 0, _vm->getDisplayWidth());
_tileClip.right = CLIP<int>(spritePointer.x + width, 0, _vm->getDisplayWidth());
_tileClip.left = CLIP<int>(spritePointer.x, 0, _vm->getDisplayInfo().logicalWidth);
_tileClip.right = CLIP<int>(spritePointer.x + width, 0, _vm->getDisplayInfo().logicalWidth);
_tileClip.top = CLIP<int>(spritePointer.y, 0, _vm->_scene->getHeight());
_tileClip.bottom = CLIP<int>(spritePointer.y + height, 0, _vm->_scene->getHeight());
@ -441,7 +441,7 @@ void IsoMap::drawTiles(const Location *location) {
metaTileY.x = (u0 - v0) * 128 - (view1.x * 16 + fineScroll.x);
metaTileY.y = (view1.y * 16 - fineScroll.y) - (u0 + v0) * 64;
workAreaWidth = _vm->getDisplayWidth() + 128;
workAreaWidth = _vm->getDisplayInfo().logicalWidth + 128;
workAreaHeight = _vm->_scene->getHeight() + 128 + 80;
for (u1 = u0, v1 = v0; metaTileY.y < workAreaHeight; u1--, v1-- ) {
@ -852,8 +852,8 @@ void IsoMap::drawTile(uint16 tileIndex, const Point &point, const Location *loca
}
while ((col < _tileClip.right) && (count < fgRunCount)) {
assert(_vm->_gfx->getBackBufferPixels() <= (byte *)(drawPointer + count));
assert((_vm->_gfx->getBackBufferPixels() + (_vm->getDisplayWidth() *
_vm->getDisplayHeight())) > (byte *)(drawPointer + count));
assert((_vm->_gfx->getBackBufferPixels() + (_vm->getDisplayInfo().logicalWidth *
_vm->getDisplayInfo().logicalHeight)) > (byte *)(drawPointer + count));
drawPointer[count] = readPointer[count];
count++;
col++;

View File

@ -55,7 +55,7 @@ Render::Render(SagaEngine *vm, OSystem *system) {
_vm->_timer->installTimerProc(&fpsTimerCallback, 1000000, this);
#endif
_backGroundSurface.create(_vm->getDisplayWidth(), _vm->getDisplayHeight(), 1);
_backGroundSurface.create(_vm->getDisplayInfo().logicalWidth, _vm->getDisplayInfo().logicalHeight, 1);
_flags = 0;
@ -104,7 +104,7 @@ void Render::drawScene() {
if (!(_flags & RF_DISABLE_ACTORS) || _vm->getGameId() == GID_ITE)
_vm->_scene->draw();
if (_vm->_puzzle->isActive()) {
if (_vm->getGameId() == GID_ITE && _vm->_puzzle->isActive()) {
_vm->_puzzle->movePiece(mousePoint);
_vm->_actor->drawSpeech();
} else {

View File

@ -74,7 +74,7 @@ Resource::~Resource() {
clearContexts();
}
bool Resource::loadSagaContext(ResourceContext *context, uint32 contextOffset, uint32 contextSize) {
bool Resource::loadResContext(ResourceContext *context, uint32 contextOffset, uint32 contextSize) {
size_t i;
bool result;
byte tableInfo[RSC_TABLEINFO_SIZE];
@ -254,13 +254,19 @@ bool Resource::loadMacContext(ResourceContext *context) {
}
free(macResTypes);
if ((!notSagaContext) && (!loadSagaContext(context, MAC_BINARY_HEADER_SIZE, macDataSize))) {
if ((!notSagaContext) && (!loadResContext(context, MAC_BINARY_HEADER_SIZE, macDataSize))) {
return false;
}
return true;
}
bool Resource::loadHResContext(ResourceContext *context, uint32 contextSize) {
// Stub for now
return true;
}
bool Resource::loadContext(ResourceContext *context) {
size_t i;
const GamePatchDescription *patchDescription;
@ -286,18 +292,26 @@ bool Resource::loadContext(ResourceContext *context) {
isMacBinary = (context->fileType & GAME_MACBINARY) > 0;
context->fileType &= ~GAME_MACBINARY;
if (isMacBinary) {
if (!loadMacContext(context)) {
return false;
if (!isMacBinary) {
if (!_vm->isSaga2()) {
// ITE, IHNM
if (!loadResContext(context, 0, context->file->size())) {
return false;
}
} else {
// DINO, FTA2
if (!loadHResContext(context, context->file->size())) {
return false;
}
}
} else {
if (!loadSagaContext(context, 0, context->file->size())) {
if (!loadMacContext(context)) {
return false;
}
}
//process internal patch files
if (GAME_PATCHFILE & context->fileType) {
if (context->fileType & GAME_PATCHFILE) {
subjectResourceType = ~GAME_PATCHFILE & context->fileType;
subjectContext = getContext((GameFileTypes)subjectResourceType);
if (subjectContext == NULL) {

View File

@ -156,7 +156,8 @@ private:
bool loadContext(ResourceContext *context);
bool loadMacContext(ResourceContext *context);
bool loadSagaContext(ResourceContext *context, uint32 contextOffset, uint32 contextSize);
bool loadResContext(ResourceContext *context, uint32 contextOffset, uint32 contextSize);
bool loadHResContext(ResourceContext *context, uint32 contextSize);
public:
MetaResource _metaResource;

View File

@ -118,18 +118,26 @@ SagaEngine::~SagaEngine() {
}
}
delete _puzzle;
delete _sndRes;
delete _events;
delete _font;
delete _sprite;
delete _anim;
delete _script;
delete _interface;
delete _actor;
delete _palanim;
if (!isSaga2()) {
if (getGameId() == GID_ITE)
delete _puzzle;
delete _sndRes;
delete _events;
delete _font;
delete _sprite;
delete _anim;
delete _script;
delete _interface;
delete _actor;
delete _palanim;
}
delete _scene;
delete _isoMap;
if (getGameId() == GID_ITE) {
delete _isoMap;
}
delete _render;
delete _music;
delete _sound;
@ -165,25 +173,34 @@ Common::Error SagaEngine::init() {
}
// Initialize engine modules
_sndRes = new SndRes(this);
_events = new Events(this);
_font = new Font(this);
_sprite = new Sprite(this);
_anim = new Anim(this);
_script = new Script(this);
_interface = new Interface(this); // requires script module
// TODO: implement differences for SAGA2
if (!isSaga2()) {
_sndRes = new SndRes(this);
_events = new Events(this);
_font = new Font(this);
_sprite = new Sprite(this);
_anim = new Anim(this);
_script = new Script(this);
_interface = new Interface(this); // requires script module
}
_scene = new Scene(this);
_actor = new Actor(this);
_palanim = new PalAnim(this);
_isoMap = new IsoMap(this);
_puzzle = new Puzzle(this);
if (!isSaga2()) {
_actor = new Actor(this);
_palanim = new PalAnim(this);
if (getGameId() == GID_ITE) {
_isoMap = new IsoMap(this);
_puzzle = new Puzzle(this);
}
}
// System initialization
_previousTicks = _system->getMillis();
// Initialize graphics
_gfx = new Gfx(this, _system, getDisplayWidth(), getDisplayHeight());
_gfx = new Gfx(this, _system, getDisplayInfo().logicalWidth, getDisplayInfo().logicalHeight);
// Graphics driver should be initialized before console
_console = new Console(this);
@ -296,7 +313,7 @@ Common::Error SagaEngine::go() {
}
// Since Puzzle and forced text are actorless, we do them here
if (_puzzle->isActive() || _actor->isForcedTextShown()) {
if ((getGameId() == GID_ITE && _puzzle->isActive()) || _actor->isForcedTextShown()) {
_actor->handleSpeech(msec);
} else if (!_scene->isInIntro()) {
if (_interface->getMode() == kPanelMain ||

View File

@ -96,7 +96,9 @@ enum ERRORCODE {
enum GameIds {
GID_ITE = 0,
GID_IHNM = 1
GID_IHNM = 1,
GID_DINO = 2,
GID_FTA2 = 3
};
enum GameFileTypes {
@ -594,6 +596,7 @@ public:
bool isBigEndian() const;
bool isMacResources() const;
bool isSaga2() const { return getGameId() == GID_DINO || getGameId() == GID_FTA2; }
const GameResourceDescription *getResourceDescription();
const GameSoundInfo *getVoiceInfo() const;
const GameSoundInfo *getSfxInfo() const;
@ -614,8 +617,6 @@ public:
const Common::ADGameFileDescription *getFilesDescriptions() const;
const Common::Rect &getDisplayClip() const { return _displayClip;}
int getDisplayWidth() const;
int getDisplayHeight() const;
Common::Error loadGameState(int slot);
Common::Error saveGameState(int slot, const char *desc);
bool canLoadGameStateCurrently();

View File

@ -331,7 +331,8 @@ void SagaEngine::load(const char *fileName) {
int volume = _music->getVolume();
_music->setVolume(0);
_isoMap->setMapPosition(mapx, mapy);
if (getGameId() == GID_ITE)
_isoMap->setMapPosition(mapx, mapy);
// Protagonist swapping
if (getGameId() == GID_IHNM) {

View File

@ -483,9 +483,9 @@ void Scene::changeScene(int16 sceneNumber, int actorsEntrance, SceneTransitionTy
_vm->_interface->setStatusText("Click or Press Return to continue. Press Q to quit.", 96);
_vm->_font->textDrawRect(kKnownFontMedium, sceneSubstitutes[i].title,
Common::Rect(0, 7, _vm->getDisplayWidth(), 27), _vm->KnownColor2ColorId(kKnownColorBrightWhite), _vm->KnownColor2ColorId(kKnownColorBlack), kFontOutline);
Common::Rect(0, 7, _vm->getDisplayInfo().logicalWidth, 27), _vm->KnownColor2ColorId(kKnownColorBrightWhite), _vm->KnownColor2ColorId(kKnownColorBlack), kFontOutline);
_vm->_font->textDrawRect(kKnownFontMedium, sceneSubstitutes[i].message,
Common::Rect(24, getHeight() - 33, _vm->getDisplayWidth() - 11,
Common::Rect(24, getHeight() - 33, _vm->getDisplayInfo().logicalWidth - 11,
getHeight()), _vm->KnownColor2ColorId(kKnownColorBrightWhite), _vm->KnownColor2ColorId(kKnownColorBlack), kFontOutline);
return;
}
@ -520,8 +520,8 @@ void Scene::getBGInfo(BGInfo &bgInfo) {
bgInfo.bounds.left = 0;
bgInfo.bounds.top = 0;
if (_bg.w < _vm->getDisplayWidth()) {
bgInfo.bounds.left = (_vm->getDisplayWidth() - _bg.w) / 2;
if (_bg.w < _vm->getDisplayInfo().logicalWidth) {
bgInfo.bounds.left = (_vm->getDisplayInfo().logicalWidth - _bg.w) / 2;
}
if (_bg.h < getHeight()) {
@ -553,7 +553,7 @@ bool Scene::offscreenPath(Point &testPoint) {
return false;
}
point.x = CLIP<int>(testPoint.x, 0, _vm->getDisplayWidth() - 1);
point.x = CLIP<int>(testPoint.x, 0, _vm->getDisplayInfo().logicalWidth - 1);
point.y = CLIP<int>(testPoint.y, 0, _bgMask.h - 1);
if (point == testPoint) {
return false;
@ -719,13 +719,13 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) {
_sceneClip.left = 0;
_sceneClip.top = 0;
_sceneClip.right = _vm->getDisplayWidth();
_sceneClip.right = _vm->getDisplayInfo().logicalWidth;
_sceneClip.bottom = getHeight();
} else {
BGInfo backGroundInfo;
getBGInfo(backGroundInfo);
_sceneClip = backGroundInfo.bounds;
if (!(_bg.w < _vm->getDisplayWidth() || _bg.h < getHeight()))
if (!(_bg.w < _vm->getDisplayInfo().logicalWidth || _bg.h < getHeight()))
_outsetSceneNumber = _sceneNumber;
}
@ -1039,7 +1039,7 @@ void Scene::processSceneResources() {
// At least in ITE the mask needs to be clipped.
_bgMask.w = MIN(_bgMask.w, _vm->getDisplayWidth());
_bgMask.w = MIN(_bgMask.w, _vm->getDisplayInfo().logicalWidth);
_bgMask.h = MIN(_bgMask.h, getHeight());
debug(4, "BACKGROUND MASK width=%d height=%d length=%d", _bgMask.w, _bgMask.h, (int)_bgMask.buf_len);
@ -1222,7 +1222,9 @@ void Scene::endScene() {
_actionMap->freeMem();
_entryList.freeMem();
_sceneStrings.freeMem();
_vm->_isoMap->freeMem();
if (_vm->getGameId() == GID_ITE)
_vm->_isoMap->freeMem();
_vm->_events->clearList();
_textList.clear();

View File

@ -1219,7 +1219,7 @@ void Script::sfPlacard(SCRIPTFUNC_PARAMS) {
event.param2 = 0;
event.param3 = _vm->_scene->getHeight();
event.param4 = 0;
event.param5 = _vm->getDisplayWidth();
event.param5 = _vm->getDisplayInfo().logicalWidth;
q_event = _vm->_events->chain(q_event, &event);
// Put the text in the center of the viewport, assuming it will fit on
@ -1232,7 +1232,7 @@ void Script::sfPlacard(SCRIPTFUNC_PARAMS) {
textEntry.knownColor = kKnownColorBrightWhite;
textEntry.effectKnownColor = kKnownColorBlack;
textEntry.point.x = _vm->getDisplayWidth() / 2;
textEntry.point.x = _vm->getDisplayInfo().logicalWidth / 2;
textEntry.point.y = (_vm->_scene->getHeight() - _vm->_font->getHeight(kKnownFontMedium)) / 2;
textEntry.font = kKnownFontMedium;
textEntry.flags = (FontEffectFlags)(kFontOutline | kFontCentered);

View File

@ -59,7 +59,7 @@ SndRes::SndRes(SagaEngine *vm) : _vm(vm) {
if (_vm->getGameId() == GID_ITE) {
_fxTable = ITE_SfxTable;
_fxTableLen = ITE_SFXCOUNT;
} else {
} else if (_vm->getGameId() == GID_IHNM) {
ResourceContext *resourceContext;
resourceContext = _vm->_resource->getContext(GAME_SOUNDFILE);
@ -93,6 +93,10 @@ SndRes::SndRes(SagaEngine *vm) : _vm(vm) {
_fxTable = 0;
_fxTableLen = 0;
} else if (_vm->getGameId() == GID_DINO) {
// TODO
} else if (_vm->getGameId() == GID_FTA2) {
// TODO
}
}

View File

@ -243,8 +243,8 @@ void Sprite::drawClip(const Point &spritePointer, int width, int height, const b
for (i = io; i < clipHeight; i++) {
for (j = jo; j < clipWidth; j++) {
assert(_vm->_gfx->getBackBufferPixels() <= (byte *)(bufRowPointer + j + spritePointer.x));
assert((_vm->_gfx->getBackBufferPixels() + (_vm->getDisplayWidth() *
_vm->getDisplayHeight())) > (byte *)(bufRowPointer + j + spritePointer.x));
assert((_vm->_gfx->getBackBufferPixels() + (_vm->getDisplayInfo().logicalWidth *
_vm->getDisplayInfo().logicalHeight)) > (byte *)(bufRowPointer + j + spritePointer.x));
assert((const byte *)spriteBuffer <= (const byte *)(srcRowPointer + j));
assert(((const byte *)spriteBuffer + (width * height)) > (const byte *)(srcRowPointer + j));