This commit is contained in:
Charles 2001-05-14 21:08:03 +00:00
parent 918abff5fa
commit 37be262782
24 changed files with 404 additions and 697 deletions

View File

@ -566,30 +566,16 @@ void CNpcAnemone2Enemy::render()
{ {
CEnemyThing::render(); CEnemyThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, m_scaleX, m_scaleY );
sBBox boundingBox = m_actorGfx->GetBBox(); SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) ); m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, m_scaleX, m_scaleY );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
} sBBox boundingBox = m_actorGfx->GetBBox();
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
} }
} }
} }

View File

@ -47,67 +47,45 @@ void CNpcButterflyBackgroundEnemy::render()
{ {
CEnemyThing::render(); CEnemyThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR origRenderPos;
DVECTOR offset = CLevel::getCameraPos();
int spriteWidth = m_spriteBank->getFrameWidth( m_frame >> 8 );
int spriteHeight = m_spriteBank->getFrameHeight( m_frame >> 8 );
renderPos.vx = Pos.vx - offset.vx;
origRenderPos.vx = renderPos.vx;
renderPos.vx += m_drawOffset.vx;
renderPos.vy = Pos.vy - offset.vy;
origRenderPos.vy = renderPos.vy;
renderPos.vy += m_drawOffset.vy - ( spriteHeight >> 1 );
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SprFrame = m_spriteBank->printFT4(FRM_BUTTERFLY_FLAP01 + ( m_frame >> 8 ),renderPos.vx,renderPos.vy,!m_reversed,0,15);
setRGB0( SprFrame, 255, 128, 255 ); // Let me know if these change! ALso ket me know when the different coloured ones go in pls! (pkg)
// get xmax, xmin, ymax, ymin SprFrame = m_spriteBank->printFT4(FRM_BUTTERFLY_FLAP01 + ( m_frame >> 8 ),renderPos.vx,renderPos.vy,!m_reversed,0,15);
setRGB0( SprFrame, 255, 128, 255 ); // Let me know if these change! ALso ket me know when the different coloured ones go in pls! (pkg)
s32 XMax; // get xmax, xmin, ymax, ymin
s32 XMin;
s32 YMax; s32 XMax;
s32 YMin; s32 XMin;
XMin=SprFrame->x0; s32 YMax;
if (XMin>SprFrame->x1) XMin=SprFrame->x1; s32 YMin;
if (XMin>SprFrame->x2) XMin=SprFrame->x2;
if (XMin>SprFrame->x3) XMin=SprFrame->x3;
XMax=SprFrame->x0;
if (XMax<SprFrame->x1) XMax=SprFrame->x1;
if (XMax<SprFrame->x2) XMax=SprFrame->x2;
if (XMax<SprFrame->x3) XMax=SprFrame->x3;
YMin=SprFrame->y0;
if (YMin>SprFrame->y1) YMin=SprFrame->y1;
if (YMin>SprFrame->y2) YMin=SprFrame->y2;
if (YMin>SprFrame->y3) YMin=SprFrame->y3;
YMax=SprFrame->y0;
if (YMax<SprFrame->y1) YMax=SprFrame->y1;
if (YMax<SprFrame->y2) YMax=SprFrame->y2;
if (YMax<SprFrame->y3) YMax=SprFrame->y3;
XMax -= origRenderPos.vx; XMin=SprFrame->x0;
XMin -= origRenderPos.vx; if (XMin>SprFrame->x1) XMin=SprFrame->x1;
YMax -= origRenderPos.vy; if (XMin>SprFrame->x2) XMin=SprFrame->x2;
YMin -= origRenderPos.vy; if (XMin>SprFrame->x3) XMin=SprFrame->x3;
XMax=SprFrame->x0;
if (XMax<SprFrame->x1) XMax=SprFrame->x1;
if (XMax<SprFrame->x2) XMax=SprFrame->x2;
if (XMax<SprFrame->x3) XMax=SprFrame->x3;
YMin=SprFrame->y0;
if (YMin>SprFrame->y1) YMin=SprFrame->y1;
if (YMin>SprFrame->y2) YMin=SprFrame->y2;
if (YMin>SprFrame->y3) YMin=SprFrame->y3;
YMax=SprFrame->y0;
if (YMax<SprFrame->y1) YMax=SprFrame->y1;
if (YMax<SprFrame->y2) YMax=SprFrame->y2;
if (YMax<SprFrame->y3) YMax=SprFrame->y3;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) ); XMax -= renderPos.vx;
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 ); XMin -= renderPos.vx;
} YMax -= renderPos.vy;
YMin -= renderPos.vy;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) );
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 );
} }
} }
} }

