Auto enable text when no voice file is available.

Allow 't' to toggle speech on and off in simon1talkie/win

svn-id: r5629
This commit is contained in:
Travis Howell 2002-11-20 05:12:10 +00:00
parent caa5159a52
commit 47c4b25bfd
3 changed files with 74 additions and 30 deletions

View file

@ -1010,11 +1010,34 @@ int SimonState::runScript()
case 179:{
if (_game == GAME_SIMON1TALKIE || _game == GAME_SIMON1WIN) {
uint b = getVarOrByte();
/*uint c = */ getVarOrByte();
uint c = getVarOrByte();
uint a = getVarOrByte();
uint d = _array_4[a];
if (d != 0)
talk_with_speech(d, b);
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);
}
if (_vk_t_toggle) {
talk_with_text(b, c, s, tv->a, tv->b, tv->c);
} else if (d != 0) {
talk_with_speech(d, b);
}
} else if (_game == GAME_SIMON1DEMO || _game == GAME_SIMON1DOS) {
uint b = getVarOrByte();
uint c = getVarOrByte();
@ -1305,15 +1328,49 @@ void SimonState::o_177()
{
if (_game == GAME_SIMON1TALKIE || _game == GAME_SIMON1WIN) {
uint a = getVarOrByte();
/*uint b = */ 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);
} else if (child != NULL && child->avail_props & 0x100) {
offs = getOffsetOfChild2Param(child, 0x100);
talk_with_speech(child->array[offs] + 3550, a);
const char *s = NULL;
ThreeValues *tv = NULL;
char buf[256];
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);
}
}
if (_vk_t_toggle) {
if (child->avail_props & 0x100) {
uint x = getOffsetOfChild2Param(child, 0x100);
sprintf(buf, "%d%s", child->array[x], s);
s = buf;
}
talk_with_text(a, b, s, tv->a, tv->b, tv->c);
} else {
if (child != NULL && child->avail_props & 0x200) {
offs = getOffsetOfChild2Param(child, 0x200);
talk_with_speech(child->array[offs], a);
} else if (child != NULL && child->avail_props & 0x100) {
offs = getOffsetOfChild2Param(child, 0x100);
talk_with_speech(child->array[offs] + 3550, a);
}
}
} else if ((_game == GAME_SIMON1DEMO) || (_game == GAME_SIMON1DOS)) {
uint a = getVarOrByte();

View file

@ -1772,24 +1772,11 @@ void SimonState::o_print_str()
switch (_game) {
case GAME_SIMON1TALKIE:
case GAME_SIMON1WIN:
#ifdef USE_TEXT_HACK
if (speech_id != 0) {
if (string_ptr == NULL)
talk_with_speech(speech_id, num_1);
else if (speech_id != 9999)
playVoice(speech_id);
}
if (string_ptr != NULL) {
talk_with_text(num_1, num_2, (char *)string_ptr, tv->a, tv->b, tv->c);
}
#else
if (speech_id != 0) {
if (speech_id != 0 && !_vk_t_toggle) {
talk_with_speech(speech_id, num_1);
} else if (string_ptr != NULL) {
talk_with_text(num_1, num_2, (char *)string_ptr, tv->a, tv->b, tv->c);
}
#endif
break;
case GAME_SIMON1DEMO:
@ -3435,13 +3422,9 @@ void SimonState::video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte
bool SimonState::vc_59_helper()
{
#ifdef USE_TEXT_HACK
return true;
#else
if (_voice_file == NULL)
if (_vk_t_toggle)
return true;
return _voice_sound == 0;
#endif
}
void SimonState::video_copy_if_flag_0x8_c(FillOrCopyStruct *fcs)
@ -4569,7 +4552,12 @@ void SimonState::go()
_last_music_played = (uint) - 1;
_vga_base_delay = 1;
if (_voice_type != FORMAT_NONE) {
_vk_t_toggle = false;
} else {
_vk_t_toggle = true;
}
while (1) {
hitarea_stuff();

View file

@ -31,7 +31,6 @@
//#define DUMP_CONTINOUS_MAINSCRIPT
//#define DUMP_START_MAINSCRIPT
//#define DUMP_CONTINOUS_VGASCRIPT
//#define USE_TEXT_HACK
//#define DRAW_IMAGES_DEBUG
//#define DRAW_THREE_STARS
//#define DUMP_START_VGASCRIPT