TITANIC: Implement messages PET section

This commit is contained in:
Paul Gilbert 2016-04-30 17:50:19 -04:00
parent ecb14e9bc2
commit a15e299a06
8 changed files with 135 additions and 58 deletions

View file

@ -362,13 +362,13 @@ MODULE_OBJS := \
pet_control/pet_gfx_element.o \ pet_control/pet_gfx_element.o \
pet_control/pet_inventory.o \ pet_control/pet_inventory.o \
pet_control/pet_inventory_glyphs.o \ pet_control/pet_inventory_glyphs.o \
pet_control/pet_message.o \
pet_control/pet_nav_helmet.o \ pet_control/pet_nav_helmet.o \
pet_control/pet_rooms.o \ pet_control/pet_rooms.o \
pet_control/pet_rooms_glyphs.o \ pet_control/pet_rooms_glyphs.o \
pet_control/pet_remote.o \ pet_control/pet_remote.o \
pet_control/pet_real_life.o \ pet_control/pet_real_life.o \
pet_control/pet_section.o \ pet_control/pet_section.o \
pet_control/pet_control_sub7.o \
pet_control/pet_drag_chev.o \ pet_control/pet_drag_chev.o \
pet_control/pet_graphic2.o \ pet_control/pet_graphic2.o \
pet_control/pet_graphic.o \ pet_control/pet_graphic.o \

View file

@ -52,7 +52,7 @@ CPetControl::CPetControl() : CGameObject(),
_sections[PET_ROOMS] = &_rooms; _sections[PET_ROOMS] = &_rooms;
_sections[PET_REAL_LIFE] = &_realLife; _sections[PET_REAL_LIFE] = &_realLife;
_sections[PET_NAV_HELMET] = &_navHelmet; _sections[PET_NAV_HELMET] = &_navHelmet;
_sections[PET_6] = &_sub7; _sections[PET_MESSAGE] = &_message;
} }
void CPetControl::save(SimpleFile *file, int indent) const { void CPetControl::save(SimpleFile *file, int indent) const {
@ -87,7 +87,7 @@ void CPetControl::setup() {
_inventory.setup(this); _inventory.setup(this);
_navHelmet.setup(this); _navHelmet.setup(this);
_realLife.setup(this); _realLife.setup(this);
_sub7.setup(this); _message.setup(this);
_frame.setup(this); _frame.setup(this);
} }
@ -98,7 +98,7 @@ bool CPetControl::isValid() {
_inventory.isValid(this) && _inventory.isValid(this) &&
_navHelmet.isValid(this) && _navHelmet.isValid(this) &&
_realLife.isValid(this) && _realLife.isValid(this) &&
_sub7.isValid(this) && _message.isValid(this) &&
_frame.isValid(this); _frame.isValid(this);
} }
@ -109,7 +109,7 @@ void CPetControl::loadAreas(SimpleFile *file, int param) {
_inventory.load(file, param); _inventory.load(file, param);
_navHelmet.load(file, param); _navHelmet.load(file, param);
_realLife.load(file, param); _realLife.load(file, param);
_sub7.load(file, param); _message.load(file, param);
_frame.load(file, param); _frame.load(file, param);
} }
@ -120,7 +120,7 @@ void CPetControl::saveAreas(SimpleFile *file, int indent) const {
_inventory.save(file, indent); _inventory.save(file, indent);
_navHelmet.save(file, indent); _navHelmet.save(file, indent);
_realLife.save(file, indent); _realLife.save(file, indent);
_sub7.save(file, indent); _message.save(file, indent);
_frame.save(file, indent); _frame.save(file, indent);
} }
@ -165,7 +165,7 @@ void CPetControl::loaded() {
_inventory.postLoad(); _inventory.postLoad();
_navHelmet.postLoad(); _navHelmet.postLoad();
_realLife.postLoad(); _realLife.postLoad();
_sub7.postLoad(); _message.postLoad();
_frame.postLoad(); _frame.postLoad();
} }

View file

