svn-id: r5841
This commit is contained in:
Oliver Kiehl 2002-12-04 22:40:16 +00:00
parent 95c1f3de15
commit 632f44a1a4
3 changed files with 41 additions and 180 deletions

View file

@ -386,20 +386,12 @@ int SimonState::runScript()
break; break;
case 67:{ /* set array 3 and 4 */ case 67:{ /* set array 3 and 4 */
if (_game & GAME_TALKIE) { uint var = getVarOrByte();
uint var = getVarOrByte(); uint string_id = getNextStringID();
uint string_id = getNextStringID(); if (var < 20) {
uint value = getNextWord(); _stringid_array_3[var] = string_id;
if (var < 20) { if (_game & GAME_TALKIE)
_stringid_array_3[var] = string_id; _array_4[var] = getNextWord();
_array_4[var] = value;
}
} else {
uint var = getVarOrByte();
uint string_id = getNextStringID();
if (var < 20) {
_stringid_array_3[var] = string_id;
}
} }
} }
break; break;
@ -743,13 +735,11 @@ int SimonState::runScript()
case 130:{ /* set script cond */ case 130:{ /* set script cond */
uint a = getVarOrByte(); uint a = getVarOrByte();
if (a == 1) { getNextWord();
getNextWord(); if (a == 1)
_script_cond_b = getNextWord(); _script_cond_b = getNextWord();
} else { else
getNextWord();
_script_cond_c = getNextWord(); _script_cond_c = getNextWord();
}
} }
break; break;
@ -930,24 +920,7 @@ int SimonState::runScript()
case 161:{ /* setup text */ case 161:{ /* setup text */
uint value = getVarOrByte(); uint value = getVarOrByte();
ThreeValues *tv; ThreeValues *tv = getThreeValues(value);
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);
}
tv->a = getVarOrWord(); tv->a = getVarOrWord();
tv->b = getVarOrByte(); tv->b = getVarOrByte();
@ -1039,24 +1012,7 @@ int SimonState::runScript()
uint c = getVarOrByte(); uint c = getVarOrByte();
uint a = getVarOrByte(); uint a = getVarOrByte();
const char *s = (const char *)getStringPtrByID(_stringid_array_3[a]); const char *s = (const char *)getStringPtrByID(_stringid_array_3[a]);
ThreeValues *tv; ThreeValues *tv = getThreeValues(b);
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);
}
talk_with_text(b, c, s, tv->a, tv->b, tv->c); talk_with_text(b, c, s, tv->a, tv->b, tv->c);
} else if (_game == GAME_SIMON2TALKIE || _game == GAME_SIMON2WIN) { } else if (_game == GAME_SIMON2TALKIE || _game == GAME_SIMON2WIN) {
@ -1065,24 +1021,7 @@ int SimonState::runScript()
uint a = getVarOrByte(); uint a = getVarOrByte();
uint d; uint d;
const char *s = (const char *)getStringPtrByID(_stringid_array_3[a]); const char *s = (const char *)getStringPtrByID(_stringid_array_3[a]);
ThreeValues *tv; ThreeValues *tv = getThreeValues(b);
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);
}
d = _array_4[a]; d = _array_4[a];
if (d != 0 && !_vk_t_toggle) if (d != 0 && !_vk_t_toggle)
@ -1095,24 +1034,8 @@ int SimonState::runScript()
uint c = getVarOrByte(); uint c = getVarOrByte();
uint a = getVarOrByte(); uint a = getVarOrByte();
const char *s = (const char *)getStringPtrByID(_stringid_array_3[a]); const char *s = (const char *)getStringPtrByID(_stringid_array_3[a]);
ThreeValues *tv;
switch (b) { ThreeValues *tv = getThreeValues(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);
}
if (s != NULL) if (s != NULL)
talk_with_text(b, c, s, tv->a, tv->b, tv->c); 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); Child2 *child = (Child2 *)findChildOfType(getNextItemPtr(), 2);
if (child != NULL && child->avail_props & 1) { if (child != NULL && child->avail_props & 1) {
const char *s = (const char *)getStringPtrByID(child->array[0]); const char *s = (const char *)getStringPtrByID(child->array[0]);
ThreeValues *tv;
char buf[256]; char buf[256];
switch (a) {
case 1: ThreeValues *tv = getThreeValues(a);
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);
}
if (child->avail_props & 0x100) { if (child->avail_props & 0x100) {
uint x = getOffsetOfChild2Param(child, 0x100); uint x = getOffsetOfChild2Param(child, 0x100);
@ -1398,22 +1306,7 @@ void SimonState::o_177()
if (child != NULL && child->avail_props & 1) { if (child != NULL && child->avail_props & 1) {
s = (const char *)getStringPtrByID(child->array[0]); s = (const char *)getStringPtrByID(child->array[0]);
switch (a) { tv = getThreeValues(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);
}
} }
if (child != NULL && child->avail_props & 0x200) { if (child != NULL && child->avail_props & 0x200) {
@ -1489,22 +1382,7 @@ void SimonState::o_177()
if (child != NULL && child->avail_props & 1) { if (child != NULL && child->avail_props & 1) {
s = (const char *)getStringPtrByID(child->array[0]); s = (const char *)getStringPtrByID(child->array[0]);
switch (a) { tv = getThreeValues(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);
}
} }
if (child == NULL || !(child->avail_props & 1)) if (child == NULL || !(child->avail_props & 1))

View file

@ -1700,6 +1700,24 @@ void SimonState::handle_verb_clicked(uint verb)
startUp_helper_2(); 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() void SimonState::o_print_str()
{ {
uint num_1 = getVarOrByte(); uint num_1 = getVarOrByte();
@ -1709,54 +1727,16 @@ void SimonState::o_print_str()
uint speech_id = 0; uint speech_id = 0;
ThreeValues *tv; ThreeValues *tv;
if (_game & GAME_TALKIE) {
switch (_game) {
case GAME_SIMON1TALKIE:
case GAME_SIMON1WIN:
if (string_id != 0xFFFF) if (string_id != 0xFFFF)
string_ptr = getStringPtrByID(string_id); string_ptr = getStringPtrByID(string_id);
speech_id = (uint16)getNextWord(); speech_id = (uint16)getNextWord();
break; } else {
case GAME_SIMON2TALKIE:
case GAME_SIMON2WIN:
if (string_id != 0xFFFF)
string_ptr = getStringPtrByID(string_id);
speech_id = (uint16)getNextWord();
break;
case GAME_SIMON2DOS:
string_ptr = getStringPtrByID(string_id); string_ptr = getStringPtrByID(string_id);
break;
case GAME_SIMON1DEMO:
string_ptr = getStringPtrByID(string_id);
break;
case GAME_SIMON1DOS:
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) { switch (_game) {
case GAME_SIMON1TALKIE: case GAME_SIMON1TALKIE:

View file

@ -474,6 +474,9 @@ public:
void o_clear_vgapointer_entry(uint a); void o_clear_vgapointer_entry(uint a);
void o_unk_186(); void o_unk_186();
void o_fade_to_black(); void o_fade_to_black();
ThreeValues *getThreeValues(uint a);
void o_print_str(); void o_print_str();
void o_setup_cond_c(); void o_setup_cond_c();
void setup_cond_c_helper(); void setup_cond_c_helper();