about summary refs log tree commit diff
path: root/src/game/server/entity.hpp
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-08-14 18:25:44 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-08-14 18:25:44 +0000
commita420eb543f8206730aebb80e60a625f7204694e4 (patch)
tree235971d38c917c1b97c512743db64c2fd23ffadc /src/game/server/entity.hpp
parent817f431377c7f1545621ff597c018b133651e991 (diff)
downloadzcatch-a420eb543f8206730aebb80e60a625f7204694e4.tar.gz
zcatch-a420eb543f8206730aebb80e60a625f7204694e4.zip
moved alot of stuff to their own cpp/hpp files
Diffstat (limited to 'src/game/server/entity.hpp')
-rw-r--r--src/game/server/entity.hpp83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/game/server/entity.hpp b/src/game/server/entity.hpp
new file mode 100644
index 00000000..d3ae3a1c
--- /dev/null
+++ b/src/game/server/entity.hpp
@@ -0,0 +1,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