diff --git a/source/enemy/nsshark.cpp b/source/enemy/nsshark.cpp index 104371d3a..5046fe728 100644 --- a/source/enemy/nsshark.cpp +++ b/source/enemy/nsshark.cpp @@ -88,7 +88,7 @@ void CNpcSubSharkEnemy::processMovement( int _frames ) CProjectile *projectile; projectile = CProjectile::Create(); - projectile->init( Pos, 1024 ); + projectile->init( Pos, 1024, CProjectile::PROJECTILE_MINE, CProjectile::PROJECTILE_FINITE_LIFE ); m_salvoCount--; diff --git a/source/projectl/projectl.cpp b/source/projectl/projectl.cpp index 07d743c77..740b5e627 100644 --- a/source/projectl/projectl.cpp +++ b/source/projectl/projectl.cpp @@ -46,7 +46,9 @@ #ifndef __ENEMY_NPC_H__ #include "enemy\npc.h" #endif + #include "gfx\otpos.h" +#include "fx\fx.h" //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -347,6 +349,20 @@ void CProjectile::think(int _frames) break; } + case PROJECTILE_MINE: + { + s32 moveY = _frames * m_speed; + + s32 groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy + moveY, 16 ); + + if ( groundHeight < 0 ) + { + moveY = groundHeight; + } + + Pos.vy += moveY; + } + case PROJECTILE_DUMBFIRE: default: { @@ -371,6 +387,11 @@ void CProjectile::think(int _frames) if ( m_lifetime <= 0 ) { setToShutdown(); + + if ( m_movementType == PROJECTILE_MINE ) + { + CFX::Create( CFX::FX_TYPE_EXPLODE, Pos ); + } } } } @@ -434,6 +455,11 @@ void CProjectile::collidedWith(CThing *_thisThing) if ( m_lifetimeType != PROJECTILE_INFINITE_LIFE ) { setToShutdown(); + + if ( m_movementType == PROJECTILE_MINE ) + { + CFX::Create( CFX::FX_TYPE_EXPLODE, Pos ); + } } break; diff --git a/source/projectl/projectl.h b/source/projectl/projectl.h index df407879e..2643b3a46 100644 --- a/source/projectl/projectl.h +++ b/source/projectl/projectl.h @@ -29,6 +29,7 @@ public: PROJECTILE_DUMBFIRE = 1, PROJECTILE_USER_SEEK, PROJECTILE_GAS_CLOUD, + PROJECTILE_MINE, }; enum PROJECTILE_LIFETIME_TYPE