/* 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 = 0) { Button &btn = _buttons[index]; if (btn._state != GUI::NOTHING && btn._state != state) { terminateMachineAndNull(btn._series); btn._state = state; setupButton(index); } } } void Room510::buttonAction(int index, int firstFrame, int lastFrame) { const int max = (index == 4) ? 1 : 2; digi_play(Common::String::format("510b00%d%c", index, 'a' + imath_ranged_rand(0, max)).c_str(), 2); series_play("510waves", 0, 0, 2, 6, 2, 100, 0, 0, firstFrame, lastFrame); } void Room510::updateButtons() { _val3 = getHighlightedButton(); if (_val2 != -1) { setButtonState(_val2, (_val2 == _val3) ? GUI::SELECTED : GUI::IN_CONTROL); } else if (_val3 == -1) { setButtonState(_val4, GUI::IN_CONTROL); } else if (_val3 != _val4) { setButtonState(_val4, GUI::IN_CONTROL); setButtonState(_val3, GUI::OVER_CONTROL); } } int Room510::getHighlightedButton() const { for (int i = 0; i < BUTTON_COUNT; ++i) { const Button &btn = _buttons[i]; if (_G(MouseState).CursorColumn >= btn._x1 && _G(MouseState).CursorColumn <= btn._x2 && _G(MouseState).CursorRow >= btn._y1 && _G(MouseState).CursorRow <= btn._y2) return i; } return -1; } } // namespace Rooms } // namespace Burger } // namespace M4