View File

@ -50,30 +50,16 @@ void CNpcMotherJellyfishBackground::render()
{ {
CEnemyThing::render(); CEnemyThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false);
m_actorGfx->RotateScale( SprFrame, renderPos, 0, 8192, 8192 );
sBBox boundingBox = m_actorGfx->GetBBox(); SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false);
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) ); m_actorGfx->RotateScale( SprFrame, renderPos, 0, 8192, 8192 );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
} sBBox boundingBox = m_actorGfx->GetBBox();
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
} }
} }
} }

View File

@ -366,30 +366,16 @@ void CNpcMotherJellyfishEnemy::render()
{ {
CEnemyThing::render(); CEnemyThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false);
m_actorGfx->RotateScale( SprFrame, renderPos, 0, 8192, 8192 );
sBBox boundingBox = m_actorGfx->GetBBox(); SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false);
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) ); m_actorGfx->RotateScale( SprFrame, renderPos, 0, 8192, 8192 );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
} sBBox boundingBox = m_actorGfx->GetBBox();
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
} }
} }
} }

View File

@ -1343,30 +1343,16 @@ void CNpcEnemy::render()
{ {
CEnemyThing::render(); CEnemyThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, 4096, 4096 );
sBBox boundingBox = m_actorGfx->GetBBox(); SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) ); m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, 4096, 4096 );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
} sBBox boundingBox = m_actorGfx->GetBBox();
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
} }
} }
} }

View File

@ -150,67 +150,45 @@ void CNpcSmallJellyfishProjectileEnemy::render()
{ {
CEnemyThing::render(); CEnemyThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR origRenderPos;
DVECTOR offset = CLevel::getCameraPos();
int spriteWidth = m_spriteBank->getFrameWidth( m_frame >> 8 );
int spriteHeight = m_spriteBank->getFrameHeight( m_frame >> 8 );
renderPos.vx = Pos.vx - offset.vx;
origRenderPos.vx = renderPos.vx;
renderPos.vx += m_drawOffset.vx;
renderPos.vy = Pos.vy - offset.vy;
origRenderPos.vy = renderPos.vy;
renderPos.vy += m_drawOffset.vy - ( spriteHeight >> 1 );
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SprFrame = m_spriteBank->printRotatedScaledSprite( FRM_JELLYFISH1_SWIM1 + ( m_frame >> 8 ),renderPos.vx,renderPos.vy,4096,4096,m_drawRotation,10);
setRGB0( SprFrame, 255, 128, 255 ); // Let me know if these change! ALso ket me know when the different coloured ones go in pls! (pkg)
// get xmax, xmin, ymax, ymin SprFrame = m_spriteBank->printRotatedScaledSprite( FRM_JELLYFISH1_SWIM1 + ( m_frame >> 8 ),renderPos.vx,renderPos.vy,4096,4096,m_drawRotation,10);
setRGB0( SprFrame, 255, 128, 255 ); // Let me know if these change! ALso ket me know when the different coloured ones go in pls! (pkg)
s32 XMax; // get xmax, xmin, ymax, ymin
s32 XMin;
s32 YMax; s32 XMax;
s32 YMin; s32 XMin;
XMin=SprFrame->x0; s32 YMax;
if (XMin>SprFrame->x1) XMin=SprFrame->x1; s32 YMin;
if (XMin>SprFrame->x2) XMin=SprFrame->x2;
if (XMin>SprFrame->x3) XMin=SprFrame->x3;
XMax=SprFrame->x0;
if (XMax<SprFrame->x1) XMax=SprFrame->x1;
if (XMax<SprFrame->x2) XMax=SprFrame->x2;
if (XMax<SprFrame->x3) XMax=SprFrame->x3;
YMin=SprFrame->y0;
if (YMin>SprFrame->y1) YMin=SprFrame->y1;
if (YMin>SprFrame->y2) YMin=SprFrame->y2;
if (YMin>SprFrame->y3) YMin=SprFrame->y3;
YMax=SprFrame->y0;
if (YMax<SprFrame->y1) YMax=SprFrame->y1;
if (YMax<SprFrame->y2) YMax=SprFrame->y2;
if (YMax<SprFrame->y3) YMax=SprFrame->y3;
XMax -= origRenderPos.vx; XMin=SprFrame->x0;
XMin -= origRenderPos.vx; if (XMin>SprFrame->x1) XMin=SprFrame->x1;
YMax -= origRenderPos.vy; if (XMin>SprFrame->x2) XMin=SprFrame->x2;
YMin -= origRenderPos.vy; if (XMin>SprFrame->x3) XMin=SprFrame->x3;
XMax=SprFrame->x0;
if (XMax<SprFrame->x1) XMax=SprFrame->x1;
if (XMax<SprFrame->x2) XMax=SprFrame->x2;
if (XMax<SprFrame->x3) XMax=SprFrame->x3;
YMin=SprFrame->y0;
if (YMin>SprFrame->y1) YMin=SprFrame->y1;
if (YMin>SprFrame->y2) YMin=SprFrame->y2;
if (YMin>SprFrame->y3) YMin=SprFrame->y3;
YMax=SprFrame->y0;
if (YMax<SprFrame->y1) YMax=SprFrame->y1;
if (YMax<SprFrame->y2) YMax=SprFrame->y2;
if (YMax<SprFrame->y3) YMax=SprFrame->y3;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) ); XMax -= renderPos.vx;
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 ); XMin -= renderPos.vx;
} YMax -= renderPos.vy;
YMin -= renderPos.vy;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) );
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 );
} }
} }
} }

