This commit is contained in:
parent
2898ccb84c
commit
891103611f
12 changed files with 79 additions and 4 deletions
|
@ -79,7 +79,8 @@ enemy_src := npc \
|
||||||
npuffa \
|
npuffa \
|
||||||
ngen \
|
ngen \
|
||||||
nsdart \
|
nsdart \
|
||||||
ndustdev
|
ndustdev \
|
||||||
|
npbug
|
||||||
|
|
||||||
platform_src := platform \
|
platform_src := platform \
|
||||||
platdata \
|
platdata \
|
||||||
|
|
|
@ -68,6 +68,13 @@ bool CNpcClamEnemy::processSensor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CNpcJumpingClamEnemy::postInit()
|
||||||
|
{
|
||||||
|
CNpcClamEnemy::postInit();
|
||||||
|
|
||||||
|
m_drawRotation = m_heading + 1024;
|
||||||
|
}
|
||||||
|
|
||||||
void CNpcJumpingClamEnemy::processClose( int _frames )
|
void CNpcJumpingClamEnemy::processClose( int _frames )
|
||||||
{
|
{
|
||||||
s32 velocity;
|
s32 velocity;
|
||||||
|
@ -90,7 +97,7 @@ void CNpcJumpingClamEnemy::processClose( int _frames )
|
||||||
if ( !m_animPlaying )
|
if ( !m_animPlaying )
|
||||||
{
|
{
|
||||||
m_animPlaying = true;
|
m_animPlaying = true;
|
||||||
m_animNo = ANIM_CLAM_SIDESNAP;
|
m_animNo = ANIM_CLAM_SNAPUP;
|
||||||
m_frame = 0;
|
m_frame = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ protected:
|
||||||
|
|
||||||
class CNpcJumpingClamEnemy : public CNpcClamEnemy
|
class CNpcJumpingClamEnemy : public CNpcClamEnemy
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual void postInit();
|
||||||
protected:
|
protected:
|
||||||
virtual void processClose( int _frames );
|
virtual void processClose( int _frames );
|
||||||
};
|
};
|
||||||
|
|
|
@ -205,3 +205,27 @@ void CNpcHermitCrabEnemy::processClose( int _frames )
|
||||||
break;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ class CNpcHermitCrabEnemy : public CNpcEnemy
|
||||||
public:
|
public:
|
||||||
virtual void postInit();
|
virtual void postInit();
|
||||||
protected:
|
protected:
|
||||||
|
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
|
||||||
virtual bool processSensor();
|
virtual bool processSensor();
|
||||||
virtual void processClose( int _frames );
|
virtual void processClose( int _frames );
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,14 @@
|
||||||
#ifndef __ENEMY_NPBUG_H__
|
#ifndef __ENEMY_NPBUG_H__
|
||||||
#define __ENEMY_NPBUG_H__
|
#define __ENEMY_NPBUG_H__
|
||||||
|
|
||||||
|
#ifndef __ENEMY_NPC_H__
|
||||||
|
#include "enemy\npc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class CNpcPricklyBugEnemy : public CNpcEnemy
|
class CNpcPricklyBugEnemy : public CNpcEnemy
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -734,6 +734,7 @@ void CNpcEnemy::init()
|
||||||
m_positionHistory = NULL;
|
m_positionHistory = NULL;
|
||||||
|
|
||||||
m_isShuttingDown = false;
|
m_isShuttingDown = false;
|
||||||
|
m_drawRotation = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1397,6 +1398,7 @@ void CNpcEnemy::render()
|
||||||
if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() )
|
if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() )
|
||||||
{
|
{
|
||||||
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
|
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
|
||||||
|
m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, 4096, 4096 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,6 +358,7 @@ protected:
|
||||||
virtual void collidedWith(CThing *_thisThing);
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
|
||||||
u8 m_isShuttingDown;
|
u8 m_isShuttingDown;
|
||||||
|
s16 m_drawRotation;
|
||||||
|
|
||||||
// position history stuff
|
// position history stuff
|
||||||
|
|
||||||
|
|
|
@ -399,7 +399,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] =
|
||||||
|
|
||||||
{ // NPC_CLAM_JUMP
|
{ // NPC_CLAM_JUMP
|
||||||
ACTORS_CLAM_SBK,
|
ACTORS_CLAM_SBK,
|
||||||
ANIM_CLAM_SIDESNAP,
|
ANIM_CLAM_SNAPUP,
|
||||||
NPC_SENSOR_USER_CLOSE,
|
NPC_SENSOR_USER_CLOSE,
|
||||||
NPC_MOVEMENT_STATIC,
|
NPC_MOVEMENT_STATIC,
|
||||||
NPC_CLOSE_NONE,
|
NPC_CLOSE_NONE,
|
||||||
|
|
|
@ -293,3 +293,29 @@ void CNpcSpiderCrabEnemy::processMovement(int _frames)
|
||||||
|
|
||||||
processMovementModifier( _frames, moveX, moveY, moveVel, moveDist );
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ class CNpcSpiderCrabEnemy : public CNpcEnemy
|
||||||
public:
|
public:
|
||||||
virtual void postInit();
|
virtual void postInit();
|
||||||
protected:
|
protected:
|
||||||
|
virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange );
|
||||||
virtual bool processSensor();
|
virtual bool processSensor();
|
||||||
virtual void processClose( int _frames );
|
virtual void processClose( int _frames );
|
||||||
virtual void processCollision();
|
virtual void processCollision();
|
||||||
|
|
|
@ -253,6 +253,10 @@ SOURCE=..\..\..\source\enemy\noilblob.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\enemy\npbug.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\..\source\enemy\npbug.h
|
SOURCE=..\..\..\source\enemy\npbug.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue