Use ScummVM code formatting for names.
svn-id: r17930
This commit is contained in:
parent
d04492a05a
commit
076e42c302
13 changed files with 1555 additions and 1567 deletions
|
@ -28,15 +28,15 @@ namespace Simon {
|
|||
void SimonEngine::print_char_helper_1(const byte *src, uint len) {
|
||||
uint ind;
|
||||
|
||||
if (_fcs_ptr_1 == NULL)
|
||||
if (_fcsPtr1 == NULL)
|
||||
return;
|
||||
|
||||
while (len-- != 0) {
|
||||
if (*src != 12 && _fcs_ptr_1->fcs_data != NULL &&
|
||||
_fcs_data_1[ind = get_fcs_ptr_3_index(_fcs_ptr_1)] != 2) {
|
||||
if (*src != 12 && _fcsPtr1->fcs_data != NULL &&
|
||||
_fcsData1[ind = get_fcs_ptr_3_index(_fcsPtr1)] != 2) {
|
||||
|
||||
_fcs_data_1[ind] = 2;
|
||||
_fcs_data_2[ind] = 1;
|
||||
_fcsData1[ind] = 2;
|
||||
_fcsData2[ind] = 1;
|
||||
}
|
||||
|
||||
fcs_putchar(*src++);
|
||||
|
@ -46,23 +46,23 @@ void SimonEngine::print_char_helper_1(const byte *src, uint len) {
|
|||
void SimonEngine::print_char_helper_5(FillOrCopyStruct *fcs) {
|
||||
uint index = get_fcs_ptr_3_index(fcs);
|
||||
print_char_helper_6(index);
|
||||
_fcs_data_1[index] = 0;
|
||||
_fcsData1[index] = 0;
|
||||
}
|
||||
|
||||
void SimonEngine::print_char_helper_6(uint i) {
|
||||
FillOrCopyStruct *fcs;
|
||||
|
||||
if (_fcs_data_2[i]) {
|
||||
if (_fcsData2[i]) {
|
||||
lock();
|
||||
fcs = _fcs_ptr_array_3[i];
|
||||
fcs = _fcsPtrArray3[i];
|
||||
fcs_unk_proc_1(i, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1, fcs->fcs_data->unk2);
|
||||
_fcs_data_2[i] = 0;
|
||||
_fcsData2[i] = 0;
|
||||
unlock();
|
||||
}
|
||||
}
|
||||
|
||||
void SimonEngine::render_string_amiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt) {
|
||||
VgaPointersEntry *vpe = &_vga_buffer_pointers[2];
|
||||
VgaPointersEntry *vpe = &_vgaBufferPointers[2];
|
||||
byte *src, *dst, *dst_org, chr;
|
||||
uint count;
|
||||
|
||||
|
@ -153,7 +153,7 @@ void SimonEngine::render_string_amiga(uint vga_sprite_id, uint color, uint width
|
|||
}
|
||||
|
||||
void SimonEngine::render_string(uint vga_sprite_id, uint color, uint width, uint height, const char *txt) {
|
||||
VgaPointersEntry *vpe = &_vga_buffer_pointers[2];
|
||||
VgaPointersEntry *vpe = &_vgaBufferPointers[2];
|
||||
byte *src, *dst, *p, *dst_org, chr;
|
||||
uint count;
|
||||
|
||||
|
@ -226,15 +226,15 @@ void SimonEngine::showMessageFormat(const char *s, ...) {
|
|||
vsnprintf(buf, STRINGBUFLEN, s, va);
|
||||
va_end(va);
|
||||
|
||||
if (!_fcs_data_1[_fcs_unk_1]) {
|
||||
if (!_fcsData1[_fcsUnk1]) {
|
||||
showmessage_helper_2();
|
||||
if (!_showmessage_flag) {
|
||||
_fcs_ptr_array_3[0] = _fcs_ptr_1;
|
||||
showmessage_helper_3(_fcs_ptr_1->textLength,
|
||||
_fcs_ptr_1->textMaxLength);
|
||||
if (!_showMessageFlag) {
|
||||
_fcsPtrArray3[0] = _fcsPtr1;
|
||||
showmessage_helper_3(_fcsPtr1->textLength,
|
||||
_fcsPtr1->textMaxLength);
|
||||
}
|
||||
_showmessage_flag = true;
|
||||
_fcs_data_1[_fcs_unk_1] = 1;
|
||||
_showMessageFlag = true;
|
||||
_fcsData1[_fcsUnk1] = 1;
|
||||
}
|
||||
|
||||
for (str = buf; *str; str++)
|
||||
|
@ -243,55 +243,55 @@ void SimonEngine::showMessageFormat(const char *s, ...) {
|
|||
|
||||
void SimonEngine::showmessage_print_char(byte chr) {
|
||||
if (chr == 12) {
|
||||
_num_letters_to_print = 0;
|
||||
_print_char_unk_1 = 0;
|
||||
_numLettersToPrint = 0;
|
||||
_printCharUnk1 = 0;
|
||||
print_char_helper_1(&chr, 1);
|
||||
print_char_helper_5(_fcs_ptr_1);
|
||||
print_char_helper_5(_fcsPtr1);
|
||||
} else if (chr == 0 || chr == ' ' || chr == 10) {
|
||||
if (_print_char_unk_2 - _print_char_unk_1 >= _num_letters_to_print) {
|
||||
_print_char_unk_1 += _num_letters_to_print;
|
||||
print_char_helper_1(_letters_to_print_buf, _num_letters_to_print);
|
||||
if (_printCharUnk2 - _printCharUnk1 >= _numLettersToPrint) {
|
||||
_printCharUnk1 += _numLettersToPrint;
|
||||
print_char_helper_1(_lettersToPrintBuf, _numLettersToPrint);
|
||||
|
||||
if (_print_char_unk_1 == _print_char_unk_2) {
|
||||
_print_char_unk_1 = 0;
|
||||
if (_printCharUnk1 == _printCharUnk2) {
|
||||
_printCharUnk1 = 0;
|
||||
} else {
|
||||
if (chr)
|
||||
print_char_helper_1(&chr, 1);
|
||||
if (chr == 10)
|
||||
_print_char_unk_1 = 0;
|
||||
_printCharUnk1 = 0;
|
||||
else if (chr != 0)
|
||||
_print_char_unk_1++;
|
||||
_printCharUnk1++;
|
||||
}
|
||||
} else {
|
||||
const byte newline_character = 10;
|
||||
_print_char_unk_1 = _num_letters_to_print;
|
||||
_printCharUnk1 = _numLettersToPrint;
|
||||
print_char_helper_1(&newline_character, 1);
|
||||
print_char_helper_1(_letters_to_print_buf, _num_letters_to_print);
|
||||
print_char_helper_1(_lettersToPrintBuf, _numLettersToPrint);
|
||||
if (chr == ' ') {
|
||||
print_char_helper_1(&chr, 1);
|
||||
_print_char_unk_1++;
|
||||
_printCharUnk1++;
|
||||
} else {
|
||||
print_char_helper_1(&chr, 1);
|
||||
_print_char_unk_1 = 0;
|
||||
_printCharUnk1 = 0;
|
||||
}
|
||||
}
|
||||
_num_letters_to_print = 0;
|
||||
_numLettersToPrint = 0;
|
||||
} else {
|
||||
_letters_to_print_buf[_num_letters_to_print++] = chr;
|
||||
_lettersToPrintBuf[_numLettersToPrint++] = chr;
|
||||
}
|
||||
}
|
||||
|
||||
void SimonEngine::showmessage_helper_2() {
|
||||
if (_fcs_ptr_1)
|
||||
if (_fcsPtr1)
|
||||
return;
|
||||
|
||||
_fcs_ptr_1 = fcs_alloc(8, 0x90, 0x18, 6, 1, 0, 0xF);
|
||||
_fcsPtr1 = fcs_alloc(8, 0x90, 0x18, 6, 1, 0, 0xF);
|
||||
}
|
||||
|
||||
void SimonEngine::showmessage_helper_3(uint a, uint b) {
|
||||
_print_char_unk_1 = a;
|
||||
_print_char_unk_2 = b;
|
||||
_num_letters_to_print = 0;
|
||||
_printCharUnk1 = a;
|
||||
_printCharUnk2 = b;
|
||||
_numLettersToPrint = 0;
|
||||
}
|
||||
|
||||
void SimonEngine::video_putchar(FillOrCopyStruct *fcs, byte c, byte b) {
|
||||
|
@ -1091,10 +1091,10 @@ void SimonEngine::video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y,
|
|||
byte color, *dst;
|
||||
uint h, i;
|
||||
|
||||
_lock_word |= 0x8000;
|
||||
_lockWord |= 0x8000;
|
||||
|
||||
dst = dx_lock_2();
|
||||
dst += y * _dx_surface_pitch + x * 8 + fcs->textColumnOffset;
|
||||
dst += y * _dxSurfacePitch + x * 8 + fcs->textColumnOffset;
|
||||
|
||||
if (_language == 21) {
|
||||
src = russian_video_font + (chr - 0x20) * 8;
|
||||
|
@ -1122,12 +1122,12 @@ void SimonEngine::video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y,
|
|||
dst[i] = color;
|
||||
b <<= 1;
|
||||
} while (++i != 6);
|
||||
dst += _dx_surface_pitch;
|
||||
dst += _dxSurfacePitch;
|
||||
} while (--h);
|
||||
|
||||
dx_unlock_2();
|
||||
|
||||
_lock_word &= ~0x8000;
|
||||
_lockWord &= ~0x8000;
|
||||
}
|
||||
|
||||
} // End of namespace Simon
|
||||
|
|
|
@ -224,7 +224,7 @@ static const byte _simon2_cursors[10][256] = {
|
|||
|
||||
void SimonEngine::draw_mouse_pointer() {
|
||||
if (_game & GF_SIMON2)
|
||||
_system->setMouseCursor(_simon2_cursors[_mouse_cursor], 16, 16, 7, 7);
|
||||
_system->setMouseCursor(_simon2_cursors[_mouseCursor], 16, 16, 7, 7);
|
||||
else
|
||||
_system->setMouseCursor(_simon1_cursor, 16, 16, 0, 0);
|
||||
}
|
||||
|
|
|
@ -52,30 +52,30 @@ const byte *SimonEngine::dumpOpcode(const byte *p) {
|
|||
}
|
||||
while (*st != '|')
|
||||
st++;
|
||||
fprintf(_dump_file, "%s ", st + 1);
|
||||
fprintf(_dumpFile, "%s ", st + 1);
|
||||
|
||||
for (;;) {
|
||||
switch (*s++) {
|
||||
case 'x':
|
||||
fprintf(_dump_file, "\n");
|
||||
fprintf(_dumpFile, "\n");
|
||||
return NULL;
|
||||
case '|':
|
||||
fprintf(_dump_file, "\n");
|
||||
fprintf(_dumpFile, "\n");
|
||||
return p;
|
||||
case 'B':{
|
||||
byte b = *p++;
|
||||
if (b == 255)
|
||||
fprintf(_dump_file, "[%d] ", *p++);
|
||||
fprintf(_dumpFile, "[%d] ", *p++);
|
||||
else
|
||||
fprintf(_dump_file, "%d ", b);
|
||||
fprintf(_dumpFile, "%d ", b);
|
||||
break;
|
||||
}
|
||||
case 'V':{
|
||||
byte b = *p++;
|
||||
if (b == 255)
|
||||
fprintf(_dump_file, "[[%d]] ", *p++);
|
||||
fprintf(_dumpFile, "[[%d]] ", *p++);
|
||||
else
|
||||
fprintf(_dump_file, "[%d] ", b);
|
||||
fprintf(_dumpFile, "[%d] ", b);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -83,16 +83,16 @@ const byte *SimonEngine::dumpOpcode(const byte *p) {
|
|||
int n = (int16)((p[0] << 8) | p[1]);
|
||||
p += 2;
|
||||
if (n >= 30000 && n < 30512)
|
||||
fprintf(_dump_file, "[%d] ", n - 30000);
|
||||
fprintf(_dumpFile, "[%d] ", n - 30000);
|
||||
else
|
||||
fprintf(_dump_file, "%d ", n);
|
||||
fprintf(_dumpFile, "%d ", n);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'w':{
|
||||
int n = (int16)((p[0] << 8) | p[1]);
|
||||
p += 2;
|
||||
fprintf(_dump_file, "%d ", n);
|
||||
fprintf(_dumpFile, "%d ", n);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -100,22 +100,22 @@ const byte *SimonEngine::dumpOpcode(const byte *p) {
|
|||
int n = (int16)((p[0] << 8) | p[1]);;
|
||||
p += 2;
|
||||
if (n == -1)
|
||||
fprintf(_dump_file, "ITEM_M1 ");
|
||||
fprintf(_dumpFile, "ITEM_M1 ");
|
||||
else if (n == -3)
|
||||
fprintf(_dump_file, "ITEM_M3 ");
|
||||
fprintf(_dumpFile, "ITEM_M3 ");
|
||||
else if (n == -5)
|
||||
fprintf(_dump_file, "ITEM_1 ");
|
||||
fprintf(_dumpFile, "ITEM_1 ");
|
||||
else if (n == -7)
|
||||
fprintf(_dump_file, "ITEM_0 ");
|
||||
fprintf(_dumpFile, "ITEM_0 ");
|
||||
else if (n == -9)
|
||||
fprintf(_dump_file, "ITEM_A_PARENT ");
|
||||
fprintf(_dumpFile, "ITEM_A_PARENT ");
|
||||
else
|
||||
fprintf(_dump_file, "<%d> ", n);
|
||||
fprintf(_dumpFile, "<%d> ", n);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'J':{
|
||||
fprintf(_dump_file, "-> ");
|
||||
fprintf(_dumpFile, "-> ");
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -123,9 +123,9 @@ const byte *SimonEngine::dumpOpcode(const byte *p) {
|
|||
uint n = ((p[0] << 8) | p[1]);
|
||||
p += 2;
|
||||
if (n != 0xFFFF)
|
||||
fprintf(_dump_file, "\"%s\"(%d) ", getStringPtrByID(n), n);
|
||||
fprintf(_dumpFile, "\"%s\"(%d) ", getStringPtrByID(n), n);
|
||||
else
|
||||
fprintf(_dump_file, "NULL_STRING ");
|
||||
fprintf(_dumpFile, "NULL_STRING ");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ void SimonEngine::dumpSubroutineLine(SubroutineLine *sl, Subroutine *sub) {
|
|||
|
||||
p = (byte *)sl + SUBROUTINE_LINE_SMALL_SIZE;
|
||||
if (sub->id == 0) {
|
||||
fprintf(_dump_file, "; cond_a=%d, cond_b=%d, cond_c=%d\n", sl->cond_a, sl->cond_b, sl->cond_c);
|
||||
fprintf(_dumpFile, "; cond_a=%d, cond_b=%d, cond_c=%d\n", sl->cond_a, sl->cond_b, sl->cond_c);
|
||||
p = (byte *)sl + SUBROUTINE_LINE_BIG_SIZE;
|
||||
}
|
||||
|
||||
|
@ -153,17 +153,17 @@ void SimonEngine::dumpSubroutineLine(SubroutineLine *sl, Subroutine *sub) {
|
|||
void SimonEngine::dumpSubroutine(Subroutine *sub) {
|
||||
SubroutineLine *sl;
|
||||
|
||||
fprintf(_dump_file, "\n******************************************\n;Subroutine, ID=%d:\nSUB_%d:\n", sub->id, sub->id);
|
||||
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(_dump_file, "\nEND ******************************************\n");
|
||||
fflush(_dump_file);
|
||||
fprintf(_dumpFile, "\nEND ******************************************\n");
|
||||
fflush(_dumpFile);
|
||||
}
|
||||
|
||||
void SimonEngine::dumpSubroutines() {
|
||||
Subroutine *sub = _subroutine_list;
|
||||
Subroutine *sub = _subroutineList;
|
||||
for (; sub; sub = sub->next) {
|
||||
dumpSubroutine(sub);
|
||||
}
|
||||
|
@ -194,31 +194,31 @@ void SimonEngine::dump_video_script(const byte *src, bool one_opcode_only) {
|
|||
|
||||
while (*strn != '|')
|
||||
strn++;
|
||||
fprintf(_dump_file, "%.2d: %s ", opcode, strn + 1);
|
||||
fprintf(_dumpFile, "%.2d: %s ", opcode, strn + 1);
|
||||
|
||||
for (; *str != '|'; str++) {
|
||||
switch (*str) {
|
||||
case 'x':
|
||||
fprintf(_dump_file, "\n");
|
||||
fprintf(_dumpFile, "\n");
|
||||
return;
|
||||
case 'b':
|
||||
fprintf(_dump_file, "%d ", *src++);
|
||||
fprintf(_dumpFile, "%d ", *src++);
|
||||
break;
|
||||
case 'd':
|
||||
fprintf(_dump_file, "%d ", READ_BE_UINT16(src));
|
||||
fprintf(_dumpFile, "%d ", READ_BE_UINT16(src));
|
||||
src += 2;
|
||||
break;
|
||||
case 'v':
|
||||
fprintf(_dump_file, "[%d] ", READ_BE_UINT16(src));
|
||||
fprintf(_dumpFile, "[%d] ", READ_BE_UINT16(src));
|
||||
src += 2;
|
||||
break;
|
||||
case 'i':
|
||||
fprintf(_dump_file, "%d ", (int16)READ_BE_UINT16(src));
|
||||
fprintf(_dumpFile, "%d ", (int16)READ_BE_UINT16(src));
|
||||
src += 2;
|
||||
break;
|
||||
case 'q':
|
||||
while (READ_BE_UINT16(src) != 999) {
|
||||
fprintf(_dump_file, "(%d,%d) ", READ_BE_UINT16(src),
|
||||
fprintf(_dumpFile, "(%d,%d) ", READ_BE_UINT16(src),
|
||||
READ_BE_UINT16(src + 2));
|
||||
src += 4;
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ void SimonEngine::dump_video_script(const byte *src, bool one_opcode_only) {
|
|||
}
|
||||
}
|
||||
|
||||
fprintf(_dump_file, "\n");
|
||||
fprintf(_dumpFile, "\n");
|
||||
} while (!one_opcode_only);
|
||||
}
|
||||
|
||||
|
@ -422,8 +422,8 @@ void SimonEngine::dump_vga_bitmaps(const byte *vga, byte *vga1, int res) {
|
|||
height = p2[5];
|
||||
flags = p2[4];
|
||||
|
||||
fprintf(_dump_file, "Image %d. Width=%d, Height=%d, Flags=0x%X\n", i, width, height, flags);
|
||||
fflush(_dump_file);
|
||||
fprintf(_dumpFile, "Image %d. Width=%d, Height=%d, Flags=0x%X\n", i, width, height, flags);
|
||||
fflush(_dumpFile);
|
||||
|
||||
/* dump bitmap */
|
||||
{
|
||||
|
@ -440,10 +440,10 @@ void SimonEngine::dump_vga_bitmaps(const byte *vga, byte *vga1, int res) {
|
|||
}
|
||||
|
||||
void SimonEngine::dump_vga_script_always(const byte *ptr, uint res, uint sprite_id) {
|
||||
fprintf(_dump_file, "; address=%x, vgafile=%d vgasprite=%d\n",
|
||||
ptr - _vga_buffer_pointers[res].vgaFile1, res, sprite_id);
|
||||
fprintf(_dumpFile, "; address=%x, vgafile=%d vgasprite=%d\n",
|
||||
ptr - _vgaBufferPointers[res].vgaFile1, res, sprite_id);
|
||||
dump_video_script(ptr, false);
|
||||
fprintf(_dump_file, "; end\n");
|
||||
fprintf(_dumpFile, "; end\n");
|
||||
}
|
||||
|
||||
void SimonEngine::dump_vga_script(const byte *ptr, uint res, uint sprite_id) {
|
||||
|
|
|
@ -43,11 +43,11 @@ void SimonEngine::loadIconFile() {
|
|||
|
||||
size = in.size();
|
||||
|
||||
_icon_file_ptr = (byte *)malloc(size);
|
||||
if (_icon_file_ptr == NULL)
|
||||
_iconFilePtr = (byte *)malloc(size);
|
||||
if (_iconFilePtr == NULL)
|
||||
error("Out of icon memory");
|
||||
|
||||
in.read(_icon_file_ptr, size);
|
||||
in.read(_iconFilePtr, size);
|
||||
in.close();
|
||||
}
|
||||
|
||||
|
@ -158,40 +158,40 @@ void SimonEngine::draw_icon_c(FillOrCopyStruct *fcs, uint icon, uint x, uint y)
|
|||
byte *dst;
|
||||
byte *src;
|
||||
|
||||
_lock_word |= 0x8000;
|
||||
_lockWord |= 0x8000;
|
||||
dst = dx_lock_2();
|
||||
|
||||
if (!(_game & GF_SIMON2)) {
|
||||
// Simon 1
|
||||
dst += (x + fcs->x) * 8;
|
||||
dst += (y * 25 + fcs->y) * _dx_surface_pitch;
|
||||
dst += (y * 25 + fcs->y) * _dxSurfacePitch;
|
||||
|
||||
if (_game & GF_AMIGA) {
|
||||
src = _icon_file_ptr;
|
||||
src = _iconFilePtr;
|
||||
src += READ_BE_UINT32(&((uint32 *)src)[icon]);
|
||||
decompress_icon_amiga (dst, src, 0xE0, _dx_surface_pitch);
|
||||
decompress_icon_amiga (dst, src, 0xE0, _dxSurfacePitch);
|
||||
} else {
|
||||
src = _icon_file_ptr;
|
||||
src = _iconFilePtr;
|
||||
src += READ_LE_UINT16(&((uint16 *)src)[icon]);
|
||||
decompress_icon(dst, src, 24, 12, 0xE0, _dx_surface_pitch);
|
||||
decompress_icon(dst, src, 24, 12, 0xE0, _dxSurfacePitch);
|
||||
}
|
||||
} else {
|
||||
// Simon 2
|
||||
dst += 110;
|
||||
dst += x;
|
||||
dst += (y + fcs->y) * _dx_surface_pitch;
|
||||
dst += (y + fcs->y) * _dxSurfacePitch;
|
||||
|
||||
src = _icon_file_ptr;
|
||||
src = _iconFilePtr;
|
||||
src += READ_LE_UINT16(&((uint16 *)src)[icon * 2 + 0]);
|
||||
decompress_icon(dst, src, 20, 10, 0xE0, _dx_surface_pitch);
|
||||
decompress_icon(dst, src, 20, 10, 0xE0, _dxSurfacePitch);
|
||||
|
||||
src = _icon_file_ptr;
|
||||
src = _iconFilePtr;
|
||||
src += READ_LE_UINT16(&((uint16 *)src)[icon * 2 + 1]);
|
||||
decompress_icon(dst, src, 20, 10, 0xD0, _dx_surface_pitch);
|
||||
decompress_icon(dst, src, 20, 10, 0xD0, _dxSurfacePitch);
|
||||
}
|
||||
|
||||
dx_unlock_2();
|
||||
_lock_word &= ~0x8000;
|
||||
_lockWord &= ~0x8000;
|
||||
}
|
||||
|
||||
uint SimonEngine::setup_icon_hit_area(FillOrCopyStruct *fcs, uint x, uint y, uint icon_number,
|
||||
|
@ -222,7 +222,7 @@ uint SimonEngine::setup_icon_hit_area(FillOrCopyStruct *fcs, uint x, uint y, uin
|
|||
ha->unk3 = 0xD0;
|
||||
}
|
||||
|
||||
return ha - _hit_areas;
|
||||
return ha - _hitAreas;
|
||||
}
|
||||
|
||||
} // End of namespace Simon
|
||||
|
|
308
simon/items.cpp
308
simon/items.cpp
|
@ -39,14 +39,14 @@ int SimonEngine::runScript() {
|
|||
bool flag, condition;
|
||||
|
||||
do {
|
||||
if (_continous_mainscript)
|
||||
dumpOpcode(_code_ptr);
|
||||
if (_continousMainScript)
|
||||
dumpOpcode(_codePtr);
|
||||
|
||||
opcode = getByte();
|
||||
if (opcode == 0xFF)
|
||||
return 0;
|
||||
|
||||
if (_run_script_return_1)
|
||||
if (_runScriptReturn1)
|
||||
return 1;
|
||||
|
||||
/* Invert condition? */
|
||||
|
@ -360,7 +360,7 @@ int SimonEngine::runScript() {
|
|||
int h = getVarOrWord();
|
||||
int number = getVarOrByte();
|
||||
if (number < 20)
|
||||
addNewHitArea(id, x, y, w, h, (number << 8) + 129, 0xD0, _dummy_item_2);
|
||||
addNewHitArea(id, x, y, w, h, (number << 8) + 129, 0xD0, _dummyItem2);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -368,7 +368,7 @@ int SimonEngine::runScript() {
|
|||
uint var = getVarOrByte();
|
||||
uint string_id = getNextStringID();
|
||||
if (var < 20)
|
||||
_stringid_array_2[var] = string_id;
|
||||
_stringIdArray2[var] = string_id;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -378,12 +378,12 @@ int SimonEngine::runScript() {
|
|||
if (_game & GF_TALKIE) {
|
||||
uint speech_id = getNextWord();
|
||||
if (var < 20) {
|
||||
_stringid_array_3[var] = string_id;
|
||||
_speechid_array_4[var] = speech_id;
|
||||
_stringIdArray3[var] = string_id;
|
||||
_speechIdArray4[var] = speech_id;
|
||||
}
|
||||
} else {
|
||||
if (var < 20) {
|
||||
_stringid_array_3[var] = string_id;
|
||||
_stringIdArray3[var] = string_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ int SimonEngine::runScript() {
|
|||
}
|
||||
|
||||
case 70:{ /* show string from array */
|
||||
const char *str = (const char *)getStringPtrByID(_stringid_array_3[getVarOrByte()]);
|
||||
const char *str = (const char *)getStringPtrByID(_stringIdArray3[getVarOrByte()]);
|
||||
|
||||
if (_game & GF_SIMON2) {
|
||||
writeVariable(51, strlen(str) / 53 * 8 + 8);
|
||||
|
@ -423,12 +423,12 @@ int SimonEngine::runScript() {
|
|||
break;
|
||||
|
||||
case 77:{ /* has item minus 1 */
|
||||
condition = _subject_item != NULL;
|
||||
condition = _subjectItem != NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case 78:{ /* has item minus 3 */
|
||||
condition = _object_item != NULL;
|
||||
condition = _objectItem != NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -460,13 +460,13 @@ int SimonEngine::runScript() {
|
|||
}
|
||||
break;
|
||||
|
||||
case 88:{ /* or_lock_word */
|
||||
_lock_word |= 0x10;
|
||||
case 88:{ /* or_lockWord */
|
||||
_lockWord |= 0x10;
|
||||
}
|
||||
break;
|
||||
|
||||
case 89:{ /* and lock word */
|
||||
_lock_word &= ~0x10;
|
||||
_lockWord &= ~0x10;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -474,10 +474,10 @@ int SimonEngine::runScript() {
|
|||
Item *item = derefItem(getNextItemPtr()->parent);
|
||||
switch (getVarOrByte()) {
|
||||
case 0:
|
||||
_object_item = item;
|
||||
_objectItem = item;
|
||||
break;
|
||||
case 1:
|
||||
_subject_item = item;
|
||||
_subjectItem = item;
|
||||
break;
|
||||
default:
|
||||
error("set minusitem to parent, invalid subcode");
|
||||
|
@ -489,10 +489,10 @@ int SimonEngine::runScript() {
|
|||
Item *item = derefItem(getNextItemPtr()->sibling);
|
||||
switch (getVarOrByte()) {
|
||||
case 0:
|
||||
_object_item = item;
|
||||
_objectItem = item;
|
||||
break;
|
||||
case 1:
|
||||
_subject_item = item;
|
||||
_subjectItem = item;
|
||||
break;
|
||||
default:
|
||||
error("set minusitem to sibling, invalid subcode");
|
||||
|
@ -504,10 +504,10 @@ int SimonEngine::runScript() {
|
|||
Item *item = derefItem(getNextItemPtr()->child);
|
||||
switch (getVarOrByte()) {
|
||||
case 0:
|
||||
_object_item = item;
|
||||
_objectItem = item;
|
||||
break;
|
||||
case 1:
|
||||
_subject_item = item;
|
||||
_subjectItem = item;
|
||||
break;
|
||||
default:
|
||||
error("set minusitem to child, invalid subcode");
|
||||
|
@ -675,11 +675,11 @@ int SimonEngine::runScript() {
|
|||
|
||||
case 119:{ /* wait vga */
|
||||
uint var = getVarOrWord();
|
||||
_scriptvar_2 = (var == 200);
|
||||
_scriptVar2 = (var == 200);
|
||||
|
||||
if (var != 200 || !_skip_vga_wait)
|
||||
if (var != 200 || !_skipVgaWait)
|
||||
o_wait_for_vga(var);
|
||||
_skip_vga_wait = false;
|
||||
_skipVgaWait = false;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -690,7 +690,7 @@ int SimonEngine::runScript() {
|
|||
|
||||
case 121:{ /* set vga item */
|
||||
uint slot = getVarOrByte();
|
||||
_vc_item_array[slot] = getNextItemPtr();
|
||||
_vcItemArray[slot] = getNextItemPtr();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -730,9 +730,9 @@ int SimonEngine::runScript() {
|
|||
uint var = getVarOrByte();
|
||||
getNextWord();
|
||||
if (var == 1)
|
||||
_script_cond_b = getNextWord();
|
||||
_scriptCondB = getNextWord();
|
||||
else
|
||||
_script_cond_c = getNextWord();
|
||||
_scriptCondC = getNextWord();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -752,7 +752,7 @@ int SimonEngine::runScript() {
|
|||
|
||||
case 134:{ /* dummy opcode? */
|
||||
midi.stop();
|
||||
_last_music_played = -1;
|
||||
_lastMusicPlayed = -1;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -781,9 +781,9 @@ int SimonEngine::runScript() {
|
|||
|
||||
case 139:{ /* set parent special */
|
||||
Item *item = getNextItemPtr();
|
||||
_no_parent_notify = true;
|
||||
_noParentNotify = true;
|
||||
setItemParent(item, getNextItemPtr());
|
||||
_no_parent_notify = false;
|
||||
_noParentNotify = false;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -797,9 +797,9 @@ int SimonEngine::runScript() {
|
|||
uint which = getVarOrByte();
|
||||
Item *item = getNextItemPtr();
|
||||
if (which == 1) {
|
||||
_subject_item = item;
|
||||
_subjectItem = item;
|
||||
} else {
|
||||
_object_item = item;
|
||||
_objectItem = item;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -822,42 +822,42 @@ int SimonEngine::runScript() {
|
|||
case 151:{ /* set array6 to item */
|
||||
uint var = getVarOrByte();
|
||||
Item *item = getNextItemPtr();
|
||||
_item_array_6[var] = item;
|
||||
_itemArray6[var] = item;
|
||||
}
|
||||
break;
|
||||
|
||||
case 152:{ /* set m1 or m3 to array6 */
|
||||
Item *item = _item_array_6[getVarOrByte()];
|
||||
Item *item = _itemArray6[getVarOrByte()];
|
||||
uint var = getVarOrByte();
|
||||
if (var == 1) {
|
||||
_subject_item = item;
|
||||
_subjectItem = item;
|
||||
} else {
|
||||
_object_item = item;
|
||||
_objectItem = item;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 153:{ /* set bit */
|
||||
uint bit = getVarOrByte();
|
||||
_bit_array[bit >> 4] |= 1 << (bit & 15);
|
||||
_bitArray[bit >> 4] |= 1 << (bit & 15);
|
||||
break;
|
||||
}
|
||||
|
||||
case 154:{ /* clear bit */
|
||||
uint bit = getVarOrByte();
|
||||
_bit_array[bit >> 4] &= ~(1 << (bit & 15));
|
||||
_bitArray[bit >> 4] &= ~(1 << (bit & 15));
|
||||
break;
|
||||
}
|
||||
|
||||
case 155:{ /* is bit clear? */
|
||||
uint bit = getVarOrByte();
|
||||
condition = (_bit_array[bit >> 4] & (1 << (bit & 15))) == 0;
|
||||
condition = (_bitArray[bit >> 4] & (1 << (bit & 15))) == 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 156:{ /* is bit set? */
|
||||
uint bit = getVarOrByte();
|
||||
condition = (_bit_array[bit >> 4] & (1 << (bit & 15))) != 0;
|
||||
condition = (_bitArray[bit >> 4] & (1 << (bit & 15))) != 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -913,9 +913,9 @@ int SimonEngine::runScript() {
|
|||
break;
|
||||
|
||||
case 164:{
|
||||
_show_preposition = true;
|
||||
_showPreposition = true;
|
||||
o_setup_cond_c();
|
||||
_show_preposition = false;
|
||||
_showPreposition = false;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -927,25 +927,25 @@ int SimonEngine::runScript() {
|
|||
|
||||
case 166:{ /* set bit2 */
|
||||
uint bit = getVarOrByte();
|
||||
_bit_array[(bit >> 4) + 16] |= 1 << (bit & 15);
|
||||
_bitArray[(bit >> 4) + 16] |= 1 << (bit & 15);
|
||||
}
|
||||
break;
|
||||
|
||||
case 167:{ /* clear bit2 */
|
||||
uint bit = getVarOrByte();
|
||||
_bit_array[(bit >> 4) + 16] &= ~(1 << (bit & 15));
|
||||
_bitArray[(bit >> 4) + 16] &= ~(1 << (bit & 15));
|
||||
}
|
||||
break;
|
||||
|
||||
case 168:{ /* is bit2 clear */
|
||||
uint bit = getVarOrByte();
|
||||
condition = (_bit_array[(bit >> 4) + 16] & (1 << (bit & 15))) == 0;
|
||||
condition = (_bitArray[(bit >> 4) + 16] & (1 << (bit & 15))) == 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 169:{ /* is bit2 set */
|
||||
uint bit = getVarOrByte();
|
||||
condition = (_bit_array[(bit >> 4) + 16] & (1 << (bit & 15))) != 0;
|
||||
condition = (_bitArray[(bit >> 4) + 16] & (1 << (bit & 15))) != 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -979,10 +979,10 @@ int SimonEngine::runScript() {
|
|||
uint string_id = getVarOrByte();
|
||||
uint speech_id = 0;
|
||||
|
||||
const char *string_ptr = (const char *)getStringPtrByID(_stringid_array_3[string_id]);
|
||||
const char *string_ptr = (const char *)getStringPtrByID(_stringIdArray3[string_id]);
|
||||
TextLocation *tl = getTextLocation(vga_sprite_id);
|
||||
if (_game & GF_TALKIE)
|
||||
speech_id = _speechid_array_4[string_id];
|
||||
speech_id = _speechIdArray4[string_id];
|
||||
|
||||
if (_speech && speech_id != 0)
|
||||
talk_with_speech(speech_id, vga_sprite_id);
|
||||
|
@ -1027,12 +1027,12 @@ int SimonEngine::runScript() {
|
|||
case 185:{ /* midi sfx file number */
|
||||
if (_game & GF_SIMON2)
|
||||
goto invalid_opcode;
|
||||
_sound_file_id = getVarOrWord();
|
||||
_soundFileId = getVarOrWord();
|
||||
if (_game == GAME_SIMON1CD32) {
|
||||
char buf[10];
|
||||
sprintf(buf, "%d%s", _sound_file_id, "Effects");
|
||||
sprintf(buf, "%d%s", _soundFileId, "Effects");
|
||||
_sound->readSfxFile(buf);
|
||||
sprintf(buf, "%d%s", _sound_file_id, "simon");
|
||||
sprintf(buf, "%d%s", _soundFileId, "simon");
|
||||
_sound->readVoiceFile(buf);
|
||||
}
|
||||
|
||||
|
@ -1057,14 +1057,14 @@ int SimonEngine::runScript() {
|
|||
{
|
||||
uint i = getVarOrByte();
|
||||
uint str = getNextStringID();
|
||||
condition = (str < 20 && _stringid_array_2[i] == str);
|
||||
condition = (str < 20 && _stringIdArray2[i] == str);
|
||||
}
|
||||
break;
|
||||
|
||||
case 189:{ /* clear_op189_flag */
|
||||
if (!(_game & GF_SIMON2))
|
||||
goto invalid_opcode;
|
||||
_op_189_flags = 0;
|
||||
_op189Flags = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1073,7 +1073,7 @@ int SimonEngine::runScript() {
|
|||
if (!(_game & GF_SIMON2))
|
||||
goto invalid_opcode;
|
||||
i = getVarOrByte();
|
||||
if (!(_op_189_flags & (1 << i)))
|
||||
if (!(_op189Flags & (1 << i)))
|
||||
o_190_helper(i);
|
||||
}
|
||||
break;
|
||||
|
@ -1093,12 +1093,12 @@ int SimonEngine::startSubroutine(Subroutine *sub) {
|
|||
SubroutineLine *sl;
|
||||
const byte *old_code_ptr;
|
||||
|
||||
if (_start_mainscript)
|
||||
if (_startMainScript)
|
||||
dumpSubroutine(sub);
|
||||
|
||||
old_code_ptr = _code_ptr;
|
||||
old_code_ptr = _codePtr;
|
||||
|
||||
if (++_recursion_depth > 40)
|
||||
if (++_recursionDepth > 40)
|
||||
error("Recursion error");
|
||||
|
||||
sl = (SubroutineLine *)((byte *)sub + sub->first);
|
||||
|
@ -1106,14 +1106,14 @@ int SimonEngine::startSubroutine(Subroutine *sub) {
|
|||
while ((byte *)sl != (byte *)sub) {
|
||||
if (checkIfToRunSubroutineLine(sl, sub)) {
|
||||
result = 0;
|
||||
_code_ptr = (byte *)sl;
|
||||
_codePtr = (byte *)sl;
|
||||
if (sub->id)
|
||||
_code_ptr += 2;
|
||||
_codePtr += 2;
|
||||
else
|
||||
_code_ptr += 8;
|
||||
_codePtr += 8;
|
||||
|
||||
if (_continous_mainscript)
|
||||
fprintf(_dump_file, "; %d\n", sub->id);
|
||||
if (_continousMainScript)
|
||||
fprintf(_dumpFile, "; %d\n", sub->id);
|
||||
result = runScript();
|
||||
if (result != 0) {
|
||||
/* result -10 means restart subroutine */
|
||||
|
@ -1128,9 +1128,9 @@ int SimonEngine::startSubroutine(Subroutine *sub) {
|
|||
sl = (SubroutineLine *)((byte *)sub + sl->next);
|
||||
}
|
||||
|
||||
_code_ptr = old_code_ptr;
|
||||
_codePtr = old_code_ptr;
|
||||
|
||||
_recursion_depth--;
|
||||
_recursionDepth--;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1142,23 +1142,23 @@ bool SimonEngine::checkIfToRunSubroutineLine(SubroutineLine *sl, Subroutine *sub
|
|||
if (sub->id)
|
||||
return true;
|
||||
|
||||
if (sl->cond_a != -1 && sl->cond_a != _script_cond_a &&
|
||||
(sl->cond_a != -2 || _script_cond_a != -1))
|
||||
if (sl->cond_a != -1 && sl->cond_a != _scriptCondA &&
|
||||
(sl->cond_a != -2 || _scriptCondA != -1))
|
||||
return false;
|
||||
|
||||
if (sl->cond_b != -1 && sl->cond_b != _script_cond_b &&
|
||||
(sl->cond_b != -2 || _script_cond_b != -1))
|
||||
if (sl->cond_b != -1 && sl->cond_b != _scriptCondB &&
|
||||
(sl->cond_b != -2 || _scriptCondB != -1))
|
||||
return false;
|
||||
|
||||
if (sl->cond_c != -1 && sl->cond_c != _script_cond_c &&
|
||||
(sl->cond_c != -2 || _script_cond_c != -1))
|
||||
if (sl->cond_c != -1 && sl->cond_c != _scriptCondC &&
|
||||
(sl->cond_c != -2 || _scriptCondC != -1))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SimonEngine::o_83_helper() {
|
||||
if (_exit_cutscene) {
|
||||
if (_exitCutscene) {
|
||||
if (vc_get_bit(9)) {
|
||||
startSubroutine170();
|
||||
}
|
||||
|
@ -1168,9 +1168,9 @@ void SimonEngine::o_83_helper() {
|
|||
}
|
||||
|
||||
void SimonEngine::o_190_helper(uint i) {
|
||||
_exit_cutscene = false;
|
||||
while (!(_op_189_flags & (1 << i))) {
|
||||
if (_exit_cutscene) {
|
||||
_exitCutscene = false;
|
||||
while (!(_op189Flags & (1 << i))) {
|
||||
if (_exitCutscene) {
|
||||
if (vc_get_bit(9)) {
|
||||
startSubroutine170();
|
||||
break;
|
||||
|
@ -1191,24 +1191,24 @@ bool SimonEngine::o_unk_23(uint a) {
|
|||
if (a == 100)
|
||||
return 1;
|
||||
|
||||
a += _script_unk_1;
|
||||
a += _scriptUnk1;
|
||||
if (a <= 0) {
|
||||
_script_unk_1 = 0;
|
||||
_scriptUnk1 = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((uint)_rnd.getRandomNumber(99) < a) {
|
||||
if (_script_unk_1 <= 0)
|
||||
_script_unk_1 -= 5;
|
||||
if (_scriptUnk1 <= 0)
|
||||
_scriptUnk1 -= 5;
|
||||
else
|
||||
_script_unk_1 = 0;
|
||||
_scriptUnk1 = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (_script_unk_1 >= 0)
|
||||
_script_unk_1 += 5;
|
||||
if (_scriptUnk1 >= 0)
|
||||
_scriptUnk1 += 5;
|
||||
else
|
||||
_script_unk_1 = 0;
|
||||
_scriptUnk1 = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1303,27 +1303,27 @@ void SimonEngine::o_quit_if_user_presses_y() {
|
|||
delay(1);
|
||||
#ifdef _WIN32_WCE
|
||||
if (isSmartphone()) {
|
||||
if (_key_pressed) {
|
||||
if (_key_pressed == 13)
|
||||
if (_keyPressed) {
|
||||
if (_keyPressed == 13)
|
||||
shutdown();
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (_key_pressed == 'f' && _language == 20) // Hebrew
|
||||
if (_keyPressed == 'f' && _language == 20) // Hebrew
|
||||
shutdown();
|
||||
if (_key_pressed == 's' && _language == 5) // Spanish
|
||||
if (_keyPressed == 's' && _language == 5) // Spanish
|
||||
shutdown();
|
||||
if (_key_pressed == 's' && _language == 3) // Italian
|
||||
if (_keyPressed == 's' && _language == 3) // Italian
|
||||
shutdown();
|
||||
if (_key_pressed == 'o' && _language == 2) // French
|
||||
if (_keyPressed == 'o' && _language == 2) // French
|
||||
shutdown();
|
||||
if (_key_pressed == 'j' && _language == 1) // German
|
||||
if (_keyPressed == 'j' && _language == 1) // German
|
||||
shutdown();
|
||||
if (_key_pressed == 'y' && _language == 0) // English
|
||||
if (_keyPressed == 'y' && _language == 0) // English
|
||||
shutdown();
|
||||
if (_key_pressed == 'n')
|
||||
if (_keyPressed == 'n')
|
||||
goto get_out;
|
||||
}
|
||||
get_out:;
|
||||
|
@ -1332,63 +1332,63 @@ get_out:;
|
|||
void SimonEngine::o_unk_137(uint fcs_index) {
|
||||
FillOrCopyStruct *fcs;
|
||||
|
||||
fcs = _fcs_ptr_array_3[fcs_index & 7];
|
||||
fcs = _fcsPtrArray3[fcs_index & 7];
|
||||
if (fcs->fcs_data == NULL)
|
||||
return;
|
||||
fcs_unk_proc_1(fcs_index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1, fcs->fcs_data->unk2);
|
||||
}
|
||||
|
||||
void SimonEngine::o_unk_138() {
|
||||
_vga_buf_start = _vga_buf_free_start;
|
||||
_vga_file_buf_org = _vga_buf_free_start;
|
||||
_vgaBufStart = _vgaBufFreeStart;
|
||||
_vgaFileBufOrg = _vgaBufFreeStart;
|
||||
}
|
||||
|
||||
void SimonEngine::o_unk_186() {
|
||||
_vga_buf_free_start = _vga_file_buf_org_2;
|
||||
_vga_buf_start = _vga_file_buf_org_2;
|
||||
_vga_file_buf_org = _vga_file_buf_org_2;
|
||||
_vgaBufFreeStart = _vgaFileBufOrg2;
|
||||
_vgaBufStart = _vgaFileBufOrg2;
|
||||
_vgaFileBufOrg = _vgaFileBufOrg2;
|
||||
}
|
||||
|
||||
void SimonEngine::o_unk_175() {
|
||||
_vga_buf_start = _vga_buf_free_start;
|
||||
_vgaBufStart = _vgaBufFreeStart;
|
||||
}
|
||||
|
||||
void SimonEngine::o_unk_176() {
|
||||
_vga_buf_free_start = _vga_file_buf_org;
|
||||
_vga_buf_start = _vga_file_buf_org;
|
||||
_vgaBufFreeStart = _vgaFileBufOrg;
|
||||
_vgaBufStart = _vgaFileBufOrg;
|
||||
}
|
||||
|
||||
int SimonEngine::o_unk_132_helper(bool *b, char *buf) {
|
||||
HitArea *ha;
|
||||
*b = true;
|
||||
|
||||
if (!_saveload_flag) {
|
||||
if (!_saveLoadFlag) {
|
||||
strange_jump:;
|
||||
_saveload_flag = false;
|
||||
_saveLoadFlag = false;
|
||||
savegame_dialog(buf);
|
||||
}
|
||||
|
||||
start_over:;
|
||||
_key_pressed = 0;
|
||||
_keyPressed = 0;
|
||||
|
||||
if (_game == GAME_SIMON1CD32)
|
||||
goto start_over_3;
|
||||
|
||||
start_over_2:;
|
||||
_last_hitarea = _last_hitarea_3 = 0;
|
||||
_lastHitArea = _lastHitArea3 = 0;
|
||||
|
||||
do {
|
||||
if (_key_pressed != 0) {
|
||||
if (_saveload_flag) {
|
||||
if (_keyPressed != 0) {
|
||||
if (_saveLoadFlag) {
|
||||
*b = false;
|
||||
return _key_pressed;
|
||||
return _keyPressed;
|
||||
}
|
||||
goto start_over;
|
||||
}
|
||||
delay(100);
|
||||
} while (_last_hitarea_3 == 0);
|
||||
} while (_lastHitArea3 == 0);
|
||||
|
||||
ha = _last_hitarea;
|
||||
ha = _lastHitArea;
|
||||
|
||||
if (ha == NULL || ha->id < 205)
|
||||
goto start_over_2;
|
||||
|
@ -1397,22 +1397,22 @@ start_over_2:;
|
|||
return ha->id;
|
||||
|
||||
if (ha->id == 206) {
|
||||
if (_saveload_row_curpos == 1)
|
||||
if (_saveLoadRowCurPos == 1)
|
||||
goto start_over_2;
|
||||
if (_saveload_row_curpos < 7)
|
||||
_saveload_row_curpos = 1;
|
||||
if (_saveLoadRowCurPos < 7)
|
||||
_saveLoadRowCurPos = 1;
|
||||
else
|
||||
_saveload_row_curpos -= 6;
|
||||
_saveLoadRowCurPos -= 6;
|
||||
|
||||
goto strange_jump;
|
||||
}
|
||||
|
||||
if (ha->id == 207) {
|
||||
if (!_savedialog_flag)
|
||||
if (!_saveDialogFlag)
|
||||
goto start_over_2;
|
||||
_saveload_row_curpos += 6;
|
||||
if (_saveload_row_curpos >= _num_savegame_rows)
|
||||
_saveload_row_curpos = _num_savegame_rows;
|
||||
_saveLoadRowCurPos += 6;
|
||||
if (_saveLoadRowCurPos >= _numSaveGameRows)
|
||||
_saveLoadRowCurPos = _numSaveGameRows;
|
||||
goto strange_jump;
|
||||
}
|
||||
|
||||
|
@ -1427,37 +1427,37 @@ start_over_2:;
|
|||
// Down Arrow to move down slots
|
||||
// X to exit
|
||||
start_over_3:;
|
||||
if (_saveload_flag) {
|
||||
if (_saveLoadFlag) {
|
||||
*b = false;
|
||||
delay(1);
|
||||
return _key_pressed;
|
||||
return _keyPressed;
|
||||
}
|
||||
|
||||
if (_key_pressed == 17) {
|
||||
if (_saveload_row_curpos == 1)
|
||||
if (_keyPressed == 17) {
|
||||
if (_saveLoadRowCurPos == 1)
|
||||
goto start_over_3;
|
||||
if (_saveload_row_curpos < 7)
|
||||
_saveload_row_curpos = 1;
|
||||
if (_saveLoadRowCurPos < 7)
|
||||
_saveLoadRowCurPos = 1;
|
||||
else
|
||||
_saveload_row_curpos -= 6;
|
||||
_saveLoadRowCurPos -= 6;
|
||||
|
||||
goto strange_jump;
|
||||
}
|
||||
|
||||
if (_key_pressed == 18) {
|
||||
if (!_savedialog_flag)
|
||||
if (_keyPressed == 18) {
|
||||
if (!_saveDialogFlag)
|
||||
goto start_over_3;
|
||||
_saveload_row_curpos += 6;
|
||||
if (_saveload_row_curpos >= _num_savegame_rows)
|
||||
_saveload_row_curpos = _num_savegame_rows;
|
||||
_saveLoadRowCurPos += 6;
|
||||
if (_saveLoadRowCurPos >= _numSaveGameRows)
|
||||
_saveLoadRowCurPos = _numSaveGameRows;
|
||||
goto strange_jump;
|
||||
}
|
||||
|
||||
if (_key_pressed == 120)
|
||||
if (_keyPressed == 120)
|
||||
return 205;
|
||||
|
||||
if (_key_pressed > 48 && _key_pressed < 55) {
|
||||
return _key_pressed - 49;
|
||||
if (_keyPressed > 48 && _keyPressed < 55) {
|
||||
return _keyPressed - 49;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1509,13 +1509,13 @@ void SimonEngine::o_play_music_resource() {
|
|||
int loop = getVarOrByte();
|
||||
|
||||
midi.setLoop (loop != 0);
|
||||
if (_last_music_played != music)
|
||||
_next_music_to_play = music;
|
||||
if (_lastMusicPlayed != music)
|
||||
_nextMusicToPlay = music;
|
||||
else
|
||||
midi.startTrack (track);
|
||||
} else {
|
||||
if (music != _last_music_played) {
|
||||
_last_music_played = music;
|
||||
if (music != _lastMusicPlayed) {
|
||||
_lastMusicPlayed = music;
|
||||
loadMusic (music);
|
||||
midi.startTrack (track);
|
||||
}
|
||||
|
@ -1525,15 +1525,15 @@ void SimonEngine::o_play_music_resource() {
|
|||
void SimonEngine::o_unk_120(uint a) {
|
||||
uint16 id = TO_BE_16(a);
|
||||
if (_game & GF_SIMON2) {
|
||||
_lock_word |= 0x8000;
|
||||
_vc_ptr = (byte *)&id;
|
||||
_lockWord |= 0x8000;
|
||||
_vcPtr = (byte *)&id;
|
||||
vc_15_wakeup_id();
|
||||
_lock_word &= ~0x8000;
|
||||
_lockWord &= ~0x8000;
|
||||
} else {
|
||||
_lock_word |= 0x4000;
|
||||
_vc_ptr = (byte *)&id;
|
||||
_lockWord |= 0x4000;
|
||||
_vcPtr = (byte *)&id;
|
||||
vc_15_wakeup_id();
|
||||
_lock_word &= ~0x4000;
|
||||
_lockWord &= ~0x4000;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1545,22 +1545,22 @@ void SimonEngine::o_play_sound(uint sound_id) {
|
|||
}
|
||||
|
||||
void SimonEngine::o_unk_160(uint a) {
|
||||
fcs_setTextColor(_fcs_ptr_array_3[_fcs_unk_1], a);
|
||||
fcs_setTextColor(_fcsPtrArray3[_fcsUnk1], a);
|
||||
}
|
||||
|
||||
void SimonEngine::o_unk_103() {
|
||||
lock();
|
||||
fcs_unk1(_fcs_unk_1);
|
||||
fcs_unk1(_fcsUnk1);
|
||||
showMessageFormat("\x0C");
|
||||
unlock();
|
||||
}
|
||||
|
||||
void SimonEngine::o_kill_sprite_simon1(uint a) {
|
||||
uint16 b = TO_BE_16(a);
|
||||
_lock_word |= 0x4000;
|
||||
_vc_ptr = (byte *)&b;
|
||||
_lockWord |= 0x4000;
|
||||
_vcPtr = (byte *)&b;
|
||||
vc_60_kill_sprite();
|
||||
_lock_word &= ~0x4000;
|
||||
_lockWord &= ~0x4000;
|
||||
}
|
||||
|
||||
void SimonEngine::o_kill_sprite_simon2(uint a, uint b) {
|
||||
|
@ -1569,24 +1569,24 @@ void SimonEngine::o_kill_sprite_simon2(uint a, uint b) {
|
|||
items[0] = TO_BE_16(a);
|
||||
items[1] = TO_BE_16(b);
|
||||
|
||||
_lock_word |= 0x8000;
|
||||
_vc_ptr = (byte *)&items;
|
||||
_lockWord |= 0x8000;
|
||||
_vcPtr = (byte *)&items;
|
||||
vc_60_kill_sprite();
|
||||
_lock_word &= ~0x8000;
|
||||
_lockWord &= ~0x8000;
|
||||
}
|
||||
|
||||
/* OK */
|
||||
void SimonEngine::o_unk26_helper(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h) {
|
||||
a &= 7;
|
||||
|
||||
if (_fcs_ptr_array_3[a])
|
||||
if (_fcsPtrArray3[a])
|
||||
fcs_delete(a);
|
||||
|
||||
_fcs_ptr_array_3[a] = fcs_alloc(b, c, d, e, f, g, h);
|
||||
_fcsPtrArray3[a] = fcs_alloc(b, c, d, e, f, g, h);
|
||||
|
||||
if (a == _fcs_unk_1) {
|
||||
_fcs_ptr_1 = _fcs_ptr_array_3[a];
|
||||
showmessage_helper_3(_fcs_ptr_1->textLength, _fcs_ptr_1->textMaxLength);
|
||||
if (a == _fcsUnk1) {
|
||||
_fcsPtr1 = _fcsPtrArray3[a];
|
||||
showmessage_helper_3(_fcsPtr1->textLength, _fcsPtr1->textMaxLength);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ void SimonEngine::loadGamePcFile(const char *filename) {
|
|||
readGamePcText(&in);
|
||||
|
||||
for (i = 2; i < num_inited_objects; i++) {
|
||||
readItemFromGamePc(&in, _itemarray_ptr[i]);
|
||||
readItemFromGamePc(&in, _itemArrayPtr[i]);
|
||||
}
|
||||
|
||||
readSubroutineBlock(&in);
|
||||
|
@ -137,16 +137,16 @@ void SimonEngine::loadGamePcFile(const char *filename) {
|
|||
|
||||
file_size = in.size();
|
||||
|
||||
_tbl_list = (byte *)malloc(file_size);
|
||||
if (_tbl_list == NULL)
|
||||
_tblList = (byte *)malloc(file_size);
|
||||
if (_tblList == NULL)
|
||||
error("Out of memory for strip table list");
|
||||
in.read(_tbl_list, file_size);
|
||||
in.read(_tblList, file_size);
|
||||
in.close();
|
||||
|
||||
/* Remember the current state */
|
||||
_subroutine_list_org = _subroutine_list;
|
||||
_tablesheap_ptr_org = _tablesheap_ptr;
|
||||
_tablesheap_curpos_org = _tablesheap_curpos;
|
||||
_subroutineListOrg = _subroutineList;
|
||||
_tablesHeapPtrOrg = _tablesHeapPtr;
|
||||
_tablesHeapCurPosOrg = _tablesHeapCurPos;
|
||||
|
||||
/* Read list of TEXT resources */
|
||||
if (_game == GAME_SIMON1ACORN)
|
||||
|
@ -157,10 +157,10 @@ void SimonEngine::loadGamePcFile(const char *filename) {
|
|||
error("Can't open text resources file 'STRIPPED.TXT'");
|
||||
|
||||
file_size = in.size();
|
||||
_stripped_txt_mem = (byte *)malloc(file_size);
|
||||
if (_stripped_txt_mem == NULL)
|
||||
_strippedTxtMem = (byte *)malloc(file_size);
|
||||
if (_strippedTxtMem == NULL)
|
||||
error("Out of memory for strip text list");
|
||||
in.read(_stripped_txt_mem, file_size);
|
||||
in.read(_strippedTxtMem, file_size);
|
||||
in.close();
|
||||
}
|
||||
|
||||
|
@ -168,14 +168,14 @@ void SimonEngine::readGamePcText(File *in) {
|
|||
uint text_size;
|
||||
byte *text_mem;
|
||||
|
||||
_text_size = text_size = in->readUint32BE();
|
||||
_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, _stringtab_num);
|
||||
setupStringTable(text_mem, _stringTabNum);
|
||||
}
|
||||
|
||||
void SimonEngine::readItemFromGamePc(File *in, Item *item) {
|
||||
|
|
|
@ -115,7 +115,7 @@ void SimonEngine::quick_load_or_save() {
|
|||
char buf[50];
|
||||
|
||||
char *filename = gen_savename(_saveLoadSlot);
|
||||
if (_saveLoadFlag == 2) {
|
||||
if (_saveLoadType == 2) {
|
||||
Subroutine *sub;
|
||||
success = load_game(_saveLoadSlot);
|
||||
if (!success) {
|
||||
|
@ -140,14 +140,14 @@ void SimonEngine::quick_load_or_save() {
|
|||
GUI::MessageDialog dialog(buf, "OK");
|
||||
dialog.runModal();
|
||||
|
||||
} else if (_saveLoadFlag == 1) {
|
||||
} else if (_saveLoadType == 1) {
|
||||
sprintf(buf, "Successfully saved game state in file:\n\n%s", filename);
|
||||
GUI::TimedMessageDialog dialog(buf, 1500);
|
||||
dialog.runModal();
|
||||
|
||||
}
|
||||
|
||||
_saveLoadFlag = 0;
|
||||
_saveLoadType = 0;
|
||||
}
|
||||
|
||||
void SimonEngine::savegame_dialog(char *buf) {
|
||||
|
@ -155,15 +155,15 @@ void SimonEngine::savegame_dialog(char *buf) {
|
|||
|
||||
o_unk_132_helper_3();
|
||||
|
||||
i = display_savegame_list(_saveload_row_curpos, _save_or_load, buf);
|
||||
i = display_savegame_list(_saveLoadRowCurPos, _saveOrLoad, buf);
|
||||
|
||||
_savedialog_flag = true;
|
||||
_saveDialogFlag = true;
|
||||
|
||||
if (i != 7) {
|
||||
i++;
|
||||
if (!_save_or_load)
|
||||
if (!_saveOrLoad)
|
||||
i++;
|
||||
_savedialog_flag = false;
|
||||
_saveDialogFlag = false;
|
||||
}
|
||||
|
||||
if (!--i)
|
||||
|
@ -185,11 +185,11 @@ void SimonEngine::save_or_load_dialog(bool load) {
|
|||
bool b;
|
||||
char buf[108];
|
||||
|
||||
_save_or_load = load;
|
||||
_saveOrLoad = load;
|
||||
|
||||
save_time = time(NULL);
|
||||
|
||||
_copy_partial_mode = 1;
|
||||
_copyPartialMode = 1;
|
||||
|
||||
number_of_savegames = count_savegames();
|
||||
if (!load)
|
||||
|
@ -198,13 +198,13 @@ void SimonEngine::save_or_load_dialog(bool load) {
|
|||
if (number_of_savegames < 0)
|
||||
number_of_savegames = 0;
|
||||
number_of_savegames++;
|
||||
_num_savegame_rows = number_of_savegames;
|
||||
_numSaveGameRows = number_of_savegames;
|
||||
|
||||
_saveload_row_curpos = 1;
|
||||
_saveLoadRowCurPos = 1;
|
||||
if (!load)
|
||||
_saveload_row_curpos = number_of_savegames;
|
||||
_saveLoadRowCurPos = number_of_savegames;
|
||||
|
||||
_saveload_flag = false;
|
||||
_saveLoadFlag = false;
|
||||
|
||||
restart:;
|
||||
do {
|
||||
|
@ -223,7 +223,7 @@ restart:;
|
|||
|
||||
// some code here
|
||||
|
||||
fcs = _fcs_ptr_array_3[5];
|
||||
fcs = _fcsPtrArray3[5];
|
||||
|
||||
fcs->textRow = unk132_result;
|
||||
|
||||
|
@ -272,7 +272,7 @@ restart:;
|
|||
for (;;) {
|
||||
video_putchar(fcs, 0x7f);
|
||||
|
||||
_saveload_flag = true;
|
||||
_saveLoadFlag = true;
|
||||
|
||||
// do_2
|
||||
do {
|
||||
|
@ -282,22 +282,22 @@ restart:;
|
|||
if (i == 205)
|
||||
goto get_out;
|
||||
clear_hitarea_bit_0x40(0xd0 + unk132_result);
|
||||
if (_saveload_flag) {
|
||||
o_clear_character(_fcs_ptr_array_3[5], 8);
|
||||
if (_saveLoadFlag) {
|
||||
o_clear_character(_fcsPtrArray3[5], 8);
|
||||
// move code
|
||||
}
|
||||
goto if_1;
|
||||
}
|
||||
|
||||
// is_not_b
|
||||
if (!_saveload_flag) {
|
||||
if (!_saveLoadFlag) {
|
||||
clear_hitarea_bit_0x40(0xd0 + unk132_result);
|
||||
goto restart;
|
||||
}
|
||||
} while (i >= 0x80 || i == 0);
|
||||
|
||||
// after_do_2
|
||||
o_clear_character(_fcs_ptr_array_3[5], 8);
|
||||
o_clear_character(_fcsPtrArray3[5], 8);
|
||||
if (i == 10 || i == 13)
|
||||
break;
|
||||
if (i == 8) {
|
||||
|
@ -316,35 +316,35 @@ restart:;
|
|||
|
||||
name[name_len] = 0;
|
||||
|
||||
o_clear_character(_fcs_ptr_array_3[5], x, m);
|
||||
o_clear_character(_fcsPtrArray3[5], x, m);
|
||||
}
|
||||
} else if (i >= 32 && name_len != 17) {
|
||||
name[name_len++] = i;
|
||||
|
||||
video_putchar(_fcs_ptr_array_3[5], i);
|
||||
video_putchar(_fcsPtrArray3[5], i);
|
||||
}
|
||||
}
|
||||
|
||||
// do_save
|
||||
if (!save_game(_saveload_row_curpos + unk132_result, buf + unk132_result * 18))
|
||||
o_file_error(_fcs_ptr_array_3[5], true);
|
||||
if (!save_game(_saveLoadRowCurPos + unk132_result, buf + unk132_result * 18))
|
||||
o_file_error(_fcsPtrArray3[5], true);
|
||||
} else {
|
||||
if (!load_game(_saveload_row_curpos + i))
|
||||
o_file_error(_fcs_ptr_array_3[5], false);
|
||||
if (!load_game(_saveLoadRowCurPos + i))
|
||||
o_file_error(_fcsPtrArray3[5], false);
|
||||
}
|
||||
|
||||
get_out:;
|
||||
o_unk_132_helper_3();
|
||||
|
||||
_base_time = time(NULL) - save_time + _base_time;
|
||||
_copy_partial_mode = 0;
|
||||
_copyPartialMode = 0;
|
||||
|
||||
dx_copy_rgn_from_3_to_2(94, 208, 46, 80);
|
||||
|
||||
i = _timer_4;
|
||||
i = _timer4;
|
||||
do {
|
||||
delay(10);
|
||||
} while (i == _timer_4);
|
||||
} while (i == _timer4);
|
||||
|
||||
g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
|
||||
}
|
||||
|
@ -385,13 +385,13 @@ void SimonEngine::o_file_error(FillOrCopyStruct *fcs, bool save_error) {
|
|||
ha->layer = 0x3EF;
|
||||
|
||||
loop:;
|
||||
_last_hitarea = _last_hitarea_3 = 0;
|
||||
_lastHitArea = _lastHitArea3 = 0;
|
||||
|
||||
do {
|
||||
delay(1);
|
||||
} while (_last_hitarea_3 == 0);
|
||||
} while (_lastHitArea3 == 0);
|
||||
|
||||
ha = _last_hitarea;
|
||||
ha = _lastHitArea;
|
||||
if (ha == NULL || ha->id != 0x7FFF)
|
||||
goto loop;
|
||||
|
||||
|
@ -404,34 +404,34 @@ bool SimonEngine::save_game(uint slot, char *caption) {
|
|||
uint item_index, num_item, i, j;
|
||||
TimeEvent *te;
|
||||
|
||||
_lock_word |= 0x100;
|
||||
_lockWord |= 0x100;
|
||||
|
||||
f = _saveFileMan->openForSaving(gen_savename(slot));
|
||||
if (f == NULL) {
|
||||
_lock_word &= ~0x100;
|
||||
_lockWord &= ~0x100;
|
||||
return false;
|
||||
}
|
||||
|
||||
f->write(caption, 0x12);
|
||||
|
||||
f->writeUint32BE(_itemarray_inited - 1);
|
||||
f->writeUint32BE(_itemArrayInited - 1);
|
||||
f->writeUint32BE(0xFFFFFFFF);
|
||||
f->writeUint32BE(0);
|
||||
f->writeUint32BE(0);
|
||||
|
||||
i = 0;
|
||||
for (te = _first_time_struct; te; te = te->next)
|
||||
for (te = _firstTimeStruct; te; te = te->next)
|
||||
i++;
|
||||
f->writeUint32BE(i);
|
||||
|
||||
for (te = _first_time_struct; te; te = te->next) {
|
||||
for (te = _firstTimeStruct; te; te = te->next) {
|
||||
f->writeUint32BE(te->time + _base_time);
|
||||
f->writeUint16BE(te->subroutine_id);
|
||||
}
|
||||
|
||||
item_index = 1;
|
||||
for (num_item = _itemarray_inited - 1; num_item; num_item--) {
|
||||
Item *item = _itemarray_ptr[item_index++];
|
||||
for (num_item = _itemArrayInited - 1; num_item; num_item--) {
|
||||
Item *item = _itemArrayPtr[item_index++];
|
||||
|
||||
f->writeUint16BE(item->parent);
|
||||
f->writeUint16BE(item->sibling);
|
||||
|
@ -470,16 +470,16 @@ bool SimonEngine::save_game(uint slot, char *caption) {
|
|||
|
||||
// write the items in array 6
|
||||
for (i = 0; i != 10; i++) {
|
||||
f->writeUint16BE(itemPtrToID(_item_array_6[i]));
|
||||
f->writeUint16BE(itemPtrToID(_itemArray6[i]));
|
||||
}
|
||||
|
||||
// Write the bits in array 1 & 2
|
||||
for (i = 0; i != 32; i++)
|
||||
f->writeUint16BE(_bit_array[i]);
|
||||
f->writeUint16BE(_bitArray[i]);
|
||||
|
||||
delete f;
|
||||
|
||||
_lock_word &= ~0x100;
|
||||
_lockWord &= ~0x100;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -500,11 +500,11 @@ bool SimonEngine::load_game(uint slot) {
|
|||
InSaveFile *f;
|
||||
uint num, item_index, i, j;
|
||||
|
||||
_lock_word |= 0x100;
|
||||
_lockWord |= 0x100;
|
||||
|
||||
f = _saveFileMan->openForLoading(gen_savename(slot));
|
||||
if (f == NULL) {
|
||||
_lock_word &= ~0x100;
|
||||
_lockWord &= ~0x100;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -512,15 +512,15 @@ bool SimonEngine::load_game(uint slot) {
|
|||
|
||||
num = f->readUint32BE();
|
||||
|
||||
if (f->readUint32BE() != 0xFFFFFFFF || num != _itemarray_inited - 1) {
|
||||
if (f->readUint32BE() != 0xFFFFFFFF || num != _itemArrayInited - 1) {
|
||||
delete f;
|
||||
_lock_word &= ~0x100;
|
||||
_lockWord &= ~0x100;
|
||||
return false;
|
||||
}
|
||||
|
||||
f->readUint32BE();
|
||||
f->readUint32BE();
|
||||
_no_parent_notify = true;
|
||||
_noParentNotify = true;
|
||||
|
||||
|
||||
// add all timers
|
||||
|
@ -532,8 +532,8 @@ bool SimonEngine::load_game(uint slot) {
|
|||
}
|
||||
|
||||
item_index = 1;
|
||||
for (num = _itemarray_inited - 1; num; num--) {
|
||||
Item *item = _itemarray_ptr[item_index++], *parent_item;
|
||||
for (num = _itemArrayInited - 1; num; num--) {
|
||||
Item *item = _itemArrayPtr[item_index++], *parent_item;
|
||||
|
||||
uint parent = f->readUint16BE();
|
||||
uint sibling = f->readUint16BE();
|
||||
|
@ -583,12 +583,12 @@ bool SimonEngine::load_game(uint slot) {
|
|||
|
||||
// write the items in array 6
|
||||
for (i = 0; i != 10; i++) {
|
||||
_item_array_6[i] = derefItem(f->readUint16BE());
|
||||
_itemArray6[i] = derefItem(f->readUint16BE());
|
||||
}
|
||||
|
||||
// Write the bits in array 1 & 2
|
||||
for (i = 0; i != 32; i++)
|
||||
_bit_array[i] = f->readUint16BE();
|
||||
_bitArray[i] = f->readUint16BE();
|
||||
|
||||
if (f->ioFailed()) {
|
||||
error("load failed");
|
||||
|
@ -596,9 +596,9 @@ bool SimonEngine::load_game(uint slot) {
|
|||
|
||||
delete f;
|
||||
|
||||
_no_parent_notify = false;
|
||||
_noParentNotify = false;
|
||||
|
||||
_lock_word &= ~0x100;
|
||||
_lockWord &= ~0x100;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
1651
simon/simon.cpp
1651
simon/simon.cpp
File diff suppressed because it is too large
Load diff
291
simon/simon.h
291
simon/simon.h
|
@ -112,11 +112,11 @@ class SimonEngine : public Engine {
|
|||
protected:
|
||||
void playSting(uint a);
|
||||
|
||||
const byte *_vc_ptr; /* video code ptr */
|
||||
const byte *_vcPtr; /* video code ptr */
|
||||
uint16 _vc_get_out_of_code;
|
||||
|
||||
|
||||
uint32 *_game_offsets_ptr;
|
||||
uint32 *_gameOffsetsPtr;
|
||||
|
||||
uint VGA_DELAY_BASE;
|
||||
uint TABLE_INDEX_BASE;
|
||||
|
@ -129,7 +129,7 @@ protected:
|
|||
const GameSpecificSettings *gss;
|
||||
|
||||
byte _game;
|
||||
byte _key_pressed;
|
||||
byte _keyPressed;
|
||||
|
||||
typedef enum {
|
||||
FORMAT_NONE,
|
||||
|
@ -138,234 +138,229 @@ protected:
|
|||
FORMAT_VOC
|
||||
} SoundFormat;
|
||||
|
||||
File *_game_file;
|
||||
File *_gameFile;
|
||||
|
||||
byte *_stripped_txt_mem;
|
||||
uint _text_size;
|
||||
uint _stringtab_num, _stringtab_pos, _stringtab_numalloc;
|
||||
byte **_stringtab_ptr;
|
||||
byte *_strippedTxtMem;
|
||||
uint _textSize;
|
||||
uint _stringTabNum, _stringTabPos, _stringtab_numalloc;
|
||||
byte **_stringTabPtr;
|
||||
|
||||
Item **_itemarray_ptr;
|
||||
uint _itemarray_size;
|
||||
uint _itemarray_inited;
|
||||
Item **_itemArrayPtr;
|
||||
uint _itemArraySize;
|
||||
uint _itemArrayInited;
|
||||
|
||||
byte *_itemheap_ptr;
|
||||
uint _itemheap_curpos;
|
||||
uint _itemheap_size;
|
||||
byte *_itemHeapPtr;
|
||||
uint _itemHeapCurPos;
|
||||
uint _itemHeapSize;
|
||||
|
||||
byte *_icon_file_ptr;
|
||||
byte *_iconFilePtr;
|
||||
|
||||
byte *_tbl_list;
|
||||
byte *_tblList;
|
||||
|
||||
const byte *_code_ptr;
|
||||
const byte *_codePtr;
|
||||
|
||||
|
||||
byte **_local_stringtable;
|
||||
uint _string_id_local_min, _string_id_local_max;
|
||||
byte **_localStringtable;
|
||||
uint _stringIdLocalMin, _stringIdLocalMax;
|
||||
|
||||
byte *_tablesheap_ptr, *_tablesheap_ptr_org, *_tablesheap_ptr_new;
|
||||
uint _tablesheap_size, _tablesheap_curpos, _tablesheap_curpos_org;
|
||||
uint _tablesheap_curpos_new;
|
||||
byte *_tablesHeapPtr, *_tablesHeapPtrOrg, *_tablesheapPtrNew;
|
||||
uint _tablesHeapSize, _tablesHeapCurPos, _tablesHeapCurPosOrg;
|
||||
uint _tablesHeapCurPosNew;
|
||||
|
||||
Subroutine *_subroutine_list, *_subroutine_list_org;
|
||||
Subroutine *_subroutineList, *_subroutineListOrg;
|
||||
uint _subroutine;
|
||||
|
||||
uint _dx_surface_pitch;
|
||||
uint _dxSurfacePitch;
|
||||
|
||||
uint _recursion_depth;
|
||||
uint _recursionDepth;
|
||||
|
||||
uint32 _last_vga_tick;
|
||||
uint32 _lastVgaTick;
|
||||
|
||||
uint16 _op_189_flags;
|
||||
uint16 _op189Flags;
|
||||
|
||||
bool _scriptvar_2;
|
||||
bool _run_script_return_1;
|
||||
bool _skip_vga_wait;
|
||||
bool _no_parent_notify;
|
||||
bool _vga_res_328_loaded;
|
||||
bool _scriptVar2;
|
||||
bool _runScriptReturn1;
|
||||
bool _skipVgaWait;
|
||||
bool _noParentNotify;
|
||||
bool _vgaRes328Loaded;
|
||||
bool _hitarea_unk_3;
|
||||
bool _mortal_flag;
|
||||
volatile bool _sync_flag_1;
|
||||
byte _video_var_8;
|
||||
bool _use_palette_delay;
|
||||
bool _sync_flag_2;
|
||||
bool _in_callback;
|
||||
bool _cepe_flag;
|
||||
byte _copy_partial_mode;
|
||||
bool _mortalFlag;
|
||||
byte _videoVar8;
|
||||
bool _usePaletteDelay;
|
||||
bool _syncFlag2;
|
||||
bool _inCallBack;
|
||||
bool _cepeFlag;
|
||||
byte _copyPartialMode;
|
||||
uint _speed;
|
||||
bool _fast_mode;
|
||||
bool _dx_use_3_or_4_for_lock;
|
||||
bool _fastMode;
|
||||
bool _dxUse3Or4ForLock;
|
||||
|
||||
uint16 _debugMode;
|
||||
uint16 _language;
|
||||
bool _pause;
|
||||
bool _start_mainscript;
|
||||
bool _continous_mainscript;
|
||||
bool _start_vgascript;
|
||||
bool _continous_vgascript;
|
||||
bool _draw_images_debug;
|
||||
bool _dump_images;
|
||||
bool _startMainScript;
|
||||
bool _continousMainScript;
|
||||
bool _startVgaScript;
|
||||
bool _continousVgaScript;
|
||||
bool _drawImagesDebug;
|
||||
bool _dumpImages;
|
||||
bool _speech;
|
||||
bool _subtitles;
|
||||
bool _fade;
|
||||
byte _mouse_cursor;
|
||||
bool _vga_var9;
|
||||
int16 _script_unk_1;
|
||||
bool _vga_var6;
|
||||
int _x_scroll, _vga_var1, _vga_var2, _xscroll_step, _sprite_height;
|
||||
const byte *_vga_var7;
|
||||
byte _vga_var8;
|
||||
byte _mouseCursor;
|
||||
bool _vgaVar9;
|
||||
int16 _scriptUnk1;
|
||||
bool _vgaVar6;
|
||||
int _xScroll, _vgaVar1, _vgaVar2, _xScrollStep, _spriteHeight;
|
||||
const byte *_vgaVar7;
|
||||
byte _vgaVar8;
|
||||
|
||||
int16 _script_cond_a, _script_cond_b, _script_cond_c;
|
||||
int16 _scriptCondA, _scriptCondB, _scriptCondC;
|
||||
|
||||
uint16 _fcs_unk_1;
|
||||
FillOrCopyStruct *_fcs_ptr_1;
|
||||
uint16 _fcsUnk1;
|
||||
FillOrCopyStruct *_fcsPtr1;
|
||||
|
||||
Item *_subject_item, *_object_item;
|
||||
Item *_item_1;
|
||||
Item *_subjectItem, *_objectItem;
|
||||
Item *_item1;
|
||||
|
||||
Item *_hitarea_object_item;
|
||||
HitArea *_last_hitarea;
|
||||
HitArea *_last_hitarea_2_ptr;
|
||||
HitArea *_last_hitarea_3;
|
||||
byte _left_button_down;
|
||||
Item *_hitarea_subject_item;
|
||||
HitArea *_hitarea_ptr_5, *_hitarea_ptr_7;
|
||||
uint _need_hitarea_recalc;
|
||||
uint _verb_hitarea;
|
||||
uint16 _hitarea_unk_4;
|
||||
uint _lock_counter;
|
||||
Item *_hitAreaObjectItem;
|
||||
HitArea *_lastHitArea;
|
||||
HitArea *_lastHitArea2Ptr;
|
||||
HitArea *_lastHitArea3;
|
||||
byte _leftButtonDown;
|
||||
Item *_hitAreaSubjectItem;
|
||||
HitArea *_hitAreaPtr5, *_hitAreaPtr7;
|
||||
uint _needHitAreaRecalc;
|
||||
uint _verbHitArea;
|
||||
uint16 _hitAreaUnk4;
|
||||
uint _lockCounter;
|
||||
|
||||
uint16 _video_palette_mode;
|
||||
uint16 _videoPaletteMode;
|
||||
|
||||
uint _print_char_unk_1, _print_char_unk_2;
|
||||
uint _num_letters_to_print;
|
||||
uint _printCharUnk1, _printCharUnk2;
|
||||
uint _numLettersToPrint;
|
||||
|
||||
uint _last_time;
|
||||
uint _lastTime;
|
||||
|
||||
TimeEvent *_first_time_struct, *_pending_delete_time_event;
|
||||
TimeEvent *_firstTimeStruct, *_pendingDeleteTimeEvent;
|
||||
|
||||
uint _base_time;
|
||||
|
||||
uint _mouse_x, _mouse_y;
|
||||
uint _mouse_x_old, _mouse_y_old;
|
||||
uint _mouseX, _mouseY;
|
||||
uint _mouseXOld, _mouseYOld;
|
||||
|
||||
Item *_dummy_item_1;
|
||||
Item *_dummy_item_2;
|
||||
Item *_dummy_item_3;
|
||||
Item *_dummyItem1;
|
||||
Item *_dummyItem2;
|
||||
Item *_dummyItem3;
|
||||
|
||||
volatile uint16 _lock_word;
|
||||
uint16 _scroll_up_hit_area;
|
||||
uint16 _scroll_down_hit_area;
|
||||
volatile uint16 _lockWord;
|
||||
uint16 _scrollUpHitArea;
|
||||
uint16 _scrollDownHitArea;
|
||||
|
||||
uint16 _video_var_7;
|
||||
volatile uint16 _palette_color_count;
|
||||
uint16 _videoVar7;
|
||||
volatile uint16 _paletteColorCount;
|
||||
|
||||
byte _video_var_4;
|
||||
bool _video_var_5;
|
||||
bool _video_var_3;
|
||||
bool _unk_pal_flag;
|
||||
bool _exit_cutscene;
|
||||
bool _skip_speech;
|
||||
byte _video_var_9;
|
||||
byte _videoVar4;
|
||||
bool _videoVar5;
|
||||
bool _videoVar3;
|
||||
bool _unkPalFlag;
|
||||
bool _exitCutscene;
|
||||
bool _skipSpeech;
|
||||
byte _videoVar9;
|
||||
|
||||
uint _sound_file_id;
|
||||
int16 _last_music_played;
|
||||
int16 _next_music_to_play;
|
||||
uint _soundFileId;
|
||||
int16 _lastMusicPlayed;
|
||||
int16 _nextMusicToPlay;
|
||||
|
||||
bool _show_preposition;
|
||||
bool _showmessage_flag;
|
||||
bool _showPreposition;
|
||||
bool _showMessageFlag;
|
||||
|
||||
uint _video_num_pal_colors;
|
||||
uint _videoNumPalColors;
|
||||
|
||||
uint _invoke_timer_callback;
|
||||
uint _vgaSpriteChanged;
|
||||
|
||||
uint _vga_sprite_changed;
|
||||
byte *_vgaBufFreeStart, *_vgaBufEnd, *_vgaBufStart;
|
||||
byte *_vgaFileBufOrg, *_vgaFileBufOrg2;
|
||||
|
||||
byte *_vga_buf_free_start, *_vga_buf_end, *_vga_buf_start;
|
||||
byte *_vga_file_buf_org, *_vga_file_buf_org_2;
|
||||
byte *_curVgaFile1;
|
||||
byte *_curVgaFile2;
|
||||
|
||||
byte *_cur_vga_file_1;
|
||||
byte *_cur_vga_file_2;
|
||||
uint16 _timer1, _timer5, _timer4;
|
||||
|
||||
uint16 _timer_1, _timer_5, _timer_4;
|
||||
uint16 _vgaBaseDelay;
|
||||
|
||||
uint16 _vga_base_delay;
|
||||
uint16 _vgaCurFile2;
|
||||
uint16 _vgaWaitFor, _vgaCurFileId;
|
||||
uint16 _vgaCurSpriteId;
|
||||
|
||||
uint16 _vga_cur_file_2;
|
||||
uint16 _vga_wait_for, _vga_cur_file_id;
|
||||
uint16 _vga_cur_sprite_id;
|
||||
VgaTimerEntry *_nextVgaTimerToProcess;
|
||||
|
||||
VgaTimerEntry *_next_vga_timer_to_process;
|
||||
Item *_vcItemArray[20];
|
||||
Item *_itemArray6[20];
|
||||
|
||||
Item *_vc_item_array[20];
|
||||
Item *_item_array_6[20];
|
||||
uint16 _stringIdArray2[20];
|
||||
uint16 _stringIdArray3[20];
|
||||
uint16 _speechIdArray4[20];
|
||||
|
||||
uint16 _stringid_array_2[20];
|
||||
uint16 _stringid_array_3[20];
|
||||
uint16 _speechid_array_4[20];
|
||||
|
||||
uint16 _bit_array[32];
|
||||
uint16 _bitArray[32];
|
||||
int16 _variableArray[256];
|
||||
|
||||
FillOrCopyStruct *_fcs_ptr_array_3[8];
|
||||
FillOrCopyStruct *_fcsPtrArray3[8];
|
||||
|
||||
byte _fcs_data_1[8];
|
||||
bool _fcs_data_2[8];
|
||||
byte _fcsData1[8];
|
||||
bool _fcsData2[8];
|
||||
|
||||
TextLocation _textlocation_1, _textlocation_2, _textlocation_3, _textlocation_4;
|
||||
TextLocation _textLocation1, _textLocation2, _textLocation3, _textLocation4;
|
||||
|
||||
int _free_string_slot;
|
||||
int _freeStringSlot;
|
||||
|
||||
byte _stringReturnBuffer[2][180];
|
||||
|
||||
HitArea _hit_areas[90];
|
||||
HitArea _hitAreas[90];
|
||||
|
||||
VgaPointersEntry _vga_buffer_pointers[180];
|
||||
VgaSprite _vga_sprites[180];
|
||||
VgaSleepStruct _vga_sleep_structs[30];
|
||||
VgaPointersEntry _vgaBufferPointers[180];
|
||||
VgaSprite _vgaSprites[180];
|
||||
VgaSleepStruct _vgaSleepStructs[30];
|
||||
|
||||
const uint16 *_pathfind_array[20];
|
||||
const uint16 *_pathFindArray[20];
|
||||
|
||||
uint8 _palette_backup[1024];
|
||||
uint8 _paletteBackup[1024];
|
||||
uint8 _palette[1024];
|
||||
|
||||
byte _video_buf_1[3000];
|
||||
byte _videoBuf1[3000];
|
||||
|
||||
VgaTimerEntry _vga_timer_list[95];
|
||||
VgaTimerEntry _vgaTimerList[95];
|
||||
|
||||
FillOrCopyStruct *_fcs_list;
|
||||
|
||||
byte _letters_to_print_buf[80];
|
||||
byte _lettersToPrintBuf[80];
|
||||
|
||||
MidiPlayer midi;
|
||||
int _midiDriver;
|
||||
|
||||
int _num_screen_updates;
|
||||
int _vga_tick_counter;
|
||||
int _numScreenUpdates;
|
||||
int _vgaTickCounter;
|
||||
|
||||
Sound *_sound;
|
||||
|
||||
bool _effects_paused;
|
||||
bool _ambient_paused;
|
||||
bool _music_paused;
|
||||
bool _effectsPaused;
|
||||
bool _ambientPaused;
|
||||
bool _musicPaused;
|
||||
|
||||
Debugger *_debugger;
|
||||
|
||||
int _timer_id;
|
||||
FILE *_dumpFile;
|
||||
|
||||
FILE *_dump_file;
|
||||
int _saveLoadRowCurPos;
|
||||
int _numSaveGameRows;
|
||||
bool _saveDialogFlag;
|
||||
bool _saveOrLoad;
|
||||
bool _saveLoadFlag;
|
||||
|
||||
int _saveload_row_curpos;
|
||||
int _num_savegame_rows;
|
||||
bool _savedialog_flag;
|
||||
bool _save_or_load;
|
||||
bool _saveload_flag;
|
||||
|
||||
byte _saveLoadFlag, _saveLoadSlot;
|
||||
byte _saveLoadType, _saveLoadSlot;
|
||||
char _saveLoadName[32];
|
||||
|
||||
int _sdl_mouse_x, _sdl_mouse_y;
|
||||
int _sdlMouseX, _sdlMouseY;
|
||||
|
||||
byte *_sdl_buf_3;
|
||||
byte *_sdl_buf;
|
||||
|
@ -373,7 +368,7 @@ protected:
|
|||
|
||||
Common::RandomSource _rnd;
|
||||
|
||||
const byte *_vc_10_base_ptr_old;
|
||||
const byte *_vc10BasePtrOld;
|
||||
byte _hebrew_char_widths[32];
|
||||
|
||||
public:
|
||||
|
|
|
@ -234,8 +234,8 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer
|
|||
_voice = 0;
|
||||
_effects = 0;
|
||||
|
||||
_effects_paused = false;
|
||||
_ambient_paused = false;
|
||||
_effectsPaused = false;
|
||||
_ambientPaused = false;
|
||||
|
||||
_filenums = 0;
|
||||
_last_voice_file = 0;
|
||||
|
@ -455,7 +455,7 @@ void Sound::playEffects(uint sound) {
|
|||
if (!_effects)
|
||||
return;
|
||||
|
||||
if (_effects_paused)
|
||||
if (_effectsPaused)
|
||||
return;
|
||||
|
||||
_effects->playSound(sound, &_effects_handle, (_game == GAME_SIMON1CD32) ? 0 : SoundMixer::FLAG_UNSIGNED);
|
||||
|
@ -470,7 +470,7 @@ void Sound::playAmbient(uint sound) {
|
|||
|
||||
_ambient_playing = sound;
|
||||
|
||||
if (_ambient_paused)
|
||||
if (_ambientPaused)
|
||||
return;
|
||||
|
||||
_mixer->stopHandle(_ambient_handle);
|
||||
|
@ -491,13 +491,13 @@ void Sound::stopAll() {
|
|||
}
|
||||
|
||||
void Sound::effectsPause(bool b) {
|
||||
_effects_paused = b;
|
||||
_effectsPaused = b;
|
||||
}
|
||||
|
||||
void Sound::ambientPause(bool b) {
|
||||
_ambient_paused = b;
|
||||
_ambientPaused = b;
|
||||
|
||||
if (_ambient_paused && _ambient_playing) {
|
||||
if (_ambientPaused && _ambient_playing) {
|
||||
_mixer->stopHandle(_ambient_handle);
|
||||
} else if (_ambient_playing) {
|
||||
uint tmp = _ambient_playing;
|
||||
|
|
|
@ -37,8 +37,8 @@ private:
|
|||
BaseSound *_voice;
|
||||
BaseSound *_effects;
|
||||
|
||||
bool _effects_paused;
|
||||
bool _ambient_paused;
|
||||
bool _effectsPaused;
|
||||
bool _ambientPaused;
|
||||
|
||||
uint16 *_filenums;
|
||||
uint32 *_offsets;
|
||||
|
|
|
@ -192,20 +192,20 @@ void SimonEngine::defocusHitarea() {
|
|||
HitArea *ha;
|
||||
|
||||
if (_game & GF_SIMON2) {
|
||||
if (_bit_array[4] & 0x8000) {
|
||||
if (_bitArray[4] & 0x8000) {
|
||||
o_unk_120(202);
|
||||
_last_hitarea_2_ptr = NULL;
|
||||
_lastHitArea2Ptr = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
last = _hitarea_ptr_5;
|
||||
last = _hitAreaPtr5;
|
||||
|
||||
if (last == _hitarea_ptr_7)
|
||||
if (last == _hitAreaPtr7)
|
||||
return;
|
||||
|
||||
hitareaChangedHelper();
|
||||
_hitarea_ptr_7 = last;
|
||||
_hitAreaPtr7 = last;
|
||||
|
||||
if (last != NULL && (ha = findHitAreaByID(200)) && (ha->flags & 0x40) && !(last->flags & 0x40))
|
||||
focusVerb(last->id);
|
||||
|
@ -219,7 +219,7 @@ void SimonEngine::focusVerb(uint hitarea_id) {
|
|||
|
||||
hitarea_id -= 101;
|
||||
|
||||
if (_show_preposition) {
|
||||
if (_showPreposition) {
|
||||
switch (_language) {
|
||||
case 21: verb_prep_names = russian_verb_prep_names; break;
|
||||
case 20: verb_prep_names = hebrew_verb_prep_names; break;
|
||||
|
@ -251,7 +251,7 @@ void SimonEngine::focusVerb(uint hitarea_id) {
|
|||
void SimonEngine::showActionString(uint x, const byte *string) {
|
||||
FillOrCopyStruct *fcs;
|
||||
|
||||
fcs = _fcs_ptr_array_3[1];
|
||||
fcs = _fcsPtrArray3[1];
|
||||
if (fcs == NULL || fcs->text_color == 0)
|
||||
return;
|
||||
|
||||
|
@ -266,21 +266,21 @@ void SimonEngine::hitareaChangedHelper() {
|
|||
FillOrCopyStruct *fcs;
|
||||
|
||||
if (_game & GF_SIMON2) {
|
||||
if (_bit_array[4] & 0x8000)
|
||||
if (_bitArray[4] & 0x8000)
|
||||
return;
|
||||
}
|
||||
|
||||
fcs = _fcs_ptr_array_3[1];
|
||||
fcs = _fcsPtrArray3[1];
|
||||
if (fcs != NULL && fcs->text_color != 0)
|
||||
video_fill_or_copy_from_3_to_2(fcs);
|
||||
|
||||
_last_hitarea_2_ptr = NULL;
|
||||
_hitarea_ptr_7 = NULL;
|
||||
_lastHitArea2Ptr = NULL;
|
||||
_hitAreaPtr7 = NULL;
|
||||
}
|
||||
|
||||
HitArea *SimonEngine::findHitAreaByID(uint hitarea_id) {
|
||||
HitArea *ha = _hit_areas;
|
||||
uint count = ARRAYSIZE(_hit_areas);
|
||||
HitArea *ha = _hitAreas;
|
||||
uint count = ARRAYSIZE(_hitAreas);
|
||||
|
||||
do {
|
||||
if (ha->id == hitarea_id)
|
||||
|
@ -290,8 +290,8 @@ HitArea *SimonEngine::findHitAreaByID(uint hitarea_id) {
|
|||
}
|
||||
|
||||
HitArea *SimonEngine::findEmptyHitArea() {
|
||||
HitArea *ha = _hit_areas;
|
||||
uint count = ARRAYSIZE(_hit_areas);
|
||||
HitArea *ha = _hitAreas;
|
||||
uint count = ARRAYSIZE(_hitAreas);
|
||||
|
||||
do {
|
||||
if (ha->flags == 0)
|
||||
|
@ -328,9 +328,9 @@ void SimonEngine::delete_hitarea(uint hitarea) {
|
|||
HitArea *ha = findHitAreaByID(hitarea);
|
||||
if (ha != NULL) {
|
||||
ha->flags = 0;
|
||||
if (ha == _last_hitarea_2_ptr)
|
||||
if (ha == _lastHitArea2Ptr)
|
||||
defocusHitarea();
|
||||
_need_hitarea_recalc++;
|
||||
_needHitAreaRecalc++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,7 +355,7 @@ void SimonEngine::addNewHitArea(int id, int x, int y, int width, int height, int
|
|||
ha->unk3 = unk3;
|
||||
ha->item_ptr = item_ptr;
|
||||
|
||||
_need_hitarea_recalc++;
|
||||
_needHitAreaRecalc++;
|
||||
}
|
||||
|
||||
void SimonEngine::hitarea_proc_1() {
|
||||
|
@ -364,29 +364,29 @@ void SimonEngine::hitarea_proc_1() {
|
|||
|
||||
if (_game & GF_SIMON2) {
|
||||
id = 2;
|
||||
if (!(_bit_array[4] & 0x8000))
|
||||
id = (_mouse_y >= 136) ? 102 : 101;
|
||||
if (!(_bitArray[4] & 0x8000))
|
||||
id = (_mouseY >= 136) ? 102 : 101;
|
||||
} else {
|
||||
id = (_mouse_y >= 136) ? 102 : 101;
|
||||
id = (_mouseY >= 136) ? 102 : 101;
|
||||
}
|
||||
|
||||
_hitarea_unk_4 = id;
|
||||
_hitAreaUnk4 = id;
|
||||
|
||||
ha = findHitAreaByID(id);
|
||||
if (ha == NULL)
|
||||
return;
|
||||
|
||||
if (ha->flags & 0x40) {
|
||||
_hitarea_unk_4 = 999;
|
||||
_hitarea_ptr_5 = NULL;
|
||||
_hitAreaUnk4 = 999;
|
||||
_hitAreaPtr5 = NULL;
|
||||
} else {
|
||||
_verb_hitarea = ha->unk3;
|
||||
_verbHitArea = ha->unk3;
|
||||
handle_verb_hitarea(ha);
|
||||
}
|
||||
}
|
||||
|
||||
void SimonEngine::handle_verb_hitarea(HitArea *ha) {
|
||||
HitArea *tmp = _hitarea_ptr_5;
|
||||
HitArea *tmp = _hitAreaPtr5;
|
||||
|
||||
if (ha == tmp)
|
||||
return;
|
||||
|
@ -407,10 +407,10 @@ void SimonEngine::handle_verb_hitarea(HitArea *ha) {
|
|||
} else {
|
||||
if (ha->id < 101)
|
||||
return;
|
||||
_mouse_cursor = ha->id - 101;
|
||||
_need_hitarea_recalc++;
|
||||
_mouseCursor = ha->id - 101;
|
||||
_needHitAreaRecalc++;
|
||||
}
|
||||
_hitarea_ptr_5 = ha;
|
||||
_hitAreaPtr5 = ha;
|
||||
}
|
||||
|
||||
void SimonEngine::hitarea_leave(HitArea *ha) {
|
||||
|
@ -452,15 +452,15 @@ void SimonEngine::handle_downarrow_hitarea(FillOrCopyStruct *fcs) {
|
|||
|
||||
void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) {
|
||||
HitArea *best_ha;
|
||||
HitArea *ha = _hit_areas;
|
||||
uint count = ARRAYSIZE(_hit_areas);
|
||||
HitArea *ha = _hitAreas;
|
||||
uint count = ARRAYSIZE(_hitAreas);
|
||||
uint16 layer = 0;
|
||||
uint16 x_ = x;
|
||||
const uint16 y_ = y;
|
||||
|
||||
if (_game & GF_SIMON2) {
|
||||
if (_bit_array[4] & 0x8000 || y < 134) {
|
||||
x_ += _x_scroll * 8;
|
||||
if (_bitArray[4] & 0x8000 || y < 134) {
|
||||
x_ += _xScroll * 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -491,14 +491,14 @@ void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) {
|
|||
}
|
||||
|
||||
if (mode != 0 && mode != 3) {
|
||||
_last_hitarea = best_ha;
|
||||
_lastHitArea = best_ha;
|
||||
_variableArray[1] = x;
|
||||
_variableArray[2] = y;
|
||||
}
|
||||
|
||||
if (best_ha->flags & 4) {
|
||||
defocusHitarea();
|
||||
} else if (best_ha != _last_hitarea_2_ptr) {
|
||||
} else if (best_ha != _lastHitArea2Ptr) {
|
||||
new_current_hitarea(best_ha);
|
||||
}
|
||||
|
||||
|
@ -521,7 +521,7 @@ void SimonEngine::new_current_hitarea(HitArea *ha) {
|
|||
}
|
||||
|
||||
if (result)
|
||||
_last_hitarea_2_ptr = ha;
|
||||
_lastHitArea2Ptr = ha;
|
||||
}
|
||||
|
||||
bool SimonEngine::hitarea_proc_2(uint a) {
|
||||
|
@ -529,7 +529,7 @@ bool SimonEngine::hitarea_proc_2(uint a) {
|
|||
const byte *string_ptr;
|
||||
|
||||
if (_game & GF_SIMON2) {
|
||||
if (_bit_array[4] & 0x8000) {
|
||||
if (_bitArray[4] & 0x8000) {
|
||||
Subroutine *sub;
|
||||
_variableArray[84] = a;
|
||||
sub = getSubroutineByID(5003);
|
||||
|
@ -542,7 +542,7 @@ bool SimonEngine::hitarea_proc_2(uint a) {
|
|||
if (a >= 20)
|
||||
return false;
|
||||
|
||||
string_ptr = getStringPtrByID(_stringid_array_2[a]);
|
||||
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;
|
||||
|
@ -558,7 +558,7 @@ bool SimonEngine::hitarea_proc_3(Item *item) {
|
|||
uint x;
|
||||
const byte *string_ptr;
|
||||
|
||||
if (item == 0 || item == _dummy_item_2 || item == _dummy_item_3)
|
||||
if (item == 0 || item == _dummyItem2 || item == _dummyItem3)
|
||||
return false;
|
||||
|
||||
child2 = (Child2 *)findChildOfType(item, 2);
|
||||
|
|
454
simon/vga.cpp
454
simon/vga.cpp
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue