r62 - in trunk/src: . objects
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Oct 1 14:28:10 EDT 2004
Author: jonas
Date: 2004-10-01 14:28:10 -0400 (Fri, 01 Oct 2004)
New Revision: 62
Modified:
trunk/src/characters_common.h
trunk/src/events.cpp
trunk/src/events.h
trunk/src/objects/eric.cpp
trunk/src/objects/eric.h
trunk/src/players_common.h
Log:
added eric's jump and run attack, rearranged some states
Modified: trunk/src/characters_common.h
===================================================================
--- trunk/src/characters_common.h 2004-10-01 16:09:36 UTC (rev 61)
+++ trunk/src/characters_common.h 2004-10-01 18:28:10 UTC (rev 62)
@@ -10,18 +10,24 @@
#define T_GRAV_EFFECT 10
#define T_AI_EFFECT 20
-//Character/Player states
+//Character states
//facing: either left or right (not left)
#define STATE_LEFT 0x00000001
//in water
-#define STATE_WATER 0x00000040
+#define STATE_WATER 0x00000004
//falling
-#define STATE_FALL 0x00000080
+#define STATE_FALL 0x00000008
//Common Triggers
-#define STATE_ACT_1 0x00000200
-#define STATE_ACT_2 0x00000400
-#define STATE_ACT_3 0x00000800
+#define STATE_ACT_1 0x00000010
+#define STATE_ACT_2 0x00000020
+#define STATE_ACT_3 0x00000040
+//Special states
+#define STATE_RUN 0x00000080
+#define STATE_PRESS_LR 0x00000100
+#define STATE_PRESS_UD 0x00000200
+
+
/** \brief Damagable, non static objects.
A character can get hit, can move and fall, can die, etc...
Modified: trunk/src/events.cpp
===================================================================
--- trunk/src/events.cpp 2004-10-01 16:09:36 UTC (rev 61)
+++ trunk/src/events.cpp 2004-10-01 18:28:10 UTC (rev 62)
@@ -144,7 +144,7 @@
ERun::ERun(Character* chr, Uint16 length, Sint16 inispeed, Sint16 ahspeed, Uint16 edelay, Uint32 switchstate, Mix_Chunk* esound, Animation* runanim, bool delanim):
- ESpeed(chr,length,0,ahspeed,edelay,switchstate,esound,runanim,delanim),
+ ESpeed(chr,length,0,ahspeed,edelay,(switchstate|STATE_PRESS_LR),esound,runanim,delanim),
ispeed(inispeed),
t_reset(0) {
charowner->setState(STATE_RUN);
Modified: trunk/src/events.h
===================================================================
--- trunk/src/events.h 2004-10-01 16:09:36 UTC (rev 61)
+++ trunk/src/events.h 2004-10-01 18:28:10 UTC (rev 62)
@@ -7,10 +7,6 @@
#define EV_END 0x00000008
#define EV_CANCEL 0x00000010
-/// \todo: This is already defined in eric's header, either remove it there or find
-/// a more intelligent way to deal with it.
-#define STATE_RUN 0x00400000
-
/** \brief Base class for events (non instantanious effects)
Organize effects that aren't instantanious. Updated by AnimHandler, usually
Modified: trunk/src/objects/eric.cpp
===================================================================
--- trunk/src/objects/eric.cpp 2004-10-01 16:09:36 UTC (rev 61)
+++ trunk/src/objects/eric.cpp 2004-10-01 18:28:10 UTC (rev 62)
@@ -2,6 +2,7 @@
#include "events.h"
#include "anim.h"
#include "input.h"
+#include "map.h"
#include "weapons.h"
#include "imgcache.h"
#include "sndcache.h"
@@ -13,6 +14,7 @@
Player(imagename,xcord,ycord,pname),
jump(V_JUMP),
jump2(V_JUMP2) {
+ weapon=Weapon(-1,W_PRESSURE,WS_PRESSURE);
im_left=new Animation(imgcache->loadImage("eric_left.bmp"));
im_right=new Animation(60,imgcache->loadImage("kuru.bmp"),12,1000);
im_fall_left=im_left;
@@ -90,6 +92,15 @@
Player::in_right(dt);
}
+void Eric::crash(Uint16 dir) {
+ if ((state&(STATE_PRESS_LR|STATE_ACT_2)) && (!(dir&DIR_DOWN))) {
+ std::set<Character *> targets=curmap->getCharactersIn(OTYPE_MONSTER,getCenter(),true,pos.w+1,dir);
+ ///\bug This might get the wrong target
+ if (!targets.empty()) (*targets.begin())->hit(dir,weapon);
+ }
+ Player::crash(dir);
+}
+
Uint16 Eric::hit(Uint16 dir, Weapon& weap) {
if (weap.getType()==W_WATER) {
cancelEvent();
Modified: trunk/src/objects/eric.h
===================================================================
--- trunk/src/objects/eric.h 2004-10-01 16:09:36 UTC (rev 61)
+++ trunk/src/objects/eric.h 2004-10-01 18:28:10 UTC (rev 62)
@@ -1,6 +1,5 @@
#include "players_common.h"
-#define STATE_RUN 0x00400000
#define V_JUMP -400
#define V_JUMP2 -500
#define DE_JUMP 200
@@ -22,6 +21,7 @@
virtual void in_sp2(Sint16);
virtual void in_left(Sint16);
virtual void in_right(Sint16);
+ virtual void crash(Uint16 dir);
virtual Uint16 hit(Uint16 direction,Weapon& weap);
private:
Mix_Chunk* au_jump;
Modified: trunk/src/players_common.h
===================================================================
--- trunk/src/players_common.h 2004-10-01 16:09:36 UTC (rev 61)
+++ trunk/src/players_common.h 2004-10-01 18:28:10 UTC (rev 62)
@@ -7,10 +7,10 @@
//Player states
//movement (while up/down/left/right key is pressed)
-#define STATE_MLEFT 0x00000004
-#define STATE_MRIGHT 0x00000008
-#define STATE_MUP 0x00000010
-#define STATE_MDOWN 0x00000020
+#define STATE_MLEFT 0x00000400
+#define STATE_MRIGHT 0x00000800
+#define STATE_MUP 0x00001000
+#define STATE_MDOWN 0x00002000
/** \brief Interactively controlled characters
More information about the lostpenguins-commits
mailing list