diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index a1a4a56f6..ee2c94c47 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -75,6 +75,7 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] = true, DAMAGE__NONE, 0, + NPC_PLATFORM_INFINITE_LIFE, }, { // NPC_CIRCULAR_PLATFORM @@ -83,9 +84,22 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] = NPC_PLATFORM_MOVEMENT_FIXED_CIRCULAR, 3, 128, - false, + true, DAMAGE__NONE, 0, + NPC_PLATFORM_INFINITE_LIFE, + }, + + { // NPC_BUBBLE_PLATFORM + ACTORS_CLAM_A3D, + ANIM_CLAM_CLAMSHUT, + NPC_PLATFORM_MOVEMENT_BUBBLE, + 3, + 128, + true, + DAMAGE__NONE, + 0, + NPC_PLATFORM_FINITE_LIFE, }, }; diff --git a/source/game/pause.cpp b/source/game/pause.cpp index 0ac23e92a..d3937d993 100644 --- a/source/game/pause.cpp +++ b/source/game/pause.cpp @@ -104,7 +104,7 @@ void CPauseMenu::init() STR__DEBUG__FULLUNARMED_MODE, &newmode,PLAYER_MODE_FULLUNARMED); xpos+=TEXT_SPACING; -#ifdef __USER_paul__ +#if defined(__USER_paul__) || defined(__USER_charles__) // CGUIFactory::createValueButtonFrame(m_guiFrame, // (FRAME_WIDTH-TEXT_BOX_WIDTH)/2,xpos,TEXT_BOX_WIDTH,TEXT_BOX_HEIGHT, // STR__DEBUG__NET_MODE, diff --git a/source/player/player.cpp b/source/player/player.cpp index 90a8d4c4a..1094fb037 100644 --- a/source/player/player.cpp +++ b/source/player/player.cpp @@ -544,7 +544,10 @@ int CPlayer::getHeightFromGround(int _x,int _y,int _maxHeight) { DVECTOR platformPos; platformPos=m_platform->getPos(); - height=platformPos.vy-Pos.vy; + DVECTOR newPos = getNewCollidedPos(); + + height = newPos.vy - Pos.vy; + // if(height<-_maxHeight) // { // height=-_maxHeight; @@ -1088,6 +1091,15 @@ void CPlayer::clearPlatform() m_platform=NULL; } +void CPlayer::setHasPlatformCollided( bool newVal ) +{ + m_hasPlatformCollided = newVal; +} + +bool CPlayer::getHasPlatformCollided() +{ + return( m_hasPlatformCollided ); +} /*=========================================================================== diff --git a/source/player/player.h b/source/player/player.h index e3ba31f1d..2ec174a61 100644 --- a/source/player/player.h +++ b/source/player/player.h @@ -139,6 +139,8 @@ public: virtual void think(int _frames); virtual void render(); virtual void shove(DVECTOR move); + virtual void setHasPlatformCollided( bool newVal ); + virtual bool getHasPlatformCollided(); DVECTOR getCameraPos() {return m_cameraPos;} @@ -266,7 +268,8 @@ private: DVECTOR m_prevPlatformPos; */ - +private: + bool m_hasPlatformCollided; }; diff --git a/source/player/pmbubble.cpp b/source/player/pmbubble.cpp index d04c12531..1e333f6f3 100644 --- a/source/player/pmbubble.cpp +++ b/source/player/pmbubble.cpp @@ -16,6 +16,7 @@ -------- */ #include "player\pmbubble.h" +#include "enemy\nplatfrm.h" /* Std Lib @@ -94,6 +95,10 @@ void CPlayerModeBubbleMixture::think() // Start the anim off m_blowFrame=0; m_blowing=true; + + CNpcPlatform *bubble = new ("bubble platform") CNpcPlatform; + bubble->setType( CNpcPlatform::NPC_BUBBLE_PLATFORM ); + bubble->init( m_player->getPos(), 4 ); } } diff --git a/source/player/pmodes.cpp b/source/player/pmodes.cpp index bd5cc17dc..711c4e251 100644 --- a/source/player/pmodes.cpp +++ b/source/player/pmodes.cpp @@ -319,6 +319,11 @@ void CPlayerModeBase::thinkVerticalMovement() setState(STATE_FALL); } */ + if ( m_player->isOnPlatform() && m_moveVelocity.vy >= 0 ) + { + pos.vy += colHeight; + m_moveVelocity.vy=0; + } } pos.vy+=m_moveVelocity.vy>>VELOCITY_SHIFT; diff --git a/source/thing/thing.cpp b/source/thing/thing.cpp index 9e7a471fd..f928589b8 100644 --- a/source/thing/thing.cpp +++ b/source/thing/thing.cpp @@ -128,11 +128,16 @@ void CThingManager::thinkAllThings(int _frames) // Player -> Platform collision thing1=s_thingLists[CThing::TYPE_PLATFORM]; thing2=s_thingLists[CThing::TYPE_PLAYER]; + + thing2->setHasPlatformCollided( false ); + thing2->setNewCollidedPos( thing2->getPos() ); + while(thing1&&thing2) { //if ( !thing1->hasChild( thing2 ) ) { thing1->removeAllChild(); + if(thing1->canCollide()&& thing1->checkCollisionAgainst(thing2)) { @@ -776,11 +781,36 @@ int CThing::checkCollisionAgainst(CThing *_thisThing) if ( ( newPos.vx >= thisRect.x1 && newPos.vx <= thisRect.x2 ) && ( newPos.vy >= thisRect.y1 && newPos.vy <= thisRect.y2 ) ) { - _thisThing->setCentreCollision( true ); - thatPos.vy = getNewYPos( _thisThing ); - _thisThing->setNewCollidedPos( thatPos ); + if ( thatPos.vy - _thisThing->getPos().vy >= -10 ) + { + _thisThing->setHasPlatformCollided( true ); + + _thisThing->setCentreCollision( true ); + + if ( _thisThing->getHasPlatformCollided() ) + { + // if this has already collided with a platform, check the current platform is + // (a) within 10 units, + // (b) higher + + DVECTOR oldCollidedPos = _thisThing->getNewCollidedPos(); + + if ( thatPos.vy < oldCollidedPos.vy ) + { + _thisThing->setNewCollidedPos( thatPos ); + } + } + else + { + _thisThing->setNewCollidedPos( thatPos ); + } + } + else + { + _thisThing->setCentreCollision( false ); + } } else { diff --git a/source/thing/thing.h b/source/thing/thing.h index 29f1d61b3..ec1e0452e 100644 --- a/source/thing/thing.h +++ b/source/thing/thing.h @@ -129,6 +129,8 @@ public: virtual int checkCollisionAgainst(CThing *_thisThing); void updateCollisionArea(); virtual void collidedWith(CThing *_thisThing) {;} + virtual void setHasPlatformCollided( bool newVal ) {;} + virtual bool getHasPlatformCollided() {return false;} s32 getNewYPos( CThing *_thisThing ); void setNewCollidedPos(DVECTOR newPos) {m_newCollidedPos = newPos;} protected: