ScummVM API documentation
dispnode.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  * Based on the original sources
22  * Faery Tale II -- The Halls of the Dead
23  * (c) 1993-1996 The Wyrmkeep Entertainment Co.
24  */
25 
26 #ifndef SAGA2_DISPNODE_H
27 #define SAGA2_DISPNODE_H
28 
29 #include "saga2/idtypes.h"
30 #include "saga2/rect.h"
31 
32 namespace Saga2 {
33 
34 class GameObject;
35 struct TilePoint;
36 struct StaticTilePoint;
37 
38 class Effectron;
39 
40 enum nodeType {
41  kNodeTypeObject = 0,
42  kNodeTypeEffect
43 };
44 
45 
46 class DisplayNode {
47  friend class DisplayNodeList;
48  friend class SpellDisplayList;
49  friend class GameObject;
50  friend ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos);
51 
52 private:
53  DisplayNode *_nextDisplayed; // pointer to next in display list
54  int16 _sortDepth; // for sorting by depth
55  GameObject *_object; // the object to display
56  Point16 _screenCoords; // screen coordinates
57  Rect16 _hitBox; // hitbox for clicking this item
58  uint8 _flags; // various flags
59 
60  enum {
61  kDisplayIndicator = (1 << 0)
62  };
63 
64 public:
65  nodeType _type;
66  Effectron *_efx;
67 
68  DisplayNode();
69 
70  void drawObject();
71  void drawEffect();
72  void updateObject(const int32 deltaTime);
73  void updateEffect(const int32 deltaTime);
74  TilePoint SpellPos();
75 };
76 
77 /* ============================================================================ *
78  Object Display List
79  * ============================================================================ */
80 
81 // This class is used to form a list of objects to display on
82 // the screen.
83 
84 const int kMaxDisplayed = 100;
85 
87  friend ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos);
88 
89 public:
90  uint16 _count; // number of entries in list
91  DisplayNode *_displayList; // table of displayed objects
92  static DisplayNode *_head; // head of list
93 
94  DisplayNodeList(uint16 newSize) {
95  _displayList = (DisplayNode *)malloc(sizeof(DisplayNode) * newSize);
96  init(newSize);
97  _count = 0;
98  }
99  DisplayNodeList() {
100  _displayList = (DisplayNode *)malloc(sizeof(DisplayNode) * kMaxDisplayed);
101  init(kMaxDisplayed);
102  _count = 0;
103  }
104  ~DisplayNodeList() {
105  free(_displayList);
106  }
107 
108  void reset() {
109  _count = 0;
110  _head = NULL;
111  }
112 
113  void init(uint16 s);
114  void buildObjects(bool fromScratch);
115  void buildEffects(bool fromScratch);
116  void draw();
117  void updateOStates(const int32 deltaTime);
118  void updateEStates(const int32 deltaTime);
119  bool dissipated();
120 };
121 
122 /* ============================================================================ *
123  Function prototypes
124  * ============================================================================ */
125 
126 // Enable or disable the center actor indicator
127 void setCenterActorIndicator(bool enabled);
128 
129 } // end of namespace Saga2
130 
131 #endif
Definition: speldefs.h:277
Definition: actor.h:32
Definition: tcoords.h:127
Definition: spelshow.h:333
Definition: tcoords.h:48
Definition: rect.h:42
Definition: objects.h:118
Definition: rect.h:140
Definition: rect.h:290
Definition: dispnode.h:86
Definition: dispnode.h:46