View File

@ -42,54 +42,29 @@ void CNpcSquidDartEnemy::render()
{ {
CEnemyThing::render(); CEnemyThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR origRenderPos;
DVECTOR offset = CLevel::getCameraPos();
int frame = FRM_SQUIDDART_SWIM0001 + ( m_frame >> 8 );
int spriteWidth = m_spriteBank->getFrameWidth( frame );
int spriteHeight = m_spriteBank->getFrameHeight( frame );
renderPos.vx = Pos.vx - offset.vx;
origRenderPos.vx = renderPos.vx;
if ( m_reversed )
{ {
renderPos.vx += ( spriteWidth >> 1 ) + m_drawOffset.vx; DVECTOR &renderPos=getRenderPos();
}
else
{
renderPos.vx -= ( spriteWidth >> 1 ) + m_drawOffset.vx;
}
renderPos.vy = Pos.vy - offset.vy; int frame = FRM_SQUIDDART_SWIM0001 + ( m_frame >> 8 );
origRenderPos.vy = renderPos.vy;
renderPos.vy += m_drawOffset.vy - ( spriteHeight >> 1 );
CRECT collisionRect = getCollisionArea(); SprFrame = m_spriteBank->printFT4(frame,renderPos.vx,renderPos.vy,m_reversed,0,10);
collisionRect.x1 -= Pos.vx; setRGB0( SprFrame, 255, 128, 255 );
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() ) /*s32 XMax = SprFrame->x1 - origRenderPos.vx;
{ s32 XMin = SprFrame->x0 - origRenderPos.vx;
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SprFrame = m_spriteBank->printFT4(frame,renderPos.vx,renderPos.vy,m_reversed,0,10);
setRGB0( SprFrame, 255, 128, 255 );
s32 XMax = SprFrame->x1 - origRenderPos.vx; s32 YMax = SprFrame->y2 - origRenderPos.vy;
s32 XMin = SprFrame->x0 - origRenderPos.vx; s32 YMin = SprFrame->y0 - origRenderPos.vy;*/
s32 YMax = SprFrame->y2 - origRenderPos.vy; s32 XMax = SprFrame->x1 - renderPos.vx;
s32 YMin = SprFrame->y0 - origRenderPos.vy; s32 XMin = SprFrame->x0 - renderPos.vx;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) ); s32 YMax = SprFrame->y2 - renderPos.vy;
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 ); s32 YMin = SprFrame->y0 - renderPos.vy;
}
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) );
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 );
} }
} }
} }

View File

