r77 - trunk/src/objects
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Oct 15 08:09:33 EDT 2004
Author: jonas
Date: 2004-10-15 08:09:33 -0400 (Fri, 15 Oct 2004)
New Revision: 77
Added:
trunk/src/objects/spike.cpp
trunk/src/objects/spike.h
Log:
100l
Added: trunk/src/objects/spike.cpp
===================================================================
--- trunk/src/objects/spike.cpp 2004-10-06 11:22:14 UTC (rev 76)
+++ trunk/src/objects/spike.cpp 2004-10-15 12:09:33 UTC (rev 77)
@@ -0,0 +1,23 @@
+#include "common.h"
+#include "sndcache.h"
+#include "sfxeng.h"
+#include "weapons.h"
+#include "players_common.h"
+#include "monsters_common.h"
+#include "map.h"
+#include "spike.h"
+
+Spike::Spike(string imagename, Sint16 xcord, Sint16 ycord, Uint16 sdir, string oname):
+ Object(imagename,xcord,ycord,oname),
+ dir(sdir) {
+ weapon=Weapon(-10,W_TOUCH,WS_SPIKE);
+ otype|=(DIR_ALL&(~dir));
+}
+Spike::~Spike() { }
+
+void Spike::touch(Object* obj) {
+ if(Character* ptr = dynamic_cast<Character*>(obj)) {
+ Uint16 adir=(curmap->getDirection(getCenter(),ptr->getCenter()));
+ if (dir&adir) ptr->hit(adir,weapon);
+ }
+}
Added: trunk/src/objects/spike.h
===================================================================
--- trunk/src/objects/spike.h 2004-10-06 11:22:14 UTC (rev 76)
+++ trunk/src/objects/spike.h 2004-10-15 12:09:33 UTC (rev 77)
@@ -0,0 +1,14 @@
+#include "characters_common.h"
+
+/** \brief Regrowing plant
+
+*/
+class Spike : public Object {
+ public:
+ Spike(string imagename, Sint16 xpos=0, Sint16 ypos=0, Uint16 dir=DIR_UP, string name="Spike");
+ virtual ~Spike();
+ virtual void touch(Object*);
+ private:
+ Weapon weapon;
+ Uint16 dir;
+};
More information about the lostpenguins-commits
mailing list