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

View file

@ -468,14 +468,14 @@ void CNpcAnemone2Enemy::render()
spikePos.vy += result.vy;
sFrameHdr *frameHdr;
DVECTOR offset;
int x,y;
int scrnWidth = VidGetScrW();
int scrnHeight = VidGetScrH();
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth(FRM__SPIKE);
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight(FRM__SPIKE);
offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
x = spikePos.vx - offset.vx;
y = spikePos.vy - offset.vy;

View file

@ -161,7 +161,7 @@ void CNpcFlyingDutchmanEnemy::processMovement( int _frames )
{
CPlayer *player = GameScene.getPlayer();
DVECTOR playerPos = player->getPos();
DVECTOR const &playerPos = player->getPos();
s32 minX, maxX;
m_npcPath.getPathXExtents( &minX, &maxX );

View file

@ -131,7 +131,7 @@ void CNpcEnemy::processGenericGetUserDist( int _frames, s32 *distX, s32 *distY )
CPlayer *player = GameScene.getPlayer();
DVECTOR playerPos = player->getPos();
DVECTOR const &playerPos = player->getPos();
*distX = playerPos.vx - this->Pos.vx;
*distY = playerPos.vy - this->Pos.vy;

View file

@ -374,7 +374,7 @@ void CNpcMotherJellyfishEnemy::processMovement( int _frames )
{
CPlayer *player = GameScene.getPlayer();
DVECTOR playerPos = player->getPos();
DVECTOR const &playerPos = player->getPos();
Pos.vx = playerPos.vx + ( ( 70 * rcos( 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;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
if ( Pos.vx - offset.vx > VidGetScrW() )
{

View file

@ -849,15 +849,15 @@ void CNpcEnemy::processAttackCollision()
void CNpcEnemy::drawAttackEffect()
{
CRECT rect;
rect = getCollisionArea();
CRECT const &rect = getCollisionArea();
DVECTOR thwakPos;
s32 xDist;
CPlayer *player = GameScene.getPlayer();
DVECTOR playerPos = player->getPos();
DVECTOR const &playerPos = player->getPos();
xDist = playerPos.vx - this->Pos.vx;
@ -1320,7 +1320,7 @@ void CNpcEnemy::processShotDeathEnd( int _frames )
m_speed++;
}
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
if ( Pos.vy - offset.vy > VidGetScrH() )
{
@ -1507,8 +1507,8 @@ int CNpcEnemy::canCollide()
void CNpcEnemy::processEnemyCollision( CThing *thisThing )
{
DVECTOR otherPos = thisThing->getPos();
DVECTOR otherDelta = thisThing->getPosDelta();
DVECTOR const &otherPos = thisThing->getPos();
DVECTOR otherDelta = thisThing->getPosDelta();
s32 xDist = Pos.vx - otherPos.vx;
s32 yDist = Pos.vy - otherPos.vy;
@ -1572,8 +1572,8 @@ void CNpcEnemy::processEnemyCollision( CThing *thisThing )
void CNpcEnemy::processUserCollision( CThing *thisThing )
{
DVECTOR otherPos = thisThing->getPos();
DVECTOR otherDelta = thisThing->getPosDelta();
DVECTOR const &otherPos = thisThing->getPos();
DVECTOR const &otherDelta = thisThing->getPosDelta();
s32 xDist = Pos.vx - otherPos.vx;
s32 yDist = Pos.vy - otherPos.vy;

View file

@ -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;
@ -268,14 +268,14 @@ void CNpcPath::reversePathDir()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool CNpcPath::getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY )
bool CNpcPath::getDistToNextWaypoint( DVECTOR const &currentPos, s32 *distX, s32 *distY )
{
return( isPointNear( currentPos, distX, distY ) );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
s32 CNpcPath::think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange, s32 *distX, s32 *distY )
s32 CNpcPath::think( DVECTOR const &currentPos, bool *pathComplete, bool *waypointChange, s32 *distX, s32 *distY )
{
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 &currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading, u8 waypointDist )
{
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 &currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading )
{
bool pointChange = false;

View file

@ -33,10 +33,10 @@ public:
void decPath();
void resetPath();
void reversePathDir();
s32 think( DVECTOR currentPos, bool *pathComplete, bool *waypointChange, s32 *distX, s32 *distY );
bool thinkFlat( DVECTOR currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading, u8 waypointDist = 10 );
bool thinkVertical( DVECTOR currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading );
bool getDistToNextWaypoint( DVECTOR currentPos, s32 *distX, s32 *distY );
s32 think( DVECTOR const &currentPos, bool *pathComplete, bool *waypointChange, s32 *distX, s32 *distY );
bool thinkFlat( DVECTOR const &currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading, u8 waypointDist = 10 );
bool thinkVertical( DVECTOR const &currentPos, bool *pathComplete, s32 *distX, s32 *distY, s32 *heading );
bool getDistToNextWaypoint( DVECTOR const &currentPos, s32 *distX, s32 *distY );
void getPathXExtents( s32 *minExtent, s32 *maxExtent );
void getPathYExtents( s32 *minExtent, s32 *maxExtent );
u8 getWaypointCount() { return( waypointCount ); }
@ -44,7 +44,7 @@ public:
void setWaypointPtr( u16 *newPtr );
void setPathExtents();
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 );
private:

View file

@ -158,7 +158,7 @@ void CNpcSharkManEnemy::processClose( int _frames )
newPos.vy -= 50;
CPlayer *player = GameScene.getPlayer();
DVECTOR playerPos = player->getPos();
DVECTOR const &playerPos = player->getPos();
xDist = playerPos.vx - newPos.vx;
yDist = playerPos.vy - newPos.vy;

View file

@ -55,7 +55,7 @@ void CNpcSmallJellyfishBackgroundEnemy::processMovement( int _frames )
// change direction?
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
@ -175,7 +175,7 @@ void CNpcSmallJellyfishBackgroundEnemy::shutdown()
void CNpcSmallJellyfishBackgroundEnemy::processUserCollision( CThing *thisThing )
{
DVECTOR otherPos = thisThing->getPos();
DVECTOR const &otherPos = thisThing->getPos();
DVECTOR otherDelta = thisThing->getPosDelta();
s32 xDist = Pos.vx - otherPos.vx;

View file

@ -679,7 +679,7 @@ void CNpcSeaSnakeEnemy::updateTail( DVECTOR &oldPos, int _frames )
for ( segmentCount = 0 ; segmentCount < m_segmentCount ; segmentCount++ )
{
DVECTOR currentPos = m_segmentArray[segmentCount].getPos();
DVECTOR const &currentPos = m_segmentArray[segmentCount].getPos();
s32 xDist = oldPos.vx - currentPos.vx;
s32 yDist = oldPos.vy - currentPos.vy;
@ -692,7 +692,7 @@ void CNpcSeaSnakeEnemy::updateTail( DVECTOR &oldPos, int _frames )
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;
yDist = currentPos.vy - nextPos.vy;
headingFromNext = ratan2( yDist, xDist );
@ -1000,23 +1000,22 @@ void CNpcSeaSnakeEnemy::render()
int CNpcSeaSnakeEnemy::checkCollisionAgainst( CThing *_thisThing, int _frames )
{
DVECTOR pos,thisThingPos;
// DVECTOR pos,thisThingPos;
int radius;
int collided;
pos=getCollisionCentre();
thisThingPos=_thisThing->getCollisionCentre();
DVECTOR const &pos=getCollisionCentre();
DVECTOR const &thisThingPos=_thisThing->getCollisionCentre();
radius=getCollisionRadius()+_thisThing->getCollisionRadius();
collided=false;
if(abs(pos.vx-thisThingPos.vx)<radius&&
abs(pos.vy-thisThingPos.vy)<radius)
{
CRECT thisRect,thatRect;
// CRECT thisRect,thatRect;
thisRect=getCollisionArea();
thatRect=_thisThing->getCollisionArea();
CRECT const &thisRect=getCollisionArea();
CRECT const &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))&&
((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 )
{
DVECTOR pos,thisThingPos;
// DVECTOR pos,thisThingPos;
int radius;
int collided;
pos = getCollisionCentre();
thisThingPos = _thisThing->getCollisionCentre();
DVECTOR const &pos = getCollisionCentre();
DVECTOR const &thisThingPos = _thisThing->getCollisionCentre();
radius = getCollisionRadius() + _thisThing->getCollisionRadius();
collided = false;
if(abs(pos.vx-thisThingPos.vx)<radius&&
abs(pos.vy-thisThingPos.vy)<radius)
{
CRECT thisRect,thatRect;
// CRECT thisRect,thatRect;
thisRect=getCollisionArea();
thatRect=_thisThing->getCollisionArea();
CRECT const &thisRect=getCollisionArea();
CRECT const &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))&&
((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;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
if ( Pos.vy - offset.vy > VidGetScrH() )
{
@ -1196,7 +1194,7 @@ u8 CNpcSeaSnakeEnemy::isSnakeStopped()
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 )
{
@ -1210,7 +1208,7 @@ u8 CNpcSeaSnakeEnemy::isSnakeStopped()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcSeaSnakeEnemy::moveEntireSnake( DVECTOR newPos )
void CNpcSeaSnakeEnemy::moveEntireSnake( DVECTOR const &newPos )
{
Pos.vx = newPos.vx;
Pos.vy = newPos.vy;

View file

@ -28,8 +28,8 @@ public:
void processEnemyCollision( CThing *thisThing );
void setScale( u16 scale ) {m_scale = scale;}
CNpcSeaSnakeSegment *m_nextSegment;
void setPos( DVECTOR newPos ) {Pos = newPos;}
DVECTOR getPos() {return( Pos );}
void setPos( DVECTOR const &newPos ) {Pos = newPos;}
DVECTOR const &getPos() {return( Pos );}
void setHeading( s16 newHeading ) {m_heading = newHeading;}
void updateCollisionArea();
int checkCollisionAgainst(CThing *_thisThing, int _frames);
@ -70,7 +70,7 @@ protected:
void processUserCollision( CThing *thisThing );
u8 processPathMove( int _frames, s32 *moveX, s32 *moveY, s32 *moveVel, s32 *moveDist );
u8 isSnakeStopped();
void moveEntireSnake( DVECTOR newPos );
void moveEntireSnake( DVECTOR const &newPos );
void addHealthMeter();
void updateTail( DVECTOR &oldPos, int _frames );

View file

@ -277,7 +277,7 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
for ( segmentCount = 0 ; segmentCount < NPC_PARASITIC_WORM_LENGTH ; segmentCount++ )
{
DVECTOR currentPos = m_segmentArray[segmentCount].getPos();
DVECTOR const &currentPos = m_segmentArray[segmentCount].getPos();
s32 xDist = oldPos.vx - currentPos.vx;
s32 yDist = oldPos.vy - currentPos.vy;
@ -290,7 +290,7 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
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;
yDist = currentPos.vy - nextPos.vy;
headingFromNext = ratan2( yDist, xDist );
@ -469,23 +469,22 @@ void CNpcParasiticWormEnemy::render()
int CNpcParasiticWormEnemy::checkCollisionAgainst( CThing *_thisThing, int _frames )
{
DVECTOR pos,thisThingPos;
// DVECTOR pos,thisThingPos;
int radius;
int collided;
pos=getCollisionCentre();
thisThingPos=_thisThing->getCollisionCentre();
DVECTOR const &pos=getCollisionCentre();
DVECTOR const &thisThingPos=_thisThing->getCollisionCentre();
radius=getCollisionRadius()+_thisThing->getCollisionRadius();
collided=false;
if(abs(pos.vx-thisThingPos.vx)<radius&&
abs(pos.vy-thisThingPos.vy)<radius)
{
CRECT thisRect,thatRect;
// CRECT thisRect,thatRect;
thisRect=getCollisionArea();
thatRect=_thisThing->getCollisionArea();
CRECT const &thisRect=getCollisionArea();
CRECT const &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))&&
((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 )
{
DVECTOR pos,thisThingPos;
// DVECTOR pos,thisThingPos;
int radius;
int collided;
pos = getCollisionCentre();
thisThingPos = _thisThing->getCollisionCentre();
DVECTOR const &pos = getCollisionCentre();
DVECTOR const &thisThingPos = _thisThing->getCollisionCentre();
radius = getCollisionRadius() + _thisThing->getCollisionRadius();
collided = false;
if(abs(pos.vx-thisThingPos.vx)<radius&&
abs(pos.vy-thisThingPos.vy)<radius)
{
CRECT thisRect,thatRect;
// CRECT thisRect,thatRect;
thisRect=getCollisionArea();
thatRect=_thisThing->getCollisionArea();
CRECT const &thisRect=getCollisionArea();
CRECT const &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))&&
((thisRect.y1>=thatRect.y1&&thisRect.y1<=thatRect.y2)||(thisRect.y2>=thatRect.y1&&thisRect.y2<=thatRect.y2)||(thisRect.y1<=thatRect.y1&&thisRect.y2>=thatRect.y2)))

View file

@ -23,8 +23,8 @@ public:
void processEnemyCollision( CThing *thisThing );
void setScale( u16 scale ) {m_scale = scale;}
CNpcParasiticWormSegment *m_nextSegment;
void setPos( DVECTOR newPos ) {Pos = newPos;}
DVECTOR getPos() {return( Pos );}
void setPos( DVECTOR const &newPos ) {Pos = newPos;}
DVECTOR const &getPos() {return( Pos );}
void setHeading( s16 newHeading ) {m_heading = newHeading;}
void updateCollisionArea();
int checkCollisionAgainst(CThing *_thisThing, int _frames);