@ -42,67 +42,45 @@ void CNpcSmallJellyfish2BackgroundEnemy::render()
{ {
CEnemyThing::render(); CEnemyThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR origRenderPos;
DVECTOR offset = CLevel::getCameraPos();
int spriteWidth = m_spriteBank->getFrameWidth( m_frame >> 8 );
int spriteHeight = m_spriteBank->getFrameHeight( m_frame >> 8 );
renderPos.vx = Pos.vx - offset.vx;
origRenderPos.vx = renderPos.vx;
renderPos.vx += m_drawOffset.vx;
renderPos.vy = Pos.vy - offset.vy;
origRenderPos.vy = renderPos.vy;
renderPos.vy += m_drawOffset.vy - ( spriteHeight >> 1 );
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SprFrame = m_spriteBank->printRotatedScaledSprite( FRM_JELLYFISH1_SWIM1 + ( m_frame >> 8 ),renderPos.vx,renderPos.vy,4096,4096,m_drawRotation,15);
setRGB0( SprFrame, 128, 128, 255 ); // Let me know if these change! ALso ket me know when the different coloured ones go in pls! (pkg)
// get xmax, xmin, ymax, ymin SprFrame = m_spriteBank->printRotatedScaledSprite( FRM_JELLYFISH1_SWIM1 + ( m_frame >> 8 ),renderPos.vx,renderPos.vy,4096,4096,m_drawRotation,15);
setRGB0( SprFrame, 128, 128, 255 ); // Let me know if these change! ALso ket me know when the different coloured ones go in pls! (pkg)
s32 XMax; // get xmax, xmin, ymax, ymin
s32 XMin;
s32 YMax; s32 XMax;
s32 YMin; s32 XMin;
XMin=SprFrame->x0; s32 YMax;
if (XMin>SprFrame->x1) XMin=SprFrame->x1; s32 YMin;
if (XMin>SprFrame->x2) XMin=SprFrame->x2;
if (XMin>SprFrame->x3) XMin=SprFrame->x3;
XMax=SprFrame->x0;
if (XMax<SprFrame->x1) XMax=SprFrame->x1;
if (XMax<SprFrame->x2) XMax=SprFrame->x2;
if (XMax<SprFrame->x3) XMax=SprFrame->x3;
YMin=SprFrame->y0;
if (YMin>SprFrame->y1) YMin=SprFrame->y1;
if (YMin>SprFrame->y2) YMin=SprFrame->y2;
if (YMin>SprFrame->y3) YMin=SprFrame->y3;
YMax=SprFrame->y0;
if (YMax<SprFrame->y1) YMax=SprFrame->y1;
if (YMax<SprFrame->y2) YMax=SprFrame->y2;
if (YMax<SprFrame->y3) YMax=SprFrame->y3;
XMax -= origRenderPos.vx; XMin=SprFrame->x0;
XMin -= origRenderPos.vx; if (XMin>SprFrame->x1) XMin=SprFrame->x1;
YMax -= origRenderPos.vy; if (XMin>SprFrame->x2) XMin=SprFrame->x2;
YMin -= origRenderPos.vy; if (XMin>SprFrame->x3) XMin=SprFrame->x3;
XMax=SprFrame->x0;
if (XMax<SprFrame->x1) XMax=SprFrame->x1;
if (XMax<SprFrame->x2) XMax=SprFrame->x2;
if (XMax<SprFrame->x3) XMax=SprFrame->x3;
YMin=SprFrame->y0;
if (YMin>SprFrame->y1) YMin=SprFrame->y1;
if (YMin>SprFrame->y2) YMin=SprFrame->y2;
if (YMin>SprFrame->y3) YMin=SprFrame->y3;
YMax=SprFrame->y0;
if (YMax<SprFrame->y1) YMax=SprFrame->y1;
if (YMax<SprFrame->y2) YMax=SprFrame->y2;
if (YMax<SprFrame->y3) YMax=SprFrame->y3;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) ); XMax -= renderPos.vx;
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 ); XMin -= renderPos.vx;
} YMax -= renderPos.vy;
YMin -= renderPos.vy;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) );
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 );
} }
} }
} }

View File

