This commit is contained in:
Charles 2001-05-30 18:31:57 +00:00
parent 415a7d7f4f
commit f821541cf3
5 changed files with 213 additions and 47 deletions

View File

@ -185,7 +185,7 @@ void CNpcSquidDartEnemy::processClose( int _frames )
}
else
{
if ( yAim )
if ( abs( yAim ) > 20 )
{
movement = yAim;

View File

@ -27,6 +27,11 @@
#include "platform\pfallnor.h"
#endif
#ifndef __VID_HEADER_
#include "system\vid.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcConveyorPlatformGenerator::collidedWith(CThing *_thisThing)
@ -102,6 +107,9 @@ void CNpcConveyorPlatform::postInit()
CNpcPlatform::postInit();
m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH );
m_spinFinish = false;
m_rotation = 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -112,11 +120,29 @@ void CNpcConveyorPlatform::processMovement( int _frames )
s32 distX, distY;
bool pathComplete, waypointChange;
if ( m_spinFinish )
{
m_rotation += 64 * _frames;
m_rotation &= 4095;
DVECTOR offset = CLevel::getCameraPos();
Pos.vy += 3 * _frames;
s32 yPos = Pos.vy - offset.vy;
if ( yPos > VidGetScrH() )
{
setToShutdown();
}
}
else
{
m_npcPath.think( Pos, &pathComplete, &waypointChange, &distX, &distY );
if ( pathComplete )
{
setToShutdown();
m_spinFinish = true;
}
else
{
@ -149,6 +175,7 @@ void CNpcConveyorPlatform::processMovement( int _frames )
}
}
}
}
Pos.vx += moveX;
Pos.vy += moveY;
@ -225,9 +252,10 @@ void CNpcConveyorPlatform::collidedWith( CThing *_thisThing )
case TYPE_HAZARD:
{
// needs to explode or something
setToShutdown();
if ( !m_spinFinish )
{
m_spinFinish = true;
}
break;
}
@ -237,3 +265,45 @@ void CNpcConveyorPlatform::collidedWith( CThing *_thisThing )
break;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcConveyorPlatform::render()
{
if ( m_isActive )
{
CPlatformThing::render();
// Render
if (canRender())
{
DVECTOR &renderPos=getRenderPos();
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
rotation.vz = m_rotation;
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
m_modelGfx->Render(renderPos,&rotation,&scale);
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int CNpcConveyorPlatform::checkCollisionAgainst(CThing *_thisThing, int _frames)
{
if ( m_spinFinish )
{
return( false );
}
else
{
return( CNpcPlatform::checkCollisionAgainst( _thisThing, _frames ) );
}
}

View File

@ -23,9 +23,14 @@ class CNpcConveyorPlatform : public CNpcPlatform
public:
virtual void postInit();
virtual CRECT const *getThinkBBox();
virtual void render();
virtual int checkCollisionAgainst(CThing *_thisThing, int _frames);
protected:
virtual void processMovement( int _frames );
virtual void collidedWith(CThing *_thisThing);
u8 m_spinFinish;
s16 m_rotation;
};
class CNpcConveyorPlatformGenerator : public CNpcPlatform

View File

@ -23,6 +23,11 @@
#include "utils\utils.h"
#endif
#ifndef __VID_HEADER_
#include "system\vid.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFallingNoRespawnPlatform::postInit()
@ -30,21 +35,58 @@ void CNpcFallingNoRespawnPlatform::postInit()
CNpcPlatform::postInit();
m_npcPath.setPathType( CNpcPath::SINGLE_USE_PATH );
m_spinFinish = false;
m_rotation = 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFallingNoRespawnPlatform::processMovement( int _frames )
{
s32 moveX, moveY;
s32 moveX = 0, moveY = 0;
s32 distX, distY, heading;
bool pathComplete;
if ( m_spinFinish )
{
m_rotation += 64 * _frames;
m_rotation &= 4095;
DVECTOR offset = CLevel::getCameraPos();
if ( m_bounceDir )
{
Pos.vx += 2 * _frames;
}
else
{
Pos.vx -= 2 * _frames;
}
Pos.vy += m_speed * _frames;
if ( m_speed < 3 )
{
m_speed++;
}
s32 yPos = Pos.vy - offset.vy;
if ( yPos > VidGetScrH() )
{
setToShutdown();
}
}
else
{
m_npcPath.thinkVertical( Pos, &pathComplete, &distX, &distY, &heading );
if ( pathComplete )
{
setToShutdown();
m_spinFinish = true;
m_speed = -5;
m_bounceDir = getRnd() % 2;
}
else
{
@ -66,11 +108,12 @@ void CNpcFallingNoRespawnPlatform::processMovement( int _frames )
moveX = 2 * _frames;
}
}
}
}
Pos.vx += moveX;
Pos.vy += moveY;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -86,3 +129,45 @@ const CRECT *CNpcFallingNoRespawnPlatform::getThinkBBox()
return &objThinkBox;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcFallingNoRespawnPlatform::render()
{
if ( m_isActive )
{
CPlatformThing::render();
// Render
if (canRender())
{
DVECTOR &renderPos=getRenderPos();
SVECTOR rotation;
rotation.vx = 0;
rotation.vy = 0;
rotation.vz = m_rotation;
VECTOR scale;
scale.vx = ONE;
scale.vy = ONE;
scale.vz = ONE;
m_modelGfx->Render(renderPos,&rotation,&scale);
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int CNpcFallingNoRespawnPlatform::checkCollisionAgainst(CThing *_thisThing, int _frames)
{
if ( m_spinFinish )
{
return( false );
}
else
{
return( CNpcPlatform::checkCollisionAgainst( _thisThing, _frames ) );
}
}

View File

@ -23,8 +23,14 @@ class CNpcFallingNoRespawnPlatform : public CNpcPlatform
public:
virtual void postInit();
virtual CRECT const *getThinkBBox();
virtual int checkCollisionAgainst(CThing *_thisThing, int _frames);
protected:
virtual void render();
virtual void processMovement( int _frames );
u8 m_spinFinish;
s16 m_rotation;
u8 m_bounceDir;
};
#endif