2001-01-22 17:01:49 +01:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
nanemone.cpp
|
|
|
|
|
|
|
|
Author: CRB
|
2001-04-26 23:29:44 +02:00
|
|
|
Created:
|
2001-01-22 17:01:49 +01:00
|
|
|
Project: Spongebob
|
2001-04-26 23:29:44 +02:00
|
|
|
Purpose:
|
2001-01-22 17:01:49 +01:00
|
|
|
|
|
|
|
Copyright (c) 2000 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
#ifndef __ENEMY_NPC_H__
|
|
|
|
#include "enemy\npc.h"
|
|
|
|
#endif
|
|
|
|
|
2001-04-20 00:09:59 +02:00
|
|
|
#ifndef __ENEMY_NANEMONE_H__
|
|
|
|
#include "enemy\nanemone.h"
|
|
|
|
#endif
|
|
|
|
|
2001-01-22 17:01:49 +01:00
|
|
|
#ifndef __PROJECTL_PROJECTL_H__
|
|
|
|
#include "projectl\projectl.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __GAME_GAME_H__
|
|
|
|
#include "game\game.h"
|
|
|
|
#endif
|
|
|
|
|
2001-05-03 22:47:20 +02:00
|
|
|
#ifndef __VID_HEADER_
|
|
|
|
#include "system\vid.h"
|
|
|
|
#endif
|
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
#ifndef __UTILS_HEADER__
|
|
|
|
#include "utils\utils.h"
|
|
|
|
#endif
|
|
|
|
|
2001-01-22 18:44:58 +01:00
|
|
|
#ifndef __PLAYER_PLAYER_H__
|
|
|
|
#include "player\player.h"
|
|
|
|
#endif
|
|
|
|
|
2001-04-26 23:15:36 +02:00
|
|
|
#ifndef __ANIM_ANENOME_HEADER__
|
|
|
|
#include <ACTOR_ANENOME_ANIM.h>
|
2001-04-02 17:52:09 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __ANIM_SPIKEYANENOME_HEADER__
|
|
|
|
#include <ACTOR_SPIKEYANENOME_ANIM.h>
|
|
|
|
#endif
|
|
|
|
|
2001-05-03 22:47:20 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-04-26 23:29:44 +02:00
|
|
|
void CNpcAnemoneEnemy::postInit()
|
|
|
|
{
|
|
|
|
CNpcEnemy::postInit();
|
|
|
|
m_drawRotation = m_heading + 1024;
|
|
|
|
}
|
|
|
|
|
2001-05-03 22:47:20 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-04-24 21:03:06 +02:00
|
|
|
void CNpcAnemoneEnemy::processEnemyCollision( CThing *thisThing )
|
|
|
|
{
|
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
2001-05-03 22:47:20 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-04-20 00:09:59 +02:00
|
|
|
bool CNpcAnemoneEnemy::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 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-05-03 22:47:20 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-04-20 16:48:15 +02:00
|
|
|
void CNpcAnemone1Enemy::processClose( int _frames )
|
2001-01-22 18:44:58 +01:00
|
|
|
{
|
|
|
|
s32 moveX, moveY;
|
|
|
|
s16 decDir, incDir, moveDist;
|
|
|
|
s16 maxTurnRate = m_data[m_type].turnSpeed;
|
|
|
|
bool withinRange = false;
|
|
|
|
|
2001-02-07 17:42:13 +01:00
|
|
|
s16 headingToPlayer = ratan2( playerYDist, playerXDist );
|
2001-01-22 18:44:58 +01:00
|
|
|
|
2001-01-22 20:14:00 +01:00
|
|
|
decDir = m_fireHeading - headingToPlayer;
|
2001-01-22 18:44:58 +01:00
|
|
|
|
|
|
|
if ( decDir < 0 )
|
|
|
|
{
|
|
|
|
decDir += ONE;
|
|
|
|
}
|
|
|
|
|
2001-01-22 20:14:00 +01:00
|
|
|
incDir = headingToPlayer - m_fireHeading;
|
2001-01-22 18:44:58 +01:00
|
|
|
|
|
|
|
if ( incDir < 0 )
|
|
|
|
{
|
|
|
|
incDir += ONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( decDir < incDir )
|
|
|
|
{
|
|
|
|
moveDist = decDir;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
moveDist = incDir;
|
|
|
|
}
|
|
|
|
|
|
|
|
// check user is within 45 degrees either way
|
|
|
|
|
|
|
|
if ( moveDist < 512 )
|
|
|
|
{
|
|
|
|
decDir = m_heading - headingToPlayer;
|
|
|
|
|
|
|
|
if ( decDir < 0 )
|
|
|
|
{
|
|
|
|
decDir += ONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
incDir = headingToPlayer - m_heading;
|
|
|
|
|
|
|
|
if ( incDir < 0 )
|
|
|
|
{
|
|
|
|
incDir += ONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( decDir < incDir )
|
|
|
|
{
|
|
|
|
moveDist = decDir;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
moveDist = incDir;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( moveDist < -maxTurnRate )
|
|
|
|
{
|
|
|
|
moveDist = -maxTurnRate;
|
|
|
|
}
|
|
|
|
else if ( moveDist > maxTurnRate )
|
|
|
|
{
|
|
|
|
moveDist = maxTurnRate;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
withinRange = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_heading += moveDist;
|
|
|
|
|
2001-04-18 18:34:17 +02:00
|
|
|
m_heading &= 4095;
|
2001-01-22 18:44:58 +01:00
|
|
|
|
|
|
|
if ( withinRange )
|
|
|
|
{
|
2001-04-18 18:34:17 +02:00
|
|
|
// can fire, start firing anim
|
2001-01-22 18:44:58 +01:00
|
|
|
|
2001-04-02 17:52:09 +02:00
|
|
|
if ( m_timerTimer <= 0 && !m_animPlaying )
|
2001-01-22 18:44:58 +01:00
|
|
|
{
|
2001-04-26 23:15:36 +02:00
|
|
|
if ( m_animNo != ANIM_ANENOME_FIRE )
|
2001-04-02 17:52:09 +02:00
|
|
|
{
|
|
|
|
m_animPlaying = true;
|
2001-04-26 23:15:36 +02:00
|
|
|
m_animNo = ANIM_ANENOME_FIRE;
|
2001-04-02 17:52:09 +02:00
|
|
|
m_frame = 0;
|
|
|
|
}
|
2001-04-18 18:34:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-04-26 23:15:36 +02:00
|
|
|
if ( !m_animPlaying || m_animNo != ANIM_ANENOME_FIRE )
|
2001-04-18 18:34:17 +02:00
|
|
|
{
|
|
|
|
m_animPlaying = true;
|
2001-04-26 23:15:36 +02:00
|
|
|
m_animNo = ANIM_ANENOME_FIRE;
|
2001-04-18 18:34:17 +02:00
|
|
|
m_frame = 0;
|
|
|
|
}
|
|
|
|
}
|
2001-04-02 17:52:09 +02:00
|
|
|
|
2001-04-18 18:34:17 +02:00
|
|
|
if ( withinRange )
|
|
|
|
{
|
|
|
|
if ( m_timerTimer <= 0 && !m_animPlaying )
|
|
|
|
{
|
2001-04-26 23:15:36 +02:00
|
|
|
if ( m_animNo == ANIM_ANENOME_FIRE )
|
2001-04-18 18:34:17 +02:00
|
|
|
{
|
|
|
|
// if firing anim is complete and user is still in range, fire projectile
|
2001-04-02 17:52:09 +02:00
|
|
|
|
2001-04-18 18:34:17 +02:00
|
|
|
CProjectile *projectile;
|
|
|
|
projectile = new( "test projectile" ) CProjectile;
|
|
|
|
projectile->init( Pos, m_heading );
|
|
|
|
projectile->setLayerCollision( m_layerCollision );
|
|
|
|
|
|
|
|
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
|
|
|
m_timerTimer = GameState::getOneSecondInFrames();
|
|
|
|
m_timerFunc = NPC_TIMER_ATTACK_DONE;
|
|
|
|
m_sensorFunc = NPC_SENSOR_NONE;
|
|
|
|
|
|
|
|
m_animPlaying = true;
|
2001-04-26 23:15:36 +02:00
|
|
|
m_animNo = ANIM_ANENOME_FIRE;
|
2001-04-18 18:34:17 +02:00
|
|
|
m_frame = 0;
|
2001-01-22 18:44:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-01-22 17:01:49 +01:00
|
|
|
|
2001-05-03 22:47:20 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-04-20 22:22:16 +02:00
|
|
|
void CNpcAnemone2Enemy::postInit()
|
|
|
|
{
|
|
|
|
CProjectile *projectile;
|
|
|
|
s16 heading;
|
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
MATRIX mtx;
|
|
|
|
SetIdentNoTrans(&mtx );
|
|
|
|
RotMatrixZ( m_heading, &mtx );
|
|
|
|
|
2001-04-20 22:22:16 +02:00
|
|
|
for ( int fireLoop = 0 ; fireLoop < 5 ; fireLoop++ )
|
|
|
|
{
|
|
|
|
DVECTOR spikePos;
|
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
s16 relativeHeading = -1024 + ( fireLoop * 512 );
|
|
|
|
|
|
|
|
heading = m_heading + relativeHeading;
|
2001-04-20 22:22:16 +02:00
|
|
|
heading &= 4095;
|
|
|
|
|
|
|
|
spikePos = Pos;
|
2001-04-26 23:29:44 +02:00
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
//s16 multiplier, multiplier2;
|
|
|
|
s16 xDiff, yDiff;
|
|
|
|
SVECTOR offset;
|
|
|
|
VECTOR result;
|
|
|
|
|
|
|
|
// move base position
|
|
|
|
|
2001-04-26 23:29:44 +02:00
|
|
|
spikePos.vx += ( 10 * rcos( m_heading ) ) >> 12;
|
|
|
|
spikePos.vy += ( 10 * rsin( m_heading ) ) >> 12;
|
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
// move appropriate to scaling (anemone origin is 90 degrees off, hence:)
|
|
|
|
|
|
|
|
xDiff = ( m_scaleY * 40 ) >> 12;
|
|
|
|
yDiff = ( m_scaleX * 40 ) >> 12;
|
|
|
|
|
|
|
|
offset.vx = ( xDiff * rcos( relativeHeading ) ) >> 12;
|
|
|
|
offset.vy = ( yDiff * rsin( relativeHeading ) ) >> 12;
|
|
|
|
|
|
|
|
ApplyMatrix( &mtx, &offset, &result );
|
|
|
|
|
|
|
|
spikePos.vx += result.vx;
|
|
|
|
spikePos.vy += result.vy;
|
2001-04-20 22:22:16 +02:00
|
|
|
|
|
|
|
projectile = new( "anemone lev2 projectile" ) CProjectile;
|
|
|
|
projectile->init( spikePos, heading, CProjectile::PROJECTILE_FIXED, CProjectile::PROJECTILE_INFINITE_LIFE );
|
|
|
|
projectile->setLayerCollision( m_layerCollision );
|
|
|
|
|
|
|
|
addChild( projectile );
|
|
|
|
}
|
2001-04-26 23:29:44 +02:00
|
|
|
|
|
|
|
m_drawRotation = m_heading + 1024;
|
2001-05-03 22:47:20 +02:00
|
|
|
|
|
|
|
m_scaleX = ONE;
|
|
|
|
m_scaleY = ONE;
|
2001-04-26 23:29:44 +02:00
|
|
|
}
|
|
|
|
|
2001-05-03 22:47:20 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-04-26 23:29:44 +02:00
|
|
|
void CNpcAnemone2Enemy::shutdown()
|
|
|
|
{
|
|
|
|
deleteAllChild();
|
|
|
|
CNpcEnemy::shutdown();
|
2001-04-20 22:22:16 +02:00
|
|
|
}
|
|
|
|
|
2001-05-03 22:47:20 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-04-20 16:48:15 +02:00
|
|
|
void CNpcAnemone2Enemy::processClose( int _frames )
|
2001-01-22 17:01:49 +01:00
|
|
|
{
|
|
|
|
int fireLoop;
|
|
|
|
CProjectile *projectile;
|
|
|
|
s16 heading;
|
|
|
|
|
2001-04-02 17:52:09 +02:00
|
|
|
if ( m_animNo != ANIM_SPIKEYANENOME_BODY )
|
2001-01-22 17:01:49 +01:00
|
|
|
{
|
2001-04-02 17:52:09 +02:00
|
|
|
m_animPlaying = true;
|
|
|
|
m_animNo = ANIM_SPIKEYANENOME_BODY;
|
|
|
|
m_frame = 0;
|
2001-01-22 17:01:49 +01:00
|
|
|
}
|
2001-04-02 17:52:09 +02:00
|
|
|
else
|
|
|
|
{
|
2001-04-04 17:53:44 +02:00
|
|
|
CProjectile *projectile;
|
|
|
|
s16 heading;
|
|
|
|
|
|
|
|
// fire off attached spikes
|
|
|
|
|
|
|
|
CThing *nextThing = Next;
|
|
|
|
|
|
|
|
while ( nextThing )
|
|
|
|
{
|
|
|
|
CProjectile *projectile;
|
|
|
|
|
|
|
|
projectile = (CProjectile *) nextThing;
|
|
|
|
|
|
|
|
if ( projectile->getMovementType() == CProjectile::PROJECTILE_FIXED )
|
|
|
|
{
|
|
|
|
projectile->setMovementType( CProjectile::PROJECTILE_DUMBFIRE );
|
|
|
|
projectile->setLifeTime( CProjectile::PROJECTILE_FINITE_LIFE );
|
|
|
|
projectile->setState( CProjectile::PROJECTILE_ATTACK );
|
|
|
|
}
|
|
|
|
|
|
|
|
nextThing = nextThing->getNext();
|
|
|
|
}
|
|
|
|
|
2001-04-12 18:33:48 +02:00
|
|
|
removeAllChild();
|
|
|
|
|
2001-04-04 17:53:44 +02:00
|
|
|
// attach new spikes
|
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
MATRIX mtx;
|
|
|
|
SetIdentNoTrans(&mtx );
|
|
|
|
RotMatrixZ( m_heading, &mtx );
|
|
|
|
|
2001-04-02 17:52:09 +02:00
|
|
|
for ( fireLoop = 0 ; fireLoop < 5 ; fireLoop++ )
|
|
|
|
{
|
2001-04-04 17:53:44 +02:00
|
|
|
DVECTOR spikePos;
|
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
s16 relativeHeading = -1024 + ( fireLoop * 512 );
|
|
|
|
|
|
|
|
heading = m_heading + relativeHeading;
|
2001-04-05 16:17:24 +02:00
|
|
|
heading &= 4095;
|
2001-01-22 17:01:49 +01:00
|
|
|
|
2001-04-04 17:53:44 +02:00
|
|
|
spikePos = Pos;
|
2001-04-26 23:29:44 +02:00
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
//s16 multiplier, multiplier2;
|
|
|
|
s16 xDiff, yDiff;
|
|
|
|
SVECTOR offset;
|
|
|
|
VECTOR result;
|
|
|
|
|
|
|
|
// move base position
|
|
|
|
|
2001-04-26 23:29:44 +02:00
|
|
|
spikePos.vx += ( 10 * rcos( m_heading ) ) >> 12;
|
|
|
|
spikePos.vy += ( 10 * rsin( m_heading ) ) >> 12;
|
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
// move appropriate to scaling (anemone origin is 90 degrees off, hence:)
|
|
|
|
|
|
|
|
xDiff = ( m_scaleY * 40 ) >> 12;
|
|
|
|
yDiff = ( m_scaleX * 40 ) >> 12;
|
|
|
|
|
|
|
|
offset.vx = ( xDiff * rcos( relativeHeading ) ) >> 12;
|
|
|
|
offset.vy = ( yDiff * rsin( relativeHeading ) ) >> 12;
|
|
|
|
|
|
|
|
ApplyMatrix( &mtx, &offset, &result );
|
|
|
|
|
|
|
|
spikePos.vx += result.vx;
|
|
|
|
spikePos.vy += result.vy;
|
2001-04-04 17:53:44 +02:00
|
|
|
|
|
|
|
projectile = new( "anemone lev2 projectile" ) CProjectile;
|
|
|
|
projectile->init( spikePos, heading, CProjectile::PROJECTILE_FIXED, CProjectile::PROJECTILE_INFINITE_LIFE );
|
2001-04-12 16:55:55 +02:00
|
|
|
projectile->setLayerCollision( m_layerCollision );
|
2001-04-04 17:53:44 +02:00
|
|
|
|
|
|
|
addChild( projectile );
|
2001-04-02 17:52:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
|
|
|
m_timerFunc = NPC_TIMER_ATTACK_DONE;
|
|
|
|
m_timerTimer = GameState::getOneSecondInFrames();
|
|
|
|
m_sensorFunc = NPC_SENSOR_NONE;
|
|
|
|
}
|
2001-02-08 16:34:18 +01:00
|
|
|
}
|
|
|
|
|
2001-05-03 22:47:20 +02:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void CNpcAnemone2Enemy::processMovementModifier( int _frames, s32 distX, s32 distY, s32 dist, s16 headingChange )
|
|
|
|
{
|
|
|
|
s32 maxTimer = GameState::getOneSecondInFrames() >> 1;
|
|
|
|
|
|
|
|
m_movementTimer += _frames;
|
|
|
|
|
|
|
|
if ( m_movementTimer > maxTimer )
|
|
|
|
{
|
|
|
|
m_movementTimer -= maxTimer;
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 sineVal = ( m_movementTimer * ONE ) / maxTimer;
|
|
|
|
|
|
|
|
m_scaleX = ONE + ( rsin( sineVal ) >> 2 );
|
|
|
|
m_scaleY = ONE + ( rcos( sineVal ) >> 2 );
|
|
|
|
|
|
|
|
CProjectile *projectile;
|
|
|
|
projectile = (CProjectile *) Next;
|
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
MATRIX mtx;
|
|
|
|
SetIdentNoTrans(&mtx );
|
|
|
|
RotMatrixZ( m_heading, &mtx );
|
|
|
|
|
2001-05-03 22:47:20 +02:00
|
|
|
for ( int fireLoop = 0 ; fireLoop < 5 ; fireLoop++ )
|
|
|
|
{
|
|
|
|
DVECTOR spikePos;
|
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
s16 relativeHeading = -1024 + ( fireLoop * 512 );
|
|
|
|
s16 heading = m_heading + relativeHeading;
|
2001-05-03 22:47:20 +02:00
|
|
|
heading &= 4095;
|
|
|
|
|
|
|
|
spikePos = Pos;
|
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
//s16 multiplier, multiplier2;
|
|
|
|
s16 xDiff, yDiff;
|
|
|
|
SVECTOR offset;
|
|
|
|
VECTOR result;
|
|
|
|
|
|
|
|
// move base position
|
2001-05-03 22:47:20 +02:00
|
|
|
|
|
|
|
spikePos.vx += ( 10 * rcos( m_heading ) ) >> 12;
|
|
|
|
spikePos.vy += ( 10 * rsin( m_heading ) ) >> 12;
|
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
// move appropriate to scaling (anemone origin is 90 degrees off, hence:)
|
|
|
|
|
|
|
|
xDiff = ( m_scaleY * 40 ) >> 12;
|
|
|
|
yDiff = ( m_scaleX * 40 ) >> 12;
|
|
|
|
|
|
|
|
offset.vx = ( xDiff * rcos( relativeHeading ) ) >> 12;
|
|
|
|
offset.vy = ( yDiff * rsin( relativeHeading ) ) >> 12;
|
2001-05-03 22:47:20 +02:00
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
ApplyMatrix( &mtx, &offset, &result );
|
2001-05-03 22:47:20 +02:00
|
|
|
|
2001-05-08 21:54:02 +02:00
|
|
|
spikePos.vx += result.vx;
|
|
|
|
spikePos.vy += result.vy;
|
2001-05-03 22:47:20 +02:00
|
|
|
|
|
|
|
if ( projectile )
|
|
|
|
{
|
|
|
|
projectile->setPos( spikePos );
|
|
|
|
projectile = (CProjectile *) projectile->getNext();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void CNpcAnemone2Enemy::render()
|
|
|
|
{
|
|
|
|
SprFrame = NULL;
|
|
|
|
|
|
|
|
if ( m_isActive )
|
|
|
|
{
|
|
|
|
CEnemyThing::render();
|
|
|
|
|
|
|
|
// Render
|
|
|
|
DVECTOR renderPos;
|
|
|
|
DVECTOR offset = CLevel::getCameraPos();
|
|
|
|
|
|
|
|
renderPos.vx = Pos.vx - offset.vx;
|
|
|
|
renderPos.vy = Pos.vy - offset.vy;
|
|
|
|
|
2001-05-05 16:58:49 +02:00
|
|
|
CRECT collisionRect = getCollisionArea();
|
|
|
|
collisionRect.x1 -= Pos.vx;
|
|
|
|
collisionRect.x2 -= Pos.vx;
|
|
|
|
collisionRect.y1 -= Pos.vy;
|
|
|
|
collisionRect.y2 -= Pos.vy;
|
|
|
|
|
|
|
|
if ( renderPos.vx + collisionRect.x2 >= 0 && renderPos.vx + collisionRect.x1 <= VidGetScrW() )
|
2001-05-03 22:47:20 +02:00
|
|
|
{
|
2001-05-05 16:58:49 +02:00
|
|
|
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
|
2001-05-03 22:47:20 +02:00
|
|
|
{
|
|
|
|
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),m_reversed);
|
|
|
|
m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, m_scaleX, m_scaleY );
|
|
|
|
|
|
|
|
sBBox boundingBox = m_actorGfx->GetBBox();
|
|
|
|
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );
|
|
|
|
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2001-04-20 16:48:15 +02:00
|
|
|
void CNpcAnemone3Enemy::processClose( int _frames )
|
2001-02-08 16:34:18 +01:00
|
|
|
{
|
2001-04-26 23:15:36 +02:00
|
|
|
if ( m_animNo != ANIM_ANENOME_FIRE )
|
2001-04-04 17:53:44 +02:00
|
|
|
{
|
|
|
|
m_animPlaying = true;
|
2001-04-26 23:15:36 +02:00
|
|
|
m_animNo = ANIM_ANENOME_FIRE;
|
2001-04-04 17:53:44 +02:00
|
|
|
m_frame = 0;
|
|
|
|
}
|
|
|
|
else if ( !m_animPlaying )
|
|
|
|
{
|
|
|
|
CProjectile *projectile;
|
|
|
|
u8 lifetime = 8;
|
|
|
|
|
|
|
|
projectile = new( "test projectile" ) CProjectile;
|
|
|
|
projectile->init( Pos,
|
|
|
|
m_fireHeading,
|
|
|
|
CProjectile::PROJECTILE_GAS_CLOUD,
|
|
|
|
CProjectile::PROJECTILE_FINITE_LIFE,
|
|
|
|
lifetime * GameState::getOneSecondInFrames() );
|
2001-04-12 16:55:55 +02:00
|
|
|
projectile->setLayerCollision( m_layerCollision );
|
2001-04-04 17:53:44 +02:00
|
|
|
|
|
|
|
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
|
|
|
m_timerFunc = NPC_TIMER_ATTACK_DONE;
|
|
|
|
m_timerTimer = ( lifetime + 4 ) * GameState::getOneSecondInFrames();
|
|
|
|
m_sensorFunc = NPC_SENSOR_NONE;
|
|
|
|
|
|
|
|
m_animPlaying = true;
|
2001-04-26 23:15:36 +02:00
|
|
|
m_animNo = ANIM_ANENOME_FIRE;
|
2001-04-04 17:53:44 +02:00
|
|
|
m_frame = 0;
|
|
|
|
}
|
2001-01-22 17:01:49 +01:00
|
|
|
}
|