diff --git a/source/enemy/ngpirate.cpp b/source/enemy/ngpirate.cpp index dfcda608e..53d48e65e 100644 --- a/source/enemy/ngpirate.cpp +++ b/source/enemy/ngpirate.cpp @@ -23,6 +23,10 @@ #include "player\player.h" #endif +#ifndef __PROJECTL_PROJECTL_H__ +#include "projectl\projectl.h" +#endif + void CNpc::processCloseGhostPirateAttack( int _frames ) { @@ -47,7 +51,26 @@ void CNpc::processCloseGhostPirateAttack( int _frames ) { m_extendDir = EXTEND_DOWN; - // fire too + // fire + + s16 heading; + + CPlayer *player = GameScene.getPlayer(); + DVECTOR playerPos = player->getPos(); + + if ( playerPos.vx > Pos.vx ) + { + heading = 0; + } + else + { + heading = 2048; + } + + CProjectile *projectile; + + projectile = new( "test projectile" ) CProjectile; + projectile->init( Pos, heading ); } } else if ( m_extendDir == EXTEND_DOWN ) diff --git a/source/enemy/npc.cpp b/source/enemy/npc.cpp index 7113f11cd..d902bf09b 100644 --- a/source/enemy/npc.cpp +++ b/source/enemy/npc.cpp @@ -332,7 +332,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] = }, { // NPC_GHOST_PIRATE - NPC_INIT_DEFAULT, + NPC_INIT_GHOST_PIRATE, NPC_SENSOR_GHOST_PIRATE_USER_CLOSE, NPC_MOVEMENT_STATIC, NPC_MOVEMENT_MODIFIER_NONE, @@ -383,7 +383,7 @@ CNpc::NPC_DATA CNpc::m_data[NPC_UNIT_TYPE_MAX] = void CNpc::init() { - m_type = NPC_ANEMONE_1; + m_type = NPC_GHOST_PIRATE; m_heading = m_fireHeading = 0; m_movementTimer = 0; @@ -397,11 +397,11 @@ void CNpc::init() m_timerFunc = m_data[this->m_type].timerFunc; m_sensorFunc = m_data[this->m_type].sensorFunc; + m_controlFunc = NPC_CONTROL_MOVEMENT; + switch ( m_data[this->m_type].initFunc ) { case NPC_INIT_DEFAULT: - m_controlFunc = NPC_CONTROL_MOVEMENT; - m_npcPath.initPath(); DVECTOR newPos; @@ -430,8 +430,10 @@ void CNpc::init() break; + case NPC_INIT_GHOST_PIRATE: + m_heading = m_fireHeading = 3072; + default: - m_controlFunc = NPC_CONTROL_MOVEMENT; break; } diff --git a/source/enemy/npc.h b/source/enemy/npc.h index 32441e592..cb488e27f 100644 --- a/source/enemy/npc.h +++ b/source/enemy/npc.h @@ -75,6 +75,7 @@ protected: NPC_INIT_DEFAULT = 0, NPC_INIT_SNAKE = 1, NPC_INIT_ACID, + NPC_INIT_GHOST_PIRATE, }; enum NPC_CONTROL_FUNC