SCI: Added some hacks related to new functionality in Phantasmagoria 2

The game will now start (but won't do anything exciting - it'll display
its main menu, which doesn't work yet)
This commit is contained in:
Filippos Karapetis 2011-10-18 03:10:19 +03:00
parent 021b09d35c
commit 7708a4ddbb
3 changed files with 29 additions and 1 deletions

View File

@ -691,6 +691,16 @@ reg_t kArray(EngineState *s, int argc, reg_t *argv) {
}
case 2: { // At (return value at an index)
SciArray<reg_t> *array = s->_segMan->lookupArray(argv[1]);
if (g_sci->getGameId() == GID_PHANTASMAGORIA2) {
// HACK: Phantasmagoria 2 keeps trying to access past the end of an
// array when it starts. I'm assuming it's trying to see where the
// array ends, or tries to resize it. Adjust the array size
// accordingly, and return NULL for now.
if (array->getSize() == argv[2].toUint16()) {
array->setSize(argv[2].toUint16());
return NULL_REG;
}
}
return array->getValue(argv[2].toUint16());
}
case 3: { // Atput (put value at an index)

View File

@ -179,6 +179,18 @@ void GfxCursor::kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Co
if (_useOriginalKQ6WinCursors)
viewNum += 2000; // Windows cursors
if (g_sci->getGameId() == GID_PHANTASMAGORIA2) {
// HACK: Ignore cursor views for Phantasmagoria 2. They've got
// differences from other SCI32 views, thus we skip them for
// now, otherwise our view decoding code will crash.
// The view code will crash with *any* view in P2, but this hack
// allows the game to start and show the menu.
// TODO: Remove once the view code is updated to handle
// Phantasmagoria 2 views.
warning("TODO: Cursor views for Phantasmagoria 2");
return;
}
if (!_cachedCursors.contains(viewNum))
_cachedCursors[viewNum] = new GfxView(_resMan, _screen, _palette, viewNum);

View File

@ -492,7 +492,6 @@ void GfxFrameout::kernelFrameout() {
// warning("view %s %04x:%04x", _segMan->getObjectName(itemEntry->object), PRINT_REG(itemEntry->object));
if (view->isSci2Hires()) {
int16 dummyX = 0;
view->adjustToUpscaledCoordinates(itemEntry->y, itemEntry->x);
@ -540,6 +539,13 @@ void GfxFrameout::kernelFrameout() {
nsRect.right = (nsRect.right * scriptsRunningWidth) / _screen->getWidth();
}
if (g_sci->getGameId() == GID_PHANTASMAGORIA2) {
// HACK: Some (?) objects in Phantasmagoria 2 have no NS rect. Skip them for now.
// TODO: Remove once we figure out how Phantasmagoria 2 draws objects on screen.
if (lookupSelector(_segMan, itemEntry->object, SELECTOR(nsLeft), NULL, NULL) != kSelectorVariable)
continue;
}
writeSelectorValue(_segMan, itemEntry->object, SELECTOR(nsLeft), nsRect.left);
writeSelectorValue(_segMan, itemEntry->object, SELECTOR(nsTop), nsRect.top);
writeSelectorValue(_segMan, itemEntry->object, SELECTOR(nsRight), nsRect.right);