This commit is contained in:
Daveo 2001-05-10 16:16:57 +00:00
parent 0b65d9d4a7
commit c110d56dc5
15 changed files with 403 additions and 536 deletions

View file

@ -230,47 +230,33 @@ void CNpcBranchPlatform::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() )
DVECTOR &renderPos=getRenderPos();
SVECTOR rotation;
rotation.vx = 0;
if ( m_reversed )
{
SVECTOR rotation;
rotation.vx = 0;
if ( m_reversed )
{
rotation.vy = 0;
rotation.vz = getCollisionAngle();
renderPos.vx-= BX;
renderPos.vy+= BY;
}
else
{
rotation.vy = 0;
rotation.vz = getCollisionAngle();
renderPos.vx+= BX;
renderPos.vy+= BY;
}
rotation.vy = 0;
rotation.vz = getCollisionAngle();
renderPos.vx-= BX;
renderPos.vy+= BY;
}
else
{
rotation.vy = 0;
rotation.vz = getCollisionAngle();
renderPos.vx+= BX;
renderPos.vy+= BY;
}
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
m_modelGfx->Render(renderPos,&rotation,&scale);
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
m_modelGfx->Render(renderPos,&rotation,&scale);
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR size;
DVECTOR centre;
@ -306,7 +292,7 @@ void CNpcBranchPlatform::render()
DrawLine(x1,y1,x2,y2,0,255,0,0);
#endif
}
}
}
}

View file

@ -150,34 +150,21 @@ void CNpcCartPlatform::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 = getCollisionAngle();
DVECTOR &renderPos=getRenderPos();
SVECTOR rotation;
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
rotation.vx = 0;
rotation.vy = 0;
rotation.vz = getCollisionAngle();
m_modelGfx->Render(renderPos,&rotation,&scale);
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
m_modelGfx->Render(renderPos,&rotation,&scale);
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR size;
@ -203,7 +190,7 @@ void CNpcCartPlatform::render()
DrawLine(x1,y1,x2,y2,0,255,0,0);
#endif
}
}
}
}

View file

@ -205,34 +205,15 @@ void CNpcDualPlatform::render()
{
int x1,y1,x2,y2;
setOnScreenFlag(false);
if ( m_isActive )
{
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() )
{
setOnScreenFlag(true);
m_modelGfx->Render(renderPos);
// POLY_F4 *F4=GetPrimF4();
// setXYWH(F4,renderPos.vx-32,renderPos.vy-32,64,16);
// setRGB0(F4,127,127,64);
// AddPrimToList(F4,2);
DVECTOR &renderPos=getRenderPos();
m_modelGfx->Render(renderPos);
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR size;
@ -257,9 +238,7 @@ void CNpcDualPlatform::render()
DrawLine(x1,y1,x2,y2,0,255,0,0);
#endif
}
}
/*
x1 = Pos.vx - offset.vx;
x2 = m_lineBase.vx - offset.vx;
@ -339,6 +318,7 @@ void CNpcDualPlatform::render()
DrawLine( x1, y1, x2, y2, 0, 0, 0, 0 );
}
}
*/
}
}
}

View file

