From e78e1c6987278e07583719ea857f680b1aeff63f Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Mon, 2 Oct 2006 21:41:18 +0000 Subject: Fix crashes in swampy when moving blocks svn-id: r24081 --- engines/agos/vga.cpp | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp index bbde7f0c31..a85efa52e3 100644 --- a/engines/agos/vga.cpp +++ b/engines/agos/vga.cpp @@ -637,7 +637,13 @@ void AGOSEngine::vc4_fadeIn() { } void AGOSEngine::vc5_skip_if_neq() { - uint16 var = vcReadNextWord(); + uint16 var; + + if (getGameType() == GType_PP) + var = vcReadVarOrWord(); + else + var = vcReadNextWord(); + uint16 value = vcReadNextWord(); if (vcReadVar(var) != value) vcSkipNextInstruction(); @@ -1254,7 +1260,15 @@ void AGOSEngine::drawImages(VC10_state *state) { return; uint offs, offs2; - if (getGameType() == GType_WW) { + if (getGameType() == GType_ELVIRA) { + if (_windowNum == 2 || _windowNum == 3) { + offs = state->x * 8; + offs2 = state->y; + } else { + offs = ((vlut[0] - _video_windows[16]) * 2 + state->x) * 8; + offs2 = (vlut[1] - _video_windows[17] + state->y); + } + } else if (getGameType() == GType_WW) { //if (_windowNum == 4 || _windowNum >= 10) { offs = state->x * 8; offs2 = state->y; @@ -1981,13 +1995,23 @@ void AGOSEngine::vc37_addToSpriteY() { } void AGOSEngine::vc38_skipIfVarZero() { - uint16 var = vcReadNextWord(); + uint16 var; + if (getGameType() == GType_PP) + var = vcReadVarOrWord(); + else + var = vcReadNextWord(); + if (vcReadVar(var) == 0) vcSkipNextInstruction(); } void AGOSEngine::vc39_setVar() { - uint16 var = vcReadNextWord(); + uint16 var; + if (getGameType() == GType_PP) + var = vcReadVarOrWord(); + else + var = vcReadNextWord(); + int16 value = vcReadNextWord(); vcWriteVar(var, value); } @@ -2403,14 +2427,19 @@ void AGOSEngine::vc_kill_sprite(uint file, uint sprite) { } void AGOSEngine::vc60_killSprite() { - uint16 zoneNum; + uint16 sprite, zoneNum; - if (getGameType() == GType_SIMON1) { - zoneNum = _vgaCurZoneNum; - } else { + if (getGameType() == GType_PP) { + zoneNum = vcReadNextWord(); + sprite = vcReadVarOrWord(); + } else if (getGameType() == GType_SIMON2 || getGameType() == GType_FF) { zoneNum = vcReadNextWord(); + sprite = vcReadNextWord(); + } else { + zoneNum = _vgaCurZoneNum; + sprite = vcReadNextWord(); } - uint16 sprite = vcReadNextWord(); + vc_kill_sprite(zoneNum, sprite); } -- cgit v1.2.3