@ -225,67 +225,45 @@ void CNpcSmallJellyfishBackgroundEnemy::render()
{ {
CEnemyThing::render(); CEnemyThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR origRenderPos;
DVECTOR offset = CLevel::getCameraPos();
int spriteWidth = m_spriteBank->getFrameWidth( m_frame >> 8 );
int spriteHeight = m_spriteBank->getFrameHeight( m_frame >> 8 );
renderPos.vx = Pos.vx - offset.vx;
origRenderPos.vx = renderPos.vx;
renderPos.vx += m_drawOffset.vx;
renderPos.vy = Pos.vy - offset.vy;
origRenderPos.vy = renderPos.vy;
renderPos.vy += m_drawOffset.vy - ( spriteHeight >> 1 );
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SprFrame = m_spriteBank->printRotatedScaledSprite( FRM_JELLYFISH1_SWIM1 + ( m_frame >> 8 ),renderPos.vx,renderPos.vy,4096,4096,m_drawRotation,15);
setRGB0( SprFrame, 255, 128, 255 ); // Let me know if these change! ALso ket me know when the different coloured ones go in pls! (pkg)
// get xmax, xmin, ymax, ymin SprFrame = m_spriteBank->printRotatedScaledSprite( FRM_JELLYFISH1_SWIM1 + ( m_frame >> 8 ),renderPos.vx,renderPos.vy,4096,4096,m_drawRotation,15);
setRGB0( SprFrame, 255, 128, 255 ); // Let me know if these change! ALso ket me know when the different coloured ones go in pls! (pkg)
s32 XMax; // get xmax, xmin, ymax, ymin
s32 XMin;
s32 YMax; s32 XMax;
s32 YMin; s32 XMin;
XMin=SprFrame->x0; s32 YMax;
if (XMin>SprFrame->x1) XMin=SprFrame->x1; s32 YMin;
if (XMin>SprFrame->x2) XMin=SprFrame->x2;
if (XMin>SprFrame->x3) XMin=SprFrame->x3;
XMax=SprFrame->x0;
if (XMax<SprFrame->x1) XMax=SprFrame->x1;
if (XMax<SprFrame->x2) XMax=SprFrame->x2;
if (XMax<SprFrame->x3) XMax=SprFrame->x3;
YMin=SprFrame->y0;
if (YMin>SprFrame->y1) YMin=SprFrame->y1;
if (YMin>SprFrame->y2) YMin=SprFrame->y2;
if (YMin>SprFrame->y3) YMin=SprFrame->y3;
YMax=SprFrame->y0;
if (YMax<SprFrame->y1) YMax=SprFrame->y1;
if (YMax<SprFrame->y2) YMax=SprFrame->y2;
if (YMax<SprFrame->y3) YMax=SprFrame->y3;
XMax -= origRenderPos.vx; XMin=SprFrame->x0;
XMin -= origRenderPos.vx; if (XMin>SprFrame->x1) XMin=SprFrame->x1;
YMax -= origRenderPos.vy; if (XMin>SprFrame->x2) XMin=SprFrame->x2;
YMin -= origRenderPos.vy; if (XMin>SprFrame->x3) XMin=SprFrame->x3;
XMax=SprFrame->x0;
if (XMax<SprFrame->x1) XMax=SprFrame->x1;
if (XMax<SprFrame->x2) XMax=SprFrame->x2;
if (XMax<SprFrame->x3) XMax=SprFrame->x3;
YMin=SprFrame->y0;
if (YMin>SprFrame->y1) YMin=SprFrame->y1;
if (YMin>SprFrame->y2) YMin=SprFrame->y2;
if (YMin>SprFrame->y3) YMin=SprFrame->y3;
YMax=SprFrame->y0;
if (YMax<SprFrame->y1) YMax=SprFrame->y1;
if (YMax<SprFrame->y2) YMax=SprFrame->y2;
if (YMax<SprFrame->y3) YMax=SprFrame->y3;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) ); XMax -= renderPos.vx;
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 ); XMin -= renderPos.vx;
} YMax -= renderPos.vy;
YMin -= renderPos.vy;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) );
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 );
} }
} }
} }

View File

