/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see next) { if (!strcmp(hotspot->vocab, "FENG LI")) { if (flag) { hotspot->active = hotspot->lr_x < 600; } else { hotspot->active = hotspot->lr_x > 600; } } } } void Room303::setShadow4(bool active) { if (active) { _shadow4 = series_place_sprite("candleman shadow4", 0, 360, 252, -86, 0xe06); } else { terminateMachineAndNull(_shadow4); } } void Room303::setShadow5(bool active) { if (active) { _shadow5 = series_place_sprite("candleman shadow5", 0, 480, 256, -84, 0xe06); } else { terminateMachineAndNull(_shadow5); } } void Room303::setShadow5Alt(bool active) { if (active) { _shadow5 = series_place_sprite("candleman shadow5", 0, 706, 256, 84, 0xe06); } else { terminateMachineAndNull(_shadow5); } } void Room303::escapePressed(void *, void *) { _G(kernel).trigger_mode = KT_DAEMON; disable_player_commands_and_fade_init(56); } void Room303::playSeries(bool cow) { series_plain_play("SPINNING TOMATO MAN", -1, 0, 100, 0, 7); series_plain_play("PUFFBALL", -1, 0, 100, 0, 8); series_plain_play("CREATURE FEATURE LONG VIEW", 1, 0, 100, 0xf05, 7, 70); if (cow) series_plain_play("303cow1", -1, 0, 100, 0, 9); } void Room303::conv303a() { const int who = conv_whos_talking(); const int node = conv_current_node(); const int entry = conv_current_entry(); const char *sound = conv_sound_to_play(); if (_G(kernel).trigger == 1) { if (who <= 0) { _fengShould = node != 3 || entry ? 1 : 0; } else if (who == 1) { if ((node == 0 && entry != 0) || (node == 0 && entry == 1)) { if (!_lonelyFlag) { midi_play("ppstreet", 140, true, -1, 949); } } if (node != 1 || entry != 1) { if (node != 3 || entry != 1) _ripleyShould = 0; } else { _ripleyShould = 3; } } conv_resume(); } else if (!conv_sound_to_play()) { conv_resume(); } else { if (who <= 0) { if (node == 3 && !entry) _ripleyShould = 2; if ((node != 3 || entry != 1) && (node != 3 || entry)) _fengShould = 2; else _fengShould = 3; } else if (who == 1) { if (node != 1 || entry != 1) { if (node != 5 || entry) { if (node != 3 || entry != 1) _ripleyShould = 1; } else { _ripleyShould = 0; } } else { _ripleyShould = 4; } } digi_play(sound, 1, 255, 1); } } // Conversation with Mei void Room303::conv303b() { const int who = conv_whos_talking(); const int node = conv_current_node(); const int entry = conv_current_entry(); const char *sound = conv_sound_to_play(); switch (_G(kernel).trigger) { case 1: if (who <= 0) { _meiShould = 4; if (node == 1 && entry == 0) { digi_unload("08_01n01"); digi_unload("08_02n01"); } else if (node == 2 && entry == 2) { _ripleyShould = 0; } else if (node == 1 && entry == 2) { digi_preload("com119"); _ripPonders = series_stream("303 rip reacts", 4, 0, 667); series_stream_break_on_frame(_ripPonders, 5, 7); return; } } else if (who == 1) { if ((node == 0 && entry == 0) || (node == 0 && entry == 1)) { if (!_lonelyFlag) { midi_play("lonelyme", 140, true, -1, 949); _lonelyFlag = true; } } if (node == 0 && entry == 0) { series_unload(2); series_unload(3); series_unload(4); _ripPonders = series_stream("303pu01", 4, 0x100, 666); series_stream_break_on_frame(_ripPonders, 5, 700); return; } if (node == 1 && entry == 2) { // No implementation } else if ((node == 2 && entry == 0) || (node == 2 && entry == 2)) { _ripleyShould = 3; } else { _ripleyShould = 0; } } conv_resume(); break; case 2: series_set_frame_rate(_ripPonders, 20); series_stream_break_on_frame(_ripPonders, 27, 3); break; case 3: series_set_frame_rate(_ripPonders, 5); break; case 4: _meiShould = 5; break; case 5: digi_play("com119", 1, 255, 6); break; case 6: digi_unload("com119"); break; case 7: _ripleyShould = 0; series_stream_break_on_frame(_ripPonders, 22, 5); break; case 666: kernel_timing_trigger(1, 668); break; case 667: kernel_timing_trigger(1, 670); break; case 668: conv_resume(); digi_preload("08_01n01"); digi_preload("08_02n01"); _ripPonders = series_stream("303 rip ponders", 5, 0, -1); series_stream_break_on_frame(_ripPonders, 5, 2); break; case 670: series_load("test1"); series_load("test3"); series_load("test4"); series_load("test5"); conv_resume(); break; case 700: _ripleyShould = 0; break; default: if (sound) { if (who <= 0) { if (node != 2 || entry != 1) _meiShould = 5; } else if (who == 1) { if (node == 1 && entry == 2) { _ripleyShould = 2; } else if (node == 2 && entry == 1) { _meiShould = 6; kernel_timing_trigger(150, 4); } else if ((node == 2 && entry == 0) || (node == 2 && entry == 2)) { _ripleyShould = 4; } else { _ripleyShould = 1; } } digi_play(sound, 1, 255, 1); } else { conv_resume(); } break; } } void Room303::priestTalkCallback(frac16 myMessage, machine *sender) { const int trigger = myMessage >> 16; if (trigger > 0) { Room303 *room = (Room303 *)g_engine->_activeRoom; const KernelTriggerType oldMode = _G(kernel).trigger_mode; _G(kernel).trigger_mode = room->_val12; kernel_timing_trigger(1, trigger); _G(kernel).trigger_mode = oldMode; } } void Room303::priestTalk(bool flag, int trigger) { ws_hide_walker(_fengLi); _G(globals)[GLB_TEMP_1] = _feng1 << 24; _G(globals)[GLB_TEMP_2] = 0xD << 24; _G(globals)[GLB_TEMP_3] = _feng3 << 24; _G(globals)[GLB_TEMP_4] = 0xD << 24; _G(globals)[GLB_TEMP_9] = _feng4 << 24; _G(globals)[GLB_TEMP_10] = 0xD << 24; _G(globals)[GLB_TEMP_5] = (flag ? 480 : 706) << 16; _G(globals)[GLB_TEMP_6] = 1 << 24; _G(globals)[GLB_TEMP_7] = MulSF16((1 << 24) - _G(globals)[GLB_MIN_Y], _G(globals)[GLB_SCALER]) + _G(globals)[GLB_MIN_SCALE]; _G(globals)[GLB_TEMP_8] = (flag ? 1 : 0) << 16; _G(globals)[GLB_TEMP_11] = trigger << 16; _G(globals)[GLB_TEMP_12] = 0xdc28; _priestTalk = TriggerMachineByHash(32, nullptr, -1, -1, priestTalkCallback, false, "fl priest/talk"); } int Room303::getSize(const Common::String &assetName, int roomNum) { Common::String name = expand_name_2_RAW(assetName, roomNum); const size_t fileSize = f_info_get_file_size(Common::Path(name)); return static_cast((double)fileSize * 0.000090702946); } void Room303::playSound(const Common::String &assetName, int trigger1, int trigger2) { if (!trigger2) trigger2 = -1; const int size = MAX(getSize(assetName), 0); _G(globals)[GLB_TEMP_1] = size << 16; _G(globals)[GLB_TEMP_2] = trigger2 << 16; sendWSMessage(0x200000, 0, _priestTalk, 0, nullptr, 1); digi_play(assetName.c_str(), 1, 255, trigger1); } void Room303::syncGame(Common::Serializer &s) { s.syncAsByte(_fengFlag); } } // namespace Rooms } // namespace Riddle } // namespace M4