aboutsummaryrefslogtreecommitdiff
path: root/simon
diff options
context:
space:
mode:
authorMax Horn2006-02-11 22:45:04 +0000
committerMax Horn2006-02-11 22:45:04 +0000
commit26ee630756ebdd7c96bccede0881a8c8b98e8f2b (patch)
tree26e378d5cf990a2b81c2c96e9e683a7f333b62e8 /simon
parent2a9a0d4211b1ea5723f1409d91cb95de8984429e (diff)
downloadscummvm-rg350-26ee630756ebdd7c96bccede0881a8c8b98e8f2b.tar.gz
scummvm-rg350-26ee630756ebdd7c96bccede0881a8c8b98e8f2b.tar.bz2
scummvm-rg350-26ee630756ebdd7c96bccede0881a8c8b98e8f2b.zip
Moved engines to the new engines/ directory
svn-id: r20582
Diffstat (limited to 'simon')
-rw-r--r--simon/charset.cpp1277
-rw-r--r--simon/cursor.cpp246
-rw-r--r--simon/debug.cpp462
-rw-r--r--simon/debug.h1530
-rw-r--r--simon/debugger.cpp206
-rw-r--r--simon/debugger.h56
-rw-r--r--simon/game.cpp1186
-rw-r--r--simon/icons.cpp229
-rw-r--r--simon/intern.h217
-rw-r--r--simon/items.cpp1685
-rw-r--r--simon/midi.cpp546
-rw-r--r--simon/midi.h127
-rw-r--r--simon/midiparser_s1d.cpp155
-rw-r--r--simon/module.mk29
-rw-r--r--simon/res.cpp386
-rw-r--r--simon/saveload.cpp634
-rw-r--r--simon/simon.cpp4292
-rw-r--r--simon/simon.h903
-rw-r--r--simon/sound.cpp555
-rw-r--r--simon/sound.h80
-rw-r--r--simon/verb.cpp608
-rw-r--r--simon/vga.cpp2299
-rw-r--r--simon/vga.h129
23 files changed, 0 insertions, 17837 deletions
diff --git a/simon/charset.cpp b/simon/charset.cpp
deleted file mode 100644
index 05ed2c0351..0000000000
--- a/simon/charset.cpp
+++ /dev/null
@@ -1,1277 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/stdafx.h"
-#include "simon/simon.h"
-#include "simon/intern.h"
-
-namespace Simon {
-
-void SimonEngine::print_char_helper_1(const byte *src, uint len) {
- uint ind;
-
- if (_textWindow == NULL)
- return;
-
- while (len-- != 0) {
- if (*src != 12 && _textWindow->fcs_data != NULL &&
- _fcsData1[ind = get_fcs_ptr_3_index(_textWindow)] != 2) {
-
- _fcsData1[ind] = 2;
- _fcsData2[ind] = 1;
- }
-
- fcs_putchar(*src++);
- }
-}
-
-void SimonEngine::print_char_helper_5(FillOrCopyStruct *fcs) {
- uint index = get_fcs_ptr_3_index(fcs);
- print_char_helper_6(index);
- _fcsData1[index] = 0;
-}
-
-void SimonEngine::print_char_helper_6(uint i) {
- FillOrCopyStruct *fcs;
-
- if (_fcsData2[i]) {
- mouseOff();
- fcs = _windowArray[i];
- drawIconArray(i, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1, fcs->fcs_data->unk2);
- _fcsData2[i] = 0;
- mouseOn();
- }
-}
-
-void SimonEngine::render_string_amiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt) {
- VgaPointersEntry *vpe = &_vgaBufferPointers[2];
- byte *src, *dst, *dst_org, chr;
- uint count;
-
- if (vga_sprite_id >= 100) {
- vga_sprite_id -= 100;
- vpe++;
- }
-
- src = dst = vpe->vgaFile2;
-
- count = 499;
- if (vga_sprite_id == 1)
- count *= 2;
-
- src += vga_sprite_id * 8;
- dst += READ_BE_UINT32(src);
- WRITE_BE_UINT16(dst + 4, height);
- WRITE_BE_UINT16(dst + 6, width);
-
- uint charsize = width/8 * height;
- memset(dst, 0, count);
- dst_org = dst;
- int delta = 0;
- while ((chr = *txt++) != 0) {
- int tmp = chr;
- if (chr == 10) {
- dst_org += width * 10;
- dst = dst_org;
- delta = 0;
- } else if ((tmp -= '!') < 0) {
- delta += 6;
- if (delta > 8)
- {
- delta -= 8;
- dst_org++;
- }
- } else {
- byte *img = src + chr * 41;
- int CTR = img[40];
- int D3 = 8 - delta;
- for (int D2 = 9; D2 != 0; D2--)
- {
- byte *cur_dst = dst_org;
- for (int D7 = 2; D7 != 0; D7--)
- {
- chr = *img >> delta;
- if (chr)
- {
- if (color & 1) *(cur_dst + charsize * 0) |= chr;
- if (color & 2) *(cur_dst + charsize * 1) |= chr;
- if (color & 4) *(cur_dst + charsize * 2) |= chr;
- if (color & 8) *(cur_dst + charsize * 3) |= chr;
- }
- if ((D3 >= CTR) && (chr = *img++ << (D3)))
- {
- if (color & 1) *(cur_dst + charsize * 0) |= chr;
- if (color & 2) *(cur_dst + charsize * 1) |= chr;
- if (color & 4) *(cur_dst + charsize * 2) |= chr;
- if (color & 8) *(cur_dst + charsize * 3) |= chr;
- }
- color++;
- }
- chr = *img >> delta;
- if (chr)
- {
- *(cur_dst + charsize * 0) |= chr;
- *(cur_dst + charsize * 1) |= chr;
- *(cur_dst + charsize * 2) |= chr;
- *(cur_dst + charsize * 3) |= chr;
- }
- if ((D3 >= CTR) && (chr = *img++ << (D3)))
- {
- *(cur_dst + charsize * 0) |= chr;
- *(cur_dst + charsize * 1) |= chr;
- *(cur_dst + charsize * 2) |= chr;
- *(cur_dst + charsize * 3) |= chr;
- }
- cur_dst += width/8;
- }
- delta += CTR;
- if (delta > 8)
- {
- delta -= 8;
- dst_org++;
- }
- }
- }
-}
-
-void SimonEngine::render_string(uint vga_sprite_id, uint color, uint width, uint height, const char *txt) {
- VgaPointersEntry *vpe = &_vgaBufferPointers[2];
- byte *src, *dst, *p, *dst_org, chr;
- uint count;
-
- if (vga_sprite_id >= 100) {
- vga_sprite_id -= 100;
- vpe++;
- }
-
- src = dst = vpe->vgaFile2;
-
- count = 4000;
- if (vga_sprite_id == 1)
- count *= 2;
-
- p = dst + vga_sprite_id * 8;
-
- WRITE_BE_UINT16(p + 4, height);
- WRITE_BE_UINT16(p + 6, width);
-
- dst += READ_BE_UINT32(p);
-
- memset(dst, 0, count);
- if (_language == Common::HB_ISR)
- dst += width - 1; // For Hebrew, start at the right edge, not the left.
-
- dst_org = dst;
- while ((chr = *txt++) != 0) {
- if (chr == 10) {
- dst_org += width * 10;
- dst = dst_org;
- } else if ((chr -= ' ') == 0) {
- dst += (_language == Common::HB_ISR ? -6 : 6); // Hebrew moves to the left, all others to the right
- } else {
- byte *img_hdr = src + 48 + chr * 4;
- uint img_height = img_hdr[2];
- uint img_width = img_hdr[3], i;
- byte *img = src + READ_LE_UINT16(img_hdr);
- if (_language == Common::HB_ISR)
- dst -= img_width - 1; // For Hebrew, move from right edge to left edge of image.
- byte *cur_dst = dst;
-
- assert(img_width > 0 && img_width < 50 && img_height > 0 && img_height < 50);
-
- do {
- for (i = 0; i != img_width; i++) {
- chr = *img++;
- if (chr) {
- if (chr == 0xF)
- chr = 207;
- else
- chr += color;
- cur_dst[i] = chr;
- }
- }
- cur_dst += width;
- } while (--img_height);
-
- if (_language != Common::HB_ISR) // Hebrew character movement is done higher up
- dst += img_width - 1;
- }
- }
-}
-
-void SimonEngine::showMessageFormat(const char *s, ...) {
- char buf[STRINGBUFLEN];
- char *str;
- va_list va;
-
- va_start(va, s);
- vsnprintf(buf, STRINGBUFLEN, s, va);
- va_end(va);
-
- if (!_fcsData1[_curWindow]) {
- showmessage_helper_2();
- if (!_showMessageFlag) {
- _windowArray[0] = _textWindow;
- showmessage_helper_3(_textWindow->textLength,
- _textWindow->textMaxLength);
- }
- _showMessageFlag = true;
- _fcsData1[_curWindow] = 1;
- }
-
- for (str = buf; *str; str++)
- showmessage_print_char(*str);
-}
-
-void SimonEngine::showmessage_print_char(byte chr) {
- if (chr == 12) {
- _numLettersToPrint = 0;
- _printCharCurPos = 0;
- print_char_helper_1(&chr, 1);
- print_char_helper_5(_textWindow);
- } else if (chr == 0 || chr == ' ' || chr == 10) {
- if (_printCharMaxPos - _printCharCurPos >= _numLettersToPrint) {
- _printCharCurPos += _numLettersToPrint;
- print_char_helper_1(_lettersToPrintBuf, _numLettersToPrint);
-
- if (_printCharCurPos == _printCharMaxPos) {
- _printCharCurPos = 0;
- } else {
- if (chr)
- print_char_helper_1(&chr, 1);
- if (chr == 10)
- _printCharCurPos = 0;
- else if (chr != 0)
- _printCharCurPos++;
- }
- } else {
- const byte newline_character = 10;
- _printCharCurPos = _numLettersToPrint;
- print_char_helper_1(&newline_character, 1);
- print_char_helper_1(_lettersToPrintBuf, _numLettersToPrint);
- if (chr == ' ') {
- print_char_helper_1(&chr, 1);
- _printCharCurPos++;
- } else {
- print_char_helper_1(&chr, 1);
- _printCharCurPos = 0;
- }
- }
- _numLettersToPrint = 0;
- } else {
- _lettersToPrintBuf[_numLettersToPrint++] = chr;
- }
-}
-
-void SimonEngine::showmessage_helper_2() {
- if (_textWindow)
- return;
-
- _textWindow = openWindow(8, 0x90, 0x18, 6, 1, 0, 0xF);
-}
-
-void SimonEngine::showmessage_helper_3(uint a, uint b) {
- _printCharCurPos = a;
- _printCharMaxPos = b;
- _numLettersToPrint = 0;
-}
-
-void SimonEngine::video_putchar(FillOrCopyStruct *fcs, byte c, byte b) {
- byte width = 6;
-
- if (c == 0xC) {
- video_fill_or_copy_from_3_to_2(fcs);
- } else if (c == 0xD || c == 0xA) {
- video_putchar_newline(fcs);
- } else if ((c == 1 && _language != Common::HB_ISR) || (c == 8)) {
- if (_language == Common::HB_ISR) { //Hebrew
- if (b >= 64 && b < 91)
- width = _hebrew_char_widths [b - 64];
-
- if (fcs->textLength != 0) {
- fcs->textLength--;
- fcs->textColumnOffset += width;
- if (fcs->textColumnOffset >= 8) {
- fcs->textColumnOffset -= 8;
- fcs->textColumn--;
- }
- }
- } else {
- int8 val = (c == 8) ? 6 : 4;
-
- if (fcs->textLength != 0) {
- fcs->textLength--;
- fcs->textColumnOffset -= val;
- if ((int8)fcs->textColumnOffset < val) {
- fcs->textColumnOffset += 8;
- fcs->textColumn--;
- }
- }
- }
- } else if (c >= 0x20) {
- if (fcs->textLength == fcs->textMaxLength) {
- video_putchar_newline(fcs);
- } else if (fcs->textRow == fcs->height) {
- video_putchar_newline(fcs);
- fcs->textRow--;
- }
-
- if (_language == Common::HB_ISR) { //Hebrew
- if (c >= 64 && c < 91)
- width = _hebrew_char_widths [c - 64];
- fcs->textColumnOffset -= width;
- if (fcs->textColumnOffset >= width) {
- fcs->textColumn++;
- fcs->textColumnOffset += 8;
- }
- video_putchar_drawchar(fcs, fcs->width + fcs->x - fcs->textColumn, fcs->textRow * 8 + fcs->y, c);
- fcs->textLength++;
- } else {
- video_putchar_drawchar(fcs, fcs->textColumn + fcs->x, fcs->textRow * 8 + fcs->y, c);
-
- fcs->textLength++;
- fcs->textColumnOffset += 6;
- if (c == 'i' || c == 'l')
- fcs->textColumnOffset -= 2;
-
- if (fcs->textColumnOffset >= 8) {
- fcs->textColumnOffset -= 8;
- fcs->textColumn++;
- }
- }
- }
-}
-
-void SimonEngine::video_putchar_newline(FillOrCopyStruct *fcs) {
- fcs->textColumnOffset = 0;
- fcs->textLength = 0;
- fcs->textColumn = 0;
-
- if (fcs->textRow != fcs->height)
- fcs->textRow++;
-}
-
-#ifdef PALMOS_68K
-static const byte *russian_video_font;
-static const byte *polish_video_font;
-static const byte *french_video_font;
-static const byte *german_video_font;
-static const byte *hebrew_video_font;
-static const byte *italian_video_font;
-static const byte *spanish_video_font;
-static const byte *video_font;
-#else
-static const byte russian_video_font[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 32, 112, 112, 32, 32, 0, 32, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 0, 0, 100, 40, 48, 40, 100, 0,
- 0, 0, 96, 48, 40, 40, 112, 0,
- 60, 68, 68, 60, 36, 68, 68, 0,
- 0, 16, 40, 16, 42, 68, 58, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 0, 4, 8, 8, 8, 8, 4, 0,
- 0, 32, 16, 16, 16, 16, 32, 0,
- 72, 84, 84, 116, 84, 84, 72, 0,
- 0, 0, 60, 68, 60, 36, 100, 0,
- 0, 0, 0, 0, 0, 48, 48, 96,
- 0, 0, 0, 240, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 48, 48, 0,
- 16, 32, 0, 120, 112, 64, 56, 0,
- 112, 136, 152, 168, 200, 136, 112, 0,
- 32, 96, 32, 32, 32, 32, 112, 0,
- 112, 136, 8, 48, 64, 136, 248, 0,
- 112, 136, 8, 48, 8, 136, 112, 0,
- 16, 48, 80, 144, 248, 16, 56, 0,
- 248, 128, 240, 8, 8, 136, 112, 0,
- 48, 64, 128, 240, 136, 136, 112, 0,
- 248, 136, 8, 16, 32, 32, 32, 0,
- 112, 136, 136, 112, 136, 136, 112, 0,
- 112, 136, 136, 120, 8, 16, 96, 0,
- 0, 0, 48, 48, 0, 48, 48, 0,
- 32, 16, 0, 112, 8, 248, 120, 0,
- 0, 0, 96, 48, 40, 40, 112, 0,
- 0, 0, 112, 88, 20, 20, 56, 0,
- 0, 0, 120, 4, 28, 4, 120, 0,
- 112, 136, 8, 16, 32, 0, 32, 0,
- 0, 0, 84, 84, 84, 84, 56, 4,
- 56, 68, 68, 124, 68, 68, 68, 0,
- 124, 36, 32, 56, 36, 36, 120, 0,
- 120, 36, 36, 56, 36, 36, 120, 0,
- 124, 36, 32, 32, 32, 32, 112, 0,
- 56, 40, 40, 40, 40, 40, 124, 68,
- 124, 36, 32, 56, 32, 36, 124, 0,
- 84, 84, 84, 56, 84, 84, 84, 0,
- 56, 68, 4, 24, 4, 68, 56, 0,
- 68, 68, 76, 84, 100, 68, 68, 0,
- 100, 40, 40, 48, 40, 36, 100, 0,
- 28, 36, 36, 36, 36, 36, 100, 0,
- 68, 108, 84, 68, 68, 68, 68, 0,
- 68, 68, 68, 124, 68, 68, 68, 0,
- 56, 68, 68, 68, 68, 68, 56, 0,
- 124, 68, 68, 68, 68, 68, 68, 0,
- 120, 36, 36, 56, 32, 32, 112, 0,
- 56, 68, 64, 64, 64, 68, 56, 0,
- 124, 84, 16, 16, 16, 16, 56, 0,
- 100, 36, 36, 28, 4, 4, 56, 0,
- 56, 84, 84, 84, 56, 16, 56, 0,
- 108, 40, 16, 16, 40, 40, 108, 0,
- 72, 72, 72, 72, 72, 72, 60, 4,
- 76, 72, 72, 56, 8, 8, 28, 0,
- 84, 84, 84, 84, 84, 84, 60, 0,
- 84, 84, 84, 84, 84, 84, 56, 4,
- 56, 68, 4, 28, 4, 68, 56, 0,
- 0, 0, 68, 100, 84, 84, 100, 0,
- 0, 0, 72, 84, 116, 84, 72, 0,
- 0, 0, 60, 68, 60, 36, 100, 0,
- 0, 0, 120, 4, 24, 4, 120, 0,
- 0, 0, 100, 40, 48, 40, 100, 0,
- 60, 68, 68, 60, 36, 68, 68, 0,
- 0, 0, 56, 4, 60, 68, 60, 0,
- 60, 64, 32, 56, 68, 68, 56, 0,
- 48, 72, 80, 120, 68, 68, 56, 0,
- 0, 0, 120, 4, 56, 64, 60, 0,
- 56, 4, 4, 60, 68, 68, 56, 0,
- 0, 0, 56, 68, 120, 64, 56, 0,
- 40, 0, 56, 68, 120, 64, 56, 0,
- 0, 0, 84, 84, 56, 84, 84, 0,
- 64, 0, 192, 64, 64, 64, 224, 0,
- 0, 0, 68, 68, 68, 68, 60, 0,
- 56, 0, 68, 68, 68, 68, 60, 0,
- 192, 64, 64, 64, 64, 64, 224, 0,
- 0, 0, 28, 36, 36, 36, 100, 0,
- 0, 0, 68, 108, 84, 68, 68, 0,
- 0, 0, 56, 68, 68, 68, 56, 0,
- 0, 0, 68, 68, 124, 68, 68, 0,
- 0, 0, 124, 68, 68, 68, 68, 0,
- 0, 0, 120, 36, 36, 56, 32, 112,
- 0, 0, 60, 64, 64, 64, 60, 0,
- 0, 0, 124, 84, 16, 16, 56, 0,
- 0, 0, 68, 68, 60, 4, 56, 0,
- 48, 16, 56, 84, 84, 56, 16, 56,
- 0, 0, 68, 40, 16, 40, 68, 0,
- 0, 0, 72, 72, 72, 72, 60, 4,
- 0, 0, 76, 72, 72, 56, 8, 28,
- 0, 0, 84, 84, 84, 84, 60, 0,
- 32, 80, 0, 96, 144, 144, 96, 0,
- 0, 14, 8, 48, 8, 8, 14, 0,
- 0, 8, 8, 8, 8, 8, 8, 0,
- 0, 112, 16, 12, 16, 16, 112, 0,
- 0, 0, 0, 0, 0, 0, 248, 0,
- 252, 252, 252, 252, 252, 252, 252, 252,
- 240, 240, 240, 240, 240, 240, 240, 240,
-};
-
-static const byte polish_video_font[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 32, 112, 112, 32, 32, 0, 32, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 0, 0, 112, 136, 248, 128, 112, 8,
- 0, 16, 120, 128, 112, 8, 240, 0,
- 192, 64, 64, 96, 192, 64, 224, 0,
- 0, 16, 40, 16, 42, 68, 58, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 0, 4, 8, 8, 8, 8, 4, 0,
- 0, 32, 16, 16, 16, 16, 32, 0,
- 0, 0, 20, 8, 62, 8, 20, 0,
- 0, 32, 112, 136, 136, 136, 112, 0,
- 0, 0, 0, 0, 0, 48, 48, 96,
- 0, 0, 0, 240, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 48, 48, 0,
- 0, 32, 112, 136, 128, 136, 112, 0,
- 112, 136, 152, 168, 200, 136, 112, 0,
- 32, 96, 32, 32, 32, 32, 112, 0,
- 112, 136, 8, 48, 64, 136, 248, 0,
- 112, 136, 8, 48, 8, 136, 112, 0,
- 16, 48, 80, 144, 248, 16, 56, 0,
- 248, 128, 240, 8, 8, 136, 112, 0,
- 48, 64, 128, 240, 136, 136, 112, 0,
- 248, 136, 8, 16, 32, 32, 32, 0,
- 112, 136, 136, 112, 136, 136, 112, 0,
- 112, 136, 136, 120, 8, 16, 96, 0,
- 0, 0, 48, 48, 0, 48, 48, 0,
- 0, 32, 240, 136, 136, 136, 136, 0,
- 80, 0, 136, 136, 136, 136, 112, 0,
- 0, 32, 248, 144, 32, 72, 248, 0,
- 8, 32, 248, 144, 32, 72, 248, 0,
- 112, 136, 8, 16, 32, 0, 32, 0,
- 0, 0, 112, 8, 120, 136, 120, 4,
- 112, 136, 136, 248, 136, 136, 136, 0,
- 240, 72, 72, 112, 72, 72, 240, 0,
- 48, 72, 128, 128, 128, 72, 48, 0,
- 224, 80, 72, 72, 72, 80, 224, 0,
- 248, 72, 64, 112, 64, 72, 248, 0,
- 248, 72, 64, 112, 64, 64, 224, 0,
- 48, 72, 128, 152, 136, 72, 56, 0,
- 136, 136, 136, 248, 136, 136, 136, 0,
- 248, 32, 32, 32, 32, 32, 248, 0,
- 24, 8, 8, 8, 136, 136, 112, 0,
- 200, 72, 80, 96, 80, 72, 200, 0,
- 224, 64, 64, 64, 64, 72, 248, 0,
- 136, 216, 168, 168, 136, 136, 136, 0,
- 136, 200, 168, 152, 136, 136, 136, 0,
- 112, 136, 136, 136, 136, 136, 112, 0,
- 240, 72, 72, 112, 64, 64, 224, 0,
- 112, 136, 136, 136, 136, 168, 112, 8,
- 240, 72, 72, 112, 72, 72, 200, 0,
- 112, 136, 128, 112, 8, 136, 112, 0,
- 248, 168, 32, 32, 32, 32, 112, 0,
- 136, 136, 136, 136, 136, 136, 120, 0,
- 136, 136, 136, 80, 80, 32, 32, 0,
- 136, 136, 136, 136, 168, 216, 136, 0,
- 136, 136, 80, 32, 80, 136, 136, 0,
- 136, 136, 136, 112, 32, 32, 112, 0,
- 248, 136, 16, 32, 64, 136, 248, 0,
- 0, 14, 8, 8, 8, 8, 14, 0,
- 0, 128, 64, 32, 16, 8, 4, 0,
- 224, 64, 64, 96, 192, 72, 248, 0,
- 16, 120, 128, 112, 8, 136, 112, 0,
- 248, 72, 64, 112, 64, 72, 248, 16,
- 32, 248, 16, 32, 64, 136, 248, 0,
- 0, 0, 112, 8, 120, 136, 120, 0,
- 192, 64, 80, 104, 72, 72, 112, 0,
- 0, 0, 112, 136, 128, 136, 112, 0,
- 24, 16, 80, 176, 144, 144, 112, 0,
- 0, 0, 112, 136, 248, 128, 112, 0,
- 48, 72, 64, 224, 64, 64, 224, 0,
- 0, 0, 104, 144, 144, 112, 136, 112,
- 192, 64, 80, 104, 72, 72, 200, 0,
- 64, 0, 192, 64, 64, 64, 224, 0,
- 8, 0, 8, 8, 8, 8, 136, 112,
- 192, 64, 72, 80, 96, 80, 200, 0,
- 192, 64, 64, 64, 64, 64, 224, 0,
- 0, 0, 144, 216, 168, 136, 136, 0,
- 0, 0, 240, 136, 136, 136, 136, 0,
- 0, 0, 112, 136, 136, 136, 112, 0,
- 0, 0, 176, 72, 72, 112, 64, 224,
- 0, 0, 104, 144, 144, 112, 16, 56,
- 0, 0, 176, 72, 72, 64, 224, 0,
- 0, 0, 120, 128, 112, 8, 240, 0,
- 64, 64, 240, 64, 64, 72, 48, 0,
- 0, 0, 144, 144, 144, 144, 104, 0,
- 0, 0, 136, 136, 136, 80, 32, 0,
- 0, 0, 136, 136, 168, 216, 144, 0,
- 0, 0, 136, 80, 32, 80, 136, 0,
- 0, 0, 136, 136, 136, 112, 32, 192,
- 0, 0, 248, 144, 32, 72, 248, 0,
- 32, 80, 0, 96, 144, 144, 96, 0,
- 0, 14, 8, 48, 8, 8, 14, 0,
- 0, 8, 8, 8, 8, 8, 8, 0,
- 0, 112, 16, 12, 16, 16, 112, 0,
- 0, 0, 0, 0, 0, 0, 248, 0,
- 252, 252, 252, 252, 252, 252, 252, 252,
- 240, 240, 240, 240, 240, 240, 240, 240,
-};
-
-static const byte french_video_font[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 32, 112, 112, 32, 32, 0, 32, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 32, 80, 0, 112, 136, 136, 112, 0,
- 32, 80, 0, 112, 8, 248, 120, 0,
- 112, 136, 128, 128, 136, 112, 32, 96,
- 0, 16, 40, 16, 42, 68, 58, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 0, 4, 8, 8, 8, 8, 4, 0,
- 0, 32, 16, 16, 16, 16, 32, 0,
- 0, 0, 20, 8, 62, 8, 20, 0,
- 112, 136, 128, 128, 136, 112, 32, 96,
- 0, 0, 0, 0, 0, 48, 48, 96,
- 0, 0, 0, 240, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 48, 48, 0,
- 32, 64, 0, 112, 248, 128, 112, 0,
- 112, 136, 152, 168, 200, 136, 112, 0,
- 32, 96, 32, 32, 32, 32, 112, 0,
- 112, 136, 8, 48, 64, 136, 248, 0,
- 112, 136, 8, 48, 8, 136, 112, 0,
- 16, 48, 80, 144, 248, 16, 56, 0,
- 248, 128, 240, 8, 8, 136, 112, 0,
- 48, 64, 128, 240, 136, 136, 112, 0,
- 248, 136, 8, 16, 32, 32, 32, 0,
- 112, 136, 136, 112, 136, 136, 112, 0,
- 112, 136, 136, 120, 8, 16, 96, 0,
- 0, 0, 48, 48, 0, 48, 48, 0,
- 32, 16, 0, 112, 8, 248, 120, 0,
- 32, 80, 0, 144, 144, 144, 104, 0,
- 32, 16, 0, 112, 248, 128, 112, 0,
- 32, 80, 0, 112, 248, 128, 112, 0,
- 112, 136, 8, 16, 32, 0, 32, 0,
- 32, 80, 0, 192, 64, 64, 224, 0,
- 112, 136, 136, 248, 136, 136, 136, 0,
- 240, 72, 72, 112, 72, 72, 240, 0,
- 48, 72, 128, 128, 128, 72, 48, 0,
- 224, 80, 72, 72, 72, 80, 224, 0,
- 248, 72, 64, 112, 64, 72, 248, 0,
- 248, 72, 64, 112, 64, 64, 224, 0,
- 48, 72, 128, 152, 136, 72, 56, 0,
- 136, 136, 136, 248, 136, 136, 136, 0,
- 248, 32, 32, 32, 32, 32, 248, 0,
- 24, 8, 8, 8, 136, 136, 112, 0,
- 200, 72, 80, 96, 80, 72, 200, 0,
- 224, 64, 64, 64, 64, 72, 248, 0,
- 136, 216, 168, 168, 136, 136, 136, 0,
- 136, 200, 168, 152, 136, 136, 136, 0,
- 112, 136, 136, 136, 136, 136, 112, 0,
- 240, 72, 72, 112, 64, 64, 224, 0,
- 112, 136, 136, 136, 136, 168, 112, 8,
- 240, 72, 72, 112, 72, 72, 200, 0,
- 112, 136, 128, 112, 8, 136, 112, 0,
- 248, 168, 32, 32, 32, 32, 112, 0,
- 136, 136, 136, 136, 136, 136, 120, 0,
- 136, 136, 136, 80, 80, 32, 32, 0,
- 136, 136, 136, 136, 168, 216, 136, 0,
- 136, 136, 80, 32, 80, 136, 136, 0,
- 136, 136, 136, 112, 32, 32, 112, 0,
- 248, 136, 16, 32, 64, 136, 248, 0,
- 0, 14, 8, 8, 8, 8, 14, 0,
- 0, 128, 64, 32, 16, 8, 4, 0,
- 0, 112, 16, 16, 16, 16, 112, 0,
- 0, 0, 112, 136, 128, 112, 32, 96,
- 160, 0, 192, 64, 64, 64, 224, 0,
- 32, 16, 0, 144, 144, 144, 104, 0,
- 0, 0, 112, 8, 120, 136, 120, 0,
- 192, 64, 80, 104, 72, 72, 112, 0,
- 0, 0, 112, 136, 128, 136, 112, 0,
- 24, 16, 80, 176, 144, 144, 112, 0,
- 0, 0, 112, 136, 248, 128, 112, 0,
- 48, 72, 64, 224, 64, 64, 224, 0,
- 0, 0, 104, 144, 144, 112, 136, 112,
- 192, 64, 80, 104, 72, 72, 200, 0,
- 64, 0, 192, 64, 64, 64, 224, 0,
- 8, 0, 8, 8, 8, 8, 136, 112,
- 192, 64, 72, 80, 96, 80, 200, 0,
- 192, 64, 64, 64, 64, 64, 224, 0,
- 0, 0, 144, 216, 168, 136, 136, 0,
- 0, 0, 240, 136, 136, 136, 136, 0,
- 0, 0, 112, 136, 136, 136, 112, 0,
- 0, 0, 176, 72, 72, 112, 64, 224,
- 0, 0, 104, 144, 144, 112, 16, 56,
- 0, 0, 176, 72, 72, 64, 224, 0,
- 0, 0, 120, 128, 112, 8, 240, 0,
- 64, 64, 240, 64, 64, 72, 48, 0,
- 0, 0, 144, 144, 144, 144, 104, 0,
- 0, 0, 136, 136, 136, 80, 32, 0,
- 0, 0, 136, 136, 168, 216, 144, 0,
- 0, 0, 136, 80, 32, 80, 136, 0,
- 0, 0, 136, 136, 136, 112, 32, 192,
- 0, 0, 248, 144, 32, 72, 248, 0,
- 32, 80, 0, 96, 144, 144, 96, 0,
- 0, 14, 8, 48, 8, 8, 14, 0,
- 0, 8, 8, 8, 8, 8, 8, 0,
- 0, 112, 16, 12, 16, 16, 112, 0,
- 0, 0, 0, 0, 0, 0, 248, 0,
- 252, 252, 252, 252, 252, 252, 252, 252,
- 240, 240, 240, 240, 240, 240, 240, 240,
-};
-
-static const byte german_video_font[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 32, 112, 112, 32, 32, 0, 32, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 80, 0, 112, 8, 120, 136, 120, 0,
- 80, 0, 112, 136, 136, 136, 112, 0,
- 80, 0, 144, 144, 144, 144, 104, 0,
- 0, 16, 40, 16, 42, 68, 58, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 0, 4, 8, 8, 8, 8, 4, 0,
- 0, 32, 16, 16, 16, 16, 32, 0,
- 0, 0, 20, 8, 62, 8, 20, 0,
- 96, 144, 144, 160, 144, 144, 160, 128,
- 0, 0, 0, 0, 0, 48, 48, 96,
- 0, 0, 0, 240, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 48, 48, 0,
- 80, 0, 112, 136, 248, 136, 136, 0,
- 112, 136, 152, 168, 200, 136, 112, 0,
- 32, 96, 32, 32, 32, 32, 112, 0,
- 112, 136, 8, 48, 64, 136, 248, 0,
- 112, 136, 8, 48, 8, 136, 112, 0,
- 16, 48, 80, 144, 248, 16, 56, 0,
- 248, 128, 240, 8, 8, 136, 112, 0,
- 48, 64, 128, 240, 136, 136, 112, 0,
- 248, 136, 8, 16, 32, 32, 32, 0,
- 112, 136, 136, 112, 136, 136, 112, 0,
- 112, 136, 136, 120, 8, 16, 96, 0,
- 0, 0, 48, 48, 0, 48, 48, 0,
- 136, 112, 136, 136, 136, 136, 112, 0,
- 80, 0, 136, 136, 136, 136, 112, 0,
- 80, 0, 144, 144, 144, 144, 104, 0,
- 32, 64, 0, 112, 248, 128, 112, 0,
- 112, 136, 8, 16, 32, 0, 32, 0,
- 32, 80, 0, 192, 64, 64, 224, 0,
- 112, 136, 136, 248, 136, 136, 136, 0,
- 240, 72, 72, 112, 72, 72, 240, 0,
- 48, 72, 128, 128, 128, 72, 48, 0,
- 224, 80, 72, 72, 72, 80, 224, 0,
- 248, 72, 64, 112, 64, 72, 248, 0,
- 248, 72, 64, 112, 64, 64, 224, 0,
- 48, 72, 128, 152, 136, 72, 56, 0,
- 136, 136, 136, 248, 136, 136, 136, 0,
- 248, 32, 32, 32, 32, 32, 248, 0,
- 24, 8, 8, 8, 136, 136, 112, 0,
- 200, 72, 80, 96, 80, 72, 200, 0,
- 224, 64, 64, 64, 64, 72, 248, 0,
- 136, 216, 168, 168, 136, 136, 136, 0,
- 136, 200, 168, 152, 136, 136, 136, 0,
- 112, 136, 136, 136, 136, 136, 112, 0,
- 240, 72, 72, 112, 64, 64, 224, 0,
- 112, 136, 136, 136, 136, 168, 112, 8,
- 240, 72, 72, 112, 72, 72, 200, 0,
- 112, 136, 128, 112, 8, 136, 112, 0,
- 248, 168, 32, 32, 32, 32, 112, 0,
- 136, 136, 136, 136, 136, 136, 120, 0,
- 136, 136, 136, 80, 80, 32, 32, 0,
- 136, 136, 136, 136, 168, 216, 136, 0,
- 136, 136, 80, 32, 80, 136, 136, 0,
- 136, 136, 136, 112, 32, 32, 112, 0,
- 248, 136, 16, 32, 64, 136, 248, 0,
- 0, 14, 8, 8, 8, 8, 14, 0,
- 0, 128, 64, 32, 16, 8, 4, 0,
- 0, 112, 16, 16, 16, 16, 112, 0,
- 0, 48, 72, 64, 72, 48, 16, 48,
- 0, 80, 0, 96, 32, 40, 48, 0,
- 32, 16, 0, 152, 144, 144, 232, 0,
- 0, 0, 112, 8, 120, 136, 120, 0,
- 192, 64, 80, 104, 72, 72, 112, 0,
- 0, 0, 112, 136, 128, 136, 112, 0,
- 24, 16, 80, 176, 144, 144, 112, 0,
- 0, 0, 112, 136, 248, 128, 112, 0,
- 48, 72, 64, 224, 64, 64, 224, 0,
- 0, 0, 104, 144, 144, 112, 136, 112,
- 192, 64, 80, 104, 72, 72, 200, 0,
- 64, 0, 192, 64, 64, 64, 224, 0,
- 8, 0, 8, 8, 8, 8, 136, 112,
- 192, 64, 72, 80, 96, 80, 200, 0,
- 192, 64, 64, 64, 64, 64, 224, 0,
- 0, 0, 144, 216, 168, 136, 136, 0,
- 0, 0, 240, 136, 136, 136, 136, 0,
- 0, 0, 112, 136, 136, 136, 112, 0,
- 0, 0, 176, 72, 72, 112, 64, 224,
- 0, 0, 104, 144, 144, 112, 16, 56,
- 0, 0, 176, 72, 72, 64, 224, 0,
- 0, 0, 120, 128, 112, 8, 240, 0,
- 64, 64, 240, 64, 64, 72, 48, 0,
- 0, 0, 144, 144, 144, 144, 104, 0,
- 0, 0, 136, 136, 136, 80, 32, 0,
- 0, 0, 136, 136, 168, 216, 144, 0,
- 0, 0, 136, 80, 32, 80, 136, 0,
- 0, 0, 136, 136, 136, 112, 32, 192,
- 0, 0, 248, 144, 32, 72, 248, 0,
- 32, 80, 0, 96, 144, 144, 96, 0,
- 0, 14, 8, 48, 8, 8, 14, 0,
- 0, 8, 8, 8, 8, 8, 8, 0,
- 0, 112, 16, 12, 16, 16, 112, 0,
- 0, 0, 0, 0, 0, 0, 248, 0,
- 252, 252, 252, 252, 252, 252, 252, 252,
- 240, 240, 240, 240, 240, 240, 240, 240,
-};
-
-static const byte hebrew_video_font[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 32, 112, 112, 32, 32, 0, 32, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 0, 144, 0, 96, 144, 144, 104, 0,
- 0, 144, 0, 96, 144, 144, 96, 0,
- 0, 144, 0, 144, 144, 144, 96, 0,
- 0, 16, 40, 16, 42, 68, 58, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 0, 4, 8, 8, 8, 8, 4, 0,
- 0, 32, 16, 16, 16, 16, 32, 0,
- 0, 0, 20, 8, 62, 8, 20, 0,
- 0, 112, 136, 240, 136, 136, 240, 0,
- 0, 0, 0, 0, 0, 48, 48, 96,
- 0, 0, 0, 240, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 48, 48, 0,
- 16, 32, 0, 120, 112, 64, 56, 0,
- 112, 136, 152, 168, 200, 136, 112, 0,
- 32, 96, 32, 32, 32, 32, 112, 0,
- 112, 136, 8, 48, 64, 136, 248, 0,
- 112, 136, 8, 48, 8, 136, 112, 0,
- 16, 48, 80, 144, 248, 16, 56, 0,
- 248, 128, 240, 8, 8, 136, 112, 0,
- 48, 64, 128, 240, 136, 136, 112, 0,
- 248, 136, 8, 16, 32, 32, 32, 0,
- 112, 136, 136, 112, 136, 136, 112, 0,
- 112, 136, 136, 120, 8, 16, 96, 0,
- 0, 0, 48, 48, 0, 48, 48, 0,
- 5, 5, 4, 6, 5, 3, 4, 5,
- 6, 3, 5, 5, 4, 6, 5, 3,
- 4, 6, 5, 6, 6, 6, 5, 5,
- 5, 6, 5, 6, 6, 6, 6, 6,
- 112, 136, 8, 16, 32, 0, 32, 0,
- 0, 0, 144, 80, 160, 144, 144, 0,
- 0, 0, 224, 32, 32, 32, 240, 0,
- 0, 0, 224, 32, 96, 160, 160, 0,
- 0, 0, 248, 16, 16, 16, 16, 0,
- 0, 0, 240, 16, 16, 144, 144, 0,
- 0, 0, 192, 64, 64, 64, 64, 0,
- 0, 0, 224, 64, 32, 64, 64, 0,
- 0, 0, 240, 144, 144, 144, 144, 0,
- 0, 0, 184, 168, 136, 136, 112, 0,
- 0, 0, 192, 64, 0, 0, 0, 0,
- 0, 0, 240, 16, 16, 16, 16, 16,
- 0, 0, 224, 16, 16, 16, 224, 0,
- 128, 128, 224, 32, 32, 32, 192, 0,
- 0, 0, 248, 72, 72, 72, 120, 0,
- 0, 0, 176, 208, 144, 144, 176, 0,
- 0, 0, 192, 64, 64, 64, 64, 64,
- 0, 0, 96, 32, 32, 32, 224, 0,
- 0, 0, 248, 72, 72, 72, 48, 0,
- 0, 0, 80, 80, 80, 80, 224, 0,
- 0, 0, 248, 72, 104, 8, 8, 8,
- 0, 0, 248, 72, 104, 8, 248, 0,
- 0, 0, 216, 72, 48, 16, 16, 16,
- 0, 0, 144, 80, 32, 16, 240, 0,
- 0, 0, 240, 16, 144, 160, 128, 128,
- 0, 0, 240, 16, 16, 16, 16, 0,
- 0, 0, 168, 168, 200, 136, 112, 0,
- 0, 0, 240, 80, 80, 80, 208, 0,
- 0, 14, 8, 8, 8, 8, 14, 0,
- 0, 128, 64, 32, 16, 8, 4, 0,
- 0, 112, 16, 16, 16, 16, 112, 0,
- 0, 48, 72, 64, 72, 48, 16, 48,
- 0, 80, 0, 96, 32, 40, 48, 0,
- 32, 16, 0, 152, 144, 144, 232, 0,
- 0, 0, 112, 8, 120, 136, 120, 0,
- 192, 64, 80, 104, 72, 72, 112, 0,
- 0, 0, 112, 136, 128, 136, 112, 0,
- 24, 16, 80, 176, 144, 144, 112, 0,
- 0, 0, 112, 136, 248, 128, 112, 0,
- 48, 72, 64, 224, 64, 64, 224, 0,
- 0, 0, 104, 144, 144, 112, 136, 112,
- 192, 64, 80, 104, 72, 72, 200, 0,
- 64, 0, 192, 64, 64, 64, 224, 0,
- 8, 0, 8, 8, 8, 8, 136, 112,
- 192, 64, 72, 80, 96, 80, 200, 0,
- 192, 64, 64, 64, 64, 64, 224, 0,
- 0, 0, 144, 216, 168, 136, 136, 0,
- 0, 0, 240, 136, 136, 136, 136, 0,
- 0, 0, 112, 136, 136, 136, 112, 0,
- 0, 0, 176, 72, 72, 112, 64, 224,
- 0, 0, 104, 144, 144, 112, 16, 56,
- 0, 0, 176, 72, 72, 64, 224, 0,
- 0, 0, 120, 128, 112, 8, 240, 0,
- 64, 64, 240, 64, 64, 72, 48, 0,
- 0, 0, 144, 144, 144, 144, 104, 0,
- 0, 0, 136, 136, 136, 80, 32, 0,
- 0, 0, 136, 136, 168, 216, 144, 0,
- 0, 0, 136, 80, 32, 80, 136, 0,
- 0, 0, 136, 136, 136, 112, 32, 192,
- 0, 0, 248, 144, 32, 72, 248, 0,
- 32, 80, 0, 96, 144, 144, 96, 0,
- 0, 14, 8, 48, 8, 8, 14, 0,
- 0, 8, 8, 8, 8, 8, 8, 0,
- 0, 112, 16, 12, 16, 16, 112, 0,
- 0, 0, 0, 0, 0, 0, 248, 0,
- 252, 252, 252, 252, 252, 252, 252, 252,
- 240, 240, 240, 240, 240, 240, 240, 240,
-};
-
-static const byte italian_video_font[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 32, 112, 112, 32, 32, 0, 32, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 80, 0, 112, 8, 120, 136, 120, 0,
- 80, 0, 112, 136, 136, 136, 112, 0,
- 32, 16, 0, 112, 136, 136, 112, 0,
- 0, 16, 40, 16, 42, 68, 58, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 0, 4, 8, 8, 8, 8, 4, 0,
- 0, 32, 16, 16, 16, 16, 32, 0,
- 0, 0, 20, 8, 62, 8, 20, 0,
- 32, 16, 0, 192, 64, 64, 224, 0,
- 0, 0, 0, 0, 0, 48, 48, 96,
- 0, 0, 0, 240, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 48, 48, 0,
- 32, 64, 0, 112, 248, 128, 112, 0,
- 112, 136, 152, 168, 200, 136, 112, 0,
- 32, 96, 32, 32, 32, 32, 112, 0,
- 112, 136, 8, 48, 64, 136, 248, 0,
- 112, 136, 8, 48, 8, 136, 112, 0,
- 16, 48, 80, 144, 248, 16, 56, 0,
- 248, 128, 240, 8, 8, 136, 112, 0,
- 48, 64, 128, 240, 136, 136, 112, 0,
- 248, 136, 8, 16, 32, 32, 32, 0,
- 112, 136, 136, 112, 136, 136, 112, 0,
- 112, 136, 136, 120, 8, 16, 96, 0,
- 0, 0, 48, 48, 0, 48, 48, 0,
- 32, 16, 0, 112, 8, 248, 120, 0,
- 32, 16, 0, 112, 136, 136, 112, 0,
- 32, 16, 0, 112, 248, 128, 112, 0,
- 32, 80, 0, 112, 248, 128, 112, 0,
- 112, 136, 8, 16, 32, 0, 32, 0,
- 32, 80, 0, 96, 32, 40, 48, 0,
- 112, 136, 136, 248, 136, 136, 136, 0,
- 240, 72, 72, 112, 72, 72, 240, 0,
- 48, 72, 128, 128, 128, 72, 48, 0,
- 224, 80, 72, 72, 72, 80, 224, 0,
- 248, 72, 64, 112, 64, 72, 248, 0,
- 248, 72, 64, 112, 64, 64, 224, 0,
- 48, 72, 128, 152, 136, 72, 56, 0,
- 136, 136, 136, 248, 136, 136, 136, 0,
- 248, 32, 32, 32, 32, 32, 248, 0,
- 24, 8, 8, 8, 136, 136, 112, 0,
- 200, 72, 80, 96, 80, 72, 200, 0,
- 224, 64, 64, 64, 64, 72, 248, 0,
- 136, 216, 168, 168, 136, 136, 136, 0,
- 136, 200, 168, 152, 136, 136, 136, 0,
- 112, 136, 136, 136, 136, 136, 112, 0,
- 240, 72, 72, 112, 64, 64, 224, 0,
- 112, 136, 136, 136, 136, 168, 112, 8,
- 240, 72, 72, 112, 72, 72, 200, 0,
- 112, 136, 128, 112, 8, 136, 112, 0,
- 248, 168, 32, 32, 32, 32, 112, 0,
- 136, 136, 136, 136, 136, 136, 120, 0,
- 136, 136, 136, 80, 80, 32, 32, 0,
- 136, 136, 136, 136, 168, 216, 136, 0,
- 136, 136, 80, 32, 80, 136, 136, 0,
- 136, 136, 136, 112, 32, 32, 112, 0,
- 248, 136, 16, 32, 64, 136, 248, 0,
- 0, 14, 8, 8, 8, 8, 14, 0,
- 0, 128, 64, 32, 16, 8, 4, 0,
- 0, 112, 16, 16, 16, 16, 112, 0,
- 0, 0, 112, 136, 128, 112, 32, 96,
- 160, 0, 192, 64, 64, 64, 224, 0,
- 32, 16, 0, 144, 144, 144, 104, 0,
- 0, 0, 112, 8, 120, 136, 120, 0,
- 192, 64, 80, 104, 72, 72, 112, 0,
- 0, 0, 112, 136, 128, 136, 112, 0,
- 24, 16, 80, 176, 144, 144, 112, 0,
- 0, 0, 112, 136, 248, 128, 112, 0,
- 48, 72, 64, 224, 64, 64, 224, 0,
- 0, 0, 104, 144, 144, 112, 136, 112,
- 192, 64, 80, 104, 72, 72, 200, 0,
- 64, 0, 192, 64, 64, 64, 224, 0,
- 8, 0, 8, 8, 8, 8, 136, 112,
- 192, 64, 72, 80, 96, 80, 200, 0,
- 192, 64, 64, 64, 64, 64, 224, 0,
- 0, 0, 144, 216, 168, 136, 136, 0,
- 0, 0, 240, 136, 136, 136, 136, 0,
- 0, 0, 112, 136, 136, 136, 112, 0,
- 0, 0, 176, 72, 72, 112, 64, 224,
- 0, 0, 104, 144, 144, 112, 16, 56,
- 0, 0, 176, 72, 72, 64, 224, 0,
- 0, 0, 120, 128, 112, 8, 240, 0,
- 64, 64, 240, 64, 64, 72, 48, 0,
- 0, 0, 144, 144, 144, 144, 104, 0,
- 0, 0, 136, 136, 136, 80, 32, 0,
- 0, 0, 136, 136, 168, 216, 144, 0,
- 0, 0, 136, 80, 32, 80, 136, 0,
- 0, 0, 136, 136, 136, 112, 32, 192,
- 0, 0, 248, 144, 32, 72, 248, 0,
- 32, 80, 0, 96, 144, 144, 96, 0,
- 0, 14, 8, 48, 8, 8, 14, 0,
- 0, 8, 8, 8, 8, 8, 8, 0,
- 0, 112, 16, 12, 16, 16, 112, 0,
- 0, 0, 0, 0, 0, 0, 248, 0,
- 252, 252, 252, 252, 252, 252, 252, 252,
- 240, 240, 240, 240, 240, 240, 240, 240,
-};
-
-static const byte spanish_video_font[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 32, 112, 112, 32, 32, 0, 32, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 80, 0, 112, 8, 120, 136, 120, 0,
- 80, 0, 112, 136, 136, 136, 112, 0,
- 80, 0, 144, 144, 144, 144, 104, 0,
- 0, 16, 40, 16, 42, 68, 58, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 0, 4, 8, 8, 8, 8, 4, 0,
- 0, 32, 16, 16, 16, 16, 32, 0,
- 0, 0, 20, 8, 62, 8, 20, 0,
- 96, 144, 144, 160, 144, 144, 160, 128,
- 0, 0, 0, 0, 0, 48, 48, 96,
- 0, 0, 0, 240, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 48, 48, 0,
- 32, 64, 0, 112, 248, 128, 112, 0,
- 112, 136, 152, 168, 200, 136, 112, 0,
- 32, 96, 32, 32, 32, 32, 112, 0,
- 112, 136, 8, 48, 64, 136, 248, 0,
- 112, 136, 8, 48, 8, 136, 112, 0,
- 16, 48, 80, 144, 248, 16, 56, 0,
- 248, 128, 240, 8, 8, 136, 112, 0,
- 48, 64, 128, 240, 136, 136, 112, 0,
- 248, 136, 8, 16, 32, 32, 32, 0,
- 112, 136, 136, 112, 136, 136, 112, 0,
- 112, 136, 136, 120, 8, 16, 96, 0,
- 0, 0, 48, 48, 0, 48, 48, 0,
- 32, 64, 0, 112, 8, 248, 120, 0,
- 32, 64, 0, 192, 64, 64, 224, 0,
- 32, 64, 0, 112, 136, 136, 112, 0,
- 32, 64, 0, 144, 144, 144, 104, 0,
- 112, 136, 8, 16, 32, 0, 32, 0,
- 80, 160, 0, 240, 136, 136, 136, 0,
- 112, 136, 136, 248, 136, 136, 136, 0,
- 240, 72, 72, 112, 72, 72, 240, 0,
- 48, 72, 128, 128, 128, 72, 48, 0,
- 224, 80, 72, 72, 72, 80, 224, 0,
- 248, 72, 64, 112, 64, 72, 248, 0,
- 248, 72, 64, 112, 64, 64, 224, 0,
- 48, 72, 128, 152, 136, 72, 56, 0,
- 136, 136, 136, 248, 136, 136, 136, 0,
- 248, 32, 32, 32, 32, 32, 248, 0,
- 24, 8, 8, 8, 136, 136, 112, 0,
- 200, 72, 80, 96, 80, 72, 200, 0,
- 224, 64, 64, 64, 64, 72, 248, 0,
- 136, 216, 168, 168, 136, 136, 136, 0,
- 136, 200, 168, 152, 136, 136, 136, 0,
- 112, 136, 136, 136, 136, 136, 112, 0,
- 240, 72, 72, 112, 64, 64, 224, 0,
- 112, 136, 136, 136, 136, 168, 112, 8,
- 240, 72, 72, 112, 72, 72, 200, 0,
- 112, 136, 128, 112, 8, 136, 112, 0,
- 248, 168, 32, 32, 32, 32, 112, 0,
- 136, 136, 136, 136, 136, 136, 120, 0,
- 136, 136, 136, 80, 80, 32, 32, 0,
- 136, 136, 136, 136, 168, 216, 136, 0,
- 136, 136, 80, 32, 80, 136, 136, 0,
- 136, 136, 136, 112, 32, 32, 112, 0,
- 248, 136, 16, 32, 64, 136, 248, 0,
- 0, 14, 8, 8, 8, 8, 14, 0,
- 0, 128, 64, 32, 16, 8, 4, 0,
- 0, 112, 16, 16, 16, 16, 112, 0,
- 32, 0, 32, 64, 128, 136, 112, 0,
- 32, 0, 32, 32, 112, 112, 32, 0,
- 80, 0, 144, 144, 144, 144, 104, 0,
- 0, 0, 112, 8, 120, 136, 120, 0,
- 192, 64, 80, 104, 72, 72, 112, 0,
- 0, 0, 112, 136, 128, 136, 112, 0,
- 24, 16, 80, 176, 144, 144, 112, 0,
- 0, 0, 112, 136, 248, 128, 112, 0,
- 48, 72, 64, 224, 64, 64, 224, 0,
- 0, 0, 104, 144, 144, 112, 136, 112,
- 192, 64, 80, 104, 72, 72, 200, 0,
- 64, 0, 192, 64, 64, 64, 224, 0,
- 8, 0, 8, 8, 8, 8, 136, 112,
- 192, 64, 72, 80, 96, 80, 200, 0,
- 192, 64, 64, 64, 64, 64, 224, 0,
- 0, 0, 144, 216, 168, 136, 136, 0,
- 0, 0, 240, 136, 136, 136, 136, 0,
- 0, 0, 112, 136, 136, 136, 112, 0,
- 0, 0, 176, 72, 72, 112, 64, 224,
- 0, 0, 104, 144, 144, 112, 16, 56,
- 0, 0, 176, 72, 72, 64, 224, 0,
- 0, 0, 120, 128, 112, 8, 240, 0,
- 64, 64, 240, 64, 64, 72, 48, 0,
- 0, 0, 144, 144, 144, 144, 104, 0,
- 0, 0, 136, 136, 136, 80, 32, 0,
- 0, 0, 136, 136, 168, 216, 144, 0,
- 0, 0, 136, 80, 32, 80, 136, 0,
- 0, 0, 136, 136, 136, 112, 32, 192,
- 0, 0, 248, 144, 32, 72, 248, 0,
- 32, 80, 0, 96, 144, 144, 96, 0,
- 0, 14, 8, 48, 8, 8, 14, 0,
- 0, 8, 8, 8, 8, 8, 8, 0,
- 0, 112, 16, 12, 16, 16, 112, 0,
- 0, 0, 0, 0, 0, 0, 248, 0,
- 252, 252, 252, 252, 252, 252, 252, 252,
- 240, 240, 240, 240, 240, 240, 240, 240,
-};
-
-static const byte video_font[] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 32, 112, 112, 32, 32, 0, 32, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 0, 144, 0, 96, 144, 144, 104, 0,
- 0, 144, 0, 96, 144, 144, 96, 0,
- 0, 144, 0, 144, 144, 144, 96, 0,
- 0, 16, 40, 16, 42, 68, 58, 0,
- 48, 48, 96, 0, 0, 0, 0, 0,
- 0, 4, 8, 8, 8, 8, 4, 0,
- 0, 32, 16, 16, 16, 16, 32, 0,
- 0, 0, 20, 8, 62, 8, 20, 0,
- 0, 112, 136, 240, 136, 136, 240, 0,
- 0, 0, 0, 0, 0, 48, 48, 96,
- 0, 0, 0, 240, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 48, 48, 0,
- 16, 32, 0, 120, 112, 64, 56, 0,
- 112, 136, 152, 168, 200, 136, 112, 0,
- 32, 96, 32, 32, 32, 32, 112, 0,
- 112, 136, 8, 48, 64, 136, 248, 0,
- 112, 136, 8, 48, 8, 136, 112, 0,
- 16, 48, 80, 144, 248, 16, 56, 0,
- 248, 128, 240, 8, 8, 136, 112, 0,
- 48, 64, 128, 240, 136, 136, 112, 0,
- 248, 136, 8, 16, 32, 32, 32, 0,
- 112, 136, 136, 112, 136, 136, 112, 0,
- 112, 136, 136, 120, 8, 16, 96, 0,
- 0, 0, 48, 48, 0, 48, 48, 0,
- 32, 16, 0, 112, 8, 248, 120, 0,
- 32, 80, 0, 144, 144, 144, 104, 0,
- 80, 0, 144, 144, 144, 144, 104, 0,
- 32, 80, 0, 112, 248, 128, 112, 0,
- 112, 136, 8, 16, 32, 0, 32, 0,
- 32, 80, 0, 192, 64, 64, 224, 0,
- 112, 136, 136, 248, 136, 136, 136, 0,
- 240, 72, 72, 112, 72, 72, 240, 0,
- 48, 72, 128, 128, 128, 72, 48, 0,
- 224, 80, 72, 72, 72, 80, 224, 0,
- 248, 72, 64, 112, 64, 72, 248, 0,
- 248, 72, 64, 112, 64, 64, 224, 0,
- 48, 72, 128, 152, 136, 72, 56, 0,
- 136, 136, 136, 248, 136, 136, 136, 0,
- 248, 32, 32, 32, 32, 32, 248, 0,
- 24, 8, 8, 8, 136, 136, 112, 0,
- 200, 72, 80, 96, 80, 72, 200, 0,
- 224, 64, 64, 64, 64, 72, 248, 0,
- 136, 216, 168, 168, 136, 136, 136, 0,
- 136, 200, 168, 152, 136, 136, 136, 0,
- 112, 136, 136, 136, 136, 136, 112, 0,
- 240, 72, 72, 112, 64, 64, 224, 0,
- 112, 136, 136, 136, 136, 168, 112, 8,
- 240, 72, 72, 112, 72, 72, 200, 0,
- 112, 136, 128, 112, 8, 136, 112, 0,
- 248, 168, 32, 32, 32, 32, 112, 0,
- 136, 136, 136, 136, 136, 136, 120, 0,
- 136, 136, 136, 80, 80, 32, 32, 0,
- 136, 136, 136, 136, 168, 216, 136, 0,
- 136, 136, 80, 32, 80, 136, 136, 0,
- 136, 136, 136, 112, 32, 32, 112, 0,
- 248, 136, 16, 32, 64, 136, 248, 0,
- 0, 14, 8, 8, 8, 8, 14, 0,
- 0, 128, 64, 32, 16, 8, 4, 0,
- 0, 112, 16, 16, 16, 16, 112, 0,
- 0, 48, 72, 64, 72, 48, 16, 48,
- 0, 80, 0, 96, 32, 40, 48, 0,
- 32, 16, 0, 152, 144, 144, 232, 0,
- 0, 0, 112, 8, 120, 136, 120, 0,
- 192, 64, 80, 104, 72, 72, 112, 0,
- 0, 0, 112, 136, 128, 136, 112, 0,
- 24, 16, 80, 176, 144, 144, 112, 0,
- 0, 0, 112, 136, 248, 128, 112, 0,
- 48, 72, 64, 224, 64, 64, 224, 0,
- 0, 0, 104, 144, 144, 112, 136, 112,
- 192, 64, 80, 104, 72, 72, 200, 0,
- 64, 0, 192, 64, 64, 64, 224, 0,
- 8, 0, 8, 8, 8, 8, 136, 112,
- 192, 64, 72, 80, 96, 80, 200, 0,
- 192, 64, 64, 64, 64, 64, 224, 0,
- 0, 0, 144, 216, 168, 136, 136, 0,
- 0, 0, 240, 136, 136, 136, 136, 0,
- 0, 0, 112, 136, 136, 136, 112, 0,
- 0, 0, 176, 72, 72, 112, 64, 224,
- 0, 0, 104, 144, 144, 112, 16, 56,
- 0, 0, 176, 72, 72, 64, 224, 0,
- 0, 0, 120, 128, 112, 8, 240, 0,
- 64, 64, 240, 64, 64, 72, 48, 0,
- 0, 0, 144, 144, 144, 144, 104, 0,
- 0, 0, 136, 136, 136, 80, 32, 0,
- 0, 0, 136, 136, 168, 216, 144, 0,
- 0, 0, 136, 80, 32, 80, 136, 0,
- 0, 0, 136, 136, 136, 112, 32, 192,
- 0, 0, 248, 144, 32, 72, 248, 0,
- 32, 80, 0, 96, 144, 144, 96, 0,
- 0, 14, 8, 48, 8, 8, 14, 0,
- 0, 8, 8, 8, 8, 8, 8, 0,
- 0, 112, 16, 12, 16, 16, 112, 0,
- 0, 0, 0, 0, 0, 0, 248, 0,
- 252, 252, 252, 252, 252, 252, 252, 252,
- 240, 240, 240, 240, 240, 240, 240, 240,
-};
-#endif
-
-void SimonEngine::video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y, byte chr) {
- const byte *src;
- byte color, *dst;
- uint h, i;
-
- _lockWord |= 0x8000;
-
- dst = dx_lock_2();
- dst += y * _dxSurfacePitch + x * 8 + fcs->textColumnOffset;
-
- switch(_language) {
- case Common::RU_RUS:
- src = russian_video_font + (chr - 0x20) * 8;
- break;
- case Common::PL_POL:
- src = polish_video_font + (chr - 0x20) * 8;
- break;
- case Common::HB_ISR:
- src = hebrew_video_font + (chr - 0x20) * 8;
- break;
- case Common::ES_ESP:
- src = spanish_video_font + (chr - 0x20) * 8;
- break;
- case Common::IT_ITA:
- src = italian_video_font + (chr - 0x20) * 8;
- break;
- case Common::FR_FRA:
- src = french_video_font + (chr - 0x20) * 8;
- break;
- case Common::DE_DEU:
- src = german_video_font + (chr - 0x20) * 8;
- break;
- case Common::EN_USA:
- src = video_font + (chr - 0x20) * 8;
- break;
- default:
- error("video_putchar_drawchar: Unknown language %d\n", _language);
- }
-
- color = fcs->text_color;
-
- h = 8;
- do {
- int8 b = *src++;
- i = 0;
- do {
- if (b < 0)
- dst[i] = color;
- b <<= 1;
- } while (++i != 6);
- dst += _dxSurfacePitch;
- } while (--h);
-
- dx_unlock_2();
-
- _lockWord &= ~0x8000;
-}
-
-} // End of namespace Simon
-
-#ifdef PALMOS_68K
-#include "scumm_globals.h"
-
-_GINIT(Simon_Charset)
-_GSETPTR(Simon::russian_video_font, GBVARS_RUSSIANVIDEOFONT_INDEX, byte, GBVARS_SIMON)
-//_GSETPTR(Simon::polish_video_font, GBVARS_POLISHVIDEOFONT_INDEX, byte, GBVARS_SIMON)
-_GSETPTR(Simon::french_video_font, GBVARS_FRENCHVIDEOFONT_INDEX, byte, GBVARS_SIMON)
-_GSETPTR(Simon::german_video_font, GBVARS_GERMANVIDEOFONT_INDEX, byte, GBVARS_SIMON)
-_GSETPTR(Simon::hebrew_video_font, GBVARS_HEBREWVIDEOFONT_INDEX, byte, GBVARS_SIMON)
-_GSETPTR(Simon::italian_video_font, GBVARS_ITALIANVIDEOFONT_INDEX, byte, GBVARS_SIMON)
-_GSETPTR(Simon::spanish_video_font, GBVARS_SPANISHVIDEOFONT_INDEX, byte, GBVARS_SIMON)
-_GSETPTR(Simon::video_font, GBVARS_VIDEOFONT_INDEX, byte, GBVARS_SIMON)
-_GEND
-
-_GRELEASE(Simon_Charset)
-_GRELEASEPTR(GBVARS_RUSSIANVIDEOFONT_INDEX, GBVARS_SIMON)
-//_GRELEASEPTR(GBVARS_POLISHVIDEOFONT_INDEX, GBVARS_SIMON)
-_GRELEASEPTR(GBVARS_FRENCHVIDEOFONT_INDEX, GBVARS_SIMON)
-_GRELEASEPTR(GBVARS_GERMANVIDEOFONT_INDEX, GBVARS_SIMON)
-_GRELEASEPTR(GBVARS_HEBREWVIDEOFONT_INDEX, GBVARS_SIMON)
-_GRELEASEPTR(GBVARS_ITALIANVIDEOFONT_INDEX, GBVARS_SIMON)
-_GRELEASEPTR(GBVARS_SPANISHVIDEOFONT_INDEX, GBVARS_SIMON)
-_GRELEASEPTR(GBVARS_VIDEOFONT_INDEX, GBVARS_SIMON)
-_GEND
-
-#endif
diff --git a/simon/cursor.cpp b/simon/cursor.cpp
deleted file mode 100644
index 248039d05d..0000000000
--- a/simon/cursor.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/stdafx.h"
-
-#include "simon/simon.h"
-#include "simon/intern.h"
-#include "common/system.h"
-
-namespace Simon {
-
-#ifdef PALMOS_68K
-static const byte *_simon1_cursor;
-#else
-static const byte _simon1_cursor[256] = {
- 0xe1,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xe1,0xe1,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xe1,0xe1,0xe1,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xe1,0xe1,0xe1,0xe1,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xe1,0xe1,0xe1,0xe1,0xe1,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xe1,0xe1,0xe1,0xe1,0xe0,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xe1,0xff,0xff,0xe1,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xe1,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xe1,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xe1,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-};
-#endif
-static const byte _simon2_cursors[10][256] = {
- // cross hair
- { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xec,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xec,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xec,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xec,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xec,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xec,0xec,0xec,0xec,0xec,0xef,0xff,0xea,0xff,0xef,0xec,0xec,0xec,0xec,0xec,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xec,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xec,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xec,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xec,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xec,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff },
- // examine
- { 0xff,0xff,0xef,0xef,0xef,0xef,0xef,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xef,0xee,0xeb,0xe4,0xe4,0xe4,0xee,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xef,0xee,0xeb,0xee,0xef,0xef,0xee,0xec,0xee,0xef,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xef,0xeb,0xee,0xef,0xee,0xee,0xef,0xee,0xe4,0xef,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xef,0xeb,0xef,0xef,0xef,0xec,0xee,0xef,0xe4,0xef,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xef,0xeb,0xef,0xef,0xee,0xef,0xef,0xef,0xe4,0xef,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xef,0xeb,0xee,0xef,0xef,0xef,0xef,0xee,0xe4,0xef,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xef,0xee,0xeb,0xee,0xef,0xef,0xee,0xe4,0xee,0xef,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xef,0xee,0xeb,0xeb,0xeb,0xeb,0xee,0xe4,0xec,0xef,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xef,0xef,0xef,0xef,0xef,0xef,0xeb,0xe4,0xee,0xef,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xee,0xe4,0xeb,0xef,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xeb,0xe4,0xeb,0xef,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xeb,0xec,0xeb,0xef,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xeb,0xe4,0xef,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xef,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff },
- // pick up
- { 0xff,0xff,0xff,0xff,0xff,0xe5,0xe5,0xe5,0xe5,0xe5,0xe5,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xe5,0xe6,0xe6,0xe7,0xe7,0xe6,0xe6,0xe5,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xe5,0xe7,0xe7,0xe7,0xe7,0xe8,0xe8,0xe8,0xe8,0xe5,0xff,0xff,0xff,
- 0xff,0xff,0xe5,0xe6,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe8,0xe9,0xe7,0xe5,0xff,0xff,
- 0xff,0xe5,0xe6,0xe7,0xe6,0xe5,0xff,0xff,0xff,0xff,0xe5,0xe6,0xe8,0xe6,0xe5,0xff,
- 0xff,0xe5,0xe7,0xe7,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xe5,0xe8,0xe7,0xe5,0xff,
- 0xff,0xe5,0xe7,0xe7,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xe5,0xe7,0xe7,0xe5,0xff,
- 0xff,0xef,0xeb,0xeb,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xeb,0xeb,0xef,0xff,
- 0xff,0xef,0xee,0xeb,0xee,0xef,0xff,0xff,0xff,0xff,0xef,0xee,0xeb,0xee,0xef,0xff,
- 0xff,0xff,0xef,0xeb,0xeb,0xef,0xff,0xff,0xff,0xff,0xef,0xeb,0xeb,0xef,0xff,0xff,
- 0xff,0xff,0xef,0xee,0xe4,0xee,0xef,0xff,0xff,0xef,0xee,0xe4,0xee,0xef,0xff,0xff,
- 0xff,0xff,0xff,0xef,0xe4,0xeb,0xef,0xff,0xff,0xef,0xeb,0xe4,0xef,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xeb,0xeb,0xeb,0xef,0xef,0xeb,0xeb,0xeb,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xef,0xee,0xee,0xee,0xee,0xe1,0xe1,0xef,0xff,0xff,0xff,0xe4,
- 0xef,0xee,0xeb,0xeb,0xeb,0xeb,0xeb,0xe4,0xe4,0xe4,0xe4,0xe4,0xe4,0xe4,0xeb,0xec,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe4 },
- // give
- { 0xff,0xff,0xff,0xff,0xff,0xe5,0xe7,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xe5,0xe7,0xe8,0xe7,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xe9,0xe7,0xe8,0xe8,0xe8,0xe7,0xe9,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xe5,0xe7,0xea,0xe8,0xe8,0xe8,0xea,0xe7,0xe5,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xe5,0xe7,0xe8,0xe8,0xea,0xe9,0xea,0xe8,0xe8,0xe7,0xe5,0xff,0xff,0xff,0xff,
- 0xe5,0xe7,0xe9,0xe8,0xe8,0xe9,0xec,0xe9,0xe8,0xe8,0xe8,0xe7,0xe5,0xff,0xff,0xff,
- 0xe5,0xe7,0xe7,0xe9,0xe8,0xec,0xe9,0xec,0xe8,0xe9,0xe7,0xe6,0xe5,0xff,0xff,0xff,
- 0xe5,0xe7,0xe7,0xe8,0xec,0xe9,0xe9,0xe9,0xec,0xe7,0xe6,0xe6,0xe5,0xff,0xff,0xff,
- 0xe5,0xe7,0xe7,0xea,0xe8,0xe9,0xe9,0xe9,0xe7,0xec,0xec,0xe4,0xe5,0xff,0xff,0xff,
- 0xe5,0xe7,0xe7,0xe9,0xe7,0xe8,0xe9,0xe7,0xe6,0xec,0xe4,0xec,0xe4,0xef,0xff,0xff,
- 0xe5,0xe6,0xe7,0xe9,0xe7,0xe7,0xe8,0xe6,0xe6,0xe4,0xec,0xe4,0xec,0xe4,0xef,0xff,
- 0xff,0xe5,0xe6,0xe9,0xe7,0xe7,0xe8,0xe6,0xe6,0xe8,0xe4,0xec,0xe4,0xec,0xeb,0xff,
- 0xff,0xff,0xe5,0xe9,0xe7,0xe7,0xe8,0xe6,0xe6,0xe8,0xe6,0xe4,0xec,0xeb,0xef,0xff,
- 0xff,0xff,0xff,0xe8,0xe7,0xe7,0xe8,0xe6,0xe6,0xe7,0xff,0xef,0xeb,0xef,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xe5,0xe7,0xe8,0xe6,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xe5,0xe6,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff },
- // talk
- { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xe5,0xe5,0xe5,0xe5,0xe5,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xe5,0xe7,0xe8,0xe8,0xe8,0xe7,0xe6,0xe5,0xe5,0xe5,0xff,0xff,0xff,0xff,
- 0xff,0xe5,0xe6,0xe9,0xea,0xe6,0xea,0xe9,0xe8,0xe9,0xe8,0xe7,0xe5,0xff,0xff,0xff,
- 0xff,0xe5,0xe7,0xe5,0xef,0xe5,0xec,0xea,0xe5,0xea,0xec,0xe5,0xe9,0xe6,0xff,0xff,
- 0xff,0xe5,0xe6,0xe5,0xef,0xef,0xef,0xe5,0xef,0xef,0xe5,0xef,0xef,0xe8,0xe5,0xff,
- 0xff,0xe5,0xe9,0xea,0xe5,0xe8,0xe7,0xe6,0xe6,0xe8,0xe7,0xe5,0xec,0xe9,0xe5,0xff,
- 0xff,0xe5,0xe9,0xe8,0xe5,0xe7,0xe8,0xe8,0xe9,0xe9,0xe8,0xe5,0xe9,0xe9,0xe5,0xff,
- 0xff,0xe5,0xe6,0xec,0xea,0xe5,0xe6,0xe6,0xe7,0xe7,0xe6,0xe5,0xec,0xe8,0xe5,0xff,
- 0xff,0xff,0xe5,0xe9,0xe8,0xe9,0xe5,0xe8,0xe5,0xe8,0xe5,0xe9,0xe9,0xe7,0xe5,0xff,
- 0xff,0xff,0xe5,0xe7,0xe9,0xec,0xe8,0xec,0xe8,0xec,0xe8,0xec,0xe8,0xe5,0xff,0xff,
- 0xff,0xff,0xff,0xe5,0xe6,0xe8,0xe9,0xe9,0xe9,0xe9,0xe9,0xe8,0xe5,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xe5,0xe5,0xe5,0xe5,0xe5,0xe5,0xe5,0xe5,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff },
- // use
- { 0xff,0xff,0xff,0xff,0xff,0xee,0xe1,0xeb,0xee,0xef,0xef,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xef,0xef,0xef,0xe4,0xeb,0xee,0xe5,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xeb,0xe4,0xe4,0xeb,0xe5,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xeb,0xe4,0xec,0xe4,0xef,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xeb,0xeb,0xe4,0xe4,0xee,0xef,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xee,0xeb,0xeb,0xeb,0xe1,0xef,0xee,0xef,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe5,0xe6,0xef,0xef,0xee,0xeb,0xeb,0xe4,0xee,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xe5,0xe6,0xff,0xff,0xff,0xef,0xeb,0xec,0xeb,0xef,
- 0xff,0xff,0xff,0xff,0xff,0xe5,0xe6,0xe5,0xff,0xff,0xff,0xee,0xe4,0xeb,0xef,0xff,
- 0xff,0xff,0xff,0xe5,0xe5,0xe6,0xe5,0xff,0xff,0xff,0xff,0xef,0xee,0xef,0xff,0xff,
- 0xff,0xff,0xe5,0xe6,0xe8,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xff,0xff,0xff,
- 0xff,0xe5,0xe6,0xe8,0xe6,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xe5,0xe6,0xe8,0xe6,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xe5,0xe6,0xe6,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xe5,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff },
- // wear
- { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xef,0xeb,0xed,0xe4,0xe2,0xeb,0xee,0xee,0xee,0xef,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xef,0xe2,0xec,0xe2,0xe1,0xee,0xef,0xef,0xee,0xef,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xef,0xeb,0xed,0xeb,0xee,0xef,0xef,0xef,0xee,0xef,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xef,0xee,0xe4,0xeb,0xee,0xef,0xef,0xee,0xef,0xef,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xef,0xe4,0xeb,0xee,0xef,0xef,0xee,0xef,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xef,0xe2,0xeb,0xee,0xef,0xef,0xee,0xef,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xef,0xeb,0xe1,0xee,0xef,0xef,0xee,0xef,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xef,0xeb,0xe1,0xee,0xef,0xef,0xef,0xef,0xff,0xff,0xff,0xff,
- 0xff,0xef,0xef,0xef,0xe1,0xe4,0xe4,0xe4,0xe1,0xeb,0xee,0xef,0xef,0xef,0xff,0xff,
- 0xef,0xee,0xee,0xef,0xee,0xee,0xee,0xee,0xee,0xef,0xef,0xef,0xee,0xee,0xef,0xff,
- 0xff,0xef,0xef,0xee,0xe1,0xe2,0xe4,0xe4,0xe4,0xeb,0xe1,0xee,0xef,0xef,0xff,0xff,
- 0xff,0xff,0xff,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff },
- // move
- { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xff,
- 0xff,0xe1,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe1,0xff,
- 0xff,0xe1,0xe3,0xe3,0xe3,0xed,0xe3,0xe3,0xe3,0xe3,0xed,0xe3,0xe3,0xe3,0xe1,0xff,
- 0xff,0xe1,0xe3,0xe3,0xed,0xec,0xe3,0xe3,0xe3,0xe3,0xec,0xed,0xe3,0xe3,0xe1,0xff,
- 0xff,0xe1,0xe3,0xed,0xec,0xec,0xec,0xec,0xec,0xec,0xec,0xec,0xed,0xe3,0xe1,0xff,
- 0xff,0xe1,0xed,0xec,0xec,0xec,0xec,0xec,0xec,0xec,0xec,0xec,0xec,0xed,0xe1,0xff,
- 0xff,0xe1,0xe3,0xed,0xec,0xec,0xec,0xec,0xec,0xec,0xec,0xec,0xed,0xe3,0xe1,0xff,
- 0xff,0xe1,0xe3,0xe3,0xed,0xec,0xe3,0xe3,0xe3,0xe3,0xec,0xed,0xe3,0xe3,0xe1,0xff,
- 0xff,0xe1,0xe3,0xe3,0xe3,0xed,0xe3,0xe3,0xe3,0xe3,0xed,0xe3,0xe3,0xe3,0xe1,0xff,
- 0xff,0xe1,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe1,0xff,
- 0xff,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff },
- // open
- { 0xff,0xff,0xe5,0xe8,0xe8,0xe7,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xe5,0xe8,0xe7,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xe5,0xe7,0xe5,0xe7,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xe5,0xff,0xe5,0xe7,0xe6,0xe9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xe6,0xea,0xe6,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xe6,0xea,0xe6,0xe7,0xe5,0xff,0xe5,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xe6,0xea,0xe6,0xff,0xe5,0xe7,0xe5,0xe7,0xe5,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xe6,0xea,0xe6,0xff,0xff,0xff,0xe5,0xe7,0xe8,0xe5,0xff,0xff,0xff,
- 0xff,0xe5,0xe6,0xea,0xe6,0xff,0xff,0xff,0xe5,0xe7,0xe8,0xe8,0xe5,0xff,0xff,0xff,
- 0xff,0xe5,0xe9,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xe5,0xff,0xff,0xff,0xff,
- 0xff,0xe5,0xe9,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xea,0xe5,0xff,0xff,0xff,0xff,
- 0xff,0xe5,0xe9,0xe5,0xe5,0xe5,0xe5,0xe5,0xe5,0xe5,0xe9,0xe5,0xff,0xff,0xff,0xff,
- 0xff,0xe5,0xe9,0xe8,0xe8,0xe8,0xe8,0xe8,0xe7,0xe7,0xe9,0xe5,0xff,0xff,0xff,0xff,
- 0xff,0xe5,0xe9,0xe6,0xe6,0xe6,0xe6,0xe6,0xe6,0xe5,0xe9,0xe5,0xff,0xff,0xff,0xff,
- 0xff,0xe5,0xe9,0xe8,0xe8,0xe8,0xe8,0xe8,0xe8,0xe7,0xe9,0xe5,0xff,0xff,0xff,0xff,
- 0xff,0xe5,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xe5,0xff,0xff,0xff,0xff },
- // question mark
- { 0xff,0xff,0xff,0xff,0xff,0xe5,0xe5,0xe5,0xe5,0xe5,0xe5,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xe5,0xe7,0xea,0xec,0xec,0xec,0xe9,0xe5,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xe5,0xe7,0xea,0xec,0xea,0xe9,0xea,0xec,0xe9,0xe5,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xe5,0xe9,0xec,0xe9,0xe8,0xe7,0xe8,0xea,0xec,0xe5,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xe5,0xe8,0xe9,0xe8,0xe5,0xe5,0xe8,0xe9,0xec,0xe5,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xe5,0xe5,0xe5,0xe5,0xe8,0xe9,0xec,0xe9,0xe5,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xe5,0xe9,0xec,0xec,0xe9,0xe5,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xe5,0xe8,0xec,0xea,0xe8,0xe5,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xe5,0xe9,0xec,0xe9,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xe5,0xe9,0xea,0xe9,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xe5,0xe7,0xe9,0xe7,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xe5,0xe5,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xe5,0xe8,0xe9,0xe8,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xe5,0xe9,0xec,0xe9,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xe5,0xe8,0xe9,0xe8,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xe5,0xe5,0xe5,0xff,0xff,0xff,0xff,0xff,0xff,0xff },
-};
-
-void SimonEngine::drawMousePointer() {
- if (getGameType() == GType_SIMON2)
- _system->setMouseCursor(_simon2_cursors[_mouseCursor], 16, 16, 7, 7);
- else
- _system->setMouseCursor(_simon1_cursor, 16, 16, 0, 0);
-}
-
-} // End of namespace Simon
-
-#ifdef PALMOS_68K
-#include "scumm_globals.h"
-
-_GINIT(Simon_Cursor)
-_GSETPTR(Simon::_simon1_cursor, GBVARS_SIMON1CURSOR_INDEX, byte, GBVARS_SIMON)
-_GEND
-
-_GRELEASE(Simon_Cursor)
-_GRELEASEPTR(GBVARS_SIMON1CURSOR_INDEX, GBVARS_SIMON)
-_GEND
-
-#endif
diff --git a/simon/debug.cpp b/simon/debug.cpp
deleted file mode 100644
index 39e462782f..0000000000
--- a/simon/debug.cpp
+++ /dev/null
@@ -1,462 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-// Simon debug functions
-#include "common/stdafx.h"
-#include "simon/simon.h"
-#include "simon/intern.h"
-#include "simon/debug.h"
-#include "simon/vga.h"
-
-#include <sys/stat.h>
-
-namespace Simon {
-
-const byte *SimonEngine::dumpOpcode(const byte *p) {
- byte opcode;
- const char *s, *st;
-
- opcode = *p++;
- if (opcode == 255)
- return NULL;
- if (getGameType() == GType_FF) {
- st = s = feeblefiles_opcode_name_table[opcode];
- } else if (getGameType() == GType_SIMON2 && getFeatures() & GF_TALKIE) {
- st = s = simon2talkie_opcode_name_table[opcode];
- } else if (getFeatures() & GF_TALKIE) {
- st = s = simon1talkie_opcode_name_table[opcode];
- } else if (getGameType() == GType_SIMON2) {
- st = s = simon2dos_opcode_name_table[opcode];
- } else {
- st = s = simon1dos_opcode_name_table[opcode];
- }
- if (s == NULL) {
- //error("INVALID OPCODE %d", opcode);
- return NULL;
- }
- while (*st != '|')
- st++;
- fprintf(_dumpFile, "%s ", st + 1);
-
- for (;;) {
- switch (*s++) {
- case 'x':
- fprintf(_dumpFile, "\n");
- return NULL;
- case '|':
- fprintf(_dumpFile, "\n");
- return p;
- case 'B':{
- byte b = *p++;
- if (b == 255)
- fprintf(_dumpFile, "[%d] ", *p++);
- else
- fprintf(_dumpFile, "%d ", b);
- break;
- }
- case 'V':{
- byte b = *p++;
- if (b == 255)
- fprintf(_dumpFile, "[[%d]] ", *p++);
- else
- fprintf(_dumpFile, "[%d] ", b);
- break;
- }
-
- case 'W':{
- int n = (int16)((p[0] << 8) | p[1]);
- p += 2;
- if (n >= 30000 && n < 30512)
- fprintf(_dumpFile, "[%d] ", n - 30000);
- else
- fprintf(_dumpFile, "%d ", n);
- break;
- }
-
- case 'w':{
- int n = (int16)((p[0] << 8) | p[1]);
- p += 2;
- fprintf(_dumpFile, "%d ", n);
- break;
- }
-
- case 'I':{
- int n = (int16)((p[0] << 8) | p[1]);;
- p += 2;
- if (n == -1)
- fprintf(_dumpFile, "ITEM_M1 ");
- else if (n == -3)
- fprintf(_dumpFile, "ITEM_M3 ");
- else if (n == -5)
- fprintf(_dumpFile, "ITEM_1 ");
- else if (n == -7)
- fprintf(_dumpFile, "ITEM_0 ");
- else if (n == -9)
- fprintf(_dumpFile, "ITEM_A_PARENT ");
- else
- fprintf(_dumpFile, "<%d> ", n);
- break;
- }
-
- case 'J':{
- fprintf(_dumpFile, "-> ");
- }
- break;
-
- case 'T':{
- uint n = ((p[0] << 8) | p[1]);
- p += 2;
- if (n != 0xFFFF)
- fprintf(_dumpFile, "\"%s\"(%d) ", getStringPtrByID(n), n);
- else
- fprintf(_dumpFile, "NULL_STRING ");
- }
- break;
- }
- }
-}
-
-void SimonEngine::dumpSubroutineLine(SubroutineLine *sl, Subroutine *sub) {
- const byte *p;
-
- printf("; ****\n");
-
- p = (byte *)sl + SUBROUTINE_LINE_SMALL_SIZE;
- if (sub->id == 0) {
- fprintf(_dumpFile, "; verb=%d, noun1=%d, noun2=%d\n", sl->verb, sl->noun1, sl->noun2);
- p = (byte *)sl + SUBROUTINE_LINE_BIG_SIZE;
- }
-
- for (;;) {
- p = dumpOpcode(p);
- if (p == NULL)
- break;
- }
-}
-
-void SimonEngine::dumpSubroutine(Subroutine *sub) {
- SubroutineLine *sl;
-
- fprintf(_dumpFile, "\n******************************************\n;Subroutine, ID=%d:\nSUB_%d:\n", sub->id, sub->id);
- sl = (SubroutineLine *)((byte *)sub + sub->first);
- for (; (byte *)sl != (byte *)sub; sl = (SubroutineLine *)((byte *)sub + sl->next)) {
- dumpSubroutineLine(sl, sub);
- }
- fprintf(_dumpFile, "\nEND ******************************************\n");
- fflush(_dumpFile);
-}
-
-void SimonEngine::dumpSubroutines() {
- Subroutine *sub = _subroutineList;
- for (; sub; sub = sub->next) {
- dumpSubroutine(sub);
- }
-}
-
-void SimonEngine::dump_video_script(const byte *src, bool one_opcode_only) {
- uint opcode;
- const char *str, *strn;
-
- do {
- if (getGameType() == GType_SIMON1) {
- opcode = READ_BE_UINT16(src);
- src += 2;
- } else {
- opcode = *src++;
- }
-
- if (opcode >= NUM_VIDEO_OP_CODES) {
- error("Invalid opcode %x\n", opcode);
- return;
- }
-
- if (getGameType() == GType_FF) {
- strn = str = feeblefiles_video_opcode_name_table[opcode];
- } else if (getGameType() == GType_SIMON2) {
- strn = str = simon2_video_opcode_name_table[opcode];
- } else {
- strn = str = simon1_video_opcode_name_table[opcode];
- }
-
- while (*strn != '|')
- strn++;
- fprintf(_dumpFile, "%.2d: %s ", opcode, strn + 1);
-
- int end = (getGameType() == GType_FF) ? 9999 : 999;
- for (; *str != '|'; str++) {
- switch (*str) {
- case 'x':
- fprintf(_dumpFile, "\n");
- return;
- case 'b':
- fprintf(_dumpFile, "%d ", *src++);
- break;
- case 'd': {
- int16 tmp = (int16)readUint16Wrapper(src);
- if (tmp < 0) tmp = vcReadVar(-tmp);
- fprintf(_dumpFile, "%d ", tmp);
- src += 2;
- break;
- }
- case 'v':
- fprintf(_dumpFile, "[%d] ", readUint16Wrapper(src));
- src += 2;
- break;
- case 'i':
- fprintf(_dumpFile, "%d ", (int16)readUint16Wrapper(src));
- src += 2;
- break;
- case 'q':
- while (readUint16Wrapper(src) != end) {
- fprintf(_dumpFile, "(%d,%d) ", readUint16Wrapper(src),
- readUint16Wrapper(src + 2));
- src += 4;
- }
- src++;
- break;
- default:
- error("Invalid fmt string '%c' in decompile VGA", *str);
- }
- }
-
- fprintf(_dumpFile, "\n");
- } while (!one_opcode_only);
-}
-
-void SimonEngine::dump_vga_file(const byte *vga) {
- {
- const byte *pp;
- const byte *p;
- int count;
-
- pp = vga;
- p = pp + READ_BE_UINT16(&((const VgaFileHeader_Simon *) pp)->hdr2_start);
- count = READ_BE_UINT16(&((const VgaFileHeader2_Simon *) p)->animationCount);
- p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Simon *) p)->animationTable);
- while (--count >= 0) {
- int id = READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->id);
-
- dump_vga_script_always(vga + READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->scriptOffs), id / 100, id);
- p += sizeof(AnimationHeader_Simon);
- }
- }
-
- {
- const byte *bb, *b;
- int c;
-
- bb = vga;
- b = bb + READ_BE_UINT16(&((const VgaFileHeader_Simon *) bb)->hdr2_start);
- c = READ_BE_UINT16(&((const VgaFileHeader2_Simon *) b)->imageCount);
- b = bb + READ_BE_UINT16(&((const VgaFileHeader2_Simon *) b)->imageTable);
-
- while (--c >= 0) {
- int id = READ_BE_UINT16(&((const ImageHeader_Simon *) b)->id);
-
- dump_vga_script_always(vga + READ_BE_UINT16(&((const ImageHeader_Simon *) b)->scriptOffs), id / 100, id);
- b += sizeof(ImageHeader_Simon);
- }
- }
-}
-
-static const byte bmp_hdr[] = {
- 0x42, 0x4D,
- 0x9E, 0x14, 0x00, 0x00, /* offset 2, file size */
- 0x00, 0x00, 0x00, 0x00,
- 0x36, 0x04, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00,
-
- 0x3C, 0x00, 0x00, 0x00, /* image width */
- 0x46, 0x00, 0x00, 0x00, /* image height */
- 0x01, 0x00, 0x08, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-
- 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00,
-};
-
-void dump_bmp(const char *filename, int w, int h, const byte *bytes, const uint32 *palette) {
- FILE *out = fopen(filename, "wb");
- byte my_hdr[sizeof(bmp_hdr)];
- int i;
-
- if (out == NULL) {
- printf("DUMP ERROR\n");
- return;
- }
-
- memcpy(my_hdr, bmp_hdr, sizeof(bmp_hdr));
-
- *(uint32 *)(my_hdr + 2) = w * h + 1024 + sizeof(bmp_hdr);
- *(uint32 *)(my_hdr + 18) = w;
- *(uint32 *)(my_hdr + 22) = h;
-
-
- fwrite(my_hdr, 1, sizeof(my_hdr), out);
-
- for (i = 0; i != 256; i++, palette++) {
- byte color[4];
- color[0] = (byte)(*palette >> 16);
- color[1] = (byte)(*palette >> 8);
- color[2] = (byte)(*palette);
- color[3] = 0;
- fwrite(color, 1, 4, out);
- }
-
- while (--h >= 0) {
- fwrite(bytes + h * ((w + 3) & ~3), ((w + 3) & ~3), 1, out);
- }
-
- fclose(out);
-}
-
-static void dump_bitmap(const char *filename, const byte *offs, int w, int h, int flags, const byte *palette,
- byte base)
-{
- /* allocate */
- byte *b = (byte *)malloc(w * h);
- int i, j;
-
- VC10_state state;
-
- state.depack_cont = -0x80;
- state.depack_src = offs;
- state.dh = h;
- state.y_skip = 0;
-
- for (i = 0; i != w; i += 2) {
- byte *c = vc10_depack_column(&state);
- for (j = 0; j != h; j++) {
- byte pix = c[j];
- b[j * w + i] = (pix >> 4) | base;
- b[j * w + i + 1] = (pix & 0xF) | base;
-
- }
- }
-
- dump_bmp(filename, w, h, b, (const uint32 *)palette);
- free(b);
-}
-
-void SimonEngine::dump_single_bitmap(int file, int image, const byte *offs, int w, int h, byte base) {
- char buf[40];
-#if !defined(PALMOS_MODE) && !defined(__DC__) && !defined(__PSP__) && !defined(__PLAYSTATION2__)
- struct stat statbuf;
-#endif
-
-#if defined(MACOS_CARBON)
- sprintf(buf, ":dumps:File%d_Image%d.bmp", file, image);
-#else
- sprintf(buf, "dumps/File%d_Image%d.bmp", file, image);
-#endif
-
-#if !defined(PALMOS_MODE) && !defined(__DC__) && !defined(__PSP__) && !defined(__PLAYSTATION2__)
- if (stat(buf, &statbuf) == 0)
- return;
-#endif
-
- dump_bitmap(buf, offs, w, h, 0, _palette, base);
-}
-
-void pal_load(byte *pal, const byte *vga1, int a, int b) {
- uint num = (a == 0) ? 0x20 : 0x10;
- byte *palptr;
- const byte *src;
-
- palptr = (byte *)&pal[a << 4];
- src = vga1 + 6 + b * 96;
-
- do {
- palptr[0] = src[0] << 2;
- palptr[1] = src[1] << 2;
- palptr[2] = src[2] << 2;
- palptr[3] = 0;
-
- palptr += 4;
- src += 3;
- } while (--num);
-}
-
-void SimonEngine::dump_vga_bitmaps(const byte *vga, byte *vga1, int res) {
-
- int i;
- uint32 offs;
- const byte *p2;
- byte pal[768];
-
- {
- memset(pal, 0, sizeof(pal));
- pal_load(pal, vga1, 2, 0);
- pal_load(pal, vga1, 3, 1);
- pal_load(pal, vga1, 4, 2);
- pal_load(pal, vga1, 5, 3);
- }
-
- int width, height, flags;
-
- i = 538;
-
- for (i = 1; ; i++) {
- p2 = vga + i * 8;
- offs = READ_BE_UINT32(p2);
-
- /* try to detect end of images.
- * assume the end when offset >= 200kb */
- if (offs >= 200*1024)
- return;
-
- width = READ_BE_UINT16(p2 + 6);
- height = p2[5];
- flags = p2[4];
-
- fprintf(_dumpFile, "Image %d. Width=%d, Height=%d, Flags=0x%X\n", i, width, height, flags);
- fflush(_dumpFile);
-
- /* dump bitmap */
- {
- char buf[40];
-#if defined(MACOS_CARBON)
- sprintf(buf, ":dumps:Res%d_Image%d.bmp", res, i);
-#else
- sprintf(buf, "dumps/Res%d_Image%d.bmp", res, i);
-#endif
-
- dump_bitmap(buf, vga + offs, width, height, flags, pal, 0);
- }
- }
-}
-
-void SimonEngine::dump_vga_script_always(const byte *ptr, uint res, uint sprite_id) {
- fprintf(_dumpFile, "; address=%x, vgafile=%d vgasprite=%d\n",
- ptr - _vgaBufferPointers[res].vgaFile1, res, sprite_id);
- dump_video_script(ptr, false);
- fprintf(_dumpFile, "; end\n");
-}
-
-void SimonEngine::dump_vga_script(const byte *ptr, uint res, uint sprite_id) {
- dump_vga_script_always(ptr, res, sprite_id);
-}
-
-} // End of namespace Simon
diff --git a/simon/debug.h b/simon/debug.h
deleted file mode 100644
index 5b7bf45eeb..0000000000
--- a/simon/debug.h
+++ /dev/null
@@ -1,1530 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef SIMON_DEBUG_H
-#define SIMON_DEBUG_H
-
-namespace Simon {
-
-static const char *const simon1dos_opcode_name_table[256] = {
- /* 0 */
- "|INV_COND",
- "IJ|PTRA_PARENT_IS",
- "IJ|PTRA_PARENT_ISNOT",
- NULL,
- /* 4 */
- NULL,
- "IJ|PARENT_IS_1",
- "IJ|PARENT_ISNOT_1",
- "IIJ|PARENT_IS",
- /* 8 */
- NULL,
- NULL,
- NULL,
- "VJ|IS_ZERO",
- /* 12 */
- "VJ|ISNOT_ZERO",
- "VWJ|IS_EQ",
- "VWJ|IS_NEQ",
- "VWJ|IS_LE",
- /* 16 */
- "VWJ|IS_GE",
- "VVJ|IS_EQF",
- "VVJ|IS_NEQF",
- "VVJ|IS_LEF",
- /* 20 */
- "VVJ|IS_GEF",
- NULL,
- NULL,
- "WJ|CHANCE",
- /* 24 */
- NULL,
- "IJ|IS_ROOM",
- "IJ|IS_OBJECT",
- "IWJ|ITEM_UNK3_IS",
- /* 28 */
- "IBJ|CHILD_HAS_FLAG",
- NULL,
- NULL,
- "I|SET_NO_PARENT",
- /* 32 */
- NULL,
- "II|SET_PARENT",
- NULL,
- NULL,
- /* 36 */
- "VV|MOVE",
- NULL,
- NULL,
- NULL,
- /* 40 */
- NULL,
- "V|ZERO",
- "VW|SET",
- "VW|ADD",
- /* 44 */
- "VW|SUB",
- "VV|ADDF",
- "VV|SUBF",
- "VW|MUL",
- /* 48 */
- "VW|DIV",
- "VV|MULF",
- "VV|DIVF",
- "VW|MOD",
- /* 52 */
- "VV|MODF",
- "VW|RANDOM",
- NULL,
- "I|SET_A_PARENT",
- /* 56 */
- "IB|SET_CHILD2_BIT",
- "IB|CLEAR_CHILD2_BIT",
- "II|MAKE_SIBLING",
- "I|INC_UNK3",
- /* 60 */
- "I|DEC_UNK3",
- "IW|SET_UNK3",
- "V|SHOW_INT",
- "T|SHOW_STRING_NL",
- /* 64 */
- "T|SHOW_STRING",
- "WWWWWB|ADD_HITAREA",
- "BT|SET_ITEM_NAME",
- "BT|SET_ITEM_DESC",
- /* 68 */
- "x|HALT",
- "x|RET1",
- "V|SHOW_STRING_AR3",
- "W|START_SUB",
- /* 72 */
- NULL,
- NULL,
- NULL,
- NULL,
- /* 76 */
- "WW|ADD_TIMEOUT",
- "J|IS_M1_EMPTY",
- "J|IS_M3_EMPTY",
- "ITJ|CHILD_FR2_IS",
- /* 80 */
- "IIJ|IS_ITEM_EQ",
- NULL,
- "B|UNK_82",
- "|RETM10",
- /* 84 */
- NULL,
- NULL,
- NULL,
- "W|UNK_87",
- /* 88 */
- "|STOP_ANIMATION",
- "|RESTART_ANIMATION",
- "IB|SET_M_TO_PARENT",
- "IB|SET_M_TO_SIBLING",
- /* 92 */
- "IB|SET_M_TO_CHILD",
- NULL,
- NULL,
- NULL,
- /* 96 */
- "WB|UNK_96",
- "W|LOAD_VGA",
- "WBWWW|START_VGA",
- "W|KILL_SPRITE",
- /* 100 */
- "|VGA_RESET",
- "BWWWWWW|UNK_101",
- "B|UNK_102",
- "|UNK_103",
- /* 104 */
- "B|UNK_104",
- NULL,
- NULL,
- "WWWWWIW|ADD_ITEM_HITAREA",
- /* 108 */
- "W|DEL_HITAREA",
- "W|CLEAR_HITAREA_0x40",
- "W|SET_HITAREA_0x40",
- "WWW|SET_HITAREA_XY",
- /* 112 */
- NULL,
- NULL,
- "IB|UNK_114",
- "IBJ|HAS_FLAG",
- /* 116 */
- "IB|SET_FLAG",
- "IB|CLEAR_FLAG",
- NULL,
- "W|WAIT_VGA",
- /* 120 */
- "W|UNK_120",
- "BI|SET_VGA_ITEM",
- NULL,
- NULL,
- /* 124 */
- NULL,
- "IJ|IS_SIBLING_WITH_A",
- "IBB|UNK_126",
- "WW|PLAY_MUSIC_RESOURCE",
- /* 128 */
- "W|GET_DUMMY_WORD",
- "W|GET_WORD_COND_TRUE",
- "Bww|SET_ADJ_NOUN",
- NULL,
- /* 132 */
- "|SAVE_GAME",
- "|LOAD_GAME",
- "|DUMMYPROC_134",
- "|QUIT_IF_USER_PRESSES_Y",
- /* 136 */
- "IV|GET_ITEM_UNK3",
- "B|UNK_137",
- "|VGA_POINTER_OP_4",
- "II|SET_PARENT_SPECIAL",
- /* 140 */
- "|DEL_TE_AND_ADD_ONE",
- "BI|SET_M1_OR_M3",
- "WJ|IS_HITAREA_0x40_CLEAR",
- "I|START_ITEM_SUB",
- /* 144 */
- NULL,
- NULL,
- NULL,
- NULL,
- /* 148 */
- NULL,
- NULL,
- NULL,
- "BI|SET_ARRAY6_TO",
- /* 152 */
- "BB|SET_M1_M3_TO_ARRAY6",
- "B|SET_BIT",
- "B|CLEAR_BIT",
- "BJ|IS_BIT_CLEAR",
- /* 156 */
- "BJ|IS_BIT_SET",
- "IBB|GET_ITEM_PROP",
- "IBW|SET_ITEM_PROP",
- NULL,
- /* 160 */
- "B|UNK_160",
- "BWBW|SETUP_TEXT",
- "BBT|PRINT_STR",
- "W|SOUND_1",
- /* 164 */
- "|UNK_164",
- "IWWJ|ITEM_UNK1_UNK2_IS",
- "B|SET_BIT2",
- "B|CLEAR_BIT2",
- /* 168 */
- "BJ|IS_BIT2_CLEAR",
- "BJ|IS_BIT2_SET",
- NULL,
- NULL,
- /* 172 */
- NULL,
- NULL,
- NULL,
- "|VGA_POINTER_OP_1",
- /* 176 */
- "|VGA_POINTER_OP_2",
- "BBI|INVENTORY_DESCRIPTION",
- "WWBB|PATHFIND",
- "BBB|ROOM_DESCRIPTION",
- /* 180 */
- "|MOUSE_ON",
- "|MOUSE_OFF",
- "|LOAD_BEARD",
- "|UNLOAD_BEARD",
- /* 184 */
- "W|CLEAR_VGAPOINTER_ENTRY",
- "W|LOAD_SOUND_FILES",
- "|VGA_POINTER_OP_3",
- "|FADE_TO_BLACK",
-};
-
-static const char *const simon1talkie_opcode_name_table[256] = {
- /* 0 */
- "|INV_COND",
- "IJ|PTRA_PARENT_IS",
- "IJ|PTRA_PARENT_ISNOT",
- NULL,
- /* 4 */
- NULL,
- "IJ|PARENT_IS_1",
- "IJ|PARENT_ISNOT_1",
- "IIJ|PARENT_IS",
- /* 8 */
- NULL,
- NULL,
- NULL,
- "VJ|IS_ZERO",
- /* 12 */
- "VJ|ISNOT_ZERO",
- "VWJ|IS_EQ",
- "VWJ|IS_NEQ",
- "VWJ|IS_LE",
- /* 16 */
- "VWJ|IS_GE",
- "VVJ|IS_EQF",
- "VVJ|IS_NEQF",
- "VVJ|IS_LEF",
- /* 20 */
- "VVJ|IS_GEF",
- NULL,
- NULL,
- "WJ|CHANCE",
- /* 24 */
- NULL,
- "IJ|IS_ROOM",
- "IJ|IS_OBJECT",
- "IWJ|ITEM_UNK3_IS",
- /* 28 */
- "IBJ|CHILD_HAS_FLAG",
- NULL,
- NULL,
- "I|SET_NO_PARENT",
- /* 32 */
- NULL,
- "II|SET_PARENT",
- NULL,
- NULL,
- /* 36 */
- "VV|MOVE",
- NULL,
- NULL,
- NULL,
- /* 40 */
- NULL,
- "V|ZERO",
- "VW|SET",
- "VW|ADD",
- /* 44 */
- "VW|SUB",
- "VV|ADDF",
- "VV|SUBF",
- "VW|MUL",
- /* 48 */
- "VW|DIV",
- "VV|MULF",
- "VV|DIVF",
- "VW|MOD",
- /* 52 */
- "VV|MODF",
- "VW|RANDOM",
- NULL,
- "I|SET_A_PARENT",
- /* 56 */
- "IB|SET_CHILD2_BIT",
- "IB|CLEAR_CHILD2_BIT",
- "II|MAKE_SIBLING",
- "I|INC_UNK3",
- /* 60 */
- "I|DEC_UNK3",
- "IW|SET_UNK3",
- "V|SHOW_INT",
- "T|SHOW_STRING_NL",
- /* 64 */
- "T|SHOW_STRING",
- "WWWWWB|ADD_HITAREA",
- "BT|SET_ITEM_NAME",
- "BTw|SET_ITEM_DESC",
- /* 68 */
- "x|HALT",
- "x|RET1",
- "V|SHOW_STRING_AR3",
- "W|START_SUB",
- /* 72 */
- NULL,
- NULL,
- NULL,
- NULL,
- /* 76 */
- "WW|ADD_TIMEOUT",
- "J|IS_M1_EMPTY",
- "J|IS_M3_EMPTY",
- "ITJ|CHILD_FR2_IS",
- /* 80 */
- "IIJ|IS_ITEM_EQ",
- NULL,
- "B|UNK_82",
- "|RETM10",
- /* 84 */
- NULL,
- NULL,
- NULL,
- "W|UNK_87",
- /* 88 */
- "|STOP_ANIMATION",
- "|RESTART_ANIMATION",
- "IB|SET_M_TO_PARENT",
- "IB|SET_M_TO_SIBLING",
- /* 92 */
- "IB|SET_M_TO_CHILD",
- NULL,
- NULL,
- NULL,
- /* 96 */
- "WB|UNK_96",
- "W|LOAD_VGA",
- "WBWWW|START_VGA",
- "W|KILL_SPRITE",
- /* 100 */
- "|VGA_RESET",
- "BWWWWWW|UNK_101",
- "B|UNK_102",
- "|UNK_103",
- /* 104 */
- "B|UNK_104",
- NULL,
- NULL,
- "WWWWWIW|ADD_ITEM_HITAREA",
- /* 108 */
- "W|DEL_HITAREA",
- "W|CLEAR_HITAREA_0x40",
- "W|SET_HITAREA_0x40",
- "WWW|SET_HITAREA_XY",
- /* 112 */
- NULL,
- NULL,
- "IB|UNK_114",
- "IBJ|HAS_FLAG",
- /* 116 */
- "IB|SET_FLAG",
- "IB|CLEAR_FLAG",
- NULL,
- "W|WAIT_VGA",
- /* 120 */
- "W|UNK_120",
- "BI|SET_VGA_ITEM",
- NULL,
- NULL,
- /* 124 */
- NULL,
- "IJ|IS_SIBLING_WITH_A",
- "IBB|UNK_126",
- "WW|PLAY_MUSIC_RESOURCE",
- /* 128 */
- "W|GET_DUMMY_WORD",
- "W|GET_WORD_COND_TRUE",
- "Bww|SET_ADJ_NOUN",
- NULL,
- /* 132 */
- "|SAVE_GAME",
- "|LOAD_GAME",
- "|DUMMYPROC_134",
- "|QUIT_IF_USER_PRESSES_Y",
- /* 136 */
- "IV|GET_ITEM_UNK3",
- "B|UNK137",
- "|VGA_POINTER_OP_4",
- "II|SET_PARENT_SPECIAL",
- /* 140 */
- "|DEL_TE_AND_ADD_ONE",
- "BI|SET_M1_OR_M3",
- "WJ|IS_HITAREA_0x40_CLEAR",
- "I|START_ITEM_SUB",
- /* 144 */
- NULL,
- NULL,
- NULL,
- NULL,
- /* 148 */
- NULL,
- NULL,
- NULL,
- "BI|SET_ARRAY6_TO",
- /* 152 */
- "BB|SET_M1_M3_TO_ARRAY6",
- "B|SET_BIT",
- "B|CLEAR_BIT",
- "BJ|IS_BIT_CLEAR",
- /* 156 */
- "BJ|IS_BIT_SET",
- "IBB|GET_ITEM_PROP",
- "IBW|SET_ITEM_PROP",
- NULL,
- /* 160 */
- "B|UNK_160",
- "BWBW|SETUP_TEXT",
- "BBTW|PRINT_STR",
- "W|SOUND_1",
- /* 164 */
- "|UNK_164",
- "IWWJ|ITEM_UNK1_UNK2_IS",
- "B|SET_BIT2",
- "B|CLEAR_BIT2",
- /* 168 */
- "BJ|IS_BIT2_CLEAR",
- "BJ|IS_BIT2_SET",
- NULL,
- NULL,
- /* 172 */
- NULL,
- NULL,
- NULL,
- "|VGA_POINTER_OP_1",
- /* 176 */
- "|VGA_POINTER_OP_2",
- "BBI|INVENTORY_DESCRIPTION",
- "WWBB|PATHFIND",
- "BBB|ROOM_DESCRIPTION",
- /* 180 */
- "|MOUSE_ON",
- "|MOUSE_OFF",
- "|LOAD_BEARD",
- "|UNLOAD_BEARD",
- /* 184 */
- "W|CLEAR_VGAPOINTER_ENTRY",
- "W|LOAD_SOUND_FILES",
- "|VGA_POINTER_OP_3",
- "|FADE_TO_BLACK",
-};
-
-static const char *const simon2dos_opcode_name_table[256] = {
- /* 0 */
- "|INV_COND",
- "IJ|PTRA_PARENT_IS",
- "IJ|PTRA_PARENT_ISNOT",
- NULL,
- /* 4 */
- NULL,
- "IJ|PARENT_IS_1",
- "IJ|PARENT_ISNOT_1",
- "IIJ|PARENT_IS",
- /* 8 */
- NULL,
- NULL,
- NULL,
- "VJ|IS_ZERO",
- /* 12 */
- "VJ|ISNOT_ZERO",
- "VWJ|IS_EQ",
- "VWJ|IS_NEQ",
- "VWJ|IS_LE",
- /* 16 */
- "VWJ|IS_GE",
- "VVJ|IS_EQF",
- "VVJ|IS_NEQF",
- "VVJ|IS_LEF",
- /* 20 */
- "VVJ|IS_GEF",
- NULL,
- NULL,
- "WJ|CHANCE",
- /* 24 */
- NULL,
- "IJ|IS_ROOM",
- "IJ|IS_OBJECT",
- "IWJ|ITEM_UNK3_IS",
- /* 28 */
- "IBJ|CHILD_HAS_FLAG",
- NULL,
- NULL,
- "I|SET_NO_PARENT",
- /* 32 */
- NULL,
- "II|SET_PARENT",
- NULL,
- NULL,
- /* 36 */
- "VV|MOVE",
- NULL,
- NULL,
- NULL,
- /* 40 */
- NULL,
- "V|ZERO",
- "VW|SET",
- "VW|ADD",
- /* 44 */
- "VW|SUB",
- "VV|ADDF",
- "VV|SUBF",
- "VW|MUL",
- /* 48 */
- "VW|DIV",
- "VV|MULF",
- "VV|DIVF",
- "VW|MOD",
- /* 52 */
- "VV|MODF",
- "VW|RANDOM",
- NULL,
- "I|SET_A_PARENT",
- /* 56 */
- "IB|SET_CHILD2_BIT",
- "IB|CLEAR_CHILD2_BIT",
- "II|MAKE_SIBLING",
- "I|INC_UNK3",
- /* 60 */
- "I|DEC_UNK3",
- "IW|SET_UNK3",
- "V|SHOW_INT",
- "T|SHOW_STRING_NL",
- /* 64 */
- "T|SHOW_STRING",
- "WWWWWB|ADD_HITAREA",
- "BT|SET_ITEM_NAME",
- "BT|SET_ITEM_DESC",
- /* 68 */
- "x|HALT",
- "x|RET1",
- "V|SHOW_STRING_AR3",
- "W|START_SUB",
- /* 72 */
- NULL,
- NULL,
- NULL,
- NULL,
- /* 76 */
- "WW|ADD_TIMEOUT",
- "J|IS_M1_EMPTY",
- "J|IS_M3_EMPTY",
- "ITJ|CHILD_FR2_IS",
- /* 80 */
- "IIJ|IS_ITEM_EQ",
- NULL,
- "B|UNK_82",
- "|RETM10",
- /* 84 */
- NULL,
- NULL,
- NULL,
- "W|UNK_87",
- /* 88 */
- "|STOP_ANIMATION",
- "|RESTART_ANIMATION",
- "IB|SET_M_TO_PARENT",
- "IB|SET_M_TO_SIBLING",
- /* 92 */
- "IB|SET_M_TO_CHILD",
- NULL,
- NULL,
- NULL,
- /* 96 */
- "WB|UNK_96",
- "W|LOAD_VGA",
- "WWBWWW|START_VGA",
- "WW|KILL_SPRITE",
- /* 100 */
- "|VGA_RESET",
- "BWWWWWW|UNK_101",
- "B|UNK_102",
- "|UNK_103",
- /* 104 */
- "B|UNK_104",
- NULL,
- NULL,
- "WWWWWIW|ADD_ITEM_HITAREA",
- /* 108 */
- "W|DEL_HITAREA",
- "W|CLEAR_HITAREA_0x40",
- "W|SET_HITAREA_0x40",
- "WWW|SET_HITAREA_XY",
- /* 112 */
- NULL,
- NULL,
- "IB|UNK_114",
- "IBJ|HAS_FLAG",
- /* 116 */
- "IB|SET_FLAG",
- "IB|CLEAR_FLAG",
- NULL,
- "W|WAIT_VGA",
- /* 120 */
- "W|UNK_120",
- "BI|SET_VGA_ITEM",
- NULL,
- NULL,
- /* 124 */
- NULL,
- "IJ|IS_SIBLING_WITH_A",
- "IBB|UNK_126",
- "WW|PLAY_MUSIC_RESOURCE",
- /* 128 */
- "W|GET_DUMMY_WORD",
- "W|GET_WORD_COND_TRUE",
- "Bww|SET_ADJ_NOUN",
- NULL,
- /* 132 */
- "|SAVE_GAME",
- "|LOAD_GAME",
- "|DUMMYPROC_134",
- "|QUIT_IF_USER_PRESSES_Y",
- /* 136 */
- "IV|GET_ITEM_UNK3",
- "B|UNK_137",
- "|VGA_POINTER_OP_4",
- "II|SET_PARENT_SPECIAL",
- /* 140 */
- "|DEL_TE_AND_ADD_ONE",
- "BI|SET_M1_OR_M3",
- "WJ|IS_HITAREA_0x40_CLEAR",
- "I|START_ITEM_SUB",
- /* 144 */
- NULL,
- NULL,
- NULL,
- NULL,
- /* 148 */
- NULL,
- NULL,
- NULL,
- "BI|SET_ARRAY6_TO",
- /* 152 */
- "BB|SET_M1_M3_TO_ARRAY6",
- "B|SET_BIT",
- "B|CLEAR_BIT",
- "BJ|IS_BIT_CLEAR",
- /* 156 */
- "BJ|IS_BIT_SET",
- "IBB|GET_ITEM_PROP",
- "IBW|SET_ITEM_PROP",
- NULL,
- /* 160 */
- "B|UNK_160",
- "BWBW|SETUP_TEXT",
- "BBT|PRINT_STR",
- "W|SOUND_1",
- /* 164 */
- "|UNK_164",
- "IWWJ|ITEM_UNK1_UNK2_IS",
- "B|SET_BIT2",
- "B|CLEAR_BIT2",
- /* 168 */
- "BJ|IS_BIT2_CLEAR",
- "BJ|IS_BIT2_SET",
- NULL,
- NULL,
- /* 172 */
- NULL,
- NULL,
- NULL,
- "|VGA_POINTER_OP_1",
- /* 176 */
- "|VGA_POINTER_OP_2",
- "BBI|INVENTORY_DESCRIPTION",
- "WWBB|PATHFIND",
- "BBB|ROOM_DESCRIPTION",
- /* 180 */
- "|MOUSE_ON",
- "|MOUSE_OFF",
- NULL,
- NULL,
- /* 184 */
- "W|CLEAR_VGAPOINTER_ENTRY",
- NULL,
- "|VGA_POINTER_OP_3",
- NULL,
- /* 188 */
- "BSJ|STRING2_IS",
- "|CLEAR_MARKS",
- "B|WAIT_FOR_MARK",
-};
-
-static const char *const simon2talkie_opcode_name_table[256] = {
- /* 0 */
- "|INV_COND",
- "IJ|PTRA_PARENT_IS",
- "IJ|PTRA_PARENT_ISNOT",
- NULL,
- /* 4 */
- NULL,
- "IJ|PARENT_IS_1",
- "IJ|PARENT_ISNOT_1",
- "IIJ|PARENT_IS",
- /* 8 */
- NULL,
- NULL,
- NULL,
- "VJ|IS_ZERO",
- /* 12 */
- "VJ|ISNOT_ZERO",
- "VWJ|IS_EQ",
- "VWJ|IS_NEQ",
- "VWJ|IS_LE",
- /* 16 */
- "VWJ|IS_GE",
- "VVJ|IS_EQF",
- "VVJ|IS_NEQF",
- "VVJ|IS_LEF",
- /* 20 */
- "VVJ|IS_GEF",
- NULL,
- NULL,
- "WJ|CHANCE",
- /* 24 */
- NULL,
- "IJ|IS_ROOM",
- "IJ|IS_OBJECT",
- "IWJ|ITEM_UNK3_IS",
- /* 28 */
- "IBJ|CHILD_HAS_FLAG",
- NULL,
- NULL,
- "I|SET_NO_PARENT",
- /* 32 */
- NULL,
- "II|SET_PARENT",
- NULL,
- NULL,
- /* 36 */
- "VV|MOVE",
- NULL,
- NULL,
- NULL,
- /* 40 */
- NULL,
- "V|ZERO",
- "VW|SET",
- "VW|ADD",
- /* 44 */
- "VW|SUB",
- "VV|ADDF",
- "VV|SUBF",
- "VW|MUL",
- /* 48 */
- "VW|DIV",
- "VV|MULF",
- "VV|DIVF",
- "VW|MOD",
- /* 52 */
- "VV|MODF",
- "VW|RANDOM",
- NULL,
- "I|SET_A_PARENT",
- /* 56 */
- "IB|SET_CHILD2_BIT",
- "IB|CLEAR_CHILD2_BIT",
- "II|MAKE_SIBLING",
- "I|INC_UNK3",
- /* 60 */
- "I|DEC_UNK3",
- "IW|SET_UNK3",
- "V|SHOW_INT",
- "T|SHOW_STRING_NL",
- /* 64 */
- "T|SHOW_STRING",
- "WWWWWB|ADD_HITAREA",
- "BT|SET_ITEM_NAME",
- "BTw|SET_ITEM_DESC",
- /* 68 */
- "x|HALT",
- "x|RET1",
- "V|SHOW_STRING_AR3",
- "W|START_SUB",
- /* 72 */
- NULL,
- NULL,
- NULL,
- NULL,
- /* 76 */
- "WW|ADD_TIMEOUT",
- "J|IS_M1_EMPTY",
- "J|IS_M3_EMPTY",
- "ITJ|CHILD_FR2_IS",
- /* 80 */
- "IIJ|IS_ITEM_EQ",
- NULL,
- "B|UNK_82",
- "|RETM10",
- /* 84 */
- NULL,
- NULL,
- NULL,
- "W|UNK_87",
- /* 88 */
- "|STOP_ANIMATION",
- "|RESTART_ANIMATION",
- "IB|SET_M_TO_PARENT",
- "IB|SET_M_TO_SIBLING",
- /* 92 */
- "IB|SET_M_TO_CHILD",
- NULL,
- NULL,
- NULL,
- /* 96 */
- "WB|UNK_96",
- "W|LOAD_VGA",
- "WWBWWW|START_VGA",
- "WW|KILL_SPRITE",
- /* 100 */
- "|VGA_RESET",
- "BWWWWWW|UNK_101",
- "B|UNK_102",
- "|UNK_103",
- /* 104 */
- "B|UNK_104",
- NULL,
- NULL,
- "WWWWWIW|ADD_ITEM_HITAREA",
- /* 108 */
- "W|DEL_HITAREA",
- "W|CLEAR_HITAREA_0x40",
- "W|SET_HITAREA_0x40",
- "WWW|SET_HITAREA_XY",
- /* 112 */
- NULL,
- NULL,
- "IB|UNK_114",
- "IBJ|HAS_FLAG",
- /* 116 */
- "IB|SET_FLAG",
- "IB|CLEAR_FLAG",
- NULL,
- "W|WAIT_VGA",
- /* 120 */
- "W|UNK_120",
- "BI|SET_VGA_ITEM",
- NULL,
- NULL,
- /* 124 */
- NULL,
- "IJ|IS_SIBLING_WITH_A",
- "IBB|UNK_126",
- "WW|PLAY_MUSIC_RESOURCE",
- /* 128 */
- "W|GET_DUMMY_WORD",
- "W|GET_WORD_COND_TRUE",
- "Bww|SET_ADJ_NOUN",
- NULL,
- /* 132 */
- "|SAVE_GAME",
- "|LOAD_GAME",
- "|DUMMYPROC_134",
- "|QUIT_IF_USER_PRESSES_Y",
- /* 136 */
- "IV|GET_ITEM_UNK3",
- "B|UNK_137",
- "|VGA_POINTER_OP_4",
- "II|SET_PARENT_SPECIAL",
- /* 140 */
- "|DEL_TE_AND_ADD_ONE",
- "BI|SET_M1_OR_M3",
- "WJ|IS_HITAREA_0x40_CLEAR",
- "I|START_ITEM_SUB",
- /* 144 */
- NULL,
- NULL,
- NULL,
- NULL,
- /* 148 */
- NULL,
- NULL,
- NULL,
- "BI|SET_ARRAY6_TO",
- /* 152 */
- "BB|SET_M1_M3_TO_ARRAY6",
- "B|SET_BIT",
- "B|CLEAR_BIT",
- "BJ|IS_BIT_CLEAR",
- /* 156 */
- "BJ|IS_BIT_SET",
- "IBB|GET_ITEM_PROP",
- "IBW|SET_ITEM_PROP",
- NULL,
- /* 160 */
- "B|UNK_160",
- "BWBW|SETUP_TEXT",
- "BBTW|PRINT_STR",
- "W|SOUND_1",
- /* 164 */
- "|UNK_164",
- "IWWJ|ITEM_UNK1_UNK2_IS",
- "B|SET_BIT2",
- "B|CLEAR_BIT2",
- /* 168 */
- "BJ|IS_BIT2_CLEAR",
- "BJ|IS_BIT2_SET",
- NULL,
- NULL,
- /* 172 */
- NULL,
- NULL,
- NULL,
- "|VGA_POINTER_OP_1",
- /* 176 */
- "|VGA_POINTER_OP_2",
- "BBI|INVENTORY_DESCRIPTION",
- "WWBB|PATHFIND",
- "BBB|ROOM_DESCRIPTION",
- /* 180 */
- "|MOUSE_ON",
- "|MOUSE_OFF",
- NULL,
- NULL,
- /* 184 */
- "W|CLEAR_VGAPOINTER_ENTRY",
- NULL,
- "|VGA_POINTER_OP_3",
- NULL,
- /* 188 */
- "BSJ|STRING2_IS",
- "|CLEAR_MARKS",
- "B|WAIT_FOR_MARK",
-};
-
-static const char *const feeblefiles_opcode_name_table[256] = {
- /* 0 */
- "|INV_COND",
- "IJ|PTRA_PARENT_IS",
- "IJ|PTRA_PARENT_ISNOT",
- NULL,
- /* 4 */
- NULL,
- "IJ|PARENT_IS_1",
- "IJ|PARENT_ISNOT_1",
- "IIJ|PARENT_IS",
- /* 8 */
- NULL,
- NULL,
- NULL,
- "VJ|IS_ZERO",
- /* 12 */
- "VJ|ISNOT_ZERO",
- "VWJ|IS_EQ",
- "VWJ|IS_NEQ",
- "VWJ|IS_LE",
- /* 16 */
- "VWJ|IS_GE",
- "VVJ|IS_EQF",
- "VVJ|IS_NEQF",
- "VVJ|IS_LEF",
- /* 20 */
- "VVJ|IS_GEF",
- NULL,
- NULL,
- "WJ|CHANCE",
- /* 24 */
- NULL,
- "IJ|IS_ROOM",
- "IJ|IS_OBJECT",
- "IWJ|ITEM_UNK3_IS",
- /* 28 */
- "IBJ|CHILD_HAS_FLAG",
- NULL,
- NULL,
- "I|SET_NO_PARENT",
- /* 32 */
- NULL,
- "II|SET_PARENT",
- NULL,
- NULL,
- /* 36 */
- "VV|MOVE",
- NULL,
- NULL,
- NULL,
- /* 40 */
- NULL,
- "V|ZERO",
- "VW|SET",
- "VW|ADD",
- /* 44 */
- "VW|SUB",
- "VV|ADDF",
- "VV|SUBF",
- "VW|MUL",
- /* 48 */
- "VW|DIV",
- "VV|MULF",
- "VV|DIVF",
- "VW|MOD",
- /* 52 */
- "VV|MODF",
- "VW|RANDOM",
- NULL,
- "I|SET_A_PARENT",
- /* 56 */
- "IB|SET_CHILD2_BIT",
- "IB|CLEAR_CHILD2_BIT",
- "II|MAKE_SIBLING",
- "I|INC_UNK3",
- /* 60 */
- "I|DEC_UNK3",
- "IW|SET_UNK3",
- "V|SHOW_INT",
- "T|SHOW_STRING_NL",
- /* 64 */
- "T|SHOW_STRING",
- "WWWWWB|ADD_HITAREA",
- "BT|SET_ITEM_NAME",
- "BTw|SET_ITEM_DESC",
- /* 68 */
- "x|HALT",
- "x|RET1",
- "V|SHOW_STRING_AR3",
- "W|START_SUB",
- /* 72 */
- NULL,
- NULL,
- NULL,
- NULL,
- /* 76 */
- "WW|ADD_TIMEOUT",
- "J|IS_M1_EMPTY",
- "J|IS_M3_EMPTY",
- "ITJ|CHILD_FR2_IS",
- /* 80 */
- "IIJ|IS_ITEM_EQ",
- NULL,
- "B|UNK_82",
- "|RETM10",
- /* 84 */
- NULL,
- NULL,
- NULL,
- "W|UNK_87",
- /* 88 */
- "|STOP_ANIMATION",
- "|RESTART_ANIMATION",
- "IB|SET_M_TO_PARENT",
- "IB|SET_M_TO_SIBLING",
- /* 92 */
- "IB|SET_M_TO_CHILD",
- NULL,
- NULL,
- NULL,
- /* 96 */
- "WB|UNK_96",
- "W|LOAD_VGA",
- "WWBWWW|START_VGA",
- "WW|KILL_SPRITE",
- /* 100 */
- "|VGA_RESET",
- "BWWWWWW|UNK_101",
- "B|UNK_102",
- "|UNK_103",
- /* 104 */
- "B|UNK_104",
- NULL,
- NULL,
- "WWWWWIW|ADD_ITEM_HITAREA",
- /* 108 */
- "W|DEL_HITAREA",
- "W|CLEAR_HITAREA_0x40",
- "W|SET_HITAREA_0x40",
- "WWW|SET_HITAREA_XY",
- /* 112 */
- NULL,
- NULL,
- "IB|UNK_114",
- "IBJ|HAS_FLAG",
- /* 116 */
- "IB|SET_FLAG",
- "IB|CLEAR_FLAG",
- NULL,
- "W|WAIT_VGA",
- /* 120 */
- "W|UNK_120",
- "BI|SET_VGA_ITEM",
- "ORACLE_TEXT_DOWN",
- "ORACLE_TEXT_UP",
- /* 124 */
- "WJ|IF_TIME",
- "IJ|IS_SIBLING_WITH_A",
- "IBB|UNK_126",
- "WW|PLAY_MUSIC_RESOURCE",
- /* 128 */
- "W|GET_DUMMY_WORD",
- "W|GET_WORD_COND_TRUE",
- "Bww|SET_ADJ_NOUN",
- NULL,
- /* 132 */
- "|SAVE_GAME",
- "|LOAD_GAME",
- "|LIST_SAVED_GAMES",
- "|SWITCH_CD",
- /* 136 */
- "IV|GET_ITEM_UNK3",
- "B|UNK_137",
- "|VGA_POINTER_OP_4",
- "II|SET_PARENT_SPECIAL",
- /* 140 */
- "|DEL_TE_AND_ADD_ONE",
- "BI|SET_M1_OR_M3",
- "WJ|IS_HITAREA_0x40_CLEAR",
- "I|START_ITEM_SUB",
- /* 144 */
- NULL,
- NULL,
- NULL,
- NULL,
- /* 148 */
- NULL,
- NULL,
- NULL,
- "BI|SET_ARRAY6_TO",
- /* 152 */
- "BB|SET_M1_M3_TO_ARRAY6",
- "B|SET_BIT",
- "B|CLEAR_BIT",
- "BJ|IS_BIT_CLEAR",
- /* 156 */
- "BJ|IS_BIT_SET",
- "IBB|GET_ITEM_PROP",
- "IBW|SET_ITEM_PROP",
- NULL,
- /* 160 */
- "B|UNK_160",
- "BWBW|SETUP_TEXT",
- "BBTW|PRINT_STR",
- "W|SOUND_1",
- /* 164 */
- "|UNK_164",
- "IWWJ|ITEM_UNK1_UNK2_IS",
- "B|SET_BIT2",
- "B|CLEAR_BIT2",
- /* 168 */
- "BJ|IS_BIT2_CLEAR",
- "BJ|IS_BIT2_SET",
- NULL,
- NULL,
- /* 172 */
- NULL,
- NULL,
- NULL,
- "|VGA_POINTER_OP_1",
- /* 176 */
- "|VGA_POINTER_OP_2",
- "BBI|INVENTORY_DESCRIPTION",
- "WWBB|PATHFIND",
- "BBB|ROOM_DESCRIPTION",
- /* 180 */
- "|MOUSE_ON",
- "|MOUSE_OFF",
- "T|LOAD_VIDEO",
- "|PLAY_VIDEO",
- /* 184 */
- "W|CLEAR_VGAPOINTER_ENTRY",
- NULL,
- "|VGA_POINTER_OP_3",
- NULL,
- /* 188 */
- "BSJ|STRING2_IS",
- "|CLEAR_MARKS",
- "B|WAIT_FOR_MARK",
- "|RESET_PV_COUNT",
- /* 192 */
- "BBBB|SET_PATH_VALUES",
- "|PAUSE_CLOCK",
- "|RESUME_CLOCK",
- "BBBB|SET_COLOR",
- /* 196 */
- "B|B3_SET",
- "B|B3_CLEAR",
- "B|B3_ZERO",
- "B|B3_NOT_ZERO",
-};
-
-const char *const simon1_video_opcode_name_table[] = {
- /* 0 */
- "x|RET",
- "ddd|FADEOUT",
- "d|CALL",
- "ddddd|NEW_SPRITE",
- /* 4 */
- "ddd|FADEIN",
- "vd|SKIP_IF_NEQ",
- "d|SKIP_IFN_SIB_WITH_A",
- "d|SKIP_IF_SIB_WITH_A",
- /* 8 */
- "dd|SKIP_IF_PARENT_IS",
- "dd|SKIP_IF_UNK3_IS",
- "ddddd|DRAW",
- "|CLEAR_PATHFIND_ARRAY",
- /* 12 */
- "d|DELAY",
- "d|SET_SPRITE_OFFSET_X",
- "d|SET_SPRITE_OFFSET_Y",
- "d|IDENT_WAKEUP",
- /* 16 */
- "d|IDENT_SLEEP",
- "dq|SET_PATHFIND_ITEM",
- "i|JUMP_REL",
- "|CHAIN_TO",
- /* 20 */
- "dd|SET_CODE_WORD",
- "i|JUMP_IF_CODE_WORD",
- "dd|SET_SPRITE_PALETTE",
- "d|SET_SPRITE_PRIORITY",
- /* 24 */
- "diid|SET_SPRITE_XY",
- "x|HALT_SPRITE",
- "ddddd|SET_WINDOW",
- "|RESET",
- /* 28 */
- "dddd|DUMMY_28",
- "|STOP_ALL_SOUNDS",
- "d|SET_BASE_DELAY",
- "d|SET_PALETTE_MODE",
- /* 32 */
- "vv|COPY_VAR",
- "|MOUSE_ON",
- "|MOUSE_OFF",
- "dd|VC35",
- /* 36 */
- "dd|SAVELOAD_THING",
- "v|SET_SPRITE_OFFSET_Y",
- "v|SKIP_IF_VAR_ZERO",
- "vd|SET_VAR",
- /* 40 */
- "vd|ADD_VAR",
- "vd|SUB_VAR",
- "vd|DELAY_IF_NOT_EQ",
- "d|SKIP_IF_BIT_CLEAR",
- /* 44 */
- "d|SKIP_IF_BIT_SET",
- "v|SET_SPRITE_X",
- "v|SET_SPRITE_Y",
- "vv|ADD_VAR_F",
- /* 48 */
- "|VC_48",
- "d|SET_BIT",
- "d|CLEAR_BIT",
- "d|CLEAR_HITAREA_BIT_0x40",
- /* 52 */
- "d|PLAY_SOUND",
- "dd|DUMMY_53",
- "ddd|DUMMY_54",
- "ddd|OFFSET_HIT_AREA",
- /* 56 */
- "|DUMMY_56",
- "|DUMMY_57",
- "|UNK_58",
- "|SKIP_IF_SPEECH_ENDED",
- /* 60 */
- "d|KILL_SPRITE",
- "ddd|INIT_SPRITE",
- "|FASTFADEOUT",
- "|FASTFADEIN",
-};
-
-const char *const simon2_video_opcode_name_table[] = {
- /* 0 */
- "x|RET",
- "ddd|FADEOUT",
- "d|CALL",
- "ddddd|NEW_SPRITE",
- /* 4 */
- "ddd|FADEIN",
- "vd|SKIP_IF_NEQ",
- "d|SKIP_IFN_SIB_WITH_A",
- "d|SKIP_IF_SIB_WITH_A",
- /* 8 */
- "dd|SKIP_IF_PARENT_IS",
- "dd|SKIP_IF_UNK3_IS",
- "ddddb|DRAW",
- "|CLEAR_PATHFIND_ARRAY",
- /* 12 */
- "b|DELAY",
- "d|SET_SPRITE_OFFSET_X",
- "d|SET_SPRITE_OFFSET_Y",
- "d|IDENT_WAKEUP",
- /* 16 */
- "d|IDENT_SLEEP",
- "dq|SET_PATHFIND_ITEM",
- "i|JUMP_REL",
- "|CHAIN_TO",
- /* 20 */
- "dd|SET_CODE_WORD",
- "i|JUMP_IF_CODE_WORD",
- "dd|SET_SPRITE_PALETTE",
- "d|SET_SPRITE_PRIORITY",
- /* 24 */
- "diib|SET_SPRITE_XY",
- "x|HALT_SPRITE",
- "ddddd|SET_WINDOW",
- "|RESET",
- /* 28 */
- "dddd|DUMMY_28",
- "|STOP_ALL_SOUNDS",
- "d|SET_BASE_DELAY",
- "d|SET_PALETTE_MODE",
- /* 32 */
- "vv|COPY_VAR",
- "|MOUSE_ON",
- "|MOUSE_OFF",
- "dd|VC35",
- /* 36 */
- "dd|SAVELOAD_THING",
- "v|SET_SPRITE_OFFSET_Y",
- "v|SKIP_IF_VAR_ZERO",
- "vd|SET_VAR",
- /* 40 */
- "vd|ADD_VAR",
- "vd|SUB_VAR",
- "vd|DELAY_IF_NOT_EQ",
- "d|SKIP_IF_BIT_CLEAR",
- /* 44 */
- "d|SKIP_IF_BIT_SET",
- "v|SET_SPRITE_X",
- "v|SET_SPRITE_Y",
- "vv|ADD_VAR_F",
- /* 48 */
- "|VC_48",
- "d|SET_BIT",
- "d|CLEAR_BIT",
- "d|CLEAR_HITAREA_BIT_0x40",
- /* 52 */
- "d|PLAY_SOUND",
- "dd|DUMMY_53",
- "ddd|DUMMY_54",
- "ddd|OFFSET_HIT_AREA",
- /* 56 */
- "i|SLEEP_EX",
- "|DUMMY_57",
- "|UNK_58",
- "ddd|KILL_MULTI_SPRITE",
- /* 60 */
- "dd|KILL_SPRITE",
- "ddd|INIT_SPRITE",
- "|FASTFADEOUT",
- "|FASTFADEIN",
- /* 64 */
- "|SKIP_IF_SPEECH_ENDED",
- "|SLOW_FADE_IN",
- "|SKIP_IF_NZ",
- "|SKIP_IF_GE",
- /* 68 */
- "|SKIP_IF_LE",
- "dd|PLAY_TRACK",
- "dd|QUEUE_MUSIC",
- "|CHECK_MUSIC_QUEUE",
- /* 72 */
- "dd|PLAY_TRACK_2",
- "bb|SET_MARK",
- "bb|CLEAR_MARK",
-};
-
-const char *const feeblefiles_video_opcode_name_table[] = {
- /* 0 */
- "x|RET",
- "ddd|FADEOUT",
- "d|CALL",
- "ddddd|NEW_SPRITE",
- /* 4 */
- "ddd|FADEIN",
- "vd|SKIP_IF_NEQ",
- "d|SKIP_IFN_SIB_WITH_A",
- "d|SKIP_IF_SIB_WITH_A",
- /* 8 */
- "dd|SKIP_IF_PARENT_IS",
- "dd|SKIP_IF_UNK3_IS",
- "ddddb|DRAW",
- "|CLEAR_PATHFIND_ARRAY",
- /* 12 */
- "b|DELAY",
- "d|SET_SPRITE_OFFSET_X",
- "d|SET_SPRITE_OFFSET_Y",
- "d|IDENT_WAKEUP",
- /* 16 */
- "d|IDENT_SLEEP",
- "dq|SET_PATHFIND_ITEM",
- "i|JUMP_REL",
- "|CHAIN_TO",
- /* 20 */
- "dd|SET_CODE_WORD",
- "i|JUMP_IF_CODE_WORD",
- "dd|SET_SPRITE_PALETTE",
- "d|SET_SPRITE_PRIORITY",
- /* 24 */
- "diib|SET_SPRITE_XY",
- "x|HALT_SPRITE",
- "ddddd|SET_WINDOW",
- "|RESET",
- /* 28 */
- "dddd|DUMMY_28",
- "|STOP_ALL_SOUNDS",
- "d|SET_BASE_DELAY",
- "d|SET_PALETTE_MODE",
- /* 32 */
- "vv|COPY_VAR",
- "|MOUSE_ON",
- "|MOUSE_OFF",
- "dd|VC35",
- /* 36 */
- "dd|SAVELOAD_THING",
- "v|SET_SPRITE_OFFSET_Y",
- "v|SKIP_IF_VAR_ZERO",
- "vd|SET_VAR",
- /* 40 */
- "vd|ADD_VAR",
- "vd|SUB_VAR",
- "vd|DELAY_IF_NOT_EQ",
- "d|SKIP_IF_BIT_CLEAR",
- /* 44 */
- "d|SKIP_IF_BIT_SET",
- "v|SET_SPRITE_X",
- "v|SET_SPRITE_Y",
- "vv|ADD_VAR_F",
- /* 48 */
- "|VC_48",
- "d|SET_BIT",
- "d|CLEAR_BIT",
- "d|CLEAR_HITAREA_BIT_0x40",
- /* 52 */
- "ddd|PLAY_SOUND",
- "ddd|PLAY_SOUND_WITH_ANIM",
- "ddd|DUMMY_54",
- "ddd|OFFSET_HIT_AREA",
- /* 56 */
- "i|SLEEP_EX",
- "|DUMMY_57",
- "|UNK_58",
- "ddd|KILL_MULTI_SPRITE",
- /* 60 */
- "dd|KILL_SPRITE",
- "ddd|INIT_SPRITE",
- "|FASTFADEOUT",
- "|FASTFADEIN",
- /* 64 */
- "|SKIP_IF_SPEECH_ENDED",
- "|SLOW_FADE_IN",
- "|SKIP_IF_NZ",
- "|SKIP_IF_GE",
- /* 68 */
- "|SKIP_IF_LE",
- "dd|PLAY_TRACK",
- "dd|QUEUE_MUSIC",
- "|CHECK_MUSIC_QUEUE",
- /* 72 */
- "dd|PLAY_TRACK_2",
- "bb|SET_MARK",
- "bb|CLEAR_MARK",
- "dd|SETSCALE",
- /* 76 */
- "ddd|SETSCALEXOFFS",
- "ddd|SETSCALEYOFFS",
- "|COMPUTEXY",
- "|COMPUTEPOSNUM",
- /* 80 */
- "ddd|SETOVERLAYIMAGE",
- "dd|SETRANDOM",
- "d|GETPATHVALUE",
- "ddd|PLAYSOUNDLOOP",
- "|STOPSOUNDLOOP",
-};
-
-} // End of namespace Simon
-
-#endif
-
diff --git a/simon/debugger.cpp b/simon/debugger.cpp
deleted file mode 100644
index 1384c60693..0000000000
--- a/simon/debugger.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2003-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/stdafx.h"
-#include "common/config-manager.h"
-#include "common/debugger.cpp"
-#include "simon/debugger.h"
-#include "simon/simon.h"
-
-namespace Simon {
-
-Debugger::Debugger(SimonEngine *vm)
- : Common::Debugger<Debugger>() {
- _vm = vm;
-
- DCmd_Register("continue", &Debugger::Cmd_Exit);
- DCmd_Register("exit", &Debugger::Cmd_Exit);
- DCmd_Register("help", &Debugger::Cmd_Help);
- DCmd_Register("quit", &Debugger::Cmd_Exit);
- DCmd_Register("level", &Debugger::Cmd_DebugLevel);
- DCmd_Register("music", &Debugger::Cmd_PlayMusic);
- DCmd_Register("sound", &Debugger::Cmd_PlaySound);
- DCmd_Register("voice", &Debugger::Cmd_PlayVoice);
- DCmd_Register("bit", &Debugger::Cmd_SetBit);
- DCmd_Register("var", &Debugger::Cmd_SetVar);
- DCmd_Register("sub", &Debugger::Cmd_StartSubroutine);
-
-}
-
-
-void Debugger::preEnter() {
- //_vm->midi.pause(1);
-}
-
-
-void Debugger::postEnter() {
- //_vm->midi.pause(0);
-}
-
-
-bool Debugger::Cmd_Exit(int argc, const char **argv) {
- _detach_now = true;
- return false;
-}
-
-bool Debugger::Cmd_Help(int argc, const char **argv) {
- // console normally has 39 line width
- // wrap around nicely
- int width = 0, size, i;
-
- DebugPrintf("Commands are:\n");
- for (i = 0 ; i < _dcmd_count ; i++) {
- size = strlen(_dcmds[i].name) + 1;
-
- if ((width + size) >= 39) {
- DebugPrintf("\n");
- width = size;
- } else
- width += size;
-
- DebugPrintf("%s ", _dcmds[i].name);
- }
- DebugPrintf("\n");
- return true;
-}
-
-bool Debugger::Cmd_DebugLevel(int argc, const char **argv) {
- if (argc == 1) {
- if (_vm->_debugMode == false)
- DebugPrintf("Debugging is not enabled at this time\n");
- else
- DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel);
- } else { // set level
- gDebugLevel = atoi(argv[1]);
- if (gDebugLevel >= 0 && gDebugLevel < 10) {
- _vm->_debugMode = true;
- DebugPrintf("Debug level set to level %d\n", gDebugLevel);
- } else if (gDebugLevel < 0) {
- _vm->_debugMode = false;
- DebugPrintf("Debugging is now disabled\n");
- } else
- DebugPrintf("Not a valid debug level (0 - 10)\n");
- }
-
- return true;
-}
-
-bool Debugger::Cmd_PlayMusic(int argc, const char **argv) {
- if (argc > 1) {
- uint music = atoi(argv[1]);
- uint range = (_vm->getGameType() == GType_SIMON2) ? 93 : 34;
- if (music <= range) {
- _vm->loadMusic (music);
- if (_vm->getGameType() == GType_SIMON2)
- _vm->midi.startTrack (0);
- } else
- DebugPrintf("Music out of range (0 - %d)\n", range);
- } else
- DebugPrintf("Syntax: music <musicnum>\n");
-
- return true;
-}
-
-bool Debugger::Cmd_PlaySound(int argc, const char **argv) {
- if (argc > 1) {
- uint sound = atoi(argv[1]);
- uint range = (_vm->getGameType() == GType_SIMON2) ? 222 : 127;
- if (sound <= range)
- _vm->_sound->playEffects(sound);
- else
- DebugPrintf("Sound out of range (0 - %d)\n", range);
- } else
- DebugPrintf("Syntax: sound <soundnum>\n");
-
- return true;
-}
-
-bool Debugger::Cmd_PlayVoice(int argc, const char **argv) {
- if (argc > 1) {
- uint voice = atoi(argv[1]);
- uint range = (_vm->getGameType() == GType_SIMON2) ? 3632 : 1996;
- if (voice <= range)
- _vm->_sound->playVoice(voice);
- else
- DebugPrintf("Voice out of range (0 - %d)\n", range);
- } else
- DebugPrintf("Syntax: voice <voicenum>\n");
-
- return true;
-}
-
-bool Debugger::Cmd_SetBit(int argc, const char **argv) {
- uint bit, value;
- if (argc > 2) {
- bit = atoi(argv[1]);
- value = atoi(argv[2]);
- if (value <= 1) {
- _vm->vcSetBitTo(bit, value != 0);
- DebugPrintf("Set bit %d to %d\n", bit, value);
- } else
- DebugPrintf("Bit value out of range (0 - 1)\n");
- } else if (argc > 1) {
- bit = atoi(argv[1]);
- value = _vm->vcGetBit(bit);
- DebugPrintf("Bit %d is %d\n", bit, value);
- } else
- DebugPrintf("Syntax: bit <bitnum> <value>\n");
-
- return true;
-}
-
-bool Debugger::Cmd_SetVar(int argc, const char **argv) {
- uint var, value;
- if (argc > 1) {
- var = atoi(argv[1]);
- if (var <= 254) {
- if (argc > 2) {
- value = atoi(argv[2]);
- _vm->writeVariable(var, value);
- DebugPrintf("Set var %d to %d\n", var, value);
- } else {
- value = _vm->readVariable(var);
- DebugPrintf("Var %d is %d\n", var, value);
- }
- } else
- DebugPrintf("Var out of range (0 - 254)\n");
- } else
- DebugPrintf("Syntax: var <varnum> <value>\n");
-
- return true;
-}
-
-bool Debugger::Cmd_StartSubroutine(int argc, const char **argv) {
- if (argc > 1) {
- uint subroutine = atoi(argv[1]);
- Subroutine *sub;
- sub = _vm->getSubroutineByID(subroutine);
- if (sub != NULL)
- _vm->startSubroutine(sub);
- } else
- DebugPrintf("Subroutine %d\n", _vm->_subroutine);
-
- return true;
-}
-
-} // End of namespace Simon
-
diff --git a/simon/debugger.h b/simon/debugger.h
deleted file mode 100644
index 837fbbccf8..0000000000
--- a/simon/debugger.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2003-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef SIMON_DEBUGGER_H
-#define SIMON_DEBUGGER_H
-
-#include "common/debugger.h"
-
-namespace Simon {
-
-class SimonEngine;
-
-class Debugger : public Common::Debugger<Debugger> {
-public:
- Debugger(SimonEngine *vm);
- virtual ~Debugger() {} // we need this for __SYMBIAN32__ archaic gcc/UIQ
-
-protected:
- SimonEngine *_vm;
-
- virtual void preEnter();
- virtual void postEnter();
-
- bool Cmd_Exit(int argc, const char **argv);
- bool Cmd_Help(int argc, const char **argv);
- bool Cmd_DebugLevel(int argc, const char **argv);
- bool Cmd_PlayMusic(int argc, const char **argv);
- bool Cmd_PlaySound(int argc, const char **argv);
- bool Cmd_PlayVoice(int argc, const char **argv);
- bool Cmd_SetBit(int argc, const char **argv);
- bool Cmd_SetVar(int argc, const char **argv);
- bool Cmd_StartSubroutine(int argc, const char **argv);
-};
-
-} // End of namespace Simon
-
-#endif
diff --git a/simon/game.cpp b/simon/game.cpp
deleted file mode 100644
index 1cd7e4d729..0000000000
--- a/simon/game.cpp
+++ /dev/null
@@ -1,1186 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/stdafx.h"
-
-#include "backends/fs/fs.h"
-
-#include "base/gameDetector.h"
-#include "base/plugins.h"
-
-#include "common/config-manager.h"
-#include "common/file.h"
-#include "common/md5.h"
-
-#include "simon/simon.h"
-#include "simon/intern.h"
-
-using Common::File;
-
-namespace Simon {
-
-static int detectGame(const FSList &fslist, bool mode = false, int start = -1);
-
-struct GameMD5 {
- GameIds id;
- const char *md5;
- const char *filename;
- bool caseSensitive;
-};
-
-#define FILE_MD5_BYTES 5000
-
-static GameMD5 gameMD5[] = {
- { GID_SIMON1ACORNDEMO, "b4a7526ced425ba8ad0d548d0ec69900", "data", false },
- { GID_SIMON1ACORNDEMO, "425c7d1957699d35abca7e12a08c7422", "gamebase", false },
- { GID_SIMON1ACORNDEMO, "22107c24dfb31b66ac503c28a6e20b19", "icondata", false},
- { GID_SIMON1ACORNDEMO, "d9de7542612d9f4e0819ad0df5eac56b", "stripped", false},
- { GID_SIMON1ACORNDEMO, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1ACORN, "64958b3a38afdcb85da1eeed85169806", "data", false },
- { GID_SIMON1ACORN, "28261b99cd9da1242189b4f6f2841bd6", "gamebase", false },
- { GID_SIMON1ACORN, "22107c24dfb31b66ac503c28a6e20b19", "icondata", false},
- { GID_SIMON1ACORN, "f3b27a3fbb45dcd323a48159496e45e8", "stripped", false},
- { GID_SIMON1ACORN, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1AMIGA, "6c9ad2ff571d34a4cf0c696cf4e13500", "gameamiga", true },
- { GID_SIMON1AMIGA, "565ef7a98dcc21ef526a2bb10b6f42ed", "icon.pkd", true },
- { GID_SIMON1AMIGA, "c649fcc0439766810e5097ee7e81d4c8", "stripped.txt", true},
- { GID_SIMON1AMIGA, "f9d5bf2ce09f82289c791c3ca26e1e4b", "tbllist", true},
-
- { GID_SIMON1AMIGA_FR, "bd9828b9d4e5d89b50fe8c47a8e6bc07", "gameamiga", true },
- { GID_SIMON1AMIGA_FR, "565ef7a98dcc21ef526a2bb10b6f42ed", "icon.pkd", true },
- { GID_SIMON1AMIGA_FR, "2297baec985617d0d5612a0124bac359", "stripped.txt", true},
- { GID_SIMON1AMIGA_FR, "f9d5bf2ce09f82289c791c3ca26e1e4b", "tbllist", true},
-
- { GID_SIMON1AMIGA_DE, "a2de9553f3b73064369948b5af38bb30", "gameamiga", true },
- { GID_SIMON1AMIGA_DE, "565ef7a98dcc21ef526a2bb10b6f42ed", "icon.pkd", true },
- { GID_SIMON1AMIGA_DE, "c649fcc0439766810e5097ee7e81d4c8", "stripped.txt", true},
- { GID_SIMON1AMIGA_DE, "f9d5bf2ce09f82289c791c3ca26e1e4b", "tbllist", true},
-
- { GID_SIMON1AMIGADEMO, "a12b696170f14eca5ff75f1549829251", "gameamiga", true }, // Unpacked version
- { GID_SIMON1AMIGADEMO, "ebc96af15bfaf75ba8210326b9260d2f", "icon.pkd", true },
- { GID_SIMON1AMIGADEMO, "8edde5b9498dc9f31da1093028da467c", "stripped.txt", true},
- { GID_SIMON1AMIGADEMO, "1247e024e1f13ca54c1e354120c7519c", "tbllist", true},
-
- { GID_SIMON1CD32, "bab7f19237cf7d7619b6c73631da1854", "gameamiga", true },
- { GID_SIMON1CD32, "565ef7a98dcc21ef526a2bb10b6f42ed", "icon.pkd", true },
- { GID_SIMON1CD32, "59be788020441e21861e284236fd08c1", "stripped.txt", true},
- { GID_SIMON1CD32, "f9d5bf2ce09f82289c791c3ca26e1e4b", "tbllist", true},
-
- { GID_SIMON1CD32_2, "ec5358680c117f29b128cbbb322111a4", "gameamiga", true },
- { GID_SIMON1CD32_2, "8ce5a46466a4f8f6d0f780b0ef00d5f5", "icon.pkd", true },
- { GID_SIMON1CD32_2, "59be788020441e21861e284236fd08c1", "stripped.txt", true},
- { GID_SIMON1CD32_2, "f9d5bf2ce09f82289c791c3ca26e1e4b", "tbllist", true},
-
- { GID_SIMON1DOS_INF, "9f93d27432ce44a787eef10adb640870", "gamepc", false },
- { GID_SIMON1DOS_INF, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1DOS_INF, "2af9affc5981eec44b90d4c556145cb8", "stripped.txt", false},
- { GID_SIMON1DOS_INF, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1DOS_INF_RU,"605fb866e03ec1c41b10c6a518ddfa49", "gamepc", false },
- { GID_SIMON1DOS_INF_RU,"22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1DOS_INF_RU,"2af9affc5981eec44b90d4c556145cb8", "stripped.txt", false},
- { GID_SIMON1DOS_INF_RU,"d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1DOS, "c392e494dcabed797b98cbcfc687b33a", "gamepc", false },
- { GID_SIMON1DOS, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1DOS, "c95a0a1ee973e19c2a1c5d12026c139f", "stripped.txt", false},
- { GID_SIMON1DOS, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1DOS_RU, "605fb866e03ec1c41b10c6a518ddfa49", "gamepc", false },
- { GID_SIMON1DOS_RU, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1DOS_RU, "c95a0a1ee973e19c2a1c5d12026c139f", "stripped.txt", false},
- { GID_SIMON1DOS_RU, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1DOS_FR, "34759d0d4285a2f4b21b8e03b8fcefb3", "gamepc", false },
- { GID_SIMON1DOS_FR, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1DOS_FR, "aa01e7386057abc0c3e27dbaa9c4ba5b", "stripped.txt", false},
- { GID_SIMON1DOS_FR, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1DOS_DE, "063015e6ce7d90b570dbc21fe0c667b1", "gamepc", false },
- { GID_SIMON1DOS_DE, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1DOS_DE, "c95a0a1ee973e19c2a1c5d12026c139f", "stripped.txt", false},
- { GID_SIMON1DOS_DE, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1DOS_IT, "65c9b2dea57df84ef55d1eaf384ebd30", "gamepc", false },
- { GID_SIMON1DOS_IT, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1DOS_IT, "2af9affc5981eec44b90d4c556145cb8", "stripped.txt", false},
- { GID_SIMON1DOS_IT, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1DOS_ES, "5374fafdea2068134f33deab225feed3", "gamepc", false },
- { GID_SIMON1DOS_ES, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1DOS_ES, "2af9affc5981eec44b90d4c556145cb8", "stripped.txt", false},
- { GID_SIMON1DOS_ES, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1DEMO, "2be4a21bc76e2fdc071867c130651439", "gdemo", false },
- { GID_SIMON1DEMO, "55af3b4d93972bc58bfee38a86b76c3f", "icon.dat", false},
- { GID_SIMON1DEMO, "33a2e329b97b2a349858d6a093159eb7", "stripped.txt", false},
- { GID_SIMON1DEMO, "1247e024e1f13ca54c1e354120c7519c", "tbllist", false},
-
- { GID_SIMON1TALKIE, "28261b99cd9da1242189b4f6f2841bd6", "gamepc", false },
- { GID_SIMON1TALKIE, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1TALKIE, "64958b3a38afdcb85da1eeed85169806", "simon.gme", false },
- { GID_SIMON1TALKIE, "f3b27a3fbb45dcd323a48159496e45e8", "stripped.txt", false},
- { GID_SIMON1TALKIE, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1TALKIE2, "c0b948b6821d2140f8b977144f21027a", "gamepc", false },
- { GID_SIMON1TALKIE2, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1TALKIE2, "64f73e94639b63af846ac4a8a94a23d8", "simon.gme", false },
- { GID_SIMON1TALKIE2, "f3b27a3fbb45dcd323a48159496e45e8", "stripped.txt", false},
- { GID_SIMON1TALKIE2, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1TALKIE_FR, "3cfb9d1ff4ec725af9924140126cf69f", "gamepc", false },
- { GID_SIMON1TALKIE_FR, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1TALKIE_FR, "638049fa5d41b81fb6fb11671721b871", "simon.gme", false },
- { GID_SIMON1TALKIE_FR, "ef51ac74c946881ae4d7ca66cc7a0d1e", "stripped.txt", false},
- { GID_SIMON1TALKIE_FR, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1TALKIE_DE, "48b1f3499e2e0d731047f4d481ff7817", "gamepc", false },
- { GID_SIMON1TALKIE_DE, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1TALKIE_DE, "7db9912acac4f1d965a64bdcfc370ba1", "simon.gme", false },
- { GID_SIMON1TALKIE_DE, "40d68bec54042ef930f084ad9a4342a1", "stripped.txt", false},
- { GID_SIMON1TALKIE_DE, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1TALKIE_HB, "bc66e9c0b296e1b155a246917133f71a", "gamepc", false },
- { GID_SIMON1TALKIE_HB, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1TALKIE_HB, "a34b2c8642f2e3676d7088b5c8b3e884", "simon.gme", false },
- { GID_SIMON1TALKIE_HB, "9d31bef42db1a8abe4e9f368014df1d5", "stripped.txt", false},
- { GID_SIMON1TALKIE_HB, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1TALKIE_IT, "8d3ca654e158c91b860c7eae31d65312", "gamepc", false },
- { GID_SIMON1TALKIE_IT, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1TALKIE_IT, "104efd83c8f3edf545982e07d87f66ac", "simon.gme", false },
- { GID_SIMON1TALKIE_IT, "9d31bef42db1a8abe4e9f368014df1d5", "stripped.txt", false},
- { GID_SIMON1TALKIE_IT, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1TALKIE_ES, "439f801ba52c02c9d1844600d1ce0f5e", "gamepc", false },
- { GID_SIMON1TALKIE_ES, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1TALKIE_ES, "eff2774a73890b9eac533db90cd1afa1", "simon.gme", false },
- { GID_SIMON1TALKIE_ES, "9d31bef42db1a8abe4e9f368014df1d5", "stripped.txt", false},
- { GID_SIMON1TALKIE_ES, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1WIN, "c7c12fea7f6d0bfd22af5cdbc8166862", "gamepc", false },
- { GID_SIMON1WIN, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1WIN, "b1b18d0731b64c0738c5cc4a2ee792fc", "simon.gme", false },
- { GID_SIMON1WIN, "a27e87a9ba21212d769804b3df47bfb2", "stripped.txt", false},
- { GID_SIMON1WIN, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON1WIN_DE, "48b1f3499e2e0d731047f4d481ff7817", "gamepc", false },
- { GID_SIMON1WIN_DE, "22107c24dfb31b66ac503c28a6e20b19", "icon.dat", false},
- { GID_SIMON1WIN_DE, "acd9cc438525b142d93b15c77a6f551b", "simon.gme", false },
- { GID_SIMON1WIN_DE, "40d68bec54042ef930f084ad9a4342a1", "stripped.txt", false},
- { GID_SIMON1WIN_DE, "d198a80de2c59e4a0cd24b98814849e8", "tbllist", false},
-
- { GID_SIMON2DOS, "27c8e7feada80c75b70b9c2f6088d519", "game32", false },
- { GID_SIMON2DOS, "ee92d1f84893195a60449f2430d07285", "icon.dat", false},
- { GID_SIMON2DOS, "eefcc32b1f2c0482c1a59a963a146345", "simon2.gme", false},
- { GID_SIMON2DOS, "e229f84d46fa83f99b4a7115679f3fb6", "stripped.txt", false},
- { GID_SIMON2DOS, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2DOS_RU, "7edfc633dd50f8caa719c478443db70b", "game32", false },
- { GID_SIMON2DOS_RU, "ee92d1f84893195a60449f2430d07285", "icon.dat", false},
- { GID_SIMON2DOS_RU, "eefcc32b1f2c0482c1a59a963a146345", "simon2.gme", false},
- { GID_SIMON2DOS_RU, "e229f84d46fa83f99b4a7115679f3fb6", "stripped.txt", false},
- { GID_SIMON2DOS_RU, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2DOS2, "604d04315935e77624bd356ac926e068", "game32", false },
- { GID_SIMON2DOS2, "72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2DOS2, "aa6840420899a31874204f90bb214108", "simon2.gme", false},
- { GID_SIMON2DOS2, "e229f84d46fa83f99b4a7115679f3fb6", "stripped.txt", false},
- { GID_SIMON2DOS2, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2DOS2_RU, "7edfc633dd50f8caa719c478443db70b", "game32", false },
- { GID_SIMON2DOS2_RU, "72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2DOS2_RU, "aa6840420899a31874204f90bb214108", "simon2.gme", false},
- { GID_SIMON2DOS2_RU, "e229f84d46fa83f99b4a7115679f3fb6", "stripped.txt", false},
- { GID_SIMON2DOS2_RU, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2DOS_IT, "3e11d400bea0638f360a724687005cd1", "game32", false },
- { GID_SIMON2DOS_IT, "72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2DOS_IT, "f306a397565d7f13bec7ecf14c723de7", "simon2.gme", false},
- { GID_SIMON2DOS_IT, "bea6843fb9f3b2144fcb146d62db0b9a", "stripped.txt", false},
- { GID_SIMON2DOS_IT, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2DEMO, "3794c15887539b8578bacab694ccf08a", "gsptr30", false },
- { GID_SIMON2DEMO, "72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2DEMO, "f8c9e6df1e55923a749e115ba74210c4", "simon2.gme", false},
- { GID_SIMON2DEMO, "e229f84d46fa83f99b4a7115679f3fb6", "stripped.txt", false},
- { GID_SIMON2DEMO, "a0d5a494b5d3d209d1a1d76cc8d76601", "tbllist", false},
-
- { GID_SIMON2TALKIE, "8c301fb9c4fcf119d2730ccd2a565eb3", "gsptr30", false },
- { GID_SIMON2TALKIE, "72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2TALKIE, "9c535d403966750ae98bdaf698375a38", "simon2.gme", false },
- { GID_SIMON2TALKIE, "e229f84d46fa83f99b4a7115679f3fb6", "stripped.txt", false},
- { GID_SIMON2TALKIE, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2TALKIE2, "608e277904d87dd28725fa08eacc2c0d", "gsptr30", false },
- { GID_SIMON2TALKIE2, "72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2TALKIE2, "8d6dcc65577e285dbca03ff6d7d9323c", "simon2.gme", false },
- { GID_SIMON2TALKIE2, "e229f84d46fa83f99b4a7115679f3fb6", "stripped.txt", false},
- { GID_SIMON2TALKIE2, "a0d5a494b5d3d209d1a1d76cc8d76601", "tbllist", false},
-
- { GID_SIMON2TALKIE_FR, "43b3a04d2f0a0cbd1b024c814856561a", "gsptr30", false },
- { GID_SIMON2TALKIE_FR, "72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2TALKIE_FR, "8af0e02c0c3344db64dffc12196eb59d", "simon2.gme", false },
- { GID_SIMON2TALKIE_FR, "5ea27977b4d7dcfd50eb5074e162ebbf", "stripped.txt", false},
- { GID_SIMON2TALKIE_FR, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2TALKIE_DE, "0d05c3f4c06c9a4ceb3d2f5bc0b18e11", "gsptr30", false },
- { GID_SIMON2TALKIE_DE, "72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2TALKIE_DE, "6c5fdfdd0eab9038767c2d22858406b2", "simon2.gme", false },
- { GID_SIMON2TALKIE_DE, "6de6292c9ac11bfb2e70fdb0f773ba85", "stripped.txt", false},
- { GID_SIMON2TALKIE_DE, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2TALKIE_DE2,"a76ea940076b5d9316796dea225a9b69", "gsptr30", false },
- { GID_SIMON2TALKIE_DE2,"72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2TALKIE_DE2,"ec9f0f24fd895e7ea72e3c8e448c0240", "simon2.gme", false },
- { GID_SIMON2TALKIE_DE2,"6de6292c9ac11bfb2e70fdb0f773ba85", "stripped.txt", false},
- { GID_SIMON2TALKIE_DE2,"2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2TALKIE_HB, "952a2b1be23c3c609ba8d988a9a1627d", "gsptr30", false },
- { GID_SIMON2TALKIE_HB, "72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2TALKIE_HB, "a2b249a82ea182af09789eb95fb6c5be", "simon2.gme", false },
- { GID_SIMON2TALKIE_HB, "de9dbc24158660e153483fa0cf6c3172", "stripped.txt", false},
- { GID_SIMON2TALKIE_HB, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2TALKIE_IT, "3e11d400bea0638f360a724687005cd1", "gsptr30", false },
- { GID_SIMON2TALKIE_IT, "72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2TALKIE_IT, "344aca58e5ad5e25c517d5eb1d85c435", "simon2.gme", false },
- { GID_SIMON2TALKIE_IT, "bea6843fb9f3b2144fcb146d62db0b9a", "stripped.txt", false},
- { GID_SIMON2TALKIE_IT, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2TALKIE_ES, "268dc322aa73bcf27bb016b8e8ceb889", "gsptr30", false },
- { GID_SIMON2TALKIE_ES, "72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2TALKIE_ES, "4f43bd06b6cc78dbd25a7475ca964eb1", "simon2.gme", false },
- { GID_SIMON2TALKIE_ES, "d13753796bd81bf313a2449f34d8b112", "stripped.txt", false},
- { GID_SIMON2TALKIE_ES, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2WIN, "608e277904d87dd28725fa08eacc2c0d", "gsptr30", false },
- { GID_SIMON2WIN, "72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2WIN, "e749c4c103d7e7d51b34620ed76c5a04", "simon2.gme", false },
- { GID_SIMON2WIN, "e229f84d46fa83f99b4a7115679f3fb6", "stripped.txt", false},
- { GID_SIMON2WIN, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2WIN_DE, "a76ea940076b5d9316796dea225a9b69", "gsptr30", false },
- { GID_SIMON2WIN_DE, "72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2WIN_DE, "9609a933c541fed2e00c6c3479d7c181", "simon2.gme", false },
- { GID_SIMON2WIN_DE, "6de6292c9ac11bfb2e70fdb0f773ba85", "stripped.txt", false},
- { GID_SIMON2WIN_DE, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2WIN_DE2, "9e858b3bb189c134c3a5f34c3385a8d3", "gsptr30", false },
- { GID_SIMON2WIN_DE2, "ee92d1f84893195a60449f2430d07285", "icon.dat", false},
- { GID_SIMON2WIN_DE2, "16d574da07e93bcae43cee353dab8c7e", "simon2.gme", false },
- { GID_SIMON2WIN_DE2, "6de6292c9ac11bfb2e70fdb0f773ba85", "stripped.txt", false},
- { GID_SIMON2WIN_DE2, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_SIMON2WIN_PL, "657fd873f5d0637097ee02315b447e6f", "gsptr30", false },
- { GID_SIMON2WIN_PL, "72096a62d36e6034ea9fecc13b2dbdab", "icon.dat", false},
- { GID_SIMON2WIN_PL, "7b9afcf82a94722707e0d025c0192be8", "simon2.gme", false },
- { GID_SIMON2WIN_PL, "e229f84d46fa83f99b4a7115679f3fb6", "stripped.txt", false},
- { GID_SIMON2WIN_PL, "2082f8d02075e590300478853a91ffd9", "tbllist", false},
-
- { GID_FEEBLEFILES_2CD, "629762ea9ca9ee9ff85f4774d219f5c7", "game22", false },
- { GID_FEEBLEFILES_2CD, "0bbfee8e69739111eb36b0d138da8ddf", "tbllist", false},
-
- { GID_FEEBLEFILES_4CD, "a8746407a5b20a7da0da0a14c380af1c", "game22", false },
- { GID_FEEBLEFILES_4CD, "0bbfee8e69739111eb36b0d138da8ddf", "tbllist", false},
-
- { GID_FEEBLEFILES_DE, "bcd76ac080003eee3649df18db25b60e", "game22", false },
- { GID_FEEBLEFILES_DE, "0bbfee8e69739111eb36b0d138da8ddf", "tbllist", false},
-};
-
-// Simon the Sorcerer 1
-static GameFileDescription SIMON1CD32_GameFiles[] = {
- {"gameamiga", GAME_BASEFILE},
- {"icon.pkd", GAME_ICONFILE},
- {"stripped.txt", GAME_STRFILE},
- {"tbllist", GAME_TBLFILE},
-};
-
-static GameFileDescription SIMON1ACORN_GameFiles[] = {
- {"data", GAME_GMEFILE},
- {"gamebase", GAME_BASEFILE},
- {"icondata", GAME_ICONFILE},
- {"stripped", GAME_STRFILE},
- {"tbllist", GAME_TBLFILE},
-};
-
-static GameFileDescription SIMON1DEMO_GameFiles[] = {
- {"gdemo", GAME_BASEFILE},
- {"icon.dat", GAME_ICONFILE},
- {"stripped.txt", GAME_STRFILE},
- {"tbllist", GAME_TBLFILE},
-};
-
-static GameFileDescription SIMON1DOS_GameFiles[] = {
- {"gamepc", GAME_BASEFILE},
- {"icon.dat", GAME_ICONFILE},
- {"stripped.txt", GAME_STRFILE},
- {"tbllist", GAME_TBLFILE},
-};
-
-static GameFileDescription SIMON1_GameFiles[] = {
- {"gamepc", GAME_BASEFILE},
- {"icon.dat", GAME_ICONFILE},
- {"simon.gme", GAME_GMEFILE},
- {"stripped.txt", GAME_STRFILE},
- {"tbllist", GAME_TBLFILE},
-};
-
-// Simon the Sorcerer 2
-static GameFileDescription SIMON2DOS_GameFiles[] = {
- {"game32", GAME_BASEFILE},
- {"icon.dat", GAME_ICONFILE},
- {"simon2.gme", GAME_GMEFILE},
- {"stripped.txt", GAME_STRFILE},
- {"tbllist", GAME_TBLFILE},
-};
-
-static GameFileDescription SIMON2_GameFiles[] = {
- {"gsptr30", GAME_BASEFILE},
- {"icon.dat", GAME_ICONFILE},
- {"simon2.gme", GAME_GMEFILE},
- {"stripped.txt", GAME_STRFILE},
- {"tbllist", GAME_TBLFILE},
-};
-
-// The Feeble Files
-static GameFileDescription FEEBLEFILES_GameFiles[] = {
- {"game22", GAME_BASEFILE},
- {"tbllist", GAME_TBLFILE},
-};
-
-static GameDescription gameDescriptions[] = {
- // Simon the Sorcerer 1 - English Acorn CD Demo
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1ACORNDEMO,
- "Simon the Sorcerer 1 (English Acorn CD Demo)",
- ARRAYSIZE(SIMON1ACORN_GameFiles),
- SIMON1ACORN_GameFiles,
- GF_TALKIE,
- Common::EN_USA,
- Common::kPlatformAcorn,
- },
-
- // Simon the Sorcerer 1 - English Acorn CD
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1ACORN,
- "Simon the Sorcerer 1 (English Acorn CD)",
- ARRAYSIZE(SIMON1ACORN_GameFiles),
- SIMON1ACORN_GameFiles,
- GF_TALKIE,
- Common::EN_USA,
- Common::kPlatformAcorn,
- },
-
- // Simon the Sorcerer 1 - English AGA Floppy
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1AMIGA,
- "Simon the Sorcerer 1 (English Amiga AGA Floppy)",
- ARRAYSIZE(SIMON1CD32_GameFiles),
- SIMON1CD32_GameFiles,
- GF_CRUNCHED | GF_OLD_BUNDLE,
- Common::EN_USA,
- Common::kPlatformAmiga,
- },
-
- // Simon the Sorcerer 1 - French AGA Floppy
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1AMIGA_FR,
- "Simon the Sorcerer 1 (French Amiga AGA Floppy)",
- ARRAYSIZE(SIMON1CD32_GameFiles),
- SIMON1CD32_GameFiles,
- GF_CRUNCHED | GF_OLD_BUNDLE,
- Common::FR_FRA,
- Common::kPlatformAmiga,
- },
-
- // Simon the Sorcerer 1 - German AGA Floppy
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1AMIGA_DE,
- "Simon the Sorcerer 1 (German Amiga AGA Floppy)",
- ARRAYSIZE(SIMON1CD32_GameFiles),
- SIMON1CD32_GameFiles,
- GF_CRUNCHED | GF_OLD_BUNDLE,
- Common::DE_DEU,
- Common::kPlatformAmiga,
- },
-
- // Simon the Sorcerer 1 - English Amiga ECS Demo
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1AMIGADEMO,
- "Simon the Sorcerer 1 (English Amiga ECS Demo)",
- ARRAYSIZE(SIMON1CD32_GameFiles),
- SIMON1CD32_GameFiles,
- GF_CRUNCHED | GF_OLD_BUNDLE,
- Common::EN_USA,
- Common::kPlatformAmiga,
- },
-
- // Simon the Sorcerer 1 - English Amiga CD32
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1CD32,
- "Simon the Sorcerer 1 (English Amiga CD32)",
- ARRAYSIZE(SIMON1CD32_GameFiles),
- SIMON1CD32_GameFiles,
- GF_TALKIE | GF_OLD_BUNDLE,
- Common::EN_USA,
- Common::kPlatformAmiga,
- },
-
- // Simon the Sorcerer 1 - English Amiga CD32 alternative?
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1CD32_2,
- "Simon the Sorcerer 1 (English Amiga CD32)",
- ARRAYSIZE(SIMON1CD32_GameFiles),
- SIMON1CD32_GameFiles,
- GF_TALKIE | GF_OLD_BUNDLE,
- Common::EN_USA,
- Common::kPlatformAmiga,
- },
-
- // Simon the Sorcerer 1 - English DOS Floppy Demo
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1DEMO,
- "Simon the Sorcerer 1 (English DOS Floppy Demo)",
- ARRAYSIZE(SIMON1DEMO_GameFiles),
- SIMON1DEMO_GameFiles,
- GF_OLD_BUNDLE,
- Common::EN_USA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - English DOS Floppy
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1DOS,
- "Simon the Sorcerer 1 (English DOS Floppy)",
- ARRAYSIZE(SIMON1DOS_GameFiles),
- SIMON1DOS_GameFiles,
- GF_OLD_BUNDLE,
- Common::EN_USA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - English DOS Floppy with Russian patch
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1DOS_RU,
- "Simon the Sorcerer 1 (Russian DOS Floppy)",
- ARRAYSIZE(SIMON1DOS_GameFiles),
- SIMON1DOS_GameFiles,
- GF_OLD_BUNDLE,
- Common::RU_RUS,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - English DOS Floppy (Infocom)
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1DOS_INF,
- "Simon the Sorcerer 1 (English DOS Floppy)",
- ARRAYSIZE(SIMON1DOS_GameFiles),
- SIMON1DOS_GameFiles,
- GF_OLD_BUNDLE,
- Common::EN_USA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - English DOS Floppy (Infocom) with Russian patch
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1DOS_INF_RU,
- "Simon the Sorcerer 1 (Russian DOS Floppy)",
- ARRAYSIZE(SIMON1DOS_GameFiles),
- SIMON1DOS_GameFiles,
- GF_OLD_BUNDLE,
- Common::RU_RUS,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - French DOS Floppy
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1DOS_FR,
- "Simon the Sorcerer 1 (French DOS Floppy)",
- ARRAYSIZE(SIMON1DOS_GameFiles),
- SIMON1DOS_GameFiles,
- GF_OLD_BUNDLE,
- Common::FR_FRA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - German DOS Floppy
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1DOS_DE,
- "Simon the Sorcerer 1 (German DOS Floppy)",
- ARRAYSIZE(SIMON1DOS_GameFiles),
- SIMON1DOS_GameFiles,
- GF_OLD_BUNDLE,
- Common::DE_DEU,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - Italian DOS Floppy
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1DOS_IT,
- "Simon the Sorcerer 1 (Italian DOS Floppy)",
- ARRAYSIZE(SIMON1DOS_GameFiles),
- SIMON1DOS_GameFiles,
- GF_OLD_BUNDLE,
- Common::IT_ITA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - Spanish DOS Floppy
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1DOS_ES,
- "Simon the Sorcerer 1 (Spanish DOS Floppy)",
- ARRAYSIZE(SIMON1DOS_GameFiles),
- SIMON1DOS_GameFiles,
- GF_OLD_BUNDLE,
- Common::ES_ESP,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - English DOS CD
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1TALKIE,
- "Simon the Sorcerer 1 (English DOS CD)",
- ARRAYSIZE(SIMON1_GameFiles),
- SIMON1_GameFiles,
- GF_TALKIE,
- Common::EN_USA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - English DOS CD alternate?
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1TALKIE2,
- "Simon the Sorcerer 1 (English DOS CD)",
- ARRAYSIZE(SIMON1_GameFiles),
- SIMON1_GameFiles,
- GF_TALKIE,
- Common::EN_USA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - French DOS CD
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1TALKIE_FR,
- "Simon the Sorcerer 1 (French DOS CD)",
- ARRAYSIZE(SIMON1_GameFiles),
- SIMON1_GameFiles,
- GF_TALKIE,
- Common::FR_FRA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - German DOS CD
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1TALKIE_DE,
- "Simon the Sorcerer 1 (German DOS CD)",
- ARRAYSIZE(SIMON1_GameFiles),
- SIMON1_GameFiles,
- GF_TALKIE,
- Common::DE_DEU,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - Hebrew DOS CD
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1TALKIE_HB,
- "Simon the Sorcerer 1 (Hebrew DOS CD)",
- ARRAYSIZE(SIMON1_GameFiles),
- SIMON1_GameFiles,
- GF_TALKIE,
- Common::HB_ISR,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - Italian DOS CD
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1TALKIE_IT,
- "Simon the Sorcerer 1 (Italian DOS CD)",
- ARRAYSIZE(SIMON1_GameFiles),
- SIMON1_GameFiles,
- GF_TALKIE,
- Common::IT_ITA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - Spanish DOS CD
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1TALKIE_ES,
- "Simon the Sorcerer 1 (Spanish DOS CD)",
- ARRAYSIZE(SIMON1_GameFiles),
- SIMON1_GameFiles,
- GF_TALKIE,
- Common::ES_ESP,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 1 - English Windows CD
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1WIN,
- "Simon the Sorcerer 1 (English Windows CD)",
- ARRAYSIZE(SIMON1_GameFiles),
- SIMON1_GameFiles,
- GF_TALKIE,
- Common::EN_USA,
- Common::kPlatformWindows,
- },
-
- // Simon the Sorcerer 1 - German Windows CD
- {
- "simon1",
- GType_SIMON1,
- GID_SIMON1WIN_DE,
- "Simon the Sorcerer 1 (German Windows CD)",
- ARRAYSIZE(SIMON1_GameFiles),
- SIMON1_GameFiles,
- GF_TALKIE,
- Common::DE_DEU,
- Common::kPlatformWindows,
- },
-
- // Simon the Sorcerer 2 - English DOS Floppy
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2DOS,
- "Simon the Sorcerer 2 (English DOS Floppy)",
- ARRAYSIZE(SIMON2DOS_GameFiles),
- SIMON2DOS_GameFiles,
- 0,
- Common::EN_USA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 2 - English DOS Floppy with Russian patch
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2DOS_RU,
- "Simon the Sorcerer 2 (Russian DOS Floppy)",
- ARRAYSIZE(SIMON2DOS_GameFiles),
- SIMON2DOS_GameFiles,
- 0,
- Common::RU_RUS,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 2 - English DOS Floppy alternate?
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2DOS2,
- "Simon the Sorcerer 2 (English DOS Floppy)",
- ARRAYSIZE(SIMON2DOS_GameFiles),
- SIMON2DOS_GameFiles,
- 0,
- Common::EN_USA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 2 - English DOS Floppy alternate? with Russian patch
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2DOS2_RU,
- "Simon the Sorcerer 2 (Russian DOS Floppy)",
- ARRAYSIZE(SIMON2DOS_GameFiles),
- SIMON2DOS_GameFiles,
- 0,
- Common::RU_RUS,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 2 - Italian DOS Floppy
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2DOS_IT,
- "Simon the Sorcerer 2 (Italian DOS Floppy)",
- ARRAYSIZE(SIMON2DOS_GameFiles),
- SIMON2DOS_GameFiles,
- 0,
- Common::IT_ITA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 2 - English DOS CD Demo
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2DEMO,
- "Simon the Sorcerer 2 (English DOS CD Demo)",
- ARRAYSIZE(SIMON2_GameFiles),
- SIMON2_GameFiles,
- GF_TALKIE,
- Common::EN_USA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 2 - English DOS CD
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2TALKIE,
- "Simon the Sorcerer 2 (English DOS CD)",
- ARRAYSIZE(SIMON2_GameFiles),
- SIMON2_GameFiles,
- GF_TALKIE,
- Common::EN_USA,
- Common::kPlatformPC,
- },
-
-
- // Simon the Sorcerer 2 - English DOS CD alternate?
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2TALKIE2,
- "Simon the Sorcerer 2 (English DOS CD)",
- ARRAYSIZE(SIMON2_GameFiles),
- SIMON2_GameFiles,
- GF_TALKIE,
- Common::EN_USA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 2 - French DOS CD
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2TALKIE_FR,
- "Simon the Sorcerer 2 (French DOS CD)",
- ARRAYSIZE(SIMON2_GameFiles),
- SIMON2_GameFiles,
- GF_TALKIE,
- Common::FR_FRA,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 2 - German DOS CD
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2TALKIE_DE,
- "Simon the Sorcerer 2 (German DOS CD)",
- ARRAYSIZE(SIMON2_GameFiles),
- SIMON2_GameFiles,
- GF_TALKIE,
- Common::DE_DEU,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 2 - German DOS CD alternate?
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2TALKIE_DE2,
- "Simon the Sorcerer 2 (German DOS CD)",
- ARRAYSIZE(SIMON2_GameFiles),
- SIMON2_GameFiles,
- GF_TALKIE,
- Common::DE_DEU,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 2 - Hebrew DOS CD
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2TALKIE_HB,
- "Simon the Sorcerer 2 (Hebrew DOS CD)",
- ARRAYSIZE(SIMON2_GameFiles),
- SIMON2_GameFiles,
- GF_TALKIE,
- Common::HB_ISR,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 2 - Italian DOS CD
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2TALKIE_IT,
- "Simon the Sorcerer 2 (Italian DOS CD)",
- ARRAYSIZE(SIMON2_GameFiles),
- SIMON2_GameFiles,
- GF_TALKIE,
- Common::IT_ITA,
- // FIXME: DOS version which uses WAV format
- Common::kPlatformWindows,
- },
-
- // Simon the Sorcerer 2 - Spanish DOS CD
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2TALKIE_ES,
- "Simon the Sorcerer 2 (Spanish DOS CD)",
- ARRAYSIZE(SIMON2_GameFiles),
- SIMON2_GameFiles,
- GF_TALKIE,
- Common::ES_ESP,
- Common::kPlatformPC,
- },
-
- // Simon the Sorcerer 2 - English Windows CD
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2WIN,
- "Simon the Sorcerer 2 (English Windows CD)",
- ARRAYSIZE(SIMON2_GameFiles),
- SIMON2_GameFiles,
- GF_TALKIE,
- Common::EN_USA,
- Common::kPlatformWindows,
- },
-
- // Simon the Sorcerer 2 - German Windows CD
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2WIN_DE,
- "Simon the Sorcerer 2 (German Windows CD)",
- ARRAYSIZE(SIMON2_GameFiles),
- SIMON2_GameFiles,
- GF_TALKIE,
- Common::DE_DEU,
- Common::kPlatformWindows,
- },
-
- // Simon the Sorcerer 2 - German Windows CD 1.1
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2WIN_DE2,
- "Simon the Sorcerer 2 (German Windows CD)",
- ARRAYSIZE(SIMON2_GameFiles),
- SIMON2_GameFiles,
- GF_TALKIE,
- Common::DE_DEU,
- Common::kPlatformWindows,
- },
-
- // Simon the Sorcerer 2 - Polish Windows CD
- {
- "simon2",
- GType_SIMON2,
- GID_SIMON2WIN_PL,
- "Simon the Sorcerer 2 (Polish Windows CD)",
- ARRAYSIZE(SIMON2_GameFiles),
- SIMON2_GameFiles,
- GF_TALKIE,
- Common::PL_POL,
- Common::kPlatformWindows,
- },
-
- // The Feeble Files - English 2CD
- {
- "feeble",
- GType_FF,
- GID_FEEBLEFILES_2CD,
- "The Feeble Files (English 2CD)",
- ARRAYSIZE(FEEBLEFILES_GameFiles),
- FEEBLEFILES_GameFiles,
- GF_OLD_BUNDLE | GF_TALKIE,
- Common::EN_USA,
- Common::kPlatformWindows,
- },
-
- // The Feeble Files - English 4CD
- {
- "feeble",
- GType_FF,
- GID_FEEBLEFILES_4CD,
- "The Feeble Files (English 4CD)",
- ARRAYSIZE(FEEBLEFILES_GameFiles),
- FEEBLEFILES_GameFiles,
- GF_OLD_BUNDLE | GF_TALKIE,
- Common::EN_USA,
- Common::kPlatformWindows,
- },
-
- // The Feeble Files - German 4CD
- {
- "feeble",
- GType_FF,
- GID_FEEBLEFILES_DE,
- "The Feeble Files (German 4CD)",
- ARRAYSIZE(FEEBLEFILES_GameFiles),
- FEEBLEFILES_GameFiles,
- GF_OLD_BUNDLE | GF_TALKIE,
- Common::DE_DEU,
- Common::kPlatformWindows,
- },
-};
-
-bool SimonEngine::initGame(void) {
- int gameNumber;
- FSList dummy;
-
- if ((gameNumber = detectGame(dummy)) == -1) {
- warning("No valid games were found in the specified directory.");
- return false;
- }
-
- debug(0, "Running %s", gameDescriptions[gameNumber].title);
-
- _gameDescription = &gameDescriptions[gameNumber];
-
- return true;
-}
-
-DetectedGameList GAME_ProbeGame(const FSList &fslist, int **retmatches) {
- DetectedGameList detectedGames;
- int game_n;
- int index = 0, i, j;
- int matches[ARRAYSIZE(gameDescriptions)];
- bool mode = retmatches ? false : true;
-
- game_n = -1;
- for (i = 0; i < ARRAYSIZE(gameDescriptions); i++)
- matches[i] = -1;
-
- while (1) {
- game_n = detectGame(fslist, mode, game_n);
- if (game_n == -1)
- break;
- matches[index++] = game_n;
- }
-
- // We have some resource sets which are superpositions of other
- // Particularly it is ite-demo-linux vs ite-demo-win
- // Now remove lesser set if bigger matches too
-
- if (index > 1) {
- // Search max number
- int maxcount = 0;
- for (i = 0; i < index; i++) {
- int count = 0;
- for (j = 0; j < ARRAYSIZE(gameMD5); j++)
- if (gameMD5[j].id == gameDescriptions[matches[i]].gameId)
- count++;
- maxcount = MAX(maxcount, count);
- }
-
- // Now purge targets with number of files lesser than max
- for (i = 0; i < index; i++) {
- int count = 0;
- for (j = 0; j < ARRAYSIZE(gameMD5); j++)
- if (gameMD5[j].id == gameDescriptions[matches[i]].gameId)
- count++;
- if (count < maxcount) {
- debug(2, "Purged: %s", gameDescriptions[matches[i]].title);
- matches[i] = -1;
- }
- }
-
- }
-
- // and now push them into list of detected games
- for (i = 0; i < index; i++)
- if (matches[i] != -1)
- detectedGames.push_back(DetectedGame(gameDescriptions[matches[i]].toGameSettings(),
- gameDescriptions[matches[i]].language,
- gameDescriptions[matches[i]].platform));
-
- if (retmatches) {
- *retmatches = (int *)calloc(ARRAYSIZE(gameDescriptions), sizeof(int));
- for (i = 0; i < ARRAYSIZE(gameDescriptions); i++)
- (*retmatches)[i] = matches[i];
- }
-
- return detectedGames;
-}
-
-int detectGame(const FSList &fslist, bool mode, int start) {
- int game_count = ARRAYSIZE(gameDescriptions);
- int game_n = -1;
- typedef Common::Map<Common::String, Common::String> StringMap;
- StringMap filesMD5;
-
- typedef Common::Map<Common::String, bool> StringSet;
- StringSet filesList;
-
- uint16 file_count;
- uint16 file_n;
- Common::File test_file;
- bool file_missing;
-
- Common::String tstr, tstr1;
- char md5str[32+1];
- uint8 md5sum[16];
-
- // First we compose list of files which we need MD5s for
- for (int i = 0; i < ARRAYSIZE(gameMD5); i++) {
- tstr = Common::String(gameMD5[i].filename);
- tstr.toLowercase();
-
- if (gameMD5[i].caseSensitive && !mode)
- filesList[Common::String(gameMD5[i].filename)] = true;
- else
- filesList[tstr] = true;
- }
-
- if (mode) {
- // Now count MD5s for required files
- for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
- if (!file->isDirectory()) {
- tstr = file->displayName();
- // FIXME: there is a bug in String class. tstr1 = tstr; tstr.toLowercase()
- // makes tstr1 lowercase as well
- tstr1 = Common::String(file->displayName().c_str());
- tstr.toLowercase();
-
- if (filesList.contains(tstr) || filesList.contains(tstr1)) {
- if (Common::md5_file(file->path().c_str(), md5sum, NULL, FILE_MD5_BYTES)) {
- for (int j = 0; j < 16; j++) {
- sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
- }
- filesMD5[tstr] = Common::String(md5str);
- filesMD5[tstr1] = Common::String(md5str);
- }
- }
- }
- }
- } else {
- Common::File testFile;
-
- for (StringSet::const_iterator file = filesList.begin(); file != filesList.end(); ++file) {
- if (testFile.open(file->_key.c_str())) {
- testFile.close();
- if (Common::md5_file(file->_key.c_str(), md5sum, NULL, FILE_MD5_BYTES)) {
- for (int j = 0; j < 16; j++) {
- sprintf(md5str + j*2, "%02x", (int)md5sum[j]);
- }
- filesMD5[file->_key] = Common::String(md5str);
- }
- }
- }
- }
-
- for (game_n = start + 1; game_n < game_count; game_n++) {
- file_count = gameDescriptions[game_n].filesCount;
- file_missing = false;
-
- // Try to open all files for this game
- for (file_n = 0; file_n < file_count; file_n++) {
- tstr = gameDescriptions[game_n].filesDescriptions[file_n].fileName;
-
- if (!filesMD5.contains(tstr)) {
- file_missing = true;
- break;
- }
- }
-
- // Try the next game, couldn't find all files for the current
- // game
- if (file_missing) {
- continue;
- } else {
- bool match = true;
-
- debug(0, "Probing game: %s", gameDescriptions[game_n].title);
-
- for (int i = 0; i < ARRAYSIZE(gameMD5); i++) {
- if (gameMD5[i].id == gameDescriptions[game_n].gameId) {
- tstr = gameMD5[i].filename;
-
- if (strcmp(gameMD5[i].md5, filesMD5[tstr].c_str())) {
- match = false;
- break;
- }
- }
- }
- if (!match)
- continue;
-
- debug(0, "Found game: %s", gameDescriptions[game_n].title);
-
- return game_n;
- }
- }
-
- if (!filesMD5.isEmpty() && start == -1) {
- printf("MD5s of your game version are unknown. Please, report following data to\n");
- printf("ScummVM team along with your game name and version:\n");
-
- for (StringMap::const_iterator file = filesMD5.begin(); file != filesMD5.end(); ++file)
- printf("%s: %s\n", file->_key.c_str(), file->_value.c_str());
- }
-
- return -1;
-}
-
-} // End of namespace Simon
diff --git a/simon/icons.cpp b/simon/icons.cpp
deleted file mode 100644
index d9f7692e81..0000000000
--- a/simon/icons.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/stdafx.h"
-
-#include "common/file.h"
-
-#include "simon/simon.h"
-#include "simon/intern.h"
-
-namespace Simon {
-
-void SimonEngine::loadIconFile() {
- Common::File in;
- if (getPlatform() == Common::kPlatformAcorn)
- in.open("ICONDATA");
- else if (getPlatform() == Common::kPlatformAmiga)
- in.open("icon.pkd");
- else
- in.open("ICON.DAT");
- uint size;
-
- if (in.isOpen() == false)
- error("Can't open icons file 'ICON.DAT'");
-
- size = in.size();
-
- _iconFilePtr = (byte *)malloc(size);
- if (_iconFilePtr == NULL)
- error("Out of icon memory");
-
- in.read(_iconFilePtr, size);
- in.close();
-}
-
-// Thanks to Stuart Caie for providing the original
-// C conversion upon which this function is based.
-void decompress_icon_amiga (byte *dst, byte *src, byte base, uint pitch) {
- byte icon_pln[288];
- byte *i, *o, x, y;
-
- // Decode RLE planar icon data
- i = src;
- o = icon_pln;
- while (o < &icon_pln[288]) {
- x = *i++;
- if (x < 128) {
- do {
- *o++ = *i++;
- *o++ = *i++;
- *o++ = *i++;
- } while (x-- > 0);
- } else {
- x = 256 - x;
- do {
- *o++ = i[0];
- *o++ = i[1];
- *o++ = i[2];
- } while (x-- > 0);
- i += 3;
- }
- }
-
- // Translate planar data to chunky (very slow method)
- for (y = 0; y < 24; y++) {
- for (x = 0; x < 24; x++) {
- byte pixel =
- (icon_pln[(( y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 1 : 0)
- | (icon_pln[((24 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 2 : 0)
- | (icon_pln[((48 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 4 : 0)
- | (icon_pln[((72 + y) * 3) + (x >> 3)] & (1 << (7 - (x & 7))) ? 8 : 0);
- if (pixel)
- dst[x] = pixel | base;
- }
- dst += pitch;
- }
-}
-
-static void decompress_icon(byte *dst, byte *src, uint w, uint h_org, byte base, uint pitch) {
- int8 reps;
- byte color_1, color_2;
- byte *dst_org = dst;
- uint h = h_org;
-
- for (;;) {
- reps = *src++;
- if (reps < 0) {
- reps--;
- color_1 = *src >> 4;
- if (color_1 != 0)
- color_1 |= base;
- color_2 = *src++ & 0xF;
- if (color_2 != 0)
- color_2 |= base;
-
- do {
- if (color_1 != 0)
- *dst = color_1;
- dst += pitch;
- if (color_2 != 0)
- *dst = color_2;
- dst += pitch;
-
- // reached bottom?
- if (--h == 0) {
- // reached right edge?
- if (--w == 0)
- return;
- dst = ++dst_org;
- h = h_org;
- }
- } while (++reps != 0);
- } else {
- do {
- color_1 = *src >> 4;
- if (color_1 != 0)
- *dst = color_1 | base;
- dst += pitch;
-
- color_2 = *src++ & 0xF;
- if (color_2 != 0)
- *dst = color_2 | base;
- dst += pitch;
-
- // reached bottom?
- if (--h == 0) {
- // reached right edge?
- if (--w == 0)
- return;
- dst = ++dst_org;
- h = h_org;
- }
- } while (--reps >= 0);
- }
- }
-}
-
-
-void SimonEngine::draw_icon_c(FillOrCopyStruct *fcs, uint icon, uint x, uint y) {
- byte *dst;
- byte *src;
-
- _lockWord |= 0x8000;
- dst = dx_lock_2();
-
- if (!(getGameType() == GType_SIMON2)) {
- // Simon 1
- dst += (x + fcs->x) * 8;
- dst += (y * 25 + fcs->y) * _dxSurfacePitch;
-
- if (getPlatform() == Common::kPlatformAmiga) {
- src = _iconFilePtr;
- src += READ_BE_UINT32(&((uint32 *)src)[icon]);
- decompress_icon_amiga (dst, src, 0xE0, _dxSurfacePitch);
- } else {
- src = _iconFilePtr;
- src += READ_LE_UINT16(&((uint16 *)src)[icon]);
- decompress_icon(dst, src, 24, 12, 0xE0, _dxSurfacePitch);
- }
- } else {
- // Simon 2
- dst += 110;
- dst += x;
- dst += (y + fcs->y) * _dxSurfacePitch;
-
- src = _iconFilePtr;
- src += READ_LE_UINT16(&((uint16 *)src)[icon * 2 + 0]);
- decompress_icon(dst, src, 20, 10, 0xE0, _dxSurfacePitch);
-
- src = _iconFilePtr;
- src += READ_LE_UINT16(&((uint16 *)src)[icon * 2 + 1]);
- decompress_icon(dst, src, 20, 10, 0xD0, _dxSurfacePitch);
- }
-
- dx_unlock_2();
- _lockWord &= ~0x8000;
-}
-
-uint SimonEngine::setup_icon_hit_area(FillOrCopyStruct *fcs, uint x, uint y, uint icon_number,
- Item *item_ptr) {
- HitArea *ha;
-
- ha = findEmptyHitArea();
-
- if (!(getGameType() == GType_SIMON2)) {
- ha->x = (x + fcs->x) << 3;
- ha->y = y * 25 + fcs->y;
- ha->item_ptr = item_ptr;
- ha->width = 24;
- ha->height = 24;
- ha->flags = 0xB0;
- ha->id = 0x7FFD;
- ha->layer = 100;
- ha->unk3 = 0xD0;
- } else {
- ha->x = x + 110;
- ha->y = fcs->y + y;
- ha->item_ptr = item_ptr;
- ha->width = 20;
- ha->height = 20;
- ha->flags = 0xB0;
- ha->id = 0x7FFD;
- ha->layer = 100;
- ha->unk3 = 0xD0;
- }
-
- return ha - _hitAreas;
-}
-
-} // End of namespace Simon
diff --git a/simon/intern.h b/simon/intern.h
deleted file mode 100644
index aa60d0245f..0000000000
--- a/simon/intern.h
+++ /dev/null
@@ -1,217 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef SIMON_INTERN_H
-#define SIMON_INTERN_H
-
-namespace Simon {
-
-struct Child {
- Child *next;
- uint16 type;
-};
-
-struct Child1 : Child {
- uint16 subroutine_id;
- uint16 fr2;
- uint16 array[1];
-};
-
-struct Child2 : Child {
- uint16 string_id;
- uint32 avail_props;
- int16 array[1];
-};
-
-struct Child9 : Child {
- uint16 array[4];
-};
-
-enum {
- CHILD1_SIZE = sizeof(Child1) - sizeof(uint16),
- CHILD2_SIZE = sizeof(Child2) - sizeof(int16)
-};
-
-struct Item {
- uint16 parent;
- uint16 child;
- uint16 sibling;
- int16 noun;
- int16 adjective;
- int16 state; /* signed int */
- uint16 classFlags;
- Child *children;
-
- Item() { memset(this, 0, sizeof(*this)); }
-};
-
-struct Subroutine {
- uint16 id; /* subroutine ID */
- uint16 first; /* offset from subroutine start to first subroutine line */
- Subroutine *next; /* next subroutine in linked list */
-};
-
-struct FillOrCopyDataEntry {
- Item *item;
- uint16 hit_area;
- uint16 xxx_1;
-};
-
-struct FillOrCopyData {
- int16 unk1;
- Item *item_ptr;
- FillOrCopyDataEntry e[64];
- int16 upArrow, downArrow;
- uint16 unk2;
-};
-
-struct FillOrCopyStruct {
- byte mode;
- byte flags;
- uint16 x, y;
- uint16 width, height;
- uint16 textColumn, textRow;
- uint8 textColumnOffset, textLength, textMaxLength;
- uint8 fill_color, text_color, unk5;
- FillOrCopyData *fcs_data;
- FillOrCopyStruct() { memset(this, 0, sizeof(*this)); }
-};
-// note on text offset:
-// the actual x-coordinate is: textColumn * 8 + textColumnOffset
-// the actual y-coordinate is: textRow * 8
-
-
-enum {
- SUBROUTINE_LINE_SMALL_SIZE = 2,
- SUBROUTINE_LINE_BIG_SIZE = 8
-};
-
-struct SubroutineLine {
- uint16 next;
- int16 verb;
- int16 noun1;
- int16 noun2;
-};
-
-struct TimeEvent {
- uint32 time;
- uint16 subroutine_id;
- TimeEvent *next;
-};
-
-struct GameSpecificSettings {
-#ifndef PALMOS_68K
- const char *gme_filename;
- const char *wav_filename;
- const char *voc_filename;
- const char *mp3_filename;
- const char *vorbis_filename;
- const char *flac_filename;
- const char *voc_effects_filename;
- const char *mp3_effects_filename;
- const char *vorbis_effects_filename;
- const char *flac_effects_filename;
- const char *gamepc_filename;
- #else
- const char gme_filename[12];
- const char wav_filename[12];
- const char voc_filename[12];
- const char mp3_filename[12];
- const char flac_filename[12];
- const char vorbis_filename[12];
- const char voc_effects_filename[12];
- const char mp3_effects_filename[12];
- const char vorbis_effects_filename[12];
- const char flac_effects_filename[12];
- const char gamepc_filename[12];
- #endif
-};
-
-} // End of namespace Simon
-
-enum GameFeatures {
- GF_TALKIE = 1 << 0,
- GF_OLD_BUNDLE = 1 << 1,
- GF_CRUNCHED = 1 << 2
-};
-
-enum GameFileTypes {
- GAME_BASEFILE = 1 << 0,
- GAME_ICONFILE = 1 << 1,
- GAME_GMEFILE = 1 << 2,
- GAME_STRFILE = 1 << 3,
- GAME_TBLFILE = 1 << 4
-};
-
-enum GameIds {
- GID_SIMON1DOS,
- GID_SIMON1DOS_RU,
- GID_SIMON1DOS_INF,
- GID_SIMON1DOS_INF_RU,
- GID_SIMON1DOS_DE,
- GID_SIMON1DOS_FR,
- GID_SIMON1DOS_IT,
- GID_SIMON1DOS_ES,
- GID_SIMON1DEMO,
- GID_SIMON1AMIGA,
- GID_SIMON1AMIGA_FR,
- GID_SIMON1AMIGA_DE,
- GID_SIMON1AMIGADEMO,
- GID_SIMON1CD32,
- GID_SIMON1CD32_2,
- GID_SIMON1ACORN,
- GID_SIMON1ACORNDEMO,
- GID_SIMON1TALKIE,
- GID_SIMON1TALKIE2,
- GID_SIMON1TALKIE_DE,
- GID_SIMON1TALKIE_FR,
- GID_SIMON1TALKIE_HB,
- GID_SIMON1TALKIE_IT,
- GID_SIMON1TALKIE_ES,
- GID_SIMON1WIN,
- GID_SIMON1WIN_DE,
-
- GID_SIMON2DOS,
- GID_SIMON2DOS_RU,
- GID_SIMON2DOS2,
- GID_SIMON2DOS2_RU,
- GID_SIMON2DOS_IT,
- GID_SIMON2DEMO,
- GID_SIMON2TALKIE,
- GID_SIMON2TALKIE2,
- GID_SIMON2TALKIE_DE,
- GID_SIMON2TALKIE_DE2,
- GID_SIMON2TALKIE_FR,
- GID_SIMON2TALKIE_HB,
- GID_SIMON2TALKIE_IT,
- GID_SIMON2TALKIE_ES,
- GID_SIMON2WIN,
- GID_SIMON2WIN_DE,
- GID_SIMON2WIN_DE2,
- GID_SIMON2WIN_PL,
-
- GID_FEEBLEFILES_2CD,
- GID_FEEBLEFILES_4CD,
- GID_FEEBLEFILES_DE
-};
-
-#endif
diff --git a/simon/items.cpp b/simon/items.cpp
deleted file mode 100644
index d1df1aa82c..0000000000
--- a/simon/items.cpp
+++ /dev/null
@@ -1,1685 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-// Item script opcodes for Simon1/Simon2
-
-#include "common/stdafx.h"
-#include "simon/simon.h"
-#include "simon/intern.h"
-
-#include "common/system.h"
-
-#ifdef _WIN32_WCE
-extern bool isSmartphone(void);
-#endif
-
-namespace Simon {
-
-int SimonEngine::runScript() {
- byte opcode;
- bool flag, condition;
-
- do {
- if (_continousMainScript)
- dumpOpcode(_codePtr);
-
- opcode = getByte();
- if (opcode == 0xFF)
- return 0;
-
- if (_runScriptReturn1)
- return 1;
-
- /* Invert condition? */
- flag = false;
- if (opcode == 0) {
- flag = true;
- opcode = getByte();
- if (opcode == 0xFF)
- return 0;
- }
-
- condition = true;
-
- switch (opcode) {
- case 1:{ /* ptrA parent is */
- condition = (getItem1Ptr()->parent == getNextItemID());
- }
- break;
-
- case 2:{ /* ptrA parent is not */
- condition = (getItem1Ptr()->parent != getNextItemID());
- }
- break;
-
- case 5:{ /* parent is 1 */
- condition = (getNextItemPtr()->parent == getItem1ID());
- }
- break;
-
- case 6:{ /* parent isnot 1 */
- condition = (getNextItemPtr()->parent != getItem1ID());
- }
- break;
-
- case 7:{ /* parent is */
- Item *item = getNextItemPtr();
- condition = (item->parent == getNextItemID());
- }
- break;
-
- case 11:{ /* is zero */
- condition = (getNextVarContents() == 0);
- }
- break;
-
- case 12:{ /* isnot zero */
- condition = (getNextVarContents() != 0);
- }
- break;
-
- case 13:{ /* equal */
- uint tmp = getNextVarContents();
- condition = (tmp == getVarOrWord());
- }
- break;
-
- case 14:{ /* not equal */
- uint tmp = getNextVarContents();
- condition = (tmp != getVarOrWord());
- }
- break;
-
- case 15:{ /* is greater */
- uint tmp = getNextVarContents();
- condition = (tmp > getVarOrWord());
- }
- break;
-
- case 16:{ /* is less */
- uint tmp = getNextVarContents();
- condition = (tmp < getVarOrWord());
- }
- break;
-
- case 17:{ /* is eq f */
- uint tmp = getNextVarContents();
- condition = (tmp == getNextVarContents());
- }
- break;
-
- case 18:{ /* is not equal f */
- uint tmp = getNextVarContents();
- condition = (tmp != getNextVarContents());
- }
- break;
-
- case 19:{ /* is greater f */
- uint tmp = getNextVarContents();
- condition = (tmp < getNextVarContents());
- }
- break;
-
- case 20:{ /* is less f */
- uint tmp = getNextVarContents();
- condition = (tmp > getNextVarContents());
- }
- break;
-
- case 23:{
- condition = o_chance(getVarOrWord());
- }
- break;
-
- case 25:{ /* is room */
- condition = isRoom(getNextItemPtr());
- }
- break;
-
- case 26:{ /* is object */
- condition = isObject(getNextItemPtr());
- }
- break;
-
- case 27:{ /* item state is */
- Item *item = getNextItemPtr();
- condition = ((uint) item->state == getVarOrWord());
- }
- break;
-
- case 28:{ /* item has prop */
- Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
- byte num = getVarOrByte();
- condition = child != NULL && (child->avail_props & (1 << num)) != 0;
- } break;
-
- case 31:{ /* set no parent */
- setItemParent(getNextItemPtr(), NULL);
- }
- break;
-
- case 33:{ /* set item parent */
- Item *item = getNextItemPtr();
- setItemParent(item, getNextItemPtr());
- }
- break;
-
- case 36:{ /* copy var */
- uint value = getNextVarContents();
- writeNextVarContents(value);
- }
- break;
-
- case 41:{ /* zero var */
- writeNextVarContents(0);
- }
- break;
-
- case 42:{ /* set var */
- uint var = getVarOrByte();
- writeVariable(var, getVarOrWord());
- }
- break;
-
- case 43:{ /* add */
- uint var = getVarOrByte();
- writeVariable(var, readVariable(var) + getVarOrWord());
- }
- break;
-
- case 44:{ /* sub */
- uint var = getVarOrByte();
- writeVariable(var, readVariable(var) - getVarOrWord());
- }
- break;
-
- case 45:{ /* add f */
- uint var = getVarOrByte();
- writeVariable(var, readVariable(var) + getNextVarContents());
- }
- break;
-
- case 46:{ /* sub f */
- uint var = getVarOrByte();
- writeVariable(var, readVariable(var) - getNextVarContents());
- }
- break;
-
- case 47:{ /* mul */
- uint var = getVarOrByte();
- writeVariable(var, readVariable(var) * getVarOrWord());
- }
- break;
-
- case 48:{ /* div */
- uint var = getVarOrByte();
- int value = getVarOrWord();
- if (value == 0)
- error("Division by zero in div");
- writeVariable(var, readVariable(var) / value);
- }
- break;
-
- case 49:{ /* mul f */
- uint var = getVarOrByte();
- writeVariable(var, readVariable(var) * getNextVarContents());
- }
- break;
-
- case 50:{ /* div f */
- uint var = getVarOrByte();
- int value = getNextVarContents();
- if (value == 0)
- error("Division by zero in div f");
- writeVariable(var, readVariable(var) / value);
- }
- break;
-
- case 51:{ /* mod */
- uint var = getVarOrByte();
- int value = getVarOrWord();
- if (value == 0)
- error("Division by zero in mod");
- writeVariable(var, readVariable(var) % value);
- }
- break;
-
- case 52:{ /* mod f */
- uint var = getVarOrByte();
- int value = getNextVarContents();
- if (value == 0)
- error("Division by zero in mod f");
- writeVariable(var, readVariable(var) % value);
- }
- break;
-
- case 53:{ /* random */
- uint var = getVarOrByte();
- uint value = (uint16)getVarOrWord();
-
- // Disable random in simon1amiga for now
- // Since copy protection screen is currently unreadable
- if (getPlatform() == Common::kPlatformAmiga)
- writeVariable(var, 4);
- else
- writeVariable(var, _rnd.getRandomNumber(value - 1));
- }
- break;
-
- case 55:{ /* set itemA parent */
- setItemParent(getItem1Ptr(), getNextItemPtr());
- }
- break;
-
- case 56:{ /* set child2 fr bit */
- Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
- int value = getVarOrByte();
- if (child != NULL && value >= 0x10)
- child->avail_props |= 1 << value;
- }
- break;
-
- case 57:{ /* clear child2 fr bit */
- Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
- int value = getVarOrByte();
- if (child != NULL && value >= 0x10)
- child->avail_props &= ~(1 << value);
- }
- break;
-
- case 58:{ /* make siblings */
- Item *item = getNextItemPtr();
- setItemParent(item, derefItem(getNextItemPtr()->parent));
- }
- break;
-
- case 59:{ /* item inc state */
- Item *item = getNextItemPtr();
- if (item->state <= 30000)
- setItemState(item, item->state + 1);
- }
- break;
-
- case 60:{ /* item dec state */
- Item *item = getNextItemPtr();
- if (item->state >= 0)
- setItemState(item, item->state - 1);
- }
- break;
-
- case 61:{ /* item set state */
- Item *item = getNextItemPtr();
- int value = getVarOrWord();
- if (value < 0)
- value = 0;
- if (value > 30000)
- value = 30000;
- setItemState(item, value);
- }
- break;
-
- case 62:{ /* show int */
- showMessageFormat("%d", getNextVarContents());
- }
- break;
-
- case 63:{ /* show string nl */
- showMessageFormat("%s\n", getStringPtrByID(getNextStringID()));
- }
- break;
-
- case 64:{ /* show string */
- showMessageFormat("%s", getStringPtrByID(getNextStringID()));
- }
- break;
-
- case 65:{ /* add hit area */
- int id = getVarOrWord();
- int x = getVarOrWord();
- int y = getVarOrWord();
- int w = getVarOrWord();
- int h = getVarOrWord();
- int number = getVarOrByte();
- if (number < 20)
- addNewHitArea(id, x, y, w, h, (number << 8) + 129, 0xD0, _dummyItem2);
- }
- break;
-
- case 66:{ /* set item name */
- uint var = getVarOrByte();
- uint string_id = getNextStringID();
- if (var < 20)
- _stringIdArray2[var] = string_id;
- }
- break;
-
- case 67:{ /* set item description */
- uint var = getVarOrByte();
- uint string_id = getNextStringID();
- if (getFeatures() & GF_TALKIE) {
- uint speechId = getNextWord();
- if (var < 20) {
- _stringIdArray3[var] = string_id;
- _speechIdArray4[var] = speechId;
- }
- } else {
- if (var < 20) {
- _stringIdArray3[var] = string_id;
- }
- }
- }
- break;
-
- case 68:{ /* exit interpreter */
- shutdown();
- }
- break;
-
- case 69:{ /* return 1 */
- return 1;
- }
-
- case 70:{ /* show string from array */
- const char *str = (const char *)getStringPtrByID(_stringIdArray3[getVarOrByte()]);
-
- if (getGameType() == GType_SIMON2) {
- writeVariable(51, strlen(str) / 53 * 8 + 8);
- }
-
- showMessageFormat("%s\n", str);
- }
- break;
-
- case 71:{ /* start subroutine */
- Subroutine *sub = getSubroutineByID(getVarOrWord());
- if (sub != NULL)
- startSubroutine(sub);
- }
- break;
-
- case 76:{ /* add timeout */
- uint timeout = getVarOrWord();
- addTimeEvent(timeout, getVarOrWord());
- }
- break;
-
- case 77:{ /* has item minus 1 */
- condition = _subjectItem != NULL;
- }
- break;
-
- case 78:{ /* has item minus 3 */
- condition = _objectItem != NULL;
- }
- break;
-
- case 79:{ /* childstruct fr2 is */
- Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
- uint string_id = getNextStringID();
- condition = (child != NULL) && child->string_id == string_id;
- }
- break;
-
- case 80:{ /* item equal */
- condition = getNextItemPtr() == getNextItemPtr();
- }
- break;
-
- case 82:{ /* debug opcode */
- getVarOrByte();
- }
- break;
-
- case 83:{ /* restart subroutine */
- if (getGameType() == GType_SIMON2 || getGameType() == GType_FF)
- o_83_helper();
- return -10;
- }
-
- case 87:{ /* comment */
- getNextStringID();
- }
- break;
-
- case 88:{ /* stop animation */
- _lockWord |= 0x10;
- }
- break;
-
- case 89:{ /* restart animation */
- _lockWord &= ~0x10;
- }
- break;
-
- case 90:{ /* set minusitem to parent */
- Item *item = derefItem(getNextItemPtr()->parent);
- switch (getVarOrByte()) {
- case 0:
- _objectItem = item;
- break;
- case 1:
- _subjectItem = item;
- break;
- default:
- error("set minusitem to parent, invalid subcode");
- }
- }
- break;
-
- case 91:{ /* set minusitem to sibling */
- Item *item = derefItem(getNextItemPtr()->sibling);
- switch (getVarOrByte()) {
- case 0:
- _objectItem = item;
- break;
- case 1:
- _subjectItem = item;
- break;
- default:
- error("set minusitem to sibling, invalid subcode");
- }
- }
- break;
-
- case 92:{ /* set minusitem to child */
- Item *item = derefItem(getNextItemPtr()->child);
- switch (getVarOrByte()) {
- case 0:
- _objectItem = item;
- break;
- case 1:
- _subjectItem = item;
- break;
- default:
- error("set minusitem to child, invalid subcode");
- }
- }
- break;
-
- case 96:{
- uint val = getVarOrWord();
- o_set_video_mode(getVarOrByte(), val);
- }
- break;
-
- case 97:{ /* load vga */
- o_loadZone(getVarOrWord());
- }
- break;
-
- case 98:{ /* start vga */
- uint vga_res, vgaSpriteId, windowNum, x, y, palette;
- if (getGameType() == GType_SIMON1) {
- vgaSpriteId = getVarOrWord();
- vga_res = vgaSpriteId / 100;
- } else {
- vga_res = getVarOrWord();
- vgaSpriteId = getVarOrWord();
- }
- windowNum = getVarOrByte();
- x = getVarOrWord();
- y = getVarOrWord();
- palette = getVarOrWord();
- loadSprite(windowNum, vga_res, vgaSpriteId, x, y, palette);
- }
- break;
-
- case 99:{ /* kill sprite */
- if (getGameType() == GType_SIMON1) {
- o_kill_sprite_simon1(getVarOrWord());
- } else {
- uint a = getVarOrWord();
- uint b = getVarOrWord();
- o_kill_sprite_simon2(a, b);
- }
- }
- break;
-
- case 100:{ /* vga reset */
- o_vga_reset();
- }
- break;
-
- case 101:{
- uint a = getVarOrByte();
- uint b = getVarOrWord();
- uint c = getVarOrWord();
- uint d = getVarOrWord();
- uint e = getVarOrWord();
- uint f = getVarOrWord();
- uint g = getVarOrWord();
- o_defineWindow(a, b, c, d, e, f, g, 0);
- }
- break;
-
- case 102:{
- changeWindow(getVarOrByte() & 7);
- }
- break;
-
- case 103:{
- o_unk_103();
- }
- break;
-
- case 104:{
- closeWindow(getVarOrByte() & 7);
- }
- break;
-
- case 107:{ /* add item hitarea */
- uint flags = 0;
- uint id = getVarOrWord();
- uint params = id / 1000;
- uint x, y, w, h, unk3;
- Item *item;
-
- id = id % 1000;
-
- if (params & 1)
- flags |= 8;
- if (params & 2)
- flags |= 4;
- if (params & 4)
- flags |= 0x80;
- if (params & 8)
- flags |= 1;
- if (params & 16)
- flags |= 0x10;
-
- x = getVarOrWord();
- y = getVarOrWord();
- w = getVarOrWord();
- h = getVarOrWord();
- item = getNextItemPtrStrange();
- unk3 = getVarOrWord();
- if (x >= 1000) {
- unk3 += 0x4000;
- x -= 1000;
- }
- addNewHitArea(id, x, y, w, h, flags, unk3, item);
- }
- break;
-
- case 108:{ /* delete hitarea */
- delete_hitarea(getVarOrWord());
- }
- break;
-
- case 109:{ /* clear hitarea bit 0x40 */
- clear_hitarea_bit_0x40(getVarOrWord());
- }
- break;
-
- case 110:{ /* set hitarea bit 0x40 */
- set_hitarea_bit_0x40(getVarOrWord());
- }
- break;
-
- case 111:{ /* set hitarea xy */
- uint hitarea_id = getVarOrWord();
- uint x = getVarOrWord();
- uint y = getVarOrWord();
- set_hitarea_x_y(hitarea_id, x, y);
- }
- break;
-
- case 114:{
- Item *item = getNextItemPtr();
- uint fcs_index = getVarOrByte();
- mouseOff();
- drawIconArray(fcs_index, item, 0, 0);
- mouseOn();
- }
- break;
-
- case 115:{ /* item has flag */
- Item *item = getNextItemPtr();
- condition = (item->classFlags & (1 << getVarOrByte())) != 0;
- }
- break;
-
- case 116:{ /* item set flag */
- Item *item = getNextItemPtr();
- item->classFlags |= (1 << getVarOrByte());
- }
- break;
-
- case 117:{ /* item clear flag */
- Item *item = getNextItemPtr();
- item->classFlags &= ~(1 << getVarOrByte());
- }
- break;
-
- case 119:{ /* wait vga */
- uint var = getVarOrWord();
- _scriptVar2 = (var == 200);
-
- if (var != 200 || !_skipVgaWait)
- o_waitForSync(var);
- _skipVgaWait = false;
- }
- break;
-
- case 120:{
- o_sync(getVarOrWord());
- }
- break;
-
- case 121:{ /* set vga item */
- uint slot = getVarOrByte();
- _vcItemArray[slot] = getNextItemPtr();
- }
- break;
-
- case 122:{ /* oracle text down */
- if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2)
- goto invalid_opcode;
-
- warning("STUB: script opcode 122");
- }
- break;
-
- case 123:{ /* oracle text down */
- if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2)
- goto invalid_opcode;
-
- warning("STUB: script opcode 123");
- }
- break;
-
- case 124:{ /* if time */
- if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2)
- goto invalid_opcode;
-
- uint time = getVarOrWord();
- condition = 1;
- warning("STUB: script opcode 124 (%d)", time);
- }
- break;
-
- case 125:{ /* item is sibling with item 1 */
- Item *item = getNextItemPtr();
- condition = (getItem1Ptr()->parent == item->parent);
- }
- break;
-
- case 126:{
- Item *item = getNextItemPtr();
- uint fcs_index = getVarOrByte();
- uint a = 1 << getVarOrByte();
- mouseOff();
- drawIconArray(fcs_index, item, 1, a);
- mouseOn();
- }
- break;
-
- case 127:{ /* deals with music */
- o_playMusic();
- }
- break;
-
- case 128:{ /* dummy instruction */
- getVarOrWord();
- }
- break;
-
- case 129:{ /* dummy instruction */
- getVarOrWord();
- condition = true;
- }
- break;
-
- case 130:{ /* set adj noun */
- uint var = getVarOrByte();
- if (var == 1) {
- _scriptAdj1 = getNextWord();
- _scriptNoun1 = getNextWord();
- } else {
- _scriptAdj2 = getNextWord();
- _scriptNoun2 = getNextWord();
- }
- }
- break;
-
- case 132:{ /* save game */
- _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
- o_saveGame();
- _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
- }
- break;
-
- case 133:{ /* load game */
- if (getGameType() == GType_FF) {
- loadGame(readVariable(55));
- } else {
- _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
- o_loadGame();
- _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
- }
- }
- break;
-
- case 134:{ /* dummy opcode? */
- if (getGameType() == GType_FF) {
- warning("STUB: script opcode 134");
- } else {
- midi.stop();
- _lastMusicPlayed = -1;
- }
- }
- break;
-
- case 135:{ /* quit if user presses y */
- if (getGameType() == GType_FF) {
- // Switch CD
- debug(1, "Switch to CD number %d", readVariable(97));
- } else {
- _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
- o_confirmQuit();
- _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
- }
- }
- break;
-
- case 136:{ /* set var to item unk3 */
- Item *item = getNextItemPtr();
- writeNextVarContents(item->state);
- }
- break;
-
- case 137:{
- o_restoreIconArray(getVarOrByte());
- }
- break;
-
- case 138:{ /* vga pointer op 4 */
- o_freezeBottom();
- }
- break;
-
- case 139:{ /* set parent special */
- Item *item = getNextItemPtr();
- _noParentNotify = true;
- setItemParent(item, getNextItemPtr());
- _noParentNotify = false;
- }
- break;
-
- case 140:{ /* del te and add one */
- killAllTimers();
- addTimeEvent(3, 0xA0);
- }
- break;
-
- case 141:{ /* set m1 or m3 */
- uint which = getVarOrByte();
- Item *item = getNextItemPtr();
- if (which == 1) {
- _subjectItem = item;
- } else {
- _objectItem = item;
- }
- }
- break;
-
- case 142:{ /* is hitarea 0x40 clear */
- condition = is_hitarea_0x40_clear(getVarOrWord());
- }
- break;
-
- case 143:{ /* start item sub */
- Child1 *child = (Child1 *)findChildOfType(getNextItemPtr(), 1);
- if (child != NULL) {
- Subroutine *sub = getSubroutineByID(child->subroutine_id);
- if (sub)
- startSubroutine(sub);
- }
- }
- break;
-
- case 151:{ /* set array6 to item */
- uint var = getVarOrByte();
- Item *item = getNextItemPtr();
- _itemArray6[var] = item;
- }
- break;
-
- case 152:{ /* set m1 or m3 to array6 */
- Item *item = _itemArray6[getVarOrByte()];
- uint var = getVarOrByte();
- if (var == 1) {
- _subjectItem = item;
- } else {
- _objectItem = item;
- }
- }
- break;
-
- case 153:{ /* set bit */
- uint bit = getVarOrByte();
- _bitArray[bit / 16] |= 1 << (bit & 15);
- break;
- }
-
- case 154:{ /* clear bit */
- uint bit = getVarOrByte();
- _bitArray[bit / 16] &= ~(1 << (bit & 15));
- break;
- }
-
- case 155:{ /* is bit clear */
- uint bit = getVarOrByte();
- condition = (_bitArray[bit / 16] & (1 << (bit & 15))) == 0;
- }
- break;
-
- case 156:{ /* is bit set */
- uint bit = getVarOrByte();
- if (getGameType() == GType_SIMON1 && _subroutine == 2962 && bit == 63) {
- bit = 50;
- }
- condition = (_bitArray[bit / 16] & (1 << (bit & 15))) != 0;
- }
- break;
-
- case 157:{ /* get item int prop */
- Item *item = getNextItemPtr();
- Child2 *child = (Child2 *)findChildOfType(item, 2);
- uint prop = getVarOrByte();
-
- if (child != NULL && child->avail_props & (1 << prop) && prop < 16) {
- uint offs = getOffsetOfChild2Param(child, 1 << prop);
- writeNextVarContents(child->array[offs]);
- } else {
- writeNextVarContents(0);
- }
- }
- break;
-
- case 158:{ /* set item prop */
- Item *item = getNextItemPtr();
- Child2 *child = (Child2 *)findChildOfType(item, 2);
- uint prop = getVarOrByte();
- int value = getVarOrWord();
-
- if (child != NULL && child->avail_props & (1 << prop) && prop < 16) {
- uint offs = getOffsetOfChild2Param(child, 1 << prop);
- child->array[offs] = value;
- }
- }
- break;
-
- case 160:{
- o_unk_160(getVarOrByte());
- }
- break;
-
- case 161:{ /* setup text */
- TextLocation *tl = getTextLocation(getVarOrByte());
-
- tl->x = getVarOrWord();
- tl->y = getVarOrByte();
- tl->width = getVarOrWord();
- }
- break;
-
- case 162:{ /* print string */
- o_printStr();
- }
- break;
-
- case 163:{ /* play sound */
- o_playSFX(getVarOrWord());
- }
- break;
-
- case 164:{
- _showPreposition = true;
- o_setup_cond_c();
- _showPreposition = false;
- }
- break;
-
- case 165:{ /* item unk1 unk2 is */
- Item *item = getNextItemPtr();
- int16 a = getNextWord(), b = getNextWord();
- condition = (item->adjective == a && item->noun == b);
- } break;
-
- case 166:{ /* set bit2 */
- uint bit = getVarOrByte();
- _bitArray[(bit / 16) + 16] |= 1 << (bit & 15);
- }
- break;
-
- case 167:{ /* clear bit2 */
- uint bit = getVarOrByte();
- _bitArray[(bit / 16) + 16] &= ~(1 << (bit & 15));
- }
- break;
-
- case 168:{ /* is bit2 clear */
- uint bit = getVarOrByte();
- condition = (_bitArray[(bit / 16) + 16] & (1 << (bit & 15))) == 0;
- }
- break;
-
- case 169:{ /* is bit2 set */
- uint bit = getVarOrByte();
- condition = (_bitArray[(bit / 16) + 16] & (1 << (bit & 15))) != 0;
- }
- break;
-
- case 175:{ /* vga pointer op 1 */
- o_lockZone();
- }
- break;
-
- case 176:{ /* vga pointer op 2 */
- o_unlockZone();
- }
- break;
-
- case 177:{ /* inventory descriptions */
- o_inventory_descriptions();
- }
- break;
-
- case 178:{ /* path find */
- uint a = getVarOrWord();
- uint b = getVarOrWord();
- uint c = getVarOrByte();
- uint d = getVarOrByte();
- o_pathfind(a, b, c, d);
- }
- break;
-
- case 179:{ /* conversation responses */
- uint vgaSpriteId = getVarOrByte(); /* and room descriptions */
- uint color = getVarOrByte();
- uint string_id = getVarOrByte();
- uint speechId = 0;
-
- const char *string_ptr = (const char *)getStringPtrByID(_stringIdArray3[string_id]);
- TextLocation *tl = getTextLocation(vgaSpriteId);
- if (getFeatures() & GF_TALKIE)
- speechId = _speechIdArray4[string_id];
-
- if (_speech && speechId != 0)
- playSpeech(speechId, vgaSpriteId);
- if (string_ptr != NULL && _subtitles)
- printText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
- }
- break;
-
- case 180:{ /* force mouseOn */
- o_mouseOn();
- }
- break;
-
- case 181:{ /* force mouseOff */
- o_mouseOff();
- if (getGameType() == GType_SIMON2) {
- changeWindow(1);
- showMessageFormat("\xC");
- }
- }
- break;
-
- case 182:{ /* load beard */
- if (getGameType() == GType_FF) {
- // Load video file
- debug(1,"Load video file: %s", getStringPtrByID(getNextStringID()));
- } else if (getGameType() == GType_SIMON2) {
- goto invalid_opcode;
- } else {
- o_loadBeard();
- }
- }
- break;
-
- case 183:{ /* unload beard */
- if (getGameType() == GType_FF) {
- // Play video
- debug(1, "Play video");
- } else if (getGameType() == GType_SIMON2) {
- goto invalid_opcode;
- } else {
- o_unloadBeard();
- }
- }
- break;
-
- case 184:{ /* clear vgapointer entry */
- o_unloadZone(getVarOrWord());
- }
- break;
-
- case 185:{ /* load sound files */
- if (getGameType() == GType_SIMON2)
- goto invalid_opcode;
-
- _soundFileId = getVarOrWord();
- if (getPlatform() == Common::kPlatformAmiga && getFeatures() & GF_TALKIE) {
- char buf[10];
- sprintf(buf, "%d%s", _soundFileId, "Effects");
- _sound->readSfxFile(buf);
- sprintf(buf, "%d%s", _soundFileId, "simon");
- _sound->readVoiceFile(buf);
- }
-
- }
- break;
-
- case 186:{ /* vga pointer op 3 */
- o_unfreezeBottom();
- }
- break;
-
- case 187:{ /* fade to black */
- if (getGameType() == GType_SIMON2)
- goto invalid_opcode;
- o_fadeToBlack();
- }
- break;
-
- case 188: /* string2 is */
- if (getGameType() == GType_SIMON1)
- goto invalid_opcode;
- {
- uint i = getVarOrByte();
- uint str = getNextStringID();
- condition = (str < 20 && _stringIdArray2[i] == str);
- }
- break;
-
- case 189:{ /* clear_op189_flag */
- if (getGameType() == GType_SIMON1)
- goto invalid_opcode;
- _marks = 0;
- }
- break;
-
- case 190:{
- uint i;
- if (getGameType() == GType_SIMON1)
- goto invalid_opcode;
- i = getVarOrByte();
- if (!(_marks & (1 << i)))
- o_waitForMark(i);
- }
- break;
-
- // Feeble opcodes
- case 191:
- if (_bitArray[5] & 0x0008) {
- _PVCount1 = 0;
- _GPVCount1 = 0;
- } else {
- _PVCount = 0;
- _GPVCount = 0;
- }
- break;
-
- case 192:{
- uint8 a = getVarOrByte();
- uint8 b = getVarOrByte();
- uint8 c = getVarOrByte();
- uint8 d = getVarOrByte();
- if (_bitArray[5] & 0x0008) {
- _pathValues1[_PVCount1++] = a;
- _pathValues1[_PVCount1++] = b;
- _pathValues1[_PVCount1++] = c;
- _pathValues1[_PVCount1++] = d;
- } else {
- _pathValues[_PVCount++] = a;
- _pathValues[_PVCount++] = b;
- _pathValues[_PVCount++] = c;
- _pathValues[_PVCount++] = d;
- }
- }
- break;
-
- case 193:
- // pause clock
- warning("STUB: script opcode 193");
- break;
-
- case 194:
- // resume clock
- warning("STUB: script opcode 194");
- break;
-
- case 195:{
- // Set palette colour?
- uint blue = getVarOrByte();
- uint green = getVarOrByte();
- uint red = getVarOrByte();
- uint color = getVarOrByte();
- warning("STUB: script opcode 195 (%d, %d, %d, %d)", blue, green, red, color);
- }
- break;
-
- case 196:{ /* set bit3 */
- uint bit = getVarOrByte();
- _bitArray[(bit / 16) + 32] |= 1 << (bit & 15);
- }
- break;
-
- case 197:{ /* clear bit3 */
- uint bit = getVarOrByte();
- _bitArray[(bit / 16) + 32] &= ~(1 << (bit & 15));
- }
- break;
-
- case 198:{ /* is bit3 clear */
- uint bit = getVarOrByte();
- condition = (_bitArray[(bit / 16) + 32] & (1 << (bit & 15))) == 0;
- }
- break;
-
- case 199:{ /* is bit3 set */
- uint bit = getVarOrByte();
- condition = (_bitArray[(bit / 16) + 32] & (1 << (bit & 15))) != 0;
- }
- break;
-
- default:
- invalid_opcode:;
- error("Invalid opcode '%d'", opcode);
- }
-
- } while (condition != flag);
-
- return 0;
-}
-
-int SimonEngine::startSubroutine(Subroutine *sub) {
- int result = -1;
- SubroutineLine *sl;
- const byte *old_code_ptr;
-
- if (_startMainScript)
- dumpSubroutine(sub);
-
- old_code_ptr = _codePtr;
-
- if (++_recursionDepth > 40)
- error("Recursion error");
-
- sl = (SubroutineLine *)((byte *)sub + sub->first);
-
- while ((byte *)sl != (byte *)sub) {
- if (checkIfToRunSubroutineLine(sl, sub)) {
- result = 0;
- _codePtr = (byte *)sl;
- if (sub->id)
- _codePtr += 2;
- else
- _codePtr += 8;
-
- if (_continousMainScript)
- fprintf(_dumpFile, "; %d\n", sub->id);
- result = runScript();
- if (result != 0) {
- /* result -10 means restart subroutine */
- if (result == -10) {
- delay(0); /* maybe leave control to the VGA */
- sl = (SubroutineLine *)((byte *)sub + sub->first);
- continue;
- }
- break;
- }
- }
- sl = (SubroutineLine *)((byte *)sub + sl->next);
- }
-
- _codePtr = old_code_ptr;
-
- _recursionDepth--;
- return result;
-}
-
-int SimonEngine::startSubroutineEx(Subroutine *sub) {
- return startSubroutine(sub);
-}
-
-bool SimonEngine::checkIfToRunSubroutineLine(SubroutineLine *sl, Subroutine *sub) {
- if (sub->id)
- return true;
-
- if (sl->verb != -1 && sl->verb != _scriptVerb &&
- (sl->verb != -2 || _scriptVerb != -1))
- return false;
-
- if (sl->noun1 != -1 && sl->noun1 != _scriptNoun1 &&
- (sl->noun1 != -2 || _scriptNoun1 != -1))
- return false;
-
- if (sl->noun2 != -1 && sl->noun2 != _scriptNoun2 &&
- (sl->noun2 != -2 || _scriptNoun2 != -1))
- return false;
-
- return true;
-}
-
-void SimonEngine::o_83_helper() {
- if (_exitCutscene) {
- if (vcGetBit(9)) {
- endCutscene();
- }
- } else {
- processSpecialKeys();
- }
-}
-
-void SimonEngine::o_waitForMark(uint i) {
- _exitCutscene = false;
- while (!(_marks & (1 << i))) {
- if (_exitCutscene) {
- if (vcGetBit(9)) {
- endCutscene();
- break;
- }
- } else {
- processSpecialKeys();
- }
-
- delay(10);
- }
-}
-
-
-bool SimonEngine::o_chance(uint a) {
- if (a == 0)
- return 0;
-
- if (a == 100)
- return 1;
-
- a += _scriptUnk1;
- if (a <= 0) {
- _scriptUnk1 = 0;
- return 0;
- }
-
- if ((uint)_rnd.getRandomNumber(99) < a) {
- if (_scriptUnk1 <= 0)
- _scriptUnk1 -= 5;
- else
- _scriptUnk1 = 0;
- return 1;
- }
-
- if (_scriptUnk1 >= 0)
- _scriptUnk1 += 5;
- else
- _scriptUnk1 = 0;
-
- return 0;
-}
-
-void SimonEngine::o_inventory_descriptions() {
- uint vgaSpriteId = getVarOrByte();
- uint color = getVarOrByte();
- const char *string_ptr = NULL;
- TextLocation *tl = NULL;
- char buf[256];
-
- Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
- if (child != NULL && child->avail_props & 1) {
- string_ptr = (const char *)getStringPtrByID(child->array[0]);
- tl = getTextLocation(vgaSpriteId);
- }
-
- if ((getGameType() == GType_SIMON2) && (getFeatures() & GF_TALKIE)) {
- if (child != NULL && child->avail_props & 0x200) {
- uint speechId = child->array[getOffsetOfChild2Param(child, 0x200)];
-
- if (child->avail_props & 0x100) {
- uint speechIdOffs = child->array[getOffsetOfChild2Param(child, 0x100)];
-
- if (speechId == 116)
- speechId = speechIdOffs + 115;
- if (speechId == 92)
- speechId = speechIdOffs + 98;
- if (speechId == 99)
- speechId = 9;
- if (speechId == 97) {
- switch (speechIdOffs) {
- case 12:
- speechId = 109;
- break;
- case 14:
- speechId = 108;
- break;
- case 18:
- speechId = 107;
- break;
- case 20:
- speechId = 106;
- break;
- case 22:
- speechId = 105;
- break;
- case 28:
- speechId = 104;
- break;
- case 90:
- speechId = 103;
- break;
- case 92:
- speechId = 102;
- break;
- case 100:
- speechId = 51;
- break;
- default:
- error("o_177: invalid case %d", speechIdOffs);
- }
- }
- }
-
- if (_speech)
- playSpeech(speechId, vgaSpriteId);
- }
-
- } else if (getFeatures() & GF_TALKIE) {
- if (child != NULL && child->avail_props & 0x200) {
- uint offs = getOffsetOfChild2Param(child, 0x200);
- playSpeech(child->array[offs], vgaSpriteId);
- } else if (child != NULL && child->avail_props & 0x100) {
- uint offs = getOffsetOfChild2Param(child, 0x100);
- playSpeech(child->array[offs] + 3550, vgaSpriteId);
- }
- }
-
- if (child != NULL && (child->avail_props & 1) && _subtitles) {
- if (child->avail_props & 0x100) {
- sprintf(buf, "%d%s", child->array[getOffsetOfChild2Param(child, 0x100)], string_ptr);
- string_ptr = buf;
- }
- if (string_ptr != NULL)
- printText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
- }
-}
-
-void SimonEngine::o_confirmQuit() {
- // If all else fails, use English as fallback.
- byte keyYes = 'y';
- byte keyNo = 'n';
-
- switch (_language) {
- case Common::RU_RUS:
- break;
- case Common::PL_POL:
- keyYes = 't';
- break;
- case Common::HB_ISR:
- keyYes = 'f';
- break;
- case Common::ES_ESP:
- keyYes = 's';
- break;
- case Common::IT_ITA:
- keyYes = 's';
- break;
- case Common::FR_FRA:
- keyYes = 'o';
- break;
- case Common::DE_DEU:
- keyYes = 'j';
- break;
- default:
- break;
- }
-
- for (;;) {
- delay(1);
-#ifdef _WIN32_WCE
- if (isSmartphone()) {
- if (_keyPressed) {
- if (_keyPressed == 13)
- shutdown();
- else
- break;
- }
- }
-#endif
- if (_keyPressed == keyYes)
- shutdown();
- else if (_keyPressed == keyNo)
- break;
- }
-}
-
-void SimonEngine::o_restoreIconArray(uint fcs_index) {
- FillOrCopyStruct *fcs;
-
- fcs = _windowArray[fcs_index & 7];
- if (fcs->fcs_data == NULL)
- return;
- drawIconArray(fcs_index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1, fcs->fcs_data->unk2);
-}
-
-void SimonEngine::o_freezeBottom() {
- _vgaBufStart = _vgaBufFreeStart;
- _vgaFileBufOrg = _vgaBufFreeStart;
-}
-
-void SimonEngine::o_unfreezeBottom() {
- _vgaBufFreeStart = _vgaFileBufOrg2;
- _vgaBufStart = _vgaFileBufOrg2;
- _vgaFileBufOrg = _vgaFileBufOrg2;
-}
-
-void SimonEngine::o_lockZone() {
- _vgaBufStart = _vgaBufFreeStart;
-}
-
-void SimonEngine::o_unlockZone() {
- _vgaBufFreeStart = _vgaFileBufOrg;
- _vgaBufStart = _vgaFileBufOrg;
-}
-
-int SimonEngine::o_unk_132_helper(bool *b, char *buf) {
- HitArea *ha;
- *b = true;
-
- if (!_saveLoadFlag) {
- strange_jump:;
- _saveLoadFlag = false;
- saveGameDialog(buf);
- }
-
-start_over:;
- _keyPressed = 0;
-
-start_over_2:;
- _lastHitArea = _lastHitArea3 = 0;
-
- do {
- if (_keyPressed != 0) {
- if (_saveLoadFlag) {
- *b = false;
- return _keyPressed;
- }
- goto start_over;
- }
- delay(100);
- } while (_lastHitArea3 == 0);
-
- ha = _lastHitArea;
-
- if (ha == NULL || ha->id < 205)
- goto start_over_2;
-
- if (ha->id == 205)
- return ha->id;
-
- if (ha->id == 206) {
- if (_saveLoadRowCurPos == 1)
- goto start_over_2;
- if (_saveLoadRowCurPos < 7)
- _saveLoadRowCurPos = 1;
- else
- _saveLoadRowCurPos -= 6;
-
- goto strange_jump;
- }
-
- if (ha->id == 207) {
- if (!_saveDialogFlag)
- goto start_over_2;
- _saveLoadRowCurPos += 6;
- if (_saveLoadRowCurPos >= _numSaveGameRows)
- _saveLoadRowCurPos = _numSaveGameRows;
- goto strange_jump;
- }
-
- if (ha->id >= 214)
- goto start_over_2;
- return ha->id - 208;
-}
-
-void SimonEngine::o_unk_132_helper_3() {
- for (int i = 208; i != 208 + 6; i++)
- set_hitarea_bit_0x40(i);
-}
-
-void SimonEngine::o_clearCharacter(FillOrCopyStruct *fcs, int x, byte b) {
- byte old_text;
-
- video_putchar(fcs, x, b);
- old_text = fcs->text_color;
- fcs->text_color = fcs->fill_color;
-
- if (_language == Common::HB_ISR) { //Hebrew
- x = 128;
- } else {
- x += 120;
- if (x != 128)
- x = 129;
-
- }
-
- video_putchar(fcs, x);
-
- fcs->text_color = old_text;
- video_putchar(fcs, 8);
-}
-
-void SimonEngine::o_playMusic() {
- int music = getVarOrWord();
- int track = getVarOrWord();
-
- // Jamieson630:
- // This appears to be a "load or play music" command.
- // The music resource is specified, and optionally
- // a track as well. Normally we see two calls being
- // made, one to load the resource and another to
- // actually start a track (so the resource is
- // effectively preloaded so there's no latency when
- // starting playback).
- if (getGameType() == GType_SIMON2) {
- int loop = getVarOrByte();
-
- midi.setLoop (loop != 0);
- if (_lastMusicPlayed != music)
- _nextMusicToPlay = music;
- else
- midi.startTrack (track);
- } else {
- if (music != _lastMusicPlayed) {
- _lastMusicPlayed = music;
- loadMusic (music);
- midi.startTrack (track);
- }
- }
-}
-
-void SimonEngine::o_sync(uint a) {
- uint16 id = to16Wrapper(a);
- _lockWord |= 0x8000;
- _vcPtr = (byte *)&id;
- vc15_wakeup_id();
- _lockWord &= ~0x8000;
-}
-
-void SimonEngine::o_playSFX(uint sound_id) {
- if (getGameId() == GID_SIMON1DOS)
- playSting(sound_id);
- else
- _sound->playEffects(sound_id);
-}
-
-void SimonEngine::o_unk_160(uint a) {
- fcs_setTextColor(_windowArray[_curWindow], a);
-}
-
-void SimonEngine::o_unk_103() {
- mouseOff();
- removeIconArray(_curWindow);
- if (getGameType() == GType_FF)
- showMessageFormat("\x0E");
- else
- showMessageFormat("\x0C");
- mouseOn();
-}
-
-void SimonEngine::o_kill_sprite_simon1(uint a) {
- uint16 b = to16Wrapper(a);
- _lockWord |= 0x8000;
- _vcPtr = (byte *)&b;
- vc60_killSprite();
- _lockWord &= ~0x8000;
-}
-
-void SimonEngine::o_kill_sprite_simon2(uint a, uint b) {
- uint16 items[2];
-
- items[0] = to16Wrapper(a);
- items[1] = to16Wrapper(b);
-
- _lockWord |= 0x8000;
- _vcPtr = (byte *)&items;
- vc60_killSprite();
- _lockWord &= ~0x8000;
-}
-
-/* OK */
-void SimonEngine::o_defineWindow(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h) {
- a &= 7;
-
- if (_windowArray[a])
- closeWindow(a);
-
- _windowArray[a] = openWindow(b, c, d, e, f, g, h);
-
- if (a == _curWindow) {
- _textWindow = _windowArray[a];
- showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
- }
-}
-
-} // End of namespace Simon
diff --git a/simon/midi.cpp b/simon/midi.cpp
deleted file mode 100644
index 915bc7108f..0000000000
--- a/simon/midi.cpp
+++ /dev/null
@@ -1,546 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-
-#include "common/stdafx.h"
-#include "common/scummsys.h"
-#include "common/system.h"
-#include "common/file.h"
-#include "sound/mixer.h"
-#include "simon/simon.h"
-
-namespace Simon {
-
-
-// MidiParser_S1D is not considered part of the standard
-// MidiParser suite, but we still try to mask its details
-// and just provide a factory function.
-extern MidiParser *MidiParser_createS1D();
-
-MidiPlayer::MidiPlayer(OSystem *system) {
- // Since initialize() is called every time the music changes,
- // this is where we'll initialize stuff that must persist
- // between songs.
- _driver = 0;
- _map_mt32_to_gm = false;
- _passThrough = false;
-
- _enable_sfx = true;
- _current = 0;
-
- _masterVolume = 255;
- resetVolumeTable();
- _paused = false;
-
- _currentTrack = 255;
- _loopTrack = 0;
- _queuedTrack = 255;
- _loopQueuedTrack = 0;
-}
-
-MidiPlayer::~MidiPlayer() {
- _mutex.lock();
- close();
- _mutex.unlock();
-}
-
-int MidiPlayer::open() {
- // Don't ever call open without first setting the output driver!
- if (!_driver)
- return 255;
-
- int ret = _driver->open();
- if (ret)
- return ret;
- _driver->setTimerCallback(this, &onTimer);
- return 0;
-}
-
-void MidiPlayer::close() {
- stop();
-// _system->lockMutex (_mutex);
- if (_driver)
- _driver->close();
- _driver = NULL;
- clearConstructs();
-// _system->unlockMutex (_mutex);
-}
-
-void MidiPlayer::send(uint32 b) {
- if (!_current)
- return;
-
- if (_passThrough) {
- _driver->send(b);
- return;
- }
-
- byte channel = (byte) (b & 0x0F);
- if ((b & 0xFFF0) == 0x07B0) {
- // Adjust volume changes by master volume.
- byte volume = (byte) ((b >> 16) & 0x7F);
- _current->volume[channel] = volume;
- volume = volume * _masterVolume / 255;
- b = (b & 0xFF00FFFF) | (volume << 16);
- } else if ((b & 0xF0) == 0xC0 && _map_mt32_to_gm) {
- b = (b & 0xFFFF00FF) | (MidiDriver::_mt32ToGm[(b >> 8) & 0xFF] << 8);
- } else if ((b & 0xFFF0) == 0x007BB0) {
- // Only respond to an All Notes Off if this channel
- // has already been allocated.
- if (!_current->channel[b & 0x0F])
- return;
- }
-
- if (!_current->channel[channel])
- _current->channel[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();
- if (_current->channel[channel]) {
- if (channel == 9)
- _current->channel[9]->volume (_current->volume[9] * _masterVolume / 255);
- _current->channel[channel]->send(b);
- }
-}
-
-void MidiPlayer::metaEvent (byte type, byte *data, uint16 length) {
- // Only thing we care about is End of Track.
- if (!_current || type != 0x2F) {
- return;
- } else if (_current == &_sfx) {
- clearConstructs(_sfx);
- } else if (_loopTrack) {
- _current->parser->jumpToTick(0);
- } else if (_queuedTrack != 255) {
- _currentTrack = 255;
- byte destination = _queuedTrack;
- _queuedTrack = 255;
- _loopTrack = _loopQueuedTrack;
- _loopQueuedTrack = false;
-
- // Remember, we're still inside the locked mutex.
- // Have to unlock it before calling jump()
- // (which locks it itself), and then relock it
- // upon returning.
- _mutex.unlock();
- startTrack (destination);
- _mutex.lock();
- } else {
- stop();
- }
-}
-
-void MidiPlayer::onTimer (void *data) {
- MidiPlayer *p = (MidiPlayer *) data;
- Common::StackLock lock(p->_mutex);
-
- if (!p->_paused) {
- if (p->_music.parser && p->_currentTrack != 255) {
- p->_current = &p->_music;
- p->_music.parser->onTimer();
- }
- }
- if (p->_sfx.parser) {
- p->_current = &p->_sfx;
- p->_sfx.parser->onTimer();
- }
- p->_current = 0;
-}
-
-void MidiPlayer::startTrack (int track) {
- if (track == _currentTrack)
- return;
-
- if (_music.num_songs > 0) {
- if (track >= _music.num_songs)
- return;
-
- _mutex.lock();
-
- if (_music.parser) {
- _current = &_music;
- delete _music.parser;
- _current = 0;
- _music.parser = 0;
- }
-
- MidiParser *parser = MidiParser::createParser_SMF();
- parser->property (MidiParser::mpMalformedPitchBends, 1);
- parser->setMidiDriver (this);
- parser->setTimerRate (_driver->getBaseTempo());
- if (!parser->loadMusic (_music.songs[track], _music.song_sizes[track])) {
- printf ("Error reading track!\n");
- delete parser;
- parser = 0;
- }
-
- _currentTrack = (byte) track;
- _music.parser = parser; // That plugs the power cord into the wall
- } else if (_music.parser) {
- _mutex.lock();
- if (!_music.parser->setTrack(track)) {
- _mutex.unlock();
- return;
- }
- _currentTrack = (byte) track;
- _current = &_music;
- _music.parser->jumpToTick(0);
- _current = 0;
- }
-
- _mutex.unlock();
-}
-
-void MidiPlayer::stop() {
- Common::StackLock lock(_mutex);
-
- if (_music.parser) {
- _current = &_music;
- _music.parser->jumpToTick(0);
- }
- _current = 0;
- _currentTrack = 255;
-}
-
-void MidiPlayer::pause (bool b) {
- if (_paused == b || !_driver)
- return;
- _paused = b;
-
- Common::StackLock lock(_mutex);
- for (int i = 0; i < 16; ++i) {
- if (_music.channel[i])
- _music.channel[i]->volume (_paused ? 0 : (_music.volume[i] * _masterVolume / 255));
- if (_sfx.channel[i])
- _sfx.channel[i]->volume (_paused ? 0 : (_sfx.volume[i] * _masterVolume / 255));
- }
-}
-
-void MidiPlayer::set_volume (int volume) {
- if (volume < 0)
- volume = 0;
- else if (volume > 255)
- volume = 255;
-
- if (_masterVolume == volume)
- return;
- _masterVolume = volume;
-
- // Now tell all the channels this.
- Common::StackLock lock(_mutex);
- if (_driver && !_paused) {
- for (int i = 0; i < 16; ++i) {
- if (_music.channel[i])
- _music.channel[i]->volume(_music.volume[i] * _masterVolume / 255);
- if (_sfx.channel[i])
- _sfx.channel[i]->volume(_sfx.volume[i] * _masterVolume / 255);
- }
- }
-}
-
-void MidiPlayer::set_driver(MidiDriver *md) {
- // Don't try to set this more than once.
- if (_driver)
- return;
- _driver = md;
-}
-
-void MidiPlayer::mapMT32toGM (bool map) {
- Common::StackLock lock(_mutex);
-
- _map_mt32_to_gm = map;
-}
-
-void MidiPlayer::setLoop (bool loop) {
- Common::StackLock lock(_mutex);
-
- _loopTrack = loop;
-}
-
-void MidiPlayer::queueTrack (int track, bool loop) {
- _mutex.lock();
- if (_currentTrack == 255) {
- _mutex.unlock();
- setLoop(loop);
- startTrack(track);
- } else {
- _queuedTrack = track;
- _loopQueuedTrack = loop;
- _mutex.unlock();
- }
-}
-
-void MidiPlayer::clearConstructs() {
- clearConstructs(_music);
- clearConstructs(_sfx);
-}
-
-void MidiPlayer::clearConstructs(MusicInfo &info) {
- int i;
- if (info.num_songs > 0) {
- for (i = 0; i < info.num_songs; ++i)
- free (info.songs[i]);
- info.num_songs = 0;
- }
-
- if (info.data) {
- free(info.data);
- info.data = 0;
- } // end if
-
- if (info.parser) {
- delete info.parser;
- info.parser = 0;
- }
-
- if (_driver) {
- for (i = 0; i < 16; ++i) {
- if (info.channel[i]) {
- info.channel[i]->allNotesOff();
- info.channel[i]->release();
- }
- }
- }
- info.clear();
-}
-
-void MidiPlayer::resetVolumeTable() {
- int i;
- for (i = 0; i < 16; ++i) {
- _music.volume[i] = _sfx.volume[i] = 127;
- if (_driver)
- _driver->send (((_masterVolume >> 1) << 16) | 0x7B0 | i);
- }
-}
-
-static int simon1_gmf_size[] = {
- 8900, 12166, 2848, 3442, 4034, 4508, 7064, 9730, 6014, 4742, 3138,
- 6570, 5384, 8909, 6457, 16321, 2742, 8968, 4804, 8442, 7717,
- 9444, 5800, 1381, 5660, 6684, 2456, 4744, 2455, 1177, 1232,
- 17256, 5103, 8794, 4884, 16
-};
-
-void MidiPlayer::loadSMF (Common::File *in, int song, bool sfx) {
- Common::StackLock lock(_mutex);
-
- MusicInfo *p = sfx ? &_sfx : &_music;
- clearConstructs (*p);
-
- uint32 startpos = in->pos();
- byte header[4];
- in->read(header, 4);
- bool isGMF = !memcmp (header, "GMF\x1", 4);
- in->seek(startpos, SEEK_SET);
-
- uint32 size = in->size() - in->pos();
- if (isGMF) {
- if (sfx) {
- // Multiple GMF resources are stored in the SFX files,
- // but each one is referenced by a pointer at the
- // beginning of the file. Those pointers can be used
- // to determine file size.
- in->seek(0, SEEK_SET);
- uint16 value = in->readUint16LE() >> 2; // Number of resources
- if (song != value - 1) {
- in->seek(song * 2 + 2, SEEK_SET);
- value = in->readUint16LE();
- size = value - startpos;
- }
- in->seek(startpos, SEEK_SET);
- } else if (size >= 64000) {
- // For GMF resources not in separate
- // files, we're going to have to use
- // hardcoded size tables.
- size = simon1_gmf_size[song];
- }
- }
-
- // When allocating space, add 4 bytes in case
- // this is a GMF and we have to tack on our own
- // End of Track event.
- p->data = (byte *) calloc(size + 4, 1);
- in->read(p->data, size);
-
- if (!memcmp(p->data, "GMF\x1", 4)) {
- // BTW, here's what we know about the GMF header,
- // the 7 bytes preceding the actual MIDI events.
- // 3 BYTES: 'GMF'
- // 1 BYTE : Always seems to be 0x01
- // 1 BYTE : Always seems to be 0x00
- // 1 BYTE : Ranges from 0x02 to 0x08 (always 0x02 for SFX, though)
- // 1 BYTE : Loop control. 0 = no loop, 1 = loop
- if (!sfx) {
- // According to bug #1004919 calling setLoop() from
- // within a lock causes a lockup, though I have no
- // idea when this actually happens.
- _loopTrack = (p->data[6] != 0);
- }
- }
-
- MidiParser *parser = MidiParser::createParser_SMF();
- parser->property(MidiParser::mpMalformedPitchBends, 1);
- parser->setMidiDriver(this);
- parser->setTimerRate(_driver->getBaseTempo());
- if (!parser->loadMusic(p->data, size)) {
- printf ("Error reading track!\n");
- delete parser;
- parser = 0;
- }
-
- if (!sfx) {
- _currentTrack = 255;
- resetVolumeTable();
- }
- p->parser = parser; // That plugs the power cord into the wall
-}
-
-void MidiPlayer::loadMultipleSMF (Common::File *in, bool sfx) {
- // This is a special case for Simon 2 Windows.
- // Instead of having multiple sequences as
- // separate tracks in a Type 2 file, simon2win
- // has multiple songs, each of which is a Type 1
- // file. Thus, preceding the songs is a single
- // byte specifying how many songs are coming.
- // We need to load ALL the songs and then
- // treat them as separate tracks -- for the
- // purpose of jumps, anyway.
- Common::StackLock lock(_mutex);
-
- MusicInfo *p = sfx ? &_sfx : &_music;
- clearConstructs(*p);
-
- p->num_songs = in->readByte();
- if (p->num_songs > 16) {
- printf ("playMultipleSMF: %d is too many songs to keep track of!\n", (int) p->num_songs);
- return;
- }
-
- byte i;
- for (i = 0; i < p->num_songs; ++i) {
- byte buf[5];
- uint32 pos = in->pos();
-
- // Make sure there's a MThd
- in->read(buf, 4);
- if (memcmp (buf, "MThd", 4)) {
- printf ("Expected MThd but found '%c%c%c%c' instead!\n", buf[0], buf[1], buf[2], buf[3]);
- return;
- }
- in->seek(in->readUint32BE() + in->pos(), SEEK_SET);
-
- // Now skip all the MTrk blocks
- while (true) {
- in->read (buf, 4);
- if (memcmp(buf, "MTrk", 4))
- break;
- in->seek(in->readUint32BE() + in->pos(), SEEK_SET);
- }
-
- uint32 pos2 = in->pos() - 4;
- uint32 size = pos2 - pos;
- p->songs[i] = (byte *) calloc(size, 1);
- in->seek(pos, SEEK_SET);
- in->read(p->songs[i], size);
- p->song_sizes[i] = size;
- }
-
- if (!sfx) {
- _currentTrack = 255;
- resetVolumeTable();
- }
-}
-
-void MidiPlayer::loadXMIDI(Common::File *in, bool sfx) {
- Common::StackLock lock(_mutex);
- MusicInfo *p = sfx ? &_sfx : &_music;
- clearConstructs(*p);
-
- char buf[4];
- uint32 pos = in->pos();
- uint32 size = 4;
- in->read(buf, 4);
- if (!memcmp(buf, "FORM", 4)) {
- int i;
- for (i = 0; i < 16; ++i) {
- if (!memcmp(buf, "CAT ", 4))
- break;
- size += 2;
- memcpy(buf, &buf[2], 2);
- in->read(&buf[2], 2);
- }
- if (memcmp(buf, "CAT ", 4)) {
- warning("Could not find 'CAT ' tag to determine resource size!");
- return;
- }
- size += 4 + in->readUint32BE();
- in->seek(pos, 0);
- p->data = (byte *) calloc(size, 1);
- in->read(p->data, size);
- } else {
- warning("Expected 'FORM' tag but found '%c%c%c%c' instead!", buf[0], buf[1], buf[2], buf[3]);
- return;
- }
-
- MidiParser *parser = MidiParser::createParser_XMIDI();
- parser->setMidiDriver(this);
- parser->setTimerRate(_driver->getBaseTempo());
- if (!parser->loadMusic(p->data, size)) {
- warning("Error reading track!");
- delete parser;
- parser = 0;
- }
-
- if (!sfx) {
- _currentTrack = 255;
- resetVolumeTable();
- }
- p->parser = parser; // That plugs the power cord into the wall
-}
-
-void MidiPlayer::loadS1D (Common::File *in, bool sfx) {
- Common::StackLock lock(_mutex);
- MusicInfo *p = sfx ? &_sfx : &_music;
- clearConstructs(*p);
-
- uint16 size = in->readUint16LE();
- if (size != in->size() - 2) {
- warning("Size mismatch in simon1demo MUS file (%ld versus reported %d)", (long) in->size() - 2, (int) size);
- return;
- }
-
- p->data = (byte *) calloc(size, 1);
- in->read(p->data, size);
-
- MidiParser *parser = MidiParser_createS1D();
- parser->setMidiDriver(this);
- parser->setTimerRate(_driver->getBaseTempo());
- if (!parser->loadMusic(p->data, size)) {
- warning("Error reading track!");
- delete parser;
- parser = 0;
- }
-
- if (!sfx) {
- _currentTrack = 255;
- resetVolumeTable();
- }
- p->parser = parser; // That plugs the power cord into the wall
-}
-
-} // End of namespace Simon
diff --git a/simon/midi.h b/simon/midi.h
deleted file mode 100644
index bc903f9d17..0000000000
--- a/simon/midi.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef SIMON_MIDI_H
-#define SIMON_MIDI_H
-
-#include "sound/mididrv.h"
-#include "sound/midiparser.h"
-#include "common/mutex.h"
-
-namespace Common {
- class File;
-}
-
-namespace Simon {
-
-struct MusicInfo {
- MidiParser *parser;
- byte * data;
- byte num_songs; // For Type 1 SMF resources
- byte * songs[16]; // For Type 1 SMF resources
- uint32 song_sizes[16]; // For Type 1 SMF resources
-
- MidiChannel *channel[16]; // Dynamic remapping of channels to resolve conflicts
- byte volume[16]; // Current channel volume
-
- MusicInfo() { clear(); }
- void clear() {
- parser = 0; data = 0; num_songs = 0;
- memset (songs, 0, sizeof (songs));
- memset (song_sizes, 0, sizeof (song_sizes));
- memset (channel, 0, sizeof (channel));
- }
-};
-
-class MidiPlayer : public MidiDriver {
-protected:
- Common::Mutex _mutex;
- MidiDriver *_driver;
- bool _map_mt32_to_gm;
- bool _passThrough;
-
- MusicInfo _music;
- MusicInfo _sfx;
- MusicInfo *_current; // Allows us to establish current context for operations.
-
- // These are maintained for both music and SFX
- byte _masterVolume; // 0-255
- bool _paused;
-
- // These are only used for music.
- byte _currentTrack;
- bool _loopTrack;
- byte _queuedTrack;
- bool _loopQueuedTrack;
-
-protected:
- static void onTimer (void *data);
- void clearConstructs();
- void clearConstructs (MusicInfo &info);
- void resetVolumeTable();
-
-public:
- bool _enable_sfx;
-
-public:
- MidiPlayer (OSystem *system);
- virtual ~MidiPlayer();
-
- void loadSMF (Common::File *in, int song, bool sfx = false);
- void loadMultipleSMF (Common::File *in, bool sfx = false);
- void loadXMIDI (Common::File *in, bool sfx = false);
- void loadS1D (Common::File *in, bool sfx = false);
-
- void mapMT32toGM (bool map);
- void setLoop (bool loop);
- void startTrack(int track);
- void queueTrack (int track, bool loop);
- bool isPlaying (bool check_queued = false) { return (_currentTrack != 255 && (_queuedTrack != 255 || !check_queued)); }
-
- void stop();
- void pause (bool b);
-
- int get_volume() { return _masterVolume; }
- void set_volume (int volume);
- void set_driver (MidiDriver *md);
-
-public:
- // MidiDriver interface implementation
- int open();
- void close();
- void send(uint32 b);
-
- void metaEvent (byte type, byte *data, uint16 length);
- void setPassThrough(bool b) { _passThrough = b; }
-
- // Timing functions - MidiDriver now operates timers
- void setTimerCallback (void *timer_param, void (*timer_proc) (void *)) { }
- uint32 getBaseTempo (void) { return _driver ? _driver->getBaseTempo() : 0; }
-
- // Channel allocation functions
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
-};
-
-} // End of namespace Simon
-
-#endif
diff --git a/simon/midiparser_s1d.cpp b/simon/midiparser_s1d.cpp
deleted file mode 100644
index 926a8cb263..0000000000
--- a/simon/midiparser_s1d.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/stdafx.h"
-#include "sound/midiparser.h"
-#include "sound/mididrv.h"
-#include "common/util.h"
-
-#include <stdio.h>
-
-namespace Simon {
-
-/**
- * Simon 1 Demo version of MidiParser.
- *
- * This parser is the result of eyeballing the one MUS file that's included
- * with simon1demo. So there might be some things missing. I've tried to notate
- * question-mark areas where they occur.
- */
-class MidiParser_S1D : public MidiParser {
-protected:
- byte *_data;
- bool _no_delta;
-
-protected:
- void parseNextEvent (EventInfo &info);
- void resetTracking();
- uint32 readVLQ2(byte * &data);
-
-public:
- MidiParser_S1D() : _data(0), _no_delta(false) {}
-
- bool loadMusic(byte *data, uint32 size);
-};
-
-
-// The VLQs for simon1demo seem to be
-// in Little Endian format.
-uint32 MidiParser_S1D::readVLQ2(byte * &data) {
- byte str;
- uint32 value = 0;
- int i;
-
- for (i = 0; i < 4; ++i) {
- str = data[0];
- ++data;
- value |= (str & 0x7F) << (i * 7);
- if (!(str & 0x80))
- break;
- }
- return value;
-}
-
-void MidiParser_S1D::parseNextEvent(EventInfo &info) {
- info.start = _position._play_pos;
- info.delta = _no_delta ? 0 : readVLQ2(_position._play_pos);
-
- _no_delta = false;
- info.event = *(_position._play_pos++);
- if (info.command() < 0x8) {
- _no_delta = true;
- info.event += 0x80;
- }
-
- switch (info.command()) {
- case 0x8:
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = 0;
- info.length = 0;
- break;
-
- case 0x9:
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = *(_position._play_pos++); // I'm ASSUMING this byte is velocity!
- info.length = 0;
- break;
-
- case 0xC:
- info.basic.param1 = *(_position._play_pos++);
- info.basic.param2 = 0;
- ++_position._play_pos; // I have NO IDEA what the second byte is for.
- break;
-
- case 0xF:
- if (info.event == 0xFC) {
- // This means End of Track.
- // Rewrite in SMF (MIDI transmission) form.
- info.event = 0xFF;
- info.ext.type = 0x2F;
- info.length = 0;
- break;
- }
- // OTherwise fall through to default.
-
- default:
- printf ("MidiParser_S1D: Warning! Unexpected byte 0x%02X found!\n", (int) info.event);
- _abort_parse = true;
- _position._play_pos = 0;
- }
-}
-
-bool MidiParser_S1D::loadMusic(byte *data, uint32 size) {
- unloadMusic();
-
- byte *pos = data;
- if (*(pos++) != 0xFC) {
- printf ("Warning: Expected 0xFC header but found 0x%02X instead\n", (int) *pos);
- return false;
- }
-
- // The next 3 bytes MIGHT be tempo, but we skip them and use the default.
-// setTempo (*(pos++) | (*(pos++) << 8) | (*(pos++) << 16));
- pos += 3;
-
- // And now we're at the actual data. Only one track.
- _num_tracks = 1;
- _data = pos;
- _tracks[0] = pos;
-
- // Note that we assume the original data passed in
- // will persist beyond this call, i.e. we do NOT
- // copy the data to our own buffer. Take warning....
- resetTracking();
- setTempo(666667);
- setTrack(0);
- return true;
-}
-
-void MidiParser_S1D::resetTracking() {
- MidiParser::resetTracking();
- _no_delta = false;
-}
-
-MidiParser *MidiParser_createS1D() { return new MidiParser_S1D; }
-
-} // End of namespace Simon
diff --git a/simon/module.mk b/simon/module.mk
deleted file mode 100644
index d2f860fb7f..0000000000
--- a/simon/module.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-MODULE := simon
-
-MODULE_OBJS := \
- simon/charset.o \
- simon/cursor.o \
- simon/debug.o \
- simon/debugger.o \
- simon/game.o \
- simon/icons.o \
- simon/items.o \
- simon/midi.o \
- simon/midiparser_s1d.o \
- simon/res.o \
- simon/saveload.o \
- simon/sound.o \
- simon/simon.o \
- simon/verb.o \
- simon/vga.o \
-
-MODULE_DIRS += \
- simon
-
-# This module can be built as a plugin
-ifdef BUILD_PLUGINS
-PLUGIN := 1
-endif
-
-# Include common rules
-include $(srcdir)/common.rules
diff --git a/simon/res.cpp b/simon/res.cpp
deleted file mode 100644
index 0be063c065..0000000000
--- a/simon/res.cpp
+++ /dev/null
@@ -1,386 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-// Resource file routines for Simon1/Simon2
-#include "common/stdafx.h"
-#include "common/file.h"
-#include "simon/simon.h"
-#include "simon/intern.h"
-
-namespace Simon {
-
-// Script opcodes to load into memory
-static const char *const opcode_arg_table_simon1win[256] = {
- " ", "I ", "I ", "I ", "I ", "I ", "I ", "II ", "II ", "II ", "II ", "B ", "B ", "BN ", "BN ",
- "BN ", "BN ", "BB ", "BB ", "BB ", "BB ", "II ", "II ", "N ", "I ", "I ", "I ", "IN ", "IB ",
- "II ", "I ", "I ", "II ", "II ", "IBB ", "BIB ", "BB ", "B ", "BI ", "IB ", "B ", "B ", "BN ",
- "BN ", "BN ", "BB ", "BB ", "BN ", "BN ", "BB ", "BB ", "BN ", "BB ", "BN ", "B ", "I ", "IB ",
- "IB ", "II ", "I ", "I ", "IN ", "B ", "T ", "T ", "NNNNNB ", "BT ", "BTS ", "T ", " ", "B ",
- "N ", "IBN ", "I ", "I ", "I ", "NN ", " ", " ", "IT ", "II ", "I ", "B ", " ", "IB ", "IBB ",
- "IIB ", "T ", " ", " ", "IB ", "IB ", "IB ", "B ", "BB ", "IBB ", "NB ", "N ", "NBNNN ", "N ",
- " ", "BNNNNNN ", "B ", " ", "B ", "B ", "BB ", "NNNNNIN ", "N ", "N ", "N ", "NNN ", "NBNN ",
- "IBNN ", "IB ", "IB ", "IB ", "IB ", "N ", "N ", "N ", "BI ", " ", " ", "N ", "I ", "IBB ",
- "NN ", "N ", "N ", "Ban ", "BB ", " ", " ", " ", " ", "IB ", "B ", " ", "II ", " ", "BI ", "N ",
- "I ", "IB ", "IB ", "IB ", "IB ", "IB ", "IB ", "IB ", "BI ", "BB ", "B ", "B ", "B ", "B ",
- "IBB ", "IBN ", "IB ", "B ", "BNBN ", "BBTS ", "N ", " ", "Ian ", "B ", "B ", "B ", "B ", "T ",
- "T ", "B ", " ", "I ", " ", " ", "BBI ", "NNBB ", "BBB ", " ", " ", " ", " ", "N ", "N ", " ",
- " ",
-};
-
-static const char *const opcode_arg_table_simon1dos[256] = {
- " ", "I ", "I ", "I ", "I ", "I ", "I ", "II ", "II ", "II ", "II ", "B ", "B ", "BN ", "BN ",
- "BN ", "BN ", "BB ", "BB ", "BB ", "BB ", "II ", "II ", "N ", "I ", "I ", "I ", "IN ", "IB ",
- "II ", "I ", "I ", "II ", "II ", "IBB ", "BIB ", "BB ", "B ", "BI ", "IB ", "B ", "B ", "BN ",
- "BN ", "BN ", "BB ", "BB ", "BN ", "BN ", "BB ", "BB ", "BN ", "BB ", "BN ", "B ", "I ", "IB ",
- "IB ", "II ", "I ", "I ", "IN ", "B ", "T ", "T ", "NNNNNB ", "BT ", "BT ", "T ", " ", "B ",
- "N ", "IBN ", "I ", "I ", "I ", "NN ", " ", " ", "IT ", "II ", "I ", "B ", " ", "IB ", "IBB ",
- "IIB ", "T ", " ", " ", "IB ", "IB ", "IB ", "B ", "BB ", "IBB ", "NB ", "N ", "NBNNN ", "N ",
- " ", "BNNNNNN ", "B ", " ", "B ", "B ", "BB ", "NNNNNIN ", "N ", "N ", "N ", "NNN ", "NBNN ",
- "IBNN ", "IB ", "IB ", "IB ", "IB ", "N ", "N ", "N ", "BI ", " ", " ", "N ", "I ", "IBB ",
- "NN ", "N ", "N ", "Ban ", "BB ", " ", " ", " ", " ", "IB ", "B ", " ", "II ", " ", "BI ", "N ",
- "I ", "IB ", "IB ", "IB ", "IB ", "IB ", "IB ", "IB ", "BI ", "BB ", "B ", "B ", "B ", "B ",
- "IBB ", "IBN ", "IB ", "B ", "BNBN ", "BBT ", "N ", " ", "Ian ", "B ", "B ", "B ", "B ", "T ",
- "T ", "B ", " ", "I ", " ", " ", "BBI ", "NNBB ", "BBB ", " ", " ", " ", " ", "N ", "N ", " ",
- " ",
-};
-
-static const char *const opcode_arg_table_simon2win[256] = {
- " ", "I ", "I ", "I ", "I ", "I ", "I ", "II ", "II ", "II ", "II ", "B ", "B ", "BN ", "BN ",
- "BN ", "BN ", "BB ", "BB ", "BB ", "BB ", "II ", "II ", "N ", "I ", "I ", "I ", "IN ", "IB ",
- "II ", "I ", "I ", "II ", "II ", "IBB ", "BIB ", "BB ", "B ", "BI ", "IB ", "B ", "B ", "BN ",
- "BN ", "BN ", "BB ", "BB ", "BN ", "BN ", "BB ", "BB ", "BN ", "BB ", "BN ", "B ", "I ", "IB ",
- "IB ", "II ", "I ", "I ", "IN ", "B ", "T ", "T ", "NNNNNB ", "BT ", "BTS ", "T ", " ", "B ",
- "N ", "IBN ", "I ", "I ", "I ", "NN ", " ", " ", "IT ", "II ", "I ", "B ", " ", "IB ", "IBB ",
- "IIB ", "T ", " ", " ", "IB ", "IB ", "IB ", "B ", "BB ", "IBB ", "NB ", "N ", "NNBNNN ", "NN ",
- " ", "BNNNNNN ", "B ", " ", "B ", "B ", "BB ", "NNNNNIN ", "N ", "N ", "N ", "NNN ", "NBNN ",
- "IBNN ", "IB ", "IB ", "IB ", "IB ", "N ", "N ", "N ", "BI ", " ", " ", "N ", "I ", "IBB ",
- "NNB ", "N ", "N ", "Ban ", "BB ", " ", " ", " ", " ", "IB ", "B ", " ", "II ", " ", "BI ",
- "N ", "I ", "IB ", "IB ", "IB ", "IB ", "IB ", "IB ", "IB ", "BI ", "BB ", "B ", "B ", "B ",
- "B ", "IBB ", "IBN ", "IB ", "B ", "BNBN ", "BBTS ", "N ", " ", "Ian ", "B ", "B ", "B ", "B ",
- "T ", "T ", "B ", " ", "I ", " ", " ", "BBI ", "NNBB ", "BBB ", " ", " ", " ", " ", "N ", "N ",
- " ", " ", "BT ", " ", "B "
-};
-
-static const char *const opcode_arg_table_simon2dos[256] = {
- " ", "I ", "I ", "I ", "I ", "I ", "I ", "II ", "II ", "II ", "II ", "B ", "B ", "BN ", "BN ",
- "BN ", "BN ", "BB ", "BB ", "BB ", "BB ", "II ", "II ", "N ", "I ", "I ", "I ", "IN ", "IB ",
- "II ", "I ", "I ", "II ", "II ", "IBB ", "BIB ", "BB ", "B ", "BI ", "IB ", "B ", "B ", "BN ",
- "BN ", "BN ", "BB ", "BB ", "BN ", "BN ", "BB ", "BB ", "BN ", "BB ", "BN ", "B ", "I ", "IB ",
- "IB ", "II ", "I ", "I ", "IN ", "B ", "T ", "T ", "NNNNNB ", "BT ", "BT ", "T ", " ", "B ",
- "N ", "IBN ", "I ", "I ", "I ", "NN ", " ", " ", "IT ", "II ", "I ", "B ", " ", "IB ", "IBB ",
- "IIB ", "T ", " ", " ", "IB ", "IB ", "IB ", "B ", "BB ", "IBB ", "NB ", "N ", "NNBNNN ", "NN ",
- " ", "BNNNNNN ", "B ", " ", "B ", "B ", "BB ", "NNNNNIN ", "N ", "N ", "N ", "NNN ", "NBNN ",
- "IBNN ", "IB ", "IB ", "IB ", "IB ", "N ", "N ", "N ", "BI ", " ", " ", "N ", "I ", "IBB ",
- "NNB ", "N ", "N ", "Ban ", "BB ", " ", " ", " ", " ", "IB ", "B ", " ", "II ", " ", "BI ",
- "N ", "I ", "IB ", "IB ", "IB ", "IB ", "IB ", "IB ", "IB ", "BI ", "BB ", "B ", "B ", "B ",
- "B ", "IBB ", "IBN ", "IB ", "B ", "BNBN ", "BBT ", "N ", " ", "Ian ", "B ", "B ", "B ", "B ",
- "T ", "T ", "B ", " ", "I ", " ", " ", "BBI ", "NNBB ", "BBB ", " ", " ", " ", " ", "N ", "N ",
- " ", " ", "BT ", " ", "B "
-};
-
-static const char *const opcode_arg_table_feeblefiles[256] = {
- " ", "I ", "I ", "I ", "I ", "I ", "I ", "II ", "II ", "II ", "II ", "B ", "B ", "BN ", "BN ",
- "BN ", "BN ", "BB ", "BB ", "BB ", "BB ", "II ", "II ", "N ", "I ", "I ", "I ", "IN ", "IB ",
- "II ", "I ", "I ", "II ", "II ", "IBB ", "BIB ", "BB ", "B ", "BI ", "IB ", "B ", "B ", "BN ",
- "BN ", "BN ", "BB ", "BB ", "BN ", "BN ", "BB ", "BB ", "BN ", "BB ", "BN ", "B ", "I ", "IB ",
- "IB ", "II ", "I ", "I ", "IN ", "B ", "T ", "T ", "NNNNNB ", "BT ", "BTS ", "T ", " ", "B ",
- "N ", "IBN ", "I ", "I ", "I ", "NN ", " ", " ", "IT ", "II ", "I ", "B ", " ", "IB ", "IBB ",
- "IIB ", "T ", " ", " ", "IB ", "IB ", "IB ", "B ", "BB ", "IBB ", "NB ", "N ", "NNBNNN ", "NN ",
- " ", "BNNNNNN ", "B ", " ", "B ", "B ", "BB ", "NNNNNIN ", "N ", "N ", "N ", "NNN ", "NBNN ",
- "IBNN ", "IB ", "IB ", "IB ", "IB ", "N ", "N ", "N ", "BI ", " ", " ", "N ", "I ", "IBB ",
- "NNB ", "N ", "N ", "Ban ", " ", " ", " ", " ", " ", "IB ", "B ", " ", "II ", " ", "BI ",
- "N ", "I ", "IB ", "IB ", "IB ", "IB ", "IB ", "IB ", "IB ", "BI ", "BB ", "B ", "B ", "B ",
- "B ", "IBB ", "IBN ", "IB ", "B ", "BNNN ", "BBTS ", "N ", " ", "Ian ", "B ", "B ", "B ", "B ",
- "T ", "N ", " ", " ", "I ", " ", " ", "BBI ", "NNBB ", "BBB ", " ", " ", "T ", " ", "N ", "N ",
- " ", " ", "BT ", " ", "B ", " ", "BBBB ", " ", " ", "BBBB ", "B ", "B ", "B ", "B "
-};
-
-uint16 SimonEngine::to16Wrapper(uint value) {
- if (getGameType() == GType_FF)
- return TO_LE_16(value);
- else
- return TO_BE_16(value);
-}
-
-uint16 SimonEngine::readUint16Wrapper(const void *src) {
- if (getGameType() == GType_FF)
- return READ_LE_UINT16(src);
- else
- return READ_BE_UINT16(src);
-}
-
-void SimonEngine::loadGamePcFile(const char *filename) {
- Common::File in;
- int num_inited_objects;
- int i, file_size;
-
- /* read main gamepc file */
- in.open(filename);
- if (in.isOpen() == false) {
- char *filename2;
- filename2 = (char *)malloc(strlen(filename) + 2);
- strcpy(filename2, filename);
- strcat(filename2, ".");
- in.open(filename2);
- free(filename2);
- if (in.isOpen() == false)
- error("Can't open gamepc file '%s' or '%s.'", gss->gamepc_filename, gss->gamepc_filename);
- }
-
- num_inited_objects = allocGamePcVars(&in);
-
- loginPlayer();
- readGamePcText(&in);
-
- for (i = 2; i < num_inited_objects; i++) {
- readItemFromGamePc(&in, _itemArrayPtr[i]);
- }
-
- readSubroutineBlock(&in);
-
- in.close();
-
- /* Read list of TABLE resources */
- in.open("TBLLIST");
- if (in.isOpen() == false) {
- in.open("TBLLIST.");
- if (in.isOpen() == false)
- error("Can't open table resources file 'TBLLIST' or 'TBLLIST.'");
- }
-
- file_size = in.size();
-
- _tblList = (byte *)malloc(file_size);
- if (_tblList == NULL)
- error("Out of memory for strip table list");
- in.read(_tblList, file_size);
- in.close();
-
- /* Remember the current state */
- _subroutineListOrg = _subroutineList;
- _tablesHeapPtrOrg = _tablesHeapPtr;
- _tablesHeapCurPosOrg = _tablesHeapCurPos;
-
- if (getGameType() == GType_FF)
- return;
-
- /* Read list of TEXT resources */
- if (getPlatform() == Common::kPlatformAcorn)
- in.open("STRIPPED");
- else
- in.open("STRIPPED.TXT");
- if (in.isOpen() == false)
- error("Can't open text resources file 'STRIPPED.TXT'");
-
- file_size = in.size();
- _strippedTxtMem = (byte *)malloc(file_size);
- if (_strippedTxtMem == NULL)
- error("Out of memory for strip text list");
- in.read(_strippedTxtMem, file_size);
- in.close();
-}
-
-void SimonEngine::readGamePcText(Common::File *in) {
- uint text_size;
- byte *text_mem;
-
- _textSize = text_size = in->readUint32BE();
- text_mem = (byte *)malloc(text_size);
- if (text_mem == NULL)
- error("Out of text memory");
-
- in->read(text_mem, text_size);
-
- setupStringTable(text_mem, _stringTabNum);
-}
-
-void SimonEngine::readItemFromGamePc(Common::File *in, Item *item) {
- uint32 type;
-
- item->adjective = in->readUint16BE();
- item->noun = in->readUint16BE();
- item->state = in->readUint16BE();
- item->sibling = (uint16)fileReadItemID(in);
- item->child = (uint16)fileReadItemID(in);
- item->parent = (uint16)fileReadItemID(in);
- in->readUint16BE();
- item->classFlags = in->readUint16BE();
- item->children = NULL;
-
- type = in->readUint32BE();
- while (type) {
- type = in->readUint16BE();
- if (type != 0)
- readItemChildren(in, item, type);
- }
-}
-
-void SimonEngine::readItemChildren(Common::File *in, Item *item, uint type) {
- if (type == 1) {
- uint fr1 = in->readUint16BE();
- uint fr2 = in->readUint16BE();
- uint i, size;
- uint j, k;
- Child1 *child;
-
- size = CHILD1_SIZE;
- for (i = 0, j = fr2; i != 6; i++, j >>= 2)
- if (j & 3)
- size += sizeof(child->array[0]);
-
- child = (Child1 *)allocateChildBlock(item, 1, size);
- child->subroutine_id = fr1;
- child->fr2 = fr2;
-
- for (i = k = 0, j = fr2; i != 6; i++, j >>= 2)
- if (j & 3)
- child->array[k++] = (uint16)fileReadItemID(in);
- } else if (type == 2) {
- uint32 fr = in->readUint32BE();
- uint i, k, size;
- Child2 *child;
-
- size = CHILD2_SIZE;
- for (i = 0; i != 16; i++)
- if (fr & (1 << i))
- size += sizeof(child->array[0]);
-
- child = (Child2 *)allocateChildBlock(item, 2, size);
- child->avail_props = fr;
-
- k = 0;
- if (fr & 1) {
- child->array[k++] = (uint16)in->readUint32BE();
- }
- for (i = 1; i != 16; i++)
- if (fr & (1 << i))
- child->array[k++] = in->readUint16BE();
-
- child->string_id = (uint16)in->readUint32BE();
- } else {
- error("readItemChildren: invalid type %d", type);
- }
-}
-
-uint fileReadItemID(Common::File *in) {
- uint32 val = in->readUint32BE();
- if (val == 0xFFFFFFFF)
- return 0;
- return val + 2;
-}
-
-byte *SimonEngine::readSingleOpcode(Common::File *in, byte *ptr) {
- int i, l;
- const char *string_ptr;
- uint val;
-
- const char *const *table;
-
- if (getGameType() == GType_FF) {
- table = opcode_arg_table_feeblefiles;
- } else if ((getGameType() == GType_SIMON2) && (getFeatures() & GF_TALKIE))
- table = opcode_arg_table_simon2win;
- else if (getGameType() == GType_SIMON2)
- table = opcode_arg_table_simon2dos;
- else if (getFeatures() & GF_TALKIE)
- table = opcode_arg_table_simon1win;
- else
- table = opcode_arg_table_simon1dos;
-
- i = 0;
-
- string_ptr = table[*ptr++];
- if (!string_ptr)
- error("Unable to locate opcode table. Perhaps you are using the wrong game target?");
-
- for (;;) {
- if (string_ptr[i] == ' ')
- return ptr;
-
- l = string_ptr[i++];
- switch (l) {
- case 'N':
- case 'S':
- case 'a':
- case 'n':
- case 'p':
- case 'v':
- val = in->readUint16BE();
- *ptr++ = val >> 8;
- *ptr++ = val & 255;
- break;
-
- case 'B':
- *ptr++ = in->readByte();
- if (ptr[-1] == 0xFF) {
- *ptr++ = in->readByte();
- }
- break;
-
- case 'I':
- val = in->readUint16BE();
- switch (val) {
- case 1:
- val = 0xFFFF;
- break;
- case 3:
- val = 0xFFFD;
- break;
- case 5:
- val = 0xFFFB;
- break;
- case 7:
- val = 0xFFF9;
- break;
- case 9:
- val = 0xFFF7;
- break;
- default:
- val = fileReadItemID(in);;
- }
- *ptr++ = val >> 8;
- *ptr++ = val & 255;
- break;
-
- case 'T':
- val = in->readUint16BE();
- switch (val) {
- case 0:
- val = 0xFFFF;
- break;
- case 3:
- val = 0xFFFD;
- break;
- default:
- val = (uint16)in->readUint32BE();
- break;
- }
- *ptr++ = val >> 8;
- *ptr++ = val & 255;
- break;
- default:
- error("Bad cmd table entry %c", l);
- }
- }
-}
-
-} // End of namespace Simon
diff --git a/simon/saveload.cpp b/simon/saveload.cpp
deleted file mode 100644
index 9314a4bfca..0000000000
--- a/simon/saveload.cpp
+++ /dev/null
@@ -1,634 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/stdafx.h"
-
-#include "gui/about.h"
-#include "gui/message.h"
-
-#include "simon/simon.h"
-#include "simon/intern.h"
-
-#include "common/savefile.h"
-#include "common/system.h"
-
-namespace Simon {
-
-void SimonEngine::o_saveGame() {
- saveOrLoadDialog(false);
-}
-
-void SimonEngine::o_loadGame() {
- saveOrLoadDialog(true);
-}
-
-int SimonEngine::countSaveGames() {
- Common::InSaveFile *f;
- uint i = 1;
- bool marks[256];
-
- char *prefix = gen_savename(999);
- prefix[strlen(prefix)-3] = '\0';
- _saveFileMan->listSavefiles(prefix, marks, 256);
-
- while (i < 256) {
- if (marks[i] &&
- (f = _saveFileMan->openForLoading(gen_savename(i)))) {
- i++;
- delete f;
- } else
- break;
- }
- return i;
-}
-
-int SimonEngine::displaySaveGameList(int curpos, bool load, char *dst) {
- int slot, last_slot;
- Common::InSaveFile *in;
-
- showMessageFormat("\xC");
-
- memset(dst, 0, 18 * 6);
-
- slot = curpos;
-
- while (curpos + 6 > slot) {
- if (!(in = _saveFileMan->openForLoading(gen_savename(slot))))
- break;
-
- in->read(dst, 18);
- delete in;
- last_slot = slot;
- if (slot < 10)
- showMessageFormat(" ");
- showMessageFormat("%d", slot);
- showMessageFormat(".%s\n", dst);
- dst += 18;
- slot++;
- }
- // while_break
- if (!load) {
- if (curpos + 6 == slot)
- slot++;
- else {
- if (slot < 10)
- showMessageFormat(" ");
- showMessageFormat("%d.\n", slot);
- }
- } else {
- if (curpos + 6 == slot) {
- if ((in = _saveFileMan->openForLoading(gen_savename(slot)))) {
- slot++;
- delete in;
- }
- }
- }
-
- return slot - curpos;
-}
-
-void SimonEngine::quickLoadOrSave() {
- // simon1demo subroutines are missing too many segments
- // original demo didn't allow load or save either.
- if (getGameId() == GID_SIMON1DEMO)
- return;
-
- bool success;
- char buf[50];
-
- char *filename = gen_savename(_saveLoadSlot);
- if (_saveLoadType == 2) {
- Subroutine *sub;
- success = loadGame(_saveLoadSlot);
- if (!success) {
- sprintf(buf, "Failed to load game state to file:\n\n%s", filename);
- } else {
- // Redraw Inventory
- mouseOff();
- drawIconArray(2, getItem1Ptr(), 0, 0);
- mouseOn();
- // Reset engine?
- vcSetBitTo(97, true);
- sub = getSubroutineByID(100);
- startSubroutine(sub);
- }
- } else {
- success = saveGame(_saveLoadSlot, _saveLoadName);
- if (!success)
- sprintf(buf, "Failed to save game state to file:\n\n%s", filename);
- }
-
- if (!success) {
- GUI::MessageDialog dialog(buf, "OK");
- dialog.runModal();
-
- } else if (_saveLoadType == 1) {
- sprintf(buf, "Successfully saved game state in file:\n\n%s", filename);
- GUI::TimedMessageDialog dialog(buf, 1500);
- dialog.runModal();
-
- }
-
- _saveLoadType = 0;
-}
-
-void SimonEngine::saveGameDialog(char *buf) {
- int i;
-
- o_unk_132_helper_3();
-
- i = displaySaveGameList(_saveLoadRowCurPos, _saveOrLoad, buf);
-
- _saveDialogFlag = true;
-
- if (i != 7) {
- i++;
- if (!_saveOrLoad)
- i++;
- _saveDialogFlag = false;
- }
-
- if (!--i)
- return;
-
- do {
- clear_hitarea_bit_0x40(0xd0 + i - 1);
- } while (--i);
-}
-
-void SimonEngine::saveOrLoadDialog(bool load) {
- time_t save_time;
- int number_of_savegames;
- int i;
- int unk132_result;
- FillOrCopyStruct *fcs;
- char *name;
- int name_len;
- bool b;
- char buf[108];
-
- _saveOrLoad = load;
-
- save_time = time(NULL);
-
- _copyPartialMode = 1;
-
- number_of_savegames = countSaveGames();
- if (!load)
- number_of_savegames++;
- number_of_savegames -= 6;
- if (number_of_savegames < 0)
- number_of_savegames = 0;
- number_of_savegames++;
- _numSaveGameRows = number_of_savegames;
-
- _saveLoadRowCurPos = 1;
- if (!load)
- _saveLoadRowCurPos = number_of_savegames;
-
- _saveLoadFlag = false;
-
-restart:;
- do {
- i = o_unk_132_helper(&b, buf);
- } while (!b);
-
- if (i == 205)
- goto get_out;
- if (!load) {
- // if_1
- if_1:;
- unk132_result = i;
-
- set_hitarea_bit_0x40(0xd0 + i);
- leaveHitAreaById(0xd0 + i);
-
- // some code here
-
- fcs = _windowArray[5];
-
- fcs->textRow = unk132_result;
-
- if (_language == Common::HB_ISR) { //Hebrew
- // init x offset with a 2 character savegame number + a period (18 pix)
- fcs->textColumn = 3;
- fcs->textColumnOffset = 6;
- fcs->textLength = 3;
- } else {
- // init x offset with a 2 character savegame number + a period (18 pix)
- fcs->textColumn = 2;
- fcs->textColumnOffset = 2;
- fcs->textLength = 3;
- }
-
- name = buf + i * 18;
-
- // now process entire savegame name to get correct x offset for cursor
- name_len = 0;
- while (name[name_len]) {
- if (_language == Common::HB_ISR) { //Hebrew
- byte width = 6;
- if (name[name_len] >= 64 && name[name_len] < 91)
- width = _hebrew_char_widths [name[name_len] - 64];
- fcs->textLength++;
- fcs->textColumnOffset -= width;
- if (fcs->textColumnOffset < width) {
- fcs->textColumnOffset += 8;
- fcs->textColumn++;
- }
- } else {
- fcs->textLength++;
- fcs->textColumnOffset += 6;
- if (name[name_len] == 'i' || name[name_len] == 'l')
- fcs->textColumnOffset -= 2;
- if (fcs->textColumnOffset >= 8) {
- fcs->textColumnOffset -= 8;
- fcs->textColumn++;
- }
- }
- name_len++;
- }
- // while_1_end
-
- // do_3_start
- for (;;) {
- video_putchar(fcs, 0x7f);
-
- _saveLoadFlag = true;
-
- // do_2
- do {
- i = o_unk_132_helper(&b, buf);
-
- if (b) {
- if (i == 205)
- goto get_out;
- clear_hitarea_bit_0x40(0xd0 + unk132_result);
- if (_saveLoadFlag) {
- o_clearCharacter(_windowArray[5], 8);
- // move code
- }
- goto if_1;
- }
-
- // is_not_b
- if (!_saveLoadFlag) {
- clear_hitarea_bit_0x40(0xd0 + unk132_result);
- goto restart;
- }
- } while (i >= 0x80 || i == 0);
-
- // after_do_2
- o_clearCharacter(_windowArray[5], 8);
- if (i == 10 || i == 13)
- break;
- if (i == 8) {
- // do_backspace
- if (name_len != 0) {
- int x;
- byte m;
-
- name_len--;
- m = name[name_len];
-
- if (_language == Common::HB_ISR) //Hebrew
- x = 8;
- else
- x = (name[name_len] == 'i' || name[name_len] == 'l') ? 1 : 8;
-
- name[name_len] = 0;
-
- o_clearCharacter(_windowArray[5], x, m);
- }
- } else if (i >= 32 && name_len != 17) {
- name[name_len++] = i;
-
- video_putchar(_windowArray[5], i);
- }
- }
-
- // do_save
- if (!saveGame(_saveLoadRowCurPos + unk132_result, buf + unk132_result * 18))
- o_fileError(_windowArray[5], true);
- } else {
- if (!loadGame(_saveLoadRowCurPos + i))
- o_fileError(_windowArray[5], false);
- }
-
-get_out:;
- o_unk_132_helper_3();
-
- _base_time = time(NULL) - save_time + _base_time;
- _copyPartialMode = 0;
-
- dx_copy_rgn_from_3_to_2(94, 208, 46, 80);
-
- i = _timer4;
- do {
- delay(10);
- } while (i == _timer4);
-
- g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
-}
-
-void SimonEngine::o_fileError(FillOrCopyStruct *fcs, bool save_error) {
- HitArea *ha;
- const char *string, *string2;
-
- if (save_error) {
- string = "\r Save failed.";
- string2 = "\r Disk error.";
- } else {
- string = "\r Load failed.";
- string2 = "\r File not found.";
- }
-
- video_putchar(fcs, 0xC);
- for (; *string; string++)
- video_putchar(fcs, *string);
- for (; *string2; string2++)
- video_putchar(fcs, *string2);
-
- fcs->textColumn = (fcs->width >> 1) - 3;
- fcs->textRow = fcs->height - 1;
- fcs->textLength = 0;
-
- string = "[ OK ]";
- for (; *string; string++)
- video_putchar(fcs, *string);
-
- ha = findEmptyHitArea();
- ha->x = ((fcs->width >> 1) + (fcs->x - 3)) << 3;
- ha->y = (fcs->height << 3) + fcs->y - 8;
- ha->width = 48;
- ha->height = 8;
- ha->flags = 0x20;
- ha->id = 0x7FFF;
- ha->layer = 0x3EF;
-
-loop:;
- _lastHitArea = _lastHitArea3 = 0;
-
- do {
- delay(1);
- } while (_lastHitArea3 == 0);
-
- ha = _lastHitArea;
- if (ha == NULL || ha->id != 0x7FFF)
- goto loop;
-
- // Return
- delete_hitarea(0x7FFF);
-}
-
-bool SimonEngine::saveGame(uint slot, char *caption) {
- Common::OutSaveFile *f;
- uint item_index, num_item, i, j;
- TimeEvent *te;
-
- _lockWord |= 0x100;
-
- f = _saveFileMan->openForSaving(gen_savename(slot));
- if (f == NULL) {
- _lockWord &= ~0x100;
- return false;
- }
-
- if (getGameType() == GType_FF) {
- f->write(caption, 100);
- } else {
- f->write(caption, 18);
- }
-
- f->writeUint32BE(_itemArrayInited - 1);
- f->writeUint32BE(0xFFFFFFFF);
- f->writeUint32BE(0);
- f->writeUint32BE(0);
-
- i = 0;
- for (te = _firstTimeStruct; te; te = te->next)
- i++;
- f->writeUint32BE(i);
-
- for (te = _firstTimeStruct; te; te = te->next) {
- f->writeUint32BE(te->time + _base_time);
- f->writeUint16BE(te->subroutine_id);
- }
-
- item_index = 1;
- for (num_item = _itemArrayInited - 1; num_item; num_item--) {
- Item *item = _itemArrayPtr[item_index++];
-
- f->writeUint16BE(item->parent);
- f->writeUint16BE(item->sibling);
- f->writeUint16BE(item->state);
- f->writeUint16BE(item->classFlags);
-
- Child1 *child1 = (Child1 *)findChildOfType(item, 1);
- if (child1) {
- f->writeUint16BE(child1->fr2);
- }
-
- Child2 *child2 = (Child2 *)findChildOfType(item, 2);
- if (child2) {
- f->writeUint32BE(child2->avail_props);
- i = child2->avail_props & 1;
-
- for (j = 1; j < 16; j++) {
- if ((1 << j) & child2->avail_props) {
- f->writeUint16BE(child2->array[i++]);
- }
- }
- }
-
- Child9 *child9 = (Child9 *)findChildOfType(item, 9);
- if (child9) {
- for (i = 0; i != 4; i++) {
- f->writeUint16BE(child9->array[i]);
- }
- }
- }
-
- // write the 255 variables
- for (i = 0; i != 255; i++) {
- f->writeUint16BE(readVariable(i));
- }
-
- // write the items in array 6
- for (i = 0; i != 10; i++) {
- f->writeUint16BE(itemPtrToID(_itemArray6[i]));
- }
-
- // Write the bits in array 1 & 2
- for (i = 0; i != 32; i++)
- f->writeUint16BE(_bitArray[i]);
-
- // Write the bits in array 3
- if (getGameType() == GType_FF) {
- for (i = 33; i != 48; i++)
- f->writeUint16BE(_bitArray[i]);
- }
-
- f->flush();
- bool result = !f->ioFailed();
-
- delete f;
- _lockWord &= ~0x100;
-
- return result;
-}
-
-char *SimonEngine::gen_savename(int slot) {
- static char buf[15];
-
- if (getGameType() == GType_FF) {
- if (slot == 999)
- sprintf(buf, "save.%.3d", slot);
- else
- sprintf(buf, "feeble.%.3d", slot);
- } else if (getGameType() == GType_SIMON2) {
- sprintf(buf, "simon2.%.3d", slot);
- } else {
- sprintf(buf, "simon1.%.3d", slot);
- }
- return buf;
-}
-
-bool SimonEngine::loadGame(uint slot) {
- char ident[100];
- Common::InSaveFile *f;
- uint num, item_index, i, j;
-
- _lockWord |= 0x100;
-
- f = _saveFileMan->openForLoading(gen_savename(slot));
- if (f == NULL) {
- _lockWord &= ~0x100;
- return false;
- }
-
- if (getGameType() == GType_FF) {
- f->read(ident, 100);
- } else {
- f->read(ident, 18);
- }
-
- num = f->readUint32BE();
-
- if (f->readUint32BE() != 0xFFFFFFFF || num != _itemArrayInited - 1) {
- delete f;
- _lockWord &= ~0x100;
- return false;
- }
-
- f->readUint32BE();
- f->readUint32BE();
- _noParentNotify = true;
-
-
- // add all timers
- killAllTimers();
- for (num = f->readUint32BE(); num; num--) {
- uint32 timeout = f->readUint32BE();
- uint16 func_to_call = f->readUint16BE();
- addTimeEvent(timeout, func_to_call);
- }
-
- item_index = 1;
- for (num = _itemArrayInited - 1; num; num--) {
- Item *item = _itemArrayPtr[item_index++], *parent_item;
-
- uint parent = f->readUint16BE();
- uint sibling = f->readUint16BE();
-
- parent_item = derefItem(parent);
-
- setItemParent(item, parent_item);
-
- if (parent_item == NULL) {
- item->parent = parent;
- item->sibling = sibling;
- }
-
- item->state = f->readUint16BE();
- item->classFlags = f->readUint16BE();
-
- Child1 *child1 = (Child1 *)findChildOfType(item, 1);
- if (child1 != NULL) {
- child1->fr2 = f->readUint16BE();
- }
-
- Child2 *child2 = (Child2 *)findChildOfType(item, 2);
- if (child2 != NULL) {
- child2->avail_props = f->readUint32BE();
- i = child2->avail_props & 1;
-
- for (j = 1; j < 16; j++) {
- if ((1 << j) & child2->avail_props) {
- child2->array[i++] = f->readUint16BE();
- }
- }
- }
-
- Child9 *child9 = (Child9 *) findChildOfType(item, 9);
- if (child9) {
- for (i = 0; i != 4; i++) {
- child9->array[i] = f->readUint16BE();
- }
- }
- }
-
-
- // read the 255 variables
- for (i = 0; i != 255; i++) {
- writeVariable(i, f->readUint16BE());
- }
-
- // read the items in array 6
- for (i = 0; i != 10; i++) {
- _itemArray6[i] = derefItem(f->readUint16BE());
- }
-
- // Read the bits in array 1 & 2
- for (i = 0; i != 32; i++)
- _bitArray[i] = f->readUint16BE();
-
- // Read the bits in array 3
- if (getGameType() == GType_FF) {
- for (i = 33; i != 48; i++)
- _bitArray[i] = f->readUint16BE();
- }
-
- if (f->ioFailed()) {
- error("load failed");
- }
-
- delete f;
-
- _noParentNotify = false;
-
- _lockWord &= ~0x100;
-
- return true;
-}
-
-} // End of namespace Simon
diff --git a/simon/simon.cpp b/simon/simon.cpp
deleted file mode 100644
index 78d0eac221..0000000000
--- a/simon/simon.cpp
+++ /dev/null
@@ -1,4292 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/stdafx.h"
-
-#include "backends/fs/fs.h"
-
-#include "base/gameDetector.h"
-#include "base/plugins.h"
-
-#include "common/config-manager.h"
-#include "common/file.h"
-#include "common/md5.h"
-#include "common/system.h"
-
-#include "gui/about.h"
-#include "gui/message.h"
-
-#include "simon/simon.h"
-#include "simon/intern.h"
-#include "simon/vga.h"
-#include "simon/debugger.h"
-
-#include "sound/mididrv.h"
-#ifdef _WIN32_WCE
-extern bool isSmartphone(void);
-#endif
-
-#ifdef PALMOS_68K
-#include "globals.h"
-#endif
-
-using Common::File;
-
-struct ObsoleteTargets {
- const char *from;
- const char *to;
- Common::Platform platform;
-
- GameSettings toGameSettings() const {
- GameSettings dummy = { from, "Obsolete Target", 0 };
- return dummy;
- }
-};
-
-/**
- * Conversion table mapping old obsolete target names to the
- * corresponding new target and platform combination.
- *
- */
-static ObsoleteTargets obsoleteTargetsTable[] = {
- {"simon1acorn", "simon1", Common::kPlatformAcorn},
- {"simon1amiga", "simon1", Common::kPlatformAmiga},
- {"simon1cd32", "simon1", Common::kPlatformAmiga},
- {"simon1dos", "simon1", Common::kPlatformPC},
- {"simon1talkie", "simon1", Common::kPlatformPC},
- {"simon1win", "simon1", Common::kPlatformWindows},
- {"simon2dos", "simon2", Common::kPlatformPC},
- {"simon2talkie", "simon2", Common::kPlatformPC},
- {"simon2mac", "simon2", Common::kPlatformMacintosh},
- {"simon2win", "simon2", Common::kPlatformWindows},
- {NULL, NULL, Common::kPlatformUnknown}
-};
-
-static const GameSettings simonGames[] = {
- // Simon the Sorcerer 1 & 2 (not SCUMM games)
- {"feeble", "The Feeble Files", 0},
- {"simon1", "Simon the Sorcerer 1", 0},
- {"simon2", "Simon the Sorcerer 2", 0},
-
- {"simon1acorn", "Simon the Sorcerer 1 (Acorn)", 0},
- {"simon1amiga", "Simon the Sorcerer 1 (Amiga)", 0},
- {"simon1cd32", "Simon the Sorcerer 1 Talkie (Amiga CD32)", 0},
- {"simon1demo", "Simon the Sorcerer 1 (DOS Demo)", 0},
- {"simon1dos", "Simon the Sorcerer 1 (DOS)", 0},
- {"simon1talkie", "Simon the Sorcerer 1 Talkie", 0},
- {"simon1win", "Simon the Sorcerer 1 Talkie (Windows)", 0},
- {"simon2dos", "Simon the Sorcerer 2 (DOS)", 0},
- {"simon2talkie", "Simon the Sorcerer 2 Talkie", 0},
- {"simon2win", "Simon the Sorcerer 2 Talkie (Windows)", 0},
- {"simon2mac", "Simon the Sorcerer 2 Talkie (Amiga or Mac)", 0},
-
- {NULL, NULL, 0}
-};
-
-GameList Engine_SIMON_gameList() {
- GameList games;
- const GameSettings *g = simonGames;
- while (g->gameid) {
- games.push_back(*g);
- g++;
- }
-
- return games;
-}
-
-DetectedGameList Engine_SIMON_detectGames(const FSList &fslist) {
- return Simon::GAME_ProbeGame(fslist);
-}
-
-Engine *Engine_SIMON_create(GameDetector *detector, OSystem *syst) {
- const ObsoleteTargets *o = obsoleteTargetsTable;
- while (o->from) {
- if (!scumm_stricmp(detector->_game.gameid, o->from)) {
- detector->_game.gameid = o->to;
-
- ConfMan.set("gameid", o->to);
-
- if (o->platform != Common::kPlatformUnknown)
- ConfMan.set("platform", Common::getPlatformCode(o->platform));
-
- warning("Target upgraded from %s to %s", o->from, o->to);
- ConfMan.flushToDisk();
- break;
- }
- o++;
- }
-
- return new Simon::SimonEngine(detector, syst);
-}
-
-REGISTER_PLUGIN(SIMON, "Simon the Sorcerer")
-
-namespace Simon {
-
-#ifdef PALMOS_68K
-#define PTR(a) a
-static const GameSpecificSettings *simon1_settings;
-static const GameSpecificSettings *simon1acorn_settings;
-static const GameSpecificSettings *simon1amiga_settings;
-static const GameSpecificSettings *simon1demo_settings;
-static const GameSpecificSettings *simon2win_settings;
-static const GameSpecificSettings *simon2dos_settings;
-static const GameSpecificSettings *feeblefiles_settings;
-#else
-#define PTR(a) &a
-static const GameSpecificSettings simon1_settings = {
- "SIMON.GME", // gme_filename
- "SIMON.WAV", // wav_filename
- "SIMON.VOC", // voc_filename
- "SIMON.MP3", // mp3_filename
- "SIMON.OGG", // vorbis_filename
- "SIMON.FLA", // flac_filename
- "EFFECTS.VOC", // voc_effects_filename
- "EFFECTS.MP3", // mp3_effects_filename
- "EFFECTS.OGG", // vorbis_effects_filename
- "EFFECTS.FLA", // flac_effects_filename
- "GAMEPC", // gamepc_filename
-};
-
-static const GameSpecificSettings simon1acorn_settings = {
- "DATA", // gme_filename
- "", // wav_filename
- "SIMON", // voc_filename
- "SIMON.MP3", // mp3_filename
- "SIMON.OGG", // vorbis_filename
- "SIMON.FLA", // flac_filename
- "EFFECTS", // voc_effects_filename
- "EFFECTS.MP3", // mp3_effects_filename
- "EFFECTS.OGG", // vorbis_effects_filename
- "EFFECTS.FLA", // flac_effects_filename
- "GAMEBASE", // gamepc_filename
-};
-
-static const GameSpecificSettings simon1amiga_settings = {
- "", // gme_filename
- "", // wav_filename
- "", // voc_filename
- "SIMON.MP3", // mp3_filename
- "SIMON.OGG", // vorbis_filename
- "SIMON.FLA", // flac_filename
- "", // voc_effects_filename
- "", // mp3_effects_filename
- "", // vorbis_effects_filename
- "", // flac_effects_filename
- "gameamiga", // gamepc_filename
-};
-
-static const GameSpecificSettings simon1demo_settings = {
- "", // gme_filename
- "", // wav_filename
- "", // voc_filename
- "", // mp3_filename
- "", // vorbis_filename
- "", // flac_filename
- "", // voc_effects_filename
- "", // mp3_effects_filename
- "", // vorbis_effects_filename
- "", // flac_effects_filename
- "GDEMO", // gamepc_filename
-};
-
-static const GameSpecificSettings simon2win_settings = {
- "SIMON2.GME", // gme_filename
- "SIMON2.WAV", // wav_filename
- "SIMON2.VOC", // voc_filename
- "SIMON2.MP3", // mp3_filename
- "SIMON2.OGG", // vorbis_filename
- "SIMON2.FLA", // flac_filename
- "", // voc_effects_filename
- "", // mp3_effects_filename
- "", // vorbis_effects_filename
- "", // flac_effects_filename
- "GSPTR30", // gamepc_filename
-};
-
-static const GameSpecificSettings simon2dos_settings = {
- "SIMON2.GME", // gme_filename
- "", // wav_filename
- "", // voc_filename
- "", // mp3_filename
- "", // vorbis_filename
- "", // flac_filename
- "", // voc_effects_filename
- "", // mp3_effects_filename
- "", // vorbis_effects_filename
- "", // flac_effects_filename
- "GAME32", // gamepc_filename
-};
-
-static const GameSpecificSettings feeblefiles_settings = {
- "", // gme_filename
- "VOICES.WAV", // wav_filename
- "VOICES.VOC", // voc_filename
- "VOICES.MP3", // mp3_filename
- "VOICES.OGG", // vorbis_filename
- "VOICES.FLA", // flac_filename
- "", // voc_effects_filename
- "", // mp3_effects_filename
- "", // vorbis_effects_filename
- "", // flac_effects_filename
- "GAME22", // gamepc_filename
-};
-#endif
-
-SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst)
- : Engine(syst), midi(syst) {
- _vcPtr = 0;
- _vc_get_out_of_code = 0;
- _gameOffsetsPtr = 0;
-
- _debugger = 0;
- setupVgaOpcodes();
-
- _keyPressed = 0;
-
- _gameFile = 0;
-
- _strippedTxtMem = 0;
- _textSize = 0;
- _stringTabNum = 0;
- _stringTabPos = 0;
- _stringtab_numalloc = 0;
- _stringTabPtr = 0;
-
- _itemArrayPtr = 0;
- _itemArraySize = 0;
- _itemArrayInited = 0;
-
- _itemHeapPtr = 0;
- _itemHeapCurPos = 0;
- _itemHeapSize = 0;
-
- _iconFilePtr = 0;
-
- _tblList = 0;
-
- _codePtr = 0;
-
- _localStringtable = 0;
- _stringIdLocalMin = 1;
- _stringIdLocalMax = 0;
-
- _tablesHeapPtr = 0;
- _tablesHeapPtrOrg = 0;
- _tablesheapPtrNew = 0;
- _tablesHeapSize = 0;
- _tablesHeapCurPos = 0;
- _tablesHeapCurPosOrg = 0;
- _tablesHeapCurPosNew = 0;
-
- _subroutineList = 0;
- _subroutineListOrg = 0;
- _subroutine = 0;
-
- _dxSurfacePitch = 0;
-
- _recursionDepth = 0;
-
- _lastVgaTick = 0;
-
- _marks = 0;
-
- _scriptVar2 = 0;
- _runScriptReturn1 = 0;
- _skipVgaWait = 0;
- _noParentNotify = 0;
- _beardLoaded = 0;
- _hitarea_unk_3 = 0;
- _mortalFlag = 0;
- _updateScreen = 0;
- _usePaletteDelay = 0;
- _syncFlag2 = 0;
- _inCallBack = 0;
- _cepeFlag = 0;
- _copyPartialMode = 0;
- _speed = 1;
- _fastMode = 0;
- _dxUse3Or4ForLock = 0;
-
- _debugMode = 0;
- _pause = 0;
- _startMainScript = 0;
- _continousMainScript = 0;
- _startVgaScript = 0;
- _continousVgaScript = 0;
- _drawImagesDebug = 0;
- _dumpImages = 0;
- _speech = true;
- _subtitles = true;
- _fade = true;
- _mouseCursor = 0;
- _vgaVar9 = 0;
- _scriptUnk1 = 0;
- _vgaVar6 = 0;
- _scrollX = 0;
- _scrollY = 0;
- _scrollXMax = 0;
- _scrollYMax = 0;
- _scrollCount = 0;
- _scrollFlag = 0;
- _scrollHeight = 0;
- _scrollWidth = 0;
- _scrollImage = 0;
- _vgaVar8 = 0;
-
- _scriptVerb = 0;
- _scriptNoun1 = 0;
- _scriptNoun2 = 0;
- _scriptAdj1 = 0;
- _scriptAdj2 = 0;
-
- _curWindow = 0;
- _textWindow = 0;
-
- _subjectItem = 0;
- _objectItem = 0;
- _item1 = 0;
-
- _hitAreaObjectItem = 0;
- _lastHitArea = 0;
- _lastHitArea2Ptr = 0;
- _lastHitArea3 = 0;
- _leftButtonDown = 0;
- _hitAreaSubjectItem = 0;
- _hitAreaPtr5 = 0;
- _hitAreaPtr7 = 0;
- _needHitAreaRecalc = 0;
- _verbHitArea = 0;
- _hitAreaUnk4 = 0;
- _mouseHideCount = 0;
-
- _windowNum = 0;
-
- _printCharCurPos = 0;
- _printCharMaxPos = 0;
- _numLettersToPrint = 0;
-
- _lastTime = 0;
-
- _firstTimeStruct = 0;
- _pendingDeleteTimeEvent = 0;
-
- _base_time = 0;
-
- _mouseX = 0;
- _mouseY = 0;
- _mouseXOld = 0;
- _mouseYOld = 0;
-
- _dummyItem1 = new Item();
- _dummyItem2 = new Item();
- _dummyItem3 = new Item();
-
- _lockWord = 0;
- _scrollUpHitArea = 0;
- _scrollDownHitArea = 0;
-
- _videoVar7 = 0xFFFF;
- _paletteColorCount = 0;
-
- _videoVar4 = 0;
- _videoVar5 = 0;
- _fastFadeOutFlag = 0;
- _unkPalFlag = 0;
- _exitCutscene = 0;
- _skipSpeech = 0;
- _paletteFlag = 0;
-
- _soundFileId = 0;
- _lastMusicPlayed = -1;
- _nextMusicToPlay = -1;
-
- _showPreposition = 0;
- _showMessageFlag = 0;
-
- _videoNumPalColors = 0;
-
- _vgaSpriteChanged = 0;
-
- _vgaBufFreeStart = 0;
- _vgaBufEnd = 0;
- _vgaBufStart = 0;
- _vgaFileBufOrg = 0;
- _vgaFileBufOrg2 = 0;
-
- _curVgaFile1 = 0;
- _curVgaFile2 = 0;
- _curSfxFile = 0;
-
- _timer1 = 0;
- _timer5 = 0;
- _timer4 = 0;
-
- _frameRate = 1;
-
- _vgaCurFile2 = 0;
- _vgaWaitFor = 0;
- _vgaCurFileId = 0;
- _vgaCurSpriteId = 0;
-
- _nextVgaTimerToProcess = 0;
-
- memset(_vcItemArray, 0, sizeof(_vcItemArray));
- memset(_itemArray6, 0, sizeof(_itemArray6));
-
- memset(_stringIdArray2, 0, sizeof(_stringIdArray2));
- memset(_stringIdArray3, 0, sizeof(_stringIdArray3));
- memset(_speechIdArray4, 0, sizeof(_speechIdArray4));
-
- memset(_bitArray, 0, sizeof(_bitArray));
- memset(_variableArray, 0, sizeof(_variableArray));
-
- memset(_windowArray, 0, sizeof(_windowArray));
-
- memset(_fcsData1, 0, sizeof(_fcsData1));
- memset(_fcsData2, 0, sizeof(_fcsData2));
-
- _freeStringSlot = 0;
-
- memset(_stringReturnBuffer, 0, sizeof(_stringReturnBuffer));
-
- memset(_pathFindArray, 0, sizeof(_pathFindArray));
-
- memset(_pathValues, 0, sizeof(_pathValues));
- _PVCount = 0;
- _GPVCount = 0;
-
- memset(_pathValues1, 0, sizeof(_pathValues1));
- _PVCount1 = 0;
- _GPVCount1 = 0;
-
- memset(_paletteBackup, 0, sizeof(_paletteBackup));
- memset(_palette, 0, sizeof(_palette));
-
- memset(_videoBuf1, 0, sizeof(_videoBuf1));
-
- _fcs_list = new FillOrCopyStruct[16];
-
- memset(_lettersToPrintBuf, 0, sizeof(_lettersToPrintBuf));
-
- _numScreenUpdates = 0;
- _vgaTickCounter = 0;
-
- _sound = 0;
-
- _effectsPaused = false;
- _ambientPaused = false;
- _musicPaused = false;
-
- _dumpFile = 0;
-
- _saveLoadType = 0;
- _saveLoadSlot = 0;
- memset(_saveLoadName, 0, sizeof(_saveLoadName));
-
- _saveLoadRowCurPos = 0;
- _numSaveGameRows = 0;
- _saveDialogFlag = false;
- _saveOrLoad = false;
- _saveLoadFlag = false;
-
- _sdlMouseX = 0;
- _sdlMouseY = 0;
-
- _sdl_buf_3 = 0;
- _sdl_buf = 0;
- _sdl_buf_attached = 0;
-
- _vc10BasePtrOld = 0;
- memcpy (_hebrew_char_widths,
- "\x5\x5\x4\x6\x5\x3\x4\x5\x6\x3\x5\x5\x4\x6\x5\x3\x4\x6\x5\x6\x6\x6\x5\x5\x5\x6\x5\x6\x6\x6\x6\x6", 32);
-
-}
-
-int SimonEngine::init(GameDetector &detector) {
-
- // Add default file directories for Acorn version
- File::addDefaultDirectory(_gameDataPath + "execute/");
- File::addDefaultDirectory(_gameDataPath + "EXECUTE/");
-
- // Detect game
- if (!initGame()) {
- return -1;
- }
-
- if (getGameType() == GType_FF) {
- _screenWidth = 640;
- _screenHeight = 480;
- } else {
- _screenWidth = 320;
- _screenHeight = 200;
- }
-
- // Setup mixer
- if (!_mixer->isReady())
- warning("Sound initialization failed. "
- "Features of the game that depend on sound synchronization will most likely break");
- set_volume(ConfMan.getInt("sfx_volume"));
- _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
-
- _system->beginGFXTransaction();
- initCommonGFX(detector);
- _system->initSize(_screenWidth, _screenHeight);
- if (getGameType() == GType_FF)
- _system->setGraphicsMode("1x");
- _system->endGFXTransaction();
-
- // Setup midi driver
- MidiDriver *driver = 0;
- if (getPlatform() == Common::kPlatformAmiga) {
- driver = MidiDriver::createMidi(MD_NULL); // Create fake MIDI driver for Simon1Amiga and Simon2CD32 for now
- _native_mt32 = false;
- } else {
- int midiDriver = MidiDriver::detectMusicDriver(MDT_ADLIB | MDT_MIDI);
- _native_mt32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
- driver = MidiDriver::createMidi(midiDriver);
- if (_native_mt32) {
- driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
- }
- }
-
- midi.mapMT32toGM (getGameType() == GType_SIMON1 && !_native_mt32);
-
- midi.set_driver(driver);
- int ret = midi.open();
- if (ret)
- warning ("MIDI Player init failed: \"%s\"", midi.getErrorName (ret));
- midi.set_volume(ConfMan.getInt("music_volume"));
-
- _debugMode = (gDebugLevel >= 0);
- _language = Common::parseLanguage(ConfMan.get("language"));
-
- if (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute") == 1)
- midi.pause(_musicPaused ^= 1);
-
- if ((getGameType() == GType_SIMON2) && ConfMan.hasKey("speech_mute") && ConfMan.getBool("speech_mute") == 1)
- _speech = 0;
-
- if ((getGameType() == GType_SIMON1 && _language > 1) || ((getGameType() == GType_SIMON2) && _language == Common::HB_ISR)) {
- if (ConfMan.hasKey("subtitles") && ConfMan.getBool("subtitles") == 0)
- _subtitles = 0;
- } else
- _subtitles = ConfMan.getBool("subtitles");
-
- // Make sure either speech or subtitles is enabled
- if ((getFeatures() & GF_TALKIE) && !_speech && !_subtitles)
- _subtitles = 1;
-
- if (ConfMan.hasKey("fade") && ConfMan.getBool("fade") == 0)
- _fade = 0;
-
- if (ConfMan.hasKey("slow_down") && ConfMan.getInt("slow_down") >= 1)
- _speed = ConfMan.getInt("slow_down");
-
- // FIXME Use auto dirty rects cleanup code to reduce CPU usage
- g_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true);
-
- VGA_DELAY_BASE = 1;
- if (getGameType() == GType_FF) {
- NUM_VIDEO_OP_CODES = 85;
-#ifndef PALMOS_68K
- VGA_MEM_SIZE = 7500000;
-#else
- VGA_MEM_SIZE = gVars->memory[kMemSimon2Games];
-#endif
- TABLES_MEM_SIZE = 200000;
- } else if (getGameType() == GType_SIMON2) {
- TABLE_INDEX_BASE = 1580 / 4;
- TEXT_INDEX_BASE = 1500 / 4;
- NUM_VIDEO_OP_CODES = 75;
-#ifndef PALMOS_68K
- VGA_MEM_SIZE = 2000000;
-#else
- VGA_MEM_SIZE = gVars->memory[kMemSimon2Games];
-#endif
- TABLES_MEM_SIZE = 100000;
- // Check whether to use MT-32 MIDI tracks in Simon the Sorcerer 2
- if ((getGameType() == GType_SIMON2) && _native_mt32)
- MUSIC_INDEX_BASE = (1128 + 612) / 4;
- else
- MUSIC_INDEX_BASE = 1128 / 4;
- SOUND_INDEX_BASE = 1660 / 4;
- } else {
- TABLE_INDEX_BASE = 1576 / 4;
- TEXT_INDEX_BASE = 1460 / 4;
- NUM_VIDEO_OP_CODES = 64;
-#ifndef PALMOS_68K
- VGA_MEM_SIZE = 1000000;
-#else
- VGA_MEM_SIZE = gVars->memory[kMemSimon1Games];
-#endif
- TABLES_MEM_SIZE = 50000;
- MUSIC_INDEX_BASE = 1316 / 4;
- SOUND_INDEX_BASE = 0;
- }
-
- if (getGameType() == GType_FF) {
- gss = PTR(feeblefiles_settings);
- } else if (getGameType() == GType_SIMON2) {
- if (getFeatures() & GF_TALKIE) {
- gss = PTR(simon2win_settings);
-
- // Add default file directories
- File::addDefaultDirectory(_gameDataPath + "voices/");
- File::addDefaultDirectory(_gameDataPath + "VOICES/");
- } else {
- gss = PTR(simon2dos_settings);
- }
- } else if (getGameType() == GType_SIMON1) {
- if (getPlatform() == Common::kPlatformAcorn) {
- gss = PTR(simon1acorn_settings);
- } else if (getPlatform() == Common::kPlatformAmiga) {
- gss = PTR(simon1amiga_settings);
- } else if (getGameId() == GID_SIMON1DEMO) {
- gss = PTR(simon1demo_settings);
- } else {
- gss = PTR(simon1_settings);
- }
- }
-
- if ((getGameType() == GType_SIMON1) && (getFeatures() & GF_TALKIE)) {
- // Add default file directories
- switch (_language) {
- case Common::HB_ISR:
- File::addDefaultDirectory(_gameDataPath + "hebrew/");
- File::addDefaultDirectory(_gameDataPath + "HEBREW/");
- break;
- case Common::ES_ESP:
- File::addDefaultDirectory(_gameDataPath + "spanish/");
- File::addDefaultDirectory(_gameDataPath + "SPANISH/");
- break;
- case Common::IT_ITA:
- File::addDefaultDirectory(_gameDataPath + "italian/");
- File::addDefaultDirectory(_gameDataPath + "ITALIAN/");
- break;
- case Common::FR_FRA:
- File::addDefaultDirectory(_gameDataPath + "french/");
- File::addDefaultDirectory(_gameDataPath + "FRENCH/");
- break;
- }
- }
-
- return 0;
-}
-
-SimonEngine::~SimonEngine() {
- delete _gameFile;
-
- midi.close();
-
- free(_stringTabPtr);
- free(_itemArrayPtr);
- free(_itemHeapPtr - _itemHeapCurPos);
- free(_tablesHeapPtr - _tablesHeapCurPos);
- free(_tblList);
- free(_iconFilePtr);
- free(_gameOffsetsPtr);
-
- delete _dummyItem1;
- delete _dummyItem2;
- delete _dummyItem3;
-
- delete [] _fcs_list;
-
- delete _sound;
- delete _debugger;
-}
-
-void SimonEngine::errorString(const char *buf1, char *buf2) {
- strcpy(buf2, buf1);
-
-#ifdef _WIN32_WCE
- if (isSmartphone())
- return;
-#endif
-
- // Unless an error -originated- within the debugger, spawn the
- // debugger. Otherwise exit out normally.
- if (_debugger && !_debugger->isAttached()) {
- // (Print it again in case debugger segfaults)
- printf("%s\n", buf2);
- _debugger->attach(buf2);
- _debugger->onFrame();
- }
-}
-
-void SimonEngine::palette_fadeout(uint32 *pal_values, uint num) {
- byte *p = (byte *)pal_values;
-
- do {
- if (p[0] >= 8)
- p[0] -= 8;
- else
- p[0] = 0;
- if (p[1] >= 8)
- p[1] -= 8;
- else
- p[1] = 0;
- if (p[2] >= 8)
- p[2] -= 8;
- else
- p[2] = 0;
- p += 4;
- } while (--num);
-}
-
-byte *SimonEngine::allocateItem(uint size) {
- byte *org = _itemHeapPtr;
- size = (size + 3) & ~3;
-
- _itemHeapPtr += size;
- _itemHeapCurPos += size;
-
- if (_itemHeapCurPos > _itemHeapSize)
- error("Itemheap overflow");
-
- return org;
-}
-
-void SimonEngine::alignTableMem() {
- if ((unsigned long)_tablesHeapPtr & 3) {
- _tablesHeapPtr += 2;
- _tablesHeapCurPos += 2;
- }
-}
-
-byte *SimonEngine::allocateTable(uint size) {
- byte *org = _tablesHeapPtr;
-
- size = (size + 1) & ~1;
-
- _tablesHeapPtr += size;
- _tablesHeapCurPos += size;
-
- if (_tablesHeapCurPos > _tablesHeapSize)
- error("Tablesheap overflow");
-
- return org;
-}
-
-int SimonEngine::allocGamePcVars(File *in) {
- uint item_array_size, item_array_inited, stringtable_num;
- uint32 version;
- uint i;
-
- item_array_size = in->readUint32BE();
- version = in->readUint32BE();
- item_array_inited = in->readUint32BE();
- stringtable_num = in->readUint32BE();
-
- item_array_inited += 2; // first two items are predefined
- item_array_size += 2;
-
- if (version != 0x80)
- error("Not a runtime database");
-
- _itemArrayPtr = (Item **)calloc(item_array_size, sizeof(Item *));
- if (_itemArrayPtr == NULL)
- error("Out of memory for Item array");
-
- _itemArraySize = item_array_size;
- _itemArrayInited = item_array_inited;
-
- for (i = 1; i < item_array_inited; i++) {
- _itemArrayPtr[i] = (Item *)allocateItem(sizeof(Item));
- }
-
- // The rest is cleared automatically by calloc
- allocateStringTable(stringtable_num + 10);
- _stringTabNum = stringtable_num;
-
- return item_array_inited;
-}
-
-void SimonEngine::loginPlayerHelper(Item *item, int a, int b) {
- Child9 *child;
-
- child = (Child9 *) findChildOfType(item, 9);
- if (child == NULL) {
- child = (Child9 *) allocateChildBlock(item, 9, sizeof(Child9));
- }
-
- if (a >= 0 && a <= 3)
- child->array[a] = b;
-}
-
-void SimonEngine::loginPlayer() {
- Child *child;
-
- _item1 = _itemArrayPtr[1];
- _item1->adjective = -1;
- _item1->noun = 10000;
-
- child = (Child *)allocateChildBlock(_item1, 3, sizeof(Child));
- if (child == NULL)
- error("player create failure");
-
- loginPlayerHelper(_item1, 0, 0);
-}
-
-void SimonEngine::allocateStringTable(int num) {
- _stringTabPtr = (byte **)calloc(num, sizeof(byte *));
- _stringTabPos = 0;
- _stringtab_numalloc = num;
-}
-
-void SimonEngine::setupStringTable(byte *mem, int num) {
- int i = 0;
- for (;;) {
- _stringTabPtr[i++] = mem;
- if (--num == 0)
- break;
- for (; *mem; mem++);
- mem++;
- }
-
- _stringTabPos = i;
-}
-
-void SimonEngine::setupLocalStringTable(byte *mem, int num) {
- int i = 0;
- for (;;) {
- _localStringtable[i++] = mem;
- if (--num == 0)
- break;
- for (; *mem; mem++);
- mem++;
- }
-}
-
-void SimonEngine::readSubroutineLine(File *in, SubroutineLine *sl, Subroutine *sub) {
- byte line_buffer[1024], *q = line_buffer;
- int size;
-
- if (sub->id == 0) {
- sl->verb = in->readUint16BE();
- sl->noun1 = in->readUint16BE();
- sl->noun2 = in->readUint16BE();
- }
-
- while ((*q = in->readByte()) != 0xFF) {
- if (*q == 87) {
- in->readUint16BE();
- } else {
- q = readSingleOpcode(in, q);
- }
- }
-
- size = q - line_buffer + 1;
-
- memcpy(allocateTable(size), line_buffer, size);
-}
-
-SubroutineLine *SimonEngine::createSubroutineLine(Subroutine *sub, int where) {
- SubroutineLine *sl, *cur_sl = NULL, *last_sl = NULL;
-
- if (sub->id == 0)
- sl = (SubroutineLine *)allocateTable(SUBROUTINE_LINE_BIG_SIZE);
- else
- sl = (SubroutineLine *)allocateTable(SUBROUTINE_LINE_SMALL_SIZE);
-
- // where is what offset to insert the line at, locate the proper beginning line
- if (sub->first != 0) {
- cur_sl = (SubroutineLine *)((byte *)sub + sub->first);
- while (where) {
- last_sl = cur_sl;
- cur_sl = (SubroutineLine *)((byte *)sub + cur_sl->next);
- if ((byte *)cur_sl == (byte *)sub)
- break;
- where--;
- }
- }
-
- if (last_sl != NULL) {
- // Insert the subroutine line in the middle of the link
- last_sl->next = (byte *)sl - (byte *)sub;
- sl->next = (byte *)cur_sl - (byte *)sub;
- } else {
- // Insert the subroutine line at the head of the link
- sl->next = sub->first;
- sub->first = (byte *)sl - (byte *)sub;
- }
-
- return sl;
-}
-
-void SimonEngine::readSubroutine(File *in, Subroutine *sub) {
- while (in->readUint16BE() == 0) {
- readSubroutineLine(in, createSubroutineLine(sub, 0xFFFF), sub);
- }
-}
-
-Subroutine *SimonEngine::createSubroutine(uint id) {
- Subroutine *sub;
-
- alignTableMem();
-
- sub = (Subroutine *)allocateTable(sizeof(Subroutine));
- sub->id = id;
- sub->first = 0;
- sub->next = _subroutineList;
- _subroutineList = sub;
- return sub;
-}
-
-void SimonEngine::readSubroutineBlock(File *in) {
- while (in->readUint16BE() == 0) {
- readSubroutine(in, createSubroutine(in->readUint16BE()));
- }
-}
-
-Child *SimonEngine::findChildOfType(Item *i, uint type) {
- Child *child = i->children;
- for (; child; child = child->next)
- if (child->type == type)
- return child;
- return NULL;
-}
-
-bool SimonEngine::isRoom(Item *item) {
- return findChildOfType(item, 1) != NULL;
-}
-
-bool SimonEngine::isObject(Item *item) {
- return findChildOfType(item, 2) != NULL;
-}
-
-uint SimonEngine::getOffsetOfChild2Param(Child2 *child, uint prop) {
- uint m = 1;
- uint offset = 0;
- while (m != prop) {
- if (child->avail_props & m)
- offset++;
- m *= 2;
- }
- return offset;
-}
-
-Child *SimonEngine::allocateChildBlock(Item *i, uint type, uint size) {
- Child *child = (Child *)allocateItem(size);
- child->next = i->children;
- i->children = child;
- child->type = type;
- return child;
-}
-
-void SimonEngine::allocItemHeap() {
- _itemHeapSize = 10000;
- _itemHeapCurPos = 0;
- _itemHeapPtr = (byte *)calloc(10000, 1);
-}
-
-void SimonEngine::allocTablesHeap() {
- _tablesHeapSize = TABLES_MEM_SIZE;
- _tablesHeapCurPos = 0;
- _tablesHeapPtr = (byte *)calloc(TABLES_MEM_SIZE, 1);
-}
-
-void SimonEngine::setItemState(Item *item, int value) {
- item->state = value;
-}
-
-int SimonEngine::getNextWord() {
- int16 a = (int16)READ_BE_UINT16(_codePtr);
- _codePtr += 2;
- return a;
-}
-
-uint SimonEngine::getNextStringID() {
- return (uint16)getNextWord();
-}
-
-uint SimonEngine::getVarOrByte() {
- uint a = *_codePtr++;
- if (a != 255)
- return a;
- return readVariable(*_codePtr++);
-}
-
-uint SimonEngine::getVarOrWord() {
- uint a = READ_BE_UINT16(_codePtr);
- _codePtr += 2;
- if (a >= 30000 && a < 30512)
- return readVariable(a - 30000);
- return a;
-}
-
-Item *SimonEngine::getNextItemPtr() {
- int a = getNextWord();
- switch (a) {
- case -1:
- return _subjectItem;
- case -3:
- return _objectItem;
- case -5:
- return getItem1Ptr();
- case -7:
- return getItemPtrB();
- case -9:
- return derefItem(getItem1Ptr()->parent);
- default:
- return derefItem(a);
- }
-}
-
-Item *SimonEngine::getNextItemPtrStrange() {
- int a = getNextWord();
- switch (a) {
- case -1:
- return _subjectItem;
- case -3:
- return _objectItem;
- case -5:
- return _dummyItem2;
- case -7:
- return NULL;
- case -9:
- return _dummyItem3;
- default:
- return derefItem(a);
- }
-}
-
-uint SimonEngine::getNextItemID() {
- int a = getNextWord();
- switch (a) {
- case -1:
- return itemPtrToID(_subjectItem);
- case -3:
- return itemPtrToID(_objectItem);
- case -5:
- return getItem1ID();
- case -7:
- return 0;
- case -9:
- return getItem1Ptr()->parent;
- default:
- return a;
- }
-}
-
-Item *SimonEngine::getItem1Ptr() {
- if (_item1)
- return _item1;
- return _dummyItem1;
-}
-
-Item *SimonEngine::getItemPtrB() {
- error("getItemPtrB: is this code ever used?");
- return _dummyItem1;
-}
-
-uint SimonEngine::getNextVarContents() {
- return (uint16)readVariable(getVarOrByte());
-}
-
-uint SimonEngine::readVariable(uint variable) {
- if (variable >= 255)
- error("Variable %d out of range in read", variable);
- return _variableArray[variable];
-}
-
-void SimonEngine::writeNextVarContents(uint16 contents) {
- writeVariable(getVarOrByte(), contents);
-}
-
-void SimonEngine::writeVariable(uint variable, uint16 contents) {
- if (variable >= 256)
- error("Variable %d out of range in write", variable);
- _variableArray[variable] = contents;
-}
-
-void SimonEngine::setItemParent(Item *item, Item *parent) {
- Item *old_parent = derefItem(item->parent);
-
- if (item == parent)
- error("Trying to set item as its own parent");
-
- // unlink it if it has a parent
- if (old_parent)
- unlinkItem(item);
- itemChildrenChanged(old_parent);
- linkItem(item, parent);
- itemChildrenChanged(parent);
-}
-
-void SimonEngine::itemChildrenChanged(Item *item) {
- int i;
- FillOrCopyStruct *fcs;
-
- if (_noParentNotify)
- return;
-
- mouseOff();
-
- for (i = 0; i != 8; i++) {
- fcs = _windowArray[i];
- if (fcs && fcs->fcs_data && fcs->fcs_data->item_ptr == item) {
- if (_fcsData1[i]) {
- _fcsData2[i] = true;
- } else {
- _fcsData2[i] = false;
- drawIconArray(i, item, fcs->fcs_data->unk1, fcs->fcs_data->unk2);
- }
- }
- }
-
- mouseOn();
-}
-
-void SimonEngine::unlinkItem(Item *item) {
- Item *first, *parent, *next;
-
- // can't unlink item without parent
- if (item->parent == 0)
- return;
-
- // get parent and first child of parent
- parent = derefItem(item->parent);
- first = derefItem(parent->child);
-
- // the node to remove is first in the parent's children?
- if (first == item) {
- parent->child = item->sibling;
- item->parent = 0;
- item->sibling = 0;
- return;
- }
-
- for (;;) {
- if (!first)
- error("unlinkItem: parent empty");
- if (first->sibling == 0)
- error("unlinkItem: parent does not contain child");
-
- next = derefItem(first->sibling);
- if (next == item) {
- first->sibling = next->sibling;
- item->parent = 0;
- item->sibling = 0;
- return;
- }
- first = next;
- }
-}
-
-void SimonEngine::linkItem(Item *item, Item *parent) {
- uint id;
- // Don't allow that an item that is already linked is relinked
- if (item->parent)
- return;
-
- id = itemPtrToID(parent);
- item->parent = id;
-
- if (parent != 0) {
- item->sibling = parent->child;
- parent->child = itemPtrToID(item);
- } else {
- item->sibling = 0;
- }
-}
-
-const byte *SimonEngine::getStringPtrByID(uint string_id) {
- const byte *string_ptr;
- byte *dst;
-
- _freeStringSlot ^= 1;
-
- if (string_id < 0x8000) {
- string_ptr = _stringTabPtr[string_id];
- } else {
- string_ptr = getLocalStringByID(string_id);
- }
-
- dst = _stringReturnBuffer[_freeStringSlot];
- strcpy((char *)dst, (const char *)string_ptr);
- return dst;
-}
-
-const byte *SimonEngine::getLocalStringByID(uint string_id) {
- if (string_id < _stringIdLocalMin || string_id >= _stringIdLocalMax) {
- loadTextIntoMem(string_id);
- }
- return _localStringtable[string_id - _stringIdLocalMin];
-}
-
-void SimonEngine::loadTextIntoMem(uint string_id) {
- byte *p;
- char filename[30];
- int i;
- uint base_min = 0x8000, base_max, size;
-
- _tablesHeapPtr = _tablesheapPtrNew;
- _tablesHeapCurPos = _tablesHeapCurPosNew;
-
- p = _strippedTxtMem;
-
- // get filename
- while (*p) {
- for (i = 0; *p; p++, i++)
- filename[i] = *p;
- filename[i] = 0;
- p++;
-
- base_max = (p[0] * 256) | p[1];
- p += 2;
-
- if (string_id < base_max) {
- _stringIdLocalMin = base_min;
- _stringIdLocalMax = base_max;
-
- _localStringtable = (byte **)_tablesHeapPtr;
-
- size = (base_max - base_min + 1) * sizeof(byte *);
- _tablesHeapPtr += size;
- _tablesHeapCurPos += size;
-
- size = loadTextFile(filename, _tablesHeapPtr);
-
- setupLocalStringTable(_tablesHeapPtr, base_max - base_min + 1);
-
- _tablesHeapPtr += size;
- _tablesHeapCurPos += size;
-
- if (_tablesHeapCurPos > _tablesHeapSize) {
- error("loadTextIntoMem: Out of table memory");
- }
- return;
- }
-
- base_min = base_max;
- }
-
- error("loadTextIntoMem: didn't find %d", string_id);
-}
-
-void SimonEngine::loadTablesIntoMem(uint subr_id) {
- byte *p;
- int i;
- uint min_num, max_num;
- char filename[30];
- File *in;
-
- p = _tblList;
- if (p == NULL)
- return;
-
- while (*p) {
- for (i = 0; *p; p++, i++)
- filename[i] = *p;
- filename[i] = 0;
- p++;
-
- for (;;) {
- min_num = (p[0] * 256) | p[1];
- p += 2;
-
- if (min_num == 0)
- break;
-
- max_num = (p[0] * 256) | p[1];
- p += 2;
-
- if (subr_id >= min_num && subr_id <= max_num) {
- _subroutineList = _subroutineListOrg;
- _tablesHeapPtr = _tablesHeapPtrOrg;
- _tablesHeapCurPos = _tablesHeapCurPosOrg;
- _stringIdLocalMin = 1;
- _stringIdLocalMax = 0;
-
- in = openTablesFile(filename);
- readSubroutineBlock(in);
- closeTablesFile(in);
- if (getGameType() == GType_FF) {
- // TODO
- } else if (getGameType() == GType_SIMON2) {
- _sound->loadSfxTable(_gameFile, _gameOffsetsPtr[atoi(filename + 6) - 1 + SOUND_INDEX_BASE]);
- } else if (getPlatform() == Common::kPlatformWindows) {
- memcpy(filename, "SFXXXX", 6);
- _sound->readSfxFile(filename);
- }
-
- alignTableMem();
-
- _tablesheapPtrNew = _tablesHeapPtr;
- _tablesHeapCurPosNew = _tablesHeapCurPos;
-
- if (_tablesHeapCurPos > _tablesHeapSize)
- error("loadTablesIntoMem: Out of table memory");
- return;
- }
- }
- }
-
- debug(1,"loadTablesIntoMem: didn't find %d", subr_id);
-}
-
-void SimonEngine::playSting(uint a) {
- if (!midi._enable_sfx)
- return;
-
- char filename[15];
-
- File mus_file;
- uint16 mus_offset;
-
- sprintf(filename, "STINGS%i.MUS", _soundFileId);
- mus_file.open(filename);
- if (!mus_file.isOpen()) {
- warning("Can't load sound effect from '%s'", filename);
- return;
- }
-
- mus_file.seek(a * 2, SEEK_SET);
- mus_offset = mus_file.readUint16LE();
- if (mus_file.ioFailed())
- error("Can't read sting %d offset", a);
-
- mus_file.seek(mus_offset, SEEK_SET);
- midi.loadSMF(&mus_file, a, true);
- midi.startTrack(0);
-}
-
-Subroutine *SimonEngine::getSubroutineByID(uint subroutine_id) {
- Subroutine *cur;
-
- _subroutine = subroutine_id;
-
- for (cur = _subroutineList; cur; cur = cur->next) {
- if (cur->id == subroutine_id)
- return cur;
- }
-
- loadTablesIntoMem(subroutine_id);
-
- for (cur = _subroutineList; cur; cur = cur->next) {
- if (cur->id == subroutine_id)
- return cur;
- }
-
- debug(1,"getSubroutineByID: subroutine %d not found", subroutine_id);
- return NULL;
-}
-
-uint SimonEngine::loadTextFile_gme(const char *filename, byte *dst) {
- uint res;
- uint32 offs;
- uint32 size;
-
- res = atoi(filename + 4) + TEXT_INDEX_BASE - 1;
- offs = _gameOffsetsPtr[res];
- size = _gameOffsetsPtr[res + 1] - offs;
-
- resfile_read(dst, offs, size);
-
- return size;
-}
-
-File *SimonEngine::openTablesFile_gme(const char *filename) {
- uint res;
- uint32 offs;
-
- res = atoi(filename + 6) + TABLE_INDEX_BASE - 1;
- offs = _gameOffsetsPtr[res];
-
- _gameFile->seek(offs, SEEK_SET);
- return _gameFile;
-}
-
-uint SimonEngine::loadTextFile_simon1(const char *filename, byte *dst) {
- File fo;
- fo.open(filename);
- uint32 size;
-
- if (fo.isOpen() == false)
- error("loadTextFile: Can't open '%s'", filename);
-
- size = fo.size();
-
- if (fo.read(dst, size) != size)
- error("loadTextFile: fread failed");
- fo.close();
-
- return size;
-}
-
-File *SimonEngine::openTablesFile_simon1(const char *filename) {
- File *fo = new File();
- fo->open(filename);
- if (fo->isOpen() == false)
- error("openTablesFile: Can't open '%s'", filename);
- return fo;
-}
-
-uint SimonEngine::loadTextFile(const char *filename, byte *dst) {
- if (getFeatures() & GF_OLD_BUNDLE)
- return loadTextFile_simon1(filename, dst);
- else
- return loadTextFile_gme(filename, dst);
-}
-
-File *SimonEngine::openTablesFile(const char *filename) {
- if (getFeatures() & GF_OLD_BUNDLE)
- return openTablesFile_simon1(filename);
- else
- return openTablesFile_gme(filename);
-}
-
-void SimonEngine::closeTablesFile(File *in) {
- if (getFeatures() & GF_OLD_BUNDLE) {
- in->close();
- delete in;
- }
-}
-
-void SimonEngine::addTimeEvent(uint timeout, uint subroutine_id) {
- TimeEvent *te = (TimeEvent *)malloc(sizeof(TimeEvent)), *first, *last = NULL;
- time_t cur_time;
-
- time(&cur_time);
-
- te->time = cur_time + timeout - _base_time;
- te->subroutine_id = subroutine_id;
-
- first = _firstTimeStruct;
- while (first) {
- if (te->time <= first->time) {
- if (last) {
- last->next = te;
- te->next = first;
- return;
- }
- te->next = _firstTimeStruct;
- _firstTimeStruct = te;
- return;
- }
-
- last = first;
- first = first->next;
- }
-
- if (last) {
- last->next = te;
- te->next = NULL;
- } else {
- _firstTimeStruct = te;
- te->next = NULL;
- }
-}
-
-void SimonEngine::delTimeEvent(TimeEvent *te) {
- TimeEvent *cur;
-
- if (te == _pendingDeleteTimeEvent)
- _pendingDeleteTimeEvent = NULL;
-
- if (te == _firstTimeStruct) {
- _firstTimeStruct = te->next;
- free(te);
- return;
- }
-
- cur = _firstTimeStruct;
- if (cur == NULL)
- error("delTimeEvent: none available");
-
- for (;;) {
- if (cur->next == NULL)
- error("delTimeEvent: no such te");
- if (te == cur->next) {
- cur->next = te->next;
- free(te);
- return;
- }
- cur = cur->next;
- }
-}
-
-void SimonEngine::killAllTimers() {
- TimeEvent *cur, *next;
-
- for (cur = _firstTimeStruct; cur; cur = next) {
- next = cur->next;
- delTimeEvent(cur);
- }
-}
-
-bool SimonEngine::kickoffTimeEvents() {
- time_t cur_time;
- TimeEvent *te;
- bool result = false;
-
- time(&cur_time);
- cur_time -= _base_time;
-
- while ((te = _firstTimeStruct) != NULL && te->time <= (uint32)cur_time) {
- result = true;
- _pendingDeleteTimeEvent = te;
- invokeTimeEvent(te);
- if (_pendingDeleteTimeEvent) {
- _pendingDeleteTimeEvent = NULL;
- delTimeEvent(te);
- }
- }
-
- return result;
-}
-
-void SimonEngine::invokeTimeEvent(TimeEvent *te) {
- Subroutine *sub;
-
- _scriptVerb = 0;
- if (_runScriptReturn1)
- return;
- sub = getSubroutineByID(te->subroutine_id);
- if (sub != NULL)
- startSubroutineEx(sub);
- _runScriptReturn1 = false;
-}
-
-void SimonEngine::o_setup_cond_c() {
-
- setup_cond_c_helper();
-
- _objectItem = _hitAreaObjectItem;
-
- if (_objectItem == _dummyItem2)
- _objectItem = getItem1Ptr();
-
- if (_objectItem == _dummyItem3)
- _objectItem = derefItem(getItem1Ptr()->parent);
-
- if (_objectItem != NULL) {
- _scriptNoun2 = _objectItem->noun;
- _scriptAdj2 = _objectItem->adjective;
- } else {
- _scriptNoun2 = -1;
- _scriptAdj2 = -1;
- }
-}
-
-void SimonEngine::setup_cond_c_helper() {
- HitArea *last;
-
- if (getGameType() == GType_SIMON2) {
- _mouseCursor = 0;
- if (_hitAreaUnk4 != 999) {
- _mouseCursor = 9;
- _needHitAreaRecalc++;
- _hitAreaUnk4 = 0;
- }
- }
-
- _lastHitArea = 0;
- _hitAreaObjectItem = NULL;
-
- last = _lastHitArea2Ptr;
- defocusHitarea();
- _lastHitArea2Ptr = last;
-
- for (;;) {
- _lastHitArea = NULL;
- _lastHitArea3 = 0;
- _leftButtonDown = 0;
-
- do {
- if (_exitCutscene && (_bitArray[0] & 0x200)) {
- endCutscene();
- goto out_of_here;
- }
-
- if (getGameType() == GType_FF) {
- if (_variableArray[254] == 63) {
- hitarea_stuff_helper();
- } else if (_variableArray[254] == 75) {
- hitarea_stuff_helper();
- _variableArray[60] = 9999;
- goto out_of_here;
- }
- }
-
- delay(100);
- } while (_lastHitArea3 == (HitArea *) 0xFFFFFFFF || _lastHitArea3 == 0);
-
- if (_lastHitArea == NULL) {
- } else if (_lastHitArea->id == 0x7FFB) {
- handle_uparrow_hitarea(_lastHitArea->fcs);
- } else if (_lastHitArea->id == 0x7FFC) {
- handle_downarrow_hitarea(_lastHitArea->fcs);
- } else if (_lastHitArea->item_ptr != NULL) {
- _hitAreaObjectItem = _lastHitArea->item_ptr;
- _variableArray[60] = (_lastHitArea->flags & 1) ? (_lastHitArea->flags / 256) : 0xFFFF;
- break;
- }
- }
-
-out_of_here:
- _lastHitArea3 = 0;
- _lastHitArea = 0;
- _lastHitArea2Ptr = NULL;
-}
-
-void SimonEngine::endCutscene() {
- Subroutine *sub;
-
- _sound->stopVoice();
-
- sub = getSubroutineByID(170);
- if (sub != NULL)
- startSubroutineEx(sub);
-
- _runScriptReturn1 = true;
-}
-
-uint SimonEngine::get_fcs_ptr_3_index(FillOrCopyStruct *fcs) {
- uint i;
-
- for (i = 0; i != ARRAYSIZE(_windowArray); i++)
- if (_windowArray[i] == fcs)
- return i;
-
- error("get_fcs_ptr_3_index: not found");
- return 0;
-}
-
-void SimonEngine::mouseOff() {
- _mouseHideCount++;
-}
-
-void SimonEngine::mouseOn() {
- _lockWord |= 1;
-
- if (_mouseHideCount != 0)
- _mouseHideCount--;
-
- _lockWord &= ~1;
-}
-
-void SimonEngine::handle_mouse_moved() {
- uint x;
-
- if (_mouseHideCount) {
- _system->showMouse(false);
- return;
- }
-
- _system->showMouse(true);
- pollMouseXY();
-
- if (_mouseX >= 32768)
- _mouseX = 0;
- if (_mouseX >= _screenWidth - 1)
- _mouseX = _screenWidth - 1;
-
- if (_mouseY >= 32768)
- _mouseY = 0;
- if (_mouseY >= _screenHeight - 1)
- _mouseY = _screenHeight - 1;
-
- if (_hitAreaUnk4) {
- uint id = 101;
- if (_mouseY >= 136)
- id = 102;
- if (_hitAreaUnk4 != id)
- hitarea_proc_1();
- }
-
- if (getGameType() == GType_FF) {
- if (_bitArray[6] & 0x8) { // Oracle
- if (_mouseX >= 10 && _mouseX <= 635 && _mouseY >= 5 && _mouseX <= 475) {
- _bitArray[6] |= 0x4;
- } else {
- if (_bitArray[6] & 0x4) {
- _variableArray[254] = 63;
- }
- }
- } else if (_bitArray[5] & 0x0100) { // Close Up
- if (_mouseX >= 10 && _mouseX <= 635 && _mouseY >= 5 && _mouseX <= 475) {
- _bitArray[5] |= 0x80;
- } else {
- if (_bitArray[5] & 0x80) {
- _variableArray[254] = 75;
- }
- }
- }
- }
-
- if (getGameType() == GType_SIMON2) {
- if (_bitArray[4] & 0x8000) {
- if (!_vgaVar9) {
- if (_mouseX >= 630 / 2 || _mouseX < 9)
- goto get_out2;
- _vgaVar9 = 1;
- }
- if (_scrollCount == 0) {
- if (_mouseX >= 631 / 2) {
- if (_scrollX != _scrollXMax)
- _scrollFlag = 1;
- } else if (_mouseX < 8) {
- if (_scrollX != 0)
- _scrollFlag = -1;
- }
- }
- } else {
- get_out2:;
- _vgaVar9 = 0;
- }
- }
-
- if (_mouseX != _mouseXOld || _mouseY != _mouseYOld)
- _needHitAreaRecalc++;
-
- x = 0;
- if (_lastHitArea3 == 0 && _leftButtonDown != 0) {
- _leftButtonDown = 0;
- x = 1;
- } else {
- if (_hitarea_unk_3 == 0 && _needHitAreaRecalc == 0)
- goto get_out;
- }
-
- setup_hitarea_from_pos(_mouseX, _mouseY, x);
- _lastHitArea3 = _lastHitArea;
- if (x == 1 && _lastHitArea == NULL)
- _lastHitArea3 = (HitArea *) - 1;
-
-get_out:
- drawMousePointer();
- _needHitAreaRecalc = 0;
-}
-
-void SimonEngine::drawIconArray(uint fcs_index, Item *item_ptr, int unk1, int unk2) {
- Item *item_ptr_org = item_ptr;
- FillOrCopyStruct *fcs_ptr;
- uint width_div_3, height_div_3;
- uint j, k, i, num_sibs_with_flag;
- bool item_again;
- uint x_pos, y_pos;
-
- fcs_ptr = _windowArray[fcs_index & 7];
-
- if (getGameType() == GType_SIMON1) {
- width_div_3 = fcs_ptr->width / 3;
- height_div_3 = fcs_ptr->height / 3;
- } else {
- width_div_3 = 100;
- height_div_3 = 40;
- }
-
- i = 0;
-
- if (fcs_ptr == NULL)
- return;
-
- if (fcs_ptr->fcs_data)
- removeIconArray(fcs_index);
-
- fcs_ptr->fcs_data = (FillOrCopyData *) malloc(sizeof(FillOrCopyData));
- fcs_ptr->fcs_data->item_ptr = item_ptr;
- fcs_ptr->fcs_data->upArrow = -1;
- fcs_ptr->fcs_data->downArrow = -1;
- fcs_ptr->fcs_data->unk1 = unk1;
- fcs_ptr->fcs_data->unk2 = unk2;
-
- item_ptr = derefItem(item_ptr->child);
-
- while (item_ptr && unk1-- != 0) {
- num_sibs_with_flag = 0;
- while (item_ptr && width_div_3 > num_sibs_with_flag) {
- if ((unk2 == 0 || item_ptr->classFlags & unk2) && has_item_childflag_0x10(item_ptr))
- if (getGameType() == GType_SIMON1) {
- num_sibs_with_flag++;
- } else {
- num_sibs_with_flag += 20;
- }
- item_ptr = derefItem(item_ptr->sibling);
- }
- }
-
- if (item_ptr == NULL) {
- fcs_ptr->fcs_data->unk1 = 0;
- item_ptr = derefItem(item_ptr_org->child);
- }
-
- x_pos = 0;
- y_pos = 0;
- item_again = false;
- k = 0;
- j = 0;
-
- while (item_ptr) {
- if ((unk2 == 0 || item_ptr->classFlags & unk2) && has_item_childflag_0x10(item_ptr)) {
- if (item_again == false) {
- fcs_ptr->fcs_data->e[k].item = item_ptr;
- if (getGameType() == GType_SIMON1) {
- draw_icon_c(fcs_ptr, item_get_icon_number(item_ptr), x_pos * 3, y_pos);
- fcs_ptr->fcs_data->e[k].hit_area =
- setup_icon_hit_area(fcs_ptr, x_pos * 3, y_pos,
- item_get_icon_number(item_ptr), item_ptr);
- } else {
- draw_icon_c(fcs_ptr, item_get_icon_number(item_ptr), x_pos, y_pos);
- fcs_ptr->fcs_data->e[k].hit_area =
- setup_icon_hit_area(fcs_ptr, x_pos, y_pos, item_get_icon_number(item_ptr), item_ptr);
- }
- k++;
- } else {
- fcs_ptr->fcs_data->e[k].item = NULL;
- j = 1;
- }
- x_pos += (getGameType() == GType_SIMON1) ? 1 : 20;
-
- if (x_pos >= width_div_3) {
- x_pos = 0;
-
- y_pos += (getGameType() == GType_SIMON1) ? 1 : 20;
- if (y_pos >= height_div_3)
- item_again = true;
- }
- }
- item_ptr = derefItem(item_ptr->sibling);
- }
-
- fcs_ptr->fcs_data->e[k].item = NULL;
-
- if (j != 0 || fcs_ptr->fcs_data->unk1 != 0) {
- addArrows(fcs_ptr, fcs_index);
- }
-}
-
-void SimonEngine::addArrows(FillOrCopyStruct *fcs, uint fcs_index) {
- setArrowHitAreas(fcs, fcs_index);
-
- fcs->fcs_data->upArrow = _scrollUpHitArea;
- fcs->fcs_data->downArrow = _scrollDownHitArea;
-}
-
-void SimonEngine::setArrowHitAreas(FillOrCopyStruct *fcs, uint fcs_index) {
- HitArea *ha;
-
- ha = findEmptyHitArea();
- _scrollUpHitArea = ha - _hitAreas;
- if (getGameType() == GType_SIMON1) {
- ha->x = 308;
- ha->y = 149;
- ha->width = 12;
- ha->height = 17;
- ha->flags = 0x24;
- ha->id = 0x7FFB;
- ha->layer = 100;
- ha->fcs = fcs;
- ha->unk3 = 1;
- } else {
- ha->x = 81;
- ha->y = 158;
- ha->width = 12;
- ha->height = 26;
- ha->flags = 36;
- ha->id = 0x7FFB;
- ha->layer = 100;
- ha->fcs = fcs;
- ha->unk3 = 1;
- }
-
- ha = findEmptyHitArea();
- _scrollDownHitArea = ha - _hitAreas;
-
- if (getGameType() == GType_SIMON1) {
- ha->x = 308;
- ha->y = 176;
- ha->width = 12;
- ha->height = 17;
- ha->flags = 0x24;
- ha->id = 0x7FFC;
- ha->layer = 100;
- ha->fcs = fcs;
- ha->unk3 = 1;
-
- // Simon1 specific
- o_kill_sprite_simon1(128);
- loadSprite(0, 1, 128, 0, 0, 14);
- } else {
- ha->x = 227;
- ha->y = 162;
- ha->width = 12;
- ha->height = 26;
- ha->flags = 36;
- ha->id = 0x7FFC;
- ha->layer = 100;
- ha->fcs = fcs;
- ha->unk3 = 1;
- }
-}
-
-
-bool SimonEngine::has_item_childflag_0x10(Item *item) {
- Child2 *child = (Child2 *)findChildOfType(item, 2);
- return child && (child->avail_props & 0x10) != 0;
-}
-
-uint SimonEngine::item_get_icon_number(Item *item) {
- Child2 *child = (Child2 *)findChildOfType(item, 2);
- uint offs;
-
- if (child == NULL || !(child->avail_props & 0x10))
- return 0;
-
- offs = getOffsetOfChild2Param(child, 0x10);
- return child->array[offs];
-}
-
-void SimonEngine::f10_key() {
- HitArea *ha, *dha;
- uint count;
- uint y_, x_;
- byte *dst;
- uint b, color;
-
- _lockWord |= 0x8000;
-
- if (getGameType() == GType_SIMON2)
- color = 236;
- else
- color = 225;
-
- uint limit = (getGameType() == GType_SIMON2) ? 200 : 134;
-
- for (int i = 0; i < 5; i++) {
- ha = _hitAreas;
- count = ARRAYSIZE(_hitAreas);
-
- timer_vga_sprites();
-
- do {
- if (ha->id != 0 && ha->flags & 0x20 && !(ha->flags & 0x40)) {
-
- dha = _hitAreas;
- if (ha->flags & 1) {
- while (dha != ha && dha->flags != ha->flags)
- ++dha;
- if (dha != ha && dha->flags == ha->flags)
- continue;
- } else {
- dha = _hitAreas;
- while (dha != ha && dha->item_ptr != ha->item_ptr)
- ++dha;
- if (dha != ha && dha->item_ptr == ha->item_ptr)
- continue;
- }
-
- if (ha->y >= limit || ((getGameType() == GType_SIMON2) && ha->y >= _vgaVar8))
- continue;
-
- y_ = (ha->height / 2) - 4 + ha->y;
-
- x_ = (ha->width / 2) - 4 + ha->x - (_scrollX * 8);
-
- if (x_ >= 311)
- continue;
-
- dst = dx_lock_attached();
-
- dst += (((_dxSurfacePitch / 4) * y_) * 4) + x_;
-
- b = _dxSurfacePitch;
- dst[4] = color;
- dst[b+1] = color;
- dst[b+4] = color;
- dst[b+7] = color;
- b += _dxSurfacePitch;
- dst[b+2] = color;
- dst[b+4] = color;
- dst[b+6] = color;
- b += _dxSurfacePitch;
- dst[b+3] = color;
- dst[b+5] = color;
- b += _dxSurfacePitch;
- dst[b] = color;
- dst[b+1] = color;
- dst[b+2] = color;
- dst[b+6] = color;
- dst[b+7] = color;
- dst[b+8] = color;
- b += _dxSurfacePitch;
- dst[b+3] = color;
- dst[b+5] = color;
- b += _dxSurfacePitch;
- dst[b+2] = color;
- dst[b+4] = color;
- dst[b+6] = color;
- b += _dxSurfacePitch;
- dst[b+1] = color;
- dst[b+4] = color;
- dst[b+7] = color;
- b += _dxSurfacePitch;
- dst[b+4] = color;
-
- dx_unlock_attached();
- }
- } while (ha++, --count);
-
- dx_update_screen_and_palette();
- delay(100);
- timer_vga_sprites();
- dx_update_screen_and_palette();
- delay(100);
- }
-
- _lockWord &= ~0x8000;
-}
-
-void SimonEngine::hitarea_stuff() {
- HitArea *ha;
- uint id;
-
- _leftButtonDown = 0;
- _lastHitArea = 0;
- _verbHitArea = 0;
- _hitAreaSubjectItem = NULL;
- _hitAreaObjectItem = NULL;
-
- hitarea_proc_1();
-
-startOver:
- for (;;) {
- _lastHitArea = NULL;
- _lastHitArea3 = NULL;
-
- for (;;) {
- if (_keyPressed == 35)
- f10_key();
- processSpecialKeys();
- if (_lastHitArea3 == (HitArea *) 0xFFFFFFFF)
- goto startOver;
- if (_lastHitArea3 != 0)
- break;
- hitarea_stuff_helper();
- delay(100);
- }
-
- ha = _lastHitArea;
-
- if (ha == NULL) {
- } else if (ha->id == 0x7FFB) {
- handle_uparrow_hitarea(ha->fcs);
- } else if (ha->id == 0x7FFC) {
- handle_downarrow_hitarea(ha->fcs);
- } else if (ha->id >= 101 && ha->id < 113) {
- _verbHitArea = ha->unk3;
- handle_verb_hitarea(ha);
- _hitAreaUnk4 = 0;
- } else {
- if ((_verbHitArea != 0 || _hitAreaSubjectItem != ha->item_ptr && ha->flags & 0x80) &&
- ha->item_ptr) {
- if_1:;
- _hitAreaSubjectItem = ha->item_ptr;
- id = 0xFFFF;
- if (ha->flags & 1)
- id = ha->flags / 256;
- _variableArray[60] = id;
- new_current_hitarea(ha);
- if (_verbHitArea != 0)
- break;
- } else {
- // else 1
- if (ha->unk3 == 0) {
- if (ha->item_ptr)
- goto if_1;
- } else {
- _verbHitArea = ha->unk3 & 0xBFFF;
- if (ha->unk3 & 0x4000) {
- _hitAreaSubjectItem = ha->item_ptr;
- break;
- }
- if (_hitAreaSubjectItem != NULL)
- break;
- }
- }
- }
- }
-
- _needHitAreaRecalc++;
-}
-
-void SimonEngine::hitarea_stuff_helper() {
- time_t cur_time;
-
- if (getGameType() == GType_SIMON1) {
- uint subr_id = _variableArray[254];
- if (subr_id != 0) {
- Subroutine *sub = getSubroutineByID(subr_id);
- if (sub != NULL) {
- startSubroutineEx(sub);
- startUp_helper_2();
- }
- _variableArray[254] = 0;
- _runScriptReturn1 = false;
- }
- } else {
- if (_variableArray[254] || _variableArray[249]) {
- hitarea_stuff_helper_2();
- }
- }
-
- time(&cur_time);
- if ((uint) cur_time != _lastTime) {
- _lastTime = cur_time;
- if (kickoffTimeEvents())
- startUp_helper_2();
- }
-}
-
-// Simon 2 specific
-void SimonEngine::hitarea_stuff_helper_2() {
- uint subr_id;
- Subroutine *sub;
-
- subr_id = _variableArray[249];
- if (subr_id != 0) {
- sub = getSubroutineByID(subr_id);
- if (sub != NULL) {
- _variableArray[249] = 0;
- startSubroutineEx(sub);
- startUp_helper_2();
- }
- _variableArray[249] = 0;
- }
-
- subr_id = _variableArray[254];
- if (subr_id != 0) {
- sub = getSubroutineByID(subr_id);
- if (sub != NULL) {
- _variableArray[254] = 0;
- startSubroutineEx(sub);
- startUp_helper_2();
- }
- _variableArray[254] = 0;
- }
-
- _runScriptReturn1 = false;
-}
-
-void SimonEngine::startUp_helper_2() {
- if (!_mortalFlag) {
- _mortalFlag = true;
- showmessage_print_char(0);
- _curWindow = 0;
- if (_windowArray[0] != 0) {
- _textWindow = _windowArray[0];
- showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
- }
- _mortalFlag = false;
- }
-}
-
-void SimonEngine::pollMouseXY() {
- _mouseX = _sdlMouseX;
- _mouseY = _sdlMouseY;
-}
-
-void SimonEngine::handle_verb_clicked(uint verb) {
- Subroutine *sub;
- int result;
-
- _objectItem = _hitAreaObjectItem;
- if (_objectItem == _dummyItem2) {
- _objectItem = getItem1Ptr();
- }
- if (_objectItem == _dummyItem3) {
- _objectItem = derefItem(getItem1Ptr()->parent);
- }
-
- _subjectItem = _hitAreaSubjectItem;
- if (_subjectItem == _dummyItem2) {
- _subjectItem = getItem1Ptr();
- }
- if (_subjectItem == _dummyItem3) {
- _subjectItem = derefItem(getItem1Ptr()->parent);
- }
-
- if (_subjectItem) {
- _scriptNoun1 = _subjectItem->noun;
- _scriptAdj1 = _subjectItem->adjective;
- } else {
- _scriptNoun1 = -1;
- _scriptAdj1 = -1;
- }
-
- if (_objectItem) {
- _scriptNoun2 = _objectItem->noun;
- _scriptAdj2 = _objectItem->adjective;
- } else {
- _scriptNoun2 = -1;
- _scriptAdj2 = -1;
- }
-
- _scriptVerb = _verbHitArea;
-
- sub = getSubroutineByID(0);
- if (sub == NULL)
- return;
-
- result = startSubroutine(sub);
- if (result == -1)
- showMessageFormat("I don't understand");
-
- _runScriptReturn1 = false;
-
- sub = getSubroutineByID(100);
- if (sub)
- startSubroutine(sub);
-
- if (getGameType() == GType_SIMON2 || getGameType() == GType_FF)
- _runScriptReturn1 = false;
-
- startUp_helper_2();
-}
-
-TextLocation *SimonEngine::getTextLocation(uint a) {
- switch (a) {
- case 1:
- return &_textLocation1;
- case 2:
- return &_textLocation2;
- case 101:
- return &_textLocation3;
- case 102:
- return &_textLocation4;
- default:
- error("text, invalid value %d", a);
- }
- return NULL;
-}
-
-void SimonEngine::o_printStr() {
- uint vgaSpriteId = getVarOrByte();
- uint color = getVarOrByte();
- uint string_id = getNextStringID();
- const byte *string_ptr = NULL;
- uint speech_id = 0;
- TextLocation *tl;
-
- if (string_id != 0xFFFF)
- string_ptr = getStringPtrByID(string_id);
-
- if (getFeatures() & GF_TALKIE)
- speech_id = (uint16)getNextWord();
-
- tl = getTextLocation(vgaSpriteId);
-
- if (_speech && speech_id != 0)
- playSpeech(speech_id, vgaSpriteId);
- if ((getGameType() == GType_SIMON2) && (getFeatures() & GF_TALKIE) && speech_id == 0)
- o_kill_sprite_simon2(2, vgaSpriteId + 2);
-
- if (string_ptr != NULL && (speech_id == 0 || _subtitles))
- printText(vgaSpriteId, color, (const char *)string_ptr, tl->x, tl->y, tl->width);
-
-}
-
-void SimonEngine::o_loadZone(uint vga_res) {
- _lockWord |= 0x80;
- loadZone(vga_res);
- _lockWord &= ~0x80;
-}
-
-void SimonEngine::loadZone(uint vga_res) {
- VgaPointersEntry *vpe;
-
- CHECK_BOUNDS(vga_res, _vgaBufferPointers);
-
- vpe = _vgaBufferPointers + vga_res;
- if (vpe->vgaFile1 != NULL)
- return;
-
- vpe->vgaFile1 = read_vga_from_datfile_2(vga_res * 2, 1);
- vpe->vgaFile2 = read_vga_from_datfile_2(vga_res * 2 + 1, 2);
- vpe->sfxFile = read_vga_from_datfile_2(vga_res * 2, 3);
-
-}
-
-byte *SimonEngine::setup_vga_destination(uint32 size) {
- byte *dest, *end;
-
- _videoVar4 = 0;
-
- for (;;) {
- dest = _vgaBufFreeStart;
-
- end = dest + size;
-
- if (end >= _vgaBufEnd) {
- _vgaBufFreeStart = _vgaBufStart;
- } else {
- _videoVar5 = false;
- vga_buf_unk_proc3(end);
- if (_videoVar5)
- continue;
- vga_buf_unk_proc1(end);
- if (_videoVar5)
- continue;
- delete_memptr_range(end);
- _vgaBufFreeStart = end;
- return dest;
- }
- }
-}
-
-void SimonEngine::setup_vga_file_buf_pointers() {
- byte *alloced;
-
- alloced = (byte *)malloc(VGA_MEM_SIZE);
-
- _vgaBufFreeStart = alloced;
- _vgaBufStart = alloced;
- _vgaFileBufOrg = alloced;
- _vgaFileBufOrg2 = alloced;
- _vgaBufEnd = alloced + VGA_MEM_SIZE;
-}
-
-void SimonEngine::vga_buf_unk_proc3(byte *end) {
- VgaPointersEntry *vpe;
-
- if (_videoVar7 == 0xFFFF)
- return;
-
- if (_videoVar4 == 2)
- error("vga_buf_unk_proc3: _videoVar4 == 2");
-
- vpe = &_vgaBufferPointers[_videoVar7];
-
- if (_vgaBufFreeStart <= vpe->vgaFile1 && end >= vpe->vgaFile1 ||
- _vgaBufFreeStart <= vpe->vgaFile2 && end >= vpe->vgaFile2) {
- _videoVar5 = 1;
- _videoVar4++;
- _vgaBufFreeStart = vpe->vgaFile1 + 0x5000;
- } else {
- _videoVar5 = 0;
- }
-}
-
-void SimonEngine::vga_buf_unk_proc1(byte *end) {
- VgaSprite *vsp;
- if (_lockWord & 0x20)
- return;
-
- for (vsp = _vgaSprites; vsp->id; vsp++) {
- vga_buf_unk_proc2(vsp->fileId, end);
- if (_videoVar5 == true)
- return;
- }
-}
-
-void SimonEngine::delete_memptr_range(byte *end) {
- uint count = ARRAYSIZE(_vgaBufferPointers);
- VgaPointersEntry *vpe = _vgaBufferPointers;
- do {
- if (_vgaBufFreeStart <= vpe->vgaFile1 && end >= vpe->vgaFile1 ||
- _vgaBufFreeStart <= vpe->vgaFile2 && end >= vpe->vgaFile2) {
- vpe->sfxFile = NULL;
- vpe->vgaFile1 = NULL;
- vpe->vgaFile2 = NULL;
- }
-
- } while (++vpe, --count);
-}
-
-void SimonEngine::vga_buf_unk_proc2(uint a, byte *end) {
- VgaPointersEntry *vpe;
-
- vpe = &_vgaBufferPointers[a];
-
- if (_vgaBufFreeStart <= vpe->vgaFile1 && end >= vpe->vgaFile1 ||
- _vgaBufFreeStart <= vpe->vgaFile2 && end >= vpe->vgaFile2) {
- _videoVar5 = true;
- _videoVar4++;
- _vgaBufFreeStart = vpe->vgaFile1 + 0x5000;
- } else {
- _videoVar5 = false;
- }
-}
-
-void SimonEngine::o_unloadZone(uint a) {
- VgaPointersEntry *vpe;
-
- vpe = &_vgaBufferPointers[a];
-
- vpe->sfxFile = NULL;
- vpe->vgaFile1 = NULL;
- vpe->vgaFile2 = NULL;
-}
-
-void SimonEngine::o_set_video_mode(uint mode, uint vga_res) {
- if (mode == 4)
- vc29_stopAllSounds();
-
- if (_lockWord & 0x10)
- error("o_set_video_mode_ex: _lockWord & 0x10");
-
- set_video_mode_internal(mode, vga_res);
-}
-
-void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) {
- uint num, num_lines;
- VgaPointersEntry *vpe;
- byte *bb, *b;
- // uint16 count;
- const byte *vc_ptr_org;
-
- _windowNum = mode;
- _lockWord |= 0x20;
-
- if (vga_res_id == 0) {
-
- if (getGameType() == GType_SIMON1) {
- _unkPalFlag = true;
- } else {
- _dxUse3Or4ForLock = true;
- _vgaVar6 = true;
- }
- }
-
- _vgaCurFile2 = num = vga_res_id / 100;
-
- for (;;) {
- vpe = &_vgaBufferPointers[num];
-
- _curVgaFile1 = vpe->vgaFile1;
- _curVgaFile2 = vpe->vgaFile2;
- _curSfxFile = vpe->sfxFile;
-
- if (vpe->vgaFile1 != NULL)
- break;
-
- loadZone(num);
- }
-
- // ensure flipping complete
-
- bb = _curVgaFile1;
-
- if (getGameType() == GType_FF) {
- b = bb + READ_LE_UINT16(&((VgaFileHeader_Feeble *) bb)->hdr2_start);
- //count = READ_LE_UINT16(&((VgaFileHeader2_Feeble *) b)->imageCount);
- b = bb + READ_LE_UINT16(&((VgaFileHeader2_Feeble *) b)->imageTable);
-
- while (READ_LE_UINT16(&((ImageHeader_Feeble *) b)->id) != vga_res_id)
- b += sizeof(ImageHeader_Feeble);
- } else {
- b = bb + READ_BE_UINT16(&((VgaFileHeader_Simon *) bb)->hdr2_start);
- //count = READ_BE_UINT16(&((VgaFileHeader2_Simon *) b)->imageCount);
- b = bb + READ_BE_UINT16(&((VgaFileHeader2_Simon *) b)->imageTable);
-
- while (READ_BE_UINT16(&((ImageHeader_Simon *) b)->id) != vga_res_id)
- b += sizeof(ImageHeader_Simon);
- }
-
- if ((getGameType() == GType_SIMON1) && vga_res_id == 16300) {
- dx_clear_attached_from_top(134);
- _usePaletteDelay = true;
- } else {
- _scrollX = 0;
- _scrollXMax = 0;
- _scrollCount = 0;
- _scrollFlag = 0;
- _scrollHeight = 134;
- if (_variableArray[34] != -1)
- _variableArray[251] = 0;
- }
-
- vc_ptr_org = _vcPtr;
-
- if (getGameType() == GType_FF) {
- _vcPtr = _curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble *) b)->scriptOffs);
- } else {
- _vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon *) b)->scriptOffs);
- }
-
- //dump_vga_script(_vcPtr, num, vga_res_id);
- run_vga_script();
- _vcPtr = vc_ptr_org;
-
-
- if (getGameType() == GType_SIMON1) {
- // Allow one section of Simon the Sorcerer 1 introduction to be displayed
- // in lower half of screen
- if (_subroutine == 2923 || _subroutine == 2926)
- num_lines = 200;
- else
- num_lines = _windowNum == 4 ? 134 : 200;
-
- dx_copy_from_attached_to_2(0, 0, _screenWidth, num_lines);
- dx_copy_from_attached_to_3(num_lines);
-
- _syncFlag2 = 1;
- _timer5 = 0;
- } else {
- if (!_dxUse3Or4ForLock) {
- 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);
- _syncFlag2 = 1;
- }
- _dxUse3Or4ForLock = false;
- }
-
- _lockWord &= ~0x20;
-
- if (getGameType() == GType_SIMON1) {
- if (_unkPalFlag) {
- _unkPalFlag = false;
- while (_paletteColorCount != 0) {
- delay(10);
- }
- }
- }
-}
-
-void SimonEngine::o_fadeToBlack() {
- uint i;
-
- memcpy(_videoBuf1, _paletteBackup, 1024);
-
- i = NUM_PALETTE_FADEOUT;
- do {
- palette_fadeout((uint32 *)_videoBuf1, 32);
- palette_fadeout((uint32 *)_videoBuf1 + 32 + 16, 144);
- palette_fadeout((uint32 *)_videoBuf1 + 32 + 16 + 144 + 16, 48);
-
- _system->setPalette(_videoBuf1, 0, 256);
- if (_fade)
- _system->updateScreen();
- delay(5);
- } while (--i);
-
- memcpy(_paletteBackup, _videoBuf1, 1024);
- memcpy(_palette, _videoBuf1, 1024);
-}
-
-void SimonEngine::delete_vga_timer(VgaTimerEntry * vte) {
- _lockWord |= 1;
-
- if (vte + 1 <= _nextVgaTimerToProcess) {
- _nextVgaTimerToProcess--;
- }
-
- do {
- memcpy(vte, vte + 1, sizeof(VgaTimerEntry));
- vte++;
- } while (vte->delay);
-
- _lockWord &= ~1;
-}
-
-void SimonEngine::expire_vga_timers() {
- VgaTimerEntry *vte = _vgaTimerList;
-
- _vgaTickCounter++;
-
- while (vte->delay) {
- if (!--vte->delay) {
- uint16 cur_file = vte->cur_vga_file;
- uint16 cur_unk = vte->sprite_id;
- const byte *script_ptr = vte->script_pointer;
-
- _nextVgaTimerToProcess = vte + 1;
- delete_vga_timer(vte);
-
- if ((getGameType() == GType_SIMON2) && script_ptr == NULL) {
- // special scroll timer
- scroll_timeout();
- } else {
- vcResumeSprite(script_ptr, cur_file, cur_unk);
- }
- vte = _nextVgaTimerToProcess;
- } else {
- vte++;
- }
- }
-}
-
-// Simon2 specific
-void SimonEngine::scroll_timeout() {
- if (_scrollCount == 0)
- return;
-
- if (_scrollCount < 0) {
- if (_scrollFlag != -1) {
- _scrollFlag = -1;
- if (++_scrollCount == 0)
- return;
- }
- } else {
- if (_scrollFlag != 1) {
- _scrollFlag = 1;
- if (--_scrollCount == 0)
- return;
- }
- }
-
- add_vga_timer(6, NULL, 0, 0);
-}
-
-void SimonEngine::vcResumeSprite(const byte *code_ptr, uint16 cur_file, uint16 cur_sprite) {
- VgaPointersEntry *vpe;
-
- _vgaCurSpriteId = cur_sprite;
-
- _vgaCurFileId = cur_file;
- _vgaCurFile2 = cur_file;
- vpe = &_vgaBufferPointers[cur_file];
-
- _curVgaFile1 = vpe->vgaFile1;
- _curVgaFile2 = vpe->vgaFile2;
- _curSfxFile = vpe->sfxFile;
-
- _vcPtr = code_ptr;
-
- run_vga_script();
-}
-
-void SimonEngine::add_vga_timer(uint num, const byte *code_ptr, uint cur_sprite, uint cur_file) {
- VgaTimerEntry *vte;
-
- // When Simon talks to the Golum about stew in French version of
- // Simon the Sorcerer 1 the code_ptr is at wrong location for
- // sprite 200. This was a bug in the original game, which
- // caused several glitches in this scene.
- // We work around the problem by correcting the code_ptr for sprite
- // 200 in this scene, if it is wrong.
- if (getGameType() == GType_SIMON1 && _language == Common::FR_FRA &&
- (code_ptr - _vgaBufferPointers[cur_file].vgaFile1 == 4) && (cur_sprite == 200) && (cur_file == 2))
- code_ptr += 0x66;
-
- _lockWord |= 1;
-
- for (vte = _vgaTimerList; vte->delay; vte++) {
- }
-
- vte->delay = num;
- vte->script_pointer = code_ptr;
- vte->sprite_id = cur_sprite;
- vte->cur_vga_file = cur_file;
-
- _lockWord &= ~1;
-}
-
-void SimonEngine::o_mouseOn() {
- if (getGameType() == GType_SIMON2 && _bitArray[4] & 0x8000)
- _mouseCursor = 0;
- _mouseHideCount = 0;
-}
-
-void SimonEngine::o_mouseOff() {
- _lockWord |= 0x8000;
- vc34_setMouseOff();
- _lockWord &= ~0x8000;
-}
-
-void SimonEngine::o_waitForSync(uint a) {
- _vgaWaitFor = a;
- _timer1 = 0;
- _exitCutscene = false;
- _skipSpeech = false;
- while (_vgaWaitFor != 0) {
- if (_skipSpeech && (getGameType() == GType_SIMON2 || getGameType() == GType_FF)) {
- if (_vgaWaitFor == 200 && !vcGetBit(14)) {
- skipSpeech();
- break;
- }
- } else if (_exitCutscene) {
- if (vcGetBit(9)) {
- endCutscene();
- break;
- }
- } else {
- processSpecialKeys();
- }
-
- delay(10);
-
- if (getGameType() == GType_SIMON2) {
- if (_timer1 >= 1000) {
- warning("wait timed out");
- break;
- }
- } else if (_timer1 >= 500) {
- warning("wait timed out");
- break;
- }
-
- }
-}
-
-void SimonEngine::skipSpeech() {
- _sound->stopVoice();
- if (!(_bitArray[1] & 0x1000)) {
- _bitArray[0] |= 0x4000;
- _variableArray[100] = 5;
- loadSprite(4, 1, 30, 0, 0, 0);
- o_waitForSync(130);
- o_kill_sprite_simon2(2, 1);
- }
-}
-
-void SimonEngine::timer_vga_sprites() {
- VgaSprite *vsp;
- VgaPointersEntry *vpe;
- const byte *vc_ptr_org = _vcPtr;
- uint16 params[5]; // parameters to vc10
-
- if (_paletteFlag == 2)
- _paletteFlag = 1;
-
- if (getGameType() == GType_SIMON2 && _scrollFlag) {
- timer_vga_sprites_helper();
- }
-
- vsp = _vgaSprites;
-
- while (vsp->id != 0) {
- vsp->windowNum &= 0x7FFF;
-
- vpe = &_vgaBufferPointers[vsp->fileId];
- _curVgaFile1 = vpe->vgaFile1;
- _curVgaFile2 = vpe->vgaFile2;
- _curSfxFile = vpe->sfxFile;
- _windowNum = vsp->windowNum;
- _vgaCurSpriteId = vsp->id;
-
- params[0] = readUint16Wrapper(&vsp->image);
- params[1] = readUint16Wrapper(&vsp->palette);
- params[2] = readUint16Wrapper(&vsp->x);
- params[3] = readUint16Wrapper(&vsp->y);
-
- if (getGameType() == GType_SIMON1) {
- params[4] = READ_BE_UINT16(&vsp->flags);
- } else {
- *(byte *)(&params[4]) = (byte)vsp->flags;
- }
-
- _vcPtr = (const byte *)params;
- vc10_draw();
-
- vsp++;
- }
-
- if (_drawImagesDebug)
- memset(_sdl_buf_attached, 0, _screenWidth * _screenHeight);
-
- _updateScreen++;
- _vcPtr = vc_ptr_org;
-}
-
-void SimonEngine::timer_vga_sprites_helper() {
- byte *dst = dx_lock_2();
- const byte *src;
- uint x;
-
- if (_scrollFlag < 0) {
- memmove(dst + 8, dst, _screenWidth * _scrollHeight - 8);
- } else {
- memmove(dst, dst + 8, _screenWidth * _scrollHeight - 8);
- }
-
- x = _scrollX - 1;
-
- if (_scrollFlag > 0) {
- dst += _screenWidth - 8;
- x += 41;
- }
-
- src = _scrollImage + x * 4;
- decodeStripA(dst, src + READ_BE_UINT32(src), _scrollHeight);
-
- dx_unlock_2();
-
-
- memcpy(_sdl_buf_attached, _sdl_buf, _screenWidth * _screenHeight);
- dx_copy_from_attached_to_3(_scrollHeight);
-
-
- _scrollX += _scrollFlag;
-
- vcWriteVar(251, _scrollX);
-
- _scrollFlag = 0;
-}
-
-void SimonEngine::timer_vga_sprites_2() {
- VgaSprite *vsp;
- VgaPointersEntry *vpe;
- const byte *vc_ptr_org = _vcPtr;
- uint16 params[5]; // parameters to vc10_draw
-
- if (_paletteFlag == 2)
- _paletteFlag = 1;
-
- vsp = _vgaSprites;
- while (vsp->id != 0) {
- vsp->windowNum &= 0x7FFF;
-
- vpe = &_vgaBufferPointers[vsp->fileId];
- _curVgaFile1 = vpe->vgaFile1;
- _curVgaFile2 = vpe->vgaFile2;
- _curSfxFile = vpe->sfxFile;
- _windowNum = vsp->windowNum;
- _vgaCurSpriteId = vsp->id;
-
- if (vsp->image)
- fprintf(_dumpFile, "id:%5d image:%3d base-color:%3d x:%3d y:%3d flags:%x\n",
- vsp->id, vsp->image, vsp->palette, vsp->x, vsp->y, vsp->flags);
- params[0] = readUint16Wrapper(&vsp->image);
- params[1] = readUint16Wrapper(&vsp->palette);
- params[2] = readUint16Wrapper(&vsp->x);
- params[3] = readUint16Wrapper(&vsp->y);
- params[4] = readUint16Wrapper(&vsp->flags);
- _vcPtr = (const byte *)params;
- vc10_draw();
-
- vsp++;
- }
-
- _updateScreen++;
- _vcPtr = vc_ptr_org;
-}
-
-void SimonEngine::timer_proc1() {
- _timer4++;
-
- if (_lockWord & 0x80E9 || _lockWord & 2)
- return;
-
- _timer1++;
-
- _lockWord |= 2;
-
- if (!(_lockWord & 0x10)) {
- expire_vga_timers();
- expire_vga_timers();
- _syncFlag2 ^= 1;
- _cepeFlag ^= 1;
- if (!_cepeFlag)
- expire_vga_timers();
-
- if (_mouseHideCount != 0 && _syncFlag2) {
- _lockWord &= ~2;
- return;
- }
- }
-
- timer_vga_sprites();
- if (_drawImagesDebug)
- timer_vga_sprites_2();
-
- if (_copyPartialMode == 1) {
- dx_copy_from_2_to_attached(80, 46, 208 - 80, 94 - 46);
- }
-
- if (_copyPartialMode == 2) {
- // copy partial from attached to 2
- dx_copy_from_attached_to_2(176, 61, _screenWidth - 176, 134 - 61);
- _copyPartialMode = 0;
- }
-
- if (_updateScreen) {
- handle_mouse_moved();
- dx_update_screen_and_palette();
- _updateScreen = false;
- }
-
- _lockWord &= ~2;
-}
-
-void SimonEngine::timer_callback() {
- if (_timer5 != 0) {
- _syncFlag2 = true;
- _timer5--;
- } else {
- timer_proc1();
- }
-}
-
-void SimonEngine::fcs_setTextColor(FillOrCopyStruct *fcs, uint value) {
- fcs->text_color = value;
-}
-
-void SimonEngine::o_vga_reset() {
- _lockWord |= 0x8000;
- vc27_resetSprite();
- _lockWord &= ~0x8000;
-}
-
-bool SimonEngine::itemIsSiblingOf(uint16 a) {
- Item *item;
-
- CHECK_BOUNDS(a, _vcItemArray);
-
- item = _vcItemArray[a];
- if (item == NULL)
- return true;
-
- return getItem1Ptr()->parent == item->parent;
-}
-
-bool SimonEngine::itemIsParentOf(uint16 a, uint16 b) {
- Item *item_a, *item_b;
-
- CHECK_BOUNDS(a, _vcItemArray);
- CHECK_BOUNDS(b, _vcItemArray);
-
- item_a = _vcItemArray[a];
- item_b = _vcItemArray[b];
-
- if (item_a == NULL || item_b == NULL)
- return true;
-
- return derefItem(item_a->parent) == item_b;
-}
-
-bool SimonEngine::vc_maybe_skip_proc_1(uint16 a, int16 b) {
- Item *item;
-
- CHECK_BOUNDS(a, _vcItemArray);
-
- item = _vcItemArray[a];
- if (item == NULL)
- return true;
- return item->state == b;
-}
-
-// OK
-void SimonEngine::closeWindow(uint a) {
- if (_windowArray[a] == NULL)
- return;
- removeIconArray(a);
- video_copy_if_flag_0x8_c(_windowArray[a]);
- _windowArray[a] = NULL;
- if (_curWindow == a) {
- _textWindow = NULL;
- changeWindow(0);
- }
-}
-
-// OK
-void SimonEngine::changeWindow(uint a) {
- a &= 7;
-
- if (_windowArray[a] == NULL || _curWindow == a)
- return;
-
- _curWindow = a;
- showmessage_print_char(0);
- _textWindow = _windowArray[a];
-
- showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
-}
-
-// OK
-FillOrCopyStruct *SimonEngine::openWindow(uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint text_color) {
- FillOrCopyStruct *fcs;
-
- fcs = _fcs_list;
- while (fcs->mode != 0)
- fcs++;
-
- fcs->mode = 2;
- fcs->x = x;
- fcs->y = y;
- fcs->width = w;
- fcs->height = h;
- fcs->flags = flags;
- fcs->fill_color = fill_color;
- fcs->text_color = text_color;
- fcs->textColumn = 0;
- fcs->textRow = 0;
- fcs->textColumnOffset = 0;
- fcs->textMaxLength = fcs->width * 8 / 6; // characters are 6 pixels
- return fcs;
-}
-
-Item *SimonEngine::derefItem(uint item) {
- if (item >= _itemArraySize)
- error("derefItem: invalid item %d", item);
- return _itemArrayPtr[item];
-}
-
-uint SimonEngine::itemPtrToID(Item *id) {
- uint i;
- for (i = 0; i != _itemArraySize; i++)
- if (_itemArrayPtr[i] == id)
- return i;
- error("itemPtrToID: not found");
- return 0;
-}
-
-void SimonEngine::o_pathfind(int x, int y, uint var_1, uint var_2) {
- const uint16 *p;
- uint i, j;
- uint prev_i;
- uint x_diff, y_diff;
- uint best_i = 0, best_j = 0, best_dist = 0xFFFFFFFF;
-
- if (getGameType() == GType_SIMON2) {
- x += _scrollX * 8;
- }
-
- int end = (getGameType() == GType_FF) ? 9999 : 999;
- prev_i = 21 - _variableArray[12];
- for (i = 20; i != 0; --i) {
- p = (const uint16 *)_pathFindArray[20 - i];
- if (!p)
- continue;
- for (j = 0; readUint16Wrapper(&p[0]) != end; j++, p += 2) {
- x_diff = abs((int)(readUint16Wrapper(&p[0]) - x));
- y_diff = abs((int)(readUint16Wrapper(&p[1]) - 12 - y));
-
- if (x_diff < y_diff) {
- x_diff /= 4;
- y_diff *= 4;
- }
- x_diff += y_diff /= 4;
-
- if (x_diff < best_dist || x_diff == best_dist && prev_i == i) {
- best_dist = x_diff;
- best_i = 21 - i;
- best_j = j;
- }
- }
- }
-
- _variableArray[var_1] = best_i;
- _variableArray[var_2] = best_j;
-}
-
-// ok
-void SimonEngine::removeIconArray(uint fcs_index) {
- FillOrCopyStruct *fcs;
- uint16 fcsunk1;
- uint16 i;
-
- fcs = _windowArray[fcs_index & 7];
- fcsunk1 = _curWindow;
-
- if (fcs == NULL || fcs->fcs_data == NULL)
- return;
-
- changeWindow(fcs_index);
- fcs_putchar(12);
- changeWindow(fcsunk1);
-
- for (i = 0; fcs->fcs_data->e[i].item != NULL; i++) {
- delete_hitarea_by_index(fcs->fcs_data->e[i].hit_area);
- }
-
- if (fcs->fcs_data->upArrow != -1) {
- delete_hitarea_by_index(fcs->fcs_data->upArrow);
- }
-
- if (fcs->fcs_data->downArrow != -1) {
- delete_hitarea_by_index(fcs->fcs_data->downArrow);
- if (getGameType() == GType_SIMON1)
- removeArrows(fcs, fcs_index);
- }
-
- free(fcs->fcs_data);
- fcs->fcs_data = NULL;
-
- _fcsData1[fcs_index] = 0;
- _fcsData2[fcs_index] = 0;
-}
-
-// ok
-void SimonEngine::removeArrows(FillOrCopyStruct *fcs, uint fcs_index) {
- o_kill_sprite_simon1(128);
-}
-
-void SimonEngine::delete_hitarea_by_index(uint index) {
- CHECK_BOUNDS(index, _hitAreas);
- _hitAreas[index].flags = 0;
-}
-
-// ok
-void SimonEngine::fcs_putchar(uint a) {
- if (_textWindow != _windowArray[0])
- video_putchar(_textWindow, a);
-}
-
-// ok
-void SimonEngine::video_fill_or_copy_from_3_to_2(FillOrCopyStruct *fcs) {
- if (fcs->flags & 0x10)
- copy_img_from_3_to_2(fcs);
- else
- video_erase(fcs);
-
- fcs->textColumn = 0;
- fcs->textRow = 0;
- fcs->textColumnOffset = 0;
- fcs->textLength = 0;
-}
-
-// ok
-void SimonEngine::copy_img_from_3_to_2(FillOrCopyStruct *fcs) {
- _lockWord |= 0x8000;
-
- if (getGameType() == GType_SIMON1) {
- dx_copy_rgn_from_3_to_2(fcs->y + fcs->height * 8 + ((fcs == _windowArray[2]) ? 1 : 0), (fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8);
- } else {
- if (_vgaVar6 && _windowArray[2] == fcs) {
- fcs = _windowArray[6];
- _vgaVar6 = 0;
- }
-
- dx_copy_rgn_from_3_to_2(fcs->y + fcs->height * 8, (fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8);
- }
-
- _lockWord &= ~0x8000;
-}
-
-void SimonEngine::video_erase(FillOrCopyStruct *fcs) {
- byte *dst;
- uint h;
-
- _lockWord |= 0x8000;
-
- dst = dx_lock_2();
- dst += _dxSurfacePitch * fcs->y + fcs->x * 8;
-
- h = fcs->height * 8;
- do {
- memset(dst, fcs->fill_color, fcs->width * 8);
- dst += _dxSurfacePitch;
- } while (--h);
-
- dx_unlock_2();
- _lockWord &= ~0x8000;
-}
-
-VgaSprite *SimonEngine::findCurSprite() {
- VgaSprite *vsp = _vgaSprites;
- while (vsp->id) {
- if (getGameType() == GType_SIMON1) {
- if (vsp->id == _vgaCurSpriteId)
- break;
- } else {
- if (vsp->id == _vgaCurSpriteId && vsp->fileId == _vgaCurFileId)
- break;
- }
- vsp++;
- }
- return vsp;
-}
-
-bool SimonEngine::isSpriteLoaded(uint16 id, uint16 fileId) {
- VgaSprite *vsp = _vgaSprites;
- while (vsp->id) {
- if (getGameType() == GType_SIMON1) {
- if (vsp->id == id)
- return true;
- } else {
- if (vsp->id == id && vsp->fileId == fileId)
- return true;
- }
- vsp++;
- }
- return false;
-}
-
-void SimonEngine::processSpecialKeys() {
- switch (_keyPressed) {
- case 27: // escape
- _exitCutscene = true;
- break;
- case 59: // F1
- if (getGameType() == GType_SIMON1) {
- vcWriteVar(5, 40);
- } else {
- vcWriteVar(5, 50);
- }
- vcWriteVar(86, 0);
- break;
- case 60: // F2
- if (getGameType() == GType_SIMON1) {
- vcWriteVar(5, 60);
- } else {
- vcWriteVar(5, 75);
- }
- vcWriteVar(86, 1);
- break;
- case 61: // F3
- if (getGameType() == GType_SIMON1) {
- vcWriteVar(5, 100);
- } else {
- vcWriteVar(5, 125);
- }
- vcWriteVar(86, 2);
- break;
- case 63: // F5
- if (getGameType() == GType_SIMON2 || getGameType() == GType_FF)
- _exitCutscene = true;
- break;
- case 'p':
- pause();
- break;
- case 't':
- if ((getGameType() == GType_SIMON2 && getFeatures() & GF_TALKIE) || ( getFeatures() & GF_TALKIE && _language > 1))
- if (_speech)
- _subtitles ^= 1;
- break;
- case 'v':
- if ((getGameType() == GType_SIMON2) && (getFeatures() & GF_TALKIE))
- if (_subtitles)
- _speech ^= 1;
- case '+':
- midi.set_volume(midi.get_volume() + 16);
- break;
- case '-':
- midi.set_volume(midi.get_volume() - 16);
- break;
- case 'm':
- midi.pause(_musicPaused ^= 1);
- break;
- case 's':
- if (getGameId() == GID_SIMON1DOS)
- midi._enable_sfx ^= 1;
- else
- _sound->effectsPause(_effectsPaused ^= 1);
- break;
- case 'b':
- _sound->ambientPause(_ambientPaused ^= 1);
- break;
- case 'r':
- if (_debugMode)
- _startMainScript ^= 1;
- break;
- case 'o':
- if (_debugMode)
- _continousMainScript ^= 1;
- break;
- case 'a':
- if (_debugMode)
- _startVgaScript ^= 1;
- break;
- case 'g':
- if (_debugMode)
- _continousVgaScript ^= 1;
- break;
- case 'i':
- if (_debugMode)
- _drawImagesDebug ^= 1;
- break;
- case 'd':
- if (_debugMode)
- _dumpImages ^=1;
- break;
- }
-
- _keyPressed = 0;
-}
-
-void SimonEngine::pause() {
- _keyPressed = 1;
- _pause = 1;
- bool ambient_status = _ambientPaused;
- bool music_status = _musicPaused;
-
- midi.pause(true);
- _sound->ambientPause(true);
- while (_pause) {
- delay(1);
- if (_keyPressed == 'p')
- _pause = 0;
- }
- midi.pause(music_status);
- _sound->ambientPause(ambient_status);
-
-}
-
-void SimonEngine::video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte d) {
- byte *src, color;
- uint w, h, i;
-
- _lockWord |= 0x8000;
- src = dx_lock_2() + ha->y * _dxSurfacePitch + ha->x;
-
- w = ha->width;
- h = ha->height;
-
- // Works around bug in original Simon the Sorcerer 2
- // Animations continue in background when load/save dialog is open
- // often causing the savegame name highlighter to be cut short
- if (!(h > 0 && w > 0 && ha->x + w <= _screenWidth && ha->y + h <= _screenHeight)) {
- debug(1,"Invalid coordinates in video_toggle_colors (%d,%d,%d,%d)", ha->x, ha->y, ha->width, ha->height);
- _lockWord &= ~0x8000;
- return;
- }
-
- do {
- for (i = 0; i != w; ++i) {
- color = src[i];
- if (a >= color && b < color) {
- if (c >= color)
- color += d;
- else
- color -= d;
- src[i] = color;
- }
- }
- src += _dxSurfacePitch;
- } while (--h);
-
-
- dx_unlock_2();
- _lockWord &= ~0x8000;
-}
-
-void SimonEngine::video_copy_if_flag_0x8_c(FillOrCopyStruct *fcs) {
- if (fcs->flags & 8)
- copy_img_from_3_to_2(fcs);
- fcs->mode = 0;
-}
-
-void SimonEngine::loadSprite(uint windowNum, uint fileId, uint vgaSpriteId, uint x, uint y, uint palette) {
- VgaSprite *vsp;
- VgaPointersEntry *vpe;
- byte *p, *pp;
- uint count;
-
- _lockWord |= 0x40;
-
- if (isSpriteLoaded(vgaSpriteId, fileId)) {
- _lockWord &= ~0x40;
- return;
- }
-
- vsp = _vgaSprites;
- while (vsp->id != 0)
- vsp++;
-
- vsp->windowNum = windowNum;
- vsp->priority = 0;
- vsp->flags = 0;
-
- vsp->y = y;
- vsp->x = x;
- vsp->image = 0;
- vsp->palette = palette;
- vsp->id = vgaSpriteId;
- if (getGameType() == GType_SIMON1)
- vsp->fileId = fileId = vgaSpriteId / 100;
- else
- vsp->fileId = fileId;
-
-
- for (;;) {
- vpe = &_vgaBufferPointers[fileId];
- _vgaCurFile2 = fileId;
- _curVgaFile1 = vpe->vgaFile1;
- if (vpe->vgaFile1 != NULL)
- break;
- loadZone(fileId);
- }
-
- pp = _curVgaFile1;
- if (getGameType() == GType_FF) {
- p = pp + READ_LE_UINT16(&((VgaFileHeader_Feeble *) pp)->hdr2_start);
- count = READ_LE_UINT16(&((VgaFileHeader2_Feeble *) p)->animationCount);
- p = pp + READ_LE_UINT16(&((VgaFileHeader2_Feeble *) p)->animationTable);
- } else {
- p = pp + READ_BE_UINT16(&((VgaFileHeader_Simon *) pp)->hdr2_start);
- count = READ_BE_UINT16(&((VgaFileHeader2_Simon *) p)->animationCount);
- p = pp + READ_BE_UINT16(&((VgaFileHeader2_Simon *) p)->animationTable);
- }
-
- for (;;) {
- if (getGameType() == GType_FF) {
- if (READ_LE_UINT16(&((AnimationHeader_Feeble *) p)->id) == vgaSpriteId) {
- if (_startVgaScript)
- dump_vga_script(pp + READ_LE_UINT16(&((AnimationHeader_Feeble*)p)->scriptOffs), fileId, vgaSpriteId);
-
- add_vga_timer(VGA_DELAY_BASE, pp + READ_LE_UINT16(&((AnimationHeader_Feeble *) p)->scriptOffs), vgaSpriteId, fileId);
- break;
- }
- p += sizeof(AnimationHeader_Feeble);
- } else {
- if (READ_BE_UINT16(&((AnimationHeader_Simon *) p)->id) == vgaSpriteId) {
- if (_startVgaScript)
- dump_vga_script(pp + READ_BE_UINT16(&((AnimationHeader_Simon*)p)->scriptOffs), fileId, vgaSpriteId);
-
- add_vga_timer(VGA_DELAY_BASE, pp + READ_BE_UINT16(&((AnimationHeader_Simon *) p)->scriptOffs), vgaSpriteId, fileId);
- break;
- }
- p += sizeof(AnimationHeader_Simon);
- }
-
- if (!--count) {
- vsp->id = 0;
- break;
- }
- }
-
- _lockWord &= ~0x40;
-}
-
-void SimonEngine::playSpeech(uint speech_id, uint vgaSpriteId) {
- if (getGameType() == GType_SIMON1) {
- if (speech_id == 9999) {
- if (_subtitles)
- return;
- if (!(_bitArray[0] & 0x4000) && !(_bitArray[1] & 0x1000)) {
- _bitArray[0] |= 0x4000;
- _variableArray[100] = 15;
- loadSprite(4, 1, 130, 0, 0, 0);
- o_waitForSync(130);
- }
- _skipVgaWait = true;
- } else {
- if (_subtitles && _scriptVar2) {
- loadSprite(4, 2, 204, 0, 0, 0);
- o_waitForSync(204);
- o_kill_sprite_simon1(204);
- }
- o_kill_sprite_simon1(vgaSpriteId + 201);
- _sound->playVoice(speech_id);
- loadSprite(4, 2, vgaSpriteId + 201, 0, 0, 0);
- }
- } else {
- if (speech_id == 0xFFFF) {
- if (_subtitles)
- return;
- if (!(_bitArray[0] & 0x4000) && !(_bitArray[1] & 0x1000)) {
- _bitArray[0] |= 0x4000;
- _variableArray[100] = 5;
- loadSprite(4, 1, 30, 0, 0, 0);
- o_waitForSync(130);
- }
- _skipVgaWait = true;
- } else {
- if (_subtitles && _language != Common::HB_ISR) {
- _sound->playVoice(speech_id);
- return;
- } else if (_subtitles && _scriptVar2) {
- loadSprite(4, 2, 5, 0, 0, 0);
- o_waitForSync(205);
- o_kill_sprite_simon2(2,5);
- }
-
- o_kill_sprite_simon2(2, vgaSpriteId + 2);
- _sound->playVoice(speech_id);
- loadSprite(4, 2, vgaSpriteId + 2, 0, 0, 0);
- }
- }
-}
-
-void SimonEngine::printText(uint vgaSpriteId, uint color, const char *string, int16 x, int16 y, int16 width) {
- char convertedString[320];
- char *convertedString2 = convertedString;
- int16 height, talkDelay;
- int stringLength = strlen(string);
- int padding, lettersPerRow, lettersPerRowJustified;
- const int textHeight = 10;
-
- height = textHeight;
- lettersPerRow = width / 6;
- lettersPerRowJustified = stringLength / (stringLength / lettersPerRow + 1) + 1;
-
- talkDelay = (stringLength + 3) / 3;
- if ((getGameType() == GType_SIMON1) && (getFeatures() & GF_TALKIE)) {
- if (_variableArray[141] == 0)
- _variableArray[141] = 9;
- _variableArray[85] = _variableArray[141] * talkDelay;
- } else {
- if (_variableArray[86] == 0)
- talkDelay /= 2;
- if (_variableArray[86] == 2)
- talkDelay *= 2;
- _variableArray[85] = talkDelay * 5;
- }
-
- assert(stringLength > 0);
- while (stringLength > 0) {
- int pos = 0;
- if (stringLength > lettersPerRow) {
- int removeLastWord = 0;
- if (lettersPerRow > lettersPerRowJustified) {
- pos = lettersPerRowJustified;
- while (string[pos] != ' ')
- pos++;
- if (pos > lettersPerRow)
- removeLastWord = 1;
- }
- if (lettersPerRow <= lettersPerRowJustified || removeLastWord) {
- pos = lettersPerRow;
- while (string[pos] != ' ' && pos > 0)
- pos--;
- }
- height += textHeight;
- y -= textHeight;
- } else
- pos = stringLength;
- padding = (lettersPerRow - pos) % 2 ?
- (lettersPerRow - pos) / 2 + 1 : (lettersPerRow - pos) / 2;
- while (padding--)
- *convertedString2++ = ' ';
- stringLength -= pos;
- while (pos--)
- *convertedString2++ = *string++;
- *convertedString2++ = '\n';
- string++; // skip space
- stringLength--; // skip space
- }
- *(convertedString2 - 1) = '\0';
-
- if (getGameType() == GType_SIMON1)
- o_kill_sprite_simon1(vgaSpriteId + 199);
- else
- o_kill_sprite_simon2(2, vgaSpriteId);
-
- color = color * 3 + 192;
- if (getPlatform() == Common::kPlatformAmiga)
- render_string_amiga(vgaSpriteId, color, width, height, convertedString);
- else
- render_string(vgaSpriteId, color, width, height, convertedString);
-
- int b = 4;
- if (!(_bitArray[8] & 0x20))
- b = 3;
-
- x /= 8;
- if (y < 2)
- y = 2;
-
- if (getGameType() == GType_SIMON1)
- loadSprite(b, 2, vgaSpriteId + 199, x, y, 12);
- else
- loadSprite(b, 2, vgaSpriteId, x, y, 12);
-}
-
-// Thanks to Stuart Caie for providing the original
-// C conversion upon which this decruncher is based.
-
-#define SD_GETBIT(var) do { \
- if (!bits--) { \
- s -= 4; \
- if (s < src) \
- return false; \
- bb = READ_BE_UINT32(s); \
- bits = 31; \
- } \
- (var) = bb & 1; \
- bb >>= 1; \
-}while (0)
-
-#define SD_GETBITS(var, nbits) do { \
- bc = (nbits); \
- (var) = 0; \
- while (bc--) { \
- (var) <<= 1; \
- SD_GETBIT(bit); \
- (var) |= bit; \
- } \
-}while (0)
-
-#define SD_TYPE_LITERAL (0)
-#define SD_TYPE_MATCH (1)
-
-static bool decrunchFile(byte *src, byte *dst, uint32 size) {
- byte *s = src + size - 4;
- uint32 destlen = READ_BE_UINT32 (s);
- uint32 bb, x, y;
- byte *d = dst + destlen;
- byte bc, bit, bits, type;
-
- // Initialize bit buffer.
- s -= 4;
- bb = x = READ_BE_UINT32 (s);
- bits = 0;
- do {
- x >>= 1;
- bits++;
- } while (x);
- bits--;
-
- while (d > dst) {
- SD_GETBIT(x);
- if (x) {
- SD_GETBITS(x, 2);
- switch (x) {
- case 0:
- type = SD_TYPE_MATCH;
- x = 9;
- y = 2;
- break;
-
- case 1:
- type = SD_TYPE_MATCH;
- x = 10;
- y = 3;
- break;
-
- case 2:
- type = SD_TYPE_MATCH;
- x = 12;
- SD_GETBITS(y, 8);
- break;
-
- default:
- type = SD_TYPE_LITERAL;
- x = 8;
- y = 8;
- }
- } else {
- SD_GETBIT(x);
- if (x) {
- type = SD_TYPE_MATCH;
- x = 8;
- y = 1;
- } else {
- type = SD_TYPE_LITERAL;
- x = 3;
- y = 0;
- }
- }
-
- if (type == SD_TYPE_LITERAL) {
- SD_GETBITS(x, x);
- y += x;
- if ((int)(y + 1) > (d - dst))
- return false; // Overflow?
- do {
- SD_GETBITS(x, 8);
- *--d = x;
- } while (y-- > 0);
- } else {
- if ((int)(y + 1) > (d - dst))
- return false; // Overflow?
- SD_GETBITS(x, x);
- if ((d + x) > (dst + destlen))
- return false; // Offset overflow?
- do {
- d--;
- *d = d[x];
- } while (y-- > 0);
- }
- }
-
- // Successful decrunch.
- return true;
-}
-
-#undef SD_GETBIT
-#undef SD_GETBITS
-#undef SD_TYPE_LITERAL
-#undef SD_TYPE_MATCH
-
-void SimonEngine::read_vga_from_datfile_1(uint vga_id) {
- if (getFeatures() & GF_OLD_BUNDLE) {
- File in;
- char buf[15];
- uint32 size;
- if (vga_id == 23)
- vga_id = 112;
- if (vga_id == 328)
- vga_id = 119;
-
- if (getPlatform() == Common::kPlatformAmiga) {
- if (getFeatures() & GF_TALKIE)
- sprintf(buf, "0%d.out", vga_id);
- else
- sprintf(buf, "0%d.pkd", vga_id);
- } else {
- sprintf(buf, "0%d.VGA", vga_id);
- }
-
- in.open(buf);
- if (in.isOpen() == false)
- error("read_vga_from_datfile_1: can't open %s", buf);
- size = in.size();
-
- if (getFeatures() & GF_CRUNCHED) {
- byte *buffer = new byte[size];
- if (in.read(buffer, size) != size)
- error("read_vga_from_datfile_1: read failed");
- decrunchFile(buffer, _vgaBufferPointers[11].vgaFile2, size);
- delete [] buffer;
- } else {
- if (in.read(_vgaBufferPointers[11].vgaFile2, size) != size)
- error("read_vga_from_datfile_1: read failed");
- }
- in.close();
- } else {
- uint32 offs_a = _gameOffsetsPtr[vga_id];
- uint32 size = _gameOffsetsPtr[vga_id + 1] - offs_a;
-
- resfile_read(_vgaBufferPointers[11].vgaFile2, offs_a, size);
- }
-}
-
-byte *SimonEngine::read_vga_from_datfile_2(uint id, uint type) {
- // !!! HACK !!!
- // allocate more space for text to cope with foreign languages that use
- // up more space than english. I hope 6400 bytes are enough. This number
- // is base on: 2 (lines) * 320 (screen width) * 10 (textheight) -- olki
- int extraBuffer = (id == 5 ? 6400 : 0);
-
- if (getFeatures() & GF_OLD_BUNDLE) {
- File in;
- char buf[15];
- uint32 size;
- byte *dst = NULL;
-
- if (getPlatform() == Common::kPlatformAmiga) {
- if (getFeatures() & GF_TALKIE)
- sprintf(buf, "%.3d%d.out", id / 2, type);
- else
- sprintf(buf, "%.3d%d.pkd", id / 2, type);
- } else {
- sprintf(buf, "%.3d%d.VGA", id / 2, type);
- }
-
- in.open(buf);
- if (in.isOpen() == false) {
- if (type == 3)
- return NULL;
- else
- error("read_vga_from_datfile_2: can't open %s", buf);
- }
- size = in.size();
-
- if (getFeatures() & GF_CRUNCHED) {
- byte *buffer = new byte[size];
- if (in.read(buffer, size) != size)
- error("read_vga_from_datfile_2: read failed");
- dst = setup_vga_destination (READ_BE_UINT32(buffer + size - 4) + extraBuffer);
- decrunchFile(buffer, dst, size);
- delete[] buffer;
- } else {
- dst = setup_vga_destination(size + extraBuffer);
- if (in.read(dst, size) != size)
- error("read_vga_from_datfile_2: read failed");
- }
- in.close();
-
- return dst;
- } else {
- uint32 offs_a = _gameOffsetsPtr[id];
- uint32 size = _gameOffsetsPtr[id + 1] - offs_a;
- byte *dst;
-
- dst = setup_vga_destination(size + extraBuffer);
- resfile_read(dst, offs_a, size);
-
- return dst;
- }
-}
-
-void SimonEngine::resfile_read(void *dst, uint32 offs, uint32 size) {
- _gameFile->seek(offs, SEEK_SET);
- if (_gameFile->read(dst, size) != size)
- error("resfile_read(%d,%d) read failed", offs, size);
-}
-
-void SimonEngine::openGameFile() {
- if (!(getFeatures() & GF_OLD_BUNDLE)) {
- _gameFile = new File();
- _gameFile->open(gss->gme_filename);
-
- if (_gameFile->isOpen() == false)
- error("Can't open game file '%s'", gss->gme_filename);
-
- uint32 size = _gameFile->readUint32LE();
-
- _gameOffsetsPtr = (uint32 *)malloc(size);
- if (_gameOffsetsPtr == NULL)
- error("out of memory, game offsets");
-
- resfile_read(_gameOffsetsPtr, 0, size);
-#if defined(SCUMM_BIG_ENDIAN)
- for (uint r = 0; r < size / 4; r++)
- _gameOffsetsPtr[r] = FROM_LE_32(_gameOffsetsPtr[r]);
-#endif
- }
-
- if (getGameType() != GType_FF)
- loadIconFile();
-
- vc34_setMouseOff();
-
- runSubroutine101();
- startUp_helper_2();
-}
-
-void SimonEngine::runSubroutine101() {
- Subroutine *sub;
-
- sub = getSubroutineByID(101);
- if (sub != NULL)
- startSubroutineEx(sub);
-
- startUp_helper_2();
-}
-
-void SimonEngine::dx_copy_rgn_from_3_to_2(uint b, uint r, uint y, uint x) {
- byte *dst, *src;
- uint i;
-
- dst = dx_lock_2();
- src = _sdl_buf_3;
-
- dst += y * _dxSurfacePitch;
- src += y * _dxSurfacePitch;
-
- while (y < b) {
- for (i = x; i < r; i++)
- dst[i] = src[i];
- y++;
- dst += _dxSurfacePitch;
- src += _dxSurfacePitch;
- }
-
- dx_unlock_2();
-}
-
-void SimonEngine::dx_clear_surfaces(uint num_lines) {
- memset(_sdl_buf_attached, 0, num_lines * _screenWidth);
-
- _system->copyRectToScreen(_sdl_buf_attached, _screenWidth, 0, 0, _screenWidth, num_lines);
-
- if (_dxUse3Or4ForLock) {
- memset(_sdl_buf, 0, num_lines * _screenWidth);
- memset(_sdl_buf_3, 0, num_lines * _screenWidth);
- }
-}
-
-void SimonEngine::dx_clear_attached_from_top(uint lines) {
- memset(_sdl_buf_attached, 0, lines * _screenWidth);
-}
-
-void SimonEngine::dx_copy_from_attached_to_2(uint x, uint y, uint w, uint h) {
- uint offs = x + y * _screenWidth;
- byte *s = _sdl_buf_attached + offs;
- byte *d = _sdl_buf + offs;
-
- do {
- memcpy(d, s, w);
- d += _screenWidth;
- s += _screenWidth;
- } while (--h);
-}
-
-void SimonEngine::dx_copy_from_2_to_attached(uint x, uint y, uint w, uint h) {
- uint offs = x + y * _screenWidth;
- byte *s = _sdl_buf + offs;
- byte *d = _sdl_buf_attached + offs;
-
- do {
- memcpy(d, s, w);
- d += _screenWidth;
- s += _screenWidth;
- } while (--h);
-}
-
-void SimonEngine::dx_copy_from_attached_to_3(uint lines) {
- memcpy(_sdl_buf_3, _sdl_buf_attached, lines * _screenWidth);
-}
-
-void SimonEngine::dx_update_screen_and_palette() {
- _numScreenUpdates++;
-
- if (_paletteColorCount == 0 && _paletteFlag == 1) {
- _paletteFlag = 0;
- if (memcmp(_palette, _paletteBackup, 1024) != 0) {
- memcpy(_paletteBackup, _palette, 1024);
- _system->setPalette(_palette, 0, 256);
- }
- }
-
- _system->copyRectToScreen(_sdl_buf_attached, _screenWidth, 0, 0, _screenWidth, _screenHeight);
- _system->updateScreen();
-
- memcpy(_sdl_buf_attached, _sdl_buf, _screenWidth * _screenHeight);
-
- if (_paletteColorCount != 0) {
- if (getGameType() == GType_SIMON1 && _usePaletteDelay) {
- delay(100);
- _usePaletteDelay = false;
- }
- fastFadeIn();
- }
-}
-
-void SimonEngine::fastFadeIn() {
- if (_paletteColorCount & 0x8000) {
- slowFadeIn();
- } else {
- _paletteFlag = false;
- memcpy(_paletteBackup, _palette, 1024);
- _system->setPalette(_palette, 0, _paletteColorCount);
- _paletteColorCount = 0;
- }
-}
-
-void SimonEngine::slowFadeIn() {
- uint8 paletteTmp[768];
- uint8 *src, *dst;
- int c, p;
-
- _paletteColorCount &= 0x7fff;
- _paletteFlag = false;
-
- memcpy(_videoBuf1, _palette, 1024); // Difference
- memset(_videoBuf1, 0, 768);
-
- memcpy(_paletteBackup, _palette, 768);
- memcpy(paletteTmp, _palette, 768);
-
- for (c = 255; c > 0; c -= 4) {
- src = paletteTmp;
- dst = _videoBuf1;
-
- for (p = _paletteColorCount; p !=0 ; p--) {
- if (*src >= c)
- *dst = *dst + 4;
-
- src++;
- dst++;
- }
- _system->setPalette(_videoBuf1, 0, _videoNumPalColors);
- if (_fade)
- _system->updateScreen();
- delay(5);
- }
- _paletteColorCount = 0;
-}
-
-int SimonEngine::go() {
- if (!_dumpFile)
- _dumpFile = stdout;
-
- // allocate buffers
- _sdl_buf_3 = (byte *)calloc(_screenWidth * _screenHeight, 1);
- _sdl_buf = (byte *)calloc(_screenWidth * _screenHeight, 1);
- _sdl_buf_attached = (byte *)calloc(_screenWidth * _screenHeight, 1);
-
- allocItemHeap();
- allocTablesHeap();
-
- setup_vga_file_buf_pointers();
-
- _sound = new Sound(this, gss, _mixer);
- _debugger = new Debugger(this);
-
- if (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute") == 1) {
- if (getGameId() == GID_SIMON1DOS)
- midi._enable_sfx ^= 1;
- else
- _sound->effectsPause(_effectsPaused ^= 1);
- }
-
- loadGamePcFile(gss->gamepc_filename);
-
- addTimeEvent(0, 1);
- openGameFile();
-
- _lastMusicPlayed = -1;
- _frameRate = 1;
-
- _startMainScript = false;
- _continousMainScript = false;
- _startVgaScript = false;
- _continousVgaScript = false;
- _drawImagesDebug = false;
-
- if (gDebugLevel == 2)
- _continousMainScript = true;
- if (gDebugLevel == 3)
- _continousVgaScript = true;
- if (gDebugLevel == 4)
- _startMainScript = true;
- if (gDebugLevel == 5)
- _startVgaScript = true;
-
- if (getFeatures() & GF_TALKIE) {
- // English and German versions of Simon the Sorcerer 1 don't have full subtitles
- if (getGameType() == GType_SIMON1 && (_language == Common::EN_USA || _language == Common::DE_DEU))
- _subtitles = false;
- } else {
- _subtitles = true;
- }
-
- while (1) {
- hitarea_stuff();
- handle_verb_clicked(_verbHitArea);
- delay(100);
- }
-
- return 0;
-}
-
-void SimonEngine::shutdown() {
- delete _gameFile;
-
- midi.close();
-
- free(_stringTabPtr);
- free(_itemArrayPtr);
- free(_itemHeapPtr - _itemHeapCurPos);
- free(_tablesHeapPtr - _tablesHeapCurPos);
- free(_tblList);
- free(_iconFilePtr);
- free(_gameOffsetsPtr);
-
- _system->quit();
-}
-
-void SimonEngine::delay(uint amount) {
- OSystem::Event event;
-
- uint32 start = _system->getMillis();
- uint32 cur = start;
- uint this_delay, vga_period;
-
- if (_debugger->isAttached())
- _debugger->onFrame();
-
- if (_fastMode)
- vga_period = 10;
- else if (getGameType() == GType_SIMON2)
- vga_period = 45 * _speed;
- else
- vga_period = 50 * _speed;
-
- _rnd.getRandomNumber(2);
-
- do {
- while (!_inCallBack && cur >= _lastVgaTick + vga_period && !_pause) {
- _lastVgaTick += vga_period;
-
- // don't get too many frames behind
- if (cur >= _lastVgaTick + vga_period * 2)
- _lastVgaTick = cur;
-
- _inCallBack = true;
- timer_callback();
- _inCallBack = false;
- }
-
- while (_system->pollEvent(event)) {
- switch (event.type) {
- case OSystem::EVENT_KEYDOWN:
- if (event.kbd.keycode >= '0' && event.kbd.keycode <='9'
- && (event.kbd.flags == OSystem::KBD_ALT ||
- event.kbd.flags == OSystem::KBD_CTRL)) {
- _saveLoadSlot = event.kbd.keycode - '0';
-
- // There is no save slot 0
- if (_saveLoadSlot == 0)
- _saveLoadSlot = 10;
-
- sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot);
- _saveLoadType = (event.kbd.flags == OSystem::KBD_ALT) ? 1 : 2;
-
- // We should only allow a load or save when it was possible in original
- // This stops load/save during copy protection, conversations and cut scenes
- if (!_mouseHideCount && !_showPreposition)
- quickLoadOrSave();
- } else if (event.kbd.flags == OSystem::KBD_CTRL) {
- if (event.kbd.keycode == 'a') {
- GUI::Dialog *_aboutDialog;
- _aboutDialog = new GUI::AboutDialog();
- _aboutDialog->runModal();
- } else if (event.kbd.keycode == 'f')
- _fastMode ^= 1;
- else if (event.kbd.keycode == 'd')
- _debugger->attach();
- }
- // Make sure backspace works right (this fixes a small issue on OS X)
- if (event.kbd.keycode == 8)
- _keyPressed = 8;
- else
- _keyPressed = (byte)event.kbd.ascii;
- break;
- case OSystem::EVENT_MOUSEMOVE:
- _sdlMouseX = event.mouse.x;
- _sdlMouseY = event.mouse.y;
- break;
- case OSystem::EVENT_LBUTTONDOWN:
- _leftButtonDown++;
-#if defined (_WIN32_WCE) || defined(PALMOS_MODE)
- _sdlMouseX = event.mouse.x;
- _sdlMouseY = event.mouse.y;
-#endif
- break;
- case OSystem::EVENT_RBUTTONDOWN:
- if (getGameType() == GType_SIMON2 || getGameType() == GType_FF)
- _skipSpeech = true;
- else
- _exitCutscene = true;
- break;
- case OSystem::EVENT_QUIT:
- shutdown();
- return;
- break;
- default:
- break;
- }
- }
-
- if (amount == 0)
- break;
-
- {
- this_delay = _fastMode ? 1 : 20 * _speed;
- if (this_delay > amount)
- this_delay = amount;
- _system->delayMillis(this_delay);
- }
- cur = _system->getMillis();
- } while (cur < start + amount);
-}
-
-void SimonEngine::loadMusic(uint music) {
- char buf[4];
-
- if (getPlatform() == Common::kPlatformAmiga) {
- if (getFeatures() & GF_CRUNCHED) {
- // TODO Add support for decruncher
- debug(5,"loadMusic - Decrunch %dtune attempt", music);
- }
- // TODO Add Protracker support for simon1amiga/cd32
- debug(5,"playMusic - Load %dtune attempt", music);
- } else if (getGameType() == GType_SIMON2) { // Simon 2 music
- midi.stop();
- _gameFile->seek(_gameOffsetsPtr[MUSIC_INDEX_BASE + music - 1], SEEK_SET);
- _gameFile->read(buf, 4);
- if (!memcmp(buf, "FORM", 4)) {
- _gameFile->seek(_gameOffsetsPtr[MUSIC_INDEX_BASE + music - 1], SEEK_SET);
- midi.loadXMIDI (_gameFile);
- } else {
- _gameFile->seek(_gameOffsetsPtr[MUSIC_INDEX_BASE + music - 1], SEEK_SET);
- midi.loadMultipleSMF (_gameFile);
- }
-
- _lastMusicPlayed = music;
- _nextMusicToPlay = -1;
- } else if (getGameType() == GType_SIMON1) { // Simon 1 music
- midi.stop();
- midi.setLoop (true); // Must do this BEFORE loading music. (GMF may have its own override.)
-
- if (getFeatures() & GF_TALKIE) {
- // FIXME: The very last music resource, a cymbal crash for when the
- // two demons crash into each other, should NOT be looped like the
- // other music tracks. In simon1dos/talkie the GMF resource includes
- // a loop override that acomplishes this, but there seems to be nothing
- // for this in the SMF resources.
- if (music == 35)
- midi.setLoop (false);
-
- _gameFile->seek(_gameOffsetsPtr[MUSIC_INDEX_BASE + music], SEEK_SET);
- _gameFile->read(buf, 4);
- if (!memcmp(buf, "GMF\x1", 4)) {
- _gameFile->seek(_gameOffsetsPtr[MUSIC_INDEX_BASE + music], SEEK_SET);
- midi.loadSMF (_gameFile, music);
- } else {
- _gameFile->seek(_gameOffsetsPtr[MUSIC_INDEX_BASE + music], SEEK_SET);
- midi.loadMultipleSMF (_gameFile);
- }
-
- } else {
- char filename[15];
- File f;
- sprintf(filename, "MOD%d.MUS", music);
- f.open(filename);
- if (f.isOpen() == false) {
- warning("Can't load music from '%s'", filename);
- return;
- }
- if (getGameId() == GID_SIMON1DEMO)
- midi.loadS1D (&f);
- else
- midi.loadSMF (&f, music);
- }
-
- midi.startTrack (0);
- }
-}
-
-byte *SimonEngine::dx_lock_2() {
- _dxSurfacePitch = _screenWidth;
- return _sdl_buf;
-}
-
-void SimonEngine::dx_unlock_2() {
-}
-
-byte *SimonEngine::dx_lock_attached() {
- _dxSurfacePitch = _screenWidth;
- return _dxUse3Or4ForLock ? _sdl_buf_3 : _sdl_buf_attached;
-}
-
-void SimonEngine::dx_unlock_attached() {
-}
-
-void SimonEngine::set_volume(int volume) {
- _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volume);
-}
-
-byte SimonEngine::getByte() {
- return *_codePtr++;
-}
-
-} // End of namespace Simon
-
-#ifdef PALMOS_68K
-#include "scumm_globals.h"
-
-_GINIT(Simon_Simon)
-_GSETPTR(Simon::simon1_settings, GBVARS_SIMON1SETTINGS_INDEX, Simon::GameSpecificSettings, GBVARS_SIMON)
-_GSETPTR(Simon::simon1acorn_settings, GBVARS_SIMON1ACORNSETTINGS_INDEX, Simon::GameSpecificSettings, GBVARS_SIMON)
-_GSETPTR(Simon::simon1amiga_settings, GBVARS_SIMON1AMIGASETTINGS_INDEX, Simon::GameSpecificSettings, GBVARS_SIMON)
-_GSETPTR(Simon::simon1demo_settings, GBVARS_SIMON1DEMOSETTINGS_INDEX, Simon::GameSpecificSettings, GBVARS_SIMON)
-_GSETPTR(Simon::simon2win_settings, GBVARS_SIMON2WINSETTINGS_INDEX, Simon::GameSpecificSettings, GBVARS_SIMON)
-_GSETPTR(Simon::simon2dos_settings, GBVARS_SIMON2DOSSETTINGS_INDEX, Simon::GameSpecificSettings, GBVARS_SIMON)
-_GSETPTR(Simon::feeblefiles_settings, GBVARS_FEEBLEFILESSETTINGS_INDEX, Simon::GameSpecificSettings, GBVARS_SIMON)
-_GEND
-
-_GRELEASE(Simon_Simon)
-_GRELEASEPTR(GBVARS_SIMON1SETTINGS_INDEX, GBVARS_SIMON)
-_GRELEASEPTR(GBVARS_SIMON1ACORNSETTINGS_INDEX, GBVARS_SIMON)
-_GRELEASEPTR(GBVARS_SIMON1AMIGASETTINGS_INDEX, GBVARS_SIMON)
-_GRELEASEPTR(GBVARS_SIMON1DEMOSETTINGS_INDEX, GBVARS_SIMON)
-_GRELEASEPTR(GBVARS_SIMON2WINSETTINGS_INDEX, GBVARS_SIMON)
-_GRELEASEPTR(GBVARS_SIMON2DOSSETTINGS_INDEX, GBVARS_SIMON)
-_GRELEASEPTR(GBVARS_FEEBLEFILESSETTINGS_INDEX, GBVARS_SIMON)
-_GEND
-
-#endif
diff --git a/simon/simon.h b/simon/simon.h
deleted file mode 100644
index 8fa27924b6..0000000000
--- a/simon/simon.h
+++ /dev/null
@@ -1,903 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef SIMON_H
-#define SIMON_H
-
-#include <stdio.h>
-#include "base/engine.h"
-#include "base/gameDetector.h"
-#include "base/plugins.h"
-#include "common/util.h"
-#include "simon/midi.h"
-#include "simon/sound.h"
-#include "simon/vga.h"
-
-class GameDetector;
-
-namespace Simon {
-
-/* Various other settings */
-//#define DUMP_FILE_NR 8
-//#define DUMP_BITMAPS_FILE_NR 8
-
-uint fileReadItemID(Common::File *in);
-
-#define CHECK_BOUNDS(x, y) assert((uint)(x) < ARRAYSIZE(y))
-#define NUM_PALETTE_FADEOUT 32
-
-struct Child;
-struct Child2;
-
-struct Item;
-struct FillOrCopyStruct;
-struct Subroutine;
-struct SubroutineLine;
-struct TimeEvent;
-
-struct TextLocation {
- int16 x, y, width;
- TextLocation() { memset(this, 0, sizeof(*this)); }
-};
-
-struct HitArea {
- uint16 x, y;
- uint16 width, height;
- uint16 flags;
- uint16 id;
- FillOrCopyStruct *fcs;
- Item *item_ptr;
- uint16 unk3;
- uint16 layer;
- HitArea() { memset(this, 0, sizeof(*this)); }
-};
-
-struct VgaPointersEntry {
- byte *vgaFile1;
- byte *vgaFile2;
- byte *sfxFile;
- VgaPointersEntry() { memset(this, 0, sizeof(*this)); }
-};
-
-struct VgaSprite {
- uint16 id;
- uint16 image;
- uint16 palette;
- uint16 x, y; /* actually signed numbers */
- uint16 flags;
- uint16 priority;
- uint16 windowNum, fileId;
- VgaSprite() { memset(this, 0, sizeof(*this)); }
-};
-
-struct VgaSleepStruct {
- uint16 ident;
- const byte *code_ptr;
- uint16 sprite_id;
- uint16 cur_vga_file;
- VgaSleepStruct() { memset(this, 0, sizeof(*this)); }
-};
-
-struct VgaTimerEntry {
- uint16 delay;
- const byte *script_pointer;
- uint16 sprite_id;
- uint16 cur_vga_file;
- VgaTimerEntry() { memset(this, 0, sizeof(*this)); }
-};
-
-enum SimonTypes {
- GType_SIMON1,
- GType_SIMON2,
- GType_FF
-};
-
-struct GameFileDescription {
- const char *fileName;
- uint16 fileType;
-};
-
-struct GameDescription {
- const char *name;
- SimonTypes gameType;
- GameIds gameId;
- const char *title;
- int filesCount;
- GameFileDescription *filesDescriptions;
- uint32 features;
- Common::Language language;
- Common::Platform platform;
-
- GameSettings toGameSettings() const {
- GameSettings dummy = { name, title, features };
- return dummy;
- }
-};
-
-DetectedGameList GAME_ProbeGame(const FSList &fslist, int **matches = NULL);
-
-struct GameSpecificSettings;
-
-class Debugger;
-
-class SimonEngine : public Engine {
- friend class Debugger;
-
- void errorString(const char *buf_input, char *buf_output);
-
- typedef void (SimonEngine::*VgaOpcodeProc) ();
- void setupVgaOpcodes();
- const VgaOpcodeProc *_vga_opcode_table;
-
-public:
- GameDescription *_gameDescription;
-
- bool initGame(void);
-
- int getGameId() const { return _gameDescription->gameId; }
- int getGameType() const { return _gameDescription->gameType; }
- uint32 getFeatures() const { return _gameDescription->features; }
- Common::Language getLanguage() const { return _gameDescription->language; }
- Common::Platform getPlatform() const { return _gameDescription->platform; }
-
-protected:
- void playSting(uint a);
-
- const byte *_vcPtr; /* video code ptr */
- uint16 _vc_get_out_of_code;
-
-
- uint32 *_gameOffsetsPtr;
-
- uint VGA_DELAY_BASE;
- uint TABLE_INDEX_BASE;
- uint TEXT_INDEX_BASE;
- uint NUM_VIDEO_OP_CODES;
- uint VGA_MEM_SIZE;
- uint TABLES_MEM_SIZE;
- uint MUSIC_INDEX_BASE;
- uint SOUND_INDEX_BASE;
- const GameSpecificSettings *gss;
-
- byte _keyPressed;
-
- typedef enum {
- FORMAT_NONE,
- FORMAT_MP3,
- FORMAT_WAV,
- FORMAT_VOC
- } SoundFormat;
-
- Common::File *_gameFile;
-
- byte *_strippedTxtMem;
- uint _textSize;
- uint _stringTabNum, _stringTabPos, _stringtab_numalloc;
- byte **_stringTabPtr;
-
- Item **_itemArrayPtr;
- uint _itemArraySize;
- uint _itemArrayInited;
-
- byte *_itemHeapPtr;
- uint _itemHeapCurPos;
- uint _itemHeapSize;
-
- byte *_iconFilePtr;
-
- byte *_tblList;
-
- const byte *_codePtr;
-
- byte **_localStringtable;
- uint _stringIdLocalMin, _stringIdLocalMax;
-
- byte *_tablesHeapPtr, *_tablesHeapPtrOrg, *_tablesheapPtrNew;
- uint _tablesHeapSize, _tablesHeapCurPos, _tablesHeapCurPosOrg;
- uint _tablesHeapCurPosNew;
-
- Subroutine *_subroutineList, *_subroutineListOrg;
- uint _subroutine;
-
- uint _dxSurfacePitch;
-
- uint _recursionDepth;
-
- uint32 _lastVgaTick;
-
- uint16 _marks;
-
- bool _scriptVar2;
- bool _runScriptReturn1;
- bool _skipVgaWait;
- bool _noParentNotify;
- bool _beardLoaded;
- bool _hitarea_unk_3;
- bool _mortalFlag;
- byte _updateScreen;
- bool _usePaletteDelay;
- bool _syncFlag2;
- bool _inCallBack;
- bool _cepeFlag;
- byte _copyPartialMode;
- uint _speed;
- bool _fastMode;
- bool _dxUse3Or4ForLock;
-
- uint16 _debugMode;
- uint16 _language;
- bool _pause;
- bool _startMainScript;
- bool _continousMainScript;
- bool _startVgaScript;
- bool _continousVgaScript;
- bool _drawImagesDebug;
- bool _dumpImages;
- bool _speech;
- bool _subtitles;
- bool _fade;
- byte _mouseCursor;
- bool _vgaVar9;
- int16 _scriptUnk1;
- bool _vgaVar6;
- int _scrollX, _scrollXMax, _scrollHeight;
- int _scrollY, _scrollYMax, _scrollWidth;
- int _scrollCount, _scrollFlag;
- const byte *_scrollImage;
- byte _vgaVar8;
-
- int16 _scriptVerb, _scriptNoun1, _scriptNoun2;
- int16 _scriptAdj1, _scriptAdj2;
-
- uint16 _curWindow;
- FillOrCopyStruct *_textWindow;
-
- Item *_subjectItem, *_objectItem;
- Item *_item1;
-
- Item *_hitAreaObjectItem;
- HitArea *_lastHitArea;
- HitArea *_lastHitArea2Ptr;
- HitArea *_lastHitArea3;
- byte _leftButtonDown;
- Item *_hitAreaSubjectItem;
- HitArea *_hitAreaPtr5, *_hitAreaPtr7;
- uint _needHitAreaRecalc;
- uint _verbHitArea;
- uint16 _hitAreaUnk4;
- uint _mouseHideCount;
-
- uint16 _windowNum;
-
- uint _printCharCurPos, _printCharMaxPos;
- uint _numLettersToPrint;
-
- uint _lastTime;
-
- TimeEvent *_firstTimeStruct, *_pendingDeleteTimeEvent;
-
- uint _base_time;
-
- uint _mouseX, _mouseY;
- uint _mouseXOld, _mouseYOld;
-
- Item *_dummyItem1;
- Item *_dummyItem2;
- Item *_dummyItem3;
-
- volatile uint16 _lockWord;
- uint16 _scrollUpHitArea;
- uint16 _scrollDownHitArea;
-
- uint16 _videoVar7;
- volatile uint16 _paletteColorCount;
-
- uint _screenWidth, _screenHeight;
-
- byte _videoVar4;
- bool _videoVar5;
- bool _fastFadeOutFlag;
- bool _unkPalFlag;
- bool _exitCutscene;
- bool _skipSpeech;
- byte _paletteFlag;
-
- uint _soundFileId;
- int16 _lastMusicPlayed;
- int16 _nextMusicToPlay;
-
- bool _showPreposition;
- bool _showMessageFlag;
-
- uint _videoNumPalColors;
-
- uint _vgaSpriteChanged;
-
- byte *_vgaBufFreeStart, *_vgaBufEnd, *_vgaBufStart;
- byte *_vgaFileBufOrg, *_vgaFileBufOrg2;
-
- byte *_curVgaFile1;
- byte *_curVgaFile2;
- byte *_curSfxFile;
-
- uint16 _timer1, _timer5, _timer4;
-
- uint16 _frameRate;
-
- uint16 _vgaCurFile2;
- uint16 _vgaWaitFor, _vgaCurFileId;
- uint16 _vgaCurSpriteId;
-
- int16 _baseY;
- float _scale;
-
- VgaTimerEntry *_nextVgaTimerToProcess;
-
- Item *_vcItemArray[20];
- Item *_itemArray6[20];
-
- uint16 _stringIdArray2[20];
- uint16 _stringIdArray3[20];
- uint16 _speechIdArray4[20];
-
- uint16 _bitArray[48];
- int16 _variableArray[256];
-
- FillOrCopyStruct *_windowArray[8];
-
- byte _fcsData1[8];
- bool _fcsData2[8];
-
- TextLocation _textLocation1, _textLocation2, _textLocation3, _textLocation4;
-
- int _freeStringSlot;
-
- byte _stringReturnBuffer[2][180];
-
- HitArea _hitAreas[90];
-
- VgaPointersEntry _vgaBufferPointers[450];
- VgaSprite _vgaSprites[180];
- VgaSleepStruct _vgaSleepStructs[30];
-
- const uint16 *_pathFindArray[100];
-
- uint8 _pathValues[400];
- uint8 _PVCount;
- uint8 _GPVCount;
-
- uint8 _pathValues1[400];
- uint8 _PVCount1;
- uint8 _GPVCount1;
-
- uint8 _paletteBackup[1024];
- uint8 _palette[1024];
-
- byte _videoBuf1[3000];
-
- VgaTimerEntry _vgaTimerList[95];
-
- FillOrCopyStruct *_fcs_list;
-
- byte _lettersToPrintBuf[80];
-
- MidiPlayer midi;
- bool _native_mt32;
-
- int _numScreenUpdates;
- int _vgaTickCounter;
-
- Sound *_sound;
-
- bool _effectsPaused;
- bool _ambientPaused;
- bool _musicPaused;
-
- Debugger *_debugger;
-
- FILE *_dumpFile;
-
- int _saveLoadRowCurPos;
- int _numSaveGameRows;
- bool _saveDialogFlag;
- bool _saveOrLoad;
- bool _saveLoadFlag;
-
- byte _saveLoadType, _saveLoadSlot;
- char _saveLoadName[32];
-
- int _sdlMouseX, _sdlMouseY;
-
- byte *_sdl_buf_3;
- byte *_sdl_buf;
- byte *_sdl_buf_attached;
-
- Common::RandomSource _rnd;
-
- const byte *_vc10BasePtrOld;
- byte _hebrew_char_widths[32];
-
-public:
- SimonEngine(GameDetector *detector, OSystem *syst);
- virtual ~SimonEngine();
-
-protected:
- uint16 to16Wrapper(uint value);
- uint16 readUint16Wrapper(const void *src);
-
- int allocGamePcVars(Common::File *in);
- void loginPlayerHelper(Item *item, int a, int b);
- void loginPlayer();
- void allocateStringTable(int num);
- void setupStringTable(byte *mem, int num);
- void setupLocalStringTable(byte *mem, int num);
- void readGamePcText(Common::File *in);
- void readItemChildren(Common::File *in, Item *item, uint tmp);
- void readItemFromGamePc(Common::File *in, Item *item);
- void loadGamePcFile(const char *filename);
-
- void palette_fadeout(uint32 *pal_values, uint num);
-
- byte *allocateItem(uint size);
- byte *allocateTable(uint size);
- void alignTableMem();
-
- Child *findChildOfType(Item *i, uint child);
- Child *allocateChildBlock(Item *i, uint type, uint size);
-
- void allocItemHeap();
- void allocTablesHeap();
-
- Subroutine *createSubroutine(uint a);
- void readSubroutine(Common::File *in, Subroutine *sub);
- SubroutineLine *createSubroutineLine(Subroutine *sub, int a);
- void readSubroutineLine(Common::File *in, SubroutineLine *new_table, Subroutine *sub);
- byte *readSingleOpcode(Common::File *in, byte *ptr);
- void readSubroutineBlock(Common::File *in);
-
- Subroutine *getSubroutineByID(uint subroutine_id);
-
- /* used in debugger */
- void dumpSubroutines();
- void dumpSubroutine(Subroutine *sub);
- void dumpSubroutineLine(SubroutineLine *sl, Subroutine *sub);
- const byte *dumpOpcode(const byte *p);
-
- int startSubroutine(Subroutine *sub);
- int startSubroutineEx(Subroutine *sub);
-
- bool checkIfToRunSubroutineLine(SubroutineLine *sl, Subroutine *sub);
-
- int runScript();
-
- Item *getNextItemPtr();
- uint getNextItemID();
- uint getItem1ID() {return 1;}
- Item *getItem1Ptr();
- Item *getItemPtrB();
-
- byte getByte();
- int getNextWord();
-
- uint getNextVarContents();
- uint getVarOrWord();
- uint getVarOrByte();
- uint readVariable(uint variable);
- void writeNextVarContents(uint16 contents);
- void writeVariable(uint variable, uint16 contents);
-
- void setItemParent(Item *item, Item *parent);
-
- uint itemPtrToID(Item *id);
-
- Item *derefItem(uint item);
- void setItemState(Item *item, int value);
-
- void showMessageFormat(const char *s, ...);
- const byte *getStringPtrByID(uint string_id);
- const byte *getLocalStringByID(uint string_id);
- uint getNextStringID();
-
- void addTimeEvent(uint timeout, uint subroutine_id);
- void delTimeEvent(TimeEvent *te);
-
- bool isRoom(Item *item);
- bool isObject(Item *item);
-
- void itemChildrenChanged(Item *item);
- void unlinkItem(Item *item);
- void linkItem(Item *item, Item *parent);
-
- bool o_chance(uint a);
-
- void o_kill_sprite_simon1(uint a);
- void o_kill_sprite_simon2(uint a, uint b);
-
- void o_vga_reset();
- void changeWindow(uint a);
- void o_unk_103();
- void closeWindow(uint a);
- void clear_hitarea_bit_0x40(uint hitarea);
- void set_hitarea_bit_0x40(uint hitarea);
- void set_hitarea_x_y(uint hitarea, int x, int y);
- bool is_hitarea_0x40_clear(uint hitarea);
- void delete_hitarea(uint hitarea);
- void addNewHitArea(int id, int x, int y, int width, int height, int flags, int unk3, Item *item_ptr);
- HitArea *findEmptyHitArea();
- void hitarea_proc_1();
- void handle_verb_hitarea(HitArea * ha);
- void hitarea_leave(HitArea * ha);
- void leaveHitAreaById(uint hitarea_id);
-
- void o_waitForSync(uint a);
- void skipSpeech();
- void o_sync(uint a);
- void o_playMusic();
- void o_saveGame();
- void o_loadGame();
- void o_confirmQuit();
- void o_restoreIconArray(uint a);
- void o_freezeBottom();
- void killAllTimers();
-
- uint getOffsetOfChild2Param(Child2 *child, uint prop);
- void o_unk_160(uint a);
- void o_playSFX(uint a);
- void o_lockZone();
- void o_unlockZone();
- void o_pathfind(int x, int y, uint var_1, uint var_2);
- void o_mouseOn();
- void o_mouseOff();
- void o_loadBeard();
- void o_unloadBeard();
- void o_unloadZone(uint a);
- void o_unfreezeBottom();
- void o_fadeToBlack();
-
- TextLocation *getTextLocation(uint a);
- void o_printStr();
- void o_setup_cond_c();
- void setup_cond_c_helper();
-
- void o_inventory_descriptions();
-
- void mouseOff();
- void mouseOn();
-
- void drawIconArray(uint i, Item *item_ptr, int unk1, int unk2);
-
- void loadTextIntoMem(uint string_id);
- void loadTablesIntoMem(uint subr_id);
-
- uint loadTextFile(const char *filename, byte *dst);
- Common::File *openTablesFile(const char *filename);
- void closeTablesFile(Common::File *in);
-
- uint loadTextFile_simon1(const char *filename, byte *dst);
- Common::File *openTablesFile_simon1(const char *filename);
-
- uint loadTextFile_gme(const char *filename, byte *dst);
- Common::File *openTablesFile_gme(const char *filename);
-
- void invokeTimeEvent(TimeEvent *te);
- bool kickoffTimeEvents();
-
- void defocusHitarea();
- void endCutscene();
- void runSubroutine101();
- void handle_uparrow_hitarea(FillOrCopyStruct *fcs);
- void handle_downarrow_hitarea(FillOrCopyStruct *fcs);
- void hitareaChangedHelper();
- void focusVerb(uint hitarea_id);
- HitArea *findHitAreaByID(uint hitarea_id);
-
- void showActionString(uint x, const byte *string);
- void video_putchar(FillOrCopyStruct *fcs, byte c, byte b = 0);
- void video_fill_or_copy_from_3_to_2(FillOrCopyStruct *fcs);
- void video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte d);
-
- void read_vga_from_datfile_1(uint vga_id);
-
- uint get_fcs_ptr_3_index(FillOrCopyStruct *fcs);
-
- void setup_hitarea_from_pos(uint x, uint y, uint mode);
- void new_current_hitarea(HitArea * ha);
- bool hitarea_proc_2(uint a);
- bool hitarea_proc_3(Item *item);
- void f10_key();
- void hitarea_stuff();
-
- void handle_mouse_moved();
- void pollMouseXY();
- void drawMousePointer();
-
- void removeIconArray(uint fcs_index);
- void draw_icon_c(FillOrCopyStruct *fcs, uint icon, uint x, uint y);
- bool has_item_childflag_0x10(Item *item);
- uint item_get_icon_number(Item *item);
- uint setup_icon_hit_area(FillOrCopyStruct *fcs, uint x, uint y, uint icon_number, Item *item_ptr);
- void addArrows(FillOrCopyStruct *fcs, uint fcs_index);
-
- void loadIconFile();
- void processSpecialKeys();
- void hitarea_stuff_helper();
-
- void startUp_helper_2();
- void showmessage_helper_3(uint a, uint b);
- void showmessage_print_char(byte chr);
-
- void handle_verb_clicked(uint verb);
-
- void o_set_video_mode(uint mode, uint vga_res);
- void set_video_mode_internal(uint mode, uint vga_res_id);
-
- void o_loadZone(uint vga_res);
- void loadZone(uint vga_res);
-
- void loadSprite(uint windowNum, uint vga_res, uint vga_sprite_id, uint x, uint y, uint palette);
- void o_defineWindow(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h);
- void playSpeech(uint speech_id, uint vga_sprite_id);
- void printText(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 width);
- FillOrCopyStruct *openWindow(uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint text_color);
-
- void render_string_amiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
- void render_string(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
-
- void setArrowHitAreas(FillOrCopyStruct *fcs, uint fcs_index);
-
- byte *setup_vga_destination(uint32 size);
- void vga_buf_unk_proc3(byte *end);
- void vga_buf_unk_proc1(byte *end);
- void vga_buf_unk_proc2(uint a, byte *end);
- void delete_memptr_range(byte *end);
-
- void setup_vga_file_buf_pointers();
-
- void run_vga_script();
-
-public:
- // Simon1/Simon2 video script opcodes
- void vc1_fadeOut();
- void vc2_call();
- void vc3_loadSprite();
- void vc4_fadeIn();
- void vc5_skip_if_neq();
- void vc6_skip_ifn_sib_with_a();
- void vc7_skip_if_sib_with_a();
- void vc8_skip_if_parent_is();
- void vc9_skip_if_unk3_is();
- void vc10_draw();
- void vc11_clearPathFinder();
- void vc12_delay();
- void vc13_addToSpriteX();
- void vc14_addToSpriteY();
- void vc15_wakeup_id();
- void vc16_sleep_on_id();
- void vc17_setPathfinderItem();
- void vc18_jump();
- void vc19_chain_to_script();
- void vc20_setRepeat();
- void vc21_endRepeat();
- void vc22_setSpritePalette();
- void vc23_setSpritePriority();
- void vc24_setSpriteXY();
- void vc25_halt_sprite();
- void vc26_setSubWindow();
- void vc27_resetSprite();
- void vc28_dummy_op();
- void vc29_stopAllSounds();
- void vc30_setFrameRate();
- void vc31_setWindow();
- void vc32_copyVar();
- void vc33_setMouseOn();
- void vc34_setMouseOff();
- void vc35_clearWindow();
- void vc36_setWindowImage();
- void vc37_addToSpriteY();
- void vc38_skipIfVarZero();
- void vc39_setVar();
- void vc40();
- void vc41();
- void vc42_delayIfNotEQ();
- void vc43_skipIfBitClear();
- void vc44_skipIfBitSet();
- void vc45_setSpriteX();
- void vc46_setSpriteY();
- void vc47_addToVar();
- void vc48_setPathFinder();
- void vc49_setBit();
- void vc50_clearBit();
- void vc51_clear_hitarea_bit_0x40();
- void vc52_playSound();
- void vc53_no_op();
- void vc54_no_op();
- void vc55_offset_hit_area();
- void vc56_delay();
- void vc57_no_op();
- void vc58();
- void vc59();
- void vc60_killSprite();
- void vc61_setMaskImage();
- void vc62_fastFadeOut();
- void vc63_fastFadeIn();
-
- // Simon2 specific Video Script Opcodes
- void vc64_skipIfSpeechEnded();
- void vc65_slowFadeIn();
- void vc66_skipIfNotEqual();
- void vc67_skipIfGE();
- void vc68_skipIfLE();
- void vc69_playTrack();
- void vc70_queueMusic();
- void vc71_checkMusicQueue();
- void vc72_play_track_2();
- void vc73_setMark();
- void vc74_clearMark();
-
- // Feeble specific Video Script Opcodes
- void vc75_setScale();
- void vc76_setScaleXOffs();
- void vc77_setScaleYOffs();
- void vc78_computeXY();
- void vc79_computePosNum();
- void vc80_setOverlayImage();
- void vc81_setRandom();
- void vc82_getPathValue();
- void vc83_playSoundLoop();
- void vc84_stopSoundLoop();
-
-protected:
- void drawImages(VC10_state *state);
- void drawImages_Feeble(VC10_state *state);
-
- void delete_vga_timer(VgaTimerEntry * vte);
- void vcResumeSprite(const byte *code_ptr, uint16 cur_file, uint16 cur_sprite);
- int vcReadVarOrWord();
- uint vcReadNextWord();
- uint vcReadNextByte();
- uint vcReadVar(uint var);
- void vcWriteVar(uint var, int16 value);
- void vcSkipNextInstruction();
-
- int getScale(int y, int x);
-
- bool itemIsSiblingOf(uint16 val);
- bool itemIsParentOf(uint16 a, uint16 b);
- bool vc_maybe_skip_proc_1(uint16 a, int16 b);
-
- void add_vga_timer(uint num, const byte *code_ptr, uint cur_sprite, uint cur_file);
- VgaSprite *findCurSprite();
-
- bool vcGetBit(uint bit);
- void vcSetBitTo(uint bit, bool value);
-
- void expire_vga_timers();
-
- bool isSpriteLoaded(uint16 id, uint16 fileId);
-
- void fcs_setTextColor(FillOrCopyStruct *fcs, uint value);
-
- void video_copy_if_flag_0x8_c(FillOrCopyStruct *fcs);
- void delete_hitarea_by_index(uint index);
-
- void removeArrows(FillOrCopyStruct *fcs, uint fcs_index);
- void fcs_putchar(uint a);
-
- void copy_img_from_3_to_2(FillOrCopyStruct *fcs);
- void video_erase(FillOrCopyStruct *fcs);
-
- void dx_copy_rgn_from_3_to_2(uint b, uint r, uint y, uint x);
-
- byte *dx_lock_2();
- void dx_unlock_2();
-
- byte *dx_lock_attached();
- void dx_unlock_attached();
-
- byte *read_vga_from_datfile_2(uint id, uint type);
-
- void resfile_read(void *dst, uint32 offs, uint32 size);
-
- int init(GameDetector &detector);
- int go();
- void openGameFile();
-
- void timer_callback();
- void timer_proc1();
-
- void timer_vga_sprites();
- void timer_vga_sprites_2();
-
- void dx_clear_surfaces(uint num_lines);
- void dx_update_screen_and_palette();
-
- void dump_video_script(const byte *src, bool one_opcode_only);
- void dump_vga_file(const byte *vga);
- void dump_vga_script(const byte *ptr, uint res, uint sprite_id);
- void dump_vga_script_always(const byte *ptr, uint res, uint sprite_id);
- void dump_vga_bitmaps(const byte *vga, byte *vga1, int res);
- void dump_single_bitmap(int file, int image, const byte *offs, int w, int h, byte base);
-
- void dx_clear_attached_from_top(uint lines);
- void dx_copy_from_attached_to_2(uint x, uint y, uint w, uint h);
- void dx_copy_from_attached_to_3(uint lines);
- void dx_copy_from_2_to_attached(uint x, uint y, uint w, uint h);
-
- void print_char_helper_1(const byte *src, uint len);
- void print_char_helper_5(FillOrCopyStruct *fcs);
-
- void quickLoadOrSave();
- void shutdown();
-
- byte *vc10_uncompressFlip(const byte *src, uint w, uint h);
- byte *vc10_flip(const byte *src, uint w, uint h);
-
- Item *getNextItemPtrStrange();
-
- bool saveGame(uint slot, char *caption);
- bool loadGame(uint slot);
-
- void showmessage_helper_2();
- void print_char_helper_6(uint i);
-
- void video_putchar_newline(FillOrCopyStruct *fcs);
- void video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y, byte chr);
-
- void loadMusic(uint music);
- void checkTimerCallback();
- void delay(uint delay);
- void pause();
-
- void o_83_helper();
- void o_waitForMark(uint i);
- void timer_vga_sprites_helper();
-
- void decodeStripA(byte *dst, const byte *src, int height);
- void scroll_timeout();
- void hitarea_stuff_helper_2();
- void fastFadeIn();
- void slowFadeIn();
-
- void vc_kill_sprite(uint file, uint sprite);
-
- void set_dummy_cursor();
-
- void set_volume(int volume);
-
- void saveOrLoadDialog(bool load);
- void o_unk_132_helper_3();
- int o_unk_132_helper(bool *b, char *buf);
- void o_clearCharacter(FillOrCopyStruct *fcs, int x, byte b = 0);
- void saveGameDialog(char *buf);
- void o_fileError(FillOrCopyStruct *fcs, bool save_error);
-
- int countSaveGames();
- int displaySaveGameList(int curpos, bool load, char *dst);
-
- void show_it(void *buf);
-
- char *gen_savename(int slot);
-};
-
-} // End of namespace Simon
-
-#endif
diff --git a/simon/sound.cpp b/simon/sound.cpp
deleted file mode 100644
index f40a164a12..0000000000
--- a/simon/sound.cpp
+++ /dev/null
@@ -1,555 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "common/stdafx.h"
-
-#include "common/file.h"
-#include "common/util.h"
-
-#include "simon/simon.h"
-#include "simon/sound.h"
-
-#include "sound/flac.h"
-#include "sound/mp3.h"
-#include "sound/voc.h"
-#include "sound/vorbis.h"
-#include "sound/wave.h"
-
-using Common::File;
-
-namespace Simon {
-
-#define SOUND_BIG_ENDIAN true
-
-class BaseSound {
-protected:
- File *_file;
- uint32 *_offsets;
- Audio::Mixer *_mixer;
- bool _freeOffsets;
-
-public:
- BaseSound(Audio::Mixer *mixer, File *file, uint32 base = 0, bool bigendian = false);
- BaseSound(Audio::Mixer *mixer, File *file, uint32 *offsets, bool bigendian = false);
- virtual ~BaseSound();
- virtual void playSound(uint sound, Audio::SoundHandle *handle, byte flags) = 0;
-};
-
-class WavSound : public BaseSound {
-public:
- WavSound(Audio::Mixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {};
- WavSound(Audio::Mixer *mixer, File *file, uint32 *offsets) : BaseSound(mixer, file, offsets) {};
- void playSound(uint sound, Audio::SoundHandle *handle, byte flags);
-};
-
-class VocSound : public BaseSound {
-public:
- VocSound(Audio::Mixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {};
- void playSound(uint sound, Audio::SoundHandle *handle, byte flags);
-};
-class RawSound : public BaseSound {
-public:
- RawSound(Audio::Mixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {};
- void playSound(uint sound, Audio::SoundHandle *handle, byte flags);
-};
-
-BaseSound::BaseSound(Audio::Mixer *mixer, File *file, uint32 base, bool bigendian) {
- _mixer = mixer;
- _file = file;
-
- uint res = 0;
- uint32 size;
-
- _file->seek(base + sizeof(uint32), SEEK_SET);
- if (bigendian)
- size = _file->readUint32BE();
- else
- size = _file->readUint32LE();
-
- // The Feeble Files uses set amount of voice offsets
- if (size == 0)
- size = 40000;
-
- res = size / sizeof(uint32);
-
- _offsets = (uint32 *)malloc(size + sizeof(uint32));
- _freeOffsets = true;
-
- _file->seek(base, SEEK_SET);
-
- if (_file->read(_offsets, size) != size)
- error("Can't read offsets");
-
- for (uint i = 0; i < res; i++) {
-#if defined(SCUMM_BIG_ENDIAN)
- if (!(bigendian))
- _offsets[i] = FROM_LE_32(_offsets[i]);
-#endif
- if (bigendian)
- _offsets[i] = TO_BE_32(_offsets[i]);
- _offsets[i] += base;
- }
-
- // only needed for mp3
- _file->seek(0, SEEK_END);
- _offsets[res] = _file->pos();
-}
-
-BaseSound::BaseSound(Audio::Mixer *mixer, File *file, uint32 *offsets, bool bigendian) {
- _mixer = mixer;
- _file = file;
- _offsets = offsets;
- _freeOffsets = false;
-}
-
-BaseSound::~BaseSound() {
- if (_freeOffsets)
- free(_offsets);
- delete _file;
-}
-
-void WavSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) {
- if (_offsets == NULL)
- return;
-
- _file->seek(_offsets[sound], SEEK_SET);
-
- byte wavFlags;
- int size, rate;
- if (!loadWAVFromStream(*_file, size, rate, wavFlags)) {
- error("playSound: Not a valid WAV file");
- }
-
- byte *buffer = (byte *)malloc(size);
- _file->read(buffer, size);
- _mixer->playRaw(handle, buffer, size, rate, flags | wavFlags);
-}
-
-void VocSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) {
- if (_offsets == NULL)
- return;
-
- _file->seek(_offsets[sound], SEEK_SET);
-
- int size, rate;
- byte *buffer = loadVOCFromStream(*_file, size, rate);
-
- _mixer->playRaw(handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE);
-}
-
-void RawSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) {
- if (_offsets == NULL)
- return;
-
- _file->seek(_offsets[sound], SEEK_SET);
-
- uint size = _file->readUint32BE();
- byte *buffer = (byte *)malloc(size);
- _file->read(buffer, size);
-
- _mixer->playRaw(handle, buffer, size, 22050, flags | Audio::Mixer::FLAG_AUTOFREE);
-}
-
-#ifdef USE_MAD
-class MP3Sound : public BaseSound {
-public:
- MP3Sound(Audio::Mixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {};
- void playSound(uint sound, Audio::SoundHandle *handle, byte flags);
-};
-
-void MP3Sound::playSound(uint sound, Audio::SoundHandle *handle, byte flags)
-{
- if (_offsets == NULL)
- return;
-
- _file->seek(_offsets[sound], SEEK_SET);
-
- int i = 1;
- while (_offsets[sound + i] == _offsets[sound])
- i++;
-
- uint32 size = _offsets[sound + i] - _offsets[sound];
-
- _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, makeMP3Stream(_file, size));
-}
-#endif
-
-#ifdef USE_VORBIS
-class VorbisSound : public BaseSound {
-public:
- VorbisSound(Audio::Mixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {};
- void playSound(uint sound, Audio::SoundHandle *handle, byte flags);
-};
-
-void VorbisSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags)
-{
- if (_offsets == NULL)
- return;
-
- _file->seek(_offsets[sound], SEEK_SET);
-
- int i = 1;
- while (_offsets[sound + i] == _offsets[sound])
- i++;
-
- uint32 size = _offsets[sound + i] - _offsets[sound];
-
- _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, makeVorbisStream(_file, size));
-}
-#endif
-
-#ifdef USE_FLAC
-class FlacSound : public BaseSound {
-public:
- FlacSound(Audio::Mixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {};
- void playSound(uint sound, Audio::SoundHandle *handle, byte flags);
-};
-
-void FlacSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags)
-{
- if (_offsets == NULL)
- return;
-
- _file->seek(_offsets[sound], SEEK_SET);
-
- int i = 1;
- while (_offsets[sound + i] == _offsets[sound])
- i++;
-
- uint32 size = _offsets[sound + i] - _offsets[sound];
-
- _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, makeFlacStream(_file, size));
-}
-#endif
-
-Sound::Sound(SimonEngine *vm, const GameSpecificSettings *gss, Audio::Mixer *mixer)
- : _vm(vm), _mixer(mixer) {
- _voice = 0;
- _effects = 0;
-
- _effectsPaused = false;
- _ambientPaused = false;
-
- _filenums = 0;
- _lastVoiceFile = 0;
- _offsets = 0;
-
- _hasEffectsFile = false;
- _hasVoiceFile = false;
- _ambientPlaying = 0;
-
- // SIMON1CD32 uses separate speech files
- if (!(_vm->getFeatures() & GF_TALKIE) || (_vm->getGameId() == GID_SIMON1CD32))
- return;
-
- File *file = new File();
-
-#ifdef USE_FLAC
- if (!_hasVoiceFile && gss->flac_filename && gss->flac_filename[0]) {
- file->open(gss->flac_filename);
- if (file->isOpen()) {
- _hasVoiceFile = true;
- _voice = new FlacSound(_mixer, file);
- }
- }
-#endif
-#ifdef USE_MAD
- if (!_hasVoiceFile && gss->mp3_filename && gss->mp3_filename[0]) {
- file->open(gss->mp3_filename);
- if (file->isOpen()) {
- _hasVoiceFile = true;
- _voice = new MP3Sound(_mixer, file);
- }
- }
-#endif
-#ifdef USE_VORBIS
- if (!_hasVoiceFile && gss->vorbis_filename && gss->vorbis_filename[0]) {
- file->open(gss->vorbis_filename);
- if (file->isOpen()) {
- _hasVoiceFile = true;
- _voice = new VorbisSound(_mixer, file);
- }
- }
-#endif
- if (!_hasVoiceFile && _vm->getGameType() == GType_SIMON2) {
- // for simon2 mac/amiga, only read index file
- file->open("voices.idx");
- if (file->isOpen() == true) {
- file->seek(0, SEEK_END);
- int end = file->pos();
- file->seek(0, SEEK_SET);
- _filenums = (uint16 *)malloc((end / 6 + 1) * 2);
- _offsets = (uint32 *)malloc((end / 6 + 1) * 4);
-
- for (int i = 1; i <= end / 6; i++) {
- _filenums[i] = file->readUint16BE();
- _offsets[i] = file->readUint32BE();
- }
- _hasVoiceFile = true;
- }
- }
- if (!_hasVoiceFile && gss->wav_filename && gss->wav_filename[0]) {
- file->open(gss->wav_filename);
- if (file->isOpen()) {
- _hasVoiceFile = true;
- _voice = new WavSound(_mixer, file);
- }
- }
- if (!_hasVoiceFile && gss->voc_filename && gss->voc_filename[0]) {
- file->open(gss->voc_filename);
- if (file->isOpen()) {
- _hasVoiceFile = true;
- _voice = new VocSound(_mixer, file);
- }
- }
-
- if ((_vm->getGameType() == GType_SIMON1) && (_vm->getFeatures() & GF_TALKIE)) {
- file = new File();
-#ifdef USE_MAD
- if (!_hasEffectsFile && gss->mp3_effects_filename && gss->mp3_effects_filename[0]) {
- file->open(gss->mp3_effects_filename);
- if (file->isOpen()) {
- _hasEffectsFile = true;
- _effects = new MP3Sound(_mixer, file);
- }
- }
-#endif
-#ifdef USE_VORBIS
- if (!_hasEffectsFile && gss->vorbis_effects_filename && gss->vorbis_effects_filename[0]) {
- file->open(gss->vorbis_effects_filename);
- if (file->isOpen()) {
- _hasEffectsFile = true;
- _effects = new VorbisSound(_mixer, file);
- }
- }
-#endif
-#ifdef USE_FLAC
- if (!_hasEffectsFile && gss->flac_effects_filename && gss->flac_effects_filename[0]) {
- file->open(gss->flac_effects_filename);
- if (file->isOpen()) {
- _hasEffectsFile = true;
- _effects = new FlacSound(_mixer, file);
- }
- }
-#endif
- if (!_hasEffectsFile && gss->voc_effects_filename && gss->voc_effects_filename[0]) {
- file->open(gss->voc_effects_filename);
- if (file->isOpen()) {
- _hasEffectsFile = true;
- _effects = new VocSound(_mixer, file);
- }
- }
- }
-}
-
-Sound::~Sound() {
- delete _voice;
- delete _effects;
-
- free(_filenums);
- free(_offsets);
-}
-
-void Sound::readSfxFile(const char *filename) {
- if (_hasEffectsFile)
- return;
-
- stopAll();
-
- File *file = new File();
- file->open(filename);
-
- if (file->isOpen() == false) {
- char *filename2;
- filename2 = (char *)malloc(strlen(filename) + 2);
- strcpy(filename2, filename);
- strcat(filename2, ".");
- file->open(filename2);
- free(filename2);
- if (file->isOpen() == false) {
- if (atoi(filename + 6) != 1 && atoi(filename + 6) != 30)
- warning("readSfxFile: Can't load sfx file %s", filename);
- return;
- }
- }
-
- delete _effects;
- if (_vm->getGameId() == GID_SIMON1CD32) {
- _effects = new VocSound(_mixer, file, 0, SOUND_BIG_ENDIAN);
- } else
- _effects = new WavSound(_mixer, file);
-}
-
-void Sound::loadSfxTable(File *gameFile, uint32 base) {
- stopAll();
-
- if (_vm->getPlatform() == Common::kPlatformWindows)
- _effects = new WavSound(_mixer, gameFile, base);
- else
- _effects = new VocSound(_mixer, gameFile, base);
-}
-
-void Sound::readVoiceFile(const char *filename) {
- stopAll();
-
- File *file = new File();
- file->open(filename);
-
- if (file->isOpen() == false) {
- char *filename2;
- filename2 = (char *)malloc(strlen(filename) + 2);
- strcpy(filename2, filename);
- strcat(filename2, ".");
- file->open(filename2);
- free(filename2);
- if (file->isOpen() == false) {
- warning("readVoiceFile: Can't load voice file %s", filename);
- return;
- }
- }
-
- delete _voice;
- _voice = new RawSound(_mixer, file, 0, SOUND_BIG_ENDIAN);
-}
-
-void Sound::playVoice(uint sound) {
- if (_filenums) {
- if (_lastVoiceFile != _filenums[sound]) {
- stopAll();
-
- char filename[16];
- _lastVoiceFile = _filenums[sound];
- sprintf(filename, "voices%d.dat", _filenums[sound]);
- File *file = new File();
- file->open(filename);
- if (file->isOpen() == false) {
- warning("playVoice: Can't load voice file %s", filename);
- return;
- }
- delete _voice;
- _voice = new WavSound(_mixer, file, _offsets);
- }
- }
-
- if (!_voice)
- return;
-
- _mixer->stopHandle(_voiceHandle);
- if (_vm->getGameType() == GType_FF || _vm->getGameId() == GID_SIMON1CD32) {
- _voice->playSound(sound, &_voiceHandle, 0);
- } else {
- _voice->playSound(sound, &_voiceHandle, Audio::Mixer::FLAG_UNSIGNED);
- }
-}
-
-void Sound::playSoundData(byte *soundData, uint sound, uint pan, uint vol, bool ambient) {
- byte flags;
- int rate;
-
- if (ambient == true) {
- if (sound == _ambientPlaying)
- return;
-
- _ambientPlaying = sound;
-
- if (_ambientPaused)
- return;
- } else {
- if (_effectsPaused)
- return;
- }
-
- soundData += READ_LE_UINT32(soundData + sound * 4);
- int size = READ_LE_UINT32(soundData + 4);
- Common::MemoryReadStream stream(soundData, size);
- if (!loadWAVFromStream(stream, size, rate, flags)) {
- error("playSoundData: Not a valid WAV data");
- }
-
- byte *buffer = (byte *)malloc(size);
- memcpy(buffer, soundData + stream.pos(), size);
-
- if (ambient == true) {
- _mixer->stopHandle(_ambientHandle);
- _mixer->playRaw(&_ambientHandle, buffer, size, rate, Audio::Mixer::FLAG_LOOP|flags);
- } else {
- _mixer->playRaw(&_effectsHandle, buffer, size, rate, flags);
- }
-}
-
-void Sound::playEffects(uint sound) {
- if (!_effects)
- return;
-
- if (_effectsPaused)
- return;
-
- _effects->playSound(sound, &_effectsHandle, (_vm->getGameId() == GID_SIMON1CD32) ? 0 : Audio::Mixer::FLAG_UNSIGNED);
-}
-
-void Sound::playAmbient(uint sound) {
- if (!_effects)
- return;
-
- if (sound == _ambientPlaying)
- return;
-
- _ambientPlaying = sound;
-
- if (_ambientPaused)
- return;
-
- _mixer->stopHandle(_ambientHandle);
- _effects->playSound(sound, &_ambientHandle, Audio::Mixer::FLAG_LOOP|Audio::Mixer::FLAG_UNSIGNED);
-}
-
-bool Sound::hasVoice() const {
- return _hasVoiceFile;
-}
-
-bool Sound::isVoiceActive() const {
- return _mixer->isSoundHandleActive(_voiceHandle) ;
-}
-
-void Sound::stopVoice() {
- _mixer->stopHandle(_voiceHandle);
-}
-
-void Sound::stopAll() {
- _mixer->stopAll();
- _ambientPlaying = 0;
-}
-
-void Sound::effectsPause(bool b) {
- _effectsPaused = b;
-}
-
-void Sound::ambientPause(bool b) {
- _ambientPaused = b;
-
- if (_ambientPaused && _ambientPlaying) {
- _mixer->stopHandle(_ambientHandle);
- } else if (_ambientPlaying) {
- uint tmp = _ambientPlaying;
- _ambientPlaying = 0;
- playAmbient(tmp);
- }
-}
-
-} // End of namespace Simon
diff --git a/simon/sound.h b/simon/sound.h
deleted file mode 100644
index 245c6ffb0c..0000000000
--- a/simon/sound.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef SIMON_SOUND_H
-#define SIMON_SOUND_H
-
-#include "sound/mixer.h"
-#include "simon/intern.h"
-#include "common/str.h"
-
-namespace Simon {
-
-class BaseSound;
-
-class SimonEngine;
-
-class Sound {
-private:
- SimonEngine *_vm;
-
- Audio::Mixer *_mixer;
-
- BaseSound *_voice;
- BaseSound *_effects;
-
- bool _effectsPaused;
- bool _ambientPaused;
-
- uint16 *_filenums;
- uint32 *_offsets;
- uint16 _lastVoiceFile;
-
- Audio::SoundHandle _voiceHandle;
- Audio::SoundHandle _effectsHandle;
- Audio::SoundHandle _ambientHandle;
-
- bool _hasEffectsFile;
- bool _hasVoiceFile;
- uint _ambientPlaying;
-
-public:
- Sound(SimonEngine *vm, const GameSpecificSettings *gss, Audio::Mixer *mixer);
- ~Sound();
-
- void readSfxFile(const char *filename);
- void loadSfxTable(Common::File *gameFile, uint32 base);
- void readVoiceFile(const char *filename);
-
- void playVoice(uint sound);
- void playEffects(uint sound);
- void playAmbient(uint sound);
- void playSoundData(byte *soundData, uint sound, uint pan, uint vol, bool ambient);
-
- bool hasVoice() const;
- bool isVoiceActive() const;
- void stopVoice();
- void stopAll();
- void effectsPause(bool b);
- void ambientPause(bool b);
-};
-
-} // End of namespace Simon
-
-#endif
diff --git a/simon/verb.cpp b/simon/verb.cpp
deleted file mode 100644
index 65f105f1f9..0000000000
--- a/simon/verb.cpp
+++ /dev/null
@@ -1,608 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-// Verb and hitarea handling
-#include "common/stdafx.h"
-#include "simon/simon.h"
-#include "simon/intern.h"
-
-namespace Simon {
-
-static const char *const russian_verb_names[] = {
- "Ietj _",
- "Qnotrft< pa",
- "Nt_r[t<",
- "Ecjdat<",
-
- "Q=fst<",
- "C^]t<",
- "Ha_r[t<",
- "Isqom<^ocat<",
-
- "Docorjt<",
- "Qp]t<",
- "Neft<",
- "Eat<"
-};
-
-static const char *const hebrew_verb_names[] = {
- "LJ @L",
- "DQZKL RL",
- "TZG",
- "DFF",
-
- "@KEL",
- "DXM",
- "QBEX",
- "DYZNY",
-
- "CAX @L",
- "DQX",
- "LAY",
- "ZO"
-};
-
-static const char *const spanish_verb_names[] = {
- "Caminar",
- "Mirar",
- "Abrir",
- "Mover",
-
- "Consumir",
- "Coger",
- "Cerrar",
- "Usar",
-
- "Hablar",
- "Quitar",
- "Llevar",
- "Dar"
-};
-
-static const char *const italian_verb_names[] = {
- "Vai verso",
- "Osserva",
- "Apri",
- "Sposta",
-
- "Mangia",
- "Raccogli",
- "Chiudi",
- "Usa",
-
- "Parla a",
- "Togli",
- "Indossa",
- "Dai"
-};
-
-static const char *const french_verb_names[] = {
- "Aller vers",
- "Regarder",
- "Ouvrir",
- "D/placer",
-
- "Consommer",
- "Prendre",
- "Fermer",
- "Utiliser",
-
- "Parler ;",
- "Enlever",
- "Mettre",
- "Donner"
-};
-
-static const char *const german_verb_names[] = {
- "Gehe zu",
- "Schau an",
- ";ffne",
- "Bewege",
-
- "Verzehre",
- "Nimm",
- "Schlie+e",
- "Benutze",
-
- "Rede mit",
- "Entferne",
- "Trage",
- "Gib"
-};
-
-static const char *const english_verb_names[] = {
- "Walk to",
- "Look at",
- "Open",
- "Move",
-
- "Consume",
- "Pick up",
- "Close",
- "Use",
-
- "Talk to",
- "Remove",
- "Wear",
- "Give"
-};
-
-static const char *const russian_verb_prep_names[] = {
- "", "", "", "",
- "", "", "", "s yfn?",
- "", "", "", "_onu ?"
-};
-
-static const char *const hebrew_verb_prep_names[] = {
- "", "", "", "",
- "", "", "", "RM ND ?",
- "", "", "", "LNI ?"
-};
-
-static const char *const spanish_verb_prep_names[] = {
- "", "", "", "",
- "", "", "", "^con qu/?",
- "", "", "", "^a qui/n?"
-};
-
-static const char *const italian_verb_prep_names[] = {
- "", "", "", "",
- "", "", "", "con cosa ?",
- "", "", "", "a chi ?"
-};
-
-static const char *const french_verb_prep_names[] = {
- "", "", "", "",
- "", "", "", "avec quoi ?",
- "", "", "", "; qui ?"
-};
-
-static const char *const german_verb_prep_names[] = {
- "", "", "", "",
- "", "", "", "mit was ?",
- "", "", "", "zu wem ?"
-};
-
-static const char *const english_verb_prep_names[] = {
- "", "", "", "",
- "", "", "", "with what ?",
- "", "", "", "to whom ?"
-};
-
-void SimonEngine::defocusHitarea() {
- HitArea *last;
- HitArea *ha;
-
- if (getGameType() == GType_SIMON2) {
- if (_bitArray[4] & 0x8000) {
- o_sync(202);
- _lastHitArea2Ptr = NULL;
- return;
- }
- }
-
- last = _hitAreaPtr5;
-
- if (last == _hitAreaPtr7)
- return;
-
- hitareaChangedHelper();
- _hitAreaPtr7 = last;
-
- if (last != NULL && (ha = findHitAreaByID(200)) && (ha->flags & 0x40) && !(last->flags & 0x40))
- focusVerb(last->id);
-}
-
-void SimonEngine::focusVerb(uint hitarea_id) {
- uint x;
- const char *txt;
- const char * const *verb_names;
- const char * const *verb_prep_names;
-
- hitarea_id -= 101;
-
- if (_showPreposition) {
- switch (_language) {
- case Common::RU_RUS:
- verb_prep_names = russian_verb_prep_names;
- break;
- case Common::HB_ISR:
- verb_prep_names = hebrew_verb_prep_names;
- break;
- case Common::ES_ESP:
- verb_prep_names = spanish_verb_prep_names;
- break;
- case Common::IT_ITA:
- verb_prep_names = italian_verb_prep_names;
- break;
- case Common::FR_FRA:
- verb_prep_names = french_verb_prep_names;
- break;
- case Common::DE_DEU:
- verb_prep_names = german_verb_prep_names;
- break;
- default:
- verb_prep_names = english_verb_prep_names;
- break;
- }
- CHECK_BOUNDS(hitarea_id, english_verb_prep_names);
- txt = verb_prep_names[hitarea_id];
- } else {
- switch (_language) {
- case Common::RU_RUS:
- verb_names = russian_verb_names;
- break;
- case Common::HB_ISR:
- verb_names = hebrew_verb_names;
- break;
- case Common::ES_ESP:
- verb_names = spanish_verb_names;
- break;
- case Common::IT_ITA:
- verb_names = italian_verb_names;
- break;
- case Common::FR_FRA:
- verb_names = french_verb_names;
- break;
- case Common::DE_DEU:
- verb_names = german_verb_names;
- break;
- default:
- verb_names = english_verb_names;
- break;
- }
- CHECK_BOUNDS(hitarea_id, english_verb_names);
- txt = verb_names[hitarea_id];
- }
- x = (53 - strlen(txt)) * 3;
- showActionString(x, (const byte *)txt);
-}
-
-void SimonEngine::showActionString(uint x, const byte *string) {
- FillOrCopyStruct *fcs;
-
- fcs = _windowArray[1];
- if (fcs == NULL || fcs->text_color == 0)
- return;
-
- fcs->textColumn = x >> 3;
- fcs->textColumnOffset = x & 7;
-
- for (; *string; string++)
- video_putchar(fcs, *string);
-}
-
-void SimonEngine::hitareaChangedHelper() {
- FillOrCopyStruct *fcs;
-
- if (getGameType() == GType_SIMON2) {
- if (_bitArray[4] & 0x8000)
- return;
- }
-
- fcs = _windowArray[1];
- if (fcs != NULL && fcs->text_color != 0)
- video_fill_or_copy_from_3_to_2(fcs);
-
- _lastHitArea2Ptr = NULL;
- _hitAreaPtr7 = NULL;
-}
-
-HitArea *SimonEngine::findHitAreaByID(uint hitarea_id) {
- HitArea *ha = _hitAreas;
- uint count = ARRAYSIZE(_hitAreas);
-
- do {
- if (ha->id == hitarea_id)
- return ha;
- } while (ha++, --count);
- return NULL;
-}
-
-HitArea *SimonEngine::findEmptyHitArea() {
- HitArea *ha = _hitAreas;
- uint count = ARRAYSIZE(_hitAreas);
-
- do {
- if (ha->flags == 0)
- return ha;
- } while (ha++, --count);
- return NULL;
-}
-
-void SimonEngine::clear_hitarea_bit_0x40(uint hitarea) {
- HitArea *ha = findHitAreaByID(hitarea);
- if (ha != NULL)
- ha->flags &= ~0x40;
-}
-
-void SimonEngine::set_hitarea_bit_0x40(uint hitarea) {
- HitArea *ha = findHitAreaByID(hitarea);
- if (ha != NULL) {
- ha->flags |= 0x40;
- ha->flags &= ~2;
- if (hitarea == 102)
- hitarea_proc_1();
- }
-}
-
-void SimonEngine::set_hitarea_x_y(uint hitarea, int x, int y) {
- HitArea *ha = findHitAreaByID(hitarea);
- if (ha != NULL) {
- ha->x = x;
- ha->y = y;
- }
-}
-
-void SimonEngine::delete_hitarea(uint hitarea) {
- HitArea *ha = findHitAreaByID(hitarea);
- if (ha != NULL) {
- ha->flags = 0;
- if (ha == _lastHitArea2Ptr)
- defocusHitarea();
- _needHitAreaRecalc++;
- }
-}
-
-bool SimonEngine::is_hitarea_0x40_clear(uint hitarea) {
- HitArea *ha = findHitAreaByID(hitarea);
- if (ha == NULL)
- return false;
- return (ha->flags & 0x40) == 0;
-}
-
-void SimonEngine::addNewHitArea(int id, int x, int y, int width, int height, int flags, int unk3, Item *item_ptr) {
- HitArea *ha;
- delete_hitarea(id);
-
- ha = findEmptyHitArea();
- ha->x = x;
- ha->y = y;
- ha->width = width;
- ha->height = height;
- ha->flags = flags | 0x20;
- ha->id = ha->layer = id;
- ha->unk3 = unk3;
- ha->item_ptr = item_ptr;
-
- _needHitAreaRecalc++;
-}
-
-void SimonEngine::hitarea_proc_1() {
- uint id;
- HitArea *ha;
-
- if (getGameType() == GType_SIMON2) {
- id = 2;
- if (!(_bitArray[4] & 0x8000))
- id = (_mouseY >= 136) ? 102 : 101;
- } else {
- id = (_mouseY >= 136) ? 102 : 101;
- }
-
- _hitAreaUnk4 = id;
-
- ha = findHitAreaByID(id);
- if (ha == NULL)
- return;
-
- if (ha->flags & 0x40) {
- _hitAreaUnk4 = 999;
- _hitAreaPtr5 = NULL;
- } else {
- _verbHitArea = ha->unk3;
- handle_verb_hitarea(ha);
- }
-}
-
-void SimonEngine::handle_verb_hitarea(HitArea *ha) {
- HitArea *tmp = _hitAreaPtr5;
-
- if (ha == tmp)
- return;
-
- if (!(getGameType() == GType_SIMON2)) {
- if (tmp != NULL) {
- tmp->flags |= 8;
- video_toggle_colors(tmp, 0xd5, 0xd0, 0xd5, 0xA);
- }
-
- if (ha->flags & 2)
- video_toggle_colors(ha, 0xda, 0xd5, 0xd5, 5);
- else
- video_toggle_colors(ha, 0xdf, 0xda, 0xda, 0xA);
-
- ha->flags &= ~(2 + 8);
-
- } else {
- if (ha->id < 101)
- return;
- _mouseCursor = ha->id - 101;
- _needHitAreaRecalc++;
- }
- _hitAreaPtr5 = ha;
-}
-
-void SimonEngine::hitarea_leave(HitArea *ha) {
- if (!(getGameType() == GType_SIMON2)) {
- video_toggle_colors(ha, 0xdf, 0xd5, 0xda, 5);
- } else {
- video_toggle_colors(ha, 0xe7, 0xe5, 0xe6, 1);
- }
-}
-
-void SimonEngine::leaveHitAreaById(uint hitarea_id) {
- HitArea *ha = findHitAreaByID(hitarea_id);
- if (ha)
- hitarea_leave(ha);
-}
-
-void SimonEngine::handle_uparrow_hitarea(FillOrCopyStruct *fcs) {
- uint index;
-
- index = get_fcs_ptr_3_index(fcs);
-
- if (fcs->fcs_data->unk1 == 0)
- return;
-
- mouseOff();
- drawIconArray(index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1 - 1, fcs->fcs_data->unk2);
- mouseOn();
-}
-
-void SimonEngine::handle_downarrow_hitarea(FillOrCopyStruct *fcs) {
- uint index;
-
- index = get_fcs_ptr_3_index(fcs);
-
- mouseOff();
- drawIconArray(index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1 + 1, fcs->fcs_data->unk2);
- mouseOn();
-}
-
-void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) {
- HitArea *best_ha;
- HitArea *ha = _hitAreas;
- uint count = ARRAYSIZE(_hitAreas);
- uint16 layer = 0;
- uint16 x_ = x;
- const uint16 y_ = y;
-
- if (getGameType() == GType_SIMON2) {
- if (_bitArray[4] & 0x8000 || y < 134) {
- x_ += _scrollX * 8;
- }
- }
-
- best_ha = NULL;
-
- do {
- if (ha->flags & 0x20) {
- if (!(ha->flags & 0x40)) {
- if (x_ >= ha->x && y_ >= ha->y &&
- x_ - ha->x < ha->width && y_ - ha->y < ha->height && layer <= ha->layer) {
- layer = ha->layer;
- best_ha = ha;
- } else {
- if (ha->flags & 2) {
- hitarea_leave(ha);
- ha->flags &= ~2;
- }
- }
- } else {
- ha->flags &= ~2;
- }
- }
- } while (ha++, --count);
-
- if (best_ha == NULL) {
- defocusHitarea();
- return;
- }
-
- if (mode != 0 && mode != 3) {
- _lastHitArea = best_ha;
- _variableArray[1] = x;
- _variableArray[2] = y;
- }
-
- if (best_ha->flags & 4) {
- defocusHitarea();
- } else if (best_ha != _lastHitArea2Ptr) {
- new_current_hitarea(best_ha);
- }
-
- if (best_ha->flags & 8 && !(best_ha->flags & 2)) {
- hitarea_leave(best_ha);
- best_ha->flags |= 2;
- }
-
- return;
-}
-
-void SimonEngine::new_current_hitarea(HitArea *ha) {
- bool result;
-
- hitareaChangedHelper();
- if (ha->flags & 1) {
- result = hitarea_proc_2(ha->flags >> 8);
- } else {
- result = hitarea_proc_3(ha->item_ptr);
- }
-
- if (result)
- _lastHitArea2Ptr = ha;
-}
-
-bool SimonEngine::hitarea_proc_2(uint a) {
- uint x;
- const byte *string_ptr;
-
- if (getGameType() == GType_SIMON2) {
- if (_bitArray[4] & 0x8000) {
- Subroutine *sub;
- _variableArray[84] = a;
- sub = getSubroutineByID(5003);
- if (sub != NULL)
- startSubroutineEx(sub);
- return true;
- }
- }
-
- if (a >= 20)
- return false;
-
- string_ptr = getStringPtrByID(_stringIdArray2[a]);
- // Arisme : hack for long strings in the French version
- if ((strlen((const char*)string_ptr) - 1) <= 53)
- x = (53 - (strlen((const char *)string_ptr) - 1)) * 3;
- else
- x = 0;
- showActionString(x, string_ptr);
-
- return true;
-}
-
-bool SimonEngine::hitarea_proc_3(Item *item) {
- Child2 *child2;
- uint x;
- const byte *string_ptr;
-
- if (item == 0 || item == _dummyItem2 || item == _dummyItem3)
- return false;
-
- child2 = (Child2 *)findChildOfType(item, 2);
- if (child2 == NULL)
- return false;
-
- string_ptr = getStringPtrByID(child2->string_id);
- // Arisme : hack for long strings in the French version
- if ((strlen((const char*)string_ptr) - 1) <= 53)
- x = (53 - (strlen((const char *)string_ptr) - 1)) * 3;
- else
- x = 0;
- showActionString(x, string_ptr);
-
- return true;
-}
-
-} // End of namespace Simon
diff --git a/simon/vga.cpp b/simon/vga.cpp
deleted file mode 100644
index d7d0731539..0000000000
--- a/simon/vga.cpp
+++ /dev/null
@@ -1,2299 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-// Video script opcodes for Simon1/Simon2
-#include "common/stdafx.h"
-#include "simon/simon.h"
-#include "simon/intern.h"
-#include "simon/vga.h"
-
-#include "common/system.h"
-
-namespace Simon {
-
-// Opcode tables
-void SimonEngine::setupVgaOpcodes() {
- static const VgaOpcodeProc vga_opcode_table[] = {
- NULL,
- &SimonEngine::vc1_fadeOut,
- &SimonEngine::vc2_call,
- &SimonEngine::vc3_loadSprite,
- &SimonEngine::vc4_fadeIn,
- &SimonEngine::vc5_skip_if_neq,
- &SimonEngine::vc6_skip_ifn_sib_with_a,
- &SimonEngine::vc7_skip_if_sib_with_a,
- &SimonEngine::vc8_skip_if_parent_is,
- &SimonEngine::vc9_skip_if_unk3_is,
- &SimonEngine::vc10_draw,
- &SimonEngine::vc11_clearPathFinder,
- &SimonEngine::vc12_delay,
- &SimonEngine::vc13_addToSpriteX,
- &SimonEngine::vc14_addToSpriteY,
- &SimonEngine::vc15_wakeup_id,
- &SimonEngine::vc16_sleep_on_id,
- &SimonEngine::vc17_setPathfinderItem,
- &SimonEngine::vc18_jump,
- &SimonEngine::vc19_chain_to_script,
- &SimonEngine::vc20_setRepeat,
- &SimonEngine::vc21_endRepeat,
- &SimonEngine::vc22_setSpritePalette,
- &SimonEngine::vc23_setSpritePriority,
- &SimonEngine::vc24_setSpriteXY,
- &SimonEngine::vc25_halt_sprite,
- &SimonEngine::vc26_setSubWindow,
- &SimonEngine::vc27_resetSprite,
- &SimonEngine::vc28_dummy_op,
- &SimonEngine::vc29_stopAllSounds,
- &SimonEngine::vc30_setFrameRate,
- &SimonEngine::vc31_setWindow,
- &SimonEngine::vc32_copyVar,
- &SimonEngine::vc33_setMouseOn,
- &SimonEngine::vc34_setMouseOff,
- &SimonEngine::vc35_clearWindow,
- &SimonEngine::vc36_setWindowImage,
- &SimonEngine::vc37_addToSpriteY,
- &SimonEngine::vc38_skipIfVarZero,
- &SimonEngine::vc39_setVar,
- &SimonEngine::vc40,
- &SimonEngine::vc41,
- &SimonEngine::vc42_delayIfNotEQ,
- &SimonEngine::vc43_skipIfBitClear,
- &SimonEngine::vc44_skipIfBitSet,
- &SimonEngine::vc45_setSpriteX,
- &SimonEngine::vc46_setSpriteY,
- &SimonEngine::vc47_addToVar,
- &SimonEngine::vc48_setPathFinder,
- &SimonEngine::vc49_setBit,
- &SimonEngine::vc50_clearBit,
- &SimonEngine::vc51_clear_hitarea_bit_0x40,
- &SimonEngine::vc52_playSound,
- &SimonEngine::vc53_no_op,
- &SimonEngine::vc54_no_op,
- &SimonEngine::vc55_offset_hit_area,
- &SimonEngine::vc56_delay,
- &SimonEngine::vc57_no_op,
- &SimonEngine::vc58,
- &SimonEngine::vc59,
- &SimonEngine::vc60_killSprite,
- &SimonEngine::vc61_setMaskImage,
- &SimonEngine::vc62_fastFadeOut,
- &SimonEngine::vc63_fastFadeIn,
- &SimonEngine::vc64_skipIfSpeechEnded,
- &SimonEngine::vc65_slowFadeIn,
- &SimonEngine::vc66_skipIfNotEqual,
- &SimonEngine::vc67_skipIfGE,
- &SimonEngine::vc68_skipIfLE,
- &SimonEngine::vc69_playTrack,
- &SimonEngine::vc70_queueMusic,
- &SimonEngine::vc71_checkMusicQueue,
- &SimonEngine::vc72_play_track_2,
- &SimonEngine::vc73_setMark,
- &SimonEngine::vc74_clearMark,
- &SimonEngine::vc75_setScale,
- &SimonEngine::vc76_setScaleXOffs,
- &SimonEngine::vc77_setScaleYOffs,
- &SimonEngine::vc78_computeXY,
- &SimonEngine::vc79_computePosNum,
- &SimonEngine::vc80_setOverlayImage,
- &SimonEngine::vc81_setRandom,
- &SimonEngine::vc82_getPathValue,
- &SimonEngine::vc83_playSoundLoop,
- &SimonEngine::vc84_stopSoundLoop,
- };
-
- _vga_opcode_table = vga_opcode_table;
-}
-
-// Script parser
-void SimonEngine::run_vga_script() {
- for (;;) {
- uint opcode;
-
- if (_continousVgaScript) {
- if (_vcPtr != (const byte *)&_vc_get_out_of_code) {
- fprintf(_dumpFile, "%.5d %.5X: %5d %4d ", _vgaTickCounter, _vcPtr - _curVgaFile1, _vgaCurSpriteId, _vgaCurFileId);
- dump_video_script(_vcPtr, true);
- }
- }
-
- if (getGameType() == GType_SIMON1) {
- opcode = READ_BE_UINT16(_vcPtr);
- _vcPtr += 2;
- } else {
- opcode = *_vcPtr++;
- }
-
- if (opcode >= NUM_VIDEO_OP_CODES)
- error("Invalid VGA opcode '%d' encountered", opcode);
-
- if (opcode == 0)
- return;
-
- (this->*_vga_opcode_table[opcode]) ();
- }
-}
-
-int SimonEngine::vcReadVarOrWord() {
- int16 var = vcReadNextWord();
- if (var < 0)
- var = vcReadVar(-var);
- return var;
-}
-
-uint SimonEngine::vcReadNextWord() {
- uint a;
- a = readUint16Wrapper(_vcPtr);
- _vcPtr += 2;
- return a;
-}
-
-uint SimonEngine::vcReadNextByte() {
- return *_vcPtr++;
-}
-
-void SimonEngine::vcSkipNextInstruction() {
- static const byte opcodeParamLenSimon1[] = {
- 0, 6, 2, 10, 6, 4, 2, 2,
- 4, 4, 10, 0, 2, 2, 2, 2,
- 2, 0, 2, 0, 4, 2, 4, 2,
- 8, 0, 10, 0, 8, 0, 2, 2,
- 4, 0, 0, 4, 4, 2, 2, 4,
- 4, 4, 4, 2, 2, 2, 2, 4,
- 0, 2, 2, 2, 2, 4, 6, 6,
- 0, 0, 0, 0, 2, 6, 0, 0,
- };
-
- static const byte opcodeParamLenSimon2[] = {
- 0, 6, 2, 12, 6, 4, 2, 2,
- 4, 4, 9, 0, 1, 2, 2, 2,
- 2, 0, 2, 0, 4, 2, 4, 2,
- 7, 0, 10, 0, 8, 0, 2, 2,
- 4, 0, 0, 4, 4, 2, 2, 4,
- 4, 4, 4, 2, 2, 2, 2, 4,
- 0, 2, 2, 2, 2, 4, 6, 6,
- 2, 0, 6, 6, 4, 6, 0, 0,
- 0, 0, 4, 4, 4, 4, 4, 0,
- 4, 2, 2
- };
-
- static const byte opcodeParamLenFeebleFiles[] = {
- 0, 6, 2, 12, 6, 4, 2, 2,
- 4, 4, 9, 0, 1, 2, 2, 2,
- 2, 0, 2, 0, 4, 2, 4, 2,
- 7, 0, 10, 0, 8, 0, 2, 2,
- 4, 0, 0, 4, 4, 2, 2, 4,
- 4, 4, 4, 2, 2, 2, 2, 4,
- 0, 2, 2, 2, 6, 6, 6, 6,
- 2, 0, 6, 6, 4, 6, 0, 0,
- 0, 0, 4, 4, 4, 4, 4, 0,
- 4, 2, 2, 4, 6, 6, 0, 0,
- 6, 4, 2, 6, 0
- };
-
- if (getGameType() == GType_FF) {
- uint opcode = vcReadNextByte();
- _vcPtr += opcodeParamLenFeebleFiles[opcode];
- } else if (getGameType() == GType_SIMON2) {
- uint opcode = vcReadNextByte();
- _vcPtr += opcodeParamLenSimon2[opcode];
- } else {
- uint opcode = vcReadNextWord();
- _vcPtr += opcodeParamLenSimon1[opcode];
- }
-
- if (_continousVgaScript)
- fprintf(_dumpFile, "; skipped\n");
-}
-
-void SimonEngine::o_unloadBeard() {
- // Simon1 Only
- if (_beardLoaded == true) {
- _beardLoaded = false;
- _lockWord |= 0x8000;
- read_vga_from_datfile_1(23);
- _lockWord &= ~0x8000;
- }
-}
-
-void SimonEngine::o_loadBeard() {
- // Simon1 Only
- if (_beardLoaded == false) {
- _beardLoaded = true;
- _lockWord |= 0x8000;
- read_vga_from_datfile_1(328);
- _lockWord &= ~0x8000;
- }
-}
-
-// VGA Script commands
-void SimonEngine::vc1_fadeOut() {
- /* dummy opcode */
- _vcPtr += 6;
-}
-
-void SimonEngine::vc2_call() {
- VgaPointersEntry *vpe;
- uint num;
- uint res;
- byte *old_file_1, *old_file_2;
- byte *b, *bb;
- const byte *vc_ptr_org;
-
- num = vcReadVarOrWord();
-
- old_file_1 = _curVgaFile1;
- old_file_2 = _curVgaFile2;
-
- for (;;) {
- res = num / 100;
- vpe = &_vgaBufferPointers[res];
-
- _curVgaFile1 = vpe->vgaFile1;
- _curVgaFile2 = vpe->vgaFile2;
- if (vpe->vgaFile1 != NULL)
- break;
- if (_vgaCurFile2 != res)
- _videoVar7 = _vgaCurFile2;
-
- loadZone(res);
- _videoVar7 = 0xFFFF;
- }
-
-
- bb = _curVgaFile1;
- if (getGameType() == GType_FF) {
- b = bb + READ_LE_UINT16(&((VgaFileHeader_Feeble *) bb)->hdr2_start);
- b = bb + READ_LE_UINT16(&((VgaFileHeader2_Feeble *) b)->imageTable);
-
- while (READ_LE_UINT16(&((ImageHeader_Feeble *) b)->id) != num)
- b += sizeof(ImageHeader_Feeble);
- } else {
- b = bb + READ_BE_UINT16(&((VgaFileHeader_Simon *) bb)->hdr2_start);
- b = bb + READ_BE_UINT16(&((VgaFileHeader2_Simon *) b)->imageTable);
-
- while (READ_BE_UINT16(&((ImageHeader_Simon *) b)->id) != num)
- b += sizeof(ImageHeader_Simon);
- }
-
- vc_ptr_org = _vcPtr;
-
- if (getGameType() == GType_FF) {
- _vcPtr = _curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble *) b)->scriptOffs);
- } else {
- _vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon *) b)->scriptOffs);
- }
-
- //dump_vga_script(_vcPtr, res, num);
- run_vga_script();
-
- _curVgaFile1 = old_file_1;
- _curVgaFile2 = old_file_2;
-
- _vcPtr = vc_ptr_org;
-}
-
-void SimonEngine::vc3_loadSprite() {
- uint16 windowNum, fileId, palette, x, y, vgaSpriteId;
- uint16 res;
- VgaSprite *vsp;
- VgaPointersEntry *vpe;
- byte *p, *pp;
- byte *old_file_1;
-
- windowNum = vcReadNextWord(); /* 0 */
-
- if (getGameType() == GType_SIMON1) {
- vgaSpriteId = vcReadNextWord(); /* 2 */
- fileId = vgaSpriteId / 100;
- } else {
- fileId = vcReadNextWord(); /* 0 */
- vgaSpriteId = vcReadNextWord(); /* 2 */
- }
-
- x = vcReadNextWord(); /* 4 */
- y = vcReadNextWord(); /* 6 */
- palette = vcReadNextWord(); /* 8 */
-
- /* 2nd param ignored with simon1 */
- if (isSpriteLoaded(vgaSpriteId, fileId))
- return;
-
- vsp = _vgaSprites;
- while (vsp->id)
- vsp++;
-
- vsp->palette = palette;
- vsp->windowNum = windowNum;
- vsp->priority = 0;
- vsp->flags = 0;
- vsp->image = 0;
- vsp->x = x;
- vsp->y = y;
- vsp->id = vgaSpriteId;
- vsp->fileId = res = fileId;
-
- old_file_1 = _curVgaFile1;
- for (;;) {
- vpe = &_vgaBufferPointers[res];
- _curVgaFile1 = vpe->vgaFile1;
-
- if (vpe->vgaFile1 != NULL)
- break;
- if (_vgaCurFile2 != res)
- _videoVar7 = _vgaCurFile2;
-
- loadZone(res);
- _videoVar7 = 0xFFFF;
- }
-
- pp = _curVgaFile1;
- if (getGameType() == GType_FF) {
- p = pp + READ_LE_UINT16(&((VgaFileHeader_Feeble *) pp)->hdr2_start);
- p = pp + READ_LE_UINT16(&((VgaFileHeader2_Feeble *) p)->animationTable);
-
- while (READ_LE_UINT16(&((AnimationHeader_Feeble *) p)->id) != vgaSpriteId)
- p += sizeof(AnimationHeader_Feeble);
- } else {
- p = pp + READ_BE_UINT16(&((VgaFileHeader_Simon *) pp)->hdr2_start);
- p = pp + READ_BE_UINT16(&((VgaFileHeader2_Simon *) p)->animationTable);
-
- while (READ_BE_UINT16(&((AnimationHeader_Simon *) p)->id) != vgaSpriteId)
- p += sizeof(AnimationHeader_Simon);
- }
-
-#ifdef DUMP_FILE_NR
- {
- static bool dumped = false;
- if (res == DUMP_FILE_NR && !dumped) {
- dumped = true;
- dump_vga_file(_curVgaFile1);
- }
- }
-#endif
-
-#ifdef DUMP_BITMAPS_FILE_NR
- {
- static bool dumped = false;
- if (res == DUMP_BITMAPS_FILE_NR && !dumped) {
- dumped = true;
- dump_vga_bitmaps(_curVgaFile2, _curVgaFile1, res);
- }
- }
-#endif
-
- if (_startVgaScript) {
- if (getGameType() == GType_FF) {
- dump_vga_script(_curVgaFile1 + READ_LE_UINT16(&((AnimationHeader_Feeble*)p)->scriptOffs), res, vgaSpriteId);
- } else {
- dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((AnimationHeader_Simon*)p)->scriptOffs), res, vgaSpriteId);
-
- }
- }
-
- if (getGameType() == GType_FF) {
- add_vga_timer(VGA_DELAY_BASE, _curVgaFile1 + READ_LE_UINT16(&((AnimationHeader_Feeble *) p)->scriptOffs), vgaSpriteId, res);
- } else {
- add_vga_timer(VGA_DELAY_BASE, _curVgaFile1 + READ_BE_UINT16(&((AnimationHeader_Simon *) p)->scriptOffs), vgaSpriteId, res);
- }
-
- _curVgaFile1 = old_file_1;
-}
-
-void SimonEngine::vc4_fadeIn() {
- /* dummy opcode */
- _vcPtr += 6;
-}
-
-void SimonEngine::vc5_skip_if_neq() {
- uint var = vcReadNextWord();
- uint value = vcReadNextWord();
- if (vcReadVar(var) != value)
- vcSkipNextInstruction();
-}
-
-void SimonEngine::vc6_skip_ifn_sib_with_a() {
- if (!itemIsSiblingOf(vcReadNextWord()))
- vcSkipNextInstruction();
-}
-
-void SimonEngine::vc7_skip_if_sib_with_a() {
- if (itemIsSiblingOf(vcReadNextWord()))
- vcSkipNextInstruction();
-}
-
-void SimonEngine::vc8_skip_if_parent_is() {
- uint a = vcReadNextWord();
- uint b = vcReadNextWord();
- if (!itemIsParentOf(a, b))
- vcSkipNextInstruction();
-}
-
-void SimonEngine::vc9_skip_if_unk3_is() {
- uint a = vcReadNextWord();
- uint b = vcReadNextWord();
- if (!vc_maybe_skip_proc_1(a, b))
- vcSkipNextInstruction();
-}
-
-byte *vc10_depack_column(VC10_state * vs) {
- int8 a = vs->depack_cont;
- const byte *src = vs->depack_src;
- byte *dst = vs->depack_dest;
- uint16 dh = vs->dh;
- byte color;
-
- if (a == -0x80)
- a = *src++;
-
- for (;;) {
- if (a >= 0) {
- color = *src++;
- do {
- *dst++ = color;
- if (!--dh) {
- if (--a < 0)
- a = -0x80;
- else
- src--;
- goto get_out;
- }
- } while (--a >= 0);
- } else {
- do {
- *dst++ = *src++;
- if (!--dh) {
- if (++a == 0)
- a = -0x80;
- goto get_out;
- }
- } while (++a != 0);
- }
- a = *src++;
- }
-
-get_out:;
- vs->depack_src = src;
- vs->depack_cont = a;
- return vs->depack_dest + vs->y_skip;
-}
-
-void vc10_skip_cols(VC10_state *vs) {
- vs->depack_cont = -0x80;
- while (vs->x_skip) {
- vc10_depack_column(vs);
- vs->x_skip--;
- }
-}
-
-byte *SimonEngine::vc10_uncompressFlip(const byte *src, uint w, uint h) {
- w *= 8;
-
- byte *src_org, *dst_org;
- byte color;
- int8 cur = -0x80;
- uint i, w_cur = w;
-
- dst_org = _videoBuf1 + w;
-
- do {
- byte *dst = dst_org;
- uint h_cur = h;
-
- if (cur == -0x80)
- cur = *src++;
-
- for (;;) {
- if (cur >= 0) {
- /* rle_same */
- color = *src++;
- do {
- *dst = color;
- dst += w;
- if (!--h_cur) {
- if (--cur < 0)
- cur = -0x80;
- else
- src--;
- goto next_line;
- }
- } while (--cur >= 0);
- } else {
- /* rle_diff */
- do {
- *dst = *src++;
- dst += w;
- if (!--h_cur) {
- if (++cur == 0)
- cur = -0x80;
- goto next_line;
- }
- } while (++cur != 0);
- }
- cur = *src++;
- }
- next_line:
- dst_org++;
- } while (--w_cur);
-
-
- src_org = dst_org = _videoBuf1 + w;
-
- do {
- byte *dst = dst_org;
- for (i = 0; i != w; ++i) {
- byte b = src_org[i];
- b = (b >> 4) | (b << 4);
- *--dst = b;
- }
-
- src_org += w;
- dst_org += w;
- } while (--h);
-
- return _videoBuf1;
-}
-
-byte *SimonEngine::vc10_flip(const byte *src, uint w, uint h) {
- if (src == _vc10BasePtrOld)
- return _videoBuf1;
-
- _vc10BasePtrOld = src;
-
- byte *dst_org, *src_org;
- uint i;
-
- w *= 8;
- src_org = dst_org = _videoBuf1 + w;
-
- do {
- byte *dst = dst_org;
- for (i = 0; i != w; ++i) {
- byte b = src_org[i];
- b = (b >> 4) | (b << 4);
- *--dst = b;
- }
-
- src_org += w;
- dst_org += w;
- } while (--h);
-
- return _videoBuf1;
-}
-
-/* must not be const */
-static uint16 _video_windows[128] = {
- 0, 0, 20, 200,
- 0, 0, 3, 136,
- 17, 0, 3, 136,
- 0, 0, 20, 200,
- 0, 0, 20, 134
-};
-
-/* simon2 specific */
-void SimonEngine::decodeStripA(byte *dst, const byte *src, int height) {
- const uint pitch = _dxSurfacePitch;
- int8 reps = (int8)0x80;
- byte color;
- byte *dst_org = dst;
- uint h = height, w = 8;
-
- for (;;) {
- reps = *src++;
- if (reps >= 0) {
- color = *src++;
-
- do {
- *dst = color;
- dst += pitch;
-
- /* reached bottom? */
- if (--h == 0) {
- /* reached right edge? */
- if (--w == 0)
- return;
- dst = ++dst_org;
- h = height;
- }
- } while (--reps >= 0);
- } else {
-
- do {
- *dst = *src++;
- dst += pitch;
-
- /* reached bottom? */
- if (--h == 0) {
- /* reached right edge? */
- if (--w == 0)
- return;
- dst = ++dst_org;
- h = height;
- }
- } while (++reps != 0);
- }
- }
-}
-
-void SimonEngine::vc10_draw() {
- byte *p2;
- uint width, height;
- uint maxWidth, maxHeight;
- byte flags;
- const uint16 *vlut;
- VC10_state state;
-
- int cur;
-
- state.image = (int16)vcReadNextWord();
- if (state.image == 0)
- return;
-
- if (getGameType() == GType_FF) {
- state.palette = (_vcPtr[0] * 16);
- } else {
- state.palette = (_vcPtr[1] * 16);
- }
- _vcPtr += 2;
- state.x = (int16)vcReadNextWord();
-
- if (getGameType() == GType_SIMON2) {
- state.x -= _scrollX;
- }
- state.y = (int16)vcReadNextWord();
-
- if (getGameType() == GType_SIMON1) {
- state.flags = vcReadNextWord();
- } else {
- state.flags = vcReadNextByte();
- }
-
- if (state.image < 0)
- state.image = vcReadVar(-state.image);
-
- debug(1, "vc10_draw: image %d palette %d x %d y %d flags 0x0%x\n", state.image, state.palette, state.x, state.y, state.flags);
-
- p2 = _curVgaFile2 + state.image * 8;
- if (getGameType() == GType_FF) {
- state.depack_src = _curVgaFile2 + READ_LE_UINT32(p2);
- 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;
- height = p2[5];
- flags = p2[4];
- }
-
- if (height == 0 || width == 0)
- return;
-
- if (_dumpImages)
- dump_single_bitmap(_vgaCurFileId, state.image, state.depack_src, width * 16, height,
- state.palette);
- // TODO::Add support for image overlay and scaling in Feeble Files
-
- if (flags & 0x80 && !(state.flags & 0x10)) {
- if (state.flags & 1) {
- state.flags &= ~1;
- state.flags |= 0x10;
- } else {
- state.flags |= 0x8;
- }
- }
-
- if (getGameType() == GType_FF) {
- if (width > 640) {
- debug(0, "Horizontal scrolling not supported");
- return;
- }
- if (height > 480) {
- debug(0, "Vertical scrolling not supported");
- return;
- }
- }
- if (getGameType() == GType_SIMON2 && width > 20) {
- const byte *src;
- byte *dst;
- uint w;
-
- _scrollXMax = width * 2 - 40;
- _scrollImage = state.depack_src;
- _scrollHeight = height;
- if (_variableArray[34] == -1)
- state.x = _variableArray[251];
-
- _scrollX = state.x;
-
- vcWriteVar(251, _scrollX);
-
- dst = dx_lock_attached();
- src = state.depack_src + _scrollX * 4;
-
- for (w = 0; w < 40; w++) {
- decodeStripA(dst, src + READ_BE_UINT32(src), height);
- dst += 8;
- src += 4;
- }
-
- dx_unlock_attached();
-
- return;
- }
-
- 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) {
- state.depack_src = vc10_flip(state.depack_src, width, height);
- }
- }
-
- vlut = &_video_windows[_windowNum * 4];
-
- state.width = state.draw_width = width; /* cl */
- state.height = state.draw_height = height; /* ch */
-
- if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
- state.draw_width = width * 2;
- }
-
- state.x_skip = 0; /* colums to skip = bh */
- state.y_skip = 0; /* rows to skip = bl */
-
- cur = state.x;
- if (cur < 0) {
- do {
- if (!--state.draw_width)
- return;
- state.x_skip++;
- } while (++cur);
- }
- state.x = cur;
-
- maxWidth = (getGameType() == GType_FF) ? 640 : (vlut[2] * 2);
- cur += state.draw_width - maxWidth;
- if (cur > 0) {
- do {
- if (!--state.draw_width)
- return;
- } while (--cur);
- }
-
- cur = state.y;
- if (cur < 0) {
- do {
- if (!--state.draw_height)
- return;
- state.y_skip++;
- } while (++cur);
- }
- state.y = cur;
-
- maxHeight = (getGameType() == GType_FF) ? 480 : vlut[3];
- cur += state.draw_height - maxHeight;
- if (cur > 0) {
- do {
- if (!--state.draw_height)
- return;
- } while (--cur);
- }
-
- assert(state.draw_width != 0 && state.draw_height != 0);
-
- if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
- state.draw_width *= 4;
- }
-
- state.surf2_addr = dx_lock_2();
- state.surf2_pitch = _dxSurfacePitch;
-
- state.surf_addr = dx_lock_attached();
- state.surf_pitch = _dxSurfacePitch;
-
- if (getGameType() == GType_FF) {
- drawImages_Feeble(&state);
- } else {
- drawImages(&state);
- }
-
- dx_unlock_2();
- dx_unlock_attached();
-}
-
-void SimonEngine::drawImages_Feeble(VC10_state *state) {
- state->surf2_addr += state->x + state->y * state->surf2_pitch;
- state->surf_addr += state->x + state->y * state->surf_pitch;
-
- if (state->flags & 0x20) {
- if (vcGetBit(81) == false) {
- // TODO: Compare Feeble rect
- }
-
- uint w, h;
- byte *src, *dst, *dst_org;
-
- state->dl = state->width;
- state->dh = state->height;
-
- vc10_skip_cols(state);
-
- dst_org = state->surf_addr;
- w = 0;
- do {
- byte color;
-
- src = vc10_depack_column(state);
- dst = dst_org;
-
- h = 0;
- do {
- color = *src;
- if (color)
- *dst = color;
- dst += _screenWidth;
- src++;
- } while (++h != state->draw_height);
- dst_org++;
- } while (++w != state->draw_width);
- } else {
- if (state->flags & 0x8) {
- uint w, h;
- byte *src, *dst, *dst_org;
-
- state->dl = state->width;
- state->dh = state->height;
-
- vc10_skip_cols(state);
-
- if (state->flags & 2) {
- dst_org = state->surf_addr;
- w = 0;
- do {
- src = vc10_depack_column(state);
- dst = dst_org;
-
- h = 0;
- do {
- *dst = *src;
- dst += _screenWidth;
- src++;
- } while (++h != state->draw_height);
- dst_org++;
- } while (++w != state->draw_width);
- } else {
- dst_org = state->surf_addr;
- w = 0;
- do {
- byte color;
-
- src = vc10_depack_column(state);
- dst = dst_org;
-
- h = 0;
- do {
- color = *src;
- if (color)
- *dst = color;
- dst += _screenWidth;
- src++;
- } while (++h != state->draw_height);
- dst_org++;
- } while (++w != state->draw_width);
- }
- } else {
- const byte *src;
- byte *dst;
- uint count;
-
- src = state->depack_src + state->width * state->y_skip;
- dst = state->surf_addr;
- if (state->flags & 0x80) {
- do {
- for (count = 0; count != state->draw_width; count++) {
- byte color;
- color = src[count + state->x_skip];
- if (color) {
- if (color == 220)
- color = 244;
-
- dst[count] = color;
- }
- }
- dst += _screenWidth;
- src += state->width;
- } while (--state->draw_height);
- } else {
- do {
- for (count = 0; count != state->draw_width; count++) {
- byte color;
- color = src[count + state->x_skip];
- if (color)
- dst[count] = color;
- }
- dst += _screenWidth;
- src += state->width;
- } while (--state->draw_height);
- }
- }
- }
-}
-
-void SimonEngine::drawImages(VC10_state *state) {
- const uint16 *vlut = &_video_windows[_windowNum * 4];
-
- uint offs, offs2;
- // Allow one section of Simon the Sorcerer 1 introduction to be displayed
- // in lower half of screen
- if ((getGameType() == GType_SIMON1) && _subroutine == 2926) {
- offs = ((vlut[0]) * 2 + state->x) * 8;
- offs2 = (vlut[1] + state->y);
- } else {
- offs = ((vlut[0] - _video_windows[16]) * 2 + state->x) * 8;
- offs2 = (vlut[1] - _video_windows[17] + state->y);
- }
-
- state->surf2_addr += offs + offs2 * state->surf2_pitch;
- state->surf_addr += offs + offs2 * state->surf_pitch;
-
- if (state->flags & 0x20) {
- byte *mask, *src, *dst;
- byte h;
- uint w;
-
- state->x_skip *= 4;
- state->dl = state->width;
- state->dh = state->height;
-
- vc10_skip_cols(state);
-
- w = 0;
- do {
- mask = vc10_depack_column(state); /* esi */
- src = state->surf2_addr + w * 2; /* ebx */
- dst = state->surf_addr + w * 2; /* edi */
-
- h = state->draw_height;
- if ((getGameType() == GType_SIMON1) && vcGetBit(88)) {
- /* transparency */
- do {
- if (mask[0] & 0xF0) {
- if ((dst[0] & 0x0F0) == 0x20)
- dst[0] = src[0];
- }
- if (mask[0] & 0x0F) {
- if ((dst[1] & 0x0F0) == 0x20)
- dst[1] = src[1];
- }
- mask++;
- dst += state->surf_pitch;
- src += state->surf2_pitch;
- } while (--h);
- } else {
- /* no transparency */
- do {
- if (mask[0] & 0xF0)
- dst[0] = src[0];
- if (mask[0] & 0x0F)
- dst[1] = src[1];
- mask++;
- dst += state->surf_pitch;
- src += state->surf2_pitch;
- } while (--h);
- }
- } while (++w != state->draw_width);
-
- /* vc10_helper_5 */
- } else if (((_lockWord & 0x20) && state->palette == 0) || state->palette == 0xC0) {
- const byte *src;
- byte *dst;
- uint h, i;
-
- if (!(state->flags & 8)) {
- src = state->depack_src + (state->width * state->y_skip * 16) + (state->x_skip * 8);
- dst = state->surf_addr;
-
- state->draw_width *= 2;
-
- if (state->flags & 2) {
- /* no transparency */
- h = state->draw_height;
- do {
- memcpy(dst, src, state->draw_width);
- dst += _screenWidth;
- src += state->width * 16;
- } while (--h);
- } else {
- /* transparency */
- h = state->draw_height;
- do {
- for (i = 0; i != state->draw_width; i++)
- if (src[i])
- dst[i] = src[i];
- dst += _screenWidth;
- src += state->width * 16;
- } while (--h);
- }
-
- } else {
- byte *dst_org = state->surf_addr;
- src = state->depack_src;
- /* AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD EEEEEEEE
- * aaaaabbb bbcccccd ddddeeee efffffgg ggghhhhh
- */
-
- if (state->flags & 2) {
- /* no transparency */
- do {
- uint count = state->draw_width / 4;
-
- dst = dst_org;
- do {
- uint32 bits = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | (src[3]);
-
- dst[0] = (byte)((bits >> (32 - 5)) & 31);
- dst[1] = (byte)((bits >> (32 - 10)) & 31);
- dst[2] = (byte)((bits >> (32 - 15)) & 31);
- dst[3] = (byte)((bits >> (32 - 20)) & 31);
- dst[4] = (byte)((bits >> (32 - 25)) & 31);
- dst[5] = (byte)((bits >> (32 - 30)) & 31);
-
- bits = (bits << 8) | src[4];
-
- dst[6] = (byte)((bits >> (40 - 35)) & 31);
- dst[7] = (byte)((bits) & 31);
-
- dst += 8;
- src += 5;
- } while (--count);
- dst_org += _screenWidth;
- } while (--state->draw_height);
- } else {
- /* transparency */
- do {
- uint count = state->draw_width / 4;
-
- dst = dst_org;
- do {
- uint32 bits = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | (src[3]);
- byte tmp;
-
- tmp = (byte)((bits >> (32 - 5)) & 31);
- if (tmp)
- dst[0] = tmp;
- tmp = (byte)((bits >> (32 - 10)) & 31);
- if (tmp)
- dst[1] = tmp;
- tmp = (byte)((bits >> (32 - 15)) & 31);
- if (tmp)
- dst[2] = tmp;
- tmp = (byte)((bits >> (32 - 20)) & 31);
- if (tmp)
- dst[3] = tmp;
- tmp = (byte)((bits >> (32 - 25)) & 31);
- if (tmp)
- dst[4] = tmp;
- tmp = (byte)((bits >> (32 - 30)) & 31);
- if (tmp)
- dst[5] = tmp;
-
- bits = (bits << 8) | src[4];
-
- tmp = (byte)((bits >> (40 - 35)) & 31);
- if (tmp)
- dst[6] = tmp;
- tmp = (byte)((bits) & 31);
- if (tmp)
- dst[7] = tmp;
-
- dst += 8;
- src += 5;
- } while (--count);
- dst_org += _screenWidth;
- } while (--state->draw_height);
- }
- }
- /* vc10_helper_4 */
- } else {
- if (getGameType() == GType_SIMON2 && state->flags & 0x4 && _bitArray[10] & 0x800) {
- state->surf_addr = state->surf2_addr;
- state->surf_pitch = state->surf2_pitch;
- }
-
- if (state->flags & 0x8) {
- uint w, h;
- byte *src, *dst, *dst_org;
-
- state->x_skip *= 4; /* reached */
-
- state->dl = state->width;
- state->dh = state->height;
-
- vc10_skip_cols(state);
-
- if (state->flags & 2) {
- dst_org = state->surf_addr;
- w = 0;
- do {
- src = vc10_depack_column(state);
- dst = dst_org;
-
- h = 0;
- do {
- dst[0] = (*src / 16) | state->palette;
- dst[1] = (*src & 15) | state->palette;
- dst += _screenWidth;
- src++;
- } while (++h != state->draw_height);
- dst_org += 2;
- } while (++w != state->draw_width);
- } else {
- dst_org = state->surf_addr;
- if (state->flags & 0x40) { /* reached */
- dst_org += vcReadVar(252);
- }
- w = 0;
- do {
- byte color;
-
- src = vc10_depack_column(state);
- dst = dst_org;
-
- h = 0;
- do {
- color = (*src / 16);
- if (color)
- dst[0] = color | state->palette;
- color = (*src & 15);
- if (color)
- dst[1] = color | state->palette;
- dst += _screenWidth;
- src++;
- } while (++h != state->draw_height);
- dst_org += 2;
- } while (++w != state->draw_width);
- }
- /* vc10_helper_6 */
- } 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;
- if (state->flags & 2) {
- do {
- for (count = 0; count != state->draw_width; count++) {
- dst[count * 2] = (src[count + state->x_skip] / 16) | state->palette;
- dst[count * 2 + 1] = (src[count + state->x_skip] & 15) | state->palette;
- }
- dst += _screenWidth;
- src += state->width * 8;
- } while (--state->draw_height);
- } else {
- do {
- for (count = 0; count != state->draw_width; count++) {
- byte color;
- color = (src[count + state->x_skip] / 16);
- if (color)
- dst[count * 2] = color | state->palette;
- color = (src[count + state->x_skip] & 15);
- if (color)
- dst[count * 2 + 1] = color | state->palette;
- }
- dst += _screenWidth;
- src += state->width * 8;
- } while (--state->draw_height);
-
- }
-
- /* vc10_helper_7 */
- }
- }
-
-}
-
-void SimonEngine::vc11_clearPathFinder() {
- memset(&_pathFindArray, 0, sizeof(_pathFindArray));
-}
-
-void SimonEngine::vc12_delay() {
- VgaSprite *vsp = findCurSprite();
- uint num;
-
- if (getGameType() == GType_SIMON1) {
- num = vcReadVarOrWord();
- } else {
- num = vcReadNextByte() * _frameRate;
- }
-
- // Work around to allow inventory arrows to be
- // shown in some versions of Simon the Sorcerer 1
- if ((getGameType() == GType_SIMON1) && vsp->id == 128)
- num = 0;
- else
- num += VGA_DELAY_BASE;
-
- add_vga_timer(num, _vcPtr, _vgaCurSpriteId, _vgaCurFileId);
- _vcPtr = (byte *)&_vc_get_out_of_code;
-}
-
-void SimonEngine::vc13_addToSpriteX() {
- VgaSprite *vsp = findCurSprite();
- vsp->x += (int16)vcReadNextWord();
- _vgaSpriteChanged++;
-}
-
-void SimonEngine::vc14_addToSpriteY() {
- VgaSprite *vsp = findCurSprite();
- vsp->y += (int16)vcReadNextWord();
- _vgaSpriteChanged++;
-}
-
-void SimonEngine::vc15_wakeup_id() {
- VgaSleepStruct *vfs = _vgaSleepStructs, *vfs_tmp;
- uint16 id = vcReadNextWord();
- while (vfs->ident != 0) {
- if (vfs->ident == id) {
- add_vga_timer(VGA_DELAY_BASE, vfs->code_ptr, vfs->sprite_id, vfs->cur_vga_file);
- vfs_tmp = vfs;
- do {
- memcpy(vfs_tmp, vfs_tmp + 1, sizeof(VgaSleepStruct));
- vfs_tmp++;
- } while (vfs_tmp->ident != 0);
- } else {
- vfs++;
- }
- }
-
- /* clear a wait event */
- if (id == _vgaWaitFor)
- _vgaWaitFor = 0;
-}
-
-void SimonEngine::vc16_sleep_on_id() {
- VgaSleepStruct *vfs = _vgaSleepStructs;
- while (vfs->ident)
- vfs++;
-
- vfs->ident = vcReadNextWord();
- vfs->code_ptr = _vcPtr;
- vfs->sprite_id = _vgaCurSpriteId;
- vfs->cur_vga_file = _vgaCurFileId;
-
- _vcPtr = (byte *)&_vc_get_out_of_code;
-}
-
-void SimonEngine::vc17_setPathfinderItem() {
- uint a = vcReadNextWord();
- _pathFindArray[a - 1] = (const uint16 *)_vcPtr;
-
- int end = (getGameType() == GType_FF) ? 9999 : 999;
- while (readUint16Wrapper(_vcPtr) != end)
- _vcPtr += 4;
- _vcPtr += 2;
-}
-
-void SimonEngine::vc18_jump() {
- int16 offs = vcReadNextWord();
- _vcPtr += offs;
-}
-
-/* chain to script? */
-void SimonEngine::vc19_chain_to_script() {
- /* unused */
- error("vc19_chain_to_script: not implemented");
-}
-
-/* helper routines */
-
-void SimonEngine::vc20_setRepeat() {
- /* FIXME: This opcode is somewhat strange: it first reads a BE word from
- * the script (advancing the script pointer in doing so); then it writes
- * back the same word, this time as LE, into the script.
- */
- uint16 a = vcReadNextWord();
- WRITE_LE_UINT16(const_cast<byte *>(_vcPtr), a);
- _vcPtr += 2;
-}
-
-void SimonEngine::vc21_endRepeat() {
- int16 a = vcReadNextWord();
- const byte *tmp = _vcPtr + a;
- if (getGameType() == GType_SIMON1)
- tmp += 4;
- else
- tmp += 3;
-
- uint16 val = READ_LE_UINT16(tmp);
- if (val != 0) {
- // Decrement counter
- WRITE_LE_UINT16(const_cast<byte *>(tmp), val - 1);
- _vcPtr = tmp + 2;
- }
-}
-
-void SimonEngine::vc22_setSpritePalette() {
- uint a = vcReadNextWord();
- uint b = vcReadNextWord();
- uint num = a == 0 ? 32 : 16;
- uint palSize = 96;
- byte *palptr, *src;
-
- if (getGameType() == GType_FF) {
- a = 0;
- num = 256;
- palSize = 768;
- }
-
- palptr = &_palette[(a * 64)];
- src = _curVgaFile1 + 6 + b * palSize;
-
- do {
- palptr[0] = src[0] * 4;
- palptr[1] = src[1] * 4;
- palptr[2] = src[2] * 4;
- palptr[3] = 0;
-
- palptr += 4;
- src += 3;
- } while (--num);
-
- _paletteFlag = 2;
- _vgaSpriteChanged++;
-}
-
-void SimonEngine::vc23_setSpritePriority() {
- VgaSprite *vsp = findCurSprite(), *vus2;
- uint16 pri = vcReadNextWord();
- VgaSprite bak;
-
- if (vsp->id == 0)
- return;
-
- memcpy(&bak, vsp, sizeof(bak));
- bak.priority = pri;
- bak.windowNum |= 0x8000;
-
- vus2 = vsp;
-
- if (vsp != _vgaSprites && pri < vsp[-1].priority) {
- do {
- vsp--;
- } while (vsp != _vgaSprites && pri < vsp[-1].priority);
- do {
- memcpy(vus2, vus2 - 1, sizeof(VgaSprite));
- } while (--vus2 != vsp);
- memcpy(vus2, &bak, sizeof(VgaSprite));
- } else if (vsp[1].id != 0 && pri >= vsp[1].priority) {
- do {
- vsp++;
- } while (vsp[1].id != 0 && pri >= vsp[1].priority);
- do {
- memcpy(vus2, vus2 + 1, sizeof(VgaSprite));
- } while (++vus2 != vsp);
- memcpy(vus2, &bak, sizeof(VgaSprite));
- } else {
- vsp->priority = pri;
- }
- _vgaSpriteChanged++;
-}
-
-void SimonEngine::vc24_setSpriteXY() {
- VgaSprite *vsp = findCurSprite();
- vsp->image = vcReadVarOrWord();
-
- vsp->x += (int16)vcReadNextWord();
- vsp->y += (int16)vcReadNextWord();
- if (getGameType() == GType_SIMON1) {
- vsp->flags = vcReadNextWord();
- } else {
- vsp->flags = vcReadNextByte();
- }
-
- _vgaSpriteChanged++;
-}
-
-void SimonEngine::vc25_halt_sprite() {
- VgaSprite *vsp = findCurSprite();
- while (vsp->id != 0) {
- memcpy(vsp, vsp + 1, sizeof(VgaSprite));
- vsp++;
- }
- _vcPtr = (byte *)&_vc_get_out_of_code;
- _vgaSpriteChanged++;
-}
-
-void SimonEngine::vc26_setSubWindow() {
- uint16 *as = &_video_windows[vcReadNextWord() * 4]; // number
- as[0] = vcReadNextWord(); // x
- as[1] = vcReadNextWord(); // y
- as[2] = vcReadNextWord(); // width
- as[3] = vcReadNextWord(); // height
-}
-
-void SimonEngine::vc27_resetSprite() {
- VgaSprite bak, *vsp;
- VgaSleepStruct *vfs;
- VgaTimerEntry *vte, *vte2;
-
- _lockWord |= 8;
-
- memset(&bak, 0, sizeof(bak));
-
- vsp = _vgaSprites;
- while (vsp->id) {
- if ((getGameType() == GType_SIMON1) && vsp->id == 128) {
- memcpy(&bak, vsp, sizeof(VgaSprite));
- }
- vsp->id = 0;
- vsp++;
- }
-
- if (bak.id != 0)
- memcpy(_vgaSprites, &bak, sizeof(VgaSprite));
-
- vfs = _vgaSleepStructs;
- while (vfs->ident) {
- vfs->ident = 0;
- vfs++;
- }
-
- vte = _vgaTimerList;
- while (vte->delay) {
- if ((getGameType() == GType_SIMON1) && vsp->id == 128) {
- vte++;
- } else {
- vte2 = vte;
- while (vte2->delay) {
- memcpy(vte2, vte2 + 1, sizeof(VgaTimerEntry));
- vte2++;
- }
- }
- }
-
- vcWriteVar(254, 0);
-
- _lockWord &= ~8;
-}
-
-void SimonEngine::vc28_dummy_op() {
- /* unused */
- _vcPtr += 8;
-}
-
-void SimonEngine::vc29_stopAllSounds() {
- _sound->stopAll();
-}
-
-void SimonEngine::vc30_setFrameRate() {
- _frameRate = vcReadNextWord();
-}
-
-void SimonEngine::vc31_setWindow() {
- _windowNum = vcReadNextWord();
-}
-
-uint SimonEngine::vcReadVar(uint var) {
- assert(var < 255);
- return (uint16)_variableArray[var];
-}
-
-void SimonEngine::vcWriteVar(uint var, int16 value) {
- _variableArray[var] = value;
-}
-
-void SimonEngine::vc32_copyVar() {
- uint16 a = vcReadVar(vcReadNextWord());
- vcWriteVar(vcReadNextWord(), a);
-}
-
-void SimonEngine::vc33_setMouseOn() {
- if (_mouseHideCount != 0) {
- _mouseHideCount = 1;
- mouseOn();
- }
-}
-
-void SimonEngine::vc34_setMouseOff() {
- mouseOff();
- _mouseHideCount = 200;
- _leftButtonDown = 0;
-}
-
-void SimonEngine::vc35_clearWindow() {
- /* unused */
- _vcPtr += 4;
- _vgaSpriteChanged++;
-}
-
-void SimonEngine::vc36_setWindowImage() {
- _updateScreen = false;
- uint vga_res = vcReadNextWord();
- uint windowNum = vcReadNextWord();
-
- if (getGameType() == GType_SIMON1) {
- if (windowNum == 16) {
- _copyPartialMode = 2;
- } else {
- set_video_mode_internal(windowNum, vga_res);
- }
- } else {
- set_video_mode_internal(windowNum, vga_res);
- }
-}
-
-void SimonEngine::vc37_addToSpriteY() {
- VgaSprite *vsp = findCurSprite();
- vsp->y += vcReadVar(vcReadNextWord());
- _vgaSpriteChanged++;
-}
-
-void SimonEngine::vc38_skipIfVarZero() {
- uint var = vcReadNextWord();
- if (vcReadVar(var) == 0)
- vcSkipNextInstruction();
-}
-
-void SimonEngine::vc39_setVar() {
- uint var = vcReadNextWord();
- int16 value = vcReadNextWord();
- vcWriteVar(var, value);
-}
-
-void SimonEngine::vc40() {
- uint var = vcReadNextWord();
- int16 value = vcReadVar(var) + vcReadNextWord();
-
- if ((getGameType() == GType_SIMON2) && var == 15 && !(_bitArray[5] & 1)) {
- int16 tmp;
-
- if (_scrollCount != 0) {
- if (_scrollCount >= 0)
- goto no_scroll;
- _scrollCount = 0;
- } else {
- if (_scrollFlag != 0)
- goto no_scroll;
- }
-
- if (value - _scrollX >= 30) {
- _scrollCount = 20;
- tmp = _scrollXMax - _scrollX;
- if (tmp < 20)
- _scrollCount = tmp;
- add_vga_timer(6, NULL, 0, 0); /* special timer */
- }
- }
-no_scroll:;
-
- vcWriteVar(var, value);
-}
-
-void SimonEngine::vc41() {
- uint var = vcReadNextWord();
- int16 value = vcReadVar(var) - vcReadNextWord();
-
- if ((getGameType() == GType_SIMON2) && var == 15 && !(_bitArray[5] & 1)) {
- int16 tmp;
-
- if (_scrollCount != 0) {
- if (_scrollCount < 0)
- goto no_scroll;
- _scrollCount = 0;
- } else {
- if (_scrollFlag != 0)
- goto no_scroll;
- }
-
- if ((uint16)(value - _scrollX) < 11) {
- _scrollCount = -20;
- tmp = _scrollXMax - _scrollX;
- if (_scrollX < 20)
- _scrollCount = -_scrollX;
- add_vga_timer(6, NULL, 0, 0); /* special timer */
- }
- }
-no_scroll:;
-
- vcWriteVar(var, value);
-}
-
-void SimonEngine::vc42_delayIfNotEQ() {
- uint val = vcReadVar(vcReadNextWord());
- if (val != vcReadNextWord()) {
-
- add_vga_timer(_frameRate + 1, _vcPtr - 4, _vgaCurSpriteId, _vgaCurFileId);
- _vcPtr = (byte *)&_vc_get_out_of_code;
- }
-}
-
-void SimonEngine::vc43_skipIfBitClear() {
- if (!vcGetBit(vcReadNextWord())) {
- vcSkipNextInstruction();
- }
-}
-
-void SimonEngine::vc44_skipIfBitSet() {
- if (vcGetBit(vcReadNextWord())) {
- vcSkipNextInstruction();
- }
-}
-
-void SimonEngine::vc45_setSpriteX() {
- VgaSprite *vsp = findCurSprite();
- vsp->x = vcReadVar(vcReadNextWord());
- _vgaSpriteChanged++;
-}
-
-void SimonEngine::vc46_setSpriteY() {
- VgaSprite *vsp = findCurSprite();
- vsp->y = vcReadVar(vcReadNextWord());
- _vgaSpriteChanged++;
-}
-
-void SimonEngine::vc47_addToVar() {
- uint var = vcReadNextWord();
- vcWriteVar(var, vcReadVar(var) + vcReadVar(vcReadNextWord()));
-}
-
-void SimonEngine::vc48_setPathFinder() {
- uint a = (uint16)_variableArray[12];
- const uint16 *p = _pathFindArray[a - 1];
-
- if (getGameType() == GType_FF) {
- VgaSprite *vsp = findCurSprite();
- int16 x, x2, y, y1, y2, ydiff;
- uint pos = 0;
-
- while(vsp->x > readUint16Wrapper(p + 2)) {
- p += 2;
- pos++;
- }
-
- y1 = readUint16Wrapper(p + 1);
- x2 = readUint16Wrapper(p + 2);
- y2 = readUint16Wrapper(p + 3);
-
- if (x2 != 9999) {
- ydiff = y2 - y1;
- if (ydiff < 0) {
- ydiff = -ydiff;
- x = vsp->x & 7;
- ydiff *= x;
- ydiff /= 8;
- ydiff = -ydiff;
- } else {
- x = vsp->x & 7;
- ydiff *= x;
- ydiff /= 8;
- }
- y1 += ydiff;
- }
-
- y = vsp->y;
- vsp->y = y1;
- //checkScrollY(y, diff);
-
- _variableArray[11] = readUint16Wrapper(p);
- _variableArray[13] = pos;
- } else {
- uint b = (uint16)_variableArray[13];
- p += b * 2 + 1;
- int c = _variableArray[14];
-
- int step;
- int y1, y2;
- int16 *vp;
-
- step = 2;
- if (c < 0) {
- c = -c;
- step = -2;
- }
-
- vp = &_variableArray[20];
-
- do {
- y2 = readUint16Wrapper(p);
- p += step;
- y1 = readUint16Wrapper(p) - y2;
-
- vp[0] = y1 / 2;
- vp[1] = y1 - (y1 / 2);
-
- vp += 2;
- } while (--c);
- }
-}
-
-void SimonEngine::vcSetBitTo(uint bit, bool value) {
- uint16 *bits = &_bitArray[bit >> 4];
- *bits = (*bits & ~(1 << (bit & 15))) | (value << (bit & 15));
-}
-
-bool SimonEngine::vcGetBit(uint bit) {
- uint16 *bits = &_bitArray[bit >> 4];
- return (*bits & (1 << (bit & 15))) != 0;
-}
-
-void SimonEngine::vc49_setBit() {
- vcSetBitTo(vcReadNextWord(), true);
-}
-
-void SimonEngine::vc50_clearBit() {
- vcSetBitTo(vcReadNextWord(), false);
-}
-
-void SimonEngine::vc51_clear_hitarea_bit_0x40() {
- clear_hitarea_bit_0x40(vcReadNextWord());
-}
-
-void SimonEngine::vc52_playSound() {
- bool ambient = false;
-
- uint16 sound = vcReadNextWord();
- if (sound >= 0x8000) {
- ambient = true;
- sound = -sound;
- }
-
- if (getGameType() == GType_FF) {
- uint16 pan = vcReadNextWord();
- uint16 vol = vcReadNextWord();
- _sound->playSoundData(_curSfxFile, sound, pan, vol, ambient);
- } else if (getGameType() == GType_SIMON2) {
- if (ambient) {
- _sound->playAmbient(sound);
- } else {
- _sound->playEffects(sound);
- }
- } else if (getFeatures() & GF_TALKIE) {
- _sound->playEffects(sound);
- } else if (getGameId() == GID_SIMON1DOS) {
- playSting(sound);
- }
-}
-
-void SimonEngine::vc53_no_op() {
- // Start sound effect, panning it with the animation
- int snd = vcReadNextWord();
- int xoffs = vcReadNextWord();
- int vol = vcReadNextWord();
- debug(0, "STUB: vc53_no_op: snd %d xoffs %d vol %d", snd, xoffs, vol);
-}
-
-void SimonEngine::vc54_no_op() {
- /* unused */
- _vcPtr += 6;
-}
-
-void SimonEngine::vc55_offset_hit_area() {
- HitArea *ha = _hitAreas;
- uint count = ARRAYSIZE(_hitAreas);
- uint16 id = vcReadNextWord();
- int16 x = vcReadNextWord();
- int16 y = vcReadNextWord();
-
- for (;;) {
- if (ha->id == id) {
- ha->x += x;
- ha->y += y;
- break;
- }
- ha++;
- if (!--count)
- break;
- }
-
- _needHitAreaRecalc++;
-}
-
-void SimonEngine::vc56_delay() {
- uint num = vcReadVarOrWord() * _frameRate;
-
- add_vga_timer(num + VGA_DELAY_BASE, _vcPtr, _vgaCurSpriteId, _vgaCurFileId);
- _vcPtr = (byte *)&_vc_get_out_of_code;
-}
-
-void SimonEngine::vc59() {
- if (getGameType() == GType_SIMON1) {
- if (!_sound->isVoiceActive())
- vcSkipNextInstruction();
- } else {
- uint file = vcReadNextWord();
- uint start = vcReadNextWord();
- uint end = vcReadNextWord() + 1;
-
- do {
- vc_kill_sprite(file, start);
- } while (++start != end);
- }
-}
-
-void SimonEngine::vc58() {
- uint sprite = _vgaCurSpriteId;
- uint file = _vgaCurFileId;
- const byte *vc_ptr_org;
- uint16 tmp;
-
- _vgaCurFileId = vcReadNextWord();
- _vgaCurSpriteId = vcReadNextWord();
-
- tmp = to16Wrapper(vcReadNextWord());
-
- vc_ptr_org = _vcPtr;
- _vcPtr = (byte *)&tmp;
- vc23_setSpritePriority();
-
- _vcPtr = vc_ptr_org;
- _vgaCurSpriteId = sprite;
- _vgaCurFileId = file;
-}
-
-void SimonEngine::vc57_no_op() {
- /* unused */
-}
-
-void SimonEngine::vc_kill_sprite(uint file, uint sprite) {
- uint16 old_sprite_id, old_cur_file_id;
- VgaSleepStruct *vfs;
- VgaSprite *vsp;
- VgaTimerEntry *vte;
- const byte *vc_ptr_org;
-
- old_sprite_id = _vgaCurSpriteId;
- old_cur_file_id = _vgaCurFileId;
- vc_ptr_org = _vcPtr;
-
- _vgaCurFileId = file;
- _vgaCurSpriteId = sprite;
-
- vfs = _vgaSleepStructs;
- while (vfs->ident != 0) {
- if (vfs->sprite_id == _vgaCurSpriteId && ((getGameType() == GType_SIMON1) || vfs->cur_vga_file == _vgaCurFileId)) {
- while (vfs->ident != 0) {
- memcpy(vfs, vfs + 1, sizeof(VgaSleepStruct));
- vfs++;
- }
- break;
- }
- vfs++;
- }
-
- vsp = findCurSprite();
- if (vsp->id) {
- vc25_halt_sprite();
-
- vte = _vgaTimerList;
- while (vte->delay != 0) {
- if (vte->sprite_id == _vgaCurSpriteId && ((getGameType() == GType_SIMON1) || vte->cur_vga_file == _vgaCurFileId)) {
- delete_vga_timer(vte);
- break;
- }
- vte++;
- }
- }
-
- _vgaCurFileId = old_cur_file_id;
- _vgaCurSpriteId = old_sprite_id;
- _vcPtr = vc_ptr_org;
-}
-
-void SimonEngine::vc60_killSprite() {
- uint file;
-
- if (getGameType() == GType_SIMON1) {
- file = _vgaCurFileId;
- } else {
- file = vcReadNextWord();
- }
- uint sprite = vcReadNextWord();
- vc_kill_sprite(file, sprite);
-}
-
-void SimonEngine::vc61_setMaskImage() {
- VgaSprite *vsp = findCurSprite();
-
- vsp->image = vcReadVarOrWord();
-
- vsp->x += vcReadNextWord();
- vsp->y += vcReadNextWord();
- vsp->flags = 0x24;
-
- _vgaSpriteChanged++;
-}
-
-void SimonEngine::vc62_fastFadeOut() {
- uint i;
-
- vc29_stopAllSounds();
-
- if (!_fastFadeOutFlag) {
- _fastFadeOutFlag = true;
-
- _videoNumPalColors = 256;
- if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
- if (_windowNum == 4)
- _videoNumPalColors = 208;
- }
-
- memcpy(_videoBuf1, _paletteBackup, _videoNumPalColors * 4);
- for (i = NUM_PALETTE_FADEOUT; i != 0; --i) {
- palette_fadeout((uint32 *)_videoBuf1, _videoNumPalColors);
- _system->setPalette(_videoBuf1, 0, _videoNumPalColors);
- if (_fade)
- _system->updateScreen();
- delay(5);
- }
-
- if (getGameType() == GType_SIMON1) {
- uint16 params[5]; /* parameters to vc10_draw */
- VgaSprite *vsp;
- VgaPointersEntry *vpe;
- const byte *vc_ptr_org = _vcPtr;
-
- vsp = _vgaSprites;
- while (vsp->id != 0) {
- if (vsp->id == 128) {
- byte *old_file_1 = _curVgaFile1;
- byte *old_file_2 = _curVgaFile2;
- uint palmode = _windowNum;
-
- vpe = &_vgaBufferPointers[vsp->fileId];
- _curVgaFile1 = vpe->vgaFile1;
- _curVgaFile2 = vpe->vgaFile2;
- _windowNum = vsp->windowNum;
-
- params[0] = READ_BE_UINT16(&vsp->image);
- params[1] = READ_BE_UINT16(&vsp->palette);
- params[2] = READ_BE_UINT16(&vsp->x);
- params[3] = READ_BE_UINT16(&vsp->y);
- params[4] = READ_BE_UINT16(&vsp->flags);
- _vcPtr = (byte *)params;
- vc10_draw();
-
- _windowNum = palmode;
- _curVgaFile1 = old_file_1;
- _curVgaFile2 = old_file_2;
- break;
- }
- vsp++;
- }
- _vcPtr = vc_ptr_org;
- }
-
- // 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)) {
- dx_clear_surfaces(200);
- } else if (getGameType() == GType_FF) {
- dx_clear_surfaces(480);
- } else {
- dx_clear_surfaces(_windowNum == 4 ? 134 : 200);
- }
- }
- if (getGameType() == GType_SIMON2) {
- if (_nextMusicToPlay != -1)
- loadMusic(_nextMusicToPlay);
- }
-
-}
-
-void SimonEngine::vc63_fastFadeIn() {
- if (getGameType() == GType_FF) {
- _paletteColorCount = 256;
- } else {
- _paletteColorCount = 208;
- if (_windowNum != 4) {
- _paletteColorCount = 256;
- }
- }
- _fastFadeOutFlag = false;
-}
-
-void SimonEngine::vc64_skipIfSpeechEnded() {
- if (!_sound->isVoiceActive() || (_subtitles && _language != Common::HB_ISR))
- vcSkipNextInstruction();
-}
-
-void SimonEngine::vc65_slowFadeIn() {
- _paletteColorCount = 624;
- _videoNumPalColors = 208;
- if (_windowNum != 4) {
- _paletteColorCount = 768;
- _videoNumPalColors = 256;
- }
- _paletteColorCount |= 0x8000;
- _fastFadeOutFlag = false;
-}
-
-void SimonEngine::vc66_skipIfNotEqual() {
- uint a = vcReadNextWord();
- uint b = vcReadNextWord();
-
- if (vcReadVar(a) != vcReadVar(b))
- vcSkipNextInstruction();
-}
-
-void SimonEngine::vc67_skipIfGE() {
- uint a = vcReadNextWord();
- uint b = vcReadNextWord();
-
- if (vcReadVar(a) >= vcReadVar(b))
- vcSkipNextInstruction();
-}
-
-void SimonEngine::vc68_skipIfLE() {
- uint a = vcReadNextWord();
- uint b = vcReadNextWord();
-
- if (vcReadVar(a) <= vcReadVar(b))
- vcSkipNextInstruction();
-}
-
-void SimonEngine::vc69_playTrack() {
- int16 track = vcReadNextWord();
- int16 loop = vcReadNextWord();
-
- // Jamieson630:
- // This is a "play track". The original
- // design stored the track to play if one was
- // already in progress, so that the next time a
- // "fill MIDI stream" event occured, the MIDI
- // player would find the change and switch
- // tracks. We use a different architecture that
- // allows for an immediate response here, but
- // we'll simulate the variable changes so other
- // scripts don't get thrown off.
- // NOTE: This opcode looks very similar in function
- // to vc72(), except that vc72() may allow for
- // specifying a non-valid track number (999 or -1)
- // as a means of stopping what music is currently
- // playing.
- midi.setLoop(loop != 0);
- midi.startTrack(track);
-}
-
-void SimonEngine::vc70_queueMusic() {
- // Simon2
- uint16 track = vcReadNextWord();
- uint16 loop = vcReadNextWord();
-
- // Jamieson630:
- // This sets the "on end of track" action.
- // It specifies whether to loop the current
- // track and, if not, whether to switch to
- // a different track upon completion.
- if (track != 0xFFFF && track != 999)
- midi.queueTrack(track, loop != 0);
- else
- midi.setLoop(loop != 0);
-}
-
-void SimonEngine::vc71_checkMusicQueue() {
- // Jamieson630:
- // This command skips the next instruction
- // unless (1) there is a track playing, AND
- // (2) there is a track queued to play after it.
- if (!midi.isPlaying (true))
- vcSkipNextInstruction();
-}
-
-void SimonEngine::vc72_play_track_2() {
- // Jamieson630:
- // This is a "play or stop track". Note that
- // this opcode looks very similar in function
- // to vc69(), except that this opcode may allow
- // for specifying a track of 999 or -1 in order to
- // stop the music. We'll code it that way for now.
-
- // NOTE: It's possible that when "stopping" a track,
- // we're supposed to just go on to the next queued
- // track, if any. Must find out if there is ANY
- // case where this is used to stop a track in the
- // first place.
-
- int16 track = vcReadNextWord();
- int16 loop = vcReadNextWord();
-
- if (track == -1 || track == 999) {
- midi.stop();
- } else {
- midi.setLoop (loop != 0);
- midi.startTrack (track);
- }
-}
-
-void SimonEngine::vc73_setMark() {
- vcReadNextByte();
- _marks |= 1 << vcReadNextByte();
-}
-
-void SimonEngine::vc74_clearMark() {
- vcReadNextByte();
- _marks &= ~(1 << vcReadNextByte());
-}
-
-int SimonEngine::getScale(int y, int x) {
- int z;
-
- if (y > _baseY) {
- return((int)(x * (1 + ((y - _baseY) * _scale))));
- } else {
- if (x == 0)
- return(0);
- if (x < 0) {
- z = ((int)((x * (1 - ((_baseY - y)* _scale))) - 0.5));
- if (z >- 2)
- return(-2);
- return(z);
- }
-
- z=((int)((x * (1 - ((_baseY-y) * _scale))) + 0.5));
- if (z < 2)
- return(2);
-
- return(z);
- }
-}
-
-void SimonEngine::vc75_setScale() {
- _baseY = vcReadNextWord();
- _scale = (float)vcReadNextWord() / 1000000.;
-}
-
-void SimonEngine::vc76_setScaleXOffs() {
- VgaSprite *vsp = findCurSprite();
-
- vsp->image = vcReadNextWord();
- int16 x = vcReadNextWord();
- int var = vcReadNextWord();
-
- vsp->x += getScale(vsp->y, x);
- _variableArray[var] = vsp->x;
-
- if (_scrollXMax) {
- // TODO: Scroll check
- }
-
- vsp->flags = 0x40;
-}
-
-void SimonEngine::vc77_setScaleYOffs() {
- VgaSprite *vsp = findCurSprite();
-
- vsp->image = vcReadNextWord();
- int16 x = vcReadNextWord();
- int var = vcReadNextWord();
-
- vsp->y += getScale(vsp->y, x);
- _variableArray[var] = vsp->y;
- vsp->flags = 0x40;
-}
-
-void SimonEngine::vc78_computeXY() {
- VgaSprite *vsp = findCurSprite();
-
- uint a = (uint16)_variableArray[12];
- uint b = (uint16)_variableArray[13];
-
- const uint16 *p = _pathFindArray[a - 1];
- p += b * 2;
-
- uint16 posx = readUint16Wrapper(p);
- _variableArray[15] = posx;
- vsp->x = posx;
-
- uint16 posy = readUint16Wrapper(p + 1);
- _variableArray[16] = posy;
- vsp->y = posy;
-
- vcSetBitTo(85, false);
- if (vcGetBit(74) == true) {
- //centreScroll();
- }
-}
-
-void SimonEngine::vc79_computePosNum() {
- uint a = (uint16)_variableArray[12];
- const uint16 *p = _pathFindArray[a - 1];
- uint pos = 0;
-
- int16 y = _variableArray[16];
- while(y > readUint16Wrapper(p + 1)) {
- p += 2;
- pos++;
- }
-
- _variableArray[13] = pos;
-}
-
-void SimonEngine::vc80_setOverlayImage() {
- VgaSprite *vsp = findCurSprite();
-
- vsp->image = vcReadVarOrWord();
-
- vsp->x += vcReadNextWord();
- vsp->y += vcReadNextWord();
- vsp->flags = 0x10;
-
- _vgaSpriteChanged++;
-}
-
-void SimonEngine::vc81_setRandom() {
- uint var = vcReadNextWord();
- uint value = vcReadNextWord();
- writeVariable(var, _rnd.getRandomNumber(value - 1));
-}
-
-void SimonEngine::vc82_getPathValue() {
- uint8 val;
-
- uint16 var = vcReadNextWord();
-
- if (vcGetBit(82) == true) {
- val = _pathValues1[_GPVCount1++];
- } else {
- val = _pathValues[_GPVCount++];
- }
-
- writeVariable(var, val);
-}
-
-void SimonEngine::vc83_playSoundLoop() {
- // Start looping sound effect
- int snd = vcReadNextWord();
- int vol = vcReadNextWord();
- int pan = vcReadNextWord();
- debug(0, "STUB: vc83_playSoundLoop: snd %d vol %d pan %d", snd, vol, pan);
-}
-
-void SimonEngine::vc84_stopSoundLoop() {
- // Stop looping sound effect
- debug(0, "STUB: vc84_stopSoundLoop");
-}
-
-} // End of namespace Simon
diff --git a/simon/vga.h b/simon/vga.h
deleted file mode 100644
index 2dd77633de..0000000000
--- a/simon/vga.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2002-2006 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef SIMON_VGA_H
-#define SIMON_VGA_H
-
-namespace Simon {
-
-#if !defined(__GNUC__)
- #pragma START_PACK_STRUCTS
-#endif
-
-// Feeble Files
-struct VgaFileHeader_Feeble {
- uint16 x_1;
- uint16 hdr2_start;
- uint16 x_2, x_3;
-} GCC_PACK;
-
-struct VgaFileHeader2_Feeble {
- uint16 imageCount;
- uint16 x_2;
- uint16 animationCount;
- uint16 x_3;
- uint16 imageTable;
- uint16 x_4;
- uint16 animationTable;
- uint16 x_5;
-} GCC_PACK;
-
-struct ImageHeader_Feeble {
- uint16 id;
- uint16 x_1;
- uint16 scriptOffs;
- uint16 x_2;
-} GCC_PACK;
-
-struct AnimationHeader_Feeble {
- uint16 scriptOffs;
- uint16 x_2;
- uint16 id;
-} GCC_PACK;
-
-// Simon 1/2
-struct VgaFileHeader_Simon {
- uint16 x_1, x_2;
- uint16 hdr2_start;
- uint16 x_3, x_4;
-} GCC_PACK;
-
-struct VgaFileHeader2_Simon {
- uint16 x_1;
- uint16 imageCount;
- uint16 x_2;
- uint16 animationCount;
- uint16 x_3;
- uint16 imageTable;
- uint16 x_4;
- uint16 animationTable;
- uint16 x_5;
-} GCC_PACK;
-
-struct ImageHeader_Simon {
- uint16 id;
- uint16 x_1;
- uint16 x_2;
- uint16 scriptOffs;
-} GCC_PACK;
-
-struct AnimationHeader_Simon {
- uint16 id;
- uint16 x_2;
- uint16 scriptOffs;
-} GCC_PACK;
-
-
-#if !defined(__GNUC__)
- #pragma END_PACK_STRUCTS
-#endif
-
-struct VC10_state {
- int image;
- uint16 flags;
- int x, y;
-
- byte palette;
-
- uint width, height;
- uint draw_width, draw_height;
- uint x_skip, y_skip;
-
- byte *surf2_addr;
- uint surf2_pitch;
-
- byte *surf_addr;
- uint surf_pitch;
-
- uint16 dl, dh;
-
- const byte *depack_src;
- int8 depack_cont;
-
- byte depack_dest[480];
-};
-
-byte *vc10_depack_column(VC10_state *vs);
-
-} // End of namespace Simon
-
-#endif