@ -50,67 +50,45 @@ void CNpcSmallJellyfishEnemy::render()
{ {
CEnemyThing::render(); CEnemyThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR origRenderPos;
DVECTOR offset = CLevel::getCameraPos();
int spriteWidth = m_spriteBank->getFrameWidth( m_frame >> 8 );
int spriteHeight = m_spriteBank->getFrameHeight( m_frame >> 8 );
renderPos.vx = Pos.vx - offset.vx;
origRenderPos.vx = renderPos.vx;
renderPos.vx += m_drawOffset.vx;
renderPos.vy = Pos.vy - offset.vy;
origRenderPos.vy = renderPos.vy;
renderPos.vy += m_drawOffset.vy - ( spriteHeight >> 1 );
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SprFrame = m_spriteBank->printRotatedScaledSprite( FRM_JELLYFISH1_SWIM1 + ( m_frame >> 8 ),renderPos.vx,renderPos.vy,4096,4096,m_drawRotation,10);
setRGB0( SprFrame, 255, 128, 255 ); // Let me know if these change! ALso ket me know when the different coloured ones go in pls! (pkg)
// get xmax, xmin, ymax, ymin SprFrame = m_spriteBank->printRotatedScaledSprite( FRM_JELLYFISH1_SWIM1 + ( m_frame >> 8 ),renderPos.vx,renderPos.vy,4096,4096,m_drawRotation,10);
setRGB0( SprFrame, 255, 128, 255 ); // Let me know if these change! ALso ket me know when the different coloured ones go in pls! (pkg)
s32 XMax; // get xmax, xmin, ymax, ymin
s32 XMin;
s32 YMax; s32 XMax;
s32 YMin; s32 XMin;
XMin=SprFrame->x0; s32 YMax;
if (XMin>SprFrame->x1) XMin=SprFrame->x1; s32 YMin;
if (XMin>SprFrame->x2) XMin=SprFrame->x2;
if (XMin>SprFrame->x3) XMin=SprFrame->x3;
XMax=SprFrame->x0;
if (XMax<SprFrame->x1) XMax=SprFrame->x1;
if (XMax<SprFrame->x2) XMax=SprFrame->x2;
if (XMax<SprFrame->x3) XMax=SprFrame->x3;
YMin=SprFrame->y0;
if (YMin>SprFrame->y1) YMin=SprFrame->y1;
if (YMin>SprFrame->y2) YMin=SprFrame->y2;
if (YMin>SprFrame->y3) YMin=SprFrame->y3;
YMax=SprFrame->y0;
if (YMax<SprFrame->y1) YMax=SprFrame->y1;
if (YMax<SprFrame->y2) YMax=SprFrame->y2;
if (YMax<SprFrame->y3) YMax=SprFrame->y3;
XMax -= origRenderPos.vx; XMin=SprFrame->x0;
XMin -= origRenderPos.vx; if (XMin>SprFrame->x1) XMin=SprFrame->x1;
YMax -= origRenderPos.vy; if (XMin>SprFrame->x2) XMin=SprFrame->x2;
YMin -= origRenderPos.vy; if (XMin>SprFrame->x3) XMin=SprFrame->x3;
XMax=SprFrame->x0;
if (XMax<SprFrame->x1) XMax=SprFrame->x1;
if (XMax<SprFrame->x2) XMax=SprFrame->x2;
if (XMax<SprFrame->x3) XMax=SprFrame->x3;
YMin=SprFrame->y0;
if (YMin>SprFrame->y1) YMin=SprFrame->y1;
if (YMin>SprFrame->y2) YMin=SprFrame->y2;
if (YMin>SprFrame->y3) YMin=SprFrame->y3;
YMax=SprFrame->y0;
if (YMax<SprFrame->y1) YMax=SprFrame->y1;
if (YMax<SprFrame->y2) YMax=SprFrame->y2;
if (YMax<SprFrame->y3) YMax=SprFrame->y3;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) ); XMax -= renderPos.vx;
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 ); XMin -= renderPos.vx;
} YMax -= renderPos.vy;
YMin -= renderPos.vy;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) );
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 );
} }
} }
} }

View File

@ -401,30 +401,16 @@ void CNpcParasiticWormEnemy::render()
{ {
CEnemyThing::render(); CEnemyThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
m_actorGfx->RotateScale( SprFrame, renderPos, m_heading, 4096, 4096 );
sBBox boundingBox = m_actorGfx->GetBBox(); SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) ); m_actorGfx->RotateScale( SprFrame, renderPos, m_heading, 4096, 4096 );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
} sBBox boundingBox = m_actorGfx->GetBBox();
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
} }
} }
} }
@ -439,30 +425,16 @@ void CNpcParasiticWormSegment::render()
{ {
CEnemyThing::render(); CEnemyThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
m_actorGfx->RotateScale( SprFrame, renderPos, m_heading, 4096, m_scale );
sBBox boundingBox = m_actorGfx->GetBBox(); SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) ); m_actorGfx->RotateScale( SprFrame, renderPos, m_heading, 4096, m_scale );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
} sBBox boundingBox = m_actorGfx->GetBBox();
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
} }
} }
} }

View File

@ -361,26 +361,11 @@ void CNpcHazard::render()
{ {
CHazardThing::render(); CHazardThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
m_modelGfx->Render(renderPos); m_modelGfx->Render(renderPos);
//m_actorGfx->Render(renderPos,0,0,0);
}
} }
} }
} }

View File

@ -142,34 +142,20 @@ void CNpcBouncingBarrelHazard::render()
{ {
CHazardThing::render(); CHazardThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SVECTOR rotation;
rotation.vx = m_rockRotation;
rotation.vy = 0;
rotation.vz = m_rotation;
VECTOR scale; SVECTOR rotation;
scale.vx = ONE; rotation.vx = m_rockRotation;
scale.vy = ONE; rotation.vy = 0;
scale.vz = ONE; rotation.vz = m_rotation;
m_modelGfx->Render(renderPos,&rotation,&scale); VECTOR scale;
} scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
m_modelGfx->Render(renderPos,&rotation,&scale);
} }
} }

