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);

View File

@ -125,7 +125,7 @@ void CNpcGaryFriend::think( int _frames )
m_speed++;
}
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
if ( Pos.vy - offset.vy > VidGetScrH() )
{

View File

@ -63,7 +63,7 @@ void CNpcPlanktonFriend::render()
// Render
DVECTOR renderPos;
DVECTOR origRenderPos;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
int frame = FRM_PLANKTON_STATIC00;
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth( frame );
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight( frame );
@ -71,7 +71,7 @@ void CNpcPlanktonFriend::render()
renderPos.vx = Pos.vx - offset.vx - ( spriteWidth >> 1 );
renderPos.vy = Pos.vy - offset.vy - ( spriteHeight >> 1 );
CRECT collisionRect = getCollisionArea();
CRECT const &collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;

View File

@ -96,23 +96,22 @@ int H=renderPos1.vy-renderPos0.vy;
/*****************************************************************************/
int CFXLaser::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

@ -106,16 +106,7 @@
#include "gfx\actor.h"
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
static const int RenderZ=378;//256; Increased to make depth less, and SB more visible
/*****************************************************************************/
@ -208,11 +199,6 @@ CGameScene GameScene;
/*****************************************************************************/
void CGameScene::init()
{
// Setup Constant Camera Matrix
// SetIdentTrans(&CamMtx,0,0,RenderZ);
// SetGeomScreen(RenderZ);
// SetTransMatrix(&CamMtx);
setCameraMtx();
s_genericFont=new ("CGameScene::Init") FontBank();
@ -348,26 +334,7 @@ void CGameScene::render_showing_lives()
void CGameScene::render_playing()
{
// 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)
{
int timerValue;
@ -384,10 +351,6 @@ void CGameScene::render_playing()
CThingManager::renderAllThings();
setCameraMtx();
// SetIdentTrans(&CamMtx,0,0,RenderZ);
// SetGeomScreen(RenderZ);
// SetRotMatrix(&CamMtx);
// SetTransMatrix(&CamMtx);
Level.render();
m_HealthManager->render();
@ -543,19 +506,6 @@ void CGameScene::think_showing_lives(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)
{
return;
@ -685,7 +635,7 @@ void CGameScene::think_playing(int _frames)
if(!CConversation::isActive()&&!m_pauseMenu->isActive())
{
DVECTOR camPos;
DVECTOR camPos;
CJellyfishGenerator::think( _frames, &Level );
CThingManager::thinkAllThings(_frames);
camPos=m_player->getCameraPos();
@ -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);
}

View File

@ -62,7 +62,7 @@ static ACTOR_TYPE getActorType( int actorNum ) {return actorType[actorNum];}
static void setBossHasBeenKilled() {s_bossHasBeenKilled=true;}
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);

View File

@ -52,7 +52,7 @@ void CHealthManager::shutdown()
/*****************************************************************************/
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 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;

View File

@ -35,14 +35,14 @@ public:
void init();
void shutdown();
void drop(DVECTOR &Pos,int Amount,int Vel);
void drop(DVECTOR const &Pos,int Amount,int Vel);
void checkPlayerCol(CPlayer *Thing);
void think(int frames);
void render();
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];
sFrameHdr *FrameHdr;

View File

@ -517,9 +517,6 @@ CActorGfx::~CActorGfx()
void CActorGfx::setActor(sActorPool *ThisActor)
{
PoolEntry=ThisActor;
// ShadowXOfs=DEF_SHADOW_OFS;
// ShadowYOfs=DEF_SHADOW_OFS;
// ShadowFlag=false;
OtPos=OTPOS__ACTOR_POS;
}
@ -605,27 +602,11 @@ sSpriteAnim *ThisAnim=SpriteBank->AnimList+Anim;
Ft4=GetPrimFT4();
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->clut=PoolEntry->ActorGfx->Clut;
setShadeTex(Ft4,1);
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
//int HalfW=CurrentFrameGfx->W>>1;
// Sizes now depend on aspect corrected sizes, so get sizes back from poly
int BBoxW=Ft4->x1-Ft4->x0;
int BBoxH=Ft4->y2-Ft4->y0;
@ -810,9 +791,7 @@ void CModelGfx::SetModel(int Type)
}
/*****************************************************************************/
static const int MXO=0;
static const int MYO=-8*0;
void CModelGfx::Render(DVECTOR &Pos,SVECTOR *Angle,VECTOR *Scale)
void CModelGfx::Render(DVECTOR &Pos,SVECTOR *Angle,VECTOR *Scale,s32 ClipFlag)
{
#define BLOCK_MULT 16
sElem3d *Elem=&ModelElemBank[Model->ElemID];
@ -848,8 +827,8 @@ sTri *TList=&ModelTriList[Elem->TriStart];
}
}
RenderPos.vx=(INGAME_SCREENOFS_X+MXO)+Pos.vx;
RenderPos.vy=(INGAME_SCREENOFS_Y+MYO)+Pos.vy;
RenderPos.vx=(INGAME_SCREENOFS_X)+Pos.vx;
RenderPos.vy=(INGAME_SCREENOFS_Y)+Pos.vy;
gte_SetRotMatrix(&Mtx);
CMX_SetTransMtxXY(&RenderPos);
@ -860,20 +839,20 @@ sTri *TList=&ModelTriList[Elem->TriStart];
gte_ldv3(P0,P1,P2);
setlen(TPrimPtr, GPU_PolyFT3Tag);
TPrimPtr->code=TList->PolyCode;
setRGB0(TPrimPtr,128,128,128);
gte_rtpt_b();
setShadeTex(TPrimPtr,1);
T0=*(u32*)&TList->uv0; // Get UV0 & TPage
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->u1=T1; // Set UV1
*(u16*)&TPrimPtr->u2=T2; // Set UV2
*(u32*)&TPrimPtr->u2=T2; // Set UV2
ThisOT=OtPtr+TList->OTOfs;
TList++;
gte_nclip_b();
gte_stsxy3_ft3(TPrimPtr);
gte_stopz(&ClipZ);
ClipZ|=ClipFlag; // <-- Evil!!
if (ClipZ<=0)
{
addPrim(ThisOT,TPrimPtr);
@ -884,3 +863,4 @@ sTri *TList=&ModelTriList[Elem->TriStart];
SetPrimPtr((u8*)TPrimPtr);
}

