DDraceNetwork Docs
entity.h
Go to the documentation of this file.
1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3#ifndef GAME_CLIENT_PREDICTION_ENTITY_H
4#define GAME_CLIENT_PREDICTION_ENTITY_H
5
6#include <base/vmath.h>
7
8#include <game/alloc.h>
9
10#include "gameworld.h"
11
13{
15
16private:
17 friend CGameWorld; // entity list handling
20
21protected:
24 int m_Id;
26
27public:
28 int GetId() const { return m_Id; }
29
30 CEntity(CGameWorld *pGameWorld, int Objtype, vec2 Pos = vec2(0, 0), int ProximityRadius = 0);
31 virtual ~CEntity();
32
33 std::vector<SSwitchers> &Switchers() { return m_pGameWorld->Switchers(); }
37 CTuningParams *GetTuning(int i) { return GameWorld()->GetTuning(i); }
38 class CCollision *Collision() { return GameWorld()->Collision(); }
41 const vec2 &GetPos() const { return m_Pos; }
42 float GetProximityRadius() const { return m_ProximityRadius; }
43
44 void Destroy() { delete this; }
45 virtual void PreTick() {}
46 virtual void Tick() {}
47 virtual void TickDeferred() {}
48
49 bool GameLayerClipped(vec2 CheckPos);
54
61 void Keep()
62 {
63 m_SnapTicks = 0;
64 m_MarkedForDestroy = false;
65 }
66
68 {
69 m_Id = -1;
70 m_pGameWorld = 0;
71 }
72};
73
74#endif
#define MACRO_ALLOC_HEAP()
Definition: alloc.h:21
Definition: collision.h:34
Definition: entity.h:13
virtual ~CEntity()
Definition: entity.cpp:33
float m_ProximityRadius
Definition: entity.h:50
class CCollision * Collision()
Definition: entity.h:38
CGameWorld * GameWorld()
Definition: entity.h:34
int GetId() const
Definition: entity.h:28
CEntity * m_pChild
Definition: entity.h:59
bool m_MarkedForDestroy
Definition: entity.h:23
std::vector< SSwitchers > & Switchers()
Definition: entity.h:33
virtual void PreTick()
Definition: entity.h:45
friend CGameWorld
Definition: entity.h:17
const vec2 & GetPos() const
Definition: entity.h:41
CEntity * m_pNextTypeEntity
Definition: entity.h:19
CGameWorld * m_pGameWorld
Definition: entity.h:22
CEntity * NextEntity()
Definition: entity.h:60
vec2 m_Pos
Definition: entity.h:51
CTuningParams * GetTuning(int i)
Definition: entity.h:37
CEntity * m_pParent
Definition: entity.h:58
virtual void TickDeferred()
Definition: entity.h:47
float GetProximityRadius() const
Definition: entity.h:42
int m_Layer
Definition: entity.h:53
int m_SnapTicks
Definition: entity.h:55
CTuningParams * TuningList()
Definition: entity.h:36
CEntity()
Definition: entity.h:67
CEntity * m_pPrevTypeEntity
Definition: entity.h:18
void Keep()
Definition: entity.h:61
int m_DestroyTick
Definition: entity.h:56
CEntity * TypeNext()
Definition: entity.h:39
virtual void Tick()
Definition: entity.h:46
CEntity * TypePrev()
Definition: entity.h:40
CTuningParams * Tuning()
Definition: entity.h:35
int m_LastRenderTick
Definition: entity.h:57
int m_Number
Definition: entity.h:52
int m_ObjType
Definition: entity.h:25
void Destroy()
Definition: entity.h:44
bool GameLayerClipped(vec2 CheckPos)
Definition: entity.cpp:39
int m_Id
Definition: entity.h:24
Definition: gameworld.h:17
CTuningParams * TuningList()
Definition: gameworld.h:103
CTuningParams * Tuning()
Definition: gameworld.cpp:319
std::vector< SSwitchers > & Switchers()
Definition: gameworld.h:61
CTuningParams * GetTuning(int i)
Definition: gameworld.h:104
CCollision * Collision()
Definition: gameworld.h:59
Definition: gamecore.h:41
vector2_base< float > vec2
Definition: vmath.h:158