View File

@ -134,40 +134,25 @@ void CNpcBoatHazard::render()
{ {
CHazardThing::render(); CHazardThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
VECTOR flip;
if ( m_reversed )
{ {
VECTOR flip; flip.vx = ONE;
if ( m_reversed )
{
flip.vx = ONE;
}
else
{
flip.vx = -ONE;
}
flip.vy = ONE;
flip.vz = ONE;
m_modelGfx->Render( renderPos, NULL, &flip );
//m_actorGfx->Render(renderPos,0,0,0);
} }
else
{
flip.vx = -ONE;
}
flip.vy = ONE;
flip.vz = ONE;
m_modelGfx->Render( renderPos, NULL, &flip );
} }
} }
} }

View File

@ -47,35 +47,21 @@ void CNpcBigWheelHazard::render()
{ {
CHazardThing::render(); CHazardThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
rotation.vz = m_rotation;
VECTOR scale; SVECTOR rotation;
scale.vx = ONE; rotation.vx = 0;
scale.vy = ONE; rotation.vy = 0;
scale.vz = ONE; rotation.vz = m_rotation;
m_modelGfx->Render(renderPos,&rotation,&scale); VECTOR scale;
} scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
m_modelGfx->Render(renderPos,&rotation,&scale);
} }
} }

View File

@ -47,34 +47,20 @@ void CNpcCircularSawHazard::render()
{ {
CHazardThing::render(); CHazardThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
rotation.vz = m_rotation;
VECTOR scale; SVECTOR rotation;
scale.vx = ONE; rotation.vx = 0;
scale.vy = ONE; rotation.vy = 0;
scale.vz = ONE; rotation.vz = m_rotation;
m_modelGfx->Render(renderPos,&rotation,&scale); VECTOR scale;
} scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
m_modelGfx->Render(renderPos,&rotation,&scale);
} }
} }

View File

@ -158,34 +158,20 @@ void CNpcDualPlatformBarrelHazard::render()
{ {
CHazardThing::render(); CHazardThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
rotation.vz = m_rotation;
VECTOR scale; SVECTOR rotation;
scale.vx = ONE; rotation.vx = 0;
scale.vy = ONE; rotation.vy = 0;
scale.vz = ONE; rotation.vz = m_rotation;
m_modelGfx->Render(renderPos,&rotation,&scale); VECTOR scale;
} scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
m_modelGfx->Render(renderPos,&rotation,&scale);
} }
} }

View File

@ -147,7 +147,7 @@ void CNpcFallingHazard::processTimer( int _frames )
void CNpcFallingHazard::collidedWith( CThing *_thisThing ) void CNpcFallingHazard::collidedWith( CThing *_thisThing )
{ {
if (!m_bounceFinish && m_movementTimer<=0) CNpcHazard::collidedWith(_thisThing); if (m_movementTimer<=0) CNpcHazard::collidedWith(_thisThing);
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -160,4 +160,43 @@ const CRECT *CNpcFallingHazard::getThinkBBox()
objThinkBox.y2 = thinkBBox.YMin + 1; objThinkBox.y2 = thinkBBox.YMin + 1;
return &objThinkBox; return &objThinkBox;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFallingHazard::setWaypoints( sThingHazard *ThisHazard )
{
int pointNum;
u16 *PntList=(u16*)MakePtr(ThisHazard,sizeof(sThingHazard));
u16 newXPos, newYPos;
newXPos = (u16) *PntList;
PntList++;
newYPos = (u16) *PntList;
PntList++;
DVECTOR startPos;
startPos.vx = newXPos << 4;
//startPos.vy = newYPos << 4;
startPos.vy = -10;
Pos = startPos;
m_base = Pos;
addWaypoint( newXPos, newYPos );
if ( ThisHazard->PointCount > 1 )
{
for ( pointNum = 1 ; pointNum < ThisHazard->PointCount ; pointNum++ )
{
newXPos = (u16) *PntList;
PntList++;
newYPos = (u16) *PntList;
PntList++;
addWaypoint( newXPos, newYPos );
}
}
}

View File

@ -23,6 +23,7 @@ class CNpcFallingHazard : public CNpcHazard
public: public:
void init(); void init();
virtual CRECT const *getThinkBBox(); virtual CRECT const *getThinkBBox();
virtual void setWaypoints( sThingHazard *ThisHazard );
protected: protected:
void processMovement( int _frames ); void processMovement( int _frames );
void processTimer( int _frames ); void processTimer( int _frames );

View File

@ -47,34 +47,20 @@ void CNpcFanHazard::render()
{ {
CHazardThing::render(); CHazardThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SVECTOR rotation;
rotation.vx = m_rotation;
rotation.vy = 0;
rotation.vz = 0;
VECTOR scale; SVECTOR rotation;
scale.vx = ONE; rotation.vx = m_rotation;
scale.vy = ONE; rotation.vy = 0;
scale.vz = ONE; rotation.vz = 0;
m_modelGfx->Render(renderPos,&rotation,&scale); VECTOR scale;
} scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
m_modelGfx->Render(renderPos,&rotation,&scale);
} }
} }

