File: dispnode.h

package info (click to toggle)
scummvm 2.9.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 450,580 kB
  • sloc: cpp: 4,299,825; asm: 28,322; python: 12,901; sh: 11,302; java: 9,289; xml: 7,895; perl: 2,639; ansic: 2,465; yacc: 1,670; javascript: 1,020; makefile: 933; lex: 578; awk: 275; objc: 82; sed: 11; php: 1
file content (131 lines) | stat: -rw-r--r-- 3,780 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *
 * Based on the original sources
 *   Faery Tale II -- The Halls of the Dead
 *   (c) 1993-1996 The Wyrmkeep Entertainment Co.
 */

#ifndef SAGA2_DISPNODE_H
#define SAGA2_DISPNODE_H

#include "saga2/idtypes.h"
#include "saga2/rect.h"

namespace Saga2 {

class GameObject;
struct TilePoint;
struct StaticTilePoint;

class Effectron;

enum nodeType {
	kNodeTypeObject = 0,
	kNodeTypeEffect
};


class DisplayNode {
	friend class    DisplayNodeList;
	friend class    SpellDisplayList;
	friend class    GameObject;
	friend ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos);

private:
	DisplayNode             *_nextDisplayed;         // pointer to next in display list
	int16                   _sortDepth;              // for sorting by depth
	GameObject              *_object;                // the object to display
	Point16                 _screenCoords;           // screen coordinates
	Rect16                  _hitBox;                 // hitbox for clicking this item
	uint8                   _flags;                  // various flags

	enum {
		kDisplayIndicator = (1 << 0)
	};

public:
	nodeType                _type;
	Effectron               *_efx;

	DisplayNode();

	void drawObject();
	void drawEffect();
	void updateObject(const int32 deltaTime);
	void updateEffect(const int32 deltaTime);
	TilePoint SpellPos();
};

/* ============================================================================ *
   Object Display List
 * ============================================================================ */

//  This class is used to form a list of objects to display on
//  the screen.

const int           kMaxDisplayed = 100;

class DisplayNodeList {
	friend ObjectID pickObject(const StaticPoint32 &mouse, StaticTilePoint &objPos);

public:
	uint16              _count;                  // number of entries in list
	DisplayNode         *_displayList;       // table of displayed objects
	static DisplayNode  *_head;              // head of list

	DisplayNodeList(uint16 newSize) {
		_displayList = (DisplayNode *)malloc(sizeof(DisplayNode) * newSize);
		init(newSize);
		_count = 0;
	}
	DisplayNodeList() {
		_displayList = (DisplayNode *)malloc(sizeof(DisplayNode) * kMaxDisplayed);
		init(kMaxDisplayed);
		_count = 0;
	}
	~DisplayNodeList() {
		free(_displayList);
	}

	void reset() {
		_count = 0;
		_head = NULL;
	}

	void  init(uint16 s);
	void  buildObjects(bool fromScratch);
	void  buildEffects(bool fromScratch);
	void  draw();
	void  updateOStates(const int32 deltaTime);
	void  updateEStates(const int32 deltaTime);
	bool  dissipated();
};

/* ============================================================================ *
   Function prototypes
 * ============================================================================ */

//  Enable or disable the center actor indicator
void setCenterActorIndicator(bool enabled);

} // end of namespace Saga2

#endif