@ -31,11 +31,11 @@
#include "titanic/pet_control/pet_conversations.h" #include "titanic/pet_control/pet_conversations.h"
#include "titanic/pet_control/pet_frame.h" #include "titanic/pet_control/pet_frame.h"
#include "titanic/pet_control/pet_inventory.h" #include "titanic/pet_control/pet_inventory.h"
#include "titanic/pet_control/pet_message.h"
#include "titanic/pet_control/pet_nav_helmet.h" #include "titanic/pet_control/pet_nav_helmet.h"
#include "titanic/pet_control/pet_real_life.h" #include "titanic/pet_control/pet_real_life.h"
#include "titanic/pet_control/pet_remote.h" #include "titanic/pet_control/pet_remote.h"
#include "titanic/pet_control/pet_rooms.h" #include "titanic/pet_control/pet_rooms.h"
#include "titanic/pet_control/pet_control_sub7.h"
namespace Titanic { namespace Titanic {
@ -59,7 +59,7 @@ private:
CPetRemote _remote; CPetRemote _remote;
CPetRooms _rooms; CPetRooms _rooms;
CPetRealLife _realLife; CPetRealLife _realLife;
CPetControlSub7 _sub7; CPetMessage _message;
CPetFrame _frame; CPetFrame _frame;
CString _activeNPCName; CString _activeNPCName;
CString _string2; CString _string2;

View file

@ -1,44 +0,0 @@
/* 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.
*
*/
#ifndef TITANIC_PET_CONTROL_SUB7_H
#define TITANIC_PET_CONTROL_SUB7_H
#include "titanic/pet_control/pet_section.h"
#include "titanic/pet_control/pet_text.h"
namespace Titanic {
class CPetControlSub7 : public CPetSection {
private:
CPetText _text1;
CPetText _text2;
public:
/**
* Returns true if the object is in a valid state
*/
virtual bool isValid(CPetControl *petControl);
};
} // End of namespace Titanic
#endif /* TITANIC_PET_CONTROL_SUB7_H */

View file

@ -126,7 +126,7 @@ bool CPetFrame::setPetControl(CPetControl *petControl) {
void CPetFrame::setArea(PetArea newArea) { void CPetFrame::setArea(PetArea newArea) {
resetArea(); resetArea();
if (newArea < PET_6) if (newArea < PET_MESSAGE)
_modeButtons[PET_AREAS[newArea]].setMode(MODE_SELECTED); _modeButtons[PET_AREAS[newArea]].setMode(MODE_SELECTED);
} }

View file

@ -20,12 +20,37 @@
* *
*/ */
#include "titanic/pet_control/pet_control_sub7.h" #include "titanic/pet_control/pet_message.h"
namespace Titanic { namespace Titanic {
bool CPetControlSub7::isValid(CPetControl *petControl) { CPetMessage::CPetMessage() {
// TODO Rect rect1(0, 0, 580, 70);
rect1.translate(32, 368);
_message.setBounds(rect1);
_message.resize(50);
_message.setHasBorder(false);
Rect rect2(0, 0, 580, 15);
rect2.translate(32, 445);
_tooltip.setBounds(rect2);
_tooltip.setHasBorder(false);
}
bool CPetMessage::setup(CPetControl *petControl) {
if (petControl && setupControl(petControl))
return reset();
return false;
}
void CPetMessage::draw(CScreenManager *screenManager) {
_message.draw(screenManager);
_tooltip.draw(screenManager);
}
bool CPetMessage::setupControl(CPetControl *petControl) {
if (petControl)
_petControl = petControl;
return true; return true;
} }

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 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.
*
*/
#ifndef TITANIC_PET_MESSAGE_H
#define TITANIC_PET_MESSAGE_H
#include "titanic/pet_control/pet_section.h"
#include "titanic/pet_control/pet_text.h"
namespace Titanic {
class CPetMessage : public CPetSection {
private:
CPetText _message;
CPetText _tooltip;
private:
/**
* Setup the control
*/
bool setupControl(CPetControl *petControl);
public:
CPetMessage();
/**
* Sets up the section
*/
virtual bool setup(CPetControl *petControl);
/**
* Reset the section
*/
virtual bool reset() { return true; }
/**
* Draw the section
*/
virtual void draw(CScreenManager *screenManager);
/**
* Following are handlers for the various messages that the PET can
* pass onto the currently active section/area
*/
virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return false; }
virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return false; }
/**
* Returns true if the object is in a valid state
*/
virtual bool isValid(CPetControl *petControl) {
return setupControl(petControl);
}
/**
* Load the data for the class from file
*/
virtual void load(SimpleFile *file, int param) {}
/**
* Called after a game has been loaded
*/
virtual void postLoad() { reset(); }
/**
* Save the data for the class to file
*/
virtual void save(SimpleFile *file, int indent) const {}
/**
* Get a reference to the tooltip text associated with the section
*/
virtual CPetText *getText() { return &_tooltip; }
};
} // End of namespace Titanic
#endif /* TITANIC_PET_MESSAGE_H */

View file

@ -30,7 +30,7 @@ namespace Titanic {
enum PetArea { enum PetArea {
PET_INVENTORY = 0, PET_CONVERSATION = 1, PET_REMOTE = 2, PET_INVENTORY = 0, PET_CONVERSATION = 1, PET_REMOTE = 2,
PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_NAV_HELMET = 5, PET_6 = 6 PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_NAV_HELMET = 5, PET_MESSAGE = 6
}; };
class CPetControl; class CPetControl;