blob: d3ae3a1cd8a25b525ffc749a7c99e87a8d426d02 (
plain)
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
|
#ifndef GAME_SERVER_ENTITY_H
#define GAME_SERVER_ENTITY_H
#include <base/vmath.hpp>
/*
Class: Entity
Basic entity class.
*/
class ENTITY
{
private:
friend class GAMEWORLD; // thy these?
ENTITY *prev_entity;
ENTITY *next_entity;
ENTITY *prev_type_entity;
ENTITY *next_type_entity;
protected:
bool marked_for_destroy;
int id;
int objtype;
public:
ENTITY(int objtype);
virtual ~ENTITY();
ENTITY *typenext() { return next_type_entity; }
ENTITY *typeprev() { return prev_type_entity; }
/*
Function: destroy
Destorys the entity.
*/
virtual void destroy() { delete this; }
/*
Function: reset
Called when the game resets the map. Puts the entity
back to it's starting state or perhaps destroys it.
*/
virtual void reset() {}
/*
Function: tick
Called progress the entity to the next tick. Updates
and moves the entity to it's new state and position.
*/
virtual void tick() {}
/*
Function: tick_defered
Called after all entities tick() function has been called.
*/
virtual void tick_defered() {}
/*
Function: snap
Called when a new snapshot is being generated for a specific
client.
Arguments:
snapping_client - ID of the client which snapshot is
being generated. Could be -1 to create a complete
snapshot of everything in the game for demo
recording.
*/
virtual void snap(int snapping_client) {}
/*
Variable: proximity_radius
Contains the physical size of the entity.
*/
float proximity_radius;
/*
Variable: pos
Contains the current posititon of the entity.
*/
vec2 pos;
};
#endif
|