diff --git a/source/enemy/nclam.cpp b/source/enemy/nclam.cpp index a566a0f75..6d9d2c124 100644 --- a/source/enemy/nclam.cpp +++ b/source/enemy/nclam.cpp @@ -131,14 +131,61 @@ void CNpcJumpingClamEnemy::processClose( int _frames ) } } +void CNpcStaticClamEnemy::postInit() +{ + CNpcClamEnemy::postInit(); + + m_isStunned = false; + m_isAnimating = false; +} + void CNpcStaticClamEnemy::processClose( int _frames ) { - if ( !m_animPlaying ) + if ( !m_isAnimating && !m_isStunned ) { m_animPlaying = true; m_animNo = ANIM_CLAM_SIDESNAP; m_frame = 0; + m_isAnimating = true; + } + else if ( !m_animPlaying ) + { + m_controlFunc = NPC_CONTROL_MOVEMENT; + m_animNo = m_data[m_type].initAnim; + m_frame = 0; + m_isAnimating = false; + } +} + +void CNpcStaticClamEnemy::processShot() +{ + if ( !m_isStunned ) + { + switch( m_data[m_type].shotFunc ) + { + case NPC_SHOT_NONE: + { + // do nothing + + break; + } + + case NPC_SHOT_GENERIC: + { + m_isStunned = true; + + break; + } + } } m_controlFunc = NPC_CONTROL_MOVEMENT; } + +void CNpcStaticClamEnemy::collidedWith( CThing *_thisThing ) +{ + if ( !m_isStunned ) + { + CNpcClamEnemy::collidedWith( _thisThing ); + } +} diff --git a/source/enemy/nclam.h b/source/enemy/nclam.h index 1c526fabf..9054900b0 100644 --- a/source/enemy/nclam.h +++ b/source/enemy/nclam.h @@ -29,8 +29,15 @@ protected: class CNpcStaticClamEnemy : public CNpcClamEnemy { +public: + virtual void postInit(); protected: + virtual void collidedWith(CThing *_thisThing); + virtual void processShot(); virtual void processClose( int _frames ); + + u8 m_isStunned; + u8 m_isAnimating; }; #endif \ No newline at end of file diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index 0a0d9538c..f5bef922a 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -833,9 +833,8 @@ void CNpcEnemy::think(int _frames) s32 frameShift = ( _frames << 8 ) >> 1; - if ( ( frameCount << 8 ) - m_frame > frameShift ) //( _frames >> 1 ) ) + if ( ( frameCount << 8 ) - m_frame > frameShift ) { - //m_frame += _frames >> 1; m_frame += frameShift; } else @@ -853,7 +852,16 @@ void CNpcEnemy::think(int _frames) case NPC_CONTROL_MOVEMENT: if ( !processSensor() ) { - processMovement(_frames); + int moveFrames = _frames; + + if ( moveFrames > 2 ) + { + // make sure enemies don't go berserk if too many frames are dropped + + moveFrames = 2; + } + + processMovement( moveFrames ); } else { @@ -1122,11 +1130,6 @@ bool CNpcEnemy::processSensor() void CNpcEnemy::processMovement(int _frames) { - //if ( _frames > 2 ) - //{ - //_frames = 2; - //} - s32 moveX = 0, moveY = 0; s32 moveVel = 0; s32 moveDist = 0; diff --git a/source/enemy/npc.h b/source/enemy/npc.h index 8eaff4028..0fd5305b1 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -293,7 +293,7 @@ protected: virtual bool processSensor(); virtual void processMovement( int _frames ); virtual void processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange ); - void processShot(); + virtual void processShot(); virtual void processClose( int _frames ); virtual void processCollision(); void processTimer( int _frames ); diff --git a/source/enemy/nscrab.cpp b/source/enemy/nscrab.cpp index 79705806b..c30d05e6e 100644 --- a/source/enemy/nscrab.cpp +++ b/source/enemy/nscrab.cpp @@ -271,11 +271,6 @@ void CNpcSpiderCrabEnemy::processSpiderCrabInitJumpMovement( int _frames ) void CNpcSpiderCrabEnemy::processMovement(int _frames) { - if ( _frames > 2 ) - { - _frames = 2; - } - s32 moveX = 0, moveY = 0; s32 moveVel = 0; s32 moveDist = 0; diff --git a/source/thing/thing.cpp b/source/thing/thing.cpp index 16b4762a6..740d266b3 100644 --- a/source/thing/thing.cpp +++ b/source/thing/thing.cpp @@ -360,11 +360,13 @@ void CThingManager::addToThingList(CThing *_this) Params: Returns: ---------------------------------------------------------------------- */ +int testTypeGit; void CThingManager::removeFromThingList(CThing *_this) { CThing *prevThing,*thing; prevThing=NULL; + testTypeGit = _this->getThingType(); thing=s_thingLists[_this->getThingType()]; while(thing!=_this) { diff --git a/tools/Data/bin/MkLevel.ini b/tools/Data/bin/MkLevel.ini index 79a0aab3c..23b6b84ef 100644 --- a/tools/Data/bin/MkLevel.ini +++ b/tools/Data/bin/MkLevel.ini @@ -31,8 +31,8 @@ BabyOctopus=16 Ballblob=17 Boogermonster=18 Caterpillar=19 -Clam-Level1=20 -Clam-Level2=21 +JumpingClam=20 +StaticClam=21 Eyeball=22 Flamingskull=23 FlyingDutchman=24 diff --git a/tools/MapEdit/actor.ini b/tools/MapEdit/actor.ini index 4fe012001..2d3225bd9 100644 --- a/tools/MapEdit/actor.ini +++ b/tools/MapEdit/actor.ini @@ -189,23 +189,23 @@ Collision=0 Health=48 AttackStrength=20 -#[Clam-Level1] -#Gfx=..\..\graphics\characters\ -#WayPoints=16 -#Speed=0 -#TurnRate=0 -#Collision=1 -#Health=0 -#AttackStrength=20 +[JumpingClam] +Gfx=..\..\graphics\characters\clam\render\psx\clam_snapup0000.bmp +WayPoints=16 +Speed=0 +TurnRate=0 +Collision=1 +Health=0 +AttackStrength=20 -#[Clam-Level2] -#Gfx=..\..\graphics\characters\ -#WayPoints=16 -#Speed=0 -#TurnRate=0 -#Collision=1 -#Health=0 -#AttackStrength=20 +[StaticClam] +Gfx=..\..\graphics\characters\clam\render\psx\clam_sidesnap0000.bmp +WayPoints=16 +Speed=0 +TurnRate=0 +Collision=1 +Health=0 +AttackStrength=20 [Eyeball] Gfx=..\..\graphics\characters\eyeball\render\psx\EyeBall_Roll0000.bmp