@ -77,34 +77,14 @@ void CNpcFishHookPlatform::render()
{
int x1,y1,x2,y2;
setOnScreenFlag(false);
if ( m_isActive )
{
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() )
DVECTOR &renderPos=getRenderPos();
if (canRender())
{
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
setOnScreenFlag(true);
m_modelGfx->Render(renderPos);
// POLY_F4 *F4=GetPrimF4();
// setXYWH(F4,renderPos.vx-32,renderPos.vy-32,64,16);
// setRGB0(F4,127,127,64);
// AddPrimToList(F4,2);
m_modelGfx->Render(renderPos);
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR size;
@ -129,45 +109,45 @@ void CNpcFishHookPlatform::render()
DrawLine(x1,y1,x2,y2,0,255,0,0);
#endif
}
}
x1 = Pos.vx - offset.vx;
x2 = m_lineBase.vx - offset.vx;
if ( x1 > x2 )
// draw Line (Literally!!)
if (renderPos.vx>0 && renderPos.vx<512)
{
int tempX = x1;
x1 = x2;
x2 = tempX;
}
y1 = Pos.vy - offset.vy;
y2 = m_lineBase.vy - offset.vy;
if ( y1 > y2 )
{
int tempY = y1;
y1 = y2;
y2 = tempY;
}
if ( y1 < 0 )
{
y1 = 0;
}
DVECTOR const &CamPos=CLevel::getCameraPos();
if ( y2 > VidGetScrH() )
{
y2 = VidGetScrH();
}
x1 = renderPos.vx;
x2 = m_lineBase.vx - CamPos.vx;
if ( x2 >= 0 && x1 <= VidGetScrW() )
{
if ( y2 >= 0 && y1 <= VidGetScrH() )
if ( x1 > x2 )
{
DrawLine( x1, y1, x2, y2, 0, 0, 0, 0 );
int tempX = x1;
x1 = x2;
x2 = tempX;
}
y1 = renderPos.vy;
y2 = m_lineBase.vy - CamPos.vy;
if ( y1 > y2 )
{
int tempY = y1;
y1 = y2;
y2 = tempY;
}
if ( y1 < 0 )
{
y1 = 0;
}
if ( y2 > VidGetScrH() )
{
y2 = VidGetScrH();
}
DrawLine( x1, y1, x2, y2, 0, 0, 0, 0 );
}
}
}

View file

@ -30,60 +30,3 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcJellyfishPlatform::render()
{
if ( m_isActive )
{
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 ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
m_modelGfx->Render(renderPos);
// POLY_F4 *F4=GetPrimF4();
// setXYWH(F4,renderPos.vx-32,renderPos.vy-32,64,16);
// setRGB0(F4,127,127,64);
// AddPrimToList(F4,2);
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR size;
DVECTOR centre;
int halfLength;
int x1,y1,x2,y2;
centre=getCollisionCentre();
size=getCollisionSize();
halfLength=size.vx>>1;
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.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
}
}
}
}

View file

@ -21,7 +21,7 @@
class CNpcJellyfishPlatform : public CNpcPlatform
{
public:
virtual void render();
};
#endif

View file

@ -884,34 +884,17 @@ void CNpcPlatform::processMovement( int _frames )
void CNpcPlatform::render()
{
setOnScreenFlag(false);
if ( m_isActive )
{
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() )
{
setOnScreenFlag(true);
m_modelGfx->Render(renderPos);
// POLY_F4 *F4=GetPrimF4();
// setXYWH(F4,renderPos.vx-32,renderPos.vy-32,64,16);
// setRGB0(F4,127,127,64);
// AddPrimToList(F4,2);
DVECTOR &renderPos=getRenderPos();
m_modelGfx->Render(renderPos);
}
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR size;
@ -937,8 +920,6 @@ void CNpcPlatform::render()
DrawLine(x1,y1,x2,y2,0,255,0,0);
#endif
}
}
}
}

View file

