This commit is contained in:
Charles 2001-03-30 22:43:35 +00:00
parent 5bcc1f3ef9
commit 28e212b5c2
8 changed files with 78 additions and 7 deletions

View File

@ -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,
},
};

View File

@ -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,

View File

@ -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 );
}
/*===========================================================================

View File

@ -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;
};

View File

@ -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 );
}
}

View File

@ -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;

View File

@ -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
{

View File

@ -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: