From 854de79c236641bdb3414f727d9fee62e70ac463 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 18 Feb 2014 02:34:18 +0100 Subject: AVALANCHE: Make GPL headers consistent in themselves. --- engines/avalanche/help.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'engines/avalanche/help.cpp') diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp index 0e60f5fadb..bef557db07 100644 --- a/engines/avalanche/help.cpp +++ b/engines/avalanche/help.cpp @@ -1,24 +1,24 @@ /* 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 2 -* 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, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -* -*/ + * + * 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 2 + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ /* * This code is based on the original source code of Lord Avalot d'Argent version 1.3. -- cgit v1.2.3 From 589c6ffed25e818cd332e3ffb462ee13c4c8703e Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 18 Feb 2014 13:53:20 +0100 Subject: AVALANCHE: Reimplement the rectangle drawing methods. --- engines/avalanche/help.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/avalanche/help.cpp') diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp index bef557db07..b667ad090d 100644 --- a/engines/avalanche/help.cpp +++ b/engines/avalanche/help.cpp @@ -66,8 +66,8 @@ void Help::switchPage(byte which) { Common::String title = getLine(file); - _vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlue); - _vm->_graphics->drawFilledRectangle(Common::Rect(8, 40, 450, 200), kColorWhite); + _vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 639, 199), kColorBlue); + _vm->_graphics->drawFilledRectangle(Common::Rect(8, 40, 449, 199), kColorWhite); byte index = file.readByte(); _vm->_graphics->helpDrawButton(-177, index); -- cgit v1.2.3 From 37b147d9503b0614983d7072be60c2708ade0800 Mon Sep 17 00:00:00 2001 From: uruk Date: Thu, 20 Feb 2014 14:41:42 +0100 Subject: AVALANCHE: Repair out of bound read in Help::handleMouse(). --- engines/avalanche/help.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'engines/avalanche/help.cpp') diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp index b667ad090d..5d3247ba9a 100644 --- a/engines/avalanche/help.cpp +++ b/engines/avalanche/help.cpp @@ -180,6 +180,7 @@ bool Help::handleMouse(const Common::Event &event) { } else { // LBUTTONDOWN or MOUSEMOVE int highlightIs = 0; + // Decide which button we are hovering the cursor over: if ((mousePos.x > 470) && (mousePos.x <= 550) && (((mousePos.y - 13) % 27) <= 20)) { // No click, so highlight. highlightIs = (mousePos.y - 13) / 27 - 1; if ((highlightIs < 0) || (5 < highlightIs)) @@ -187,20 +188,21 @@ bool Help::handleMouse(const Common::Event &event) { } else highlightIs = 177; - if (((highlightIs != 177) && (event.type == Common::EVENT_LBUTTONDOWN)) || _holdLeft) { + Color highlightColor = kColorLightblue; + // If we clicked on a button or we are holding down the button, we have to highlight it with cyan: + if (((highlightIs != 177) && ((event.type == Common::EVENT_LBUTTONDOWN)) || _holdLeft)) { _holdLeft = true; - highlightIs += 32; + highlightColor = kColorLightcyan; } - if (_highlightWas != highlightIs) { + // Erase the previous highlight only if it's needed: + if (_highlightWas != highlightIs) _vm->_graphics->helpDrawHighlight(_highlightWas, kColorBlue); + + // Highligt the current one with the proper color: + if (_buttons[highlightIs]._trigger != Common::KEYCODE_INVALID) { _highlightWas = highlightIs; - if (_buttons[highlightIs & 31]._trigger != Common::KEYCODE_INVALID) { - if (highlightIs > 31) - _vm->_graphics->helpDrawHighlight(highlightIs, kColorLightcyan); - else - _vm->_graphics->helpDrawHighlight(highlightIs, kColorLightblue); - } + _vm->_graphics->helpDrawHighlight(highlightIs, highlightColor); } } -- cgit v1.2.3 From e15dafb9e4f15a1c9095b02bca0d240de9bd2f09 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 25 Feb 2014 21:56:32 +0100 Subject: AVALANCHE: Rework use of Common::Rect. Now the right and bottom coordinates of the rectangles aren't included in them. --- engines/avalanche/help.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/avalanche/help.cpp') diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp index 5d3247ba9a..b24f6c40d8 100644 --- a/engines/avalanche/help.cpp +++ b/engines/avalanche/help.cpp @@ -66,8 +66,8 @@ void Help::switchPage(byte which) { Common::String title = getLine(file); - _vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 639, 199), kColorBlue); - _vm->_graphics->drawFilledRectangle(Common::Rect(8, 40, 449, 199), kColorWhite); + _vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlue); + _vm->_graphics->drawFilledRectangle(Common::Rect(8, 40, 450, 200), kColorWhite); byte index = file.readByte(); _vm->_graphics->helpDrawButton(-177, index); -- cgit v1.2.3