ScummVM API documentation
game_map_gump.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 ULTIMA8_GUMPS_GAMEMAPGUMP_H
23 #define ULTIMA8_GUMPS_GAMEMAPGUMP_H
24 
25 #include "ultima/ultima8/gumps/gump.h"
26 #include "ultima/ultima8/misc/classtype.h"
27 #include "ultima/ultima8/misc/point3.h"
28 
29 namespace Ultima {
30 namespace Ultima8 {
31 
32 class ItemSorter;
33 class CameraProcess;
34 
38 class GameMapGump : public Gump {
39 protected:
40  ItemSorter *_displayList;
41 
42 public:
43  ENABLE_RUNTIME_CLASSTYPE()
44 
45  GameMapGump();
46  GameMapGump(int x, int y, int w, int h);
47  ~GameMapGump() override;
48 
49  void PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
50 
51  Point3 GetCameraLocation(int lerp_factor = 256);
52 
53  // Trace a click, and return ObjId (_parent coord space)
54  uint16 TraceObjId(int32 mx, int32 my) override;
55 
56  // Trace a click, return ObjId, and the coordinates of the mouse click (gump coord space)
57  virtual uint16 TraceCoordinates(int mx, int my, Point3 &coords,
58  int offsetx = 0, int offsety = 0,
59  Item *item = 0);
60 
61  // Get the location of an item in the gump (coords relative to this).
62  // Returns false on failure
63  bool GetLocationOfItem(uint16 itemid, int32 &gx, int32 &gy,
64  int32 lerp_factor = 256) override;
65 
66  bool StartDraggingItem(Item *item, int mx, int my) override;
67  bool DraggingItem(Item *item, int mx, int my) override;
68  void DraggingItemLeftGump(Item *item) override;
69  void StopDraggingItem(Item *item, bool moved) override;
70  void DropItem(Item *item, int mx, int my) override;
71 
72  Gump *onMouseDown(int button, int32 mx, int32 my) override;
73  void onMouseUp(int button, int32 mx, int32 my) override;
74  void onMouseClick(int button, int32 mx, int32 my) override;
75  void onMouseDouble(int button, int32 mx, int32 my) override;
76 
77  void IncSortOrder(int count);
78 
79  bool loadData(Common::ReadStream *rs, uint32 version);
80  void saveData(Common::WriteStream *ws) override;
81 
82  static void Set_highlightItems(bool highlight) {
83  _highlightItems = highlight;
84  }
85  static bool is_highlightItems() {
86  return _highlightItems;
87  }
88  static void toggleFootpads() {
89  _showFootpads = !_showFootpads;
90  }
91 
92  void RenderSurfaceChanged() override;
93 
94 protected:
95  bool _displayDragging;
96  uint32 _draggingShape;
97  uint32 _draggingFrame;
98  uint32 _draggingFlags;
99  Point3 _draggingPos;
100 
101  static bool _highlightItems;
102  static bool _showFootpads;
103 };
104 
105 } // End of namespace Ultima8
106 } // End of namespace Ultima
107 
108 #endif
Definition: stream.h:77
Definition: item.h:42
Definition: point3.h:28
void DropItem(Item *item, int mx, int my) override
bool StartDraggingItem(Item *item, int mx, int my) override
Definition: render_surface.h:40
Definition: gump.h:47
Definition: detection.h:27
bool GetLocationOfItem(uint16 itemid, int32 &gx, int32 &gy, int32 lerp_factor=256) override
void DraggingItemLeftGump(Item *item) override
Called when an item that was being dragged over the gump left the gump.
bool DraggingItem(Item *item, int mx, int my) override
Definition: item_sorter.h:36
uint16 TraceObjId(int32 mx, int32 my) override
Trace a click, and return ObjId.
void PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) override
Overloadable method to Paint just this Gump (RenderSurface is relative to this)
Definition: stream.h:385
Definition: game_map_gump.h:38
void StopDraggingItem(Item *item, bool moved) override