View File

@ -47,34 +47,20 @@ void CNpcMowerHazard::render()
{ {
CHazardThing::render(); CHazardThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
rotation.vz = m_rotation;
VECTOR scale; SVECTOR rotation;
scale.vx = ONE; rotation.vx = 0;
scale.vy = ONE; rotation.vy = 0;
scale.vz = ONE; rotation.vz = m_rotation;
m_modelGfx->Render(renderPos,&rotation,&scale); VECTOR scale;
} scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
m_modelGfx->Render(renderPos,&rotation,&scale);
} }
} }

View File

@ -210,3 +210,15 @@ void CNpcPendulumPlatform::render()
} }
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const CRECT *CNpcPendulumPlatform::getThinkBBox()
{
CRECT objThinkBox = getCollisionArea();
sBBox &thinkBBox = CThingManager::getThinkBBox();
objThinkBox.y1 = thinkBBox.YMax - 1;
return &objThinkBox;
}

View File

@ -23,6 +23,7 @@ class CNpcPendulumPlatform : public CNpcPlatform
public: public:
virtual void postInit(); virtual void postInit();
virtual void render(); virtual void render();
virtual CRECT const *getThinkBBox();
protected: protected:
virtual void setWaypoints( sThingPlatform *ThisPlatform ); virtual void setWaypoints( sThingPlatform *ThisPlatform );
virtual void processMovement( int _frames ); virtual void processMovement( int _frames );

View File

@ -118,60 +118,47 @@ void CNpcSteerableBarrelPlatform::render()
{ {
CPlatformThing::render(); CPlatformThing::render();
// Render if (canRender())
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
renderPos.vx = Pos.vx - offset.vx;
renderPos.vy = Pos.vy - offset.vy;
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{ {
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() ) DVECTOR &renderPos=getRenderPos();
{ DVECTOR offset = CLevel::getCameraPos();
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
rotation.vz = m_rotation;
VECTOR scale; SVECTOR rotation;
scale.vx = ONE; rotation.vx = 0;
scale.vy = ONE; rotation.vy = 0;
scale.vz = ONE; rotation.vz = m_rotation;
m_modelGfx->Render(renderPos,&rotation,&scale); VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
#if defined (__USER_paul__) || defined (__USER_charles__) m_modelGfx->Render(renderPos,&rotation,&scale);
DVECTOR size;
DVECTOR centre;
int halfLength;
int x1,y1,x2,y2;
centre=getCollisionCentre(); #if defined (__USER_paul__) || defined (__USER_charles__)
size=getCollisionSize(); DVECTOR size;
halfLength=size.vx>>1; DVECTOR centre;
int halfLength;
int x1,y1,x2,y2;
x1=-halfLength*mcos(getCollisionAngle()&4095)>>12; centre=getCollisionCentre();
y1=-halfLength*msin(getCollisionAngle()&4095)>>12; size=getCollisionSize();
x2=+halfLength*mcos(getCollisionAngle()&4095)>>12; halfLength=size.vx>>1;
y2=+halfLength*msin(getCollisionAngle()&4095)>>12;
centre.vx-=offset.vx; x1=-halfLength*mcos(getCollisionAngle()&4095)>>12;
centre.vy-=offset.vy; y1=-halfLength*msin(getCollisionAngle()&4095)>>12;
x1+=centre.vx; x2=+halfLength*mcos(getCollisionAngle()&4095)>>12;
y1+=centre.vy; y2=+halfLength*msin(getCollisionAngle()&4095)>>12;
x2+=centre.vx;
y2+=centre.vy;
DrawLine(x1,y1,x2,y2,0,255,0,0); centre.vx-=offset.vx;
#endif centre.vy-=offset.vy;
} x1+=centre.vx;
y1+=centre.vy;
x2+=centre.vx;
y2+=centre.vy;
DrawLine(x1,y1,x2,y2,0,255,0,0);
#endif
} }
} }
} }