diff options
author | Paul Gilbert | 2016-03-29 22:57:22 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-03-29 22:57:22 -0400 |
commit | fe79317bdefe9594561cf45afe2ad476b1ac06ff (patch) | |
tree | 1ef25d5074e4c64ab0336187b197d4fe047b505b /engines/titanic | |
parent | a1e959b4986914bd42bdbd4587cdfc2bd57ca3a0 (diff) | |
download | scummvm-rg350-fe79317bdefe9594561cf45afe2ad476b1ac06ff.tar.gz scummvm-rg350-fe79317bdefe9594561cf45afe2ad476b1ac06ff.tar.bz2 scummvm-rg350-fe79317bdefe9594561cf45afe2ad476b1ac06ff.zip |
TITANIC: Beginnings of PET drawing
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 15 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 9 | ||||
-rw-r--r-- | engines/titanic/game/television.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/main_game_window.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control.cpp | 86 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control.h | 8 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control_sub8.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_control_sub8.h | 2 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_section.h | 10 |
9 files changed, 111 insertions, 27 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index ac02f62fb5..1cdc6cde92 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -301,21 +301,16 @@ void CGameObject::setVisible(bool val) { } } -bool CGameObject::petFn1(int val) { - CPetControl *pet = getPetControl(); - return pet ? pet->fn1(val) : true; -} - void CGameObject::petFn2(int val) { CPetControl *pet = getPetControl(); if (pet) pet->fn2(val); } -void CGameObject::petFn3(int val) { +void CGameObject::petFn3(CTreeItem *item) { CPetControl *pet = getPetControl(); if (pet) - pet->fn3(val); + pet->fn3(item); } void CGameObject::fn1(int val1, int val2, int val3) { @@ -362,4 +357,10 @@ bool CGameObject::checkStartDragging(CMouseDragStartMsg *msg) { } } +void CGameObject::setPetArea(PetArea newArea) const { + CPetControl *pet = getPetControl(); + if (pet) + pet->setArea(newArea); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 9a07cd1c98..3f12123d1b 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -27,6 +27,7 @@ #include "titanic/rect.h" #include "titanic/core/movie_clip.h" #include "titanic/core/named_item.h" +#include "titanic/pet_control/pet_section.h" namespace Titanic { @@ -109,12 +110,16 @@ protected: */ void makeDirty(); + /** + * Sets a new area in the PET + */ + void setPetArea(PetArea newArea) const; + bool soundFn1(int val); void soundFn2(int val, int val2); void setVisible(bool val); - bool petFn1(int val); void petFn2(int val); - void petFn3(int val); + void petFn3(CTreeItem *item); public: int _field60; CursorId _cursorId; diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index ffec1bcdb8..c11d446fe4 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -121,7 +121,7 @@ bool CTelevision::handleMessage(CChangeSeasonMsg &msg) { } bool CTelevision::handleMessage(CEnterViewMsg &msg) { - petFn1(2); + setPetArea(PET_REMOTE); petFn2(2); petFn3(0); setVisible(0); diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 0b0bb92921..6abe83bd3f 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -147,7 +147,7 @@ void CMainGameWindow::drawPet(CScreenManager *screenManager) { if (_gameView && _gameView->_surface) { CPetControl *petControl = _gameManager->_project->getPetControl(); if (petControl) - petControl->proc26(); + petControl->draw(screenManager); } } diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index db053ca517..9f24b4b040 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -81,8 +81,46 @@ void CPetControl::saveAreas(SimpleFile *file, int indent) const { _sub8.save(file, indent); } -void CPetControl::proc26() { - warning("TODO: CPetControl::proc26"); +void CPetControl::draw(CScreenManager *screenManager) { + CGameManager *gameManager = getGameManager(); + Rect bounds = _oldBounds; + bounds.constrain(gameManager->_bounds); + + if (!bounds.isEmpty()) { + if (_fieldC8 >= 0) { + _invSection.proc5(_fieldC8); + _fieldC8 = -1; + } + + _sub8.drawFrame(screenManager); + + // Draw the specific area that's currently active + switch (_currentArea) { + case PET_INVENTORY: + _invSection.draw(screenManager); + break; + case PET_CONVERSATION: + _convSection.draw(screenManager); + break; + case PET_REMOTE: + _remoteSection.draw(screenManager); + break; + case PET_ROOMS: + _roomsSection.draw(screenManager); + break; + case PET_SAVE: + _saveSection.draw(screenManager); + break; + case PET_5: + _sub5.draw(screenManager); + break; + case PET_6: + _sub7.draw(screenManager); + break; + default: + break; + } + } } void CPetControl::postLoad() { @@ -127,14 +165,6 @@ bool CPetControl::fn1(int val) { return false; } -void CPetControl::fn2(int val) { - warning("TODO: CPetControl::fn2"); -} - -void CPetControl::fn3(int val) { - warning("TODO: CPetControl::fn3"); -} - void CPetControl::fn4() { warning("TODO: CPetControl::fn4"); } @@ -207,4 +237,40 @@ PetArea CPetControl::setArea(PetArea newArea) { return newArea; } +void CPetControl::fn2(int val) { + switch (_currentArea) { + case PET_INVENTORY: + _invSection.proc38(val); + break; + case PET_CONVERSATION: + _convSection.proc38(val); + break; + case PET_REMOTE: + _remoteSection.proc38(val); + break; + case PET_ROOMS: + _roomsSection.proc38(val); + break; + case PET_SAVE: + _saveSection.proc38(val); + break; + case PET_5: + _sub5.proc38(val); + break; + case PET_6: + _sub7.proc38(val); + break; + default: + break; + } +} + +void CPetControl::fn3(CTreeItem *item) { + _treeItem2 = item; + if (item) + _string2 = item->getName(); + else + _string2.clear(); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 02a59fdd3a..fa21d4bf01 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -56,6 +56,7 @@ private: CTreeItem *_treeItem2; CString _string2; int _field13A4; + Rect _oldBounds; private: /** * Returns true if the control is in a valid state @@ -89,7 +90,10 @@ public: */ virtual void load(SimpleFile *file); - virtual void proc26(); + /** + * Allows the item to draw itself + */ + virtual void draw(CScreenManager *screenManager); /** * Called after loading a game has finished @@ -115,7 +119,7 @@ public: void fn2(int val); - void fn3(int val); + void fn3(CTreeItem *item); void fn4(); diff --git a/engines/titanic/pet_control/pet_control_sub8.cpp b/engines/titanic/pet_control/pet_control_sub8.cpp index bc577e3cdf..7d54b87b06 100644 --- a/engines/titanic/pet_control/pet_control_sub8.cpp +++ b/engines/titanic/pet_control/pet_control_sub8.cpp @@ -37,4 +37,8 @@ void CPetControlSub8::setArea(PetArea newArea) { warning("TODO: CPetControlSub8::setArea"); } +void CPetControlSub8::drawFrame(CScreenManager *screenManager) { + warning("TODO: CPetControlSub8::drawFrame"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub8.h b/engines/titanic/pet_control/pet_control_sub8.h index 20d260d13b..716a026eaf 100644 --- a/engines/titanic/pet_control/pet_control_sub8.h +++ b/engines/titanic/pet_control/pet_control_sub8.h @@ -43,6 +43,8 @@ public: CPetControlSub8(); void setArea(PetArea newArea); + + void drawFrame(CScreenManager *screenManager); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 4a1335281b..12e462640c 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -24,7 +24,6 @@ #define TITANIC_PET_SECTION_H #include "titanic/simple_file.h" -#include "titanic/core/room_item.h" namespace Titanic { @@ -33,6 +32,9 @@ enum PetArea { PET_ROOMS = 3, PET_SAVE = 4, PET_5 = 5, PET_6 = 6 }; +class CScreenManager; +class CRoomItem; + struct CPetSectionSubData { int _field0; int _field4; @@ -52,9 +54,9 @@ public: virtual int proc1() { return 0; } virtual int proc2() { return 0; } - virtual void proc3() {} + virtual void draw(CScreenManager *screenManager) {} virtual void proc4(); - virtual void proc5() {} + virtual void proc5(int val) {} virtual int proc6() { return 0; } virtual int proc7() { return 0; } virtual int proc8() { return 0; } @@ -117,7 +119,7 @@ public: virtual void proc35() {} virtual void proc36() {} virtual void proc37() {} - virtual void proc38() {} + virtual void proc38(int val) {} }; } // End of namespace Titanic |