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
29namespace Ultima {
30namespace Ultima8 {
31
32class ItemSorter;
33class CameraProcess;
34
38class GameMapGump : public Gump {
39protected:
40 ItemSorter *_displayList;
41
42public:
43 ENABLE_RUNTIME_CLASSTYPE()
44
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 bool getShowFootpads() {
89 return _showFootpads;
90 }
91 static void setShowFootpads(bool value) {
92 _showFootpads = value;
93 }
94 static int getGridlines() {
95 return _gridlines;
96 }
97 static void setGridlines(int gridlines) {
98 _gridlines = gridlines;
99 }
100
101 void RenderSurfaceChanged() override;
102
103protected:
104 bool _displayDragging;
105 uint32 _draggingShape;
106 uint32 _draggingFrame;
107 uint32 _draggingFlags;
108 Point3 _draggingPos;
109
110 static bool _highlightItems;
111 static bool _showFootpads;
112 static int _gridlines;
113};
114
115} // End of namespace Ultima8
116} // End of namespace Ultima
117
118#endif
Definition: stream.h:385
Definition: stream.h:77
Definition: game_map_gump.h:38
void PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) override
Overloadable method to Paint just this Gump (RenderSurface is relative to this)
uint16 TraceObjId(int32 mx, int32 my) override
Trace a click, and return ObjId.
void StopDraggingItem(Item *item, bool moved) override
bool GetLocationOfItem(uint16 itemid, int32 &gx, int32 &gy, int32 lerp_factor=256) override
bool StartDraggingItem(Item *item, int mx, int my) override
void DraggingItemLeftGump(Item *item) override
Called when an item that was being dragged over the gump left the gump.
void DropItem(Item *item, int mx, int my) override
bool DraggingItem(Item *item, int mx, int my) override
Definition: gump.h:46
Definition: item.h:42
Definition: item_sorter.h:36
Definition: render_surface.h:37
Definition: point3.h:30