This commit is contained in:
Daveo 2001-07-23 19:26:37 +00:00
parent 1da64afa81
commit c7fe8c740b
70 changed files with 302 additions and 445 deletions

View file

@ -69,7 +69,7 @@ void CBridgeBalloon::shutdown()
int CBridgeBalloon::checkCollisionAgainst(CThing *_thisThing, int _frames)
{
DVECTOR projectilePos = _thisThing->getPos();
DVECTOR const &projectilePos = _thisThing->getPos();
s32 xDist = projectilePos.vx - Pos.vx;
s32 yDist = projectilePos.vy - Pos.vy;
@ -284,15 +284,15 @@ int CNpcBalloonBridgePlatform::checkCollisionAgainst(CThing *_thisThing, int _fr
thisRect = getCollisionArea();
thatRect = _thisThing->getCollisionArea();
DVECTOR posDelta = getPosDelta();
DVECTOR const &thisPosDelta = getPosDelta();
int ThisAbsY=abs(thisPosDelta.vy)>>1;
thisRect.y1 -= ThisAbsY;
thisRect.y2 += ThisAbsY;
thisRect.y1 -= abs( posDelta.vy ) >> 1;
thisRect.y2 += abs( posDelta.vy ) >> 1;
posDelta = _thisThing->getPosDelta();
thatRect.y1 -= abs( posDelta.vy ) >> 1;
thatRect.y2 += abs( posDelta.vy ) >> 1;
DVECTOR const &ThatPosDelta = _thisThing->getPosDelta();
int ThatAbsY=abs(ThatPosDelta.vy)>>1;
thatRect.y1 -= ThatAbsY;
thatRect.y2 += ThatAbsY;
if(((thisRect.x1>=thatRect.x1&&thisRect.x1<=thatRect.x2)||(thisRect.x2>=thatRect.x1&&thisRect.x2<=thatRect.x2)||(thisRect.x1<=thatRect.x1&&thisRect.x2>=thatRect.x2))&&
((thisRect.y1>=thatRect.y1&&thisRect.y1<=thatRect.y2)||(thisRect.y2>=thatRect.y1&&thisRect.y2<=thatRect.y2)||(thisRect.y1<=thatRect.y1&&thisRect.y2>=thatRect.y2)))

View file

@ -21,7 +21,7 @@
class CBridgeBalloon
{
public:
void setPos( DVECTOR newPos ) {Pos = newPos;}
void setPos( DVECTOR const &newPos ) {Pos = newPos;}
void render();
void init();
void shutdown();

View file

@ -36,7 +36,7 @@ void CNpcBobbingPlatform::processMovement( int _frames )
if ( m_contact )
{
CPlayer *player = GameScene.getPlayer();
DVECTOR playerPos = player->getPos();
DVECTOR const &playerPos = player->getPos();
int height = player->getHeightFromGroundNoPlatform( playerPos.vx, playerPos.vy );

View file

@ -145,15 +145,15 @@ void CNpcBouncePlatform::collidedWith( CThing *_thisThing )
case TYPE_PLAYER:
{
CPlayer *player;
DVECTOR playerPos;
CRECT collisionArea;
CRECT playerCollisionArea;
// DVECTOR playerPos;
// CRECT collisionArea;
// CRECT playerCollisionArea;
// Only interested in SBs feet colliding with the box (pkg)
player=(CPlayer*)_thisThing;
playerPos=player->getPos();
playerCollisionArea = player->getCollisionArea();
collisionArea=getCollisionArea();
DVECTOR const &playerPos=player->getPos();
CRECT const &playerCollisionArea = player->getCollisionArea();
CRECT const &collisionArea=getCollisionArea();
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );

View file

@ -99,15 +99,15 @@ int CNpcBubblePlatform::checkCollisionAgainst(CThing *_thisThing, int _frames)
thisRect = getCollisionArea();
thatRect = _thisThing->getCollisionArea();
DVECTOR posDelta = getPosDelta();
DVECTOR const &thisPosDelta = getPosDelta();
int ThisAbsY=abs(thisPosDelta.vy)>>1;
thisRect.y1 -= ThisAbsY;
thisRect.y2 += ThisAbsY;
thisRect.y1 -= abs( posDelta.vy ) >> 1;
thisRect.y2 += abs( posDelta.vy ) >> 1;
posDelta = _thisThing->getPosDelta();
thatRect.y1 -= abs( posDelta.vy ) >> 1;
thatRect.y2 += abs( posDelta.vy ) >> 1;
DVECTOR const &ThatPosDelta = _thisThing->getPosDelta();
int ThatAbsY=abs(ThatPosDelta.vy)>>1;
thatRect.y1 -= ThatAbsY;
thatRect.y2 += ThatAbsY;
if(((thisRect.x1>=thatRect.x1&&thisRect.x1<=thatRect.x2)||(thisRect.x2>=thatRect.x1&&thisRect.x2<=thatRect.x2)||(thisRect.x1<=thatRect.x1&&thisRect.x2>=thatRect.x2))&&
((thisRect.y1>=thatRect.y1&&thisRect.y1<=thatRect.y2)||(thisRect.y2>=thatRect.y1&&thisRect.y2<=thatRect.y2)||(thisRect.y1<=thatRect.y1&&thisRect.y2>=thatRect.y2)))

View file

@ -154,15 +154,15 @@ void CNpcBubbleTubePlatform::collidedWith( CThing *_thisThing )
case TYPE_PLAYER:
{
CPlayer *player;
DVECTOR playerPos;
CRECT collisionArea;
CRECT playerCollisionArea;
// DVECTOR playerPos;
// CRECT collisionArea;
// CRECT playerCollisionArea;
// Only interested in SBs feet colliding with the box (pkg)
player=(CPlayer*)_thisThing;
playerPos=player->getPos();
playerCollisionArea = player->getCollisionArea();
collisionArea=getCollisionArea();
DVECTOR const &playerPos=player->getPos();
CRECT const &playerCollisionArea = player->getCollisionArea();
CRECT const &collisionArea=getCollisionArea();
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );

View file

@ -102,7 +102,7 @@ int CNpcBigWheelPlatform::getHeightFromPlatformAtPosition(int _x,int _y, int off
{
DVECTOR top;
CRECT collisionArea = getCollisionArea();
CRECT const &collisionArea = getCollisionArea();
top.vy = offsetY + collisionArea.y1;

View file

@ -75,7 +75,7 @@ void CNpcCartPlatform::processMovement( int _frames )
CPlayer *player = GameScene.getPlayer();
DVECTOR newPos = Pos;
CRECT collisionArea=getCollisionArea();
CRECT const &collisionArea=getCollisionArea();
newPos.vy = collisionArea.y1;
player->setPos( newPos );
@ -98,7 +98,7 @@ void CNpcCartPlatform::processMovement( int _frames )
Pos.vy += moveY;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
s32 yPos = Pos.vy - offset.vy;
@ -365,15 +365,15 @@ void CNpcCartPlatform::collidedWith( CThing *_thisThing )
case TYPE_PLAYER:
{
CPlayer *player;
DVECTOR playerPos;
CRECT collisionArea;
CRECT playerCollisionArea;
// DVECTOR playerPos;
// CRECT collisionArea;
// CRECT playerCollisionArea;
// Only interested in SBs feet colliding with the box (pkg)
player=(CPlayer*)_thisThing;
playerPos=player->getPos();
playerCollisionArea = player->getCollisionArea();
collisionArea=getCollisionArea();
DVECTOR const & playerPos=player->getPos();
CRECT const & playerCollisionArea = player->getCollisionArea();
CRECT const & collisionArea=getCollisionArea();
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );

View file

@ -52,15 +52,15 @@ void CNpcClamPlatform::collidedWith( CThing *_thisThing )
case TYPE_PLAYER:
{
CPlayer *player;
DVECTOR playerPos;
CRECT collisionArea;
CRECT playerCollisionArea;
// DVECTOR playerPos;
// CRECT collisionArea;
// CRECT playerCollisionArea;
// Only interested in SBs feet colliding with the box (pkg)
player=(CPlayer*)_thisThing;
playerPos=player->getPos();
playerCollisionArea = player->getCollisionArea();
collisionArea=getCollisionArea();
DVECTOR const &playerPos=player->getPos();
CRECT const &playerCollisionArea = player->getCollisionArea();
CRECT const &collisionArea=getCollisionArea();
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );

View file

@ -120,7 +120,7 @@ void CNpcConveyorPlatform::processMovement( int _frames )
m_rotation += 64 * _frames;
m_rotation &= 4095;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
Pos.vy += 3 * _frames;
@ -187,13 +187,13 @@ void CNpcConveyorPlatform::collidedWith( CThing *_thisThing )
case TYPE_PLAYER:
{
CPlayer *player;
DVECTOR playerPos;
CRECT collisionArea;
// DVECTOR playerPos;
// CRECT collisionArea;
// Only interested in SBs feet colliding with the box (pkg)
player=(CPlayer*)_thisThing;
playerPos=player->getPos();
collisionArea=getCollisionArea();
DVECTOR const &playerPos=player->getPos();
CRECT const &collisionArea=getCollisionArea();
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
@ -226,7 +226,7 @@ void CNpcConveyorPlatform::collidedWith( CThing *_thisThing )
{
int distLeft, distRight;
DVECTOR playerCollisionSize = player->getCollisionSize();
DVECTOR const &playerCollisionSize = player->getCollisionSize();
distLeft = collisionArea.x1 - playerPos.vx - ( playerCollisionSize.vx >> 1 );
distRight = collisionArea.x2 - playerPos.vx + ( playerCollisionSize.vx >> 1 );

View file

@ -238,7 +238,7 @@ void CNpcDualPlatform::render()
{
int x1,y1,x2,y2;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
if ( m_isActive )
{
@ -343,15 +343,15 @@ void CNpcDualPlatform::collidedWith( CThing *_thisThing )
case TYPE_PLAYER:
{
CPlayer *player;
DVECTOR playerPos;
CRECT collisionArea;
CRECT playerCollisionArea;
// DVECTOR playerPos;
// CRECT collisionArea;
// CRECT playerCollisionArea;
// Only interested in SBs feet colliding with the box (pkg)
player=(CPlayer*)_thisThing;
playerPos=player->getPos();
playerCollisionArea = player->getCollisionArea();
collisionArea=getCollisionArea();
DVECTOR const &playerPos=player->getPos();
CRECT const &playerCollisionArea = player->getCollisionArea();
CRECT const &collisionArea=getCollisionArea();
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
@ -391,12 +391,12 @@ void CNpcDualPlatform::collidedWith( CThing *_thisThing )
case TYPE_NPC:
{
CNpcFriend *friendNpc;
DVECTOR friendPos;
CRECT collisionArea;
// DVECTOR friendPos;
// CRECT collisionArea;
friendNpc = (CNpcFriend*) _thisThing;
friendPos = friendNpc->getPos();
collisionArea=getCollisionArea();
DVECTOR const &friendPos = friendNpc->getPos();
CRECT const &collisionArea=getCollisionArea();
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );

View file

@ -48,7 +48,7 @@ void CNpcFallingNoRespawnPlatform::processMovement( int _frames )
s32 distX, distY, heading;
bool pathComplete;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
if ( m_spinFinish )
{

View file

@ -81,7 +81,7 @@ void CNpcFallingBlockPlatform::processMovement( int _frames )
}
else
{
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
s32 yPos = Pos.vy - offset.vy;
@ -106,15 +106,15 @@ void CNpcFallingBlockPlatform::collidedWith( CThing *_thisThing )
case TYPE_PLAYER:
{
CPlayer *player;
DVECTOR playerPos;
CRECT collisionArea;
CRECT playerCollisionArea;
// DVECTOR playerPos;
// CRECT collisionArea;
// CRECT playerCollisionArea;
// Only interested in SBs feet colliding with the box (pkg)
player=(CPlayer*)_thisThing;
playerPos=player->getPos();
playerCollisionArea = player->getCollisionArea();
collisionArea=getCollisionArea();
DVECTOR const &playerPos=player->getPos();
CRECT const &playerCollisionArea = player->getCollisionArea();
CRECT const &collisionArea=getCollisionArea();
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );

View file

@ -80,7 +80,7 @@ void CNpcGeyserBubblePlatform::processMovement( int _frames )
}
}
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
s32 yPos = Pos.vy - offset.vy;

View file

@ -59,7 +59,7 @@ void CNpcGhostTrainPlatform::processMovement( int _frames )
CPlayer *player = GameScene.getPlayer();
DVECTOR newPos = Pos;
CRECT collisionArea=getCollisionArea();
CRECT const &collisionArea=getCollisionArea();
newPos.vy = collisionArea.y1;
player->setPos( newPos );
@ -82,7 +82,7 @@ void CNpcGhostTrainPlatform::processMovement( int _frames )
Pos.vy += moveY;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
s32 yPos = Pos.vy - offset.vy;

View file

@ -64,15 +64,15 @@ void CNpcJellyfishPlatform::collidedWith( CThing *_thisThing )
if ( m_detectCollision && m_isActive )
{
CPlayer *player;
DVECTOR playerPos;
CRECT collisionArea;
CRECT playerArea;
// DVECTOR playerPos;
// CRECT collisionArea;
// CRECT playerArea;
// Only interested in SBs feet colliding with the box (pkg)
player=(CPlayer*)_thisThing;
playerPos=player->getPos();
playerArea=player->getCollisionArea();
collisionArea=getCollisionArea();
DVECTOR const &playerPos=player->getPos();
CRECT const &playerArea=player->getCollisionArea();
CRECT const &collisionArea=getCollisionArea();
s32 height = getHeightFromPlatformAtPosition(playerPos.vx,playerPos.vy);

View file

@ -689,8 +689,8 @@ void CNpcPlatform::reinit()
void CNpcPlatform::calculateNonRotatedCollisionData()
{
DVECTOR collisionSize = getCollisionSize();
DVECTOR collisionOffset = getCollisionCentreOffset();
DVECTOR const &collisionSize = getCollisionSize();
DVECTOR const &collisionOffset = getCollisionCentreOffset();
m_nonRotatedCollisionArea.XMax = ( collisionSize.vx >> 1 ) + collisionOffset.vx;
m_nonRotatedCollisionArea.XMin = -( collisionSize.vx >> 1 ) + collisionOffset.vx;
@ -859,9 +859,7 @@ void CNpcPlatform::setCollisionAngle(int newAngle)
player=GameScene.getPlayer();
if(player->isOnPlatform()==this)
{
DVECTOR playerPos;
playerPos=player->getPos();
DVECTOR const &playerPos=player->getPos();
DVECTOR shove;
shove.vx = 0;
@ -955,7 +953,7 @@ void CNpcPlatform::processTilt( int _frames )
// user is touching platform, tilt accordingly
CPlayer *player = GameScene.getPlayer();
DVECTOR playerPos = player->getPos();
DVECTOR const &playerPos = player->getPos();
if ( playerPos.vx > Pos.vx + 10 )
{
@ -1057,14 +1055,14 @@ u8 CNpcPlatform::checkCollisionDelta( CThing *_thisThing, int threshold, CRECT c
// check for case of "was not colliding previously because was above" +
// "is not colliding now because is below"
DVECTOR otherPos = _thisThing->getPos();
DVECTOR const &otherPos = _thisThing->getPos();
if ( getHeightFromPlatformAtPosition( otherPos.vx, otherPos.vy ) < 0 )
{
// is currently below platform landing point
DVECTOR otherPosDelta = _thisThing->getPosDelta();
DVECTOR posDelta = getPosDelta();
DVECTOR const &otherPosDelta = _thisThing->getPosDelta();
DVECTOR const &posDelta = getPosDelta();
if ( otherPosDelta.vy > 0 || posDelta.vy < 0 )
{
@ -1115,15 +1113,15 @@ void CNpcPlatform::collidedWith( CThing *_thisThing )
case TYPE_PLAYER:
{
CPlayer *player;
DVECTOR playerPos;
CRECT collisionArea;
CRECT playerCollisionArea;
// DVECTOR playerPos;
// CRECT collisionArea;
// CRECT playerCollisionArea;
// Only interested in SBs feet colliding with the box (pkg)
player=(CPlayer*)_thisThing;
playerPos=player->getPos();
playerCollisionArea = player->getCollisionArea();
collisionArea=getCollisionArea();
DVECTOR const &playerPos=player->getPos();
CRECT const &playerCollisionArea = player->getCollisionArea();
CRECT const &collisionArea=getCollisionArea();
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
@ -1163,12 +1161,12 @@ void CNpcPlatform::collidedWith( CThing *_thisThing )
case TYPE_NPC:
{
CNpcFriend *friendNpc;
DVECTOR friendPos;
CRECT collisionArea;
// DVECTOR friendPos;
// CRECT collisionArea;
friendNpc = (CNpcFriend*) _thisThing;
friendPos = friendNpc->getPos();
collisionArea=getCollisionArea();
DVECTOR const &friendPos = friendNpc->getPos();
CRECT const &collisionArea=getCollisionArea();
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
@ -1259,15 +1257,15 @@ int CNpcPlatform::checkCollisionAgainst(CThing *_thisThing, int _frames)
thisRect = getCollisionArea();
thatRect = _thisThing->getCollisionArea();
DVECTOR posDelta = getPosDelta();
DVECTOR const &thisPosDelta = getPosDelta();
int ThisAbsY=abs(thisPosDelta.vy)>>1;
thisRect.y1 -= ThisAbsY;
thisRect.y2 += ThisAbsY;
thisRect.y1 -= abs( posDelta.vy ) >> 1;
thisRect.y2 += abs( posDelta.vy ) >> 1;
posDelta = _thisThing->getPosDelta();
thatRect.y1 -= abs( posDelta.vy ) >> 1;
thatRect.y2 += abs( posDelta.vy ) >> 1;
DVECTOR const &ThatPosDelta = _thisThing->getPosDelta();
int ThatAbsY=abs(ThatPosDelta.vy)>>1;
thatRect.y1 -= ThatAbsY;
thatRect.y2 += ThatAbsY;
if(((thisRect.x1>=thatRect.x1&&thisRect.x1<=thatRect.x2)||(thisRect.x2>=thatRect.x1&&thisRect.x2<=thatRect.x2)||(thisRect.x1<=thatRect.x1&&thisRect.x2>=thatRect.x2))&&
((thisRect.y1>=thatRect.y1&&thisRect.y1<=thatRect.y2)||(thisRect.y2>=thatRect.y1&&thisRect.y2<=thatRect.y2)||(thisRect.y1<=thatRect.y1&&thisRect.y2>=thatRect.y2)))
@ -1295,7 +1293,7 @@ int CNpcPlatform::getHeightFromPlatformAtPosition(int _x,int _y, int offsetX, in
DVECTOR top;
int angle;
CRECT collisionArea = getCollisionArea();
CRECT const &collisionArea = getCollisionArea();
top.vy = offsetY + collisionArea.y1;

View file

@ -165,15 +165,15 @@ void CNpcLiftPlatform::collidedWith( CThing *_thisThing )
case TYPE_PLAYER:
{
CPlayer *player;
DVECTOR playerPos;
CRECT collisionArea;
CRECT playerCollisionArea;
// DVECTOR playerPos;
// CRECT collisionArea;
// CRECT playerCollisionArea;
// Only interested in SBs feet colliding with the box (pkg)
player=(CPlayer*)_thisThing;
playerPos=player->getPos();
playerCollisionArea = player->getCollisionArea();
collisionArea=getCollisionArea();
DVECTOR const &playerPos=player->getPos();
CRECT const &playerCollisionArea = player->getCollisionArea();
CRECT const &collisionArea=getCollisionArea();
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
@ -213,12 +213,12 @@ void CNpcLiftPlatform::collidedWith( CThing *_thisThing )
case TYPE_NPC:
{
CNpcFriend *friendNpc;
DVECTOR friendPos;
CRECT collisionArea;
// DVECTOR friendPos;
// CRECT collisionArea;
friendNpc = (CNpcFriend*) _thisThing;
friendPos = friendNpc->getPos();
collisionArea=getCollisionArea();
DVECTOR const &friendPos = friendNpc->getPos();
CRECT const &collisionArea=getCollisionArea();
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );

View file

@ -136,7 +136,7 @@ void CNpcPendulumPlatform::render()
int x1,y1,x2,y2;
int x1Boundary,y1Boundary,x2Boundary,y2Boundary;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
if ( m_isActive )
{

View file

@ -56,7 +56,7 @@ void CNpcSteerableBarrelPlatform::processMovement( int _frames )
{
player->setReverseCameraMovement(true);
DVECTOR playerPos = player->getPos();
DVECTOR const &playerPos = player->getPos();
s32 playerMovement = player->getMovement();
@ -203,7 +203,7 @@ void CNpcSteerableBarrelPlatform::render()
if (canRender())
{
DVECTOR &renderPos=getRenderPos();
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
SVECTOR rotation;
rotation.vx = 0;
@ -229,15 +229,15 @@ void CNpcSteerableBarrelPlatform::collidedWith( CThing *_thisThing )
case TYPE_PLAYER:
{
CPlayer *player;
DVECTOR playerPos;
CRECT collisionArea;
CRECT playerCollisionArea;
// DVECTOR playerPos;
// CRECT collisionArea;
// CRECT playerCollisionArea;
// Only interested in SBs feet colliding with the box (pkg)
player=(CPlayer*)_thisThing;
playerPos=player->getPos();
playerCollisionArea = player->getCollisionArea();
collisionArea=getCollisionArea();
DVECTOR const &playerPos=player->getPos();
CRECT const &playerCollisionArea = player->getCollisionArea();
CRECT const &collisionArea=getCollisionArea();
//if( playerPos.vx >= collisionArea.x1 && playerPos.vx <= collisionArea.x2 )
if( playerCollisionArea.x2 >= collisionArea.x1 && playerCollisionArea.x1 <= collisionArea.x2 )

View file

@ -46,7 +46,7 @@ void CNpcSeesawPlatform::processMovement( int _frames )
CPlayer *player = GameScene.getPlayer();
DVECTOR playerPos = player->getPos();
DVECTOR const &playerPos = player->getPos();
s32 distX = playerPos.vx - this->Pos.vx;

View file

@ -46,7 +46,7 @@ void CNpcSteerableOildrumPlatform::processMovement( int _frames )
{
player->setReverseCameraMovement(true);
DVECTOR playerPos = player->getPos();
DVECTOR const &playerPos = player->getPos();
s32 playerMovement = player->getMovement();