1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef NANCY_ACTION_TELEPHONE_H
24 #define NANCY_ACTION_TELEPHONE_H
25 
26 #include "engines/nancy/commontypes.h"
27 #include "engines/nancy/renderobject.h"
28 
29 #include "engines/nancy/action/actionrecord.h"
30 
31 namespace Nancy {
32 namespace Action {
33 
34 class Telephone : public ActionRecord, public RenderObject {
35 public:
36 	struct PhoneCall {
37 		Common::Array<byte> phoneNumber; // 0x0, 11 bytes
38 		Common::String soundName; // 0xB
39 		Common::String text; // 0x15, 0xC8 bytes
40 		SceneChangeDescription sceneChange; // 0xDD
41 		// shouldStopRendering
42 		EventFlagDescription flag; // 0xE7
43 	};
44 
45 	enum CallState { kWaiting, kButtonPress, kRinging, kBadNumber, kCall, kHangUp };
46 
Telephone(RenderObject & redrawFrom)47 	Telephone(RenderObject &redrawFrom) :
48 		RenderObject(redrawFrom, 7),
49 		_callState(kWaiting),
50 		_selected(0) {}
~Telephone()51 	virtual ~Telephone() {}
52 
53 	virtual void init() override;
54 
55 	virtual void readData(Common::SeekableReadStream &stream) override;
56 	virtual void execute() override;
57 	virtual void handleInput(NancyInput &input) override;
58 
59 	Common::String _imageName; // 0x00
60 	Common::Array<Common::Rect> _srcRects; // 0xA, 12
61 	Common::Array<Common::Rect> _destRects; // 0xCA, 12
62 	SoundDescription _genericDialogueSound; // 0x18A
63 	SoundDescription _genericButtonSound; // 0x1AC
64 	SoundDescription _ringSound; // 0x1CE
65 	SoundDescription _dialToneSound; // 0x1F0
66 	SoundDescription _dialAgainSound; // 0x212
67 	SoundDescription _hangUpSound; // 0x234
68 	Common::Array<Common::String> _buttonSoundNames; // 0x256, 12 * 0xA
69 	Common::String _addressBookString; // 0x2CE, 0xC8 long
70 	Common::String _dialAgainString; // 0x396
71 	SceneChangeDescription _reloadScene; // 0x45E
72 	EventFlagDescription _flagOnReload; // 0x468 ??
73 	SceneChangeDescription _exitScene; // 0x46C
74 	EventFlagDescription _flagOnExit; // 0x476
75 	Common::Rect _exitHotspot; // 0x47A
76 	// 0x48A numConvos
77 	Common::Array<PhoneCall> _calls; // 0x48C
78 
79 	Common::Array<byte> _calledNumber;
80 	Graphics::ManagedSurface _image;
81 	CallState _callState;
82 	uint _selected;
83 
84 protected:
getRecordTypeName()85 	virtual Common::String getRecordTypeName() const override { return "Telephone"; }
isViewportRelative()86 	virtual bool isViewportRelative() const override { return true; }
87 
88 	void drawButton(uint id);
89 	void undrawButton(uint id);
90 };
91 
92 } // End of namespace Action
93 } // End of namespace Nancy
94 
95 #endif // NANCY_ACTION_TELEPHONE_H
96