Commit d6171ecc authored by Gerhard Stein's avatar Gerhard Stein

Cleaning up more mess and restructuring...

parent d53c93fa
......@@ -275,7 +275,15 @@ bool CSpriteObject::hitdetectWithTileProperty(const int Property, const int x, c
return false;
}
const int COLISION_RES = (1<<STC);
bool CSpriteObject::checkMapBoundaryR(const int x2)
{
if( (Uint16)x2 > ((mp_Map->m_width)<<CSF) ) // Out of map?
{
exists = false; // deactivate it!
return true;
}
return false;
}
int CSpriteObject::checkSolidR( int x1, int x2, int y1, int y2)
{
......@@ -303,28 +311,7 @@ int CSpriteObject::checkSolidR( int x1, int x2, int y1, int y2)
return blocker;
}
if( m_type == OBJ_PLAYER && solid )
{
if(vorticon)
{
if( x2 >= (int)((mp_Map->m_width-2)<<CSF) ) return 1;
}
else
{
if( x2 >= (int)((mp_Map->m_width-1)<<CSF) ) return 1;
}
}
else
{
if( (Uint16)x2 > ((mp_Map->m_width)<<CSF) )
{
exists=false; // Out of map?
return 1;
}
}
return 0;
return checkMapBoundaryR(x2) ? 1 : 0;
}
int CSpriteObject::checkSolidL( int x1, int x2, int y1, int y2)
......@@ -733,7 +720,7 @@ void CSpriteObject::processPushOutCollision()
const unsigned int y1 = getYPosition()+m_BBox.y1;
const unsigned int y2 = getYPosition()+m_BBox.y2;
if( checkSolidL(x1, x2, y1, y2) /*&& checkSolidR(x1, x2, y1, y2)*/ )
if( checkSolidL(x1, x2, y1, y2) )
{
// Push him right to the position where he is not blocked anymore
int should_x = x1;
......
......@@ -806,6 +806,15 @@ void CPlayer::freeze()
playcontrol[PA_X] = 0;
}
bool CPlayer::checkMapBoundaryR(const int x2)
{
if( solid && x2 >= (int)((mp_Map->m_width-2)<<CSF) )
return true;
return false;
}
bool CPlayer::checkObjSolid()
{
supportedbyobject = false;
......
......@@ -86,6 +86,8 @@ public:
int pollLevelTrigger();
void getShotByRay(object_t &obj_type);
bool checkMapBoundaryR(const int x2);
// Used for both situations
void processCamera();
void InertiaAndFriction_X();
......
......@@ -29,6 +29,8 @@
#include "objenums.h"
const int COLISION_RES = (1<<STC);
// The bouncing box used by the object which is used to determine the collisions
struct BoundingBox{
unsigned int x1, x2, y1, y2;
......@@ -219,6 +221,8 @@ public:
int checkSolidU( int x1, int x2, int y1, const bool push_mode=false );
int checkSolidD( int x1, int x2, int y2, const bool push_mode=false );
virtual bool checkMapBoundaryR(const int x2);
// special functions for sloped tiles
bool checkslopedU( int c, int y1, char blocked);
bool checkslopedD( int c, int y2, char blocked);
......
......@@ -10,3 +10,4 @@
CGalaxySpriteObject::CGalaxySpriteObject(CMap *pmap, Uint32 x, Uint32 y, object_t type) :
CSpriteObject(pmap, x, y, type)
{}
......@@ -343,6 +343,13 @@ void CPlayerBase::kill()
}
bool CPlayerBase::checkMapBoundaryR(const int x2)
{
if( solid && x2 >= (int)((mp_Map->m_width-1)<<CSF) )
return true;
return false;
}
......
......@@ -88,6 +88,8 @@ public:
protected:
bool checkMapBoundaryR(const int x2);
std::vector<CSpriteObject*>& m_ObjectPtrs;
Sint16 m_playcontrol[PA_MAX_ACTIONS];
......
......@@ -10,3 +10,4 @@
CVorticonSpriteObject::CVorticonSpriteObject(CMap *pmap, Uint32 x, Uint32 y, object_t type) :
CSpriteObject(pmap, x, y, type)
{}
......@@ -111,18 +111,18 @@ void CRay::moveinAir()
{
std::vector<CTileProperties> &TileProperties = g_pBehaviorEngine->getTileProperties();
CSprite &raysprite = g_pGfxEngine->getSprite(sprite);
bool hitlethal;
//bool hitlethal; // TODO: Why is this here?
if (m_Direction == RIGHT)
{
// don't go through bonklethal tiles, even if they're not solid
// (for the arms on mortimer's machine)
if (TileProperties.at(mp_Map->at(((getXPosition()>>(CSF-4))+raysprite.getWidth())>>4, (getYPosition()>>CSF)+1)).behaviour == 1)
/*if (TileProperties.at(mp_Map->at(((getXPosition()>>(CSF-4))+raysprite.getWidth())>>4, (getYPosition()>>CSF)+1)).behaviour == 1)
hitlethal = true;
else if (TileProperties.at(mp_Map->at(((getXPosition()>>(CSF-4))+raysprite.getWidth())>>4, ((getYPosition()>>(CSF-4))+(raysprite.getHeight()-1))>>(CSF-4))).behaviour == 1)
hitlethal = true;
else
hitlethal = false;
hitlethal = false;*/
if (blockedr)
{
......@@ -135,12 +135,12 @@ void CRay::moveinAir()
}
else if (m_Direction == LEFT)
{
if (TileProperties.at(mp_Map->at((getXPosition()-1)>>CSF, (getYPosition()+1)>>CSF)).behaviour == 1)
/*if (TileProperties.at(mp_Map->at((getXPosition()-1)>>CSF, (getYPosition()+1)>>CSF)).behaviour == 1)
hitlethal = true;
else if (TileProperties.at(mp_Map->at((getXPosition()-1)>>CSF, ((getYPosition()>>(CSF-4))+(raysprite.getHeight()-1))>>(CSF-4))).behaviour == 1)
hitlethal = true;
else
hitlethal = false;
hitlethal = false;*/
if (blockedl)
{
......
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