ScummVM API documentation
telephone.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef NANCY_ACTION_TELEPHONE_H
23 #define NANCY_ACTION_TELEPHONE_H
24 
25 #include "engines/nancy/action/actionrecord.h"
26 
27 namespace Nancy {
28 
29 class Font;
30 
31 namespace Action {
32 
33 class Telephone : public RenderActionRecord {
34 public:
35  struct PhoneCall {
36  Common::Array<byte> phoneNumber;
37  Common::String soundName;
38  Common::String text;
39  SceneChangeWithFlag sceneChange;
40 
41  // NewPhone members
42  int16 eventFlagCondition = -1;
43  Common::Rect displaySrc;
44  };
45 
46  enum CallState { kWaiting, kButtonPress, kRinging, kBadNumber, kPreCall, kCall, kHangUp };
47 
48  Telephone(bool isNewPhone) :
50  _callState(kWaiting),
51  _buttonLastPushed(-1),
52  _selected(-1),
53  _checkNumbers(false),
54  _font(nullptr),
55  _animIsStopped(false),
56  _isNewPhone(isNewPhone) {}
57  virtual ~Telephone() {}
58 
59  void init() override;
60 
61  void readData(Common::SeekableReadStream &stream) override;
62  void execute() override;
63  void handleInput(NancyInput &input) override;
64 
65 protected:
66  Common::String getRecordTypeName() const override { return _isNewPhone ? "NewPhone" : "Telephone"; }
67  bool isViewportRelative() const override { return true; }
68 
69  Common::Path _imageName;
71  Common::Array<Common::Rect> _destRects;
72  SoundDescription _genericDialogueSound;
73  SoundDescription _genericButtonSound;
74  SoundDescription _ringSound;
75  SoundDescription _dialToneSound;
76  SoundDescription _dialAgainSound;
77  SoundDescription _hangUpSound;
78  Common::Array<Common::String> _buttonSoundNames;
79  Common::String _addressBookString;
80  Common::String _dialAgainString;
81  SceneChangeWithFlag _reloadScene;
82  SceneChangeWithFlag _exitScene;
83  Common::Rect _exitHotspot;
85 
86  // NewPhone properties
87  bool _hasDisplay = false;
88  uint16 _displayFont = 0;
89  Common::Path _displayAnimName;
90  uint32 _displayAnimFrameTime = 0;
91  Common::Array<Common::Rect> _displaySrcs;
92  Common::Rect _displayDest;
93 
94  bool _dialAutomatically = true;
95 
96  Common::Rect _dirHighlightSrc;
97  Common::Rect _dialHighlightSrc;
98 
99  int16 _upDirButtonID = -1;
100  int16 _downDirButtonID = -1;
101  int16 _dialButtonID = -1;
102  int16 _dirButtonID = -1;
103 
104  Common::Rect _displayDialingSrc;
105 
106  SoundDescription _preCallSound;
107 
108  Common::Array<byte> _calledNumber;
110  Graphics::ManagedSurface _animImage;
111  CallState _callState;
112  int _buttonLastPushed;
113  int _selected;
114  bool _checkNumbers;
115  bool _animIsStopped;
116 
117  uint32 _displayAnimEnd = 0;
118  uint16 _displayAnimFrame = 0;
119  int16 _displayedDirectory = 0;
120  bool _isShowingDirectory = false;
121 
122  const Font *_font;
123 
124  bool _isNewPhone;
125 };
126 
127 } // End of namespace Action
128 } // End of namespace Nancy
129 
130 #endif // NANCY_ACTION_TELEPHONE_H
Definition: managed_surface.h:51
Definition: str.h:59
Definition: telephone.h:33
Definition: rect.h:144
Definition: path.h:52
Definition: stream.h:745
Definition: input.h:41
Definition: commontypes.h:171
Definition: actionrecord.h:149
Definition: telephone.h:35
Definition: commontypes.h:254
Definition: font.h:37
Definition: actionmanager.h:32