summaryrefslogtreecommitdiffstats
path: root/source/Entities/ProjectileEntity.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-22 08:55:58 +0200
committermadmaxoft <github@xoft.cz>2013-08-22 08:55:58 +0200
commit73afb1507d2a0defda8a03f60030dc49bb53f94f (patch)
treeb5a14bb289756f734a8cc7e949e660298167627c /source/Entities/ProjectileEntity.cpp
parentAnother fix for #31. (diff)
downloadcuberite-73afb1507d2a0defda8a03f60030dc49bb53f94f.tar
cuberite-73afb1507d2a0defda8a03f60030dc49bb53f94f.tar.gz
cuberite-73afb1507d2a0defda8a03f60030dc49bb53f94f.tar.bz2
cuberite-73afb1507d2a0defda8a03f60030dc49bb53f94f.tar.lz
cuberite-73afb1507d2a0defda8a03f60030dc49bb53f94f.tar.xz
cuberite-73afb1507d2a0defda8a03f60030dc49bb53f94f.tar.zst
cuberite-73afb1507d2a0defda8a03f60030dc49bb53f94f.zip
Diffstat (limited to '')
-rw-r--r--source/Entities/ProjectileEntity.cpp79
1 files changed, 79 insertions, 0 deletions
diff --git a/source/Entities/ProjectileEntity.cpp b/source/Entities/ProjectileEntity.cpp
new file mode 100644
index 000000000..93508e2f7
--- /dev/null
+++ b/source/Entities/ProjectileEntity.cpp
@@ -0,0 +1,79 @@
+
+// ProjectileEntity.cpp
+
+// Implements the cProjectileEntity class representing the common base class for projectiles, as well as individual projectile types
+
+#include "Globals.h"
+#include "ProjectileEntity.h"
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cProjectileEntity:
+
+cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, double a_Width, double a_Height) :
+ super(etProjectile, a_X, a_Y, a_Z, a_Width, a_Height),
+ m_Creator(a_Creator)
+{
+}
+
+
+
+
+
+cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, const Vector3d & a_Pos, const Vector3d & a_Speed, double a_Width, double a_Height) :
+ super(etProjectile, a_Pos.x, a_Pos.y, a_Pos.z, a_Width, a_Height),
+ m_Creator(a_Creator)
+{
+ SetSpeed(a_Speed);
+}
+
+
+
+
+
+cProjectileEntity * cProjectileEntity::Create(eKind a_Kind, cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d * a_Speed)
+{
+ Vector3d Speed;
+ if (a_Speed != NULL)
+ {
+ Speed = *a_Speed;
+ }
+
+ switch (a_Kind)
+ {
+ case pkArrow: return new cArrowEntity(a_Creator, a_X, a_Y, a_Z, Speed);
+ // TODO: the rest
+ }
+
+ LOGWARNING("%s: Unknown kind: %d", __FUNCTION__, a_Kind);
+ return NULL;
+}
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cArrowEntity:
+
+cArrowEntity::cArrowEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const Vector3d a_Speed) :
+ super(pkArrow, a_Creator, a_X, a_Y, a_Z, 0.5, 0.5)
+{
+ SetSpeed(a_Speed);
+}
+
+
+
+
+
+void cArrowEntity::SpawnOn(cClientHandle & a_Client)
+{
+ // TODO
+}
+
+
+
+