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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, m_scaleX, m_scaleY );
DVECTOR &renderPos=getRenderPos();
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 );
}
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();
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
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)
DVECTOR &renderPos=getRenderPos();
// 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;
s32 XMin;
// get xmax, xmin, ymax, ymin
s32 YMax;
s32 YMin;
s32 XMax;
s32 XMin;
XMin=SprFrame->x0;
if (XMin>SprFrame->x1) XMin=SprFrame->x1;
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;
s32 YMax;
s32 YMin;
XMax -= origRenderPos.vx;
XMin -= origRenderPos.vx;
YMax -= origRenderPos.vy;
YMin -= origRenderPos.vy;
XMin=SprFrame->x0;
if (XMin>SprFrame->x1) XMin=SprFrame->x1;
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;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) );
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 );
}
XMax -= renderPos.vx;
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false);
m_actorGfx->RotateScale( SprFrame, renderPos, 0, 8192, 8192 );
DVECTOR &renderPos=getRenderPos();
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 );
}
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false);
m_actorGfx->RotateScale( SprFrame, renderPos, 0, 8192, 8192 );
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false);
m_actorGfx->RotateScale( SprFrame, renderPos, 0, 8192, 8192 );
DVECTOR &renderPos=getRenderPos();
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 );
}
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false);
m_actorGfx->RotateScale( SprFrame, renderPos, 0, 8192, 8192 );
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, 4096, 4096 );
DVECTOR &renderPos=getRenderPos();
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 );
}
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();
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
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)
DVECTOR &renderPos=getRenderPos();
// 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;
s32 XMin;
// get xmax, xmin, ymax, ymin
s32 YMax;
s32 YMin;
s32 XMax;
s32 XMin;
XMin=SprFrame->x0;
if (XMin>SprFrame->x1) XMin=SprFrame->x1;
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;
s32 YMax;
s32 YMin;
XMax -= origRenderPos.vx;
XMin -= origRenderPos.vx;
YMax -= origRenderPos.vy;
YMin -= origRenderPos.vy;
XMin=SprFrame->x0;
if (XMin>SprFrame->x1) XMin=SprFrame->x1;
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;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) );
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 );
}
XMax -= renderPos.vx;
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();
// Render
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 )
if (canRender())
{
renderPos.vx += ( spriteWidth >> 1 ) + m_drawOffset.vx;
}
else
{
renderPos.vx -= ( spriteWidth >> 1 ) + m_drawOffset.vx;
}
DVECTOR &renderPos=getRenderPos();
renderPos.vy = Pos.vy - offset.vy;
origRenderPos.vy = renderPos.vy;
renderPos.vy += m_drawOffset.vy - ( spriteHeight >> 1 );
int frame = FRM_SQUIDDART_SWIM0001 + ( m_frame >> 8 );
CRECT collisionRect = getCollisionArea();
collisionRect.x1 -= Pos.vx;
collisionRect.x2 -= Pos.vx;
collisionRect.y1 -= Pos.vy;
collisionRect.y2 -= Pos.vy;
SprFrame = m_spriteBank->printFT4(frame,renderPos.vx,renderPos.vy,m_reversed,0,10);
setRGB0( SprFrame, 255, 128, 255 );
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
{
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 XMin = SprFrame->x0 - origRenderPos.vx;
s32 XMax = SprFrame->x1 - origRenderPos.vx;
s32 XMin = SprFrame->x0 - origRenderPos.vx;
s32 YMax = SprFrame->y2 - origRenderPos.vy;
s32 YMin = SprFrame->y0 - origRenderPos.vy;*/
s32 YMax = SprFrame->y2 - origRenderPos.vy;
s32 YMin = SprFrame->y0 - origRenderPos.vy;
s32 XMax = SprFrame->x1 - renderPos.vx;
s32 XMin = SprFrame->x0 - renderPos.vx;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) );
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 );
}
s32 YMax = SprFrame->y2 - renderPos.vy;
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
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)
DVECTOR &renderPos=getRenderPos();
// 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;
s32 XMin;
// get xmax, xmin, ymax, ymin
s32 YMax;
s32 YMin;
s32 XMax;
s32 XMin;
XMin=SprFrame->x0;
if (XMin>SprFrame->x1) XMin=SprFrame->x1;
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;
s32 YMax;
s32 YMin;
XMax -= origRenderPos.vx;
XMin -= origRenderPos.vx;
YMax -= origRenderPos.vy;
YMin -= origRenderPos.vy;
XMin=SprFrame->x0;
if (XMin>SprFrame->x1) XMin=SprFrame->x1;
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;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) );
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 );
}
XMax -= renderPos.vx;
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
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)
DVECTOR &renderPos=getRenderPos();
// 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;
s32 XMin;
// get xmax, xmin, ymax, ymin
s32 YMax;
s32 YMin;
s32 XMax;
s32 XMin;
XMin=SprFrame->x0;
if (XMin>SprFrame->x1) XMin=SprFrame->x1;
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;
s32 YMax;
s32 YMin;
XMax -= origRenderPos.vx;
XMin -= origRenderPos.vx;
YMax -= origRenderPos.vy;
YMin -= origRenderPos.vy;
XMin=SprFrame->x0;
if (XMin>SprFrame->x1) XMin=SprFrame->x1;
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;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) );
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 );
}
XMax -= renderPos.vx;
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
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)
DVECTOR &renderPos=getRenderPos();
// 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;
s32 XMin;
// get xmax, xmin, ymax, ymin
s32 YMax;
s32 YMin;
s32 XMax;
s32 XMin;
XMin=SprFrame->x0;
if (XMin>SprFrame->x1) XMin=SprFrame->x1;
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;
s32 YMax;
s32 YMin;
XMax -= origRenderPos.vx;
XMin -= origRenderPos.vx;
YMax -= origRenderPos.vy;
YMin -= origRenderPos.vy;
XMin=SprFrame->x0;
if (XMin>SprFrame->x1) XMin=SprFrame->x1;
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;
setCollisionSize( ( XMax - XMin ), ( YMax - YMin ) );
setCollisionCentreOffset( ( XMax + XMin ) >> 1, ( YMax + YMin ) >> 1 );
}
XMax -= renderPos.vx;
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
m_actorGfx->RotateScale( SprFrame, renderPos, m_heading, 4096, 4096 );
DVECTOR &renderPos=getRenderPos();
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 );
}
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();
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
m_actorGfx->RotateScale( SprFrame, renderPos, m_heading, 4096, m_scale );
DVECTOR &renderPos=getRenderPos();
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 );
}
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();
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
m_modelGfx->Render(renderPos);
//m_actorGfx->Render(renderPos,0,0,0);
}
DVECTOR &renderPos=getRenderPos();
m_modelGfx->Render(renderPos);
}
}
}