View File

@ -130,11 +130,6 @@ static sActorPool *ActorList,*LastActor;
class CActorGfx
{
public:
enum
{
DEF_SHADOW_OFS=32,
};
CActorGfx(sActorPool *ThisActor);
virtual ~CActorGfx();
@ -149,8 +144,6 @@ virtual ~CActorGfx();
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;}
@ -162,8 +155,6 @@ protected:
sSpriteFrameGfx *CurrentFrameGfx;
sBBox BBox;
// bool ShadowFlag;
// s16 ShadowXOfs,ShadowYOfs;
u32 OtPos;
};
@ -179,7 +170,8 @@ virtual ~CModelGfx(){};
static void SetData(sLevelHdr *LevelHdr);
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);}
protected:

View File

@ -76,7 +76,7 @@ void CNpcBouncingBarrelHazard::processMovement( int _frames )
m_rotation += 64 * _frames;
m_rotation &= 4095;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
s32 yPos = Pos.vy - offset.vy;

View File

@ -75,7 +75,7 @@ void CNpcCheckpointHazard::render()
{
int x,y;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth(m_spriteFrame);
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight(m_spriteFrame);
@ -101,7 +101,7 @@ void CNpcCheckpointHazard::collidedWith(CThing *_thisThing)
{
case TYPE_PLAYER:
{
CRECT collisionArea=getCollisionArea();
CRECT const &collisionArea=getCollisionArea();
DVECTOR respawnPos;
respawnPos.vx=collisionArea.x1+((collisionArea.x2-collisionArea.x1)/2);
respawnPos.vy=collisionArea.y2;

View File

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

View File

@ -123,7 +123,7 @@ void CNpcFlyTrapHazard::render()
scale.vy = ONE;
scale.vz = ONE;
m_modelGfx->Render(renderPos,&rotation,&scale);
m_modelGfx->RenderClip(renderPos,&rotation,&scale);
sBBox boundingBox = m_modelGfx->GetBBox();

View File

@ -130,7 +130,7 @@ void CNpcPendulumHazard::render()
int x1,y1,x2,y2;
int minX, maxX, minY, maxY;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
CHazardThing::render();

View File

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

View File

@ -144,7 +144,7 @@ void CNpcRisingWeightHazard::render()
int x1,y1,x2,y2;
int minX, maxX, minY, maxY;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
if ( m_isActive )
{

View File

@ -122,7 +122,7 @@ void CJellyfishGenerator::think( int _frames, CLevel *level )
}
}
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
DVECTOR startPos;

View File

@ -41,7 +41,7 @@ TSPRT *PrimPtr=PrimBank;
for (int i=0; i<Count; i++)
{
setTSprt(PrimPtr);
setTSetShadeTex(PrimPtr,0);
setTSetShadeTex(PrimPtr,1);
PrimPtr->w=TILE2D_WIDTH;
PrimPtr->h=TILE2D_HEIGHT;
PrimPtr++;
@ -136,8 +136,6 @@ TSPRT *PrimPtr=PrimBank;
PrimPtr->y0=TileY;
setTSprtTPage(PrimPtr,Tile->TPage);
*(u32*)&PrimPtr->u0=*(u32*)&Tile->u0; // copy uv AND clut
extern u8 GlobalRGB[];
setRGB0(PrimPtr,GlobalRGB[2],GlobalRGB[2],GlobalRGB[2]);
addPrim(ThisOT,PrimPtr);
PrimPtr++;
}

View File

@ -48,7 +48,7 @@ public:
void render();
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 &getPlayerSpawnPos() {return s_playerSpawnPos;}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1526,7 +1526,7 @@ if(drawlastpos)
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayer::setRespawnPosAndRingTelephone(DVECTOR _respawn)
void CPlayer::setRespawnPosAndRingTelephone(DVECTOR const &_respawn)
{
if(m_respawnPos.vx!=_respawn.vx||
m_respawnPos.vy!=_respawn.vy)
@ -2395,7 +2395,7 @@ void CPlayer::justButtBouncedABadGuy()
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayer::shove( DVECTOR move )
void CPlayer::shove( DVECTOR const &move )
{
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)
{
DVECTOR offset,size;
// DVECTOR offset,size;
offset=getCollisionCentreOffset();
size=getCollisionSize();
DVECTOR const &offset=getCollisionCentreOffset();
DVECTOR const &size=getCollisionSize();
*_x=offset.vx;
*_y=offset.vy;

View File

@ -226,7 +226,7 @@ public:
void detectHazardousSurface();
virtual void render();
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 moveRight(); // " " " " "
void fall(); // " " " " "
@ -236,12 +236,12 @@ public:
int isTryingToConversateWithFriend() {return m_allowConversation;}
DVECTOR getCameraPos() {return m_cameraPos;}
DVECTOR const &getCameraPos() {return m_cameraPos;}
void setCartCam(int _flag) {m_cartCamActive=_flag;}
void setReverseCameraMovement(int _flag) {m_reverseCameraMovement=_flag;}
void setCameraBox(CameraBox _cameraBox);
void setRespawnPos(DVECTOR _respawn) {m_respawnPos=_respawn;}
void setRespawnPosAndRingTelephone(DVECTOR _respawn);
void setRespawnPos(DVECTOR const &_respawn) {m_respawnPos=_respawn;}
void setRespawnPosAndRingTelephone(DVECTOR const &_respawn);
// This isn't funny anymore.. :(
int getHeightFromGround(int _x,int _y,int _maxHeight=32);
@ -285,7 +285,7 @@ private:
public:
DVECTOR getPlayerPos() {return Pos;}
DVECTOR const &getPlayerPos() {return Pos;}
void setPlayerPos(DVECTOR *_pos) {Pos=*_pos;}
void ignoreNewlyPressedButtonsOnPadThisThink();
PLAYERINPUT getPadInputHeld() {return m_padInput;}

View File

@ -80,8 +80,9 @@ void CPlayerModeCart::think()
if ( platform )
{
newPos.vx = platform->getPos().vx;
newPos.vy = platform->getPos().vy;
newPos=platform->getPos();
// newPos.vx = platform->getPos().vx;
// newPos.vy = platform->getPos().vy;
int platformOffset = ( ( CNpcPlatform* ) platform )->getHeightFromPlatformAtPosition( newPos.vx, newPos.vy );
s16 angle = ( ( CNpcPlatform * ) platform )->getCollisionAngle();

View File

@ -212,12 +212,12 @@ void CPlayerModeCoralBlower::think()
else if(m_enemy==NULL)
{
// Search for an enemy..
DVECTOR playerPos;
// DVECTOR playerPos;
int playerFacing;
CRECT suckRect;
CThing *thing;
playerPos=m_player->getPos();
DVECTOR const &playerPos=m_player->getPos();
playerFacing=m_player->getFacing();
suckRect.x1=playerPos.vx+(blowerCatchPos.vx*playerFacing)-(blowerCatchSize.vx/2);
@ -228,7 +228,7 @@ void CPlayerModeCoralBlower::think()
#ifdef __USER_paul__
{
CRECT area=suckRect;
DVECTOR ofs=CLevel::getCameraPos();
DVECTOR const &ofs=CLevel::getCameraPos();
area.x1-=ofs.vx;
area.y1-=ofs.vy;
area.x2-=ofs.vx;
@ -352,11 +352,11 @@ void CPlayerModeCoralBlower::renderModeUi()
{
// Draw aiming cursor
int facing,heading;
DVECTOR screenOfs,launchPos,targetPos;
DVECTOR launchPos,targetPos;
facing=m_player->getFacing();
heading=((m_launchHeading+1024)*facing)&4095;
screenOfs=CLevel::getCameraPos();
DVECTOR const &screenOfs=CLevel::getCameraPos();
launchPos=m_player->getPlayerPos();
launchPos.vx+=(blowerLaunchPoint.vx*facing)-screenOfs.vx;
launchPos.vy+=blowerLaunchPoint.vy-screenOfs.vy;

View File

@ -231,15 +231,15 @@ void CPlayerModeNet::think()
case NET_STATE__CATCHING:
{
DVECTOR catchPos;
DVECTOR playerPos;
// DVECTOR catchPos;
// DVECTOR playerPos;
int playerFacing;
CRECT netRect;
CThing *thing;
ASSERT(m_netFrame<(int)(sizeof(netCatchPos)/sizeof(DVECTOR)));
catchPos=netCatchPos[m_netFrame];
playerPos=m_player->getPos();
DVECTOR const &catchPos=netCatchPos[m_netFrame];
DVECTOR const &playerPos=m_player->getPos();
playerFacing=m_player->getFacing();
netRect.x1=playerPos.vx+(catchPos.vx*playerFacing)-(netCatchSize.vx/2);

View File

@ -199,7 +199,7 @@ int CPlayerMode::getPadInputDown() {return m_player->getPadInputDown();}
---------------------------------------------------------------------- */
int CPlayerMode::getHeightFromGound()
{
DVECTOR pos=getPlayerPos();
DVECTOR const &pos=getPlayerPos();
return m_player->getHeightFromGround(pos.vx,pos.vy);
}
@ -219,7 +219,7 @@ void CPlayerMode::inSoakUpState() {m_player->inSoakUpState();}
Params:
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);}
/*----------------------------------------------------------------------
@ -350,11 +350,9 @@ void CPlayerModeBase::thinkVerticalMovement()
{
if(m_player->moveVertical(m_player->getMoveVelocity()->vy>>VELOCITY_SHIFT))
{
DVECTOR pos;
if(m_currentState!=STATE_CELEBRATE)
playerHasHitGround();
pos=m_player->getPlayerPos();
DVECTOR const &pos=m_player->getPlayerPos();
if(m_player->getHeightFromGround(pos.vx,pos.vy,5)==0&&
(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_FLOAT&&m_currentState!=STATE_CELEBRATE)
{
DVECTOR pos;
pos=m_player->getPlayerPos();
DVECTOR const &pos=m_player->getPlayerPos();
if(m_player->getHeightFromGround(pos.vx,pos.vy,1)!=0
#ifdef SHITE_COLLISION
&&
@ -565,10 +563,9 @@ int cheight=15;
int CPlayerModeBase::isOnEdge()
{
CLayerCollision *collision=CGameScene::getCollision();
DVECTOR pos;
int ret;
pos=m_player->getPlayerPos();
DVECTOR const &pos=m_player->getPlayerPos();
ret=0;
if(m_player->getHeightFromGround(pos.vx-csize,pos.vy,cheight+1)>cheight)
{
@ -589,8 +586,7 @@ int CPlayerModeBase::isOnEdge()
---------------------------------------------------------------------- */
int CPlayerModeBase::canMoveLeft()
{
DVECTOR pos;
pos=m_player->getPlayerPos();
DVECTOR const &pos=m_player->getPlayerPos();
#ifdef SHITE_COLLISION
return m_player->getHeightFromGround(pos.vx-checkx,pos.vy,checkdist)>-checkycanmove?true:false;
#else
@ -601,8 +597,7 @@ int CPlayerModeBase::canMoveLeft()
int CPlayerModeBase::canMoveRight()
{
DVECTOR pos;
pos=m_player->getPlayerPos();
DVECTOR const &pos=m_player->getPlayerPos();
#ifdef SHITE_COLLISION
return m_player->getHeightFromGround(pos.vx+checkx,pos.vy,checkdist)>-checkycanmove?true:false;
#else

View File

@ -109,7 +109,7 @@ 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:
void setPlayerPos(DVECTOR *_pos); // Private so that they cannot directly alter it

View File

@ -174,9 +174,8 @@ void CPlayerStateButtBounceLand::enter(CPlayerModeBase *_playerMode)
m_bounceOffFloor=false;
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)
{
CLevel &level=GameScene.GetLevel();
@ -223,8 +222,7 @@ void CPlayerStateButtBounceUp::enter(CPlayerModeBase *_playerMode)
{
if(_playerMode->getIsInWater())
{
DVECTOR pos;
pos=_playerMode->getPlayerPos();
DVECTOR const &pos=_playerMode->getPlayerPos();
CGameBubicleFactory::spawnBubicles(pos.vx-20,pos.vy,40,10,CGameBubicleFactory::TYPE_MEDIUM);
CPadVibrationManager::setVibration(0,CPadVibrationManager::VIBE_MEDIUM);
CGameScene::setCameraShake(0,8);

View File

@ -90,8 +90,7 @@ void CPlayerStateSoakUp::think(CPlayerModeBase *_playerMode)
{
if(m_breatheDelayFrames==0)
{
DVECTOR pos;
pos=_playerMode->getPlayerPos();
DVECTOR const & pos=_playerMode->getPlayerPos();
CGameBubicleFactory::spawnBubicles(pos.vx+BUBBLE_XOFF,pos.vy+BUBBLE_YOFF,BUBBLE_W,BUBBLE_H,CGameBubicleFactory::TYPE_SPONGEBOBSOAKUP);
m_breatheDelayFrames=0;
}

View File

@ -43,7 +43,7 @@ void CEnemyAsProjectile::render()
// Render
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
DVECTOR const &offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;

View File

@ -75,14 +75,13 @@ void CEnemyAsSpriteProjectile::setRGB( int R, int G, int B )
void CEnemyAsSpriteProjectile::render()
{
sFrameHdr *frameHdr;
DVECTOR offset;
int x,y;
int scrnWidth = VidGetScrW();
int scrnHeight = VidGetScrH();
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth( m_spriteFrame );
int spriteHeight = CGameScene::getSpriteBank()->getFrameHeight( m_spriteFrame );
offset = getScreenOffset();
DVECTOR const &offset = CLevel::getCameraPos();
x = Pos.vx - offset.vx;
y = Pos.vy - offset.vy;

View File

@ -259,13 +259,6 @@ void CProjectile::setState( PROJECTILE_STATE newState )
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::setPosition( DVECTOR newPos )
{
Pos = newPos;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::setLifeTime( PROJECTILE_LIFETIME_TYPE lifeType )
{
m_lifetimeType = lifeType;
@ -317,7 +310,7 @@ void CProjectile::think(int _frames)
default:
{
CPlayer *player = GameScene.getPlayer();
DVECTOR playerPos = player->getPos();
DVECTOR const &playerPos = player->getPos();
if ( processTargetSeek( _frames, playerPos ) )
{
@ -424,14 +417,14 @@ void CProjectile::render()
CEnemyProjectileThing::render();
sFrameHdr *frameHdr;
DVECTOR offset;
int x,y;
int scrnWidth = VidGetScrW();
int scrnHeight = VidGetScrH();
int spriteWidth = CGameScene::getSpriteBank()->getFrameWidth( 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 )*/;
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 )
{
}
@ -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 )
{
m_lifetimeType = lifeType;
@ -733,12 +712,11 @@ void CPlayerProjectile::render()
{
CPlayerProjectileThing::render();
DVECTOR offset;
int x,y;
int scrnWidth = VidGetScrW();
int scrnHeight = VidGetScrH();
offset = getScreenOffset();
DVECTOR const &offset = CLevel::getCameraPos();
if ( m_hitTarget )
{
@ -776,13 +754,6 @@ void CPlayerProjectile::render()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
DVECTOR CPlayerProjectile::getScreenOffset()
{
return CLevel::getCameraPos();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPlayerProjectile::processEvent( GAME_EVENT evt, CThing *sourceThing )
{
}

View File

@ -61,7 +61,7 @@ public:
PROJECTILE_MOVEMENT_TYPE getMovementType();
void setState( PROJECTILE_STATE newState );
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 setOt( u8 newOt ) {m_ot=newOt;}
void setGraphic( int frame );
@ -71,7 +71,6 @@ public:
void setShock() {m_shock = true;}
protected:
DVECTOR getScreenOffset();
bool processTargetSeek( int _frames, DVECTOR targetPos );
void collidedWith( CThing *_thisThing );
@ -127,12 +126,11 @@ public:
void setMovementType( PLAYER_PROJECTILE_MOVEMENT_TYPE moveType );
PLAYER_PROJECTILE_MOVEMENT_TYPE getMovementType();
void setLifeTime( PLAYER_PROJECTILE_LIFETIME_TYPE lifeType );
void setPosition( DVECTOR newPos );
void setPosition( DVECTOR const &newPos ) {Pos = newPos;}
void setRGB( u32 new_RGB );
protected:
DVECTOR getScreenOffset();
void collidedWith( CThing *_thisThing );
DVECTOR m_initPos;

View File

@ -1345,28 +1345,6 @@ void CThing::updateCollisionArea()
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:
Purpose:
@ -1375,23 +1353,22 @@ s32 CThing::getNewYPos(CThing *_thisThing)
---------------------------------------------------------------------- */
int CThing::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)))
@ -1411,10 +1388,10 @@ int CThing::checkCollisionAgainst(CThing *_thisThing, int _frames)
---------------------------------------------------------------------- */
int CThing::checkCollisionAgainstArea(CRECT *_rect)
{
CRECT thisRect;
// CRECT thisRect;
int ret;
thisRect=getCollisionArea();
CRECT const &thisRect=getCollisionArea();
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))&&

View File

@ -127,7 +127,7 @@ public:
}
virtual ~CThing() {;}
/*virtual*/ void initDef()
void initDef()
{
Pos.vx=0; Pos.vy=0;
PosDelta=Pos;
@ -138,13 +138,12 @@ virtual ~CThing() {;}
virtual TYPE getThingType()=0;
/*virtual */void setThingSubType(int T) {m_SubType=T;}
/*virtual */int getThingSubType() {return(m_SubType);}
void setThingSubType(int T) {m_SubType=T;}
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 render();
@ -161,8 +160,8 @@ virtual int dontKillDuringLevelRespawn() {return false;}
int getNumChildren() {return( m_numChildren );}
DVECTOR const &getPos() {return Pos;}
void setPos(DVECTOR newPos) {Pos=newPos;}
DVECTOR getPosDelta() {return PosDelta;}
void setPos(DVECTOR const &newPos) {Pos=newPos;}
DVECTOR const &getPosDelta() {return PosDelta;}
CThing *getParent() {return ParentThing;}
CThing *getNext() {return NextThing;}
@ -190,13 +189,12 @@ virtual CRECT const *getRenderBBox() {return &m_collisionArea;}
virtual CRECT const *getThinkBBox() {return &m_collisionArea;}
virtual bool alwaysThink() {return(false);}
virtual void leftThinkZone(int _frames) {}
//virtual void enterThinkZone(int _frames) {}
void ShowBBox();
DVECTOR const &getCollisionCentre() {return m_collisionCentre;}
DVECTOR const &getCollisionCentreOffset() {return m_collisionCentreOffset;}
int getCollisionRadius() {return m_collisionRadius;}
/*virtual */CRECT const &getCollisionArea() {return m_collisionArea;}
CRECT const &getCollisionArea() {return m_collisionArea;}
DVECTOR const &getCollisionSize() {return m_collisionSize;}
virtual int canCollide() {return true;}
@ -204,7 +202,6 @@ virtual int checkCollisionAgainst(CThing *_thisThing, int _frames);
int checkCollisionAgainstArea(CRECT *_rect);
void updateCollisionArea();
virtual void collidedWith(CThing *_thisThing) {;}
//virtual s32 getNewYPos( CThing *_thisThing );
public:
// Thing states
@ -222,9 +219,9 @@ protected:
u8 m_SubType;
protected:
/*virtual */void setCollisionSize(int _w,int _h);
/*virtual */void setCollisionCentreOffset(int _x,int _y) {m_collisionCentreOffset.vx=_x;m_collisionCentreOffset.vy=_y;}
/*virtual */void setCollisionCentreOffset(DVECTOR xy) {m_collisionCentreOffset=xy;}
void setCollisionSize(int _w,int _h);
void setCollisionCentreOffset(int _x,int _y) {m_collisionCentreOffset.vx=_x;m_collisionCentreOffset.vy=_y;}
void setCollisionCentreOffset(DVECTOR const &xy) {m_collisionCentreOffset=xy;}
private:
DVECTOR m_collisionSize;
@ -307,7 +304,16 @@ public:
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__ */
/*===========================================================================
end */

View File

@ -54,14 +54,14 @@
---------------------------------------------------------------------- */
void CRestartPointTrigger::collidedWith(CThing *_thisThing)
{
CRECT collisionArea;
// CRECT collisionArea;
DVECTOR respawnPos;
switch( _thisThing->getThingType() )
{
case TYPE_PLAYER:
{
collisionArea=getCollisionArea();
CRECT const &collisionArea=getCollisionArea();
respawnPos.vx=collisionArea.x1+((collisionArea.x2-collisionArea.x1)/2);
respawnPos.vy=collisionArea.y2;
((CPlayer*)_thisThing)->setRespawnPos(respawnPos);