ScummVM API documentation
item_sorter.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_WORLD_ITEMSORTER_H
23 #define ULTIMA8_WORLD_ITEMSORTER_H
24 
25 #include "ultima/ultima8/misc/rect.h"
26 
27 namespace Ultima {
28 namespace Ultima8 {
29 
30 class MainShapeArchive;
31 class Item;
32 class RenderSurface;
33 struct SortItem;
34 struct Point3;
35 
36 class ItemSorter {
37  MainShapeArchive *_shapes;
38  Rect _clipWindow;
39 
40  SortItem *_items;
41  SortItem *_itemsTail;
42  SortItem *_itemsUnused;
43  SortItem *_painted;
44 
45  int32 _camSx, _camSy;
46  int32 _sortLimit;
47  bool _sortLimitChanged;
48 
49 public:
50  ItemSorter(int capacity);
51  ~ItemSorter();
52 
53  enum HitFace {
54  X_FACE, Y_FACE, Z_FACE
55  };
56 
57  // Begin creating the display list
58  void BeginDisplayList(const Rect &clipWindow, const Point3 &cam);
59 
60  void AddItem(const Point3 &pt, uint32 shape_num, uint32 frame_num, uint32 item_flags, uint32 ext_flags, uint16 item_num = 0);
61  void AddItem(const Item *); // Add an Item. SetupLerp() MUST have been called
62 
63  // Finishes the display list and Paints
64  void PaintDisplayList(RenderSurface *surf, bool item_highlight = false, bool showFootpads = false);
65 
66  // Trace and find an object. Returns objid.
67  // If face is non-NULL, also return the face of the 3d bbox (x,y) is on
68  uint16 Trace(int32 x, int32 y, HitFace *face = 0, bool item_highlight = false);
69 
70  void IncSortLimit(int count);
71 
72 private:
73  bool PaintSortItem(RenderSurface *surf, SortItem *si, bool showFootpad);
74 };
75 
76 } // End of namespace Ultima8
77 } // End of namespace Ultima
78 
79 #endif
Definition: rect.h:32
Definition: item.h:42
Definition: point3.h:28
Definition: main_shape_archive.h:36
Definition: render_surface.h:40
Definition: detection.h:27
Definition: item_sorter.h:36
Definition: sort_item.h:43