TITANIC: Implementing PET Nav Helmet section

This commit is contained in:
Paul Gilbert 2016-04-30 16:52:42 -04:00
parent d46d3f7b0d
commit b013d10d8f
8 changed files with 216 additions and 71 deletions

View File

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

View File

@ -51,7 +51,7 @@ CPetControl::CPetControl() : CGameObject(),
_sections[PET_REMOTE] = &_remote;
_sections[PET_ROOMS] = &_rooms;
_sections[PET_REAL_LIFE] = &_realLife;
_sections[PET_5] = &_sub5;
_sections[PET_NAV_HELMET] = &_navHelmet;
_sections[PET_6] = &_sub7;
}
@ -85,7 +85,7 @@ void CPetControl::setup() {
_rooms.setup(this);
_remote.setup(this);
_inventory.setup(this);
_sub5.setup(this);
_navHelmet.setup(this);
_realLife.setup(this);
_sub7.setup(this);
_frame.setup(this);
@ -96,7 +96,7 @@ bool CPetControl::isValid() {
_rooms.isValid(this) &&
_remote.isValid(this) &&
_inventory.isValid(this) &&
_sub5.isValid(this) &&
_navHelmet.isValid(this) &&
_realLife.isValid(this) &&
_sub7.isValid(this) &&
_frame.isValid(this);
@ -107,7 +107,7 @@ void CPetControl::loadAreas(SimpleFile *file, int param) {
_rooms.load(file, param);
_remote.load(file, param);
_inventory.load(file, param);
_sub5.load(file, param);
_navHelmet.load(file, param);
_realLife.load(file, param);
_sub7.load(file, param);
_frame.load(file, param);
@ -118,7 +118,7 @@ void CPetControl::saveAreas(SimpleFile *file, int indent) const {
_rooms.save(file, indent);
_remote.save(file, indent);
_inventory.save(file, indent);
_sub5.save(file, indent);
_navHelmet.save(file, indent);
_realLife.save(file, indent);
_sub7.save(file, indent);
_frame.save(file, indent);
@ -163,7 +163,7 @@ void CPetControl::loaded() {
_rooms.postLoad();
_remote.postLoad();
_inventory.postLoad();
_sub5.postLoad();
_navHelmet.postLoad();
_realLife.postLoad();
_sub7.postLoad();
_frame.postLoad();

View File

@ -31,10 +31,10 @@
#include "titanic/pet_control/pet_conversations.h"
#include "titanic/pet_control/pet_frame.h"
#include "titanic/pet_control/pet_inventory.h"
#include "titanic/pet_control/pet_nav_helmet.h"
#include "titanic/pet_control/pet_real_life.h"
#include "titanic/pet_control/pet_remote.h"
#include "titanic/pet_control/pet_rooms.h"
#include "titanic/pet_control/pet_control_sub5.h"
#include "titanic/pet_control/pet_control_sub7.h"
namespace Titanic {
@ -55,10 +55,10 @@ private:
CPetSection *_sections[7];
CPetConversations _conversations;
CPetInventory _inventory;
CPetNavHelmet _navHelmet;
CPetRemote _remote;
CPetRooms _rooms;
CPetRealLife _realLife;
CPetControlSub5 _sub5;
CPetControlSub7 _sub7;
CPetFrame _frame;
CString _activeNPCName;

View File

@ -1,48 +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.
*
*/
#include "titanic/pet_control/pet_control_sub5.h"
namespace Titanic {
CPetControlSub5::CPetControlSub5() :
_field98(0), _field9C(0), _fieldA0(0),
_field18C(0), _field20C(0), _field210(0) {
}
void CPetControlSub5::save(SimpleFile *file, int indent) const {
}
void CPetControlSub5::load(SimpleFile *file, int param) {
if (!param) {
_field20C = file->readNumber();
_field210 = file->readNumber();
}
}
bool CPetControlSub5::isValid(CPetControl *petControl) {
// TODO
return true;
}
} // End of namespace Titanic

View File

@ -27,7 +27,7 @@ namespace Titanic {
static const PetArea PET_AREAS[6] = {
PET_CONVERSATION, PET_INVENTORY, PET_REMOTE,
PET_ROOMS, PET_REAL_LIFE, PET_5
PET_ROOMS, PET_REAL_LIFE, PET_NAV_HELMET
};
CPetFrame::CPetFrame() : CPetSection() {

View File

@ -0,0 +1,156 @@
/* 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.
*
*/
#include "titanic/pet_control/pet_nav_helmet.h"
#include "titanic/pet_control/pet_control.h"
namespace Titanic {
CPetNavHelmet::CPetNavHelmet() :
_field98(0), _field9C(0), _fieldA0(0), _field18C(0),
_field20C(1), _field210(0), _rect1(22, 352, 598, 478) {
}
bool CPetNavHelmet::setup(CPetControl *petControl) {
if (petControl && setupControl(petControl))
return reset();
return false;
}
bool CPetNavHelmet::reset() {
if (_petControl) {
_val1.setup(MODE_UNSELECTED, "3PetStarField", _petControl);
_val2.setup(MODE_UNSELECTED, "HomePhotoOnOff", _petControl);
_val3.setup(MODE_UNSELECTED, "3PetSetDestin", _petControl);
_val3.setup(MODE_SELECTED, "3PetSetDestin1", _petControl);
_val4.setup(MODE_UNSELECTED, "3PetStarCtrl", _petControl);
_leds[0].setup(MODE_UNSELECTED, "LEDOff1", _petControl);
_leds[1].setup(MODE_UNSELECTED, "LEDOn1", _petControl);
_leds[2].setup(MODE_UNSELECTED, "LEDOff2", _petControl);
_leds[3].setup(MODE_UNSELECTED, "LEDOn2", _petControl);
_leds[4].setup(MODE_UNSELECTED, "LEDOff3", _petControl);
_leds[5].setup(MODE_UNSELECTED, "LEDOn3", _petControl);
uint col = getColor(0);
_text.setColor(col);
_text.setLineColor(0, col);
}
return true;
}
void CPetNavHelmet::draw(CScreenManager *screenManager) {
_petControl->drawSquares(screenManager, 2);
if (_field20C) {
_val2.draw(screenManager);
} else {
_val4.draw(screenManager);
}
_val3.draw(screenManager);
drawButton(_field98, 0, screenManager);
drawButton(_field9C, 2, screenManager);
drawButton(_fieldA0, 4, screenManager);
_text.draw(screenManager);
}
bool CPetNavHelmet::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
return false;
}
bool CPetNavHelmet::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
return false;
}
bool CPetNavHelmet::isValid(CPetControl *petControl) {
return setupControl(petControl);
}
void CPetNavHelmet::load(SimpleFile *file, int param) {
if (!param) {
_field20C = file->readNumber();
_field210 = file->readNumber();
}
}
void CPetNavHelmet::postLoad() {
reset();
}
void CPetNavHelmet::save(SimpleFile *file, int indent) const {
file->writeNumberLine(_field20C, indent);
file->writeNumberLine(_field210, indent);
}
bool CPetNavHelmet::setupControl(CPetControl *petControl) {
if (petControl) {
_petControl = petControl;
Rect r(0, 0, 64, 64);
r.translate(_rect1.left, _rect1.top);
_val1.setBounds(r);
_val1.translate(15, 23);
_val2.setBounds(r);
_val2.translate(85, 23);
_val4.setBounds(r);
_val4.translate(85, 23);
r = Rect(0, 0, 34, 34);
r.translate(468, 396);
_leds[0].setBounds(r);
_leds[1].setBounds(r);
r.translate(36, 0);
_leds[2].setBounds(r);
_leds[3].setBounds(r);
r.translate(36, 0);
_leds[4].setBounds(r);
_leds[5].setBounds(r);
r = Rect(0, 0, 157, 51);
r.translate(224, 33);
r.translate(20, 350);
_val3.setBounds(r);
r = Rect(0, 0, 580, 15);
r.translate(32, 445);
_text.setBounds(r);
_text.setHasBorder(false);
}
return true;
}
void CPetNavHelmet::drawButton(int offset, int index, CScreenManager *screenManager) {
if (_field18C < 4 && (offset / 3) == 1)
--offset;
if (offset == 2)
offset = 1;
_leds[index + offset].draw(screenManager);
}
} // End of namespace Titanic

View File

@ -20,8 +20,8 @@
*
*/
#ifndef TITANIC_PET_CONTROL_SUB5_H
#define TITANIC_PET_CONTROL_SUB5_H
#ifndef TITANIC_PET_NAV_HELMET_H
#define TITANIC_PET_NAV_HELMET_H
#include "titanic/pet_control/pet_section.h"
#include "titanic/pet_control/pet_text.h"
@ -29,7 +29,7 @@
namespace Titanic {
class CPetControlSub5 : public CPetSection {
class CPetNavHelmet : public CPetSection {
private:
CPetGfxElement _val1;
CPetGfxElement _val2;
@ -38,19 +38,51 @@ private:
int _field98;
int _field9C;
int _fieldA0;
CPetGfxElement _valArray1[6];
int _field17C;
CPetGfxElement _leds[6];
Rect _rect1;
int _field18C;
CPetText _text;
int _field20C;
int _field210;
public:
CPetControlSub5();
private:
/**
* Setup the control
*/
bool setupControl(CPetControl *petControl);
/**
* Save the data for the class to file
* Draw a button
*/
virtual void save(SimpleFile *file, int indent) const;
void drawButton(int offset, int index, CScreenManager *screenManager);
public:
CPetNavHelmet();
/**
* Sets up the section
*/
virtual bool setup(CPetControl *petControl);
/**
* Reset the section
*/
virtual bool reset();
/**
* 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);
virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
/**
* Returns true if the object is in a valid state
*/
virtual bool isValid(CPetControl *petControl);
/**
* Load the data for the class from file
@ -58,11 +90,16 @@ public:
virtual void load(SimpleFile *file, int param);
/**
* Returns true if the object is in a valid state
* Called after a game has been loaded
*/
virtual bool isValid(CPetControl *petControl);
virtual void postLoad();
/**
* Save the data for the class to file
*/
virtual void save(SimpleFile *file, int indent) const;
};
} // End of namespace Titanic
#endif /* TITANIC_PET_CONTROL_SUB5_H */
#endif /* TITANIC_PET_NAV_HELMET_H */

View File

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