diff options
author | Paul Gilbert | 2016-04-06 07:55:55 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-04-06 07:55:55 -0400 |
commit | 08ed54f6c9fd72313e759d494a0b92cace2218e8 (patch) | |
tree | 3900a8842e991b704999c9a9829f74f9841a63d9 | |
parent | cb2dc0c8c8ab5b73f1ea863105a514202513de35 (diff) | |
download | scummvm-rg350-08ed54f6c9fd72313e759d494a0b92cace2218e8.tar.gz scummvm-rg350-08ed54f6c9fd72313e759d494a0b92cace2218e8.tar.bz2 scummvm-rg350-08ed54f6c9fd72313e759d494a0b92cace2218e8.zip |
TITANIC: Beginnings of CProximity class
-rw-r--r-- | engines/titanic/core/game_object.cpp | 14 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 4 | ||||
-rw-r--r-- | engines/titanic/game/television.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/gfx/st_button.cpp | 18 | ||||
-rw-r--r-- | engines/titanic/gfx/st_button.h | 2 | ||||
-rw-r--r-- | engines/titanic/messages/messages.h | 2 | ||||
-rw-r--r-- | engines/titanic/module.mk | 1 | ||||
-rw-r--r-- | engines/titanic/support/proximity.cpp | 36 | ||||
-rw-r--r-- | engines/titanic/support/proximity.h | 62 |
9 files changed, 129 insertions, 14 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index d66fa58cb4..c855fd9030 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -395,4 +395,18 @@ int CGameObject::getSurface45() const { return _surface ? _surface->proc45() : 0; } +void CGameObject::calcProximity(const CString &name, int val2, int val3, int val4) { + CProximity prox; + prox._field8 = val2; + prox._fieldC = val3; + prox._field20 = val4; + calcProximity(name, prox); +} + +void CGameObject::calcProximity(const CString &name, CProximity &prox) { + if (prox._field28 == 2) { + // TODO + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index d8d3a0be64..495fc8a2c9 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -24,6 +24,7 @@ #define TITANIC_GAME_OBJECT_H #include "titanic/support/mouse_cursor.h" +#include "titanic/support/proximity.h" #include "titanic/support/rect.h" #include "titanic/core/movie_clip.h" #include "titanic/core/named_item.h" @@ -54,6 +55,7 @@ private: void loadImage(const CString &name, bool pendingFlag = true); void processClipList2(); + void calcProximity(const CString &name, CProximity &obj6C); protected: Rect _bounds; double _field34; @@ -177,6 +179,8 @@ public: * Loads a frame */ void loadFrame(int frameNumber); + + void calcProximity(const CString &name, int val2, int val3, int val4); }; } // End of namespace Titanic diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index c11d446fe4..610a3f0596 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -164,9 +164,8 @@ bool CTelevision::handleMessage(CPETDownMsg &msg) { bool CTelevision::handleMessage(CStatusChangeMsg &msg) { if (_isOn) { stopMovie(); - changeStatus(1); + changeStatus(0); } - warning("TODO"); return true; } @@ -179,7 +178,6 @@ bool CTelevision::handleMessage(CActMsg &msg) { CStatusChangeMsg changeMsg; changeMsg.execute(this); } else { - // TODO: Should 5C be a boolean? setVisible(_isOn); stopMovie(); } diff --git a/engines/titanic/gfx/st_button.cpp b/engines/titanic/gfx/st_button.cpp index 0d17331477..387800430f 100644 --- a/engines/titanic/gfx/st_button.cpp +++ b/engines/titanic/gfx/st_button.cpp @@ -28,7 +28,7 @@ CSTButton::CSTButton() : CBackground() { _statusInc = 0; _statusTarget = "NULL"; _fieldF0 = 0; - _newStatus = 0; + _currentStatus = 0; _string4 = "NULL"; _string5 = "NULL"; _buttonFrame = 0; @@ -39,7 +39,7 @@ void CSTButton::save(SimpleFile *file, int indent) const { file->writeNumberLine(_statusInc, indent); file->writeQuotedLine(_statusTarget, indent); file->writeNumberLine(_fieldF0, indent); - file->writeNumberLine(_newStatus, indent); + file->writeNumberLine(_currentStatus, indent); file->writeQuotedLine(_string4, indent); file->writeQuotedLine(_string5, indent); file->writeNumberLine(_buttonFrame, indent); @@ -52,7 +52,7 @@ void CSTButton::load(SimpleFile *file) { _statusInc = file->readNumber(); _statusTarget = file->readString(); _fieldF0 = file->readNumber(); - _newStatus = file->readNumber(); + _currentStatus = file->readNumber(); _string4 = file->readString(); _string5 = file->readString(); _buttonFrame = file->readNumber() != 0; @@ -68,15 +68,15 @@ bool CSTButton::handleMessage(CMouseButtonDownMsg &msg) { } bool CSTButton::handleMessage(CMouseButtonUpMsg &msg) { - int value1 = _newStatus; - int value2 = _newStatus + _statusInc; + int oldStatus = _currentStatus; + int newStatus = _currentStatus + _statusInc; - CStatusChangeMsg statusMsg(value1, value2, 0); - _newStatus = value2; + CStatusChangeMsg statusMsg(oldStatus, newStatus, false); + _currentStatus = newStatus; statusMsg.execute(_statusTarget); - if (statusMsg._value3) { - _newStatus -= _statusInc; + if (!statusMsg._success) { + _currentStatus -= _statusInc; } return true; diff --git a/engines/titanic/gfx/st_button.h b/engines/titanic/gfx/st_button.h index 3e2ebe07a8..d613ad0eea 100644 --- a/engines/titanic/gfx/st_button.h +++ b/engines/titanic/gfx/st_button.h @@ -37,7 +37,7 @@ private: int _statusInc; CString _statusTarget; int _fieldF0; - int _newStatus; + int _currentStatus; CString _string4; CString _string5; int _buttonFrame; diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index b78fac481c..f4c16f5017 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -397,7 +397,7 @@ MESSAGE1(CShowTextMsg, CString, value, "NO TEXT INCLUDED!!!"); MESSAGE2(CSignalObject, CString, strValue, "", int, numValue, 0); MESSAGE2(CSpeechFallsFromTreeMsg, int, value1, 0, int, value2, 0); MESSAGE1(CStartMusicMsg, int, value, 0); -MESSAGE3(CStatusChangeMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE3(CStatusChangeMsg, int, oldStatus, 0, int, newStatus, 0, bool, success, false); MESSAGE1(CStopMusicMsg, int, value, 0); MESSAGE0(CSubDeliverCCarryMsg); MESSAGE0(CSubSendCCarryMsg); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index a29d3df10f..80abc1a760 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -431,6 +431,7 @@ MODULE_OBJS := \ support/image_decoders.o \ support/mouse_cursor.o \ support/movie.o \ + support/proximity.o \ support/rect.o \ support/screen_manager.o \ support/simple_file.o \ diff --git a/engines/titanic/support/proximity.cpp b/engines/titanic/support/proximity.cpp new file mode 100644 index 0000000000..f7c90f7caf --- /dev/null +++ b/engines/titanic/support/proximity.cpp @@ -0,0 +1,36 @@ +/* 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/support/proximity.h" + +namespace Titanic { + +CProximity::CProximity() : _field4(0), _field8(100), _fieldC(0), + _field10(-1), _field14(0), _field18(0), _field1C(0x3FF00000), + _field20(0), _field24(10), _field28(0), _field2C(0), + _field30(0x3F000000), _field34(0), _double1(0.0), _double2(0.0), + _double3(0.0), _field44(0), _field48(0), _field4C(0), + _field50(0), _field54(0), _field58(0), _field5C(0), + _field60(0), _field64(0), _field68(0) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/proximity.h b/engines/titanic/support/proximity.h new file mode 100644 index 0000000000..69979eaeaf --- /dev/null +++ b/engines/titanic/support/proximity.h @@ -0,0 +1,62 @@ +/* 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_PROXIMITY_H +#define TITANIC_PROXIMITY_H + +namespace Titanic { + +class CProximity { +public: + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; + int _field18; + int _field1C; + int _field20; + int _field24; + int _field28; + int _field2C; + int _field30; + int _field34; + double _double1; + double _double2; + double _double3; + int _field44; + int _field48; + int _field4C; + int _field50; + int _field54; + int _field58; + int _field5C; + int _field60; + int _field64; + int _field68; +public: + CProximity(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PROXIMITY_H */ |