ScummVM API documentation
pet_rooms_glyphs.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 TITANIC_PET_ROOMS_GLYPHS_H
23 #define TITANIC_PET_ROOMS_GLYPHS_H
24 
25 #include "titanic/pet_control/pet_glyphs.h"
26 #include "titanic/game_location.h"
27 
28 namespace Titanic {
29 
30 class SimpleFile;
31 
32 enum RoomGlyphMode {
33  RGM_UNASSIGNED = 0, RGM_ASSIGNED_ROOM = 1, RGM_PREV_ASSIGNED_ROOM = 2
34 };
35 
36 class CPetRoomsGlyph : public CPetGlyph {
37 private:
38  uint _roomFlags;
39  uint _mailFlag;
40  RoomGlyphMode _mode;
41  CGameObject *_chevLeftOnDim;
42  CGameObject *_chevLeftOffDim;
43  CGameObject *_chevLeftOnLit;
44  CGameObject *_chevLeftOffLit;
45  CGameObject *_chevRightOnDim;
46  CGameObject *_chevRightOffDim;
47  CGameObject *_chevRightOnLit;
48  CGameObject *_chevRightOffLit;
49 private:
54  int getSelection(const Point &topLeft, const Point &pt);
55 
59  void drawObjects(uint flags, const Point &pt, CScreenManager *screenManager);
60 public:
62  CPetRoomsGlyph(uint flags);
63 
67  bool setup(CPetControl *petControl, CPetGlyphs *owner) override;
68 
72  void drawAt(CScreenManager *screenManager, const Point &pt, bool isHighlighted) override;
73 
77  void draw2(CScreenManager *screenManager) override {}
78 
82  void selectGlyph(const Point &topLeft, const Point &pt) override;
83 
87  bool dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg) override;
88 
92  void getTooltip(CTextControl *text) override;
93 
97  void saveGlyph(SimpleFile *file, int indent) override;
98 
99  bool proc33(CPetGlyph *glyph) override;
100 
104  virtual void loadFlags(SimpleFile *file, int val);
105 
109  void setRoomFlags(uint flags) { _roomFlags = flags; }
110 
114  uint getRoomFlags() const { return _roomFlags; }
115 
119  void setFlag(uint val) { _mailFlag = val; }
120 
124  void setMode(RoomGlyphMode mode) { _mode = mode; }
125 
129  void changeClass(PassengerClass newClassNum);
130 
134  bool isAssigned() const { return _mode != RGM_UNASSIGNED; }
135 
139  bool isCurrentlyAssigned() const { return _mode == RGM_ASSIGNED_ROOM; }
140 
144  bool isPreviouslyAssigned() const { return _mode == RGM_PREV_ASSIGNED_ROOM; }
145 };
146 
147 class CPetRoomsGlyphs : public CPetGlyphs {
148 private:
149 public:
153  void saveGlyphs(SimpleFile *file, int indent);
154 
158  CPetRoomsGlyph *findAssignedRoom() const;
159 
163  CPetRoomsGlyph *findGlyphByFlags(uint flags) const;
164 
168  bool hasFlags(uint flags) const { return findGlyphByFlags(flags) != nullptr; }
169 };
170 
171 } // End of namespace Titanic
172 
173 #endif /* TITANIC_PET_ROOMS_GLYPHS_H */
Definition: mouse_messages.h:150
Definition: text_control.h:35
void saveGlyph(SimpleFile *file, int indent) override
bool dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg) override
bool isAssigned() const
Definition: pet_rooms_glyphs.h:134
uint getRoomFlags() const
Definition: pet_rooms_glyphs.h:114
bool isCurrentlyAssigned() const
Definition: pet_rooms_glyphs.h:139
virtual void loadFlags(SimpleFile *file, int val)
void draw2(CScreenManager *screenManager) override
Definition: pet_rooms_glyphs.h:77
void selectGlyph(const Point &topLeft, const Point &pt) override
Definition: simple_file.h:49
bool isHighlighted() const
void setFlag(uint val)
Definition: pet_rooms_glyphs.h:119
Definition: screen_manager.h:49
Definition: pet_rooms_glyphs.h:36
Definition: game_object.h:79
bool isPreviouslyAssigned() const
Definition: pet_rooms_glyphs.h:144
Definition: pet_glyphs.h:53
void getTooltip(CTextControl *text) override
void changeClass(PassengerClass newClassNum)
Definition: rect.h:45
Definition: arm.h:30
Definition: pet_rooms_glyphs.h:147
Definition: pet_glyphs.h:244
void setRoomFlags(uint flags)
Definition: pet_rooms_glyphs.h:109
void setMode(RoomGlyphMode mode)
Definition: pet_rooms_glyphs.h:124
bool hasFlags(uint flags) const
Definition: pet_rooms_glyphs.h:168
void drawAt(CScreenManager *screenManager, const Point &pt, bool isHighlighted) override
Definition: pet_control.h:45
bool setup(CPetControl *petControl, CPetGlyphs *owner) override