From 996401406339cd9b19d8b839d2b935f2d6f324b5 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sun, 13 Nov 2005 11:53:57 +0000 Subject: Fix invalid writes in FF. svn-id: r19585 --- simon/simon.cpp | 6 +++++- simon/vga.cpp | 28 +++++++++++++++++++--------- simon/vga.h | 2 +- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/simon/simon.cpp b/simon/simon.cpp index 793a37648f..7f29eee9d0 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -2496,7 +2496,11 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) { _timer5 = 0; } else { if (!_dxUse3Or4ForLock) { - num_lines = _windowNum == 4 ? 134 : 200; + if (getGameType() == GType_FF) + num_lines = 480; + else + num_lines = _windowNum == 4 ? 134 : 200; + _vgaVar8 = num_lines; dx_copy_from_attached_to_2(0, 0, _screenWidth, num_lines); dx_copy_from_attached_to_3(num_lines); diff --git a/simon/vga.cpp b/simon/vga.cpp index e1590d2518..77f2a14b93 100644 --- a/simon/vga.cpp +++ b/simon/vga.cpp @@ -457,7 +457,7 @@ byte *vc10_depack_column(VC10_state * vs) { int8 a = vs->depack_cont; const byte *src = vs->depack_src; byte *dst = vs->depack_dest; - byte dh = vs->dh; + uint16 dh = vs->dh; byte color; if (a == -0x80) @@ -696,6 +696,8 @@ void SimonEngine::vc10_draw() { width = READ_LE_UINT16(p2 + 6); height = READ_LE_UINT16(p2 + 4) & 0x7FFF; flags = p2[5]; + + debug(1, "Width %d Height %d Flags 0x%x", width, height, flags); } else { state.depack_src = _curVgaFile2 + READ_BE_UINT32(p2); width = READ_BE_UINT16(p2 + 6) / 16; @@ -703,8 +705,6 @@ void SimonEngine::vc10_draw() { flags = p2[4]; } - debug(1, "Width %d Height %d Flags 0x%x", width, height, flags); - if (height == 0 || width == 0) return; @@ -752,7 +752,7 @@ void SimonEngine::vc10_draw() { return; } - if (getGameType() != GType_FF) { + if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { if (state.flags & 0x10) { state.depack_src = vc10_uncompressFlip(state.depack_src, width, height); } else if (state.flags & 1) { @@ -762,8 +762,12 @@ void SimonEngine::vc10_draw() { vlut = &_video_windows[_windowNum * 4]; - state.draw_width = width * 2; /* cl */ + state.draw_width = width; /* cl */ state.draw_height = height; /* ch */ + + if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { + state.draw_width = width * 2; /* cl */ + } state.x_skip = 0; /* colums to skip = bh */ state.y_skip = 0; /* rows to skip = bl */ @@ -808,7 +812,9 @@ void SimonEngine::vc10_draw() { assert(state.draw_width != 0 && state.draw_height != 0); - state.draw_width *= 4; + if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { + state.draw_width *= 4; + } state.surf2_addr = dx_lock_2(); state.surf2_pitch = _dxSurfacePitch; @@ -880,7 +886,7 @@ void SimonEngine::vc10_draw() { } while (++w != state.draw_width); /* vc10_helper_5 */ - } else if (((_lockWord & 0x20) && state.palette == 0) || state.palette == 0xC0) { + } else if (getGameType() != GType_FF && (((_lockWord & 0x20) && state.palette == 0) || state.palette == 0xC0)) { const byte *src; byte *dst; uint h, i; @@ -1001,6 +1007,7 @@ void SimonEngine::vc10_draw() { byte *src, *dst, *dst_org; state.x_skip *= 4; /* reached */ + state.dl = width; state.dh = height; @@ -1817,10 +1824,13 @@ void SimonEngine::vc62_fastFadeOut() { // Allow one section of Simon the Sorcerer 1 introduction to be displayed // in lower half of screen - if ((getGameType() == GType_SIMON1) && (_subroutine == 2923 || _subroutine == 2926)) + if ((getGameType() == GType_SIMON1) && (_subroutine == 2923 || _subroutine == 2926)) { dx_clear_surfaces(200); - else + } else if (getGameType() == GType_FF) { + dx_clear_surfaces(480); + } else { dx_clear_surfaces(_windowNum == 4 ? 134 : 200); + } } if (getGameType() == GType_SIMON2) { if (_nextMusicToPlay != -1) diff --git a/simon/vga.h b/simon/vga.h index 22cdb6db0d..0b522ac9bb 100644 --- a/simon/vga.h +++ b/simon/vga.h @@ -112,7 +112,7 @@ struct VC10_state { byte *surf_addr; uint surf_pitch; - byte dl, dh; + uint16 dl, dh; const byte *depack_src; int8 depack_cont; -- cgit v1.2.3