Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

View File

@@ -0,0 +1,837 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "common/debug.h"
#include "m4/burger/burger.h"
#include "m4/burger/console.h"
#include "m4/burger/vars.h"
#include "m4/burger/core/conv.h"
#include "m4/burger/gui/gui_gizmo.h"
#include "m4/burger/gui/game_menu.h"
#include "m4/graphics/krn_pal.h"
#include "m4/core/errors.h"
#include "m4/core/imath.h"
namespace M4 {
namespace Burger {
static const seriesPlayBreak PLAY_BREAKS1[] = {
{ 0, 17, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
{ 18, 18, nullptr, 0, 0, 10008, 0, 0, 0, 0 },
{ 19, 21, "999blow", 1, 125, -1, 0, -1, 0, 0 },
{ 22, 30, nullptr, 0, 0, -1, 0, 0, 0, 0 },
{ 7, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
{ -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
};
static const seriesPlayBreak PLAY_BREAKS2[] = {
{ 0, 11, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
{ 12, 13, nullptr, 0, 0, -1, 0, 5, 0, 0 },
{ 14, 26, "302w002", 1, 255, -1, 0, 0, 0, 0 },
{ 7, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
{ -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
};
static const seriesPlayBreak PLAY_BREAKS3[] = {
{ 0, 14, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
{ 15, 16, "600_008", 2, 255, -1, 0, 0, 0, 0 },
{ 17, 21, "602w012", 1, 255, -1, 0, 0, 0, 0 },
{ 7, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
{ -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
};
static const seriesPlayBreak PLAY_BREAKS4[] = {
{ 0, 12, 0, 1, 0, -1, 2048, 0, 0, 0 },
{ 12, 13, "500_004", 1, 255, -1, 0, 2, 0, 0 },
{ 12, 0, 0, 0, 0, -1, 0, 0, 0, 0 },
{ -1, -1, 0, 0, 0, -1, 0, 0, 0, 0 }
};
static const seriesPlayBreak PLAY_BREAKS5[] = {
{ 0, 15, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
{ 16, 20, "999_001", 1, 200, -1, 0, 0, 0, 0 },
{ 19, 19, nullptr, 0, 0, -1, 0, 0, 0, 0 },
{ 15, 18, "999_001", 1, 200, -1, 0, 0, 0, 0 },
{ 15, 18, "999_001", 1, 200, -1, 0, 0, 0, 0 },
{ 14, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
{ -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
};
static const seriesPlayBreak PLAY_BREAKS6[] = {
{ 0, 15, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
{ 16, 23, "999_001", 1, 200, -1, 0, 0, 0, 0 },
{ 24, 30, "999_002", 1, 200, -1, 0, 0, 0, 0 },
{ 31, 34, nullptr, 1, 200, -1, 0, 0, 0, 0 },
{ 34, 34, nullptr, 0, 0, -1, 0, 0, 0, 0 },
{ 14, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
{ -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
};
static const char *SAID1[][4] = {
{ "WILBUR", "999w010", "999w011", "999w011" },
{ "BROKEN MOUSE TRAP", "405W016", nullptr, "400W001" },
{ "CARROT JUICE", "300w043", nullptr, nullptr },
{ "BOTTLE", "300w071", nullptr, nullptr },
{ "WHISTLE", "300w058", nullptr, nullptr },
{ "PANTYHOSE", "999w005", nullptr, nullptr },
{ "AMPLIFIER", "999w026", nullptr, nullptr },
{ "DEED", "999w101", nullptr, nullptr },
{ "JAWZ O' LIFE", "999w103", nullptr, nullptr },
{ nullptr, nullptr, nullptr, nullptr }
};
static const char *GLOBAL_PARSER_LIST[] = {
"DEED", "LOOK AT", "999w101", "WILBUR", "400w001",
nullptr, "999w102", PARSER_ITEM_END,
"JAWZ O' LIFE", "LOOK AT", "999w103", "WILBUR", "400w001",
nullptr, "999w104", PARSER_ITEM_END,
"CARROT JUICE", "JUG", "300w046", "JUG ", "300w046",
"JUG", "300w046", "AUNT POLLY", "999w225",
nullptr, "300w057", PARSER_ITEM_END,
"SPRING", "BROKEN MOUSE TRAP", "405w018",
nullptr, nullptr, PARSER_ITEM_END,
"BOTTLE", "WATER", "999w224", "WILBUR", "300w077",
nullptr, "300w078", PARSER_ITEM_END,
"WHISTLE", nullptr, "300w070", PARSER_ITEM_END,
"BLOCK OF ICE", "FLOOR", "999w003", "FLOOR ", "999w003",
"MICROWAVE", "999w222", "WILBUR", "999w003",
nullptr, "999w004", PARSER_ITEM_END,
"PANTYHOSE", "ENGINE", "999w223",
nullptr, "999w008", PARSER_ITEM_END,
"AMPLIFIER", "WILBUR", "999w027",
nullptr, "999w029", PARSER_ITEM_END,
"MONEY", "STOLIE", "999w205",
nullptr, "999w206", PARSER_ITEM_END,
"BROKEN PUZ DISPENSER", "LOOK AT", "999w207",
nullptr, "999w209", PARSER_ITEM_END,
"PUZ DISPENSER", "LOOK AT", "999w207",
nullptr, "999w209", PARSER_ITEM_END,
"SPRING", "LOOK AT", "999w210",
nullptr, "999w211", PARSER_ITEM_END,
"PHONE BILL", "LOOK AT", "999w212", "AUNT POLLY", "999w213",
nullptr, "999w206", PARSER_ITEM_END,
"LAXATIVE", "LOOK AT", "999w214", "GEAR", "999w215",
"WILBUR", "999w215", "PEGLEG", "999w216",
"PEGLEG ", "999w216", "PEGLEG ", "999w216",
"TRUFFLES", "999w217", "GERBILS", "999w218",
"BORK", "999w219", "BORK ", "999w219",
"BORK ", "999w219", "BORK ", "999w219",
"BORK ", "999w219",
nullptr, nullptr, PARSER_ITEM_END,
"KEYS", "LOOK AT", "999w220", "WILBUR", "999w206",
nullptr, "999w221", PARSER_ITEM_END,
"WILBUR", nullptr, "999w012", PARSER_ITEM_END,
nullptr
};
BurgerEngine::BurgerEngine(OSystem *syst, const M4GameDescription *gameDesc) :
M4Engine(syst, gameDesc) {
_sections.push_back(&_section1);
_sections.push_back(&_section2);
_sections.push_back(&_section3);
_sections.push_back(&_section4);
_sections.push_back(&_section5);
_sections.push_back(&_section6);
_sections.push_back(&_section7);
_sections.push_back(&_section8);
_sections.push_back(&_section9);
}
BurgerEngine::~BurgerEngine() {
}
M4::Vars *BurgerEngine::createVars() {
return new Burger::Vars();
}
void BurgerEngine::setupConsole() {
setDebugger(new Burger::Console());
}
void BurgerEngine::showEngineInfo() {
debug("Orion Burger\n");
debug("Game Version %s -- %s\n", "Giraffe", "September 27, 1996");
debug("%s\n", "M4 Runtime Engine by NickP, MikeE, AndrasK, Tinman, XiH, PaulL, MattP");
debug("M4 Library Version %s -- %s\n", "v1.400 OB", "January 21, 1996");
debug("%s.\n\n", "Copyright (c) 1996 by Sanctuary Woods Multimedia Corporation");
debug("Orion Burger tastes great!\n");
}
void BurgerEngine::syncFlags(Common::Serializer &s) {
g_vars->_flags.sync(s);
}
void BurgerEngine::global_daemon() {
switch (_G(kernel).trigger) {
case kRESUME_CONVERSATION:
conv_resume_curr();
break;
case kSERIES_STREAM_BREAK:
handle_series_stream_break();
break;
case kSERIES_PLAY_BREAK_0:
handle_series_play_break(0);
break;
case kSERIES_PLAY_BREAK_1:
handle_series_play_break(1);
break;
case kSERIES_PLAY_BREAK_2:
handle_series_play_break(2);
break;
case kRELEASE_TRIGGER_DIGI_CHECK:
release_trigger_digi_check();
break;
case kAdvanceTime:
_G(flags).advance_boonsville_time_and_check_schedule(300);
kernel_timing_trigger(300, kAdvanceTime);
break;
case kNPC_SPEECH_FINISHED:
if (_G(npcSpeech1))
terminateMachineAndNull(_G(npcSpeech1));
if (_G(npcSpeech2))
terminateMachineAndNull(_G(npcSpeech2));
kernel_trigger_dispatch_now(_G(npcTrigger));
break;
case kWILBURS_SPEECH_FINISHED:
_G(walker).wilburs_speech_finished();
break;
case kWILBURS_SPEECH_START:
_G(walker).wilbur_say();
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 10001:
ws_unhide_walker(_G(my_walker));
player_set_commands_allowed(true);
_G(flags)[V299] = 0;
_G(flags)[kDisableFootsteps] = 0;
_G(wilbur_should) = 10002;
break;
case 10002:
_G(flags)[V299] = 0;
_G(flags)[kDisableFootsteps] = 0;
break;
case 10003:
player_set_commands_allowed(false);
player_update_info();
ws_hide_walker();
_G(wilbur_should) = 10013;
series_play_with_breaks(PLAY_BREAKS1, "999wbw", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 7,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10004:
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10012;
series_play_with_breaks(PLAY_BREAKS2, "999wcj", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 6,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10005:
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10009;
series_play_with_breaks(PLAY_BREAKS3, "600wek", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 6,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10006:
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10001;
series_play_with_breaks(PLAY_BREAKS4, "999wsdu", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 7,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10007:
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10014;
series_play_with_breaks(PLAY_BREAKS5, "999wtpe", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 6,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10008:
player_set_commands_allowed(false);
player_update_info(_G(my_walker), &_G(player_info));
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 10001;
series_play_with_breaks(PLAY_BREAKS6, "999wtpf", _G(player_info).depth, kCHANGE_WILBUR_ANIMATION, 3, 6,
_G(player_info).scale, _G(player_info).x, _G(player_info).y);
break;
case 10009:
ws_unhide_walker(_G(my_walker));
_G(wilbur_should) = 10010;
_G(walker).wilbur_speech("602w012x", kCHANGE_WILBUR_ANIMATION);
break;
case 10010:
_G(wilbur_should) = 10011;
_G(walker).wilbur_speech("602w012y", kCHANGE_WILBUR_ANIMATION);
break;
case 10011:
player_set_commands_allowed(true);
_G(wilbur_should) = 10002;
_G(walker).wilbur_speech("602w012z");
break;
case 10012:
player_set_commands_allowed(true);
ws_unhide_walker(_G(my_walker));
_G(wilbur_should) = 10002;
_G(walker).wilbur_speech("300w055");
break;
case 10013:
player_set_commands_allowed(true);
ws_unhide_walker(_G(my_walker));
_G(wilbur_should) = 10002;
break;
case 10014:
enable_player();
_G(wilbur_should) = 10002;
_G(walker).wilbur_speech("999w208");
break;
case 10017:
wilbur_abduct(10024);
break;
case 10018:
wilbur_abduct(10027);
break;
default:
break;
}
break;
case kAdvanceHour:
if (!player_commands_allowed() && !_G(flags)[V299] && _G(my_walker) &&
_G(player).walker_in_this_scene && _G(player).walker_visible)
sendWSMessage(0, 0, _G(my_walker), 0, 0, 1);
kernel_timing_trigger(imath_ranged_rand(900, 1800), kAdvanceHour);
break;
case kSET_FACING:
player_set_facing_at(_G(player_facing_x), _G(player_facing_y),
_G(player_trigger));
break;
case kPOOF:
ws_demand_location(_G(my_walker), _G(player_dest_x), _G(player_dest_y));
_G(walker).wilbur_poof();
kernel_trigger_dispatch_now(kSET_COMMANDS_ALLOWED);
break;
case kSET_COMMANDS_ALLOWED:
player_set_commands_allowed(true);
break;
case kUNPOOF:
_G(walker).wilbur_unpoof();
break;
case kAbduction:
if (_G(game).room_id < 200) {
_G(wilbur_should) = 10017;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
error_show(FL, 'Burg', "Time to abduct Wilbur in space?");
}
break;
case kTestTimeout:
if (_G(game).room_id < 700) {
_G(wilbur_should) = 10018;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
case kTELEPORTED1:
disable_player_commands_and_fade_init(kTELEPORTED2);
break;
case kTELEPORTED2:
testDone();
break;
case 10027:
wilburTeleported();
break;
case 10033:
player_set_commands_allowed(false);
_G(game).setRoom(701);
break;
default:
break;
}
}
void BurgerEngine::global_pre_parser() {
if (player_said("wilbur")) {
_G(player).need_to_walk = false;
_G(player).ready_to_walk = true;
_G(player).waiting_for_walk = false;
}
if (player_said("SKY"))
player_set_facing_hotspot();
}
void BurgerEngine::global_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(walker).wilbur_said(SAID1))
goto done;
if (player_said_any("WILBUR", "GEAR")) {
if (player_said("CARROT JUICE")) {
if (_G(flags)[V123] && !imath_rand_bool(3)) {
_G(walker).wilbur_speech("300w056");
goto done;
} else if (_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(flags)[V123] = 1;
_G(wilbur_should) = 10004;
ws_turn_to_face(_G(my_walker), 3, kCHANGE_WILBUR_ANIMATION);
goto done;
}
}
}
if (player_said("WHISTLE") && player_said_any("GEAR", "WILBUR") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(wilbur_should) = 10003;
ws_turn_to_face(_G(my_walker), 7, kCHANGE_WILBUR_ANIMATION);
goto done;
}
if (player_said("kibble") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(wilbur_should) = 10005;
ws_turn_to_face(_G(my_walker), 9, kCHANGE_WILBUR_ANIMATION);
goto done;
}
if (player_said("rubber ducky") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(wilbur_should) = 10006;
ws_turn_to_face(_G(my_walker), 9, kCHANGE_WILBUR_ANIMATION);
goto done;
}
if (player_said("broken puz dispenser") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(wilbur_should) = 10007;
ws_turn_to_face(_G(my_walker), 5, 10016);
goto done;
}
if (player_said("puz dispenser") && player_said_any("gear", "wilbur") &&
_G(my_walker) && _G(player).walker_in_this_scene && _G(player).walker_visible) {
_G(wilbur_should) = 10008;
ws_turn_to_face(_G(my_walker), 5, kCHANGE_WILBUR_ANIMATION);
goto done;
}
if (player_said("spring", "broken puz dispenser")) {
inv_move_object("BROKEN PUZ DISPENSER", NOWHERE);
inv_move_object("SPRING", NOWHERE);
inv_give_to_player("PUZ DISPENSER");
} else if (player_said("LOOK AT", "BLOCK OF ICE")) {
_G(walker).wilbur_speech(_G(flags)[V250] ? "999w002" : "999w001");
} else if (player_said("PANTYHOSE", "WILBUR")) {
if (_G(flags)[V297]) {
_G(walker).wilbur_speech("999w007");
} else {
_G(walker).wilbur_speech("999w006");
_G(flags)[V297] = 1;
}
} else if (player_said("TAKE")) {
_G(walker).wilbur_speech(saidofInterest() ? "999w021" : "999w016");
} else if (player_said("LOOK AT", "MONEY")) {
switch (_G(flags)[V001]) {
case 11:
_G(walker).wilbur_speech("999w204");
break;
case 12:
_G(walker).wilbur_speech("999w203");
break;
case 19:
_G(walker).wilbur_speech("999w202");
break;
case 20:
_G(walker).wilbur_speech("999w201");
break;
default:
break;
}
} else if (player_said("GEAR")) {
_G(walker).wilbur_speech_random("999w017", "999w018", "999w019", "999w020");
} else if (!_G(walker).wilbur_parser(GLOBAL_PARSER_LIST)) {
if (player_said("LOOK AT")) {
_G(walker).wilbur_speech_random("999w013", "999w014", "999w015");
} else if (player_said("WALK") || player_said("WALK TO") ||
player_said("WALK ACROSS") || player_said("WALK ON")) {
term_message("Just a walk, no response needed.");
} else {
_G(walker).wilbur_speech_random("999w017", "999w018", "999w019", "999w020");
}
}
done:
_G(player).command_ready = false;
}
bool BurgerEngine::saidofInterest() const {
return player_said_any("DISTILLED CARROT JUICE", "broken puz dispenser", "puz dispenser") ||
player_said_any("broken mouse trap", "mouse trap", "kindling", "burning kindling") ||
player_said_any("CHRISTMAS LIGHTS", "CHRISTMAS LIGHTS ", "bottle", "carrot juice") ||
player_said_any("soapy water", "iron filings", "waxed hair", "fish") ||
player_said_any("hook", "keys", "records", "DOG DOLLAR") ||
player_said_any("AMPLIFIER", "rubber gloves", "DIRTY SOCK", "JAWZ O' LIFE") ||
player_said_any("deed", "burger morsel", "whistle", "QUARTER") ||
player_said_any("matches", "phone cord", "kibble", "pantyhose") ||
player_said_any("fan belt", "spring", "mirror", "PHONE BILL") ||
player_said_any("ray gun", "BLOCK OF ICE", "rolling pin", "rubber duck") ||
player_said_any("LAXATIVE", "money", "crow bar", "Wilbur");
}
void BurgerEngine::testDone() {
player_set_commands_allowed(false);
if (_G(flags).getConvName())
_G(game).setRoom(207);
else
handleTestDone();
}
void BurgerEngine::handleTestDone() {
if (_G(flags)[kFirstTestPassed]) {
testDone1();
if (_G(flags)[kSecondTestPassed]) {
testDone2();
if (_G(flags)[kThirdTestPassed]) {
testDone3();
if (_G(flags)[kFourthTestPassed]) {
testDone4();
if (_G(flags)[kFifthTestPassed]) {
testDone5();
_G(game).setRoom(701);
_G(flags).set_boonsville_time(505200);
} else {
_G(game).setRoom(_G(flags)[V153] ? 402 : 401);
_G(flags).set_boonsville_time(393600);
}
} else {
_G(game).setRoom(_G(flags)[V185] ? 502 : 501);
_G(flags).set_boonsville_time(282000);
}
} else {
_G(game).setRoom(_G(flags)[V100] ? 302 : 301);
_G(flags).set_boonsville_time(170400);
}
} else {
_G(game).setRoom(_G(flags)[V242] ? 604 : 601);
_G(flags).set_boonsville_time(58800);
}
} else {
_G(game).setRoom(801);
_G(flags).set_boonsville_time(37200);
}
}
void BurgerEngine::testDone1() {
_G(flags)[kFirstTestPassed] = 1;
if (!_G(flags)[kNEURO_TEST_COUNTER])
_G(flags)[kNEURO_TEST_COUNTER]++;
}
void BurgerEngine::testDone2() {
if (!_G(flags)[V242])
_G(flags)[V242]++;
_G(flags)[kSecondTestPassed] = 1;
_G(flags)[kHampsterState] = 6007;
_G(flags)[V244] = 6004;
_G(flags)[V245] = 10031;
_G(flags)[V246] = 0;
_G(flags)[V247] = 1;
_G(flags)[V248] = 1;
_G(flags)[V249] = 1;
_G(flags)[V250] = 1;
_G(flags)[V251] = 1;
_G(flags)[V255] = 1;
_G(flags)[kGerbilCageDoor] = 2;
_G(flags)[V257] = -140;
_G(flags)[V258] = 0;
_G(flags)[V259] = 1;
_G(flags)[V260] = 1;
_G(flags)[V261] = 1;
_G(flags)[V263] = 0;
_G(flags)[V265] = 1;
_G(flags)[V266] = 0;
_G(flags)[V269] = 1;
_G(flags)[V270] = 6001;
_G(flags)[V273] = 1;
_G(flags)[V274] = 1;
_G(flags)[V277] = 6003;
_G(flags)[V278] = 1;
inv_move_object("ray gun", NOWHERE);
inv_move_object("kibble", NOWHERE);
inv_move_object("block of ice", NOWHERE);
inv_move_object("pantyhose", NOWHERE);
}
void BurgerEngine::testDone3() {
if (!_G(flags)[V100])
_G(flags)[V100]++;
inv_move_object("BURGER MORSEL", NOWHERE);
inv_move_object("MATCHES", NOWHERE);
inv_move_object("JUG", NOWHERE);
inv_move_object("DISTILLED CARROT JUICE", NOWHERE);
inv_move_object("CARROT JUICE", NOWHERE);
inv_give_to_player("BOTTLE");
_G(flags)[kThirdTestPassed] = 1;
_G(flags)[V101] = 1;
_G(flags)[V107] = 1;
_G(flags)[V108] = 1;
_G(flags)[V109] = 1;
_G(flags)[V110] = 1;
_G(flags)[kTrufflesInMine] = 1;
_G(flags)[kPerkinsLostIsland] = 1;
_G(flags)[V115] = 5;
_G(flags)[V116] = 1;
_G(flags)[V117] = 1;
_G(flags)[V118] = 3002;
_G(flags)[V119] = 0;
_G(flags)[V120] = 1;
_G(flags)[V121] = 3003;
_G(flags)[V122] = 1;
_G(flags)[V123] = 1;
_G(flags)[kDrunkCarrotJuice] = 1;
_G(flags)[V129] = 1;
_G(flags)[V130] = 1;
_G(flags)[V134] = 1;
_G(flags)[V140] = 1;
_G(flags)[kTrufflesRanAway] = 1;
_G(flags)[V145] = 1;
}
void BurgerEngine::testDone4() {
if (!_G(flags)[V185])
_G(flags)[V185]++;
inv_move_object("GIZMO", NOWHERE);
inv_move_object("CHRISTMAS LIGHTS", NOWHERE);
inv_move_object("CHRISTMAS LIGHTS ", NOWHERE);
inv_move_object("RUBBER DUCKY", NOWHERE);
inv_move_object("SOAPY WATER", NOWHERE);
inv_move_object("DIRTY SOCK", NOWHERE);
inv_move_object("ROLLING PIN", NOWHERE);
inv_move_object("RUBBER GLOVES", NOWHERE);
inv_move_object("KINDLING", NOWHERE);
inv_move_object("BURNING KINDLING", NOWHERE);
inv_move_object("GIZMO", NOWHERE);
inv_move_object("GIZMO", NOWHERE);
inv_give_to_player("BOTTLE");
_G(flags)[kFourthTestPassed] = 1;
_G(flags)[V186] = 0;
_G(flags)[V195] = 1;
_G(flags)[V196] = 0;
_G(flags)[V197] = 1;
_G(flags)[kFireplaceHasFire] = 1;
_G(flags)[V199] = 1;
_G(flags)[kStairsBorkState] = 5003;
_G(flags)[kBORK_STATE] = 16;
_G(flags)[V204] = 5003;
_G(flags)[V205] = 1;
_G(flags)[V206] = 0;
_G(flags)[V207] = 1;
_G(flags)[V210] = 5002;
_G(flags)[V211] = 5000;
_G(flags)[V212] = 5000;
_G(flags)[V213] = 2;
_G(flags)[V214] = 0;
_G(flags)[V218] = 5003;
_G(flags)[kTVOnFire] = 1;
_G(flags)[V223] = 2;
_G(flags)[V224] = 0;
_G(flags)[V227] = 1;
_G(flags)[V228] = 1;
_G(flags)[V229] = 0;
_G(flags)[V234] = 1;
}
void BurgerEngine::testDone5() {
if (!_G(flags)[V153])
_G(flags)[V153]++;
_G(flags)[kFifthTestPassed] = 1;
_G(flags)[V157] = 1;
_G(flags)[V158] = 1;
_G(flags)[V159] = 1;
_G(flags)[V162] = 1;
_G(flags)[V165] = 1;
_G(flags)[V166] = 1;
_G(flags)[V167] = 1;
_G(flags)[V175] = 1;
_G(flags)[V171] = 4003;
_G(flags)[V172] = 10026;
_G(flags)[V173] = 0;
_G(flags)[V174] = 4004;
_G(flags)[V176] = 1;
_G(flags)[V181] = 1;
inv_move_object("QUARTER", NOWHERE);
inv_move_object("FISH", NOWHERE);
inv_move_object("RECORDS", NOWHERE);
inv_move_object("DOG COLLAR", NOWHERE);
}
#define MAX_INT 0x7FFFFFFF
void BurgerEngine::wilburTeleported() {
KernelTriggerType oldMode = _G(kernel).trigger_mode;
int oldSection = _G(game).section_id;
switch (oldSection) {
case 3:
if (_G(flags)[V100] < MAX_INT)
_G(flags)[V100]++;
break;
case 4:
if (_G(flags)[V153] < MAX_INT)
_G(flags)[V153]++;
break;
case 5:
if (_G(flags)[V185] < MAX_INT)
_G(flags)[V185]++;
break;
case 6:
if (_G(flags)[V242] < MAX_INT)
_G(flags)[V242]++;
break;
case 8:
if (_G(flags)[kNEURO_TEST_COUNTER] < MAX_INT)
_G(flags)[kNEURO_TEST_COUNTER]++;
break;
default:
break;
}
if (_G(executing) != WHOLE_GAME) {
_G(flags).reset2();
_G(game).setRoom(604);
} else {
if (_G(flags)[kFifthTestPassed]) {
testDone5();
kernel_trigger_dispatch_now(10033);
} else if (_G(flags)[kFourthTestPassed] && !_G(flags)[V153]) {
testDone4();
_G(game).setRoom(207);
} else if (_G(flags)[kThirdTestPassed] && !_G(flags)[V185]) {
testDone3();
_G(game).setRoom(207);
} else if (_G(flags)[kSecondTestPassed] && !_G(flags)[V100]) {
testDone2();
_G(game).setRoom(207);
} else if (_G(flags)[kFirstTestPassed] && !_G(flags)[V242]) {
testDone1();
_G(game).setRoom(204);
} else {
static_cast<Inventory *>(_G(inventory))->reset();
_G(flags).reset5();
_G(flags).reset4();
_G(flags).reset3();
_G(flags).reset2();
_G(flags).reset1();
_G(game).setRoom(101);
}
}
_G(kernel).trigger_mode = oldMode;
}
void BurgerEngine::showSaveScreen() {
if (_useOriginalSaveLoad) {
GUI::CreateF2SaveMenu(_G(master_palette));
} else {
M4Engine::showSaveScreen();
}
}
void BurgerEngine::showLoadScreen(LoadDialogSource source) {
if (_useOriginalSaveLoad) {
switch (source) {
case kLoadFromMainMenu:
GUI::CreateLoadMenuFromMain(_G(master_palette));
break;
case kLoadFromGameDialog:
GUI::CreateLoadMenu(_G(master_palette));
break;
case kLoadFromHotkey:
GUI::CreateF3LoadMenu(_G(master_palette));
break;
}
} else {
M4Engine::showLoadScreen(source);
}
}
bool BurgerEngine::canLoadGameStateCurrently(Common::U32String *msg) {
if (g_vars && _G(game).room_id == 903)
// Allow loading games from the main menu
return true;
else
return M4Engine::canLoadGameStateCurrently(msg);
}
} // namespace Burger
} // namespace M4

100
engines/m4/burger/burger.h Normal file
View File

@@ -0,0 +1,100 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_BURGER_H
#define M4_BURGER_BURGER_H
#include "m4/m4.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/rooms/section2/section2.h"
#include "m4/burger/rooms/section3/section3.h"
#include "m4/burger/rooms/section4/section4.h"
#include "m4/burger/rooms/section5/section5.h"
#include "m4/burger/rooms/section6/section6.h"
#include "m4/burger/rooms/section7/section7.h"
#include "m4/burger/rooms/section8/section8.h"
#include "m4/burger/rooms/section9/section9.h"
namespace M4 {
namespace Burger {
class BurgerEngine : public M4Engine {
private:
Rooms::Section1 _section1;
Rooms::Section2 _section2;
Rooms::Section3 _section3;
Rooms::Section4 _section4;
Rooms::Section5 _section5;
Rooms::Section6 _section6;
Rooms::Section7 _section7;
Rooms::Section8 _section8;
Rooms::Section9 _section9;
/**
* Tests for a bunch of words of interest during parsing
*/
bool saidofInterest() const;
void testDone();
void testDone1();
void testDone2();
void testDone3();
void testDone4();
void testDone5();
void wilburTeleported();
protected:
/**
* Creates the structure that holds all the global variables
*/
M4::Vars *createVars() override;
/**
* Sets up the debugging console
*/
void setupConsole() override;
public:
BurgerEngine(OSystem *syst, const M4GameDescription *gameDesc);
~BurgerEngine() override;
/**
* Show the engine information
*/
void showEngineInfo() override;
void syncFlags(Common::Serializer &s) override;
void showSaveScreen() override;
void showLoadScreen(LoadDialogSource source) override;
bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
void global_daemon() override;
void global_pre_parser() override;
void global_parser() override;
void handleTestDone();
};
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,75 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/console.h"
#include "m4/burger/vars.h"
#include "m4/burger/burger.h"
namespace M4 {
namespace Burger {
Console::Console() : M4::Console() {
registerCmd("global", WRAP_METHOD(Console, cmdGlobal));
registerCmd("test", WRAP_METHOD(Console, cmdTest));
registerCmd("time", WRAP_METHOD(Console, cmdTime));
}
bool Console::cmdGlobal(int argc, const char **argv) {
if (argc == 2) {
int flagNum = atol(argv[1]);
debugPrintf("Flag %d = %d\n", flagNum, _G(flags)[(Flag)flagNum]);
} else if (argc == 3) {
int flagNum = atol(argv[1]);
int flagVal = atol(argv[2]);
_G(flags)[(Flag)flagNum] = flagVal;
debugPrintf("Flag set\n");
} else {
debugPrintf("global <num> [<value>]\n");
}
return true;
}
bool Console::cmdTest(int argc, const char **argv) {
int tests = _G(flags)[kFirstTestPassed] ? 1 : 0 +
_G(flags)[kSecondTestPassed] ? 1 : 0 +
_G(flags)[kThirdTestPassed] ? 1 : 0 +
_G(flags)[kFourthTestPassed] ? 1 : 0 +
_G(flags)[kFifthTestPassed] ? 1 : 0;
debugPrintf("Tests passed = %d\n", tests);
return true;
}
bool Console::cmdTime(int argc, const char **argv) {
if (argc == 2) {
int newTime = atol(argv[1]);
_G(flags).set_boonsville_time(newTime - 1);
return false;
} else {
debugPrintf("Current time is %d\n", _G(flags)[kBoonsvilleTime]);
return true;
}
}
} // End of namespace Burger
} // End of namespace M4

View File

@@ -0,0 +1,46 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_CONSOLE_H
#define M4_BURGER_CONSOLE_H
#include "m4/console.h"
namespace M4 {
namespace Burger {
class Console : public M4::Console {
private:
bool cmdTest(int argc, const char **argv);
bool cmdGlobal(int argc, const char **argv);
bool cmdTime(int argc, const char **argv);
public:
Console();
~Console() override {
}
};
} // End of namespace Burger
} // End of namespace M4
#endif

View File

@@ -0,0 +1,41 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/adv_r/conv_io.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
void conv_play_curr() {
_G(flags)[kDisableFootsteps] = 1;
_G(flags)[V299] = 1;
conv_play(conv_get_handle());
}
void conv_resume_curr() {
_G(flags)[kDisableFootsteps] = 1;
_G(flags)[V299] = 1;
conv_resume(conv_get_handle());
}
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,37 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_CORE_CONV_H
#define M4_BURGER_CORE_CONV_H
#include "m4/m4_types.h"
namespace M4 {
namespace Burger {
void conv_play_curr();
void conv_resume_curr();
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,218 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/core/play_break.h"
#include "m4/platform/sound/digi.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
static void set_next_series_play_break(int32 slot) {
seriesPlayer *player = &_G(seriesPlayers)[slot];
player->current_break = player->break_list[player->index]; // Grab the info from the list
player->digi_trigger = false; // Assume for now gSERIES_PLAY_BREAK trigger will come from series_ play not digi_play
while (player->current_break.firstFrame >= 0) {
// If there is a positive frame to play from (or to in the case of SERIES_BACKWARDS)
// if variable is null or variable = value then this break is valid
if ((!player->current_break.variable) || (*(player->current_break.variable) == player->current_break.value)) {
// Are the first and last frame numbers backwards?
if ((player->current_break.lastFrame != -1) && (player->current_break.firstFrame > player->current_break.lastFrame)) {
player->current_break.flags = player->current_break.flags | SERIES_BACKWARD; // make sure SERIES_BACKWARD is in flags
const int32 temp = player->current_break.firstFrame; // switch the first and last frame numbers
player->current_break.firstFrame = player->current_break.lastFrame;
player->current_break.lastFrame = temp;
}
if (player->current_break.flags & DIGI_STOP) {
// Should we do a digi_stop?
digi_stop(player->current_break.channel);
}
// Is there is a sound to play?
if (player->current_break.sound) {
// Should it be looped?
if (player->current_break.flags & DIGI_LOOP) {
digi_play_loop(player->current_break.sound, player->current_break.channel, player->current_break.volume, player->current_break.trigger);
} else {
// There is a sound to play and it is not looping (finite)
if (_G(seriesPlayers)[slot].current_break.loopCount == -1) { // Check if series is to loop as long as sound plays (loopCount = -1)
_G(seriesPlayers)[slot].digi_trigger = true; // Remember that the gSERIES_PLAY_BREAK will be a sound trigger
digi_play(player->current_break.sound, player->current_break.channel, player->current_break.volume, kSERIES_PLAY_BREAK_0 + slot);
} else {
// Use the play break trigger
digi_play(player->current_break.sound, player->current_break.channel, player->current_break.volume, player->current_break.trigger);
}
}
} else {
// No sound to play so see if there is a trigger to dispatch
if (player->current_break.trigger != NO_TRIGGER) {
kernel_trigger_dispatchx(kernel_trigger_create(player->current_break.trigger));
}
}
// Play the series
if (player->digi_trigger) {
// Don't ask for the gSERIES_PLAY_BREAK trigger
player->series_machine = series_play(player->name, player->depth, player->current_break.flags, NO_TRIGGER,
player->framerate, player->current_break.loopCount,
player->scale, player->x, player->y,
player->current_break.firstFrame, player->current_break.lastFrame);
} else { // ask for the gSERIES_PLAY_BREAK trigger
player->series_machine = series_play(player->name, player->depth, player->current_break.flags, (int16)slot + kSERIES_PLAY_BREAK_0,
player->framerate, player->current_break.loopCount,
player->scale, player->x, player->y,
player->current_break.firstFrame, player->current_break.lastFrame);
}
// play the shadow series if necessary
if (player->with_shadow) {
player->shadow_machine = series_play(player->shadow_name, player->depth + 1, player->current_break.flags, NO_TRIGGER,
player->framerate, player->current_break.loopCount,
player->scale, player->x, player->y,
player->current_break.firstFrame, player->current_break.lastFrame);
}
++player->index; // set up index to the next break in list
break; // we have handled a break so don't look any farther
} else { // variable didn't equate to value so keep looking
++player->index; // go to the next break in list
player->current_break = player->break_list[player->index]; // grab the info from the list
}
}
if (player->current_break.firstFrame < 0) {
// There were no more breaks, so unload series/sounds and send off trigger
player->in_use = false;
series_unload(player->series);
if (player->with_shadow)
series_unload(player->shadow_series);
if (player->preload_sounds)
digi_unload_play_breaks(player->break_list);
kernel_trigger_dispatchx(player->trigger);
}
}
void handle_series_play_break(int32 slot) {
seriesPlayer *player = &_G(seriesPlayers)[slot];
if (player->digi_trigger) { // if this was caused by a digi_trigger
kernel_terminate_machine(player->series_machine);
if (player->with_shadow) {
kernel_terminate_machine(player->shadow_machine);
}
}
set_next_series_play_break(slot);
}
int32 series_play_with_breaks(const seriesPlayBreak list[], const char *name, frac16 depth, int32 trigger, uint32 flags,
int32 framerate, int32 scale, int32 x, int32 y) {
int32 slot;
// look for a free player slot (MAX_SERIES_PLAYERS)
for (slot = 0; slot < MAX_SERIES_PLAYERS; ++slot) {
if (!(_G(seriesPlayers)[slot].in_use))
break;
}
if (slot >= MAX_SERIES_PLAYERS) {
// No free slots
term_message("**** all seriesPlayers are in use!");
return -1;
}
seriesPlayer *player = &_G(seriesPlayers)[slot];
player->in_use = true;
player->index = 0;
player->break_list = list;
player->name = name;
player->depth = depth;
player->trigger = kernel_trigger_create(trigger);
player->framerate = framerate;
player->scale = scale;
player->x = x;
player->y = y;
player->with_shadow = (bool)(flags & WITH_SHADOW);
player->preload_sounds = (bool)(flags & PRELOAD_SOUNDS);
player->series = series_load(name, -1, nullptr); // load sprite series
// Check if shadow sprites should be loaded
if (player->with_shadow) {
// Make shadow name by adding an "s" to the series name
Common::strcpy_s(player->shadow_name, name);
Common::strcat_s(player->shadow_name, "s\0");
player->shadow_series = series_load(player->shadow_name, -1, nullptr);
} else {
player->shadow_name[0] = '\0';
}
if (player->preload_sounds) { // check if sounds are to be preloaded
digi_preload_play_breaks(list);
}
set_next_series_play_break(slot);
term_message("series_play_with_breaks:%s shadow:%s preload_sounds:%d slot:%d",
player->name, player->shadow_name, player->preload_sounds, slot);
return slot;
}
void digi_preload_play_breaks(const seriesPlayBreak list[], bool loadAll) {
int32 i = 0;
// While there is a legitimate frame to break on
while (list[i].firstFrame >= 0) {
// If variable is null or variable = value then this break is used
if ((!list[i].variable) || (*(list[i].variable) == list[i].value) || loadAll) {
// If there is a sound to load for this break
if (list[i].sound) {
if (!digi_preload(list[i].sound)) {
term_message("**** Couldn't load: %s.RAW", list[i].sound);
}
}
}
++i; // Next in list please
}
}
void digi_unload_play_breaks(const seriesPlayBreak list[]) {
int32 i = 0;
while (list[i].firstFrame >= 0) {
// If there is a sound to unload
if (list[i].sound) {
digi_unload(list[i].sound); // Unload it
}
++i; // Next in list please
}
}
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,62 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_PLAY_BREAK_H
#define M4_BURGER_PLAY_BREAK_H
#include "m4/m4_types.h"
#include "m4/adv_r/adv_trigger.h"
namespace M4 {
namespace Burger {
struct seriesPlayBreak {
int32 firstFrame;
int32 lastFrame;
const char *sound;
int32 channel;
int32 volume;
int32 trigger;
uint32 flags;
int32 loopCount;
int32 *variable;
int32 value;
};
enum {
WITH_SHADOW = 1,
PRELOAD_SOUNDS = 2
};
#define PLAY_BREAK_END { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 }
int32 series_play_with_breaks(const seriesPlayBreak list[], const char *name,
frac16 depth = 0, int32 trigger = NO_TRIGGER, uint32 flags = 0, int32 framerate = 6,
int32 scale = 100, int32 x = 0, int32 y = 0);
void digi_preload_play_breaks(const seriesPlayBreak list[], bool loadAll = false);
void digi_unload_play_breaks(const seriesPlayBreak list[]);
void handle_series_play_break(int32 slot);
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,65 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/core/release_trigger.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
#define _GT(X) _G(releaseTrigger)._##X
void release_trigger_on_digi_state(int32 trigger, int32 checkChannels, int32 matchValue) {
_GT(released_digi_trigger) = kernel_trigger_create(trigger);
_GT(check_channels) = checkChannels;
_GT(match_value) = matchValue;
const KernelTriggerType oldMode = _G(kernel).trigger_mode;
_G(kernel).trigger_mode = KT_DAEMON;
kernel_trigger_dispatch_now(kRELEASE_TRIGGER_DIGI_CHECK);
_G(kernel).trigger_mode = oldMode;
}
void release_trigger_digi_check() {
uint32 digi_state = 0;
// Set channel bits in digi_state that a sound is presently busy in each channel
for (uint32 i = 0; i < 3; ++i) {
if (digi_play_state(i + 1)) // Check if a sound is playing
digi_state |= (1 << i); // Set the bit that corresponds with this channel
}
term_message("%d %d %d", digi_state, _GT(check_channels), _GT(match_value));
// AND this with the channels we care about
digi_state &= _GT(check_channels);
term_message(" %d %d %d", digi_state, _GT(check_channels), _GT(match_value));
// Compare this with the match values
if (digi_state == _GT(match_value)) {
kernel_trigger_dispatchx(_GT(released_digi_trigger));
} else {
kernel_timing_trigger(TENTH_SECOND, kRELEASE_TRIGGER_DIGI_CHECK);
}
}
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,42 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_CORE_RELEASE_TRIGGER_H
#define M4_BURGER_CORE_RELEASE_TRIGGER_H
#include "m4/m4_types.h"
namespace M4 {
namespace Burger {
struct ReleaseTrigger_Globals {
uint32 _released_digi_trigger = 0;
uint32 _check_channels = 0, _match_value = 0;
};
void release_trigger_on_digi_state(int32 trigger, int32 checkChannels, int32 matchValue = 0);
void release_trigger_digi_check();
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,144 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/core/stream_break.h"
#include "m4/platform/sound/digi.h"
#include "m4/graphics/gr_series.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
#define _GB(X) _G(streamBreak)._##X
static void set_next_series_stream_break() {
_GB(my_stream_break) = &_GB(my_stream_break_list)[_GB(my_stream_break_index)];
// While there is a positive frame to break on...
while (_GB(my_stream_break)->frame >= 0) {
// If variable is null or variable = value then this break is used
// Note: if Variable != value this break is skipped
if ((!_GB(my_stream_break)->variable) || (*(_GB(my_stream_break)->variable) == _GB(my_stream_break)->value)) {
series_stream_break_on_frame(_GB(my_stream_viewer), _GB(my_stream_break)->frame, kSERIES_STREAM_BREAK);
break;
}
// Go to the next break in list
++_GB(my_stream_break_index);
_GB(my_stream_break) = &_GB(my_stream_break_list)[_GB(my_stream_break_index)];
}
}
void handle_series_stream_break() {
int32 thisFrame = _GB(my_stream_break)->frame;
auto &streamBreak = _GB(my_stream_break);
// Handle all breaks for this frame number (only one series break can occur on each frame)
// There can be any number of things to do once we've broken on a particular frame.
while (thisFrame == streamBreak->frame) {
// If there is a variable check if equal value
if ((!streamBreak->variable) || (*(streamBreak->variable) == streamBreak->value)) {
// Should we do a digi_stop?
if (streamBreak->flags & DIGI_STOP) {
digi_stop(streamBreak->channel);
}
// Is there is a sound to play?
if (streamBreak->sound) {
// Should it be looped?
if (streamBreak->flags & DIGI_LOOP) {
digi_play_loop(streamBreak->sound, streamBreak->channel, streamBreak->volume, streamBreak->trigger);
} else {
digi_play(streamBreak->sound, streamBreak->channel, streamBreak->volume, streamBreak->trigger);
}
} else {
// No sound to play
// See if it's a volume channel
if (streamBreak->channel)
digi_change_volume(streamBreak->channel, streamBreak->volume);
// Is there is a trigger to dispatch
if (streamBreak->trigger != NO_TRIGGER) {
kernel_trigger_dispatchx(kernel_trigger_create(streamBreak->trigger));
}
}
}
// Go to next break in list
++_GB(my_stream_break_index);
streamBreak = &_GB(my_stream_break_list)[_GB(my_stream_break_index)];
}
// If we aren't at end of list yet, set up next stream break
if (streamBreak->frame >= 0)
set_next_series_stream_break();
}
machine *series_stream_with_breaks(const seriesStreamBreak list[], const char *name, int32 framerate, frac16 depth, int32 trigger) {
_GB(my_stream_break_index) = 0;
_GB(my_stream_break_list) = list;
_GB(my_stream_viewer) = series_stream(name, framerate, depth, trigger);
set_next_series_stream_break();
return _GB(my_stream_viewer);
}
void digi_preload_stream_breaks(const seriesStreamBreak list[]) {
int32 i = 0;
// While there is a legitimate frame to break on
while (list[i].frame >= 0) {
// If variable is null or variable = value then this break is used
if ((!list[i].variable) || (*(list[i].variable) == list[i].value)) {
// Is there is a sound to load for this break
if (list[i].sound) {
digi_read_another_chunk();
// Load the sound
if (!digi_preload(list[i].sound)) {
term_message("Preload stream breaks failed: %s", list[i].sound);
}
}
}
++i; // Next in list please
}
}
void digi_unload_stream_breaks(const seriesStreamBreak list[]) {
int32 i = 0;
while (list[i].frame >= 0) {
// Unload any sounds
if (list[i].sound)
digi_unload(list[i].sound);
++i;
}
}
void palette_prep_for_stream() {
gr_pal_clear(&_G(master_palette)[0]); // Clear out colours in palette
pal_fade_set_start(&_G(master_palette)[0], 0); // Set fade to zero percent instantly (0 ticks)
}
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,69 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_STREAM_BREAK_H
#define M4_BURGER_STREAM_BREAK_H
#include "m4/m4_types.h"
#include "m4/wscript/ws_machine.h"
namespace M4 {
namespace Burger {
struct seriesStreamBreak {
int32 frame;
const char *sound;
int32 channel;
int32 volume;
int32 trigger;
uint32 flags;
const int32 *variable;
int32 value;
};
#define STREAM_BREAK_END { -1, nullptr, 0, 0, NO_TRIGGER, 0, nullptr, 0 }
// Flags for series_stream_with_breaks and series_play_with_breaks
#define DIGI_LOOP 1024 // these must be more than the series play flags
#define DIGI_STOP 2048
struct StreamBreak_Globals {
int32 _my_stream_break_index = 0; // Holds which line of the list currently waiting for a stream break
const seriesStreamBreak *_my_stream_break_list = nullptr; // Holds the list of breaks for digi plays
const seriesStreamBreak *_my_stream_break = nullptr;
machine *_my_stream_viewer = nullptr;
};
machine *series_stream_with_breaks(const seriesStreamBreak list[], const char *name, int32 framerate, frac16 depth, int32 trigger);
void digi_preload_stream_breaks(const seriesStreamBreak list[]);
void digi_unload_stream_breaks(const seriesStreamBreak list[]);
void handle_series_stream_break();
/**
* Palette_prep_for_stream is called just before series_stream() for a full screen animation.
* It clears the palette, (debug: sets ui colors) and sets up a palette fade up from 0%
*/
void palette_prep_for_stream();
} // namespace Burger
} // namespace M4
#endif

412
engines/m4/burger/flags.cpp Normal file
View File

@@ -0,0 +1,412 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/flags.h"
#include "m4/core/term.h"
#include "m4/adv_r/adv.h"
#include "m4/adv_r/adv_inv.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
struct BoonsvilleEvent {
int32 _time;
int32 _trigger;
const char *_text;
};
static const BoonsvilleEvent EVENTS[] = {
{ 600, -1, "After getting neuro stuff" },
{ 2400, -1, "After getting survival stuff" },
{ 6000, kBurlEntersTown, "Burl enters town" },
{ 6600, -1, "After getting sensory stuff" },
{ 9600, kBurlGetsFed, "Burl gets fed" },
{ 19200, -1, "After getting language stuff" },
{ 13200, kBurlStopsEating, "Burl stops eating" },
{ 22800, -1, "After getting logic stuff" },
{ 15000, kBurlLeavesTown, "Burl leaves town" },
{ 18600, kBandEntersTown, "Band enters town" },
{ 33600, kAbduction, "Abduction time" },
{ 55200, kTestTimeout, "Nero timeout" },
{ 166800, kTestTimeout, "Survival timeout" },
{ 278400, kTestTimeout, "Sensory timeout" },
{ 390000, kTestTimeout, "Language timeout" },
{ 501600, kTestTimeout, "Logic timeout" },
{ 505200, 10033, "Conclusion" },
{ 0, 0, nullptr }
};
int32 Flags::_flags[FLAGS_COUNT];
Flags::Flags() {
Common::fill(_flags, _flags + FLAGS_COUNT, 0);
}
void Flags::sync(Common::Serializer &s) {
size_t count = size();
for (uint i = 0; i < count; ++i)
s.syncAsSint32LE(_flags[i]);
}
void Flags::reset() {
Common::fill(_flags, _flags + FLAGS_COUNT, 0);
}
int32 Flags::get_boonsville_time_and_display(bool showTime) {
if (showTime) {
int time = (*this)[kBoonsvilleTime];
int seconds = time % 60;
time /= 60;
int minutes = time % 60;
time /= 60;
term_message("Boonsville time: %d:%d:%d", time, minutes, seconds);
}
return (*this)[kBoonsvilleTime];
}
void Flags::set_boonsville_time(int32 time) {
(*this)[kBoonsvilleTime] = time;
(*this)[kBoonsvillePriorTime] = time - 1;
}
bool Flags::advance_boonsville_time_and_check_schedule(int32 time) {
if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
(*this)[kBoonsvillePriorTime] = (*this)[kBoonsvilleTime];
(*this)[kBoonsvilleTime] += time;
return dispatch_scheduled_boonsville_time_trigger(
get_boonsville_time_and_display());
} else {
return false;
}
}
bool Flags::dispatch_scheduled_boonsville_time_trigger(int32 time) {
KernelTriggerType oldMode = _G(kernel).trigger_mode;
_G(kernel).trigger_mode = KT_DAEMON;
bool result = false;
for (const BoonsvilleEvent *rec = EVENTS; rec->_time; ++rec) {
if ((*this)[kBoonsvilleTime] >= rec->_time &&
(*this)[kBoonsvillePriorTime] < rec->_time) {
result = true;
term_message("Time for: %s", rec->_text);
schedule_boonsville_time();
kernel_trigger_dispatch_now(rec->_trigger);
}
}
_G(kernel).trigger_mode = oldMode;
return result;
}
void Flags::schedule_boonsville_time() {
int theTime = get_boonsville_time_and_display();
int hours = theTime / 216000;
int minutes = (theTime % 216000) / 3600;
int seconds = (theTime % 3600) / 60;
bool flag = false;
term_message("************ Schedule ************");
for (const auto &te : EVENTS) {
int teHours = te._time / 216000;
int teMinutes = (te._time % 216000) / 3600;
int teSeconds = (te._time % 3600) / 60;
if (te._time <= theTime) {
term_message("done %1d:%2d:%2d %s", teHours, teMinutes, teSeconds, te._text);
} else {
if (!flag) {
term_message("------> %1d:%2d:%2d Current time", hours, minutes, seconds);
flag = true;
}
term_message("pending %1d:%2d:%2d %s", teHours, teMinutes, teSeconds, te._text);
}
}
term_message("************************************");
}
void Flags::reset1() {
set_boonsville_time(0);
(*this)[V000] = 1000;
if (_G(executing) == WHOLE_GAME)
inv_give_to_player("money");
else
inv_move_object("money", NOWHERE);
(*this)[V001] = 20;
(*this)[V005] = 0;
(*this)[V010] = 0;
(*this)[V011] = 0;
(*this)[V012] = 0;
(*this)[V013] = 0;
(*this)[V014] = 0;
(*this)[V015] = 0;
(*this)[V017] = 0;
(*this)[V018] = 0;
(*this)[V019] = 0;
(*this)[kHarryComingToRoof] = 0;
(*this)[WAKE_UP_STOLIE_COUNT] = 0;
(*this)[V028] = 0;
(*this)[V031] = 0;
(*this)[V032] = 0;
(*this)[V033] = 2;
(*this)[V034] = 0;
inv_move_object("deed", 105);
(*this)[V172] = 10023;
(*this)[V037] = 1;
(*this)[V039] = 0;
(*this)[kRoadOpened] = 0;
(*this)[V046] = 0;
(*this)[kPoliceState] = 0;
(*this)[kPoliceCheckCtr] = 0;
(*this)[V049] = 0;
inv_move_object("jawz o' life", 137);
inv_move_object("keys", 138);
(*this)[kPerkinsLostIsland] = 0;
(*this)[kTourBusAtDiner] = 0;
(*this)[kIceBoxOpened] = 0;
(*this)[V245] = 10027;
inv_move_object("pantyhose", 142);
inv_move_object("block of ice", 142);
inv_move_object("broken mouse trap", 143);
inv_move_object("spring", NOWHERE);
inv_move_object("amplifier", 145);
(*this)[V079] = 1;
inv_move_object("phone bill", 170);
inv_move_object("whistle", 170);
(*this)[V083] = 0;
(*this)[V084] = 0;
(*this)[V085] = 0;
(*this)[V086] = 0;
(*this)[V087] = 0;
(*this)[V088] = 0;
(*this)[V092] = 0;
(*this)[V091] = 0;
inv_move_object("carrot juice", 172);
inv_move_object("laxative", 174);
inv_move_object("broken puz dispenser", 176);
inv_move_object("puz dispenser", NOWHERE);
conv_reset_all();
}
void Flags::reset2() {
if ((*this)[V245] != 10027)
inv_give_to_player("BLOCK OF ICE");
if ((*this)[V277] == 6003)
inv_give_to_player("PANTYHOSE");
(*this)[kHampsterState] = 6000;
(*this)[V244] = 6000;
(*this)[V245] = 10027;
(*this)[V246] = 0;
(*this)[V255] = 0;
(*this)[kGerbilCageDoor] = 0;
(*this)[V257] = 0;
(*this)[V258] = 0;
(*this)[V263] = 0;
(*this)[V265] = 0;
(*this)[V266] = 0;
(*this)[V269] = 1;
(*this)[V270] = 6000;
(*this)[V273] = 0;
(*this)[V274] = 0;
(*this)[V277] = 6000;
(*this)[V278] = 0;
if (_G(executing) != WHOLE_GAME) {
inv_move_object("RAY GUN", NOWHERE);
inv_give_to_player("BLOCK OF ICE");
inv_give_to_player("PANTYHOSE");
}
}
void Flags::reset3() {
if (inv_player_has("BOTTLE")) {
inv_give_to_player("CARROT JUICE");
inv_move_object("BOTTLE", NOWHERE);
}
(*this)[V107] = 0;
(*this)[kTrufflesInMine] = 0;
inv_move_object("BURGER MORSEL", NOWHERE);
(*this)[V117] = 0;
(*this)[kDrunkCarrotJuice] = 0;
(*this)[V118] = 3001;
(*this)[V119] = 0;
(*this)[V120] = 0;
(*this)[V121] = 3001;
(*this)[V122] = 0;
(*this)[kDrunkCarrotJuice] = 0;
inv_move_object("JUG", 303);
inv_move_object("DISTILLED CARROT JUICE", NOWHERE);
(*this)[V130] = 0;
inv_move_object("MATCHES", 304);
(*this)[V134] = 0;
(*this)[V140] = 0;
(*this)[kTrufflesRanAway] = 0;
(*this)[V145] = 0;
}
void Flags::reset4() {
(*this)[V186] = 0;
(*this)[V234] = 0;
(*this)[V196] = 0;
(*this)[V197] = 0;
(*this)[kFireplaceHasFire] = 0;
(*this)[V199] = 0;
(*this)[kStairsBorkState] = 5000;
inv_move_object("KINDLING", 502);
inv_move_object("BURNING KINDLING", 502);
inv_move_object("GIZMO", 502);
(*this)[kBORK_STATE] = 0;
(*this)[V204] = 5000;
(*this)[V205] = 0;
(*this)[V207] = 0;
inv_move_object("ROLLING PIN", 503);
inv_move_object("RUBBER GLOVES", 503);
(*this)[V210] = 5000;
(*this)[V211] = 5000;
(*this)[V212] = 5001;
(*this)[V213] = 2;
(*this)[V214] = 0;
inv_move_object("DIRTY SOCK", 504);
(*this)[V218] = 5000;
(*this)[kTVOnFire] = 0;
(*this)[V223] = 0;
(*this)[V224] = 0;
inv_move_object("RUBBER DUCKY", 507);
if (inv_player_has("SOAPY WATER")) {
inv_move_object("SOAPY WATER", 507);
inv_give_to_player("BOTTLE");
}
(*this)[V227] = 0;
(*this)[V228] = 0;
(*this)[V229] = 1;
inv_move_object("CHRISTMAS LIGHTS", 508);
inv_move_object("CHRISTMAS LIGHTS ", 508);
(*this)[V237] = 0;
}
void Flags::reset5() {
if ((*this)[V159])
inv_give_to_player("DEED");
(*this)[V157] = 0;
(*this)[V158] = 0;
(*this)[V159] = 0;
(*this)[V162] = 0;
inv_move_object("FISH", 402);
inv_move_object("QUARTER", 404);
(*this)[V175] = 0;
(*this)[V171] = 4000;
(*this)[V172] = 10023;
(*this)[V173] = 0;
(*this)[V174] = 4000;
(*this)[V176] = 0;
inv_move_object("COLLAR", 406);
inv_move_object("HOOK", 406);
(*this)[V166] = 0;
(*this)[V168] = 0;
(*this)[V167] = 0;
inv_move_object("RECORDS", 405);
(*this)[V180] = 0;
(*this)[V181] = 0;
}
void Flags::conv_reset_all() {
_GC(convSave).clear();
}
const char *Flags::getConvName() {
const char *conv = nullptr;
if (_G(flags)[kFirstTestPassed] && !_G(flags)[V242])
conv = "conv51";
if (_G(flags)[V242] == 5 && _G(flags)[kSecondTestPassed] == 0 && !player_been_here(612)) {
if (_G(flags)[V248])
conv = "conv52";
else
--_G(flags)[V242];
}
if (_G(flags)[kSecondTestPassed] && !_G(flags)[V100])
conv = "conv53";
if (_G(flags)[V100] == 5 && !_G(flags)[kThirdTestPassed] && !player_been_here(310) &&
!player_been_here(311) && !player_been_here(312) && !player_been_here(313) &&
!player_been_here(314) && !player_been_here(315) && !player_been_here(316) &&
!player_been_here(317) && !player_been_here(318) && !player_been_here(319))
conv = "conv54";
if (_G(flags)[kThirdTestPassed] && !_G(flags)[V185])
conv = "conv55";
if (_G(flags)[V185] == 5 && !_G(flags)[kFourthTestPassed])
conv = "conv56";
if (_G(flags)[kFourthTestPassed] && !_G(flags)[V153])
conv = "conv57";
if (_G(flags)[V153] == 5)
conv = "conv58";
return conv;
}
} // namespace Burger
} // namespace M4

598
engines/m4/burger/flags.h Normal file
View File

@@ -0,0 +1,598 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_FLAGS_H
#define M4_BURGER_FLAGS_H
#include "common/array.h"
#include "common/serializer.h"
#include "m4/m4_types.h"
namespace M4 {
namespace Burger {
#define FLAGS_COUNT 512
enum Flag {
V000 = 0,
V001 = 1,
V002 = 2,
V003 = 3,
V004 = 4,
V005 = 5,
V006 = 6,
V007 = 7,
V008 = 8,
V009 = 9,
V010 = 10,
V011 = 11,
V012 = 12,
V013 = 13,
V014 = 14,
V015 = 15,
V016 = 16,
V017 = 17,
V018 = 18,
V019 = 19,
V020 = 20,
V021 = 21,
V022 = 22,
kHarryComingToRoof = 23,
V024 = 24,
V025 = 25,
V026 = 26,
WAKE_UP_STOLIE_COUNT = 27,
V028 = 28,
V029 = 29,
V030 = 30,
V031 = 31,
V032 = 32,
V033 = 33,
V034 = 34,
V035 = 35,
V036 = 36,
V037 = 37,
V038 = 38,
V039 = 39,
V040 = 40,
V041 = 41,
V042 = 42,
kRoadOpened = 43,
V044 = 44,
V045 = 45,
V046 = 46,
kPoliceState = 47,
kPoliceCheckCtr = 48,
V049 = 49,
V050 = 50,
V051 = 51,
V052 = 52,
V053 = 53,
V054 = 54,
V055 = 55,
V056 = 56,
V057 = 57,
kTourBusAtDiner = 58,
kIceBoxOpened = 59,
V060 = 60,
V061 = 61,
V062 = 62,
V063 = 63,
V064 = 64,
V065 = 65,
V066 = 66,
kDrumzFled = 67,
V068 = 68,
V069 = 69,
V070 = 70,
V071 = 71,
V072 = 72,
V073 = 73,
V074 = 74,
V075 = 75,
V076 = 76,
V077 = 77,
V078 = 78,
V079 = 79,
V080 = 80,
V081 = 81,
V082 = 82,
V083 = 83,
V084 = 84,
V085 = 85,
V086 = 86,
V087 = 87,
V088 = 88,
V089 = 89,
V090 = 90,
V091 = 91,
V092 = 92,
V093 = 93,
V094 = 94,
V095 = 95,
V096 = 96,
V097 = 97,
V098 = 98,
kThirdTestPassed = 99,
V100 = 100,
V101 = 101,
kGetRidOfPerkins = 102,
kNeedToFindBurger = 103,
kAmplifyMySenses = 104,
V105 = 105,
V106 = 106,
V107 = 107,
V108 = 108,
V109 = 109,
V110 = 110,
kTrufflesInMine = 111,
kPerkinsLostIsland = 112,
V113 = 113,
V114 = 114,
V115 = 115,
V116 = 116,
V117 = 117,
V118 = 118,
V119 = 119,
V120 = 120,
V121 = 121,
V122 = 122,
V123 = 123,
kDrunkCarrotJuice = 124,
V125 = 125,
V126 = 126,
V127 = 127,
V128 = 128,
V129 = 129,
V130 = 130,
V131 = 131,
V132 = 132,
V133 = 133,
V134 = 134,
V135 = 135,
V136 = 136,
kEnteredMine = 137,
V138 = 138,
V139 = 139,
V140 = 140,
V141 = 141,
V142 = 142,
V143 = 143,
kTrufflesRanAway = 144,
V145 = 145,
V146 = 146,
V147 = 147,
V148 = 148,
kMineRoomIndex = 149,
V150 = 150,
V151 = 151,
kFifthTestPassed = 152,
V153 = 153,
V154 = 154,
V155 = 155,
V156 = 156,
V157 = 157,
V158 = 158,
V159 = 159,
V160 = 160,
V161 = 161,
V162 = 162,
V163 = 163,
V164 = 164,
V165 = 165,
V166 = 166,
V167 = 167,
V168 = 168,
V169 = 169,
V170 = 170,
V171 = 171,
V172 = 172,
V173 = 173,
V174 = 174,
V175 = 175,
V176 = 176,
V177 = 177,
V178 = 178,
V179 = 179,
V180 = 180,
V181 = 181,
V182 = 182,
V183 = 183,
kFourthTestPassed = 184,
V185 = 185,
V186 = 186,
V187 = 187,
V188 = 188,
V189 = 189,
ROOM101_FLAG19 = 190,
V191 = 191,
V192 = 192,
V193 = 193,
V194 = 194,
V195 = 195,
V196 = 196,
V197 = 197,
kFireplaceHasFire = 198,
V199 = 199,
kStairsBorkState = 200,
V201 = 201,
V202 = 202,
kBORK_STATE = 203,
V204 = 204,
V205 = 205,
V206 = 206,
V207 = 207,
V208 = 208,
V209 = 209,
V210 = 210,
V211 = 211,
V212 = 212,
V213 = 213,
V214 = 214,
V215 = 215,
V216 = 216,
V217 = 217,
V218 = 218,
kTVOnFire = 219,
V220 = 220,
V221 = 221,
V222 = 222,
V223 = 223,
V224 = 224,
V225 = 225,
V226 = 226,
V227 = 227,
V228 = 228,
V229 = 229,
V230 = 230,
V231 = 231,
V232 = 232,
V233 = 233,
V234 = 234,
V235 = 235,
V236 = 236,
V237 = 237,
V238 = 238,
V239 = 239,
V240 = 240,
kSecondTestPassed = 241,
V242 = 242,
kHampsterState = 243,
V244 = 244,
V245 = 245,
V246 = 246,
V247 = 247,
V248 = 248,
V249 = 249,
V250 = 250,
V251 = 251,
V252 = 252,
V253 = 253,
V254 = 254,
V255 = 255,
kGerbilCageDoor = 256,
V257 = 257,
V258 = 258,
V259 = 259,
V260 = 260,
V261 = 261,
V262 = 262,
V263 = 263,
kStandingOnKibble = 264,
V265 = 265,
V266 = 266,
V267 = 267,
V268 = 268,
V269 = 269,
V270 = 270,
V271 = 271,
V272 = 272,
V273 = 273,
V274 = 274,
V275 = 275,
V276 = 276,
V277 = 277,
V278 = 278,
V279 = 279,
V280 = 280,
V281 = 281,
V282 = 282,
V283 = 283,
V284 = 284,
V285 = 285,
V286 = 286,
kFirstTestPassed = 287,
kNEURO_TEST_COUNTER = 288,
kGerbilsAreNasty = 289,
kKnowHowToNukeGerbils = 290,
V291 = 291,
V292 = 292,
digestability = 293,
V294 = 294,
V295 = 295,
V296 = 296,
V297 = 297,
kDisableFootsteps = 298,
V299 = 299,
V300 = 300,
V301 = 301,
V302 = 302,
V303 = 303,
V304 = 304,
V305 = 305,
V306 = 306,
V307 = 307,
kBoonsvilleTime = 308,
kBoonsvillePriorTime = 309,
V310 = 310,
V311 = 311,
V312 = 312,
V313 = 313,
V314 = 314,
V315 = 315,
V316 = 316,
V317 = 317,
V318 = 318,
V319 = 319,
V320 = 320,
V321 = 321,
V322 = 322,
V323 = 323,
V324 = 324,
V325 = 325,
V326 = 326,
V327 = 327,
V328 = 328,
V329 = 329,
V330 = 330,
V331 = 331,
V332 = 332,
V333 = 333,
V334 = 334,
V335 = 335,
V336 = 336,
V337 = 337,
V338 = 338,
V339 = 339,
V340 = 340,
V341 = 341,
V342 = 342,
V343 = 343,
V344 = 344,
V345 = 345,
V346 = 346,
V347 = 347,
V348 = 348,
V349 = 349,
V350 = 350,
V351 = 351,
V352 = 352,
V353 = 353,
V354 = 354,
V355 = 355,
V356 = 356,
V357 = 357,
V358 = 358,
V359 = 359,
V360 = 360,
V361 = 361,
V362 = 362,
V363 = 363,
V364 = 364,
V365 = 365,
V366 = 366,
V367 = 367,
V368 = 368,
V369 = 369,
V370 = 370,
V371 = 371,
V372 = 372,
V373 = 373,
V374 = 374,
V375 = 375,
V376 = 376,
V377 = 377,
V378 = 378,
V379 = 379,
V380 = 380,
V381 = 381,
V382 = 382,
V383 = 383,
V384 = 384,
V385 = 385,
V386 = 386,
V387 = 387,
V388 = 388,
V389 = 389,
V390 = 390,
V391 = 391,
V392 = 392,
V393 = 393,
V394 = 394,
V395 = 395,
V396 = 396,
V397 = 397,
V398 = 398,
V399 = 399,
V400 = 400,
V401 = 401,
V402 = 402,
V403 = 403,
V404 = 404,
V405 = 405,
V406 = 406,
V407 = 407,
V408 = 408,
V409 = 409,
V410 = 410,
V411 = 411,
V412 = 412,
V413 = 413,
V414 = 414,
V415 = 415,
V416 = 416,
V417 = 417,
V418 = 418,
V419 = 419,
V420 = 420,
V421 = 421,
V422 = 422,
V423 = 423,
V424 = 424,
V425 = 425,
V426 = 426,
V427 = 427,
V428 = 428,
V429 = 429,
V430 = 430,
V431 = 431,
V432 = 432,
V433 = 433,
V434 = 434,
V435 = 435,
V436 = 436,
V437 = 437,
V438 = 438,
V439 = 439,
V440 = 440,
V441 = 441,
V442 = 442,
V443 = 443,
V444 = 444,
V445 = 445,
V446 = 446,
V447 = 447,
V448 = 448,
V449 = 449,
V450 = 450,
V451 = 451,
V452 = 452,
V453 = 453,
V454 = 454,
V455 = 455,
V456 = 456,
V457 = 457,
V458 = 458,
V459 = 459,
V460 = 460,
V461 = 461,
V462 = 462,
V463 = 463,
V464 = 464,
V465 = 465,
V466 = 466,
V467 = 467,
V468 = 468,
V469 = 469,
V470 = 470,
V471 = 471,
V472 = 472,
V473 = 473,
V474 = 474,
V475 = 475,
V476 = 476,
V477 = 477,
V478 = 478,
V479 = 479,
V480 = 480,
V481 = 481,
V482 = 482,
V483 = 483,
V484 = 484,
V485 = 485,
V486 = 486,
V487 = 487,
V488 = 488,
V489 = 489,
V490 = 490,
V491 = 491,
V492 = 492,
V493 = 493,
V494 = 494,
V495 = 495,
V496 = 496,
V497 = 497,
V498 = 498,
V499 = 499,
V500 = 500,
V501 = 501,
V502 = 502,
V503 = 503,
V504 = 504,
V505 = 505,
V506 = 506,
V507 = 507,
V508 = 508,
V509 = 509,
V510 = 510,
V511 = 511
};
class Flags {
public:
static int32 _flags[FLAGS_COUNT];
public:
Flags();
/**
* Reset the variables back to initial game state
*/
void reset();
void reset1();
void reset2();
void reset3();
void reset4();
void reset5();
void conv_reset_all();
int32 get_boonsville_time_and_display(bool showTime = false);
void set_boonsville_time(int32 time);
bool advance_boonsville_time_and_check_schedule(int32 time);
bool dispatch_scheduled_boonsville_time_trigger(int32 time);
void schedule_boonsville_time();
/**
* Save/load values to a save file
*/
void sync(Common::Serializer &s);
size_t size() const {
return FLAGS_COUNT;
}
int32 &operator[](Flag flag) {
assert((int)flag < FLAGS_COUNT);
return _flags[flag];
}
const char *getConvName();
};
} // namespace Burger
} // namespace M4
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,115 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_GUI_GAME_MENU_H
#define M4_BURGER_GUI_GAME_MENU_H
#include "graphics/surface.h"
#include "m4/m4_types.h"
#include "m4/graphics/gr_buff.h"
#include "m4/gui/gui_menu_items.h"
#include "m4/gui/game_menu.h"
#include "m4/gui/gui_univ.h"
namespace M4 {
namespace Burger {
namespace GUI {
using M4::GUI::guiMenu;
using M4::GUI::menuItemButton;
using M4::GUI::menuItemMsg;
using M4::GUI::menuItemHSlider;
using M4::GUI::menuItemVSlider;
using M4::GUI::menuItemTextField;
using M4::GUI::Sprite;
using M4::GUI::CALLBACK;
using M4::GUI::ItemHandlerFunction;
class GameMenu {
private:
static void destroyMenu();
static void cb_Game_Quit(void *, void *);
static void cb_Game_Resume(void *, void *);
static void cb_Game_Save(void *, void *);
static void cb_Game_Load(void *, void *);
static void cb_Game_Main(void *, void *);
static void cb_Game_Options(void *, void *);
public:
static void show(RGB8 *myPalette);
};
class OptionsMenu {
private:
static void destroyMenu();
static void cb_Options_Game_Cancel(void *, void *);
static void cb_Options_Game_Done(void *, void *);
static void cb_Options_Digi(menuItemHSlider *myItem, guiMenu *myMenu);
static void cb_Options_Digestability(menuItemHSlider *myItem, guiMenu *myMenu);
static void setDigiVolume(uint16 volume);
static void setDigiVolumePerc(uint8 volumePerc);
static uint16 getDigiVolume();
static uint8 getDigiVolumePerc();
public:
static void show(RGB8 *myPalette);
};
class SaveLoadMenu : public M4::GUI::SaveLoadMenuBase {
private:
static void destroyMenu(bool saveMenu);
static bool load_Handler(menuItemButton *theItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem);
static void cb_SaveLoad_Save(void *, guiMenu *myMenu);
static void cb_SaveLoad_Load(menuItemButton *, guiMenu *);
static void cb_SaveLoad_Cancel(menuItemButton *, guiMenu *myMenu);
static void cb_SaveLoad_Slot(menuItemButton *myButton, guiMenu *myMenu);
static void cb_SaveLoad_VSlider(menuItemVSlider *myItem, guiMenu *myMenu);
public:
static void show(RGB8 *myPalette, bool saveMenu);
};
class ErrorMenu {
private:
static void destroyMenu();
static void cb_Err_Done(void *, void *);
public:
static void show(RGB8 *myPalette);
};
// GAME MENU FUNCTIONS
extern void CreateGameMenu(RGB8 *myPalette);
extern void CreateF2SaveMenu(RGB8 *myPalette);
extern void CreateLoadMenu(RGB8 *myPalette);
extern void CreateF3LoadMenu(RGB8 *myPalette);
// Routines used by the main menu
void CreateLoadMenuFromMain(RGB8 *myPalette);
void CreateGameMenuFromMain(RGB8 *myPalette);
} // namespace GUI
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,42 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_GUI_H
#define M4_BURGER_GUI_H
#include "m4/burger/gui/game_menu.h"
#include "m4/burger/gui/interface.h"
namespace M4 {
namespace Burger {
namespace GUI {
struct GUI_Globals {
bool saveLoadFromHotkey = false;
bool gameMenuFromMain = false;
};
} // namespace GUI
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,918 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/gui/gui_gizmo.h"
#include "m4/burger/vars.h"
#include "m4/core/errors.h"
#include "m4/core/imath.h"
#include "m4/adv_r/adv_background.h"
#include "m4/adv_r/adv_control.h"
#include "m4/graphics/gr_sprite.h"
#include "m4/gui/gui_event.h"
#include "m4/gui/gui_sys.h"
#include "m4/gui/gui_vmng.h"
#include "m4/mem/mem.h"
#include "m4/platform/keys.h"
#include "m4/m4.h"
#include "m4/platform/timer.h"
namespace M4 {
namespace Burger {
namespace GUI {
static void gizmo_dispose_gui();
static void gizmo_restore_interface(bool fade);
static void gizmo_free_gui(Gizmo *gizmo);
static bool gizmo_load_sprites(const char *name, size_t count);
static void gizmo_free_sprites();
static void gizmo_draw_sprite(M4sprite *sprite, Buffer *dest, int destX, int destY);
static Gizmo *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags);
static void gizmo_digi_daemon(int trigger);
static void gizmo_daemon(int trigger);
Gizmo_Globals::Gizmo_Globals() {
Common::fill(_roomFlags, _roomFlags + 15, false);
}
Gizmo_Globals::~Gizmo_Globals() {
mem_free(_gui);
}
static void gizmo_sound() {
digi_read_another_chunk();
midi_loop();
g_system->updateScreen();
g_system->delayMillis(10);
g_events->process();
gui_system_event_handler();
}
void gizmo_digi_play(const char *name, int vol, bool &done) {
if (!done) {
done = true;
digi_play(name, 2, vol);
digi_read_another_chunk();
player_set_commands_allowed(false);
while (!g_engine->shouldQuit() && digi_play_state(2))
gizmo_sound();
player_set_commands_allowed(true);
}
}
void gizmo_initialize(RGB8 *pal) {
if (!_GIZMO(initialized)) {
_GIZMO(initialized) = true;
// Remember whether interface was visible when gizmo was initialized
if (INTERFACE_VISIBLE) {
_GIZMO(interface_visible) = true;
interface_hide();
} else {
_GIZMO(interface_visible) = false;
}
_GIZMO(palette) = pal;
krn_fade_to_grey(pal, 5, 1);
}
}
void gizmo_shutdown(void *, void *) {
gizmo_dispose_gui();
gizmo_restore_interface(true);
}
static void gizmo_digi_daemon(int trigger) {
switch (trigger) {
case 5000:
if (player_been_here(503)) {
if (_G(flags)[kBORK_STATE] == 16)
gizmo_digi_play("510w005", 255, _GIZMO(roomFlags)[3]);
else
gizmo_digi_play("510w004", 255, _GIZMO(roomFlags)[2]);
}
break;
case 5001:
if (player_been_here(507)) {
if (_G(flags)[V223] == 2)
gizmo_digi_play("510w008", 255, _GIZMO(roomFlags)[5]);
else
gizmo_digi_play("510w007", 255, _GIZMO(roomFlags)[4]);
}
break;
case 5002:
if (player_been_here(504)) {
if (_G(flags)[V210] == 5002)
gizmo_digi_play("510w011", 255, _GIZMO(roomFlags)[7]);
else
gizmo_digi_play("510w010", 255, _GIZMO(roomFlags)[6]);
}
break;
case 5003:
if (player_been_here(508)) {
if (_G(flags)[V227] != 0)
gizmo_digi_play("510w014", 255, _GIZMO(roomFlags)[9]);
else
gizmo_digi_play("510w013", 255, _GIZMO(roomFlags)[8]);
}
break;
case 5004:
if (player_been_here(506)) {
if (_G(flags)[V218] == 5003)
gizmo_digi_play("510w017", 255, _GIZMO(roomFlags)[11]);
else
gizmo_digi_play("510w016", 255, _GIZMO(roomFlags)[10]);
}
break;
case 5005:
if (_G(flags)[kStairsBorkState] == 5003)
gizmo_digi_play("510w019", 255, _GIZMO(roomFlags)[13]);
else
gizmo_digi_play("510w018", 255, _GIZMO(roomFlags)[12]);
break;
case 5006:
gizmo_digi_play("510w020", 255, _GIZMO(roomFlags)[14]);
break;
default:
break;
}
}
static void gizmo_restore_sprite(int spriteIndex) {
if (!_GIZMO(gui))
return;
Buffer *dest = _GIZMO(gui)->_grBuff->get_buffer();
if (!dest)
return;
if (spriteIndex >= 22)
gizmo_draw_sprite(_GIZMO(sprites)[spriteIndex], dest, 270, 38);
int32 status = 0;
ScreenContext *ctx = vmng_screen_find(_GIZMO(gui), &status);
if (ctx && status == 1)
RestoreScreens(270, 38, 381, 93);
}
static void gizmo_digi_wait(int spriteIndex1, int spriteIndex2) {
player_set_commands_allowed(false);
digi_read_another_chunk();
int spriteNum = spriteIndex1;
while (digi_play_state(2)) {
// Cycle displayed sprite
gizmo_restore_sprite(spriteNum);
spriteNum = (spriteNum == spriteIndex2) ? spriteIndex1 : spriteNum + 1;
uint32 timer = timer_read_60();
while (!g_engine->shouldQuit() && (timer_read_60() - timer) < 6)
gizmo_sound();
}
gizmo_restore_sprite(57);
player_set_commands_allowed(true);
}
static void gizmo_daemon(int trigger) {
switch (trigger) {
case 5000:
switch (imath_ranged_rand(1, 3)) {
case 1:
digi_play("510b001a", 2, 255, -1);
break;
case 2:
digi_play("510b001b", 2, 255, -1);
break;
default:
digi_play("510b001c", 2, 255, -1);
break;
}
gizmo_digi_wait(32, 36);
break;
case 5001:
switch (imath_ranged_rand(1, 3)) {
case 1:
digi_play("510b002a", 2, 255, -1);
break;
case 2:
digi_play("510b002b", 2, 255, -1);
break;
default:
digi_play("510b002c", 2, 255, -1);
break;
}
gizmo_digi_wait(27, 31);
break;
case 5002:
switch (imath_ranged_rand(1, 3)) {
case 1:
digi_play("510b003a", 2, 255, -1);
break;
case 2:
digi_play("510b003b", 2, 255, -1);
break;
default:
digi_play("510b003c", 2, 255, -1);
break;
}
gizmo_digi_wait(32, 36);
break;
case 5003:
switch (imath_ranged_rand(1, 2)) {
case 1:
digi_play("510b004a", 2, 255, -1);
break;
case 2:
digi_play("510b004b", 2, 255, -1);
break;
default:
break;
}
gizmo_digi_wait(37, 41);
break;
case 5004:
switch (imath_ranged_rand(1, 3)) {
case 1:
digi_play("510b005a", 2, 255, -1);
break;
case 2:
digi_play("510b005b", 2, 255, -1);
break;
default:
digi_play("510b005c", 2, 255, -1);
break;
}
gizmo_digi_wait(42, 46);
break;
case 5005:
switch (imath_ranged_rand(1, 3)) {
case 1:
digi_play("510b006a", 2, 255, -1);
break;
case 2:
digi_play("510b006b", 2, 255, -1);
break;
default:
digi_play("510b006c", 2, 255, -1);
break;
}
gizmo_digi_wait(47, 51);
break;
case 5006:
switch (imath_ranged_rand(1, 3)) {
case 1:
digi_play("510b007a", 2, 255, -1);
break;
case 2:
digi_play("510b007b", 2, 255, -1);
break;
default:
digi_play("510b007c", 2, 255, -1);
break;
}
gizmo_digi_wait(52, 56);
break;
default:
break;
}
gizmo_digi_daemon(trigger);
}
static void gizmo_restore_interface(bool fade) {
if (_GIZMO(initialized)) {
_GIZMO(currentItem) = nullptr;
if (_GIZMO(lowMemory2)) {
if (!adv_restoreBackground())
error_show(FL, 0, "unable to restore background");
}
if (_GIZMO(lowMemory1)) {
if (!adv_restoreCodes())
error_show(FL, 0, "unable to restore screen codes");
}
krn_fade_from_grey(_GIZMO(palette), 5, 1, fade ? 1 : 2);
if (_GIZMO(interface_visible))
interface_show();
mouse_unlock_sprite();
game_pause(false);
_GIZMO(initialized) = false;
}
}
static void gizmo_dispose_gui() {
if (_GIZMO(gui)) {
vmng_screen_dispose(_GIZMO(gui));
gizmo_free_gui(_GIZMO(gui));
gizmo_free_sprites();
_GIZMO(gui) = nullptr;
}
}
static void gizmo_free_gui(Gizmo *gizmo) {
if (!gizmo)
return;
for (GizmoItem *item = gizmo->_items; item; item = gizmo->_items) {
gizmo->_items = item->_next;
(*item->_fnFree)(item);
}
GrBuff *grBuff = gizmo->_grBuff;
if (grBuff)
delete grBuff;
mem_free(gizmo);
}
static bool gizmo_load_sprites(const char *name, size_t count) {
if (LoadSpriteSeries(name, &_GIZMO(seriesHandle), &_GIZMO(celsOffset),
&_GIZMO(palOffset), _GIZMO(palette)) > 0) {
gr_pal_set_range(_GIZMO(palette), 64, 192);
_GIZMO(assetName) = mem_strdup(name);
_GIZMO(spriteCount) = count;
_GIZMO(sprites) = (M4sprite **)mem_alloc(count * sizeof(M4sprite *), "*sprites array");
for (size_t idx = 0; idx < count; ++idx) {
_GIZMO(sprites)[idx] = CreateSprite(_GIZMO(seriesHandle), _GIZMO(celsOffset),
idx, nullptr, nullptr);
}
return true;
}
return false;
}
static void gizmo_free_sprites() {
if (_GIZMO(assetName)) {
rtoss(_GIZMO(assetName));
mem_free(_GIZMO(assetName));
_GIZMO(assetName) = nullptr;
_GIZMO(seriesHandle) = nullptr;
_GIZMO(celsOffset) = -1;
_GIZMO(palOffset) = -1;
for (int idx = 0; idx < _GIZMO(spriteCount); ++idx)
mem_free(_GIZMO(sprites)[idx]);
mem_free(_GIZMO(sprites));
_GIZMO(sprites) = nullptr;
_GIZMO(spriteCount) = 0;
}
}
void gizmo_draw_sprite(M4sprite *sprite, Buffer *dest, int destX, int destY) {
Buffer src;
DrawRequest dr;
if (sprite && dest) {
HLock(sprite->sourceHandle);
sprite->data = (uint8 *)((intptr)*sprite->sourceHandle + sprite->sourceOffset);
src.stride = src.w = sprite->w;
src.h = sprite->h;
src.encoding = sprite->encoding & 0x7f;
src.data = sprite->data;
dr.Src = &src;
dr.Dest = dest;
dr.x = destX;
dr.y = destY;
dr.scaleX = dr.scaleY = 100;
dr.srcDepth = 0;
dr.depthCode = nullptr;
dr.Pal = nullptr;
dr.ICT = nullptr;
gr_sprite_draw(&dr);
HUnLock(sprite->sourceHandle);
}
}
static void gizmo_draw(ScreenContext *s, RectList *r, Buffer *dest, int32 destX, int32 destY) {
if (!s)
return;
void *scrnContent = s->scrnContent;
if (!scrnContent)
return;
Gizmo *gizmo = (Gizmo *)s->scrnContent;
if (!gizmo)
return;
Buffer *src = gizmo->_grBuff->get_buffer();
if (!src)
return;
if (dest) {
for (RectList *rect = r; rect; rect = rect->next) {
gr_buffer_rect_copy_2(src, dest,
rect->x1 - s->x1, rect->y1 - s->y1, destX, destY,
rect->x2 - rect->x1 + 1, rect->y2 - rect->y1 + 1);
}
} else {
for (RectList *rect = r; rect; rect = rect->next) {
vmng_refresh_video(rect->x1, rect->y1,
rect->x1 - s->x1, rect->y1 - s->y1, rect->x2 - s->x1, rect->y2 - s->y1,
src);
}
}
}
static bool gizmo_eventHandler(void *s, int32 eventType, int32 event, int32 x, int32 y, bool *z) {
Gizmo *gizmo = (Gizmo *)s;
bool flag = false;
int32 status = 0;
ScreenContext *ctx = vmng_screen_find(s, &status);
// WORKAROUND: gui_system_event_handler may call without z being set
bool dummyZ = false;
if (!z)
z = &dummyZ;
*z = false;
if (!ctx || status != 1)
return false;
if (eventType == EVENT_KEY) {
if (event == KEY_ESCAPE && gizmo->_fnEscape) {
_GIZMO(currentItem) = nullptr;
(*gizmo->_fnEscape)();
return true;
} else if (event == KEY_RETURN && gizmo->_fnEnter) {
_GIZMO(currentItem) = nullptr;
(*gizmo->_fnEnter)();
return true;
}
}
const int xs = x + ctx->x1;
const int ys = y + ctx->y1;
if (_GIZMO(currentItem)) {
flag = (*_GIZMO(currentItem)->_fnEvents)(_GIZMO(currentItem),
eventType, event, xs, ys, &_GIZMO(currentItem));
if (_GIZMO(currentItem))
*z = true;
if (flag)
return true;
}
if (eventType == EVENT_MOUSE) {
GizmoItem *item;
for (item = gizmo->_items; item; item = item->_next) {
if (item->_btnRect.contains(xs, ys))
break;
}
if (item && item->_fnEvents) {
item->_fnEvents(item, eventType, event, xs, ys, &_GIZMO(currentItem));
if (_GIZMO(currentItem))
*z = true;
return true;
}
} else if (eventType == EVENT_KEY) {
for (GizmoItem *item = gizmo->_items; item && !flag; item = item->_next) {
if (item->_fnEvents)
flag = (*item->_fnEvents)(item, eventType, event, -1, -1, nullptr);
}
return flag;
}
switch (event) {
case 2:
case 14:
if (!(ctx->scrnFlags & SF_IMMOVABLE)) {
*z = true;
_GIZMO(savedFlag) = true;
_GIZMO(savedX) = x;
_GIZMO(savedY) = y;
}
if (xs < 230 || xs > 420 || ys > 374)
gizmo_shutdown();
break;
case 4:
case 16:
if (_GIZMO(savedFlag)) {
MoveScreenDelta(ctx, _GIZMO(savedX), _GIZMO(savedY));
_GIZMO(savedX) = x;
_GIZMO(savedY) = y;
}
break;
case 5:
case 17:
*z = false;
_GIZMO(savedFlag) = false;
break;
default:
break;
}
return true;
}
static void gizmo_item_draw(GizmoItem *item, Gizmo *gizmo, int x, int y) {
if (!item || !item->_button || !gizmo)
return;
Buffer *src = nullptr;
if (item->_hasBuffer) {
if (!item->_grBuff)
return;
src = item->_grBuff->get_buffer();
if (!src)
return;
}
Buffer *dest = gizmo->_grBuff->get_buffer();
if (!dest)
return;
GizmoButton *btn = item->_button;
M4sprite *sprite = nullptr;
switch (btn->_state) {
case IN_CONTROL:
sprite = _GIZMO(sprites)[15 + btn->_index];
break;
case OVER_CONTROL:
sprite = _GIZMO(sprites)[8 + btn->_index];
break;
default:
sprite = _GIZMO(sprites)[1 + btn->_index];
break;
}
if (src) {
gr_buffer_rect_copy_2(src, dest, 0, 0, x, y, src->w, src->h);
item->_grBuff->release();
}
gizmo_draw_sprite(sprite, dest, x, y);
gizmo->_grBuff->release();
}
static void gizmo_item_free(GizmoItem *item) {
if (!item)
return;
if (item->_grBuff)
delete item->_grBuff;
if (item->_button)
mem_free(item->_button);
mem_free(item);
}
static GrBuff *gizmo_create_buffer(Gizmo *gizmo, int sx, int sy, int w, int h) {
if (!gizmo || !gizmo->_grBuff)
return nullptr;
GrBuff *grBuff = new GrBuff(w, h);
Buffer *src = gizmo->_grBuff->get_buffer();
Buffer *dest = grBuff->get_buffer();
assert(src && dest);
gr_buffer_rect_copy_2(src, dest, sx, sy, 0, 0, w, h);
gizmo->_grBuff->release();
grBuff->release();
return grBuff;
}
static bool gizmo_item_contains(GizmoItem *item, int x, int y) {
return item->_btnRect.contains(x, y);
}
static GizmoItem *gizmo_findItem(int id, Gizmo *gizmo) {
for (GizmoItem *item = gizmo->_items; item; item = item->_next) {
if (item->_id == id)
return item;
}
return nullptr;
}
static bool gizmo_item_events(GizmoItem *item, int eventType, int event, int x, int y,
GizmoItem **currentItem) {
if (!item || !item->_button || eventType != EVENT_MOUSE)
return false;
GizmoButton *btn = item->_button;
if (btn->_state == SELECTED)
return false;
bool flag1 = false;
bool flag2 = false;
bool flag3 = false;
switch (event) {
case _ME_move:
if (gizmo_item_contains(item, x, y)) {
if (!player_commands_allowed())
return false;
*currentItem = item;
if (btn->_state != IN_CONTROL) {
btn->_state = IN_CONTROL;
flag1 = true;
}
} else {
*currentItem = nullptr;
if (btn->_state != NOTHING) {
btn->_state = NOTHING;
flag1 = true;
flag3 = false;
}
}
break;
case _ME_L_click:
case _ME_doubleclick:
if (gizmo_item_contains(item, x, y)) {
if (!player_commands_allowed())
return false;
btn->_state = OVER_CONTROL;
*currentItem = item;
flag1 = true;
} else {
*currentItem = nullptr;
if (btn->_state != NOTHING) {
btn->_state = NOTHING;
flag1 = true;
}
}
break;
case _ME_L_hold:
case _ME_doubleclick_hold:
break;
case _ME_L_drag:
case _ME_doubleclick_drag:
if (!*currentItem)
return true;
if (gizmo_item_contains(item, x, y)) {
if (!player_commands_allowed())
return false;
if (btn->_state != OVER_CONTROL) {
btn->_state = OVER_CONTROL;
flag1 = true;
}
} else {
if (btn->_state != IN_CONTROL) {
btn->_state = IN_CONTROL;
flag1 = true;
}
}
break;
case _ME_L_release:
case _ME_doubleclick_release:
if (gizmo_item_contains(item, x, y)) {
if (!player_commands_allowed())
return false;
if (*currentItem)
flag2 = true;
else
*currentItem = item;
} else {
*currentItem = nullptr;
btn->_state = NOTHING;
flag1 = true;
flag3 = false;
}
break;
default:
break;
}
if (flag1) {
(*item->_fnDraw)(item, item->_gizmo, item->_bounds.left, item->_bounds.top);
int32 status;
ScreenContext *ctx = vmng_screen_find(item->_gizmo, &status);
if (ctx && status == 1)
RestoreScreens(item->_bounds.left + ctx->x1, item->_bounds.top + ctx->y1,
item->_bounds.right + ctx->x1, item->_bounds.bottom + ctx->y1);
}
if (flag2 && item->_select) {
(*item->_select)();
flag3 = true;
int32 status;
ScreenContext *ctx = vmng_screen_find(item->_gizmo, &status);
if (ctx && status == 1) {
if (!gizmo_findItem(item->_id, item->_gizmo))
*currentItem = nullptr;
} else {
*currentItem = nullptr;
}
}
return flag3;
}
static GizmoItem *gizmo_add_item(Gizmo *gizmo, int id,
int boundsX, int boundsY, int boundsW, int boundsH,
int rect1X, int rect1Y, int rect1W, int rect1H,
GizmoItemFnSelect select, int btnIndex, bool selected = false,
bool hasBuffer = false, int arg9 = 0,
GizmoItemFnEvents events = gizmo_item_events) {
if (!gizmo)
return nullptr;
// Create new item
GizmoItem *item = (GizmoItem *)mem_alloc(sizeof(GizmoItem), "*gui gizmo item");
if (!item)
error("gizmo_add_item - Not enough emory to create item (%zu bytes)", sizeof(GizmoItem));
// Put the new item at the head of the list
item->_next = gizmo->_items;
item->_prior = nullptr;
item->_gizmo = gizmo;
if (gizmo->_items)
gizmo->_items->_prior = item;
gizmo->_items = item;
// Set fields
item->_id = id;
item->_bounds = Common::Rect(boundsX, boundsY, boundsX + boundsW - 1,
boundsY + boundsH - 1);
item->_btnRect = Common::Rect(rect1X, rect1Y, rect1X + rect1W - 1, rect1Y + rect1H - 1);
item->_select = select;
item->_hasBuffer = hasBuffer;
if (hasBuffer) {
item->_grBuff = gizmo_create_buffer(gizmo, rect1X, rect1Y, rect1W, rect1H);
} else {
item->_grBuff = nullptr;
}
GizmoButton *btn = (GizmoButton *)mem_alloc(sizeof(GizmoButton), "*gizmo button");
if (!btn)
error("gizmo_add_item - Not enough emory to create btn (%zu bytes)", sizeof(GizmoButton));
btn->_state = selected ? SELECTED : NOTHING;
btn->_index = btnIndex;
btn->_field8 = arg9;
btn->_field10 = id - 1000;
item->_button = btn;
item->_fnDraw = gizmo_item_draw;
item->_fnFree = gizmo_item_free;
item->_fnEvents = events;
(*item->_fnDraw)(item, gizmo, boundsX, boundsY);
int32 status = 0;
ScreenContext *ctx = vmng_screen_find(gizmo, &status);
if (ctx && status == 1) {
RestoreScreens(ctx->x1 + item->_bounds.left, ctx->y1 + item->_bounds.top,
ctx->x1 + item->_bounds.right, ctx->y1 + item->_bounds.bottom);
}
return item;
}
static Gizmo *gui_create_gizmo(M4sprite *sprite, int sx, int sy, uint scrnFlags) {
if (!sprite)
return nullptr;
Gizmo *gui = (Gizmo *)mem_alloc(sizeof(Gizmo), "*gui gizmo");
if (!gui)
return nullptr;
GrBuff *grBuff = new GrBuff(sprite->w, sprite->h);
gui->_grBuff = grBuff;
gui->_items = nullptr;
gui->_fnEnter = nullptr;
gui->_fnEscape = nullptr;
gui->_fnEvents = gizmo_eventHandler;
Buffer *dest = gui->_grBuff->get_buffer();
Buffer *src = _G(gameDrawBuff)->get_buffer();
if ((_G(gameDrawBuff)->h - sy) >= dest->h) {
gr_buffer_rect_copy_2(src, dest, sx, sy, 0, 0, dest->w, dest->h);
} else {
gr_buffer_rect_copy_2(src, dest, sx, sy, 0, 0, dest->w, _G(gameDrawBuff)->h - sy);
}
_G(gameDrawBuff)->release();
if (sprite->sourceHandle)
gizmo_draw_sprite(sprite, dest, 0, 0);
gui->_grBuff->release();
ScreenContext *ctx = vmng_screen_create(sx, sy, sx + sprite->w, sy + sprite->h,
69, scrnFlags, gui, (RefreshFunc)gizmo_draw, gizmo_eventHandler);
return ctx ? gui : nullptr;
}
void gizmo_anim(RGB8 *pal) {
if (!_GIZMO(initialized))
gizmo_initialize(pal);
if (!gizmo_load_sprites("500gizmo", 58))
return;
Gizmo *gizmo = gui_create_gizmo(_GIZMO(sprites)[0], 0, 0, 505);
_GIZMO(gui) = gizmo;
assert(gizmo);
gizmo_add_item(gizmo, 1, 234, 153, 178, 48, 251, 163, 144, 25,
[]() { gizmo_daemon(5000); }, 0);
gizmo_add_item(gizmo, 2, 234, 178, 178, 48, 254, 188, 136, 25,
[]() { gizmo_daemon(5001); }, 1);
gizmo_add_item(gizmo, 3, 235, 203, 178, 48, 256, 212, 128, 27,
[]() { gizmo_daemon(5002); }, 2);
gizmo_add_item(gizmo, 6, 234, 230, 178, 48, 260, 239, 119, 25,
[]() { gizmo_daemon(5003); }, 3);
gizmo_add_item(gizmo, 5, 234, 255, 178, 48, 264, 264, 109, 25,
[]() { gizmo_daemon(5004); }, 4);
gizmo_add_item(gizmo, 6, 234, 278, 178, 48, 266, 289, 102, 25,
[]() { gizmo_daemon(5005); }, 5);
gizmo_add_item(gizmo, 7, 234, 300, 178, 48, 268, 314, 96, 25,
[]() { gizmo_daemon(5006); }, 6);
vmng_screen_show(gizmo);
mouse_lock_sprite(0);
}
} // namespace GUI
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,113 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_GUI_GIZMO_H
#define M4_BURGER_GUI_GIZMO_H
#include "common/rect.h"
#include "m4/m4_types.h"
#include "m4/gui/gui_vmng_core.h"
#include "m4/graphics/gr_buff.h"
#include "m4/burger/gui/inventory.h"
namespace M4 {
namespace Burger {
namespace GUI {
#define _GIZMO(X) g_vars->_gizmo._##X
struct Gizmo;
struct GizmoItem;
struct Gizmo_Globals {
bool _initialized = false;
bool _interface_visible = false;
Gizmo *_gui = nullptr;
RGB8 *_palette = nullptr;
bool _lowMemory1 = false;
bool _lowMemory2 = false;
GizmoItem *_currentItem = nullptr;
MemHandle _seriesHandle = nullptr;
int32 _celsOffset = 0;
int32 _palOffset = 0;
char *_assetName = nullptr;
int _spriteCount = 0;
M4sprite **_sprites = nullptr;
bool _roomFlags[15];
bool _savedFlag = false;
int _savedX = 0;
int _savedY = 0;
Gizmo_Globals();
~Gizmo_Globals();
};
struct Gizmo {
GrBuff *_grBuff = nullptr;
GizmoItem *_items = nullptr;
void (*_fnEnter)() = nullptr;
void (*_fnEscape)() = nullptr;
EventHandler _fnEvents = nullptr;
};
struct GizmoButton {
ControlStatus _state = NOTHING;
int _index = 0;
int _field8 = 0;
int _fieldC = 0;
int _field10 = 0;
};
typedef void (*GizmoItemFnSelect)();
typedef void (*GizmoItemFnDraw)(GizmoItem *item, Gizmo *gizmo, int x, int y);
typedef void (*GizmoItemFnFree)(GizmoItem *item);
typedef bool (*GizmoItemFnEvents)(GizmoItem *item, int eventType, int event, int x, int y,
GizmoItem **currentItem);
struct GizmoItem {
GizmoItem *_next = nullptr;
GizmoItem *_prior = nullptr;
Gizmo *_gizmo = nullptr;
GrBuff *_grBuff = nullptr;
GizmoButton *_button = nullptr;
int _id = 0;
Common::Rect _bounds;
Common::Rect _btnRect;
bool _hasBuffer = false;
GizmoItemFnSelect _select = nullptr;
GizmoItemFnDraw _fnDraw = nullptr;
GizmoItemFnFree _fnFree = nullptr;
GizmoItemFnEvents _fnEvents = nullptr;
};
void gizmo_anim(RGB8 *pal);
void gizmo_initialize(RGB8 *pal);
void gizmo_shutdown(void *v1 = nullptr, void *v2 = nullptr);
void gizmo_digi_play(const char *name, int vol, bool &done);
} // namespace GUI
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,546 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/gui/interface.h"
#include "m4/core/cstring.h"
#include "m4/core/errors.h"
#include "m4/graphics/gr_series.h"
#include "m4/gui/gui_event.h"
#include "m4/burger/burger.h"
#include "m4/burger/vars.h"
#include "m4/adv_r/other.h"
namespace M4 {
namespace Burger {
namespace GUI {
Interface::Interface() : M4::Interface() {
_x1 = 0;
_y1 = 374;
_x2 = SCREEN_WIDTH;
_y2 = SCREEN_HEIGHT;
}
bool Interface::init(int arrow, int wait, int look, int grab, int use) {
M4::Interface::init(arrow, wait, look, grab, use);
_sprite = series_load("999intr", 22, nullptr);
if (_sprite != 22)
error_show(FL, 'SLF!');
mouse_set_sprite(arrow);
if (!_G(gameInterfaceBuff)) {
_G(gameInterfaceBuff) = new GrBuff(_x2 - _x1, _y2 - _y1);
setup();
return true;
} else {
return false;
}
}
Interface::~Interface() {
delete _interfaceBox;
delete _inventory;
delete _textField;
delete _btnTake;
delete _btnManipulate;
delete _btnHandle;
delete _btnAbductFail;
delete _btnMenu;
delete _btnScrollLeft;
delete _btnScrollRight;
}
void Interface::show() {
M4::Interface::show();
_interfaceBox->_must_redraw_all = true;
vmng_screen_show(_G(gameInterfaceBuff));
_visible = true;
track_hotspots_refresh();
}
void Interface::setup() {
_interfaceBox = new InterfaceBox(RectClass(0, 0, SCREEN_WIDTH - 1, 105));
_inventory = new GUI::Inventory(RectClass(188, 22, 539, 97), _sprite, 9, 1, 39, 75, 3);
_textField = new TextField(200, 1, 470, 21);
_btnTake = new ButtonClass(RectClass(60, 35, 92, 66), "take", 4, 3, 3, 4, 5, INTERFACE_SPRITES);
_btnManipulate = new ButtonClass(RectClass(105, 35, 137, 66), "manipulate", 7, 6, 6, 7, 8, INTERFACE_SPRITES);
_btnHandle = new ButtonClass(RectClass(15, 35, 47, 66), "handle", 5, 0, 0, 1, 2, INTERFACE_SPRITES);
_interfaceBox->add(_btnTake);
_interfaceBox->add(_btnManipulate);
_interfaceBox->add(_btnHandle);
if (_G(executing) == WHOLE_GAME) {
_btnAbductFail = new ButtonClass(RectClass(580, 10, 620, 69), "abductfail", 10, 69, 69, 70, 71, INTERFACE_SPRITES);
_btnMenu = new ButtonClass(RectClass(582, 70, 619, 105), "menu", 11, 76, 76, 77, 78, INTERFACE_SPRITES);
_interfaceBox->add(_btnAbductFail);
_interfaceBox->add(_btnMenu);
} else {
_btnAbductFail = new ButtonClass(RectClass(580, 22, 620, 75), "abductfail", 10, 69, 69, 70, 71, INTERFACE_SPRITES);
_interfaceBox->add(_btnAbductFail);
}
_btnScrollLeft = new ButtonClass(RectClass(168, 22, 188, 97), "scroll left", 8, 59, 60, 61, 62, INTERFACE_SPRITES);
_btnScrollRight = new ButtonClass(RectClass(539, 22, 559, 97), "scroll right", 9, 63, 64, 65, 66, INTERFACE_SPRITES);
_interfaceBox->add(_btnScrollLeft);
_interfaceBox->add(_btnScrollRight);
}
void Interface::cancel_sentence() {
_textField->set_string(" ");
_G(player).need_to_walk = false;
_G(player).ready_to_walk = false;
_G(player).command_ready = false;
_prepText[0] = '\0';
_nounText[0] = '\0';
_verbText[0] = '\0';
_iconSelected = false;
track_hotspots_refresh();
}
void Interface::freshen_sentence() {
_textField->set_string(" ");
_G(player).need_to_walk = false;
_G(player).ready_to_walk = _G(player).need_to_walk;
_G(player).command_ready = _G(player).ready_to_walk;
_prepText[0] = '\0';
_nounText[0] = '\0';
track_hotspots_refresh();
}
bool Interface::set_interface_palette(RGB8 *myPalette) {
gr_pal_set_RGB8(&myPalette[1], 0, 68, 0);
gr_pal_set_RGB8(&myPalette[2], 0, 134, 0);
gr_pal_set_RGB8(&myPalette[3], 0, 204, 0);
gr_pal_set_RGB8(&myPalette[4], 28, 8, 90);
gr_pal_set_RGB8(&myPalette[5], 204, 204, 250);
gr_pal_set_RGB8(&myPalette[6], 204, 204, 102);
gr_pal_set_RGB8(&myPalette[7], 5, 1, 0);
gr_pal_set_RGB8(&myPalette[8], 102, 51, 222);
gr_pal_set_RGB8(&myPalette[9], 85, 117, 255);
gr_pal_set_RGB8(&myPalette[10], 68, 68, 68);
gr_pal_set_RGB8(&myPalette[11], 51, 255, 0);
gr_pal_set_RGB8(&myPalette[12], 51, 51, 115);
gr_pal_set_RGB8(&myPalette[13], 119, 119, 119);
gr_pal_set_RGB8(&myPalette[14], 151, 153, 150);
gr_pal_set_RGB8(&myPalette[15], 153, 0, 0);
gr_pal_set_RGB8(&myPalette[16], 153, 53, 9);
gr_pal_set_RGB8(&myPalette[17], 117, 246, 255);
gr_pal_set_RGB8(&myPalette[18], 88, 0, 0);
gr_pal_set_RGB8(&myPalette[19], 195, 0, 83);
gr_pal_set_RGB8(&myPalette[20], 204, 102, 61);
gr_pal_set_RGB8(&myPalette[21], 204, 153, 118);
gr_pal_set_RGB8(&myPalette[22], 204, 255, 204);
gr_pal_set_RGB8(&myPalette[23], 207, 158, 73);
gr_pal_set_RGB8(&myPalette[24], 238, 0, 0);
gr_pal_set_RGB8(&myPalette[25], 248, 51, 31);
gr_pal_set_RGB8(&myPalette[26], 255, 131, 0);
gr_pal_set_RGB8(&myPalette[27], 255, 153, 102);
gr_pal_set_RGB8(&myPalette[28], 255, 204, 153);
gr_pal_set_RGB8(&myPalette[29], 255, 252, 144);
gr_pal_set_RGB8(&myPalette[30], 255, 255, 0);
gr_pal_set_RGB8(&myPalette[31], 255, 255, 255);
gr_pal_set_range(myPalette, 1, 31);
return true;
}
void Interface::track_hotspots_refresh() {
_hotspot = nullptr;
--_savedX;
bool z = false;
eventHandler(_G(gameInterfaceBuff), EVENT_MOUSE, 1,
_G(MouseState).CursorColumn, _G(MouseState).CursorRow, &z);
}
bool Interface::eventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) {
if (eventType != EVENT_MOUSE)
return false;
if (_G(kernel).fading_to_grey && event == _ME_L_release) {
kernel_unexamine_inventory_object(_G(master_palette), 5, 1);
return true;
}
if (player_commands_allowed()) {
if (x == _savedX && y == _savedY && event != _ME_L_click &&
event != _ME_L_release && event != _ME_L_hold && event != _ME_L_drag)
return true;
_savedX = x;
_savedY = y;
ControlStatus status = _interfaceBox->track(event, x - _x1, y - _y1);
switch (status) {
case NOTHING:
_state = NOTHING;
break;
case SELECTED:
trackIcons();
break;
default:
_state = IN_CONTROL;
break;
}
if (_state == NOTHING || _state == OVER_CONTROL) {
status = _inventory->track(event, x - _x1, y - _y1);
handleState(status);
_state = status ? OVER_CONTROL : NOTHING;
}
if (_state == NOTHING) {
int32 scrStatus;
ScreenContext *screen = vmng_screen_find(_G(gameDrawBuff), &scrStatus);
if (!screen)
return false;
if (y >= _y1) {
if (!_iconSelected)
mouse_set_sprite(kArrowCursor);
_textField->set_string(" ");
}
if (trackHotspots(event, x - screen->x1, y - screen->y1) == SELECTED)
dispatch_command();
}
}
if (_interfaceBox->_must_redraw_all) {
_textField->_must_redraw = true;
_inventory->_must_redraw_all = true;
}
_interfaceBox->draw(_G(gameInterfaceBuff));
_textField->draw(_G(gameInterfaceBuff));
_inventory->draw(_G(gameInterfaceBuff));
return true;
}
void Interface::refresh_right_arrow() {
if (_inventory->need_right() || _inventory->need_left()) {
_btnScrollRight->set_sprite_unknown(63);
_btnScrollRight->set_sprite_relaxed(64);
_btnScrollRight->set_sprite_picked(66);
_btnScrollRight->set_sprite_over(65);
_btnScrollRight->unhide();
} else {
// _btnScrollRight->hide();
// _btnScrollLeft->hide();
}
}
void Interface::refresh_left_arrow() {
if (_inventory->need_right() || _inventory->need_left()) {
_btnScrollLeft->set_sprite_unknown(59);
_btnScrollLeft->set_sprite_relaxed(60);
_btnScrollLeft->set_sprite_picked(62);
_btnScrollLeft->set_sprite_over(61);
_btnScrollLeft->unhide();
} else {
// _btnScrollRight->hide();
// _btnScrollLeft->hide();
}
}
void Interface::trackIcons() {
KernelTriggerType oldMode = _G(kernel).trigger_mode;
_G(kernel).trigger_mode = KT_DAEMON;
switch (_interfaceBox->_highlight_index) {
case 4:
t_cb();
break;
case 5:
l_cb();
break;
case 6:
mouse_set_sprite(_arrow);
_iconSelected = false;
if (_btnScrollRight->is_hidden())
refresh_right_arrow();
else
_btnScrollRight->hide();
if (_btnScrollLeft->is_hidden())
refresh_left_arrow();
else
_btnScrollLeft->hide();
break;
case 7:
u_cb();
break;
case 8:
if (!_btnScrollLeft->is_hidden()) {
if (_inventory->need_left()) {
_inventory->_scroll = (_inventory->_scroll <= 0) ? 0 :
_inventory->_scroll - _inventory->_cells_v;
}
refresh_right_arrow();
refresh_left_arrow();
_inventory->_must_redraw_all = true;
} else {
return;
}
break;
case 9:
if (!_btnScrollRight->is_hidden()) {
if (_inventory->need_right())
_inventory->_scroll += _inventory->_cells_v;
refresh_right_arrow();
refresh_left_arrow();
_inventory->_must_redraw_all = true;
} else {
return;
}
break;
case 10:
term_message("Abduct/Fail Button Pressed");
if (_G(game).section_id == 1) {
term_message("Abduct me now!");
_G(wilbur_should) = 10017;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (_G(game).section_id == 7) {
_G(walker).wilbur_speech("999w023");
} else {
term_message("Fail me now!");
_G(wilbur_should) = 10015;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
case 11:
// Game menu
other_save_game_for_resurrection();
if (g_engine->useOriginalSaveLoad()) {
CreateGameMenu(_G(master_palette));
} else {
g_engine->openMainMenuDialog();
}
break;
}
_G(kernel).trigger_mode = oldMode;
}
ControlStatus Interface::trackHotspots(int event, int x, int y) {
const HotSpotRec *hotspot = g_engine->_activeRoom->custom_hotspot_which(x, y);
if (!hotspot)
hotspot = hotspot_which(_G(currentSceneDef).hotspots, x, y);
if (hotspot != _hotspot) {
if (!hotspot) {
_textField->set_string(" ");
_hotspot = nullptr;
return NOTHING;
}
if (!_iconSelected) {
if (!mouse_set_sprite(hotspot->cursor_number))
mouse_set_sprite(kArrowCursor);
Common::strlcpy(_verbText, hotspot->verb, 40);
}
Common::String tmp = (g_engine->getLanguage() == Common::EN_ANY) ?
hotspot->vocab : hotspot->prep;
tmp.toUppercase();
_textField->set_string(tmp.c_str());
tmp = hotspot->vocab;
tmp.toUppercase();
Common::strlcpy(_nounText, tmp.c_str(), 40);
_hotspot = hotspot;
}
if (event == 5 && hotspot) {
_G(player).walk_x = x;
_G(player).walk_y = y;
_G(player).click_x = x;
_G(player).click_y = y;
if (hotspot->feet_x != 0x7fff)
_G(player).walk_x = hotspot->feet_x;
if (hotspot->feet_y != 0x7fff)
_G(player).walk_y = hotspot->feet_y;
_G(player).walk_facing = hotspot->facing;
_hotspot = nullptr;
return SELECTED;
} else {
return IN_CONTROL;
}
}
void Interface::dispatch_command() {
--_savedX;
cstrncpy(_G(player).verb, _verbText, 40);
cstrncpy(_G(player).noun, _nounText, 40);
cstrncpy(_G(player).prep, _prepText, 40);
_G(player).waiting_for_walk = true;
_G(player).ready_to_walk = true;
_G(player).need_to_walk = true;
_G(player).command_ready = true;
_G(kernel).trigger = -1;
_G(kernel).trigger_mode = KT_PREPARSE;
_iconSelected = false;
mouse_set_sprite(_arrow);
_G(player).walker_trigger = -1;
g_engine->_activeRoom->pre_parser();
g_engine->_activeSection->pre_parser();
g_engine->global_pre_parser();
}
void Interface::handleState(ControlStatus status) {
int highlight = _inventory->_highlight;
int index = _inventory->_scroll + highlight;
switch (status) {
case NOTHING:
_hotspot = nullptr;
cstrncpy(_nounText, " ", 40);
_textField->set_string(" ");
break;
case OVER_CONTROL:
if (highlight < -1 || (highlight != -1 && (
highlight < 128 || highlight > 129))) {
_hotspot = nullptr;
cstrncpy(_nounText, _inventory->_items[index]._name.c_str(), 40);
if (g_engine->getLanguage() == Common::EN_ANY) {
_textField->set_string(_inventory->_items[index]._name.c_str());
} else {
_textField->set_string(_inventory->_items[index]._verb.c_str());
}
}
break;
case SELECTED:
if (highlight != -1 && _inventory->_items[index]._cell != -1) {
if (_iconSelected) {
_hotspot = nullptr;
cstrncpy(_nounText, _inventory->_items[index]._name.c_str(), 40);
if (g_engine->getLanguage() == Common::EN_ANY) {
_textField->set_string(_inventory->_items[index]._name.c_str());
} else {
_textField->set_string(_inventory->_items[index]._verb.c_str());
}
term_message("got %d", index);
dispatch_command();
_G(player).ready_to_walk = true;
_G(player).need_to_walk = false;
_G(player).waiting_for_walk = false;
} else {
_hotspot = nullptr;
cstrncpy(_verbText, _inventory->_items[index]._name.c_str(), 40);
if (g_engine->getLanguage() == Common::EN_ANY) {
_textField->set_string(_inventory->_items[index]._name.c_str());
} else {
_textField->set_string(_inventory->_items[index]._verb.c_str());
}
mouse_set_sprite(_inventory->_items[index]._cursor);
_iconSelected = true;
}
}
break;
default:
break;
}
}
void Interface::l_cb() {
if (player_commands_allowed() && INTERFACE_VISIBLE) {
Common::strcpy_s(_verbText, "look at");
mouse_set_sprite(_look);
_iconSelected = true;
_G(cursor_state) = kLOOK;
}
}
void Interface::u_cb() {
if (player_commands_allowed() && INTERFACE_VISIBLE) {
Common::strcpy_s(_verbText, "gear");
mouse_set_sprite(_use);
_iconSelected = true;
_G(cursor_state) = kUSE;
}
}
void Interface::t_cb() {
if (player_commands_allowed() && INTERFACE_VISIBLE) {
Common::strcpy_s(_verbText, "take");
mouse_set_sprite(_grab);
_iconSelected = true;
_G(cursor_state) = kTAKE;
}
}
void Interface::a_cb() {
if (player_commands_allowed() && INTERFACE_VISIBLE) {
Common::strcpy_s(_verbText, "<><><><><><><><>");
mouse_set_sprite(_arrow);
_iconSelected = false;
_G(cursor_state) = kARROW;
if (_hotspot && !mouse_set_sprite(_hotspot->cursor_number))
mouse_set_sprite(kArrowCursor);
}
}
} // namespace GUI
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,96 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_INTERFACE_H
#define M4_BURGER_INTERFACE_H
#include "m4/adv_r/adv_interface.h"
#include "m4/adv_r/adv_hotspot.h"
#include "m4/graphics/graphics.h"
#include "m4/graphics/gr_buff.h"
#include "m4/burger/gui/inventory.h"
namespace M4 {
namespace Burger {
namespace GUI {
struct Interface : public M4::Interface {
private:
void setup();
void trackIcons();
ControlStatus trackHotspots(int event, int x, int y);
void dispatch_command();
void handleState(ControlStatus status);
public:
int _sprite = 22; // main_interface_sprite;
bool _shown = false;
GUI::InterfaceBox *_interfaceBox = nullptr;
GUI::Inventory *_inventory = nullptr;
GUI::TextField *_textField = nullptr;
GUI::ButtonClass *_btnTake = nullptr;
GUI::ButtonClass *_btnManipulate = nullptr;
GUI::ButtonClass *_btnHandle = nullptr;
GUI::ButtonClass *_btnAbductFail = nullptr;
GUI::ButtonClass *_btnMenu = nullptr;
GUI::ButtonClass *_btnScrollLeft = nullptr;
GUI::ButtonClass *_btnScrollRight = nullptr;
const HotSpotRec *_hotspot = nullptr;
int _savedX = 0, _savedY = 0;
char _prepText[40] = { 0 };
char _nounText[40] = { 0 };
char _verbText[40] = { 0 };
bool _iconSelected = false;
int _state = 0;
Interface();
~Interface() override;
bool init(int arrow, int wait, int look, int grab, int use) override;
void cancel_sentence() override;
void freshen_sentence() override;
bool set_interface_palette(RGB8 *myPalette) override;
void track_hotspots_refresh() override;
bool eventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) override;
void show() override;
void refresh_right_arrow();
void refresh_left_arrow();
void l_cb();
void u_cb();
void t_cb();
void a_cb();
};
} // namespace Interface
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,289 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/gui/inventory.h"
#include "m4/burger/vars.h"
#include "m4/core/errors.h"
#include "m4/graphics/gr_line.h"
#include "m4/graphics/gr_series.h"
#include "m4/gui/gui_vmng_screen.h"
namespace M4 {
namespace Burger {
namespace GUI {
Inventory::Inventory(const RectClass &r, int32 sprite, int16 cells_h, int16 cells_v, int16 cell_w, int16 cell_h, int16 tag)
: RectClass(r) {
_sprite = sprite;
for (int16 iter = 0; iter < INVENTORY_CELLS_COUNT; iter++) {
_items[iter]._cell = -1;
_items[iter]._cursor = -1;
}
_num_cells = 0;
_tag = tag;
_cells_h = cells_h;
_cells_v = cells_v;
_cell_w = cell_w;
_cell_h = cell_h;
// If requested cell configuration doesn't fit, blow up.
if ((cells_h * cell_w > (_x2 - _x1)) || (cells_v * cell_h > (_y2 - _y1))) {
error_show(FL, 'CGIC');
}
_highlight = -1;
_must_redraw_all = true;
_must_redraw1 = -1;
_must_redraw2 = -1;
_scroll = 0;
_right_arrow_visible = false;
}
Inventory::~Inventory() {
}
bool Inventory::add(const Common::String &name, const Common::String &verb, int32 invSprite, int32 cursor) {
// Don't add something twice
for (int16 iter = 0; iter < _num_cells; iter++) {
if (name.equals(_items[iter]._name))
return true;
}
if (_num_cells >= INVENTORY_CELLS_COUNT) {
error_show(FL, 'CGIA');
return false;
}
// Shift existing items up by one
for (int i = _num_cells; i > 0; --i)
_items[i] = _items[i - 1];
Entry &item = _items[0];
item._name = name;
item._verb = verb;
item._cell = invSprite;
item._cursor = cursor;
++_num_cells;
_must_redraw_all = true;
if (_GI(visible))
_G(interface).show();
return true;
}
bool Inventory::need_left() const {
return (_scroll != 0);
}
bool Inventory::need_right() const {
if ((_num_cells - _scroll - MAX_INVENTORY) > 0)
return true;
return false;
}
void Inventory::set_scroll(int32 new_scroll) {
_scroll = new_scroll;
_must_redraw_all = true;
}
bool Inventory::remove(const Common::String &name) {
for (int16 iter = 0; iter < _num_cells; iter++) {
// Found the thing?
if (name.equals(_items[iter]._name)) {
// Eat up its slot by moving everything down
for (; iter < _num_cells; ++iter)
_items[iter] = _items[iter + 1];
--_num_cells;
_must_redraw_all = true;
_scroll = 0;
if (_GI(visible))
_G(interface).show();
return true;
}
}
// Didn't find that thing.
return false;
}
int16 Inventory::inside(int16 x, int16 y) const {
if ((x < _x1) || (x >= (_x2 - 1)) || (y < _y1 + 2) ||
(y > _y1 + _cells_v * _cell_h - 2))
return -1;
x -= _x1;
y -= _y1;
return (int16)((x / _cell_w) * _cells_v + (y / _cell_h));
}
int16 Inventory::cell_pos_x(int16 index) {
if (_cells_h > _cells_v) { // Horizontal orientation, fill left to right
return (int16)((index / _cells_v) * _cell_w);
} else { // Vertical orientation, fill top to bottom
return (int16)((index / _cells_h) * _cell_w);
}
}
int16 Inventory::cell_pos_y(int16 index) {
if (_cells_h > _cells_v) {
// Horizontal orientation, fill left to right
return (int16)((index % _cells_v) * _cell_h);
} else {
// Vertical orientation, fill top to bottom
return (int16)((index % _cells_h) * _cell_h);
}
}
void Inventory::highlight_part(int16 index) {
if (_highlight == index)
return;
_must_redraw1 = _highlight;
_highlight = index;
_must_redraw2 = _highlight;
}
void Inventory::draw(GrBuff *myBuffer) {
if (!_GI(visible))
return;
if (!_must_redraw1 && !_must_redraw2 && !_must_redraw_all)
return;
int16 cell_iter;
Buffer *myBuff = myBuffer->get_buffer();
if (_must_redraw_all) {
gr_color_set(__BLACK);
gr_buffer_rect_fill(myBuff, _x1, _y1, _x2 - _x1, _y2 - _y1);
}
_right_arrow_visible = false;
for (cell_iter = 0; (cell_iter + _scroll < _num_cells) && (cell_iter < MAX_INVENTORY); cell_iter++) {
int16 left = (int16)(_x1 + cell_pos_x(cell_iter));
int16 top = (int16)(_y1 + cell_pos_y(cell_iter));
int16 leftOffset = left + _cell_w;
int16 topOffset = top + _cell_h;
if (_must_redraw1 == cell_iter || _must_redraw2 == cell_iter || _must_redraw_all) {
// This does the button update....
_G(interface).refresh_right_arrow();
_G(interface).refresh_left_arrow();
// Draw icon here
gr_color_set(__BLACK);
gr_buffer_rect_fill(myBuff, left, top, leftOffset - left, topOffset - top);
series_show_frame(_sprite, _items[cell_iter + _scroll]._cell, myBuff,
left + (_cell_w - 31) / 2, top + (_cell_h - 31) / 2);
// Draw box around icon
if (_highlight == cell_iter) {
left += 2;
top += 20;
gr_line(left, top, left + 35, top, __GREEN, myBuff);
gr_line(left + 35, top, left + 35, top + 35, __GREEN, myBuff);
gr_line(left, top, left, top + 35, __GREEN, myBuff);
gr_line(left, top + 35, left + 35, top + 35, __GREEN, myBuff);
}
}
}
// Draw inventory slot frames
for (cell_iter = 0; cell_iter < MAX_INVENTORY; ++cell_iter) {
series_show_frame(_sprite, 67, myBuff, cell_iter * 39 + 188, 22);
series_show_frame(_sprite, 68, myBuff, cell_iter * 39 + 188, 92);
}
ScreenContext *iC = vmng_screen_find(_G(gameInterfaceBuff), nullptr);
RestoreScreensInContext(_x1, _y1, _x2, _y2, iC);
_must_redraw1 = _must_redraw2 = -1;
_must_redraw_all = false;
myBuffer->release();
}
ControlStatus Inventory::track(int32 eventType, int16 x, int16 y) {
if (!_GI(visible))
return NOTHING;
ControlStatus result = NOTHING;
int16 over = inside(x, y);
bool button_clicked = eventType == _ME_L_click || eventType == _ME_L_hold || eventType == _ME_L_drag;
// If Button is pressed
if (button_clicked) {
// If we are not tracking, start tracking
if (interface_tracking == -1) {
highlight_part(over);
interface_tracking = over;
result = IN_CONTROL;
} else {
// Else if we are over something we are tracking
if (interface_tracking == over) {
highlight_part(over);
result = IN_CONTROL;
} else {
// Else highlight nothing
highlight_part(-1);
result = NOTHING;
}
}
} else {
// If Button isn't pressed
// If we unpressed on something we were tracking
if (interface_tracking == over) {
if (interface_tracking == -1)
result = NOTHING;
else
result = SELECTED;
} else {
if (over + _scroll < _num_cells)
result = OVER_CONTROL;
else
result = NOTHING;
}
// Stop tracking anything
highlight_part(over);
interface_tracking = -1;
}
if (result == NOTHING && button_clicked)
return TRACKING;
return result;
}
} // namespace GUI
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,99 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_GUI_INVENTORY_H
#define M4_BURGER_GUI_INVENTORY_H
#include "m4/gui/gui_cheapo.h"
namespace M4 {
namespace Burger {
namespace GUI {
using namespace M4::GUI;
constexpr int16 INVENTORY_CELLS_COUNT = 128;
constexpr int16 ARROW_WIDTH = 8;
constexpr int16 MAX_INVENTORY = 9;
constexpr int16 LEFT_ARROW_TAG = 128;
constexpr int16 RIGHT_ARROW_TAG = 129;
constexpr int16 LEFT_ARROW_TAG_DORMANT = 130;
constexpr int16 RIGHT_ARROW_TAG_DORMANT = 134;
constexpr int16 LEFT_ARROW_TAG_ROLL = 131;
constexpr int16 RIGHT_ARROW_TAG_ROLL = 135;
constexpr int16 LEFT_ARROW_TAG_DOWN = 132;
constexpr int16 RIGHT_ARROW_TAG_DOWN = 136;
constexpr int16 LEFT_ARROW_TAG_NONFUNC = 133;
constexpr int16 RIGHT_ARROW_TAG_NONFUNC = 137;
class Inventory : public RectClass {
struct Entry {
Common::String _name;
Common::String _verb;
int16 _cell = -1;
int16 _cursor = -1;
};
private:
int32 _sprite = 0;
int16 _tag = 0;
int16 _num_cells = 0;
bool _right_arrow_visible = false;
int16 cell_pos_x(int16 index);
int16 cell_pos_y(int16 index);
int16 interface_tracking = -1;
public:
int16 _scroll = 0;
int16 _cells_h = 0, _cells_v = 0;
int16 _cell_w = 0, _cell_h = 0;
int16 _must_redraw1 = 0, _must_redraw2 = 0;
int16 _highlight = 0;
bool _must_redraw_all = false;
Entry _items[INVENTORY_CELLS_COUNT];
public:
Inventory(const RectClass &r, int32 sprite, int16 cells_h, int16 cells_v, int16 cell_w, int16 cell_h, int16 tag);
~Inventory();
void draw(GrBuff *interface_buffer);
int16 inside(int16 x, int16 y) const override;
ControlStatus track(int32 eventType, int16 x, int16 y);
bool add(const Common::String &name, const Common::String &verb, int32 cel, int32 cursor);
bool remove(const Common::String &name);
void highlight_part(int16 index);
bool need_left() const;
bool need_right() const;
void set_scroll(int32 new_scroll);
};
} // namespace GUI
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,192 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/hotkeys.h"
#include "m4/burger/vars.h"
#include "m4/burger/gui/game_menu.h"
#include "m4/gui/gui_sys.h"
#include "m4/adv_r/other.h"
#include "m4/platform/keys.h"
namespace M4 {
namespace Burger {
Dialog *Hotkeys::_versionDialog;
Hotkeys::Hotkeys() : M4::Hotkeys() {
_versionDialog = nullptr;
}
void Hotkeys::add_hot_keys() {
M4::Hotkeys::add_hot_keys();
AddSystemHotkey(KEY_ALT_V, show_version);
AddSystemHotkey(KEY_CTRL_V, show_version);
AddSystemHotkey('t', t_cb);
AddSystemHotkey('u', u_cb);
AddSystemHotkey('l', l_cb);
AddSystemHotkey('T', t_cb);
AddSystemHotkey('U', u_cb);
AddSystemHotkey('L', l_cb);
AddSystemHotkey('A', l_cb);
AddSystemHotkey('S', t_cb);
AddSystemHotkey('D', u_cb);
AddSystemHotkey('a', l_cb);
AddSystemHotkey('s', t_cb);
AddSystemHotkey('d', u_cb);
AddSystemHotkey('F', a_cb);
AddSystemHotkey('f', a_cb);
}
void Hotkeys::toggle_through_cursors(CursorChange cursChange) {
cursor_states newCursor = kARROW;
switch (cursChange) {
case CURSCHANGE_NEXT:
newCursor = _G(cursor_state) == kUSE ? kARROW :
static_cast<cursor_states>((int)_G(cursor_state) + 1);
break;
case CURSCHANGE_PREVIOUS:
newCursor = _G(cursor_state) == kARROW ? kUSE :
static_cast<cursor_states>((int)_G(cursor_state) - 1);
break;
case CURSCHANGE_TOGGLE:
newCursor = (_G(cursor_state) == kARROW) ? kUSE : kARROW;
break;
default:
break;
}
switch (newCursor) {
case kARROW:
Hotkeys::a_cb(nullptr, nullptr);
break;
case kLOOK:
Hotkeys::l_cb(nullptr, nullptr);
break;
case kTAKE:
Hotkeys::t_cb(nullptr, nullptr);
break;
case kUSE:
Hotkeys::u_cb(nullptr, nullptr);
break;
default:
break;
}
}
void Hotkeys::escape_key_pressed(void *, void *) {
// Decide what to do depending on what kind of game is playing
switch (_G(executing)) {
case JUST_OVERVIEW:
// Stop playing the overview
_G(kernel).going = false;
break;
case INTERACTIVE_DEMO:
case MAGAZINE_DEMO:
if (_G(game).room_id == 901) {
// Already on the demo menu screen, so quit game
_G(kernel).going = false;
} else {
// In-game, so go back to demo menu screen
_G(game).setRoom(901);
}
break;
case WHOLE_GAME:
// The real thing is playing
switch (_G(game).room_id) {
case 902:
case 904:
case 951:
case 971:
// Switch to main menu
_G(game).setRoom(903);
break;
case 903:
// Quit game
_G(kernel).going = false;
break;
default:
if (player_commands_allowed()) {
// Bring up the main menu
other_save_game_for_resurrection();
GUI::CreateGameMenu(&_G(master_palette)[0]);
}
break;
}
break;
}
}
void Hotkeys::t_cb(void *, void *) {
g_vars->_interface.t_cb();
}
void Hotkeys::u_cb(void *, void *) {
g_vars->_interface.u_cb();
}
void Hotkeys::l_cb(void *, void *) {
g_vars->_interface.l_cb();
}
void Hotkeys::a_cb(void *, void *) {
g_vars->_interface.a_cb();
}
void Hotkeys::show_version(void *a, void *b) {
if (!_versionDialog) {
gr_font_set(_G(font_tiny));
_versionDialog = DialogCreateAbsolute(190, 35, 510, 105, 242);
_versionDialog->addButton(115, 52, " OK ", version_ok_button, 1);
_versionDialog->addMessage(10, 5, "Orion Burger", 1);
_versionDialog->addMessage(10, 15,
Common::String::format("Game Version %s - %s ",
"Nudibranchs", "May 7, 1996").c_str(), 2);
_versionDialog->addMessage(10, 25,
Common::String::format("M4 Library Version %s - %s ",
"v1.400 OB", "January 21, 1996").c_str(), 3);
_versionDialog->addMessage(10, 35,
"Copyright (c) 1996 by Sanctuary Woods Multimedia Corporation", 4);
Dialog_Configure(_versionDialog, 1, 1, 1);
vmng_screen_show(_versionDialog);
}
}
void Hotkeys::version_ok_button(void *a, void *b) {
_versionDialog->destroy();
_versionDialog = nullptr;
}
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,66 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_HOTKEYS_H
#define M4_BURGER_HOTKEYS_H
#include "m4/m4_types.h"
#include "m4/gui/hotkeys.h"
#include "m4/core/mouse.h"
namespace M4 {
namespace Burger {
struct Hotkeys : public M4::Hotkeys {
private:
static Dialog *_versionDialog;
private:
static void t_cb(void *, void *);
static void u_cb(void *, void *);
static void l_cb(void *, void *);
static void a_cb(void *, void *);
/**
* Show version dialog
*/
static void show_version(void *a, void *b);
static void version_ok_button(void *a, void *b);
public:
Hotkeys();
virtual ~Hotkeys() {}
/**
* Called when the Escape key is pressed
*/
static void escape_key_pressed(void *, void *);
void add_hot_keys() override;
void toggle_through_cursors(CursorChange cursChange = CURSCHANGE_NEXT) override;
};
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,110 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/adv_r/adv_inv.h"
#include "m4/burger/inventory.h"
#include "m4/burger/vars.h"
#include "m4/burger/burger.h"
namespace M4 {
namespace Burger {
struct InvObject {
const char *_name;
const char *_germanName;
const char *_frenchName;
int32 _scene, _cel, _cursor;
};
static const InvObject INVENTORY_ITEMS[] = {
{ "money", "GELD", "ARGENT", 998, 55, 55},
{ "block of ice", "EISBLOCK", "GLA\xc7ON", 142, 51, 51},
{ "pantyhose", "STRUMPFHOSE", "COLLAN", 142, 45, 45},
{ "phone bill", "TELEFONRECHNUNG", "FACTURE DE TELEPHONE", 170, 49, 49},
{ "whistle", "PFEIFE", "SIFFLET", 170, 40, 40},
{ "carrot juice", "M\xd6""HRENSAFT", "JUS DE CAROTTES", 172, 25, 25},
{ "deed", "URKUNDE", "ACTE DE VENTE", 105, 38, 38},
{ "laxative", "ABF\xdcHRMITTEL", "LAXATIF", 174, 54, 54},
{ "amplifier", "VERST\xc4""RKER", "AMPLIFICATEUR", 145, 34, 34},
{ "jawz o' life", "KLEMMBACKE", "LA TRON\xc7ONNEUSE", 137, 37, 37},
{ "broken puz dispenser", "Bonbonspender,kaputt", "BOITE A PEZ CASSEE", 176, 16, 16},
{ "spring", "SPRUNGFEDER", "RESSORT", 999, 47, 47},
{ "puz dispenser", "BONBONSPENDER", "BOITE A PEZ", 999, 17, 17},
{ "broken mouse trap", "KAPUTTE MAUSEFALLE", "PIEGE A SOURIS CASSE", 143, 18, 18},
{ "keys", "SCHL\xdc""SSEL", "CLEFS", 138, 31, 31},
{ "ray gun", "STRAHLENPISTOLE", "PISTOLET A LASER", 604, 50, 50},
{ "kibble", "TROCKENFUTTER", "CROQUETTES", 602, 44, 44},
{ "burger morsel", "HAMBURGERST\xdc""CK", "MOR\xc7""EAU DE BURGER", 999, 39, 39},
{ "matches", "STREICHH\xd6""LZER", "ALLUMETTES", 999, 42, 42},
{ "jug", "KRUG", "PICHET", 303, 14, 14},
{ "distilled carrot juice", "DESTILLIERTER SAFT", "CAROTTES DISTILLE", 999, 15, 15},
{ "gizmo", "GER\xc4""T", "GIZMO", 999, 58, 58},
{ "kindling", "ANZ\xdc""NDHOLZ", "PETIT BOIS", 999, 20, 20},
{ "burning kindling", "BRENNENDES HOLZ", "PETIT BOIS ENFLAMME", 999, 21, 21},
{ "christmas lights", "LICHTERKETTE", "LUMIERES DE NO\xebL", 508, 22, 22},
{ "christmas lights ", "LICHTERKETTE", "LUMIERES DE NO\xebL", 508, 23, 23 },
{ "bottle", "FLASCHE", "BOUTEILLE", 999, 24, 24},
{ "soapy water", "SEIFENWASSER", "EAU DE BAIN", 999, 26, 26},
{ "rubber gloves", "GUMMIHANDSCHUHE", "GANTS DE CAOUTCHOUC", 503, 35, 35},
{ "dirty sock", "DRECKIGE SOCKE", "CHAUSSETTE SALE", 504, 36, 36},
{ "rubber ducky", "GUMMIENTCHEN", "CANARD DE BAIN", 507, 53, 53},
{ "rolling pin", "NUDELHOLZ", "ROULEAU A PATISSERIE", 999, 52, 52},
{ "fish", "FISCH", "POISSON", 999, 29, 29},
{ "hook", "HAKEN", "CROCHET", 999, 30, 30},
{ "quarter", "VIERTELDOLLAR", "PIECE", 999, 41, 41},
{ "dog collar", "HUNDEHALSBAND", "COLLIER POUR CHIEN", 999, 33, 33},
{ "records", "SCHALLPLATTEN", "DISQUES", 405, 32, 32},
{ "mirror", "SPIEGEL", "MIROIR", 999, 48, 48},
{ nullptr, nullptr, nullptr, 0, 0, 0 }
};
void Inventory::init() {
bool isFrench = g_engine->getLanguage() == Common::FR_FRA;
for (const InvObject *item = INVENTORY_ITEMS; item->_name; ++item) {
const char *foreignName = isFrench ? item->_frenchName : item->_germanName;
inv_register_thing(item->_name, foreignName, item->_scene, item->_cel, item->_cursor);
_items.push_back(InventoryItem(item->_name, item->_scene));
}
}
void Inventory::add(const Common::String &name, const Common::String &verb, int32 sprite, int32 cursor) {
_GI(inventory)->add(name, verb, sprite, cursor);
_GI(inventory)->_must_redraw_all = true;
}
void Inventory::set_scroll(int32 scroll) {
_GI(inventory)->set_scroll(scroll);
}
void Inventory::remove(const Common::String &name) {
_GI(inventory)->remove(name);
_GI(inventory)->_must_redraw_all = true;
}
void Inventory::reset() {
for (const InvObject *item = INVENTORY_ITEMS; item->_name; ++item)
inv_move_object(item->_name, item->_scene);
}
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,58 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_INVENTORY_H
#define M4_BURGER_INVENTORY_H
#include "common/array.h"
#include "m4/m4_types.h"
#include "m4/adv_r/adv_inv.h"
namespace M4 {
namespace Burger {
struct InventoryItem {
const char *_asset = nullptr;
const char *_name = nullptr;
int _scene = 0;
InventoryItem() {}
InventoryItem(const char *name, int scene) : _asset(name), _name(name), _scene(scene) {}
};
struct Inventory : public InventoryBase {
public:
Common::Array<InventoryItem> _items;
public:
void init();
virtual ~Inventory() {}
void add(const Common::String &name, const Common::String &verbs, int32 sprite, int32 cursor) override;
void set_scroll(int32 scroll) override;
void remove(const Common::String &name) override;
void reset();
};
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,51 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/other.h"
#include "m4/core/errors.h"
#include "m4/burger/vars.h"
#include "m4/m4.h"
namespace M4 {
namespace Burger {
static void other_fade_me_out(int32 trigger) {
pal_fade_init(&_G(master_palette)[0], 0, 255, 0, 30, trigger);
}
void other_resurrect_player() {
KernelTriggerType old_mode;
if (!g_engine->autosaveExists())
error_show(FL, 'Burg', "Couldn't resume game");
_G(kernel).restore_slot = 0;
old_mode = _G(kernel).trigger_mode;
_G(kernel).trigger_mode = KT_DAEMON;
other_fade_me_out(TRIG_RESTORE_GAME);
_G(kernel).trigger_mode = old_mode;
player_set_commands_allowed(false);
}
} // namespace Burger
} // namespace M4

34
engines/m4/burger/other.h Normal file
View File

@@ -0,0 +1,34 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_GUI_OTHER_H
#define M4_BURGER_GUI_OTHER_H
namespace M4 {
namespace Burger {
void other_resurrect_player();
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,94 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/rooms/room.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
HotSpotRec Room::_wilburHotspot;
char Room::_wilburName[16];
char Room::_wilburVerb = 0;
void Room::setWilburHotspot() {
Common::strcpy_s(_wilburName, "Wilbur");
_wilburHotspot.clear();
_wilburHotspot.vocab = _wilburName;
_wilburHotspot.verb = &_wilburVerb;
_wilburHotspot.feet_x = 0x7fff;
_wilburHotspot.feet_y = 0x7fff;
_wilburHotspot.cursor_number = kArrowCursor;
}
HotSpotRec *Room::custom_hotspot_which(int32 x, int32 y) {
if (!_G(player).walker_in_this_scene || !_G(player).walker_visible)
return nullptr;
player_update_info();
int y2 = _G(player_info).y - (_G(player_info).scale * 75 / 100);
int y1 = _G(player_info).y - (_G(player_info).scale * 150 / 100);
int xSize = _G(player_info).scale * 22 / 100;
if (y > y2 || y <= y1 || imath_abs(x - _G(player_info).x) >= xSize)
return nullptr;
return &_wilburHotspot;
}
void Room::npc_say(const char *digiName, int trigger, const char *seriesName,
int layer, bool shadow, int firstFrame, int lastFrame, int digiSlot, int digiVol) {
term_message("npc_say: %s npc_series: %s npc_trigger: %d",
digiName, seriesName, trigger);
_G(npcTrigger) = trigger;
if (seriesName) {
_G(npcSpeech1) = series_play(seriesName, layer, 4, -1, 6, -1, 100, 0, 0, firstFrame, lastFrame);
if (shadow) {
char temp[20];
Common::strcpy_s(temp, 20, seriesName);
Common::strcat_s(temp, 20, "s");
_G(npcSpeech2) = series_play(temp, layer + 1, 4, -1, 6, -1, 100, 0, 0, firstFrame, lastFrame);
}
}
kernel_trigger_dispatch_now(kNPC_SPEECH_STARTED);
KernelTriggerType oldMode = _G(kernel).trigger_mode;
_G(kernel).trigger_mode = KT_DAEMON;
digi_play(digiName, digiSlot, digiVol, kNPC_SPEECH_FINISHED);
_G(kernel).trigger_mode = oldMode;
}
void Room::npc_say(int trigger, const char *seriesName, int layer, bool shadow,
int firstFrame, int lastFrame, int digiSlot, int digiVol) {
npc_say(conv_sound_to_play(), trigger, seriesName, layer, shadow,
firstFrame, lastFrame, digiSlot, digiVol);
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,74 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_ROOM_H
#define M4_BURGER_ROOMS_ROOM_H
#include "m4/core/rooms.h"
#include "m4/burger/core/play_break.h"
#include "m4/burger/core/stream_break.h"
#include "m4/burger/core/conv.h"
#include "m4/adv_r/conv_io.h"
#include "m4/core/imath.h"
#include "m4/graphics/gr_series.h"
#include "m4/adv_r/adv_hotspot.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room : public M4::Room {
private:
static char _wilburName[16];
static char _wilburVerb;
protected:
static HotSpotRec _wilburHotspot;
Series _roomSeries1;
Series _general;
public:
static void setWilburHotspot();
public:
Room() : M4::Room() {}
~Room() override {}
/**
* Used to tell if x,y is over the walker hotspot
*/
HotSpotRec *custom_hotspot_which(int32 x, int32 y) override;
void compact_mem_and_report() {}
void npc_say(const char *digiName, int trigger = -1, const char *seriesName = nullptr,
int layer = 0, bool shadow = true, int firstFrame = 0, int lastFrame = -1,
int digiSlot = 1, int digiVol = 255);
void npc_say(int trigger = -1, const char *seriesName = nullptr,
int layer = 0, bool shadow = true, int firstFrame = 0, int lastFrame = -1,
int digiSlot = 1, int digiVol = 255);
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,148 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/rooms/section.h"
#include "m4/gui/gui_vmng.h"
#include "m4/burger/vars.h"
#include "m4/m4.h"
namespace M4 {
namespace Burger {
namespace Rooms {
void Section::global_room_init() {
int roomId = _G(game).room_id;
if (roomId <= 800)
_GINT().show();
else
_GINT().hide();
// Disable commands for certain rooms
if (roomId == 201 || roomId == 301 || roomId == 306 || roomId == 307 ||
roomId == 401 || roomId == 501 || roomId == 511 || roomId == 512 ||
roomId == 513 || roomId == 601 || roomId == 605 || roomId == 606 ||
roomId == 608 || roomId == 609 || roomId == 610 || roomId == 801 ||
roomId == 902) {
player_set_commands_allowed(false);
}
if (roomId >= 950 || roomId == 902)
mouse_hide();
else
mouse_show();
// Do stuff that needs to be done each time a scene is started
init_series_players();
// Preload digi sounds
if (_G(player).walker_in_this_scene) {
switch (roomId) {
case 102:
case 103:
case 105:
case 134:
case 135:
case 143:
case 174:
case 175:
case 176:
case 304:
case 505:
case 506:
case 507:
case 509:
case 602:
case 603:
case 604:
case 612: {
static const char *NAMES[] = {
"fs_wood1", "fs_wood2", "fs_wood3", "fs_wood4", "fs_wood5", nullptr
};
_G(digi).loadFootstepSounds(NAMES);
break;
}
case 106:
case 139:
case 144:
case 145:
case 302:
case 303:
case 305: {
static const char *NAMES[] = {
"fs_dirt1", "fs_dirt2", "fs_dirt3", "fs_dirt4", "fs_dirt5", nullptr
};
_G(digi).loadFootstepSounds(NAMES);
break;
}
case 310:
case 311:
case 312:
case 313:
case 314:
case 315:
case 316:
case 317:
case 318:
case 319: {
static const char *NAMES[] = {
"fs_mine1", "fs_mine2", "fs_mine3", "fs_mine4", "fs_mine5", nullptr
};
_G(digi).loadFootstepSounds(NAMES);
break;
}
default: {
static const char *NAMES[] = {
"fs_hard1", "fs_hard2", "fs_hard3", "fs_hard4", "fs_hard5", nullptr
};
_G(digi).loadFootstepSounds(NAMES);
break;
}
}
}
if (_G(executing) == WHOLE_GAME) {
kernel_timing_trigger(900, kAdvanceHour, nullptr);
kernel_timing_trigger(300, kAdvanceTime, nullptr);
}
}
void Section::init_series_players() {
_G(seriesPlayers).clear();
}
void Section::tick() {
int oldTrigger = _G(kernel).trigger;
_G(kernel).trigger = kCALLED_EACH_LOOP;
g_engine->game_daemon_code();
_G(kernel).trigger = oldTrigger;
}
void Section::daemon() {
_G(kernel).continue_handling_trigger = true;
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,48 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION_H
#define M4_BURGER_ROOMS_SECTION_H
#include "m4/core/rooms.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Section : public M4::Section {
private:
void init_series_players();
public:
Section() : M4::Section() {}
~Section() override {}
void global_room_init() override;
void tick() override;
void daemon() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,848 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room101.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
#include "m4/core/imath.h"
namespace M4 {
namespace Burger {
namespace Rooms {
static const seriesStreamBreak STREAM_BREAKS1[] = {
{ 0, nullptr, 2, 255, 4, 0, nullptr, 0 },
{ 5, nullptr, 2, 255, 4, 0, nullptr, 0 },
{ 14, nullptr, 2, 255, 4, 0, nullptr, 0 },
{ 16, nullptr, 1, 255, 11, 0, nullptr, 0 },
STREAM_BREAK_END
};
static const seriesStreamBreak STREAM_BREAKS2[] = {
{ 0, nullptr, 2, 255, 4, 0, nullptr, 0 },
{ 6, nullptr, 2, 255, 5, 0, nullptr, 0 },
{ 17, nullptr, 2, 255, 4, 0, nullptr, 0 },
{ 24, nullptr, 2, 255, 4, 0, nullptr, 0 },
{ 26, nullptr, 1, 255, 14, 0, nullptr, 0 },
STREAM_BREAK_END
};
static const seriesStreamBreak STREAM_BREAKS3[] = {
{ 0, nullptr, 2, 255, 4, 0, nullptr, 0 },
{ 5, nullptr, 2, 255, 4, 0, nullptr, 0 },
{ 14, nullptr, 2, 255, 4, 0, nullptr, 0 },
{ 16, nullptr, 1, 255, 17, 0, nullptr, 0 },
STREAM_BREAK_END
};
static const seriesStreamBreak STREAM_BREAKS4[] = {
{ 0, nullptr, 2, 255, 4, 0, nullptr, 0 },
{ 7, nullptr, 2, 255, 4, 0, nullptr, 0 },
{ 13, nullptr, 1, 255, 20, 0, nullptr, 0 },
STREAM_BREAK_END
};
static const seriesStreamBreak STREAM_BREAKS5[] = {
{ 0, "100_010", 1, 255, -1, 0, nullptr, 0 },
{ 19, "100_011", 1, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
static const seriesStreamBreak STREAM_BREAKS6[] = {
{ 9, nullptr, 2, 255, 4, 0, nullptr, 0 },
{ 19, nullptr, 2, 255, 4, 0, nullptr, 0 },
{ 28, nullptr, 2, 255, 4, 0, nullptr, 0 },
{ 32, nullptr, 1, 255, 8, 0, nullptr, 0 },
STREAM_BREAK_END
};
static const seriesPlayBreak PLAY_BREAKS1[] = {
{ 0, 10, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 11, -1, "101_004", 2, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY_BREAKS2[] = {
{ 0, 2, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 3, -1, "102_038", 1, 100, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY_BREAKS3[] = {
{ 0, 8, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 9, -1, "101_002", 1, 100, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY_BREAKS4[] = {
{ 0, 6, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 7, 9, "101w005", 1, 255, -1, 0, 0, nullptr, 0 },
{ 10, -1, nullptr, 1, 255, kCHANGE_WILBUR_ANIMATION, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const char *SAID1[][4] = {
{ "BARBERSHOP", nullptr, "101W003", "101W003" },
{ "DOOR", "101W006", nullptr, nullptr },
{ "FIRE ESCAPE", "101W004", nullptr, nullptr },
{ "TOWN HALL", nullptr, "101W003", nullptr },
{ "ALLEY", nullptr, "101W003", nullptr },
{ "VERA'S DINER", nullptr, "101W003", nullptr },
{ "OLD BRIDGE", nullptr, "101W003", nullptr },
{ "HARDWARE STORE", "101W006b", "101W003", "101W003" },
{ "BANK", "101W007", "101W003", "101W003" },
{ "THEATRE", "101W008", "101W003", "101W003" },
{ "POLICE STATION", "101W009", "101W003", "101W003" },
{ "PET AND FEED STORE", "101W010", "101W003", "101W011" },
{ "FIRE STATION", "101W012", "101W003", "101W003" },
{ "FIRE HYDRANT", "101W013", "101W003", nullptr },
{ "PICKUP TRUCK", "101W015", "101W003", "101W016" },
{ nullptr, nullptr, nullptr, nullptr }
};
void Room101::init() {
_val1 = 255;
digi_stop(1);
digi_preload("101_001");
_G(kernel).call_daemon_every_loop = true;
if (_G(game).previous_room != 102)
door();
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
// Do nothing
break;
case 102:
// Exiting barber shop
player_set_commands_allowed(false);
if (_G(flags)[V014]) {
_G(flags)[V014] = 0;
ws_demand_facing(_G(my_walker), 10);
ws_demand_location(_G(my_walker), 338, 265);
_G(wilbur_should) = 16;
} else {
ws_demand_facing(_G(my_walker), 4);
ws_demand_location(_G(my_walker), 264, 259);
_G(wilbur_should) = 10;
}
ws_hide_walker(_G(my_walker));
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 103:
// Returning from rooftop
player_set_commands_allowed(false);
ws_demand_facing(_G(my_walker), 1);
ws_demand_location(_G(my_walker), 197, 276);
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 6;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 104:
// From Town Hall
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 106:
// Leaving alley
_G(wilbur_should) = 3;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 134:
case 135:
// From Old Bridge
_G(wilbur_should) = 4;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 142:
// From Vera's Diner
_G(wilbur_should) = 5;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
// Have been beamed down
ws_demand_location(_G(my_walker), 320, 271);
ws_demand_facing(_G(my_walker), 5);
if (_G(game).previous_section > 1) {
if (_G(flags)[kFirstTestPassed]) {
ws_demand_location(_G(my_walker), 280, 309);
ws_demand_facing(_G(my_walker), 8);
player_set_commands_allowed(false);
}
kernel_timing_trigger(60, 6);
}
break;
}
digi_play_loop("101_001", 3, 200, -1);
}
void Room101::daemon() {
if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
player_update_info(_G(my_walker), &_G(player_info));
if (_G(player_info).y > 374 && player_said("old bridge")) {
// Changing to Old Bridge
player_set_commands_allowed(false);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, GOTO_OLD_BRIDGE);
_G(kernel).call_daemon_every_loop = false;
} else if (_G(player_info.y < 205) && player_said("town hall")) {
// Changing to Town Hall
player_set_commands_allowed(false);
pal_fade_init(_G(master_palette), 16, 255, 0, 30, GOTO_TOWN_HALL);
_G(kernel).call_daemon_every_loop = false;
}
}
switch (_G(kernel).trigger) {
case 1:
if (_val2 == 12) {
const int frame = imath_ranged_rand(8, 10);
series_play("101ha01", 3840, 0, 1, 6, 0, 100, 0, 0, frame, frame);
} else {
digi_preload("101_002");
series_play("101ha01", 3840, 0, 21, 6, 0, 100, 0, 0, 11, 13);
}
break;
case 2:
// Finished gathering items from past tests
digi_stop(2);
unloadSounds();
player_set_commands_allowed(true);
ws_unhide_walker(_G(my_walker));
break;
case 4:
digi_play(Common::String::format("101_0%d", imath_ranged_rand(10, 17)).c_str(), 2, 255, -1);
break;
case 5:
digi_play("101_017", 2, 255, -1);
break;
case 6:
if (!_G(flags)[kFirstTestPassed]) {
// No tests passed yet
const uint idx = _G(flags)[kNEURO_TEST_COUNTER];
assert(idx < 8);
static const char *const NAMES[8] = {
"101w500", "101w500", "101w501", "101w502",
"101w503", "101w504", "101w505", "101w506"
};
_G(walker).wilbur_speech(NAMES[idx], 23);
} else if (!_G(flags)[kSecondTestPassed]) {
// Second test failed
if (_G(flags)[V242] <= 1) {
// Oh well, at least I passed the first test
_G(walker).wilbur_speech("101w520", 7);
} else if (_G(flags)[V249] && !_G(flags)[kKnowHowToNukeGerbils]) {
// I know how to nuke those mutant gerbils
_G(walker).wilbur_speech("101w522", 7);
_G(flags)[kKnowHowToNukeGerbils] = 1;
} else if (_G(flags)[V248] && !_G(flags)[kGerbilsAreNasty]) {
// Those mutant gerbils are nasty
_G(walker).wilbur_speech("101w521", 7);
_G(flags)[kGerbilsAreNasty] = 1;
} else {
// Sigh...
_G(walker).wilbur_speech("101w524", 7);
}
} else if (!_G(flags)[kThirdTestPassed]) {
// Third test failed
if (_G(flags)[V100] <= 1) {
_G(walker).wilbur_speech("101w530", 7);
} else if (!_G(flags)[V113] && !_G(flags)[kGetRidOfPerkins]) {
// Need to get rid of Perkins
_G(walker).wilbur_speech("101w531", 7);
_G(flags)[kGetRidOfPerkins] = 1;
} else if (_G(flags)[V113] && !_G(flags)[kNeedToFindBurger]) {
// Gotten rid of Perkins, need to find burger
_G(walker).wilbur_speech("101w533", 7);
_G(flags)[kNeedToFindBurger] = 1;
} else if (_G(flags)[V113] && _G(flags)[V100] >= 5 &&
!_G(flags)[kAmplifyMySenses]) {
// Amplify my senses? Hmmm..
_G(walker).wilbur_speech("101w534", 7);
_G(flags)[kAmplifyMySenses] = 1;
} else {
_G(walker).wilbur_speech("101w532", 7);
}
} else if (!_G(flags)[kFourthTestPassed]) {
// Fourth test failed
switch (_G(flags)[V185]) {
case 0:
case 1:
_G(walker).wilbur_speech("101w550", 7);
break;
case 2:
_G(walker).wilbur_speech("101w552", 7);
break;
default:
if (_G(flags)[V194] && !_G(flags)[ROOM101_FLAG19]) {
_G(walker).wilbur_speech("101w551", 7);
_G(flags)[ROOM101_FLAG19] = 1;
} else {
kernel_timing_trigger(60, 7);
}
break;
}
} else if (!_G(flags)[kFifthTestPassed]) {
// Fifth test failed
switch (_G(flags)[V153]) {
case 0:
case 1:
_G(walker).wilbur_speech("101w570", 7);
break;
case 2:
_G(walker).wilbur_speech("101w571", 7);
break;
default:
kernel_timing_trigger(60, 7);
break;
}
} else {
kernel_trigger_dispatch_now(7);
}
break;
case 7:
loadSounds();
ws_hide_walker(_G(my_walker));
if (_G(flags)[kSecondTestPassed] || _G(flags)[kFourthTestPassed])
series_load("101wi13s", -1, nullptr);
if (_G(flags)[kThirdTestPassed])
series_load("101wi12s", -1, nullptr);
if (_G(flags)[kFifthTestPassed])
series_load("101wi11s", -1, nullptr);
_machine1 = series_play("101wi14s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
_machine2 = series_stream_with_breaks(STREAM_BREAKS6, "101wi14", 6, 0x100, 2);
break;
case 8:
kernel_timing_trigger(1, 9);
break;
case 9:
daemon9();
if (_G(flags)[kSecondTestPassed] || _G(flags)[V250] ||
_G(flags)[V280] || _G(flags)[V002]) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
kernel_trigger_dispatch_now(10);
}
break;
case 10:
_machine1 = series_play("101wi13s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
_machine2 = series_stream_with_breaks(STREAM_BREAKS1, "101wi13", 6, 0x100, 2);
break;
case 11:
kernel_timing_trigger(1, 12);
break;
case 12:
daemon12();
if (_G(flags)[kSecondTestPassed]) {
if (_G(flags)[kThirdTestPassed] || _G(flags)[kPerkinsLostIsland] ||
_G(flags)[V080] || _G(flags)[V126]) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
kernel_timing_trigger(1, 13);
}
}
break;
case 13:
_machine1 = series_play("101wi12s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
_machine2 = series_stream_with_breaks(STREAM_BREAKS2, "101wi12", 6, 0x100, 2);
break;
case 14:
kernel_timing_trigger(1, 15);
break;
case 15:
daemon15();
if (_G(flags)[kThirdTestPassed] && (_G(flags)[kFourthTestPassed] || _G(flags)[V220])) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
kernel_timing_trigger(1, 16);
}
break;
case 16:
_machine1 = series_play("101wi13s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
_machine2 = series_stream_with_breaks(STREAM_BREAKS3, "101wi13", 6, 0x100, 2);
break;
case 17:
kernel_timing_trigger(1, 18);
break;
case 18:
daemon18();
if (_G(flags)[kFourthTestPassed]) {
if (_G(flags)[kFifthTestPassed] || _G(flags)[V220]) {
terminateMachineAndNull(_machine1);
terminateMachineAndNull(_machine2);
kernel_timing_trigger(1, 19);
}
}
break;
case 19:
_machine1 = series_play("101wi11s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, -1);
_machine2 = series_stream_with_breaks(STREAM_BREAKS4, "101wi11", 6, 0x100, 2);
break;
case 20:
daemon20();
break;
case 21:
digi_play("101_002", 2, 255, -1);
_G(wilbur_should) = 18;
series_play("101ha01", 3840, 0, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 14, -1);
break;
case 23:
player_set_commands_allowed(true);
break;
case 24:
if (_G(player_info).x < 218 || (_G(player_info).x < 349 && _G(player_info).y > 277)) {
kernel_trigger_dispatch_now(27);
} else {
digi_preload_stream_breaks(STREAM_BREAKS5);
series_stream_with_breaks(STREAM_BREAKS5, "101dt01", 6, 1024, 25);
}
break;
case 25:
_val1 -= 10;
if (_val1 > 0) {
digi_change_volume(2, _val1);
kernel_timing_trigger(3, 25);
} else {
digi_stop(1);
digi_unload_stream_breaks(STREAM_BREAKS5);
digi_stop(2);
digi_unload("100_013");
player_set_commands_allowed(true);
_val1 = 255;
}
break;
case 26:
door();
_G(walker).reset_walker_sprites();
digi_preload_stream_breaks(STREAM_BREAKS5);
series_stream_with_breaks(STREAM_BREAKS5, "101dt01", 6, 1, 25);
break;
case 27:
terminateMachineAndNull(_doorMachine);
Section1::updateWalker(226, 281, 8, 26);
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 2:
player_set_commands_allowed(true);
ws_demand_location(_G(my_walker), 336, 184);
ws_demand_facing(_G(my_walker), 5);
ws_walk(_G(my_walker), 335, 195, nullptr, -1, 5);
break;
case 3:
player_set_commands_allowed(true);
ws_demand_location(_G(my_walker), 482, 208);
ws_demand_facing(_G(my_walker), 9);
ws_walk(_G(my_walker), 410, 218, nullptr, -1, 9);
break;
case 4:
player_set_commands_allowed(true);
ws_demand_location(_G(my_walker), 224, 373);
ws_demand_facing(_G(my_walker), 2);
ws_walk(_G(my_walker), 282, 342, nullptr, -1, 2);
break;
case 5:
player_set_commands_allowed(true);
ws_demand_location(_G(my_walker), 0, 288);
ws_demand_facing(_G(my_walker), 3);
ws_walk(_G(my_walker), 30, 288, nullptr, -1, 3);
break;
case 6:
_G(wilbur_should) = 7;
series_play_with_breaks(PLAY_BREAKS1, "101wi05", 0x100, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
case 7:
ws_unhide_walker(_G(my_walker));
player_set_commands_allowed(true);
break;
case 8:
// Barbershop door open
_G(wilbur_should) = 9;
terminateMachineAndNull(_doorMachine);
series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 9:
// Fade out for switching to Barbershop
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1002);
break;
case 10:
_G(wilbur_should) = 11;
series_play_with_breaks(PLAY_BREAKS3, "101wi02", 0x100, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
case 11:
case 18:
door();
ws_unhide_walker(_G(my_walker));
player_set_commands_allowed(true);
break;
case 14:
terminateMachineAndNull(_doorMachine);
_G(wilbur_should) = 15;
series_play_with_breaks(PLAY_BREAKS2, "101wi01", 3072, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 15:
_G(wilbur_should) = 16;
digi_play("101h001", 1, 255, kCHANGE_WILBUR_ANIMATION);
break;
case 16:
_G(wilbur_should) = 17;
series_play_with_breaks(PLAY_BREAKS2, "101wi03", 3072, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 17:
_G(wilbur_should) = 19;
_val2 = 12;
if (_G(flags)[V005]) {
const Common::String name = Common::String::format("101h003%c", 'a' + imath_ranged_rand(0, 5));
digi_play(name.c_str(), 1, 255, kCHANGE_WILBUR_ANIMATION);
} else {
digi_play("101h002", 1, 255, kCHANGE_WILBUR_ANIMATION);
_G(flags)[V005] = 1;
}
series_play("101ha01", 3840, 0, 1, 6, 0, 100, 0, 0, 0, 7);
break;
case 19:
_val2 = 13;
break;
case 20:
_G(wilbur_should) = 21;
series_play_with_breaks(PLAY_BREAKS4, "101wi04", 0x100, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, -53);
break;
case 21:
_G(wilbur_should) = 22;
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1003);
break;
case 22:
series_play("101wi04", 0x100, 0, -1, 10, -1, 100, 0, -53, 16, 16);
series_play("101wi04s", 0x100, 0, -1, 10, -1, 100, 0, -53, 16, 16);
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
case kBurlEntersTown:
if (_G(flags)[kRoadOpened]) {
_G(kernel).continue_handling_trigger = true;
} else if (player_commands_allowed() && _G(player).walker_visible &&
INTERFACE_VISIBLE && !digi_play_state(1)) {
Section1::updateDisablePlayer();
digi_preload("100_013");
digi_play("100_013", 2, 255, -1);
kernel_timing_trigger(240, 24);
} else {
kernel_timing_trigger(60, kBurlEntersTown);
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room101::pre_parser() {
const bool lookAt = player_said_any("look", "look at");
if (player_said("vera's diner") && !player_said_any("enter", "gear", "look", "look at"))
player_hotspot_walk_override_just_face(9);
if (player_said("alley") && !player_said_any("enter", "gear", "look", "look at"))
player_hotspot_walk_override_just_face(3);
_G(kernel).call_daemon_every_loop = player_said("ENTER", "OLD BRIDGE") ||
player_said("gear", "old bridge") ||
player_said("old bridge") ||
player_said("ENTER", "TOWN HALL") ||
player_said("gear", "town hall") ||
(lookAt && player_said("town hall"));
}
void Room101::parser() {
const bool lookFlag = player_said_any("look", "look at");
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(walker).wilbur_said(SAID1)) {
// Nothing
} else if (player_said("ENTER", "DOOR") || player_said("gear", "door")) {
if (_G(flags)[V012] == 2) {
player_set_commands_allowed(false);
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 8;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (_G(flags)[V013]) {
ws_demand_location(_G(my_walker), 338, 265);
ws_demand_facing(_G(my_walker), 10);
ws_hide_walker(_G(my_walker));
player_set_commands_allowed(false);
_G(wilbur_should) = 14;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
player_set_commands_allowed(false);
ws_hide_walker(_G(my_walker));
_G(wilbur_should) = 8;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("ENTER", "FIRE ESCAPE") || player_said("gear", "fire escape")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 20;
ws_hide_walker(_G(my_walker));
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("ENTER", "TOWN HALL") || player_said("gear", "town hall") ||
(lookFlag && player_said("town hall"))) {
player_set_commands_allowed(false);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1004);
} else if (player_said("ENTER", "ALLEY") || player_said("gear", "alley") ||
(lookFlag && player_said("alley"))) {
player_set_commands_allowed(false);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1006);
} else if (player_said("ENTER", "OLD BRIDGE") || player_said("gear", "old bridge") ||
(lookFlag && player_said("old bridge"))) {
player_set_commands_allowed(false);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1008);
} else if (player_said("ENTER", "VERA'S DINER") || player_said("gear", "vera's diner") ||
(lookFlag && player_said("vera's diner"))) {
player_set_commands_allowed(false);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1014);
} else if (inv_player_has(_G(player).verb) &&
player_said_any("alley", "town hall", "vera's diner", "old bridge")) {
_G(walker).wilbur_speech("101w003");
} else if (inv_player_has(_G(player).verb) && player_said("fire hydrant")) {
_G(walker).wilbur_speech("101w014");
} else if (lookFlag && player_said("barbershop")) {
_G(walker).wilbur_speech(_G(flags)[V013] ? "101w002" : "101w001");
} else {
return;
}
_G(player).command_ready = false;
}
void Room101::door() {
_doorMachine = series_play("101door", 3840, 0, -1, 10, -1, 100, 0, -53, 0, 0);
}
void Room101::loadSounds() {
digi_preload("101_010");
digi_preload("101_011");
digi_preload("101_012");
digi_preload("101_013");
digi_preload("101_014");
digi_preload("101_015");
digi_preload("101_016");
digi_preload("101_017");
}
void Room101::unloadSounds() {
digi_unload("101_010");
digi_unload("101_011");
digi_unload("101_012");
digi_unload("101_013");
digi_unload("101_014");
digi_unload("101_015");
digi_unload("101_016");
digi_unload("101_017");
}
void Room101::daemon9() {
_G(flags)[V019] = 1;
_G(flags)[V017] = 1;
if (_G(flags)[V021] == 10032)
_G(flags)[V001] = 12;
if (_G(flags)[V021] == 10033)
_G(flags)[V013] = 1;
_G(flags).set_boonsville_time(600);
}
void Room101::daemon12() {
if (_G(flags)[V250] || _G(flags)[kSecondTestPassed])
inv_give_to_player("BLOCK OF ICE");
if (_G(flags)[V280] || _G(flags)[kSecondTestPassed])
inv_give_to_player("PANTYHOSE");
if (_G(flags)[V002]) {
inv_give_to_player("PHONE BILL");
inv_give_to_player("WHISTLE");
_G(flags)[V079] = 0;
_G(flags)[V080] = 1;
}
_G(flags).set_boonsville_time(2400);
}
void Room101::daemon15() {
if (_G(flags)[V002] || !_G(flags)[V126] || _G(flags)[kThirdTestPassed]) {
inv_give_to_player("PHONE BILL");
inv_give_to_player("WHISTLE");
_G(flags)[V079] = 0;
_G(flags)[V080] = 1;
} else {
_G(flags)[V079] = 1;
_G(flags)[V080] = 0;
}
if (_G(flags)[V126] || _G(flags)[kThirdTestPassed]) {
inv_give_to_player("CARROT JUICE");
_G(flags)[V088] = 1;
_G(flags)[V091] = 1;
} else {
_G(flags)[V088] = 0;
_G(flags)[V091] = 0;
}
if (_G(flags)[V113] || _G(flags)[kThirdTestPassed]) {
_G(flags).set_boonsville_time(6001);
_G(flags)[V000] = 1002;
_G(flags)[V001] = 0;
inv_move_object("MONEY", NOWHERE);
_G(flags)[V039] = 1;
_G(flags)[kRoadOpened] = 1;
inv_give_to_player("DEED");
_G(flags)[kPerkinsLostIsland] = 1;
} else {
_G(flags)[V000] = 1000;
if (_G(flags)[V021] == 10032)
_G(flags)[V001] = 12;
_G(flags)[V039] = 0;
_G(flags)[kRoadOpened] = 0;
_G(flags)[kTourBusAtDiner] = 0;
}
_G(flags)[V063] = 0;
_G(flags)[V092] = 0;
if (_G(flags)[kThirdTestPassed])
_G(flags).set_boonsville_time(6600);
}
void Room101::daemon18() {
if (_G(flags)[V220] || _G(flags)[kFourthTestPassed]) {
inv_give_to_player("laxative");
inv_give_to_player("amplifier");
_G(flags)[kDrumzFled] = 1;
_G(flags)[kTourBusAtDiner] = 1;
_G(flags).set_boonsville_time(19200);
}
}
void Room101::daemon20() {
if (_G(flags)[V177] || _G(flags)[kFifthTestPassed]) {
inv_move_object("KEYS", 138);
inv_give_to_player("JAWZ O' LIFE");
_G(flags)[V046] = 0;
}
_G(flags)[kPoliceState] = 0;
_G(flags)[kPoliceCheckCtr] = 0;
_G(flags).set_boonsville_time(22800);
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,62 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM101_H
#define M4_BURGER_ROOMS_SECTION1_ROOM101_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room101 : public Room {
private:
int _val1 = 0;
int _val2 = 0;
machine *_doorMachine = nullptr;
machine *_machine1 = nullptr;
machine *_machine2 = nullptr;
void door();
void loadSounds();
void unloadSounds();
void daemon9();
void daemon12();
void daemon15();
void daemon18();
void daemon20();
public:
Room101() : Room() {}
~Room101() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,90 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM102_H
#define M4_BURGER_ROOMS_SECTION1_ROOM102_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room102 : public Room {
private:
int _val1 = 0;
int _val3 = -1;
int32 _val4 = 0;
int _val5 = 0;
int _val6 = 0;
int _val8 = 0;
int _val9 = 0;
uint32 _val10 = 99999;
int _harryMode = 0;
int _harryShould = 0;
int _wilburChairShould = 0;
int _wilburChairMode = 0;
int _val16 = 0;
int _trigger = -1;
KernelTriggerType _triggerMode = KT_DAEMON;
machine *_series1 = nullptr;
machine *_series1s = nullptr;
machine *_series3 = nullptr;
Series _wilburChair;
machine *_series6 = nullptr;
machine *_series7 = nullptr;
machine *_laz1 = nullptr;
machine *_laz2 = nullptr;
machine *_stream1 = nullptr;
int _index1 = 0, _index2 = 0;
int _index3 = 0, _index4 = 0;
int _index5 = 0;
const char *_play1 = nullptr;
bool _flag1 = false;
void setup(int val1 = 0, int val2 = 1);
void setupWax();
void setupLaz();
const char *getDigi1(int num) const;
const char *getDigi2(int num) const;
void freeWilburChair();
void queuePlay(const char *filename, int trigger = 29, KernelTriggerType triggerMode = KT_DAEMON);
void freshen();
void conv04();
void conv05();
void conv06();
void flagAction(const char *name1, const char *name2);
public:
Room102() : Room() {}
~Room102() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,684 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room103.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
enum {
kCHANGE_CROW1_ANIMATION = 10,
kCHANGE_CROW2_ANIMATION = 11,
kCHANGE_CROW3_ANIMATION = 12,
kCHANGE_CROW4_ANIMATION = 13,
kCHANGE_HARRY_ANIMATION = 20
};
static const char *SAID[][4] = {
{ "SATELLITE DISH", "103W001", "103W002", nullptr },
{ "FIRE ESCAPE", "103W005", "103W006", nullptr },
{ "SCARECROW", "103W008", "103W009", "103W009" },
{ "DOOR", "103W010", "103W011", nullptr },
{ "STAIRWAY", "103W010", "103W011", nullptr },
{ "AIR VENT", "103W013", "103W014", "103W015" },
{ nullptr, nullptr, nullptr, nullptr }
};
const seriesStreamBreak Room103::SERIES1[] = {
{ 0, "103_004", 2, 255, -1, 0, nullptr, 0 },
{ 5, nullptr, 2, 255, -1, 2048, nullptr, 0 },
{ 7, "103_007", 2, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
const seriesStreamBreak Room103::SERIES2[] = {
{ 13, "103_006", 2, 125, -1, 0, nullptr, 0 },
{ 19, nullptr, 1, 125, 6, 0, nullptr, 0 },
{ 54, nullptr, 1, 125, 16, 0, nullptr, 0 },
{ -1, nullptr, 0, 0, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
const seriesStreamBreak Room103::SERIES3[] = {
{ 5, "103_005", 2, 255, -1, 0, &_val0, 0 },
STREAM_BREAK_END
};
const seriesStreamBreak Room103::SERIES4[] = {
{ 7, "103_002", 2, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
static const seriesPlayBreak PLAY1[] = {
{ 1, 15, nullptr, 2, 255, -1, 0, 0, nullptr, 0 },
{ 16, -1, "103_004", 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY2[] = {
{ 0, 0, "103_002", 2, 100, -1, 0, 0, nullptr, 0 },
{ 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 2, 2, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 1, 1, "103_002", 2, 100, -1, 0, 0, nullptr, 0 },
{ 0, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 1, 1, "103_002", 2, 100, -1, 0, 0, nullptr, 0 },
{ 0, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 2, 2, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 1, 1, "103_002", 2, 100, -1, 0, 0, nullptr, 0 },
{ 0, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY3[] = {
{ 0, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 2, 2, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 0, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 0, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 2, 2, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 0, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 1, 1, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY4[] = {
{ 0, 0, "103_006", 2, 255, -1, 0, 0, nullptr, 0 },
{ 0, 5, "103h006", 1, 255, 23, 0, 0, nullptr, 0 },
{ 6, 11, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
int32 Room103::_val0 = 0;
void Room103::init() {
_flag1 = false;
_val2 = 0;
_val3 = 0;
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
// WORKAROUND: If you save a game after moving the satellite dish, but before Harry arrives,
// restoring the save wouldn't have Harry arrive, and you'd softlock trying to leave the roof
_G(flags)[kHarryComingToRoof] = 0;
break;
case 101:
ws_demand_location(327, 178, 7);
_G(flags)[V012] = 0;
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 1;
digi_preload_stream_breaks(SERIES1);
series_play("103wi01s", 0x100);
series_stream_with_breaks(SERIES1, "103wi01", 6, 0xa00, 10016);
break;
default:
ws_demand_location(320, 271, 5);
break;
}
if (_G(flags)[kHarryComingToRoof]) {
_series1 = series_play("103wi06", 0x500, 0, -1, 100, -1, 100, 0, 0, 0, 0);
} else {
_series1 = series_play("103wi05", 0x500, 0, -1, 100, -1, 100, 0, 0, 0, 0);
}
_series2 = series_play("103door", 0x800, 0, -1, 100, -1, 100, 0, 0, 0, 0);
series_play("103vent", 0x100, 0, -1, 6, -1, 100, 0, 0, 0, 3);
_crow1Should = 12;
kernel_trigger_dispatch_now(kCHANGE_CROW1_ANIMATION);
_crow3Should = 19;
kernel_trigger_dispatch_now(kCHANGE_CROW3_ANIMATION);
_crow4Should = 21;
kernel_trigger_dispatch_now(kCHANGE_CROW4_ANIMATION);
digi_play_loop("103_001", 3, 60);
}
void Room103::daemon() {
switch (_G(kernel).trigger) {
case 1:
term_message("death timer");
if (_flag1) {
term_message("++");
if (++_val7 < 5 || (_val2 != 0 && _val2 != 2)) {
kernel_timing_trigger(60, 1);
} else if (_val2 == 2) {
kernel_timing_trigger(1, 3);
player_set_commands_allowed(false);
_flag1 = false;
term_message("left");
} else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
term_message("caught");
kernel_timing_trigger(1, 8);
intr_freshen_sentence();
Section1::walk();
player_set_commands_allowed(false);
_flag1 = false;
} else {
term_message("again");
kernel_timing_trigger(60, 1);
}
}
break;
case 2:
if (++_val0 >= 5) {
static const char *NAMES[7] = {
"103h002a", "103h002b", "103h002c", "103h002d",
"103h002e", "103h002f", "103h002g"
};
assert(_digi1 >= 1 && _digi1 <= 7);
digi_play(NAMES[_digi1 - 1], 2, 255, 1);
} else {
kernel_timing_trigger(60, 2);
}
break;
case 3:
terminateMachineAndNull(_series2);
series_load("103ha03");
series_load("103ha03s");
digi_preload("103H005");
digi_preload_stream_breaks(SERIES2);
series_play("103ha01s", 0x201);
series_stream_with_breaks(SERIES2, "103ha01", 6, 0x200, 4);
break;
case 4:
digi_unload_stream_breaks(SERIES2);
series_play_with_breaks(PLAY2, "103ha03", 0x200, 9, 3, 12);
break;
case 6:
digi_play("103H005", 1, 255, 7);
break;
case 7:
_G(flags)[kHarryComingToRoof] = 0;
_G(flags)[V009] = _G(flags).get_boonsville_time_and_display() + 1800;
_G(flags)[V012] = 2;
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1001);
break;
case 8:
player_update_info();
digi_stop(1);
if ((_G(player_info).x > 391 && _G(player_info).y < 321) ||
(_G(player_info).x > 490 && _G(player_info).y < 374) ||
(_G(player_info).x > 215 && _G(player_info).y < 267) ||
(_G(player_info).y < 224)) {
ws_walk(271, 265, nullptr, 19, 2);
term_message("walk to caught");
} else {
kernel_timing_trigger(1, 19);
term_message("don't walk to caught");
}
break;
case 9:
series_play_with_breaks(PLAY3, "103ha03", 0x201, 9, 3, 12);
series_play_with_breaks(PLAY2, "103ha03", 0x200, 9, 3, 12);
break;
case kCHANGE_CROW1_ANIMATION:
switch (_crow1Should) {
case 12:
if (imath_ranged_rand(1, 3) == 1) {
Series::series_play("103cr01", 0x100, 0, kCHANGE_CROW1_ANIMATION, 30, 0, 100, 0, 0, 1, 2);
} else {
Series::series_play("103cr01", 0x100, 0, kCHANGE_CROW1_ANIMATION, 60, 0, 100, 0, 0, 0, 0);
}
break;
case 13:
switch (imath_ranged_rand(1, 8)) {
case 1:
_crow1Should = 12;
Series::series_play("103cr01", 0x100, 2, kCHANGE_CROW1_ANIMATION, 30, 0, 100, 0, 0, 1, 2);
break;
case 3:
Series::series_play("103cr01", 0x100, 0, kCHANGE_CROW1_ANIMATION, 6, 0, 100, 0, 0, 7, 15);
break;
case 4:
case 5:
_crow1Should = 14;
Series::series_play("103cr01", 0x100, 0, kCHANGE_CROW1_ANIMATION, 30, 0, 100, 0, 0, 3, 4);
break;
default:
Series::series_play("103cr01", 0x100, 0, kCHANGE_CROW1_ANIMATION, 60, 0, 100, 0, 0, 2, 2);
break;
}
break;
case 14:
if (imath_ranged_rand(1, 4) == 1) {
_crow1Should = 13;
Series::series_play("103cr01", 0x100, 0, kCHANGE_CROW1_ANIMATION, 6, 0, 100, 0, 0, 5, 15);
} else {
Series::series_play("103cr01", 0x100, 0, kCHANGE_CROW1_ANIMATION, 60, 0, 100, 0, 0, 4, 4);
}
break;
default:
break;
}
break;
case kCHANGE_CROW2_ANIMATION:
switch (_crow2Should) {
case 15:
if (imath_ranged_rand(1, 4) == 1) {
_crow2Should = 16;
series_play("103cr02", 0x100, 0, kCHANGE_CROW2_ANIMATION, 30, 0, 100, 0, 0, 1, 2);
series_play("103cr02s", 0x100, 0, -1, 30, 0, 100, 0, 0, 1, 2);
} else {
series_play("103cr02", 0x100, 0, kCHANGE_CROW2_ANIMATION, 70, 0, 100, 0, 0, 0, 0);
series_play("103cr02s", 0x100, 0, -1, 70, 0, 100, 0, 0, 0, 0);
}
break;
case 16:
switch (imath_ranged_rand(1, 5)) {
case 1:
_crow2Should = 15;
series_play("103cr02", 0x100, 2, kCHANGE_CROW2_ANIMATION, 30, 0, 100, 0, 0, 1, 2);
series_play("103cr02s", 0x100, 2, -1, 30, 0, 100, 0, 0, 1, 2);
break;
case 2:
_crow2Should = 17;
series_play("103cr02", 0x100, 0, kCHANGE_CROW2_ANIMATION, 30, 0, 100, 0, 0, 3, 4);
series_play("103cr02s", 0x100, 0, -1, 30, 0, 100, 0, 0, 3, 4);
break;
default:
series_play("103cr02", 0x100, 0, kCHANGE_CROW2_ANIMATION, 70, 0, 100, 0, 0, 2, 2);
series_play("103cr02s", 0x100, 0, -1, 70, 0, 100, 0, 0, 2, 2);
break;
}
break;
case 17:
switch (imath_ranged_rand(1, 6)) {
case 1:
_crow2Should = 16;
series_play("103cr02", 0x100, 2, 11, 30, 0, 100, 0, 0, 3, 4);
series_play("103cr02s", 0x100, 2, -1, 30, 0, 100, 0, 0, 3, 4);
break;
case 2:
_crow2Should = 18;
series_play("103cr02", 0x100, 0, 11, 30, 0, 100, 0, 0, 5, 8);
series_play("103cr02s", 0x100, 0, -1, 30, 0, 100, 0, 0, 5, 8);
break;
default:
series_play("103cr02", 0x100, 0, 11, 70, 0, 100, 0, 0, 4, 4);
series_play("103cr02s", 0x100, 0, -1, 70, 0, 100, 0, 0, 4, 4);
break;
}
break;
case 18:
if (imath_ranged_rand(1, 4) == 1) {
_crow2Should = 17;
series_play("103cr02", 0x100, 0, 11, 30, 0, 100, 0, 0, 9, 12);
series_play("103cr02s", 0x100, 0, -1, 30, 0, 100, 0, 0, 9, 12);
} else {
series_play("103cr02", 0x100, 0, 11, 70, 0, 100, 0, 0, 8, 8);
series_play("103cr02s", 0x100, 0, -1, 70, 0, 100, 0, 0, 8, 8);
}
break;
default:
break;
}
break;
case kCHANGE_CROW3_ANIMATION:
switch (_crow3Should) {
case 19:
if (imath_ranged_rand(1, 4) == 1) {
_crow3Should = 20;
series_play("103cr03", 0x100, 0, kCHANGE_CROW3_ANIMATION, 30, 0, 100, 0, 0, 1, 2);
series_play("103cr03s", 0x100, 0, -1, 30, 0, 100, 0, 0, 1, 2);
} else {
series_play("103cr03", 0x100, 0, kCHANGE_CROW3_ANIMATION, 80, 0, 100, 0, 0, 0, 0);
series_play("103cr03s", 0x100, 0, -1, 80, 0, 100, 0, 0, 0, 0);
}
break;
case 20:
switch (imath_ranged_rand(1, 6)) {
case 1:
_crow3Should = 19;
series_play("103cr03", 0x100, 0, kCHANGE_CROW3_ANIMATION, 80, 0, 100, 0, 0, 4, 4);
series_play("103cr03s", 0x100, 0, -1, 80, 0, 100, 0, 0, 4, 4);
break;
case 3:
series_play("103cr03", 0x100, 0, kCHANGE_CROW3_ANIMATION, 80, 0, 100, 0, 0, 2, 2);
series_play("103cr03s", 0x100, 0, -1, 80, 0, 100, 0, 0, 2, 2);
break;
default:
series_play("103cr03", 0x100, 0, kCHANGE_CROW3_ANIMATION, 80, 0, 100, 0, 0, 3, 3);
series_play("103cr03s", 0x100, 0, -1, 80, 0, 100, 0, 0, 3, 3);
break;
}
break;
default:
break;
}
break;
case kCHANGE_CROW4_ANIMATION:
switch (_crow4Should) {
case 21:
switch (imath_ranged_rand(1, 6)) {
case 1:
series_play("103cr04", 0x100, 0, kCHANGE_CROW4_ANIMATION, 6, 0, 100, 0, 0, 5, 9);
series_play("103cr04s", 0x100, 0, -1, 6, 0, 100, 0, 0, 5, 9);
break;
case 2:
_crow4Should = 22;
series_play("103cr04", 0x100, 0, kCHANGE_CROW4_ANIMATION, 30, 0, 100, 0, 0, 1, 2);
series_play("103cr04s", 0x100, 0, -1, 30, 0, 100, 0, 0, 1, 2);
break;
default:
series_play("103cr04", 0x100, 0, kCHANGE_CROW4_ANIMATION, 90, 0, 100, 0, 0, 0, 0);
series_play("103cr04s", 0x100, 0, -1, 90, 0, 100, 0, 0, 0, 0);
break;
}
break;
case 22:
if (imath_ranged_rand(1, 4) == 1) {
_crow4Should = 21;
series_play("103cr04", 0x100, 2, kCHANGE_CROW4_ANIMATION, 30, 0, 100, 0, 0, 0, 1);
series_play("103cr04s", 0x100, 2, -1, 30, 0, 100, 0, 0, 0, 1);
} else {
series_play("103cr04", 0x100, 0, kCHANGE_CROW4_ANIMATION, 90, 0, 100, 0, 0, 0, 2);
series_play("103cr04s", 0x100, 0, -1, 90, 0, 100, 0, 0, 2, 2);
}
break;
default:
break;
}
break;
case 14:
_digi1 = imath_ranged_rand(1, 7);
preloadDigi1();
_G(flags)[kDisableFootsteps] = 1;
if (_G(flags)[V024]) {
player_set_commands_allowed(true);
kernel_timing_trigger(60, 2);
} else {
wilbur_speech("103w003", 15);
}
_G(flags)[kHarryComingToRoof] = 1;
_G(flags)[V024] = 1;
_flag1 = true;
_val7 = 0;
_val0 = 0;
break;
case 15:
player_set_commands_allowed(true);
kernel_timing_trigger(1, 2);
break;
case 16:
terminateMachineAndNull(_series1);
break;
case 17:
_G(flags)[kHarryComingToRoof] = 0;
_G(wilbur_should) = 6;
_G(flags)[kDisableFootsteps] = 0;
ws_walk(325, 173, nullptr, 10016);
break;
case 19:
_G(flags)[kDisableFootsteps] = 1;
terminateMachineAndNull(_series2);
series_play_with_breaks(PLAY4, "103ha02", 0x100, kCHANGE_HARRY_ANIMATION, 2, 10, 100, 0, 0);
_frame = 10;
_harryShould = 9;
break;
case kCHANGE_HARRY_ANIMATION:
switch (_harryShould) {
case 9:
if (imath_ranged_rand(1, 2) == 1) {
if (++_frame >= 17)
_frame = 15;
} else {
if (--_frame <= 10)
_frame = 12;
}
series_play("103ha02", 0x101, 0, kCHANGE_HARRY_ANIMATION, 10, 0, 100, 0, 0, _frame, _frame);
break;
case 10:
series_play("103ha02", 0x101, 0, 22, 6, 0, 100, 0, 0, 17, 22);
break;
default:
break;
}
break;
case 21:
_harryShould = 10;
kernel_timing_trigger(1, 24);
break;
case 22:
series_play("103ha02", 0x101, 0, -1, 6, -1, 100, 0, 0, 22, 22);
break;
case 23:
if (_G(flags)[V010] == 2 || _G(flags)[V013]) {
switch (imath_ranged_rand(1, 3)) {
case 1:
digi_play("103h008a", 1, 255, 21);
break;
case 2:
digi_play("103h008b", 1, 255, 21);
break;
case 3:
digi_play("103h008c", 1, 255, 21);
break;
default:
break;
}
} else {
digi_play("103h007", 1, 255, 21);
}
_G(flags)[V009] = _G(flags).get_boonsville_time_and_display() + 1800;
_G(flags)[V012] = 2;
ws_walk(271, 265, nullptr, 24, 2);
break;
case 24:
if (++_val3 > 1) {
wilbur_speech("103w004", 17, -1, 0, 75);
_G(flags)[V013] = 1;
}
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
digi_unload_stream_breaks(SERIES1);
player_set_commands_allowed(true);
ws_unhide_walker();
_G(wilbur_should) = 10002;
break;
case 2:
ws_hide_walker();
_G(wilbur_should) = 3;
digi_preload_stream_breaks(SERIES3);
series_play("103wi04s", 0x100, 0, -1, 6, 0, 100, 0, 0, 0, 9);
series_stream_with_breaks(SERIES3, "103wi04", 6, 0x100, kCHANGE_WILBUR_ANIMATION);
break;
case 3:
digi_unload_stream_breaks(SERIES3);
player_set_commands_allowed(true);
ws_unhide_walker();
_G(wilbur_should) = 10002;
wilbur_speech("103w012");
break;
case 4:
_G(wilbur_should) = 5;
terminateMachineAndNull(_series1);
ws_hide_walker();
series_play("103wi03s", 0x101, 0, -1, 6, 0, 100, 0, 0, 0, 19);
series_stream_with_breaks(SERIES4, "103wi03", 6, 0x100, kCHANGE_WILBUR_ANIMATION);
break;
case 5:
ws_unhide_walker();
_G(wilbur_should) = 10002;
_series1 = series_play("103wi06", 0x500, 0, -1, 100, -1, 100, 0, 0, 0, 0);
digi_play(Common::String::format("103h001%c",
'a' + imath_ranged_rand(0, 4)).c_str(), 2, 255, 14);
break;
case 6:
_G(wilbur_should) = 7;
kernel_timing_trigger(1, kCHANGE_WILBUR_ANIMATION);
break;
case 7:
_G(wilbur_should) = 8;
ws_hide_walker();
series_play_with_breaks(PLAY1, "103wi02", 0xa00, kCHANGE_WILBUR_ANIMATION, 2);
series_play("103wi02s", 0x100, 0, -1, 6, 0, 100, 0, 0, 0, 27);
player_set_commands_allowed(false);
break;
case 8:
_val2 = 2;
if (!_G(flags)[kHarryComingToRoof])
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1001);
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room103::pre_parser() {
if (player_said("gear", "satellite dish"))
player_hotspot_walk_override(225, 257, 8);
if (player_said("gear", "door") || player_said("gear", "stairway"))
player_hotspot_walk_override(391, 264, 1);
}
void Room103::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (!_G(walker).wilbur_said(SAID)) {
if (player_said("gear", "satellite dish") && _G(flags)[kHarryComingToRoof] == 0) {
_G(wilbur_should) = 4;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
_G(player).command_ready = false;
} else if (player_said("gear", "door") || player_said("gear", "stairway")) {
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
_G(player).command_ready = false;
} else if (player_said("ENTER", "FIRE ESCAPE") || player_said("gear", "FIRE ESCAPE")) {
_val2 = 1;
_G(wilbur_should) = 6;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
player_set_commands_allowed(false);
_G(player).command_ready = false;
}
} else {
_G(player).command_ready = false;
}
}
void Room103::preloadDigi1() {
const char *NAMES[7] = {
"103h002a", "103h002b", "103h002c", "103h002d",
"103h002e", "103h002f", "103h002g"
};
assert(_digi1 >= 1 && _digi1 <= 7);
digi_preload(NAMES[_digi1 - 1]);
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,68 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM103_H
#define M4_BURGER_ROOMS_SECTION1_ROOM103_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room103 : public Room {
static const seriesStreamBreak SERIES1[];
static const seriesStreamBreak SERIES2[];
static const seriesStreamBreak SERIES3[];
static const seriesStreamBreak SERIES4[];
private:
static int32 _val0;
bool _flag1 = false;
int _val2 = 0;
int _val3 = 0;
int _crow1Should = 0;
int _crow3Should = 0;
int _crow4Should = 0;
int _val7 = 0;
int _harryShould = 0;
int _crow2Should = 0;
int _frame = 0;
int _digi1 = 0;
machine *_series1 = nullptr;
machine *_series2 = nullptr;
void preloadDigi1();
public:
Room103() : Room() {}
~Room103() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,548 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room104.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/core/imath.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
enum {
kCHANGE_STOLIE_ANIMATION = 3
};
static const char *SAID1[][4] = {
{ "TOWN HALL", "104W001", "104W002", "104w002" },
{ "DOORS", "104W003", "104W002", nullptr },
{ "STOLIE", "104W004", "104W002", "104W002" },
{ "MAIN STREET", nullptr, "104W002", "104W002" },
{ "AUNT POLLY'S HOUSE", nullptr, "104W002", "104W002" },
{ nullptr, nullptr, nullptr, nullptr }
};
static const seriesPlayBreak PLAY1[] = {
{ 1, 3, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 4, 23, "104S101", 2, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY2[] = {
{ 18, 28, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 29, 47, "104_003", 2, 150, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
void Room104::init() {
_stolieSleepCtr = 0;
_stolieShould = 14;
_val3 = 0;
digi_preload("104_001");
switch (_G(game).previous_room) {
case 20:
break;
case 101:
_G(wilbur_should) = 1;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 105:
_G(wilbur_should) = 2;
digi_preload("104_005");
digi_play("104_005", 2, 255, 2);
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 107:
_G(wilbur_should) = 3;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 170:
_G(wilbur_should) = 4;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
ws_demand_location(213, 297, 5);
break;
}
static const char *NAMES[14] = {
"104W101", "104W100A", "104W100B", "104W100C", "104W100D",
"104W100E", "104W100F", "104W100G", "104s100a", "104s100b",
"104s100c", "104s100d", "104s100e", "104s101"
};
for (int i = 0; i < 14; ++i)
digi_preload(NAMES[i]);
digi_play_loop("104_001", 3, 200, -1);
_G(flags)[V028] = 1;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
}
void Room104::daemon() {
int frame, frameRate;
if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
player_update_info();
if (_G(player_info).y > 374) {
player_set_commands_allowed(false);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1001);
_G(kernel).call_daemon_every_loop = false;
}
}
switch (_G(kernel).trigger) {
case 1:
digi_play("104_006", 2, 255, 1005);
break;
case 2:
digi_unload("104_005");
break;
case kCHANGE_STOLIE_ANIMATION:
switch (_stolieShould) {
case 6:
_flag1 = false;
_stolieShould = 9;
Series::series_play("104dr04", 0x200, 2, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 0, 10);
break;
case 8:
_flag1 = false;
_stolieShould = 13;
Series::series_play("104dr04", 0x200, 2, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 0, 10);
break;
case 9:
_flag1 = false;
_stolieShould = 14;
Series::series_play("104dr02", 0x200, 0, kCHANGE_STOLIE_ANIMATION, 6, 0, 100, 0, 0, 0, 7);
break;
case 10:
digi_stop(2);
freeSeries();
_flag1 = true;
_series1.play("104DR04", 0x200, 16, 4, 6, 0, 100, 0, 0, 0, 10);
break;
case 12:
freeSeries();
_stolieShould = 10;
series_play_with_breaks(PLAY1, "104DR03", 0x200, kCHANGE_STOLIE_ANIMATION, 1);
break;
case 13:
_flag1 = false;
_stolieShould = 9;
series_play_with_breaks(PLAY2, "104dr01", 0x200, kCHANGE_STOLIE_ANIMATION, 1);
break;
case 14:
if (!digi_play_state(2)) {
if (imath_ranged_rand(1, 4) == 1) {
_stolieShould = 15;
Series::series_play("104dr02", 0x200, 0, kCHANGE_STOLIE_ANIMATION, 8, 0, 100, 0, 0, 13, 14);
return;
}
_stolieSleepCtr = 0;
switch (getRandom()) {
case 1:
digi_play("104s100a", 2, 125, -1);
break;
case 2:
digi_play("104s100b", 2, 125, -1);
_stolieSleepCtr = 100;
break;
case 3:
digi_play("104s100c", 2, 125, -1);
break;
case 4:
digi_play("104s100d", 2, 125, -1);
break;
case 5:
digi_play("104s100e", 2, 125, -1);
break;
default:
break;
}
}
_flag1 = false;
++_stolieSleepCtr;
frame = 0;
if (_stolieSleepCtr < 3)
frame = 22;
else if (_stolieSleepCtr < 14)
frame = 23;
else {
switch (imath_ranged_rand(1, 3)) {
case 1:
frame = 21;
break;
case 2:
frame = 24;
break;
case 3:
frame = 25;
break;
default:
break;
}
}
frameRate = _stolieSleepCtr < 14 ? 15 : imath_ranged_rand(6, 15);
Series::series_play("104dr02", 0x200, 0, kCHANGE_STOLIE_ANIMATION,
frameRate, 0, 100, 0, 0, frame, frame);
break;
case 15:
if (!digi_play_state(2)) {
switch (imath_ranged_rand(1, 6)) {
case 1:
_stolieShould = 14;
Series::series_play("104dr02", 0x200, 2, kCHANGE_STOLIE_ANIMATION, 8, 0, 100, 0, 0, 13, 14);
return;
case 2:
_stolieShould = 16;
Series::series_play("104dr02", 0x200, 0, kCHANGE_STOLIE_ANIMATION, 8, 0, 100, 0, 0, 20, 20);
return;
default:
break;
}
_stolieSleepCtr = 0;
switch (getRandom()) {
case 1:
digi_play("104s100a", 2, 125, -1);
break;
case 2:
digi_play("104s100b", 2, 125, -1);
_stolieSleepCtr = 100;
break;
case 3:
digi_play("104s100c", 2, 125, -1);
break;
case 4:
digi_play("104s100d", 2, 125, -1);
break;
case 5:
digi_play("104s100e", 2, 125, -1);
break;
default:
break;
}
}
_flag1 = false;
++_stolieSleepCtr;
frame = 0;
if (_stolieSleepCtr < 3)
frame = 11;
else if (_stolieSleepCtr < 14)
frame = 10;
else {
switch (imath_ranged_rand(1, 3)) {
case 1:
frame = 8;
break;
case 2:
frame = 9;
break;
case 3:
frame = 12;
break;
default:
break;
}
}
frameRate = _stolieSleepCtr < 14 ? 15 : imath_ranged_rand(6, 15);
Series::series_play("104dr02", 0x200, 0, kCHANGE_STOLIE_ANIMATION, frameRate, 0, 100, 0, 0, frame, frame);
break;
case 16:
if (!digi_play_state(2)) {
if (imath_ranged_rand(1, 4) == 1) {
_stolieShould = 15;
Series::series_play("104dr02", 0x200, 0, kCHANGE_STOLIE_ANIMATION, 8, 0, 100, 0, 0, 20, 20);
break;
} else {
_stolieSleepCtr = 0;
switch (getRandom()) {
case 1:
digi_play("104s100a", 2, 125, -1);
break;
case 2:
digi_play("104s100b", 2, 125, -1);
_stolieSleepCtr = 100;
break;
case 3:
digi_play("104s100c", 2, 125, -1);
break;
case 4:
digi_play("104s100d", 2, 125, -1);
break;
case 5:
digi_play("104s100e", 2, 125, -1);
break;
default:
break;
}
}
}
_flag1 = false;
++_stolieSleepCtr;
frame = 0;
if (_stolieSleepCtr < 3)
frame = 16;
else if (_stolieSleepCtr < 14)
frame = 18;
else {
switch (imath_ranged_rand(1, 3)) {
case 1:
frame = 15;
break;
case 2:
frame = 17;
break;
case 3:
frame = 19;
break;
default:
break;
}
}
frameRate = (_stolieSleepCtr < 14) ? 15 : imath_ranged_rand(6, 15);
Series::series_play("104dr02", 0x200, 0, kCHANGE_STOLIE_ANIMATION, frameRate, 0, 100, 0, 0, frame, frame);
break;
case 17:
freeSeries();
_flag1 = true;
_stolieShould = 18;
_series1.play("104DR04", 0x200, 4, -1, 6, -1, 100, 0, 0, 11, 15);
digi_play(conv_sound_to_play(), 1, 255, kCHANGE_STOLIE_ANIMATION);
break;
case 18:
freeSeries();
_flag1 = true;
_series1.show("104DR04", 0x200, 0, -1, -1, 11);
conv_resume_curr();
break;
default:
break;
}
break;
case 4:
conv_load_and_prepare("conv16", 5, false);
conv_export_pointer_curr(&_G(flags)[WAKE_UP_STOLIE_COUNT], 0);
conv_play_curr();
break;
case 5:
term_message("WAKE UP STOLIE COUNT = %d", _G(flags)[WAKE_UP_STOLIE_COUNT]);
if (!_G(flags)[WAKE_UP_STOLIE_COUNT]) {
term_message("AT END OF CONV? COUNT = %d", _G(flags)[WAKE_UP_STOLIE_COUNT]);
_G(flags)[V028] = 0;
_G(flags)[WAKE_UP_STOLIE_COUNT]++;
}
freeSeries();
switch (_G(flags)[WAKE_UP_STOLIE_COUNT]) {
case 1:
case 4:
case 7:
case 11:
_stolieShould = 6;
break;
case 2:
case 3:
case 5:
case 6:
case 8:
case 9:
case 10:
_stolieShould = 8;
break;
default:
break;
}
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
player_set_commands_allowed(true);
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
ws_demand_location(315, 373);
ws_demand_facing(10);
ws_walk(271, 348, nullptr, -1, 10);
break;
case 2:
ws_demand_location(208, 243);
ws_demand_facing(7);
ws_walk(180, 287, nullptr, -1, 7);
break;
case 3:
ws_demand_location(417, 361);
ws_demand_facing(3);
break;
case 4:
ws_demand_location(0, 326);
ws_demand_facing(3);
ws_walk(36, 338, nullptr, -1, 3);
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room104::pre_parser() {
_G(kernel).call_daemon_every_loop = player_said("MAIN STREET") &&
player_said_any("look at", "enter");
}
void Room104::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (!_G(walker).wilbur_said(SAID1)) {
if (player_said("MAIN STREET") && player_said_any("look at", "enter")) {
player_set_commands_allowed(false);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1001);
} else if (player_said("ENTER", "DOORS") || player_said("ENTER", "DOOR HANDLE") ||
player_said("gear", "doors") || player_said("gear", "door handle")) {
player_set_commands_allowed(false);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1);
} else if (player_said("LOOK AT", "AUNT POLLY'S HOUSE")) {
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1017);
} else if (player_said("ENTER", "AUNT POLLY'S HOUSE")) {
player_set_commands_allowed(false);
pal_fade_init(_G(master_palette), _G(kernel).first_fade, 255, 0, 30, 1017);
} else if (player_said("talk to", "stolie")) {
if (_G(flags)[V028]) {
player_set_commands_allowed(false);
switch (_G(flags)[WAKE_UP_STOLIE_COUNT]) {
case 0:
_stolieShould = 12;
_G(walker).wilbur_speech_random("104W100A", "104W100B", "104W100C",
"104W100D", "104W100E", "104W100F", "104W100G");
break;
case 12:
_G(walker).wilbur_speech("104W101");
_G(flags)[V028] = 0;
player_set_commands_allowed(true);
break;
default:
_stolieShould = 10;
break;
}
} else {
_G(walker).wilbur_speech("104W101");
}
} else if (player_said("conv16")) {
conv();
} else {
return;
}
}
_G(player).command_ready = false;
}
void Room104::conv() {
if (conv_sound_to_play()) {
switch (conv_whos_talking()) {
case 0:
_stolieShould = 17;
kernel_trigger_dispatch_now(kCHANGE_STOLIE_ANIMATION);
break;
case 1:
_G(walker).wilbur_speech(conv_sound_to_play(), 10001);
break;
default:
break;
}
}
}
void Room104::freeSeries() {
if (_flag1) {
_series1.terminate();
_flag1 = false;
}
}
int Room104::getRandom() const {
if (imath_ranged_rand(1, 4) == 1) {
return imath_ranged_rand(3, 4);
} else {
switch (imath_ranged_rand(1, 5)) {
case 1:
case 2:
return 1;
case 3:
return 2;
default:
return 5;
}
}
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,57 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM104_H
#define M4_BURGER_ROOMS_SECTION1_ROOM104_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room104 : public Room {
private:
int _stolieSleepCtr = 0;
int _stolieShould = 14;
int _val3 = 0;
bool _flag1 = false;
Series _series1;
void conv();
void freeSeries();
int getRandom() const;
public:
Room104() : Room() {}
~Room104() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,91 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM105_H
#define M4_BURGER_ROOMS_SECTION1_ROOM105_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room105 : public Room {
private:
int _val1 = 0;
int _elgusShould = 0;
int _elgusMode = 0;
KernelTriggerType _savedMode = (KernelTriggerType)0;
int _savedTrigger = 0;
//int _val7 = 0;
int _val8 = 0;
bool _flag1 = false;
bool _flag2 = false;
bool _flag3 = false;
bool _flag4 = false;
bool _flag5 = false;
const char *_digi1 = nullptr;
int _series1[12];
int _series2[4];
int _series3[12];
int _series4[5];
machine *_series5 = nullptr;
machine *_series6 = nullptr;
machine *_series7 = nullptr;
machine *_series8 = nullptr;
machine *_series9 = nullptr;
machine *_series10 = nullptr;
int _series11 = 0;
int _series12 = 0;
void conv10();
void conv11();
void conv12();
void conv13();
void startConv13();
void mayorsDoor();
void loadAssets1();
void loadAssets2();
void loadAssets3();
void loadAssets4();
void unloadAssets1();
void unloadAssets2();
void unloadAssets3();
void unloadAssets4();
void townRecords();
void complaintsDept();
void mayorsOffice();
public:
Room105() : Room() {}
~Room105() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,427 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room106.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
enum {
kWILBUR_SPEECH = 2,
kCHANGE_DOG_ANIMATION = 3,
kWILBUR_ARRESTED1 = 4,
kWILBUR_ARRESTED2 = 5
};
static const char *SAID[][4] = {
{ "GARBAGE CANS", "106w002", "106w003", nullptr },
{ "POLICE STATION", "106w004", "106w004z", "106w004z" },
{ "JAIL CELL", "106w005", "106w004z", "106w004z" },
{ "BARRED WINDOW", "106w006", "106w004z", nullptr },
{ "FENCE ", "106w008", "106w004z", "106w009" },
{ "RAZOR WIRE", "106w010", "106w011", "106w011" },
{ "GATE", "106w012", "106w004z", "106w013" },
{ "SIGN", "106w015", nullptr, nullptr },
{ "TIRE", "106w016", "106w017", "106w018" },
{ "TOW TRUCK", "106w019", "106w004z", "106w020" },
{ "PEGLEG", "106w021", "106w022", "106w022" },
{ "PEGLEG ", "106w021", "106w022", "106w022" },
{ "TIRE ", "106w023", "106w020", "106w020" },
{ "MAIN STREET", nullptr, "106w004z", nullptr },
{ "DOG COLLAR ", "106w900", nullptr, "106w901" },
{ "DOG COLLAR ", "106w900", nullptr, "106w901" },
{ "HOOK ", "106w903", "106w904", "106w004z" },
{ "WINCH", "106w902", "106w004z", "106w904" },
{ nullptr, nullptr, nullptr, nullptr }
};
const WilburMatch Room106::MATCH[] = {
{ "JAWZ O' LIFE", "GATE", 2, nullptr, 0, &_speechNum, 2 },
{ "JAWZ O' LIFE", "CHAIN", 2, nullptr, 0, &_speechNum, 2 },
{ "JAWZ O' LIFE", "LOCK", 2, nullptr, 0, &_speechNum, 2 },
WILBUR_MATCH_END
};
const seriesPlayBreak Room106::PLAY1[] = {
{ 0, -1, "106d003a", 2, 255, -1, 0, 0, &_dogState, 1 },
{ 0, -1, "106d003b", 2, 255, -1, 0, 0, &_dogState, 2 },
{ 0, -1, "106d003c", 2, 255, -1, 0, 0, &_dogState, 3 },
{ 0, -1, "106d003d", 2, 255, -1, 0, 0, &_dogState, 4 },
{ 0, -1, "106d003e", 2, 255, -1, 0, 0, &_dogState, 5 },
{ 0, -1, "106d003f", 2, 255, -1, 0, 0, &_dogState, 6 },
{ 0, -1, "106d003g", 2, 255, -1, 0, 0, &_dogState, 7 },
PLAY_BREAK_END
};
const seriesPlayBreak Room106::PLAY2[] = {
{ 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room106::PLAY3[] = {
{ 0, -1, "106d001a", 2, 255, -1, 0, -1, &_dogState, 1 },
{ 0, -1, "106d001b", 2, 255, -1, 0, -1, &_dogState, 2 },
{ 0, -1, "106d001c", 2, 255, -1, 0, -1, &_dogState, 3 },
{ 0, -1, "106d001d", 2, 255, -1, 0, -1, &_dogState, 4 },
{ 0, -1, "106d001e", 2, 255, -1, 0, -1, &_dogState, 5 },
{ 0, -1, "106d001f", 2, 255, -1, 0, -1, &_dogState, 6 },
PLAY_BREAK_END
};
const seriesPlayBreak Room106::PLAY4[] = {
{ 0, -1, "106d002a", 2, 255, -1, 0, -1, &_dogState, 1 },
{ 0, -1, "106d002b", 2, 255, -1, 0, -1, &_dogState, 2 },
{ 0, -1, "106d002c", 2, 255, -1, 0, -1, &_dogState, 3 },
{ 0, -1, "106d002d", 2, 255, -1, 0, -1, &_dogState, 4 },
{ 0, -1, "106d002e", 2, 255, -1, 0, -1, &_dogState, 5 },
{ 0, -1, "106d002f", 2, 255, -1, 0, -1, &_dogState, 6 },
{ 0, -1, "106d002g", 2, 255, -1, 0, -1, &_dogState, 7 },
PLAY_BREAK_END
};
const seriesPlayBreak Room106::PLAY5[] = {
{ 0, 4, "106d006a", 2, 255, -1, 0, 0, &_dogState, 1 },
{ 0, 4, "106d006b", 2, 255, -1, 0, 0, &_dogState, 2 },
{ 0, 4, "106d006c", 2, 255, -1, 0, 0, &_dogState, 3 },
{ 5, -1, "106_005", 2, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room106::PLAY6[] = {
{ 0, 4, "106_005", 2, 255, -1, 0, 0, nullptr, 0 },
{ 5, -1, "106d007a", 2, 255, -1, 0, 0, &_dogState, 1 },
{ 5, -1, "106d007b", 2, 255, -1, 0, 0, &_dogState, 2 },
{ 5, -1, "106d007c", 2, 255, -1, 0, 0, &_dogState, 3 },
PLAY_BREAK_END
};
const seriesPlayBreak Room106::PLAY7[] = {
{ 0, -1, "106d005", 2, 255, -1, 0, 0, &_dogState, 1 },
{ 0, -1, "106d005b", 2, 255, -1, 0, 0, &_dogState, 2 },
{ 0, -1, "106d005c", 2, 255, -1, 0, 0, &_dogState, 3 },
{ 0, -1, "106d005d", 2, 255, -1, 0, 0, &_dogState, 4 },
{ 0, -1, "106d005e", 2, 255, -1, 0, 0, &_dogState, 5 },
{ 0, -1, "106d005f", 2, 255, -1, 0, 0, &_dogState, 6 },
PLAY_BREAK_END
};
int32 Room106::_speechNum;
int32 Room106::_dogState;
void Room106::preload() {
_G(player).walker_in_this_scene = _G(game).room_id != 137 &&
_G(game).room_id != 138;
}
void Room106::init() {
_dogState = 0;
digi_preload("100_001");
digi_preload("106_101");
_digi1 = "100_001";
kernel_trigger_dispatch_now(1);
player_set_commands_allowed(false);
_speechNum = 0;
setHotspots();
loadSeries();
if (_G(game).previous_room == -1) {
_dogShould = _G(flags)[V172] == 10023 ? 9 : 15;
} else {
_dogShould = imath_ranged_rand(1, 2) == 1 ? 5 : 6;
}
kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
series_show("106gate", 0x4fd);
series_show("106gates", 0x4fe);
series_show("106tt", 0x600);
series_show("106tire", 0x600);
switch (_G(game).previous_room) {
case 101:
ws_demand_location(-40, 317, 3);
ws_walk(62, 340, nullptr, 0);
break;
case 137:
case 138:
// Wilbur was arrested
digi_play("106_102", 1, 255, kWILBUR_ARRESTED1);
break;
case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
default:
ws_demand_location(169, 336, 5);
break;
}
}
void Room106::daemon() {
switch (_G(kernel).trigger) {
case 1:
_digi1 = !strcmp(_digi1, "106_101") ? "100_001" : "106_101";
digi_play(_digi1, 3, 255, 1);
break;
case 2:
switch (_speechNum) {
case 1:
player_set_commands_allowed(true);
_G(walker).wilbur_speech_random("106w001a", "106w001b", "106w001c");
break;
case 2:
wilbur_speech("106w014");
break;
case 3:
wilbur_speech("106w501", kWILBUR_ARRESTED2);
break;
case 4:
wilbur_speech("106w500", kAbduction);
break;
default:
break;
}
break;
case kCHANGE_DOG_ANIMATION:
switch (_dogShould) {
case 5:
_dogState = imath_ranged_rand(1, 7);
_dogShould = 7;
series_play_with_breaks(PLAY1, "106dg01", 0x501, kCHANGE_DOG_ANIMATION, 3);
break;
case 6:
_dogShould = 7;
series_play_with_breaks(PLAY2, "106dg02", 0x501, kCHANGE_DOG_ANIMATION, 3);
break;
case 7:
_dogState = imath_ranged_rand(1, 6);
_dogShould = _G(game).previous_room == 137 || _G(game).previous_room == 138 ? 9 : 8;
series_play_with_breaks(PLAY3, "106dg04", 0x501, kCHANGE_DOG_ANIMATION, 3);
break;
case 8:
_speechNum = 1;
ws_turn_to_face(calc_facing(415, 234), 2);
_dogShould = 9;
kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
break;
case 9:
_G(flags)[V172] = 10023;
switch (imath_ranged_rand(1, 6)) {
case 1:
_dogShould = 10;
break;
case 2:
_dogShould = 11;
break;
case 3:
_dogShould = 12;
break;
default:
_dogShould = 9;
break;
}
series_show("106dg07", 0x501, 0, kCHANGE_DOG_ANIMATION, 120);
series_show("106dg07s", 0x502, 0, -1, 120);
break;
case 10:
if (digi_play_state(1)) {
_dogShould = 9;
kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
} else {
_dogState = imath_ranged_rand(1, 7);
_dogShould = 9;
series_play_with_breaks(PLAY4, "106dg05", 0x501, kCHANGE_DOG_ANIMATION, 3);
}
break;
case 11:
if (digi_play_state(1)) {
_dogShould = 9;
kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
} else {
_dogState = imath_ranged_rand(1, 3);
_dogShould = 15;
series_play_with_breaks(PLAY5, "106dg07", 0x501, kCHANGE_DOG_ANIMATION, 3);
}
break;
case 12:
if (digi_play_state(1)) {
_dogShould = 9;
kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
} else {
_dogState = imath_ranged_rand(1, 6);
_dogShould = 9;
series_play_with_breaks(PLAY3, "106dg04", 0x501, kCHANGE_DOG_ANIMATION, 3);
}
break;
case 13:
if (digi_play_state(1)) {
_dogShould = 15;
kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
} else {
_dogState = imath_ranged_rand(1, 6);
_dogShould = 15;
series_play_with_breaks(PLAY3, "106dg09", 0x501, kCHANGE_DOG_ANIMATION, 3);
}
break;
case 14:
if (digi_play_state(1)) {
_dogShould = 15;
kernel_trigger_dispatch_now(kCHANGE_DOG_ANIMATION);
} else {
_dogState = imath_ranged_rand(1, 3);
_dogShould = 9;
series_play_with_breaks(PLAY6, "106dg11", 0x501, kCHANGE_DOG_ANIMATION, 3);
}
break;
case 15:
_G(flags)[V172] = 10024;
switch (imath_ranged_rand(1, 4)) {
case 1:
_dogShould = 13;
break;
case 2:
_dogShould = 14;
break;
default:
_dogShould = 15;
break;
}
series_show("106dg07", 0x501, 0, kCHANGE_DOG_ANIMATION, 120, 8);
series_show("106dg07s", 0x502, 0, -1, 120, 8);
break;
case 16:
_dogState = imath_ranged_rand(1, 6);
_dogShould = 11;
series_play_with_breaks(PLAY7, "106dg06", 0x501, kCHANGE_DOG_ANIMATION, 3);
break;
case 17:
_dogState = imath_ranged_rand(1, 6);
_dogShould = 13;
series_play_with_breaks(PLAY7, "106dg10", 0x501, kCHANGE_DOG_ANIMATION, 3);
break;
default:
break;
}
break;
case kWILBUR_ARRESTED1:
_speechNum = 3;
digi_play("106s001", 1, 255, kWILBUR_SPEECH);
break;
case kWILBUR_ARRESTED2:
_speechNum = 4;
digi_play("106_103", 1, 255, kWILBUR_SPEECH);
break;
case 10008:
_dogShould = _G(flags)[V172] == 10023 ? 16 : 17;
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room106::pre_parser() {
if (player_said("SKY"))
player_set_facing_hotspot();
if (player_said("MAIN STREET") && !player_said_any("GEAR", "LOOK AT")) {
player_set_facing_at(-40, 317);
}
}
void Room106::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said_any("GEAR", "LOOK AT") && player_said("MAIN STREET")) {
disable_player_commands_and_fade_init(1001);
_G(player).command_ready = false;
} else if (!_G(walker).wilbur_match(MATCH)) {
return;
}
_G(player).command_ready = false;
}
void Room106::setHotspots() {
hotspot_set_active("PEGLEG", false);
hotspot_set_active("PEGLEG ", false);
hotspot_set_active("DOG COLLAR ", false);
hotspot_set_active("DOG COLLAR ", false);
switch (_G(flags)[V172]) {
case 10023:
hotspot_set_active("PEGLEG", true);
hotspot_set_active("DOG COLLAR ", true);
break;
case 10024:
hotspot_set_active("PEGLEG ", true);
hotspot_set_active("DOG COLLAR ", true);
break;
default:
break;
}
}
void Room106::loadSeries() {
series_load("106dg04");
series_load("106dg04s");
series_load("106dg07");
series_load("106dg07s");
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,65 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM106_H
#define M4_BURGER_ROOMS_SECTION1_ROOM106_H
#include "m4/burger/rooms/room.h"
#include "m4/burger/walker.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room106 : public Room {
static const WilburMatch MATCH[];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
static const seriesPlayBreak PLAY3[];
static const seriesPlayBreak PLAY4[];
static const seriesPlayBreak PLAY5[];
static const seriesPlayBreak PLAY6[];
static const seriesPlayBreak PLAY7[];
private:
const char *_digi1 = nullptr;
static int32 _speechNum;
int _dogShould = 0;
static int32 _dogState;
void setHotspots();
void loadSeries();
public:
Room106() : Room() {}
~Room106() override {}
void preload() override;
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,52 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room120.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
void Room120::preload() {
_G(player).walker_in_this_scene = false;
}
void Room120::init() {
player_set_commands_allowed(false);
kernel_timing_trigger(200, 1);
}
void Room120::daemon() {
// After reimplementing for ScummVM the massive mess of multi-level switch
// statements that are the previous rooms' daemons, I seriously love
// the simplicity of this room's daemon. It's awesome!
if (_G(kernel).trigger == 1) {
_G(game).setRoom(_G(game).previous_room);
} else {
_G(kernel).continue_handling_trigger = true;
}
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,45 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM120_H
#define M4_BURGER_ROOMS_SECTION1_ROOM120_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room120 : public Room {
public:
Room120() : Room() {}
~Room120() override {}
void preload() override;
void init() override;
void daemon() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,363 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room133_136.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
static const char *SAID[][4] = {
{ "SIGN", "136w001", "136W003", nullptr },
{ "SIGN ", "136w002", "136W003", "136w005" },
{ "CONSTRUCTION", nullptr, "136W008", "136W008" },
{ "OLD BRIDGE", nullptr, "136W008", nullptr },
{ "TOWN LIMITS", nullptr, "136W008", nullptr },
{ nullptr, nullptr, nullptr, nullptr }
};
static const seriesPlayBreak PLAY1[] = {
{ 0, 12, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 13, 30, "136_002", 2, 255, -1, 0, 0, nullptr, 0 },
{ 31, 57, "136_002", 2, 255, -1, 0, 0, nullptr, 0 },
{ 58, -1, nullptr, 2, 255, -1, 2048, 0, nullptr, 0 },
{ -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesStreamBreak SERIES1[] = {
{ 6, nullptr, 2, 255, 9, 0, nullptr, 0 },
{ 10, "100_022", 2, 255, -1, 0, nullptr, 0 },
{ -1, nullptr, 0, 0, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
static const seriesStreamBreak SERIES2[] = {
STREAM_BREAK_END
};
static const seriesStreamBreak SERIES3[] = {
{ 0, "100_010", 1, 255, -1, 0, nullptr, 0 },
{ 14, "100_011", 1, 255, -1, 0, nullptr, 0 },
{ 20, nullptr, 1, 255, 14, 0, nullptr, 0 },
STREAM_BREAK_END
};
void Room133_136::init() {
_flag = true;
_volume = 255;
_walkCodes = nullptr;
_G(kernel).call_daemon_every_loop = true;
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
break;
case 134:
case 135:
_G(wilbur_should) = 3;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 136:
ws_demand_location(444, 230, 2);
break;
case 137:
_G(wilbur_should) = 4;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
ws_demand_location(320, 271, 5);
break;
}
setupSign();
setupSignWalkAreas();
digi_preload("136_001");
digi_play_loop("136_001", 3, 180);
}
void Room133_136::daemon() {
if (player_commands_allowed() && _G(player).walker_visible) {
player_update_info();
if (_G(player_info).y < 188 && _flag) {
_flag = false;
kernel_timing_trigger(120, 1);
player_set_commands_allowed(false);
intr_freshen_sentence();
series_play("136cw01", 0xf00, 0, 2, 6, 0, 100, 0, 0, 0, 10);
}
}
switch (_G(kernel).trigger) {
case 1:
Section1::walk();
break;
case 2:
_G(flags)[kDisableFootsteps] = 1;
digi_play("136c001", 1, 255, 5, 136);
_val1 = 1;
kernel_trigger_dispatch_now(3);
break;
case 3:
if (_val1 == 1) {
const int frame = imath_ranged_rand(8, 10);
series_play("136cw01", 0xf00, 0, 3, 6, 0, 100, 0, 0, frame, frame);
} else {
ws_walk(217, 268, nullptr, 4, 2);
series_play("136cw01", 0xf00, 2, -1, 6, 0, 100, 0, 0, 0, 10);
}
break;
case 4:
wilbur_speech("136w009");
_flag = true;
player_set_commands_allowed(true);
break;
case 5:
_G(flags)[kDisableFootsteps] = 0;
_val1 = 2;
break;
case 6:
pal_fade_set_start(0);
terminateMachineAndNull(_sign1);
terminateMachineAndNull(_sign2);
ws_hide_walker();
gr_backup_palette();
digi_preload("100_022");
digi_preload_stream_breaks(SERIES1);
kernel_timing_trigger(30, 7);
break;
case 7:
series_stream_with_breaks(SERIES1, "120dt01", 9, 0, 1009);
kernel_timing_trigger(1, 8);
break;
case 8:
pal_fade_init(15, 255, 100, 0, -1);
break;
case 9:
digi_change_volume(2, 0);
break;
case 10:
player_set_commands_allowed(true);
break;
case 11:
terminateMachineAndNull(_sign1);
terminateMachineAndNull(_sign2);
if (_G(flags)[kRoadOpened]) {
Section1::updateWalker(413, 281, 9, 15, true);
} else {
Section1::updateWalker(238, 226, 4, 15);
}
break;
case 13:
if ((_G(player_info).x < 320 && _G(player_info).y > 250) ||
(_G(player_info).y > 227 && !_G(flags)[kRoadOpened])) {
kernel_trigger_dispatch_now(11);
} else if (!_G(flags)[kRoadOpened]) {
digi_preload_stream_breaks(SERIES2);
series_stream_with_breaks(SERIES2, "136dt01", 6, 0x400, 14);
} else {
kernel_trigger_dispatch_now(11);
}
break;
case 14:
if (!_G(flags)[kRoadOpened]) {
_volume -= 10;
if (_volume > 0) {
digi_change_volume(2, _volume);
kernel_timing_trigger(3, 14);
} else {
digi_stop(1);
digi_unload_stream_breaks(SERIES2);
digi_stop(2);
digi_unload("100_013");
player_set_commands_allowed(true);
_volume = 255;
}
}
break;
case 15:
setupSign();
_G(walker).reset_walker_sprites();
digi_preload_stream_breaks(SERIES2);
if (_G(flags)[kRoadOpened]) {
_G(flags)[V000] = 1002;
series_stream_with_breaks(SERIES3, "136dt02", 6, 0x200, 6);
} else {
series_stream_with_breaks(SERIES2, "136dt01", 6, 0x200, 14);
}
break;
case 16:
ws_demand_location(398, 297, 8);
ws_hide_walker();
terminateMachineAndNull(_sign1);
terminateMachineAndNull(_sign2);
player_set_commands_allowed(false);
series_play_with_breaks(PLAY1, "136wi01", 0x300, 17, 3);
break;
case 17:
_G(flags)[kRoadOpened] = 1;
ws_unhide_walker();
player_set_commands_allowed(true);
setupSign();
setupSignWalkAreas();
wilbur_speech("136w004");
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 3:
player_set_commands_allowed(true);
player_first_walk(639, 264, 9, 588, 252, 9, true);
break;
case 4:
player_set_commands_allowed(true);
player_first_walk(0, 355, 3, 96, 340, 3, true);
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
case kBurlEntersTown:
if (player_commands_allowed() && _G(player).walker_visible &&
INTERFACE_VISIBLE && !digi_play_state(1)) {
Section1::updateDisablePlayer();
digi_preload("100_013");
digi_play("100_013", 2);
kernel_timing_trigger(240, 13);
} else {
kernel_timing_trigger(60, 10028);
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room133_136::pre_parser() {
if (player_said("gear", "sign") && !_G(flags)[kRoadOpened])
player_hotspot_walk_override(246, 247, 8);
if (player_said("old bridge") &&
!player_said_any("enter", "gear", "look", "look at"))
player_hotspot_walk_override_just_face(3);
if (player_said("town limits") &&
!player_said_any("enter", "gear", "look", "look at"))
player_hotspot_walk_override_just_face(9);
if (player_said("enter", "construction"))
player_hotspot_walk_override(292, 173, 1);
}
void Room133_136::parser() {
const bool lookFlag = player_said_any("look", "look at");
_G(kernel).trigger_mode = KT_DAEMON;
if (player_said("gear", "sign") && !_G(flags)[kRoadOpened]) {
kernel_trigger_dispatch_now(16);
} else if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (lookFlag && player_said("construction")) {
wilbur_speech(_G(flags)[V000] == 1002 ? "136w006" : "136w007");
} else if (player_said("enter", "old bridge") || player_said("gear", "old bridge") ||
(lookFlag && player_said("old bridge"))) {
player_set_commands_allowed(false);
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1008);
} else if (player_said("enter", "town limits") || player_said("gear", "town limits") ||
(lookFlag && player_said("town limits"))) {
player_set_commands_allowed(false);
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1010);
} else if (inv_player_has(_G(player).verb) &&
player_said_any("old bridge", "town limits", "construction")) {
wilbur_speech("136w008");
} else {
return;
}
_G(player).command_ready = false;
}
void Room133_136::setupSign() {
if (_G(flags)[kRoadOpened]) {
hotspot_set_active("sign", false);
hotspot_set_active("sign ", true);
_sign1 = series_play("136signr", 0x800, 0, -1, 600, -1, 100, 0, 0, 0, 0);
_sign2 = series_play("136sinrs", 0x801, 0, -1, 600, -1, 100, 0, 0, 0, 0);
} else {
hotspot_set_active("sign ", false);
hotspot_set_active("sign", true);
_sign1 = series_play("136signl", 0xa00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
_sign2 = series_play("136sinls", 0xa01, 0, -1, 600, -1, 100, 0, 0, 0, 0);
}
}
void Room133_136::setupSignWalkAreas() {
if (_G(flags)[kRoadOpened]) {
intr_add_no_walk_rect(294, 263, 332, 278, 297, 292);
intr_add_no_walk_rect(332, 278, 380, 300, 297, 292);
if (_walkCodes)
intr_remove_no_walk_rect(_walkCodes);
} else {
_walkCodes = intr_add_no_walk_rect(144, 241, 244, 252, 167, 272);
}
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,57 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM133_136_H
#define M4_BURGER_ROOMS_SECTION1_ROOM133_136_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room133_136 : public Room {
private:
bool _flag = false;
int _volume = 255;
noWalkRect *_walkCodes = nullptr;
machine *_sign1 = nullptr;
machine *_sign2 = nullptr;
int _val1 = 0;
void setupSign();
void setupSignWalkAreas();
public:
Room133_136() : Room() {}
~Room133_136() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,79 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM134_135_H
#define M4_BURGER_ROOMS_SECTION1_ROOM134_135_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room134_135 : public Room {
private:
int _volume = 0;
int _val2 = 0;
int _val4 = 0;
int _val5 = 0;
int _val6 = 0;
int _val7 = 0;
int _val8 = 0;
int _val9 = 0;
int _val10 = 0;
int _val11 = 0;
bool _flag1 = false;
bool _odieLoaded = false;
machine *_series1 = nullptr;
machine *_series2 = nullptr;
machine *_series3 = nullptr;
machine *_series4 = nullptr;
machine *_series5 = nullptr;
machine *_series6 = nullptr;
machine *_play1 = nullptr;
machine *_play2 = nullptr;
machine *_play3 = nullptr;
machine *_play4 = nullptr;
int _xp = 0, _yp = 0;
int _frame = 0;
const char *_name1 = nullptr;
void conv01();
void conv02();
void conv03();
void loadOdie();
void loadDigi();
public:
Room134_135() : Room() {}
~Room134_135() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,912 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room137.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
enum {
kCHANGE_SHERRIF_ANIMATION = 1,
kCHANGE_DEPUTY_ANIMATION = 2,
kSOMEONE_TOOK_KEYS = 4
};
static const char *SAID[][4] = {
{ "PATROL CAR", "137W002", "137W003", "137W004" },
{ "TRUNK", nullptr, "137W008", "137W008" },
{ "JAWZ O' LIFE", "137W010", nullptr, nullptr },
{ "SIGN", "137W012", "137W008", "137W008" },
{ "CAR WINDOW", nullptr, "137W008", "137W008" },
{ "HIGHWAY 2", "137W013", "137W008", "137W008" },
{ "FORK IN THE ROAD", nullptr, "137W008", "137W008" },
{ "KEYS", "137W009", nullptr, nullptr },
{ nullptr, nullptr, nullptr, nullptr }
};
static const seriesStreamBreak SERIES1[] = {
{ 9, "100_010", 1, 255, -1, 0, nullptr, 0 },
{ 20, nullptr, 1, 255, 12, 0, nullptr, 0 },
STREAM_BREAK_END
};
static const seriesPlayBreak PLAY1[] = {
{ 0, 24, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 25, 32, "137_005", 1, 255, -1, 0, 0, nullptr, 0 },
{ 33, 33, nullptr, 1, 255, 16, 0, 0, nullptr, 0 },
{ 34, 40, nullptr, 1, 255, 22, 0, 0, nullptr, 0 },
{ 41, -1, nullptr, 1, 255, 19, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY2[] = {
{ 0, 7, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 8, 8, nullptr, 1, 255, 17, 0, 0, nullptr, 0 },
{ 9, 13, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 14, 14, nullptr, 1, 255, 21, 0, 0, nullptr, 0 },
{ 14, 14, "137_006", 1, 255, -1, 0, 0, nullptr, 0 },
{ 15, -1, nullptr, 1, 255, 18, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY3[] = {
{ 0, 11, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 12, 12, nullptr, 1, 255, 20, 0, 0, nullptr, 0 },
{ 13, -1, "137_007", 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
void Room137::init() {
player_set_commands_allowed(true);
_G(kernel).call_daemon_every_loop = true;
_volume = 255;
_flag1 = true;
_flag2 = false;
_arrested = false;
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
if (_G(flags)[kPoliceCheckCtr])
_G(flags)[kPoliceCheckCtr] = 1;
break;
case 136:
player_set_commands_allowed(false);
_G(wilbur_should) = 3;
kernel_timing_trigger(1, kCHANGE_WILBUR_ANIMATION);
break;
case 138:
ws_demand_facing(2);
if (_G(flags)[kPoliceCheckCtr] >= 200) {
ws_demand_location(264, 347);
_flag1 = false;
digi_preload("137_003");
} else {
ws_demand_location(290, 334);
ws_hide_walker();
player_set_commands_allowed(false);
_G(wilbur_should) = 1;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
if (_G(flags)[kPoliceCheckCtr] < 200 && _G(flags)[kPoliceCheckCtr] && _G(flags)[kPoliceState] == 4)
_G(flags)[kPoliceState] = 5;
break;
default:
ws_demand_location(183, 216, 8);
break;
}
_door = series_play("137do01", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
jawz();
const char *NAMES[18] = {
"137_020", "137_021", "137_022", "137_023", "137_024", "137_025",
"137_026", "137_027", "137_028", "137_013", "137_014", "137_026",
"137_027", "137_028", "137_013", "137_014", "137_015", "137_016"
};
for (int i = 0; i < 18; ++i)
digi_preload(NAMES[i]);
if (inv_object_in_scene("keys", 138) && _G(flags)[kPoliceState] != 2) {
digi_preload("137_001");
digi_play_loop("137_001", 3);
} else {
digi_preload("137_002");
digi_play_loop("137_002", 3);
}
if (_G(flags)[kPoliceCheckCtr] < 200) {
_deputyShould = 27;
} else {
_deputyShould = _G(flags)[kPoliceState] == 2 || _G(flags)[kPoliceState] == 3 || _G(flags)[kPoliceState] == 4 ? 34 : 27;
digi_play("137_003", 1);
}
_deputyMode = 27;
kernel_trigger_dispatch_now(kCHANGE_DEPUTY_ANIMATION);
}
void Room137::daemon() {
int frame;
if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
player_update_info();
if (_G(player_info).y < 235 && player_said("FORK IN THE ROAD")) {
player_set_commands_allowed(false);
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1009);
}
}
if (!digi_play_state(2) && _flag1 && imath_ranged_rand(1, 3000) == 235) {
// Occasional actions. *VERY* occasional actions
if (_flag2 && inv_object_in_scene("keys", 138)) {
digi_play("137_022", 2, 100);
_flag2 = false;
} else if (inv_object_in_scene("keys", 138)) {
digi_play(imath_ranged_rand(1, 7) == 1 ? "137_020" : "137_021", 2);
} else {
digi_play(Common::String::format("137_0%d", imath_ranged_rand(23, 28)).c_str(), 2, 150);
}
}
switch (_G(kernel).trigger) {
case kCHANGE_SHERRIF_ANIMATION:
switch (_sherrifMode) {
case 5:
switch (_sherrifShould) {
case 10:
_sherrifShould = 11;
series_play("137sh01", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 17);
break;
case 11:
_sherrifShould = 12;
series_play("137sh07", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 8);
break;
case 12:
startPoliceTalk();
_sherrifShould = 22;
_sherrifMode = 10;
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
case 14:
_sherrifShould = 15;
series_play("137sh01", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 17);
break;
case 15:
startPoliceTalk();
_sherrifMode = 14;
_sherrifShould = 22;
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
case 17:
_sherrifShould = 18;
series_play("137sh01", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 17);
break;
case 18:
_sherrifShould = 19;
series_play("137sh07", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 8);
break;
case 19:
_sherrifShould = 20;
series_play("137sh09", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 8);
break;
case 20:
startPoliceTalk();
_sherrifShould = 22;
_sherrifMode = 17;
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
default:
break;
}
break;
case 10:
switch (_sherrifShould) {
case 22:
series_play("137sh08", 0x800, 0, 1, 10, 0, 100, 0, 0, 0, 0);
break;
case 23:
_sherrifMode = 13;
series_play("137sh08", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 0);
break;
default:
break;
}
break;
case 13:
if (_sherrifShould == 23) {
frame = imath_ranged_rand(0, 6);
series_play("137sh08", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, frame, frame);
if (_digi1) {
_G(kernel).trigger_mode = KT_PARSE;
digi_play(_digi1, 1, 255, 14);
_digi1 = nullptr;
}
} else {
_sherrifMode = 10;
series_play("137sh08", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 0);
}
break;
case 14:
switch (_sherrifShould) {
case 22:
if (imath_ranged_rand(1, 30) == 2) {
series_play("137sh04", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, 0, 14);
} else {
series_play("137sh01", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 12, 0, 100, 0, 0, 17, 17);
}
break;
case 23:
_sherrifMode = 16;
series_play("137sh03", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
break;
case 24:
_sherrifShould = 23;
series_play("137sh05", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, 0, 17);
if (_digi1) {
_G(kernel).trigger_mode = KT_PARSE;
digi_play(_digi1, 1, 255, 14);
_digi1 = nullptr;
}
break;
case 25:
_sherrifShould = 26;
series_play("137sh06", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, 0, 23);
break;
case 26:
conv_resume_curr();
_sherrifShould = 22;
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
default:
break;
}
break;
case 16:
if (_sherrifShould == 23) {
frame = imath_ranged_rand(0, 8);
series_play("137sh03", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, frame, frame);
if (_digi1) {
_G(kernel).trigger_mode = KT_PARSE;
digi_play(_digi1, 1, 255, 14);
_digi1 = nullptr;
}
} else {
_sherrifMode = 14;
series_play("137sh03", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 0);
}
break;
case 17:
switch (_sherrifShould) {
case 22:
series_play("137sh09", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
break;
case 23:
_sherrifMode = 21;
series_play("137sh10", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, 0, 0);
break;
default:
break;
}
break;
case 21:
if (_sherrifShould == 23) {
frame = imath_ranged_rand(0, 5);
series_play("137sh10", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 6, 0, 100, 0, 0, frame, frame);
if (_digi1) {
_G(kernel).trigger_mode = KT_PARSE;
digi_play(_digi1, 1, 255, 14);
_digi1 = nullptr;
}
} else {
_sherrifMode = 17;
series_play("137sh10", 0x800, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 0);
}
break;
default:
break;
}
break;
case kCHANGE_DEPUTY_ANIMATION:
switch (_deputyMode) {
case 27:
switch (_deputyShould) {
case 27:
movementCheck();
kernel_timing_trigger(10, kCHANGE_DEPUTY_ANIMATION);
break;
case 29:
_deputyShould = 30;
series_play("137dp02", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 8, 0, 100, 0, 0, 0, 7);
break;
case 30:
terminateMachineAndNull(_door);
_deputyMode = 31;
series_play("137dp03", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 8, 0, 100, 0, 0, 0, 14);
digi_play("137_003", 1, 255);
break;
case 34:
movementCheck();
_deputyShould = 29;
series_play("137dp01", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 60, 0, 100, 0, 0, 6, 6);
break;
default:
break;
}
break;
case 31:
if (imath_ranged_rand(1, 20) == 1) {
_deputyMode = 32;
series_play("137dp04", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
} else {
series_play("137dp04", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 10, 0, 100, 0, 0, 7, 7);
}
break;
case 32:
if (imath_ranged_rand(1, 20) == 1) {
_deputyMode = 33;
series_play("137dp04", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, imath_ranged_rand(60, 90),
0, 100, 0, 0, 0, 5);
} else {
series_play("137dp04", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
}
break;
case 33:
_deputyMode = 31;
series_play("137dp04", 0x700, 0, kCHANGE_DEPUTY_ANIMATION, 10, 0, 100, 0, 0, 6, 7);
break;
default:
break;
}
break;
case 3:
ws_walk(276, 292, nullptr, -1, 4);
break;
case kSOMEONE_TOOK_KEYS:
digi_play("137_014", 2, 200, 5);
break;
case 5:
unloadAssets();
if (_G(flags)[kPoliceState] != 2 && _G(flags)[kPoliceState] != 3 && _G(flags)[kPoliceState] != 4)
_deputyShould = 30;
_sherrifMode = 5;
_sherrifShould = 10;
if (_G(player_info).y > 308) {
_sherrifShould = 14;
ws_walk(307, 349, nullptr, -1, 2);
}
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
case 6:
digi_play("137_015", 2, 200, 7);
break;
case 7:
_sherrifMode = 5;
_sherrifShould = 14;
unloadAssets();
if (_G(player_info).y < 308)
_sherrifShould = 10;
if (_G(flags)[kPoliceState] != 2 && _G(flags)[kPoliceState] != 3 && _G(flags)[kPoliceState] != 4)
_deputyShould = 30;
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
case 8:
player_set_commands_allowed(true);
break;
case 9:
terminateMachineAndNull(_door);
if (_G(flags)[V046]) {
terminateMachineAndNull(_series3);
if (inv_object_is_here("jawz o' life"))
terminateMachineAndNull(_series2);
}
Section1::updateWalker(227, 309, 11, 13);
break;
case 11:
if (_G(player_info).y >= 300) {
digi_preload_stream_breaks(SERIES1);
series_stream_with_breaks(SERIES1, "137dt01", 6, 0xf00, -1);
} else {
kernel_trigger_dispatch_now(9);
}
break;
case 12:
_volume -= 10;
if (_volume > 0) {
digi_change_volume(2, _volume);
kernel_timing_trigger(4, 12);
} else {
digi_stop(1);
digi_unload_stream_breaks(SERIES1);
digi_stop(2);
digi_unload("100_013");
player_set_commands_allowed(true);
_volume = 255;
}
break;
case 13:
jawz();
_door = series_play("137do01", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
_G(walker).reset_walker_sprites();
digi_preload_stream_breaks(SERIES1);
series_stream_with_breaks(SERIES1, "137dt01", 0, 0xf00, -1);
_G(flags)[V049] = 1;
break;
case 14:
switch (_sherrifShould) {
case 22:
if (imath_ranged_rand(1, 30) == 2) {
series_play("137sh04", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 14);
} else {
series_play("137sh01", 0x800, 0, 1, 12, 0, 100, 0, 0, 17, 17);
}
break;
case 23:
_sherrifMode = 16;
series_play("137sh03", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 0);
break;
case 24:
_sherrifShould = 23;
series_play("137sh05", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 17);
if (_digi1) {
_G(kernel).trigger_mode = KT_PARSE;
digi_play(_digi1, 1, 255, 14);
}
break;
case 25:
_sherrifShould = 26;
series_play("137sh06", 0x800, 0, 1, 6, 0, 100, 0, 0, 0, 23);
break;
case 26:
conv_resume_curr();
_sherrifShould = 22;
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
default:
break;
}
break;
case 15:
if (_arrested) {
// Arrested
inv_move_object("keys", 138);
inv_move_object("jawz o' life", 137);
_G(flags)[V046] = 0;
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1006);
} else {
// Just sent off
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1009);
}
break;
case 16:
terminateMachineAndNull(_series3);
inv_move_object("keys", NOWHERE);
break;
case 17:
terminateMachineAndNull(_series3);
break;
case 18:
_series3 = series_play("137tr02", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
inv_give_to_player("keys");
break;
case 19:
_series3 = series_play("137tr01", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
break;
case 20:
terminateMachineAndNull(_series2);
inv_give_to_player("jawz o' life");
break;
case 21:
if (inv_object_is_here("jawz o' life"))
terminateMachineAndNull(_series2);
break;
case 22:
if (inv_object_is_here("jawz o' life"))
_series2 = series_play("137jaws", 0x600, 0, -1, 7, -1, 100, 0, 0, 0, 0);
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
_G(wilbur_should) = 2;
series_play("137wi01", 0x100, 2, kCHANGE_WILBUR_ANIMATION,
6, 0, 100, 0, 0, 0, 9);
series_play("137wi01s", 0x101, 2, -1, 6, 0, 100, 0, 0, 0, 9);
break;
case 2:
ws_unhide_walker();
player_set_commands_allowed(true);
break;
case 3:
ws_demand_location(183, 216, 8);
_G(wilbur_should) = 4;
ws_walk(171, 236, nullptr, kCHANGE_WILBUR_ANIMATION, 5);
break;
case 4:
player_set_commands_allowed(true);
if (!_G(player).been_here_before)
wilbur_speech("137w001");
break;
case 6:
ws_hide_walker();
_G(wilbur_should) = 9;
player_set_commands_allowed(false);
series_load("137jaws");
series_play_with_breaks(PLAY1, "137wi02", 0x100, kCHANGE_WILBUR_ANIMATION,
3, 6, 100, 0, 0);
hotspot_set_active("keys", true);
hotspot_set_active("trunk ", true);
if (inv_object_is_here("jawz o' life"))
hotspot_set_active("jawz o' life", true);
_G(flags)[V046] = 1;
break;
case 7:
ws_hide_walker();
player_set_commands_allowed(false);
_G(wilbur_should) = 9;
series_play_with_breaks(PLAY2, "137wi03", 0x100, kCHANGE_WILBUR_ANIMATION,
3, 6, 100, 0, 0);
hotspot_set_active("keys", false);
hotspot_set_active("trunk ", false);
hotspot_set_active("jawz o' life", false);
_G(flags)[V046] = 0;
break;
case 8:
ws_hide_walker();
player_set_commands_allowed(false);
_G(wilbur_should) = 9;
series_play_with_breaks(PLAY3, "137wi04", 0x100, kCHANGE_WILBUR_ANIMATION,
3, 6, 100, 0, 0);
hotspot_set_active("jawz o' life", false);
break;
case 9:
ws_unhide_walker();
player_set_commands_allowed(true);
break;
case 35:
_G(wilbur_should) = 36;
ws_hide_walker();
series_play("137wi01", 0x100, 0, kCHANGE_WILBUR_ANIMATION,
6, 0, 100, 0, 0, 0, 9);
series_play("137wi01s", 0x100, 0, -1, 6, 0, 100, 0, 0, 0, 9);
break;
case 36:
series_play("137wi01", 0x100, 0, kCHANGE_WILBUR_ANIMATION,
600, 0, 100, 0, 0, 9, 9);
series_play("137wi01s", 0x100, 0, -1, 600, 0, 100, 0, 0, 9, 9);
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1011);
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
case kBurlEntersTown:
if (player_commands_allowed() && _G(player).walker_visible &&
INTERFACE_VISIBLE && !digi_play_state(1)) {
Section1::updateDisablePlayer();
digi_preload("100_013");
digi_play("100_013", 2);
kernel_timing_trigger(240, 11);
} else {
kernel_timing_trigger(60, kBurlEntersTown);
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room137::pre_parser() {
if (player_said("KEYS", "PATROL CAR")) {
// Convenience added for ScummVM, using keys on the patrol car is
// the same as using the keys on the trunk specifically
player_hotspot_walk_override(500, 355, 10);
}
}
void Room137::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(flags)[V046] && (player_said("gear", "trunk") || player_said("gear", "trunk "))) {
_G(wilbur_should) = 7;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("conv15")) {
conv15();
} else if (_G(walker).wilbur_said(SAID)) {
// Nothing needed
} else if (player_said("LOOK AT", "TRUNK") || player_said("LOOK AT", "TRUNK ")) {
if (!_G(flags)[V046]) {
wilbur_speech("137w005");
} else {
wilbur_speech(inv_object_is_here("JAWZ O' LIFE") ? "137w006" : "137w007");
}
} else if (player_said("keys", "trunk") || player_said("keys", "patrol car")) {
_G(wilbur_should) = 6;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("take", "jawz o' life") && inv_object_is_here("jawz o' life")) {
_G(wilbur_should) = 8;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if ((player_said("take", "keys") || player_said("gear", "keys")) &&
!inv_player_has("keys")) {
_G(wilbur_should) = 7;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("gear", "jawz o' life") && inv_object_is_here("jawz o' life")) {
wilbur_speech("137w011");
} else if (player_said("ENTER", "FORK IN THE ROAD") ||
player_said("look at", "FORK IN THE ROAD")) {
player_set_commands_allowed(false);
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1009);
} else if (player_said("LOOK AT", "CAR WINDOW")) {
_G(wilbur_should) = 35;
player_set_commands_allowed(false);
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
_G(player).command_ready = false;
}
void Room137::conv15() {
_G(kernel).trigger_mode = KT_PARSE;
const int who = conv_whos_talking();
const int node = conv_current_node();
const int entry = conv_current_entry();
if (_G(kernel).trigger == 14) {
if (who <= 0) {
if (node == 7) {
_sherrifShould = 25;
} else {
_sherrifShould = 22;
conv_resume_curr();
}
} else if (who == 1) {
conv_resume_curr();
}
} else if (conv_sound_to_play()) {
if (who <= 0) {
if (node == 3 || node == 9 || node == 12 || node == 13 || node == 19 || node == 11)
_arrested = true;
_sherrifShould = (node == 20 && entry == 1) || (node == 21 && entry == 1) ? 24 : 23;
_digi1 = conv_sound_to_play();
} else if (who == 1) {
wilbur_speech(conv_sound_to_play(), 14);
}
} else {
conv_resume_curr();
}
}
void Room137::unloadAssets() {
const char *NAMES[13] = {
"137_020", "137_021", "137_022", "137_023", "137_024",
"137_025", "137_026", "137_027", "138_028", "138_013",
"137_014", "137_015", "137_016"
};
for (int i = 0; i < 13; ++i)
digi_unload(NAMES[i]);
}
void Room137::jawz() {
if (_G(flags)[V046]) {
_series3 = series_play("137tr01", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
if (inv_object_is_here("jawz o' life")) {
_series2 = series_play("137jaws", 0x600, 0, -1, 600, -1, 100, 0, 0, 0, 0);
} else {
hotspot_set_active("jawz o' life", false);
}
} else {
_series3 = series_play("137tr02", 0x700, 0, -1, 600, -1, 100, 0, 0, 0, 0);
hotspot_set_active("keys", false);
hotspot_set_active("trunk ", false);
hotspot_set_active("jawz o' life", false);
}
}
void Room137::movementCheck() {
if (_G(flags)[kPoliceCheckCtr] && player_commands_allowed()) {
++_G(flags)[kPoliceCheckCtr];
player_update_info();
if (_G(player_info).y < 300 && inv_player_has("keys")) {
_G(flags)[kPoliceState] = 6;
_G(flags)[kPoliceCheckCtr] = 201;
}
if (_G(player_info).y < 308 && _G(flags)[V046])
_G(flags)[kPoliceCheckCtr] = 201;
if (_G(flags)[kPoliceCheckCtr] >= 200) {
player_set_commands_allowed(false);
intr_freshen_sentence();
_G(flags)[kPoliceCheckCtr] = 0;
_flag1 = false;
if (_G(flags)[kPoliceState] == 6) {
kernel_timing_trigger(100, 3);
digi_play("137_013", 2, 200, kSOMEONE_TOOK_KEYS);
} else if (_G(player_info).x > 460) {
ws_walk(307, 349, nullptr, -1, 2);
if (_G(flags)[V046]) {
digi_play("137_013", 2, 200, 6);
} else {
digi_play("137_013", 2, 200, 7);
}
} else if (_G(flags)[kPoliceState] == 1 || _G(flags)[kPoliceState] == 2 ||
_G(flags)[kPoliceState] == 3 || _G(flags)[kPoliceState] == 4) {
kernel_timing_trigger(30, 7);
} else {
digi_play("137_013", 2, 200, 7);
player_update_info();
if (_G(player_info).y < 308)
kernel_timing_trigger(180, 3);
}
}
}
}
void Room137::startPoliceTalk() {
conv_load_and_prepare("conv15", 15);
switch (_G(flags)[kPoliceState]) {
case 1:
conv_export_value_curr(0, 0);
break;
case 2:
case 3:
conv_export_value_curr(1, 0);
break;
case 4:
conv_export_value_curr(4, 0);
break;
case 5:
conv_export_value_curr(2, 0);
break;
case 6:
conv_export_value_curr(3, 0);
break;
default:
break;
}
conv_export_value_curr(_G(flags)[V049], 2);
conv_export_value_curr(_G(flags)[kRoadOpened], 3);
conv_play_curr();
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,66 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM137_H
#define M4_BURGER_ROOMS_SECTION1_ROOM137_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room137 : public Room {
private:
bool _flag1 = false;
bool _flag2 = false;
bool _arrested = false;
int _volume = 255;
int _deputyShould = 0;
int _deputyMode = 0;
int _sherrifShould = 0;
int _sherrifMode = 0;
const char *_digi1 = nullptr;
machine *_door = nullptr;
machine *_series2 = nullptr;
machine *_series3 = nullptr;
void conv15();
void unloadAssets();
void jawz();
void movementCheck();
void startPoliceTalk();
public:
Room137() : Room() {}
~Room137() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,725 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room138.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
enum {
kCHANGE_DEPUTY_ANIMATION = 1,
kCHANGE_SHERRIF_ANIMATION = 2,
kCHANGE_WILBUR_ANIMATION = 3
};
static const char *SAID[][4] = {
{ "DONUTS", "138W002", "138W003", "138W003" },
{ "IGNITION SWITCH", "138W006", "138W007", "138W006" },
{ "HORN", "138W008", "138W007", nullptr },
{ "RADIO", "138W009", "138W007", nullptr },
{ "POLICE RADIO", "138W010", "138W007", "138W004" },
{ "RADAR", "138W011", "138W007", "138W004" },
{ "SHERIFF", "138W012", "138W013", "138W004" },
{ "DEPUTY", "138W014", "138W013", "138W004" },
{ "PATROL CAR", "138W015", "138W013", "138W016" },
{ "EXIT", nullptr, "138W017", "138W017" },
{ nullptr, nullptr, nullptr, nullptr }
};
static const seriesPlayBreak PLAY1[] = {
{ 0, 3, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 4, 4, nullptr, 1, 255, 8, 0, 0, nullptr, 0 },
{ 5, -1, nullptr, 1, 255, 10, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY2[] = {
{ 0, 11, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 12, 12, "138_003", 1, 255, -1, 0, 0, nullptr, 0 },
{ 12, 12, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 12, 12, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 12, 12, nullptr, 1, 255, 5, 0, 0, nullptr, 0 },
{ 12, 12, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 11, 0, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY3[] = {
{ 6, 8, nullptr, 1, 255, 12, 0, 0, nullptr, 0 },
{ 7, 6, "138_006", 1, 255, -1, 0, 0, nullptr, 0 },
{ 7, 8, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 8, 6, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 6, 7, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 6, 7, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 7, 6, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 6, 8, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 8, 6, nullptr, 1, 255, -1, 2048, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY4[] = {
{ 25, 5, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 4, 0, nullptr, 1, 255, 11, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
void Room138::preload() {
_G(player).walker_in_this_scene = false;
}
void Room138::init() {
_assetsFreed = false;
_series3 = -1;
_flag1 = false;
static const char *NAMES[12] = {
"138_004", "137_012", "137_013", "137_020", "137_021",
"137_022", "137_023", "137_024", "137_025", "137_026",
"137_027", "137_028"
};
for (int i = 0; i < 12; ++i)
digi_preload(NAMES[i]);
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
if (_G(flags)[kPoliceCheckCtr])
_G(flags)[kPoliceCheckCtr] = 1;
break;
default:
break;
}
if (inv_object_is_here("keys")) {
digi_preload("138_001");
digi_play_loop("138_001", 3, 255);
} else {
digi_preload("138_002");
digi_play_loop("138_002", 3, 255);
}
if (inv_object_is_here("keys")) {
hotspot_set_active("ignition switch", false);
_series1 = series_play("138keys", 0xa00, 0, -1, 7, -1, 100, 0, 0, 0, 0);
} else {
hotspot_set_active("keys", false);
}
_frame = 22;
_deputyMode = 18;
_deputyShould = 18;
kernel_trigger_dispatch_now(1);
_val4 = -1;
_sherrifMode = 26;
_sherrifShould = 26;
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
_wilburMode = 2;
_wilburShould = 1;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
_series2 = series_play("138donut", 0x400, 0, -1, 7, -1, 100, 0, 0, 0, 0);
if (!inv_object_is_here("keys"))
kernel_timing_trigger(10, 13);
if (!player_been_here(138)) {
player_set_commands_allowed(false);
wilbur_speech("138w001");
}
digi_play("137_021", 2);
}
void Room138::daemon() {
switch (_G(kernel).trigger) {
case kCHANGE_DEPUTY_ANIMATION:
switch (_deputyMode) {
case 18:
switch (_deputyShould) {
case 18:
case 23:
case 25:
if (_deputyShould == 23 && _frame == 42) {
freeAssets();
_deputyMode = 23;
series_play("138cp06", 0x500, 0, kCHANGE_DEPUTY_ANIMATION, 7, 0, 100, 0, 0, 30, 45);
} else if (_deputyShould == 25 && _frame == 42) {
_deputyShould = 18;
series_play("138cp02", 0x500, 0, kCHANGE_DEPUTY_ANIMATION, 7, 0, 100, 0, 0, 31, 61);
} else if (_frame == 42 && imath_ranged_rand(1, 5) != 1) {
series_play("138cp01", 0x500, 0, kCHANGE_DEPUTY_ANIMATION, 60, 0, 100, 0, 0, 23, 23);
} else {
if (++_frame == 43)
_frame = 23;
series_play("138cp01", 0x500, 0, kCHANGE_DEPUTY_ANIMATION, 7, 0, 100, 0, 0, _frame, _frame);
}
break;
case 22:
freeAssets();
_deputyMode = 22;
series_play("138cp04", 0x500, 0, kCHANGE_DEPUTY_ANIMATION, 7, 0, 100, 0, 0, 10, 16);
break;
default:
break;
}
break;
case 22:
if (imath_ranged_rand(1, 10) == 1) {
series_play("138cp04", 0x500, 1, kCHANGE_DEPUTY_ANIMATION, 7, 0, 100, 0, 0, 16, 18);
} else {
series_play("138cp04", 0x500, 0, kCHANGE_DEPUTY_ANIMATION, 10, 0, 100, 0, 0, 16, 16);
}
break;
case 23:
_deputyMode = 24;
series_play("138cp06", 0x500, 0, kCHANGE_DEPUTY_ANIMATION, 6, 0, 100, 0, 0, 46, 49);
digi_play("138_004", 1, 255);
break;
case 24:
series_play("138cp06", 0x500, 0, -1, 60, -1, 100, 0, 0, 49, 49);
break;
default:
break;
}
break;
case kCHANGE_SHERRIF_ANIMATION:
switch (_sherrifMode) {
case 26:
switch (_sherrifShould) {
case 26:
case 33:
case 36:
if (_sherrifShould == 33 && _val4 == 22) {
freeAssets();
term_message("xxx");
_sherrifShould = 34;
series_play("138cp06", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 18);
digi_play("138_005", 2);
} else if (_sherrifShould == 36 && _val4 == 22) {
_sherrifShould = 26;
series_play("138cp02", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 0, 30);
randomDigi();
} else if (_val4 == 22 && !inv_object_is_here("keys") &&
imath_ranged_rand(1, 2) == 1) {
term_message(".........................");
_sherrifShould = 37;
series_play("138cp02", 0x100, 2, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 25, 30);
} else if (_val4 == 22 && imath_ranged_rand(1, 6) != 1) {
series_play("138cp01", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 60, 0, 100, 0, 0, 0, 0);
} else {
_flag1 = false;
switch (++_val4) {
case 13:
digi_play("137_022", 2);
break;
case 23:
_val4 = 0;
digi_play(imath_ranged_rand(1, 2) == 1 ? "137_020" : "137_021", 2);
break;
default:
break;
}
series_play("138cp01", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 7, 0, 100, 0, 0, _val4, _val4);
}
break;
case 31:
freeAssets();
_sherrifShould = 32;
series_play("138cp04", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 7, 0, 100, 0, 0, 0, 7);
break;
case 32:
kernel_timing_trigger(120, 7);
if (!inv_object_is_here("keys"))
_G(flags)[kPoliceState] = 6;
_G(flags)[kPoliceCheckCtr] = 200;
_sherrifMode = 31;
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
case 34:
terminateMachineAndNull(_series2);
_sherrifShould = 35;
series_play("138cp06", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 19, 29);
break;
case 35:
kernel_timing_trigger(120, 7);
if (!inv_object_is_here("keys"))
_G(flags)[kPoliceState] = 6;
_G(flags)[kPoliceCheckCtr] = 200;
_sherrifMode = 33;
kernel_trigger_dispatch_now(kCHANGE_SHERRIF_ANIMATION);
break;
case 37:
_sherrifShould = 38;
series_play("138cp02", 0x100, 2, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 10, 24);
randomDigi();
break;
case 38:
_sherrifShould = 26;
series_play("138cp02", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 8, 0, 100, 0, 0, 26, 30);
_flag1 = true;
break;
default:
break;
}
break;
case 31:
if (imath_ranged_rand(1, 10) == 1) {
series_play("138cp04", 0x100, 1, kCHANGE_SHERRIF_ANIMATION, 7, 0, 100, 0, 0, 7, 9);
} else {
series_play("138cp04", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 10, 0, 100, 0, 0, 7, 7);
}
break;
case 33:
if (imath_ranged_rand(1, 10) == 1) {
series_play("138cp06", 0x100, 1, kCHANGE_SHERRIF_ANIMATION, 7, 0, 100, 0, 0, 27, 29);
} else {
series_play("138cp06", 0x100, 0, kCHANGE_SHERRIF_ANIMATION, 10, 0, 100, 0, 0, 27, 27);
}
break;
default:
break;
}
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_wilburMode) {
case 2:
switch (_wilburShould) {
case 1:
switch (imath_ranged_rand(1, 20)) {
case 1:
_wilburMode = 3;
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 3);
break;
case 2:
_wilburMode = 6;
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 17, 17);
break;
default:
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 30, 0, 100, 0, 0, 0, 0);
break;
}
break;
case 7:
series_load("138wi03");
digi_preload("138_002");
_wilburShould = 8;
series_play("138wi05", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 11);
break;
case 8:
_wilburShould = 9;
series_play_with_breaks(PLAY1, "138wi03", 0xa00, kCHANGE_WILBUR_ANIMATION, 2, 6, 100, 0, 0);
break;
case 9:
player_set_commands_allowed(true);
_wilburShould = 1;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
_deputyShould = 25;
_sherrifShould = 36;
break;
case 10:
_wilburShould = 1;
series_play_with_breaks(PLAY2, "138wi05", 0xa00, kCHANGE_WILBUR_ANIMATION, 2, 6, 100, 0, 0);
break;
case 11:
series_load("138wi06");
digi_preload("138_002");
_wilburShould = 12;
series_play("138wi05", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 11);
break;
case 12:
_wilburShould = 13;
series_play_with_breaks(PLAY3, "138wi06", 0xa00, kCHANGE_WILBUR_ANIMATION, 2, 6, 100, 0, 0);
break;
case 13:
_wilburShould = 14;
series_play("138wi05", 0xa00, 2, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 11);
break;
case 14:
_wilburShould = 1;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
if (inv_object_is_here("keys")) {
_sherrifShould = 33;
_deputyShould = 23;
} else {
player_set_commands_allowed(true);
}
break;
case 15:
_wilburMode = 15;
_G(walker).wilbur_say();
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 16:
series_load("138wi03");
digi_preload("138_001");
_wilburShould = 17;
series_play_with_breaks(PLAY4, "138wi03", 0xa00, kCHANGE_WILBUR_ANIMATION, 2, 6, 100, 0, 0);
break;
case 17:
_wilburShould = 9;
series_play("138wi05", 0xa00, 2, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 11);
break;
default:
break;
}
break;
case 3:
if (_wilburShould == 1) {
switch (imath_ranged_rand(1, 20)) {
case 1:
_wilburMode = 2;
series_play("138wi01", 0xa00, 2, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 3);
break;
case 2:
_wilburMode = 4;
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 4, 9);
break;
default:
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 30, 0, 100, 0, 0, 3, 3);
break;
}
} else {
_wilburMode = 4;
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 4, 9);
}
break;
case 4:
if (_wilburShould == 1) {
switch (imath_ranged_rand(1, 20)) {
case 1:
_wilburMode = 3;
series_play("138wi01", 0xa00, 2, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 4, 9);
break;
case 2:
_wilburMode = 5;
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 10, 12);
break;
default:
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 30, 0, 100, 0, 0, 9, 9);
break;
}
} else {
_wilburMode = 5;
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 10, 12);
}
break;
case 5:
if (_wilburShould == 1) {
switch (imath_ranged_rand(1, 20)) {
case 1:
_wilburMode = 4;
series_play("138wi01", 0xa00, 2, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 10, 12);
break;
case 2:
_wilburMode = 6;
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 13, 17);
break;
default:
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 30, 0, 100, 0, 0, 12, 12);
break;
}
} else {
_wilburMode = 6;
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 13, 17);
}
break;
case 6:
if (_wilburShould == 1) {
switch (imath_ranged_rand(1, 20)) {
case 1:
_wilburMode = 5;
series_play("138wi01", 0xa00, 2, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 13, 17);
break;
case 2:
_wilburMode = 2;
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 0);
break;
default:
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 30, 0, 100, 0, 0, 17, 17);
break;
}
} else {
_wilburMode = 2;
series_play("138wi01", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 7, 0, 100, 0, 0, 0, 0);
}
break;
case 15:
if (_wilburShould == 15) {
loadSeries();
const int frame = imath_ranged_rand(0, 4);
series_play("138wi02", 0xa00, 0, kCHANGE_WILBUR_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
} else {
freeSeries();
_wilburShould = 1;
_wilburMode = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
default:
break;
}
break;
case 4:
player_set_commands_allowed(true);
break;
case 5:
_sherrifShould = 31;
_deputyShould = 22;
break;
case 6:
// Waking them up
_sherrifShould = 33;
_deputyShould = 23;
player_set_commands_allowed(false);
break;
case 7:
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1010);
break;
case 8:
terminateMachineAndNull(_series1);
break;
case 10:
digi_play_loop("138_002", 3, 255);
_G(flags)[kPoliceState] = 4;
inv_give_to_player("keys");
hotspot_set_active("keys", false);
hotspot_set_active("ignition switch", true);
_G(flags)[kPoliceCheckCtr]++;
kernel_timing_trigger(10, 13);
break;
case 11:
digi_preload("138_001");
digi_play_loop("138_001", 3, 255);
_series1 = series_play("138keys", 0xa00, 0, -1, 7, -1, 100, 0, 0, 0, 0);
_G(flags)[kPoliceState] = 0;
_G(flags)[kPoliceCheckCtr] = 0;
inv_move_object("keys", 138);
hotspot_set_active("keys", true);
hotspot_set_active("ignition switch", false);
break;
case 12:
digi_play_loop("138_002", 3, 255);
break;
case 13:
if (_G(flags)[kPoliceCheckCtr] && player_commands_allowed()) {
if (++_G(flags)[kPoliceCheckCtr] >= 200) {
player_set_commands_allowed(false);
_G(flags)[kPoliceState] = 4;
_sherrifShould = 33;
_deputyShould = 23;
}
}
kernel_timing_trigger(10, 13);
break;
case kWILBURS_SPEECH_START:
_wilburShould = 15;
player_set_commands_allowed(false);
break;
case kWILBURS_SPEECH_FINISHED:
_wilburShould = 1;
player_set_commands_allowed(true);
_G(kernel).continue_handling_trigger = true;
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room138::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(walker).wilbur_said(SAID)) {
// Nothing needed
} else if (player_said("keys", "ignition switch")) {
_wilburShould = 16;
player_set_commands_allowed(false);
} else if ((player_said("donuts") || player_said("keys") ||
player_said("ignition switch") || player_said("horn") ||
player_said("radio") || player_said("police radio") ||
player_said("radar") || player_said("deputy") ||
player_said("patrol car")) && inv_player_has(_G(player).verb)) {
wilbur_speech("138w004");
} else if (player_said("gear", "horn")) {
player_set_commands_allowed(false);
_G(flags)[kPoliceState] = 1;
_wilburShould = 10;
} else if (player_said("gear", "radio")) {
player_set_commands_allowed(false);
if (inv_object_is_here("keys"))
_G(flags)[kPoliceState] = 2;
_wilburShould = 11;
} else if (player_said("talk to") &&
(player_said("sheriff") || player_said("deputy"))) {
player_set_commands_allowed(false);
_G(flags)[kPoliceState] = 3;
wilbur_speech("138w610", 6, 138);
_wilburShould = 15;
} else if (player_said("take", "keys") && !inv_player_has("keys")) {
_wilburShould = 7;
player_set_commands_allowed(false);
} else if (player_said("look at", "keys") && inv_object_is_here("keys")) {
wilbur_speech("138w005");
} else if (player_said("gear", "keys")) {
wilbur_speech("138w004");
} else if (player_said("keys") && inv_player_has(_G(player).verb)) {
wilbur_speech("138w004");
} else if (player_said("exit") || player_said("look at", "exit")) {
player_set_commands_allowed(false);
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1010);
} else {
return;
}
_G(player).command_ready = false;
}
void Room138::freeAssets() {
if (!_assetsFreed) {
_assetsFreed = true;
digi_stop(2);
static const char *NAMES[11] = {
"137_020", "137_021", "137_022", "137_023", "137_024",
"137_025", "137_026", "137_027", "137_028", "137_012",
"137_013"
};
for (int i = 0; i < 11; ++i)
digi_unload(NAMES[i]);
digi_unload(inv_object_is_here("keys") ? "138_002" : "138_001");
}
}
void Room138::randomDigi() {
digi_play(Common::String::format("137_0%d", imath_ranged_rand(23, 27)).c_str(), 2);
}
void Room138::loadSeries() {
if (_series3 == -1)
_series3 = series_load("138wi02");
}
void Room138::freeSeries() {
if (_series3 != -1) {
series_unload(_series3);
_series3 = -1;
}
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,66 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM138_H
#define M4_BURGER_ROOMS_SECTION1_ROOM138_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room138 : public Room {
private:
machine *_series1 = nullptr;
machine *_series2 = nullptr;
int _series3 = 0;
int _frame = 0;
int _deputyMode = 0;
int _deputyShould = 0;
int _val4 = 0;
int _sherrifMode = 0;
int _sherrifShould = 0;
int _wilburMode = 0;
int _wilburShould = 0;
bool _assetsFreed = false;
bool _flag1 = false;
void freeAssets();
void randomDigi();
void loadSeries();
void freeSeries();
public:
Room138() : Room() {}
~Room138() override {}
void preload() override;
void init() override;
void daemon() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,494 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room139_144.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
enum {
kCHANGE_BURL_ANIMATION = 9
};
static const char *SAID1[][4] = {
{ "ISLAND", nullptr, "999w011", "999w011" },
{ "ROCK", "144W004", "999w011", "999w011" },
{ "SHACK", "144W005", "999w011", nullptr },
{ "SIGN", "144W006", nullptr, nullptr },
{ "ROWBOAT", "144W007", nullptr, nullptr },
{ "WATER", "144W008", "999w011", "144W009" },
{ "BURL", "144W010", "999w011", "999w011" },
{ "MOTORBOAT", "144W012", nullptr, "144W013" },
{ "VERA'S DINER", nullptr, "999w011", "999w011" },
{ nullptr, nullptr, nullptr, nullptr }
};
static const char *SAID2[][4] = {
{ "ISLAND", "139W001", "139W002", "139W002" },
{ "ROCK", nullptr, "139W002", "139W002" },
{ "SHACK", "139W005", "139W002", nullptr },
{ "SIGN", "139W006", nullptr, nullptr },
{ "ROWBOAT", "139W007", nullptr, nullptr },
{ "WATER", "139W008", "139W002", "139W009" },
{ "VERA'S DINER", nullptr, "139W002", "139W002" },
{ nullptr, nullptr, nullptr, nullptr }
};
static const seriesPlayBreak PLAY1[] = {
{ 0, 32, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 33, 39, "139_002", 2, 255, -1, 0, 0, nullptr, 0 },
{40, 43, nullptr, 1, 255, 8, 0, 0, nullptr, 0},
{44, 52, "139_003", 2, 255, -1, 0, 0, nullptr, 0},
{52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0},
{52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0},
{52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0},
{52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0},
{52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0},
{52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0},
{52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0},
{52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0},
{52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0},
{52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0},
{52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0},
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY2[] = {
{ 0, 35, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 36, 39, "144_002", 2, 255, -1, 0, 0, nullptr, 0 },
{ 40, 46, nullptr, 1, 255, 8, 0, 0, nullptr, 0 },
{ 47, 52, "144_003", 2, 255, -1, 0, 0, nullptr, 0 },
{ 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
{ 52, 52, nullptr, 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesStreamBreak SERIES1[] = {
{ 6, nullptr, 2, 255, 2, 0, nullptr, 0 },
{ 10, "100_022", 2, 255, -1, 0, nullptr, 0 },
{ -1, nullptr, 0, 0, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
static const seriesStreamBreak SERIES2[] = {
{ 1, "144b001", 1, 255, -1, 0, nullptr, 0 },
{ 45, nullptr, 1, 255, 5, 0, nullptr, 0 },
STREAM_BREAK_END
};
void Room139_144::init() {
_val1 = 0;
_burlFrame = 15;
digi_preload("144_001");
if (_G(game).previous_room == 144)
preloadDigi();
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
break;
case 139:
player_set_commands_allowed(false);
ws_demand_location(470, 269, 8);
_burlShould = 1;
_burlMode = 3;
kernel_trigger_dispatch_now(9);
break;
case 141:
ws_demand_location(250, 224, 4);
break;
case 142:
ws_demand_location(670, 257, 9);
ws_walk(596, 245, nullptr, -1, 8);
break;
default:
ws_demand_location(320, 271, 5);
break;
}
if (_G(game).previous_room != 139 && _G(flags)[V000] == 1002) {
_burlShould = _burlMode = 3;
kernel_trigger_dispatch_now(kCHANGE_BURL_ANIMATION);
}
if (_G(flags)[kPerkinsLostIsland]) {
series_play("144mb01", 0x600, 0, -1, 600, -1, 100, 0, 0, 0, 0);
} else {
hotspot_set_active("motorboat", false);
}
_series1 = series_play((_G(flags)[V000] == 1002) ? "144rboat" : "139rboat",
0xf00, 0, -1, 600, -1, 100, 0, 0, 0, 0);
digi_play_loop("144_001", 3);
}
void Room139_144::daemon() {
switch (_G(kernel).trigger) {
case 2:
digi_change_volume(2, 0);
break;
case 3:
// Burl's truck crashing off of bridge
pal_fade_set_start(0);
ws_hide_walker();
terminateMachineAndNull(_series1);
gr_backup_palette();
digi_preload("100_022");
digi_preload_stream_breaks(SERIES1);
series_stream_with_breaks(SERIES1, "120dt01", 8, 0, 1012);
kernel_timing_trigger(1, 4);
break;
case 4:
pal_fade_init(15, 255, 100, 0, -1);
break;
case 5:
digi_play("144b003d", 1);
break;
case 6:
player_set_commands_allowed(true);
_burlShould = 3;
break;
case 7:
ws_hide_walker();
terminateMachineAndNull(_series1);
if (_G(flags)[V000] == 1002) {
series_play_with_breaks(PLAY2, "144wi01", 0xf00, -1, 3, 6, 100, 0, 0);
} else {
series_play_with_breaks(PLAY1, "139wi01", 0xf00, -1, 3, 6, 100, 0, 0);
}
break;
case 8:
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1013);
break;
case kCHANGE_BURL_ANIMATION:
switch (_burlMode) {
case 3:
switch (_burlShould) {
case 1:
_burlShould = 2;
series_play("144bu01s", 0x301, 0, -1, 8);
digi_preload("144b003d");
digi_preload_stream_breaks(SERIES2);
series_stream_with_breaks(SERIES2, "144bu01", 8, 0x300, kCHANGE_BURL_ANIMATION);
break;
case 2:
digi_unload_stream_breaks(SERIES2);
player_set_commands_allowed(true);
randomDigi();
_burlShould = 3;
series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 15);
series_play("144bu03s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 15);
break;
case 3:
if (imath_ranged_rand(5, 10) < ++_val1) {
switch (imath_ranged_rand(1, 4)) {
case 1:
_burlFrame = 25;
break;
case 2:
_burlFrame = 36;
break;
case 3:
_burlFrame = 41;
break;
case 4:
_burlFrame = 42;
break;
default:
break;
}
}
if (imath_ranged_rand(1, 10) == 1) {
switch (imath_ranged_rand(1, 4)) {
case 1:
randomDigi();
series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 10, 0, 100, 0, 0, 16, 24);
series_play("144bu03s", 0x301, 0, -1, 10, 0, 100, 0, 0, 16, 24);
break;
case 2:
randomDigi();
series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 10, 0, 100, 0, 0, 26, 35);
series_play("144bu03s", 0x301, 0, -1, 10, 0, 100, 0, 0, 26, 35);
break;
case 3:
randomDigi();
series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 10, 0, 100, 0, 0, 37, 40);
series_play("144bu03s", 0x301, 0, -1, 10, 0, 100, 0, 0, 37, 40);
break;
case 4:
_burlShould = 7;
series_play("144bu06", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 12);
series_play("144bu06s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 12);
break;
default:
break;
}
} else {
series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, _burlFrame, _burlFrame);
series_play("144bu03s", 0x301, 0, -1, 7, 0, 100, 0, 0, _burlFrame, _burlFrame);
}
break;
case 4:
case 5:
digi_play("144b002", 2);
_burlMode = 6;
series_play("144bu06", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 2);
series_play("144bu06s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 2);
break;
case 7:
digi_change_volume(2, 0);
_burlMode = 7;
series_play("144bu07", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 2);
series_play("144bu07s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 2);
break;
default:
break;
}
break;
case 4:
switch (_burlShould) {
case 4:
series_play("144bu08", 0x300, 0, kCHANGE_BURL_ANIMATION, 10, 0, 100, 0, 0, 3, 3);
series_play("144bu08s", 0x301, 0, -1, 10, 0, 100, 0, 0, 3, 3);
break;
case 5:
_burlMode = 5;
series_play("144bu08", 0x300, 0, kCHANGE_BURL_ANIMATION, 4, 0, 100, 0, 0, 4, 7);
series_play("144bu08s", 0x301, 0, -1, 4, 0, 100, 0, 0, 4, 7);
break;
default:
digi_play("144b002", 2);
_burlMode = 3;
_burlShould = 2;
series_play("144bu08", 0x300, 2, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 3);
series_play("144bu08s", 0x301, 2, -1, 7, 0, 100, 0, 0, 0, 3);
break;
}
break;
case 5:
if (_burlShould == 5) {
const int frame = imath_ranged_rand(0, 2);
series_play("144bu09", 0x300, 0, kCHANGE_BURL_ANIMATION, 4, 0, 100, 0, 0, frame, frame);
series_play("144bu09s", 0x301, 0, -1, 4, 0, 100, 0, 0, frame, frame);
if (_digi1) {
_G(kernel).trigger_mode = KT_PARSE;
digi_play(_digi1, 1, 255, 1);
_digi1 = nullptr;
}
} else {
_burlMode = 4;
series_play("144bu08", 0x300, 2, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 4, 7);
series_play("144bu08s", 0x301, 2, -1, 7, 0, 100, 0, 0, 4, 7);
}
break;
case 6:
_burlMode = 4;
series_play("144bu08", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 3);
series_play("144bu08s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 3);
break;
case 7:
if (_burlShould == 7) {
if (imath_ranged_rand(1, 10) == 1) {
randomDigi();
_burlMode = 3;
_burlShould = 3;
series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 15);
series_play("144bu03s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 15);
} else {
series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 10, 0, 100, 0, 0, 0, 0);
series_play("144bu03s", 0x301, 0, -1, 10, 0, 100, 0, 0, 0, 0);
}
} else {
_burlMode = 3;
series_play("144bu03", 0x300, 0, kCHANGE_BURL_ANIMATION, 7, 0, 100, 0, 0, 0, 15);
series_play("144bu03s", 0x301, 0, -1, 7, 0, 100, 0, 0, 0, 15);
}
break;
default:
break;
}
break;
case kBurlEntersTown:
if (!_G(flags)[kRoadOpened]) {
_G(kernel).continue_handling_trigger = true;
} else if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
Section1::updateDisablePlayer();
kernel_timing_trigger(1, 3);
} else {
kernel_timing_trigger(60, kBurlEntersTown);
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room139_144::pre_parser() {
if (player_said("vera's diner") && player_said_any("enter", "look", "look at"))
player_hotspot_walk_override_just_face(3);
}
void Room139_144::parser() {
const bool lookFlag = player_said_any("look", "look at");
_G(kernel).trigger_mode = KT_DAEMON;
if (player_said("talk to")) {
conv_load_and_prepare("conv31", 6);
conv_export_value_curr(_G(flags)[V052], 0);
conv_export_value_curr(_G(flags)[kPerkinsLostIsland], 1);
conv_play_curr();
} else if (_G(flags)[V000] == 1002 && _G(walker).wilbur_said(SAID1)) {
// Do nothing
} else if (_G(flags)[V000] == 1002 && _G(walker).wilbur_said(SAID2)) {
// Do nothing
} else if (player_said("conv31")) {
conv31();
} else if (inv_player_has(_G(player).verb) && _G(flags)[V000] == 1002 &&
player_said_any("island", "rock")) {
_G(walker).wilbur_speech("999w011");
} else if (inv_player_has(_G(player).verb) && _G(flags)[V000] == 1002 &&
player_said("burl")) {
_G(walker).wilbur_speech("144w011");
} else if (inv_player_has(_G(player).verb) && _G(flags)[V000] != 1002 &&
player_said_any("rock", "island")) {
_G(walker).wilbur_speech("139w002");
} else if (lookFlag && player_said("rock")) {
wilbur_speech(inv_player_has("deed") ? "139w004" : "139w003");
} else if (lookFlag && player_said("island") && _G(flags)[V000] == 1002) {
wilbur_speech(_G(flags)[kPerkinsLostIsland] ? "144w002" : "144w001");
} else if (player_said("enter", "vera's diner") || (lookFlag && player_said("vera's diner"))) {
player_set_commands_allowed(false);
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, 1014);
} else if (player_said("gear", "rowboat") || player_said("go island")) {
player_set_commands_allowed(false);
kernel_trigger_dispatch_now(7);
} else {
return;
}
_G(player).command_ready = false;
}
void Room139_144::preloadDigi() {
digi_preload("144b002");
digi_preload("144b003a");
digi_preload("144b003b");
digi_preload("144b003c");
}
void Room139_144::randomDigi() {
if (!digi_play_state(2)) {
digi_play(Common::String::format("144b003%c", 'a' + imath_ranged_rand(0, 2)).c_str(), 2, 255);
}
digi_change_volume(2, 255);
}
void Room139_144::conv31() {
_G(kernel).trigger_mode = KT_PARSE;
const int who = conv_whos_talking();
if (_G(kernel).trigger == 1) {
if (who <= 0) {
_burlShould = 4;
conv_resume();
} else if (who == 1) {
conv_resume();
sendWSMessage(0x150000, 0, _G(my_walker), 0, nullptr, 1);
}
} else if (conv_sound_to_play()) {
if (who <= 0) {
_burlShould = 5;
_digi1 = conv_sound_to_play();
} else if (who == 1) {
wilbur_speech(conv_sound_to_play(), 1);
}
} else {
conv_resume();
}
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,58 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM144_H
#define M4_BURGER_ROOMS_SECTION1_ROOM144_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room139_144 : public Room {
private:
machine *_series1 = nullptr;
const char *_digi1 = nullptr;
int _val1 = 0;
int _burlFrame = 0;
int _burlShould = 0;
int _burlMode = 0;
void preloadDigi();
void randomDigi();
void conv31();
public:
Room139_144() : Room() {}
~Room139_144() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,63 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM140_141_H
#define M4_BURGER_ROOMS_SECTION1_ROOM140_141_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room140_141 : public Room {
private:
machine *_series1 = nullptr;
machine *_series2 = nullptr;
int _elmoMode = 0;
int _elmoShould = 0;
int _trufflesMode = 0;
int _trufflesShould = 0;
int _wilburMode = 0;
int _wilburShould = 0;
int _trufflesFrame = 0;
bool _flag1 = false;
bool _flag2 = false;
void conv20();
void playRandom();
void loadSeries();
public:
Room140_141() : Room() {}
~Room140_141() override {}
void preload() override;
void init() override;
void daemon() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,763 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room142.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/burger.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
static const char *SAID[][4] = {
{ "VERA'S DINER", "142w001", "142w002", "142w002" },
{ "CAR", "142w003", nullptr, "142w004" },
{ "FANBELT", "142w005", nullptr, "142w002" },
{ "ICE BOX", "142w006", "142w002", nullptr },
{ "ICE", nullptr, nullptr, "142w002" },
{ "GARBAGE CANS", "142w010", "142w011", "142w012" },
{ "BACK DOOR", "142w013", "142w002", nullptr },
{ "PLANTS", "142w014", "142w015", "142w002" },
{ "SIGN", "142w016", "142w017", "142w002" },
{ "SIGN ", "142w018", "142w002", "142w002" },
{ "FRONT DOOR", nullptr, "142w002", nullptr },
{ "MAIN STREET", nullptr, "142w002", nullptr },
{ "HANLON'S POINT", nullptr, "142w002", nullptr },
{ "AUNT POLLY'S HOUSE", nullptr, "142w002", nullptr },
{ "PARKING LOT", nullptr, "142w002", nullptr },
{ "HIGHWAY 2", "142w020", "142w002", "142w021" },
{ nullptr, nullptr, nullptr, nullptr }
};
const WilburMatch Room142::MATCH[] = {
{ "GEAR", "PARKING LOT", 9, &Flags::_flags[V000], 1003, &_val1, 18 },
{ "LOOK AT", "PARKING LOT", 9, &Flags::_flags[V000], 1003, &_val1, 18 },
{ "GEAR", "PARKING LOT", 5, &Flags::_flags[kTourBusAtDiner], 0, &_val2, 13 },
{ "LOOK AT", "PARKING LOT", 5, &Flags::_flags[kTourBusAtDiner], 0, &_val2, 13 },
{ "GEAR", "ICE BOX", kCHANGE_WILBUR_ANIMATION, &Flags::_flags[kIceBoxOpened], 0, &Vars::_wilbur_should, 1 },
{ "TAKE", "FANBELT", kCHANGE_WILBUR_ANIMATION, nullptr, 0, &Vars::_wilbur_should, 9 },
{ "GEAR", "BACK DOOR", 6, nullptr, 0, nullptr, 0 },
WILBUR_MATCH_END
};
const seriesPlayBreak Room142::PLAY1[] = {
{ 8, 12, "100_010", 2, 255, -1, 0, 0, &_val3, 1 },
{ 8, 12, "100_011", 2, 255, -1, 0, 0, &_val3, 2 },
{ 8, 12, "100_012", 2, 255, -1, 0, 0, &_val3, 3 },
{ 13, -1, nullptr, 0, 0, 10, 0, 0, nullptr, 0 },
{ -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room142::PLAY2[] = {
{ 0, -1, "100_015", 2, 255, -1, 1, 3, nullptr, 0 },
{ 0, -1, "100_017", 2, 255, -1, 1, 3, nullptr, 0 },
{ 1, 1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room142::PLAY3[] = {
{ 0, 26, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 27, -1, nullptr, 0, 0, 14, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room142::PLAY4[] = {
{ 0, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 3, 6, "142b901", 2, 255, -1, 4, -1, nullptr, 0 },
{ 7, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room142::PLAY5[] = {
{ 1, 1, "100_021", 2, 255, -1, 0, 12, nullptr, 0 },
{ 0, -1, "100_015", 2, 255, -1, 1, 4, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room142::PLAY6[] = {
{ 0, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 1, 10, "100_010", 2, 255, -1, 0, 0, &_val3, 1 },
{ 1, 10, "100_011", 2, 255, -1, 0, 0, &_val3, 2 },
{ 1, 10, "100_012", 2, 255, -1, 0, 0, &_val3, 3 },
{ 11, 14, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room142::PLAY7[] = {
{ 15, -1, "100_010", 2, 255, -1, 0, 0, &_val3, 1 },
{ 15, -1, "100_011", 2, 255, -1, 0, 0, &_val3, 2 },
{ 15, -1, "100_012", 2, 255, -1, 0, 0, &_val3, 3 },
{ -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room142::PLAY8[] = {
{ 0, 5, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 6, 25, nullptr, 0, 0, 13, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room142::PLAY9[] = {
{ 0, 3, "142_003", 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room142::PLAY10[] = {
{ 3, 0, "142_002", 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room142::PLAY11[] = {
{ 4, 13, "142_001", 1, 255, -1, 0, 0, nullptr, 0 },
{ 14, -1, "142_002", 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room142::PLAY12[] = {
{ 0, -1, "142_005", 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room142::PLAY13[] = {
{ 0, 1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 2, 7, "100_010", 2, 255, -1, 0, 0, &_val3, 1 },
{ 2, 7, "100_011", 2, 255, -1, 0, 0, &_val3, 2 },
{ 2, 7, "100_012", 2, 255, -1, 0, 0, &_val3, 3 },
{ -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room142::PLAY14[] = {
{ 0, 19, "142_007", 2, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
int32 Room142::_val1;
int32 Room142::_val2;
int32 Room142::_val3;
Room142::Room142() : Room() {
_val1 = 0;
_val2 = 0;
_val3 = 0;
}
void Room142::init() {
digi_preload("142_004");
digi_play_loop("142_004", 3, 255, -1);
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
if (_G(flags)[kIceBoxOpened]) {
ws_hide_walker();
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
case 101:
ws_demand_location(120, 400, 2);
ws_walk(120, 344, nullptr, -1, -1);
break;
case 139:
ws_demand_location(-40, 375, 2);
ws_walk(25, 344, nullptr, -1, -1);
break;
case 143:
ws_demand_location(350, 270, 8);
ws_walk(297, 275, nullptr, -1, -1);
break;
case 145:
ws_demand_location(293, 275, 7);
ws_walk(282, 280, nullptr, -1, -1);
break;
case 170:
ws_demand_location(680, 325, 9);
ws_walk(613, 331, nullptr, -1, -1);
break;
default:
ws_demand_location(270, 320);
ws_demand_facing(5);
break;
}
series_play("142sm01", 0xf00, 4, -1, 6, -1);
_series1 = series_show("142door", 0xe00);
if (inv_player_has("PANTYHOSE")) {
hotspot_set_active("FANBELT", false);
hotspot_set_active("ENGINE", true);
} else {
hotspot_set_active("FANBELT", true);
hotspot_set_active("ENGINE", false);
}
hotspot_set_active("TRUCK", false);
if (_G(flags)[V000] == 1003) {
_noWalk = intr_add_no_walk_rect(230, 250, 294, 277, 229, 278,
_G(screenCodeBuff)->get_buffer());
_series2 = series_show("142dt01", 0xd00, 0, -1, -1, 22);
_series3 = series_show("142dt01s", 0xd01, 0, -1, -1, 22);
hotspot_set_active("TRUCK", true);
}
hotspot_set_active("TOUR BUS", false);
if (_G(flags)[kTourBusAtDiner]) {
_series4 = series_show("142ba01", 0xf00, 0, -1, -1, 21);
hotspot_set_active("TOUR BUS", true);
}
if (!_G(flags)[kIceBoxOpened]) {
_series5 = series_show("142icedr", 0xe00);
hotspot_set_active("ICE", false);
}
}
void Room142::daemon() {
switch (_G(kernel).trigger) {
case 1:
terminateMachineAndNull(_series8);
terminateMachineAndNull(_series5);
terminateMachineAndNull(_series1);
if (_G(player_info.y) < 285) {
Section1::updateWalker(getRoadEdgeX(_G(player_info).y), 285, 9, 2);
} else {
Section1::updateWalker(getRoadEdgeX(_G(player_info).y), _G(player_info).y, 9, 2);
}
break;
case 2:
_series8 = series_play("142sm01", 0xf00, 4);
_series5 = series_play("142icedr", 0xe00);
_series1 = series_play("142door", 0xe00);
_G(walker).reset_walker_sprites();
play015();
break;
case 3:
play015();
break;
case 4:
digi_unload("142_006");
digi_play_loop("142_004", 3);
hotspot_set_active("TOUR BUS", true);
_series4 = series_play("142ba01", 0xf00, 16, -1, 10, 0, 100, 0, 0, 20, 21);
break;
case 5:
switch (_val2) {
case 11:
wilbur_speech("142w007");
break;
case 12:
wilbur_speech(inv_player_has("BLOCK OF ICE") ?
"142w007" : "142w008");
break;
case 13:
wilbur_speech("142w019");
break;
default:
break;
}
break;
case 6:
player_set_commands_allowed(false);
digi_play("142v901", 1, 255, 7);
break;
case 7:
digi_play("142e901", 1, 255, 8);
break;
case 8:
player_set_commands_allowed(true);
break;
case 9:
switch (_val1) {
case 14:
_val3 = imath_ranged_rand(1, 3);
_val1 = 15;
_volume = 155;
series_play_with_breaks(PLAY1, "142dt01", 0xd00, 9, 3, 6, 100);
break;
case 15:
digi_stop(1);
digi_unload("100_015");
faceTruck();
hotspot_set_active("TRUCK", true);
_val1 = 16;
series_play_with_breaks(PLAY2, "142dt02", 0xd00, 9, 3, 8, 100);
break;
case 16:
_val1 = 17;
series_play_with_breaks(PLAY3, "142bu01", 0xd00, 9, 3, 6, 100);
break;
case 17:
_noWalk = intr_add_no_walk_rect(230, 250, 294, 277, 229, 278);
player_set_commands_allowed(true);
_series2 = series_show("142dt01", 0xd00, 0, -1, -1, 22);
_series3 = series_show("142dt01s", 0xd01, 0, -1, -1, 22);
_series1 = series_show("142door", 0xe00);
break;
case 18:
player_set_commands_allowed(false);
ws_turn_to_face(3);
series_play_with_breaks(PLAY4, "142bu02", 0xd00, 8, 2, 6, 100);
break;
case 19:
_val1 = 20;
series_play_with_breaks(PLAY5, "142dt02", 0xd00, 9, 3, 8, 100);
break;
case 20:
digi_preload("100_015");
digi_play_loop("100_015", 1);
_val3 = imath_ranged_rand(1, 3);
_val1 = 21;
series_play_with_breaks(PLAY6, "142dt03", 0xd00, 9, 3);
break;
case 21:
_val3 = imath_ranged_rand(1, 3);
series_play_with_breaks(PLAY7, "142dt03", 0xf00, 8, 3);
_volume = 255;
kernel_trigger_dispatch_now(11);
break;
default:
break;
}
break;
case 10:
_volume -= 10;
if (_volume > 0) {
term_message("fading truck theme, current volume = %d", _volume);
digi_change_volume(3, _volume);
kernel_timing_trigger(6, 10);
} else {
digi_stop(3);
digi_unload("100_013");
digi_play_loop("142_004", 3);
}
break;
case 11:
_volume -= 20;
if (_volume > 0) {
term_message("fading truck noise, current volume = %d", _volume);
digi_change_volume(1, _volume);
kernel_timing_trigger(6, 11);
} else {
digi_stop(1);
digi_stop(2);
digi_unload("100_015");
digi_unload("100_021");
}
break;
case 13:
_series1 = series_show("142door", 0xe00);
break;
case 14:
terminateMachineAndNull(_series1);
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
terminateMachineAndNull(_series5);
disable_player();
_G(wilbur_should) = 2;
series_play_with_breaks(PLAY9, "142wi04", 0xdff, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 2:
player_set_commands_allowed(true);
_G(flags)[kIceBoxOpened] = 1;
hotspot_set_active("ICE", true);
_series6 = series_show("142wi04", 0xdff, 0, -1, -1, 3);
_series7 = series_show("142wi04s", 0xdfe, 0, -1, -1, 3);
break;
case 3:
if (inv_player_has("BLOCK OF ICE")) {
wilbur_speech("142w009");
} else {
player_set_commands_allowed(false);
terminateMachineAndNull(_series6);
terminateMachineAndNull(_series7);
_G(wilbur_should) = 4;
series_play_with_breaks(PLAY11, "142wi04", 0xdff, kCHANGE_WILBUR_ANIMATION, 3);
}
break;
case 4:
_G(flags)[kIceBoxOpened] = 0;
hotspot_set_active("ICE", false);
_series5 = series_show("142icedr", 0xf00);
enable_player();
inv_give_to_player("BLOCK OF ICE");
break;
case 5:
player_set_commands_allowed(false);
terminateMachineAndNull(_series6);
terminateMachineAndNull(_series7);
_G(wilbur_should) = 6;
series_play_with_breaks(PLAY10, "142wi02", 0xdff, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 6:
_G(flags)[kIceBoxOpened] = 0;
hotspot_set_active("ICE", false);
_series5 = series_show("142icedr", 0xe00);
enable_player();
break;
case 7:
player_set_commands_allowed(false);
terminateMachineAndNull(_series6);
terminateMachineAndNull(_series7);
_G(wilbur_should) = 8;
series_play_with_breaks(PLAY10, "142wi04", 0xdff, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 8:
_G(flags)[kIceBoxOpened] = 0;
hotspot_set_active("ICE", false);
_series5 = series_show("142icedr", 0xe00);
enable_player();
triggerParser();
break;
case 9:
disable_player();
_G(wilbur_should) = 10;
series_play_with_breaks(PLAY12, "142wi05", 0x400, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 10:
enable_player();
hotspot_set_active("FANBELT", false);
inv_give_to_player("PANTYHOSE");
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
case kBurlEntersTown:
if (!_G(flags)[kRoadOpened]) {
if (_series2) {
terminateMachineAndNull(_series2);
terminateMachineAndNull(_series3);
}
if (_series4) {
terminateMachineAndNull(_series4);
_G(flags)[kTourBusAtDiner] = 0;
}
_G(flags)[V000] = 1003;
if (player_commands_allowed() && _G(player).walker_visible &&
INTERFACE_VISIBLE && !digi_play_state(1)) {
digi_preload("100_013");
digi_play("100_013", 3, 155);
Section1::updateDisablePlayer();
preloadAssets2();
if (getRoadEdgeX(_G(player_info).y) > _G(player_info).x ||
(_G(player_info).x < 298 && _G(player_info).y < 285)) {
// Get off the road
kernel_timing_trigger(240, 1);
} else {
// Not on road, so show truck arriving
kernel_timing_trigger(240, 3);
}
} else {
kernel_timing_trigger(15, 10028);
}
} else {
_G(kernel).continue_handling_trigger = true;
}
break;
case kBurlLeavesTown:
if (_G(flags)[V000] == 1002) {
_G(kernel).continue_handling_trigger = true;
} else {
player_update_info();
if (player_commands_allowed() && _G(player).walker_visible &&
INTERFACE_VISIBLE && !digi_play_state(1)) {
player_set_commands_allowed(false);
if (_G(player_info).y > 285) {
faceTruck();
} else {
player_walk_to(267, 290, 262, 278);
}
preloadAssets();
_G(flags)[V000] = 1004;
intr_remove_no_walk_rect(_noWalk);
hotspot_set_active("TRUCK", false);
terminateMachineAndNull(_series1);
terminateMachineAndNull(_series2);
_val1 = 19;
series_play_with_breaks(PLAY8, "142bu03", 0xd00, 9, 3);
} else {
kernel_timing_trigger(15, kBurlLeavesTown);
}
}
break;
case kBandEntersTown:
if (_series2) {
terminateMachineAndNull(_series2);
_G(flags)[V000] = _G(flags)[kRoadOpened] ? 1002 : 1004;
}
if (!_G(flags)[kTourBusAtDiner]) {
_G(flags)[kTourBusAtDiner] = 1;
digi_preload("142_006");
digi_play("142_006", 3, 255, 4);
series_play_with_breaks(PLAY14, "142ba01", 0xf00, -1, 2);
}
break;
case kCALLED_EACH_LOOP:
if (_actionType == 0) {
_G(kernel).call_daemon_every_loop = false;
} else {
checkAction();
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room142::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(flags)[kIceBoxOpened]) {
_G(player).ready_to_walk = false;
_G(player).need_to_walk = false;
if (player_said("GEAR", "ICE BOX")) {
_G(wilbur_should) = 5;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("ICE")) {
if (player_said("LOOK AT")) {
if (_G(flags)[V040] && !inv_player_has("BLOCK OF ICE")) {
wilbur_speech("142w008");
} else {
wilbur_speech("142w007");
}
} else if (player_said("TAKE")) {
if (!_G(flags)[V040]) {
wilbur_speech("142w017");
} else if (inv_player_has("BLOCK_OF_ICE")) {
wilbur_speech("142w009");
} else {
_G(wilbur_should) = 3;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("GEAR")) {
wilbur_speech("142w002");
} else {
term_message("ERROR - don't know what to do with ice!!!");
}
} else {
_G(wilbur_should) = 7;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
_G(player).command_ready = false;
} else {
if (_G(flags)[V000] == 1003 &&
_G(player).walk_x >= 230 && _G(player).walk_x <= 294 &&
_G(player).walk_y >= 250 && _G(player).walk_y <= 277) {
player_hotspot_walk_override(_G(player).click_x, 278);
} else if (player_said_any("GEAR", "LOOK AT")) {
if (player_said("MAIN STREET")) {
player_hotspot_walk_override(_G(player).walk_x, 400);
checkAction();
_G(kernel).call_daemon_every_loop = true;
_G(player).command_ready = false;
} else if (player_said("PARKING LOT") && _G(flags)[kTourBusAtDiner]) {
checkAction();
_G(kernel).call_daemon_every_loop = true;
_G(player).command_ready = false;
}
} else if (player_said("MAIN STREET")) {
player_set_facing_at(120, 400);
} else if (player_said("HANLON'S POINT")) {
player_set_facing_at(-40, 375);
} else if (player_said("AUNT POLLY'S HOUSE")) {
player_set_facing_at(680, 325);
} else if (player_said("FRONT DOOR")) {
player_set_facing_at(350, 270);
} else if (player_said("HIGHWAY 2")) {
player_set_facing_at(192, 252);
} else if (player_said("PARKING LOT")) {
player_set_facing_at(303, 247);
} else if (player_said("TOUR BUS")) {
checkAction();
_G(kernel).call_daemon_every_loop = true;
_G(player).command_ready = false;
}
}
}
void Room142::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (!_G(walker).wilbur_said(SAID)) {
if (player_said_any("GEAR", "LOOK AT") && player_said("HANLON'S POINT")) {
disable_player_commands_and_fade_init(1012);
} else if (player_said_any("GEAR", "LOOK AT") && player_said("FRONT DOOR")) {
disable_player_commands_and_fade_init(1015);
} else if (player_said_any("GEAR", "LOOK AT") && player_said("AUNT POLLY'S HOUSE")) {
disable_player_commands_and_fade_init(1017);
} else if (!_G(walker).wilbur_match(MATCH)) {
return;
}
}
_G(player).command_ready = false;
}
void Room142::checkAction() {
_actionType = 0;
if (player_said_any("GEAR", "LOOK AT", "GO TO")) {
if (player_said("MAIN STREET")) {
_actionType = 1;
} else if (_G(flags)[kTourBusAtDiner] && (player_said("PARKING LOT") ||
player_said("GO TO", "TOUR BUS"))) {
_actionType = 2;
}
}
if (_actionType) {
player_update_info();
if (_actionType == 1 && _G(player_info).y > 375 && player_commands_allowed()) {
player_update_info();
player_hotspot_walk_override(_G(player_info).x, 400);
disable_player_commands_and_fade_init(1001);
} else if (_actionType == 2 && _G(player_info).y < 280 &&
player_commands_allowed()) {
disable_player_commands_and_fade_init(1016);
}
}
}
void Room142::faceTruck() {
ws_turn_to_face(calc_facing(262, 277));
}
void Room142::preloadAssets() {
series_load("142dt02");
series_load("142dt02s");
series_load("142dt03");
series_load("142dt03s");
digi_preload_play_breaks(PLAY5);
digi_preload_play_breaks(PLAY6);
digi_preload_play_breaks(PLAY7);
}
void Room142::preloadAssets2() {
series_load("142dt01");
series_load("142dt01s");
series_load("142dt02");
series_load("142dt02s");
digi_preload_play_breaks(PLAY1, true);
digi_preload_play_breaks(PLAY1, true);
}
void Room142::triggerParser() {
_G(player).waiting_for_walk = true;
_G(player).ready_to_walk = true;
_G(player).need_to_walk = true;
_G(player).command_ready = true;
_G(kernel).trigger = -1;
_G(kernel).trigger_mode = KT_PREPARSE;
_G(player).walker_trigger = -1;
pre_parser();
g_engine->global_pre_parser();
}
void Room142::play015() {
digi_preload("100_015");
digi_play_loop("100_015", 1);
_val3 = imath_ranged_rand(1, 3);
_val1 = 14;
series_play_with_breaks(PLAY13, "142dt01", 0x100, 9, 3);
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,96 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM142_H
#define M4_BURGER_ROOMS_SECTION1_ROOM142_H
#include "m4/burger/rooms/room.h"
#include "m4/burger/walker.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room142 : public Room {
static const WilburMatch MATCH[];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
static const seriesPlayBreak PLAY3[];
static const seriesPlayBreak PLAY4[];
static const seriesPlayBreak PLAY5[];
static const seriesPlayBreak PLAY6[];
static const seriesPlayBreak PLAY7[];
static const seriesPlayBreak PLAY8[];
static const seriesPlayBreak PLAY9[];
static const seriesPlayBreak PLAY10[];
static const seriesPlayBreak PLAY11[];
static const seriesPlayBreak PLAY12[];
static const seriesPlayBreak PLAY13[];
static const seriesPlayBreak PLAY14[];
private:
machine *_series1 = nullptr;
machine *_series2 = nullptr;
machine *_series3 = nullptr;
machine *_series4 = nullptr;
machine *_series5 = nullptr;
machine *_series6 = nullptr;
machine *_series7 = nullptr;
machine *_series8 = nullptr;
noWalkRect *_noWalk = nullptr;
int _actionType = 0;
int _volume = 0;
static int32 _val1;
static int32 _val2;
static int32 _val3;
//int _val4 = 0;
void checkAction();
void faceTruck();
void preloadAssets();
void preloadAssets2();
void triggerParser();
void play015();
/**
* Gets the X position for the edge of the road, given a Y pos.
* Used for the cutscene where Burl arrives, to determine whether
* he honks the horn at Wilbur to get off the road
*/
int getRoadEdgeX(int y) const {
return (int)((double)(-y + 126) * -1.428571428571429);
}
public:
Room142();
~Room142() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,90 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM143_H
#define M4_BURGER_ROOMS_SECTION1_ROOM143_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room143 : public Room {
private:
static const char *SAID[][4];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
static const seriesPlayBreak PLAY3[];
static const seriesPlayBreak PLAY4[];
static const seriesPlayBreak PLAY5[];
static const seriesPlayBreak PLAY6[];
static const seriesPlayBreak PLAY7[];
static const seriesPlayBreak PLAY8[];
static const seriesPlayBreak PLAY9[];
static const seriesPlayBreak PLAY10[];
static const seriesPlayBreak PLAY11[];
machine *_cheese = nullptr;
machine *_mouseTrap = nullptr;
machine *_plate = nullptr;
machine *_eu02 = nullptr;
machine *_wi03 = nullptr;
machine *_wi03S = nullptr;
machine *_ve03 = nullptr, *_ve03S = nullptr;
Series _cat;
Series _emptyPlates;
noWalkRect *_walk1 = nullptr;
const char *_digiName = nullptr;
bool _flag1 = false;
int _frame = 0;
int _veraShould = 0;
int _veraMode = 0;
int _val3 = 0;
int _catShould = 0;
int _burlMode = 0;
int _burlShould = 0;
KernelTriggerType _digiMode = (KernelTriggerType)0;
int _digiTrigger = 0;
void conv35();
void conv30();
void talkToVera();
void talkToBurl();
void loadCheese();
void showEmptyPlates();
void playDigi1();
void playDigi2();
public:
Room143() : Room() {}
~Room143() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,105 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM145_H
#define M4_BURGER_ROOMS_SECTION1_ROOM145_H
#include "m4/burger/rooms/room.h"
#include "m4/burger/walker.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room145 : public Room {
private:
static const char *SAID[][4];
static const WilburMatch MATCH[];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
static const seriesPlayBreak PLAY3[];
static const seriesPlayBreak PLAY4[];
static const seriesPlayBreak PLAY5[];
static const seriesPlayBreak PLAY6[];
static const seriesPlayBreak PLAY7[];
static const seriesPlayBreak PLAY8[];
static const seriesPlayBreak PLAY9[];
static const seriesPlayBreak PLAY10[];
static const seriesPlayBreak PLAY11[];
static const seriesPlayBreak PLAY12[];
static const seriesPlayBreak PLAY13[];
static const seriesPlayBreak PLAY14[];
static const seriesPlayBreak PLAY15[];
static const seriesPlayBreak PLAY16[];
static const seriesPlayBreak PLAY17[];
static const seriesPlayBreak PLAY18[];
static const seriesPlayBreak PLAY19[];
static const seriesPlayBreak PLAY20[];
static const seriesPlayBreak PLAY21[];
static const seriesPlayBreak PLAY22[];
static const seriesPlayBreak PLAY23[];
static int32 _state1;
static int32 _state2;
static int32 _state3;
noWalkRect *_walk1 = nullptr;
noWalkRect *_walk2 = nullptr;
noWalkRect *_walk3 = nullptr;
machine *_amplifier = nullptr;
Series _vipe;
Series _roxy;
const char *_digiName1 = nullptr;
const char *_digiName2 = nullptr;
bool _flag1 = false;
int _duration = 0;
int _drumzState = 0;
int _roxyTalkTo = 0;
int _roxyState = 0;
int _vipeState = 0;
int _val5 = 0;
void loadDrum();
void loadRx();
void conv21();
void conv22();
void conv23();
void vipeSpeaking();
void roxySpeaking();
void loadSeries1();
int getRandomDrumzState() const;
void resetRoxy();
void playRandomDigi1();
void playRandomDigi2();
public:
Room145();
~Room145() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,232 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room170.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
static const char *SAID[][4] = {
{ "HOUSE", "170w001", "170w002", "170w002" },
{ "FRONT DOOR", nullptr, nullptr, nullptr },
{ "VERA'S DINER", nullptr, "170w002", nullptr },
{ "TOWN HALL", nullptr, "170w002", nullptr },
{ "HIGHWAY 2", "170w009", "170w002", "170w009" },
{ nullptr, nullptr, nullptr, nullptr }
};
static const seriesPlayBreak PLAY1[] = {
{ 0, 9, "100_004", 1, 255, -1, 0, 0, nullptr, 0 },
{ 10, -1, "100_003", 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY2[] = {
{ 0, 11, "170_001", 1, 50, -1, 0, 0, nullptr, 0 },
{ 12, 19, "170_002", 1, 255, -1, 0, 0, nullptr, 0 },
{ 20, 20, "170w005", 1, 255, -1, 0, -1, nullptr, 0 },
{ 21, 39, "170_002", 1, 255, -1, 0, 0, nullptr, 0 },
{ 40, 40, "170w006", 1, 125, -1, 0, -1, nullptr, 0 },
{ 41, 52, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 5, 0, "170_001", 1, 50, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY3[] = {
{ 0, 12, "170_001", 1, 50, -1, 0, 0, nullptr, 0 },
{ 23, 52, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 5, 0, "170_001", 1, 50, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
void Room170::init() {
digi_preload("100_001");
digi_play_loop("100_001", 3, 255);
_firstTime = !player_been_here(170);
series_show("170box", 0xa00);
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
kernel_trigger_dispatch_now(1);
break;
case 104:
ws_demand_location(494, 400, 10);
ws_walk(355, 353, nullptr, 1);
break;
case 142:
ws_demand_location(-40, 375, 2);
ws_walk(25, 350, nullptr, 1);
break;
case 171:
ws_demand_location(319, 192, 8);
kernel_trigger_dispatch_now(1);
break;
default:
ws_demand_location(134, 307, 5);
kernel_trigger_dispatch_now(1);
break;
}
}
void Room170::daemon() {
switch (_G(kernel).trigger) {
case 1:
if (_firstTime)
wilbur_speech("170w001");
break;
case 2:
disable_player_commands_and_fade_init(1018);
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
disable_player();
series_play_with_breaks(PLAY1, "170wi01", 0x900, 2, 2, 6, 100, 0, 0);
break;
case 3:
disable_player();
_G(wilbur_should) = 4;
series_play_with_breaks(PLAY2, "170wi03", 0xa00, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 4:
enable_player();
wilbur_speech("170w007");
_G(flags)[V080] = 1;
_G(flags)[V079] = 0;
inv_give_to_player("WHISTLE");
inv_give_to_player("PHONE BILL");
break;
case 5:
disable_player();
_G(wilbur_should) = 6;
series_play_with_breaks(PLAY3, "170wi03", 0xa00, kCHANGE_WILBUR_ANIMATION, 3, 6, 100, 0, 0);
break;
case 6:
enable_player();
_G(flags)[V079] = 0;
inv_give_to_player("WHISTLE");
inv_give_to_player("PHONE BILL");
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
case kCALLED_EACH_LOOP:
term_message("Calling daemon each loop..............");
if (_lookTownHall) {
setupTownHall();
} else {
_G(kernel).call_daemon_every_loop = false;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room170::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (player_said_any("GEAR", "LOOK AT")) {
if (player_said("TOWN HALL")) {
setupTownHall();
_G(kernel).call_daemon_every_loop = true;
}
} else {
if (player_said("VERA'S DINER"))
player_set_facing_at(-40, 375);
if (player_said("TOWN HALL"))
player_set_facing_at(494, 400);
}
if (player_said("YARD"))
player_set_facing_hotspot();
}
void Room170::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(walker).wilbur_said(SAID)) {
// Handled
} else if (player_said_any("GEAR", "LOOK AT") && player_said("VERA'S DINER")) {
disable_player_commands_and_fade_init(1014);
} else if (player_said_any("GEAR", "LOOK AT") && player_said("FRONT DOOR")) {
_G(wilbur_should) = 1;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said_any("GEAR", "LOOK AT") && player_said("MAILBOX")) {
if (_G(flags)[V079]) {
player_set_commands_allowed(false);
if (_G(flags)[V080]) {
_G(wilbur_should) = 5;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
_G(wilbur_should) = 3;
wilbur_speech("170w004", kCHANGE_WILBUR_ANIMATION);
}
} else {
wilbur_speech("170w008");
}
} else {
return;
}
_G(player).command_ready = false;
}
void Room170::setupTownHall() {
if (player_said_any("GEAR", "LOOK AT") && player_said("TOWN HALL"))
_lookTownHall = true;
if (_lookTownHall) {
player_update_info();
if (_G(player_info).y > 375 && player_commands_allowed())
disable_player_commands_and_fade_init(1004);
}
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,52 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM170_H
#define M4_BURGER_ROOMS_SECTION1_ROOM170_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room170 : public Room {
private:
bool _firstTime = false;
bool _lookTownHall = false;
void setupTownHall();
public:
Room170() : Room() {}
~Room170() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,924 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room171.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
enum {
kCHANGE_POLLY_ANIMATION = 5
};
static const char *SAID[][4] = {
{ "AUNT POLLY", "171w001", "171w002", "171w002" },
{ "FRONT DOOR", "171w003", "171w002", nullptr },
{ "KITCHEN", nullptr, "171w002", nullptr },
{ "STAIRS", "171w004", "171w002", nullptr },
{ "FIREPLACE", nullptr, "171w002", "171w005" },
{ "KINDLING ", "171w006", "171w007", "171w007" },
{ "WINDOW", "171w008", "171w002", "171w009" },
{ "TELEPHONE", "171w010", "171w011", "171w012" },
{ "ARMCHAIR", "171w013", "171w014", "171w015" },
{ "PIANO", "171w019", "171w020", "171w021" },
{ "PICTURE", "171w022", "171w023", "171w024" },
{ "PICTURE ", "171w025", "171w023", nullptr },
{ "PAINTING", "171w026", "171w027", nullptr },
{ "CLOCK", "171w028", "171w029", "171w030" },
{ "PILLS", "171w031", "171w032", "171w033" },
{ nullptr, nullptr, nullptr, nullptr }
};
const seriesPlayBreak Room171::PLAY1[] = {
{ 0, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 3, 6, "171_014a", 1, 100, -1, 0, 0, nullptr, 0 },
{ 7, 12, "171_014b", 1, 100, -1, 0, 0, nullptr, 0 },
{ 13, 18, "171_014a", 1, 100, -1, 0, 0, nullptr, 0 },
{ 19, 22, "171_014b", 1, 100, -1, 0, 0, nullptr, 0 },
{ 23, 27, "171_014a", 1, 100, -1, 0, 0, nullptr, 0 },
{ 28, 32, "171_014b", 1, 100, -1, 0, 0, nullptr, 0 },
{ 33, 39, "171_014a", 1, 100, -1, 0, 0, nullptr, 0 },
{ 40, -1, "171_014b", 1, 100, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY2[] = {
{ 0, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 1, 6, "171_014a", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
{ 7, 12, "171_014b", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
{ 13, 17, "171_014a", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
{ 18, 22, "171_014b", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
{ 24, 29, "171_014a", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
{ 30, 35, "171_014b", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
{ 36, 40, "171_014a", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
{ 41, -1, "171_014b", 2, 100, -1, 0, 0, &Flags::_flags[V086], 0 },
{ 1, 6, "171_014a", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
{ 7, 12, "171_014b", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
{ 13, 17, "171_014a", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
{ 18, 22, "171_014b", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
{ 24, 29, "171_014a", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
{ 30, 35, "171_014b", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
{ 36, 40, "171_014a", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
{ 41, -1, "171_014b", 1, 100, -1, 0, 0, &Flags::_flags[V086], 1 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY3[] = {
{ 0, 4, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 5, 16, nullptr, 0, 0, 3, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY4[] = {
{ 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY5[] = {
{ 0, -1, "171_001", 2, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY6[] = {
{ 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY7[] = {
{ 0, -1, nullptr, 2, 0, -1, 2048, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY8[] = {
{ 0, 4, "171_011", 2, 255, -1, 0, 0, nullptr, 0 },
{ 5, 19, nullptr, 0, 0, 3, 0, 0, nullptr, 0 },
{ 20, 25, "171_012", 2, 255, -1, 0, 0, nullptr, 0 },
{ 26, 33, "171_010", 2, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY9[] = {
{ 34, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY10[] = {
{ 7, 8, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 8, 8, nullptr, 0, 0, -1, 0, 2, nullptr, 0 },
{ 7, 8, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY11[] = {
{ 7, 12, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 13, -1, "171_006", 2, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY12[] = {
{ 0, 4, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 4, 4, nullptr, 0, 0, -1, 0, 10, nullptr, 0 },
{ 0, 4, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY13[] = {
{ 0, -1, nullptr, 0, 0, -1, 1, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY14[] = {
{ 0, 17, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 18, -1, "171_004", 2, 255, -1, 0, 0, nullptr, 0 },
{ 0, 11, nullptr, 0, 0, -1, 2, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY15[] = {
{ 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY16[] = {
{ 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room171::PLAY17[] = {
{ 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
void Room171::init() {
_flag1 = false;
_val1 = 0;
if (_G(flags)[V092]) {
hotspot_set_active("AUNT POLLY", false);
} else {
switch (_G(game).previous_room) {
case 170:
player_set_commands_allowed(false);
if (_G(flags)[V083] && _G(flags)[V084] && _G(flags)[V085] && _G(flags)[V086]) {
loadSeries1();
_pollyShould = 26;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
} else {
while (!_val1) {
switch (imath_ranged_rand(1, 4)) {
case 1:
if (!_G(flags)[V083]) {
_val1 = 10019;
loadSeries2();
_pollyShould = 5;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
}
break;
case 2:
if (!_G(flags)[V084]) {
_val1 = 10021;
loadSeries3();
digi_preload("171_002");
digi_play_loop("171_002", 2);
}
break;
case 3:
if (!_G(flags)[V085]) {
_val1 = 10020;
loadSeries4();
if (imath_rand_bool(2)) {
digi_preload("171_013a");
digi_play_loop("171_013a", 2, 255);
} else {
digi_preload("171_013b");
digi_play_loop("171_013b", 2, 255);
}
}
break;
case 4:
if (!_G(flags)[V086]) {
_val1 = 10022;
loadSeries5();
_pollyShould = 20;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
}
break;
default:
break;
}
}
}
break;
case 175:
if (!_G(flags)[V092]) {
if (_G(flags)[V086]) {
loadSeries1();
_pollyShould = 26;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
} else {
_val1 = 10022;
loadSeries5();
kernel_trigger_dispatch_now(6);
}
}
break;
default:
loadSeries1();
_pollyShould = 26;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
}
}
_series3 = series_show("171pills", 0x700);
if (_val1 || _G(flags)[V092]) {
_chair.show("171chair", "171chars", 0x900);
}
hotspot_set_active("PIANO STOOL", false);
hotspot_set_active("PIANO STOOL ", false);
if (_val1 == 10020 || _val1 == 10019) {
hotspot_set_active("PIANO STOOL ", true);
intr_add_no_walk_rect(378, 300, 518, 354, 377, 355);
if (_val1 == 10020) {
series_show("171stool", 0x300);
series_show("171stols", 0x301);
}
} else {
series_show("171st02", 0x100);
hotspot_set_active("PIANO STOOL", true);
}
_lid = series_show("171plid", 0);
if (_val1 != 10022)
series_show("171phone", 0x700);
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
break;
case 170:
ws_demand_location(84, 275, 3);
if (_G(flags)[V092] || (_G(flags)[V083] && _G(flags)[V084] &&
_G(flags)[V085] && _G(flags)[V086])) {
ws_walk(134, 275, nullptr, -1);
} else {
ws_walk(134, 275, nullptr, 6);
}
break;
case 172:
ws_demand_location(639, 289, 9);
ws_walk(541, 295, nullptr, -1);
break;
case 175:
ws_demand_location(237, 232, 9);
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
ws_demand_location(324, 319, 5);
break;
}
}
void Room171::daemon() {
switch (_G(kernel).trigger) {
case 1:
disable_player_commands_and_fade_init(1019);
break;
case 2:
disable_player_commands_and_fade_init(1022);
break;
case 3:
npc_say();
break;
case 4:
if (_pollyShould == 28 || _pollyShould == 36 || _pollyShould == 34 || _pollyShould == 33 ||
_pollyShould == 38 || _pollyShould == 30) {
digi_stop(2);
freeSeries();
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
}
break;
case kCHANGE_POLLY_ANIMATION:
// Aunt Polly
switch (_pollyShould) {
case 5:
digi_play_loop("171_003", 2);
_series.play("171ap01", 0x300, 0, -1, 6, -1);
break;
case 6:
npc_say(conv_sound_to_play(), kRESUME_CONVERSATION, "171ap01n", 0x2ff, false);
break;
case 7:
digi_stop(2);
freeSeries();
series_play_with_breaks(PLAY3, "171ap02", 0x300, kRESUME_CONVERSATION, 3);
break;
case 8:
_pollyShould = 9;
npc_say(conv_sound_to_play(), 5, "171ap02", 0x300, true, 17, 22);
break;
case 9:
freeSeries();
_pollyShould = 10;
series_play_with_breaks(PLAY4, "171ap03", 0x300, 5, 3);
break;
case 10:
_G(flags)[V083] = 1;
_chair.terminate();
series_show("171stool", 0x300);
series_show("171stols", 0x301);
_pollyShould = 26;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 11:
npc_say(kRESUME_CONVERSATION);
break;
case 12:
digi_stop(2);
npc_say();
series_play_with_breaks(PLAY5, "171ap04", 0x800, kRESUME_CONVERSATION, 3);
break;
case 13:
_pollyShould = 14;
npc_say(kCHANGE_POLLY_ANIMATION, "171ap05", 0x800);
break;
case 14:
_G(flags)[V084] = 1;
_chair.terminate();
_pollyShould = 26;
series_play_with_breaks(PLAY6, "171ap06", 0x800, 5, 3);
break;
case 15:
terminateMachineAndNull(_lid);
_pollyShould = 16;
series_play_with_breaks(PLAY7, "171ap07", 0, kCHANGE_POLLY_ANIMATION, 2);
break;
case 16:
npc_say(kRESUME_CONVERSATION, "171ap08", 0, false);
break;
case 17:
freeSeries();
_pollyShould = 18;
series_play_with_breaks(PLAY8, "171ap09", 0, kCHANGE_POLLY_ANIMATION, 3);
break;
case 18:
_pollyShould = 19;
series_play_with_breaks(PLAY9, "171ap09", 0x301, kCHANGE_POLLY_ANIMATION, 3);
series_show("171plid", 0);
break;
case 19:
_G(flags)[V085] = 1;
_chair.terminate();
_pollyShould = 26;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 20:
_series.show("171ap10", 0x700);
break;
case 21:
freeSeries();
npc_say(kRESUME_CONVERSATION, "171ap10", 0x700, true, 0, 6);
break;
case 22:
npc_say(5);
_pollyShould = 23;
series_play_with_breaks(PLAY10, "171ap10", 0x700, kCHANGE_POLLY_ANIMATION, 3);
break;
case 23:
_pollyShould = 24;
_series.play("171ap10", 0x700, 0, -1, 6, -1, 100, 0, 0, 0, 6);
break;
case 24:
freeSeries();
_pollyShould = 25;
series_play_with_breaks(PLAY11, "171ap10", 0x700, 5, 3);
break;
case 25:
_G(flags)[V086] = 1;
_chair.terminate();
series_show("171phone", 0x700);
_pollyShould = 26;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 26:
player_update_info();
if (_flag1 && (_G(player_info).x != 436 || _G(player_info).y != 288))
ws_walk(436, 288, nullptr, kRESUME_CONVERSATION, 2);
digi_play_loop("171_009", 2, 50);
_series[0] = series_play("171ap11", 0x8ff, 32, 4, 6, -1);
_series[1] = series_play("171ap11", 0x900, 0, -1, 6, -1);
break;
case 28:
_pollyShould = 29;
npc_say(_digi1, kCHANGE_POLLY_ANIMATION, "171ap13", 0x8fe);
break;
case 29:
_pollyShould = 26;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
player_set_commands_allowed(true);
break;
case 30:
_pollyShould = 32;
series_play_with_breaks(PLAY15, "171ap16", 0x8ff, kCHANGE_POLLY_ANIMATION, 3);
break;
case 31:
_pollyShould = 32;
series_play_with_breaks(PLAY16, "171ap17", 0x8ff, 5, 3);
break;
case 32:
_chair.show("171chair", "171chars", 0x900);
series_play_with_breaks(PLAY17, "171ap18", 0x400, 1, 3);
break;
case 33:
npc_say(kRESUME_CONVERSATION, "171ap13", 0x8fe);
break;
case 34:
_pollyShould = 35;
npc_say(kCHANGE_POLLY_ANIMATION, "171ap13", 0x8fe);
break;
case 35:
_pollyShould = 26;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
conv_resume_curr();
break;
case 36:
_pollyShould = 26;
series_play_with_breaks(PLAY12, "171ap12", 0x8ff, kCHANGE_POLLY_ANIMATION, 3);
break;
case 37:
series_play_with_breaks(PLAY13, "171ap14", 0x8ff, kCHANGE_POLLY_ANIMATION, 3);
break;
case 38:
_pollyShould = 39;
npc_say(kCHANGE_POLLY_ANIMATION, "171ap13", 0x8fe);
break;
case 39:
freeSeries();
_chair.show("171chair", "171chars", 0x900);
if (_series3)
terminateMachineAndNull(_series3);
_pollyShould = 40;
series_play_with_breaks(PLAY14, "171ap15", 0x700, kCHANGE_POLLY_ANIMATION, 2, 8);
break;
case 40:
_chair.terminate();
_series3 = series_show("171pills", 0x700);
_pollyShould = 26;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
conv_resume_curr();
break;
default:
term_message("ERROR!!!! polly_should not set!");
break;
}
break;
case 6:
_G(flags)[kDisableFootsteps] = 1;
_G(flags)[V299] = 1;
_flag1 = true;
conv_load_and_prepare("conv40", 7);
switch (_val1) {
case 10019:
conv_export_value_curr(1, 0);
break;
case 10020:
conv_export_value_curr(3, 0);
break;
case 10021:
conv_export_value_curr(2, 0);
break;
case 10022:
conv_export_value_curr(4, 0);
break;
default:
conv_export_value_curr(0, 0);
break;
}
conv_export_value_curr(inv_player_has("WHISTLE") ? 1 : 0, 1);
conv_export_pointer_curr(&_G(flags)[V087], 2);
conv_export_pointer_curr(&_G(flags)[V088], 3);
conv_play_curr();
break;
case 7:
_val1 = 0;
_G(flags)[kDisableFootsteps] = 0;
_G(flags)[V299] = 0;
_flag1 = false;
player_set_commands_allowed(true);
_pollyShould = 26;
if (_series) {
freeSeries();
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
}
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
disable_player();
series_play_with_breaks(PLAY1, "171wi01", 0xc01, 2, 3, 5);
break;
case 2:
disable_player();
_G(wilbur_should) = kRESUME_CONVERSATION;
series_play_with_breaks(PLAY2, "171wi02", 0xc01, kCHANGE_WILBUR_ANIMATION, 3, 5, 100, 0, -3);
break;
case 3:
if (_G(flags)[V087]) {
_digi1 = "171p903";
} else {
_digi1 = "1711p902";
_G(flags)[V087] = 1;
}
_pollyShould = 28;
break;
case kRESUME_CONVERSATION:
ws_unhide_walker();
if (_G(flags)[V092] || _G(flags)[V086])
player_set_commands_allowed(true);
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
case kCALLED_EACH_LOOP:
if (_doorFlag) {
frontDoor();
} else {
_G(kernel).call_daemon_every_loop = false;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room171::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if ((_val1 == 10019 || _val1 == 10020) &&
_G(player).walk_x > 378 && _G(player).walk_x <= 518 &&
_G(player).walk_y >= 300 && _G(player).walk_y <= 354) {
player_walk_to(_G(player).click_x, 355);
}
if (!player_said("GEAR") && player_said("FRONT DOOR")) {
player_set_facing_at(94, 281);
} else if (!player_said_any("GEAR", "LOOK AT") && player_said("KITCHEN")) {
player_set_facing_at(601, 296);
} else if (player_said("GEAR", "FRONT DOOR")) {
frontDoor();
_G(kernel).call_daemon_every_loop = true;
_G(player).command_ready = false;
}
}
void Room171::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(walker).wilbur_said(SAID)) {
// Do nothing
} else if (player_said("conv40")) {
conv40();
} else if (player_said_any("GEAR", "LOOK AT") && player_said("KITCHEN")) {
if (_G(flags)[V091]) {
disable_player_commands_and_fade_init(1019);
} else {
player_set_commands_allowed(false);
_pollyShould = 30;
}
} else if (player_said("GEAR", "STAIRS")) {
_G(wilbur_should) = 1;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("WHISTLE", "AUNT POLLY")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 3;
wilbur_speech("171w901", kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TALK", "AUNT POLLY")) {
kernel_trigger_dispatch_now(6);
} else if (player_said("AUNT POLLY") && player_said_any("PHONE BILL", "CARROT JUICE")) {
player_set_commands_allowed(false);
_digi1 = "171p901";
_pollyShould = 28;
} else if (player_said("ROCKER")) {
if (player_said("LOOK AT")) {
wilbur_speech(_G(flags)[V092] ? "171w017" : "171w016");
} else if (player_said("GEAR")) {
wilbur_speech(_G(flags)[V092] ? "171w015" : "171w018");
} else {
return;
}
} else {
return;
}
_G(player).command_ready = false;
}
void Room171::loadSeries1() {
series_load("171ap11");
series_load("171ap12");
series_load("171ap13");
series_load("171ap11s");
series_load("171ap12s");
series_load("171ap13s");
digi_preload("171_009");
}
void Room171::loadSeries2() {
series_load("171ap01");
series_load("171ap02");
series_load("171ap03");
series_load("171ap01s");
series_load("171ap02s");
series_load("171ap03s");
loadSeries1();
}
void Room171::loadSeries3() {
series_load("171ap04");
series_load("171ap05");
series_load("171ap06");
series_load("171ap04s");
series_load("171ap05s");
series_load("171ap06s");
loadSeries1();
}
void Room171::loadSeries4() {
series_load("171ap07");
series_load("171ap08");
series_load("171ap09");
series_load("171ap09s");
loadSeries1();
}
void Room171::loadSeries5() {
series_load("171ap10");
series_load("171ap10s");
loadSeries1();
}
void Room171::freeSeries() {
_series.terminate();
}
void Room171::frontDoor() {
if (player_said_any("GEAR", "LOOK AT") && player_said("FRONT DOOR"))
_doorFlag = true;
if (_doorFlag) {
player_update_info();
if (_G(player_info).x < 94 && _G(player_info).y < 281 && player_commands_allowed())
disable_player_commands_and_fade_init(1017);
}
}
void Room171::conv40() {
const int who = conv_whos_talking();
const int node = conv_current_node();
const int entry = conv_current_entry();
if (!conv_sound_to_play())
return;
if (who == 1) {
wilbur_speech(conv_sound_to_play(), kRESUME_CONVERSATION);
switch (node) {
case 6:
if (entry <= 0 || (entry == 6 || entry == 7))
_pollyShould = 36;
break;
case 7:
_pollyShould = 36;
break;
case 10:
if (entry == 0)
_pollyShould = 36;
break;
case 15:
if (entry == 1 || entry == 2 || entry == 5)
_pollyShould = 36;
break;
default:
break;
}
} else {
switch (node) {
case 1:
switch (entry) {
case 0:
_pollyShould = 6;
break;
case 1:
_pollyShould = 7;
break;
case 2:
_pollyShould = 8;
break;
default:
break;
}
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 2:
switch (entry) {
case 0:
_pollyShould = 11;
break;
case 1:
_pollyShould = 12;
break;
case 2:
_pollyShould = 13;
break;
default:
break;
}
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 3:
switch (entry) {
case 0:
_pollyShould = 15;
break;
case 1:
_pollyShould = 17;
break;
default:
break;
}
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 4:
switch (entry) {
case 0:
_pollyShould = 21;
break;
case 1:
_pollyShould = 22;
break;
default:
break;
}
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 6:
_pollyShould = (entry == 6) ? 33 : 34;
break;
case 8:
switch (entry) {
case 0:
_pollyShould = 33;
break;
case 1:
_pollyShould = 38;
break;
default:
break;
}
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 9:
_pollyShould = 34;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
default:
_pollyShould = 34;
break;
}
}
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,84 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM171_H
#define M4_BURGER_ROOMS_SECTION1_ROOM171_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room171 : public Room {
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
static const seriesPlayBreak PLAY3[];
static const seriesPlayBreak PLAY4[];
static const seriesPlayBreak PLAY5[];
static const seriesPlayBreak PLAY6[];
static const seriesPlayBreak PLAY7[];
static const seriesPlayBreak PLAY8[];
static const seriesPlayBreak PLAY9[];
static const seriesPlayBreak PLAY10[];
static const seriesPlayBreak PLAY11[];
static const seriesPlayBreak PLAY12[];
static const seriesPlayBreak PLAY13[];
static const seriesPlayBreak PLAY14[];
static const seriesPlayBreak PLAY15[];
static const seriesPlayBreak PLAY16[];
static const seriesPlayBreak PLAY17[];
private:
Series _series;
Series _chair;
machine *_series3 = nullptr;
machine *_lid = nullptr;
const char *_digi1 = nullptr;
bool _flag1 = false;
bool _doorFlag = false;
int _val1 = 0;
int _pollyShould = 0;
void loadSeries1();
void loadSeries2();
void loadSeries3();
void loadSeries4();
void loadSeries5();
void freeSeries();
void frontDoor();
void conv40();
public:
Room171() : Room() {}
~Room171() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,477 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room172.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
enum {
kCHANGE_POLLY_ANIMATION = 1
};
static const char *SAID[][4] = {
{ "AUNT POLLY", "172w001", "172w002", "172w002" },
{ "PARLOUR", "172w002", nullptr, nullptr },
{ "BASEMENT", nullptr, "172w002", nullptr },
{ "MICROWAVE", "172w003", nullptr, nullptr },
{ "REFRIGERATOR", "172w005", "172w002", nullptr },
{ "OVEN", nullptr, "172w002", nullptr },
{ "SINK", "172w008", "172w009", nullptr },
{ "HUTCH", "172w011", "172w012", "172w002" },
{ "BROOM", "172w013", "172w014", "172w015" },
{ "WINDOW", "172w016", "172w002", "172w017" },
{ "CALENDAR", "172w018", "172w019", "172w018" },
{ "CUPBOARD ", "172w021", "172w002", nullptr },
{ "CUPBOARD", "172w022", "172w002", nullptr },
{ "POTS AND PANS", "172w023", "172w024", "172w024" },
{ "COOKIES", "172w025", "172w026", "172w027" },
{ "PRESERVES", "172w028", "172w029", "172w029" },
{ "CARROT JUICE ", "172w030", nullptr, "172w031" },
{ "JUICER", "172w032", nullptr, "172w033" },
{ "VEGGIES", "172w034", "172w035", "172w035" },
{ nullptr, nullptr, nullptr, nullptr }
};
static const seriesPlayBreak PLAY1[] = {
{ 0, 9, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 10, -1, nullptr, 0, 0, 2, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY2[] = {
{ 8, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY3[] = {
{ 0, 27, "172_001", 2, 255, -1, 0, 0, nullptr, 0 },
{ 28, 30, "172_005", 3, 125, -1, 0, -1, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY4[] = {
{ 44, 45, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 45, 45, nullptr, 0, 0, -1, 0, 3, nullptr, 0 },
{ 45, 44, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY5[] = {
{ 36, 43, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 36, 36, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY6[] = {
{ 46, 48, "172_004", 3, 125, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY7[] = {
{ 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
void Room172::init() {
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
break;
case 171:
if (!_G(flags)[V092] && !_G(flags)[V091]) {
player_set_commands_allowed(false);
series_load("172ap1t");
series_load("172ap1ts");
series_load("172ap02t");
digi_preload("172p906");
_pollyShould = 4;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
ws_demand_location(300, 325, 3);
ws_walk(368, 359, nullptr, -1, 2);
} else {
ws_demand_location(11, 296, 3);
ws_walk(156, 297, nullptr, -1, -1);
}
break;
case 173:
ws_demand_location(171, 254, 3);
ws_walk(250, 270, nullptr, -1, -1);
break;
default:
ws_demand_location(312, 292, 5);
break;
}
hotspot_set_active("AUNT POLLY", false);
if (_G(flags)[V092]) {
_pollyShould = 15;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
_walk1 = intr_add_no_walk_rect(357, 311, 639, 353, 356, 354);
hotspot_set_active("AUNT POLLY", true);
} else {
_series1 = series_show(_G(flags)[V091] ? "172fud2" : "172fud", 0x700);
series_show("172fuds", 0x701);
}
if (inv_player_has("CARROT JUICE") || inv_player_has("BOTTLE") ||
inv_player_has("SOAPY WATER")) {
hotspot_set_active("CARROT JUICE ", false);
} else {
_jug.show("172jug", 0x700);
}
}
void Room172::daemon() {
switch (_G(kernel).trigger) {
case kCHANGE_POLLY_ANIMATION:
switch (_pollyShould) {
case 4:
_pollyShould = 5;
series_play_with_breaks(PLAY2, "172ap01", 0x600, kCHANGE_POLLY_ANIMATION, 3, 8);
digi_play("172p906", 2, 255, kCHANGE_POLLY_ANIMATION);
break;
case 5:
_G(flags)[V092] = 1;
hotspot_set_active("AUNT POLLY", true);
_pollyShould = 7;
_series5.play("172ap1t", 0x400, 4, -1, 6, -1);
break;
case 6:
freeSeries5();
_pollyShould = 8;
npc_say("172p907", kCHANGE_POLLY_ANIMATION, "172ap1t", 0x400, true);
break;
case 7:
digi_unload("172p906");
freeSeries5();
_series5.show("172ap1t", 0x400);
_pollyShould = 6;
wilbur_speech("172w902", kCHANGE_POLLY_ANIMATION);
break;
case 8:
_G(flags)[V091] = true;
terminateMachineAndNull(_series1);
terminateMachineAndNull(_series1s);
_pollyShould = 9;
series_play_with_breaks(PLAY3, "172ap02", 0x400, kCHANGE_POLLY_ANIMATION, 3, 8);
break;
case 9:
_series5.play("172ap02", 0x400, 0, -1, 8, -1, 100, 0, 0, 28, 30);
kernel_trigger_dispatch_now(3);
playDigi3();
break;
case 10:
freeSeries7();
_pollyShould = 11;
series_play_with_breaks(PLAY4, "172ap02", 0x400, kCHANGE_POLLY_ANIMATION, 3, 8);
break;
case 11:
freeSeries7();
_pollyShould = 14;
npc_say(kCHANGE_POLLY_ANIMATION, "172ap02", 0x400, true, 31, 35);
break;
case 12:
player_set_commands_allowed(false);
_G(flags)[kDisableFootsteps] = 1;
freeSeries7();
_series5.terminate();
_pollyShould = 15;
npc_say(_convName, kCHANGE_POLLY_ANIMATION, "172ap02", 0x400, true, 31, 35);
break;
case 13:
freeSeries7();
series_play_with_breaks(PLAY5, "172ap02", 0x400, 10001, 3, 8);
break;
case 14:
_series5.play("172ap02", 0x400, 0, -1, 8, -1, 100, 0, 0, 28, 30);
playDigi3();
conv_resume_curr();
break;
case 15:
_G(flags)[kDisableFootsteps] = 0;
player_set_commands_allowed(true);
_series5.play("172ap02", 0x400, 0, -1, 8, -1, 100, 0, 0, 28, 30);
playDigi3();
break;
case 16:
freeSeries7();
_pollyShould = 17;
series_play_with_breaks(PLAY6, "172ap02", 0x400, kCHANGE_POLLY_ANIMATION, 3, 8);
break;
case 17:
freeSeries5();
hotspot_set_active("AUNT POLLY", false);
_series1 = series_show("172fud2", 0x700);
_series1s = series_show("172fuds", 0x701);
intr_remove_no_walk_rect(_walk1);
_pollyShould = 18;
series_play_with_breaks(PLAY7, "172ap03", 0x600, kCHANGE_POLLY_ANIMATION, 3, 8);
break;
case 18:
player_set_commands_allowed(true);
break;
default:
term_message("ERROR!!!! polly_should not set!");
break;
}
break;
case 2:
_jug.terminate();
break;
case 3:
_G(flags)[kDisableFootsteps] = 1;
_G(flags)[V299] = 1;
conv_load_and_prepare("conv41", 4);
conv_export_value_curr(_G(flags)[V088], 0);
conv_export_value_curr(inv_player_has("WHISTLE") ? 1 : 0, 1);
conv_export_pointer_curr(&_G(flags)[V093], 2);
conv_play_curr();
break;
case 4:
freeSeries5();
if (_G(flags)[V092]) {
freeSeries7();
_pollyShould = 15;
} else {
_G(flags)[V088] = 1;
_pollyShould = 16;
}
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
_G(flags)[kDisableFootsteps] = 0;
_G(flags)[V299] = 0;
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
_convName = _G(flags)[V087] ? "172p903" : "172p902";
_pollyShould = 12;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 2:
disable_player();
_G(wilbur_should) = 3;
series_play_with_breaks(PLAY1, "172wi01", 0x700, kCHANGE_WILBUR_ANIMATION, 3, 8);
break;
case 3:
enable_player();
hotspot_set_active("CARROT JUICE ", false);
inv_give_to_player("CARROT JUICE");
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room172::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(flags)[V092] && _G(player).walk_x >= 357 && _G(player).walk_x <= 639 &&
_G(player).walk_y >= 311 && _G(player).walk_y <= 353)
player_hotspot_walk_override(356, 332, 3);
if (!player_said_any("GEAR", "LOOK AT")) {
if (player_said("PARLOUR"))
player_set_facing_at(84, 300);
if (player_said("BASEMENT"))
player_set_facing_at(171, 254);
}
}
void Room172::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said("conv41")) {
conv41();
} else if (player_said_any("GEAR", "LOOK AT") && player_said("PARLOUR")) {
disable_player_commands_and_fade_init(1018);
} else if (player_said_any("GEAR", "LOOK AT") && player_said("BASEMENT")) {
disable_player_commands_and_fade_init(1020);
} else if (player_said("TAKE", "CARROT JUICE ")) {
if (_G(flags)[V092]) {
_convName = "172p950";
_pollyShould = 12;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
} else {
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("WHISTLE", "AUNT POLLY")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 1;
wilbur_speech("172w901", kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TALK", "AUNT POLLY")) {
kernel_trigger_dispatch_now(3);
} else if (player_said("AUNT POLLY") && player_said_any("PHONE BILL", "CARROT JUICE")) {
_convName = imath_rand_bool(2) ? "172p901" : "172904";
_pollyShould = 12;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
} else if (player_said("MICROWAVE")) {
parserAction("172w004");
} else if (player_said("GEAR", "REFRIGERATOR")) {
parserAction("172w005");
} else if (player_said("GEAR", "OVEN")) {
parserAction("172w007");
} else if (player_said("SINK")) {
parserAction("172w010");
} else if (player_said("GEAR") && player_said_any("CUPBOARD", "CUPBOARD ")) {
parserAction("172w036");
} else if (player_said("TAKE", "JUICER")) {
if (_G(flags)[V092]) {
_convName = imath_rand_bool(2) ? "172p905a" : "172p905b";
_pollyShould = 12;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
} else {
wilbur_speech("172w033");
}
} else {
return;
}
_G(player).command_ready = false;
}
void Room172::parserAction(const char *name) {
if (_G(flags)[V092]) {
_convName = "172p950";
_pollyShould = 12;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
} else {
wilbur_speech(name);
}
}
void Room172::freeSeries7() {
digi_stop(2);
terminateMachineAndNull(_series7);
}
void Room172::playDigi3() {
loadSeries7();
digi_preload("172_003");
digi_play_loop("172_003", 3, 125);
}
void Room172::loadSeries7() {
digi_preload("172p909");
digi_play_loop("172p909", 2, 255);
_series7 = series_play("172ap02t", 0x3ff, 4, -1, 4);
}
void Room172::conv41() {
const char *sound = conv_sound_to_play();
const int who = conv_whos_talking();
const int node = conv_current_node();
const int entry = conv_current_entry();
if (sound) {
if (who == 1) {
wilbur_speech(sound, 10001);
} else {
freeSeries5();
switch (node) {
case 0:
_pollyShould = 4;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 2:
switch (entry) {
case 0:
_pollyShould = 10;
kernel_trigger_dispatch_now(kCHANGE_POLLY_ANIMATION);
break;
case 1:
freeSeries7();
_G(flags)[V092] = 0;
_pollyShould = 14;
npc_say(sound, kCHANGE_POLLY_ANIMATION, "172ap02", 0x400, true, 31, 35);
break;
default:
break;
}
break;
case 3:
freeSeries7();
_pollyShould = 13;
npc_say(sound, kCHANGE_POLLY_ANIMATION, "172ap02", 0x400, true, 31, 35);
break;
default:
freeSeries7();
_pollyShould = 14;
npc_say(sound, kCHANGE_POLLY_ANIMATION, "172ap02", 0x400, true, 31, 35);
break;
}
}
}
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,66 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM172_H
#define M4_BURGER_ROOMS_SECTION1_ROOM172_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room172 : public Room {
private:
machine *_series1 = nullptr;
machine *_series1s = nullptr;
Series _jug;
//machine *_series4 = nullptr;
Series _series5;
machine *_series7 = nullptr;
noWalkRect *_walk1 = nullptr;
const char *_convName = nullptr;
int _pollyShould = 0;
void loadSeries7();
void freeSeries5() {
_series5.terminate();
}
void freeSeries7();
void playDigi3();
void conv41();
void parserAction(const char *name);
public:
Room172() : Room() {}
~Room172() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,131 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room173.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
static const char *SAID[][4] = {
{ "STAIRS", "173w002", "173w003", nullptr },
{ "WRINGER", "173w009", "173w010", "173w008" },
{ "BREAKER BOX", "504w017", nullptr, nullptr },
{ "WASHING MACHINE", "173w007", nullptr, "173w008" },
{ "SHORTS", "173w004", "173w005", "173w005" },
{ "FAN BOY TOWEL", "173w004", "173w005", "173w005" },
{ "SOCK", "173w004", "173w005", "173w005" },
{ "T-SHIRT", "173w004", "173w005", "173w005" },
{ "LAUNDRY", "173w004", "173w006", "173w006" },
{ nullptr, nullptr, nullptr, nullptr }
};
static const seriesPlayBreak PLAY1[] = {
{ 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY2[] = {
{ 0, 5, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 6, -1, nullptr, 0, 0, 1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
void Room173::init() {
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
break;
case 172:
ws_demand_location(136, 318, 5);
_G(wilbur_should) = player_been_here(173) ? 1 : 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
ws_demand_location(332, 333, 5);
break;
}
}
void Room173::daemon() {
switch (_G(kernel).trigger) {
case 1:
disable_player_commands_and_fade_init(1019);
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
disable_player();
_G(wilbur_should) = 10001;
series_play_with_breaks(PLAY1, "173wi01", 0x200, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 2:
disable_player();
_G(wilbur_should) = 3;
series_play_with_breaks(PLAY1, "173wi01", 0x200, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 3:
enable_player();
wilbur_speech("173w001");
break;
case 4:
disable_player();
series_play_with_breaks(PLAY2, "173wi02", 0x200, -1, 3);
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room173::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said("GEAR", "STAIRS")) {
_G(wilbur_should) = 4;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
_G(player).command_ready = false;
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,45 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM173_H
#define M4_BURGER_ROOMS_SECTION1_ROOM173_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room173 : public Room {
public:
Room173() : Room() {}
~Room173() override {}
void init() override;
void daemon() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,185 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room174.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
static const char *SAID[][4] = {
{ "HALLWAY", nullptr, "174w001", nullptr },
{ "TOILET", "174w002", "174w001", nullptr },
{ "TOILET LID", "174w002", "174w001", nullptr },
{ "TOILET TANK", "174w002", "174w001", nullptr },
{ "FLUSH CHAIN", "174w002", "174w001", nullptr },
{ "TUB", "174w004", "174w001", "174w005" },
{ "WINDOW", nullptr, "174w001", "174w006" },
{ "SHOWERHEAD", "174w007", "174w008", nullptr },
{ "CLOSET", "174w009", "174w010", "174w010" },
{ "MIRROR", "174w011", nullptr, "174w011" },
{ "LAXATIVE ", "174w012", nullptr, "174w014" },
{ "MEDICATIONS", "174w015", "174w016", "174w017" },
{ nullptr, nullptr, nullptr, nullptr }
};
static const seriesPlayBreak PLAY1[] = {
{ 0, 7, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 6, 0, nullptr, 0, 0, 1, 2, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY2[] = {
{ 0, 18, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY3[] = {
{ 0, 3, "507_003", 2, 255, -1, 1, 5, nullptr, 0 },
{ 4, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 6, 6, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
{ 5, 5, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
{ 4, 4, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
PLAY_BREAK_END
};
void Room174::init() {
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
break;
case 175:
ws_demand_location(639, 299, 9);
ws_walk(472, 297, nullptr, -1);
break;
default:
ws_demand_location(252, 304, 5);
break;
}
_series1 = series_show("174tlt01", 0x8ff);
_series2 = series_show("174flush", 0xf00);
if (inv_player_has("LAXATIVE")) {
hotspot_set_active("LAXATIVE ", false);
} else {
_laxative.show("174wi01", 0x400, 0, -1, -1, 19);
}
}
void Room174::daemon() {
switch (_G(kernel).trigger) {
case 1:
switch (_action) {
case 5:
terminateMachineAndNull(_series1);
_action = 6;
series_play_with_breaks(PLAY3, "174tlt01", 0x8ff, 1, 2);
break;
case 6:
player_set_commands_allowed(true);
_series1 = series_show("174tlt01", 0x8ff);
break;
default:
term_message("ERROR!!!!! toilet_should not set!");
break;
}
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
disable_player();
terminateMachineAndNull(_series2);
_action = 5;
_G(wilbur_should) = 2;
series_play_with_breaks(PLAY1, "174wi03", 0x8ff, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 2:
ws_unhide_walker();
wilbur_speech("174w003");
_series2 = series_show("174flush", 0xf00);
break;
case 3:
_laxative.terminate();
ws_hide_walker();
_G(wilbur_should) = 4;
series_play_with_breaks(PLAY2, "174wi01", 0x400, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 4:
enable_player();
inv_give_to_player("LAXATIVE");
hotspot_set_active("LAXATIVE ", false);
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room174::pre_parser() {
if (player_said("HALLWAY") && !player_said_any("GEAR", "LOOK AT"))
player_set_facing_at(522, 287);
}
void Room174::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said("HALLWAY") && player_said_any("GEAR", "LOOK AT")) {
disable_player_commands_and_fade_init(1022);
} else if (player_said("GEAR") && player_said_any("TOILET", "FLUSH CHAIN")) {
_G(wilbur_should) = 1;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "LAXATIVE ")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 3;
wilbur_speech("174w013", kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "MIRROR")) {
wilbur_speech("174w001");
} else {
return;
}
_G(player).command_ready = false;
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,52 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM174_H
#define M4_BURGER_ROOMS_SECTION1_ROOM174_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room174 : public Room {
private:
machine *_series1 = nullptr;
machine *_series2 = nullptr;
Series _laxative;
int _action = 0;
public:
Room174() : Room() {}
~Room174() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,160 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room175.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/core/play_break.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
static const char *SAID[][4] = {
{ "WILBUR'S ROOM", nullptr, "175w001", nullptr },
{ "BATHROOM", nullptr, "175w001", nullptr },
{ "AUNT POLLY'S ROOM", "175w002", "175w001", "175w003" },
{ "STAIRS", "175w004", "175w001", nullptr },
{ "WINDOW", nullptr, nullptr, "175w005" },
{ "VASE", "175w006", "175w007", "175w008" },
{ "PICTURE", "175w012", "175w010", "175w011" },
{ "PICTURE ", "175w013", "175w010", "175w011" },
{ "PICTURE ", "175w014", "175w010", "175w011" },
{ "PICTURE ", "175w009", "176w010", "175w011" },
{ nullptr, nullptr, nullptr, nullptr }
};
static const seriesPlayBreak PLAY1[] = {
{ 0, 3, "175_002a", 1, 100, -1, 0, 0, nullptr, 0 },
{ 4, -1, "175_002b", 1, 100, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY2[] = {
{ 0, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 3, -1, "175_002a", 1, 100, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
static const seriesPlayBreak PLAY3[] = {
{ 0, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
void Room175::init() {
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
break;
case 171:
ws_demand_location(331, 272, 3);
_G(wilbur_should) = 1;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 174:
ws_demand_location(150, 307, 3);
ws_walk(222, 307, nullptr, -1);
break;
case 176:
ws_demand_location(72, 348, 3);
ws_walk(170, 349, nullptr, -1);
break;
default:
ws_demand_location(327, 340, 5);
break;
}
digi_preload("175_001");
digi_play_loop("175_001", 2, 125);
series_play("175fan", 0xf00, 0, -1, 6, -1);
}
void Room175::daemon() {
switch (_G(kernel).trigger) {
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
disable_player();
_G(wilbur_should) = 10001;
series_play_with_breaks(PLAY1, "175wi01", 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 2:
disable_player();
series_play_with_breaks(PLAY2, "175wi02", 0xc00, -1, 3);
disable_player_commands_and_fade_init(1018);
break;
case 3:
disable_player();
_G(wilbur_should) = 10001;
series_play_with_breaks(PLAY3, "175wi03", 0xc00, kCHANGE_WILBUR_ANIMATION, 3);
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room175::pre_parser() {
if (!player_said_any("GEAR", "LOOK AT")) {
if (player_said("BATHROOM"))
player_set_facing_at(194, 301);
if (player_said("WILBUR'S ROOM"))
player_set_facing_at(126, 343);
}
}
void Room175::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said("GEAR", "STAIRS")) {
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said_any("GEAR", "LOOK AT") && player_said("BATHROOM")) {
disable_player_commands_and_fade_init(1021);
} else if (player_said_any("GEAR", "LOOK AT") && player_said("WILBUR'S ROOM")) {
disable_player_commands_and_fade_init(1023);
} else {
return;
}
_G(player).command_ready = false;
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,46 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM175_H
#define M4_BURGER_ROOMS_SECTION1_ROOM175_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room175 : public Room {
public:
Room175() : Room() {}
~Room175() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,139 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section1/room176.h"
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
namespace M4 {
namespace Burger {
namespace Rooms {
static const char *SAID[][4] = {
{ "HALLWAY", nullptr, "176w001", nullptr },
{ "PUZ DISPENSER ", "176w002", nullptr, "176w003" },
{ "ROBOT", "176w004", "176w005", "176w006" },
{ "WINDOW", nullptr, "176w001", "176w010" },
{ "BED", nullptr, nullptr, "176w016" },
{ "COMIC BOOK", "176w007", "176w008", "176w008" },
{ "COMIC BOOK ", nullptr, "176w008", "176w008" },
{ "GERBIL CAGE", "176w009", "176w005", "176w005" },
{ "TELEVISION", "176w011", "176w015", "176w015" },
{ "WARDROBE", "176w017", nullptr, "176w001" },
{ "DRESSER", "176w018", nullptr, "176w001" },
{ "BOOKS", nullptr, "176w008", "176w008" },
{ "MODEL ROCKET", "176w006", "176w005", "176w006" },
{ "MODEL ROCKET ", "176w019", "176w005", "176w006" },
{ "MODEL ROCKET ", "176w020", "176w005", "176w006" },
{ "POSTER", "176w021", "176w005", nullptr },
{ nullptr, nullptr, nullptr, nullptr }
};
static const seriesPlayBreak PLAY1[] = {
{ 0, 22, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
void Room176::init() {
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
break;
case 175:
ws_demand_location(546, 239, 9);
ws_walk(447, 251, nullptr, -1);
break;
default:
ws_demand_location(340, 279, 5);
break;
}
/* Original code to initialize the presence of the Puz Dispenser.
* Replaced by the code hereunder in order to fix an original duplication bug (after you give it to Odie) */
// if (inv_player_has("PUZ DISPENSER") || inv_player_has("BROKEN PUZ DISPENSER")) {
// hotspot_set_active("PUZ DISPENSER ", false);
// } else {
// _puzDispenser = series_show("176pez", 0x500);
// }
if (inv_object_in_scene("BROKEN PUZ DISPENSER", 176))
_puzDispenser = series_show("176pez", 0x500);
else
hotspot_set_active("PUZ DISPENSER ", false);
}
void Room176::daemon() {
switch (_G(kernel).trigger) {
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
disable_player();
terminateMachineAndNull(_puzDispenser);
_G(wilbur_should) = 2;
series_play_with_breaks(PLAY1, "176wi01", 0x500, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 2:
enable_player();
inv_give_to_player("BROKEN PUZ DISPENSER");
hotspot_set_active("PUZ DISPENSER ", false);
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room176::pre_parser() {
if (player_said("HALLWAY") && !player_said_any("GEAR", "LOOK AT"))
player_set_facing_at(487, 238);
}
void Room176::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said_any("GEAR", "LOOK AT") && player_said("HALLWAY")) {
disable_player_commands_and_fade_init(1022);
} else if (player_said("TAKE", "PUZ DISPENSER ")) {
_G(wilbur_should) = 1;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
_G(player).command_ready = false;
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,49 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_ROOM176_H
#define M4_BURGER_ROOMS_SECTION1_ROOM176_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room176 : public Room {
private:
machine *_puzDispenser = nullptr;
public:
Room176() : Room() {}
~Room176() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,272 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/rooms/section1/section1.h"
#include "m4/burger/vars.h"
#include "m4/graphics/gr_series.h"
#include "m4/core/imath.h"
#include "m4/m4.h"
namespace M4 {
namespace Burger {
namespace Rooms {
Section1::Section1() : Rooms::Section() {
add(101, &_room101);
add(102, &_room102);
add(103, &_room103);
add(104, &_room104);
add(105, &_room105);
add(106, &_room106);
add(120, &_room120);
add(133, &_room133_136);
add(134, &_room134_135);
add(135, &_room134_135);
add(136, &_room133_136);
add(137, &_room137);
add(138, &_room138);
add(139, &_room139_144);
add(140, &_room140_141);
add(141, &_room140_141);
add(142, &_room142);
add(143, &_room143);
add(145, &_room145);
add(144, &_room139_144);
add(170, &_room170);
add(171, &_room171);
add(172, &_room172);
add(173, &_room173);
add(174, &_room174);
add(175, &_room175);
add(176, &_room176);
}
void Section1::updateWalker(int x, int y, int dir, int trigger, bool mode) {
Section1 *s = dynamic_cast<Section1 *>(g_engine->_activeSection);
assert(s);
s->updateWalker_(x, y, dir, trigger, mode);
}
void Section1::updateWalker_(int x, int y, int dir, int trigger, bool mode) {
_trigger = trigger;
player_set_commands_allowed(false);
ws_demand_location(_G(my_walker), x, y);
ws_demand_facing(_G(my_walker), dir);
ws_hide_walker(_G(my_walker));
_G(roomVal3) = 0;
gr_backup_palette();
pal_fade_set_start(_G(master_palette), 0);
_series1 = series_load("110", -1, _G(master_palette));
_play = series_play("110", 0, 0, -1, 600, -1, 100, 0, 0, 0, 0);
kernel_trigger_dispatch_now(mode ? 1032 : 1027);
kernel_timing_trigger(1, 1026);
}
void Section1::updateDisablePlayer() {
player_update_info(_G(my_walker), &_G(player_info));
player_set_commands_allowed(false);
g_vars->getInterface()->freshen_sentence();
walk(-1);
_G(flags)[V000] = _G(flags)[kRoadOpened] ? 1002 : 1003;
}
void Section1::walk(int facing, int trigger) {
if (_G(my_walker) && _G(player).walker_in_this_scene) {
player_update_info(_G(my_walker), &_G(player_info));
if (facing == -1)
ws_walk(_G(my_walker), _G(player_info).x, _G(player_info).y, nullptr, trigger, _G(player_info).facing);
else
ws_walk(_G(my_walker), _G(player_info).x, _G(player_info).y, nullptr, trigger, facing, _G(completeWalk));
}
}
void Section1::daemon() {
switch (_G(kernel).trigger) {
case GOTO_TOWN_HALL:
case 1002:
case 1003:
case 1004:
case 1005:
case 1006:
case 1007:
_G(game).setRoom(_G(kernel).trigger - 1000 + 100);
break;
case 1008:
_G(game).setRoom(_G(flags)[V000] == 1002 ? 134 : 135);
break;
case 1009:
_G(game).setRoom(_G(flags)[V000] == 1002 ? 133 : 136);
break;
case 1010:
_G(game).setRoom(137);
break;
case 1011:
_G(game).setRoom(138);
break;
case 1012:
_G(game).setRoom(_G(flags)[V000] == 1002 ? 144 : 139);
break;
case 1013:
_G(game).setRoom(_G(flags)[V000] == 1002 ? 141 : 140);
break;
case 1014:
_G(game).setRoom(142);
break;
case 1015:
_G(game).setRoom(143);
break;
case 1016:
_G(game).setRoom(145);
break;
case 1017:
_G(game).setRoom(170);
break;
case 1018:
_G(game).setRoom(171);
break;
case 1019:
_G(game).setRoom(172);
break;
case 1020:
_G(game).setRoom(173);
break;
case 1021:
_G(game).setRoom(174);
break;
case 1022:
_G(game).setRoom(175);
break;
case 1023:
_G(game).setRoom(176);
break;
case 1024:
pal_fade_init(_G(master_palette), 0, 255, 100, 0, -1);
break;
case 1025:
kernel_trigger_dispatch_now(_trigger);
break;
case 1026:
pal_fade_init(_G(master_palette), 15, 255, 100, 0, -1);
break;
case 1027:
_series2 = series_load("110bu01", -1, _G(master_palette));
series_play("110bu01", 0, 0, 1028, 6, 0, 100, 0, 0, 0, 8);
_state1 = 2;
break;
case 1028:
kernel_trigger_dispatch_now(1029);
digi_play((_G(game).room_id == 135) ? "100b002" : "100b001", 1, 255, 1030);
break;
case 1029:
if (_state1 == 2) {
const int frame = imath_ranged_rand(9, 12);
series_play("110bu01", 0, 0, 1029, 5, 0, 100, 0, 0, frame, frame);
} else {
pal_fade_set_start(_G(master_palette), 0);
terminateMachineAndNull(_play);
kernel_timing_trigger(1, 1031);
}
break;
case 1030:
_state1 = 1;
return;
case 1031:
series_unload(_series2);
series_unload(_series1);
kernel_trigger_dispatch_now(_trigger);
break;
case 1032:
_series2 = series_load("110bu02", -1, _G(master_palette));
_state1 = 2;
kernel_trigger_dispatch_now(1033);
digi_play("100b003", 1, 255, 1034);
break;
case 1033:
if (_state1 == 2) {
const int frame = imath_ranged_rand(0, 4);
series_play("110bu02", 0, 0, 1033, 5, 0, 100, 0, 0, frame, frame);
} else {
series_play("110bu02", 0, 0, 1035, 5, 0, 100, 0, 0, 5, 16);
}
break;
case 1034:
_state1 = 1;
break;
case 1035:
pal_fade_set_start(_G(master_palette), 0);
terminateMachineAndNull(_play);
kernel_timing_trigger(1, 1036);
break;
case 1036:
series_unload(_series2);
series_unload(_series1);
kernel_trigger_dispatch_now(_trigger);
break;
case kAdvanceTime:
if (_G(flags)[V012] == 2) {
term_message(" Harry watches tv at: %d", _G(flags)[V009]);
if (_G(flags).get_boonsville_time_and_display() == (int32)_G(flags)[V009]) {
if (_G(game).room_id == 102) {
term_message("make harry walk in");
kernel_timing_trigger(1, 1037);
} else {
term_message("harry is back in chair");
_G(flags)[V012] = 0;
}
}
}
_G(kernel).continue_handling_trigger = true;
break;
case kBurlEntersTown:
_G(flags)[V000] = _G(flags)[kRoadOpened] ? 1002 : 1003;
break;
case kBurlGetsFed:
if (!_G(flags)[kRoadOpened])
_G(flags)[V063] = 1;
break;
case kBurlStopsEating:
if (!_G(flags)[kRoadOpened])
_G(flags)[V063] = 0;
break;
case kBurlLeavesTown:
if (!_G(flags)[kRoadOpened])
_G(flags)[V000] = 1004;
break;
case kBandEntersTown:
_G(flags)[kTourBusAtDiner] = 1;
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,108 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION1_H
#define M4_BURGER_ROOMS_SECTION1_H
#include "m4/burger/rooms/room.h"
#include "m4/burger/rooms/section.h"
#include "m4/burger/rooms/section1/room101.h"
#include "m4/burger/rooms/section1/room102.h"
#include "m4/burger/rooms/section1/room103.h"
#include "m4/burger/rooms/section1/room104.h"
#include "m4/burger/rooms/section1/room105.h"
#include "m4/burger/rooms/section1/room106.h"
#include "m4/burger/rooms/section1/room120.h"
#include "m4/burger/rooms/section1/room133_136.h"
#include "m4/burger/rooms/section1/room134_135.h"
#include "m4/burger/rooms/section1/room137.h"
#include "m4/burger/rooms/section1/room138.h"
#include "m4/burger/rooms/section1/room139_144.h"
#include "m4/burger/rooms/section1/room140_141.h"
#include "m4/burger/rooms/section1/room142.h"
#include "m4/burger/rooms/section1/room143.h"
#include "m4/burger/rooms/section1/room145.h"
#include "m4/burger/rooms/section1/room170.h"
#include "m4/burger/rooms/section1/room171.h"
#include "m4/burger/rooms/section1/room172.h"
#include "m4/burger/rooms/section1/room173.h"
#include "m4/burger/rooms/section1/room174.h"
#include "m4/burger/rooms/section1/room175.h"
#include "m4/burger/rooms/section1/room176.h"
namespace M4 {
namespace Burger {
namespace Rooms {
enum Goto1 {
GOTO_TOWN_HALL = 1001,
GOTO_OLD_BRIDGE = 1008
};
class Section1 : public Rooms::Section {
private:
Room101 _room101;
Room102 _room102;
Room103 _room103;
Room104 _room104;
Room105 _room105;
Room106 _room106;
Room120 _room120;
Room133_136 _room133_136;
Room134_135 _room134_135;
Room137 _room137;
Room138 _room138;
Room139_144 _room139_144;
Room140_141 _room140_141;
Room142 _room142;
Room143 _room143;
Room145 _room145;
Room170 _room170;
Room171 _room171;
Room172 _room172;
Room173 _room173;
Room174 _room174;
Room175 _room175;
Room176 _room176;
int _trigger = 0;
int _series1 = -1;
int _series2 = -1;
machine *_play = nullptr;
int _state1 = 0;
void updateWalker_(int x, int y, int dir, int trigger, bool mode);
public:
Section1();
virtual ~Section1() {}
void daemon() override;
static void updateWalker(int x, int y, int dir, int trigger, bool mode = false);
static void updateDisablePlayer();
static void walk(int facing = -1, int trigger = -1);
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,117 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section2/room204.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
const seriesPlayBreak Room204::PLAY1[] = {
{ 0, 2, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room204::PLAY2[] = {
{ 2, 8, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 9, 14, "204_001", 2, 63, -1, 0, 0, nullptr, 0 },
{ 14, 9, "204_001", 2, 63, -1, 1, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room204::PLAY3[] = {
{ 15, 18, "204w001", 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room204::PLAY4[] = {
{ 18, -1, nullptr, 0, 0, -1, 16, 0, nullptr, 0 },
PLAY_BREAK_END
};
void Room204::preload() {
_G(player).walker_in_this_scene = false;
}
void Room204::init() {
digi_preload("200_001");
digi_play_loop("200_001", 3, 85, -1, 200);
series_load("204as01");
series_load("204as01s");
digi_preload("204_001");
digi_preload("204w001");
kernel_trigger_dispatch_now(1);
}
void Room204::daemon() {
switch (_G(kernel).trigger) {
case 1:
Series::series_show("204as01", 0x100, 0, 2, 120, 0);
break;
case 2:
series_play_with_breaks(PLAY1, "204as01", 0x100, 3, 1);
break;
case 3:
Series::series_show("204as01", 0x100, 0, 4, 60, 2);
break;
case 4:
series_play_with_breaks(PLAY2, "204as01", 0x100, 5, 1, 6);
break;
case 5:
Series::series_show("204as01", 0x100, 0, 6, 60, 14);
break;
case 6:
series_play_with_breaks(PLAY3, "204as01", 0x100, 7, 1, 6);
break;
case 7:
Series::series_show("204as01", 0x100, 0, 8, 15, 18);
break;
case 8:
series_play_with_breaks(PLAY4, "204as01", 0x100, 9, 1, 6);
break;
case 9:
kernel_timing_trigger(60, 10);
break;
case 10:
disable_player_commands_and_fade_init(2002);
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,51 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION2_ROOM204_H
#define M4_BURGER_ROOMS_SECTION2_ROOM204_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room204 : public Room {
private:
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
static const seriesPlayBreak PLAY3[];
static const seriesPlayBreak PLAY4[];
public:
Room204() : Room() {}
~Room204() override {}
void preload() override;
void init() override;
void daemon() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,477 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section2/room207.h"
#include "m4/burger/burger.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
enum {
kCHANGE_ASTRAL_ANIMATION = 1
};
const seriesPlayBreak Room207::PLAY1[] = {
{ 0, 22, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room207::PLAY2[] = {
{ 22, 17, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 18, 25, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 31, 33, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 34, 31, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room207::PLAY3[] = {
{ 0, 13, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 25, 29, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room207::PLAY4[] = {
{ 29, 25, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 13, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room207::PLAY5[] = {
{ 35, 37, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 37, 35, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room207::PLAY6[] = {
{ 0, 17, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room207::PLAY7[] = {
{ 29, 22, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room207::PLAY8[] = {
{ 5, 23, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room207::PLAY9[] = {
{ 23, 5, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room207::PLAY10[] = {
{ 31, 24, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room207::PLAY11[] = {
{ 24, 31, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room207::PLAY12[] = {
{ 18, 22, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesStreamBreak Room207::SERIES1[] = {
{ 0, nullptr, 0, 0, -1, 0, nullptr, 0 },
{ 18, "207w001", 1, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
const seriesStreamBreak Room207::SERIES2[] = {
{ 0, nullptr, 0, 0, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
void Room207::preload() {
_G(player).walker_in_this_scene = false;
}
void Room207::init() {
player_set_commands_allowed(false);
digi_preload("207_001");
digi_play_loop("207_001", 3, 60);
_G(kernel).trigger_mode = KT_DAEMON;
series_load("207WI01");
series_load("207AS01");
series_load("207AS01S");
series_load("207AS03");
series_load("207AS03S");
series_load("207AS04");
series_load("207AS04S");
_conv1 = _G(flags).getConvName();
if (!_conv1)
_conv1 = "conv51";
interface_hide();
if (!strcmp(_conv1, "conv53")) {
_G(kernel).suppress_fadeup = true;
kernel_trigger_dispatch_now(3);
} else {
kernel_trigger_dispatch_now(2);
}
}
void Room207::daemon() {
switch (_G(kernel).trigger) {
case kCHANGE_ASTRAL_ANIMATION:
switch (_astralMode) {
case 15:
switch (_astralShould) {
case 1:
_astralShould = 7;
_series1.play("207as03", 0x200, 4, -1, 6, -1, 100, 0, 0, 31, 34);
digi_play(conv_sound_to_play(), 1, 255, kCHANGE_ASTRAL_ANIMATION);
break;
case 7:
_series1.terminate();
_astralShould = 10;
conv_resume_curr();
kernel_trigger_dispatch_now(kCHANGE_ASTRAL_ANIMATION);
break;
case 8:
_astralMode = 16;
_astralShould = 8;
series_play_with_breaks(PLAY4, "207as03", 0x200, 5, kCHANGE_ASTRAL_ANIMATION);
break;
case 10:
_astralShould = getAstralShould();
Series::series_show("207as03", 0x200, 0, kCHANGE_ASTRAL_ANIMATION, 30, 30);
break;
case 11:
_astralShould = 10;
series_play_with_breaks(PLAY5, "207as03", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 12:
_astralMode = 17;
_astralShould = 12;
series_play_with_breaks(PLAY10, "207as04", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 13:
_astralMode = 0;
series_play_with_breaks(PLAY7, "207as03", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
default:
break;
}
break;
case 16:
switch (_astralShould) {
case 1:
_astralShould = 7;
_series1.play("207as01", 0x200, 4, -1, 6, -1, 100, 0, 0, 26, 30);
digi_play(conv_sound_to_play(), 1, 255, kCHANGE_ASTRAL_ANIMATION);
break;
case 7:
_series1.terminate();
_astralShould = 8;
conv_resume_curr();
kernel_trigger_dispatch_now(kCHANGE_ASTRAL_ANIMATION);
break;
case 8:
_astralShould = getAstralShould();
_series1.show("207as01", 0x200, 0, kCHANGE_ASTRAL_ANIMATION, 30, 23);
break;
case 9:
_astralShould = 8;
series_play_with_breaks(PLAY2, "207as01", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 10:
_astralMode = 15;
_astralShould = 10;
series_play_with_breaks(PLAY3, "207as03", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 12:
_astralMode = 17;
_astralShould = 12;
series_play_with_breaks(PLAY8, "207as04", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 13:
_astralMode = 0;
series_play_with_breaks(PLAY6, "207as03", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
default:
break;
}
break;
case 17:
switch (_astralShould) {
case 1:
_astralShould = 7;
_series1.play("207as04", 0x200, 4, -1, 6, -1, 100, 0, 0, 0, 4);
digi_play(conv_sound_to_play(), 1, 255, kCHANGE_ASTRAL_ANIMATION);
break;
case 7:
_series1.terminate();
_astralShould = 12;
conv_resume_curr();
kernel_trigger_dispatch_now(kCHANGE_ASTRAL_ANIMATION);
break;
case 8:
_astralMode = 16;
_astralShould = 8;
series_play_with_breaks(PLAY9, "207as04", 0x200, 5, 1);
break;
case 10:
_astralMode = 15;
_astralShould = 10;
series_play_with_breaks(PLAY11, "207as04", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 12:
_astralShould = getAstralShould();
Series::series_show("207as04", 0x200, 0, kCHANGE_ASTRAL_ANIMATION, 30, 0);
break;
case 13:
_astralMode = 15;
series_play_with_breaks(PLAY11, "207as03", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
default:
break;
}
break;
default:
switch (_astralShould) {
case 5:
_astralMode = 16;
_astralShould = 8;
series_play_with_breaks(PLAY1, "207as01", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 13:
digi_play(conv_sound_to_play(), 1, 255, 6);
_series1.play("207as03", 0x200, 1, -1, 6, -1, 100, 0, 0, 18, 22);
break;
default:
break;
}
break;
}
break;
case 2:
conv_load_and_prepare(_conv1, 7);
conv_play_curr();
_G(wilbur_should) = 4;
_astralMode = 0;
_astralShould = 5;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
kernel_trigger_dispatch_now(kCHANGE_ASTRAL_ANIMATION);
break;
case 3:
gr_backup_palette();
digi_preload_stream_breaks(SERIES1);
series_stream_with_breaks(SERIES1, "207a", 6, 0x100, 4);
pal_fade_init(_G(kernel).first_fade, 255, 100, 0, -1);
break;
case 4:
pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
series_stream_with_breaks(SERIES2, "207b", 6, 0xf00, -1);
gr_restore_palette();
release_trigger_on_digi_state(2, 1);
break;
case 5:
series_play_with_breaks(PLAY12, "207as01", 0x200, kCHANGE_ASTRAL_ANIMATION, 1);
break;
case 6:
_series1.terminate();
Series::series_show("207as03", 0x200, 0, -1, -1, 22);
conv_resume_curr();
break;
case 7:
player_set_commands_allowed(false);
disable_player_commands_and_fade_init(8);
break;
case 8:
static_cast<Burger::BurgerEngine *>(g_engine)->handleTestDone();
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
if (!strcmp(conv_sound_to_play(), "53p0101")) {
_G(wilbur_should) = 3;
conv_resume_curr();
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
_G(wilbur_should) = 2;
digi_play(conv_sound_to_play(), 1, 255, kCHANGE_WILBUR_ANIMATION);
_general1 = series_play("207wi01", 0x400, 4, -1, 6, -1);
}
break;
case 2:
terminateMachineAndNull(_general1);
_G(wilbur_should) = 3;
conv_resume_curr();
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 3:
_G(wilbur_should) = getWilburShould();
series_show("207wi01", 0x400, 0, kCHANGE_WILBUR_ANIMATION, 30, 0);
break;
case 4:
_G(wilbur_should) = getWilburShould();
series_play("207wi01", 0x400, 1, kCHANGE_WILBUR_ANIMATION, 6, 0, 100, 0, 0, 0, 2);
break;
default:
break;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room207::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (player_said(_conv1)) {
handleConv();
_G(player).command_ready = false;
}
}
void Room207::handleConv() {
const char *sound = conv_sound_to_play();
const int who = conv_whos_talking();
const int node = conv_current_node();
const int entry = conv_current_entry();
if (sound) {
if (who == 1) {
_G(wilbur_should) = 1;
if (player_said("conv56") && node == 4)
_astralShould = 8;
if (node == 0 && entry == 1)
pal_fade_init(_G(kernel).first_fade, 255, 100, 30, -1);
} else if (player_said("conv51") && node == 8) {
_astralShould = 13;
} else {
_astralShould = 1;
}
}
}
int Room207::getAstralShould() const {
const int rand = imath_ranged_rand(1, 24);
switch (_astralMode) {
case 15:
switch (rand) {
case 1:
return 8;
case 2:
return 11;
case 3:
return 12;
default:
return 10;
}
break;
case 16:
switch (rand) {
case 1:
return 10;
case 2:
case 3:
return 9;
case 4:
return 12;
default:
return 8;
}
break;
case 17:
switch (rand) {
case 1:
return 8;
case 2:
return 10;
default:
return 12;
}
break;
default:
return _astralShould;
}
}
int Room207::getWilburShould() const {
const int rand = imath_ranged_rand(1, 8);
return (rand == 1) ? 4 : 3;
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,71 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION2_ROOM207_H
#define M4_BURGER_ROOMS_SECTION2_ROOM207_H
#include "m4/burger/rooms/room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room207 : public Room {
private:
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
static const seriesPlayBreak PLAY3[];
static const seriesPlayBreak PLAY4[];
static const seriesPlayBreak PLAY5[];
static const seriesPlayBreak PLAY6[];
static const seriesPlayBreak PLAY7[];
static const seriesPlayBreak PLAY8[];
static const seriesPlayBreak PLAY9[];
static const seriesPlayBreak PLAY10[];
static const seriesPlayBreak PLAY11[];
static const seriesPlayBreak PLAY12[];
static const seriesStreamBreak SERIES1[];
static const seriesStreamBreak SERIES2[];
const char *_conv1 = nullptr;
Series _series1;
machine *_general1 = nullptr;
int _astralShould = 0;
int _astralMode = 0;
void handleConv();
int getAstralShould() const;
int getWilburShould() const;
public:
Room207() : Room() {}
~Room207() override {}
void preload() override;
void init() override;
void daemon() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,53 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/rooms/section2/section2.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
Section2::Section2() : Rooms::Section() {
add(204, &_room204);
add(207, &_room207);
}
void Section2::daemon() {
switch (_G(kernel).trigger) {
case 2001:
_G(game).setRoom(204);
break;
case 2002:
_G(game).setRoom(207);
break;
default:
break;
}
_G(kernel).continue_handling_trigger = true;
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,50 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION2_H
#define M4_BURGER_ROOMS_SECTION2_H
#include "m4/burger/rooms/room.h"
#include "m4/burger/rooms/section.h"
#include "m4/burger/rooms/section2/room204.h"
#include "m4/burger/rooms/section2/room207.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Section2 : public Rooms::Section {
private:
Room204 _room204;
Room207 _room207;
public:
Section2();
virtual ~Section2() {}
void daemon() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,495 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#include "m4/burger/rooms/section3/mine.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
#define MINE_END 39
const char *Mine::SAID[][4] = {
{ "TUNNEL", "311w007", "311w007z", nullptr },
{ "DEBRIS", nullptr, "311w010", "311w011" },
{ "GROUND", "311w012", "311w007z", "311w007z" },
{ "WALL", "311w012", "311w007z", "311w007z" },
{ "CEILING", "311w012", "311w007z", "311w007z" },
{ nullptr, nullptr, nullptr, nullptr }
};
const int16 Mine::MINE_SCENE_NUMBERS[] = {
305, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319
};
const MineRoom Mine::MINE_INFO[] = {
// Links Doors
// --------------------- -------------------------- Correct
// Room# Scene ID Back Front Left Right Back Front Left Right Link Check
// ----- ---------- ---- ----- ---- ----- ----- ----- ----- ----- ------- -----
{ 0, SCENE_305, { 6, -1, -1, -1 }, { FRONT, NONE, NONE, NONE }, BACK, 0}, // mine entrance
{ 1, SCENE_313, { -1, -1, 2, 6 }, { NONE, NONE, RIGHT, LEFT }, RIGHT, 0},
{ 2, SCENE_316, { -1, 11, 13, 1 }, { NONE, BACK, RIGHT, LEFT }, LEFT, 0},
{ 3, SCENE_318, { 9, 14, 5, 4 }, { FRONT, BACK, RIGHT, LEFT }, FRONT, 0},
{ 4, SCENE_315, { 5, -1, 3, 10 }, { FRONT, NONE, RIGHT, LEFT }, LEFT, 0},
{ 5, SCENE_317, { 18, 4, 9, 3 }, { FRONT, BACK, RIGHT, LEFT }, RIGHT, 0},
{ 6, SCENE_318, { 11, 0, 1, 7 }, { FRONT, BACK, RIGHT, LEFT }, RIGHT, 0},
{ 7, SCENE_317, { 13, 14, 6, 18 }, { FRONT, RIGHT, RIGHT, LEFT }, FRONT, 0},
{ 8, SCENE_313, { -1, -1, 10, 9 }, { NONE, NONE, RIGHT, LEFT }, RIGHT, 0},
{ 9, SCENE_318, { 10, 3, 8, 5 }, { FRONT, BACK, RIGHT, LEFT }, FRONT, 0},
// ----- ---------- ---- ----- ---- ----- ----- ----- ----- ----- ---- ---}--
{10, SCENE_316, { -1, 9, 4, 8 }, { NONE, BACK, RIGHT, LEFT }, LEFT, 0},
{11, SCENE_317, { 2, 6, 11, 11 }, { FRONT, BACK, RIGHT, LEFT }, FRONT, 0},
{12, SCENE_319, { -1, -1, -1, 13 }, { NONE, NONE, NONE, LEFT }, RIGHT, 0},
{13, SCENE_316, { -1, 7, 12, 2 }, { NONE, BACK, RIGHT, LEFT }, FRONT, 0},
{14, SCENE_315, { 3, -1, 26, 7 }, { FRONT, NONE, BACK, FRONT}, LEFT, 0},
{15, SCENE_317, { 17, 16, 17, 20 }, { FRONT, BACK, RIGHT, LEFT }, RIGHT, 0},
{16, SCENE_311, { 15, -1, -1, -1 }, { FRONT, NONE, NONE, NONE }, BACK, 0},
{17, SCENE_318, { 22, 15, 20, 15 }, { FRONT, BACK, RIGHT, LEFT }, LEFT, 0},
{18, SCENE_316, { -1, 5, 7, 19 }, { NONE, BACK, RIGHT, LEFT }, LEFT, 0},
{19, SCENE_312, { -1, -1, 18, -1 }, { NONE, NONE, RIGHT, NONE }, LEFT, 0},
// ----- ---------- ---- ----- ---- ----- ----- ----- ------ ----- ---- ---}--
{20, SCENE_315, { 26, -1, 15, 17 }, { FRONT, NONE, RIGHT, LEFT }, BACK, 0},
{21, SCENE_319, { -1, -1, -1, 22 }, { NONE, NONE, NONE, LEFT }, RIGHT, 0},
{22, SCENE_316, { -1, 17, 21, 23 }, { NONE, BACK, RIGHT, LEFT }, FRONT, 0},
{23, SCENE_312, { -1, -1, 22, -1 }, { NONE, NONE, RIGHT, NONE }, LEFT, 0},
{24, SCENE_318, { 35, 29, 33, 25 }, { FRONT, BACK, RIGHT, LEFT }, RIGHT, 0},
{25, SCENE_314, { -1, -1, 24, 26 }, { NONE, NONE, RIGHT, LEFT }, RIGHT, 0},
{26, SCENE_317, { 14, 20, 25, 38 }, { LEFT, BACK, RIGHT, LEFT }, RIGHT, 0},
{27, SCENE_318, { 38, 38, 37, 28 }, { FRONT, BACK, RIGHT, LEFT }, BACK, 0},
{28, SCENE_312, { -1, -1, 27, -1 }, { NONE, NONE, RIGHT, NONE }, LEFT, 0},
{29, SCENE_317, { 24, 30, 35, 31 }, { FRONT, BACK, RIGHT, LEFT }, BACK, 0},
// ----- ---------- ---- ----- ---- ----- ----- ----- ------ ----- ---- -----
{30, SCENE_311, { 29, -1, -1, -1 }, { FRONT, NONE, NONE, NONE }, BACK, 0},
{31, SCENE_312, { -1, -1, 29, -1 }, { NONE, NONE, RIGHT, NONE }, LEFT, 0},
{32, SCENE_319, { -1, -1, -1, 33 }, { NONE, NONE, NONE, LEFT }, RIGHT, 0},
{33, SCENE_314, { -1, -1, 32, 24 }, { NONE, NONE, RIGHT, LEFT }, RIGHT, 0},
{34, SCENE_319, { -1, -1, -1, 35 }, { NONE, NONE, NONE, LEFT }, RIGHT, 0},
{35, SCENE_316, { -1, 24, 34, 29 }, { NONE, BACK, RIGHT, LEFT }, FRONT, 0},
{36, SCENE_319, { -1, -1, -1, 37 }, { NONE, NONE, NONE, LEFT }, RIGHT, 0},
{37, SCENE_314, { -1, -1, 36, 27 }, { NONE, NONE, RIGHT, LEFT }, RIGHT, 0},
{38, SCENE_318, { 27, 27, 26, 39 }, { FRONT, BACK, RIGHT, LEFT }, RIGHT, 0},
{39, SCENE_310, { -1, -1, 38, -1 }, { NONE, NONE, RIGHT, NONE }, NONE, 0}, // treasure
// ----- ---------- ---- ----- ---- ----- ----- ----- ----- ----- ------- -----
{40, NO_SCENE, { -1, -1, -1, -1 }, { NONE, NONE, NONE, NONE }, NONE, 0}
};
const EntranceInfo Mine::ENTRANCE_INFO[MAX_SCENE_TYPES][4] = {
//
// ( offscreen_x, offscreen_y, enter_facing, home_x, home_y, home_facing ) x 4 possible entrances
//
// Back Front Left Right
//----------------------- ------------------------- ------------------------- -------------------------
{{285, 240, 5, 320, 290, 5}, { 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0}}, // 305
{{ 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0}, { 55, 245, 3, 225, 275, 3}, { 0, 0, 0, 0, 0, 0}}, // 310
{{315, 225, 7, 310, 275, 7}, { 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0}}, // 311
{{ 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0}, { 90, 240, 3, 220, 270, 4}, { 0, 0, 0, 0, 0, 0}}, // 312
{{ 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0}, { 65, 230, 3, 215, 270, 4}, {550, 240, 8, 400, 270, 8}}, // 313
{{ 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0}, { 65, 240, 3, 190, 270, 4}, {570, 250, 8, 440, 280, 8}}, // 314
{{320, 210, 7, 315, 270, 7}, { 0, 0, 0, 0, 0, 0}, { 60, 230, 3, 190, 270, 4}, {560, 250, 9, 400, 270, 8}}, // 315
{{ 0, 0, 0, 0, 0, 0}, {400, 373,11, 335, 300, 7}, { 60, 220, 3, 200, 270, 4}, {570, 240, 8, 400, 270, 7}}, // 316
{{320, 215, 7, 315, 270, 7}, {230, 373, 1, 330, 300, 7}, { 60, 220, 3, 200, 270, 4}, {570, 240, 8, 400, 270, 7}}, // 317
{{320, 215, 5, 315, 270, 7}, {350, 373,11, 330, 300, 7}, { 60, 240, 3, 190, 270, 4}, {560, 235, 9, 420, 270, 8}}, // 318
{{ 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0}, {530, 240, 9, 420, 270, 7}} // 319
};
const Rectangle Mine::FADE_DOWN_INFO[MAX_SCENE_TYPES][4] = {
//
// ( x1, y1, x2, y2) for four directions
//
// Back Front Left Right
//------------------- ------------------- ------------------- -------------------
{{255, 0, 315, 250}, { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0}}, // 305
{{ 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 170, 270}, { 0, 0, 0, 0}}, // 310
{{270, 0, 365, 255}, { 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0}}, // 311
{{ 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 175, 268}, { 0, 0, 0, 0}}, // 312
{{ 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 172, 256}, {470, 0, 639, 265}}, // 313
{{ 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 172, 265}, {470, 0, 639, 280}}, // 314
{{280, 0, 365, 245}, { 0, 0, 0, 0}, { 0, 0, 165, 257}, {470, 0, 639, 271}}, // 315
{{ 0, 0, 0, 0}, {325, 350, 500, 374}, { 0, 0, 178, 265}, {470, 0, 639, 265}}, // 316
{{275, 0, 365, 255}, {136, 344, 360, 374}, { 0, 0, 165, 268}, {470, 0, 639, 270}}, // 317
{{275, 0, 365, 252}, {185, 344, 500, 374}, { 0, 0, 165, 265}, {470, 0, 639, 270}}, // 318
{{ 0, 0, 0, 0}, { 0, 0, 0, 0}, { 0, 0, 0, 0}, {470, 0, 639, 270}} // 319
};
int16 Mine::_entranceDoor;
void MineRoom::clear() {
roomNumber = 0;
scene_id = 0;
Common::fill(link, link + 4, 0);
Common::fill(door, door + 4, 0);
correctLink = 0;
check = 0;
}
Mine::Mine() : Section3Room() {
_mineRoomInfo.clear();
}
void Mine::preload() {
Section3Room::preload();
_mineCtr = 0;
_G(player).walker_type = 0;
_G(player).shadow_type = 0;
}
void Mine::init() {
setupDigi();
if (_G(flags)[kTrufflesInMine]) {
for (int i = 0; i < 6; ++i)
digi_preload(Common::String::format("300t001%c", 'a' + i));
}
_fade_down_rect_active = false;
set_palette_brightness(30);
_G(kernel).call_daemon_every_loop = true;
_mineCtr = 0;
const int32 &mineRoomIndex = _G(flags)[kMineRoomIndex];
_mineRoomInfo = MINE_INFO[mineRoomIndex]; // Get this mine room info
_presentSceneID = _mineRoomInfo.scene_id; // Set the scene ID
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
default:
player_set_commands_allowed(false);
ws_demand_location(-50, 200);
kernel_trigger_dispatch_now(301);
break;
}
}
void Mine::daemon() {
switch (_G(kernel).trigger) {
case 301:
case 302: {
const EntranceInfo &ei = ENTRANCE_INFO[_presentSceneID][_entranceDoor];
if (_G(kernel).trigger == 301)
ws_demand_location(ei.offscreen_x, ei.offscreen_y, ei.enter_facing);
player_set_commands_allowed(false);
ws_walk(ei.home_x, ei.home_y, nullptr, 303, ei.home_facing);
term_message("Mine entry %d at (%d,%d) to (%d,%d, %d)",
_presentSceneID,
ei.offscreen_x, ei.offscreen_y,
ei.home_x, ei.home_y, ei.home_facing);
break;
}
case 303:
player_set_commands_allowed(true);
if (_G(game).room_id == 310) {
if (_G(flags)[V141]) {
_G(wilbur_should) = 10002;
} else {
_G(flags)[V141] = 1;
_G(wilbur_should) = 408;
}
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (_G(game).room_id != 305) {
if (!_G(flags)[kEnteredMine]) {
_G(flags)[kEnteredMine] = 1;
_G(wilbur_should) = _G(flags)[kTrufflesInMine] ? 402 : 401;
} else if (!imath_rand_bool(3)) {
_G(wilbur_should) = 10002;
} else if (!_G(flags)[kTrufflesInMine]) {
_G(wilbur_should) = 404;
} else {
_G(wilbur_should) = inv_player_has("WHISTLE") ? 406 : 405;
}
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
break;
case 304:
digi_play("300_007", 2);
break;
case 305:
_volume = 160 - getTreasureDistance() * 25;
_random1 = imath_ranged_rand(0, 5);
digi_play(Common::String::format("300t001%c", 'a' + _random1).c_str(), 3, _volume);
break;
case 10008:
switch (_G(game).room_id) {
case 305:
case 310:
_G(kernel).continue_handling_trigger = true;
break;
default:
if (_G(flags)[kTrufflesInMine] && !_G(flags)[kTrufflesRanAway])
kernel_timing_trigger(15, 305);
break;
}
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 401:
wilbur_speech("311w001");
break;
case 402:
player_set_commands_allowed(false);
_G(wilbur_should) = 403;
wilbur_speech("311w002", kCHANGE_WILBUR_ANIMATION);
break;
case 403:
player_set_commands_allowed(true);
wilbur_speech("311w003");
break;
case 404:
player_set_commands_allowed(true);
_random2 = imath_ranged_rand(0, 5);
wilbur_speech(Common::String::format("311w004%c", 'a' + _random2).c_str());
break;
case 405:
term_message("Wilbur enters the mine with no whistle!");
player_set_commands_allowed(true);
_random2 = imath_ranged_rand(0, 3);
digi_play(Common::String::format("311w005%c", 'a' + _random2).c_str(), 3, _volume);
break;
case 406:
_random2 = imath_ranged_rand(0, 2);
wilbur_speech(Common::String::format("311w006%c", 'a' + _random2).c_str());
break;
case 407:
if (_G(flags)[V136]) {
_random2 = imath_ranged_rand(0, 6);
wilbur_speech(Common::String::format("311w009%c", 'a' + _random2).c_str());
} else {
wilbur_speech("311w008");
}
break;
case 408:
wilbur_speech("310w001");
break;
case kWILBUR_SPEECH_STARTED:
player_set_commands_allowed(true);
ws_unhide_walker();
_G(wilbur_should) = 10002;
term_message("Mine whistle daemon thing");
switch (_G(game).room_id) {
case 305:
if (_G(flags)[kTrufflesInMine]) {
_G(flags)[V002] = 1;
wilbur_speech("300w060");
}
break;
case 310:
if (_G(flags)[kTrufflesInMine] && !_G(flags)[kTrufflesRanAway]) {
_G(flags)[kTrufflesRanAway] = 1;
} else {
wilbur_speech("300w069");
}
break;
default:
if (!_G(flags)[kTrufflesInMine] && _G(flags)[kTrufflesRanAway]) {
// Truffles is too far away
wilbur_speech("300w061");
} else if (!_G(flags)[V148]) {
_G(flags)[V148] = 1;
_treasureDistance = getTreasureDistance();
switch (_treasureDistance) {
case 1:
wilbur_speech("300w062");
break;
case 2:
wilbur_speech("300w063");
break;
case 3:
case 4:
wilbur_speech("300w064");
break;
case 5:
case 6:
wilbur_speech("300w065");
break;
default:
break;
}
_previousDistance = _treasureDistance;
} else {
_treasureDistance = getTreasureDistance();
if (_treasureDistance < _previousDistance) {
wilbur_speech("300w068");
} else if (_treasureDistance == _previousDistance) {
wilbur_speech("300w067");
} else {
wilbur_speech("300w066");
}
_previousDistance = _treasureDistance;
}
break;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
case kCALLED_EACH_LOOP:
if (_fade_down_rect_active) {
player_update_info();
if (_G(player_info).x >= _fade_down_rect.x1 &&
_G(player_info).x <= _fade_down_rect.x2 &&
_G(player_info).y >= _fade_down_rect.y1 &&
_G(player_info).y <= _fade_down_rect.y2) {
if (player_commands_allowed()) {
pal_fade_set_start(100);
pal_fade_init(_G(kernel).first_fade, 255, 0, 40, -1);
}
player_set_commands_allowed(false);
}
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Mine::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
_fade_down_rect_active = false;
if (player_said("tunnel") && player_said_any("walk through", "GEAR")) {
if (_G(player).click_y > 300)
set_fade_down_rect(FRONT);
else if (_G(player).click_x < 200)
set_fade_down_rect(LEFT);
else if (_G(player).click_x < 400)
set_fade_down_rect(BACK);
else
set_fade_down_rect(RIGHT);
// Turn on the fade down area
_fade_down_rect_active = true;
}
}
void Mine::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (player_said("LOOK AT") && player_said_any("WALL", "CEILING", "GROUND")) {
term_message("Room #: %d", _G(flags)[kMineRoomIndex]);
term_message("Distance from pig: %d", getTreasureDistance());
_mineCtr = (_mineCtr + 1) % 5;
if (_mineCtr == 0) {
wilbur_speech("311w012");
_G(player).command_ready = false;
return;
}
}
if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said("tunnel") && player_said_any("walk through", "GEAR")) {
pal_fade_set_start(0);
if (_G(player).click_y > 300)
mine_travel_link(FRONT);
else if (_G(player).click_x < 200)
mine_travel_link(LEFT);
else if (_G(player).click_x > 400)
mine_travel_link(RIGHT);
else
mine_travel_link(BACK);
} else if (player_said("LOOK AT", "DEBRIS") && _G(game).room_id != 305) {
_G(wilbur_should) = 407;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
_G(player).command_ready = false;
}
int Mine::getTreasureDistance() const {
int distance = 0;
for (int index = _G(flags)[kMineRoomIndex]; index != MINE_END; ++distance) {
const MineRoom &me = MINE_INFO[index];
index = me.link[me.correctLink];
}
return distance;
}
void Mine::mine_travel_link(int16 takeLink) {
int32 &mineRoomIndex = _G(flags)[kMineRoomIndex];
_mineRoomInfo = MINE_INFO[mineRoomIndex]; // Get this mine room info
_entranceDoor = _mineRoomInfo.door[takeLink]; // Get which door to enter from in new room
mineRoomIndex = _mineRoomInfo.link[takeLink]; // Get which link to take
assert(mineRoomIndex != -1);
_mineRoomInfo = MINE_INFO[mineRoomIndex]; // Get new mine room info from new index
_presentSceneID = _mineRoomInfo.scene_id; // Set the scene ID
_G(game).setRoom(MINE_SCENE_NUMBERS[_presentSceneID]); // Go to the corresponding scene number
_G(kernel).force_restart = true; // Makes the scene start over even if new_room = present room
}
void Mine::set_fade_down_rect(MineDoors exit_door) {
_fade_down_rect.x1 = FADE_DOWN_INFO[_presentSceneID][exit_door].x1;
_fade_down_rect.y1 = FADE_DOWN_INFO[_presentSceneID][exit_door].y1;
_fade_down_rect.x2 = FADE_DOWN_INFO[_presentSceneID][exit_door].x2;
_fade_down_rect.y2 = FADE_DOWN_INFO[_presentSceneID][exit_door].y2;
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,134 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION3_MINE_ROOM_H
#define M4_BURGER_ROOMS_SECTION3_MINE_ROOM_H
#include "m4/burger/rooms/section3/section3_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
enum MineDoors {
BACK, FRONT, LEFT, RIGHT, MAX_DOORS, NONE
};
enum MineScenes {
SCENE_305, // treasure
SCENE_310, // mine entrance
SCENE_311, // one door (a)
SCENE_312, // one door (b)
SCENE_313, // two doors (a)
SCENE_314, // two doors (b)
SCENE_315, // three doors (a)
SCENE_316, // three doors (b)
SCENE_317, // four doors (a)
SCENE_318, // four doors (b)
SCENE_319, // one door (c)
MAX_SCENE_TYPES,
TREASURE_SCENE = SCENE_310,
ENTRANCE_SCENE = SCENE_305,
NO_SCENE = MAX_SCENE_TYPES
};
struct MineRoom {
int16 roomNumber; // The mine room number
int16 scene_id; // The scene id (indexes for mine_scene_numbers)
int16 link[4]; // Links to other mine rooms
int16 door[4]; // Specify doors to use
int16 correctLink; // The correct link to take to get to the treasure
int16 check; // Used to check the maze sanity
void clear();
};
struct EntranceInfo {
int16 offscreen_x;
int16 offscreen_y;
int16 enter_facing;
int16 home_x;
int16 home_y;
int16 home_facing;
};
struct Rectangle {
int16 x1;
int16 y1;
int16 x2;
int16 y2;
};
class Mine : public Section3Room {
private:
static const char *SAID[][4];
static const int16 MINE_SCENE_NUMBERS[];
static const MineRoom MINE_INFO[];
/**
* Coords for starting fade down for exits
*/
static const Rectangle FADE_DOWN_INFO[MAX_SCENE_TYPES][4];
/**
* Room coords for entrance walk-ins
*/
static const EntranceInfo ENTRANCE_INFO[MAX_SCENE_TYPES][4];
int _mineCtr = 0;
int16 _presentSceneID = 0;
static int16 _entranceDoor; // Shared between cellar and mine room classes
MineRoom _mineRoomInfo;
bool _fade_down_rect_active = false; // True if a fade down should occur when walker in the fade_down_rect
Rectangle _fade_down_rect = {0, 0, 0, 0}; // If the walker is in his rectum and its active, turn off the lights
int _volume = 0;
int _random1 = 0;
int _random2 = 0;
int _treasureDistance = 0;
int _previousDistance = 0;
int getTreasureDistance() const;
protected:
const char *getDigi() override {
return "300_004";
}
void mine_travel_link(int16 takeLink);
void set_fade_down_rect(MineDoors exit_door);
public:
Mine();
virtual ~Mine() {}
void preload() override;
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,263 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section3/room301.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
const seriesStreamBreak Room301::SERIES1[] = {
{ 0, nullptr, 0, 0, 16, 0, nullptr, 0 },
{ 1, "301_010", 3, 60, -1, (uint)-1, nullptr, 0 },
{ 9, "301W001", 1, 255, -1, 0, nullptr, 0 },
{ 39, "301F001", 1, 255, -1, 0, nullptr, 0 },
{ 42, "301_007", 2, 255, -1, 0, nullptr, 0 },
{ 63, "301_003", 1, 255, -1, 0, nullptr, 0 },
{ 65, "301_019", 2, 275, -1, 0, nullptr, 0 },
{ 75, nullptr, 1, 0, -1, 0, nullptr, 0 },
{ 77, "301F001A", 1, 255, -1, 0, nullptr, 0 },
{ 110, "301Z001", 1, 255, -1, 0, nullptr, 0 },
{ 129, nullptr, 0, 0, 15, 0, nullptr, 0 },
{ 132, nullptr, 0, 0, 20, 0, nullptr, 0 },
{ 133, nullptr, 3, 0, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
const seriesStreamBreak Room301::SERIES2[] = {
{ 0, nullptr, 0, 0, 17, 0, nullptr, 0 },
{ 1, "301_010", 3, 60, -1, (uint)-1, nullptr, 0 },
{ 12, "301Z002x", 1, 255, -1, 0, nullptr, 0 },
{ 17, "301_002", 2, 125, -1, 0, nullptr, 0 },
{ 31, "301Z002y", 1, 255, -1, 0, nullptr, 0 },
{ 105, "301Z002z", 1, 255, -1, 0, nullptr, 0 },
{ 136, "301W003", 1, 255, -1, 0, nullptr, 0 },
{ 161, "301Z003", 1, 255, -1, 0, nullptr, 0 },
{ 301, "301F003", 1, 255, -1, 0, nullptr, 0 },
{ 335, "301Z005x", 1, 255, -1, 0, nullptr, 0 },
{ 372, "301Z005y", 1, 255, -1, 0, nullptr, 0 },
{ 385, "301Z005z", 1, 255, -1, 0, nullptr, 0 },
{ 434, "301_017", 2, 150, -1, 0, nullptr, 0 },
{ 438, "301Z006", 1, 255, -1, 0, nullptr, 0 },
{ 456, "301Z011y", 1, 255, -1, 0, nullptr, 0 },
{ 488, "301Z011z", 1, 255, -1, 0, nullptr, 0 },
{ 526, "301_021", 2, 200, -1, 0, nullptr, 0 },
{ 542, "301Z007", 1, 150, -1, 0, nullptr, 0 },
{ 549, "301w999", 2, 150, -1, 0, nullptr, 0 },
{ 564, "301Z008", 1, 255, -1, 0, nullptr, 0 },
{ 591, "301W004", 1, 255, -1, 0, nullptr, 0 },
{ 620, "301Z009y", 1, 255, -1, 0, nullptr, 0 },
{ 631, "301Z009z", 1, 255, -1, 0, nullptr, 0 },
{ 688, "301Z010x", 1, 255, -1, 0, nullptr, 0 },
{ 700, "301Z010y", 1, 255, -1, 0, nullptr, 0 },
{ 747, "301Z010z", 1, 255, -1, 0, nullptr, 0 },
{ 792, "301_009", 2, 255, -1, 0, nullptr, 0 },
{ 795, "301_003", 1, 255, -1, 0, nullptr, 0 },
{ 803, "301_002", 2, 255, -1, 0, nullptr, 0 },
{ 812, "301_011", 2, 255, -1, 0, nullptr, 0 },
{ 821, "301_005", 1, 255, -1, 0, nullptr, 0 },
{ 826, "301_018", 2, 175, -1, 0, nullptr, 0 },
{ 835, nullptr, 1, 0, -1, 0, nullptr, 0 },
{ 836, nullptr, 0, 0, 15, 0, nullptr, 0 },
{ 837, nullptr, 0, 0, 20, 0, nullptr, 0 },
STREAM_BREAK_END
};
const seriesStreamBreak Room301::SERIES3[] = {
{ 0, "301_004", 3, 100, -1, (uint)-1, nullptr, 0 },
{ 0, "301_010", 2, 30, -1, (uint)-1, nullptr, 0 },
{ 0, nullptr, 0, 0, 18, 0, nullptr, 0 },
{ 1, "301Z101", 1, 255, -1, 0, nullptr, 0 },
{ 30, "301W101", 1, 255, -1, 0, nullptr, 0 },
{ 49, "301Z102", 1, 255, -1, 0, nullptr, 0 },
{ 96, "301W102", 1, 255, -1, 0, nullptr, 0 },
{ 127, nullptr, 0, 0, 15, 0, nullptr, 0 },
{ 130, nullptr, 3, 0, -1, 0, nullptr, 0 },
{ 131, nullptr, 0, 0, 20, 0, nullptr, 0 },
STREAM_BREAK_END
};
const seriesStreamBreak Room301::SERIES4[] = {
{ 0, "301_010", 2, 30, -1, (uint)-1, nullptr, 0 },
{ 0, nullptr, 0, 0, 18, 0, nullptr, 0 },
{ 1, "301_004", 3, 255, -1, (uint)-1, nullptr, 0 },
{ 37, nullptr, 0, 0, 15, 0, nullptr, 0 },
{ 38, nullptr, 0, 0, 20, 0, nullptr, 0 },
{ -1, nullptr, 0, 0, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
void Room301::preload() {
_G(player).walker_in_this_scene = false;
}
void Room301::init() {
setupDigi();
_G(flags).reset3();
digi_preload_stream_breaks(SERIES1);
digi_preload_stream_breaks(SERIES2);
digi_preload_stream_breaks(SERIES3);
digi_preload_stream_breaks(SERIES4);
if (_G(executing) != WHOLE_GAME) {
inv_give_to_player("JUG");
inv_give_to_player("CARROT JUICE");
inv_give_to_player("WHISTLE");
}
_G(kernel).suppress_fadeup = true;
kernel_trigger_dispatch_now(1);
}
void Room301::daemon() {
switch (_G(kernel).trigger) {
case 1:
pal_fade_set_start(0);
series_stream_with_breaks(SERIES1, "301lab01", 6, 1, 2);
pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
break;
case 2:
pal_fade_set_start(0);
pal_cycle_stop();
kernel_timing_trigger(6, 3);
break;
case 3:
compact_mem_and_report();
kernel_timing_trigger(6, 4);
break;
case 4:
pal_fade_set_start(0);
series_stream_with_breaks(SERIES3, "301orb01", 6, 1, 5);
pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
break;
case 5:
pal_fade_set_start(0);
pal_cycle_stop();
kernel_timing_trigger(6, 6);
break;
case 6:
compact_mem_and_report();
kernel_timing_trigger(6, 7);
break;
case 7:
digi_unload_stream_breaks(SERIES1);
pal_fade_set_start(0);
series_stream_with_breaks(SERIES2, "301lab02", 6, 1, 9);
pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
break;
case 8:
pal_fade_set_start(0);
pal_cycle_stop();
kernel_timing_trigger(6, 9);
break;
case 9:
compact_mem_and_report();
kernel_timing_trigger(6, 10);
break;
case 10:
pal_fade_set_start(0);
digi_unload_stream_breaks(SERIES3);
series_stream_with_breaks(SERIES4, "301orb02", 6, 1, 11);
pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
break;
case 11:
pal_fade_set_start(0);
pal_cycle_stop();
kernel_timing_trigger(6, 12);
digi_unload_stream_breaks(SERIES2);
break;
case 12:
compact_mem_and_report();
kernel_timing_trigger(6, 3001);
break;
case 13:
gr_pal_set_range(120, 8);
pal_cycle_init(118, 127, 6, -1, -1);
break;
case 14:
break;
case 15:
pal_fade_init(_G(kernel).first_fade, 255, 0, 30, -1);
break;
case 16:
pal_fade_set_start(0);
digi_unload_stream_breaks(SERIES3);
pal_fade_init(_G(kernel).first_fade, 255, 100, 30, 13);
break;
case 17:
pal_fade_set_start(0);
pal_mirror_colours(120, 122);
pal_fade_init(_G(kernel).first_fade, 255, 100, 30, 14);
break;
case 18:
pal_fade_set_start(0);
pal_mirror_colours(32, 39);
pal_fade_init(_G(kernel).first_fade, 255, 100, 30, 19);
break;
case 19:
gr_pal_set_range(32, 16);
pal_cycle_init(32, 47, 6, -1);
break;
case 20:
pal_cycle_stop();
break;
case 3001:
_G(kernel).suppress_fadeup = false;
digi_unload_stream_breaks(SERIES1);
digi_unload_stream_breaks(SERIES1);
digi_unload_stream_breaks(SERIES3);
digi_unload_stream_breaks(SERIES4);
digi_preload("301_016");
digi_play("301_016", 1, 255);
adv_kill_digi_between_rooms(false);
_G(game).setRoom(302);
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,51 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM301_H
#define M4_BURGER_ROOMS_SECTION3_ROOM301_H
#include "m4/burger/rooms/section3/section3_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room301 : public Section3Room {
private:
static const seriesStreamBreak SERIES1[];
static const seriesStreamBreak SERIES2[];
static const seriesStreamBreak SERIES3[];
static const seriesStreamBreak SERIES4[];
public:
Room301() : Section3Room() {}
~Room301() override {}
void preload() override;
void init() override;
void daemon() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,614 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section3/room302.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
const char *Room302::SAID[][4] = {
{ "DOOR", nullptr, "300w001", nullptr },
{ "STORM CELLAR", nullptr, "300w002", nullptr },
{ "BACK YARD", "302w002", "302w002", nullptr },
{ "BURGER MORSEL ", nullptr, nullptr, "302w010" },
{ "TRUFFLES", nullptr, "302w013", "302w014" },
{ "TROUGH", "302w015", "300w003", "302w016" },
{ "SIGN", "302w017", "300w004", "300w005" },
{ "CABIN", "302w018", "300w002", "300w002" },
{ "WINDOW", "302w021", "300w002", "302w022" },
{ "ROCKING CHAIR", "302w019", "302w020", "302w020" },
{ "CRASHED ROCKET", "302w023", "300w003", "302w024" },
{ "DOCK", "302w025", "300w002", "302w026" },
{ "FORCE FIELD", "302w027", "300w002", "300w002" },
{ "ROCK", "302w028", "300w002", "300w002" },
{ "TREES", "302w029", "300w002", "300w002" },
{ nullptr, nullptr, nullptr, nullptr }
};
const seriesStreamBreak Room302::SERIES1[] = {
{ 0, "302p004", 1, 255, -1, 0, nullptr, 0 },
{ 19, "302_008", 2, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
const seriesStreamBreak Room302::SERIES2[] = {
{ 7, "302_002", 1, 255, -1, 0, nullptr, 0 },
{ 9, "302w001a", 2, 255, -1, 0, &_state1, 0 },
{ 9, "302w001b", 2, 255, -1, 0, &_state1, 1 },
{ 9, "302w001c", 2, 255, -1, 0, &_state1, 2 },
{ 34, "302_005", 2, 125, -1, 0, nullptr, 0 },
{ 48, "302_006", 2, 125, -1, 1024, nullptr, 0 },
{ 138, "302_007", 1, 255, -1, 0, nullptr, 0 },
{ 138, "302_003", 1, 255, -1, 0, nullptr, 0 },
{ 152, "302_007", 1, 255, -1, 0, nullptr, 0 },
{ 152, "302_003", 1, 255, -1, 0, nullptr, 0 },
{ 165, nullptr, 2, 0, 4, 0, nullptr, 0 },
STREAM_BREAK_END
};
const seriesStreamBreak Room302::SERIES3[] = {
{ 7, "302_002", 2, 255, -1, 0, nullptr, 0 },
{ 9, "302w001a", 1, 255, -1, 0, &_state1, 0 },
{ 9, "302w001b", 1, 255, -1, 0, &_state1, 1 },
{ 9, "302w001c", 1, 255, -1, 0, &_state1, 2 },
{ 24, "302p001", 2, 255, -1, 0, nullptr, 0 },
{ 35, "302_005", 2, 125, -1, 0, nullptr, 0 },
{ 48, "302_006", 2, 125, -1, 1024, nullptr, 0 },
{ 52, "302p003", 1, 255, -1, 0, nullptr, 0 },
{ 71, "302_008", 2, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
const seriesPlayBreak Room302::PLAY1[] = {
{ 0, -1, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room302::PLAY2[] = {
{ 0, -1, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room302::PLAY3[] = {
{ 0, -1, "304_001", 2, 255, -1, 2048, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room302::PLAY4[] = {
{ 0, 1, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
{ 2, -1, "302w002", 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room302::PLAY5[] = {
{ 0, 22, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
{ 23, -1, "302_001", 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room302::PLAY6[] = {
{ 0, 7, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
{ 8, -1, nullptr, 1, 0, 5, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room302::PLAY7[] = {
{ 0, 29, "302t004", 2, 155, -1, 2048, 0, nullptr, 0 },
{ 26, 29, "302t005", 2, 155, -1, 0, 12, &Flags::_flags[V110], 0 },
{ 26, 29, "302t005", 2, 155, -1, 0, 3, &Flags::_flags[V110], 1 },
{ 30, 61, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room302::PLAY8[] = {
{ 62, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room302::PLAY9[] = {
{ 0, 28, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
{ 29, -1, nullptr, 1, 0, 6, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room302::PLAY10[] = {
{ 0, 4, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room302::PLAY11[] = {
{ 5, 13, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room302::PLAY12[] = {
{ 6, 16, "302t002", 2, 155, -1, 0, 0, nullptr, 0 },
{ 11, 17, nullptr, 2, 0, -1, 3, 2, nullptr, 0 },
{ 12, 6, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room302::PLAY13[] = {
{ 0, 4, "302t003", 2, 155, -1, 0, 0, nullptr, 0 },
{ 5, 3, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
{ 4, 5, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
{ 4, 3, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
{ 3, 5, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
{ 5, 3, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
{ 3, 4, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
{ 5, 0, nullptr, 2, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
int32 Room302::_state1;
Room302::Room302() : Section3Room() {
_state1 = 0;
}
void Room302::init() {
setupDigi();
if (!_G(flags)[kTrufflesInMine]) {
static const char *NAMES[12] = {
"302t001a", "302t001b", "302t001c", "302t001d", "302t001e",
"302t001f", "302t001g", "302t001h", "302t002", "302t003",
"302t004", "302t005"
};
for (int i = 0; i < 12; ++i)
digi_preload(NAMES[i], 302);
}
player_set_commands_allowed(false);
pal_cycle_init(112, 127, 6, -1, -1);
if (_G(flags)[kTrufflesInMine]) {
hotspot_set_active("TRUFFLES", false);
} else if (_G(flags)[kPerkinsLostIsland]) {
series_load("302tr01");
series_load("302tr01s");
series_load("302tr02");
series_load("302tr02s");
series_load("302tr03");
series_load("302tr03s");
_val1 = 24;
kernel_trigger_dispatch_now(9);
} else {
_val1 = 21;
kernel_trigger_dispatch_now(9);
}
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
case 303:
_G(wilbur_should) = _G(flags)[V125] ? 6 : 5;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 304:
_G(wilbur_should) = 4;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 305:
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
ws_demand_location(341, 287, 9);
ws_hide_walker();
_state1 = imath_ranged_rand(0, 2);
if (_G(flags)[kPerkinsLostIsland]) {
_G(flags)[V113] = 1;
_volume = 125;
_val4 = 29;
} else {
_val4 = 30;
}
kernel_trigger_dispatch_now(10);
_G(flags)[V107] = 1;
break;
}
if (_G(flags)[V107]) {
hotspot_set_active("BURGER MORSEL ", false);
} else {
_series1 = series_show("302BURG", 0x200);
hotspot_set_active("BURGER MORSEL ", true);
}
}
void Room302::daemon() {
switch (_G(kernel).trigger) {
case 1:
wilbur_speech("302w009z");
break;
case 2:
ws_unhide_walker();
ws_walk(500, 250, nullptr, 3, 8, true);
break;
case 3:
player_set_commands_allowed(true);
break;
case 4:
_volume -= 20;
if (_volume > 0) {
term_message("fading propellor, current volume = %d", _volume);
digi_change_volume(2, _volume);
kernel_timing_trigger(10, 4);
} else {
digi_stop(2);
}
break;
case 5:
terminateMachineAndNull(_series1);
inv_give_to_player("BURGER MORSEL");
hotspot_set_active("BURGER MORSEL ", false);
_G(flags)[V107] = 1;
break;
case 6:
inv_put_thing_in("BURGER MORSEL", NOWHERE);
break;
case 7:
if (!digi_play_state(2)) {
_val7 = imath_ranged_rand(0, 6);
digi_play(Common::String::format("302t001%c", 'a' + _val7).c_str(), 2, 55, -1, 302);
}
break;
case 8:
if (_val2 == 19) {
digi_unload_stream_breaks(SERIES3);
_series2.terminate();
pal_fade_set_start(0);
_series3 = series_stream_with_breaks(SERIES1, "302pe02", 6, 1, 3007);
pal_fade_init(0, 255, 100, 15, -1);
}
break;
case 9:
switch (_val1) {
case 20:
series_show("302tr02", 0x900, 0, 9, 30, 13);
series_show("302tr02s", 0x901, 0, -1, 30, 13);
_val1 = 22;
break;
case 21:
_series2.show("302tr02", 0x900);
_val1 = 22;
break;
case 22:
_val6 = imath_ranged_rand(0, 1);
_val1 = _val6 ? 24 : 23;
kernel_trigger_dispatch_now(9);
break;
case 23:
kernel_trigger_dispatch_now(7);
_val1 = 20;
series_play_with_breaks(PLAY10, "302tr02", 0x900, 9, 3);
break;
case 24:
kernel_trigger_dispatch_now(7);
_val1 = 20;
series_play_with_breaks(PLAY11, "302tr02", 0x900, 9, 3);
break;
case 25:
_val1 = 20;
series_play_with_breaks(PLAY12, "302tr03", 0x900, 9, 3);
break;
case 26:
_val1 = 20;
series_play_with_breaks(PLAY13, "302tr03", 0x900, 9, 3);
break;
case 27:
ws_hide_walker();
_G(wilbur_should) = 11;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
_val1 = 28;
series_play_with_breaks(PLAY7, "302tr01", 0x700, 9, 3);
break;
case 28:
hotspot_set_active("truffles", false);
_G(flags)[kTrufflesInMine] = 1;
_G(wilbur_should) = 8;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
series_play_with_breaks(PLAY8, "302tr01", 0x900, -1, 3);
break;
default:
break;
}
break;
case 10:
switch (_val4) {
case 29:
digi_preload_stream_breaks(SERIES2);
_G(wilbur_should) = 9;
series_stream_with_breaks(SERIES2, "302pr01", 6, 1, kCHANGE_WILBUR_ANIMATION);
break;
case 30:
digi_preload_stream_breaks(SERIES3);
_val2 = 19;
series_stream_with_breaks(SERIES3, "302pr02", 6, 1, 8);
break;
default:
break;
}
break;
case 10008:
_val1 = 26;
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
ws_hide_walker();
player_set_commands_allowed(false);
series_play_with_breaks(PLAY1, "302wi03", 0x500, 3004, 3);
pal_fade_init(_G(kernel).first_fade, 255, 0, 120, 3004);
break;
case 2:
ws_demand_location(427, 228, 4);
ws_hide_walker();
player_set_commands_allowed(false);
series_play_with_breaks(PLAY2, "302wi04", 0x500, 2, 3);
break;
case 3:
ws_hide_walker();
player_set_commands_allowed(false);
series_play_with_breaks(PLAY3, "302wi01", 0x500, 3003, 3);
pal_fade_init(_G(kernel).first_fade, 255, 0, 120, 3003);
break;
case 4:
player_first_walk(233, 222, 7, 180, 270, 7, true);
ws_unhide_walker();
player_set_commands_allowed(true);
break;
case 5:
ws_unhide_walker();
player_set_commands_allowed(true);
_G(wilbur_should) = 10002;
player_first_walk(483, 210, 5, 490, 245, 7, true);
break;
case 6:
ws_unhide_walker();
player_set_commands_allowed(true);
_G(wilbur_should) = 10002;
player_first_walk(184, 189, 8, 78, 225, 8, true);
break;
case 7:
_val1 = 27;
break;
case 8:
ws_unhide_walker();
_G(wilbur_should) = _G(flags)[V110] ? 10001 : 18;
ws_turn_to_face(3, kCHANGE_WILBUR_ANIMATION);
break;
case 9:
digi_unload_stream_breaks(SERIES2);
_G(wilbur_should) = 12;
hotspot_set_active("BURGER MORSEL ", true);
series_play_with_breaks(PLAY4, "302wi10", 0x200, kCHANGE_WILBUR_ANIMATION, 2);
break;
case 10:
ws_hide_walker();
_G(wilbur_should) = 10001;
series_play_with_breaks(PLAY6, "302wi06", 0x200, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 11:
_G(wilbur_should) = 17;
series_play_with_breaks(PLAY9, "302wi07", 0x200, kCHANGE_WILBUR_ANIMATION, 3, 4);
break;
case 12:
_series1 = series_show("302BURG", 0x200);
_G(flags)[V107] = 0;
_G(wilbur_should) = 15;
series_play_with_breaks(PLAY5, "302wi09", 0x200, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 13:
_G(wilbur_should) = 14;
kernel_timing_trigger(30, kCHANGE_WILBUR_ANIMATION);
break;
case 14:
player_set_commands_allowed(true);
wilbur_speech("302w009z");
break;
case 15:
ws_unhide_walker();
_G(wilbur_should) = 10001;
if (_G(flags)[V108]) {
_val5 = imath_ranged_rand(0, 9);
wilbur_speech(Common::String::format("302w004%c", 'a' + _val5).c_str(), kCHANGE_WILBUR_ANIMATION);
} else {
wilbur_speech("302w003", kCHANGE_WILBUR_ANIMATION);
}
break;
case 16:
_G(wilbur_should) = 7;
player_set_commands_allowed(false);
wilbur_speech(_G(flags)[V110] ? "300w010" : "300w007", kCHANGE_WILBUR_ANIMATION);
break;
case 17:
ws_unhide_walker();
if (!_G(flags)[V110])
wilbur_speech("300w008");
break;
case 18:
_G(flags)[V110] = 1;
_G(wilbur_should) = 10001;
wilbur_speech("300w009");
break;
case 10013:
ws_unhide_walker();
player_set_commands_allowed(true);
_G(wilbur_should) = 10002;
if (_G(flags)[kTrufflesInMine]) {
_G(flags)[V002] = 1;
wilbur_speech("300w059");
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room302::pre_parser() {
if (player_said_any("BACKYARD", "BACKYARD ") && !player_said_any("LOOK AT", "GEAR", "ENTER"))
player_set_facing_hotspot();
}
void Room302::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said("LOOK AT", "BURGER MORSEL ")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 13;
wilbur_speech("302w009y", kCHANGE_WILBUR_ANIMATION);
} else if (player_said("LOOK AT", "DOOR")) {
wilbur_speech(player_been_here(304) ? "302w006" : "302w005");
} else if (player_said("DISTILLED CARROT JUICE", "CRASHED ROCKET")) {
wilbur_speech("300w032");
} else if (player_said("CARROT JUICE", "CRASHED ROCKET")) {
wilbur_speech("300w045");
} else if (player_said("MATCHES", "CRASHED ROCKET")) {
wilbur_speech("300w018");
} else if (player_said("TAKE", "BURGER MORSEL ")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 10;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("ENTER", "DOOR") || player_said("GEAR", "DOOR")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 3;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("MATCHES", "PROBE")) {
wilbur_speech("300w023");
} else if (player_said("BOTTLE", "TROUGH")) {
wilbur_speech("300w073");
} else if (player_said("LOOK AT", "STORM CELLAR")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 1;
wilbur_speech("302w007", kCHANGE_WILBUR_ANIMATION);
} else if (player_said_any("GEAR", "ENTER") && player_said("STORM CELLAR")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 1;
if (_G(flags)[V133]) {
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
term_message("Wilbur: Here we go...!");
wilbur_speech("302w008", kCHANGE_WILBUR_ANIMATION);
}
} else if (player_said("CARROT JUICE", "TROUGH")) {
wilbur_speech("300w044");
} else if (player_said("BACKYARD") && player_said_any("LOOK AT", "GEAR", "ENTER")) {
player_set_commands_allowed(false);
pal_fade_init(_G(kernel).first_fade, 255, 0, 6, 3002);
_G(flags)[V125] = 0;
} else if (player_said("BACKYARD ") && player_said_any("LOOK AT", "GEAR", "ENTER")) {
player_set_commands_allowed(false);
pal_fade_init(_G(kernel).first_fade, 255, 0, 6, 3002);
_G(flags)[V125] = 1;
} else if (player_said("TRUFFLES")) {
if (player_said("BURGER MORSEL")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 16;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("LOOK AT")) {
wilbur_speech(_G(flags)[V109] ? "302w012" : "302w011");
} else if (player_said("MATCHES")) {
wilbur_speech("300w016");
} else if (player_said("DISTILLED CARROT JUICE")) {
wilbur_speech("300w031");
} else if (player_said("CARROT JUICE")) {
wilbur_speech("300w044");
} else if (player_said("BOTTLE")) {
wilbur_speech("300w072");
} else {
_val1 = 25;
return;
}
} else {
return;
}
_G(player).command_ready = false;
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,81 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM302_H
#define M4_BURGER_ROOMS_SECTION3_ROOM302_H
#include "m4/burger/rooms/section3/section3_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room302 : public Section3Room {
private:
static const char *SAID[][4];
static const seriesStreamBreak SERIES1[];
static const seriesStreamBreak SERIES2[];
static const seriesStreamBreak SERIES3[];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
static const seriesPlayBreak PLAY3[];
static const seriesPlayBreak PLAY4[];
static const seriesPlayBreak PLAY5[];
static const seriesPlayBreak PLAY6[];
static const seriesPlayBreak PLAY7[];
static const seriesPlayBreak PLAY8[];
static const seriesPlayBreak PLAY9[];
static const seriesPlayBreak PLAY10[];
static const seriesPlayBreak PLAY11[];
static const seriesPlayBreak PLAY12[];
static const seriesPlayBreak PLAY13[];
static int32 _state1;
machine *_series1 = nullptr;
Series _series2;
machine *_series3 = nullptr;
int _val1 = 0;
int _val2 = 0;
int _volume = 0;
int _val4 = 0;
int _val5 = 0;
int _val6 = 0;
int _val7 = 0;
protected:
const char *getDigi() override {
return "300_005";
}
public:
Room302();
~Room302() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,769 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section3/room303.h"
#include "m4/burger/vars.h"
#include "m4/platform/timer.h"
namespace M4 {
namespace Burger {
namespace Rooms {
const char *Room303::SAID[][4] = {
{ "JUG ", "303w022", nullptr, "303w022z" },
{ "JUG ", "303w022", nullptr, "303w022z" },
{ "FUEL TANK", "303w003", "303w004", nullptr },
{ "BURNER", nullptr, "303w010", nullptr },
{ "BOILER", "303w014", "303w015", nullptr },
{ "STOOL", "303w019", "300w004", "303w020" },
{ "DISTILLED CARROT JUICE ", "303w021", nullptr, nullptr },
{ "DISTILLED CARROT JUICE ", "303w021", nullptr, nullptr },
{ "CONDENSER", "303w023", "303w024", "303w025" },
{ "KEG", nullptr, "303w024", "303w025" },
{ "CABIN", "303w028", "300w002", "300w002" },
{ "WINDOW", "303w029", "300w002", "303w030" },
{ "WOOD", "303w031", "303w032", "303w033" },
{ "ROCK", "303w034", "300w002", "300w002" },
{ "TREES", "303w035", "300w002", "300w002" },
{ "FORCE FIELD", "303w036", "300w002", "300w002" },
{ nullptr, nullptr, nullptr, nullptr }
};
const seriesStreamBreak Room303::SERIES1[] = {
{ 0, "303_001", 2, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
const seriesPlayBreak Room303::PLAY1[] = {
{ 0, 7, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
{ 8, -1, nullptr, 1, 0, 9, 2048, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room303::PLAY2[] = {
{ 0, 5, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
{ 6, 7, "300w048", 1, 255, -1, 0, 0, nullptr, 0 },
{ 10, -1, "303_002", 2, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room303::PLAY3[] = {
{ 9, 14, nullptr, 1, 0, -1, 2050, 0, nullptr, 0 },
{ 0, 8, nullptr, 1, 0, 9, 2050, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room303::PLAY4[] = {
{ 0, -1, nullptr, 1, 0, -1, 2050, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room303::PLAY5[] = {
{ 0, -1, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room303::PLAY6[] = {
{ 0, -1, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room303::PLAY7[] = {
{ 0, -1, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room303::PLAY8[] = {
{ 0, 31, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
{ 32, -1, "303_003", 1, 255, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room303::PLAY9[] = {
{ 0, 28, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
{ 29, 36, "300_003", 2, 255, -1, 0, 0, nullptr, 0 },
{ 37, -1, nullptr, 0, 0, 5, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room303::PLAY10[] = {
{ 0, 6, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
{ 7, 6, "303_007", 1, 100, -1, 0, 0, nullptr, 0 },
{ 6, 6, nullptr, 0, 0, -1, 0, 2, nullptr, 0 },
{ 6, 7, nullptr, 0, 0, -1, 1, 1, nullptr, 0 },
{ 8, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
Room303::Room303() : Section3Room() {
Common::fill(_triggers, _triggers + 5, -1);
}
const char *Room303::getDigi() {
if (_G(flags)[V118] == 3002) {
_digiVolume = 125;
return "303_005";
} else if (_G(flags)[V117]) {
return "303_006";
} else {
return "300_005";
}
}
void Room303::init() {
setupDigi();
pal_cycle_init(112, 127, 0, -1, -1);
_val1 = _val2 = 0;
_series1 = nullptr;
series_load("303ft");
series_load("303burnr");
series_load("303stil");
series_load("303stilb");
Common::fill(_triggers, _triggers + 5, -1);
if (_G(flags)[V117]) {
_series2 = series_load("303ft_on");
_series3 = series_play("303ft_on", 0xd00, 0, -1, 0, -1);
_val3 = 2;
} else {
_series2 = series_load("303ft");
_series3 = series_show("303ft", 0xd00);
_val3 = 4;
}
if (_G(flags)[V118] == 3002) {
_series4 = series_load("303burn");
_series5 = series_play("303burn", 0xd14, 0, -1, 0, -1);
_val4 = 7;
} else {
_series4 = series_load("303burnr");
_series5 = series_show("303burnr", 0xd14);
_val4 = 9;
}
_series6 = series_load("303stil");
_series7 = series_show("303stil", 0xd10);
series_show("303stilb", 0xd15);
_val5 = 0;
kernel_trigger_dispatch_now(11);
switch (_G(flags)[V121]) {
case 3001:
_val6 = _G(flags)[V122] ? 32 : 30;
kernel_trigger_dispatch_now(10);
break;
case 3002:
_val6 = _G(flags)[V122] ? 33 : 31;
kernel_trigger_dispatch_now(10);
break;
default:
break;
}
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
if (_G(flags)[V117])
_timer = timer_read_60();
break;
case 302:
if (_G(flags)[V125]) {
ws_demand_location(51, 276, 3);
kernel_trigger_dispatch_now(3);
} else {
ws_demand_location(245, 373, 1);
kernel_trigger_dispatch_now(2);
}
break;
default:
player_set_commands_allowed(true);
if (_G(flags)[V117])
_timer = timer_read_60();
ws_demand_location(290, 325, 1);
break;
}
}
void Room303::daemon() {
doDaemon(_G(kernel).trigger);
}
void Room303::doDaemon(int trigger) {
switch (trigger) {
case 1:
for (_ctr = 0; _ctr < 5; ++_ctr) {
if (_triggers[_ctr] != -1) {
kernel_trigger_dispatch_now(_triggers[_ctr]);
_triggers[_ctr] = -1;
}
}
break;
case 2:
if (_G(flags)[V115] > 1) {
player_set_commands_allowed(true);
ws_walk(290, 325, nullptr, 4, 1);
} else {
_G(wilbur_should) = 18;
player_set_commands_allowed(false);
ws_walk(290, 325, nullptr, kCHANGE_WILBUR_ANIMATION, 1);
}
break;
case 3:
if (_G(flags)[V115] > 1) {
player_set_commands_allowed(true);
ws_walk(261, 276, nullptr, 4, 3);
} else {
_G(wilbur_should) = 18;
player_set_commands_allowed(false);
ws_walk(261, 276, nullptr, kCHANGE_WILBUR_ANIMATION, 3);
}
break;
case 4:
player_set_commands_allowed(true);
break;
case 5:
setupDigi();
break;
case 6:
switch (_val7) {
case 25:
if (_G(flags)[V119] && _G(flags)[V118] == 3002) {
terminateMachineAndNull(_series7);
series_unload(_series6);
_G(flags)[V120] = 1;
_val7 = 26;
digi_preload_stream_breaks(SERIES1);
series_stream_with_breaks(SERIES1, "303dist", 6, 0xc10, 6);
player_set_commands_allowed(false);
intr_cancel_sentence();
ws_walk(330, 350, nullptr, -1, 2);
}
break;
case 26:
digi_unload_stream_breaks(SERIES1);
player_set_commands_allowed(true);
_G(flags)[V119] = 0;
_series6 = series_load("303stil");
_series7 = series_show("303stil", 0xd10);
if (_G(flags)[V121] == 3002) {
_val8 = 27;
_G(flags)[V122] = 1;
terminateMachineAndNull(_series8);
_val6 = 33;
kernel_trigger_dispatch_now(10);
} else {
_val8 = 28;
}
kernel_trigger_dispatch_now(9);
break;
default:
break;
}
break;
case 7:
switch (_val3) {
case 1:
freeSeries1();
series_play_with_breaks(PLAY6, "303wi07", 0xd00, 7, 3);
_val3 = 2;
_G(flags)[V117] = 1;
setupDigi();
ws_hide_walker();
_G(wilbur_should) = 19;
_timer = timer_read_60();
break;
case 2:
_series2 = series_load("303ft_on");
_series3 = series_play("303ft_on", 0xd00, 0, -1, 0, -1);
if (_G(wilbur_should) == 19)
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 3:
freeSeries1();
series_play_with_breaks(PLAY7, "303wi08", 0xd00, 7, 3);
_val3 = 4;
ws_hide_walker();
_G(wilbur_should) = 20;
break;
case 4:
_series2 = series_load("303ft");
_series3 = series_show("303ft", 0xd00);
_G(flags)[V117] = 0;
setupDigi();
if (_G(flags)[V118] == 3002) {
_val4 = 8;
doDaemon(8);
}
if (_G(wilbur_should) == 20)
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
default:
break;
}
break;
case 8:
switch (_val4) {
case 5:
freeSeries2();
player_update_info();
if (timer_read_60() - _timer > 900) {
_G(flags)[V118] = 3003;
series_play_with_breaks(PLAY8, "303wi10", 0xd01, 3007, 1);
} else {
_G(flags)[V118] = 3002;
series_play_with_breaks(PLAY9, "303wi02", 0xd01, 8, 3);
}
_val4 = 7;
ws_hide_walker();
_G(wilbur_should) = 10001;
break;
case 6:
freeSeries2();
series_play_with_breaks(PLAY9, "303wi09", 0xd01, 8, 3);
_val4 = 9;
ws_hide_walker();
_G(wilbur_should) = 10001;
break;
case 7:
setupDigi();
_series4 = series_load("303burn");
_series5 = series_play("303burn", 0xd14, 0, -1, 0, -1);
if (_G(wilbur_should) == 10001) {
ws_unhide_walker();
_G(wilbur_should) = 10002;
player_set_commands_allowed(true);
}
_val7 = 25;
kernel_timing_trigger(180, 6);
break;
case 8:
freeSeries2();
_series4 = series_load("303burnr");
_series5 = series_show("303burnr", 0xd14);
_G(flags)[V118] = 3001;
setupDigi();
break;
case 9:
_series4 = series_load("303burnr");
_series5 = series_show("303burnr", 0xd14);
_G(flags)[V118] = 3001;
if (_G(wilbur_should) == 10001) {
ws_unhide_walker();
_G(wilbur_should) = 10002;
player_set_commands_allowed(true);
}
break;
default:
break;
}
break;
case 9:
switch (_val8) {
case 27:
if (_val5 < 15) {
++_val5;
_val8 = 27;
terminateMachineAndNull(_series9);
_series9 = series_play("303cj01", 0xd15, 0, 9, 8);
}
break;
case 28:
if (_val5 < 15) {
++_val5;
_val8 = 28;
terminateMachineAndNull(_series9);
_series9 = series_play("303cj02", 0xd15, 0, 9, 6);
}
break;
default:
break;
}
break;
case 10:
switch (_val6) {
case 30:
inv_move_object("JUG", 303);
inv_move_object("DISTILLED CARROT JUICE", 303);
_G(flags)[V121] = 3001;
_series8 = series_show("303juga", 0xbff);
hotspot_set_active("JUG ", true);
break;
case 31:
inv_move_object("JUG", 303);
inv_move_object("DISTILLED CARROT JUICE", 303);
_G(flags)[V121] = 3002;
_series8 = series_show("303JUG", 0xd14);
hotspot_set_active("JUG ", true);
break;
case 32:
inv_move_object("JUG", 303);
inv_move_object("DISTILLED CARROT JUICE", 303);
_G(flags)[V122] = 1;
_G(flags)[V121] = 3001;
_series8 = series_show("303juga", 0xbff);
hotspot_set_active("DISTILLED CARROT JUICE ", true);
break;
case 33:
inv_move_object("JUG", 303);
inv_move_object("DISTILLED CARROT JUICE", 303);
_G(flags)[V122] = 1;
_G(flags)[V121] = 3002;
_series8 = series_show("303JUG", 0xd14);
hotspot_set_active("DISTILLED CARROT JUICE ", true);
hotspot_set_active("JUG ", true);
break;
case 34:
_G(flags)[V121] = 3003;
inv_give_to_player(_G(flags)[V122] ? "DISTILLED CARROT JUICE" : "JUG");
break;
default:
break;
}
break;
case 11:
terminateMachineAndNull(_series8);
hotspot_set_active("DISTILLED CARROT JUICE ", false);
hotspot_set_active("DISTILLED CARROT JUICE ", false);
hotspot_set_active("JUG ", false);
hotspot_set_active("JUG ", false);
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 11:
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
_triggers[0] = kCHANGE_WILBUR_ANIMATION;
if (_val5 > 0 && _val5 < 15) {
_val8 = 27;
_G(flags)[V122] = 1;
} else {
_val8 = 29;
}
_val6 = _G(flags)[V122] ? 33 : 31;
_triggers[1] = 10;
series_play_with_breaks(PLAY1, "303wi4b", 0x100, 1, 3);
break;
case 12:
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
_triggers[0] = kCHANGE_WILBUR_ANIMATION;
kernel_trigger_dispatch_now(11);
_val6 = 34;
_triggers[1] = 10;
_val8 = (_val5 > 0 && _val5 < 15) ? 28 : 29;
series_play_with_breaks(PLAY3, "303wi4b", 0x100, 1, 3);
break;
case 13:
ws_hide_walker();
player_set_commands_allowed(false);
kernel_trigger_dispatch_now(11);
_G(wilbur_should) = 10001;
_triggers[0] = kCHANGE_WILBUR_ANIMATION;
_triggers[1] = 10;
_val6 = 34;
series_play_with_breaks(PLAY4, "303wi4a", 0x100, 1, 3);
break;
case 14:
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
_triggers[0] = kCHANGE_WILBUR_ANIMATION;
_val6 = _G(flags)[V122] ? 32 : 30;
_triggers[1] = 10;
series_play_with_breaks(PLAY5, "303wi4a", 0x100, 1, 3);
break;
case 15:
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 23;
series_play_with_breaks(PLAY10, "303wi15", 0x100, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 16:
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 17;
series_play_with_breaks(PLAY2, "303wi03", 0x100, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 17:
_G(flags)[V119] = 1;
_G(flags)[V126] = 1;
inv_put_thing_in("CARROT JUICE", NOWHERE);
inv_give_to_player("BOTTLE");
_val7 = 25;
kernel_trigger_dispatch_now(6);
enable_player();
break;
case 18:
_G(wilbur_should) = 10001;
wilbur_speech(_G(flags)[V115] ? "303w002" : "303w001");
_G(flags)[V115]++;
break;
case 19:
player_set_commands_allowed(true);
ws_unhide_walker();
_G(wilbur_should) = 10002;
if (_G(flags)[V116]) {
wilbur_speech("303w006");
} else {
wilbur_speech("303w005");
_G(flags)[V116] = 1;
}
break;
case 20:
player_set_commands_allowed(true);
ws_unhide_walker();
_G(wilbur_should) = 10002;
wilbur_speech("303w007");
break;
case 21:
player_set_commands_allowed(true);
ws_unhide_walker();
_G(wilbur_should) = 10002;
wilbur_speech(_G(flags)[V118] == 3001 ? "303w008" : "303w009");
break;
case 22:
player_set_commands_allowed(true);
ws_unhide_walker();
_G(wilbur_should) = 10002;
wilbur_speech(_G(flags)[V118] == 3001 ? "303w011" : "303w012");
break;
case 23:
player_set_commands_allowed(true);
ws_unhide_walker();
_G(wilbur_should) = 10002;
wilbur_speech("303w016");
break;
case 24:
player_set_commands_allowed(true);
ws_unhide_walker();
_G(wilbur_should) = 10002;
wilbur_speech("303w017");
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room303::pre_parser() {
if (player_said("GEAR", "BOILER") && !_G(flags)[V119]) {
_G(wilbur_should) = 15;
player_hotspot_walk_override(409, 312, 3, kCHANGE_WILBUR_ANIMATION);
_G(player).command_ready = false;
} else {
if (player_said("FRONT YARD") && !player_said_any("LOOK AT", "WALK TO", "GEAR", "ENTER"))
player_set_facing_hotspot();
if (player_said("FRONT YARD ") && !player_said_any("LOOK AT", "WALK TO", "GEAR", "ENTER"))
player_set_facing_hotspot();
}
}
void Room303::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said("FRONT YARD") && player_said_any("LOOK AT", "WALK TO", "GEAR", "ENTER")) {
frontYard();
player_set_commands_allowed(false);
pal_fade_init(_G(kernel).first_fade, 255, 0, 6, 3001);
_G(flags)[V125] = 0;
} else if (player_said("FRONT YARD ") && player_said_any("LOOK AT", "WALK TO", "GEAR", "ENTER")) {
frontYard();
player_set_commands_allowed(false);
pal_fade_init(_G(kernel).first_fade, 255, 0, 6, 3001);
_G(flags)[V125] = 1;
} else if (player_said("DISTILLED CARROT JUICE", "BURNER")) {
wilbur_speech("300w033");
} else if (player_said("DISTILLED CARROT JUICE", "BOILER")) {
wilbur_speech("300w034");
} else if (player_said("JUG", "BOILER")) {
wilbur_speech("300w027");
} else if (player_said("JUG", "STOOL") || player_said("DISTILLED CARROT JUICE", "STOOL")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 11;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("JUG", "JUG ", "JUG ") && player_said("CARROT JUICE")) {
wilbur_speech("300w046");
} else if (player_said("JUG", "STUMP") || player_said("DISTILLED CARROT JUICE", "STUMP")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 14;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("BOTTLE", "BOILER")) {
wilbur_speech("300w074");
} else if (player_said("BOTTLE", "STOOL")) {
wilbur_speech("300w075");
} else if (player_said("CARROT JUICE", "BURNER")) {
wilbur_speech("300w047");
} else if (player_said("CARROT JUICE", "STOOL")) {
wilbur_speech("300w049");
} else if (player_said("MATCHES", "STUMP") || player_said("MATCHES", "WOOD")) {
wilbur_speech("300w019");
} else if (player_said("GEAR", "FUEL TANK")) {
player_set_commands_allowed(false);
_val3 = _G(flags)[V117] ? 3 : 1;
kernel_trigger_dispatch_now(7);
} else if (player_said("LOOK AT", "BURNER")) {
_G(wilbur_should) = 21;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("GEAR", "BURNER")) {
_G(wilbur_should) = 22;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("MATCHES", "BURNER")) {
if (_G(flags)[V118] == 3001) {
player_set_commands_allowed(false);
_val4 = _G(flags)[V117] ? 5 : 6;
kernel_trigger_dispatch_now(8);
}
} else if (player_said("GEAR", "BOILER")) {
if (_G(flags)[V119])
_G(wilbur_should) = 24;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("BOILER", "CARROT JUICE")) {
_G(wilbur_should) = 16;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "JUG ") || player_said("TAKE", "DISTILLED CARROT JUICE ")) {
_G(wilbur_should) = 12;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "JUG ") || player_said("TAKE", "DISTILLED CARROT JUICE ")) {
_G(wilbur_should) = 13;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("LOOK AT", "KEG")) {
wilbur_speech(_G(flags)[V120] ? "303w027" : "303w026");
} else if (player_said("BURNER")) {
wilbur_speech("303w013");
} else if (player_said("BOILER")) {
wilbur_speech("303w018");
} else {
return;
}
_G(player).command_ready = false;
}
void Room303::frontYard() {
term_message("------- %ld %ld %ld", _G(flags)[V119], _G(flags)[V118], _G(flags)[V121]);
if (_G(flags)[V119] && _G(flags)[V118] == 3002 && _G(flags)[V121] == 3002) {
term_message("jug filled with distilled juice!!");
_G(flags)[V122] = 1;
_G(flags)[V120] = 1;
_G(flags)[V119] = 0;
}
}
void Room303::freeSeries1() {
if (_series3)
terminateMachineAndNull(_series3);
if (_series2)
series_unload(_series2);
}
void Room303::freeSeries2() {
if (_series5)
terminateMachineAndNull(_series5);
if (_series4)
series_unload(_series4);
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,88 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM303_H
#define M4_BURGER_ROOMS_SECTION3_ROOM303_H
#include "m4/burger/rooms/section3/section3_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room303 : public Section3Room {
private:
static const char *SAID[][4];
static const seriesStreamBreak SERIES1[];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
static const seriesPlayBreak PLAY3[];
static const seriesPlayBreak PLAY4[];
static const seriesPlayBreak PLAY5[];
static const seriesPlayBreak PLAY6[];
static const seriesPlayBreak PLAY7[];
static const seriesPlayBreak PLAY8[];
static const seriesPlayBreak PLAY9[];
static const seriesPlayBreak PLAY10[];
machine *_series1 = nullptr;
int _series2 = -1;
machine *_series3 = nullptr;
int _series4 = -1;
machine *_series5 = nullptr;
int _series6 = -1;
machine *_series7 = nullptr;
machine *_series8 = nullptr;
machine *_series9 = nullptr;
int _triggers[5];
int _ctr = 0;
int _timer = 0;
int _val1 = 0;
int _val2 = 0;
int _val3 = 0;
int _val4 = 0;
int _val5 = 0;
int _val6 = 0;
int _val7 = 0;
int _val8 = 0;
void frontYard();
void doDaemon(int trigger);
void freeSeries1();
void freeSeries2();
protected:
const char *getDigi() override;
public:
Room303();
~Room303() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,259 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section3/room304.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
const char *Room304::SAID[][4] = {
{ "DOOR", "304w002", "300w002", nullptr },
{ "BED", "304w007", "300w003", "304w008" },
{ "PICTURE", "304w009", "304w010", "300w005" },
{ "MATCHES ", "304w003", nullptr, "304w004" },
{ "MAP", nullptr, "304w013", "304w014" },
{ "CRATE", "304w015", "300w004", "300w004" },
{ "STOVE", "304w016", "304w017", "304w018" },
{ "KETTLE", "304w019", "304w018", "304w018" },
{ "MUG", "304w019", nullptr, nullptr },
{ "RECIPE BOOK", nullptr, "304w021", "304w022" },
{ "WASHTUB", "304w023", "304w024", "304w024" },
{ "POT", "304w025", "304w018", "304w018" },
{ "FRYING PAN", "304w026", "304w027", "304w018" },
{ "WINDOW", "304w028", "300w002", "304w029" },
{ nullptr, nullptr, nullptr, nullptr }
};
const seriesPlayBreak Room304::PLAY1[] = {
{ 0, 3, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
{ 4, 16, "304_001", 2, 255, -1, 2048, 0, nullptr, 0 },
{ 17, -1, "304_002", 2, 255, -1, 2048, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room304::PLAY2[] = {
{ 0, 3, nullptr, 1, 0, -1, 2050, 0, nullptr, 0 },
{ 0, 0, "304w020", 1, 255, -1, 0, 10, nullptr, 0 },
{ 0, 6, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 7, 7, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
{ 8, 12, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 13, -1, "304_004", 2, 255, -1, 0, 0, nullptr, 0 },
{ 7, 7, nullptr, 0, 0, -1, 0, 3, nullptr, 0 },
{ 8, 12, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
{ 13, -1, "304_004", 2, 255, -1, 0, 0, nullptr, 0 },
{ 7, 7, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
{ 7, 3, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room304::PLAY3[] = {
{ 0, 3, nullptr, 1, 0, -1, 0, 0, nullptr, 0 },
{ 4, 5, nullptr, 0, 0, 6, 0, 0, nullptr, 0 },
{ 6, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room304::PLAY4[] = {
{ 0, 24, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
{ 25, 36, "300_003", 2, 255, -1, 2048, 0, nullptr, 0 },
{ 37, -1, nullptr, 0, 0, 3, 0, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room304::PLAY5[] = {
{ 17, 17, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
{ 17, 21, "304_002", 2, 255, -1, 2048, 0, nullptr, 0 },
PLAY_BREAK_END
};
const char *Room304::getDigi() {
return _G(flags)[V130] ? "304_003" : "300_005";
}
void Room304::init() {
setupDigi();
set_palette_brightness(70);
if (inv_player_has("MATCHES")) {
hotspot_set_active("MATCHES ", false);
} else {
_matches = series_show("304match", 0xa00);
hotspot_set_active("MATCHES ", true);
}
if (_G(flags)[V130]) {
_fire = series_play("304firel", 0xa00, 4, -1, 6, -1);
} else {
_fire = series_show("304firel", 0xa00);
}
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
case 302:
ws_demand_location(150, 306, 3);
kernel_trigger_dispatch_now(4);
break;
default:
player_set_commands_allowed(true);
ws_demand_location(300, 306, 4);
break;
}
}
void Room304::daemon() {
switch (_G(kernel).trigger) {
case 1:
term_message("Walking into scene....!");
if (_G(flags)[V129]) {
ws_walk(300, 306, nullptr, 2, 4);
} else {
_G(flags)[V129] = 1;
player_set_commands_allowed(false);
_G(wilbur_should) = 5;
ws_walk(300, 306, nullptr, kCHANGE_WILBUR_ANIMATION, 4);
}
break;
case 2:
player_set_commands_allowed(true);
break;
case 3:
setupDigi();
break;
case 4:
player_set_commands_allowed(false);
series_play_with_breaks(PLAY5, "304wi01", 0x600, -1, 2, 6);
kernel_trigger_dispatch_now(1);
break;
case 5:
_fire = series_play("304fire1", 0xa00, 0, -1, 6, -1);
_G(wilbur_should) = 10001;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 6:
inv_give_to_player("MATCHES");
hotspot_set_active("MATCHES ", false);
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 1:
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10002;
series_play_with_breaks(PLAY1, "304wi01", 0x600, 3001, 3, 8);
break;
case 2:
player_set_commands_allowed(false);
ws_hide_walker();
terminateMachineAndNull(_fire);
series_play_with_breaks(PLAY4, "304wi05", 0xa00, 5, 3);
break;
case 3:
player_set_commands_allowed(false);
ws_hide_walker();
terminateMachineAndNull(_matches);
_G(wilbur_should) = 10001;
series_play_with_breaks(PLAY3, "304wb01", 0xa00, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 4:
player_set_commands_allowed(false);
ws_hide_walker();
_G(wilbur_should) = 10001;
series_play_with_breaks(PLAY2, "304wi03", 0x101, kCHANGE_WILBUR_ANIMATION, 2);
break;
case 5:
_G(wilbur_should) = 10001;
_G(flags)[V129] = 1;
wilbur_speech("304w001");
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room304::pre_parser() {
_G(kernel).trigger_mode = KT_DAEMON;
}
void Room304::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
if (_G(walker).wilbur_said(SAID)) {
// Already handled
} else if (player_said("OPEN", "DOOR") || player_said("GEAR", "DOOR")) {
_G(wilbur_should) = 1;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("LOOK AT", "MAP")) {
wilbur_speech(_G(flags)[V135] ? "304w012" : "304w011");
} else if (player_said("DISTILLED CARROT JUICE") &&
player_said_any("STOVE", "KETTLE", "FRYING PAN", "POT")) {
wilbur_speech("300w035");
} else if (player_said("CARROT JUICE") &&
player_said_any("STOVE", "KETTLE", "FRYING PAN", "POT")) {
wilbur_speech("300w051");
} else if (player_said("CARROT JUICE", "WASHTUB")) {
wilbur_speech("300w052");
} else if (player_said("DISTILLED CARROT JUICE", "WASHTUB")) {
wilbur_speech("300w035z");
} else if (player_said("MATCHES", "STOVE") && !_G(flags)[V130]) {
_G(wilbur_should) = 2;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("TAKE", "MATCHES ")) {
_G(wilbur_should) = 3;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("READ", "RECIPE BOOK") || player_said("LOOK AT", "RECIPE BOOK")) {
_G(wilbur_should) = 4;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
return;
}
_G(player).command_ready = false;
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,59 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM304_H
#define M4_BURGER_ROOMS_SECTION3_ROOM304_H
#include "m4/burger/rooms/section3/section3_room.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room304 : public Section3Room {
private:
static const char *SAID[][4];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
static const seriesPlayBreak PLAY3[];
static const seriesPlayBreak PLAY4[];
static const seriesPlayBreak PLAY5[];
machine *_matches = nullptr;
machine *_fire = nullptr;
protected:
const char *getDigi() override;
public:
Room304() : Section3Room() {}
~Room304() override {}
void init() override;
void daemon() override;
void pre_parser() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,271 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section3/room305.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
const char *Room305::SAID[][4] = {
{ "STAIRS", "305w002", "300w002", nullptr },
{ "DARKNESS", "305w004", "300w002", "300w002" },
{ "MINE", "305w003", "300w002", "300w002" },
{ "GENERATOR", nullptr, "305w008", nullptr },
{ "PICK AXE", "305w015", "305w016", "305w017" },
{ "BOX", "305w018", "300w003", "300w005" },
{ "DEBRIS", nullptr, "305w021", "300w005" },
{ "GROUND", "305w022", "300w002", "300w002" },
{ "WALL", "305w022", "300w002", "300w002" },
{ "CEILING", "305w022", "300w002", "300w002" },
{ "FORCE FIELD", "302w027", "300w002", "300w002" },
{ nullptr, nullptr, nullptr, nullptr }
};
const seriesStreamBreak Room305::SERIES1[] = {
{ 6, "305_003", 2, 255, -1, 0, nullptr, 0 },
{ 11, "305w009", 1, 255, -1, 0, nullptr, 0 },
{ 12, "305_005", 2, 255, -1, 0, nullptr, 0 },
{ 20, "305w010", 1, 255, -1, 0, &Flags::_flags[V135], 0 },
{ 30, "305_006", 2, 255, -1, (uint)-1, nullptr, 0 },
{ 72, "305_001", 1, 255, -1, 0, nullptr, 0 },
{ 72, nullptr, 2, 0, -1, 2048, nullptr, 0 },
{ 79, "305_004", 2, 255, -1, 0, nullptr, 0 },
{ 94, "305_002", 2, 255, -1, 0, nullptr, 0 },
{ -1, nullptr, 0, 0, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
const seriesPlayBreak Room305::PLAY1[] = {
{ 0, -1, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
PLAY_BREAK_END
};
const seriesPlayBreak Room305::PLAY2[] = {
{ 0, -1, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
PLAY_BREAK_END
};
void Room305::init() {
setupDigi();
set_palette_brightness(60);
pal_cycle_init(96, 111, 6, -1, -1);
_G(flags)[kMineRoomIndex] = 0;
if (_G(flags)[V134] && !_G(flags)[V135] && !_G(flags)[kEnteredMine]) {
hotspot_set_active("DARKNESS", true);
hotspot_set_active("MINE", false);
} else {
hotspot_set_active("DARKNESS", false);
hotspot_set_active("MINE", true);
}
_series1 = series_show(_G(flags)[V134] ? "305genx" : "305gen", 0x200);
switch (_G(game).previous_room) {
case KERNEL_RESTORING_GAME:
player_set_commands_allowed(true);
break;
case 302:
_G(wilbur_should) = 101;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 319:
player_set_commands_allowed(true);
ws_demand_location(-50, 200);
kernel_trigger_dispatch_now(301);
break;
default:
player_set_commands_allowed(true);
ws_demand_location(320, 290, 7);
break;
}
}
void Room305::daemon() {
Mine::daemon();
if (!_G(kernel).continue_handling_trigger)
return;
_G(kernel).continue_handling_trigger = false;
switch (_G(kernel).trigger) {
case 100:
_series1 = series_show("305genx", 0x200);
_G(flags)[V134] = 1;
_G(wilbur_should) = 105;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
break;
case 3001:
_G(game).setRoom(302);
break;
case kCHANGE_WILBUR_ANIMATION:
switch (_G(wilbur_should)) {
case 101:
ws_demand_location(372, 267, 9);
player_set_commands_allowed(false);
ws_hide_walker();
if (_G(flags)[V133]) {
_G(wilbur_should) = 10001;
} else {
_G(flags)[V133] = 1;
_G(wilbur_should) = 104;
}
series_play_with_breaks(PLAY1, "305wi01", 0x700, kCHANGE_WILBUR_ANIMATION, 3);
break;
case 102:
player_set_commands_allowed(false);
ws_demand_location(375, 280, 2);
ws_hide_walker();
series_play_with_breaks(PLAY2, "305wi02", 0x700, -1, 3);
pal_fade_init(_G(kernel).first_fade, 255, 0, 60, 3001);
break;
case 103:
hotspot_set_active("DARKNESS", false);
hotspot_set_active("MINE", true);
player_set_commands_allowed(false);
ws_hide_walker();
terminateMachineAndNull(_series1);
series_stream_with_breaks(SERIES1, "305wi04", 6, 0x200, 100);
break;
case 104:
ws_unhide_walker();
player_set_commands_allowed(true);
wilbur_speech("305w001");
break;
case 105:
ws_unhide_walker();
if (_G(flags)[V135]) {
_G(wilbur_should) = 106;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
_G(flags)[V135] = 1;
_G(wilbur_should) = 106;
wilbur_speech("305w011", kCHANGE_WILBUR_ANIMATION);
}
break;
case 106:
_G(wilbur_should) = 10001;
wilbur_speech(_G(flags)[kEnteredMine] ? "305w013" : "305w012", kCHANGE_WILBUR_ANIMATION);
break;
case 107:
_G(wilbur_should) = 10001;
wilbur_speech("305w012", kCHANGE_WILBUR_ANIMATION);
break;
case 108:
mine_travel_link(BACK);
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
void Room305::parser() {
_G(kernel).trigger_mode = KT_DAEMON;
// Handle any generic mine stuff
Mine::parser();
if (!_G(player).command_ready)
// Already handled
return;
// Check for standard actions
if (_G(walker).wilbur_said(SAID)) {
// Handled
} else if (player_said("climb", "stairs") || player_said("GEAR", "STAIRS")) {
player_set_commands_allowed(false);
_G(wilbur_should) = 102;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else if (player_said("ENTER", "MINE") || player_said("ENTER", "DARKNESS")) {
player_set_commands_allowed(false);
if (!_G(flags)[kDrunkCarrotJuice]) {
player_set_commands_allowed(true);
wilbur_speech("305w004");
} else {
_G(wilbur_should) = 108;
if (_G(flags)[kEnteredMine]) {
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
} else {
wilbur_speech("305w005", kCHANGE_WILBUR_ANIMATION);
}
}
} else if (player_said("DISTILLED CARROT JUICE", "GENERATOR")) {
wilbur_speech(_G(flags)[V134] ? "300w037" : "300w036");
} else if (player_said("CARROT JUICE", "GENERATOR")) {
wilbur_speech(_G(flags)[V134] ? "300w054" : "300w053");
} else if (player_said_any("CARROT JUICE", "DISTILLED CARROT JUICE") &&
player_said("BARREL")) {
wilbur_speech("300w038");
} else if (player_said("LOOK AT", "GENERATOR")) {
wilbur_speech(_G(flags)[V134] ? "300w007" : "300w006");
} else if (player_said("MATCHES", "GENERATOR")) {
wilbur_speech(_G(flags)[V134] ? "300w022" : "300w021");
} else if (player_said("LOOK AT", "DEBRIS")) {
if (!_G(flags)[V136]) {
_G(flags)[V136] = 1;
wilbur_speech("305w019");
} else {
wilbur_speech(Common::String::format("305w020%c",
'a' + imath_ranged_rand(0, 6)).c_str());
}
} else if (player_said("GEAR", "GENERATOR")) {
if (_G(flags)[V134]) {
wilbur_speech("305w014");
} else {
_G(wilbur_should) = 103;
kernel_trigger_dispatch_now(kCHANGE_WILBUR_ANIMATION);
}
} else if (!player_said("LOOK AT WALL")) {
return;
}
_G(player).command_ready = false;
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

View File

@@ -0,0 +1,57 @@
/* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef M4_BURGER_ROOMS_SECTION3_ROOM305_H
#define M4_BURGER_ROOMS_SECTION3_ROOM305_H
#include "m4/burger/rooms/section3/mine.h"
namespace M4 {
namespace Burger {
namespace Rooms {
class Room305 : public Mine {
private:
static const char *SAID[][4];
static const seriesStreamBreak SERIES1[];
static const seriesPlayBreak PLAY1[];
static const seriesPlayBreak PLAY2[];
machine *_series1 = nullptr;
protected:
const char *getDigi() override {
return "305_007";
}
public:
Room305() : Mine() {}
~Room305() override {}
void init() override;
void daemon() override;
void parser() override;
};
} // namespace Rooms
} // namespace Burger
} // namespace M4
#endif

View File

@@ -0,0 +1,91 @@
/* 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 <http://www.gnu.org/licenses/ },.
*
*/
#include "m4/burger/rooms/section3/room306.h"
#include "m4/burger/vars.h"
namespace M4 {
namespace Burger {
namespace Rooms {
const seriesStreamBreak Room306::SERIES1[] = {
{ 0, "608_003", 3, 100, -1, 0, nullptr, 0 },
{ 2, "306f003a", 1, 255, -1, 0, nullptr, 0 },
{ 33, "608_001", 2, 255, -1, 0, nullptr, 0 },
{ 48, "608_002", 2, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
const seriesStreamBreak Room306::SERIES2[] = {
{ 0, "608_003", 3, 100, -1, 0, nullptr, 0 },
{ 2, "306f001a", 1, 255, -1, 0, nullptr, 0 },
{ 33, "608_001", 2, 255, -1, 0, nullptr, 0 },
{ 48, "608_002", 2, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
const seriesStreamBreak Room306::SERIES3[] = {
{ 0, "608_003", 3, 100, -1, 0, nullptr, 0 },
{ 1, "306f002a", 1, 255, -1, 0, nullptr, 0 },
{ 33, "608_001", 2, 255, -1, 0, nullptr, 0 },
{ 48, "608_002", 2, 255, -1, 0, nullptr, 0 },
STREAM_BREAK_END
};
void Room306::preload() {
_G(player).walker_in_this_scene = false;
}
void Room306::init() {
pal_cycle_init(101, 110, 6);
kernel_trigger_dispatch_now(3007);
}
void Room306::daemon() {
switch (_G(kernel).trigger) {
case 1:
pal_fade_init(_G(kernel).first_fade, 255, 0, 0, -1);
release_trigger_on_digi_state(k10027, 1);
break;
case 3007:
if (!_G(flags)[kPerkinsLostIsland]) {
digi_preload_stream_breaks(SERIES2);
series_stream_with_breaks(SERIES2, "306burnt", 6, 1, 1);
} else if (_G(flags)[V118] == 3003) {
digi_preload_stream_breaks(SERIES3);
series_stream_with_breaks(SERIES3, "306burnt", 6, 1, 1);
} else {
digi_preload_stream_breaks(SERIES1);
series_stream_with_breaks(SERIES1, "306fail", 6, 1, 1);
}
break;
default:
_G(kernel).continue_handling_trigger = true;
break;
}
}
} // namespace Rooms
} // namespace Burger
} // namespace M4

Some files were not shown because too many files have changed in this diff Show More