2001-02-06 20:28:38 +01:00
|
|
|
/*=========================================================================
|
|
|
|
|
2001-04-20 16:48:15 +02:00
|
|
|
nfskull.cpp
|
2001-02-06 20:28:38 +01:00
|
|
|
|
|
|
|
Author: CRB
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2000 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
#ifndef __ENEMY_NPC_H__
|
|
|
|
#include "enemy\npc.h"
|
|
|
|
#endif
|
|
|
|
|
2001-04-20 16:48:15 +02:00
|
|
|
#ifndef __ENEMY_NFSKULL_H__
|
|
|
|
#include "enemy\nfskull.h"
|
|
|
|
#endif
|
|
|
|
|
2001-02-06 20:28:38 +01:00
|
|
|
#ifndef __PLAYER_PLAYER_H__
|
|
|
|
#include "player\player.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __GAME_GAME_H__
|
|
|
|
#include "game\game.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2001-04-24 21:03:06 +02:00
|
|
|
void CNpcFlamingSkullEnemy::processEnemyCollision( CThing *thisThing )
|
|
|
|
{
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
2001-04-20 16:48:15 +02:00
|
|
|
void CNpcFlamingSkullEnemy::postInit()
|
|
|
|
{
|
|
|
|
m_state = FLAMING_SKULL_ATTACK;
|
2001-05-16 21:04:40 +02:00
|
|
|
m_fireHeading = m_heading;
|
2001-04-20 16:48:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CNpcFlamingSkullEnemy::processSensor()
|
|
|
|
{
|
|
|
|
switch( m_sensorFunc )
|
|
|
|
{
|
|
|
|
case NPC_SENSOR_NONE:
|
|
|
|
return( false );
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
if ( playerXDistSqr + playerYDistSqr < 40000 )
|
|
|
|
{
|
|
|
|
m_controlFunc = NPC_CONTROL_CLOSE;
|
|
|
|
|
|
|
|
return( true );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return( false );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CNpcFlamingSkullEnemy::processClose( int _frames )
|
2001-02-06 20:28:38 +01:00
|
|
|
{
|
|
|
|
s32 distX, distY;
|
|
|
|
s32 distXSqr, distYSqr;
|
|
|
|
|
2001-06-18 21:06:43 +02:00
|
|
|
if ( m_soundId == NOT_PLAYING )
|
|
|
|
{
|
|
|
|
m_soundId = (int) CSoundMediator::playSfx( CSoundMediator::SFX_FLAMING_SKULL_ATTACK, true );
|
|
|
|
}
|
2001-06-01 18:30:37 +02:00
|
|
|
|
2001-02-06 20:28:38 +01:00
|
|
|
if ( m_state == FLAMING_SKULL_ATTACK )
|
|
|
|
{
|
|
|
|
processGenericGetUserDist( _frames, &distX, &distY );
|
|
|
|
|
|
|
|
distXSqr = distX * distX;
|
|
|
|
distYSqr = distY * distY;
|
|
|
|
|
|
|
|
if ( distXSqr + distYSqr < 400 )
|
|
|
|
{
|
|
|
|
m_state = FLAMING_SKULL_RETURN;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-05-09 23:27:23 +02:00
|
|
|
processGenericGotoTarget( _frames, distX, distY, m_speed );
|
2001-02-06 20:28:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
distX = m_base.vx - Pos.vx;
|
|
|
|
distY = m_base.vy - Pos.vy;
|
|
|
|
|
|
|
|
distXSqr = distX * distX;
|
|
|
|
distYSqr = distY * distY;
|
|
|
|
|
|
|
|
if ( distXSqr + distYSqr < 100 )
|
|
|
|
{
|
|
|
|
m_state = FLAMING_SKULL_ATTACK;
|
2001-02-09 20:44:36 +01:00
|
|
|
m_heading = m_fireHeading;
|
2001-02-06 20:28:38 +01:00
|
|
|
|
|
|
|
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
|
|
|
m_timerFunc = NPC_TIMER_ATTACK_DONE;
|
|
|
|
m_timerTimer = GameState::getOneSecondInFrames();
|
|
|
|
m_sensorFunc = NPC_SENSOR_NONE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-05-09 23:27:23 +02:00
|
|
|
processGenericGotoTarget( _frames, distX, distY, m_speed );
|
2001-02-06 20:28:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|