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

View file

@ -101,7 +101,7 @@ bool Actor::validFollowerLocation(const Location &location) {
Point point; Point point;
location.toScreenPointXY(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())) { (point.y < 0) || (point.y > _vm->_scene->getHeight())) {
return false; return false;
} }
@ -856,7 +856,7 @@ bool Actor::followProtagonist(ActorData *actor) {
newLocation.y += _vm->_rnd.getRandomNumber(prefer1.y - 1) - prefer1.y / 2; 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); return actorWalkTo(actor->_id, newLocation);
} }

View file

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

View file

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

View file

@ -834,6 +834,41 @@ static const SAGAGameDescription gameDescriptions[] = {
&MAC_GameSound, &MAC_GameSound,
NULL, 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 } { 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 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 } // End of namespace Saga
#endif #endif

View file

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

View file

@ -1879,7 +1879,7 @@ void Interface::drawStatusBar() {
// Erase background of status bar // Erase background of status bar
rect.left = _vm->getDisplayInfo().statusXOffset; rect.left = _vm->getDisplayInfo().statusXOffset;
rect.top = _vm->getDisplayInfo().statusYOffset; 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; rect.bottom = rect.top + _vm->getDisplayInfo().statusHeight;
_vm->_gfx->drawRect(rect, _vm->getDisplayInfo().statusBGColor - offset); _vm->_gfx->drawRect(rect, _vm->getDisplayInfo().statusBGColor - offset);
@ -2787,7 +2787,7 @@ void Interface::mapPanelDrawCrossHair() {
_mapPanelCrossHairState = !_mapPanelCrossHairState; _mapPanelCrossHairState = !_mapPanelCrossHairState;
Point mapPosition = _vm->_isoMap->getMapPosition(); Point mapPosition = _vm->_isoMap->getMapPosition();
Rect screen(_vm->getDisplayWidth(), _vm->_scene->getHeight()); Rect screen(_vm->getDisplayInfo().logicalWidth, _vm->_scene->getHeight());
if (screen.contains(mapPosition)) { if (screen.contains(mapPosition)) {
_vm->_sprite->draw(_vm->_sprite->_mainSprites, _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.effectKnownColor = kKnownColorTransparent;
textEntry.useRect = true; textEntry.useRect = true;
textEntry.rect.left = 0; textEntry.rect.left = 0;
textEntry.rect.right = _vm->getDisplayWidth(); textEntry.rect.right = _vm->getDisplayInfo().logicalWidth;
if (_vm->getLanguage() == Common::DE_DEU) { if (_vm->getLanguage() == Common::DE_DEU) {
textEntry.rect.top = INTRO_DE_CAPTION_Y; textEntry.rect.top = INTRO_DE_CAPTION_Y;
} else if (_vm->getLanguage() == Common::IT_ITA) { } else if (_vm->getLanguage() == Common::IT_ITA) {
@ -122,7 +122,7 @@ Event *Scene::ITEQueueDialogue(Event *q_event, int n_dialogues, const IntroDialo
} else { } else {
textEntry.rect.top = INTRO_CAPTION_Y; textEntry.rect.top = INTRO_CAPTION_Y;
} }
textEntry.rect.bottom = _vm->getDisplayHeight(); textEntry.rect.bottom = _vm->getDisplayInfo().logicalHeight;
textEntry.font = kKnownFontMedium; textEntry.font = kKnownFontMedium;
textEntry.flags = (FontEffectFlags)(kFontOutline | kFontCentered); textEntry.flags = (FontEffectFlags)(kFontOutline | kFontCentered);

View file

@ -295,7 +295,7 @@ void IsoMap::adjustScroll(bool jump) {
} }
playerPoint.y -= 28; 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; playerPoint.y += _viewScroll.y - _vm->_scene->getHeight()/2;
minScrollPos.x = playerPoint.x - SAGA_SCROLL_LIMIT_X1; 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.x = screenPosition.x + xAlign;
spritePointer.y = screenPosition.y + yAlign; spritePointer.y = screenPosition.y + yAlign;
_tileClip.left = CLIP<int>(spritePointer.x, 0, _vm->getDisplayWidth()); _tileClip.left = CLIP<int>(spritePointer.x, 0, _vm->getDisplayInfo().logicalWidth);
_tileClip.right = CLIP<int>(spritePointer.x + width, 0, _vm->getDisplayWidth()); _tileClip.right = CLIP<int>(spritePointer.x + width, 0, _vm->getDisplayInfo().logicalWidth);
_tileClip.top = CLIP<int>(spritePointer.y, 0, _vm->_scene->getHeight()); _tileClip.top = CLIP<int>(spritePointer.y, 0, _vm->_scene->getHeight());
_tileClip.bottom = CLIP<int>(spritePointer.y + height, 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.x = (u0 - v0) * 128 - (view1.x * 16 + fineScroll.x);
metaTileY.y = (view1.y * 16 - fineScroll.y) - (u0 + v0) * 64; 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; workAreaHeight = _vm->_scene->getHeight() + 128 + 80;
for (u1 = u0, v1 = v0; metaTileY.y < workAreaHeight; u1--, v1-- ) { 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)) { while ((col < _tileClip.right) && (count < fgRunCount)) {
assert(_vm->_gfx->getBackBufferPixels() <= (byte *)(drawPointer + count)); assert(_vm->_gfx->getBackBufferPixels() <= (byte *)(drawPointer + count));
assert((_vm->_gfx->getBackBufferPixels() + (_vm->getDisplayWidth() * assert((_vm->_gfx->getBackBufferPixels() + (_vm->getDisplayInfo().logicalWidth *
_vm->getDisplayHeight())) > (byte *)(drawPointer + count)); _vm->getDisplayInfo().logicalHeight)) > (byte *)(drawPointer + count));
drawPointer[count] = readPointer[count]; drawPointer[count] = readPointer[count];
count++; count++;
col++; col++;

View file

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

View file

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

View file

@ -156,7 +156,8 @@ private:
bool loadContext(ResourceContext *context); bool loadContext(ResourceContext *context);
bool loadMacContext(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: public:
MetaResource _metaResource; MetaResource _metaResource;

View file

@ -118,6 +118,8 @@ SagaEngine::~SagaEngine() {
} }
} }
if (!isSaga2()) {
if (getGameId() == GID_ITE)
delete _puzzle; delete _puzzle;
delete _sndRes; delete _sndRes;
delete _events; delete _events;
@ -128,8 +130,14 @@ SagaEngine::~SagaEngine() {
delete _interface; delete _interface;
delete _actor; delete _actor;
delete _palanim; delete _palanim;
}
delete _scene; delete _scene;
if (getGameId() == GID_ITE) {
delete _isoMap; delete _isoMap;
}
delete _render; delete _render;
delete _music; delete _music;
delete _sound; delete _sound;
@ -165,6 +173,8 @@ Common::Error SagaEngine::init() {
} }
// Initialize engine modules // Initialize engine modules
// TODO: implement differences for SAGA2
if (!isSaga2()) {
_sndRes = new SndRes(this); _sndRes = new SndRes(this);
_events = new Events(this); _events = new Events(this);
_font = new Font(this); _font = new Font(this);
@ -172,18 +182,25 @@ Common::Error SagaEngine::init() {
_anim = new Anim(this); _anim = new Anim(this);
_script = new Script(this); _script = new Script(this);
_interface = new Interface(this); // requires script module _interface = new Interface(this); // requires script module
}
_scene = new Scene(this); _scene = new Scene(this);
if (!isSaga2()) {
_actor = new Actor(this); _actor = new Actor(this);
_palanim = new PalAnim(this); _palanim = new PalAnim(this);
if (getGameId() == GID_ITE) {
_isoMap = new IsoMap(this); _isoMap = new IsoMap(this);
_puzzle = new Puzzle(this); _puzzle = new Puzzle(this);
}
}
// System initialization // System initialization
_previousTicks = _system->getMillis(); _previousTicks = _system->getMillis();
// Initialize graphics // 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 // Graphics driver should be initialized before console
_console = new Console(this); _console = new Console(this);
@ -296,7 +313,7 @@ Common::Error SagaEngine::go() {
} }
// Since Puzzle and forced text are actorless, we do them here // 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); _actor->handleSpeech(msec);
} else if (!_scene->isInIntro()) { } else if (!_scene->isInIntro()) {
if (_interface->getMode() == kPanelMain || if (_interface->getMode() == kPanelMain ||

View file

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

View file

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

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

View file

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

View file

@ -59,7 +59,7 @@ SndRes::SndRes(SagaEngine *vm) : _vm(vm) {
if (_vm->getGameId() == GID_ITE) { if (_vm->getGameId() == GID_ITE) {
_fxTable = ITE_SfxTable; _fxTable = ITE_SfxTable;
_fxTableLen = ITE_SFXCOUNT; _fxTableLen = ITE_SFXCOUNT;
} else { } else if (_vm->getGameId() == GID_IHNM) {
ResourceContext *resourceContext; ResourceContext *resourceContext;
resourceContext = _vm->_resource->getContext(GAME_SOUNDFILE); resourceContext = _vm->_resource->getContext(GAME_SOUNDFILE);
@ -93,6 +93,10 @@ SndRes::SndRes(SagaEngine *vm) : _vm(vm) {
_fxTable = 0; _fxTable = 0;
_fxTableLen = 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 (i = io; i < clipHeight; i++) {
for (j = jo; j < clipWidth; j++) { for (j = jo; j < clipWidth; j++) {
assert(_vm->_gfx->getBackBufferPixels() <= (byte *)(bufRowPointer + j + spritePointer.x)); assert(_vm->_gfx->getBackBufferPixels() <= (byte *)(bufRowPointer + j + spritePointer.x));
assert((_vm->_gfx->getBackBufferPixels() + (_vm->getDisplayWidth() * assert((_vm->_gfx->getBackBufferPixels() + (_vm->getDisplayInfo().logicalWidth *
_vm->getDisplayHeight())) > (byte *)(bufRowPointer + j + spritePointer.x)); _vm->getDisplayInfo().logicalHeight)) > (byte *)(bufRowPointer + j + spritePointer.x));
assert((const byte *)spriteBuffer <= (const byte *)(srcRowPointer + j)); assert((const byte *)spriteBuffer <= (const byte *)(srcRowPointer + j));
assert(((const byte *)spriteBuffer + (width * height)) > (const byte *)(srcRowPointer + j)); assert(((const byte *)spriteBuffer + (width * height)) > (const byte *)(srcRowPointer + j));