r61 - in trunk/src: . objects

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Oct 1 12:09:36 EDT 2004


Author: jonas
Date: 2004-10-01 12:09:36 -0400 (Fri, 01 Oct 2004)
New Revision: 61

Modified:
   trunk/src/objects/baleog.cpp
   trunk/src/objects/fang.cpp
   trunk/src/objects/fang.h
   trunk/src/objects_common.h
   trunk/src/players_common.cpp
   trunk/src/players_common.h
Log:
added fang's claw attack, reset the states before starting a player event, baleog can attack anytime

Modified: trunk/src/objects/baleog.cpp
===================================================================
--- trunk/src/objects/baleog.cpp	2004-10-01 14:42:56 UTC (rev 60)
+++ trunk/src/objects/baleog.cpp	2004-10-01 16:09:36 UTC (rev 61)
@@ -26,6 +26,7 @@
 Baleog::~Baleog() {
     delete im_left;
     delete im_land_left;
+    delete im_sword_left;
 }
 
 //Baleog1: Sword attack
@@ -33,7 +34,5 @@
     if (dt < 0) return;
     input->unsetState(INPUT_SP1);
 
-    if (!(state&STATE_FALL)) {
-        setEvent(new EAttack(this,10,&weapon,(state&STATE_LEFT) ? DIR_LEFT : DIR_RIGHT,5,enemy_types,0,0,au_sword,(state&STATE_LEFT) ? im_sword_left : im_sword_right));
-    }
+    setEvent(new EAttack(this,10,&weapon,(state&STATE_LEFT) ? DIR_LEFT : DIR_RIGHT,5,enemy_types,0,0,au_sword,(state&STATE_LEFT) ? im_sword_left : im_sword_right));
 }

Modified: trunk/src/objects/fang.cpp
===================================================================
--- trunk/src/objects/fang.cpp	2004-10-01 14:42:56 UTC (rev 60)
+++ trunk/src/objects/fang.cpp	2004-10-01 16:09:36 UTC (rev 61)
@@ -10,6 +10,7 @@
 Fang::Fang(string imagename, Sint16 xcord, Sint16 ycord, string pname):
   Player(imagename,xcord,ycord,pname),
   jump(V_JUMP) {
+    weapon=Weapon(-1,W_STRIKE);
     im_left=new Animation(imgcache->loadImage("olaf_left.bmp"));
     im_right=new Animation(imgcache->loadImage("olaf_right.bmp"));
     im_fall_left=im_left;
@@ -18,13 +19,17 @@
     im_krit_right=im_right;
     im_land_left=new Animation(imgcache->loadImage("olaf_land.bmp"),1,T_IRR,true);
     im_land_right=im_land_left;
+    im_claw_left=new Animation(60,imgcache->loadImage("kuru.bmp"),12,500,true);
+    im_claw_right=im_claw_left;
     au_hit=sndcache->loadWAV("wolfhit.wav");
-    au_jump=NULL;
+    au_claw=sndcache->loadWAV("wolfjmp1.wav");
+    au_jump=sndcache->loadWAV("fangjump.wav");
 }
 Fang::~Fang() {
     delete im_left;
     delete im_right;
     delete im_land_left;
+    delete im_claw_left;
 }
 
 void Fang::in_left(Sint16 dt) {
@@ -75,6 +80,13 @@
     }
 }
 
+void Fang::in_sp2(Sint16 dt) {
+    if (dt < 0) return;
+    input->unsetState(INPUT_SP2);
+
+    setEvent(new EAttack(this,10,&weapon,(state&STATE_LEFT) ? DIR_LEFT : DIR_RIGHT,5,enemy_types,0,0,au_claw,(state&STATE_LEFT) ? im_claw_left : im_claw_right));
+}
+
 void Fang::crash(Uint16 dir) {
     Player::crash(dir);
     switch (dir) {

Modified: trunk/src/objects/fang.h
===================================================================
--- trunk/src/objects/fang.h	2004-10-01 14:42:56 UTC (rev 60)
+++ trunk/src/objects/fang.h	2004-10-01 16:09:36 UTC (rev 61)
@@ -29,9 +29,14 @@
         virtual void in_right(Sint16);
         /// \brief Fang jumps
         virtual void in_sp1(Sint16);
+        /// \brief Fang attacks
+        virtual void in_sp2(Sint16);
         virtual void clearStates(bool reset=false);
     private:
         virtual void crash(Uint16 dir=DIR_DOWN);
+        Animation* im_claw_left;
+        Animation* im_claw_right;
         Mix_Chunk* au_jump;
+        Mix_Chunk* au_claw;
         Sint16 jump;
 };

Modified: trunk/src/objects_common.h
===================================================================
--- trunk/src/objects_common.h	2004-10-01 14:42:56 UTC (rev 60)
+++ trunk/src/objects_common.h	2004-10-01 16:09:36 UTC (rev 61)
@@ -133,7 +133,7 @@
         void clearEvents();
         /// Schedules a new event and cancels any currently running event
         /// \param ev New event
-        void setEvent(Event* ev);
+        virtual void setEvent(Event* ev);
         /// Updates the event (run by the AnimHandler) and react on the new event
         /// state (start, end or cancel an event).
         /// \return New event state

Modified: trunk/src/players_common.cpp
===================================================================
--- trunk/src/players_common.cpp	2004-10-01 14:42:56 UTC (rev 60)
+++ trunk/src/players_common.cpp	2004-10-01 16:09:36 UTC (rev 61)
@@ -132,6 +132,11 @@
     }
 }
 
+void Player::setEvent(Event* ev) {
+    clearStates();
+    Character::setEvent(ev);
+}
+
 void Player::updateAnimState(bool change) {
     if (!change) {
     } else if (state&STATE_LEFT) {

Modified: trunk/src/players_common.h
===================================================================
--- trunk/src/players_common.h	2004-10-01 14:42:56 UTC (rev 60)
+++ trunk/src/players_common.h	2004-10-01 16:09:36 UTC (rev 61)
@@ -63,6 +63,7 @@
         /// Removes all interactively initiated events and states
         /// \param reset If true reset the states of this player
         virtual void clearStates(bool reset=false);
+        virtual void setEvent(Event* ev);
         //@}
         //Input methods
         //@{




More information about the lostpenguins-commits mailing list