This commit is contained in:
Charles 2001-04-26 15:20:21 +00:00
parent 2898ccb84c
commit 891103611f
12 changed files with 79 additions and 4 deletions

View File

@ -79,7 +79,8 @@ enemy_src := npc \
npuffa \
ngen \
nsdart \
ndustdev
ndustdev \
npbug
platform_src := platform \
platdata \

View File

@ -68,6 +68,13 @@ bool CNpcClamEnemy::processSensor()
}
}
void CNpcJumpingClamEnemy::postInit()
{
CNpcClamEnemy::postInit();
m_drawRotation = m_heading + 1024;
}
void CNpcJumpingClamEnemy::processClose( int _frames )
{
s32 velocity;
@ -90,7 +97,7 @@ void CNpcJumpingClamEnemy::processClose( int _frames )
if ( !m_animPlaying )
{
m_animPlaying = true;
m_animNo = ANIM_CLAM_SIDESNAP;
m_animNo = ANIM_CLAM_SNAPUP;
m_frame = 0;
}
}

View File

@ -23,6 +23,8 @@ protected:
class CNpcJumpingClamEnemy : public CNpcClamEnemy
{
public:
virtual void postInit();
protected:
virtual void processClose( int _frames );
};

View File

@ -204,4 +204,28 @@ void CNpcHermitCrabEnemy::processClose( int _frames )
default:
break;
}
}
}
void CNpcHermitCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange )
{
Pos.vx += distX;
Pos.vy += distY;
// sort out draw rotation
DVECTOR testPos1, testPos2;
testPos1 = testPos2 = Pos;
testPos1.vx -= 10;
testPos2.vx += 10;
testPos1.vy += m_layerCollision->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
testPos2.vy += m_layerCollision->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
s32 xDist = testPos2.vx - testPos1.vx;
s32 yDist = testPos2.vy - testPos1.vy;
s16 heading = ratan2( yDist, xDist );
m_drawRotation = heading;
}

View File

@ -23,6 +23,7 @@ class CNpcHermitCrabEnemy : public CNpcEnemy
public:
virtual void postInit();
protected:
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
virtual bool processSensor();
virtual void processClose( int _frames );

View File

@ -14,8 +14,14 @@
#ifndef __ENEMY_NPBUG_H__
#define __ENEMY_NPBUG_H__
#ifndef __ENEMY_NPC_H__
#include "enemy\npc.h"
#endif
class CNpcPricklyBugEnemy : public CNpcEnemy
{
protected:
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
};
#endif

View File

@ -734,6 +734,7 @@ void CNpcEnemy::init()
m_positionHistory = NULL;
m_isShuttingDown = false;
m_drawRotation = 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -1397,6 +1398,7 @@ void CNpcEnemy::render()
if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() )
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, 4096, 4096 );
}
}
}

View File

@ -358,6 +358,7 @@ protected:
virtual void collidedWith(CThing *_thisThing);
u8 m_isShuttingDown;
s16 m_drawRotation;
// position history stuff

View File

@ -399,7 +399,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
{ // NPC_CLAM_JUMP
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
ANIM_CLAM_SNAPUP,
NPC_SENSOR_USER_CLOSE,
NPC_MOVEMENT_STATIC,
NPC_CLOSE_NONE,

View File

@ -293,3 +293,29 @@ void CNpcSpiderCrabEnemy::processMovement(int _frames)
processMovementModifier( _frames, moveX, moveY, moveVel, moveDist );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcSpiderCrabEnemy::processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange )
{
Pos.vx += distX;
Pos.vy += distY;
// sort out draw rotation
DVECTOR testPos1, testPos2;
testPos1 = testPos2 = Pos;
testPos1.vx -= 10;
testPos2.vx += 10;
testPos1.vy += m_layerCollision->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
testPos2.vy += m_layerCollision->getHeightFromGround( testPos1.vx, testPos1.vy, 16 );
s32 xDist = testPos2.vx - testPos1.vx;
s32 yDist = testPos2.vy - testPos1.vy;
s16 heading = ratan2( yDist, xDist );
m_drawRotation = heading;
}

View File

@ -23,6 +23,7 @@ class CNpcSpiderCrabEnemy : public CNpcEnemy
public:
virtual void postInit();
protected:
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
virtual bool processSensor();
virtual void processClose( int _frames );
virtual void processCollision();

View File

@ -253,6 +253,10 @@ SOURCE=..\..\..\source\enemy\noilblob.h
# End Source File
# Begin Source File
SOURCE=..\..\..\source\enemy\npbug.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\source\enemy\npbug.h
# End Source File
# Begin Source File