From 891103611f212a69b23a2d0d80390a7879a5b16b Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 26 Apr 2001 15:20:21 +0000 Subject: [PATCH] --- makefile.gaz | 3 ++- source/enemy/nclam.cpp | 9 ++++++- source/enemy/nclam.h | 2 ++ source/enemy/nhcrab.cpp | 26 ++++++++++++++++++- source/enemy/nhcrab.h | 1 + source/enemy/npbug.h | 6 +++++ source/enemy/npc.cpp | 2 ++ source/enemy/npc.h | 1 + source/enemy/npcdata.cpp | 2 +- source/enemy/nscrab.cpp | 26 +++++++++++++++++++ source/enemy/nscrab.h | 1 + .../spongebob project/spongebob project.dsp | 4 +++ 12 files changed, 79 insertions(+), 4 deletions(-) diff --git a/makefile.gaz b/makefile.gaz index cd1a25b3a..2f36beb2e 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -79,7 +79,8 @@ enemy_src := npc \ npuffa \ ngen \ nsdart \ - ndustdev + ndustdev \ + npbug platform_src := platform \ platdata \ diff --git a/source/enemy/nclam.cpp b/source/enemy/nclam.cpp index 2320f706b..c24627811 100644 --- a/source/enemy/nclam.cpp +++ b/source/enemy/nclam.cpp @@ -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; } } diff --git a/source/enemy/nclam.h b/source/enemy/nclam.h index 7a825b87a..d2fdcb64f 100644 --- a/source/enemy/nclam.h +++ b/source/enemy/nclam.h @@ -23,6 +23,8 @@ protected: class CNpcJumpingClamEnemy : public CNpcClamEnemy { +public: + virtual void postInit(); protected: virtual void processClose( int _frames ); }; diff --git a/source/enemy/nhcrab.cpp b/source/enemy/nhcrab.cpp index a05db3bc1..a5e4fe804 100644 --- a/source/enemy/nhcrab.cpp +++ b/source/enemy/nhcrab.cpp @@ -204,4 +204,28 @@ void CNpcHermitCrabEnemy::processClose( int _frames ) default: break; } -} \ No newline at end of file +} + +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; +} diff --git a/source/enemy/nhcrab.h b/source/enemy/nhcrab.h index c7beb0677..31ac3a597 100644 --- a/source/enemy/nhcrab.h +++ b/source/enemy/nhcrab.h @@ -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 ); diff --git a/source/enemy/npbug.h b/source/enemy/npbug.h index 2f046c038..fbf93d277 100644 --- a/source/enemy/npbug.h +++ b/source/enemy/npbug.h @@ -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 diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index dca716bbc..32657cb6c 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -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 ); } } } diff --git a/source/enemy/npc.h b/source/enemy/npc.h index 0566f4839..2b6870d4c 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -358,6 +358,7 @@ protected: virtual void collidedWith(CThing *_thisThing); u8 m_isShuttingDown; + s16 m_drawRotation; // position history stuff diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index 88033c7be..11e702248 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -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, diff --git a/source/enemy/nscrab.cpp b/source/enemy/nscrab.cpp index c30d05e6e..0009c2661 100644 --- a/source/enemy/nscrab.cpp +++ b/source/enemy/nscrab.cpp @@ -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; +} diff --git a/source/enemy/nscrab.h b/source/enemy/nscrab.h index ebe095543..5bb889d37 100644 --- a/source/enemy/nscrab.h +++ b/source/enemy/nscrab.h @@ -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(); diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index 9f5737575..218b63918 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -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