SBSPSS/source/enemy/nffolk.cpp

84 lines
1.3 KiB
C++
Raw Normal View History

2001-02-05 15:53:51 +01:00
/*=========================================================================
nffolk.cpp
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_NFFOLK_H__
#include "enemy\nffolk.h"
#endif
2001-02-05 15:53:51 +01:00
#ifndef __UTILS_HEADER__
#include "utils\utils.h"
#endif
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
2001-04-20 22:22:16 +02:00
void CNpcFishFolk::postInit()
{
m_heading = m_fireHeading = 0;
DVECTOR newPos;
newPos.vx = 200;
newPos.vy = 400;
m_npcPath.addWaypoint( newPos );
newPos.vx = 500;
newPos.vy = 400;
m_npcPath.addWaypoint( newPos );
m_npcPath.setPathType( CNpcPath::PONG_PATH );
}
2001-04-20 16:48:15 +02:00
void CNpcFishFolk::processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange )
2001-02-05 15:53:51 +01:00
{
2001-02-22 16:39:38 +01:00
Pos.vy += distY;
2001-02-05 15:53:51 +01:00
if ( m_movementTimer > 0 )
{
Pos.vx += distX;
m_movementTimer -= _frames;
if ( m_movementTimer <= 0 )
{
m_timerTimer = GameState::getOneSecondInFrames() * ( ( getRnd() % 5 ) + 1 );
}
}
else
{
if ( m_timerTimer > 0 )
{
// pause and look around
m_timerTimer -= _frames;
}
else
{
if ( getRnd() % 2 )
{
m_npcPath.reversePathDir();
}
m_movementTimer = GameState::getOneSecondInFrames() * ( ( getRnd() & 10 ) + 4 );
}
}
}