This commit is contained in:
parent
aea2980e21
commit
7ea3e30162
1 changed files with 78 additions and 0 deletions
78
source/enemy/nclam.cpp
Normal file
78
source/enemy/nclam.cpp
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
nclam.cpp
|
||||||
|
|
||||||
|
Author: CRB
|
||||||
|
Created:
|
||||||
|
Project: Spongebob
|
||||||
|
Purpose:
|
||||||
|
|
||||||
|
Copyright (c) 2000 Climax Development Ltd
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
#ifndef __ENEMY_NPC_H__
|
||||||
|
#include "enemy\npc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GAME_GAME_H__
|
||||||
|
#include "game\game.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PLAYER_PLAYER_H__
|
||||||
|
#include "player\player.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void CNpc::processCloseClamAttack( int _frames )
|
||||||
|
{
|
||||||
|
s32 velocity;
|
||||||
|
|
||||||
|
if ( m_extendOut )
|
||||||
|
{
|
||||||
|
m_movementTimer -= _frames;
|
||||||
|
|
||||||
|
if ( m_movementTimer > 0 )
|
||||||
|
{
|
||||||
|
// extend
|
||||||
|
|
||||||
|
velocity = m_velocity * _frames;
|
||||||
|
|
||||||
|
m_extension += velocity;
|
||||||
|
|
||||||
|
Pos.vx += ( velocity * rcos( m_heading ) ) >> 12;
|
||||||
|
Pos.vy += ( velocity * rsin( m_heading ) ) >> 12;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_extendOut = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// retract
|
||||||
|
|
||||||
|
if ( m_extension > 0 )
|
||||||
|
{
|
||||||
|
velocity = -_frames;
|
||||||
|
|
||||||
|
if ( m_extension < _frames )
|
||||||
|
{
|
||||||
|
velocity = m_extension - _frames;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_extension += velocity;
|
||||||
|
|
||||||
|
|
||||||
|
Pos.vx += ( velocity * rcos( m_heading ) ) >> 12;
|
||||||
|
Pos.vy += ( velocity * rsin( m_heading ) ) >> 12;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->m_controlFunc = NPC_CONTROL_MOVEMENT;
|
||||||
|
this->m_timerFunc = NPC_TIMER_ATTACK_DONE;
|
||||||
|
this->m_timerTimer = GameState::getOneSecondInFrames();
|
||||||
|
this->m_sensorFunc = NPC_SENSOR_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue