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

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