aboutsummaryrefslogtreecommitdiff
path: root/simon
diff options
context:
space:
mode:
authorTravis Howell2005-05-06 12:23:19 +0000
committerTravis Howell2005-05-06 12:23:19 +0000
commit1057d5fa696c5e1503f2d8e55bab939a0dcfa06f (patch)
treead9c3dfca7c6d73a33e555e635be397cf11c1188 /simon
parent076e42c302dd463e42d5bbd31eedccf3463f7a61 (diff)
downloadscummvm-rg350-1057d5fa696c5e1503f2d8e55bab939a0dcfa06f.tar.gz
scummvm-rg350-1057d5fa696c5e1503f2d8e55bab939a0dcfa06f.tar.bz2
scummvm-rg350-1057d5fa696c5e1503f2d8e55bab939a0dcfa06f.zip
Rename sprite field.
Cleanup. svn-id: r17931
Diffstat (limited to 'simon')
-rw-r--r--simon/items.cpp53
-rw-r--r--simon/simon.cpp62
-rw-r--r--simon/simon.h4
-rw-r--r--simon/vga.cpp106
-rw-r--r--simon/vga.h2
5 files changed, 110 insertions, 117 deletions
diff --git a/simon/items.cpp b/simon/items.cpp
index 5543e0359c..e24fe68c0a 100644
--- a/simon/items.cpp
+++ b/simon/items.cpp
@@ -527,27 +527,24 @@ int SimonEngine::runScript() {
break;
case 98:{ /* start vga */
- if (!(_game & GF_SIMON2)) {
- uint vga_sprite_id = getVarOrWord();
- uint b = getVarOrByte();
- uint x = getVarOrWord();
- uint y = getVarOrWord();
- uint base_color = getVarOrWord();
- start_vga_code(b, vga_sprite_id / 100, vga_sprite_id, x, y, base_color);
+ uint vga_res, vgaSpriteId, paletteMode, x, y, base_color;
+ if (_game & GF_SIMON2) {
+ vga_res = getVarOrWord();
+ vgaSpriteId = getVarOrWord();
} else {
- uint vga_res = getVarOrWord();
- uint vga_sprite_id = getVarOrWord();
- uint b = getVarOrByte();
- uint x = getVarOrWord();
- uint y = getVarOrWord();
- uint base_color = getVarOrWord();
- start_vga_code(b, vga_res, vga_sprite_id, x, y, base_color);
+ vgaSpriteId = getVarOrWord();
+ vga_res = vgaSpriteId / 100;
}
+ paletteMode = getVarOrByte();
+ x = getVarOrWord();
+ y = getVarOrWord();
+ base_color = getVarOrWord();
+ start_vga_code(paletteMode, vga_res, vgaSpriteId, x, y, base_color);
}
break;
case 99:{ /* kill sprite */
- if (!(_game & GF_SIMON2)) {
+ if (_game & GF_SIMON1) {
o_kill_sprite_simon1(getVarOrWord());
} else {
uint a = getVarOrWord();
@@ -974,20 +971,20 @@ int SimonEngine::runScript() {
break;
case 179:{ /* conversation responses */
- uint vga_sprite_id = getVarOrByte(); /* and room descriptions */
+ uint vgaSpriteId = getVarOrByte(); /* and room descriptions */
uint color = getVarOrByte();
uint string_id = getVarOrByte();
uint speech_id = 0;
const char *string_ptr = (const char *)getStringPtrByID(_stringIdArray3[string_id]);
- TextLocation *tl = getTextLocation(vga_sprite_id);
+ TextLocation *tl = getTextLocation(vgaSpriteId);
if (_game & GF_TALKIE)
speech_id = _speechIdArray4[string_id];
if (_speech && speech_id != 0)
- talk_with_speech(speech_id, vga_sprite_id);
+ talk_with_speech(speech_id, vgaSpriteId);
if (string_ptr != NULL && _subtitles)
- talk_with_text(vga_sprite_id, color, string_ptr, tl->x, tl->y, tl->width);
+ talk_with_text(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
}
break;
@@ -1052,7 +1049,7 @@ int SimonEngine::runScript() {
break;
case 188: /* string2 is */
- if (!(_game & GF_SIMON2))
+ if (_game & GF_SIMON1)
goto invalid_opcode;
{
uint i = getVarOrByte();
@@ -1062,7 +1059,7 @@ int SimonEngine::runScript() {
break;
case 189:{ /* clear_op189_flag */
- if (!(_game & GF_SIMON2))
+ if (_game & GF_SIMON1)
goto invalid_opcode;
_op189Flags = 0;
}
@@ -1070,7 +1067,7 @@ int SimonEngine::runScript() {
case 190:{
uint i;
- if (!(_game & GF_SIMON2))
+ if (_game & GF_SIMON1)
goto invalid_opcode;
i = getVarOrByte();
if (!(_op189Flags & (1 << i)))
@@ -1214,7 +1211,7 @@ bool SimonEngine::o_unk_23(uint a) {
}
void SimonEngine::o_inventory_descriptions() {
- uint vga_sprite_id = getVarOrByte();
+ uint vgaSpriteId = getVarOrByte();
uint color = getVarOrByte();
const char *string_ptr = NULL;
TextLocation *tl = NULL;
@@ -1223,7 +1220,7 @@ void SimonEngine::o_inventory_descriptions() {
Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
if (child != NULL && child->avail_props & 1) {
string_ptr = (const char *)getStringPtrByID(child->array[0]);
- tl = getTextLocation(vga_sprite_id);
+ tl = getTextLocation(vgaSpriteId);
}
if ((_game & GF_SIMON2) && (_game & GF_TALKIE)) {
@@ -1275,16 +1272,16 @@ void SimonEngine::o_inventory_descriptions() {
}
if (_speech)
- talk_with_speech(speech_id, vga_sprite_id);
+ talk_with_speech(speech_id, vgaSpriteId);
}
} else if (_game & GF_TALKIE) {
if (child != NULL && child->avail_props & 0x200) {
uint offs = getOffsetOfChild2Param(child, 0x200);
- talk_with_speech(child->array[offs], vga_sprite_id);
+ talk_with_speech(child->array[offs], vgaSpriteId);
} else if (child != NULL && child->avail_props & 0x100) {
uint offs = getOffsetOfChild2Param(child, 0x100);
- talk_with_speech(child->array[offs] + 3550, vga_sprite_id);
+ talk_with_speech(child->array[offs] + 3550, vgaSpriteId);
}
}
@@ -1294,7 +1291,7 @@ void SimonEngine::o_inventory_descriptions() {
string_ptr = buf;
}
if (string_ptr != NULL)
- talk_with_text(vga_sprite_id, color, string_ptr, tl->x, tl->y, tl->width);
+ talk_with_text(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
}
}
diff --git a/simon/simon.cpp b/simon/simon.cpp
index e3427f89aa..2bb73d6bae 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -2257,7 +2257,7 @@ TextLocation *SimonEngine::getTextLocation(uint a) {
}
void SimonEngine::o_print_str() {
- uint vga_sprite_id = getVarOrByte();
+ uint vgaSpriteId = getVarOrByte();
uint color = getVarOrByte();
uint string_id = getNextStringID();
const byte *string_ptr = NULL;
@@ -2270,15 +2270,15 @@ void SimonEngine::o_print_str() {
if (_game & GF_TALKIE)
speech_id = (uint16)getNextWord();
- tl = getTextLocation(vga_sprite_id);
+ tl = getTextLocation(vgaSpriteId);
if (_speech && speech_id != 0)
- talk_with_speech(speech_id, vga_sprite_id);
+ talk_with_speech(speech_id, vgaSpriteId);
if ((_game & GF_SIMON2) && (_game & GF_TALKIE) && speech_id == 0)
- o_kill_sprite_simon2(2, vga_sprite_id + 2);
+ o_kill_sprite_simon2(2, vgaSpriteId + 2);
if (string_ptr != NULL && (speech_id == 0 || _subtitles))
- talk_with_text(vga_sprite_id, color, (const char *)string_ptr, tl->x, tl->y, tl->width);
+ talk_with_text(vgaSpriteId, color, (const char *)string_ptr, tl->x, tl->y, tl->width);
}
@@ -2746,9 +2746,9 @@ void SimonEngine::timer_vga_sprites() {
params[3] = READ_BE_UINT16(&vsp->y);
if (_game & GF_SIMON2) {
- *(byte *)(&params[4]) = (byte)vsp->unk4;
+ *(byte *)(&params[4]) = (byte)vsp->flags;
} else {
- params[4] = READ_BE_UINT16(&vsp->unk4);
+ params[4] = READ_BE_UINT16(&vsp->flags);
}
_vcPtr = (const byte *)params;
@@ -2820,12 +2820,12 @@ void SimonEngine::timer_vga_sprites_2() {
if (vsp->image)
fprintf(_dumpFile, "id:%5d image:%3d base-color:%3d x:%3d y:%3d flags:%x\n",
- vsp->id, vsp->image, vsp->base_color, vsp->x, vsp->y, vsp->unk4);
+ vsp->id, vsp->image, vsp->base_color, vsp->x, vsp->y, vsp->flags);
params[0] = READ_BE_UINT16(&vsp->image);
params[1] = READ_BE_UINT16(&vsp->base_color);
params[2] = READ_BE_UINT16(&vsp->x);
params[3] = READ_BE_UINT16(&vsp->y);
- params[4] = READ_BE_UINT16(&vsp->unk4);
+ params[4] = READ_BE_UINT16(&vsp->flags);
_vcPtr = (const byte *)params;
vc_10_draw();
@@ -3341,7 +3341,7 @@ void SimonEngine::video_copy_if_flag_0x8_c(FillOrCopyStruct *fcs) {
fcs->mode = 0;
}
-void SimonEngine::start_vga_code(uint b, uint vga_res, uint vga_sprite_id, uint x, uint y, uint base_color) {
+void SimonEngine::start_vga_code(uint paletteMode, uint vga_res, uint vgaSpriteId, uint x, uint y, uint base_color) {
VgaSprite *vsp;
VgaPointersEntry *vpe;
byte *p, *pp;
@@ -3349,7 +3349,7 @@ void SimonEngine::start_vga_code(uint b, uint vga_res, uint vga_sprite_id, uint
_lockWord |= 0x40;
- if (has_vga_sprite_with_id(vga_sprite_id, vga_res)) {
+ if (has_vga_sprite_with_id(vgaSpriteId, vga_res)) {
_lockWord &= ~0x40;
return;
}
@@ -3358,17 +3358,17 @@ void SimonEngine::start_vga_code(uint b, uint vga_res, uint vga_sprite_id, uint
while (vsp->id != 0)
vsp++;
- vsp->paletteMode = b;
+ vsp->paletteMode = paletteMode;
vsp->priority = 0;
- vsp->unk4 = 0;
+ vsp->flags = 0;
vsp->y = y;
vsp->x = x;
vsp->image = 0;
vsp->base_color = base_color;
- vsp->id = vga_sprite_id;
- if (!(_game & GF_SIMON2))
- vsp->unk7 = vga_res = vga_sprite_id / 100;
+ vsp->id = vgaSpriteId;
+ if (_game & GF_SIMON1)
+ vsp->unk7 = vga_res = vgaSpriteId / 100;
else
vsp->unk7 = vga_res;
@@ -3389,12 +3389,12 @@ void SimonEngine::start_vga_code(uint b, uint vga_res, uint vga_sprite_id, uint
p = pp + READ_BE_UINT16(&((VgaFile1Header2 *) p)->id_table);
for (;;) {
- if (READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->id) == vga_sprite_id) {
+ if (READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->id) == vgaSpriteId) {
if (_startVgaScript)
- dump_vga_script(pp + READ_BE_UINT16(&((VgaFile1Struct0x6*)p)->script_offs), vga_res, vga_sprite_id);
+ dump_vga_script(pp + READ_BE_UINT16(&((VgaFile1Struct0x6*)p)->script_offs), vga_res, vgaSpriteId);
- add_vga_timer(VGA_DELAY_BASE, pp + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), vga_sprite_id, vga_res);
+ add_vga_timer(VGA_DELAY_BASE, pp + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), vgaSpriteId, vga_res);
break;
}
p += sizeof(VgaFile1Struct0x6);
@@ -3407,7 +3407,7 @@ void SimonEngine::start_vga_code(uint b, uint vga_res, uint vga_sprite_id, uint
_lockWord &= ~0x40;
}
-void SimonEngine::talk_with_speech(uint speech_id, uint vga_sprite_id) {
+void SimonEngine::talk_with_speech(uint speech_id, uint vgaSpriteId) {
if (!(_game & GF_SIMON2)) {
if (speech_id == 9999) {
if (_subtitles)
@@ -3425,9 +3425,9 @@ void SimonEngine::talk_with_speech(uint speech_id, uint vga_sprite_id) {
o_wait_for_vga(204);
o_kill_sprite_simon1(204);
}
- o_kill_sprite_simon1(vga_sprite_id + 201);
+ o_kill_sprite_simon1(vgaSpriteId + 201);
_sound->playVoice(speech_id);
- start_vga_code(4, 2, vga_sprite_id + 201, 0, 0, 0);
+ start_vga_code(4, 2, vgaSpriteId + 201, 0, 0, 0);
}
} else {
if (speech_id == 0xFFFF) {
@@ -3450,14 +3450,14 @@ void SimonEngine::talk_with_speech(uint speech_id, uint vga_sprite_id) {
o_kill_sprite_simon2(2,5);
}
- o_kill_sprite_simon2(2, vga_sprite_id + 2);
+ o_kill_sprite_simon2(2, vgaSpriteId + 2);
_sound->playVoice(speech_id);
- start_vga_code(4, 2, vga_sprite_id + 2, 0, 0, 0);
+ start_vga_code(4, 2, vgaSpriteId + 2, 0, 0, 0);
}
}
}
-void SimonEngine::talk_with_text(uint vga_sprite_id, uint color, const char *string, int16 x, int16 y, int16 width) {
+void SimonEngine::talk_with_text(uint vgaSpriteId, uint color, const char *string, int16 x, int16 y, int16 width) {
char convertedString[320];
char *convertedString2 = convertedString;
int16 height, len_div_3;
@@ -3517,15 +3517,15 @@ void SimonEngine::talk_with_text(uint vga_sprite_id, uint color, const char *str
*(convertedString2 - 1) = '\0';
if (_game & GF_SIMON2)
- o_kill_sprite_simon2(2, vga_sprite_id);
+ o_kill_sprite_simon2(2, vgaSpriteId);
else
- o_kill_sprite_simon1(vga_sprite_id + 199);
+ o_kill_sprite_simon1(vgaSpriteId + 199);
color = color * 3 + 192;
if (_game & GF_AMIGA)
- render_string_amiga(vga_sprite_id, color, width, height, convertedString);
+ render_string_amiga(vgaSpriteId, color, width, height, convertedString);
else
- render_string(vga_sprite_id, color, width, height, convertedString);
+ render_string(vgaSpriteId, color, width, height, convertedString);
int b = 4;
if (!(_bitArray[8] & 0x20))
@@ -3537,9 +3537,9 @@ void SimonEngine::talk_with_text(uint vga_sprite_id, uint color, const char *str
y = 2;
if (_game & GF_SIMON2)
- start_vga_code(b, 2, vga_sprite_id, x, y, 12);
+ start_vga_code(b, 2, vgaSpriteId, x, y, 12);
else
- start_vga_code(b, 2, vga_sprite_id + 199, x, y, 12);
+ start_vga_code(b, 2, vgaSpriteId + 199, x, y, 12);
}
// Thanks to Stuart Caie for providing the original
diff --git a/simon/simon.h b/simon/simon.h
index eb1d6f8cc5..7cd9c90768 100644
--- a/simon/simon.h
+++ b/simon/simon.h
@@ -79,7 +79,7 @@ struct VgaSprite {
uint16 image;
uint16 base_color;
uint16 x, y; /* actually signed numbers */
- uint16 unk4;
+ uint16 flags;
uint16 priority;
uint16 paletteMode, unk7;
VgaSprite() { memset(this, 0, sizeof(*this)); }
@@ -588,7 +588,7 @@ protected:
void ensureVgaResLoadedC(uint vga_res);
void ensureVgaResLoaded(uint vga_res);
- void start_vga_code(uint b, uint vga_res, uint vga_sprite_id, uint x, uint y, uint base_color);
+ void start_vga_code(uint paletteMode, uint vga_res, uint vga_sprite_id, uint x, uint y, uint base_color);
void o_unk26_helper(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h);
void talk_with_speech(uint speech_id, uint vga_sprite_id);
void talk_with_text(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 width);
diff --git a/simon/vga.cpp b/simon/vga.cpp
index ca9427e63f..aad2253b65 100644
--- a/simon/vga.cpp
+++ b/simon/vga.cpp
@@ -122,7 +122,7 @@ void SimonEngine::run_vga_script() {
}
}
- if (!(_game & GF_SIMON2)) {
+ if (_game & GF_SIMON1) {
opcode = READ_BE_UINT16(_vcPtr);
_vcPtr += 2;
} else {
@@ -269,21 +269,21 @@ void SimonEngine::vc_2_call() {
}
void SimonEngine::vc_3_new_sprite() {
- uint16 a, f, base_color, x, y, vga_sprite_id;
+ uint16 paletteMode, vga_res, base_color, x, y, vgaSpriteId;
uint16 res;
VgaSprite *vsp;
VgaPointersEntry *vpe;
byte *p, *pp;
byte *old_file_1;
- a = vc_read_next_word(); /* 0 */
+ paletteMode = vc_read_next_word(); /* 0 */
if (_game & GF_SIMON2) {
- f = vc_read_next_word(); /* 0 */
- vga_sprite_id = vc_read_next_word(); /* 2 */
+ vga_res = vc_read_next_word(); /* 0 */
+ vgaSpriteId = vc_read_next_word(); /* 2 */
} else {
- vga_sprite_id = vc_read_next_word(); /* 2 */
- f = vga_sprite_id / 100;
+ vgaSpriteId = vc_read_next_word(); /* 2 */
+ vga_res = vgaSpriteId / 100;
}
x = vc_read_next_word(); /* 4 */
@@ -291,7 +291,7 @@ void SimonEngine::vc_3_new_sprite() {
base_color = vc_read_next_word(); /* 8 */
/* 2nd param ignored with simon1 */
- if (has_vga_sprite_with_id(vga_sprite_id, f))
+ if (has_vga_sprite_with_id(vgaSpriteId, vga_res))
return;
vsp = _vgaSprites;
@@ -299,14 +299,14 @@ void SimonEngine::vc_3_new_sprite() {
vsp++;
vsp->base_color = base_color;
- vsp->paletteMode = a;
+ vsp->paletteMode = paletteMode;
vsp->priority = 0;
- vsp->unk4 = 0;
+ vsp->flags = 0;
vsp->image = 0;
vsp->x = x;
vsp->y = y;
- vsp->id = vga_sprite_id;
- vsp->unk7 = res = f;
+ vsp->id = vgaSpriteId;
+ vsp->unk7 = res = vga_res;
old_file_1 = _curVgaFile1;
for (;;) {
@@ -326,7 +326,7 @@ void SimonEngine::vc_3_new_sprite() {
p = pp + READ_BE_UINT16(&((VgaFile1Header *) pp)->hdr2_start);
p = pp + READ_BE_UINT16(&((VgaFile1Header2 *) p)->id_table);
- while (READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->id) != vga_sprite_id)
+ while (READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->id) != vgaSpriteId)
p += sizeof(VgaFile1Struct0x6);
#ifdef DUMP_FILE_NR
@@ -350,9 +350,9 @@ void SimonEngine::vc_3_new_sprite() {
#endif
if (_startVgaScript)
- dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((VgaFile1Struct0x6*)p)->script_offs), res, vga_sprite_id);
+ dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((VgaFile1Struct0x6*)p)->script_offs), res, vgaSpriteId);
- add_vga_timer(VGA_DELAY_BASE, _curVgaFile1 + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), vga_sprite_id, res);
+ add_vga_timer(VGA_DELAY_BASE, _curVgaFile1 + READ_BE_UINT16(&((VgaFile1Struct0x6 *) p)->script_offs), vgaSpriteId, res);
_curVgaFile1 = old_file_1;
}
@@ -612,9 +612,9 @@ void SimonEngine::vc_10_draw() {
state.y = (int16)vc_read_next_word();
if (!(_game & GF_SIMON2)) {
- state.e = vc_read_next_word();
+ state.flags = vc_read_next_word();
} else {
- state.e = vc_read_next_byte();
+ state.flags = vc_read_next_byte();
}
if (state.image < 0)
@@ -634,12 +634,12 @@ void SimonEngine::vc_10_draw() {
dump_single_bitmap(_vgaCurFileId, state.image, state.depack_src, width * 16, height,
state.base_color);
- if (flags & 0x80 && !(state.e & 0x10)) {
- if (state.e & 1) {
- state.e &= ~1;
- state.e |= 0x10;
+ if (flags & 0x80 && !(state.flags & 0x10)) {
+ if (state.flags & 1) {
+ state.flags &= ~1;
+ state.flags |= 0x10;
} else {
- state.e |= 0x8;
+ state.flags |= 0x8;
}
}
@@ -672,9 +672,9 @@ void SimonEngine::vc_10_draw() {
return;
}
- if (state.e & 0x10) {
+ if (state.flags & 0x10) {
state.depack_src = vc_10_depack_swap(state.depack_src, width, height);
- } else if (state.e & 1) {
+ } else if (state.flags & 1) {
state.depack_src = vc_10_no_depack_swap(state.depack_src, width, height);
}
@@ -736,7 +736,7 @@ void SimonEngine::vc_10_draw() {
uint offs, offs2;
// Allow one section of Simon the Sorcerer 1 introduction to be displayed
// in lower half of screen
- if (!(_game & GF_SIMON2) && _subroutine == 2926) {
+ if ((_game & GF_SIMON1) && _subroutine == 2926) {
offs = ((vlut[0]) * 2 + state.x) * 8;
offs2 = (vlut[1] + state.y);
} else {
@@ -748,7 +748,7 @@ void SimonEngine::vc_10_draw() {
state.surf_addr += offs + offs2 * state.surf_pitch;
}
- if (state.e & 0x20) {
+ if (state.flags & 0x20) {
byte *mask, *src, *dst;
byte h;
uint w;
@@ -766,7 +766,7 @@ void SimonEngine::vc_10_draw() {
dst = state.surf_addr + w * 2; /* edi */
h = state.draw_height;
- if (!(_game & GF_SIMON2) && vc_get_bit(88)) {
+ if ((_game & GF_SIMON1) && vc_get_bit(88)) {
/* transparency */
do {
if (mask[0] & 0xF0) {
@@ -801,13 +801,13 @@ void SimonEngine::vc_10_draw() {
byte *dst;
uint h, i;
- if (!(state.e & 8)) {
+ if (!(state.flags & 8)) {
src = state.depack_src + (width * state.y_skip << 4) + (state.x_skip << 3);
dst = state.surf_addr;
state.draw_width *= 2;
- if (state.e & 2) {
+ if (state.flags & 2) {
/* no transparency */
h = state.draw_height;
do {
@@ -834,7 +834,7 @@ void SimonEngine::vc_10_draw() {
* aaaaabbb bbcccccd ddddeeee efffffgg ggghhhhh
*/
- if (state.e & 2) {
+ if (state.flags & 2) {
/* no transparency */
do {
uint count = state.draw_width >> 2;
@@ -907,12 +907,12 @@ void SimonEngine::vc_10_draw() {
}
/* vc_10_helper_4 */
} else {
- if (_game & GF_SIMON2 && state.e & 0x4 && _bitArray[10] & 0x800) {
+ if (_game & GF_SIMON2 && state.flags & 0x4 && _bitArray[10] & 0x800) {
state.surf_addr = state.surf2_addr;
state.surf_pitch = state.surf2_pitch;
}
- if (state.e & 0x8) {
+ if (state.flags & 0x8) {
uint w, h;
byte *src, *dst, *dst_org;
@@ -922,7 +922,7 @@ void SimonEngine::vc_10_draw() {
vc_10_skip_cols(&state);
- if (state.e & 2) {
+ if (state.flags & 2) {
dst_org = state.surf_addr;
w = 0;
do {
@@ -940,7 +940,7 @@ void SimonEngine::vc_10_draw() {
} while (++w != state.draw_width);
} else {
dst_org = state.surf_addr;
- if (state.e & 0x40) { /* reached */
+ if (state.flags & 0x40) { /* reached */
dst_org += vc_read_var(252);
}
w = 0;
@@ -973,7 +973,7 @@ void SimonEngine::vc_10_draw() {
src = state.depack_src + (width * state.y_skip) * 8;
dst = state.surf_addr;
state.x_skip <<= 2;
- if (state.e & 2) {
+ if (state.flags & 2) {
do {
for (count = 0; count != state.draw_width; count++) {
dst[count * 2] = (src[count + state.x_skip] >> 4) | state.base_color;
@@ -1016,7 +1016,7 @@ void SimonEngine::vc_12_delay() {
VgaSprite *vsp = find_cur_sprite();
uint num;
- if (!(_game & GF_SIMON2)) {
+ if (_game & GF_SIMON1) {
num = vc_read_var_or_word();
} else {
num = vc_read_next_byte() * _vgaBaseDelay;
@@ -1192,10 +1192,10 @@ void SimonEngine::vc_24_set_sprite_xy() {
vsp->x += (int16)vc_read_next_word();
vsp->y += (int16)vc_read_next_word();
- if (!(_game & GF_SIMON2)) {
- vsp->unk4 = vc_read_next_word();
+ if (_game & GF_SIMON1) {
+ vsp->flags = vc_read_next_word();
} else {
- vsp->unk4 = vc_read_next_byte();
+ vsp->flags = vc_read_next_byte();
}
_vgaSpriteChanged++;
@@ -1319,7 +1319,7 @@ void SimonEngine::vc_36_saveload_thing() {
uint vga_res = vc_read_next_word();
uint mode = vc_read_next_word();
- if (!(_game & GF_SIMON2)) {
+ if (_game & GF_SIMON1) {
if (mode == 16) {
_copyPartialMode = 2;
} else {
@@ -1352,7 +1352,7 @@ void SimonEngine::vc_40_var_add() {
uint var = vc_read_next_word();
int16 value = vc_read_var(var) + vc_read_next_word();
- if (_game & GF_SIMON2 && var == 0xF && !(_bitArray[5] & 1)) {
+ if ((_game & GF_SIMON2) && var == 0xF && !(_bitArray[5] & 1)) {
int16 tmp;
if (_vgaVar2 != 0) {
@@ -1381,7 +1381,7 @@ void SimonEngine::vc_41_var_sub() {
uint var = vc_read_next_word();
int16 value = vc_read_var(var) - vc_read_next_word();
- if (_game & GF_SIMON2 && var == 0xF && !(_bitArray[5] & 1)) {
+ if ((_game & GF_SIMON2) && var == 0xF && !(_bitArray[5] & 1)) {
int16 tmp;
if (_vgaVar2 != 0) {
@@ -1500,17 +1500,17 @@ void SimonEngine::vc_51_clear_hitarea_bit_0x40() {
void SimonEngine::vc_52_play_sound() {
uint16 sound_id = vc_read_next_word();
- if (_game == GAME_SIMON1DOS) {
- playSting(sound_id);
- } else if (!(_game & GF_SIMON2)) {
- _sound->playEffects(sound_id);
- } else {
+ if (_game & GF_SIMON2) {
if (sound_id >= 0x8000) {
sound_id = -sound_id;
_sound->playAmbient(sound_id);
} else {
_sound->playEffects(sound_id);
}
+ } else if (_game & GF_TALKIE) {
+ _sound->playEffects(sound_id);
+ } else {
+ playSting(sound_id);
}
}
@@ -1609,9 +1609,7 @@ void SimonEngine::vc_kill_sprite(uint file, uint sprite) {
vfs = _vgaSleepStructs;
while (vfs->ident != 0) {
- if (vfs->sprite_id == _vgaCurSpriteId
- && (vfs->cur_vga_file == _vgaCurFileId || !(_game & GF_SIMON2))
- ) {
+ if ((_game & GF_SIMON1) || (vfs->sprite_id == _vgaCurSpriteId && vfs->cur_vga_file == _vgaCurFileId)) {
while (vfs->ident != 0) {
memcpy(vfs, vfs + 1, sizeof(VgaSleepStruct));
vfs++;
@@ -1627,9 +1625,7 @@ void SimonEngine::vc_kill_sprite(uint file, uint sprite) {
vte = _vgaTimerList;
while (vte->delay != 0) {
- if (vte->sprite_id == _vgaCurSpriteId
- && (vte->cur_vga_file == _vgaCurFileId || !(_game & GF_SIMON2))
- ) {
+ if ((_game & GF_SIMON1) || (vte->sprite_id == _vgaCurSpriteId && vte->cur_vga_file == _vgaCurFileId)) {
delete_vga_timer(vte);
break;
}
@@ -1661,7 +1657,7 @@ void SimonEngine::vc_61_sprite_change() {
vsp->x += vc_read_next_word();
vsp->y += vc_read_next_word();
- vsp->unk4 = 36;
+ vsp->flags = 0x24;
_vgaSpriteChanged++;
}
@@ -1709,7 +1705,7 @@ void SimonEngine::vc_62_palette_thing() {
params[1] = READ_BE_UINT16(&vsp->base_color);
params[2] = READ_BE_UINT16(&vsp->x);
params[3] = READ_BE_UINT16(&vsp->y);
- params[4] = READ_BE_UINT16(&vsp->unk4);
+ params[4] = READ_BE_UINT16(&vsp->flags);
_vcPtr = (byte *)params;
vc_10_draw();
diff --git a/simon/vga.h b/simon/vga.h
index ad5095ffd6..5a282ce292 100644
--- a/simon/vga.h
+++ b/simon/vga.h
@@ -66,7 +66,7 @@ struct VgaFile1Struct0x6 {
struct VC10_state {
int image;
- uint16 e;
+ uint16 flags;
int x, y;
byte base_color;