Commit 77894eed authored by Gerhard Stein's avatar Gerhard Stein

More collision fixes

parent b073367d
......@@ -692,33 +692,20 @@ void CSpriteObject::processMoveBitUp()
void CSpriteObject::processMoveBitDown()
{
/// Now check the neighboring tile to the down
const unsigned int x1 = getXPosition()+m_BBox.x1;
const unsigned int x2 = getXPosition()+m_BBox.x2;
const unsigned int y2 = getYPosition()+m_BBox.y2;
if( ( blockedd = checkSolidD(x1, x2, y2) ) == true )
{
if(g_pBehaviorEngine->getEpisode()<=3) // Galaxy only!
return;
/// Now check the neighboring tile to the down
const unsigned int x1 = getXPosition()+m_BBox.x1;
const unsigned int x2 = getXPosition()+m_BBox.x2;
const unsigned int y2 = getYPosition()+m_BBox.y2;
// additionally if there is a narrow space and the object might fit in, try to move it into that space
const int xMid = (x1+x2)/2;
if(checkSolidU(x1, xMid, y2) == false)
{
processMoveBitLeft();
}
else if(checkSolidU(xMid, x2, y2) == false)
{
processMoveBitRight();
}
return;
if( ( blockedd = checkSolidD(x1, x2, y2) ) == true )
{
return;
}
// if we are here, the tiles aren't blocking us.
// TODO: Here we need the Object collision part
m_Pos.y+=MOVE_RES;
// if we are here, the tiles aren't blocking us.
// TODO: Here we need the Object collision part
m_Pos.y+=MOVE_RES;
}
......
......@@ -581,13 +581,13 @@ void CPlayerLevel::processMoveBitDown()
auto obj = mObjectPtrs.begin();
for( ; obj != mObjectPtrs.end() ; obj++ )
{
if( CPlatform *platform = dynamic_cast<CPlatform*>(obj->get()) )
{
if(platform->hitdetect(*this))
{
platform->getTouchedBy(*this);
}
}
if( CPlatform *platform = dynamic_cast<CPlatform*>(obj->get()) )
{
if(platform->hitdetect(*this))
{
platform->getTouchedBy(*this);
}
}
}
CSpriteObject::processMoveBitDown();
......
......@@ -1197,5 +1197,33 @@ void CPlayerWM::setMounted(const bool value)
mounted = value;
}
void CPlayerWM::processMoveBitDown()
{
/// Now check the neighboring tile to the down
const unsigned int x1 = getXPosition()+m_BBox.x1;
const unsigned int x2 = getXPosition()+m_BBox.x2;
const unsigned int y2 = getYPosition()+m_BBox.y2;
if( ( blockedd = checkSolidD(x1, x2, y2) ) == true )
{
// additionally if there is a narrow space and the object might fit in, try to move it into that space
const int xMid = (x1+x2)/2;
if(checkSolidD(x1, xMid, y2) == false)
{
processMoveBitLeft();
}
else if(checkSolidD(xMid, x2, y2) == false)
{
processMoveBitRight();
}
return;
}
// if we are here, the tiles aren't blocking us.
m_Pos.y++;
}
}
......@@ -74,6 +74,8 @@ public:
void setMounted(const bool value);
void processMoveBitDown();
private:
Uint16 m_basesprite;
Uint16 m_teleportanibasetile;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment