diff --git a/makefile.gaz b/makefile.gaz index 5736aa8d0..f7c16fb43 100644 --- a/makefile.gaz +++ b/makefile.gaz @@ -108,7 +108,8 @@ platform_src := platform \ pdual \ pfgen \ pfallnor \ - praft + praft \ + plantern hazard_src := hazard \ hfalling \ diff --git a/source/enemy/ndogfish.cpp b/source/enemy/ndogfish.cpp index de4516d5a..ed92e36b4 100644 --- a/source/enemy/ndogfish.cpp +++ b/source/enemy/ndogfish.cpp @@ -276,98 +276,22 @@ void CNpcIronDogfishEnemy::processClose( int _frames ) } } -void CNpcIronDogfishEnemy::collidedWith(CThing *_thisThing) +void CNpcIronDogfishEnemy::processAttackCollision() { - if ( m_isActive && !m_isCaught ) + switch( m_animNo ) { - switch(_thisThing->getThingType()) + case ANIM_IRONDOGFISH_PUNCH: + case ANIM_IRONDOGFISH_TAILSMASH: { - case TYPE_PLAYER: - { - CPlayer *player = (CPlayer *) _thisThing; + // only detect collision if in attack mode - ATTACK_STATE playerState = player->getAttackState(); + m_oldControlFunc = m_controlFunc; + m_controlFunc = NPC_CONTROL_COLLISION; - switch( playerState ) - { - case ATTACK_STATE__NONE: - { - if ( !player->isRecoveringFromHit() ) - { - switch( m_data[m_type].detectCollision ) - { - case DETECT_NO_COLLISION: - { - // ignore - - break; - } - - case DETECT_ALL_COLLISION: - { - m_oldControlFunc = m_controlFunc; - m_controlFunc = NPC_CONTROL_COLLISION; - - break; - } - - case DETECT_ATTACK_COLLISION_GENERIC: - { - switch( m_animNo ) - { - case ANIM_IRONDOGFISH_PUNCH: - case ANIM_IRONDOGFISH_TAILSMASH: - { - // only detect collision if in attack mode - - m_oldControlFunc = m_controlFunc; - m_controlFunc = NPC_CONTROL_COLLISION; - - break; - } - - default: - break; - } - } - } - } - - break; - } - - default: - { - // player is attacking, respond appropriately - - if ( m_controlFunc != NPC_CONTROL_SHOT ) - { - m_controlFunc = NPC_CONTROL_SHOT; - m_state = NPC_GENERIC_HIT_CHECK_HEALTH; - } - - break; - } - } - - break; - } - - case TYPE_ENEMY: - { - CNpcEnemy *enemy = (CNpcEnemy *) _thisThing; - - if ( enemy->canCollideWithEnemy() ) - { - processEnemyCollision( _thisThing ); - } - - break; - } - - default: - ASSERT(0); - break; + break; } + + default: + break; } } diff --git a/source/enemy/ndogfish.h b/source/enemy/ndogfish.h index 97be5dbbb..e17bca013 100644 --- a/source/enemy/ndogfish.h +++ b/source/enemy/ndogfish.h @@ -24,7 +24,7 @@ protected: virtual void processMovement( int _frames ); void processStandardIronDogfishAttack( int _frames ); void processWalkToUser( int _frames, int speed ); - virtual void collidedWith(CThing *_thisThing); + virtual void processAttackCollision(); enum NPC_IRON_DOGFISH_STATE { diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index 0f04c4cdf..d40fb9029 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -813,6 +813,20 @@ void CNpcEnemy::think(int _frames) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +void CNpcEnemy::processAttackCollision() +{ + //if ( m_controlFunc == NPC_CONTROL_CLOSE && m_data[m_type].closeFunc != NPC_CLOSE_NONE ) + if ( m_controlFunc == NPC_CONTROL_CLOSE ) + { + // only detect collision if in attack mode + + m_oldControlFunc = m_controlFunc; + m_controlFunc = NPC_CONTROL_COLLISION; + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + void CNpcEnemy::collidedWith( CThing *_thisThing ) { if ( m_isActive && !m_isCaught ) @@ -850,14 +864,7 @@ void CNpcEnemy::collidedWith( CThing *_thisThing ) case DETECT_ATTACK_COLLISION_GENERIC: { - //if ( m_controlFunc == NPC_CONTROL_CLOSE && m_data[m_type].closeFunc != NPC_CLOSE_NONE ) - if ( m_controlFunc == NPC_CONTROL_CLOSE ) - { - // only detect collision if in attack mode - - m_oldControlFunc = m_controlFunc; - m_controlFunc = NPC_CONTROL_COLLISION; - } + processAttackCollision(); break; } diff --git a/source/enemy/npc.h b/source/enemy/npc.h index e5812f826..dd6741e88 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -236,6 +236,7 @@ protected: virtual void processShot(); virtual void processClose( int _frames ); virtual void processCollision(); + virtual void processAttackCollision(); void processTimer( int _frames ); bool isCollisionWithGround(); diff --git a/source/enemy/npcdata.cpp b/source/enemy/npcdata.cpp index 57ebce3a9..b78423f19 100644 --- a/source/enemy/npcdata.cpp +++ b/source/enemy/npcdata.cpp @@ -784,7 +784,7 @@ CNpcEnemy::NPC_DATA CNpcEnemy::m_data[NPC_UNIT_TYPE_MAX] = false, 3, 256, - DETECT_NO_COLLISION, + DETECT_ALL_COLLISION, DAMAGE__SHOCK_ENEMY, 256, 0, diff --git a/source/platform/platdata.cpp b/source/platform/platdata.cpp index fc842ce52..81d8ec5bc 100644 --- a/source/platform/platdata.cpp +++ b/source/platform/platdata.cpp @@ -286,6 +286,18 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] = NPC_PLATFORM_TIMER_NONE, }, + { // NPC_LANTERN_PLATFORM + 3, + 128, + true, + DAMAGE__NONE, + 0, + 4, + NPC_PLATFORM_INFINITE_LIFE, + 0, + NPC_PLATFORM_TIMER_NONE, + }, + { // NPC_PLAYER_BUBBLE_PLATFORM 3, 128, @@ -322,5 +334,6 @@ CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATF NPC_CRATE_GENERATOR, NPC_RAFT_PLATFORM, NPC_VERTICAL_OILDRUM_GENERATOR, + NPC_LANTERN_PLATFORM, NPC_PLAYER_BUBBLE_PLATFORM, }; diff --git a/source/platform/platform.cpp b/source/platform/platform.cpp index 3f2c838ae..53f1aed76 100644 --- a/source/platform/platform.cpp +++ b/source/platform/platform.cpp @@ -115,6 +115,10 @@ #include "platform\praft.h" #endif +#ifndef __PLATFORM_PLANTERN_H__ +#include "platform\plantern.h" +#endif + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -264,6 +268,12 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform) break; } + case NPC_LANTERN_PLATFORM: + { + platform = new ("lantern platform") CNpcLanternPlatform; + break; + } + default: { ASSERT( 0 ); diff --git a/source/platform/platform.h b/source/platform/platform.h index f1f99b087..b7ad3cbd8 100644 --- a/source/platform/platform.h +++ b/source/platform/platform.h @@ -74,6 +74,7 @@ public: NPC_RAFT_PLATFORM, NPC_VERTICAL_OILDRUM_GENERATOR, NPC_VERTICAL_OILDRUM_PLATFORM, + NPC_LANTERN_PLATFORM, NPC_PLAYER_BUBBLE_PLATFORM, NPC_PLATFORM_TYPE_MAX, }; diff --git a/tools/Data/bin/MkLevel.ini b/tools/Data/bin/MkLevel.ini index e372b515d..27a9176cb 100644 --- a/tools/Data/bin/MkLevel.ini +++ b/tools/Data/bin/MkLevel.ini @@ -102,6 +102,7 @@ DualPlatform=16 Wooden=6 Raft=19 VertOilDrumGenerator=20 +SwingingLantern=21 ################################################ # Triggers diff --git a/tools/MapEdit/platform.ini b/tools/MapEdit/platform.ini index e28b878f3..0a2a475bc 100644 --- a/tools/MapEdit/platform.ini +++ b/tools/MapEdit/platform.ini @@ -82,3 +82,6 @@ Gfx=..\..\Graphics\platforms\raft\raft.gin [VertOildrumGenerator] Gfx=..\..\Graphics\platforms\vert_Oildrum\vert_Oildrum.gin +[SwingingLantern] +Gfx=..\..\Graphics\platforms\wooden\wooden.gin + diff --git a/users/paul/spongebob project/spongebob project.dsp b/users/paul/spongebob project/spongebob project.dsp index a1561f741..897541a3b 100644 --- a/users/paul/spongebob project/spongebob project.dsp +++ b/users/paul/spongebob project/spongebob project.dsp @@ -1185,6 +1185,14 @@ SOURCE=..\..\..\source\platform\pgeyser.h # End Source File # Begin Source File +SOURCE=..\..\..\source\platform\plantern.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\source\platform\plantern.h +# End Source File +# Begin Source File + SOURCE=..\..\..\source\platform\platdata.cpp # End Source File # Begin Source File