aboutsummaryrefslogtreecommitdiff
path: root/simon
diff options
context:
space:
mode:
authorOliver Kiehl2002-12-04 22:40:16 +0000
committerOliver Kiehl2002-12-04 22:40:16 +0000
commit632f44a1a41a9da360dd1cac3e8cb3ff315527ca (patch)
tree41afc0d0eccb6d8829e59953d88415625207d7e0 /simon
parent95c1f3de15c1769e9403beb61aac70ade8e45ccb (diff)
downloadscummvm-rg350-632f44a1a41a9da360dd1cac3e8cb3ff315527ca.tar.gz
scummvm-rg350-632f44a1a41a9da360dd1cac3e8cb3ff315527ca.tar.bz2
scummvm-rg350-632f44a1a41a9da360dd1cac3e8cb3ff315527ca.zip
cleanup
svn-id: r5841
Diffstat (limited to 'simon')
-rw-r--r--simon/items.cpp156
-rw-r--r--simon/simon.cpp62
-rw-r--r--simon/simon.h3
3 files changed, 41 insertions, 180 deletions
diff --git a/simon/items.cpp b/simon/items.cpp
index 556c494307..efd8e3e5f0 100644
--- a/simon/items.cpp
+++ b/simon/items.cpp
@@ -386,20 +386,12 @@ int SimonState::runScript()
break;
case 67:{ /* set array 3 and 4 */
- if (_game & GAME_TALKIE) {
- uint var = getVarOrByte();
- uint string_id = getNextStringID();
- uint value = getNextWord();
- if (var < 20) {
- _stringid_array_3[var] = string_id;
- _array_4[var] = value;
- }
- } else {
- uint var = getVarOrByte();
- uint string_id = getNextStringID();
- if (var < 20) {
- _stringid_array_3[var] = string_id;
- }
+ uint var = getVarOrByte();
+ uint string_id = getNextStringID();
+ if (var < 20) {
+ _stringid_array_3[var] = string_id;
+ if (_game & GAME_TALKIE)
+ _array_4[var] = getNextWord();
}
}
break;
@@ -743,13 +735,11 @@ int SimonState::runScript()
case 130:{ /* set script cond */
uint a = getVarOrByte();
- if (a == 1) {
- getNextWord();
+ getNextWord();
+ if (a == 1)
_script_cond_b = getNextWord();
- } else {
- getNextWord();
+ else
_script_cond_c = getNextWord();
- }
}
break;
@@ -930,24 +920,7 @@ int SimonState::runScript()
case 161:{ /* setup text */
uint value = getVarOrByte();
- ThreeValues *tv;
-
- switch (value) {
- case 1:
- tv = &_threevalues_1;
- break;
- case 2:
- tv = &_threevalues_2;
- break;
- case 101:
- tv = &_threevalues_3;
- break;
- case 102:
- tv = &_threevalues_4;
- break;
- default:
- error("setup text, invalid value %d", value);
- }
+ ThreeValues *tv = getThreeValues(value);
tv->a = getVarOrWord();
tv->b = getVarOrByte();
@@ -1039,24 +1012,7 @@ int SimonState::runScript()
uint c = getVarOrByte();
uint a = getVarOrByte();
const char *s = (const char *)getStringPtrByID(_stringid_array_3[a]);
- ThreeValues *tv;
-
- switch (b) {
- case 1:
- tv = &_threevalues_1;
- break;
- case 2:
- tv = &_threevalues_2;
- break;
- case 101:
- tv = &_threevalues_3;
- break;
- case 102:
- tv = &_threevalues_4;
- break;
- default:
- error("setup text, invalid value %d", b);
- }
+ ThreeValues *tv = getThreeValues(b);
talk_with_text(b, c, s, tv->a, tv->b, tv->c);
} else if (_game == GAME_SIMON2TALKIE || _game == GAME_SIMON2WIN) {
@@ -1065,24 +1021,7 @@ int SimonState::runScript()
uint a = getVarOrByte();
uint d;
const char *s = (const char *)getStringPtrByID(_stringid_array_3[a]);
- ThreeValues *tv;
-
- switch (b) {
- case 1:
- tv = &_threevalues_1;
- break;
- case 2:
- tv = &_threevalues_2;
- break;
- case 101:
- tv = &_threevalues_3;
- break;
- case 102:
- tv = &_threevalues_4;
- break;
- default:
- error("setup text, invalid value %d", b);
- }
+ ThreeValues *tv = getThreeValues(b);
d = _array_4[a];
if (d != 0 && !_vk_t_toggle)
@@ -1095,24 +1034,8 @@ int SimonState::runScript()
uint c = getVarOrByte();
uint a = getVarOrByte();
const char *s = (const char *)getStringPtrByID(_stringid_array_3[a]);
- ThreeValues *tv;
- switch (b) {
- case 1:
- tv = &_threevalues_1;
- break;
- case 2:
- tv = &_threevalues_2;
- break;
- case 101:
- tv = &_threevalues_3;
- break;
- case 102:
- tv = &_threevalues_4;
- break;
- default:
- error("setup text, invalid value %d", b);
- }
+ ThreeValues *tv = getThreeValues(b);
if (s != NULL)
talk_with_text(b, c, s, tv->a, tv->b, tv->c);
@@ -1361,24 +1284,9 @@ void SimonState::o_177()
Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
if (child != NULL && child->avail_props & 1) {
const char *s = (const char *)getStringPtrByID(child->array[0]);
- ThreeValues *tv;
char buf[256];
- switch (a) {
- case 1:
- tv = &_threevalues_1;
- break;
- case 2:
- tv = &_threevalues_2;
- break;
- case 101:
- tv = &_threevalues_3;
- break;
- case 102:
- tv = &_threevalues_4;
- break;
- default:
- error("setup text, invalid value %d", a);
- }
+
+ ThreeValues *tv = getThreeValues(a);
if (child->avail_props & 0x100) {
uint x = getOffsetOfChild2Param(child, 0x100);
@@ -1398,22 +1306,7 @@ void SimonState::o_177()
if (child != NULL && child->avail_props & 1) {
s = (const char *)getStringPtrByID(child->array[0]);
- switch (a) {
- case 1:
- tv = &_threevalues_1;
- break;
- case 2:
- tv = &_threevalues_2;
- break;
- case 101:
- tv = &_threevalues_3;
- break;
- case 102:
- tv = &_threevalues_4;
- break;
- default:
- error("setup text, invalid value %d", a);
- }
+ tv = getThreeValues(a);
}
if (child != NULL && child->avail_props & 0x200) {
@@ -1489,22 +1382,7 @@ void SimonState::o_177()
if (child != NULL && child->avail_props & 1) {
s = (const char *)getStringPtrByID(child->array[0]);
- switch (a) {
- case 1:
- tv = &_threevalues_1;
- break;
- case 2:
- tv = &_threevalues_2;
- break;
- case 101:
- tv = &_threevalues_3;
- break;
- case 102:
- tv = &_threevalues_4;
- break;
- default:
- error("setup text, invalid value %d", a);
- }
+ tv = getThreeValues(a);
}
if (child == NULL || !(child->avail_props & 1))
diff --git a/simon/simon.cpp b/simon/simon.cpp
index 14937caaef..181d1e3cd0 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -1700,6 +1700,24 @@ void SimonState::handle_verb_clicked(uint verb)
startUp_helper_2();
}
+ThreeValues *SimonState::getThreeValues(uint a)
+{
+ switch (a) {
+ case 1:
+ return &_threevalues_1;
+ case 2:
+ return &_threevalues_2;
+ case 101:
+ return &_threevalues_3;
+ break;
+ case 102:
+ return &_threevalues_4;
+ break;
+ default:
+ error("text, invalid value %d", a);
+ }
+}
+
void SimonState::o_print_str()
{
uint num_1 = getVarOrByte();
@@ -1709,54 +1727,16 @@ void SimonState::o_print_str()
uint speech_id = 0;
ThreeValues *tv;
-
- switch (_game) {
- case GAME_SIMON1TALKIE:
- case GAME_SIMON1WIN:
- if (string_id != 0xFFFF)
- string_ptr = getStringPtrByID(string_id);
-
- speech_id = (uint16)getNextWord();
- break;
-
- case GAME_SIMON2TALKIE:
- case GAME_SIMON2WIN:
+ if (_game & GAME_TALKIE) {
if (string_id != 0xFFFF)
string_ptr = getStringPtrByID(string_id);
speech_id = (uint16)getNextWord();
- break;
-
- case GAME_SIMON2DOS:
- string_ptr = getStringPtrByID(string_id);
- break;
-
- case GAME_SIMON1DEMO:
- string_ptr = getStringPtrByID(string_id);
- break;
-
- case GAME_SIMON1DOS:
+ } else {
string_ptr = getStringPtrByID(string_id);
- break;
- }
-
- switch (num_1) {
- case 1:
- tv = &_threevalues_1;
- break;
- case 2:
- tv = &_threevalues_2;
- break;
- case 101:
- tv = &_threevalues_3;
- break;
- case 102:
- tv = &_threevalues_4;
- break;
- default:
- error("o_print_str, invalid value %d", num_1);
}
+ tv = getThreeValues(num_1);
switch (_game) {
case GAME_SIMON1TALKIE:
diff --git a/simon/simon.h b/simon/simon.h
index d98fa4c978..0b2f098760 100644
--- a/simon/simon.h
+++ b/simon/simon.h
@@ -474,6 +474,9 @@ public:
void o_clear_vgapointer_entry(uint a);
void o_unk_186();
void o_fade_to_black();
+
+
+ ThreeValues *getThreeValues(uint a);
void o_print_str();
void o_setup_cond_c();
void setup_cond_c_helper();