aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/agos/agos.h5
-rw-r--r--engines/agos/gfx.cpp139
-rw-r--r--engines/agos/subroutine.cpp10
-rw-r--r--engines/agos/vga.cpp2
4 files changed, 124 insertions, 32 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 5818975dde..8eef317f22 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -1275,9 +1275,12 @@ public:
void opp_restartClock();
protected:
+ bool drawImages_clip(VC10_state *state);
+
void drawImages(VC10_state *state);
+ void drawImages_Simon(VC10_state *state);
void drawImages_Feeble(VC10_state *state);
- bool drawImages_clip(VC10_state *state);
+
void scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY);
void horizontalScroll(VC10_state *state);
void verticalScroll(VC10_state *state);
diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp
index 1754af2551..644747012a 100644
--- a/engines/agos/gfx.cpp
+++ b/engines/agos/gfx.cpp
@@ -387,38 +387,14 @@ void AGOSEngine::drawImages_Feeble(VC10_state *state) {
}
}
-void AGOSEngine::drawImages(VC10_state *state) {
+void AGOSEngine::drawImages_Simon(VC10_state *state) {
const uint16 *vlut = &_videoWindows[_windowNum * 4];
if (drawImages_clip(state) == 0)
return;
uint xoffs, yoffs;
- if (getGameType() == GType_ELVIRA1) {
- //if (_windowNum != 2 && _windowNum != 3 && _windowNum != 6) {
- // xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
- // yoffs = (vlut[1] - _videoWindows[17] + state->y);
- //} else {
- xoffs = (vlut[0] * 2 + state->x) * 8;
- yoffs = vlut[1] + state->y;
- //}
- } else if (getGameType() == GType_ELVIRA2) {
- //if (_windowNum == 4 || _windowNum >= 10) {
- // xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
- // yoffs = (vlut[1] - _videoWindows[17] + state->y);
- //} else {
- xoffs = (vlut[0] * 2 + state->x) * 8;
- yoffs = vlut[1] + state->y;
- //}
- } else if (getGameType() == GType_WW) {
- //if (_windowNum == 4 || (_windowNum >= 10 && _windowNum < 28)) {
- // xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
- // yoffs = (vlut[1] - _videoWindows[17] + state->y);
- //} else {
- xoffs = (vlut[0] * 2 + state->x) * 8;
- yoffs = vlut[1] + state->y;
- //}
- } else if (getGameType() == GType_SIMON1 && (_subroutine == 2923 || _subroutine == 2926)) {
+ if (getGameType() == GType_SIMON1 && (_subroutine == 2923 || _subroutine == 2926)) {
// Allow one section of Simon the Sorcerer 1 introduction to be displayed
// in lower half of screen
xoffs = state->x * 8;
@@ -478,7 +454,6 @@ void AGOSEngine::drawImages(VC10_state *state) {
}
} while (++w != state->draw_width);
} else if ((((_lockWord & 0x20) && state->palette == 0) || state->palette == 0xC0) &&
- (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) &&
getPlatform() != Common::kPlatformAmiga) {
const byte *src;
byte *dst;
@@ -548,14 +523,11 @@ void AGOSEngine::drawImages(VC10_state *state) {
} while (--h);
}
} else {
- if (state->flags & kDFUseFrontBuf) {
+ if (getGameType() == GType_SIMON2 && state->flags & kDFUseFrontBuf && getBitFlag(171)) {
state->surf_addr = state->surf2_addr;
state->surf_pitch = state->surf2_pitch;
}
- if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
- state->palette = state->surf_addr[0] & 0xF0;
-
if (state->flags & kDFCompressed) {
uint w, h;
byte *src, *dst, *dstPtr;
@@ -617,6 +589,111 @@ void AGOSEngine::drawImages(VC10_state *state) {
}
}
+void AGOSEngine::drawImages(VC10_state *state) {
+ const uint16 *vlut = &_videoWindows[_windowNum * 4];
+
+ if (drawImages_clip(state) == 0)
+ return;
+
+ uint xoffs, yoffs;
+ if (getGameType() == GType_ELVIRA1) {
+ //if (_windowNum != 2 && _windowNum != 3 && _windowNum != 6) {
+ // xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+ // yoffs = (vlut[1] - _videoWindows[17] + state->y);
+ //} else {
+ xoffs = (vlut[0] * 2 + state->x) * 8;
+ yoffs = vlut[1] + state->y;
+ //}
+ } else if (getGameType() == GType_ELVIRA2) {
+ //if (_windowNum == 4 || _windowNum >= 10) {
+ // xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+ // yoffs = (vlut[1] - _videoWindows[17] + state->y);
+ //} else {
+ xoffs = (vlut[0] * 2 + state->x) * 8;
+ yoffs = vlut[1] + state->y;
+ //}
+ } else if (getGameType() == GType_WW) {
+ //if (_windowNum == 4 || (_windowNum >= 10 && _windowNum < 28)) {
+ // xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+ // yoffs = (vlut[1] - _videoWindows[17] + state->y);
+ //} else {
+ xoffs = (vlut[0] * 2 + state->x) * 8;
+ yoffs = vlut[1] + state->y;
+ //}
+ } else {
+ xoffs = ((vlut[0] - _videoWindows[16]) * 2 + state->x) * 8;
+ yoffs = (vlut[1] - _videoWindows[17] + state->y);
+ }
+
+ state->surf2_addr += xoffs + yoffs * state->surf_pitch;
+ state->surf_addr += xoffs + yoffs * state->surf2_pitch;
+
+ if (state->flags & kDFUseFrontBuf) {
+ state->surf_addr = state->surf2_addr;
+ state->surf_pitch = state->surf2_pitch;
+ }
+
+ if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
+ state->palette = state->surf_addr[0] & 0xF0;
+
+ if (state->flags & kDFCompressed) {
+ uint w, h;
+ byte *src, *dst, *dstPtr;
+
+ state->x_skip *= 4; /* reached */
+
+ state->dl = state->width;
+ state->dh = state->height;
+
+ vc10_skip_cols(state);
+
+ dstPtr = state->surf_addr;
+ w = 0;
+ do {
+ byte color;
+
+ src = vc10_depackColumn(state);
+ dst = dstPtr;
+
+ h = 0;
+ do {
+ color = (*src / 16);
+ if ((state->flags & kDFNonTrans) || color != 0)
+ dst[0] = color | state->palette;
+ color = (*src & 15);
+ if ((state->flags & kDFNonTrans) || color != 0)
+ dst[1] = color | state->palette;
+ dst += _screenWidth;
+ src++;
+ } while (++h != state->draw_height);
+ dstPtr += 2;
+ } while (++w != state->draw_width);
+ } else {
+ const byte *src;
+ byte *dst;
+ uint count;
+
+ src = state->depack_src + (state->width * state->y_skip) * 8;
+ dst = state->surf_addr;
+ state->x_skip *= 4;
+
+ do {
+ for (count = 0; count != state->draw_width; count++) {
+ byte color;
+ color = (src[count + state->x_skip] / 16);
+ if ((state->flags & kDFNonTrans) || color)
+ dst[count * 2] = color | state->palette;
+ color = (src[count + state->x_skip] & 15);
+ if ((state->flags & kDFNonTrans) || color)
+ dst[count * 2 + 1] = color | state->palette;
+ }
+ dst += _screenWidth;
+ src += state->width * 8;
+ } while (--state->draw_height);
+ }
+}
+
+
void AGOSEngine::horizontalScroll(VC10_state *state) {
const byte *src;
byte *dst;
diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp
index 2ad67c70ee..59135d48b9 100644
--- a/engines/agos/subroutine.cpp
+++ b/engines/agos/subroutine.cpp
@@ -523,6 +523,16 @@ int AGOSEngine::startSubroutine(Subroutine *sub) {
int result = -1;
SubroutineLine *sl = (SubroutineLine *)((byte *)sub + sub->first);
+ // WORKAROUND: Bit Flag 171 isn't set when Simon rides the lion to the
+ // goblin camp in non-English versions. Bit Flag 171 is required to display
+ // the red trail between locations on the map, during the ride.
+ if (getGameType() == GType_SIMON2) {
+ if (sub->id == 13020)
+ setBitFlag(171, true);
+ if (sub->id == 13021)
+ setBitFlag(171, false);
+ }
+
const byte *old_code_ptr = _codePtr;
Subroutine *old_currentTable = _currentTable;
SubroutineLine *old_currentLine = _currentLine;
diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp
index 3a0725fbeb..7c2fe6b582 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.cpp
@@ -671,6 +671,8 @@ void AGOSEngine::vc10_draw() {
if (getGameType() == GType_FF || getGameType() == GType_PP) {
drawImages_Feeble(&state);
+ } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
+ drawImages_Simon(&state);
} else {
drawImages(&state);
}