View File

@ -142,34 +142,20 @@ void CNpcBouncingBarrelHazard::render()
{
CHazardThing::render();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SVECTOR rotation;
rotation.vx = m_rockRotation;
rotation.vy = 0;
rotation.vz = m_rotation;
DVECTOR &renderPos=getRenderPos();
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
SVECTOR rotation;
rotation.vx = m_rockRotation;
rotation.vy = 0;
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
DVECTOR &renderPos=getRenderPos();
VECTOR flip;
if ( m_reversed )
{
VECTOR flip;
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);
flip.vx = ONE;
}
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
rotation.vz = m_rotation;
DVECTOR &renderPos=getRenderPos();
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
rotation.vz = m_rotation;
DVECTOR &renderPos=getRenderPos();
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
rotation.vz = m_rotation;
DVECTOR &renderPos=getRenderPos();
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
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 )
{
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;
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:
void init();
virtual CRECT const *getThinkBBox();
virtual void setWaypoints( sThingHazard *ThisHazard );
protected:
void processMovement( int _frames );
void processTimer( int _frames );

View File

@ -47,34 +47,20 @@ void CNpcFanHazard::render()
{
CHazardThing::render();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SVECTOR rotation;
rotation.vx = m_rotation;
rotation.vy = 0;
rotation.vz = 0;
DVECTOR &renderPos=getRenderPos();
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
SVECTOR rotation;
rotation.vx = m_rotation;
rotation.vy = 0;
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();
// Render
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 (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
rotation.vz = m_rotation;
DVECTOR &renderPos=getRenderPos();
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
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:
virtual void postInit();
virtual void render();
virtual CRECT const *getThinkBBox();
protected:
virtual void setWaypoints( sThingPlatform *ThisPlatform );
virtual void processMovement( int _frames );

View File

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