[Clonekeenplus-commits] [SCM] clonekeenplus branch, master, updated. 2793f76aa38716883647b78a4b243c
Commander Keen Interpreter
Brought to you by:
gerstrong
From: Gerstrong <ger...@us...> - 2011-09-18 16:54:20
|
via 2793f76aa38716883647b78a4b243c6a8cda164b (commit) via 05e7f1615494e4f462294a05c327f3ef483ad455 (commit) via 5dea742510bc293cbca3dcf3303ecfa68b19e069 (commit) via 2f12705c50813a84d89530311a38a799e70dbb89 (commit) from f3c08da2597679806b460f4b8a3498e955f03d06 (commit) - Log ----------------------------------------------------------------- commit 2793f76aa38716883647b78a4b243c6a8cda164b Author: Gerstrong <ger...@gm...> Date: Sun Sep 18 18:53:14 2011 +0200 Small bounce change to the mad mushroom commit 05e7f1615494e4f462294a05c327f3ef483ad455 Author: Gerstrong <ger...@gm...> Date: Sun Sep 18 18:52:41 2011 +0200 Mimrock changes commit 5dea742510bc293cbca3dcf3303ecfa68b19e069 Author: Gerstrong <ger...@gm...> Date: Sun Sep 18 18:24:20 2011 +0200 Mimrock changes commit 2f12705c50813a84d89530311a38a799e70dbb89 Author: Gerstrong <ger...@gm...> Date: Sun Sep 18 18:08:48 2011 +0200 Added Mimrock ----------------------------------------------------------------------- Summary of changes: src/engine/galaxy/CMapLoaderGalaxy.cpp | 7 ++ src/engine/galaxy/ai/ep4/CMadMushroom.cpp | 2 +- src/engine/galaxy/ai/ep4/CMimrock.cpp | 99 +++++++++++++++++++++++++++++ src/engine/galaxy/ai/ep4/CMimrock.h | 31 +++++++++ 4 files changed, 138 insertions(+), 1 deletions(-) create mode 100644 src/engine/galaxy/ai/ep4/CMimrock.cpp create mode 100644 src/engine/galaxy/ai/ep4/CMimrock.h diff --git a/src/engine/galaxy/CMapLoaderGalaxy.cpp b/src/engine/galaxy/CMapLoaderGalaxy.cpp index 1acbb10..53f213c 100644 --- a/src/engine/galaxy/CMapLoaderGalaxy.cpp +++ b/src/engine/galaxy/CMapLoaderGalaxy.cpp @@ -40,6 +40,7 @@ #include "engine/galaxy/ai/ep4/CLick.h" #include "engine/galaxy/ai/ep4/CLindsey.h" #include "engine/galaxy/ai/ep4/CSkypest.h" +#include "engine/galaxy/ai/ep4/CMimrock.h" // General stuff #include "engine/galaxy/ai/CSpriteItem.h" @@ -424,6 +425,12 @@ void CMapLoaderGalaxy::addFoe(CMap &Map, word foe, size_t x, size_t y) p_newfoe = new galaxy::CBounder(&Map, x, y-250); break; + case 19: + //This is a Mimrock. + // TODO: Those relative coordinates are not a good sign. Try to remove them and make the Sprite substract them + p_newfoe = new galaxy::CMimrock(&Map, x, y-(2<<CSF)); + break; + case 21: // This is a Mad Mushroom. diff --git a/src/engine/galaxy/ai/ep4/CMadMushroom.cpp b/src/engine/galaxy/ai/ep4/CMadMushroom.cpp index 4b6c859..f5c92d6 100644 --- a/src/engine/galaxy/ai/ep4/CMadMushroom.cpp +++ b/src/engine/galaxy/ai/ep4/CMadMushroom.cpp @@ -68,7 +68,7 @@ void CMadMushroom::process() yinertia = -MUSHROOM_LOW_INERTIA; jumpcounter++; - if( jumpcounter>=2 ) + if( jumpcounter>=3 ) { yinertia = -MUSHROOM_HIGH_INERTIA; jumpcounter = 0; diff --git a/src/engine/galaxy/ai/ep4/CMimrock.cpp b/src/engine/galaxy/ai/ep4/CMimrock.cpp new file mode 100644 index 0000000..5f0438f --- /dev/null +++ b/src/engine/galaxy/ai/ep4/CMimrock.cpp @@ -0,0 +1,99 @@ +/* + * CMimrock.cpp + * + * Created on: 18.09.2011 + * Author: gerstrong + */ + +#include "CMimrock.h" +#include "engine/galaxy/ai/CPlayerBase.h" + +namespace galaxy { + +#define A_MIMROCK_SIT 0 +#define A_MIMROCK_WALK 1 +#define A_MIMROCK_JUMP 7 +#define A_MIMROCK_BOUNCE 10 +#define A_MIMROCK_STUNNED 11 + +const int CSF_DISTANCE_TO_FOLLOW_TOLERANCE = 2<<CSF; +const int WALK_SPEED = 10; + +CMimrock::CMimrock(CMap *pmap, Uint32 x, Uint32 y) : +CObject(pmap, x, y, OBJ_NONE), +CStunnable(pmap, x, y, OBJ_NONE) +{ + setupGalaxyObjectOnMap(0x343A, A_MIMROCK_SIT); + mp_processState = (void (CStunnable::*)()) &CMimrock::processSit; + m_hDir = NONE; +} + + +bool CMimrock::isNearby(CObject &theObject) +{ + if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) ) + { + const int dx = player->getXMidPos() - getXMidPos(); + + if( dx>-CSF_DISTANCE_TO_FOLLOW_TOLERANCE && + dx<+CSF_DISTANCE_TO_FOLLOW_TOLERANCE ) + { + if( dx<0 ) + m_hDir = LEFT; + else + m_hDir = RIGHT; + + setAction(A_MIMROCK_WALK); + mp_processState = (void (CStunnable::*)()) &CMimrock::processWalk; + } + } + + return true; +} + +void CMimrock::processSit() +{ + // When sitting the rock doesn't do any thing, so this stays empty for now. +} + +void CMimrock::processWalk() +{ + if(m_hDir == LEFT) + moveLeft(WALK_SPEED); + else + moveRight(WALK_SPEED); + + if(getActionStatus(A_MIMROCK_SIT)) + { + setAction(A_MIMROCK_SIT); + mp_processState = (void (CStunnable::*)()) &CMimrock::processSit; + } +} + +void CMimrock::processJump() +{ + // TODO: Code here! +} + +void CMimrock::processBounce() +{ + // TODO: Code here! +} + +void CMimrock::processStunned() +{ + // TODO: Code here! +} + +void CMimrock::process() +{ + performCollisions(); + processFalling(); + + (this->*mp_processState)(); + + processActionRoutine(); +} + + +} /* namespace galaxy */ diff --git a/src/engine/galaxy/ai/ep4/CMimrock.h b/src/engine/galaxy/ai/ep4/CMimrock.h new file mode 100644 index 0000000..e414df9 --- /dev/null +++ b/src/engine/galaxy/ai/ep4/CMimrock.h @@ -0,0 +1,31 @@ +/* + * CMimrock.h + * + * Created on: 18.09.2011 + * Author: gerstrong + */ + +#ifndef CMIMROCK_H_ +#define CMIMROCK_H_ + +#include "engine/galaxy/ai/CStunnable.h" + +namespace galaxy { + +class CMimrock: public CStunnable +{ +public: + + CMimrock(CMap *pmap, Uint32 x, Uint32 y); + + bool isNearby(CObject &theObject); + void process(); + void processSit(); + void processWalk(); + void processJump(); + void processBounce(); + void processStunned(); +}; + +} /* namespace galaxy */ +#endif /* CMIMROCK_H_ */ hooks/post-receive -- clonekeenplus |