From DONOTREPLY at icculus.org Fri Oct 1 04:18:19 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 1 Oct 2004 04:18:19 -0400 Subject: r59 - trunk Message-ID: <20041001081819.637.qmail@icculus.org> Author: icculus Date: 2004-10-01 04:18:19 -0400 (Fri, 01 Oct 2004) New Revision: 59 Modified: trunk/TODO Log: Took my newline back out (testing email commit script...) Modified: trunk/TODO =================================================================== --- trunk/TODO 2004-10-01 08:15:06 UTC (rev 58) +++ trunk/TODO 2004-10-01 08:18:19 UTC (rev 59) @@ -105,4 +105,3 @@ o IDEA: add horizontal gravity that slows objects down?? - From DONOTREPLY at icculus.org Fri Oct 1 10:42:56 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 1 Oct 2004 10:42:56 -0400 Subject: r60 - branches tags Message-ID: <20041001144256.22339.qmail@icculus.org> Author: jonas Date: 2004-10-01 10:42:56 -0400 (Fri, 01 Oct 2004) New Revision: 60 Added: tags/initial-rel-0-1-2/ tags/rel-0-1-4/ tags/rel-0-1-5/ Removed: branches/LV/ branches/rel-0-1-4/ tags/LV_0_1_2_4/ Log: Cleanup old cvs stuff, released version 0.1.5 Copied: tags/initial-rel-0-1-2 (from rev 59, tags/LV_0_1_2_4) Copied: tags/rel-0-1-4 (from rev 59, branches/rel-0-1-4) Copied: tags/rel-0-1-5 (from rev 59, trunk) From DONOTREPLY at icculus.org Fri Oct 1 12:09:36 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 1 Oct 2004 12:09:36 -0400 Subject: r61 - in trunk/src: . objects Message-ID: <20041001160936.2649.qmail@icculus.org> 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 //@{ From DONOTREPLY at icculus.org Fri Oct 1 14:28:10 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 1 Oct 2004 14:28:10 -0400 Subject: r62 - in trunk/src: . objects Message-ID: <20041001182810.25150.qmail@icculus.org> 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 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 From DONOTREPLY at icculus.org Fri Oct 1 17:38:24 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 1 Oct 2004 17:38:24 -0400 Subject: r63 - trunk Message-ID: <20041001213824.22646.qmail@icculus.org> Author: jonas Date: 2004-10-01 17:38:24 -0400 (Fri, 01 Oct 2004) New Revision: 63 Removed: trunk/.cvsignore Log: removed .cvsignore Deleted: trunk/.cvsignore =================================================================== --- trunk/.cvsignore 2004-10-01 18:28:10 UTC (rev 62) +++ trunk/.cvsignore 2004-10-01 21:38:24 UTC (rev 63) @@ -1,2 +0,0 @@ -lost_penguins -slvextract From DONOTREPLY at icculus.org Fri Oct 1 17:56:11 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 1 Oct 2004 17:56:11 -0400 Subject: r64 - trunk/src Message-ID: <20041001215611.25280.qmail@icculus.org> Author: jonas Date: 2004-10-01 17:56:11 -0400 (Fri, 01 Oct 2004) New Revision: 64 Modified: trunk/src/characters_common.cpp Log: makes more sense... Modified: trunk/src/characters_common.cpp =================================================================== --- trunk/src/characters_common.cpp 2004-10-01 21:38:24 UTC (rev 63) +++ trunk/src/characters_common.cpp 2004-10-01 21:56:11 UTC (rev 64) @@ -76,7 +76,7 @@ void Character::idle(Uint16) { //check if we have ground below us... Hit hitobj; - hitobj=checkMove(pos); + hitobj=checkMove(pos,false,true); //are we falling? if ((!(hitobj.touch&DIR_DOWN)) || (gravity<0)) { @@ -111,7 +111,7 @@ addSpeed(Sint16(gravity*Dgrav/1000)); } Hit hit=move(Dgrav); - if ((hit.enter&DIR_DOWN || hit.touch&DIR_DOWN) && (state&STATE_FALL)) crash(DIR_DOWN); + if ((hit.enter&DIR_DOWN) && (state&STATE_FALL)) crash(DIR_DOWN); Dgrav=0; } } From DONOTREPLY at icculus.org Sat Oct 2 10:56:42 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Oct 2004 10:56:42 -0400 Subject: r65 - trunk/src Message-ID: <20041002145642.9317.qmail@icculus.org> Author: jonas Date: 2004-10-02 10:56:41 -0400 (Sat, 02 Oct 2004) New Revision: 65 Modified: trunk/src/players_common.cpp trunk/src/players_common.h Log: play error sound if an item couldn't be used Modified: trunk/src/players_common.cpp =================================================================== --- trunk/src/players_common.cpp 2004-10-01 21:56:11 UTC (rev 64) +++ trunk/src/players_common.cpp 2004-10-02 14:56:41 UTC (rev 65) @@ -34,6 +34,7 @@ im_land_right=animation; au_land=sndcache->loadWAV("dizzy.wav"); au_act=sndcache->loadWAV("button.wav"); + au_useerror=sndcache->loadWAV("useerror.wav"); au_newitem=sndcache->loadWAV("pickup.wav"); au_hit=sndcache->loadWAV("vikhit.wav"); au_elec=sndcache->loadWAV("elecdth.wav"); @@ -186,7 +187,9 @@ void Player::in_use(Sint16 dt) { if (dt < 0) return; input->unsetState(INPUT_USE); - if (items[currentitem]) items[currentitem]->act(this); + if (items[currentitem]) { + if (!(items[currentitem]->act(this))) sfxeng->playWAV(au_useerror); + } } void Player::in_right(Sint16 dt) { Modified: trunk/src/players_common.h =================================================================== --- trunk/src/players_common.h 2004-10-01 21:56:11 UTC (rev 64) +++ trunk/src/players_common.h 2004-10-02 14:56:41 UTC (rev 65) @@ -121,6 +121,7 @@ Mix_Chunk* au_hit; Mix_Chunk* au_land; Mix_Chunk* au_act; + Mix_Chunk* au_useerror; Mix_Chunk* au_newitem; Mix_Chunk* au_die; Mix_Chunk* au_elec; From DONOTREPLY at icculus.org Sat Oct 2 18:14:51 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Oct 2004 18:14:51 -0400 Subject: r66 - trunk/src Message-ID: <20041002221451.22013.qmail@icculus.org> Author: jonas Date: 2004-10-02 18:14:51 -0400 (Sat, 02 Oct 2004) New Revision: 66 Modified: trunk/src/anim.cpp trunk/src/characters_common.cpp trunk/src/events.cpp trunk/src/input.cpp trunk/src/input.h trunk/src/objectpools.h trunk/src/players_common.cpp trunk/src/players_common.h trunk/src/weapons.h Log: removed all player specific parts from the InputHandler, increased input state size to Uint32, minor improvements Modified: trunk/src/anim.cpp =================================================================== --- trunk/src/anim.cpp 2004-10-02 14:56:41 UTC (rev 65) +++ trunk/src/anim.cpp 2004-10-02 22:14:51 UTC (rev 66) @@ -87,6 +87,26 @@ tcurrent=SDL_GetTicks(); if (!paused) { + //released keys of player + if (player != NULL) { + if (input->getState(INPUTR_USE)) player->in_use(-1); + input->unsetState(INPUTR_USE); + if (input->getState(INPUTR_ACT)) player->in_act(-1); + input->unsetState(INPUTR_ACT); + if (input->getState(INPUTR_RIGHT)) player->in_right(-1); + input->unsetState(INPUTR_RIGHT); + if (input->getState(INPUTR_LEFT)) player->in_left(-1); + input->unsetState(INPUTR_LEFT); + if (input->getState(INPUTR_SP1)) player->in_sp1(-1); + input->unsetState(INPUTR_SP1); + if (input->getState(INPUTR_SP2)) player->in_sp2(-1); + input->unsetState(INPUTR_SP2); + if (input->getState(INPUTR_UP)) player->in_up(-1); + input->unsetState(INPUTR_UP); + if (input->getState(INPUTR_DOWN)) player->in_down(-1); + input->unsetState(INPUTR_DOWN); + input->unsetState(INPUTR_DEL); + } object_iterator obit=pool->objectspool.begin(); while (obit!=pool->objectspool.end()) { //remove marked objects @@ -100,7 +120,7 @@ (*obit)->updateEvents(dt); ++obit; } - //handle current player + //handle current (new) player if ((player!=NULL) && (!(player->getState(ESTATE_BUSY)))) { if (input->getState(INPUT_USE)) player->in_use(dt); if (input->getState(INPUT_ACT)) player->in_act(dt); Modified: trunk/src/characters_common.cpp =================================================================== --- trunk/src/characters_common.cpp 2004-10-02 14:56:41 UTC (rev 65) +++ trunk/src/characters_common.cpp 2004-10-02 22:14:51 UTC (rev 66) @@ -79,7 +79,7 @@ hitobj=checkMove(pos,false,true); //are we falling? - if ((!(hitobj.touch&DIR_DOWN)) || (gravity<0)) { + if ((!(hitobj.touch&DIR_DOWN)) || (gravity<0) || (speed<0)) { setState(STATE_FALL); } } Modified: trunk/src/events.cpp =================================================================== --- trunk/src/events.cpp 2004-10-02 14:56:41 UTC (rev 65) +++ trunk/src/events.cpp 2004-10-02 22:14:51 UTC (rev 66) @@ -57,7 +57,7 @@ anim(runanim), del(delanim), sound(asound) { - state|=ESTATE_ANIM; + if (anim) state|=ESTATE_ANIM; if (anim!=NULL) duration=30000; } Uint16 AnimEvent::update(Uint16 dt) { @@ -96,7 +96,7 @@ anim(runanim), del(delanim), sound(asound) { - state|=ESTATE_ANIM; + if (anim) state|=ESTATE_ANIM; if (anim!=NULL) duration=30000; } Uint16 CAnimEvent::update(Uint16 dt) { Modified: trunk/src/input.cpp =================================================================== --- trunk/src/input.cpp 2004-10-02 14:56:41 UTC (rev 65) +++ trunk/src/input.cpp 2004-10-02 22:14:51 UTC (rev 66) @@ -6,9 +6,7 @@ #include "gfxeng.h" #include "sfxeng.h" #include "objectpools.h" -///\todo The player calls should be in anim.cpp #include "objects_common.h" -#include "players_common.h" InputHandler::InputHandler(): @@ -38,32 +36,32 @@ case SDL_KEYUP: { switch(event.key.keysym.sym) { case SDLK_LEFT: { - if (state&INPUT_LEFT) player->in_left(-1); + if (state&INPUT_LEFT) setState(INPUTR_LEFT); state&=~INPUT_LEFT; break; } case SDLK_RIGHT: { - if (state&INPUT_RIGHT) player->in_right(-1); + if (state&INPUT_RIGHT) state|=INPUTR_RIGHT; state&=~INPUT_RIGHT; break; } case SDLK_UP: { - if (state&INPUT_UP) player->in_up(-1); + if (state&INPUT_UP) setState(INPUTR_UP); state&=~INPUT_UP; break; } case SDLK_DOWN: { - if (state&INPUT_DOWN) player->in_down(-1); + if (state&INPUT_DOWN) setState(INPUTR_DOWN); state&=~INPUT_DOWN; break; } case SDLK_SPACE: { - if (state&INPUT_SP1) player->in_sp1(-1); + if (state&INPUT_SP1) setState(INPUTR_SP1); state&=~INPUT_SP1; break; } case SDLK_LSHIFT: { - if (state&INPUT_SP2) player->in_sp2(-1); + if (state&INPUT_SP2) setState(INPUTR_SP2); state&=~INPUT_SP2; break; } @@ -72,16 +70,17 @@ break; } case SDLK_RETURN: { - if (state&INPUT_ACT) player->in_act(-1); + if (state&INPUT_ACT) setState(INPUTR_ACT); state&=~INPUT_ACT; break; } case SDLK_INSERT: { - if (state&INPUT_USE) player->in_use(-1); + if (state&INPUT_USE) setState(INPUTR_USE); state&=~INPUT_USE; break; } case SDLK_DELETE: { + if (state&INPUT_DEL) setState(INPUTR_DEL); state&=~INPUT_DEL; break; } Modified: trunk/src/input.h =================================================================== --- trunk/src/input.h 2004-10-02 14:56:41 UTC (rev 65) +++ trunk/src/input.h 2004-10-02 22:14:51 UTC (rev 66) @@ -11,6 +11,15 @@ #define INPUT_ACT 0x00000040 #define INPUT_USE 0x00000080 #define INPUT_DEL 0x00000100 +#define INPUTR_LEFT 0x00010000 +#define INPUTR_RIGHT 0x00020000 +#define INPUTR_UP 0x00040000 +#define INPUTR_DOWN 0x00080000 +#define INPUTR_SP1 0x00100000 +#define INPUTR_SP2 0x00200000 +#define INPUTR_ACT 0x00400000 +#define INPUTR_USE 0x00800000 +#define INPUTR_DEL 0x01000000 #define INPUT_PAUSE 0x10000000 /** \brief Handels keyboard events @@ -22,18 +31,18 @@ ~InputHandler(); /// Check for keyboard events void pollEvents(); - bool getState(Uint16 cstate) { + bool getState(Uint32 cstate) { return (state&cstate); } - void setState(Uint16 cstate) { + void setState(Uint32 cstate) { state|=cstate; } - void unsetState(Uint16 cstate) { + void unsetState(Uint32 cstate) { state&=~cstate; } private: /// Information about which buttons are pressed - Uint16 state; + Uint32 state; /// Sound: When the game is paused Mix_Chunk* au_pause; }; Modified: trunk/src/objectpools.h =================================================================== --- trunk/src/objectpools.h 2004-10-02 14:56:41 UTC (rev 65) +++ trunk/src/objectpools.h 2004-10-02 22:14:51 UTC (rev 66) @@ -28,7 +28,7 @@ /// \param arg3 Third argument as string /// \return Pointer to the new entry in the objectspool or NULL if /// the object was not recognized - Object* addObjectbyName(const string& obj, const string& image, Uint16 x=0, Uint16 y=0, const string& arg1="0", const string& arg2="0", const string& arg3="0"); + Object* addObjectbyName(const string& obj, const string& image, Sint16 x=0, Sint16 y=0, const string& arg1="0", const string& arg2="0", const string& arg3="0"); //@{ /// Add an Object to the objectspool /// \return Pointer to the new entry in the objectspool or NULL if it failed Modified: trunk/src/players_common.cpp =================================================================== --- trunk/src/players_common.cpp 2004-10-02 14:56:41 UTC (rev 65) +++ trunk/src/players_common.cpp 2004-10-02 22:14:51 UTC (rev 66) @@ -353,8 +353,8 @@ case W_TOUCH: { //TODO: play animations (make new Event for this) if (direction&(DIR_UP|DIR_DOWN)) sfxeng->playWAV(aud_hit); - if (direction&DIR_LEFT) setEvent(new ESpeed(this,TSTRIKE,-100,-DSTRIKE,0,ESTATE_BUSY,aud_hit)); - else setEvent(new ESpeed(this,TSTRIKE,-100,DSTRIKE,0,ESTATE_BUSY,aud_hit)); + if (direction&DIR_LEFT) setEvent(new ESpeed(this,TSTRIKE,-200,-DSTRIKE,0,ESTATE_BUSY,aud_hit)); + else setEvent(new ESpeed(this,TSTRIKE,-200,DSTRIKE,0,ESTATE_BUSY,aud_hit)); break; } case W_WATER: { Modified: trunk/src/players_common.h =================================================================== --- trunk/src/players_common.h 2004-10-02 14:56:41 UTC (rev 65) +++ trunk/src/players_common.h 2004-10-02 22:14:51 UTC (rev 66) @@ -103,6 +103,8 @@ //@} /// \brief Called when crashing into a dense object (default: ground) /// \param dir Direction of the crash + /// \bug crash is called _after_ addEnter/etc, so if one of those sets + /// an event, it will be canceled by crash! virtual void crash(Uint16 dir=DIR_DOWN); /// \brief Called when this player dies virtual void die(); Modified: trunk/src/weapons.h =================================================================== --- trunk/src/weapons.h 2004-10-02 14:56:41 UTC (rev 65) +++ trunk/src/weapons.h 2004-10-02 22:14:51 UTC (rev 66) @@ -22,7 +22,7 @@ #define WS_PRESSURE 0x00000010 #define WS_HEAL 0x00000020 -#define DSTRIKE 100 +#define DSTRIKE 200 #define TSTRIKE 600 /** \brief Weapons From DONOTREPLY at icculus.org Sat Oct 2 18:24:33 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Oct 2004 18:24:33 -0400 Subject: r67 - trunk/src Message-ID: <20041002222433.22965.qmail@icculus.org> Author: jonas Date: 2004-10-02 18:24:32 -0400 (Sat, 02 Oct 2004) New Revision: 67 Modified: trunk/src/objectpools.cpp Log: 10l Modified: trunk/src/objectpools.cpp =================================================================== --- trunk/src/objectpools.cpp 2004-10-02 22:14:51 UTC (rev 66) +++ trunk/src/objectpools.cpp 2004-10-02 22:24:32 UTC (rev 67) @@ -32,7 +32,7 @@ while (i!=objectspool.end()) i=removeObject(i); } -Object* ObjectsPool::addObjectbyName(const string& obj, const string& image, Uint16 x, Uint16 y, const string& arg1, const string& arg2, const string& arg3) { +Object* ObjectsPool::addObjectbyName(const string& obj, const string& image, Sint16 x, Sint16 y, const string& arg1, const string& arg2, const string& arg3) { //Set names... string name=obj; if (arg1!="0") { From DONOTREPLY at icculus.org Sat Oct 2 18:41:31 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Oct 2004 18:41:31 -0400 Subject: r68 - in trunk/src: . objects Message-ID: <20041002224131.24543.qmail@icculus.org> Author: jonas Date: 2004-10-02 18:41:31 -0400 (Sat, 02 Oct 2004) New Revision: 68 Modified: trunk/src/characters_common.h trunk/src/objects/fang.cpp trunk/src/objects/olaf.cpp trunk/src/objects/scorch.cpp Log: fixed the misbehaviour of olaf, scorch and fang (this should have been changed with the commit of the fall function) Modified: trunk/src/characters_common.h =================================================================== --- trunk/src/characters_common.h 2004-10-02 22:24:32 UTC (rev 67) +++ trunk/src/characters_common.h 2004-10-02 22:41:31 UTC (rev 68) @@ -107,6 +107,8 @@ } //Define these for each character, the base function must be run for all derived classes virtual void idle(Uint16); + /// Calculates the speed of the character + /// \todo clean up this mess with fall/move virtual void fall(Uint16); //when it dies... virtual void die(); @@ -149,7 +151,8 @@ //@} //crash into another object (default: ground) virtual void crash(Uint16 dir=DIR_DOWN); - //move + /// Updates the position of the character depending on it's velocity, checks for crashes + /// \todo clean up this mess with move and fall virtual Hit move(Uint16 dt, bool check=false); Uint8 health; Uint8 maxhealth; Modified: trunk/src/objects/fang.cpp =================================================================== --- trunk/src/objects/fang.cpp 2004-10-02 22:24:32 UTC (rev 67) +++ trunk/src/objects/fang.cpp 2004-10-02 22:41:31 UTC (rev 68) @@ -55,7 +55,7 @@ if (!(hit.touch&DIR_LEFT)) unsetState(STATE_CLIMB_L); if (!(hit.touch&DIR_RIGHT)) unsetState(STATE_CLIMB_R); } - if ((hit.enter&DIR_DOWN || hit.touch&DIR_DOWN) && (state&STATE_FALL)) crash(DIR_DOWN); + if ((hit.enter&DIR_DOWN) && (state&STATE_FALL)) crash(DIR_DOWN); Dgrav=0; } } Modified: trunk/src/objects/olaf.cpp =================================================================== --- trunk/src/objects/olaf.cpp 2004-10-02 22:24:32 UTC (rev 67) +++ trunk/src/objects/olaf.cpp 2004-10-02 22:41:31 UTC (rev 68) @@ -167,7 +167,7 @@ if ((state&STATE_SHIELD) && (speed > V_SHIELD)) setSpeed(V_SHIELD); } Hit hit=move(Dgrav); - if ((hit.enter&DIR_DOWN || hit.touch&DIR_DOWN) && (state&STATE_FALL)) crash(DIR_DOWN); + if ((hit.enter&DIR_DOWN) && (state&STATE_FALL)) crash(DIR_DOWN); Dgrav=0; } } Modified: trunk/src/objects/scorch.cpp =================================================================== --- trunk/src/objects/scorch.cpp 2004-10-02 22:24:32 UTC (rev 67) +++ trunk/src/objects/scorch.cpp 2004-10-02 22:41:31 UTC (rev 68) @@ -36,7 +36,7 @@ if ((state&STATE_GLIDE) && (speed > V_GLIDE)) speed=V_GLIDE;; } Hit hit=move(Dgrav); - if ((hit.enter&DIR_DOWN || hit.touch&DIR_DOWN) && (state&STATE_FALL)) crash(DIR_DOWN); + if ((hit.enter&DIR_DOWN) && (state&STATE_FALL)) crash(DIR_DOWN); Dgrav=0; } } From DONOTREPLY at icculus.org Sat Oct 2 19:00:48 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 2 Oct 2004 19:00:48 -0400 Subject: r69 - trunk/src/objects Message-ID: <20041002230048.26502.qmail@icculus.org> Author: jonas Date: 2004-10-02 19:00:47 -0400 (Sat, 02 Oct 2004) New Revision: 69 Modified: trunk/src/objects/zombie.cpp Log: fixes a bug (zombie misbehaved in Wind) Modified: trunk/src/objects/zombie.cpp =================================================================== --- trunk/src/objects/zombie.cpp 2004-10-02 22:41:31 UTC (rev 68) +++ trunk/src/objects/zombie.cpp 2004-10-02 23:00:47 UTC (rev 69) @@ -28,9 +28,7 @@ void Zombie::idle(Uint16 dt) { hspeed=0; Character::idle(dt); - if (!(state&STATE_FALL)) { - runAI(dt); - } + runAI(dt); } void Zombie::ai_left(Uint16 dt) { @@ -42,6 +40,8 @@ } else if (hit.touch&DIR_LEFT) { move(dt); unsetState(STATE_LEFT); + } else if (state&STATE_FALL) { + move(dt); } else if (!(hit.touch&DIR_DOWN)) { unsetState(STATE_LEFT); hspeed=0; @@ -59,6 +59,8 @@ } else if (hit.touch&DIR_RIGHT) { move(dt); setState(STATE_LEFT); + } else if (state&STATE_FALL) { + move(dt); } else if (!(hit.touch&DIR_DOWN)) { setState(STATE_LEFT); hspeed=0; From DONOTREPLY at icculus.org Sun Oct 3 06:56:52 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 3 Oct 2004 06:56:52 -0400 Subject: r70 - in trunk/src: . objects Message-ID: <20041003105652.24147.qmail@icculus.org> Author: jonas Date: 2004-10-03 06:56:52 -0400 (Sun, 03 Oct 2004) New Revision: 70 Added: trunk/src/objects/plant.cpp trunk/src/objects/plant.h Modified: trunk/src/monsters_common.cpp trunk/src/objectpools.cpp trunk/src/objects/Makefile trunk/src/objects/baleog.cpp trunk/src/objects/fang.cpp trunk/src/players_common.cpp trunk/src/weapons.h Log: added plant, modified some event settings, monster and players are no longer dense to each other Modified: trunk/src/monsters_common.cpp =================================================================== --- trunk/src/monsters_common.cpp 2004-10-02 23:00:47 UTC (rev 69) +++ trunk/src/monsters_common.cpp 2004-10-03 10:56:52 UTC (rev 70) @@ -18,7 +18,6 @@ maxspeedy=0; state=STATE_FALL; otype|=OTYPE_MONSTER; - dense_types|=OTYPE_PLAYER; enemy_types|=OTYPE_PLAYER; im_left=animation; im_right=animation; Modified: trunk/src/objectpools.cpp =================================================================== --- trunk/src/objectpools.cpp 2004-10-02 23:00:47 UTC (rev 69) +++ trunk/src/objectpools.cpp 2004-10-03 10:56:52 UTC (rev 70) @@ -4,6 +4,7 @@ #include "sndcache.h" #include "objectpools.h" //HACK!!!!!! +#include "monsters_common.h" #include "objects/baleog.h" #include "objects/bomb.h" #include "objects/door.h" @@ -18,6 +19,7 @@ #include "objects/teleport.h" #include "objects/trigger.h" #include "objects/triggered_bomb.h" +#include "objects/plant.h" #include "objects/wall.h" #include "objects/water.h" #include "objects/wind.h" @@ -37,7 +39,7 @@ string name=obj; if (arg1!="0") { //one additional parameter - if (name=="Trigger" || name=="Door" || name=="Bomb" || name=="TriggeredBomb" || name=="Geyser" || name=="Wind") { + if (name=="Trigger" || name=="Door" || name=="Bomb" || name=="TriggeredBomb" || name=="Plant" || name=="Geyser" || name=="Wind") { if (arg2!="0") name=arg2; //two additional parameter } else if (name=="Teleporter") { @@ -63,6 +65,7 @@ //normal characters else if (obj=="TriggeredBomb") return (addCharacter(new TriggeredBomb(image,x,y,atoi(arg1.c_str()),name))); + //Players else if (obj=="Eric") return (addPlayer(new Eric(image,x,y,name))); else if (obj=="Olaf") return (addPlayer(new Olaf(image,x,y,name))); @@ -71,6 +74,7 @@ else if (obj=="Scorch") return (addPlayer(new Scorch(image,x,y,name))); //Monsters + else if (obj=="Plant") return (addMonster(new Plant(image,x,y,atoi(arg1.c_str()),name))); else if (obj=="Zombie") return (addMonster(new Zombie(image,x,y,name))); //not recognized Modified: trunk/src/objects/Makefile =================================================================== --- trunk/src/objects/Makefile 2004-10-02 23:00:47 UTC (rev 69) +++ trunk/src/objects/Makefile 2004-10-03 10:56:52 UTC (rev 70) @@ -9,7 +9,7 @@ OBJS = baleog.o bomb.o door.o eric.o exit.o fang.o geyser.o heart.o\ key.o olaf.o scorch.o teleport.o trigger.o triggered_bomb.o\ - wall.o water.o wind.o zombie.o + wall.o water.o wind.o zombie.o plant.o PLUGS = ../objects.a Modified: trunk/src/objects/baleog.cpp =================================================================== --- trunk/src/objects/baleog.cpp 2004-10-02 23:00:47 UTC (rev 69) +++ trunk/src/objects/baleog.cpp 2004-10-03 10:56:52 UTC (rev 70) @@ -34,5 +34,5 @@ if (dt < 0) return; input->unsetState(INPUT_SP1); - 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,10,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-02 23:00:47 UTC (rev 69) +++ trunk/src/objects/fang.cpp 2004-10-03 10:56:52 UTC (rev 70) @@ -84,7 +84,7 @@ 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)); + setEvent(new EAttack(this,10,&weapon,(state&STATE_LEFT) ? DIR_LEFT : DIR_RIGHT,10,enemy_types,0,0,au_claw,(state&STATE_LEFT) ? im_claw_left : im_claw_right)); } void Fang::crash(Uint16 dir) { Added: trunk/src/objects/plant.cpp =================================================================== --- trunk/src/objects/plant.cpp 2004-10-02 23:00:47 UTC (rev 69) +++ trunk/src/objects/plant.cpp 2004-10-03 10:56:52 UTC (rev 70) @@ -0,0 +1,52 @@ +#include "common.h" +#include "sndcache.h" +#include "sfxeng.h" +#include "weapons.h" +#include "players_common.h" +#include "monsters_common.h" +#include "map.h" +#include "plant.h" + +Plant::Plant(string imagename, Sint16 xcord, Sint16 ycord, Uint16 trecover, string cname): + Monster(imagename,xcord,ycord,cname), + recover(trecover), + tcur(trecover) { + maxhealth=1; + weapon=Weapon(-1,W_TOUCH); + au_hit=sndcache->loadWAV("creeper.wav"); + au_recover=au_hit; + enemy_types|=(OTYPE_PLAYER); +} +Plant::~Plant() { } + +void Plant::touch(Object* obj) { + if (health==0) return; + if(Player* ptr = dynamic_cast(obj)) { + Uint16 adir=(DIR_UP|curmap->getDirection(getCenter(),ptr->getCenter())); + if (!(adir&DIR_LR)) adir|=DIR_LEFT; + ptr->hit(adir,weapon); + } +} + +void Plant::idle(Uint16 dt) { + if (health==0) { + tcur-=dt; + if (tcur<=0) { + sfxeng->playWAV(au_recover); + tcur=recover; + setHealth(maxhealth); + std::set cset=curmap->getCharactersIn(enemy_types,pos,true); + character_iterator cit=cset.begin(); + while (cit!=cset.end()) { + (*cit)->hit(curmap->getDirection(pos,*(*cit)->getPos()),weapon); + ++cit; + } + } + } +} + +Uint16 Plant::hit(Uint16, Weapon& weap) { + if (health==0) return health; + sfxeng->playWAV(au_hit); + return addHealth(weap.getDamage()); +} Added: trunk/src/objects/plant.h =================================================================== --- trunk/src/objects/plant.h 2004-10-02 23:00:47 UTC (rev 69) +++ trunk/src/objects/plant.h 2004-10-03 10:56:52 UTC (rev 70) @@ -0,0 +1,17 @@ +#include "characters_common.h" + +/** \brief Regrowing plant + +*/ +class Plant : public Monster { + public: + Plant(string imagename, Sint16 xpos=0, Sint16 ypos=0, Uint16 dleft=3000, string name="Plant"); + virtual ~Plant(); + virtual void touch(Object*); + virtual void idle(Uint16); + virtual Uint16 hit(Uint16 dir, Weapon& weap); + private: + Uint16 recover; + Sint16 tcur; + Mix_Chunk* au_recover; +}; Modified: trunk/src/players_common.cpp =================================================================== --- trunk/src/players_common.cpp 2004-10-02 23:00:47 UTC (rev 69) +++ trunk/src/players_common.cpp 2004-10-03 10:56:52 UTC (rev 70) @@ -22,7 +22,6 @@ } state=STATE_FALL; otype|=OTYPE_PLAYER; - dense_types|=OTYPE_MONSTER; enemy_types|=OTYPE_MONSTER; im_left=animation; im_right=animation; @@ -353,8 +352,8 @@ case W_TOUCH: { //TODO: play animations (make new Event for this) if (direction&(DIR_UP|DIR_DOWN)) sfxeng->playWAV(aud_hit); - if (direction&DIR_LEFT) setEvent(new ESpeed(this,TSTRIKE,-200,-DSTRIKE,0,ESTATE_BUSY,aud_hit)); - else setEvent(new ESpeed(this,TSTRIKE,-200,DSTRIKE,0,ESTATE_BUSY,aud_hit)); + if (direction&DIR_LEFT) setEvent(new ESpeed(this,TSTRIKE,-200,-400,0,ESTATE_BUSY,aud_hit)); + else setEvent(new ESpeed(this,TSTRIKE,-200,400,0,ESTATE_BUSY,aud_hit)); break; } case W_WATER: { Modified: trunk/src/weapons.h =================================================================== --- trunk/src/weapons.h 2004-10-02 23:00:47 UTC (rev 69) +++ trunk/src/weapons.h 2004-10-03 10:56:52 UTC (rev 70) @@ -22,7 +22,6 @@ #define WS_PRESSURE 0x00000010 #define WS_HEAL 0x00000020 -#define DSTRIKE 200 #define TSTRIKE 600 /** \brief Weapons From DONOTREPLY at icculus.org Tue Oct 5 04:42:53 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 5 Oct 2004 04:42:53 -0400 Subject: r71 - trunk/src/objects Message-ID: <20041005084253.20180.qmail@icculus.org> Author: jonas Date: 2004-10-05 04:42:53 -0400 (Tue, 05 Oct 2004) New Revision: 71 Modified: trunk/src/objects/eric.cpp Log: fixes a bug (Eric couldn't hitrun monsters) Modified: trunk/src/objects/eric.cpp =================================================================== --- trunk/src/objects/eric.cpp 2004-10-03 10:56:52 UTC (rev 70) +++ trunk/src/objects/eric.cpp 2004-10-05 08:42:53 UTC (rev 71) @@ -54,9 +54,11 @@ //TODO: check STATE_WATER if (dt < 0) { input->unsetState(INPUT_SP2); + dense_types&=~OTYPE_MONSTER; if (state&STATE_RUN) cancelEvent(); return; } + dense_types|=OTYPE_MONSTER; if (state&STATE_RUN) { if (state&STATE_FALL) cancelEvent(); } else if (state&STATE_MLEFT) { From DONOTREPLY at icculus.org Tue Oct 5 08:20:13 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 5 Oct 2004 08:20:13 -0400 Subject: r72 - in trunk: . src src/objects Message-ID: <20041005122013.12507.qmail@icculus.org> Author: jonas Date: 2004-10-05 08:20:13 -0400 (Tue, 05 Oct 2004) New Revision: 72 Modified: trunk/TODO trunk/src/characters_common.cpp trunk/src/objectpools.cpp trunk/src/objects/Makefile trunk/src/objects_common.h trunk/src/weapons.h Log: added spikes Modified: trunk/TODO =================================================================== --- trunk/TODO 2004-10-05 08:42:53 UTC (rev 71) +++ trunk/TODO 2004-10-05 12:20:13 UTC (rev 72) @@ -8,10 +8,15 @@ ==== o General: - o pointers => references where possible - o Describe everything using Doxygen styles, move the documentation from + o pointers => references where possible + o Describe everything using Doxygen styles, move the documentation from *.cpp to the headers... + o Fall/push/crash/collisions: + o the character should have more information what he hits + o movements into dense objects should involve a push() + o the collision detection and the move/fall code is all a big mess + o Animations/Events: o Make all events quite short, ie. almost all events become animation events Modified: trunk/src/characters_common.cpp =================================================================== --- trunk/src/characters_common.cpp 2004-10-05 08:42:53 UTC (rev 71) +++ trunk/src/characters_common.cpp 2004-10-05 12:20:13 UTC (rev 72) @@ -169,7 +169,7 @@ Uint8 Character::addHealth(Sint8 dhealth) { if (health==0) return 0; if ((health+dhealth)>=0) return setHealth(health+dhealth); - else return health; + else return setHealth(0); } inline Hit Character::checkHit(const SDL_Rect& dest, Object* destobj, bool tele) const { Modified: trunk/src/objectpools.cpp =================================================================== --- trunk/src/objectpools.cpp 2004-10-05 08:42:53 UTC (rev 71) +++ trunk/src/objectpools.cpp 2004-10-05 12:20:13 UTC (rev 72) @@ -5,24 +5,26 @@ #include "objectpools.h" //HACK!!!!!! #include "monsters_common.h" -#include "objects/baleog.h" #include "objects/bomb.h" #include "objects/door.h" -#include "objects/eric.h" #include "objects/exit.h" -#include "objects/fang.h" #include "objects/geyser.h" #include "objects/heart.h" #include "objects/key.h" -#include "objects/olaf.h" -#include "objects/scorch.h" #include "objects/teleport.h" #include "objects/trigger.h" -#include "objects/triggered_bomb.h" -#include "objects/plant.h" #include "objects/wall.h" #include "objects/water.h" #include "objects/wind.h" +#include "objects/spike.h" +//Characters +#include "objects/triggered_bomb.h" +#include "objects/plant.h" +#include "objects/baleog.h" +#include "objects/eric.h" +#include "objects/olaf.h" +#include "objects/scorch.h" +#include "objects/fang.h" #include "objects/zombie.h" @@ -39,7 +41,7 @@ string name=obj; if (arg1!="0") { //one additional parameter - if (name=="Trigger" || name=="Door" || name=="Bomb" || name=="TriggeredBomb" || name=="Plant" || name=="Geyser" || name=="Wind") { + if (name=="Trigger" || name=="Door" || name=="Bomb" || name=="TriggeredBomb" || name=="Plant" || name=="Geyser" || name=="Wind" || name=="Spike") { if (arg2!="0") name=arg2; //two additional parameter } else if (name=="Teleporter") { @@ -58,6 +60,7 @@ else if (obj=="Geyser") return (addObject(new Geyser(image,x,y,atoi(arg1.c_str()),name))); else if (obj=="Trigger") return (addObject(new Trigger(image,x,y,arg1,name,arg3))); else if (obj=="Door") return (addObject(new Door(image,x,y,arg1,name))); + else if (obj=="Spike") return (addObject(new Spike(image,x,y,atoi(arg1.c_str()),name))); //Items else if (obj=="Heart") return (addObject(new Heart(image,x,y,name))); else if (obj=="Key") return (addObject(new Key(image,x,y,name))); Modified: trunk/src/objects/Makefile =================================================================== --- trunk/src/objects/Makefile 2004-10-05 08:42:53 UTC (rev 71) +++ trunk/src/objects/Makefile 2004-10-05 12:20:13 UTC (rev 72) @@ -9,7 +9,7 @@ OBJS = baleog.o bomb.o door.o eric.o exit.o fang.o geyser.o heart.o\ key.o olaf.o scorch.o teleport.o trigger.o triggered_bomb.o\ - wall.o water.o wind.o zombie.o plant.o + wall.o water.o wind.o zombie.o plant.o spike.o PLUGS = ../objects.a Modified: trunk/src/objects_common.h =================================================================== --- trunk/src/objects_common.h 2004-10-05 08:42:53 UTC (rev 71) +++ trunk/src/objects_common.h 2004-10-05 12:20:13 UTC (rev 72) @@ -2,6 +2,7 @@ #define _OBJECTS_COMMON_H 1 //Object types +//dense types are the same as directions (that fact is beeing used) #define OTYPE_DENSE_R 0x00000001 #define OTYPE_DENSE_L 0x00000002 #define OTYPE_DENSE_U 0x00000004 Modified: trunk/src/weapons.h =================================================================== --- trunk/src/weapons.h 2004-10-05 08:42:53 UTC (rev 71) +++ trunk/src/weapons.h 2004-10-05 12:20:13 UTC (rev 72) @@ -20,7 +20,8 @@ #define WS_FIRE 0x00000004 #define WS_WATER 0x00000008 #define WS_PRESSURE 0x00000010 -#define WS_HEAL 0x00000020 +#define WS_SPIKE 0x00000020 +#define WS_HEAL 0x00000040 #define TSTRIKE 600 From DONOTREPLY at icculus.org Tue Oct 5 13:30:34 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 5 Oct 2004 13:30:34 -0400 Subject: r73 - in trunk/src: . objects Message-ID: <20041005173034.22077.qmail@icculus.org> Author: jonas Date: 2004-10-05 13:30:34 -0400 (Tue, 05 Oct 2004) New Revision: 73 Added: trunk/src/objects/erik.cpp trunk/src/objects/erik.h Removed: trunk/src/objects/eric.cpp trunk/src/objects/eric.h Modified: trunk/src/objectpools.cpp trunk/src/objects/Makefile trunk/src/objects/baleog.cpp trunk/src/objects/fang.cpp trunk/src/objects/olaf.cpp trunk/src/objects/olaf.h trunk/src/objects/scorch.cpp trunk/src/players_common.cpp trunk/src/players_common.h Log: added run animations, renamed Eric to Erik ;) Modified: trunk/src/objectpools.cpp =================================================================== --- trunk/src/objectpools.cpp 2004-10-05 12:20:13 UTC (rev 72) +++ trunk/src/objectpools.cpp 2004-10-05 17:30:34 UTC (rev 73) @@ -21,7 +21,7 @@ #include "objects/triggered_bomb.h" #include "objects/plant.h" #include "objects/baleog.h" -#include "objects/eric.h" +#include "objects/erik.h" #include "objects/olaf.h" #include "objects/scorch.h" #include "objects/fang.h" @@ -70,7 +70,7 @@ else if (obj=="TriggeredBomb") return (addCharacter(new TriggeredBomb(image,x,y,atoi(arg1.c_str()),name))); //Players - else if (obj=="Eric") return (addPlayer(new Eric(image,x,y,name))); + else if (obj=="Erik") return (addPlayer(new Erik(image,x,y,name))); else if (obj=="Olaf") return (addPlayer(new Olaf(image,x,y,name))); else if (obj=="Baleog") return (addPlayer(new Baleog(image,x,y,name))); else if (obj=="Fang") return (addPlayer(new Fang(image,x,y,name))); Modified: trunk/src/objects/Makefile =================================================================== --- trunk/src/objects/Makefile 2004-10-05 12:20:13 UTC (rev 72) +++ trunk/src/objects/Makefile 2004-10-05 17:30:34 UTC (rev 73) @@ -7,7 +7,7 @@ SDL_LINK = `sdl-config --libs` -lSDL_mixer -lSDL_image -ldl -rdynamic AR = ar -OBJS = baleog.o bomb.o door.o eric.o exit.o fang.o geyser.o heart.o\ +OBJS = baleog.o bomb.o door.o erik.o exit.o fang.o geyser.o heart.o\ key.o olaf.o scorch.o teleport.o trigger.o triggered_bomb.o\ wall.o water.o wind.o zombie.o plant.o spike.o PLUGS = ../objects.a Modified: trunk/src/objects/baleog.cpp =================================================================== --- trunk/src/objects/baleog.cpp 2004-10-05 12:20:13 UTC (rev 72) +++ trunk/src/objects/baleog.cpp 2004-10-05 17:30:34 UTC (rev 73) @@ -11,6 +11,8 @@ Player(imagename,xcord,ycord,pname) { im_left=new Animation(imgcache->loadImage("baleog_right.bmp")); im_right=im_left; + im_run_right=new Animation(imgcache->loadImage("baleog-run.png"),8,1000); + im_run_left=im_left; im_fall_left=im_left; im_fall_right=im_left; im_krit_left=im_left; @@ -25,6 +27,7 @@ Baleog::~Baleog() { delete im_left; + delete im_run_right; delete im_land_left; delete im_sword_left; } Deleted: trunk/src/objects/eric.cpp =================================================================== --- trunk/src/objects/eric.cpp 2004-10-05 12:20:13 UTC (rev 72) +++ trunk/src/objects/eric.cpp 2004-10-05 17:30:34 UTC (rev 73) @@ -1,111 +0,0 @@ -#include "common.h" -#include "events.h" -#include "anim.h" -#include "input.h" -#include "map.h" -#include "weapons.h" -#include "imgcache.h" -#include "sndcache.h" -#include "sfxeng.h" -#include "eric.h" - - -Eric::Eric(string imagename, Sint16 xcord, Sint16 ycord, string pname): - 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; - im_fall_right=im_right; - im_krit_left=im_left; - 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; - au_jump=sndcache->loadWAV("rboots.wav"); - au_hit=sndcache->loadWAV("erikhit.wav"); - au_run=NULL; -} -Eric::~Eric() { - delete im_left; - delete im_right; - delete im_land_left; -} - -void Eric::in_sp1(Sint16 dt) { - //TODO: check STATE_WATER - if (dt < 0) return; - input->unsetState(INPUT_SP1); - - if (state&STATE_FALL) setState(STATE_ACT_1); - - if (state&STATE_ACT_2) { - } else if (state&STATE_ACT_1) { - setState(STATE_ACT_2); - setEvent(new ESpeed(this,DE_JUMP,jump2,0,0,0,au_jump)); - } else { - setState(STATE_ACT_1); - setEvent(new ESpeed(this,DE_JUMP,jump)); - } -} - -void Eric::in_sp2(Sint16 dt) { - //TODO: check STATE_WATER - if (dt < 0) { - input->unsetState(INPUT_SP2); - dense_types&=~OTYPE_MONSTER; - if (state&STATE_RUN) cancelEvent(); - return; - } - dense_types|=OTYPE_MONSTER; - if (state&STATE_RUN) { - if (state&STATE_FALL) cancelEvent(); - } else if (state&STATE_MLEFT) { - sfxeng->playWAV(au_run); - setEvent(new ERun(this,10000,Sint16(-1/2*maxspeedx),-maxspeedx,500,ESTATE_ABORT,au_run)); - } else if (state&STATE_MRIGHT) { - sfxeng->playWAV(au_run); - setEvent(new ERun(this,10000,Sint16(1/2*maxspeedx),maxspeedx,500,ESTATE_ABORT,au_run)); - } -} - -void Eric::in_left(Sint16 dt) { - if (dt < 0) { - //TODO: play decelerate animation (setEvent instead) - if (state&STATE_RUN) cancelEvent(); - } else if (state&STATE_RUN) { - if (state&STATE_LEFT) event->reset(); - //changed directions, TODO: play decelerate animation - else cancelEvent(); - } - Player::in_left(dt); -} - -void Eric::in_right(Sint16 dt) { - if (dt < 0) { - //TODO: play decelerate animation (setEvent instead) - if (state&STATE_RUN) cancelEvent(); - } else if (state&STATE_RUN) { - if (!(state&STATE_LEFT)) event->reset(); - //changed directions, TODO: play decelerate animation - else cancelEvent(); - } - Player::in_right(dt); -} - -void Eric::crash(Uint16 dir) { - if ((state&(STATE_PRESS_LR|STATE_ACT_2)) && (!(dir&DIR_DOWN))) { - std::set 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(); - return health; - } else return Player::hit(dir,weap); -} Deleted: trunk/src/objects/eric.h =================================================================== --- trunk/src/objects/eric.h 2004-10-05 12:20:13 UTC (rev 72) +++ trunk/src/objects/eric.h 2004-10-05 17:30:34 UTC (rev 73) @@ -1,30 +0,0 @@ -#include "players_common.h" - -#define V_JUMP -400 -#define V_JUMP2 -500 -#define DE_JUMP 200 - -/** \brief Eric (Viking) - - Act1: first jump\n - Act2: second jump - \todo Implement water (STATE_WATER) - \todo Add jump and run attacks -*/ -class Eric : public Player { - public: - Eric(string imagename, Sint16 xpos=0, Sint16 ypos=0, string name="Eric"); - virtual ~Eric(); - /// \brief Eric jumps - virtual void in_sp1(Sint16); - // \brief Eric runs - 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; - Mix_Chunk* au_run; - Sint16 jump,jump2; -}; Copied: trunk/src/objects/erik.cpp (from rev 72, trunk/src/objects/eric.cpp) =================================================================== --- trunk/src/objects/eric.cpp 2004-10-05 12:20:13 UTC (rev 72) +++ trunk/src/objects/erik.cpp 2004-10-05 17:30:34 UTC (rev 73) @@ -0,0 +1,113 @@ +#include "common.h" +#include "events.h" +#include "anim.h" +#include "input.h" +#include "map.h" +#include "weapons.h" +#include "imgcache.h" +#include "sndcache.h" +#include "sfxeng.h" +#include "erik.h" + + +Erik::Erik(string imagename, Sint16 xcord, Sint16 ycord, string pname): + Player(imagename,xcord,ycord,pname), + jump(V_JUMP), + jump2(V_JUMP2) { + weapon=Weapon(-1,W_PRESSURE,WS_PRESSURE); + im_left=new Animation(imgcache->loadImage("erik_left.bmp")); + im_right=new Animation(60,imgcache->loadImage("kuru.bmp"),12,1000); + im_run_right=im_right; + im_run_left=im_left; + im_fall_left=im_left; + im_fall_right=im_right; + im_krit_left=im_left; + 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; + au_jump=sndcache->loadWAV("rboots.wav"); + au_hit=sndcache->loadWAV("erikhit.wav"); + au_run=NULL; +} +Erik::~Erik() { + delete im_left; + delete im_right; + delete im_land_left; +} + +void Erik::in_sp1(Sint16 dt) { + //TODO: check STATE_WATER + if (dt < 0) return; + input->unsetState(INPUT_SP1); + + if (state&STATE_FALL) setState(STATE_ACT_1); + + if (state&STATE_ACT_2) { + } else if (state&STATE_ACT_1) { + setState(STATE_ACT_2); + setEvent(new ESpeed(this,DE_JUMP,jump2,0,0,0,au_jump)); + } else { + setState(STATE_ACT_1); + setEvent(new ESpeed(this,DE_JUMP,jump)); + } +} + +void Erik::in_sp2(Sint16 dt) { + //TODO: check STATE_WATER + if (dt < 0) { + input->unsetState(INPUT_SP2); + dense_types&=~OTYPE_MONSTER; + if (state&STATE_RUN) cancelEvent(); + return; + } + dense_types|=OTYPE_MONSTER; + if (state&STATE_RUN) { + if (state&STATE_FALL) cancelEvent(); + } else if (state&STATE_MLEFT) { + sfxeng->playWAV(au_run); + setEvent(new ERun(this,10000,Sint16(-1/2*maxspeedx),-maxspeedx,500,ESTATE_ABORT,au_run)); + } else if (state&STATE_MRIGHT) { + sfxeng->playWAV(au_run); + setEvent(new ERun(this,10000,Sint16(1/2*maxspeedx),maxspeedx,500,ESTATE_ABORT,au_run)); + } +} + +void Erik::in_left(Sint16 dt) { + if (dt < 0) { + //TODO: play decelerate animation (setEvent instead) + if (state&STATE_RUN) cancelEvent(); + } else if (state&STATE_RUN) { + if (state&STATE_LEFT) event->reset(); + //changed directions, TODO: play decelerate animation + else cancelEvent(); + } + Player::in_left(dt); +} + +void Erik::in_right(Sint16 dt) { + if (dt < 0) { + //TODO: play decelerate animation (setEvent instead) + if (state&STATE_RUN) cancelEvent(); + } else if (state&STATE_RUN) { + if (!(state&STATE_LEFT)) event->reset(); + //changed directions, TODO: play decelerate animation + else cancelEvent(); + } + Player::in_right(dt); +} + +void Erik::crash(Uint16 dir) { + if ((state&(STATE_PRESS_LR|STATE_ACT_2)) && (!(dir&DIR_DOWN))) { + std::set 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 Erik::hit(Uint16 dir, Weapon& weap) { + if (weap.getType()==W_WATER) { + cancelEvent(); + return health; + } else return Player::hit(dir,weap); +} Copied: trunk/src/objects/erik.h (from rev 72, trunk/src/objects/eric.h) =================================================================== --- trunk/src/objects/eric.h 2004-10-05 12:20:13 UTC (rev 72) +++ trunk/src/objects/erik.h 2004-10-05 17:30:34 UTC (rev 73) @@ -0,0 +1,30 @@ +#include "players_common.h" + +#define V_JUMP -400 +#define V_JUMP2 -500 +#define DE_JUMP 200 + +/** \brief Erik (Viking) + + Act1: first jump\n + Act2: second jump + \todo Implement water (STATE_WATER) + \todo Add jump and run attacks +*/ +class Erik : public Player { + public: + Erik(string imagename, Sint16 xpos=0, Sint16 ypos=0, string name="Erik"); + virtual ~Erik(); + /// \brief Erik jumps + virtual void in_sp1(Sint16); + // \brief Erik runs + 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; + Mix_Chunk* au_run; + Sint16 jump,jump2; +}; Modified: trunk/src/objects/fang.cpp =================================================================== --- trunk/src/objects/fang.cpp 2004-10-05 12:20:13 UTC (rev 72) +++ trunk/src/objects/fang.cpp 2004-10-05 17:30:34 UTC (rev 73) @@ -13,6 +13,8 @@ weapon=Weapon(-1,W_STRIKE); im_left=new Animation(imgcache->loadImage("olaf_left.bmp")); im_right=new Animation(imgcache->loadImage("olaf_right.bmp")); + im_run_right=im_right; + im_run_left=im_left; im_fall_left=im_left; im_fall_right=im_right; im_krit_left=im_left; Modified: trunk/src/objects/olaf.cpp =================================================================== --- trunk/src/objects/olaf.cpp 2004-10-05 12:20:13 UTC (rev 72) +++ trunk/src/objects/olaf.cpp 2004-10-05 17:30:34 UTC (rev 73) @@ -13,6 +13,8 @@ fart(V_FART) { im_left=new Animation(imgcache->loadImage("olaf_left.bmp")); im_right=new Animation(imgcache->loadImage("olaf_right.bmp")); + im_run_right=new Animation(imgcache->loadImage("olaf-run.png"),8,1000); + im_run_left=im_left; im_fall_left=im_left; im_fall_right=im_right; im_krit_left=im_left; @@ -22,8 +24,12 @@ im_small_left=new Animation(imgcache->loadImage("gun.bmp"),9,1000); im_small_right=im_small_left; + im_run_small_left=im_small_left; + im_run_small_right=im_small_right; im_shield_right=new Animation(imgcache->loadImage("olaf_fall_shield_right.bmp")); im_shield_left=new Animation(imgcache->loadImage("olaf_fall_shield_left.bmp")); + im_run_shield_right=im_shield_right; + im_run_shield_left=im_shield_left; im_fall_shield_left=im_shield_left; im_fall_shield_right=im_shield_right; im_die=new Animation(60,imgcache->loadImage("kuru.bmp"),12,2000,true); @@ -35,6 +41,7 @@ Olaf::~Olaf() { delete im_left; delete im_right; + delete im_run_right; delete im_land_left; delete im_small_left; delete im_shield_right; @@ -44,21 +51,28 @@ void Olaf::updateAnimState(bool change) { if (!change) { } else if (state&STATE_SMALL) { - if (state&STATE_LEFT) animation=im_small_left; - else animation=im_small_right; + if (state&STATE_LEFT) { + if (state&STATE_MLEFT) animation=im_run_small_left; + else animation=im_small_left; + } else { + if (state&STATE_MRIGHT) animation=im_run_small_right; + else animation=im_small_right; + } } else if (state&STATE_SHIELD) { otype|=OTYPE_DENSE_D; if (state&STATE_LEFT) { if (state&STATE_FALL) { animation=im_fall_shield_left; } else { - animation=im_shield_left; + if (state&STATE_MLEFT) animation=im_run_shield_left; + else animation=im_shield_left; } } else { if (state&STATE_FALL) { animation=im_fall_shield_right; } else { - animation=im_shield_right; + if (state&STATE_MRIGHT) animation=im_run_shield_right; + else animation=im_shield_right; } } } else { Modified: trunk/src/objects/olaf.h =================================================================== --- trunk/src/objects/olaf.h 2004-10-05 12:20:13 UTC (rev 72) +++ trunk/src/objects/olaf.h 2004-10-05 17:30:34 UTC (rev 73) @@ -43,8 +43,12 @@ //@{ Animation* im_small_left; Animation* im_small_right; + Animation* im_run_small_left; + Animation* im_run_small_right; Animation* im_shield_left; Animation* im_shield_right; + Animation* im_run_shield_left; + Animation* im_run_shield_right; Animation* im_fall_shield_left; Animation* im_fall_shield_right; //@} Modified: trunk/src/objects/scorch.cpp =================================================================== --- trunk/src/objects/scorch.cpp 2004-10-05 12:20:13 UTC (rev 72) +++ trunk/src/objects/scorch.cpp 2004-10-05 17:30:34 UTC (rev 73) @@ -13,6 +13,8 @@ wing(V_FLY) { im_left=new Animation(imgcache->loadImage("baleog_right.bmp")); im_right=im_left; + im_run_left=im_left; + im_run_right=im_right; im_fall_left=im_left; im_fall_right=im_left; im_krit_left=im_left; Modified: trunk/src/players_common.cpp =================================================================== --- trunk/src/players_common.cpp 2004-10-05 12:20:13 UTC (rev 72) +++ trunk/src/players_common.cpp 2004-10-05 17:30:34 UTC (rev 73) @@ -25,6 +25,8 @@ enemy_types|=OTYPE_MONSTER; im_left=animation; im_right=animation; + im_run_left=animation; + im_run_right=animation; im_fall_left=animation; im_fall_right=animation; im_krit_left=animation; @@ -146,6 +148,8 @@ } else { animation=im_fall_left; } + } else if (state&STATE_MLEFT) { + animation=im_run_left; } else { animation=im_left; } @@ -156,6 +160,8 @@ } else { animation=im_fall_right; } + } else if (state&STATE_MRIGHT) { + animation=im_run_right; } else { animation=im_right; } Modified: trunk/src/players_common.h =================================================================== --- trunk/src/players_common.h 2004-10-05 12:20:13 UTC (rev 72) +++ trunk/src/players_common.h 2004-10-05 17:30:34 UTC (rev 73) @@ -112,6 +112,8 @@ //@{ Animation* im_left; Animation* im_right; + Animation* im_run_left; + Animation* im_run_right; Animation* im_fall_left; Animation* im_fall_right; Animation* im_krit_left; From DONOTREPLY at icculus.org Tue Oct 5 14:34:29 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 5 Oct 2004 14:34:29 -0400 Subject: r74 - in trunk: . src/objects Message-ID: <20041005183429.3573.qmail@icculus.org> Author: jonas Date: 2004-10-05 14:34:29 -0400 (Tue, 05 Oct 2004) New Revision: 74 Modified: trunk/TODO trunk/src/objects/baleog.cpp trunk/src/objects/erik.cpp trunk/src/objects/fang.cpp trunk/src/objects/olaf.cpp trunk/src/objects/scorch.cpp Log: finnished the new animations (from blizzard home page), added corresponding left/right images using convert -flop Modified: trunk/TODO =================================================================== --- trunk/TODO 2004-10-05 17:30:34 UTC (rev 73) +++ trunk/TODO 2004-10-05 18:34:29 UTC (rev 74) @@ -11,10 +11,19 @@ o pointers => references where possible o Describe everything using Doxygen styles, move the documentation from *.cpp to the headers... + o Idea: _all_ objects should have a "kore" like the players (curpos thing) + This would help in many ways and should be a frame information and not an + image as done for players atm! o Fall/push/crash/collisions: o the character should have more information what he hits o movements into dense objects should involve a push() + o I have no idea about how the push should look like, elevators can be pushed + up, even though you don't collide with them on top + o characters should be "pushable", eg. a stone that falls down pushes the + character down or better: an elevator should push the characters up + o In case of the elevator, the players are somehow "bound" to the elevator (ie. + it's not like: the elevator moves, the character falls, but they move together) o the collision detection and the move/fall code is all a big mess o Animations/Events: @@ -26,6 +35,8 @@ - store rects in an array/vector/whatever or use offset matrices - do some column/row logics to easy the access - eg. set offsets for left, right, mleft, mright... + - IDEA: just store one side and add some flipping logic to the image + loading process... o IDEA: change Animation* pointers to Animation (or references), leave only animation as a pointer and get the address each time... o introduce animation events that play an animation and end when it's Modified: trunk/src/objects/baleog.cpp =================================================================== --- trunk/src/objects/baleog.cpp 2004-10-05 17:30:34 UTC (rev 73) +++ trunk/src/objects/baleog.cpp 2004-10-05 18:34:29 UTC (rev 74) @@ -9,16 +9,16 @@ Baleog::Baleog(string imagename, Sint16 xcord, Sint16 ycord, string pname): Player(imagename,xcord,ycord,pname) { - im_left=new Animation(imgcache->loadImage("baleog_right.bmp")); - im_right=im_left; - im_run_right=new Animation(imgcache->loadImage("baleog-run.png"),8,1000); - im_run_left=im_left; + im_left=new Animation(imgcache->loadImage("baleog_left.bmp")); + im_right=new Animation(imgcache->loadImage("baleog_right.bmp")); + im_run_left=new Animation(imgcache->loadImage("baleog-run_left.png"),8,1000); + im_run_right=new Animation(imgcache->loadImage("baleog-run_right.png"),8,1000); im_fall_left=im_left; im_fall_right=im_left; im_krit_left=im_left; im_krit_right=im_left; - im_land_left=new Animation(imgcache->loadImage("olaf_land.bmp"),1,T_IRR,true); - im_land_right=im_land_left; + im_land_left=new Animation(imgcache->loadImage("olaf_land_left.bmp"),1,T_IRR,true); + im_land_right=new Animation(imgcache->loadImage("olaf_land_right.bmp"),1,T_IRR,true); weapon=Weapon(-1,W_STRIKE); im_sword_left=new Animation(60,imgcache->loadImage("kuru.bmp"),12,500,true); im_sword_right=im_sword_left; @@ -27,8 +27,11 @@ Baleog::~Baleog() { delete im_left; + delete im_right; + delete im_run_left; delete im_run_right; delete im_land_left; + delete im_land_right; delete im_sword_left; } Modified: trunk/src/objects/erik.cpp =================================================================== --- trunk/src/objects/erik.cpp 2004-10-05 17:30:34 UTC (rev 73) +++ trunk/src/objects/erik.cpp 2004-10-05 18:34:29 UTC (rev 74) @@ -16,15 +16,15 @@ jump2(V_JUMP2) { weapon=Weapon(-1,W_PRESSURE,WS_PRESSURE); im_left=new Animation(imgcache->loadImage("erik_left.bmp")); - im_right=new Animation(60,imgcache->loadImage("kuru.bmp"),12,1000); + im_right=new Animation(imgcache->loadImage("erik_right.bmp")); im_run_right=im_right; im_run_left=im_left; im_fall_left=im_left; im_fall_right=im_right; im_krit_left=im_left; 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_land_left=new Animation(imgcache->loadImage("olaf_land_left.bmp"),1,T_IRR,true); + im_land_right=new Animation(imgcache->loadImage("olaf_land_right.bmp"),1,T_IRR,true); au_jump=sndcache->loadWAV("rboots.wav"); au_hit=sndcache->loadWAV("erikhit.wav"); au_run=NULL; @@ -33,6 +33,7 @@ delete im_left; delete im_right; delete im_land_left; + delete im_land_right; } void Erik::in_sp1(Sint16 dt) { Modified: trunk/src/objects/fang.cpp =================================================================== --- trunk/src/objects/fang.cpp 2004-10-05 17:30:34 UTC (rev 73) +++ trunk/src/objects/fang.cpp 2004-10-05 18:34:29 UTC (rev 74) @@ -13,14 +13,14 @@ weapon=Weapon(-1,W_STRIKE); im_left=new Animation(imgcache->loadImage("olaf_left.bmp")); im_right=new Animation(imgcache->loadImage("olaf_right.bmp")); - im_run_right=im_right; - im_run_left=im_left; + im_run_left=new Animation(imgcache->loadImage("olaf-run_left.png"),8,1000); + im_run_right=new Animation(imgcache->loadImage("olaf-run_right.png"),8,1000); im_fall_left=im_left; im_fall_right=im_right; im_krit_left=im_left; 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_land_left=new Animation(imgcache->loadImage("olaf_land_left.bmp"),1,T_IRR,true); + im_land_right=new Animation(imgcache->loadImage("olaf_land_right.bmp"),1,T_IRR,true); 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"); @@ -30,7 +30,10 @@ Fang::~Fang() { delete im_left; delete im_right; + delete im_run_left; + delete im_run_right; delete im_land_left; + delete im_land_right; delete im_claw_left; } Modified: trunk/src/objects/olaf.cpp =================================================================== --- trunk/src/objects/olaf.cpp 2004-10-05 17:30:34 UTC (rev 73) +++ trunk/src/objects/olaf.cpp 2004-10-05 18:34:29 UTC (rev 74) @@ -13,14 +13,14 @@ fart(V_FART) { im_left=new Animation(imgcache->loadImage("olaf_left.bmp")); im_right=new Animation(imgcache->loadImage("olaf_right.bmp")); - im_run_right=new Animation(imgcache->loadImage("olaf-run.png"),8,1000); - im_run_left=im_left; + im_run_left=new Animation(imgcache->loadImage("olaf-run_left.png"),8,1000); + im_run_right=new Animation(imgcache->loadImage("olaf-run_right.png"),8,1000); im_fall_left=im_left; im_fall_right=im_right; im_krit_left=im_left; 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_land_left=new Animation(imgcache->loadImage("olaf_land_left.bmp"),1,T_IRR,true); + im_land_right=new Animation(imgcache->loadImage("olaf_land_right.bmp"),1,T_IRR,true); im_small_left=new Animation(imgcache->loadImage("gun.bmp"),9,1000); im_small_right=im_small_left; @@ -41,8 +41,10 @@ Olaf::~Olaf() { delete im_left; delete im_right; + delete im_run_left; delete im_run_right; delete im_land_left; + delete im_land_right; delete im_small_left; delete im_shield_right; delete im_shield_left; Modified: trunk/src/objects/scorch.cpp =================================================================== --- trunk/src/objects/scorch.cpp 2004-10-05 17:30:34 UTC (rev 73) +++ trunk/src/objects/scorch.cpp 2004-10-05 18:34:29 UTC (rev 74) @@ -11,23 +11,27 @@ Player(imagename,xcord,ycord,pname), left_wings(SCORCH_MAX_WINGS), wing(V_FLY) { - im_left=new Animation(imgcache->loadImage("baleog_right.bmp")); - im_right=im_left; - im_run_left=im_left; - im_run_right=im_right; + im_left=new Animation(imgcache->loadImage("baleog_left.bmp")); + im_right=new Animation(imgcache->loadImage("baleog_right.bmp")); + im_run_left=new Animation(imgcache->loadImage("baleog-run_left.png"),8,1000); + im_run_right=new Animation(imgcache->loadImage("baleog-run_right.png"),8,1000); im_fall_left=im_left; im_fall_right=im_left; im_krit_left=im_left; im_krit_right=im_left; - im_land_left=new Animation(imgcache->loadImage("olaf_land.bmp"),1,T_IRR,true); - im_land_right=im_land_left; + im_land_left=new Animation(imgcache->loadImage("olaf_land_left.bmp"),1,T_IRR,true); + im_land_right=new Animation(imgcache->loadImage("olaf_land_right.bmp"),1,T_IRR,true); au_swing=sndcache->loadWAV("flapwngs.wav"); au_tired=sndcache->loadWAV("flwings.wav"); au_hit=sndcache->loadWAV("draghit.wav"); } Scorch::~Scorch() { delete im_left; + delete im_right; + delete im_run_left; + delete im_run_right; delete im_land_left; + delete im_land_right; } void Scorch::fall(Uint16 dt) { From DONOTREPLY at icculus.org Tue Oct 5 15:18:09 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 5 Oct 2004 15:18:09 -0400 Subject: r75 - in trunk: src/objects tools Message-ID: <20041005191809.12154.qmail@icculus.org> Author: jonas Date: 2004-10-05 15:18:09 -0400 (Tue, 05 Oct 2004) New Revision: 75 Added: trunk/tools/blizzard_gif_to_viking_images.sh Modified: trunk/src/objects/baleog.cpp trunk/src/objects/scorch.cpp Log: a few more image things Modified: trunk/src/objects/baleog.cpp =================================================================== --- trunk/src/objects/baleog.cpp 2004-10-05 18:34:29 UTC (rev 74) +++ trunk/src/objects/baleog.cpp 2004-10-05 19:18:09 UTC (rev 75) @@ -14,9 +14,9 @@ im_run_left=new Animation(imgcache->loadImage("baleog-run_left.png"),8,1000); im_run_right=new Animation(imgcache->loadImage("baleog-run_right.png"),8,1000); im_fall_left=im_left; - im_fall_right=im_left; + im_fall_right=im_right; im_krit_left=im_left; - im_krit_right=im_left; + im_krit_right=im_right; im_land_left=new Animation(imgcache->loadImage("olaf_land_left.bmp"),1,T_IRR,true); im_land_right=new Animation(imgcache->loadImage("olaf_land_right.bmp"),1,T_IRR,true); weapon=Weapon(-1,W_STRIKE); Modified: trunk/src/objects/scorch.cpp =================================================================== --- trunk/src/objects/scorch.cpp 2004-10-05 18:34:29 UTC (rev 74) +++ trunk/src/objects/scorch.cpp 2004-10-05 19:18:09 UTC (rev 75) @@ -16,9 +16,9 @@ im_run_left=new Animation(imgcache->loadImage("baleog-run_left.png"),8,1000); im_run_right=new Animation(imgcache->loadImage("baleog-run_right.png"),8,1000); im_fall_left=im_left; - im_fall_right=im_left; + im_fall_right=im_right; im_krit_left=im_left; - im_krit_right=im_left; + im_krit_right=im_right; im_land_left=new Animation(imgcache->loadImage("olaf_land_left.bmp"),1,T_IRR,true); im_land_right=new Animation(imgcache->loadImage("olaf_land_right.bmp"),1,T_IRR,true); au_swing=sndcache->loadWAV("flapwngs.wav"); Added: trunk/tools/blizzard_gif_to_viking_images.sh =================================================================== --- trunk/tools/blizzard_gif_to_viking_images.sh 2004-10-05 18:34:29 UTC (rev 74) +++ trunk/tools/blizzard_gif_to_viking_images.sh 2004-10-05 19:18:09 UTC (rev 75) @@ -0,0 +1,27 @@ +#!/bin/sh + +convert $1.gif $1_right.png +convert -flop $1.gif $1_left.png + +montage\ + -crop 34x34+6+6\ + -geometry 80x80+0+0\ + -tile 100x1\ + -background transparent\ + $1_right.png.* $1_right.png + +montage\ + -crop 34x34+6+6\ + -geometry 80x80+0+0\ + -tile 100x1\ + -background transparent\ + $1_left.png.* $1_left.png + +# -background \#ff00ff\ +# -geometry +0+0 +# -colors 32\ +# -colorspace transparent\ + +echo -n "$1 : " +ls $1_right.png.* | wc -l +rm $1_*.png.* From DONOTREPLY at icculus.org Wed Oct 6 07:22:14 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 6 Oct 2004 07:22:14 -0400 Subject: r76 - trunk/src/objects Message-ID: <20041006112214.11821.qmail@icculus.org> Author: jonas Date: 2004-10-06 07:22:14 -0400 (Wed, 06 Oct 2004) New Revision: 76 Modified: trunk/src/objects/baleog.cpp trunk/src/objects/erik.cpp trunk/src/objects/fang.cpp trunk/src/objects/olaf.cpp trunk/src/objects/scorch.cpp trunk/src/objects/zombie.cpp Log: more sprites... Modified: trunk/src/objects/baleog.cpp =================================================================== --- trunk/src/objects/baleog.cpp 2004-10-05 19:18:09 UTC (rev 75) +++ trunk/src/objects/baleog.cpp 2004-10-06 11:22:14 UTC (rev 76) @@ -9,19 +9,19 @@ Baleog::Baleog(string imagename, Sint16 xcord, Sint16 ycord, string pname): Player(imagename,xcord,ycord,pname) { - im_left=new Animation(imgcache->loadImage("baleog_left.bmp")); - im_right=new Animation(imgcache->loadImage("baleog_right.bmp")); - im_run_left=new Animation(imgcache->loadImage("baleog-run_left.png"),8,1000); - im_run_right=new Animation(imgcache->loadImage("baleog-run_right.png"),8,1000); + im_left=new Animation(imgcache->loadImage("baleog1_left.bmp")); + im_right=new Animation(imgcache->loadImage("baleog1_right.bmp")); + im_run_left=new Animation(imgcache->loadImage("baleog1-run_left.png"),8,1000); + im_run_right=new Animation(imgcache->loadImage("baleog1-run_right.png"),8,1000); im_fall_left=im_left; im_fall_right=im_right; im_krit_left=im_left; im_krit_right=im_right; - im_land_left=new Animation(imgcache->loadImage("olaf_land_left.bmp"),1,T_IRR,true); - im_land_right=new Animation(imgcache->loadImage("olaf_land_right.bmp"),1,T_IRR,true); + im_land_left=new Animation(imgcache->loadImage("olaf1_land_left.bmp"),1,T_IRR,true); + im_land_right=new Animation(imgcache->loadImage("olaf1_land_right.bmp"),1,T_IRR,true); weapon=Weapon(-1,W_STRIKE); - im_sword_left=new Animation(60,imgcache->loadImage("kuru.bmp"),12,500,true); - im_sword_right=im_sword_left; + im_sword_left=new Animation(imgcache->loadImage("BaleogCyborg_Slash_left.png"),8,1000,true); + im_sword_right=new Animation(imgcache->loadImage("BaleogCyborg_Slash_right.png"),8,1000,true); au_sword=sndcache->loadWAV("swrdsw2.wav"); } @@ -33,6 +33,7 @@ delete im_land_left; delete im_land_right; delete im_sword_left; + delete im_sword_right; } //Baleog1: Sword attack Modified: trunk/src/objects/erik.cpp =================================================================== --- trunk/src/objects/erik.cpp 2004-10-05 19:18:09 UTC (rev 75) +++ trunk/src/objects/erik.cpp 2004-10-06 11:22:14 UTC (rev 76) @@ -15,16 +15,16 @@ jump(V_JUMP), jump2(V_JUMP2) { weapon=Weapon(-1,W_PRESSURE,WS_PRESSURE); - im_left=new Animation(imgcache->loadImage("erik_left.bmp")); - im_right=new Animation(imgcache->loadImage("erik_right.bmp")); + im_left=new Animation(imgcache->loadImage("erik1_left.bmp")); + im_right=new Animation(imgcache->loadImage("erik1_right.bmp")); im_run_right=im_right; im_run_left=im_left; im_fall_left=im_left; im_fall_right=im_right; im_krit_left=im_left; im_krit_right=im_right; - im_land_left=new Animation(imgcache->loadImage("olaf_land_left.bmp"),1,T_IRR,true); - im_land_right=new Animation(imgcache->loadImage("olaf_land_right.bmp"),1,T_IRR,true); + im_land_left=new Animation(imgcache->loadImage("olaf1_land_left.bmp"),1,T_IRR,true); + im_land_right=new Animation(imgcache->loadImage("olaf1_land_right.bmp"),1,T_IRR,true); au_jump=sndcache->loadWAV("rboots.wav"); au_hit=sndcache->loadWAV("erikhit.wav"); au_run=NULL; Modified: trunk/src/objects/fang.cpp =================================================================== --- trunk/src/objects/fang.cpp 2004-10-05 19:18:09 UTC (rev 75) +++ trunk/src/objects/fang.cpp 2004-10-06 11:22:14 UTC (rev 76) @@ -11,18 +11,18 @@ 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_run_left=new Animation(imgcache->loadImage("olaf-run_left.png"),8,1000); - im_run_right=new Animation(imgcache->loadImage("olaf-run_right.png"),8,1000); + im_left=new Animation(imgcache->loadImage("Fang_Breath_left.png"),4,1000); + im_right=new Animation(imgcache->loadImage("Fang_Breath_right.png"),4,1000); + im_run_left=new Animation(imgcache->loadImage("Fang_walk_left.png"),8,1000); + im_run_right=new Animation(imgcache->loadImage("Fang_walk_right.png"),8,1000); im_fall_left=im_left; im_fall_right=im_right; im_krit_left=im_left; im_krit_right=im_right; - im_land_left=new Animation(imgcache->loadImage("olaf_land_left.bmp"),1,T_IRR,true); - im_land_right=new Animation(imgcache->loadImage("olaf_land_right.bmp"),1,T_IRR,true); - im_claw_left=new Animation(60,imgcache->loadImage("kuru.bmp"),12,500,true); - im_claw_right=im_claw_left; + im_land_left=new Animation(imgcache->loadImage("olaf1_land_left.bmp"),1,T_IRR,true); + im_land_right=new Animation(imgcache->loadImage("olaf1_land_right.bmp"),1,T_IRR,true); + im_claw_left=new Animation(imgcache->loadImage("Fang_Clawslash_left.png"),8,1000,true); + im_claw_right=new Animation(imgcache->loadImage("Fang_Clawslash_right.png"),8,1000,true); au_hit=sndcache->loadWAV("wolfhit.wav"); au_claw=sndcache->loadWAV("wolfjmp1.wav"); au_jump=sndcache->loadWAV("fangjump.wav"); @@ -35,6 +35,7 @@ delete im_land_left; delete im_land_right; delete im_claw_left; + delete im_claw_right; } void Fang::in_left(Sint16 dt) { Modified: trunk/src/objects/olaf.cpp =================================================================== --- trunk/src/objects/olaf.cpp 2004-10-05 19:18:09 UTC (rev 75) +++ trunk/src/objects/olaf.cpp 2004-10-06 11:22:14 UTC (rev 76) @@ -11,23 +11,23 @@ Olaf::Olaf(string imagename, Sint16 xcord, Sint16 ycord, string pname): Player(imagename,xcord,ycord,pname), fart(V_FART) { - im_left=new Animation(imgcache->loadImage("olaf_left.bmp")); - im_right=new Animation(imgcache->loadImage("olaf_right.bmp")); - im_run_left=new Animation(imgcache->loadImage("olaf-run_left.png"),8,1000); - im_run_right=new Animation(imgcache->loadImage("olaf-run_right.png"),8,1000); + im_left=new Animation(imgcache->loadImage("olaf1_left.bmp")); + im_right=new Animation(imgcache->loadImage("olaf1_right.bmp")); + im_run_left=new Animation(imgcache->loadImage("olaf1-run_left.png"),8,1000); + im_run_right=new Animation(imgcache->loadImage("olaf1-run_right.png"),8,1000); im_fall_left=im_left; im_fall_right=im_right; im_krit_left=im_left; im_krit_right=im_right; - im_land_left=new Animation(imgcache->loadImage("olaf_land_left.bmp"),1,T_IRR,true); - im_land_right=new Animation(imgcache->loadImage("olaf_land_right.bmp"),1,T_IRR,true); + im_land_left=new Animation(imgcache->loadImage("olaf1_land_left.bmp"),1,T_IRR,true); + im_land_right=new Animation(imgcache->loadImage("olaf1_land_right.bmp"),1,T_IRR,true); - im_small_left=new Animation(imgcache->loadImage("gun.bmp"),9,1000); - im_small_right=im_small_left; - im_run_small_left=im_small_left; - im_run_small_right=im_small_right; - im_shield_right=new Animation(imgcache->loadImage("olaf_fall_shield_right.bmp")); - im_shield_left=new Animation(imgcache->loadImage("olaf_fall_shield_left.bmp")); + im_small_left=new Animation(imgcache->loadImage("Olaf_Small_Walk_left.png"),7,0); + im_small_right=new Animation(imgcache->loadImage("Olaf_Small_Walk_right.png"),7,0); + im_run_small_left=new Animation(imgcache->loadImage("Olaf_Small_Walk_left.png"),7,500); + im_run_small_right=new Animation(imgcache->loadImage("Olaf_Small_Walk_right.png"),7,500); + im_shield_right=new Animation(imgcache->loadImage("olaf1_fall_shield_right.bmp")); + im_shield_left=new Animation(imgcache->loadImage("olaf1_fall_shield_left.bmp")); im_run_shield_right=im_shield_right; im_run_shield_left=im_shield_left; im_fall_shield_left=im_shield_left; @@ -46,6 +46,9 @@ delete im_land_left; delete im_land_right; delete im_small_left; + delete im_small_right; + delete im_run_small_left; + delete im_run_small_right; delete im_shield_right; delete im_shield_left; } @@ -121,9 +124,11 @@ //as we don't fall most states are off anyway unsetState(STATE_SHIELD); setState(STATE_SMALL); + maxspeedx/=4; } else { sfxeng->playWAV(au_big); unsetState(STATE_SMALL); + maxspeedx*=4; } return true; } else return false; Modified: trunk/src/objects/scorch.cpp =================================================================== --- trunk/src/objects/scorch.cpp 2004-10-05 19:18:09 UTC (rev 75) +++ trunk/src/objects/scorch.cpp 2004-10-06 11:22:14 UTC (rev 76) @@ -11,16 +11,16 @@ Player(imagename,xcord,ycord,pname), left_wings(SCORCH_MAX_WINGS), wing(V_FLY) { - im_left=new Animation(imgcache->loadImage("baleog_left.bmp")); - im_right=new Animation(imgcache->loadImage("baleog_right.bmp")); - im_run_left=new Animation(imgcache->loadImage("baleog-run_left.png"),8,1000); - im_run_right=new Animation(imgcache->loadImage("baleog-run_right.png"),8,1000); + im_left=new Animation(imgcache->loadImage("baleog1_left.bmp")); + im_right=new Animation(imgcache->loadImage("baleog1_right.bmp")); + im_run_left=new Animation(imgcache->loadImage("baleog1-run_left.png"),8,1000); + im_run_right=new Animation(imgcache->loadImage("baleog1-run_right.png"),8,1000); im_fall_left=im_left; im_fall_right=im_right; im_krit_left=im_left; im_krit_right=im_right; - im_land_left=new Animation(imgcache->loadImage("olaf_land_left.bmp"),1,T_IRR,true); - im_land_right=new Animation(imgcache->loadImage("olaf_land_right.bmp"),1,T_IRR,true); + im_land_left=new Animation(imgcache->loadImage("olaf1_land_left.bmp"),1,T_IRR,true); + im_land_right=new Animation(imgcache->loadImage("olaf1_land_right.bmp"),1,T_IRR,true); au_swing=sndcache->loadWAV("flapwngs.wav"); au_tired=sndcache->loadWAV("flwings.wav"); au_hit=sndcache->loadWAV("draghit.wav"); Modified: trunk/src/objects/zombie.cpp =================================================================== --- trunk/src/objects/zombie.cpp 2004-10-05 19:18:09 UTC (rev 75) +++ trunk/src/objects/zombie.cpp 2004-10-06 11:22:14 UTC (rev 76) @@ -15,8 +15,8 @@ au_attack(sndcache->loadWAV("clang.wav")), T_Attack_Bite(1500) { maxspeedx=100; - im_left=new Animation(imgcache->loadImage("olaf_left.bmp"),2,1000); - im_right=new Animation(imgcache->loadImage("olaf_right.bmp"),2,1000); + im_left=new Animation(imgcache->loadImage("olaf1_left.bmp"),2,1000); + im_right=new Animation(imgcache->loadImage("olaf1_right.bmp"),2,1000); weapon=Weapon(-1,W_STRIKE); } From DONOTREPLY at icculus.org Fri Oct 15 08:09:33 2004 From: DONOTREPLY at icculus.org (DONOTREPLY at icculus.org) Date: 15 Oct 2004 08:09:33 -0400 Subject: r77 - trunk/src/objects Message-ID: <20041015120933.26500.qmail@icculus.org> 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(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; +};