Rename SimonState to SimonEngine

svn-id: r8228
This commit is contained in:
Travis Howell 2003-06-01 09:41:56 +00:00
parent b3e1668970
commit 771dcfaad7
12 changed files with 422 additions and 422 deletions

View file

@ -235,7 +235,7 @@ BOOL PPCWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, OSystem_W
if (is_demo) if (is_demo)
do_quit(); do_quit();
if (is_simon) { if (is_simon) {
((SimonState*)engine)->_exit_cutscene = true; ((SimonEngine*)engine)->_exit_cutscene = true;
break; break;
} }
wm->_event.event_code = OSystem::EVENT_KEYDOWN; wm->_event.event_code = OSystem::EVENT_KEYDOWN;

View file

@ -306,7 +306,7 @@ void SmartfonSave(OSystem_WINCE3 *wm, BOOL repeat) {
void SmartfonSkip(OSystem_WINCE3 *wm, BOOL repeat) { void SmartfonSkip(OSystem_WINCE3 *wm, BOOL repeat) {
if (is_simon) { if (is_simon) {
((SimonState*)engine)->_exit_cutscene = true; ((SimonEngine*)engine)->_exit_cutscene = true;
return; return;
} }
wm->_event.event_code = OSystem::EVENT_KEYDOWN; wm->_event.event_code = OSystem::EVENT_KEYDOWN;

View file

@ -360,7 +360,7 @@ Engine *engine;
bool is_simon; bool is_simon;
NewGui *g_gui; NewGui *g_gui;
extern Scumm *g_scumm; extern Scumm *g_scumm;
//extern SimonState *g_simon; //extern SimonEngine *g_simon;
//OSystem *g_system; //OSystem *g_system;
//SoundMixer *g_mixer; //SoundMixer *g_mixer;
Config *g_config; Config *g_config;

View file

@ -58,7 +58,7 @@ public:
virtual const char *getGameDataPath() const { return _gameDataPath; } virtual const char *getGameDataPath() const { return _gameDataPath; }
// Create a new engine object based on the detector - either // Create a new engine object based on the detector - either
// a Scumm or a SimonState object currently. // a Scumm or a SimonEngine object currently.
static Engine *createFromDetector(GameDetector *detector, OSystem *syst); static Engine *createFromDetector(GameDetector *detector, OSystem *syst);
// Specific for each engine preparare of erroe string // Specific for each engine preparare of erroe string

View file

@ -23,7 +23,7 @@
#include "simon/simon.h" #include "simon/simon.h"
#include "simon/intern.h" #include "simon/intern.h"
void SimonState::print_char_helper_1(const byte *src, uint len) { void SimonEngine::print_char_helper_1(const byte *src, uint len) {
uint ind; uint ind;
if (_fcs_ptr_1 == NULL) if (_fcs_ptr_1 == NULL)
@ -41,13 +41,13 @@ void SimonState::print_char_helper_1(const byte *src, uint len) {
} }
} }
void SimonState::print_char_helper_5(FillOrCopyStruct *fcs) { void SimonEngine::print_char_helper_5(FillOrCopyStruct *fcs) {
uint index = get_fcs_ptr_3_index(fcs); uint index = get_fcs_ptr_3_index(fcs);
print_char_helper_6(index); print_char_helper_6(index);
_fcs_data_1[index] = 0; _fcs_data_1[index] = 0;
} }
void SimonState::print_char_helper_6(uint i) { void SimonEngine::print_char_helper_6(uint i) {
FillOrCopyStruct *fcs; FillOrCopyStruct *fcs;
if (_fcs_data_2[i]) { if (_fcs_data_2[i]) {
@ -59,7 +59,7 @@ void SimonState::print_char_helper_6(uint i) {
} }
} }
void SimonState::render_string(uint num_1, uint color, uint width, uint height, const char *txt) { void SimonEngine::render_string(uint num_1, uint color, uint width, uint height, const char *txt) {
VgaPointersEntry *vpe = &_vga_buffer_pointers[2]; VgaPointersEntry *vpe = &_vga_buffer_pointers[2];
byte *src, *dst, *p, *dst_org, chr; byte *src, *dst, *p, *dst_org, chr;
uint count; uint count;
@ -127,7 +127,7 @@ void SimonState::render_string(uint num_1, uint color, uint width, uint height,
} }
} }
void SimonState::showMessageFormat(const char *s, ...) { void SimonEngine::showMessageFormat(const char *s, ...) {
char buf[1024], *str; char buf[1024], *str;
va_list va; va_list va;
@ -150,7 +150,7 @@ void SimonState::showMessageFormat(const char *s, ...) {
showmessage_print_char(*str); showmessage_print_char(*str);
} }
void SimonState::showmessage_print_char(byte chr) { void SimonEngine::showmessage_print_char(byte chr) {
if (chr == 12) { if (chr == 12) {
_num_letters_to_print = 0; _num_letters_to_print = 0;
_print_char_unk_1 = 0; _print_char_unk_1 = 0;
@ -190,20 +190,20 @@ void SimonState::showmessage_print_char(byte chr) {
} }
} }
void SimonState::showmessage_helper_2() { void SimonEngine::showmessage_helper_2() {
if (_fcs_ptr_1) if (_fcs_ptr_1)
return; return;
_fcs_ptr_1 = fcs_alloc(8, 0x90, 0x18, 6, 1, 0, 0xF); _fcs_ptr_1 = fcs_alloc(8, 0x90, 0x18, 6, 1, 0, 0xF);
} }
void SimonState::showmessage_helper_3(uint a, uint b) { void SimonEngine::showmessage_helper_3(uint a, uint b) {
_print_char_unk_1 = a; _print_char_unk_1 = a;
_print_char_unk_2 = b; _print_char_unk_2 = b;
_num_letters_to_print = 0; _num_letters_to_print = 0;
} }
void SimonState::video_putchar(FillOrCopyStruct *fcs, byte c) { void SimonEngine::video_putchar(FillOrCopyStruct *fcs, byte c) {
if (c == 0xC) { if (c == 0xC) {
video_fill_or_copy_from_3_to_2(fcs); video_fill_or_copy_from_3_to_2(fcs);
} else if (c == 0xD || c == 0xA) { } else if (c == 0xD || c == 0xA) {
@ -240,7 +240,7 @@ void SimonState::video_putchar(FillOrCopyStruct *fcs, byte c) {
} }
} }
void SimonState::video_putchar_newline(FillOrCopyStruct *fcs) { void SimonEngine::video_putchar_newline(FillOrCopyStruct *fcs) {
fcs->textColumnOffset = 0; fcs->textColumnOffset = 0;
fcs->textLength = 0; fcs->textLength = 0;
fcs->textColumn = 0; fcs->textColumn = 0;
@ -855,7 +855,7 @@ static const byte video_font[] = {
240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240,
}; };
void SimonState::video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y, byte chr) { void SimonEngine::video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y, byte chr) {
const byte *src; const byte *src;
byte color, *dst; byte color, *dst;
uint h, i; uint h, i;

View file

@ -30,7 +30,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
byte *SimonState::dumpOpcode(byte *p) { byte *SimonEngine::dumpOpcode(byte *p) {
byte opcode; byte opcode;
const char *s, *st; const char *s, *st;
@ -132,7 +132,7 @@ byte *SimonState::dumpOpcode(byte *p) {
} }
} }
void SimonState::dumpSubroutineLine(SubroutineLine *sl, Subroutine *sub) { void SimonEngine::dumpSubroutineLine(SubroutineLine *sl, Subroutine *sub) {
byte *p; byte *p;
printf("; ****\n"); printf("; ****\n");
@ -150,7 +150,7 @@ void SimonState::dumpSubroutineLine(SubroutineLine *sl, Subroutine *sub) {
} }
} }
void SimonState::dumpSubroutine(Subroutine *sub) { void SimonEngine::dumpSubroutine(Subroutine *sub) {
SubroutineLine *sl; SubroutineLine *sl;
fprintf(_dump_file, "\n******************************************\n;Subroutine, ID=%d:\nSUB_%d:\n", sub->id, sub->id); fprintf(_dump_file, "\n******************************************\n;Subroutine, ID=%d:\nSUB_%d:\n", sub->id, sub->id);
@ -162,14 +162,14 @@ void SimonState::dumpSubroutine(Subroutine *sub) {
fflush(_dump_file); fflush(_dump_file);
} }
void SimonState::dumpSubroutines() { void SimonEngine::dumpSubroutines() {
Subroutine *sub = _subroutine_list; Subroutine *sub = _subroutine_list;
for (; sub; sub = sub->next) { for (; sub; sub = sub->next) {
dumpSubroutine(sub); dumpSubroutine(sub);
} }
} }
void SimonState::dump_video_script(byte *src, bool one_opcode_only) { void SimonEngine::dump_video_script(byte *src, bool one_opcode_only) {
uint opcode; uint opcode;
const char *str, *strn; const char *str, *strn;
@ -233,7 +233,7 @@ void SimonState::dump_video_script(byte *src, bool one_opcode_only) {
} while (!one_opcode_only); } while (!one_opcode_only);
} }
void SimonState::dump_vga_file(byte *vga) { void SimonEngine::dump_vga_file(byte *vga) {
{ {
byte *pp; byte *pp;
byte *p; byte *p;
@ -351,7 +351,7 @@ void dump_bitmap(const char *filename, byte *offs, int w, int h, int flags, cons
free(b); free(b);
} }
void SimonState::dump_single_bitmap(int file, int image, byte *offs, int w, int h, byte base) { void SimonEngine::dump_single_bitmap(int file, int image, byte *offs, int w, int h, byte base) {
/* Only supported for win32 atm. mkdir doesn't work otherwise. */ /* Only supported for win32 atm. mkdir doesn't work otherwise. */
#if defined (WIN32) && !defined(_WIN32_WCE) #if defined (WIN32) && !defined(_WIN32_WCE)
char buf[255], buf2[255]; char buf[255], buf2[255];
@ -389,7 +389,7 @@ void pal_load(byte *pal, const byte *vga1, int a, int b) {
} while (--num); } while (--num);
} }
void SimonState::dump_vga_bitmaps(byte *vga, byte *vga1, int res) { void SimonEngine::dump_vga_bitmaps(byte *vga, byte *vga1, int res) {
/* Only supported for win32 atm. mkdir doesn't work otherwise. */ /* Only supported for win32 atm. mkdir doesn't work otherwise. */
#if defined (WIN32) && !defined(_WIN32_WCE) #if defined (WIN32) && !defined(_WIN32_WCE)
@ -444,14 +444,14 @@ void SimonState::dump_vga_bitmaps(byte *vga, byte *vga1, int res) {
#endif #endif
} }
void SimonState::dump_vga_script_always(byte *ptr, uint res, uint sprite_id) { void SimonEngine::dump_vga_script_always(byte *ptr, uint res, uint sprite_id) {
fprintf(_dump_file, "; address=%x, vgafile=%d vgasprite=%d\n", fprintf(_dump_file, "; address=%x, vgafile=%d vgasprite=%d\n",
ptr - _vga_buffer_pointers[res].vgaFile1, res, sprite_id); ptr - _vga_buffer_pointers[res].vgaFile1, res, sprite_id);
dump_video_script(ptr, false); dump_video_script(ptr, false);
fprintf(_dump_file, "; end\n"); fprintf(_dump_file, "; end\n");
} }
void SimonState::dump_vga_script(byte *ptr, uint res, uint sprite_id) { void SimonEngine::dump_vga_script(byte *ptr, uint res, uint sprite_id) {
dump_vga_script_always(ptr, res, sprite_id); dump_vga_script_always(ptr, res, sprite_id);
} }

View file

@ -32,7 +32,7 @@ extern void force_keyboard(bool);
#endif #endif
int SimonState::runScript() { int SimonEngine::runScript() {
byte opcode; byte opcode;
bool flag, condition; bool flag, condition;
@ -1092,7 +1092,7 @@ int SimonState::runScript() {
return 0; return 0;
} }
int SimonState::startSubroutine(Subroutine *sub) { int SimonEngine::startSubroutine(Subroutine *sub) {
int result = -1; int result = -1;
SubroutineLine *sl; SubroutineLine *sl;
byte *old_code_ptr; byte *old_code_ptr;
@ -1138,12 +1138,12 @@ int SimonState::startSubroutine(Subroutine *sub) {
return result; return result;
} }
int SimonState::startSubroutineEx(Subroutine *sub) { int SimonEngine::startSubroutineEx(Subroutine *sub) {
_item_1_ptr = _item_1; _item_1_ptr = _item_1;
return startSubroutine(sub); return startSubroutine(sub);
} }
bool SimonState::checkIfToRunSubroutineLine(SubroutineLine *sl, Subroutine *sub) { bool SimonEngine::checkIfToRunSubroutineLine(SubroutineLine *sl, Subroutine *sub) {
if (sub->id) if (sub->id)
return true; return true;
@ -1162,7 +1162,7 @@ bool SimonState::checkIfToRunSubroutineLine(SubroutineLine *sl, Subroutine *sub)
return true; return true;
} }
void SimonState::o_83_helper() { void SimonEngine::o_83_helper() {
if (_exit_cutscene) { if (_exit_cutscene) {
if (vc_get_bit(9)) { if (vc_get_bit(9)) {
startSubroutine170(); startSubroutine170();
@ -1172,7 +1172,7 @@ void SimonState::o_83_helper() {
} }
} }
void SimonState::o_190_helper(uint i) { void SimonEngine::o_190_helper(uint i) {
_exit_cutscene = false; _exit_cutscene = false;
while (!(_op_189_flags & (1 << i))) { while (!(_op_189_flags & (1 << i))) {
if (_exit_cutscene) { if (_exit_cutscene) {
@ -1189,7 +1189,7 @@ void SimonState::o_190_helper(uint i) {
} }
bool SimonState::o_unk_23(uint a) { bool SimonEngine::o_unk_23(uint a) {
if (a == 0) if (a == 0)
return 0; return 0;
@ -1218,7 +1218,7 @@ bool SimonState::o_unk_23(uint a) {
return 0; return 0;
} }
void SimonState::o_inventory_descriptions() { void SimonEngine::o_inventory_descriptions() {
uint a = getVarOrByte(); uint a = getVarOrByte();
uint b = getVarOrByte(); uint b = getVarOrByte();
const char *s = NULL; const char *s = NULL;
@ -1304,7 +1304,7 @@ void SimonState::o_inventory_descriptions() {
} }
} }
void SimonState::o_quit_if_user_presses_y() { void SimonEngine::o_quit_if_user_presses_y() {
for (;;) { for (;;) {
delay(1); delay(1);
if (_key_pressed == 'f' && _language == 20) // Hebrew if (_key_pressed == 'f' && _language == 20) // Hebrew
@ -1325,7 +1325,7 @@ void SimonState::o_quit_if_user_presses_y() {
get_out:; get_out:;
} }
void SimonState::o_unk_137(uint fcs_index) { void SimonEngine::o_unk_137(uint fcs_index) {
FillOrCopyStruct *fcs; FillOrCopyStruct *fcs;
fcs = _fcs_ptr_array_3[fcs_index & 7]; fcs = _fcs_ptr_array_3[fcs_index & 7];
@ -1334,27 +1334,27 @@ void SimonState::o_unk_137(uint fcs_index) {
fcs_unk_proc_1(fcs_index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1, fcs->fcs_data->unk2); fcs_unk_proc_1(fcs_index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1, fcs->fcs_data->unk2);
} }
void SimonState::o_unk_138() { void SimonEngine::o_unk_138() {
_vga_buf_start = _vga_buf_free_start; _vga_buf_start = _vga_buf_free_start;
_vga_file_buf_org = _vga_buf_free_start; _vga_file_buf_org = _vga_buf_free_start;
} }
void SimonState::o_unk_186() { void SimonEngine::o_unk_186() {
_vga_buf_free_start = _vga_file_buf_org_2; _vga_buf_free_start = _vga_file_buf_org_2;
_vga_buf_start = _vga_file_buf_org_2; _vga_buf_start = _vga_file_buf_org_2;
_vga_file_buf_org = _vga_file_buf_org_2; _vga_file_buf_org = _vga_file_buf_org_2;
} }
void SimonState::o_unk_175() { void SimonEngine::o_unk_175() {
_vga_buf_start = _vga_buf_free_start; _vga_buf_start = _vga_buf_free_start;
} }
void SimonState::o_unk_176() { void SimonEngine::o_unk_176() {
_vga_buf_free_start = _vga_file_buf_org; _vga_buf_free_start = _vga_file_buf_org;
_vga_buf_start = _vga_file_buf_org; _vga_buf_start = _vga_file_buf_org;
} }
int SimonState::o_unk_132_helper(bool *b, char *buf) { int SimonEngine::o_unk_132_helper(bool *b, char *buf) {
HitArea *ha; HitArea *ha;
*b = true; *b = true;
@ -1414,12 +1414,12 @@ start_over_2:;
return ha->id - 208; return ha->id - 208;
} }
void SimonState::o_unk_132_helper_3() { void SimonEngine::o_unk_132_helper_3() {
for (int i = 208; i != 208 + 6; i++) for (int i = 208; i != 208 + 6; i++)
set_hitarea_bit_0x40(i); set_hitarea_bit_0x40(i);
} }
void SimonState::o_unk_132_helper_2(FillOrCopyStruct *fcs, int x) { void SimonEngine::o_unk_132_helper_2(FillOrCopyStruct *fcs, int x) {
byte old_text; byte old_text;
video_putchar(fcs, x); video_putchar(fcs, x);
@ -1435,7 +1435,7 @@ void SimonState::o_unk_132_helper_2(FillOrCopyStruct *fcs, int x) {
video_putchar(fcs, 8); video_putchar(fcs, 8);
} }
void SimonState::o_play_music_resource() { void SimonEngine::o_play_music_resource() {
int music = getVarOrWord(); int music = getVarOrWord();
int track = getVarOrWord(); int track = getVarOrWord();
@ -1464,7 +1464,7 @@ void SimonState::o_play_music_resource() {
} }
} }
void SimonState::o_unk_120(uint a) { void SimonEngine::o_unk_120(uint a) {
uint16 id = TO_BE_16(a); uint16 id = TO_BE_16(a);
if (_game & GF_SIMON2) { if (_game & GF_SIMON2) {
_lock_word |= 0x8000; _lock_word |= 0x8000;
@ -1479,25 +1479,25 @@ void SimonState::o_unk_120(uint a) {
} }
} }
void SimonState::o_unk_163(uint a) { void SimonEngine::o_unk_163(uint a) {
if (_game == GAME_SIMON1DOS) if (_game == GAME_SIMON1DOS)
playSting(a); playSting(a);
else else
_sound->playEffects(a); _sound->playEffects(a);
} }
void SimonState::o_unk_160(uint a) { void SimonEngine::o_unk_160(uint a) {
fcs_setTextColor(_fcs_ptr_array_3[_fcs_unk_1], a); fcs_setTextColor(_fcs_ptr_array_3[_fcs_unk_1], a);
} }
void SimonState::o_unk_103() { void SimonEngine::o_unk_103() {
lock(); lock();
fcs_unk1(_fcs_unk_1); fcs_unk1(_fcs_unk_1);
showMessageFormat("\x0C"); showMessageFormat("\x0C");
unlock(); unlock();
} }
void SimonState::o_kill_sprite_simon1(uint a) { void SimonEngine::o_kill_sprite_simon1(uint a) {
uint16 b = TO_BE_16(a); uint16 b = TO_BE_16(a);
_lock_word |= 0x4000; _lock_word |= 0x4000;
_vc_ptr = (byte *)&b; _vc_ptr = (byte *)&b;
@ -1505,7 +1505,7 @@ void SimonState::o_kill_sprite_simon1(uint a) {
_lock_word &= ~0x4000; _lock_word &= ~0x4000;
} }
void SimonState::o_kill_sprite_simon2(uint a, uint b) { void SimonEngine::o_kill_sprite_simon2(uint a, uint b) {
uint16 items[2]; uint16 items[2];
items[0] = TO_BE_16(a); items[0] = TO_BE_16(a);
@ -1518,7 +1518,7 @@ void SimonState::o_kill_sprite_simon2(uint a, uint b) {
} }
/* OK */ /* OK */
void SimonState::o_unk26_helper(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h) { void SimonEngine::o_unk26_helper(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h) {
a &= 7; a &= 7;
if (_fcs_ptr_array_3[a]) if (_fcs_ptr_array_3[a])

View file

@ -94,7 +94,7 @@ static const char *const opcode_arg_table_simon2dos[256] = {
" ", " ", "BT ", " ", "B " " ", " ", "BT ", " ", "B "
}; };
void SimonState::loadGamePcFile(const char *filename) { void SimonEngine::loadGamePcFile(const char *filename) {
File * in = new File(); File * in = new File();
int num_inited_objects; int num_inited_objects;
int i, file_size; int i, file_size;
@ -160,7 +160,7 @@ void SimonState::loadGamePcFile(const char *filename) {
in->close(); in->close();
} }
void SimonState::readGamePcText(File *in) { void SimonEngine::readGamePcText(File *in) {
uint text_size; uint text_size;
byte *text_mem; byte *text_mem;
@ -174,7 +174,7 @@ void SimonState::readGamePcText(File *in) {
setupStringTable(text_mem, _stringtab_num); setupStringTable(text_mem, _stringtab_num);
} }
void SimonState::readItemFromGamePc(File *in, Item *item) { void SimonEngine::readItemFromGamePc(File *in, Item *item) {
uint32 type; uint32 type;
item->unk2 = in->readUint16BE(); item->unk2 = in->readUint16BE();
@ -195,7 +195,7 @@ void SimonState::readItemFromGamePc(File *in, Item *item) {
} }
} }
void SimonState::readItemChildren(File *in, Item *item, uint type) { void SimonEngine::readItemChildren(File *in, Item *item, uint type) {
if (type == 1) { if (type == 1) {
uint fr1 = in->readUint16BE(); uint fr1 = in->readUint16BE();
uint fr2 = in->readUint16BE(); uint fr2 = in->readUint16BE();
@ -249,7 +249,7 @@ uint fileReadItemID(File *in) {
return val + 2; return val + 2;
} }
byte *SimonState::readSingleOpcode(File *in, byte *ptr) { byte *SimonEngine::readSingleOpcode(File *in, byte *ptr) {
int i, l; int i, l;
const char *string_ptr; const char *string_ptr;
uint val; uint val;

File diff suppressed because it is too large Load diff

View file

@ -101,7 +101,7 @@ struct VgaTimerEntry {
struct GameSpecificSettings; struct GameSpecificSettings;
class SimonState : public Engine { class SimonEngine : public Engine {
void errorString(const char *buf_input, char *buf_output); void errorString(const char *buf_input, char *buf_output);
public: public:
File *_mus_file; File *_mus_file;
@ -356,8 +356,8 @@ public:
RandomSource _rnd; RandomSource _rnd;
SimonState(GameDetector *detector, OSystem *syst); SimonEngine(GameDetector *detector, OSystem *syst);
virtual ~SimonState(); virtual ~SimonEngine();
int allocGamePcVars(File *in); int allocGamePcVars(File *in);
Item *allocItem1(); Item *allocItem1();

View file

@ -77,7 +77,7 @@ static const char *const english_verb_prep_names[] = {
"", "", "", "to whom ?" "", "", "", "to whom ?"
}; };
void SimonState::defocusHitarea() { void SimonEngine::defocusHitarea() {
HitArea *last; HitArea *last;
HitArea *ha; HitArea *ha;
@ -102,7 +102,7 @@ void SimonState::defocusHitarea() {
focusVerb(last->id); focusVerb(last->id);
} }
void SimonState::focusVerb(uint hitarea_id) { void SimonEngine::focusVerb(uint hitarea_id) {
uint x; uint x;
const char *txt; const char *txt;
const char * const *verb_prep_names; const char * const *verb_prep_names;
@ -128,7 +128,7 @@ void SimonState::focusVerb(uint hitarea_id) {
showActionString(x, (const byte *)txt); showActionString(x, (const byte *)txt);
} }
void SimonState::showActionString(uint x, const byte *string) { void SimonEngine::showActionString(uint x, const byte *string) {
FillOrCopyStruct *fcs; FillOrCopyStruct *fcs;
fcs = _fcs_ptr_array_3[1]; fcs = _fcs_ptr_array_3[1];
@ -142,7 +142,7 @@ void SimonState::showActionString(uint x, const byte *string) {
video_putchar(fcs, *string); video_putchar(fcs, *string);
} }
void SimonState::hitareaChangedHelper() { void SimonEngine::hitareaChangedHelper() {
FillOrCopyStruct *fcs; FillOrCopyStruct *fcs;
if (_game & GF_SIMON2) { if (_game & GF_SIMON2) {
@ -158,7 +158,7 @@ void SimonState::hitareaChangedHelper() {
_hitarea_ptr_7 = NULL; _hitarea_ptr_7 = NULL;
} }
HitArea *SimonState::findHitAreaByID(uint hitarea_id) { HitArea *SimonEngine::findHitAreaByID(uint hitarea_id) {
HitArea *ha = _hit_areas; HitArea *ha = _hit_areas;
uint count = ARRAYSIZE(_hit_areas); uint count = ARRAYSIZE(_hit_areas);
@ -169,7 +169,7 @@ HitArea *SimonState::findHitAreaByID(uint hitarea_id) {
return NULL; return NULL;
} }
HitArea *SimonState::findEmptyHitArea() { HitArea *SimonEngine::findEmptyHitArea() {
HitArea *ha = _hit_areas; HitArea *ha = _hit_areas;
uint count = ARRAYSIZE(_hit_areas); uint count = ARRAYSIZE(_hit_areas);
@ -180,13 +180,13 @@ HitArea *SimonState::findEmptyHitArea() {
return NULL; return NULL;
} }
void SimonState::clear_hitarea_bit_0x40(uint hitarea) { void SimonEngine::clear_hitarea_bit_0x40(uint hitarea) {
HitArea *ha = findHitAreaByID(hitarea); HitArea *ha = findHitAreaByID(hitarea);
if (ha != NULL) if (ha != NULL)
ha->flags &= ~0x40; ha->flags &= ~0x40;
} }
void SimonState::set_hitarea_bit_0x40(uint hitarea) { void SimonEngine::set_hitarea_bit_0x40(uint hitarea) {
HitArea *ha = findHitAreaByID(hitarea); HitArea *ha = findHitAreaByID(hitarea);
if (ha != NULL) { if (ha != NULL) {
ha->flags |= 0x40; ha->flags |= 0x40;
@ -196,7 +196,7 @@ void SimonState::set_hitarea_bit_0x40(uint hitarea) {
} }
} }
void SimonState::set_hitarea_x_y(uint hitarea, int x, int y) { void SimonEngine::set_hitarea_x_y(uint hitarea, int x, int y) {
HitArea *ha = findHitAreaByID(hitarea); HitArea *ha = findHitAreaByID(hitarea);
if (ha != NULL) { if (ha != NULL) {
ha->x = x; ha->x = x;
@ -204,7 +204,7 @@ void SimonState::set_hitarea_x_y(uint hitarea, int x, int y) {
} }
} }
void SimonState::delete_hitarea(uint hitarea) { void SimonEngine::delete_hitarea(uint hitarea) {
HitArea *ha = findHitAreaByID(hitarea); HitArea *ha = findHitAreaByID(hitarea);
if (ha != NULL) { if (ha != NULL) {
ha->flags = 0; ha->flags = 0;
@ -214,14 +214,14 @@ void SimonState::delete_hitarea(uint hitarea) {
} }
} }
bool SimonState::is_hitarea_0x40_clear(uint hitarea) { bool SimonEngine::is_hitarea_0x40_clear(uint hitarea) {
HitArea *ha = findHitAreaByID(hitarea); HitArea *ha = findHitAreaByID(hitarea);
if (ha == NULL) if (ha == NULL)
return false; return false;
return (ha->flags & 0x40) == 0; return (ha->flags & 0x40) == 0;
} }
void SimonState::addNewHitArea(int id, int x, int y, int width, int height, int flags, int unk3, Item *item_ptr) { void SimonEngine::addNewHitArea(int id, int x, int y, int width, int height, int flags, int unk3, Item *item_ptr) {
HitArea *ha; HitArea *ha;
delete_hitarea(id); delete_hitarea(id);
@ -238,7 +238,7 @@ void SimonState::addNewHitArea(int id, int x, int y, int width, int height, int
_need_hitarea_recalc++; _need_hitarea_recalc++;
} }
void SimonState::hitarea_proc_1() { void SimonEngine::hitarea_proc_1() {
uint id; uint id;
HitArea *ha; HitArea *ha;
@ -265,7 +265,7 @@ void SimonState::hitarea_proc_1() {
} }
} }
void SimonState::handle_verb_hitarea(HitArea *ha) { void SimonEngine::handle_verb_hitarea(HitArea *ha) {
HitArea *tmp = _hitarea_ptr_5; HitArea *tmp = _hitarea_ptr_5;
if (ha == tmp) if (ha == tmp)
@ -293,7 +293,7 @@ void SimonState::handle_verb_hitarea(HitArea *ha) {
_hitarea_ptr_5 = ha; _hitarea_ptr_5 = ha;
} }
void SimonState::hitarea_leave(HitArea *ha) { void SimonEngine::hitarea_leave(HitArea *ha) {
if (!(_game & GF_SIMON2)) { if (!(_game & GF_SIMON2)) {
video_toggle_colors(ha, 0xdf, 0xd5, 0xda, 5); video_toggle_colors(ha, 0xdf, 0xd5, 0xda, 5);
} else { } else {
@ -301,13 +301,13 @@ void SimonState::hitarea_leave(HitArea *ha) {
} }
} }
void SimonState::leaveHitAreaById(uint hitarea_id) { void SimonEngine::leaveHitAreaById(uint hitarea_id) {
HitArea *ha = findHitAreaByID(hitarea_id); HitArea *ha = findHitAreaByID(hitarea_id);
if (ha) if (ha)
hitarea_leave(ha); hitarea_leave(ha);
} }
void SimonState::handle_uparrow_hitarea(FillOrCopyStruct *fcs) { void SimonEngine::handle_uparrow_hitarea(FillOrCopyStruct *fcs) {
uint index; uint index;
index = get_fcs_ptr_3_index(fcs); index = get_fcs_ptr_3_index(fcs);
@ -320,7 +320,7 @@ void SimonState::handle_uparrow_hitarea(FillOrCopyStruct *fcs) {
unlock(); unlock();
} }
void SimonState::handle_downarrow_hitarea(FillOrCopyStruct *fcs) { void SimonEngine::handle_downarrow_hitarea(FillOrCopyStruct *fcs) {
uint index; uint index;
index = get_fcs_ptr_3_index(fcs); index = get_fcs_ptr_3_index(fcs);
@ -330,7 +330,7 @@ void SimonState::handle_downarrow_hitarea(FillOrCopyStruct *fcs) {
unlock(); unlock();
} }
void SimonState::setup_hitarea_from_pos(uint x, uint y, uint mode) { void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) {
HitArea *best_ha; HitArea *best_ha;
HitArea *ha = _hit_areas; HitArea *ha = _hit_areas;
uint count = ARRAYSIZE(_hit_areas); uint count = ARRAYSIZE(_hit_areas);
@ -390,7 +390,7 @@ void SimonState::setup_hitarea_from_pos(uint x, uint y, uint mode) {
return; return;
} }
void SimonState::new_current_hitarea(HitArea *ha) { void SimonEngine::new_current_hitarea(HitArea *ha) {
bool result; bool result;
hitareaChangedHelper(); hitareaChangedHelper();
@ -404,7 +404,7 @@ void SimonState::new_current_hitarea(HitArea *ha) {
_last_hitarea_2_ptr = ha; _last_hitarea_2_ptr = ha;
} }
bool SimonState::hitarea_proc_2(uint a) { bool SimonEngine::hitarea_proc_2(uint a) {
uint x; uint x;
const byte *string_ptr; const byte *string_ptr;
@ -433,7 +433,7 @@ bool SimonState::hitarea_proc_2(uint a) {
return true; return true;
} }
bool SimonState::hitarea_proc_3(Item *item) { bool SimonEngine::hitarea_proc_3(Item *item) {
Child2 *child2; Child2 *child2;
uint x; uint x;
const byte *string_ptr; const byte *string_ptr;

View file

@ -25,90 +25,90 @@
#include "simon/intern.h" #include "simon/intern.h"
#include "simon/vga.h" #include "simon/vga.h"
typedef void (SimonState::*VgaOpcodeProc) (); typedef void (SimonEngine::*VgaOpcodeProc) ();
static uint16 vc_get_out_of_code = 0; static uint16 vc_get_out_of_code = 0;
// Opcode tables // Opcode tables
static const VgaOpcodeProc vga_opcode_table[] = { static const VgaOpcodeProc vga_opcode_table[] = {
NULL, NULL,
&SimonState::vc_1_dummy_op, &SimonEngine::vc_1_dummy_op,
&SimonState::vc_2_call, &SimonEngine::vc_2_call,
&SimonState::vc_3_new_sprite, &SimonEngine::vc_3_new_sprite,
&SimonState::vc_4_dummy_op, &SimonEngine::vc_4_dummy_op,
&SimonState::vc_5_skip_if_neq, &SimonEngine::vc_5_skip_if_neq,
&SimonState::vc_6_skip_ifn_sib_with_a, &SimonEngine::vc_6_skip_ifn_sib_with_a,
&SimonState::vc_7_skip_if_sib_with_a, &SimonEngine::vc_7_skip_if_sib_with_a,
&SimonState::vc_8_skip_if_parent_is, &SimonEngine::vc_8_skip_if_parent_is,
&SimonState::vc_9_skip_if_unk3_is, &SimonEngine::vc_9_skip_if_unk3_is,
&SimonState::vc_10_draw, &SimonEngine::vc_10_draw,
&SimonState::vc_11_clear_pathfind_array, &SimonEngine::vc_11_clear_pathfind_array,
&SimonState::vc_12_delay, &SimonEngine::vc_12_delay,
&SimonState::vc_13_set_sprite_offset_x, &SimonEngine::vc_13_set_sprite_offset_x,
&SimonState::vc_14_set_sprite_offset_y, &SimonEngine::vc_14_set_sprite_offset_y,
&SimonState::vc_15_wakeup_id, &SimonEngine::vc_15_wakeup_id,
&SimonState::vc_16_sleep_on_id, &SimonEngine::vc_16_sleep_on_id,
&SimonState::vc_17_set_pathfind_item, &SimonEngine::vc_17_set_pathfind_item,
&SimonState::vc_18_jump_rel, &SimonEngine::vc_18_jump_rel,
&SimonState::vc_19_chain_to_script, &SimonEngine::vc_19_chain_to_script,
&SimonState::vc_20_set_code_word, &SimonEngine::vc_20_set_code_word,
&SimonState::vc_21_jump_if_code_word, &SimonEngine::vc_21_jump_if_code_word,
&SimonState::vc_22_set_sprite_palette, &SimonEngine::vc_22_set_sprite_palette,
&SimonState::vc_23_set_sprite_priority, &SimonEngine::vc_23_set_sprite_priority,
&SimonState::vc_24_set_sprite_xy, &SimonEngine::vc_24_set_sprite_xy,
&SimonState::vc_25_halt_sprite, &SimonEngine::vc_25_halt_sprite,
&SimonState::vc_26_set_window, &SimonEngine::vc_26_set_window,
&SimonState::vc_27_reset, &SimonEngine::vc_27_reset,
&SimonState::vc_28_dummy_op, &SimonEngine::vc_28_dummy_op,
&SimonState::vc_29_stop_all_sounds, &SimonEngine::vc_29_stop_all_sounds,
&SimonState::vc_30_set_base_delay, &SimonEngine::vc_30_set_base_delay,
&SimonState::vc_31_set_palette_mode, &SimonEngine::vc_31_set_palette_mode,
&SimonState::vc_32_copy_var, &SimonEngine::vc_32_copy_var,
&SimonState::vc_33_force_unlock, &SimonEngine::vc_33_force_unlock,
&SimonState::vc_34_force_lock, &SimonEngine::vc_34_force_lock,
&SimonState::vc_35, &SimonEngine::vc_35,
&SimonState::vc_36_saveload_thing, &SimonEngine::vc_36_saveload_thing,
&SimonState::vc_37_set_sprite_offset_y, &SimonEngine::vc_37_set_sprite_offset_y,
&SimonState::vc_38_skip_if_var_zero, &SimonEngine::vc_38_skip_if_var_zero,
&SimonState::vc_39_set_var, &SimonEngine::vc_39_set_var,
&SimonState::vc_40_var_add, &SimonEngine::vc_40_var_add,
&SimonState::vc_41_var_sub, &SimonEngine::vc_41_var_sub,
&SimonState::vc_42_delay_if_not_eq, &SimonEngine::vc_42_delay_if_not_eq,
&SimonState::vc_43_skip_if_bit_clear, &SimonEngine::vc_43_skip_if_bit_clear,
&SimonState::vc_44_skip_if_bit_set, &SimonEngine::vc_44_skip_if_bit_set,
&SimonState::vc_45_set_sprite_x, &SimonEngine::vc_45_set_sprite_x,
&SimonState::vc_46_set_sprite_y, &SimonEngine::vc_46_set_sprite_y,
&SimonState::vc_47_add_var_f, &SimonEngine::vc_47_add_var_f,
&SimonState::vc_48, &SimonEngine::vc_48,
&SimonState::vc_49_set_bit, &SimonEngine::vc_49_set_bit,
&SimonState::vc_50_clear_bit, &SimonEngine::vc_50_clear_bit,
&SimonState::vc_51_clear_hitarea_bit_0x40, &SimonEngine::vc_51_clear_hitarea_bit_0x40,
&SimonState::vc_52_play_sound, &SimonEngine::vc_52_play_sound,
&SimonState::vc_53_no_op, &SimonEngine::vc_53_no_op,
&SimonState::vc_54_no_op, &SimonEngine::vc_54_no_op,
&SimonState::vc_55_offset_hit_area, &SimonEngine::vc_55_offset_hit_area,
&SimonState::vc_56, &SimonEngine::vc_56,
&SimonState::vc_57_no_op, &SimonEngine::vc_57_no_op,
&SimonState::vc_58, &SimonEngine::vc_58,
&SimonState::vc_59, &SimonEngine::vc_59,
&SimonState::vc_60_kill_sprite, &SimonEngine::vc_60_kill_sprite,
&SimonState::vc_61_sprite_change, &SimonEngine::vc_61_sprite_change,
&SimonState::vc_62_palette_thing, &SimonEngine::vc_62_palette_thing,
&SimonState::vc_63_palette_thing_2, &SimonEngine::vc_63_palette_thing_2,
&SimonState::vc_64_skip_if_no_speech, &SimonEngine::vc_64_skip_if_no_speech,
&SimonState::vc_65_palette_thing_3, &SimonEngine::vc_65_palette_thing_3,
&SimonState::vc_66_skip_if_nz, &SimonEngine::vc_66_skip_if_nz,
&SimonState::vc_67_skip_if_ge, &SimonEngine::vc_67_skip_if_ge,
&SimonState::vc_68_skip_if_le, &SimonEngine::vc_68_skip_if_le,
&SimonState::vc_69_play_track, &SimonEngine::vc_69_play_track,
&SimonState::vc_70_queue_music, &SimonEngine::vc_70_queue_music,
&SimonState::vc_71_check_music_queue, &SimonEngine::vc_71_check_music_queue,
&SimonState::vc_72_play_track_2, &SimonEngine::vc_72_play_track_2,
&SimonState::vc_73_set_op189_flag, &SimonEngine::vc_73_set_op189_flag,
&SimonState::vc_74_clear_op189_flag, &SimonEngine::vc_74_clear_op189_flag,
}; };
// Script parser // Script parser
void SimonState::run_vga_script() { void SimonEngine::run_vga_script() {
for (;;) { for (;;) {
uint opcode; uint opcode;
@ -136,24 +136,24 @@ void SimonState::run_vga_script() {
} }
} }
int SimonState::vc_read_var_or_word() { int SimonEngine::vc_read_var_or_word() {
int16 var = vc_read_next_word(); int16 var = vc_read_next_word();
if (var < 0) if (var < 0)
var = vc_read_var(-var); var = vc_read_var(-var);
return var; return var;
} }
uint SimonState::vc_read_next_word() { uint SimonEngine::vc_read_next_word() {
uint a = READ_BE_UINT16_UNALIGNED(_vc_ptr); uint a = READ_BE_UINT16_UNALIGNED(_vc_ptr);
_vc_ptr += 2; _vc_ptr += 2;
return a; return a;
} }
uint SimonState::vc_read_next_byte() { uint SimonEngine::vc_read_next_byte() {
return *_vc_ptr++; return *_vc_ptr++;
} }
void SimonState::vc_skip_next_instruction() { void SimonEngine::vc_skip_next_instruction() {
static const byte opcode_param_len_simon1[] = { static const byte opcode_param_len_simon1[] = {
0, 6, 2, 10, 6, 4, 2, 2, 0, 6, 2, 10, 6, 4, 2, 2,
4, 4, 10, 0, 2, 2, 2, 2, 4, 4, 10, 0, 2, 2, 2, 2,
@ -190,7 +190,7 @@ void SimonState::vc_skip_next_instruction() {
fprintf(_dump_file, "; skipped\n"); fprintf(_dump_file, "; skipped\n");
} }
void SimonState::o_read_vgares_23() { void SimonEngine::o_read_vgares_23() {
// Simon1 Only // Simon1 Only
if (_vga_res_328_loaded == true) { if (_vga_res_328_loaded == true) {
_vga_res_328_loaded = false; _vga_res_328_loaded = false;
@ -200,7 +200,7 @@ void SimonState::o_read_vgares_23() {
} }
} }
void SimonState::o_read_vgares_328() { void SimonEngine::o_read_vgares_328() {
// Simon1 Only // Simon1 Only
if (_vga_res_328_loaded == false) { if (_vga_res_328_loaded == false) {
_vga_res_328_loaded = true; _vga_res_328_loaded = true;
@ -211,12 +211,12 @@ void SimonState::o_read_vgares_328() {
} }
// VGA Script commands // VGA Script commands
void SimonState::vc_1_dummy_op() { void SimonEngine::vc_1_dummy_op() {
/* dummy opcode */ /* dummy opcode */
_vc_ptr += 6; _vc_ptr += 6;
} }
void SimonState::vc_2_call() { void SimonEngine::vc_2_call() {
VgaPointersEntry *vpe; VgaPointersEntry *vpe;
uint num; uint num;
uint res; uint res;
@ -264,7 +264,7 @@ void SimonState::vc_2_call() {
_vc_ptr = vc_ptr_org; _vc_ptr = vc_ptr_org;
} }
void SimonState::vc_3_new_sprite() { void SimonEngine::vc_3_new_sprite() {
uint16 a, b, c, d, e, f; uint16 a, b, c, d, e, f;
uint16 res; uint16 res;
VgaSprite *vsp; VgaSprite *vsp;
@ -348,36 +348,36 @@ void SimonState::vc_3_new_sprite() {
add_vga_timer(gss->VGA_DELAY_BASE, _cur_vga_file_1 + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->script_offs), b, res); add_vga_timer(gss->VGA_DELAY_BASE, _cur_vga_file_1 + READ_BE_UINT16_UNALIGNED(&((VgaFile1Struct0x6 *) p)->script_offs), b, res);
} }
void SimonState::vc_4_dummy_op() { void SimonEngine::vc_4_dummy_op() {
/* dummy opcode */ /* dummy opcode */
_vc_ptr += 6; _vc_ptr += 6;
} }
void SimonState::vc_5_skip_if_neq() { void SimonEngine::vc_5_skip_if_neq() {
uint var = vc_read_next_word(); uint var = vc_read_next_word();
uint value = vc_read_next_word(); uint value = vc_read_next_word();
if (vc_read_var(var) != value) if (vc_read_var(var) != value)
vc_skip_next_instruction(); vc_skip_next_instruction();
} }
void SimonState::vc_6_skip_ifn_sib_with_a() { void SimonEngine::vc_6_skip_ifn_sib_with_a() {
if (!itemIsSiblingOf(vc_read_next_word())) if (!itemIsSiblingOf(vc_read_next_word()))
vc_skip_next_instruction(); vc_skip_next_instruction();
} }
void SimonState::vc_7_skip_if_sib_with_a() { void SimonEngine::vc_7_skip_if_sib_with_a() {
if (itemIsSiblingOf(vc_read_next_word())) if (itemIsSiblingOf(vc_read_next_word()))
vc_skip_next_instruction(); vc_skip_next_instruction();
} }
void SimonState::vc_8_skip_if_parent_is() { void SimonEngine::vc_8_skip_if_parent_is() {
uint a = vc_read_next_word(); uint a = vc_read_next_word();
uint b = vc_read_next_word(); uint b = vc_read_next_word();
if (!itemIsParentOf(a, b)) if (!itemIsParentOf(a, b))
vc_skip_next_instruction(); vc_skip_next_instruction();
} }
void SimonState::vc_9_skip_if_unk3_is() { void SimonEngine::vc_9_skip_if_unk3_is() {
uint a = vc_read_next_word(); uint a = vc_read_next_word();
uint b = vc_read_next_word(); uint b = vc_read_next_word();
if (!vc_maybe_skip_proc_1(a, b)) if (!vc_maybe_skip_proc_1(a, b))
@ -435,7 +435,7 @@ void vc_10_skip_cols(VC10_state *vs) {
} }
} }
byte *SimonState::vc_10_depack_swap(byte *src, uint w, uint h) { byte *SimonEngine::vc_10_depack_swap(byte *src, uint w, uint h) {
w <<= 3; w <<= 3;
{ {
@ -524,7 +524,7 @@ static uint16 _video_windows[128] = {
}; };
/* simon2 specific */ /* simon2 specific */
void SimonState::decodeStripA(byte *dst, byte *src, int height) { void SimonEngine::decodeStripA(byte *dst, byte *src, int height) {
const uint pitch = _dx_surface_pitch; const uint pitch = _dx_surface_pitch;
int8 reps = (int8)0x80; int8 reps = (int8)0x80;
byte color; byte color;
@ -568,7 +568,7 @@ void SimonState::decodeStripA(byte *dst, byte *src, int height) {
} }
} }
void SimonState::vc_10_draw() { void SimonEngine::vc_10_draw() {
byte *p2; byte *p2;
uint width, height; uint width, height;
byte flags; byte flags;
@ -965,11 +965,11 @@ void SimonState::vc_10_draw() {
} }
void SimonState::vc_11_clear_pathfind_array() { void SimonEngine::vc_11_clear_pathfind_array() {
memset(&_pathfind_array, 0, sizeof(_pathfind_array)); memset(&_pathfind_array, 0, sizeof(_pathfind_array));
} }
void SimonState::vc_12_delay() { void SimonEngine::vc_12_delay() {
uint num; uint num;
if (!(_game & GF_SIMON2)) { if (!(_game & GF_SIMON2)) {
@ -982,19 +982,19 @@ void SimonState::vc_12_delay() {
_vc_ptr = (byte *)&vc_get_out_of_code; _vc_ptr = (byte *)&vc_get_out_of_code;
} }
void SimonState::vc_13_set_sprite_offset_x() { void SimonEngine::vc_13_set_sprite_offset_x() {
VgaSprite *vsp = find_cur_sprite(); VgaSprite *vsp = find_cur_sprite();
vsp->x += (int16)vc_read_next_word(); vsp->x += (int16)vc_read_next_word();
_vga_sprite_changed++; _vga_sprite_changed++;
} }
void SimonState::vc_14_set_sprite_offset_y() { void SimonEngine::vc_14_set_sprite_offset_y() {
VgaSprite *vsp = find_cur_sprite(); VgaSprite *vsp = find_cur_sprite();
vsp->y += (int16)vc_read_next_word(); vsp->y += (int16)vc_read_next_word();
_vga_sprite_changed++; _vga_sprite_changed++;
} }
void SimonState::vc_15_wakeup_id() { void SimonEngine::vc_15_wakeup_id() {
VgaSleepStruct *vfs = _vga_sleep_structs, *vfs_tmp; VgaSleepStruct *vfs = _vga_sleep_structs, *vfs_tmp;
uint16 id = vc_read_next_word(); uint16 id = vc_read_next_word();
while (vfs->ident != 0) { while (vfs->ident != 0) {
@ -1015,7 +1015,7 @@ void SimonState::vc_15_wakeup_id() {
_vga_wait_for = 0; _vga_wait_for = 0;
} }
void SimonState::vc_16_sleep_on_id() { void SimonEngine::vc_16_sleep_on_id() {
VgaSleepStruct *vfs = _vga_sleep_structs; VgaSleepStruct *vfs = _vga_sleep_structs;
while (vfs->ident) while (vfs->ident)
vfs++; vfs++;
@ -1028,7 +1028,7 @@ void SimonState::vc_16_sleep_on_id() {
_vc_ptr = (byte *)&vc_get_out_of_code; _vc_ptr = (byte *)&vc_get_out_of_code;
} }
void SimonState::vc_17_set_pathfind_item() { void SimonEngine::vc_17_set_pathfind_item() {
uint a = vc_read_next_word(); uint a = vc_read_next_word();
_pathfind_array[a - 1] = (uint16 *)_vc_ptr; _pathfind_array[a - 1] = (uint16 *)_vc_ptr;
while (READ_BE_UINT16_UNALIGNED(_vc_ptr) != 999) while (READ_BE_UINT16_UNALIGNED(_vc_ptr) != 999)
@ -1036,13 +1036,13 @@ void SimonState::vc_17_set_pathfind_item() {
_vc_ptr += 2; _vc_ptr += 2;
} }
void SimonState::vc_18_jump_rel() { void SimonEngine::vc_18_jump_rel() {
int16 offs = vc_read_next_word(); int16 offs = vc_read_next_word();
_vc_ptr += offs; _vc_ptr += offs;
} }
/* chain to script? */ /* chain to script? */
void SimonState::vc_19_chain_to_script() { void SimonEngine::vc_19_chain_to_script() {
/* XXX: not implemented */ /* XXX: not implemented */
error("vc_19_chain_to_script: not implemented"); error("vc_19_chain_to_script: not implemented");
} }
@ -1061,14 +1061,14 @@ static uint16 read_16_le(void *p) {
} }
/* FIXME: unaligned access */ /* FIXME: unaligned access */
void SimonState::vc_20_set_code_word() { void SimonEngine::vc_20_set_code_word() {
uint16 a = vc_read_next_word(); uint16 a = vc_read_next_word();
write_16_le(_vc_ptr, a); write_16_le(_vc_ptr, a);
_vc_ptr += 2; _vc_ptr += 2;
} }
/* FIXME: unaligned access */ /* FIXME: unaligned access */
void SimonState::vc_21_jump_if_code_word() { void SimonEngine::vc_21_jump_if_code_word() {
if (!(_game & GF_SIMON2)) { if (!(_game & GF_SIMON2)) {
int16 a = vc_read_next_word(); int16 a = vc_read_next_word();
byte *tmp = _vc_ptr + a; byte *tmp = _vc_ptr + a;
@ -1090,7 +1090,7 @@ void SimonState::vc_21_jump_if_code_word() {
} }
} }
void SimonState::vc_22_set_sprite_palette() { void SimonEngine::vc_22_set_sprite_palette() {
uint a = vc_read_next_word(); uint a = vc_read_next_word();
uint b = vc_read_next_word(); uint b = vc_read_next_word();
uint num = a == 0 ? 0x20 : 0x10; uint num = a == 0 ? 0x20 : 0x10;
@ -1114,7 +1114,7 @@ void SimonState::vc_22_set_sprite_palette() {
_vga_sprite_changed++; _vga_sprite_changed++;
} }
void SimonState::vc_23_set_sprite_priority() { void SimonEngine::vc_23_set_sprite_priority() {
VgaSprite *vsp = find_cur_sprite(), *vus2; VgaSprite *vsp = find_cur_sprite(), *vus2;
uint16 pri = vc_read_next_word(); uint16 pri = vc_read_next_word();
VgaSprite bak; VgaSprite bak;
@ -1153,7 +1153,7 @@ void SimonState::vc_23_set_sprite_priority() {
_vga_sprite_changed++; _vga_sprite_changed++;
} }
void SimonState::vc_24_set_sprite_xy() { void SimonEngine::vc_24_set_sprite_xy() {
VgaSprite *vsp = find_cur_sprite(); VgaSprite *vsp = find_cur_sprite();
vsp->image = vc_read_var_or_word(); vsp->image = vc_read_var_or_word();
@ -1173,7 +1173,7 @@ void SimonState::vc_24_set_sprite_xy() {
_vga_sprite_changed++; _vga_sprite_changed++;
} }
void SimonState::vc_25_halt_sprite() { void SimonEngine::vc_25_halt_sprite() {
VgaSprite *vsp = find_cur_sprite(); VgaSprite *vsp = find_cur_sprite();
while (vsp->id != 0) { while (vsp->id != 0) {
memcpy(vsp, vsp + 1, sizeof(VgaSprite)); memcpy(vsp, vsp + 1, sizeof(VgaSprite));
@ -1183,7 +1183,7 @@ void SimonState::vc_25_halt_sprite() {
_vga_sprite_changed++; _vga_sprite_changed++;
} }
void SimonState::vc_26_set_window() { void SimonEngine::vc_26_set_window() {
uint16 *as = &_video_windows[vc_read_next_word() * 4]; uint16 *as = &_video_windows[vc_read_next_word() * 4];
as[0] = vc_read_next_word(); as[0] = vc_read_next_word();
as[1] = vc_read_next_word(); as[1] = vc_read_next_word();
@ -1191,7 +1191,7 @@ void SimonState::vc_26_set_window() {
as[3] = vc_read_next_word(); as[3] = vc_read_next_word();
} }
void SimonState::vc_27_reset_simon1() { void SimonEngine::vc_27_reset_simon1() {
VgaSprite bak, *vsp; VgaSprite bak, *vsp;
VgaSleepStruct *vfs; VgaSleepStruct *vfs;
VgaTimerEntry *vte, *vte2; VgaTimerEntry *vte, *vte2;
@ -1237,7 +1237,7 @@ void SimonState::vc_27_reset_simon1() {
_lock_word &= ~8; _lock_word &= ~8;
} }
void SimonState::vc_27_reset_simon2() { void SimonEngine::vc_27_reset_simon2() {
_lock_word |= 8; _lock_word |= 8;
{ {
@ -1272,59 +1272,59 @@ void SimonState::vc_27_reset_simon2() {
_lock_word &= ~8; _lock_word &= ~8;
} }
void SimonState::vc_27_reset() { void SimonEngine::vc_27_reset() {
if (!(_game & GF_SIMON2)) if (!(_game & GF_SIMON2))
vc_27_reset_simon1(); vc_27_reset_simon1();
else else
vc_27_reset_simon2(); vc_27_reset_simon2();
} }
void SimonState::vc_28_dummy_op() { void SimonEngine::vc_28_dummy_op() {
/* dummy opcode */ /* dummy opcode */
_vc_ptr += 8; _vc_ptr += 8;
error("vc_28 - Please report error message and where in game it occured"); error("vc_28 - Please report error message and where in game it occured");
} }
void SimonState::vc_29_stop_all_sounds() { void SimonEngine::vc_29_stop_all_sounds() {
_sound->stopAll(); _sound->stopAll();
} }
void SimonState::vc_30_set_base_delay() { void SimonEngine::vc_30_set_base_delay() {
_vga_base_delay = vc_read_next_word(); _vga_base_delay = vc_read_next_word();
} }
void SimonState::vc_31_set_palette_mode() { void SimonEngine::vc_31_set_palette_mode() {
_video_palette_mode = vc_read_next_word(); _video_palette_mode = vc_read_next_word();
} }
uint SimonState::vc_read_var(uint var) { uint SimonEngine::vc_read_var(uint var) {
assert(var < 255); assert(var < 255);
return (uint16)_variableArray[var]; return (uint16)_variableArray[var];
} }
void SimonState::vc_write_var(uint var, int16 value) { void SimonEngine::vc_write_var(uint var, int16 value) {
_variableArray[var] = value; _variableArray[var] = value;
} }
void SimonState::vc_32_copy_var() { void SimonEngine::vc_32_copy_var() {
uint16 a = vc_read_var(vc_read_next_word()); uint16 a = vc_read_var(vc_read_next_word());
vc_write_var(vc_read_next_word(), a); vc_write_var(vc_read_next_word(), a);
} }
void SimonState::vc_33_force_unlock() { void SimonEngine::vc_33_force_unlock() {
if (_lock_counter != 0) { if (_lock_counter != 0) {
_lock_counter = 1; _lock_counter = 1;
unlock(); unlock();
} }
} }
void SimonState::vc_34_force_lock() { void SimonEngine::vc_34_force_lock() {
lock(); lock();
_lock_counter = 200; _lock_counter = 200;
_left_button_down = 0; _left_button_down = 0;
} }
void SimonState::vc_35() { void SimonEngine::vc_35() {
/* unknown function is simon1dos/simon2dos */ /* unknown function is simon1dos/simon2dos */
/* dummy op in simon1win/simon2win */ /* dummy op in simon1win/simon2win */
/* not used? */ /* not used? */
@ -1333,7 +1333,7 @@ void SimonState::vc_35() {
error("vc_35 - Please report error message and where in game it occured"); error("vc_35 - Please report error message and where in game it occured");
} }
void SimonState::vc_36_saveload_thing() { void SimonEngine::vc_36_saveload_thing() {
_video_var_8 = false; _video_var_8 = false;
uint vga_res = vc_read_next_word(); uint vga_res = vc_read_next_word();
uint mode = vc_read_next_word(); uint mode = vc_read_next_word();
@ -1349,25 +1349,25 @@ void SimonState::vc_36_saveload_thing() {
} }
} }
void SimonState::vc_37_set_sprite_offset_y() { void SimonEngine::vc_37_set_sprite_offset_y() {
VgaSprite *vsp = find_cur_sprite(); VgaSprite *vsp = find_cur_sprite();
vsp->y += vc_read_var(vc_read_next_word()); vsp->y += vc_read_var(vc_read_next_word());
_vga_sprite_changed++; _vga_sprite_changed++;
} }
void SimonState::vc_38_skip_if_var_zero() { void SimonEngine::vc_38_skip_if_var_zero() {
uint var = vc_read_next_word(); uint var = vc_read_next_word();
if (vc_read_var(var) == 0) if (vc_read_var(var) == 0)
vc_skip_next_instruction(); vc_skip_next_instruction();
} }
void SimonState::vc_39_set_var() { void SimonEngine::vc_39_set_var() {
uint var = vc_read_next_word(); uint var = vc_read_next_word();
int16 value = vc_read_next_word(); int16 value = vc_read_next_word();
vc_write_var(var, value); vc_write_var(var, value);
} }
void SimonState::vc_40_var_add() { void SimonEngine::vc_40_var_add() {
uint var = vc_read_next_word(); uint var = vc_read_next_word();
int16 value = vc_read_var(var) + vc_read_next_word(); int16 value = vc_read_var(var) + vc_read_next_word();
@ -1396,7 +1396,7 @@ no_scroll:;
vc_write_var(var, value); vc_write_var(var, value);
} }
void SimonState::vc_41_var_sub() { void SimonEngine::vc_41_var_sub() {
uint var = vc_read_next_word(); uint var = vc_read_next_word();
int16 value = vc_read_var(var) - vc_read_next_word(); int16 value = vc_read_var(var) - vc_read_next_word();
@ -1425,7 +1425,7 @@ no_scroll:;
vc_write_var(var, value); vc_write_var(var, value);
} }
void SimonState::vc_42_delay_if_not_eq() { void SimonEngine::vc_42_delay_if_not_eq() {
uint val = vc_read_var(vc_read_next_word()); uint val = vc_read_var(vc_read_next_word());
if (val == vc_read_next_word()) { if (val == vc_read_next_word()) {
@ -1434,36 +1434,36 @@ void SimonState::vc_42_delay_if_not_eq() {
} }
} }
void SimonState::vc_43_skip_if_bit_clear() { void SimonEngine::vc_43_skip_if_bit_clear() {
if (!vc_get_bit(vc_read_next_word())) { if (!vc_get_bit(vc_read_next_word())) {
vc_skip_next_instruction(); vc_skip_next_instruction();
} }
} }
void SimonState::vc_44_skip_if_bit_set() { void SimonEngine::vc_44_skip_if_bit_set() {
if (vc_get_bit(vc_read_next_word())) { if (vc_get_bit(vc_read_next_word())) {
vc_skip_next_instruction(); vc_skip_next_instruction();
} }
} }
void SimonState::vc_45_set_sprite_x() { void SimonEngine::vc_45_set_sprite_x() {
VgaSprite *vsp = find_cur_sprite(); VgaSprite *vsp = find_cur_sprite();
vsp->x = vc_read_var(vc_read_next_word()); vsp->x = vc_read_var(vc_read_next_word());
_vga_sprite_changed++; _vga_sprite_changed++;
} }
void SimonState::vc_46_set_sprite_y() { void SimonEngine::vc_46_set_sprite_y() {
VgaSprite *vsp = find_cur_sprite(); VgaSprite *vsp = find_cur_sprite();
vsp->y = vc_read_var(vc_read_next_word()); vsp->y = vc_read_var(vc_read_next_word());
_vga_sprite_changed++; _vga_sprite_changed++;
} }
void SimonState::vc_47_add_var_f() { void SimonEngine::vc_47_add_var_f() {
uint var = vc_read_next_word(); uint var = vc_read_next_word();
vc_write_var(var, vc_read_var(var) + vc_read_var(vc_read_next_word())); vc_write_var(var, vc_read_var(var) + vc_read_var(vc_read_next_word()));
} }
void SimonState::vc_48() { void SimonEngine::vc_48() {
uint a = (uint16)_variableArray[12]; uint a = (uint16)_variableArray[12];
uint b = (uint16)_variableArray[13]; uint b = (uint16)_variableArray[13];
int c = _variableArray[14]; int c = _variableArray[14];
@ -1494,29 +1494,29 @@ void SimonState::vc_48() {
} while (--c); } while (--c);
} }
void SimonState::vc_set_bit_to(uint bit, bool value) { void SimonEngine::vc_set_bit_to(uint bit, bool value) {
uint16 *bits = &_bit_array[bit >> 4]; uint16 *bits = &_bit_array[bit >> 4];
*bits = (*bits & ~(1 << (bit & 15))) | (value << (bit & 15)); *bits = (*bits & ~(1 << (bit & 15))) | (value << (bit & 15));
} }
bool SimonState::vc_get_bit(uint bit) { bool SimonEngine::vc_get_bit(uint bit) {
uint16 *bits = &_bit_array[bit >> 4]; uint16 *bits = &_bit_array[bit >> 4];
return (*bits & (1 << (bit & 15))) != 0; return (*bits & (1 << (bit & 15))) != 0;
} }
void SimonState::vc_49_set_bit() { void SimonEngine::vc_49_set_bit() {
vc_set_bit_to(vc_read_next_word(), true); vc_set_bit_to(vc_read_next_word(), true);
} }
void SimonState::vc_50_clear_bit() { void SimonEngine::vc_50_clear_bit() {
vc_set_bit_to(vc_read_next_word(), false); vc_set_bit_to(vc_read_next_word(), false);
} }
void SimonState::vc_51_clear_hitarea_bit_0x40() { void SimonEngine::vc_51_clear_hitarea_bit_0x40() {
clear_hitarea_bit_0x40(vc_read_next_word()); clear_hitarea_bit_0x40(vc_read_next_word());
} }
void SimonState::vc_52_play_sound() { void SimonEngine::vc_52_play_sound() {
uint16 a = vc_read_next_word(); uint16 a = vc_read_next_word();
if (_game == GAME_SIMON1DOS) { if (_game == GAME_SIMON1DOS) {
@ -1533,19 +1533,19 @@ void SimonState::vc_52_play_sound() {
} }
} }
void SimonState::vc_53_no_op() { void SimonEngine::vc_53_no_op() {
/* dummy op in simon1dos/talkie */ /* dummy op in simon1dos/talkie */
/* no op in simon1win */ /* no op in simon1win */
error("vc_53 - Please report error message and where in game it occured"); error("vc_53 - Please report error message and where in game it occured");
} }
void SimonState::vc_54_no_op() { void SimonEngine::vc_54_no_op() {
/* dummy op in simon1dos/talkie */ /* dummy op in simon1dos/talkie */
/* no op in simon1win */ /* no op in simon1win */
error("vc_54 - Please report error message and where in game it occured"); error("vc_54 - Please report error message and where in game it occured");
} }
void SimonState::vc_55_offset_hit_area() { void SimonEngine::vc_55_offset_hit_area() {
HitArea *ha = _hit_areas; HitArea *ha = _hit_areas;
uint count = ARRAYSIZE(_hit_areas); uint count = ARRAYSIZE(_hit_areas);
uint16 id = vc_read_next_word(); uint16 id = vc_read_next_word();
@ -1566,7 +1566,7 @@ void SimonState::vc_55_offset_hit_area() {
_need_hitarea_recalc++; _need_hitarea_recalc++;
} }
void SimonState::vc_56() { void SimonEngine::vc_56() {
/* no op in simon1 */ /* no op in simon1 */
if (_game & GF_SIMON2) { if (_game & GF_SIMON2) {
uint num = vc_read_var_or_word() * _vga_base_delay; uint num = vc_read_var_or_word() * _vga_base_delay;
@ -1581,7 +1581,7 @@ void SimonState::vc_56() {
} }
} }
void SimonState::vc_59() { void SimonEngine::vc_59() {
if (_game & GF_SIMON2) { if (_game & GF_SIMON2) {
uint file = vc_read_next_word(); uint file = vc_read_next_word();
uint start = vc_read_next_word(); uint start = vc_read_next_word();
@ -1596,7 +1596,7 @@ void SimonState::vc_59() {
} }
} }
void SimonState::vc_58() { void SimonEngine::vc_58() {
/* no op in simon1dos */ /* no op in simon1dos */
/* not used in simon1win? */ /* not used in simon1win? */
if (!(_game & GF_SIMON2)) if (!(_game & GF_SIMON2))
@ -1620,14 +1620,14 @@ void SimonState::vc_58() {
_vga_cur_file_id = file; _vga_cur_file_id = file;
} }
void SimonState::vc_57_no_op() { void SimonEngine::vc_57_no_op() {
/* unknown function in simon1dos/simon2dos */ /* unknown function in simon1dos/simon2dos */
/* no op in simon1win/simon2win */ /* no op in simon1win/simon2win */
/* not used? */ /* not used? */
error("vc_57 - Please report error message and where in game it occured"); error("vc_57 - Please report error message and where in game it occured");
} }
void SimonState::vc_kill_sprite(uint file, uint sprite) { void SimonEngine::vc_kill_sprite(uint file, uint sprite) {
uint16 old_sprite_id, old_cur_file_id; uint16 old_sprite_id, old_cur_file_id;
VgaSleepStruct *vfs; VgaSleepStruct *vfs;
VgaSprite *vsp; VgaSprite *vsp;
@ -1676,7 +1676,7 @@ void SimonState::vc_kill_sprite(uint file, uint sprite) {
_vc_ptr = vc_org; _vc_ptr = vc_org;
} }
void SimonState::vc_60_kill_sprite() { void SimonEngine::vc_60_kill_sprite() {
uint file; uint file;
if (_game & GF_SIMON2) { if (_game & GF_SIMON2) {
@ -1688,7 +1688,7 @@ void SimonState::vc_60_kill_sprite() {
vc_kill_sprite(file, sprite); vc_kill_sprite(file, sprite);
} }
void SimonState::vc_61_sprite_change() { void SimonEngine::vc_61_sprite_change() {
VgaSprite *vsp = find_cur_sprite(); VgaSprite *vsp = find_cur_sprite();
vsp->image = vc_read_var_or_word(); vsp->image = vc_read_var_or_word();
@ -1700,7 +1700,7 @@ void SimonState::vc_61_sprite_change() {
_vga_sprite_changed++; _vga_sprite_changed++;
} }
void SimonState::vc_62_palette_thing() { void SimonEngine::vc_62_palette_thing() {
uint i; uint i;
byte *vc_ptr_org = _vc_ptr; byte *vc_ptr_org = _vc_ptr;
@ -1766,7 +1766,7 @@ void SimonState::vc_62_palette_thing() {
} }
void SimonState::vc_63_palette_thing_2() { void SimonEngine::vc_63_palette_thing_2() {
_palette_color_count = 208; _palette_color_count = 208;
if (_video_palette_mode != 4) { if (_video_palette_mode != 4) {
_palette_color_count = 256; _palette_color_count = 256;
@ -1774,13 +1774,13 @@ void SimonState::vc_63_palette_thing_2() {
_video_var_3 = false; _video_var_3 = false;
} }
void SimonState::vc_64_skip_if_no_speech() { void SimonEngine::vc_64_skip_if_no_speech() {
// Simon2 // Simon2
if (_sound->_voice_handle == 0) if (_sound->_voice_handle == 0)
vc_skip_next_instruction(); vc_skip_next_instruction();
} }
void SimonState::vc_65_palette_thing_3() { void SimonEngine::vc_65_palette_thing_3() {
// Simon2 // Simon2
_palette_color_count = 0x270; _palette_color_count = 0x270;
_video_num_pal_colors = 0x0D0; _video_num_pal_colors = 0x0D0;
@ -1792,7 +1792,7 @@ void SimonState::vc_65_palette_thing_3() {
_video_var_3 = false; _video_var_3 = false;
} }
void SimonState::vc_66_skip_if_nz() { void SimonEngine::vc_66_skip_if_nz() {
// Simon2 // Simon2
uint a = vc_read_next_word(); uint a = vc_read_next_word();
uint b = vc_read_next_word(); uint b = vc_read_next_word();
@ -1801,7 +1801,7 @@ void SimonState::vc_66_skip_if_nz() {
vc_skip_next_instruction(); vc_skip_next_instruction();
} }
void SimonState::vc_67_skip_if_ge() { void SimonEngine::vc_67_skip_if_ge() {
// Simon2 // Simon2
uint a = vc_read_next_word(); uint a = vc_read_next_word();
uint b = vc_read_next_word(); uint b = vc_read_next_word();
@ -1810,7 +1810,7 @@ void SimonState::vc_67_skip_if_ge() {
vc_skip_next_instruction(); vc_skip_next_instruction();
} }
void SimonState::vc_68_skip_if_le() { void SimonEngine::vc_68_skip_if_le() {
// Simon2 // Simon2
uint a = vc_read_next_word(); uint a = vc_read_next_word();
uint b = vc_read_next_word(); uint b = vc_read_next_word();
@ -1819,7 +1819,7 @@ void SimonState::vc_68_skip_if_le() {
vc_skip_next_instruction(); vc_skip_next_instruction();
} }
void SimonState::vc_69_play_track() { void SimonEngine::vc_69_play_track() {
// Simon2 // Simon2
int16 track = vc_read_next_word(); int16 track = vc_read_next_word();
int16 loop = vc_read_next_word(); int16 loop = vc_read_next_word();
@ -1843,7 +1843,7 @@ void SimonState::vc_69_play_track() {
midi.startTrack (track); midi.startTrack (track);
} }
void SimonState::vc_70_queue_music() { void SimonEngine::vc_70_queue_music() {
// Simon2 // Simon2
uint16 track = vc_read_next_word(); uint16 track = vc_read_next_word();
uint16 loop = vc_read_next_word(); uint16 loop = vc_read_next_word();
@ -1858,7 +1858,7 @@ void SimonState::vc_70_queue_music() {
midi.queueTrack (track, 0); midi.queueTrack (track, 0);
} }
void SimonState::vc_71_check_music_queue() { void SimonEngine::vc_71_check_music_queue() {
// Simon2 // Simon2
// Jamieson630: // Jamieson630:
// This command skips the next instruction // This command skips the next instruction
@ -1868,7 +1868,7 @@ void SimonState::vc_71_check_music_queue() {
vc_skip_next_instruction(); vc_skip_next_instruction();
} }
void SimonState::vc_72_play_track_2() { void SimonEngine::vc_72_play_track_2() {
// Simon2 // Simon2
// Jamieson630: // Jamieson630:
// This is a "play or stop track". Note that // This is a "play or stop track". Note that
@ -1894,13 +1894,13 @@ void SimonState::vc_72_play_track_2() {
} }
} }
void SimonState::vc_73_set_op189_flag() { void SimonEngine::vc_73_set_op189_flag() {
// Simon2 // Simon2
vc_read_next_byte(); vc_read_next_byte();
_op_189_flags |= 1 << vc_read_next_byte(); _op_189_flags |= 1 << vc_read_next_byte();
} }
void SimonState::vc_74_clear_op189_flag() { void SimonEngine::vc_74_clear_op189_flag() {
// Simon2 // Simon2
vc_read_next_byte(); vc_read_next_byte();
_op_189_flags &= ~(1 << vc_read_next_byte()); _op_189_flags &= ~(1 << vc_read_next_byte());