From daaa458d64df42f113b7badd65cdfaf0da0504ff Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Apr 2016 18:42:29 -0400 Subject: TITANIC: Restructuring PET list classes, beginning of inventory --- engines/titanic/carry/arm.cpp | 10 +-- engines/titanic/carry/bridge_piece.cpp | 2 +- engines/titanic/carry/carry.cpp | 18 ++-- engines/titanic/carry/carry.h | 8 +- engines/titanic/carry/carry_parrot.cpp | 4 +- engines/titanic/carry/chicken.cpp | 10 +-- engines/titanic/carry/napkin.cpp | 2 +- engines/titanic/core/game_object.h | 10 +-- engines/titanic/module.mk | 4 +- engines/titanic/pet_control/pet_control.cpp | 29 ++++++- engines/titanic/pet_control/pet_control.h | 2 + .../titanic/pet_control/pet_control_list_item.cpp | 27 ------ .../titanic/pet_control/pet_control_list_item.h | 42 ---------- .../titanic/pet_control/pet_control_list_item2.h | 4 +- engines/titanic/pet_control/pet_control_sub10.cpp | 52 ------------ engines/titanic/pet_control/pet_control_sub10.h | 67 --------------- engines/titanic/pet_control/pet_control_sub11.h | 4 +- engines/titanic/pet_control/pet_inventory.cpp | 28 ++++++- engines/titanic/pet_control/pet_inventory.h | 16 +++- .../titanic/pet_control/pet_inventory_glyphs.cpp | 68 +++++++++++++++ engines/titanic/pet_control/pet_inventory_glyphs.h | 97 ++++++++++++++++++++++ engines/titanic/pet_control/pet_remote.h | 7 +- engines/titanic/pet_control/pet_saves.h | 9 +- 23 files changed, 282 insertions(+), 238 deletions(-) delete mode 100644 engines/titanic/pet_control/pet_control_list_item.cpp delete mode 100644 engines/titanic/pet_control/pet_control_list_item.h delete mode 100644 engines/titanic/pet_control/pet_control_sub10.cpp delete mode 100644 engines/titanic/pet_control/pet_control_sub10.h create mode 100644 engines/titanic/pet_control/pet_inventory_glyphs.cpp create mode 100644 engines/titanic/pet_control/pet_inventory_glyphs.h diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp index b6e125aa10..c39812fd26 100644 --- a/engines/titanic/carry/arm.cpp +++ b/engines/titanic/carry/arm.cpp @@ -119,7 +119,7 @@ bool CArm::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (hookedMsg._result) { _string7 = "GondolierLeftLever"; } else { - dropOnPet(); + addToInventory(); } } else if (msg->_other->getName() == "GondolierRightLever") { CIsHookedOnMsg hookedMsg(_hookedRect, 0, getName()); @@ -129,7 +129,7 @@ bool CArm::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (hookedMsg._result) { _string7 = "GondolierRightLever"; } else { - dropOnPet(); + addToInventory(); } } @@ -166,13 +166,13 @@ bool CArm::MaitreDHappyMsg(CMaitreDHappyMsg *msg) { CGameObject *child = static_cast(getFirstChild()); if (child) { child->setVisible(true); - dropOnPet(); + addToInventory(); } _visibleFrame = _field170; loadFrame(_visibleFrame); _string6 = "None"; - addToInventory(); + invFn3(); } } @@ -189,7 +189,7 @@ bool CArm::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { _visibleFrame = _field170; loadFrame(_visibleFrame); child->setVisible(true); - child->dropOnPet(); + child->addToInventory(); } _string6 = "None"; diff --git a/engines/titanic/carry/bridge_piece.cpp b/engines/titanic/carry/bridge_piece.cpp index 0ed8ae6a9a..4fafac26b5 100644 --- a/engines/titanic/carry/bridge_piece.cpp +++ b/engines/titanic/carry/bridge_piece.cpp @@ -56,7 +56,7 @@ bool CBridgePiece::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (!shipSetting) { return CCarry::UseWithOtherMsg(msg); } else if (shipSetting->_string4 == "NULL") { - dropOnPet(); + addToInventory(); return true; } else { setVisible(false); diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp index 1bb81fb4cb..31d0ff02d2 100644 --- a/engines/titanic/carry/carry.cpp +++ b/engines/titanic/carry/carry.cpp @@ -123,7 +123,7 @@ bool CCarry::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (msg->_dropTarget) { if (msg->_dropTarget->isPet()) { - dropOnPet(); + addToInventory(); return true; } @@ -147,7 +147,7 @@ bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) { CString viewName = getViewFullName(); if (viewName.empty() || msg->_mousePos.y >= 360) { sleep(250); - dropOnPet(); + addToInventory(); } else { setPosition(_origPos); loadFrame(_itemFrame); @@ -165,7 +165,7 @@ bool CCarry::UseWithCharMsg(CUseWithCharMsg *msg) { } else { CShowTextMsg textMsg(_string4); textMsg.execute("PET"); - dropOnPet(); + addToInventory(); } return true; @@ -182,7 +182,7 @@ bool CCarry::UseWithOtherMsg(CUseWithOtherMsg *msg) { _fullViewName = getViewFullName(); if (_fullViewName.empty() || _bounds.top >= 360) { sleep(250); - dropOnPet(); + addToInventory(); } else { setPosition(_origPos); } @@ -238,14 +238,16 @@ bool CCarry::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { return true; } -void CCarry::dropOnPet() { - warning("TODO: dropOnPet"); -} - void CCarry::addToInventory() { CPetControl *pet = getPetControl(); if (pet) pet->addToInventory(this); } +void CCarry::invFn3() { + CPetControl *pet = getPetControl(); + if (pet) + pet->invFn3(this); +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index 9fd7679463..2370556607 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -63,9 +63,9 @@ protected: int _visibleFrame; protected: /** - * Add the item to the PET inventory + * */ - void addToInventory(); + void invFn3(); public: CLASSDEF CCarry(); @@ -81,9 +81,9 @@ public: virtual void load(SimpleFile *file); /** - * Called to drop an item into the PET + * Add the item to the inventory */ - void dropOnPet(); + void addToInventory(); }; } // End of namespace Titanic diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp index 4b2b637fa1..598393bb08 100644 --- a/engines/titanic/carry/carry_parrot.cpp +++ b/engines/titanic/carry/carry_parrot.cpp @@ -105,7 +105,7 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { stopMovie(); if (msg->_mousePos.y >= 360) { - dropOnPet(); + addToInventory(); return true; } @@ -215,7 +215,7 @@ bool CCarryParrot::ActMsg(CActMsg *msg) { CCarry *feathers = static_cast(getRoot()->findByName("Feathers")); if (feathers) { feathers->setVisible(true); - feathers->dropOnPet(); + feathers->addToInventory(); } _field140 = true; diff --git a/engines/titanic/carry/chicken.cpp b/engines/titanic/carry/chicken.cpp index 50fcb8f500..74b42aafcd 100644 --- a/engines/titanic/carry/chicken.cpp +++ b/engines/titanic/carry/chicken.cpp @@ -72,13 +72,13 @@ bool CChicken::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (_field12C || _string6 == "None") { CActMsg actMsg("Clean"); actMsg.execute(this); - dropOnPet(); + addToInventory(); } else { CShowTextMsg textMsg("The chicken is already clean."); textMsg.execute("PET"); } - dropOnPet(); + addToInventory(); } else { CSauceDispensor *dispensor = static_cast(msg->_other); if (!dispensor || _string6 == "None") { @@ -101,7 +101,7 @@ bool CChicken::UseWithCharMsg(CUseWithCharMsg *msg) { acceptMsg._item = this; acceptMsg.execute(succubus); } else { - dropOnPet(); + addToInventory(); } return true; @@ -110,7 +110,7 @@ bool CChicken::UseWithCharMsg(CUseWithCharMsg *msg) { bool CChicken::ActMsg(CActMsg *msg) { if (msg->_action == "GoToPET") { setVisible(true); - dropOnPet(); + addToInventory(); } else if (msg->_action == "Tomato") { _string6 = "Tomato"; loadFrame(4); @@ -171,7 +171,7 @@ bool CChicken::TimerMsg(CTimerMsg *msg) { } if (flag) { - addToInventory(); + invFn3(); stopTimer(_timerId); } diff --git a/engines/titanic/carry/napkin.cpp b/engines/titanic/carry/napkin.cpp index c998c132fc..a8ceaad5ba 100644 --- a/engines/titanic/carry/napkin.cpp +++ b/engines/titanic/carry/napkin.cpp @@ -53,7 +53,7 @@ bool CNapkin::UseWithOtherMsg(CUseWithOtherMsg *msg) { } } - dropOnPet(); + addToInventory(); return CCarry::UseWithOtherMsg(msg); } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index db1ed90b54..430f70521e 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -204,11 +204,6 @@ protected: */ static CGameObject *findUnder(CTreeItem *parent, const CString &name); - /** - * Moves the item from it's original position to be under the hidden room - */ - void moveToHiddenRoom(); - /** * Moves the item from it's original position to be under the current view */ @@ -313,7 +308,10 @@ public: */ void setVisible(bool val); - + /** + * Moves the item from it's original position to be under the hidden room + */ + void moveToHiddenRoom(); }; } // End of namespace Titanic diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 8f3126b052..da642f9a3a 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -356,25 +356,25 @@ MODULE_OBJS := \ npcs/titania.o \ npcs/true_talk_npc.o \ pet_control/pet_control.o \ - pet_control/pet_control_list_item.o \ pet_control/pet_control_list_item2.o \ pet_control/pet_conversations.o \ pet_control/pet_element.o \ pet_control/pet_frame.o \ pet_control/pet_gfx_element.o \ pet_control/pet_inventory.o \ + pet_control/pet_inventory_glyphs.o \ pet_control/pet_rooms.o \ pet_control/pet_remote.o \ pet_control/pet_saves.o \ pet_control/pet_section.o \ pet_control/pet_control_sub5.o \ pet_control/pet_control_sub7.o \ - pet_control/pet_control_sub10.o \ pet_control/pet_control_sub11.o \ pet_control/pet_control_sub12.o \ pet_control/pet_drag_chev.o \ pet_control/pet_graphic2.o \ pet_control/pet_graphic.o \ + pet_control/pet_glyphs.o \ pet_control/pet_leaf.o \ pet_control/pet_mode_off.o \ pet_control/pet_mode_on.o \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index bb320f29f4..b9f1359746 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -353,7 +353,30 @@ CGameObject *CPetControl::getNextObject(CGameObject *prior) const { } void CPetControl::addToInventory(CCarry *item) { - _inventory.addItem(item); + item->detach(); + + if (item->getName() == "CarryParcel") { + CCarry *child = static_cast(getLastChild()); + if (child) + child->detach(); + + item->moveToHiddenRoom(); + if (!child) + return; + + item = child; + } + + item->addUnder(this); + _inventory.itemsChanged(); + + setArea(PET_INVENTORY); + if (_currentArea != PET_INVENTORY) + _inventory.couldntShowInventory(item); + + makeDirty(); + CPETGainedObjectMsg msg; + msg.execute(item); } void CPetControl::removeFromInventory(CCarry *item, CTreeItem *newParent, @@ -376,6 +399,10 @@ void CPetControl::removeFromInventory(CCarry *item, bool refreshUI, bool sendMsg removeFromInventory(item, view, refreshUI, sendMsg); } +void CPetControl::invFn3(CCarry *item) { + _inventory.fn3(item); +} + void CPetControl::moveToHiddenRoom(CTreeItem *item) { CRoomItem *room = getHiddenRoom(); if (room) { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 27b0a2ba6f..4192d9ebf4 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -224,6 +224,8 @@ public: */ void removeFromInventory(CCarry *item, bool refreshUI = true, bool sendMsg = true); + void invFn3(CCarry *item); + /** * Moves a tree item from it's original position to be under the hidden room */ diff --git a/engines/titanic/pet_control/pet_control_list_item.cpp b/engines/titanic/pet_control/pet_control_list_item.cpp deleted file mode 100644 index ea678754f5..0000000000 --- a/engines/titanic/pet_control/pet_control_list_item.cpp +++ /dev/null @@ -1,27 +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_list_item.h" - -namespace Titanic { - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_list_item.h b/engines/titanic/pet_control/pet_control_list_item.h deleted file mode 100644 index caa9a0d6b1..0000000000 --- a/engines/titanic/pet_control/pet_control_list_item.h +++ /dev/null @@ -1,42 +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_LIST_ITEM_H -#define TITANIC_PET_CONTROL_LIST_ITEM_H - -#include "titanic/core/list.h" -#include "titanic/pet_control/pet_gfx_element.h" - -namespace Titanic { - -class CPetControlListItem : public ListItem { -protected: - CPetGfxElement _val; - int _field30; -public: - CPetControlListItem() : _field30(0) {} - -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_LIST_ITEM_H */ diff --git a/engines/titanic/pet_control/pet_control_list_item2.h b/engines/titanic/pet_control/pet_control_list_item2.h index a7f28fa12d..70feb30432 100644 --- a/engines/titanic/pet_control/pet_control_list_item2.h +++ b/engines/titanic/pet_control/pet_control_list_item2.h @@ -23,11 +23,11 @@ #ifndef TITANIC_PET_CONTROL_LIST_ITEM2_H #define TITANIC_PET_CONTROL_LIST_ITEM2_H -#include "titanic/pet_control/pet_control_list_item.h" +#include "titanic/pet_control/pet_glyphs.h" namespace Titanic { -class CPetControlListItem2 : public CPetControlListItem { +class CPetControlListItem2 : public CPetGlyph { protected: int _field34; int _field38; diff --git a/engines/titanic/pet_control/pet_control_sub10.cpp b/engines/titanic/pet_control/pet_control_sub10.cpp deleted file mode 100644 index a50ad115c4..0000000000 --- a/engines/titanic/pet_control/pet_control_sub10.cpp +++ /dev/null @@ -1,52 +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 "common/textconsole.h" -#include "titanic/pet_control/pet_control_sub10.h" - -namespace Titanic { - -CPetControlSub10::CPetControlSub10() : _field10(0), _field14(7), - _field18(-1), _field1C(-1), _field20(0), _field24(0) { -} - -void CPetControlSub10::proc8() { - error("TODO"); -} - -void CPetControlSub10::setup() { - warning("TODO: CPetControlSub10::setup"); -} - -void CPetControlSub10::proc10() { - error("TODO"); -} - -void CPetControlSub10::proc11() { - error("TODO"); -} - -void CPetControlSub10::draw(CScreenManager *screenManager) { - warning("TODO: CPetControlSub10::draw"); -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub10.h b/engines/titanic/pet_control/pet_control_sub10.h deleted file mode 100644 index ef8d02f95c..0000000000 --- a/engines/titanic/pet_control/pet_control_sub10.h +++ /dev/null @@ -1,67 +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_SUB10_H -#define TITANIC_PET_CONTROL_SUB10_H - -#include "titanic/core/list.h" -#include "titanic/pet_control/pet_control_sub10.h" -#include "titanic/pet_control/pet_control_list_item.h" -#include "titanic/support/screen_manager.h" - -namespace Titanic { - -class CPetControlSub10 : public List { -protected: - int _field10; - int _field14; - int _field18; - int _field1C; - int _field20; - int _field24; - CPetGfxElement _selection; - CPetGfxElement _scrollLeft; - CPetGfxElement _scrollRight; -public: - CPetControlSub10(); - - virtual void proc8(); - - /** - * Set up the control - */ - virtual void setup(); - - virtual void proc10(); - virtual void proc11(); - - void set20(int val) { _field20 = val; } - - /** - * Draw the control - */ - void draw(CScreenManager *screenManager); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB10_H */ diff --git a/engines/titanic/pet_control/pet_control_sub11.h b/engines/titanic/pet_control/pet_control_sub11.h index ebad13bff5..e3f8c3d493 100644 --- a/engines/titanic/pet_control/pet_control_sub11.h +++ b/engines/titanic/pet_control/pet_control_sub11.h @@ -23,11 +23,11 @@ #ifndef TITANIC_PET_CONTROL_SUB11_H #define TITANIC_PET_CONTROL_SUB11_H -#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_glyphs.h" namespace Titanic { -class CPetControlSub11 : public CPetControlSub10 { +class CPetControlSub11 : public CPetGlyphs { public: }; diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 6ea844a3d7..89eb692a7e 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -38,7 +38,7 @@ bool CPetInventory::setup(CPetControl *petControl) { } bool CPetInventory::setup() { - _sub10.setup(); + _items.setup(); _sub12.setup(); // TODO @@ -47,7 +47,7 @@ bool CPetInventory::setup() { void CPetInventory::draw(CScreenManager *screenManager) { _petControl->drawIndent(screenManager, 7); - _sub10.draw(screenManager); + _items.draw(screenManager); _sub12.draw(screenManager); } @@ -79,8 +79,8 @@ bool CPetInventory::setPetControl(CPetControl *petControl) { return false; _petControl = petControl; - _sub10.proc8(); - _sub10.set20(28); + _items.proc8(); + _items.set20(28); Rect tempRect(0, 0, 52, 52); for (uint idx = 0; idx < TOTAL_ITEMS; ++idx) { @@ -103,6 +103,10 @@ bool CPetInventory::setPetControl(CPetControl *petControl) { } void CPetInventory::addItem(CCarry *item) { + if (item) { + CPetCarry glyphItem(item, 2); + + } warning("TODO: CPetInventory::addItem"); } @@ -110,4 +114,20 @@ void CPetInventory::itemRemoved(CCarry *item) { warning("TODO: CPetInventory::itemRemoved"); } +void CPetInventory::fn3(CCarry *item) { + warning("TODO: CPetInventory::fn3"); +} + +void CPetInventory::itemsChanged() { + _items.clear(); + + //CGameObject *item = static_cast(_petControl->getFirstObject()); + + +} + +void CPetInventory::couldntShowInventory(CCarry *item) { + +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 8f40200dfa..4a08c1c0b2 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -25,7 +25,7 @@ #include "titanic/support/simple_file.h" #include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_inventory_glyphs.h" #include "titanic/pet_control/pet_control_sub12.h" namespace Titanic { @@ -36,7 +36,7 @@ namespace Titanic { class CPetInventory : public CPetSection { private: CPetControlSub12 _sub12; - CPetControlSub10 _sub10; + CPetInventoryGlyphs _items; CGameObject *_itemBackgrounds[46]; CGameObject *_itemGlyphs[46]; int _field28C; @@ -100,6 +100,18 @@ public: * Called when an item has been removed from the PET */ void itemRemoved(CCarry *item); + + void fn3(CCarry *item); + + /** + * Called when the items under the PET have changed + */ + void itemsChanged(); + + /** + * Called when the inventory can't be shown after adding an item + */ + void couldntShowInventory(CCarry *item); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.cpp b/engines/titanic/pet_control/pet_inventory_glyphs.cpp new file mode 100644 index 0000000000..6fc58ff2ad --- /dev/null +++ b/engines/titanic/pet_control/pet_inventory_glyphs.cpp @@ -0,0 +1,68 @@ +/* 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 "common/textconsole.h" +#include "titanic/pet_control/pet_inventory_glyphs.h" + +namespace Titanic { + +CPetInventoryGlyphs::CPetInventoryGlyphs() : _field10(0), _field14(7), + _field18(-1), _field1C(-1), _field20(0), _field24(0) { +} + +void CPetInventoryGlyphs::proc8() { + error("TODO"); +} + +void CPetInventoryGlyphs::setup() { + warning("TODO: CPetInventoryGlyphs::setup"); +} + +void CPetInventoryGlyphs::proc10() { + error("TODO"); +} + +void CPetInventoryGlyphs::proc11() { + error("TODO"); +} + +void CPetInventoryGlyphs::draw(CScreenManager *screenManager) { + warning("TODO: CPetInventoryGlyphs::draw"); +} + +void CPetInventoryGlyphs::addItem(CPetCarry *item) { + + + warning("TODO"); +} + +void CPetInventoryGlyphs::clear() { + fn1(-1); + destroyContents(); + _field10 = 0; +} + +void CPetInventoryGlyphs::fn1(int val) { + warning("TODO: CPetInventoryGlyphs::fn1"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.h b/engines/titanic/pet_control/pet_inventory_glyphs.h new file mode 100644 index 0000000000..f8d4d7f2fa --- /dev/null +++ b/engines/titanic/pet_control/pet_inventory_glyphs.h @@ -0,0 +1,97 @@ +/* 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_INVENTORY_GLYPHS_H +#define TITANIC_PET_INVENTORY_GLYPHS_H + +#include "titanic/pet_control/pet_glyphs.h" +#include "titanic/support/screen_manager.h" + +namespace Titanic { + +class CPetInventoryGlyph : public CPetGlyph { +public: + CCarry *_item; + int _field34; + int _field38; + int _field3C; + int _field40; +public: + CPetInventoryGlyph(CCarry *item, int val) : _item(item), + _field34(val), _field38(0), _field3C(0), _field40(0) {} +}; + +class CPetCarry { +public: + int _val; + CCarry *_item; +public: + CPetCarry(CCarry *item, int val) : _item(item), _val(val) {} +}; + +class CPetInventoryGlyphs : public CPetGlyphs { +private: + void fn1(int val); +protected: + int _field10; + int _field14; + int _field18; + int _field1C; + int _field20; + int _field24; + CPetGfxElement _selection; + CPetGfxElement _scrollLeft; + CPetGfxElement _scrollRight; +public: + CPetInventoryGlyphs(); + + virtual void proc8(); + + /** + * Set up the control + */ + virtual void setup(); + + virtual void proc10(); + virtual void proc11(); + + void set20(int val) { _field20 = val; } + + /** + * Draw the control + */ + void draw(CScreenManager *screenManager); + + /** + * Add a new item to the list + */ + void addItem(CPetCarry *item); + + /** + * Clears the glyph list + */ + void clear(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_INVENTORY_GLYPHS_H */ diff --git a/engines/titanic/pet_control/pet_remote.h b/engines/titanic/pet_control/pet_remote.h index 410a5ff961..953f012e67 100644 --- a/engines/titanic/pet_control/pet_remote.h +++ b/engines/titanic/pet_control/pet_remote.h @@ -24,15 +24,18 @@ #define TITANIC_PET_REMOTE_H #include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_glyphs.h" #include "titanic/pet_control/pet_control_sub12.h" #include "titanic/pet_control/pet_gfx_element.h" namespace Titanic { +class CPetRemoteGlyphs : public CPetGlyphs { +}; + class CPetRemote : public CPetSection { private: - CPetControlSub10 _sub10; + CPetRemoteGlyphs _items; CPetGfxElement _val1; CPetGfxElement _val2; CPetGfxElement _val3; diff --git a/engines/titanic/pet_control/pet_saves.h b/engines/titanic/pet_control/pet_saves.h index f11eef693d..d100e8f702 100644 --- a/engines/titanic/pet_control/pet_saves.h +++ b/engines/titanic/pet_control/pet_saves.h @@ -24,15 +24,18 @@ #define TITANIC_PET_SAVES_H #include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_glyphs.h" #include "titanic/pet_control/pet_control_sub12.h" namespace Titanic { +class CPetSaveGlyphs : public CPetGlyphs { +}; + class CPetSaves : public CPetSection { private: - CPetControlSub10 _sub10; - CPetControlSub10 _sub12; + CPetSaveGlyphs _sub10; + CPetSaveGlyphs _sub12; public: /** * Returns true if the object is in a valid state -- cgit v1.2.3