aboutsummaryrefslogtreecommitdiff
path: root/simon
diff options
context:
space:
mode:
authorTravis Howell2002-12-12 11:07:01 +0000
committerTravis Howell2002-12-12 11:07:01 +0000
commita454add929ed73f5286492b9e1153c97f7b23054 (patch)
tree76b986f06601a0bb41e9651f271ee2d2ecf69cdf /simon
parent6c20dc48c7b974ad119a37adfd1f992102ac6027 (diff)
downloadscummvm-rg350-a454add929ed73f5286492b9e1153c97f7b23054.tar.gz
scummvm-rg350-a454add929ed73f5286492b9e1153c97f7b23054.tar.bz2
scummvm-rg350-a454add929ed73f5286492b9e1153c97f7b23054.zip
Small code cleanup
svn-id: r5912
Diffstat (limited to 'simon')
-rw-r--r--simon/items.cpp50
-rw-r--r--simon/simon.cpp43
2 files changed, 9 insertions, 84 deletions
diff --git a/simon/items.cpp b/simon/items.cpp
index 655e0af00b..a7aa823385 100644
--- a/simon/items.cpp
+++ b/simon/items.cpp
@@ -989,7 +989,7 @@ int SimonState::runScript()
uint d = _array_4[a];
if (d != 0)
talk_with_speech(d, b);
- } else if (_game == GAME_SIMON1DEMO || _game == GAME_SIMON1DOS) {
+ } else if (_game == GAME_SIMON1DEMO || _game == GAME_SIMON1DOS || _game == GAME_SIMON2DOS) {
const char *s = (const char *)getStringPtrByID(_stringid_array_3[a]);
ThreeValues *tv = getThreeValues(b);
@@ -1001,14 +1001,7 @@ int SimonState::runScript()
if (d != 0 && !_vk_t_toggle)
talk_with_speech(d, b);
-
- if (s != NULL && _vk_t_toggle)
- talk_with_text(b, c, s, tv->a, tv->b, tv->c);
- } else if (_game == GAME_SIMON2DOS) {
- const char *s = (const char *)getStringPtrByID(_stringid_array_3[a]);
- ThreeValues *tv = getThreeValues(b);
-
- if (s != NULL)
+ else
talk_with_text(b, c, s, tv->a, tv->b, tv->c);
}
}
@@ -1237,11 +1230,11 @@ bool SimonState::o_unk_23(uint a)
void SimonState::o_177()
{
+ uint a = getVarOrByte();
+ uint b = getVarOrByte();
+ Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
if (_game == GAME_SIMON1TALKIE || _game == GAME_SIMON1WIN) {
- uint a = getVarOrByte();
- /*uint b = */ getVarOrByte();
uint offs;
- Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
if (child != NULL && child->avail_props & 0x200) {
offs = getOffsetOfChild2Param(child, 0x200);
talk_with_speech(child->array[offs], a);
@@ -1249,10 +1242,7 @@ void SimonState::o_177()
offs = getOffsetOfChild2Param(child, 0x100);
talk_with_speech(child->array[offs] + 3550, a);
}
- } else if ((_game == GAME_SIMON1DEMO) || (_game == GAME_SIMON1DOS)) {
- uint a = getVarOrByte();
- uint b = getVarOrByte();
- Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
+ } else if (_game == GAME_SIMON1DEMO || _game == GAME_SIMON1DOS || _game == _game == GAME_SIMON2DOS) {
if (child != NULL && child->avail_props & 1) {
const char *s = (const char *)getStringPtrByID(child->array[0]);
char buf[256];
@@ -1260,17 +1250,13 @@ void SimonState::o_177()
ThreeValues *tv = getThreeValues(a);
if (child->avail_props & 0x100) {
- uint x = getOffsetOfChild2Param(child, 0x100);
- sprintf(buf, "%d%s", child->array[x], s);
+ sprintf(buf, "%d%s", child->array[getOffsetOfChild2Param(child, 0x100)], s);
s = buf;
}
talk_with_text(a, b, s, tv->a, tv->b, tv->c);
}
} else if (_game == GAME_SIMON2TALKIE || _game == GAME_SIMON2WIN) {
- uint a = getVarOrByte();
- uint b = getVarOrByte();
- Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
const char *s = NULL;
ThreeValues *tv = NULL;
char buf[256];
@@ -1343,28 +1329,6 @@ void SimonState::o_177()
}
talk_with_text(a, b, s, tv->a, tv->b, tv->c);
- } else if (_game == GAME_SIMON2DOS) {
- uint a = getVarOrByte();
- uint b = getVarOrByte();
- Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
- const char *s = NULL;
- ThreeValues *tv = NULL;
- char buf[256];
-
- if (child != NULL && child->avail_props & 1) {
- s = (const char *)getStringPtrByID(child->array[0]);
- tv = getThreeValues(a);
- }
-
- if (child == NULL || !(child->avail_props & 1))
- return;
-
- if (child->avail_props & 0x100) {
- sprintf(buf, "%d%s", child->array[getOffsetOfChild2Param(child, 0x100)], s);
- s = buf;
- }
-
- talk_with_text(a, b, s, tv->a, tv->b, tv->c);
}
}
diff --git a/simon/simon.cpp b/simon/simon.cpp
index 05b12691e9..9551e1a03a 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -2983,16 +2983,14 @@ void SimonState::copy_img_from_3_to_2(FillOrCopyStruct *fcs)
_lock_word |= 0x8000;
if (!(_game & GAME_SIMON2)) {
- dx_copy_rgn_from_3_to_2(fcs->y + fcs->height * 8 + ((fcs == _fcs_ptr_array_3[2]) ? 1 : 0),
- (fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8);
+ dx_copy_rgn_from_3_to_2(fcs->y + fcs->height * 8 + ((fcs == _fcs_ptr_array_3[2]) ? 1 : 0), (fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8);
} else {
if (_vga_var6 && _fcs_ptr_array_3[2] == fcs) {
fcs = _fcs_ptr_array_3[0x18 / 4];
_vga_var6 = 0;
}
- dx_copy_rgn_from_3_to_2(fcs->y + fcs->height * 8,
- (fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8);
+ dx_copy_rgn_from_3_to_2(fcs->y + fcs->height * 8, (fcs->x + fcs->width) * 8, fcs->y, fcs->x * 8);
}
_lock_word &= ~0x8000;
@@ -4318,43 +4316,6 @@ void SimonState::runSubroutine101()
startUp_helper_2();
}
-#if 0
-void SimonState::generateSound(byte *ptr, int len)
-{
- uint cur;
-
- cur = _voice_size;
- if (cur > (uint) len)
- cur = (uint) len;
- _voice_size -= cur;
-
- if (cur != 0) {
- fread(ptr, cur, 1, _voice_file);
- }
-
- memset(ptr + cur, 0x80, len - cur);
-
- cur = _sound_size;
- if (cur) {
- uint i;
-
- if (cur > (uint) len)
- cur = (uint) len;
-
- for (i = 0; i != cur; i++) {
- ptr[i] += _sound_ptr[i] ^ 0x80;
- }
-
- _sound_size -= cur;
- _sound_ptr += cur;
- }
-}
-#endif
-
-//static void fill_sound(void *userdata, int16 *stream, int len) {
-// ((SimonState*)userdata)->generateSound((byte*)stream, len*2);
-//}
-
void SimonState::dx_copy_rgn_from_3_to_2(uint b, uint r, uint y, uint x)
{
byte *dst, *src;