This commit is contained in:
parent
1da64afa81
commit
c7fe8c740b
70 changed files with 302 additions and 445 deletions
|
@ -468,14 +468,14 @@ void CNpcAnemone2Enemy::render()
|
||||||
spikePos.vy += result.vy;
|
spikePos.vy += result.vy;
|
||||||
|
|
||||||
sFrameHdr *frameHdr;
|
sFrameHdr *frameHdr;
|
||||||
DVECTOR offset;
|
|
||||||
int x,y;
|
int x,y;
|
||||||
int scrnWidth = VidGetScrW();
|
int scrnWidth = VidGetScrW();
|
||||||
int scrnHeight = VidGetScrH();
|
int scrnHeight = VidGetScrH();
|
||||||
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth(FRM__SPIKE);
|
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth(FRM__SPIKE);
|
||||||
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight(FRM__SPIKE);
|
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight(FRM__SPIKE);
|
||||||
|
|
||||||
offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
x = spikePos.vx - offset.vx;
|
x = spikePos.vx - offset.vx;
|
||||||
y = spikePos.vy - offset.vy;
|
y = spikePos.vy - offset.vy;
|
||||||
|
|
|
@ -161,7 +161,7 @@ void CNpcFlyingDutchmanEnemy::processMovement( int _frames )
|
||||||
{
|
{
|
||||||
CPlayer *player = GameScene.getPlayer();
|
CPlayer *player = GameScene.getPlayer();
|
||||||
|
|
||||||
DVECTOR playerPos = player->getPos();
|
DVECTOR const &playerPos = player->getPos();
|
||||||
|
|
||||||
s32 minX, maxX;
|
s32 minX, maxX;
|
||||||
m_npcPath.getPathXExtents( &minX, &maxX );
|
m_npcPath.getPathXExtents( &minX, &maxX );
|
||||||
|
|
|
@ -131,7 +131,7 @@ void CNpcEnemy::processGenericGetUserDist( int _frames, s32 *distX, s32 *distY )
|
||||||
|
|
||||||
CPlayer *player = GameScene.getPlayer();
|
CPlayer *player = GameScene.getPlayer();
|
||||||
|
|
||||||
DVECTOR playerPos = player->getPos();
|
DVECTOR const &playerPos = player->getPos();
|
||||||
|
|
||||||
*distX = playerPos.vx - this->Pos.vx;
|
*distX = playerPos.vx - this->Pos.vx;
|
||||||
*distY = playerPos.vy - this->Pos.vy;
|
*distY = playerPos.vy - this->Pos.vy;
|
||||||
|
|
|
@ -374,7 +374,7 @@ void CNpcMotherJellyfishEnemy::processMovement( int _frames )
|
||||||
{
|
{
|
||||||
CPlayer *player = GameScene.getPlayer();
|
CPlayer *player = GameScene.getPlayer();
|
||||||
|
|
||||||
DVECTOR playerPos = player->getPos();
|
DVECTOR const &playerPos = player->getPos();
|
||||||
|
|
||||||
Pos.vx = playerPos.vx + ( ( 70 * rcos( m_extension ) ) >> 12 );
|
Pos.vx = playerPos.vx + ( ( 70 * rcos( m_extension ) ) >> 12 );
|
||||||
Pos.vy = playerPos.vy + ( ( 70 * rsin( m_extension ) ) >> 12 );
|
Pos.vy = playerPos.vy + ( ( 70 * rsin( m_extension ) ) >> 12 );
|
||||||
|
@ -396,7 +396,7 @@ void CNpcMotherJellyfishEnemy::processMovement( int _frames )
|
||||||
{
|
{
|
||||||
Pos.vx += 8 * _frames;
|
Pos.vx += 8 * _frames;
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
if ( Pos.vx - offset.vx > VidGetScrW() )
|
if ( Pos.vx - offset.vx > VidGetScrW() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -849,15 +849,15 @@ void CNpcEnemy::processAttackCollision()
|
||||||
|
|
||||||
void CNpcEnemy::drawAttackEffect()
|
void CNpcEnemy::drawAttackEffect()
|
||||||
{
|
{
|
||||||
CRECT rect;
|
|
||||||
rect = getCollisionArea();
|
CRECT const &rect = getCollisionArea();
|
||||||
|
|
||||||
DVECTOR thwakPos;
|
DVECTOR thwakPos;
|
||||||
|
|
||||||
s32 xDist;
|
s32 xDist;
|
||||||
|
|
||||||
CPlayer *player = GameScene.getPlayer();
|
CPlayer *player = GameScene.getPlayer();
|
||||||
DVECTOR playerPos = player->getPos();
|
DVECTOR const &playerPos = player->getPos();
|
||||||
|
|
||||||
xDist = playerPos.vx - this->Pos.vx;
|
xDist = playerPos.vx - this->Pos.vx;
|
||||||
|
|
||||||
|
@ -1320,7 +1320,7 @@ void CNpcEnemy::processShotDeathEnd( int _frames )
|
||||||
m_speed++;
|
m_speed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
if ( Pos.vy - offset.vy > VidGetScrH() )
|
if ( Pos.vy - offset.vy > VidGetScrH() )
|
||||||
{
|
{
|
||||||
|
@ -1507,7 +1507,7 @@ int CNpcEnemy::canCollide()
|
||||||
|
|
||||||
void CNpcEnemy::processEnemyCollision( CThing *thisThing )
|
void CNpcEnemy::processEnemyCollision( CThing *thisThing )
|
||||||
{
|
{
|
||||||
DVECTOR otherPos = thisThing->getPos();
|
DVECTOR const &otherPos = thisThing->getPos();
|
||||||
DVECTOR otherDelta = thisThing->getPosDelta();
|
DVECTOR otherDelta = thisThing->getPosDelta();
|
||||||
|
|
||||||
s32 xDist = Pos.vx - otherPos.vx;
|
s32 xDist = Pos.vx - otherPos.vx;
|
||||||
|
@ -1572,8 +1572,8 @@ void CNpcEnemy::processEnemyCollision( CThing *thisThing )
|
||||||
|
|
||||||
void CNpcEnemy::processUserCollision( CThing *thisThing )
|
void CNpcEnemy::processUserCollision( CThing *thisThing )
|
||||||
{
|
{
|
||||||
DVECTOR otherPos = thisThing->getPos();
|
DVECTOR const &otherPos = thisThing->getPos();
|
||||||
DVECTOR otherDelta = thisThing->getPosDelta();
|
DVECTOR const &otherDelta = thisThing->getPosDelta();
|
||||||
|
|
||||||
s32 xDist = Pos.vx - otherPos.vx;
|
s32 xDist = Pos.vx - otherPos.vx;
|
||||||
s32 yDist = Pos.vy - otherPos.vy;
|
s32 yDist = Pos.vy - otherPos.vy;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool CNpcPath::isPointNear( DVECTOR testPos, s32 *xDist, s32 *yDist )
|
bool CNpcPath::isPointNear( DVECTOR const &testPos, s32 *xDist, s32 *yDist )
|
||||||
{
|
{
|
||||||
s32 xDistSqr, yDistSqr;
|
s32 xDistSqr, yDistSqr;
|
||||||
|
|
||||||
|
@ -268,14 +268,14 @@ void CNpcPath::reversePathDir()
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool CNpcPath::getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY )
|
bool CNpcPath::getDistToNextWaypoint( DVECTOR const ¤tPos, s32 *distX, s32 *distY )
|
||||||
{
|
{
|
||||||
return( isPointNear( currentPos, distX, distY ) );
|
return( isPointNear( currentPos, distX, distY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
s32 CNpcPath::think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange, s32 *distX, s32 *distY )
|
s32 CNpcPath::think( DVECTOR const ¤tPos, bool *pathComplete, bool *waypointChange, s32 *distX, s32 *distY )
|
||||||
{
|
{
|
||||||
if ( !waypointPtr )
|
if ( !waypointPtr )
|
||||||
{
|
{
|
||||||
|
@ -305,7 +305,7 @@ s32 CNpcPath::think( DVECTOR currentPos, bool *pathComplete, bool *waypointChang
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool CNpcPath::thinkFlat( DVECTOR currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading, u8 waypointDist )
|
bool CNpcPath::thinkFlat( DVECTOR const ¤tPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading, u8 waypointDist )
|
||||||
{
|
{
|
||||||
bool pointChange = false;
|
bool pointChange = false;
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ bool CNpcPath::thinkFlat( DVECTOR currentPos, bool *pathComplete, s32 *distX, s3
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool CNpcPath::thinkVertical( DVECTOR currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading )
|
bool CNpcPath::thinkVertical( DVECTOR const ¤tPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading )
|
||||||
{
|
{
|
||||||
bool pointChange = false;
|
bool pointChange = false;
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,10 @@ public:
|
||||||
void decPath();
|
void decPath();
|
||||||
void resetPath();
|
void resetPath();
|
||||||
void reversePathDir();
|
void reversePathDir();
|
||||||
s32 think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange, s32 *distX, s32 *distY );
|
s32 think( DVECTOR const ¤tPos, bool *pathComplete, bool *waypointChange, s32 *distX, s32 *distY );
|
||||||
bool thinkFlat( DVECTOR currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading, u8 waypointDist = 10 );
|
bool thinkFlat( DVECTOR const ¤tPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading, u8 waypointDist = 10 );
|
||||||
bool thinkVertical( DVECTOR currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading );
|
bool thinkVertical( DVECTOR const ¤tPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading );
|
||||||
bool getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY );
|
bool getDistToNextWaypoint( DVECTOR const ¤tPos, s32 *distX, s32 *distY );
|
||||||
void getPathXExtents( s32 *minExtent, s32 *maxExtent );
|
void getPathXExtents( s32 *minExtent, s32 *maxExtent );
|
||||||
void getPathYExtents( s32 *minExtent, s32 *maxExtent );
|
void getPathYExtents( s32 *minExtent, s32 *maxExtent );
|
||||||
u8 getWaypointCount() { return( waypointCount ); }
|
u8 getWaypointCount() { return( waypointCount ); }
|
||||||
|
@ -44,7 +44,7 @@ public:
|
||||||
void setWaypointPtr( u16 *newPtr );
|
void setWaypointPtr( u16 *newPtr );
|
||||||
void setPathExtents();
|
void setPathExtents();
|
||||||
u16 *getWaypointPtr() { return( waypointPtr ); }
|
u16 *getWaypointPtr() { return( waypointPtr ); }
|
||||||
bool isPointNear( DVECTOR testPos, s32 *xDist, s32 *yDist );
|
bool isPointNear( DVECTOR const &testPos, s32 *xDist, s32 *yDist );
|
||||||
void getCurrentWaypointPos( DVECTOR *waypointPos );
|
void getCurrentWaypointPos( DVECTOR *waypointPos );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -158,7 +158,7 @@ void CNpcSharkManEnemy::processClose( int _frames )
|
||||||
newPos.vy -= 50;
|
newPos.vy -= 50;
|
||||||
|
|
||||||
CPlayer *player = GameScene.getPlayer();
|
CPlayer *player = GameScene.getPlayer();
|
||||||
DVECTOR playerPos = player->getPos();
|
DVECTOR const &playerPos = player->getPos();
|
||||||
|
|
||||||
xDist = playerPos.vx - newPos.vx;
|
xDist = playerPos.vx - newPos.vx;
|
||||||
yDist = playerPos.vy - newPos.vy;
|
yDist = playerPos.vy - newPos.vy;
|
||||||
|
|
|
@ -55,7 +55,7 @@ void CNpcSmallJellyfishBackgroundEnemy::processMovement( int _frames )
|
||||||
// change direction?
|
// change direction?
|
||||||
|
|
||||||
DVECTOR renderPos;
|
DVECTOR renderPos;
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
renderPos.vx = Pos.vx - offset.vx;
|
renderPos.vx = Pos.vx - offset.vx;
|
||||||
renderPos.vy = Pos.vy - offset.vy;
|
renderPos.vy = Pos.vy - offset.vy;
|
||||||
|
@ -175,7 +175,7 @@ void CNpcSmallJellyfishBackgroundEnemy::shutdown()
|
||||||
|
|
||||||
void CNpcSmallJellyfishBackgroundEnemy::processUserCollision( CThing *thisThing )
|
void CNpcSmallJellyfishBackgroundEnemy::processUserCollision( CThing *thisThing )
|
||||||
{
|
{
|
||||||
DVECTOR otherPos = thisThing->getPos();
|
DVECTOR const &otherPos = thisThing->getPos();
|
||||||
DVECTOR otherDelta = thisThing->getPosDelta();
|
DVECTOR otherDelta = thisThing->getPosDelta();
|
||||||
|
|
||||||
s32 xDist = Pos.vx - otherPos.vx;
|
s32 xDist = Pos.vx - otherPos.vx;
|
||||||
|
|
|
@ -679,7 +679,7 @@ void CNpcSeaSnakeEnemy::updateTail( DVECTOR &oldPos, int _frames )
|
||||||
|
|
||||||
for ( segmentCount = 0 ; segmentCount < m_segmentCount ; segmentCount++ )
|
for ( segmentCount = 0 ; segmentCount < m_segmentCount ; segmentCount++ )
|
||||||
{
|
{
|
||||||
DVECTOR currentPos = m_segmentArray[segmentCount].getPos();
|
DVECTOR const ¤tPos = m_segmentArray[segmentCount].getPos();
|
||||||
|
|
||||||
s32 xDist = oldPos.vx - currentPos.vx;
|
s32 xDist = oldPos.vx - currentPos.vx;
|
||||||
s32 yDist = oldPos.vy - currentPos.vy;
|
s32 yDist = oldPos.vy - currentPos.vy;
|
||||||
|
@ -692,7 +692,7 @@ void CNpcSeaSnakeEnemy::updateTail( DVECTOR &oldPos, int _frames )
|
||||||
|
|
||||||
if ( segmentCount < m_segmentCount - 1 )
|
if ( segmentCount < m_segmentCount - 1 )
|
||||||
{
|
{
|
||||||
DVECTOR nextPos = m_segmentArray[segmentCount + 1].getPos();
|
DVECTOR const &nextPos = m_segmentArray[segmentCount + 1].getPos();
|
||||||
xDist = currentPos.vx - nextPos.vx;
|
xDist = currentPos.vx - nextPos.vx;
|
||||||
yDist = currentPos.vy - nextPos.vy;
|
yDist = currentPos.vy - nextPos.vy;
|
||||||
headingFromNext = ratan2( yDist, xDist );
|
headingFromNext = ratan2( yDist, xDist );
|
||||||
|
@ -1000,23 +1000,22 @@ void CNpcSeaSnakeEnemy::render()
|
||||||
|
|
||||||
int CNpcSeaSnakeEnemy::checkCollisionAgainst( CThing *_thisThing, int _frames )
|
int CNpcSeaSnakeEnemy::checkCollisionAgainst( CThing *_thisThing, int _frames )
|
||||||
{
|
{
|
||||||
DVECTOR pos,thisThingPos;
|
// DVECTOR pos,thisThingPos;
|
||||||
int radius;
|
int radius;
|
||||||
int collided;
|
int collided;
|
||||||
|
|
||||||
pos=getCollisionCentre();
|
DVECTOR const &pos=getCollisionCentre();
|
||||||
thisThingPos=_thisThing->getCollisionCentre();
|
DVECTOR const &thisThingPos=_thisThing->getCollisionCentre();
|
||||||
|
|
||||||
radius=getCollisionRadius()+_thisThing->getCollisionRadius();
|
radius=getCollisionRadius()+_thisThing->getCollisionRadius();
|
||||||
collided=false;
|
collided=false;
|
||||||
if(abs(pos.vx-thisThingPos.vx)<radius&&
|
if(abs(pos.vx-thisThingPos.vx)<radius&&
|
||||||
abs(pos.vy-thisThingPos.vy)<radius)
|
abs(pos.vy-thisThingPos.vy)<radius)
|
||||||
{
|
{
|
||||||
CRECT thisRect,thatRect;
|
// CRECT thisRect,thatRect;
|
||||||
|
|
||||||
thisRect=getCollisionArea();
|
CRECT const &thisRect=getCollisionArea();
|
||||||
|
CRECT const &thatRect=_thisThing->getCollisionArea();
|
||||||
thatRect=_thisThing->getCollisionArea();
|
|
||||||
|
|
||||||
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))&&
|
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)))
|
((thisRect.y1>=thatRect.y1&&thisRect.y1<=thatRect.y2)||(thisRect.y2>=thatRect.y1&&thisRect.y2<=thatRect.y2)||(thisRect.y1<=thatRect.y1&&thisRect.y2>=thatRect.y2)))
|
||||||
|
@ -1096,23 +1095,22 @@ void CNpcSeaSnakeSegment::render()
|
||||||
|
|
||||||
int CNpcSeaSnakeSegment::checkCollisionAgainst( CThing *_thisThing, int _frames )
|
int CNpcSeaSnakeSegment::checkCollisionAgainst( CThing *_thisThing, int _frames )
|
||||||
{
|
{
|
||||||
DVECTOR pos,thisThingPos;
|
// DVECTOR pos,thisThingPos;
|
||||||
int radius;
|
int radius;
|
||||||
int collided;
|
int collided;
|
||||||
|
|
||||||
pos = getCollisionCentre();
|
DVECTOR const &pos = getCollisionCentre();
|
||||||
thisThingPos = _thisThing->getCollisionCentre();
|
DVECTOR const &thisThingPos = _thisThing->getCollisionCentre();
|
||||||
|
|
||||||
radius = getCollisionRadius() + _thisThing->getCollisionRadius();
|
radius = getCollisionRadius() + _thisThing->getCollisionRadius();
|
||||||
collided = false;
|
collided = false;
|
||||||
if(abs(pos.vx-thisThingPos.vx)<radius&&
|
if(abs(pos.vx-thisThingPos.vx)<radius&&
|
||||||
abs(pos.vy-thisThingPos.vy)<radius)
|
abs(pos.vy-thisThingPos.vy)<radius)
|
||||||
{
|
{
|
||||||
CRECT thisRect,thatRect;
|
// CRECT thisRect,thatRect;
|
||||||
|
|
||||||
thisRect=getCollisionArea();
|
CRECT const &thisRect=getCollisionArea();
|
||||||
|
CRECT const &thatRect=_thisThing->getCollisionArea();
|
||||||
thatRect=_thisThing->getCollisionArea();
|
|
||||||
|
|
||||||
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))&&
|
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)))
|
((thisRect.y1>=thatRect.y1&&thisRect.y1<=thatRect.y2)||(thisRect.y2>=thatRect.y1&&thisRect.y2<=thatRect.y2)||(thisRect.y1<=thatRect.y1&&thisRect.y2>=thatRect.y2)))
|
||||||
|
@ -1144,7 +1142,7 @@ void CNpcSeaSnakeEnemy::processShot( int _frames )
|
||||||
|
|
||||||
m_state = NPC_GENERIC_HIT_DEATH_END;
|
m_state = NPC_GENERIC_HIT_DEATH_END;
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
if ( Pos.vy - offset.vy > VidGetScrH() )
|
if ( Pos.vy - offset.vy > VidGetScrH() )
|
||||||
{
|
{
|
||||||
|
@ -1196,7 +1194,7 @@ u8 CNpcSeaSnakeEnemy::isSnakeStopped()
|
||||||
return( true );
|
return( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
DVECTOR tailPos = m_segmentArray[m_segmentCount - 1].getPos();
|
DVECTOR const &tailPos = m_segmentArray[m_segmentCount - 1].getPos();
|
||||||
|
|
||||||
if ( tailPos.vx == Pos.vx && tailPos.vy == Pos.vy )
|
if ( tailPos.vx == Pos.vx && tailPos.vy == Pos.vy )
|
||||||
{
|
{
|
||||||
|
@ -1210,7 +1208,7 @@ u8 CNpcSeaSnakeEnemy::isSnakeStopped()
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CNpcSeaSnakeEnemy::moveEntireSnake( DVECTOR newPos )
|
void CNpcSeaSnakeEnemy::moveEntireSnake( DVECTOR const &newPos )
|
||||||
{
|
{
|
||||||
Pos.vx = newPos.vx;
|
Pos.vx = newPos.vx;
|
||||||
Pos.vy = newPos.vy;
|
Pos.vy = newPos.vy;
|
||||||
|
|
|
@ -28,8 +28,8 @@ public:
|
||||||
void processEnemyCollision( CThing *thisThing );
|
void processEnemyCollision( CThing *thisThing );
|
||||||
void setScale( u16 scale ) {m_scale = scale;}
|
void setScale( u16 scale ) {m_scale = scale;}
|
||||||
CNpcSeaSnakeSegment *m_nextSegment;
|
CNpcSeaSnakeSegment *m_nextSegment;
|
||||||
void setPos( DVECTOR newPos ) {Pos = newPos;}
|
void setPos( DVECTOR const &newPos ) {Pos = newPos;}
|
||||||
DVECTOR getPos() {return( Pos );}
|
DVECTOR const &getPos() {return( Pos );}
|
||||||
void setHeading( s16 newHeading ) {m_heading = newHeading;}
|
void setHeading( s16 newHeading ) {m_heading = newHeading;}
|
||||||
void updateCollisionArea();
|
void updateCollisionArea();
|
||||||
int checkCollisionAgainst(CThing *_thisThing, int _frames);
|
int checkCollisionAgainst(CThing *_thisThing, int _frames);
|
||||||
|
@ -70,7 +70,7 @@ protected:
|
||||||
void processUserCollision( CThing *thisThing );
|
void processUserCollision( CThing *thisThing );
|
||||||
u8 processPathMove( int _frames, s32 *moveX, s32 *moveY, s32 *moveVel, s32 *moveDist );
|
u8 processPathMove( int _frames, s32 *moveX, s32 *moveY, s32 *moveVel, s32 *moveDist );
|
||||||
u8 isSnakeStopped();
|
u8 isSnakeStopped();
|
||||||
void moveEntireSnake( DVECTOR newPos );
|
void moveEntireSnake( DVECTOR const &newPos );
|
||||||
void addHealthMeter();
|
void addHealthMeter();
|
||||||
void updateTail( DVECTOR &oldPos, int _frames );
|
void updateTail( DVECTOR &oldPos, int _frames );
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
|
||||||
|
|
||||||
for ( segmentCount = 0 ; segmentCount < NPC_PARASITIC_WORM_LENGTH ; segmentCount++ )
|
for ( segmentCount = 0 ; segmentCount < NPC_PARASITIC_WORM_LENGTH ; segmentCount++ )
|
||||||
{
|
{
|
||||||
DVECTOR currentPos = m_segmentArray[segmentCount].getPos();
|
DVECTOR const ¤tPos = m_segmentArray[segmentCount].getPos();
|
||||||
|
|
||||||
s32 xDist = oldPos.vx - currentPos.vx;
|
s32 xDist = oldPos.vx - currentPos.vx;
|
||||||
s32 yDist = oldPos.vy - currentPos.vy;
|
s32 yDist = oldPos.vy - currentPos.vy;
|
||||||
|
@ -290,7 +290,7 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
|
||||||
|
|
||||||
if ( segmentCount < NPC_PARASITIC_WORM_LENGTH - 1 )
|
if ( segmentCount < NPC_PARASITIC_WORM_LENGTH - 1 )
|
||||||
{
|
{
|
||||||
DVECTOR nextPos = m_segmentArray[segmentCount + 1].getPos();
|
DVECTOR const &nextPos = m_segmentArray[segmentCount + 1].getPos();
|
||||||
xDist = currentPos.vx - nextPos.vx;
|
xDist = currentPos.vx - nextPos.vx;
|
||||||
yDist = currentPos.vy - nextPos.vy;
|
yDist = currentPos.vy - nextPos.vy;
|
||||||
headingFromNext = ratan2( yDist, xDist );
|
headingFromNext = ratan2( yDist, xDist );
|
||||||
|
@ -469,23 +469,22 @@ void CNpcParasiticWormEnemy::render()
|
||||||
|
|
||||||
int CNpcParasiticWormEnemy::checkCollisionAgainst( CThing *_thisThing, int _frames )
|
int CNpcParasiticWormEnemy::checkCollisionAgainst( CThing *_thisThing, int _frames )
|
||||||
{
|
{
|
||||||
DVECTOR pos,thisThingPos;
|
// DVECTOR pos,thisThingPos;
|
||||||
int radius;
|
int radius;
|
||||||
int collided;
|
int collided;
|
||||||
|
|
||||||
pos=getCollisionCentre();
|
DVECTOR const &pos=getCollisionCentre();
|
||||||
thisThingPos=_thisThing->getCollisionCentre();
|
DVECTOR const &thisThingPos=_thisThing->getCollisionCentre();
|
||||||
|
|
||||||
radius=getCollisionRadius()+_thisThing->getCollisionRadius();
|
radius=getCollisionRadius()+_thisThing->getCollisionRadius();
|
||||||
collided=false;
|
collided=false;
|
||||||
if(abs(pos.vx-thisThingPos.vx)<radius&&
|
if(abs(pos.vx-thisThingPos.vx)<radius&&
|
||||||
abs(pos.vy-thisThingPos.vy)<radius)
|
abs(pos.vy-thisThingPos.vy)<radius)
|
||||||
{
|
{
|
||||||
CRECT thisRect,thatRect;
|
// CRECT thisRect,thatRect;
|
||||||
|
|
||||||
thisRect=getCollisionArea();
|
CRECT const &thisRect=getCollisionArea();
|
||||||
|
CRECT const &thatRect=_thisThing->getCollisionArea();
|
||||||
thatRect=_thisThing->getCollisionArea();
|
|
||||||
|
|
||||||
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))&&
|
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)))
|
((thisRect.y1>=thatRect.y1&&thisRect.y1<=thatRect.y2)||(thisRect.y2>=thatRect.y1&&thisRect.y2<=thatRect.y2)||(thisRect.y1<=thatRect.y1&&thisRect.y2>=thatRect.y2)))
|
||||||
|
@ -565,23 +564,22 @@ void CNpcParasiticWormSegment::render()
|
||||||
|
|
||||||
int CNpcParasiticWormSegment::checkCollisionAgainst( CThing *_thisThing, int _frames )
|
int CNpcParasiticWormSegment::checkCollisionAgainst( CThing *_thisThing, int _frames )
|
||||||
{
|
{
|
||||||
DVECTOR pos,thisThingPos;
|
// DVECTOR pos,thisThingPos;
|
||||||
int radius;
|
int radius;
|
||||||
int collided;
|
int collided;
|
||||||
|
|
||||||
pos = getCollisionCentre();
|
DVECTOR const &pos = getCollisionCentre();
|
||||||
thisThingPos = _thisThing->getCollisionCentre();
|
DVECTOR const &thisThingPos = _thisThing->getCollisionCentre();
|
||||||
|
|
||||||
radius = getCollisionRadius() + _thisThing->getCollisionRadius();
|
radius = getCollisionRadius() + _thisThing->getCollisionRadius();
|
||||||
collided = false;
|
collided = false;
|
||||||
if(abs(pos.vx-thisThingPos.vx)<radius&&
|
if(abs(pos.vx-thisThingPos.vx)<radius&&
|
||||||
abs(pos.vy-thisThingPos.vy)<radius)
|
abs(pos.vy-thisThingPos.vy)<radius)
|
||||||
{
|
{
|
||||||
CRECT thisRect,thatRect;
|
// CRECT thisRect,thatRect;
|
||||||
|
|
||||||
thisRect=getCollisionArea();
|
CRECT const &thisRect=getCollisionArea();
|
||||||
|
CRECT const &thatRect=_thisThing->getCollisionArea();
|
||||||
thatRect=_thisThing->getCollisionArea();
|
|
||||||
|
|
||||||
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))&&
|
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)))
|
((thisRect.y1>=thatRect.y1&&thisRect.y1<=thatRect.y2)||(thisRect.y2>=thatRect.y1&&thisRect.y2<=thatRect.y2)||(thisRect.y1<=thatRect.y1&&thisRect.y2>=thatRect.y2)))
|
||||||
|
|
|
@ -23,8 +23,8 @@ public:
|
||||||
void processEnemyCollision( CThing *thisThing );
|
void processEnemyCollision( CThing *thisThing );
|
||||||
void setScale( u16 scale ) {m_scale = scale;}
|
void setScale( u16 scale ) {m_scale = scale;}
|
||||||
CNpcParasiticWormSegment *m_nextSegment;
|
CNpcParasiticWormSegment *m_nextSegment;
|
||||||
void setPos( DVECTOR newPos ) {Pos = newPos;}
|
void setPos( DVECTOR const &newPos ) {Pos = newPos;}
|
||||||
DVECTOR getPos() {return( Pos );}
|
DVECTOR const &getPos() {return( Pos );}
|
||||||
void setHeading( s16 newHeading ) {m_heading = newHeading;}
|
void setHeading( s16 newHeading ) {m_heading = newHeading;}
|
||||||
void updateCollisionArea();
|
void updateCollisionArea();
|
||||||
int checkCollisionAgainst(CThing *_thisThing, int _frames);
|
int checkCollisionAgainst(CThing *_thisThing, int _frames);
|
||||||
|
|
|
@ -125,7 +125,7 @@ void CNpcGaryFriend::think( int _frames )
|
||||||
m_speed++;
|
m_speed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
if ( Pos.vy - offset.vy > VidGetScrH() )
|
if ( Pos.vy - offset.vy > VidGetScrH() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,7 +63,7 @@ void CNpcPlanktonFriend::render()
|
||||||
// Render
|
// Render
|
||||||
DVECTOR renderPos;
|
DVECTOR renderPos;
|
||||||
DVECTOR origRenderPos;
|
DVECTOR origRenderPos;
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
int frame = FRM_PLANKTON_STATIC00;
|
int frame = FRM_PLANKTON_STATIC00;
|
||||||
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth( frame );
|
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth( frame );
|
||||||
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight( frame );
|
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight( frame );
|
||||||
|
@ -71,7 +71,7 @@ void CNpcPlanktonFriend::render()
|
||||||
renderPos.vx = Pos.vx - offset.vx - ( spriteWidth >> 1 );
|
renderPos.vx = Pos.vx - offset.vx - ( spriteWidth >> 1 );
|
||||||
renderPos.vy = Pos.vy - offset.vy - ( spriteHeight >> 1 );
|
renderPos.vy = Pos.vy - offset.vy - ( spriteHeight >> 1 );
|
||||||
|
|
||||||
CRECT collisionRect = getCollisionArea();
|
CRECT const &collisionRect = getCollisionArea();
|
||||||
collisionRect.x1 -= Pos.vx;
|
collisionRect.x1 -= Pos.vx;
|
||||||
collisionRect.x2 -= Pos.vx;
|
collisionRect.x2 -= Pos.vx;
|
||||||
collisionRect.y1 -= Pos.vy;
|
collisionRect.y1 -= Pos.vy;
|
||||||
|
|
|
@ -96,23 +96,22 @@ int H=renderPos1.vy-renderPos0.vy;
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int CFXLaser::checkCollisionAgainst(CThing *_thisThing, int _frames)
|
int CFXLaser::checkCollisionAgainst(CThing *_thisThing, int _frames)
|
||||||
{
|
{
|
||||||
DVECTOR pos,thisThingPos;
|
// DVECTOR pos,thisThingPos;
|
||||||
int radius;
|
int radius;
|
||||||
int collided;
|
int collided;
|
||||||
|
|
||||||
pos=getCollisionCentre();
|
DVECTOR const &pos=getCollisionCentre();
|
||||||
thisThingPos=_thisThing->getCollisionCentre();
|
DVECTOR const &thisThingPos=_thisThing->getCollisionCentre();
|
||||||
|
|
||||||
radius=getCollisionRadius()+_thisThing->getCollisionRadius();
|
radius=getCollisionRadius()+_thisThing->getCollisionRadius();
|
||||||
collided=false;
|
collided=false;
|
||||||
if(abs(pos.vx-thisThingPos.vx)<radius&&
|
if(abs(pos.vx-thisThingPos.vx)<radius&&
|
||||||
abs(pos.vy-thisThingPos.vy)<radius)
|
abs(pos.vy-thisThingPos.vy)<radius)
|
||||||
{
|
{
|
||||||
CRECT thisRect,thatRect;
|
// CRECT thisRect,thatRect;
|
||||||
|
|
||||||
thisRect=getCollisionArea();
|
CRECT const &thisRect=getCollisionArea();
|
||||||
|
CRECT const &thatRect=_thisThing->getCollisionArea();
|
||||||
thatRect=_thisThing->getCollisionArea();
|
|
||||||
|
|
||||||
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))&&
|
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)))
|
((thisRect.y1>=thatRect.y1&&thisRect.y1<=thatRect.y2)||(thisRect.y2>=thatRect.y1&&thisRect.y2<=thatRect.y2)||(thisRect.y1<=thatRect.y1&&thisRect.y2>=thatRect.y2)))
|
||||||
|
|
|
@ -106,16 +106,7 @@
|
||||||
|
|
||||||
#include "gfx\actor.h"
|
#include "gfx\actor.h"
|
||||||
|
|
||||||
int RenderZ=378;//256; Increased to make depth less, and SB more visible
|
static const int RenderZ=378;//256; Increased to make depth less, and SB more visible
|
||||||
// Horrible evil bodge 4 Petro, via Gary :o(
|
|
||||||
#define USE_GLOBAL_RGB
|
|
||||||
#ifdef USE_GLOBAL_RGB
|
|
||||||
u8 GlobalRGB[4]={127,127,127,127};
|
|
||||||
int GlobalRGBSel=0;
|
|
||||||
char *GlobalRGBName[4]={"Sprites","Action","Mid","Other"};
|
|
||||||
int GlobalRGBX=200;
|
|
||||||
int GlobalRGBY=28;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
@ -208,11 +199,6 @@ CGameScene GameScene;
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CGameScene::init()
|
void CGameScene::init()
|
||||||
{
|
{
|
||||||
// Setup Constant Camera Matrix
|
|
||||||
// SetIdentTrans(&CamMtx,0,0,RenderZ);
|
|
||||||
// SetGeomScreen(RenderZ);
|
|
||||||
// SetTransMatrix(&CamMtx);
|
|
||||||
|
|
||||||
setCameraMtx();
|
setCameraMtx();
|
||||||
|
|
||||||
s_genericFont=new ("CGameScene::Init") FontBank();
|
s_genericFont=new ("CGameScene::Init") FontBank();
|
||||||
|
@ -348,26 +334,7 @@ void CGameScene::render_showing_lives()
|
||||||
void CGameScene::render_playing()
|
void CGameScene::render_playing()
|
||||||
{
|
{
|
||||||
// CamMtx.t[2]=ZPos; // Temp
|
// CamMtx.t[2]=ZPos; // Temp
|
||||||
#ifdef USE_GLOBAL_RGB
|
|
||||||
if (PadIsConnected(1))
|
|
||||||
{
|
|
||||||
s_genericFont->setTrans(0);
|
|
||||||
s_genericFont->setSMode(0);
|
|
||||||
|
|
||||||
for (int i=0; i<3; i++)
|
|
||||||
{
|
|
||||||
char Buf[32];
|
|
||||||
if (i==GlobalRGBSel)
|
|
||||||
s_genericFont->setColour(255,255,255);
|
|
||||||
else
|
|
||||||
s_genericFont->setColour(64,64,64);
|
|
||||||
|
|
||||||
sprintf(Buf,"%s: %i",GlobalRGBName[i],GlobalRGB[i]);
|
|
||||||
s_genericFont->print(GlobalRGBX,GlobalRGBY+(i*16),Buf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
if(m_levelHasTimer)
|
if(m_levelHasTimer)
|
||||||
{
|
{
|
||||||
int timerValue;
|
int timerValue;
|
||||||
|
@ -384,10 +351,6 @@ void CGameScene::render_playing()
|
||||||
CThingManager::renderAllThings();
|
CThingManager::renderAllThings();
|
||||||
|
|
||||||
setCameraMtx();
|
setCameraMtx();
|
||||||
// SetIdentTrans(&CamMtx,0,0,RenderZ);
|
|
||||||
// SetGeomScreen(RenderZ);
|
|
||||||
// SetRotMatrix(&CamMtx);
|
|
||||||
// SetTransMatrix(&CamMtx);
|
|
||||||
|
|
||||||
Level.render();
|
Level.render();
|
||||||
m_HealthManager->render();
|
m_HealthManager->render();
|
||||||
|
@ -543,19 +506,6 @@ void CGameScene::think_showing_lives(int _frames)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CGameScene::think_playing(int _frames)
|
void CGameScene::think_playing(int _frames)
|
||||||
{
|
{
|
||||||
#ifdef USE_GLOBAL_RGB
|
|
||||||
if (PadIsConnected(1))
|
|
||||||
{
|
|
||||||
if (PadGetDown(1) & PAD_UP) GlobalRGBSel--;
|
|
||||||
if (PadGetDown(1) & PAD_DOWN) GlobalRGBSel++;
|
|
||||||
GlobalRGBSel&=3;
|
|
||||||
|
|
||||||
if(PadGetHeld(1)&PAD_LEFT ) GlobalRGB[GlobalRGBSel]--;
|
|
||||||
if(PadGetHeld(1)&PAD_RIGHT ) GlobalRGB[GlobalRGBSel]++;
|
|
||||||
GlobalRGB[GlobalRGBSel]&=255;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(s_readyToExit)
|
if(s_readyToExit)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -832,7 +782,7 @@ void CGameScene::initLevel()
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CGameScene::dropHealth(DVECTOR &Pos,int Amount,int Vel)
|
void CGameScene::dropHealth(DVECTOR const &Pos,int Amount,int Vel)
|
||||||
{
|
{
|
||||||
m_HealthManager->drop(Pos,Amount,Vel);
|
m_HealthManager->drop(Pos,Amount,Vel);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ static ACTOR_TYPE getActorType( int actorNum ) {return actorType[actorNum];}
|
||||||
static void setBossHasBeenKilled() {s_bossHasBeenKilled=true;}
|
static void setBossHasBeenKilled() {s_bossHasBeenKilled=true;}
|
||||||
static int getBossHasBeenKilled() {return s_bossHasBeenKilled;}
|
static int getBossHasBeenKilled() {return s_bossHasBeenKilled;}
|
||||||
|
|
||||||
static void dropHealth(DVECTOR &Pos,int Amount,int Vel);
|
static void dropHealth(DVECTOR const &Pos,int Amount,int Vel);
|
||||||
|
|
||||||
|
|
||||||
static void setCameraShake(s16 X,s16 Y);
|
static void setCameraShake(s16 X,s16 Y);
|
||||||
|
|
|
@ -52,7 +52,7 @@ void CHealthManager::shutdown()
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
const int AngleS=2048+1024+512;
|
const int AngleS=2048+1024+512;
|
||||||
void CHealthManager::drop(DVECTOR &Pos,int Amount,int Vel)
|
void CHealthManager::drop(DVECTOR const &Pos,int Amount,int Vel)
|
||||||
{
|
{
|
||||||
int Count=0;
|
int Count=0;
|
||||||
int Am=Amount;
|
int Am=Amount;
|
||||||
|
@ -86,7 +86,7 @@ int AngleInc=1024/Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CHealthManager::addItem(DVECTOR &Pos,int TableIdx,int Angle,int Vel)
|
void CHealthManager::addItem(DVECTOR const &Pos,int TableIdx,int Angle,int Vel)
|
||||||
{
|
{
|
||||||
int Idx=0;
|
int Idx=0;
|
||||||
|
|
||||||
|
|
|
@ -35,14 +35,14 @@ public:
|
||||||
void init();
|
void init();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
void drop(DVECTOR &Pos,int Amount,int Vel);
|
void drop(DVECTOR const &Pos,int Amount,int Vel);
|
||||||
|
|
||||||
void checkPlayerCol(CPlayer *Thing);
|
void checkPlayerCol(CPlayer *Thing);
|
||||||
void think(int frames);
|
void think(int frames);
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void addItem(DVECTOR &Pos,int TableIdx,int Angle,int Vel);
|
void addItem(DVECTOR const &Pos,int TableIdx,int Angle,int Vel);
|
||||||
|
|
||||||
sItem ItemList[ITEM_MAX];
|
sItem ItemList[ITEM_MAX];
|
||||||
sFrameHdr *FrameHdr;
|
sFrameHdr *FrameHdr;
|
||||||
|
|
|
@ -517,9 +517,6 @@ CActorGfx::~CActorGfx()
|
||||||
void CActorGfx::setActor(sActorPool *ThisActor)
|
void CActorGfx::setActor(sActorPool *ThisActor)
|
||||||
{
|
{
|
||||||
PoolEntry=ThisActor;
|
PoolEntry=ThisActor;
|
||||||
// ShadowXOfs=DEF_SHADOW_OFS;
|
|
||||||
// ShadowYOfs=DEF_SHADOW_OFS;
|
|
||||||
// ShadowFlag=false;
|
|
||||||
OtPos=OTPOS__ACTOR_POS;
|
OtPos=OTPOS__ACTOR_POS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,27 +602,11 @@ sSpriteAnim *ThisAnim=SpriteBank->AnimList+Anim;
|
||||||
|
|
||||||
Ft4=GetPrimFT4();
|
Ft4=GetPrimFT4();
|
||||||
SetUpFT4(Ft4,ThisNode,Pos.vx,Pos.vy,XFlip,YFlip);
|
SetUpFT4(Ft4,ThisNode,Pos.vx,Pos.vy,XFlip,YFlip);
|
||||||
extern u8 GlobalRGB[];
|
|
||||||
setRGB0(Ft4,GlobalRGB[0],GlobalRGB[0],GlobalRGB[0]);
|
|
||||||
Ft4->tpage=ThisNode->TPage;
|
Ft4->tpage=ThisNode->TPage;
|
||||||
Ft4->clut=PoolEntry->ActorGfx->Clut;
|
Ft4->clut=PoolEntry->ActorGfx->Clut;
|
||||||
|
setShadeTex(Ft4,1);
|
||||||
addPrim(OtPtr+OtPos,Ft4);
|
addPrim(OtPtr+OtPos,Ft4);
|
||||||
/*
|
|
||||||
if (ShadowFlag)
|
|
||||||
{
|
|
||||||
POLY_FT4 *sFt4=GetPrimFT4();
|
|
||||||
*sFt4=*Ft4;
|
|
||||||
sFt4->x0-=ShadowXOfs;
|
|
||||||
sFt4->x1-=ShadowXOfs;
|
|
||||||
sFt4->y0+=ShadowYOfs;
|
|
||||||
sFt4->y1+=ShadowYOfs;
|
|
||||||
setSemiTrans(sFt4,1);
|
|
||||||
setRGB0(sFt4,0,0,0);
|
|
||||||
addPrim(OtPtr+OtPos,sFt4);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// Set BBox
|
// Set BBox
|
||||||
//int HalfW=CurrentFrameGfx->W>>1;
|
|
||||||
// Sizes now depend on aspect corrected sizes, so get sizes back from poly
|
// Sizes now depend on aspect corrected sizes, so get sizes back from poly
|
||||||
int BBoxW=Ft4->x1-Ft4->x0;
|
int BBoxW=Ft4->x1-Ft4->x0;
|
||||||
int BBoxH=Ft4->y2-Ft4->y0;
|
int BBoxH=Ft4->y2-Ft4->y0;
|
||||||
|
@ -810,9 +791,7 @@ void CModelGfx::SetModel(int Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static const int MXO=0;
|
void CModelGfx::Render(DVECTOR &Pos,SVECTOR *Angle,VECTOR *Scale,s32 ClipFlag)
|
||||||
static const int MYO=-8*0;
|
|
||||||
void CModelGfx::Render(DVECTOR &Pos,SVECTOR *Angle,VECTOR *Scale)
|
|
||||||
{
|
{
|
||||||
#define BLOCK_MULT 16
|
#define BLOCK_MULT 16
|
||||||
sElem3d *Elem=&ModelElemBank[Model->ElemID];
|
sElem3d *Elem=&ModelElemBank[Model->ElemID];
|
||||||
|
@ -848,8 +827,8 @@ sTri *TList=&ModelTriList[Elem->TriStart];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderPos.vx=(INGAME_SCREENOFS_X+MXO)+Pos.vx;
|
RenderPos.vx=(INGAME_SCREENOFS_X)+Pos.vx;
|
||||||
RenderPos.vy=(INGAME_SCREENOFS_Y+MYO)+Pos.vy;
|
RenderPos.vy=(INGAME_SCREENOFS_Y)+Pos.vy;
|
||||||
|
|
||||||
gte_SetRotMatrix(&Mtx);
|
gte_SetRotMatrix(&Mtx);
|
||||||
CMX_SetTransMtxXY(&RenderPos);
|
CMX_SetTransMtxXY(&RenderPos);
|
||||||
|
@ -860,20 +839,20 @@ sTri *TList=&ModelTriList[Elem->TriStart];
|
||||||
gte_ldv3(P0,P1,P2);
|
gte_ldv3(P0,P1,P2);
|
||||||
setlen(TPrimPtr, GPU_PolyFT3Tag);
|
setlen(TPrimPtr, GPU_PolyFT3Tag);
|
||||||
TPrimPtr->code=TList->PolyCode;
|
TPrimPtr->code=TList->PolyCode;
|
||||||
setRGB0(TPrimPtr,128,128,128);
|
|
||||||
gte_rtpt_b();
|
gte_rtpt_b();
|
||||||
|
setShadeTex(TPrimPtr,1);
|
||||||
T0=*(u32*)&TList->uv0; // Get UV0 & TPage
|
T0=*(u32*)&TList->uv0; // Get UV0 & TPage
|
||||||
T1=*(u32*)&TList->uv1; // Get UV1 & Clut
|
T1=*(u32*)&TList->uv1; // Get UV1 & Clut
|
||||||
T2=*(u16*)&TList->uv2; // Get UV2
|
T2=*(u32*)&TList->uv2; // Get UV2
|
||||||
*(u32*)&TPrimPtr->u0=T0; // Set UV0
|
*(u32*)&TPrimPtr->u0=T0; // Set UV0
|
||||||
*(u32*)&TPrimPtr->u1=T1; // Set UV1
|
*(u32*)&TPrimPtr->u1=T1; // Set UV1
|
||||||
*(u16*)&TPrimPtr->u2=T2; // Set UV2
|
*(u32*)&TPrimPtr->u2=T2; // Set UV2
|
||||||
ThisOT=OtPtr+TList->OTOfs;
|
ThisOT=OtPtr+TList->OTOfs;
|
||||||
TList++;
|
TList++;
|
||||||
gte_nclip_b();
|
gte_nclip_b();
|
||||||
gte_stsxy3_ft3(TPrimPtr);
|
gte_stsxy3_ft3(TPrimPtr);
|
||||||
gte_stopz(&ClipZ);
|
gte_stopz(&ClipZ);
|
||||||
|
ClipZ|=ClipFlag; // <-- Evil!!
|
||||||
if (ClipZ<=0)
|
if (ClipZ<=0)
|
||||||
{
|
{
|
||||||
addPrim(ThisOT,TPrimPtr);
|
addPrim(ThisOT,TPrimPtr);
|
||||||
|
@ -884,3 +863,4 @@ sTri *TList=&ModelTriList[Elem->TriStart];
|
||||||
SetPrimPtr((u8*)TPrimPtr);
|
SetPrimPtr((u8*)TPrimPtr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,11 +130,6 @@ static sActorPool *ActorList,*LastActor;
|
||||||
class CActorGfx
|
class CActorGfx
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum
|
|
||||||
{
|
|
||||||
DEF_SHADOW_OFS=32,
|
|
||||||
};
|
|
||||||
|
|
||||||
CActorGfx(sActorPool *ThisActor);
|
CActorGfx(sActorPool *ThisActor);
|
||||||
virtual ~CActorGfx();
|
virtual ~CActorGfx();
|
||||||
|
|
||||||
|
@ -149,8 +144,6 @@ virtual ~CActorGfx();
|
||||||
|
|
||||||
sBBox &GetBBox() {return(BBox);}
|
sBBox &GetBBox() {return(BBox);}
|
||||||
|
|
||||||
// void SetShadow(bool f) {ShadowFlag=f;}
|
|
||||||
// void SetShadowOfs(int X,int Y) {ShadowXOfs=X; ShadowYOfs=Y;}
|
|
||||||
void SetOtPos(int Ot) {OtPos=Ot;}
|
void SetOtPos(int Ot) {OtPos=Ot;}
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,8 +155,6 @@ protected:
|
||||||
sSpriteFrameGfx *CurrentFrameGfx;
|
sSpriteFrameGfx *CurrentFrameGfx;
|
||||||
|
|
||||||
sBBox BBox;
|
sBBox BBox;
|
||||||
// bool ShadowFlag;
|
|
||||||
// s16 ShadowXOfs,ShadowYOfs;
|
|
||||||
u32 OtPos;
|
u32 OtPos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -179,7 +170,8 @@ virtual ~CModelGfx(){};
|
||||||
static void SetData(sLevelHdr *LevelHdr);
|
static void SetData(sLevelHdr *LevelHdr);
|
||||||
void SetModel(int Type);
|
void SetModel(int Type);
|
||||||
|
|
||||||
void Render(DVECTOR &Pos,SVECTOR *Angle=0,VECTOR *Scale=0);
|
void Render(DVECTOR &Pos,SVECTOR *Angle=0,VECTOR *Scale=0,s32 ClipFlag=0xffffffff);
|
||||||
|
void RenderClip(DVECTOR &Pos,SVECTOR *Angle=0,VECTOR *Scale=0) {Render(Pos,Angle,Scale,0);}
|
||||||
sBBox &GetBBox() {return(Model->BBox);}
|
sBBox &GetBBox() {return(Model->BBox);}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -76,7 +76,7 @@ void CNpcBouncingBarrelHazard::processMovement( int _frames )
|
||||||
m_rotation += 64 * _frames;
|
m_rotation += 64 * _frames;
|
||||||
m_rotation &= 4095;
|
m_rotation &= 4095;
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
s32 yPos = Pos.vy - offset.vy;
|
s32 yPos = Pos.vy - offset.vy;
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ void CNpcCheckpointHazard::render()
|
||||||
{
|
{
|
||||||
int x,y;
|
int x,y;
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth(m_spriteFrame);
|
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth(m_spriteFrame);
|
||||||
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight(m_spriteFrame);
|
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight(m_spriteFrame);
|
||||||
|
@ -101,7 +101,7 @@ void CNpcCheckpointHazard::collidedWith(CThing *_thisThing)
|
||||||
{
|
{
|
||||||
case TYPE_PLAYER:
|
case TYPE_PLAYER:
|
||||||
{
|
{
|
||||||
CRECT collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
DVECTOR respawnPos;
|
DVECTOR respawnPos;
|
||||||
respawnPos.vx=collisionArea.x1+((collisionArea.x2-collisionArea.x1)/2);
|
respawnPos.vx=collisionArea.x1+((collisionArea.x2-collisionArea.x1)/2);
|
||||||
respawnPos.vy=collisionArea.y2;
|
respawnPos.vy=collisionArea.y2;
|
||||||
|
|
|
@ -156,7 +156,7 @@ void CNpcFallingHazard::processMovement( int _frames )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
s32 yPos = Pos.vy - offset.vy;
|
s32 yPos = Pos.vy - offset.vy;
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ void CNpcFlyTrapHazard::render()
|
||||||
scale.vy = ONE;
|
scale.vy = ONE;
|
||||||
scale.vz = ONE;
|
scale.vz = ONE;
|
||||||
|
|
||||||
m_modelGfx->Render(renderPos,&rotation,&scale);
|
m_modelGfx->RenderClip(renderPos,&rotation,&scale);
|
||||||
|
|
||||||
sBBox boundingBox = m_modelGfx->GetBBox();
|
sBBox boundingBox = m_modelGfx->GetBBox();
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ void CNpcPendulumHazard::render()
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
int minX, maxX, minY, maxY;
|
int minX, maxX, minY, maxY;
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
CHazardThing::render();
|
CHazardThing::render();
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ void CNpcRockShardHazard::processMovement( int _frames )
|
||||||
Pos.vy += yMovement;
|
Pos.vy += yMovement;
|
||||||
}
|
}
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
s32 yPos = Pos.vy - offset.vy;
|
s32 yPos = Pos.vy - offset.vy;
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ void CNpcRisingWeightHazard::render()
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
int minX, maxX, minY, maxY;
|
int minX, maxX, minY, maxY;
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
if ( m_isActive )
|
if ( m_isActive )
|
||||||
{
|
{
|
||||||
|
|
|
@ -122,7 +122,7 @@ void CJellyfishGenerator::think( int _frames, CLevel *level )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
DVECTOR startPos;
|
DVECTOR startPos;
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ TSPRT *PrimPtr=PrimBank;
|
||||||
for (int i=0; i<Count; i++)
|
for (int i=0; i<Count; i++)
|
||||||
{
|
{
|
||||||
setTSprt(PrimPtr);
|
setTSprt(PrimPtr);
|
||||||
setTSetShadeTex(PrimPtr,0);
|
setTSetShadeTex(PrimPtr,1);
|
||||||
PrimPtr->w=TILE2D_WIDTH;
|
PrimPtr->w=TILE2D_WIDTH;
|
||||||
PrimPtr->h=TILE2D_HEIGHT;
|
PrimPtr->h=TILE2D_HEIGHT;
|
||||||
PrimPtr++;
|
PrimPtr++;
|
||||||
|
@ -136,8 +136,6 @@ TSPRT *PrimPtr=PrimBank;
|
||||||
PrimPtr->y0=TileY;
|
PrimPtr->y0=TileY;
|
||||||
setTSprtTPage(PrimPtr,Tile->TPage);
|
setTSprtTPage(PrimPtr,Tile->TPage);
|
||||||
*(u32*)&PrimPtr->u0=*(u32*)&Tile->u0; // copy uv AND clut
|
*(u32*)&PrimPtr->u0=*(u32*)&Tile->u0; // copy uv AND clut
|
||||||
extern u8 GlobalRGB[];
|
|
||||||
setRGB0(PrimPtr,GlobalRGB[2],GlobalRGB[2],GlobalRGB[2]);
|
|
||||||
addPrim(ThisOT,PrimPtr);
|
addPrim(ThisOT,PrimPtr);
|
||||||
PrimPtr++;
|
PrimPtr++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
void render();
|
void render();
|
||||||
void think(int _frames);
|
void think(int _frames);
|
||||||
|
|
||||||
void setCameraCentre(DVECTOR _pos) {MapPos=_pos;}
|
void setCameraCentre(DVECTOR const &_pos) {MapPos=_pos;}
|
||||||
static DVECTOR const &getCameraPos() {return MapPos;}
|
static DVECTOR const &getCameraPos() {return MapPos;}
|
||||||
static DVECTOR const &getPlayerSpawnPos() {return s_playerSpawnPos;}
|
static DVECTOR const &getPlayerSpawnPos() {return s_playerSpawnPos;}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ void CBridgeBalloon::shutdown()
|
||||||
|
|
||||||
int CBridgeBalloon::checkCollisionAgainst(CThing *_thisThing, int _frames)
|
int CBridgeBalloon::checkCollisionAgainst(CThing *_thisThing, int _frames)
|
||||||
{
|
{
|
||||||
DVECTOR projectilePos = _thisThing->getPos();
|
DVECTOR const &projectilePos = _thisThing->getPos();
|
||||||
|
|
||||||
s32 xDist = projectilePos.vx - Pos.vx;
|
s32 xDist = projectilePos.vx - Pos.vx;
|
||||||
s32 yDist = projectilePos.vy - Pos.vy;
|
s32 yDist = projectilePos.vy - Pos.vy;
|
||||||
|
@ -284,15 +284,15 @@ int CNpcBalloonBridgePlatform::checkCollisionAgainst(CThing *_thisThing, int _fr
|
||||||
thisRect = getCollisionArea();
|
thisRect = getCollisionArea();
|
||||||
thatRect = _thisThing->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;
|
DVECTOR const &ThatPosDelta = _thisThing->getPosDelta();
|
||||||
thisRect.y2 += abs( posDelta.vy ) >> 1;
|
int ThatAbsY=abs(ThatPosDelta.vy)>>1;
|
||||||
|
thatRect.y1 -= ThatAbsY;
|
||||||
posDelta = _thisThing->getPosDelta();
|
thatRect.y2 += ThatAbsY;
|
||||||
|
|
||||||
thatRect.y1 -= abs( posDelta.vy ) >> 1;
|
|
||||||
thatRect.y2 += abs( posDelta.vy ) >> 1;
|
|
||||||
|
|
||||||
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))&&
|
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)))
|
((thisRect.y1>=thatRect.y1&&thisRect.y1<=thatRect.y2)||(thisRect.y2>=thatRect.y1&&thisRect.y2<=thatRect.y2)||(thisRect.y1<=thatRect.y1&&thisRect.y2>=thatRect.y2)))
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
class CBridgeBalloon
|
class CBridgeBalloon
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void setPos( DVECTOR newPos ) {Pos = newPos;}
|
void setPos( DVECTOR const &newPos ) {Pos = newPos;}
|
||||||
void render();
|
void render();
|
||||||
void init();
|
void init();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
|
@ -36,7 +36,7 @@ void CNpcBobbingPlatform::processMovement( int _frames )
|
||||||
if ( m_contact )
|
if ( m_contact )
|
||||||
{
|
{
|
||||||
CPlayer *player = GameScene.getPlayer();
|
CPlayer *player = GameScene.getPlayer();
|
||||||
DVECTOR playerPos = player->getPos();
|
DVECTOR const &playerPos = player->getPos();
|
||||||
|
|
||||||
int height = player->getHeightFromGroundNoPlatform( playerPos.vx, playerPos.vy );
|
int height = player->getHeightFromGroundNoPlatform( playerPos.vx, playerPos.vy );
|
||||||
|
|
||||||
|
|
|
@ -145,15 +145,15 @@ void CNpcBouncePlatform::collidedWith( CThing *_thisThing )
|
||||||
case TYPE_PLAYER:
|
case TYPE_PLAYER:
|
||||||
{
|
{
|
||||||
CPlayer *player;
|
CPlayer *player;
|
||||||
DVECTOR playerPos;
|
// DVECTOR playerPos;
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
CRECT playerCollisionArea;
|
// CRECT playerCollisionArea;
|
||||||
|
|
||||||
// Only interested in SBs feet colliding with the box (pkg)
|
// Only interested in SBs feet colliding with the box (pkg)
|
||||||
player=(CPlayer*)_thisThing;
|
player=(CPlayer*)_thisThing;
|
||||||
playerPos=player->getPos();
|
DVECTOR const &playerPos=player->getPos();
|
||||||
playerCollisionArea = player->getCollisionArea();
|
CRECT const &playerCollisionArea = player->getCollisionArea();
|
||||||
collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
|
|
||||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
|
|
|
@ -99,15 +99,15 @@ int CNpcBubblePlatform::checkCollisionAgainst(CThing *_thisThing, int _frames)
|
||||||
thisRect = getCollisionArea();
|
thisRect = getCollisionArea();
|
||||||
thatRect = _thisThing->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;
|
DVECTOR const &ThatPosDelta = _thisThing->getPosDelta();
|
||||||
thisRect.y2 += abs( posDelta.vy ) >> 1;
|
int ThatAbsY=abs(ThatPosDelta.vy)>>1;
|
||||||
|
thatRect.y1 -= ThatAbsY;
|
||||||
posDelta = _thisThing->getPosDelta();
|
thatRect.y2 += ThatAbsY;
|
||||||
|
|
||||||
thatRect.y1 -= abs( posDelta.vy ) >> 1;
|
|
||||||
thatRect.y2 += abs( posDelta.vy ) >> 1;
|
|
||||||
|
|
||||||
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))&&
|
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)))
|
((thisRect.y1>=thatRect.y1&&thisRect.y1<=thatRect.y2)||(thisRect.y2>=thatRect.y1&&thisRect.y2<=thatRect.y2)||(thisRect.y1<=thatRect.y1&&thisRect.y2>=thatRect.y2)))
|
||||||
|
|
|
@ -154,15 +154,15 @@ void CNpcBubbleTubePlatform::collidedWith( CThing *_thisThing )
|
||||||
case TYPE_PLAYER:
|
case TYPE_PLAYER:
|
||||||
{
|
{
|
||||||
CPlayer *player;
|
CPlayer *player;
|
||||||
DVECTOR playerPos;
|
// DVECTOR playerPos;
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
CRECT playerCollisionArea;
|
// CRECT playerCollisionArea;
|
||||||
|
|
||||||
// Only interested in SBs feet colliding with the box (pkg)
|
// Only interested in SBs feet colliding with the box (pkg)
|
||||||
player=(CPlayer*)_thisThing;
|
player=(CPlayer*)_thisThing;
|
||||||
playerPos=player->getPos();
|
DVECTOR const &playerPos=player->getPos();
|
||||||
playerCollisionArea = player->getCollisionArea();
|
CRECT const &playerCollisionArea = player->getCollisionArea();
|
||||||
collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
|
|
||||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ int CNpcBigWheelPlatform::getHeightFromPlatformAtPosition(int _x,int _y, int off
|
||||||
{
|
{
|
||||||
DVECTOR top;
|
DVECTOR top;
|
||||||
|
|
||||||
CRECT collisionArea = getCollisionArea();
|
CRECT const &collisionArea = getCollisionArea();
|
||||||
|
|
||||||
top.vy = offsetY + collisionArea.y1;
|
top.vy = offsetY + collisionArea.y1;
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ void CNpcCartPlatform::processMovement( int _frames )
|
||||||
CPlayer *player = GameScene.getPlayer();
|
CPlayer *player = GameScene.getPlayer();
|
||||||
|
|
||||||
DVECTOR newPos = Pos;
|
DVECTOR newPos = Pos;
|
||||||
CRECT collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
newPos.vy = collisionArea.y1;
|
newPos.vy = collisionArea.y1;
|
||||||
|
|
||||||
player->setPos( newPos );
|
player->setPos( newPos );
|
||||||
|
@ -98,7 +98,7 @@ void CNpcCartPlatform::processMovement( int _frames )
|
||||||
|
|
||||||
Pos.vy += moveY;
|
Pos.vy += moveY;
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
s32 yPos = Pos.vy - offset.vy;
|
s32 yPos = Pos.vy - offset.vy;
|
||||||
|
|
||||||
|
@ -365,15 +365,15 @@ void CNpcCartPlatform::collidedWith( CThing *_thisThing )
|
||||||
case TYPE_PLAYER:
|
case TYPE_PLAYER:
|
||||||
{
|
{
|
||||||
CPlayer *player;
|
CPlayer *player;
|
||||||
DVECTOR playerPos;
|
// DVECTOR playerPos;
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
CRECT playerCollisionArea;
|
// CRECT playerCollisionArea;
|
||||||
|
|
||||||
// Only interested in SBs feet colliding with the box (pkg)
|
// Only interested in SBs feet colliding with the box (pkg)
|
||||||
player=(CPlayer*)_thisThing;
|
player=(CPlayer*)_thisThing;
|
||||||
playerPos=player->getPos();
|
DVECTOR const & playerPos=player->getPos();
|
||||||
playerCollisionArea = player->getCollisionArea();
|
CRECT const & playerCollisionArea = player->getCollisionArea();
|
||||||
collisionArea=getCollisionArea();
|
CRECT const & collisionArea=getCollisionArea();
|
||||||
|
|
||||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
|
|
|
@ -52,15 +52,15 @@ void CNpcClamPlatform::collidedWith( CThing *_thisThing )
|
||||||
case TYPE_PLAYER:
|
case TYPE_PLAYER:
|
||||||
{
|
{
|
||||||
CPlayer *player;
|
CPlayer *player;
|
||||||
DVECTOR playerPos;
|
// DVECTOR playerPos;
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
CRECT playerCollisionArea;
|
// CRECT playerCollisionArea;
|
||||||
|
|
||||||
// Only interested in SBs feet colliding with the box (pkg)
|
// Only interested in SBs feet colliding with the box (pkg)
|
||||||
player=(CPlayer*)_thisThing;
|
player=(CPlayer*)_thisThing;
|
||||||
playerPos=player->getPos();
|
DVECTOR const &playerPos=player->getPos();
|
||||||
playerCollisionArea = player->getCollisionArea();
|
CRECT const &playerCollisionArea = player->getCollisionArea();
|
||||||
collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
|
|
||||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ void CNpcConveyorPlatform::processMovement( int _frames )
|
||||||
m_rotation += 64 * _frames;
|
m_rotation += 64 * _frames;
|
||||||
m_rotation &= 4095;
|
m_rotation &= 4095;
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
Pos.vy += 3 * _frames;
|
Pos.vy += 3 * _frames;
|
||||||
|
|
||||||
|
@ -187,13 +187,13 @@ void CNpcConveyorPlatform::collidedWith( CThing *_thisThing )
|
||||||
case TYPE_PLAYER:
|
case TYPE_PLAYER:
|
||||||
{
|
{
|
||||||
CPlayer *player;
|
CPlayer *player;
|
||||||
DVECTOR playerPos;
|
// DVECTOR playerPos;
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
|
|
||||||
// Only interested in SBs feet colliding with the box (pkg)
|
// Only interested in SBs feet colliding with the box (pkg)
|
||||||
player=(CPlayer*)_thisThing;
|
player=(CPlayer*)_thisThing;
|
||||||
playerPos=player->getPos();
|
DVECTOR const &playerPos=player->getPos();
|
||||||
collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
|
|
||||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ void CNpcConveyorPlatform::collidedWith( CThing *_thisThing )
|
||||||
{
|
{
|
||||||
int distLeft, distRight;
|
int distLeft, distRight;
|
||||||
|
|
||||||
DVECTOR playerCollisionSize = player->getCollisionSize();
|
DVECTOR const &playerCollisionSize = player->getCollisionSize();
|
||||||
|
|
||||||
distLeft = collisionArea.x1 - playerPos.vx - ( playerCollisionSize.vx >> 1 );
|
distLeft = collisionArea.x1 - playerPos.vx - ( playerCollisionSize.vx >> 1 );
|
||||||
distRight = collisionArea.x2 - playerPos.vx + ( playerCollisionSize.vx >> 1 );
|
distRight = collisionArea.x2 - playerPos.vx + ( playerCollisionSize.vx >> 1 );
|
||||||
|
|
|
@ -238,7 +238,7 @@ void CNpcDualPlatform::render()
|
||||||
{
|
{
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
if ( m_isActive )
|
if ( m_isActive )
|
||||||
{
|
{
|
||||||
|
@ -343,15 +343,15 @@ void CNpcDualPlatform::collidedWith( CThing *_thisThing )
|
||||||
case TYPE_PLAYER:
|
case TYPE_PLAYER:
|
||||||
{
|
{
|
||||||
CPlayer *player;
|
CPlayer *player;
|
||||||
DVECTOR playerPos;
|
// DVECTOR playerPos;
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
CRECT playerCollisionArea;
|
// CRECT playerCollisionArea;
|
||||||
|
|
||||||
// Only interested in SBs feet colliding with the box (pkg)
|
// Only interested in SBs feet colliding with the box (pkg)
|
||||||
player=(CPlayer*)_thisThing;
|
player=(CPlayer*)_thisThing;
|
||||||
playerPos=player->getPos();
|
DVECTOR const &playerPos=player->getPos();
|
||||||
playerCollisionArea = player->getCollisionArea();
|
CRECT const &playerCollisionArea = player->getCollisionArea();
|
||||||
collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
|
|
||||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
|
@ -391,12 +391,12 @@ void CNpcDualPlatform::collidedWith( CThing *_thisThing )
|
||||||
case TYPE_NPC:
|
case TYPE_NPC:
|
||||||
{
|
{
|
||||||
CNpcFriend *friendNpc;
|
CNpcFriend *friendNpc;
|
||||||
DVECTOR friendPos;
|
// DVECTOR friendPos;
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
|
|
||||||
friendNpc = (CNpcFriend*) _thisThing;
|
friendNpc = (CNpcFriend*) _thisThing;
|
||||||
friendPos = friendNpc->getPos();
|
DVECTOR const &friendPos = friendNpc->getPos();
|
||||||
collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
|
|
||||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ void CNpcFallingNoRespawnPlatform::processMovement( int _frames )
|
||||||
s32 distX, distY, heading;
|
s32 distX, distY, heading;
|
||||||
bool pathComplete;
|
bool pathComplete;
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
if ( m_spinFinish )
|
if ( m_spinFinish )
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,7 +81,7 @@ void CNpcFallingBlockPlatform::processMovement( int _frames )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
s32 yPos = Pos.vy - offset.vy;
|
s32 yPos = Pos.vy - offset.vy;
|
||||||
|
|
||||||
|
@ -106,15 +106,15 @@ void CNpcFallingBlockPlatform::collidedWith( CThing *_thisThing )
|
||||||
case TYPE_PLAYER:
|
case TYPE_PLAYER:
|
||||||
{
|
{
|
||||||
CPlayer *player;
|
CPlayer *player;
|
||||||
DVECTOR playerPos;
|
// DVECTOR playerPos;
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
CRECT playerCollisionArea;
|
// CRECT playerCollisionArea;
|
||||||
|
|
||||||
// Only interested in SBs feet colliding with the box (pkg)
|
// Only interested in SBs feet colliding with the box (pkg)
|
||||||
player=(CPlayer*)_thisThing;
|
player=(CPlayer*)_thisThing;
|
||||||
playerPos=player->getPos();
|
DVECTOR const &playerPos=player->getPos();
|
||||||
playerCollisionArea = player->getCollisionArea();
|
CRECT const &playerCollisionArea = player->getCollisionArea();
|
||||||
collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
|
|
||||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ void CNpcGeyserBubblePlatform::processMovement( int _frames )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
s32 yPos = Pos.vy - offset.vy;
|
s32 yPos = Pos.vy - offset.vy;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ void CNpcGhostTrainPlatform::processMovement( int _frames )
|
||||||
CPlayer *player = GameScene.getPlayer();
|
CPlayer *player = GameScene.getPlayer();
|
||||||
|
|
||||||
DVECTOR newPos = Pos;
|
DVECTOR newPos = Pos;
|
||||||
CRECT collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
newPos.vy = collisionArea.y1;
|
newPos.vy = collisionArea.y1;
|
||||||
|
|
||||||
player->setPos( newPos );
|
player->setPos( newPos );
|
||||||
|
@ -82,7 +82,7 @@ void CNpcGhostTrainPlatform::processMovement( int _frames )
|
||||||
|
|
||||||
Pos.vy += moveY;
|
Pos.vy += moveY;
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
s32 yPos = Pos.vy - offset.vy;
|
s32 yPos = Pos.vy - offset.vy;
|
||||||
|
|
||||||
|
|
|
@ -64,15 +64,15 @@ void CNpcJellyfishPlatform::collidedWith( CThing *_thisThing )
|
||||||
if ( m_detectCollision && m_isActive )
|
if ( m_detectCollision && m_isActive )
|
||||||
{
|
{
|
||||||
CPlayer *player;
|
CPlayer *player;
|
||||||
DVECTOR playerPos;
|
// DVECTOR playerPos;
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
CRECT playerArea;
|
// CRECT playerArea;
|
||||||
|
|
||||||
// Only interested in SBs feet colliding with the box (pkg)
|
// Only interested in SBs feet colliding with the box (pkg)
|
||||||
player=(CPlayer*)_thisThing;
|
player=(CPlayer*)_thisThing;
|
||||||
playerPos=player->getPos();
|
DVECTOR const &playerPos=player->getPos();
|
||||||
playerArea=player->getCollisionArea();
|
CRECT const &playerArea=player->getCollisionArea();
|
||||||
collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
|
|
||||||
s32 height = getHeightFromPlatformAtPosition(playerPos.vx,playerPos.vy);
|
s32 height = getHeightFromPlatformAtPosition(playerPos.vx,playerPos.vy);
|
||||||
|
|
||||||
|
|
|
@ -689,8 +689,8 @@ void CNpcPlatform::reinit()
|
||||||
|
|
||||||
void CNpcPlatform::calculateNonRotatedCollisionData()
|
void CNpcPlatform::calculateNonRotatedCollisionData()
|
||||||
{
|
{
|
||||||
DVECTOR collisionSize = getCollisionSize();
|
DVECTOR const &collisionSize = getCollisionSize();
|
||||||
DVECTOR collisionOffset = getCollisionCentreOffset();
|
DVECTOR const &collisionOffset = getCollisionCentreOffset();
|
||||||
|
|
||||||
m_nonRotatedCollisionArea.XMax = ( collisionSize.vx >> 1 ) + collisionOffset.vx;
|
m_nonRotatedCollisionArea.XMax = ( collisionSize.vx >> 1 ) + collisionOffset.vx;
|
||||||
m_nonRotatedCollisionArea.XMin = -( 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();
|
player=GameScene.getPlayer();
|
||||||
if(player->isOnPlatform()==this)
|
if(player->isOnPlatform()==this)
|
||||||
{
|
{
|
||||||
DVECTOR playerPos;
|
DVECTOR const &playerPos=player->getPos();
|
||||||
|
|
||||||
playerPos=player->getPos();
|
|
||||||
|
|
||||||
DVECTOR shove;
|
DVECTOR shove;
|
||||||
shove.vx = 0;
|
shove.vx = 0;
|
||||||
|
@ -955,7 +953,7 @@ void CNpcPlatform::processTilt( int _frames )
|
||||||
// user is touching platform, tilt accordingly
|
// user is touching platform, tilt accordingly
|
||||||
|
|
||||||
CPlayer *player = GameScene.getPlayer();
|
CPlayer *player = GameScene.getPlayer();
|
||||||
DVECTOR playerPos = player->getPos();
|
DVECTOR const &playerPos = player->getPos();
|
||||||
|
|
||||||
if ( playerPos.vx > Pos.vx + 10 )
|
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" +
|
// check for case of "was not colliding previously because was above" +
|
||||||
// "is not colliding now because is below"
|
// "is not colliding now because is below"
|
||||||
|
|
||||||
DVECTOR otherPos = _thisThing->getPos();
|
DVECTOR const &otherPos = _thisThing->getPos();
|
||||||
|
|
||||||
if ( getHeightFromPlatformAtPosition( otherPos.vx, otherPos.vy ) < 0 )
|
if ( getHeightFromPlatformAtPosition( otherPos.vx, otherPos.vy ) < 0 )
|
||||||
{
|
{
|
||||||
// is currently below platform landing point
|
// is currently below platform landing point
|
||||||
|
|
||||||
DVECTOR otherPosDelta = _thisThing->getPosDelta();
|
DVECTOR const &otherPosDelta = _thisThing->getPosDelta();
|
||||||
DVECTOR posDelta = getPosDelta();
|
DVECTOR const &posDelta = getPosDelta();
|
||||||
|
|
||||||
if ( otherPosDelta.vy > 0 || posDelta.vy < 0 )
|
if ( otherPosDelta.vy > 0 || posDelta.vy < 0 )
|
||||||
{
|
{
|
||||||
|
@ -1115,15 +1113,15 @@ void CNpcPlatform::collidedWith( CThing *_thisThing )
|
||||||
case TYPE_PLAYER:
|
case TYPE_PLAYER:
|
||||||
{
|
{
|
||||||
CPlayer *player;
|
CPlayer *player;
|
||||||
DVECTOR playerPos;
|
// DVECTOR playerPos;
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
CRECT playerCollisionArea;
|
// CRECT playerCollisionArea;
|
||||||
|
|
||||||
// Only interested in SBs feet colliding with the box (pkg)
|
// Only interested in SBs feet colliding with the box (pkg)
|
||||||
player=(CPlayer*)_thisThing;
|
player=(CPlayer*)_thisThing;
|
||||||
playerPos=player->getPos();
|
DVECTOR const &playerPos=player->getPos();
|
||||||
playerCollisionArea = player->getCollisionArea();
|
CRECT const &playerCollisionArea = player->getCollisionArea();
|
||||||
collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
|
|
||||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
|
@ -1163,12 +1161,12 @@ void CNpcPlatform::collidedWith( CThing *_thisThing )
|
||||||
case TYPE_NPC:
|
case TYPE_NPC:
|
||||||
{
|
{
|
||||||
CNpcFriend *friendNpc;
|
CNpcFriend *friendNpc;
|
||||||
DVECTOR friendPos;
|
// DVECTOR friendPos;
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
|
|
||||||
friendNpc = (CNpcFriend*) _thisThing;
|
friendNpc = (CNpcFriend*) _thisThing;
|
||||||
friendPos = friendNpc->getPos();
|
DVECTOR const &friendPos = friendNpc->getPos();
|
||||||
collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
|
|
||||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
|
@ -1259,15 +1257,15 @@ int CNpcPlatform::checkCollisionAgainst(CThing *_thisThing, int _frames)
|
||||||
thisRect = getCollisionArea();
|
thisRect = getCollisionArea();
|
||||||
thatRect = _thisThing->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;
|
DVECTOR const &ThatPosDelta = _thisThing->getPosDelta();
|
||||||
thisRect.y2 += abs( posDelta.vy ) >> 1;
|
int ThatAbsY=abs(ThatPosDelta.vy)>>1;
|
||||||
|
thatRect.y1 -= ThatAbsY;
|
||||||
posDelta = _thisThing->getPosDelta();
|
thatRect.y2 += ThatAbsY;
|
||||||
|
|
||||||
thatRect.y1 -= abs( posDelta.vy ) >> 1;
|
|
||||||
thatRect.y2 += abs( posDelta.vy ) >> 1;
|
|
||||||
|
|
||||||
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))&&
|
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)))
|
((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;
|
DVECTOR top;
|
||||||
int angle;
|
int angle;
|
||||||
|
|
||||||
CRECT collisionArea = getCollisionArea();
|
CRECT const &collisionArea = getCollisionArea();
|
||||||
|
|
||||||
top.vy = offsetY + collisionArea.y1;
|
top.vy = offsetY + collisionArea.y1;
|
||||||
|
|
||||||
|
|
|
@ -165,15 +165,15 @@ void CNpcLiftPlatform::collidedWith( CThing *_thisThing )
|
||||||
case TYPE_PLAYER:
|
case TYPE_PLAYER:
|
||||||
{
|
{
|
||||||
CPlayer *player;
|
CPlayer *player;
|
||||||
DVECTOR playerPos;
|
// DVECTOR playerPos;
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
CRECT playerCollisionArea;
|
// CRECT playerCollisionArea;
|
||||||
|
|
||||||
// Only interested in SBs feet colliding with the box (pkg)
|
// Only interested in SBs feet colliding with the box (pkg)
|
||||||
player=(CPlayer*)_thisThing;
|
player=(CPlayer*)_thisThing;
|
||||||
playerPos=player->getPos();
|
DVECTOR const &playerPos=player->getPos();
|
||||||
playerCollisionArea = player->getCollisionArea();
|
CRECT const &playerCollisionArea = player->getCollisionArea();
|
||||||
collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
|
|
||||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
|
@ -213,12 +213,12 @@ void CNpcLiftPlatform::collidedWith( CThing *_thisThing )
|
||||||
case TYPE_NPC:
|
case TYPE_NPC:
|
||||||
{
|
{
|
||||||
CNpcFriend *friendNpc;
|
CNpcFriend *friendNpc;
|
||||||
DVECTOR friendPos;
|
// DVECTOR friendPos;
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
|
|
||||||
friendNpc = (CNpcFriend*) _thisThing;
|
friendNpc = (CNpcFriend*) _thisThing;
|
||||||
friendPos = friendNpc->getPos();
|
DVECTOR const &friendPos = friendNpc->getPos();
|
||||||
collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
|
|
||||||
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
s32 threshold = abs( collisionArea.y2 - collisionArea.y1 );
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ void CNpcPendulumPlatform::render()
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
int x1Boundary,y1Boundary,x2Boundary,y2Boundary;
|
int x1Boundary,y1Boundary,x2Boundary,y2Boundary;
|
||||||
|
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
if ( m_isActive )
|
if ( m_isActive )
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,7 +56,7 @@ void CNpcSteerableBarrelPlatform::processMovement( int _frames )
|
||||||
{
|
{
|
||||||
player->setReverseCameraMovement(true);
|
player->setReverseCameraMovement(true);
|
||||||
|
|
||||||
DVECTOR playerPos = player->getPos();
|
DVECTOR const &playerPos = player->getPos();
|
||||||
|
|
||||||
s32 playerMovement = player->getMovement();
|
s32 playerMovement = player->getMovement();
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ void CNpcSteerableBarrelPlatform::render()
|
||||||
if (canRender())
|
if (canRender())
|
||||||
{
|
{
|
||||||
DVECTOR &renderPos=getRenderPos();
|
DVECTOR &renderPos=getRenderPos();
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
SVECTOR rotation;
|
SVECTOR rotation;
|
||||||
rotation.vx = 0;
|
rotation.vx = 0;
|
||||||
|
@ -229,15 +229,15 @@ void CNpcSteerableBarrelPlatform::collidedWith( CThing *_thisThing )
|
||||||
case TYPE_PLAYER:
|
case TYPE_PLAYER:
|
||||||
{
|
{
|
||||||
CPlayer *player;
|
CPlayer *player;
|
||||||
DVECTOR playerPos;
|
// DVECTOR playerPos;
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
CRECT playerCollisionArea;
|
// CRECT playerCollisionArea;
|
||||||
|
|
||||||
// Only interested in SBs feet colliding with the box (pkg)
|
// Only interested in SBs feet colliding with the box (pkg)
|
||||||
player=(CPlayer*)_thisThing;
|
player=(CPlayer*)_thisThing;
|
||||||
playerPos=player->getPos();
|
DVECTOR const &playerPos=player->getPos();
|
||||||
playerCollisionArea = player->getCollisionArea();
|
CRECT const &playerCollisionArea = player->getCollisionArea();
|
||||||
collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
|
|
||||||
//if( playerPos.vx >= collisionArea.x1 && playerPos.vx <= collisionArea.x2 )
|
//if( playerPos.vx >= collisionArea.x1 && playerPos.vx <= collisionArea.x2 )
|
||||||
if( playerCollisionArea.x2 >= collisionArea.x1 && playerCollisionArea.x1 <= collisionArea.x2 )
|
if( playerCollisionArea.x2 >= collisionArea.x1 && playerCollisionArea.x1 <= collisionArea.x2 )
|
||||||
|
|
|
@ -46,7 +46,7 @@ void CNpcSeesawPlatform::processMovement( int _frames )
|
||||||
|
|
||||||
CPlayer *player = GameScene.getPlayer();
|
CPlayer *player = GameScene.getPlayer();
|
||||||
|
|
||||||
DVECTOR playerPos = player->getPos();
|
DVECTOR const &playerPos = player->getPos();
|
||||||
|
|
||||||
s32 distX = playerPos.vx - this->Pos.vx;
|
s32 distX = playerPos.vx - this->Pos.vx;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ void CNpcSteerableOildrumPlatform::processMovement( int _frames )
|
||||||
{
|
{
|
||||||
player->setReverseCameraMovement(true);
|
player->setReverseCameraMovement(true);
|
||||||
|
|
||||||
DVECTOR playerPos = player->getPos();
|
DVECTOR const &playerPos = player->getPos();
|
||||||
|
|
||||||
s32 playerMovement = player->getMovement();
|
s32 playerMovement = player->getMovement();
|
||||||
|
|
||||||
|
|
|
@ -1526,7 +1526,7 @@ if(drawlastpos)
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CPlayer::setRespawnPosAndRingTelephone(DVECTOR _respawn)
|
void CPlayer::setRespawnPosAndRingTelephone(DVECTOR const &_respawn)
|
||||||
{
|
{
|
||||||
if(m_respawnPos.vx!=_respawn.vx||
|
if(m_respawnPos.vx!=_respawn.vx||
|
||||||
m_respawnPos.vy!=_respawn.vy)
|
m_respawnPos.vy!=_respawn.vy)
|
||||||
|
@ -2395,7 +2395,7 @@ void CPlayer::justButtBouncedABadGuy()
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CPlayer::shove( DVECTOR move )
|
void CPlayer::shove( DVECTOR const &move )
|
||||||
{
|
{
|
||||||
int colHeight;
|
int colHeight;
|
||||||
|
|
||||||
|
@ -3026,10 +3026,10 @@ void CPlayer::setPlayerCollisionSize(int _x,int _y,int _w,int _h)
|
||||||
}
|
}
|
||||||
void CPlayer::getPlayerCollisionSize(int *_x,int *_y,int *_w,int *_h)
|
void CPlayer::getPlayerCollisionSize(int *_x,int *_y,int *_w,int *_h)
|
||||||
{
|
{
|
||||||
DVECTOR offset,size;
|
// DVECTOR offset,size;
|
||||||
|
|
||||||
offset=getCollisionCentreOffset();
|
DVECTOR const &offset=getCollisionCentreOffset();
|
||||||
size=getCollisionSize();
|
DVECTOR const &size=getCollisionSize();
|
||||||
|
|
||||||
*_x=offset.vx;
|
*_x=offset.vx;
|
||||||
*_y=offset.vy;
|
*_y=offset.vy;
|
||||||
|
|
|
@ -226,7 +226,7 @@ public:
|
||||||
void detectHazardousSurface();
|
void detectHazardousSurface();
|
||||||
virtual void render();
|
virtual void render();
|
||||||
virtual int dontKillDuringLevelRespawn() {return true;}
|
virtual int dontKillDuringLevelRespawn() {return true;}
|
||||||
virtual void shove(DVECTOR move);
|
virtual void shove(DVECTOR const &move);
|
||||||
void moveLeft(); // This is only for camera scroll right now
|
void moveLeft(); // This is only for camera scroll right now
|
||||||
void moveRight(); // " " " " "
|
void moveRight(); // " " " " "
|
||||||
void fall(); // " " " " "
|
void fall(); // " " " " "
|
||||||
|
@ -236,12 +236,12 @@ public:
|
||||||
|
|
||||||
int isTryingToConversateWithFriend() {return m_allowConversation;}
|
int isTryingToConversateWithFriend() {return m_allowConversation;}
|
||||||
|
|
||||||
DVECTOR getCameraPos() {return m_cameraPos;}
|
DVECTOR const &getCameraPos() {return m_cameraPos;}
|
||||||
void setCartCam(int _flag) {m_cartCamActive=_flag;}
|
void setCartCam(int _flag) {m_cartCamActive=_flag;}
|
||||||
void setReverseCameraMovement(int _flag) {m_reverseCameraMovement=_flag;}
|
void setReverseCameraMovement(int _flag) {m_reverseCameraMovement=_flag;}
|
||||||
void setCameraBox(CameraBox _cameraBox);
|
void setCameraBox(CameraBox _cameraBox);
|
||||||
void setRespawnPos(DVECTOR _respawn) {m_respawnPos=_respawn;}
|
void setRespawnPos(DVECTOR const &_respawn) {m_respawnPos=_respawn;}
|
||||||
void setRespawnPosAndRingTelephone(DVECTOR _respawn);
|
void setRespawnPosAndRingTelephone(DVECTOR const &_respawn);
|
||||||
|
|
||||||
// This isn't funny anymore.. :(
|
// This isn't funny anymore.. :(
|
||||||
int getHeightFromGround(int _x,int _y,int _maxHeight=32);
|
int getHeightFromGround(int _x,int _y,int _maxHeight=32);
|
||||||
|
@ -285,7 +285,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DVECTOR getPlayerPos() {return Pos;}
|
DVECTOR const &getPlayerPos() {return Pos;}
|
||||||
void setPlayerPos(DVECTOR *_pos) {Pos=*_pos;}
|
void setPlayerPos(DVECTOR *_pos) {Pos=*_pos;}
|
||||||
void ignoreNewlyPressedButtonsOnPadThisThink();
|
void ignoreNewlyPressedButtonsOnPadThisThink();
|
||||||
PLAYERINPUT getPadInputHeld() {return m_padInput;}
|
PLAYERINPUT getPadInputHeld() {return m_padInput;}
|
||||||
|
|
|
@ -80,8 +80,9 @@ void CPlayerModeCart::think()
|
||||||
|
|
||||||
if ( platform )
|
if ( platform )
|
||||||
{
|
{
|
||||||
newPos.vx = platform->getPos().vx;
|
newPos=platform->getPos();
|
||||||
newPos.vy = platform->getPos().vy;
|
// newPos.vx = platform->getPos().vx;
|
||||||
|
// newPos.vy = platform->getPos().vy;
|
||||||
|
|
||||||
int platformOffset = ( ( CNpcPlatform* ) platform )->getHeightFromPlatformAtPosition( newPos.vx, newPos.vy );
|
int platformOffset = ( ( CNpcPlatform* ) platform )->getHeightFromPlatformAtPosition( newPos.vx, newPos.vy );
|
||||||
s16 angle = ( ( CNpcPlatform * ) platform )->getCollisionAngle();
|
s16 angle = ( ( CNpcPlatform * ) platform )->getCollisionAngle();
|
||||||
|
|
|
@ -212,12 +212,12 @@ void CPlayerModeCoralBlower::think()
|
||||||
else if(m_enemy==NULL)
|
else if(m_enemy==NULL)
|
||||||
{
|
{
|
||||||
// Search for an enemy..
|
// Search for an enemy..
|
||||||
DVECTOR playerPos;
|
// DVECTOR playerPos;
|
||||||
int playerFacing;
|
int playerFacing;
|
||||||
CRECT suckRect;
|
CRECT suckRect;
|
||||||
CThing *thing;
|
CThing *thing;
|
||||||
|
|
||||||
playerPos=m_player->getPos();
|
DVECTOR const &playerPos=m_player->getPos();
|
||||||
playerFacing=m_player->getFacing();
|
playerFacing=m_player->getFacing();
|
||||||
|
|
||||||
suckRect.x1=playerPos.vx+(blowerCatchPos.vx*playerFacing)-(blowerCatchSize.vx/2);
|
suckRect.x1=playerPos.vx+(blowerCatchPos.vx*playerFacing)-(blowerCatchSize.vx/2);
|
||||||
|
@ -228,7 +228,7 @@ void CPlayerModeCoralBlower::think()
|
||||||
#ifdef __USER_paul__
|
#ifdef __USER_paul__
|
||||||
{
|
{
|
||||||
CRECT area=suckRect;
|
CRECT area=suckRect;
|
||||||
DVECTOR ofs=CLevel::getCameraPos();
|
DVECTOR const &ofs=CLevel::getCameraPos();
|
||||||
area.x1-=ofs.vx;
|
area.x1-=ofs.vx;
|
||||||
area.y1-=ofs.vy;
|
area.y1-=ofs.vy;
|
||||||
area.x2-=ofs.vx;
|
area.x2-=ofs.vx;
|
||||||
|
@ -352,11 +352,11 @@ void CPlayerModeCoralBlower::renderModeUi()
|
||||||
{
|
{
|
||||||
// Draw aiming cursor
|
// Draw aiming cursor
|
||||||
int facing,heading;
|
int facing,heading;
|
||||||
DVECTOR screenOfs,launchPos,targetPos;
|
DVECTOR launchPos,targetPos;
|
||||||
|
|
||||||
facing=m_player->getFacing();
|
facing=m_player->getFacing();
|
||||||
heading=((m_launchHeading+1024)*facing)&4095;
|
heading=((m_launchHeading+1024)*facing)&4095;
|
||||||
screenOfs=CLevel::getCameraPos();
|
DVECTOR const &screenOfs=CLevel::getCameraPos();
|
||||||
launchPos=m_player->getPlayerPos();
|
launchPos=m_player->getPlayerPos();
|
||||||
launchPos.vx+=(blowerLaunchPoint.vx*facing)-screenOfs.vx;
|
launchPos.vx+=(blowerLaunchPoint.vx*facing)-screenOfs.vx;
|
||||||
launchPos.vy+=blowerLaunchPoint.vy-screenOfs.vy;
|
launchPos.vy+=blowerLaunchPoint.vy-screenOfs.vy;
|
||||||
|
|
|
@ -231,15 +231,15 @@ void CPlayerModeNet::think()
|
||||||
|
|
||||||
case NET_STATE__CATCHING:
|
case NET_STATE__CATCHING:
|
||||||
{
|
{
|
||||||
DVECTOR catchPos;
|
// DVECTOR catchPos;
|
||||||
DVECTOR playerPos;
|
// DVECTOR playerPos;
|
||||||
int playerFacing;
|
int playerFacing;
|
||||||
CRECT netRect;
|
CRECT netRect;
|
||||||
CThing *thing;
|
CThing *thing;
|
||||||
|
|
||||||
ASSERT(m_netFrame<(int)(sizeof(netCatchPos)/sizeof(DVECTOR)));
|
ASSERT(m_netFrame<(int)(sizeof(netCatchPos)/sizeof(DVECTOR)));
|
||||||
catchPos=netCatchPos[m_netFrame];
|
DVECTOR const &catchPos=netCatchPos[m_netFrame];
|
||||||
playerPos=m_player->getPos();
|
DVECTOR const &playerPos=m_player->getPos();
|
||||||
playerFacing=m_player->getFacing();
|
playerFacing=m_player->getFacing();
|
||||||
|
|
||||||
netRect.x1=playerPos.vx+(catchPos.vx*playerFacing)-(netCatchSize.vx/2);
|
netRect.x1=playerPos.vx+(catchPos.vx*playerFacing)-(netCatchSize.vx/2);
|
||||||
|
|
|
@ -199,7 +199,7 @@ int CPlayerMode::getPadInputDown() {return m_player->getPadInputDown();}
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
int CPlayerMode::getHeightFromGound()
|
int CPlayerMode::getHeightFromGound()
|
||||||
{
|
{
|
||||||
DVECTOR pos=getPlayerPos();
|
DVECTOR const &pos=getPlayerPos();
|
||||||
return m_player->getHeightFromGround(pos.vx,pos.vy);
|
return m_player->getHeightFromGround(pos.vx,pos.vy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ void CPlayerMode::inSoakUpState() {m_player->inSoakUpState();}
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
DVECTOR CPlayerMode::getPlayerPos() {return m_player->getPlayerPos();}
|
DVECTOR const &CPlayerMode::getPlayerPos() {return m_player->getPlayerPos();}
|
||||||
void CPlayerMode::setPlayerPos(DVECTOR *_pos) {m_player->setPlayerPos(_pos);}
|
void CPlayerMode::setPlayerPos(DVECTOR *_pos) {m_player->setPlayerPos(_pos);}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
|
@ -350,11 +350,9 @@ void CPlayerModeBase::thinkVerticalMovement()
|
||||||
{
|
{
|
||||||
if(m_player->moveVertical(m_player->getMoveVelocity()->vy>>VELOCITY_SHIFT))
|
if(m_player->moveVertical(m_player->getMoveVelocity()->vy>>VELOCITY_SHIFT))
|
||||||
{
|
{
|
||||||
DVECTOR pos;
|
|
||||||
|
|
||||||
if(m_currentState!=STATE_CELEBRATE)
|
if(m_currentState!=STATE_CELEBRATE)
|
||||||
playerHasHitGround();
|
playerHasHitGround();
|
||||||
pos=m_player->getPlayerPos();
|
DVECTOR const &pos=m_player->getPlayerPos();
|
||||||
if(m_player->getHeightFromGround(pos.vx,pos.vy,5)==0&&
|
if(m_player->getHeightFromGround(pos.vx,pos.vy,5)==0&&
|
||||||
(CGameScene::getCollision()->getCollisionBlock(pos.vx,pos.vy)&COLLISION_TYPE_MASK)==COLLISION_TYPE_FLAG_SOAKUP)
|
(CGameScene::getCollision()->getCollisionBlock(pos.vx,pos.vy)&COLLISION_TYPE_MASK)==COLLISION_TYPE_FLAG_SOAKUP)
|
||||||
{
|
{
|
||||||
|
@ -378,8 +376,8 @@ void CPlayerModeBase::thinkVerticalMovement()
|
||||||
m_currentState!=STATE_JUMPBACK&&m_currentState!=STATE_BUTTBOUNCEUP&&
|
m_currentState!=STATE_JUMPBACK&&m_currentState!=STATE_BUTTBOUNCEUP&&
|
||||||
m_currentState!=STATE_FLOAT&&m_currentState!=STATE_CELEBRATE)
|
m_currentState!=STATE_FLOAT&&m_currentState!=STATE_CELEBRATE)
|
||||||
{
|
{
|
||||||
DVECTOR pos;
|
DVECTOR const &pos=m_player->getPlayerPos();
|
||||||
pos=m_player->getPlayerPos();
|
|
||||||
if(m_player->getHeightFromGround(pos.vx,pos.vy,1)!=0
|
if(m_player->getHeightFromGround(pos.vx,pos.vy,1)!=0
|
||||||
#ifdef SHITE_COLLISION
|
#ifdef SHITE_COLLISION
|
||||||
&&
|
&&
|
||||||
|
@ -565,10 +563,9 @@ int cheight=15;
|
||||||
int CPlayerModeBase::isOnEdge()
|
int CPlayerModeBase::isOnEdge()
|
||||||
{
|
{
|
||||||
CLayerCollision *collision=CGameScene::getCollision();
|
CLayerCollision *collision=CGameScene::getCollision();
|
||||||
DVECTOR pos;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
pos=m_player->getPlayerPos();
|
DVECTOR const &pos=m_player->getPlayerPos();
|
||||||
ret=0;
|
ret=0;
|
||||||
if(m_player->getHeightFromGround(pos.vx-csize,pos.vy,cheight+1)>cheight)
|
if(m_player->getHeightFromGround(pos.vx-csize,pos.vy,cheight+1)>cheight)
|
||||||
{
|
{
|
||||||
|
@ -589,8 +586,7 @@ int CPlayerModeBase::isOnEdge()
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
int CPlayerModeBase::canMoveLeft()
|
int CPlayerModeBase::canMoveLeft()
|
||||||
{
|
{
|
||||||
DVECTOR pos;
|
DVECTOR const &pos=m_player->getPlayerPos();
|
||||||
pos=m_player->getPlayerPos();
|
|
||||||
#ifdef SHITE_COLLISION
|
#ifdef SHITE_COLLISION
|
||||||
return m_player->getHeightFromGround(pos.vx-checkx,pos.vy,checkdist)>-checkycanmove?true:false;
|
return m_player->getHeightFromGround(pos.vx-checkx,pos.vy,checkdist)>-checkycanmove?true:false;
|
||||||
#else
|
#else
|
||||||
|
@ -601,8 +597,7 @@ int CPlayerModeBase::canMoveLeft()
|
||||||
|
|
||||||
int CPlayerModeBase::canMoveRight()
|
int CPlayerModeBase::canMoveRight()
|
||||||
{
|
{
|
||||||
DVECTOR pos;
|
DVECTOR const &pos=m_player->getPlayerPos();
|
||||||
pos=m_player->getPlayerPos();
|
|
||||||
#ifdef SHITE_COLLISION
|
#ifdef SHITE_COLLISION
|
||||||
return m_player->getHeightFromGround(pos.vx+checkx,pos.vy,checkdist)>-checkycanmove?true:false;
|
return m_player->getHeightFromGround(pos.vx+checkx,pos.vy,checkdist)>-checkycanmove?true:false;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -109,7 +109,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DVECTOR getPlayerPos(); // Public so that the states can get the position for bubicle spawners
|
DVECTOR const &getPlayerPos(); // Public so that the states can get the position for bubicle spawners
|
||||||
protected:
|
protected:
|
||||||
void setPlayerPos(DVECTOR *_pos); // Private so that they cannot directly alter it
|
void setPlayerPos(DVECTOR *_pos); // Private so that they cannot directly alter it
|
||||||
|
|
||||||
|
|
|
@ -174,9 +174,8 @@ void CPlayerStateButtBounceLand::enter(CPlayerModeBase *_playerMode)
|
||||||
m_bounceOffFloor=false;
|
m_bounceOffFloor=false;
|
||||||
if(_playerMode->getIsInWater())
|
if(_playerMode->getIsInWater())
|
||||||
{
|
{
|
||||||
DVECTOR pos;
|
DVECTOR const &pos=_playerMode->getPlayerPos();
|
||||||
|
|
||||||
pos=_playerMode->getPlayerPos();
|
|
||||||
if((CGameScene::getCollision()->getCollisionBlock(pos.vx,pos.vy)&COLLISION_TYPE_MASK)==COLLISION_TYPE_FLAG_DESTRUCTABLE_WALL)
|
if((CGameScene::getCollision()->getCollisionBlock(pos.vx,pos.vy)&COLLISION_TYPE_MASK)==COLLISION_TYPE_FLAG_DESTRUCTABLE_WALL)
|
||||||
{
|
{
|
||||||
CLevel &level=GameScene.GetLevel();
|
CLevel &level=GameScene.GetLevel();
|
||||||
|
@ -223,8 +222,7 @@ void CPlayerStateButtBounceUp::enter(CPlayerModeBase *_playerMode)
|
||||||
{
|
{
|
||||||
if(_playerMode->getIsInWater())
|
if(_playerMode->getIsInWater())
|
||||||
{
|
{
|
||||||
DVECTOR pos;
|
DVECTOR const &pos=_playerMode->getPlayerPos();
|
||||||
pos=_playerMode->getPlayerPos();
|
|
||||||
CGameBubicleFactory::spawnBubicles(pos.vx-20,pos.vy,40,10,CGameBubicleFactory::TYPE_MEDIUM);
|
CGameBubicleFactory::spawnBubicles(pos.vx-20,pos.vy,40,10,CGameBubicleFactory::TYPE_MEDIUM);
|
||||||
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_MEDIUM);
|
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_MEDIUM);
|
||||||
CGameScene::setCameraShake(0,8);
|
CGameScene::setCameraShake(0,8);
|
||||||
|
|
|
@ -90,8 +90,7 @@ void CPlayerStateSoakUp::think(CPlayerModeBase *_playerMode)
|
||||||
{
|
{
|
||||||
if(m_breatheDelayFrames==0)
|
if(m_breatheDelayFrames==0)
|
||||||
{
|
{
|
||||||
DVECTOR pos;
|
DVECTOR const & pos=_playerMode->getPlayerPos();
|
||||||
pos=_playerMode->getPlayerPos();
|
|
||||||
CGameBubicleFactory::spawnBubicles(pos.vx+BUBBLE_XOFF,pos.vy+BUBBLE_YOFF,BUBBLE_W,BUBBLE_H,CGameBubicleFactory::TYPE_SPONGEBOBSOAKUP);
|
CGameBubicleFactory::spawnBubicles(pos.vx+BUBBLE_XOFF,pos.vy+BUBBLE_YOFF,BUBBLE_W,BUBBLE_H,CGameBubicleFactory::TYPE_SPONGEBOBSOAKUP);
|
||||||
m_breatheDelayFrames=0;
|
m_breatheDelayFrames=0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ void CEnemyAsProjectile::render()
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
DVECTOR renderPos;
|
DVECTOR renderPos;
|
||||||
DVECTOR offset = CLevel::getCameraPos();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
renderPos.vx = Pos.vx - offset.vx;
|
renderPos.vx = Pos.vx - offset.vx;
|
||||||
renderPos.vy = Pos.vy - offset.vy;
|
renderPos.vy = Pos.vy - offset.vy;
|
||||||
|
|
|
@ -75,14 +75,13 @@ void CEnemyAsSpriteProjectile::setRGB( int R, int G, int B )
|
||||||
void CEnemyAsSpriteProjectile::render()
|
void CEnemyAsSpriteProjectile::render()
|
||||||
{
|
{
|
||||||
sFrameHdr *frameHdr;
|
sFrameHdr *frameHdr;
|
||||||
DVECTOR offset;
|
|
||||||
int x,y;
|
int x,y;
|
||||||
int scrnWidth = VidGetScrW();
|
int scrnWidth = VidGetScrW();
|
||||||
int scrnHeight = VidGetScrH();
|
int scrnHeight = VidGetScrH();
|
||||||
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth( m_spriteFrame );
|
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth( m_spriteFrame );
|
||||||
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight( m_spriteFrame );
|
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight( m_spriteFrame );
|
||||||
|
|
||||||
offset = getScreenOffset();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
x = Pos.vx - offset.vx;
|
x = Pos.vx - offset.vx;
|
||||||
y = Pos.vy - offset.vy;
|
y = Pos.vy - offset.vy;
|
||||||
|
|
|
@ -259,13 +259,6 @@ void CProjectile::setState( PROJECTILE_STATE newState )
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CProjectile::setPosition( DVECTOR newPos )
|
|
||||||
{
|
|
||||||
Pos = newPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void CProjectile::setLifeTime( PROJECTILE_LIFETIME_TYPE lifeType )
|
void CProjectile::setLifeTime( PROJECTILE_LIFETIME_TYPE lifeType )
|
||||||
{
|
{
|
||||||
m_lifetimeType = lifeType;
|
m_lifetimeType = lifeType;
|
||||||
|
@ -317,7 +310,7 @@ void CProjectile::think(int _frames)
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
CPlayer *player = GameScene.getPlayer();
|
CPlayer *player = GameScene.getPlayer();
|
||||||
DVECTOR playerPos = player->getPos();
|
DVECTOR const &playerPos = player->getPos();
|
||||||
|
|
||||||
if ( processTargetSeek( _frames, playerPos ) )
|
if ( processTargetSeek( _frames, playerPos ) )
|
||||||
{
|
{
|
||||||
|
@ -424,14 +417,14 @@ void CProjectile::render()
|
||||||
CEnemyProjectileThing::render();
|
CEnemyProjectileThing::render();
|
||||||
|
|
||||||
sFrameHdr *frameHdr;
|
sFrameHdr *frameHdr;
|
||||||
DVECTOR offset;
|
|
||||||
int x,y;
|
int x,y;
|
||||||
int scrnWidth = VidGetScrW();
|
int scrnWidth = VidGetScrW();
|
||||||
int scrnHeight = VidGetScrH();
|
int scrnHeight = VidGetScrH();
|
||||||
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth( m_spriteFrame );
|
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth( m_spriteFrame );
|
||||||
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight( m_spriteFrame );
|
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight( m_spriteFrame );
|
||||||
|
|
||||||
offset = getScreenOffset();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
x = Pos.vx - offset.vx /*+ ( scrnWidth >> 1 ) - ( spriteWidth >> 1 )*/;
|
x = Pos.vx - offset.vx /*+ ( scrnWidth >> 1 ) - ( spriteWidth >> 1 )*/;
|
||||||
y = Pos.vy - offset.vy /*+ ( scrnHeight >> 1 ) - ( spriteHeight >> 1 )*/;
|
y = Pos.vy - offset.vy /*+ ( scrnHeight >> 1 ) - ( spriteHeight >> 1 )*/;
|
||||||
|
@ -450,13 +443,6 @@ void CProjectile::render()
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
DVECTOR CProjectile::getScreenOffset()
|
|
||||||
{
|
|
||||||
return CLevel::getCameraPos();
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void CProjectile::processEvent( GAME_EVENT evt, CThing *sourceThing )
|
void CProjectile::processEvent( GAME_EVENT evt, CThing *sourceThing )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -597,13 +583,6 @@ CPlayerProjectile::PLAYER_PROJECTILE_MOVEMENT_TYPE CPlayerProjectile::getMovemen
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void CPlayerProjectile::setPosition( DVECTOR newPos )
|
|
||||||
{
|
|
||||||
Pos = newPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void CPlayerProjectile::setLifeTime( PLAYER_PROJECTILE_LIFETIME_TYPE lifeType )
|
void CPlayerProjectile::setLifeTime( PLAYER_PROJECTILE_LIFETIME_TYPE lifeType )
|
||||||
{
|
{
|
||||||
m_lifetimeType = lifeType;
|
m_lifetimeType = lifeType;
|
||||||
|
@ -733,12 +712,11 @@ void CPlayerProjectile::render()
|
||||||
{
|
{
|
||||||
CPlayerProjectileThing::render();
|
CPlayerProjectileThing::render();
|
||||||
|
|
||||||
DVECTOR offset;
|
|
||||||
int x,y;
|
int x,y;
|
||||||
int scrnWidth = VidGetScrW();
|
int scrnWidth = VidGetScrW();
|
||||||
int scrnHeight = VidGetScrH();
|
int scrnHeight = VidGetScrH();
|
||||||
|
|
||||||
offset = getScreenOffset();
|
DVECTOR const &offset = CLevel::getCameraPos();
|
||||||
|
|
||||||
if ( m_hitTarget )
|
if ( m_hitTarget )
|
||||||
{
|
{
|
||||||
|
@ -776,13 +754,6 @@ void CPlayerProjectile::render()
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
DVECTOR CPlayerProjectile::getScreenOffset()
|
|
||||||
{
|
|
||||||
return CLevel::getCameraPos();
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void CPlayerProjectile::processEvent( GAME_EVENT evt, CThing *sourceThing )
|
void CPlayerProjectile::processEvent( GAME_EVENT evt, CThing *sourceThing )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
PROJECTILE_MOVEMENT_TYPE getMovementType();
|
PROJECTILE_MOVEMENT_TYPE getMovementType();
|
||||||
void setState( PROJECTILE_STATE newState );
|
void setState( PROJECTILE_STATE newState );
|
||||||
void setLifeTime( PROJECTILE_LIFETIME_TYPE lifeType );
|
void setLifeTime( PROJECTILE_LIFETIME_TYPE lifeType );
|
||||||
void setPosition( DVECTOR newPos );
|
void setPosition( DVECTOR const &newPos ) {Pos = newPos;}
|
||||||
void setHeading( s16 newHeading ) {m_heading = newHeading;}
|
void setHeading( s16 newHeading ) {m_heading = newHeading;}
|
||||||
void setOt( u8 newOt ) {m_ot=newOt;}
|
void setOt( u8 newOt ) {m_ot=newOt;}
|
||||||
void setGraphic( int frame );
|
void setGraphic( int frame );
|
||||||
|
@ -71,7 +71,6 @@ public:
|
||||||
void setShock() {m_shock = true;}
|
void setShock() {m_shock = true;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DVECTOR getScreenOffset();
|
|
||||||
bool processTargetSeek( int _frames, DVECTOR targetPos );
|
bool processTargetSeek( int _frames, DVECTOR targetPos );
|
||||||
void collidedWith( CThing *_thisThing );
|
void collidedWith( CThing *_thisThing );
|
||||||
|
|
||||||
|
@ -127,12 +126,11 @@ public:
|
||||||
void setMovementType( PLAYER_PROJECTILE_MOVEMENT_TYPE moveType );
|
void setMovementType( PLAYER_PROJECTILE_MOVEMENT_TYPE moveType );
|
||||||
PLAYER_PROJECTILE_MOVEMENT_TYPE getMovementType();
|
PLAYER_PROJECTILE_MOVEMENT_TYPE getMovementType();
|
||||||
void setLifeTime( PLAYER_PROJECTILE_LIFETIME_TYPE lifeType );
|
void setLifeTime( PLAYER_PROJECTILE_LIFETIME_TYPE lifeType );
|
||||||
void setPosition( DVECTOR newPos );
|
void setPosition( DVECTOR const &newPos ) {Pos = newPos;}
|
||||||
void setRGB( u32 new_RGB );
|
void setRGB( u32 new_RGB );
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DVECTOR getScreenOffset();
|
|
||||||
void collidedWith( CThing *_thisThing );
|
void collidedWith( CThing *_thisThing );
|
||||||
|
|
||||||
DVECTOR m_initPos;
|
DVECTOR m_initPos;
|
||||||
|
|
|
@ -1345,28 +1345,6 @@ void CThing::updateCollisionArea()
|
||||||
m_collisionArea.y2=m_collisionArea.y1+m_collisionSize.vy;
|
m_collisionArea.y2=m_collisionArea.y1+m_collisionSize.vy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
|
||||||
Function:
|
|
||||||
Purpose:
|
|
||||||
Params:
|
|
||||||
Returns:
|
|
||||||
---------------------------------------------------------------------- */
|
|
||||||
/*
|
|
||||||
s32 CThing::getNewYPos(CThing *_thisThing)
|
|
||||||
{
|
|
||||||
CRECT thisRect;
|
|
||||||
thisRect = getCollisionArea();
|
|
||||||
|
|
||||||
if ( thisRect.y1 < thisRect.y2 )
|
|
||||||
{
|
|
||||||
return( thisRect.y1 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return( thisRect.y2 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
Function:
|
||||||
Purpose:
|
Purpose:
|
||||||
|
@ -1375,23 +1353,22 @@ s32 CThing::getNewYPos(CThing *_thisThing)
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
int CThing::checkCollisionAgainst(CThing *_thisThing, int _frames)
|
int CThing::checkCollisionAgainst(CThing *_thisThing, int _frames)
|
||||||
{
|
{
|
||||||
DVECTOR pos,thisThingPos;
|
// DVECTOR pos,thisThingPos;
|
||||||
int radius;
|
int radius;
|
||||||
int collided;
|
int collided;
|
||||||
|
|
||||||
pos=getCollisionCentre();
|
DVECTOR const &pos=getCollisionCentre();
|
||||||
thisThingPos=_thisThing->getCollisionCentre();
|
DVECTOR const &thisThingPos=_thisThing->getCollisionCentre();
|
||||||
|
|
||||||
radius=getCollisionRadius()+_thisThing->getCollisionRadius();
|
radius=getCollisionRadius()+_thisThing->getCollisionRadius();
|
||||||
collided=false;
|
collided=false;
|
||||||
if(abs(pos.vx-thisThingPos.vx)<radius&&
|
if(abs(pos.vx-thisThingPos.vx)<radius&&
|
||||||
abs(pos.vy-thisThingPos.vy)<radius)
|
abs(pos.vy-thisThingPos.vy)<radius)
|
||||||
{
|
{
|
||||||
CRECT thisRect,thatRect;
|
// CRECT thisRect,thatRect;
|
||||||
|
|
||||||
thisRect=getCollisionArea();
|
CRECT const &thisRect=getCollisionArea();
|
||||||
|
CRECT const &thatRect=_thisThing->getCollisionArea();
|
||||||
thatRect=_thisThing->getCollisionArea();
|
|
||||||
|
|
||||||
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))&&
|
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)))
|
((thisRect.y1>=thatRect.y1&&thisRect.y1<=thatRect.y2)||(thisRect.y2>=thatRect.y1&&thisRect.y2<=thatRect.y2)||(thisRect.y1<=thatRect.y1&&thisRect.y2>=thatRect.y2)))
|
||||||
|
@ -1411,10 +1388,10 @@ int CThing::checkCollisionAgainst(CThing *_thisThing, int _frames)
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
int CThing::checkCollisionAgainstArea(CRECT *_rect)
|
int CThing::checkCollisionAgainstArea(CRECT *_rect)
|
||||||
{
|
{
|
||||||
CRECT thisRect;
|
// CRECT thisRect;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
thisRect=getCollisionArea();
|
CRECT const &thisRect=getCollisionArea();
|
||||||
ret=false;
|
ret=false;
|
||||||
|
|
||||||
if(((thisRect.x1>=_rect->x1&&thisRect.x1<=_rect->x2)||(thisRect.x2>=_rect->x1&&thisRect.x2<=_rect->x2)||(thisRect.x1<=_rect->x1&&thisRect.x2>=_rect->x2))&&
|
if(((thisRect.x1>=_rect->x1&&thisRect.x1<=_rect->x2)||(thisRect.x2>=_rect->x1&&thisRect.x2<=_rect->x2)||(thisRect.x1<=_rect->x1&&thisRect.x2>=_rect->x2))&&
|
||||||
|
|
|
@ -127,7 +127,7 @@ public:
|
||||||
}
|
}
|
||||||
virtual ~CThing() {;}
|
virtual ~CThing() {;}
|
||||||
|
|
||||||
/*virtual*/ void initDef()
|
void initDef()
|
||||||
{
|
{
|
||||||
Pos.vx=0; Pos.vy=0;
|
Pos.vx=0; Pos.vy=0;
|
||||||
PosDelta=Pos;
|
PosDelta=Pos;
|
||||||
|
@ -138,13 +138,12 @@ virtual ~CThing() {;}
|
||||||
|
|
||||||
virtual TYPE getThingType()=0;
|
virtual TYPE getThingType()=0;
|
||||||
|
|
||||||
/*virtual */void setThingSubType(int T) {m_SubType=T;}
|
void setThingSubType(int T) {m_SubType=T;}
|
||||||
/*virtual */int getThingSubType() {return(m_SubType);}
|
int getThingSubType() {return(m_SubType);}
|
||||||
|
|
||||||
|
virtual void init();
|
||||||
|
virtual void shutdown();
|
||||||
|
|
||||||
//virtual void create() {;} // Once only init (for mem alloc)
|
|
||||||
virtual void init(); // re-usable init
|
|
||||||
virtual void shutdown(); // re-usable shutdown
|
|
||||||
//virtual void destroy() {;} // memory clean up when totally killing the poor things
|
|
||||||
|
|
||||||
virtual void think(int _frames);
|
virtual void think(int _frames);
|
||||||
virtual void render();
|
virtual void render();
|
||||||
|
@ -161,8 +160,8 @@ virtual int dontKillDuringLevelRespawn() {return false;}
|
||||||
int getNumChildren() {return( m_numChildren );}
|
int getNumChildren() {return( m_numChildren );}
|
||||||
|
|
||||||
DVECTOR const &getPos() {return Pos;}
|
DVECTOR const &getPos() {return Pos;}
|
||||||
void setPos(DVECTOR newPos) {Pos=newPos;}
|
void setPos(DVECTOR const &newPos) {Pos=newPos;}
|
||||||
DVECTOR getPosDelta() {return PosDelta;}
|
DVECTOR const &getPosDelta() {return PosDelta;}
|
||||||
CThing *getParent() {return ParentThing;}
|
CThing *getParent() {return ParentThing;}
|
||||||
CThing *getNext() {return NextThing;}
|
CThing *getNext() {return NextThing;}
|
||||||
|
|
||||||
|
@ -190,13 +189,12 @@ virtual CRECT const *getRenderBBox() {return &m_collisionArea;}
|
||||||
virtual CRECT const *getThinkBBox() {return &m_collisionArea;}
|
virtual CRECT const *getThinkBBox() {return &m_collisionArea;}
|
||||||
virtual bool alwaysThink() {return(false);}
|
virtual bool alwaysThink() {return(false);}
|
||||||
virtual void leftThinkZone(int _frames) {}
|
virtual void leftThinkZone(int _frames) {}
|
||||||
//virtual void enterThinkZone(int _frames) {}
|
|
||||||
|
|
||||||
void ShowBBox();
|
void ShowBBox();
|
||||||
DVECTOR const &getCollisionCentre() {return m_collisionCentre;}
|
DVECTOR const &getCollisionCentre() {return m_collisionCentre;}
|
||||||
DVECTOR const &getCollisionCentreOffset() {return m_collisionCentreOffset;}
|
DVECTOR const &getCollisionCentreOffset() {return m_collisionCentreOffset;}
|
||||||
int getCollisionRadius() {return m_collisionRadius;}
|
int getCollisionRadius() {return m_collisionRadius;}
|
||||||
/*virtual */CRECT const &getCollisionArea() {return m_collisionArea;}
|
CRECT const &getCollisionArea() {return m_collisionArea;}
|
||||||
DVECTOR const &getCollisionSize() {return m_collisionSize;}
|
DVECTOR const &getCollisionSize() {return m_collisionSize;}
|
||||||
|
|
||||||
virtual int canCollide() {return true;}
|
virtual int canCollide() {return true;}
|
||||||
|
@ -204,7 +202,6 @@ virtual int checkCollisionAgainst(CThing *_thisThing, int _frames);
|
||||||
int checkCollisionAgainstArea(CRECT *_rect);
|
int checkCollisionAgainstArea(CRECT *_rect);
|
||||||
void updateCollisionArea();
|
void updateCollisionArea();
|
||||||
virtual void collidedWith(CThing *_thisThing) {;}
|
virtual void collidedWith(CThing *_thisThing) {;}
|
||||||
//virtual s32 getNewYPos( CThing *_thisThing );
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Thing states
|
// Thing states
|
||||||
|
@ -222,9 +219,9 @@ protected:
|
||||||
u8 m_SubType;
|
u8 m_SubType;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/*virtual */void setCollisionSize(int _w,int _h);
|
void setCollisionSize(int _w,int _h);
|
||||||
/*virtual */void setCollisionCentreOffset(int _x,int _y) {m_collisionCentreOffset.vx=_x;m_collisionCentreOffset.vy=_y;}
|
void setCollisionCentreOffset(int _x,int _y) {m_collisionCentreOffset.vx=_x;m_collisionCentreOffset.vy=_y;}
|
||||||
/*virtual */void setCollisionCentreOffset(DVECTOR xy) {m_collisionCentreOffset=xy;}
|
void setCollisionCentreOffset(DVECTOR const &xy) {m_collisionCentreOffset=xy;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DVECTOR m_collisionSize;
|
DVECTOR m_collisionSize;
|
||||||
|
@ -307,7 +304,16 @@ public:
|
||||||
virtual TYPE getThingType() {return TYPE_FX;}
|
virtual TYPE getThingType() {return TYPE_FX;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline bool CheckRect2Rect(CRECT const &Rect0,CRECT const &Rect1)
|
||||||
|
{
|
||||||
|
if (Rect0.x2<Rect1.x1 || Rect0.x1>Rect1.x2) return(false);
|
||||||
|
if (Rect0.y2<Rect1.y1 || Rect0.y1>Rect1.y2) return(false);
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __THING_THING_H__ */
|
#endif /* __THING_THING_H__ */
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
|
|
||||||
end */
|
end */
|
||||||
|
|
|
@ -54,14 +54,14 @@
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
void CRestartPointTrigger::collidedWith(CThing *_thisThing)
|
void CRestartPointTrigger::collidedWith(CThing *_thisThing)
|
||||||
{
|
{
|
||||||
CRECT collisionArea;
|
// CRECT collisionArea;
|
||||||
DVECTOR respawnPos;
|
DVECTOR respawnPos;
|
||||||
|
|
||||||
switch( _thisThing->getThingType() )
|
switch( _thisThing->getThingType() )
|
||||||
{
|
{
|
||||||
case TYPE_PLAYER:
|
case TYPE_PLAYER:
|
||||||
{
|
{
|
||||||
collisionArea=getCollisionArea();
|
CRECT const &collisionArea=getCollisionArea();
|
||||||
respawnPos.vx=collisionArea.x1+((collisionArea.x2-collisionArea.x1)/2);
|
respawnPos.vx=collisionArea.x1+((collisionArea.x2-collisionArea.x1)/2);
|
||||||
respawnPos.vy=collisionArea.y2;
|
respawnPos.vy=collisionArea.y2;
|
||||||
((CPlayer*)_thisThing)->setRespawnPos(respawnPos);
|
((CPlayer*)_thisThing)->setRespawnPos(respawnPos);
|
||||||
|
|
Loading…
Add table
Reference in a new issue