2016-02-23 20:59:57 -05:00
|
|
|
/* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-04-18 17:25:58 -04:00
|
|
|
#include "titanic/pet_control/pet_quit.h"
|
2016-04-19 21:23:52 -04:00
|
|
|
#include "titanic/pet_control/pet_control.h"
|
2016-04-18 22:52:11 -04:00
|
|
|
#include "titanic/pet_control/pet_real_life.h"
|
|
|
|
#include "titanic/support/rect.h"
|
2016-04-19 21:23:52 -04:00
|
|
|
#include "titanic/game_manager.h"
|
2016-02-23 20:59:57 -05:00
|
|
|
|
|
|
|
namespace Titanic {
|
|
|
|
|
2016-04-19 22:00:47 -04:00
|
|
|
bool CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) {
|
2016-04-18 22:52:11 -04:00
|
|
|
CPetGlyph::setup(petControl, owner);
|
|
|
|
Rect tempRect(0, 0, 280, 16);
|
|
|
|
tempRect.moveTo(32, 407);
|
2016-04-18 23:13:19 -04:00
|
|
|
_text.setBounds(tempRect);
|
|
|
|
_text.resize(3);
|
|
|
|
_text.setHasBorder(true);
|
|
|
|
_text.setup();
|
2016-04-18 22:52:11 -04:00
|
|
|
|
2016-04-23 11:29:26 -04:00
|
|
|
Rect btnRect(0, 0, 496, 388);
|
|
|
|
btnRect.moveTo(496, 388);
|
|
|
|
_btnYes.setBounds(btnRect);
|
2016-04-19 22:00:47 -04:00
|
|
|
|
|
|
|
return true;
|
2016-04-18 22:52:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CPetQuit::reset() {
|
|
|
|
CPetControl *pet = getPetControl();
|
|
|
|
if (!pet)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
setName("PetExit", pet);
|
2016-04-19 13:13:32 -04:00
|
|
|
|
2016-04-19 22:00:47 -04:00
|
|
|
uint col = getPetSection()->getColor(0);
|
2016-04-19 13:23:30 -04:00
|
|
|
_text.setText("Are you sure you want to quit?");
|
|
|
|
_text.setColor(0, col);
|
|
|
|
|
|
|
|
_btnYes.reset("PetQuitOut", pet, MODE_UNSELECTED);
|
|
|
|
_btnYes.reset("PetQuitIn", pet, MODE_SELECTED);
|
2016-04-18 22:52:11 -04:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2016-03-31 21:40:36 -04:00
|
|
|
|
2016-04-19 21:23:52 -04:00
|
|
|
void CPetQuit::draw2(CScreenManager *screenManager) {
|
|
|
|
_text.draw(screenManager);
|
|
|
|
_btnYes.draw(screenManager);
|
|
|
|
}
|
|
|
|
|
2016-04-21 22:13:44 -04:00
|
|
|
bool CPetQuit::checkHighlight(const Point &pt) {
|
|
|
|
return !_btnYes.highlightBounds(pt);
|
2016-04-19 21:23:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CPetQuit::mouseButtonDownMsg(CMouseButtonDownMsg *msg) {
|
|
|
|
CPetControl *pet = getPetControl();
|
|
|
|
if (_btnYes.MouseButtonDownMsg(msg) && pet) {
|
|
|
|
CGameManager *gameManager = pet->getGameManager();
|
|
|
|
if (gameManager)
|
|
|
|
gameManager->_gameState._quitGame = true;
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CPetQuit::getTooltip(CPetText *text) {
|
|
|
|
text->setText("Quit the game.");
|
|
|
|
}
|
|
|
|
|
2016-02-23 20:59:57 -05:00
|
|
|
} // End of namespace Titanic
|