@ -126,34 +126,15 @@ void CNpcPendulumPlatform::render()
int x1,y1,x2,y2;
int x1Boundary,y1Boundary,x2Boundary,y2Boundary;
setOnScreenFlag(false);
if ( m_isActive )
{
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() )
{
setOnScreenFlag(true);
m_modelGfx->Render(renderPos);
// POLY_F4 *F4=GetPrimF4();
// setXYWH(F4,renderPos.vx-32,renderPos.vy-32,64,16);
// setRGB0(F4,127,127,64);
// AddPrimToList(F4,2);
DVECTOR &renderPos=getRenderPos();
m_modelGfx->Render(renderPos);
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR size;
@ -178,53 +159,53 @@ void CNpcPendulumPlatform::render()
DrawLine(x1,y1,x2,y2,0,255,0,0);
#endif
}
}
/*
x1 = x1Boundary = Pos.vx - offset.vx;
x2 = x2Boundary = m_lineBase.vx - offset.vx;
x1 = x1Boundary = Pos.vx - offset.vx;
x2 = x2Boundary = m_lineBase.vx - offset.vx;
y1 = y1Boundary = Pos.vy - offset.vy;
y2 = y2Boundary = m_lineBase.vy - offset.vy;
y1 = y1Boundary = Pos.vy - offset.vy;
y2 = y2Boundary = m_lineBase.vy - offset.vy;
int angle = ratan2( x1 - x2, y1 - y2 );
int angle = ratan2( x1 - x2, y1 - y2 );
if ( y2 < 0 )
{
int yDiff = -y2;
y2 = y2Boundary = 0;
int hyp = ( yDiff << 12 ) / rcos( angle );
x2 += ( hyp * rsin( angle ) ) >> 12;
}
if ( y1 > VidGetScrH() )
{
int yDiff = y1 - VidGetScrH();
y1 = y1Boundary = VidGetScrH();
int hyp = ( yDiff << 12 ) / rcos( angle );
x1 -= ( hyp * rsin( angle ) ) >> 12;
}
if ( x1Boundary > x2Boundary )
{
int tempX = x1Boundary;
x1Boundary = x2Boundary;
x2Boundary = tempX;
}
if ( y1Boundary > y2Boundary )
{
int tempY = y1Boundary;
y1Boundary = y2Boundary;
y2Boundary = tempY;
}
if ( x2Boundary >= 0 && x1Boundary <= VidGetScrW() )
{
if ( y2Boundary >= 0 && y1Boundary <= VidGetScrH() )
if ( y2 < 0 )
{
DrawLine( x1, y1, x2, y2, 0, 0, 0, 0 );
int yDiff = -y2;
y2 = y2Boundary = 0;
int hyp = ( yDiff << 12 ) / rcos( angle );
x2 += ( hyp * rsin( angle ) ) >> 12;
}
if ( y1 > VidGetScrH() )
{
int yDiff = y1 - VidGetScrH();
y1 = y1Boundary = VidGetScrH();
int hyp = ( yDiff << 12 ) / rcos( angle );
x1 -= ( hyp * rsin( angle ) ) >> 12;
}
if ( x1Boundary > x2Boundary )
{
int tempX = x1Boundary;
x1Boundary = x2Boundary;
x2Boundary = tempX;
}
if ( y1Boundary > y2Boundary )
{
int tempY = y1Boundary;
y1Boundary = y2Boundary;
y2Boundary = tempY;
}
if ( x2Boundary >= 0 && x1Boundary <= VidGetScrW() )
{
if ( y2Boundary >= 0 && y1Boundary <= VidGetScrH() )
{
DrawLine( x1, y1, x2, y2, 0, 0, 0, 0 );
}
}
*/
}
}
}

View file

@ -107,33 +107,23 @@ void CNpcRetractingPlatform::render()
CPlatformThing::render();
// Render
DVECTOR renderPos;
DVECTOR offset = CLevel::getCameraPos();
CPlatformThing::render();
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 = 0;
DVECTOR &renderPos=getRenderPos();
SVECTOR rotation;
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = m_extension;
rotation.vx = 0;
rotation.vy = 0;
rotation.vz = 0;
m_modelGfx->Render(renderPos,&rotation,&scale);
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = m_extension;
m_modelGfx->Render(renderPos,&rotation,&scale);
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR size;
@ -159,7 +149,6 @@ void CNpcRetractingPlatform::render()
DrawLine(x1,y1,x2,y2,0,255,0,0);
#endif
}
}
}
}

View file

@ -117,34 +117,21 @@ void CNpcSeesawPlatform::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 = getCollisionAngle();
DVECTOR &renderPos=getRenderPos();
SVECTOR rotation;
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
rotation.vx = 0;
rotation.vy = 0;
rotation.vz = getCollisionAngle();
m_modelGfx->Render(renderPos,&rotation,&scale);
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
m_modelGfx->Render(renderPos,&rotation,&scale);
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR size;
@ -170,7 +157,6 @@ void CNpcSeesawPlatform::render()
DrawLine(x1,y1,x2,y2,0,255,0,0);
#endif
}
}
}
}