2001-04-19 01:12:24 +02:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
ngen.cpp
|
|
|
|
|
|
|
|
Author: CRB
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2001 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
2001-04-20 00:09:59 +02:00
|
|
|
#ifndef __ENEMY_NPC_H__
|
|
|
|
#include "enemy\npc.h"
|
|
|
|
#endif
|
|
|
|
|
2001-04-19 01:12:24 +02:00
|
|
|
#ifndef __ENEMY_NGEN_H__
|
|
|
|
#include "enemy\ngen.h"
|
|
|
|
#endif
|
|
|
|
|
2001-04-20 00:09:59 +02:00
|
|
|
#ifndef __ENEMY_NSCRAB_H__
|
|
|
|
#include "enemy\nscrab.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __GAME_GAME_H__
|
|
|
|
#include "game\game.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-04-26 23:29:44 +02:00
|
|
|
void CNpcEnemyGenerator::shutdown()
|
|
|
|
{
|
|
|
|
deleteAllChild();
|
|
|
|
CNpcEnemy::shutdown();
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-04-20 00:09:59 +02:00
|
|
|
void CNpcEnemyGenerator::think(int _frames)
|
|
|
|
{
|
|
|
|
if ( getNumChildren() < 3 )
|
|
|
|
{
|
|
|
|
m_movementTimer -= _frames;
|
|
|
|
|
|
|
|
if ( m_movementTimer < 0 )
|
|
|
|
{
|
|
|
|
m_movementTimer = 3 * GameState::getOneSecondInFrames();
|
|
|
|
|
|
|
|
CNpcEnemy *enemy;
|
2001-06-13 21:13:55 +02:00
|
|
|
enemy=CNpcEnemy::Create( CNpcEnemy::NPC_SPIDER_CRAB );
|
2001-06-28 21:31:56 +02:00
|
|
|
enemy->setStartPosHighRes( Pos.vx, Pos.vy - 8 );
|
2001-04-20 00:09:59 +02:00
|
|
|
|
2001-05-30 00:07:28 +02:00
|
|
|
u16 *waypointPtr = m_npcPath.getWaypointPtr();
|
2001-04-20 00:09:59 +02:00
|
|
|
|
2001-05-30 00:07:28 +02:00
|
|
|
// skip first waypoint
|
|
|
|
waypointPtr++;
|
|
|
|
waypointPtr++;
|
2001-04-20 00:09:59 +02:00
|
|
|
|
2001-05-30 00:07:28 +02:00
|
|
|
enemy->setWaypointCount( m_npcPath.getWaypointCount() - 1 );
|
|
|
|
enemy->setWaypointPtr( waypointPtr );
|
2001-04-20 00:09:59 +02:00
|
|
|
|
|
|
|
enemy->setPathType( m_npcPath.getPathType() );
|
|
|
|
enemy->postInit();
|
2001-06-26 21:23:55 +02:00
|
|
|
enemy->setThinkArea();
|
2001-06-13 21:13:55 +02:00
|
|
|
enemy->updateCollisionArea();
|
2001-04-20 00:09:59 +02:00
|
|
|
|
|
|
|
addChild( enemy );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-19 01:12:24 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void CNpcEnemyGenerator::render()
|
|
|
|
{
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-04-24 21:03:06 +02:00
|
|
|
void CNpcEnemyGenerator::processEnemyCollision( CThing *thisThing )
|
|
|
|
{
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|