This commit is contained in:
Charles 2001-06-14 16:07:48 +00:00
parent 4c93823479
commit f701f34dc4
25 changed files with 264 additions and 276 deletions

View file

@ -239,7 +239,7 @@ void CNpcAnemone1Enemy::processClose( int _frames )
projPos.vy += rsin( m_heading ) >> 9; projPos.vy += rsin( m_heading ) >> 9;
CProjectile *projectile; CProjectile *projectile;
projectile = new( "test projectile" ) CProjectile; projectile = CProjectile::Create();
projectile->init( projPos, m_heading ); projectile->init( projPos, m_heading );
m_controlFunc = NPC_CONTROL_MOVEMENT; m_controlFunc = NPC_CONTROL_MOVEMENT;
@ -450,7 +450,7 @@ void CNpcAnemone2Enemy::processClose( int _frames )
spikePos.vx += result.vx; spikePos.vx += result.vx;
spikePos.vy += result.vy; spikePos.vy += result.vy;
projectile = new( "anemone lev2 projectile" ) CProjectile; projectile = CProjectile::Create();
projectile->init( spikePos, heading, CProjectile::PROJECTILE_DUMBFIRE, CProjectile::PROJECTILE_FINITE_LIFE ); projectile->init( spikePos, heading, CProjectile::PROJECTILE_DUMBFIRE, CProjectile::PROJECTILE_FINITE_LIFE );
projectile->setState( CProjectile::PROJECTILE_ATTACK ); projectile->setState( CProjectile::PROJECTILE_ATTACK );
projectile->setSpeed( 5 ); projectile->setSpeed( 5 );
@ -592,7 +592,7 @@ void CNpcAnemone3Enemy::processClose( int _frames )
projPos.vx += rcos( m_heading ) >> 9; projPos.vx += rcos( m_heading ) >> 9;
projPos.vy += rsin( m_heading ) >> 9; projPos.vy += rsin( m_heading ) >> 9;
projectile = new( "test projectile" ) CProjectile; projectile = CProjectile::Create();
projectile->init( projPos, projectile->init( projPos,
m_fireHeading, m_fireHeading,
CProjectile::PROJECTILE_GAS_CLOUD, CProjectile::PROJECTILE_GAS_CLOUD,

View file

@ -19,10 +19,6 @@
#include "enemy\nclam.h" #include "enemy\nclam.h"
#endif #endif
#ifndef __PLATFORM_PCLAM_H__
#include "platform\pclam.h"
#endif
#ifndef __PLATFORM_PLATFORM_H__ #ifndef __PLATFORM_PLATFORM_H__
#include "platform\platform.h" #include "platform\platform.h"
#endif #endif
@ -200,9 +196,10 @@ void CNpcStaticClamEnemy::postInit()
// create platform in same place // create platform in same place
CNpcClamPlatform *platform = new ("clam platform") CNpcClamPlatform; CNpcPlatform *platform;
platform = CNpcPlatform::Create( CNpcPlatform::NPC_CLAM_PLATFORM );
platform->setThingSubType(CNpcClamPlatform::NPC_CLAM_PLATFORM); platform->setThingSubType(CNpcPlatform::NPC_CLAM_PLATFORM);
platform->setGraphic( (u8) 0 ); platform->setGraphic( (u8) 0 );
platform->init( Pos ); platform->init( Pos );
platform->setTiltable( false ); platform->setTiltable( false );

View file

@ -220,7 +220,7 @@ void CNpcIronDogfishEnemy::processStandardIronDogfishAttack( int _frames )
s16 headingToPlayer = ratan2( playerYDist, playerXDist ) & 4095; s16 headingToPlayer = ratan2( playerYDist, playerXDist ) & 4095;
CProjectile *projectile; CProjectile *projectile;
projectile = new( "test projectile" ) CProjectile; projectile = CProjectile::Create();
DVECTOR startPos = Pos; DVECTOR startPos = Pos;
startPos.vy -= 20; startPos.vy -= 20;
projectile->init( startPos, headingToPlayer ); projectile->init( startPos, headingToPlayer );

View file

@ -60,7 +60,7 @@ void CNpcEyeballEnemy::postInit()
eyeballPos.vy += ( EYEBALL_DIST * rsin( m_heading ) ) >> 12; eyeballPos.vy += ( EYEBALL_DIST * rsin( m_heading ) ) >> 12;
CProjectile *projectile; CProjectile *projectile;
projectile = new ( "eyeball projectile" ) CProjectile; projectile = CProjectile::Create();
projectile->init( eyeballPos, m_fireHeading, CProjectile::PROJECTILE_FIXED, CProjectile::PROJECTILE_INFINITE_LIFE ); projectile->init( eyeballPos, m_fireHeading, CProjectile::PROJECTILE_FIXED, CProjectile::PROJECTILE_INFINITE_LIFE );
projectile->setGraphic( FRM_EYEBALL_STATIC ); projectile->setGraphic( FRM_EYEBALL_STATIC );
@ -130,7 +130,7 @@ CThing *Next=getNext();
eyeballPos.vy += ( EYEBALL_DIST * rsin( m_heading ) ) >> 12; eyeballPos.vy += ( EYEBALL_DIST * rsin( m_heading ) ) >> 12;
CProjectile *projectile; CProjectile *projectile;
projectile = new ( "eyeball projectile" ) CProjectile; projectile = CProjectile::Create();
projectile->init( eyeballPos, m_fireHeading, CProjectile::PROJECTILE_USER_SEEK, CProjectile::PROJECTILE_INFINITE_LIFE ); projectile->init( eyeballPos, m_fireHeading, CProjectile::PROJECTILE_USER_SEEK, CProjectile::PROJECTILE_INFINITE_LIFE );
projectile->setGraphic( FRM_EYEBALL_STATIC ); projectile->setGraphic( FRM_EYEBALL_STATIC );
projectile->setState( CProjectile::PROJECTILE_ATTACK ); projectile->setState( CProjectile::PROJECTILE_ATTACK );

View file

@ -180,7 +180,7 @@ void CNpcFlyingDutchmanEnemy::processClose( int _frames )
} }
CProjectile *projectile; CProjectile *projectile;
projectile = new( "test projectile" ) CProjectile; projectile = CProjectile::Create();
DVECTOR newPos = Pos; DVECTOR newPos = Pos;
newPos.vy -= 50; newPos.vy -= 50;
projectile->init( newPos, heading ); projectile->init( newPos, heading );

View file

@ -102,7 +102,7 @@ void CNpcGhostPirateEnemy::processClose( int _frames )
CProjectile *projectile; CProjectile *projectile;
projectile = new( "test projectile" ) CProjectile; projectile = CProjectile::Create();
projectile->init( Pos, heading ); projectile->init( Pos, heading );
} }
} }

View file

@ -347,10 +347,7 @@ void CNpcMotherJellyfishEnemy::spawnJellyfish( int _frames )
else else
{ {
CNpcEnemy *enemy; CNpcEnemy *enemy;
enemy = new( "jellyfish projectile" ) CNpcSmallJellyfishProjectileEnemy; enemy = CNpcEnemy::Create( NPC_PROJECTILE_JELLYFISH );
ASSERT(enemy);
enemy->setType( CNpcEnemy::NPC_PROJECTILE_JELLYFISH );
enemy->init();
enemy->setStartPos( Pos.vx >> 4, ( Pos.vy + 20 ) >> 4 ); enemy->setStartPos( Pos.vx >> 4, ( Pos.vy + 20 ) >> 4 );
enemy->setWaypointCount( m_npcPath.getWaypointCount() ); enemy->setWaypointCount( m_npcPath.getWaypointCount() );

View file

@ -199,6 +199,10 @@
#include "enemy\nbuttfly.h" #include "enemy\nbuttfly.h"
#endif #endif
#ifndef __ENEMY_NPROJJF_H__
#include "enemy\nprojjf.h"
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Enemy NPCs // Enemy NPCs
@ -450,6 +454,12 @@ CNpcEnemy *CNpcEnemy::Create(int enemyType)
break; break;
} }
case CNpcEnemy::NPC_PROJECTILE_JELLYFISH:
{
enemy = new ("projectile jellyfish") CNpcSmallJellyfishProjectileEnemy;
break;
}
default: default:
{ {
SYSTEM_DBGMSG("UNKNOWN %i\n",enemyType); SYSTEM_DBGMSG("UNKNOWN %i\n",enemyType);

View file

@ -100,7 +100,7 @@ void CNpcSquidDartEnemy::fireAsProjectile( s16 heading )
newPos.vy -= 10; newPos.vy -= 10;
CEnemyAsSpriteProjectile *projectile; CEnemyAsSpriteProjectile *projectile;
projectile = new( "blower projectile" ) CEnemyAsSpriteProjectile; projectile = CEnemyAsSpriteProjectile::Create();
projectile->init( newPos, projectile->init( newPos,
heading, heading,
CPlayerProjectile::PLAYER_PROJECTILE_DUMBFIRE, CPlayerProjectile::PLAYER_PROJECTILE_DUMBFIRE,

View file

@ -162,7 +162,7 @@ void CNpcSharkManEnemy::processClose( int _frames )
s16 heading = ratan2( yDist, xDist ) & 4095; s16 heading = ratan2( yDist, xDist ) & 4095;
CProjectile *projectile; CProjectile *projectile;
projectile = new( "shark man projectile" ) CProjectile; projectile = CProjectile::Create();
projectile->init( newPos, heading ); projectile->init( newPos, heading );
projectile->setGraphic( FRM__LIGHTNING2 ); projectile->setGraphic( FRM__LIGHTNING2 );

View file

@ -374,7 +374,7 @@ void CNpcSmallJellyfishEnemy::fireAsProjectile( s16 heading )
newPos.vy -= 10; newPos.vy -= 10;
CEnemyAsSpriteProjectile *projectile; CEnemyAsSpriteProjectile *projectile;
projectile = new( "blower projectile" ) CEnemyAsSpriteProjectile; projectile = CEnemyAsSpriteProjectile::Create();
projectile->init( newPos, projectile->init( newPos,
heading, heading,
CPlayerProjectile::PLAYER_PROJECTILE_DUMBFIRE, CPlayerProjectile::PLAYER_PROJECTILE_DUMBFIRE,

View file

@ -77,7 +77,7 @@ void CNpcSubSharkEnemy::processMovement( int _frames )
// drop mine // drop mine
CProjectile *projectile; CProjectile *projectile;
projectile = new( "test projectile" ) CProjectile; projectile = CProjectile::Create();
projectile->init( Pos, 1024 ); projectile->init( Pos, 1024 );
m_salvoCount--; m_salvoCount--;

View file

@ -87,45 +87,32 @@ void CNpcSeaSnakeEnemy::postInit()
{ {
m_npcPath.setPathType( CNpcPath::REPEATING_PATH ); m_npcPath.setPathType( CNpcPath::REPEATING_PATH );
// create start of list s16 maxArraySize = NPC_SEA_SNAKE_LENGTH * NPC_SEA_SNAKE_SPACING;
CNpcPositionHistory *newPosition;
newPosition = new ("position history") CNpcPositionHistory;
newPosition->pos = Pos;
m_positionHistory = newPosition;
CNpcPositionHistory *currentPosition = m_positionHistory; m_positionHistoryArray[0].pos = Pos;
m_positionHistoryArray[0].next = &m_positionHistoryArray[1];
m_positionHistoryArray[0].prev = &m_positionHistoryArray[maxArraySize - 1];
// create rest of list for ( int histLength = 1 ; histLength < maxArraySize - 1 ; histLength++ )
for ( int histLength = 1 ; histLength < ( NPC_SEA_SNAKE_LENGTH * NPC_SEA_SNAKE_SPACING ) ; histLength++ )
{ {
newPosition = new ("position history") CNpcPositionHistory; m_positionHistoryArray[histLength].pos = Pos;
newPosition->pos = Pos; m_positionHistoryArray[histLength].next = &m_positionHistoryArray[histLength + 1];
newPosition->next = NULL; m_positionHistoryArray[histLength].prev = &m_positionHistoryArray[histLength - 1];
newPosition->prev = currentPosition;
currentPosition->next = newPosition;
currentPosition = newPosition;
} }
// link ends together for circular list m_positionHistoryArray[maxArraySize - 1].pos = Pos;
m_positionHistoryArray[maxArraySize - 1].next = &m_positionHistoryArray[0];
m_positionHistoryArray[maxArraySize - 1].prev = &m_positionHistoryArray[maxArraySize - 2];
currentPosition->next = m_positionHistory; m_positionHistory = &m_positionHistoryArray[0];
m_positionHistory->prev = currentPosition;
u16 segScale; u16 segScale;
int initLength = NPC_SEA_SNAKE_LENGTH / 3; int initLength = NPC_SEA_SNAKE_LENGTH / 3;
int remLength = NPC_SEA_SNAKE_LENGTH - initLength; int remLength = NPC_SEA_SNAKE_LENGTH - initLength;
m_segment = NULL;
CNpcSeaSnakeSegment *currentSegment;
for ( int segCount = 0 ; segCount < NPC_SEA_SNAKE_LENGTH ; segCount++ ) for ( int segCount = 0 ; segCount < NPC_SEA_SNAKE_LENGTH ; segCount++ )
{ {
CNpcSeaSnakeSegment *snakeSegment; m_segmentArray[segCount].init();
snakeSegment = new ("segment") CNpcSeaSnakeSegment;
snakeSegment->init();
if ( segCount < initLength ) if ( segCount < initLength )
{ {
@ -144,29 +131,18 @@ void CNpcSeaSnakeEnemy::postInit()
segScale = start + ( ( end * ( NPC_SEA_SNAKE_LENGTH - segCount ) ) / remLength ); segScale = start + ( ( end * ( NPC_SEA_SNAKE_LENGTH - segCount ) ) / remLength );
} }
snakeSegment->setScale( segScale ); m_segmentArray[segCount].setScale( segScale );
// attach snake segment // attach snake segment
if ( m_segment ) if ( segCount < NPC_SEA_SNAKE_LENGTH - 1 )
{ {
currentSegment = m_segment; m_segmentArray[segCount].m_nextSegment = &m_segmentArray[segCount + 1];
while( currentSegment->m_nextSegment )
{
currentSegment = currentSegment->m_nextSegment;
}
currentSegment->m_nextSegment = snakeSegment;
}
else
{
// no previous segments
m_segment = snakeSegment;
} }
} }
m_segmentCount = NPC_SEA_SNAKE_LENGTH;
m_movementTimer = 2 * GameState::getOneSecondInFrames(); m_movementTimer = 2 * GameState::getOneSecondInFrames();
m_collTimer = 0; m_collTimer = 0;
} }
@ -184,37 +160,11 @@ void CNpcSeaSnakeEnemy::shutdown()
{ {
// delete snake segments // delete snake segments
CNpcSeaSnakeSegment *currentSegment = m_segment; for ( int segCount = 0 ; segCount < NPC_SEA_SNAKE_LENGTH ; segCount++ )
while( currentSegment )
{ {
CNpcSeaSnakeSegment *oldSegment; m_segmentArray[segCount].shutdown();
oldSegment = currentSegment;
currentSegment = currentSegment->m_nextSegment;
oldSegment->shutdown();
delete oldSegment;
} }
// remove position history
CNpcPositionHistory *currentPosition;
CNpcPositionHistory *oldPosition;
currentPosition = m_positionHistory;
while( currentPosition )
{
oldPosition = currentPosition;
currentPosition = currentPosition->next;
oldPosition->prev->next = NULL;
delete oldPosition;
}
m_positionHistory = NULL;
CNpcEnemy::shutdown(); CNpcEnemy::shutdown();
} }
@ -305,8 +255,6 @@ void CNpcSeaSnakeEnemy::processMovement( int _frames )
newPos = newPos->next; newPos = newPos->next;
} }
CNpcSeaSnakeSegment *List = m_segment;
oldPos = Pos; oldPos = Pos;
s32 extension = m_extension; s32 extension = m_extension;
@ -325,7 +273,9 @@ void CNpcSeaSnakeEnemy::processMovement( int _frames )
timeShift = m_movementTimer / GameState::getOneSecondInFrames(); timeShift = m_movementTimer / GameState::getOneSecondInFrames();
while( List ) int segmentCount;
for ( segmentCount = 0 ; segmentCount < m_segmentCount ; segmentCount++ )
{ {
s32 xDist = oldPos.vx - newPos->pos.vx; s32 xDist = oldPos.vx - newPos->pos.vx;
s32 yDist = oldPos.vy - newPos->pos.vy; s32 yDist = oldPos.vy - newPos->pos.vy;
@ -339,17 +289,12 @@ void CNpcSeaSnakeEnemy::processMovement( int _frames )
sinPos.vx += ( diff * rcos( headingToTarget + 1024 ) ) >> 12; sinPos.vx += ( diff * rcos( headingToTarget + 1024 ) ) >> 12;
sinPos.vy += ( diff * rsin( headingToTarget + 1024 ) ) >> 12; sinPos.vy += ( diff * rsin( headingToTarget + 1024 ) ) >> 12;
List->setPos( sinPos ); m_segmentArray[segmentCount].setPos( sinPos );
oldPos = sinPos; oldPos = sinPos;
List = List->m_nextSegment; for ( skipCounter = 0 ; skipCounter < NPC_SEA_SNAKE_SPACING ; skipCounter++ )
if ( List )
{ {
for ( skipCounter = 0 ; skipCounter < NPC_SEA_SNAKE_SPACING ; skipCounter++ ) newPos = newPos->next;
{
newPos = newPos->next;
}
} }
extension += 1024; extension += 1024;
@ -361,13 +306,11 @@ void CNpcSeaSnakeEnemy::processMovement( int _frames )
} }
} }
List = m_segment;
oldPos = Pos; oldPos = Pos;
while( List ) for ( segmentCount = 0 ; segmentCount < m_segmentCount ; segmentCount++ )
{ {
DVECTOR currentPos = List->getPos(); DVECTOR currentPos = m_segmentArray[segmentCount].getPos();
s32 xDist = oldPos.vx - currentPos.vx; s32 xDist = oldPos.vx - currentPos.vx;
s32 yDist = oldPos.vy - currentPos.vy; s32 yDist = oldPos.vy - currentPos.vy;
@ -378,13 +321,9 @@ void CNpcSeaSnakeEnemy::processMovement( int _frames )
oldPos = currentPos; oldPos = currentPos;
CNpcSeaSnakeSegment *oldList = List; if ( segmentCount < m_segmentCount - 1 )
List = List->m_nextSegment;
if ( List )
{ {
DVECTOR nextPos = List->getPos(); DVECTOR nextPos = m_segmentArray[segmentCount + 1].getPos();
xDist = currentPos.vx - nextPos.vx; xDist = currentPos.vx - nextPos.vx;
yDist = currentPos.vy - nextPos.vy; yDist = currentPos.vy - nextPos.vy;
headingFromNext = ratan2( yDist, xDist ); headingFromNext = ratan2( yDist, xDist );
@ -417,8 +356,8 @@ void CNpcSeaSnakeEnemy::processMovement( int _frames )
heading -= moveDist >> 1; heading -= moveDist >> 1;
} }
oldList->setHeading( heading ); m_segmentArray[segmentCount].setHeading( heading );
oldList->updateCollisionArea(); m_segmentArray[segmentCount].updateCollisionArea();
} }
if ( m_collTimer > 0 ) if ( m_collTimer > 0 )
@ -555,12 +494,9 @@ void CNpcSeaSnakeEnemy::render()
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 ); setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
} }
CNpcSeaSnakeSegment *segment = m_segment; for ( int segmentCount = 0 ; segmentCount < m_segmentCount ; segmentCount++ )
while( segment )
{ {
segment->render(); m_segmentArray[segmentCount].render();
segment = segment->m_nextSegment;
} }
} }
} }
@ -596,16 +532,12 @@ int CNpcSeaSnakeEnemy::checkCollisionAgainst( CThing *_thisThing, int _frames )
// go through segments // go through segments
CNpcSeaSnakeSegment *segment = m_segment; for ( int segmentCount = 0 ; segmentCount < m_segmentCount ; segmentCount++ )
while( segment )
{ {
if ( segment->checkCollisionAgainst( _thisThing, _frames ) ) if ( m_segmentArray[segmentCount].checkCollisionAgainst( _thisThing, _frames ) )
{ {
collided = true; collided = true;
} }
segment = segment->m_nextSegment;
} }
return collided; return collided;
@ -701,7 +633,7 @@ int CNpcSeaSnakeSegment::checkCollisionAgainst( CThing *_thisThing, int _frames
void CNpcSeaSnakeEnemy::processShot( int _frames ) void CNpcSeaSnakeEnemy::processShot( int _frames )
{ {
if ( !m_segment ) if ( !m_segmentCount )
{ {
m_drawRotation += 64 * _frames; m_drawRotation += 64 * _frames;
m_drawRotation &= 4095; m_drawRotation &= 4095;
@ -727,27 +659,7 @@ void CNpcSeaSnakeEnemy::processShot( int _frames )
{ {
// knock segment off end of list // knock segment off end of list
CNpcSeaSnakeSegment *segment = m_segment; m_segmentCount--;
CNpcSeaSnakeSegment *oldSegment = segment;
while( segment->m_nextSegment )
{
oldSegment = segment;
segment = segment->m_nextSegment;
}
segment->shutdown();
delete segment;
if ( segment == m_segment )
{
m_segment = NULL;
}
else
{
oldSegment->m_nextSegment = NULL;
}
m_collTimer = GameState::getOneSecondInFrames(); m_collTimer = GameState::getOneSecondInFrames();
} }

View file

@ -78,8 +78,11 @@ protected:
CNpcPositionHistory *prev; CNpcPositionHistory *prev;
}; };
CNpcSeaSnakeSegment *m_segment; u8 m_segmentCount;
CNpcSeaSnakeSegment m_segmentArray[NPC_SEA_SNAKE_LENGTH];
CNpcPositionHistory *m_positionHistory; CNpcPositionHistory *m_positionHistory;
CNpcPositionHistory m_positionHistoryArray[NPC_SEA_SNAKE_SPACING * NPC_SEA_SNAKE_LENGTH];
s32 m_collTimer; s32 m_collTimer;
s32 m_snapTimer; s32 m_snapTimer;
s32 m_openTimer; s32 m_openTimer;

View file

@ -87,45 +87,32 @@ void CNpcParasiticWormEnemy::postInit()
{ {
m_npcPath.setPathType( CNpcPath::REPEATING_PATH ); m_npcPath.setPathType( CNpcPath::REPEATING_PATH );
// create start of list s16 maxArraySize = NPC_PARASITIC_WORM_LENGTH * NPC_PARASITIC_WORM_SPACING;
CNpcPositionHistory *newPosition;
newPosition = new ("position history") CNpcPositionHistory;
newPosition->pos = Pos;
m_positionHistory = newPosition;
CNpcPositionHistory *currentPosition = m_positionHistory; m_positionHistoryArray[0].pos = Pos;
m_positionHistoryArray[0].next = &m_positionHistoryArray[1];
m_positionHistoryArray[0].prev = &m_positionHistoryArray[maxArraySize - 1];
// create rest of list for ( int histLength = 1 ; histLength < maxArraySize - 1 ; histLength++ )
for ( int histLength = 1 ; histLength < ( NPC_PARASITIC_WORM_LENGTH * NPC_PARASITIC_WORM_SPACING ) ; histLength++ )
{ {
newPosition = new ("position history") CNpcPositionHistory; m_positionHistoryArray[histLength].pos = Pos;
newPosition->pos = Pos; m_positionHistoryArray[histLength].next = &m_positionHistoryArray[histLength + 1];
newPosition->next = NULL; m_positionHistoryArray[histLength].prev = &m_positionHistoryArray[histLength - 1];
newPosition->prev = currentPosition;
currentPosition->next = newPosition;
currentPosition = newPosition;
} }
// link ends together for circular list m_positionHistoryArray[maxArraySize - 1].pos = Pos;
m_positionHistoryArray[maxArraySize - 1].next = &m_positionHistoryArray[0];
m_positionHistoryArray[maxArraySize - 1].prev = &m_positionHistoryArray[maxArraySize - 2];
currentPosition->next = m_positionHistory; m_positionHistory = &m_positionHistoryArray[0];
m_positionHistory->prev = currentPosition;
u16 segScale; u16 segScale;
int initLength = NPC_PARASITIC_WORM_LENGTH / 3; int initLength = NPC_PARASITIC_WORM_LENGTH / 3;
int remLength = NPC_PARASITIC_WORM_LENGTH - initLength; int remLength = NPC_PARASITIC_WORM_LENGTH - initLength;
m_segment = NULL;
CNpcParasiticWormSegment *currentSegment;
for ( int segCount = 0 ; segCount < NPC_PARASITIC_WORM_LENGTH ; segCount++ ) for ( int segCount = 0 ; segCount < NPC_PARASITIC_WORM_LENGTH ; segCount++ )
{ {
CNpcParasiticWormSegment *wormSegment; m_segmentArray[segCount].init();
wormSegment = new ("segment") CNpcParasiticWormSegment;
wormSegment->init();
if ( segCount < initLength ) if ( segCount < initLength )
{ {
@ -145,26 +132,13 @@ void CNpcParasiticWormEnemy::postInit()
segScale = start + ( ( end * ( NPC_PARASITIC_WORM_LENGTH - segCount ) ) / remLength ); segScale = start + ( ( end * ( NPC_PARASITIC_WORM_LENGTH - segCount ) ) / remLength );
} }
wormSegment->setScale( segScale ); m_segmentArray[segCount].setScale( segScale );
// attach worm segment // attach snake segment
if ( m_segment ) if ( segCount < NPC_PARASITIC_WORM_LENGTH - 1 )
{ {
currentSegment = m_segment; m_segmentArray[segCount].m_nextSegment = &m_segmentArray[segCount + 1];
while( currentSegment->m_nextSegment )
{
currentSegment = currentSegment->m_nextSegment;
}
currentSegment->m_nextSegment = wormSegment;
}
else
{
// no previous segments
m_segment = wormSegment;
} }
} }
@ -185,37 +159,11 @@ void CNpcParasiticWormEnemy::shutdown()
{ {
// delete worm segments // delete worm segments
CNpcParasiticWormSegment *currentSegment = m_segment; for ( int segCount = 0 ; segCount < NPC_PARASITIC_WORM_LENGTH ; segCount++ )
while( currentSegment )
{ {
CNpcParasiticWormSegment *oldSegment; m_segmentArray[segCount].shutdown();
oldSegment = currentSegment;
currentSegment = currentSegment->m_nextSegment;
oldSegment->shutdown();
delete oldSegment;
} }
// remove position history
CNpcPositionHistory *currentPosition;
CNpcPositionHistory *oldPosition;
currentPosition = m_positionHistory;
while( currentPosition )
{
oldPosition = currentPosition;
currentPosition = currentPosition->next;
oldPosition->prev->next = NULL;
delete oldPosition;
}
m_positionHistory = NULL;
CNpcEnemy::shutdown(); CNpcEnemy::shutdown();
} }
@ -265,8 +213,6 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
newPos = newPos->next; newPos = newPos->next;
} }
CNpcParasiticWormSegment *List = m_segment;
oldPos = Pos; oldPos = Pos;
s32 extension = m_extension; s32 extension = m_extension;
@ -285,7 +231,9 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
timeShift = m_movementTimer / GameState::getOneSecondInFrames(); timeShift = m_movementTimer / GameState::getOneSecondInFrames();
while( List ) int segmentCount;
for ( segmentCount = 0 ; segmentCount < NPC_PARASITIC_WORM_LENGTH ; segmentCount++ )
{ {
s32 xDist = oldPos.vx - newPos->pos.vx; s32 xDist = oldPos.vx - newPos->pos.vx;
s32 yDist = oldPos.vy - newPos->pos.vy; s32 yDist = oldPos.vy - newPos->pos.vy;
@ -299,17 +247,12 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
sinPos.vx += ( diff * rcos( headingToTarget + 1024 ) ) >> 12; sinPos.vx += ( diff * rcos( headingToTarget + 1024 ) ) >> 12;
sinPos.vy += ( diff * rsin( headingToTarget + 1024 ) ) >> 12; sinPos.vy += ( diff * rsin( headingToTarget + 1024 ) ) >> 12;
List->setPos( sinPos ); m_segmentArray[segmentCount].setPos( sinPos );
oldPos = sinPos; oldPos = sinPos;
List = List->m_nextSegment; for ( skipCounter = 0 ; skipCounter < NPC_PARASITIC_WORM_SPACING ; skipCounter++ )
if ( List )
{ {
for ( skipCounter = 0 ; skipCounter < NPC_PARASITIC_WORM_SPACING ; skipCounter++ ) newPos = newPos->next;
{
newPos = newPos->next;
}
} }
extension += 256; extension += 256;
@ -321,13 +264,11 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
} }
} }
List = m_segment;
oldPos = Pos; oldPos = Pos;
while( List ) for ( segmentCount = 0 ; segmentCount < NPC_PARASITIC_WORM_LENGTH ; segmentCount++ )
{ {
DVECTOR currentPos = List->getPos(); DVECTOR currentPos = m_segmentArray[segmentCount].getPos();
s32 xDist = oldPos.vx - currentPos.vx; s32 xDist = oldPos.vx - currentPos.vx;
s32 yDist = oldPos.vy - currentPos.vy; s32 yDist = oldPos.vy - currentPos.vy;
@ -338,13 +279,9 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
oldPos = currentPos; oldPos = currentPos;
CNpcParasiticWormSegment *oldList = List; if ( segmentCount < NPC_PARASITIC_WORM_LENGTH - 1 )
List = List->m_nextSegment;
if ( List )
{ {
DVECTOR nextPos = List->getPos(); DVECTOR nextPos = m_segmentArray[segmentCount + 1].getPos();
xDist = currentPos.vx - nextPos.vx; xDist = currentPos.vx - nextPos.vx;
yDist = currentPos.vy - nextPos.vy; yDist = currentPos.vy - nextPos.vy;
headingFromNext = ratan2( yDist, xDist ); headingFromNext = ratan2( yDist, xDist );
@ -377,8 +314,8 @@ void CNpcParasiticWormEnemy::processMovement( int _frames )
heading -= moveDist >> 1; heading -= moveDist >> 1;
} }
oldList->setHeading( heading ); m_segmentArray[segmentCount].setHeading( heading );
oldList->updateCollisionArea(); m_segmentArray[segmentCount].updateCollisionArea();
} }
if ( m_collTimer > 0 ) if ( m_collTimer > 0 )
@ -512,12 +449,9 @@ void CNpcParasiticWormEnemy::render()
setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 ); setCollisionCentreOffset( ( boundingBox.XMax + boundingBox.XMin ) >> 1, ( boundingBox.YMax + boundingBox.YMin ) >> 1 );
} }
CNpcParasiticWormSegment *segment = m_segment; for ( int segmentCount = 0 ; segmentCount < NPC_PARASITIC_WORM_LENGTH ; segmentCount++ )
while( segment )
{ {
segment->render(); m_segmentArray[segmentCount].render();
segment = segment->m_nextSegment;
} }
} }
} }
@ -553,16 +487,12 @@ int CNpcParasiticWormEnemy::checkCollisionAgainst( CThing *_thisThing, int _fram
// go through segments // go through segments
CNpcParasiticWormSegment *segment = m_segment; for ( int segmentCount = 0 ; segmentCount < NPC_PARASITIC_WORM_LENGTH ; segmentCount++ )
while( segment )
{ {
if ( segment->checkCollisionAgainst( _thisThing, _frames ) ) if ( m_segmentArray[segmentCount].checkCollisionAgainst( _thisThing, _frames ) )
{ {
collided = true; collided = true;
} }
segment = segment->m_nextSegment;
} }
return collided; return collided;
@ -728,16 +658,12 @@ void CNpcParasiticWormEnemy::processShot( int _frames )
// go through segments // go through segments
CNpcParasiticWormSegment *segment = m_segment; for ( int segCount = 0 ; segCount < NPC_PARASITIC_WORM_LENGTH ; segCount++ )
while( segment )
{ {
DVECTOR segPos = segment->getPos(); DVECTOR segPos = m_segmentArray[segCount].getPos();
segPos.vy += m_speed * _frames; segPos.vy += m_speed * _frames;
segment->setPos( segPos ); m_segmentArray[segCount].setPos( segPos );
segment->updateCollisionArea(); m_segmentArray[segCount].updateCollisionArea();
segment = segment->m_nextSegment;
} }
if ( m_speed < 5 ) if ( m_speed < 5 )

View file

@ -77,8 +77,11 @@ protected:
CNpcPositionHistory *prev; CNpcPositionHistory *prev;
}; };
CNpcParasiticWormSegment *m_segment; CNpcParasiticWormSegment m_segmentArray[NPC_PARASITIC_WORM_LENGTH];
CNpcPositionHistory *m_positionHistory; CNpcPositionHistory *m_positionHistory;
CNpcPositionHistory m_positionHistoryArray[NPC_PARASITIC_WORM_SPACING * NPC_PARASITIC_WORM_LENGTH];
s32 m_collTimer; s32 m_collTimer;
}; };

View file

@ -195,6 +195,14 @@
#include "platform\pbubtube.h" #include "platform\pbubtube.h"
#endif #endif
#ifndef __PLATFORM_PCLAM_H__
#include "platform\pclam.h"
#endif
#ifndef __PLATFORM_PPLAYER_H__
#include "platform\pplayer.h"
#endif
#include "fx\fx.h" #include "fx\fx.h"
#include "fx\fxjfish.h" #include "fx\fxjfish.h"
@ -451,6 +459,19 @@ CNpcPlatform *CNpcPlatform::Create(int Type)
break; break;
} }
case NPC_CLAM_PLATFORM:
{
platform = new ("clam platform") CNpcClamPlatform;
break;
}
case NPC_PLAYER_BUBBLE_PLATFORM:
{
platform = new ("player bubble platform") CNpcPlayerBubblePlatform;
platform->setGraphic( (u8) 0 );
break;
}
default: default:
{ {
ASSERT( 0 ); ASSERT( 0 );

View file

@ -17,8 +17,8 @@
#include "player\pmbubble.h" #include "player\pmbubble.h"
#ifndef __PLATFORM_PPLAYER_H__ #ifndef __PLATFORM_PLATFORM_H__
#include "platform\pplayer.h" #include "platform\platform.h"
#endif #endif
#ifndef __GFX_FONT_H__ #ifndef __GFX_FONT_H__
@ -103,12 +103,9 @@ void CPlayerModeBubbleMixture::think()
if(!m_blowing&&getPadInputDown()&PI_FIRE&&canBlowBubbleFromThisState()&&m_player->getBubbleAmmo()) if(!m_blowing&&getPadInputDown()&PI_FIRE&&canBlowBubbleFromThisState()&&m_player->getBubbleAmmo())
{ {
// Spawn the bubbly platform thingy..! // Spawn the bubbly platform thingy..!
CNpcPlayerBubblePlatform *bubble; CNpcPlatform *bubble;
DVECTOR pos; DVECTOR pos;
bubble=new ("bubble platform") CNpcPlayerBubblePlatform; bubble = CNpcPlatform::Create( CNpcPlatform::NPC_PLAYER_BUBBLE_PLATFORM );
bubble->setThingSubType( CNpcPlatform::NPC_PLAYER_BUBBLE_PLATFORM );
bubble->setGraphic( (u8) 0 );
bubble->setTiltable( false );
pos=m_player->getPos(); pos=m_player->getPos();
pos.vx+=buboff.vx*m_player->getFacing(); pos.vx+=buboff.vx*m_player->getFacing();
pos.vy+=buboff.vy; pos.vy+=buboff.vy;

View file

@ -276,7 +276,7 @@ void CPlayerModeCoralBlower::think()
launchHeading=(-((m_launchHeading+1024)*facing)-1024)&4095; launchHeading=(-((m_launchHeading+1024)*facing)-1024)&4095;
CEnemyAsSpriteProjectile *projectile; CEnemyAsSpriteProjectile *projectile;
projectile = new( "blower projectile" ) CEnemyAsSpriteProjectile; projectile = CEnemyAsSpriteProjectile::Create();
projectile->init( launchPos, projectile->init( launchPos,
launchHeading,//1024+(1024*facing), launchHeading,//1024+(1024*facing),
CPlayerProjectile::PLAYER_PROJECTILE_DUMBFIRE, CPlayerProjectile::PLAYER_PROJECTILE_DUMBFIRE,

View file

@ -296,7 +296,7 @@ void CPlayerModeJellyLauncher::launchProjectile()
fireHeading=1024+(1024*playerFacing)-512; fireHeading=1024+(1024*playerFacing)-512;
for(i=0;i<3;i++) for(i=0;i<3;i++)
{ {
projectile=new("JellyProjectile") CPlayerProjectile; projectile=CPlayerProjectile::Create();
projectile->init(launchPos, projectile->init(launchPos,
fireHeading, fireHeading,
CPlayerProjectile::PLAYER_PROJECTILE_DUMBFIRE, CPlayerProjectile::PLAYER_PROJECTILE_DUMBFIRE,
@ -312,7 +312,7 @@ void CPlayerModeJellyLauncher::launchProjectile()
{ {
// Normal, small shot // Normal, small shot
fireHeading=1024+(1024*m_player->getFacing()); fireHeading=1024+(1024*m_player->getFacing());
projectile=new("JellyProjectile") CPlayerProjectile; projectile=CPlayerProjectile::Create();
projectile->init(launchPos, projectile->init(launchPos,
fireHeading, fireHeading,
CPlayerProjectile::PLAYER_PROJECTILE_DUMBFIRE, CPlayerProjectile::PLAYER_PROJECTILE_DUMBFIRE,

View file

@ -229,7 +229,7 @@ void CPlayerModeNet::think()
launchPos.vy+=netLaunchPos.vy; launchPos.vy+=netLaunchPos.vy;
projectile = new( "user projectile" ) CPlayerProjectile; projectile = CPlayerProjectile::Create();
projectile->init( launchPos, projectile->init( launchPos,
fireHeading, fireHeading,

View file

@ -25,6 +25,25 @@
#include "game/game.h" #include "game/game.h"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CEnemyAsSpriteProjectile *CEnemyAsSpriteProjectile::Create()
{
CEnemyAsSpriteProjectile *projectile;
projectile = (CEnemyAsSpriteProjectile*)CThingManager::GetThing(TYPE_PLAYERPROJECTILE,0);
if ( !projectile )
{
projectile = new ("player projectile") CEnemyAsSpriteProjectile;
}
ASSERT(projectile);
return( projectile );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CEnemyAsSpriteProjectile::think( int _frames ) void CEnemyAsSpriteProjectile::think( int _frames )
{ {
CPlayerProjectile::think( _frames ); CPlayerProjectile::think( _frames );
@ -33,12 +52,16 @@ void CEnemyAsSpriteProjectile::think( int _frames )
m_rotation &= 4095; m_rotation &= 4095;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CEnemyAsSpriteProjectile::setGraphic( int frame ) void CEnemyAsSpriteProjectile::setGraphic( int frame )
{ {
m_spriteFrame = frame; m_spriteFrame = frame;
m_rotation = 0; m_rotation = 0;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CEnemyAsSpriteProjectile::setRGB( int R, int G, int B ) void CEnemyAsSpriteProjectile::setRGB( int R, int G, int B )
{ {
m_R = R; m_R = R;
@ -46,6 +69,8 @@ void CEnemyAsSpriteProjectile::setRGB( int R, int G, int B )
m_B = B; m_B = B;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CEnemyAsSpriteProjectile::render() void CEnemyAsSpriteProjectile::render()
{ {
sFrameHdr *frameHdr; sFrameHdr *frameHdr;

View file

@ -29,6 +29,7 @@
class CEnemyAsSpriteProjectile : public CPlayerProjectile class CEnemyAsSpriteProjectile : public CPlayerProjectile
{ {
public: public:
static CEnemyAsSpriteProjectile *Create();
void render(); void render();
void setGraphic( int frame ); void setGraphic( int frame );
void setRGB( int R, int G, int B ); void setRGB( int R, int G, int B );

View file

@ -49,7 +49,24 @@
#include "gfx\otpos.h" #include "gfx\otpos.h"
/*****************************************************************************/ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CProjectile *CProjectile::Create()
{
CProjectile *projectile;
projectile = (CProjectile*)CThingManager::GetThing(TYPE_ENEMYPROJECTILE,0);
if ( !projectile )
{
projectile = new ("enemy projectile") CProjectile;
}
ASSERT(projectile);
return( projectile );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::init() void CProjectile::init()
{ {
@ -71,6 +88,8 @@ void CProjectile::init()
updateCollisionArea(); updateCollisionArea();
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::init( DVECTOR initPos, s16 initHeading ) void CProjectile::init( DVECTOR initPos, s16 initHeading )
{ {
init(); init();
@ -79,6 +98,8 @@ void CProjectile::init( DVECTOR initPos, s16 initHeading )
m_initPos = Pos = initPos; m_initPos = Pos = initPos;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::init( DVECTOR initPos, s16 initHeading, PROJECTILE_MOVEMENT_TYPE initMoveType, PROJECTILE_LIFETIME_TYPE initLifeType ) void CProjectile::init( DVECTOR initPos, s16 initHeading, PROJECTILE_MOVEMENT_TYPE initMoveType, PROJECTILE_LIFETIME_TYPE initLifeType )
{ {
init( initPos, initHeading ); init( initPos, initHeading );
@ -87,6 +108,8 @@ void CProjectile::init( DVECTOR initPos, s16 initHeading, PROJECTILE_MOVEMENT_TY
m_lifetimeType = initLifeType; m_lifetimeType = initLifeType;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::init( DVECTOR initPos, s16 initHeading, PROJECTILE_MOVEMENT_TYPE initMoveType, PROJECTILE_LIFETIME_TYPE initLifeType, s32 initLifetime ) void CProjectile::init( DVECTOR initPos, s16 initHeading, PROJECTILE_MOVEMENT_TYPE initMoveType, PROJECTILE_LIFETIME_TYPE initLifeType, s32 initLifetime )
{ {
init( initPos, initHeading, initMoveType, initLifeType ); init( initPos, initHeading, initMoveType, initLifeType );
@ -94,16 +117,22 @@ void CProjectile::init( DVECTOR initPos, s16 initHeading, PROJECTILE_MOVEMENT_TY
m_lifetime = initLifetime; m_lifetime = initLifetime;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::shutdown() void CProjectile::shutdown()
{ {
CEnemyProjectileThing::shutdown(); CEnemyProjectileThing::shutdown();
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::setGraphic( int frame ) void CProjectile::setGraphic( int frame )
{ {
m_spriteFrame = frame; m_spriteFrame = frame;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool CProjectile::processTargetSeek( int _frames, DVECTOR targetPos ) bool CProjectile::processTargetSeek( int _frames, DVECTOR targetPos )
{ {
s32 moveX = 0, moveY = 0; s32 moveX = 0, moveY = 0;
@ -202,31 +231,43 @@ bool CProjectile::processTargetSeek( int _frames, DVECTOR targetPos )
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::setMovementType( PROJECTILE_MOVEMENT_TYPE moveType ) void CProjectile::setMovementType( PROJECTILE_MOVEMENT_TYPE moveType )
{ {
m_movementType = moveType; m_movementType = moveType;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CProjectile::PROJECTILE_MOVEMENT_TYPE CProjectile::getMovementType() CProjectile::PROJECTILE_MOVEMENT_TYPE CProjectile::getMovementType()
{ {
return( m_movementType ); return( m_movementType );
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::setState( PROJECTILE_STATE newState ) void CProjectile::setState( PROJECTILE_STATE newState )
{ {
m_state = newState; m_state = newState;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::setPosition( DVECTOR newPos ) void CProjectile::setPosition( DVECTOR newPos )
{ {
Pos = newPos; Pos = newPos;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::setLifeTime( PROJECTILE_LIFETIME_TYPE lifeType ) void CProjectile::setLifeTime( PROJECTILE_LIFETIME_TYPE lifeType )
{ {
m_lifetimeType = lifeType; m_lifetimeType = lifeType;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::think(int _frames) void CProjectile::think(int _frames)
{ {
if ( _frames > 2 ) if ( _frames > 2 )
@ -334,6 +375,8 @@ void CProjectile::think(int _frames)
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::render() void CProjectile::render()
{ {
CEnemyProjectileThing::render(); CEnemyProjectileThing::render();
@ -363,15 +406,21 @@ void CProjectile::render()
CGameScene::getSpriteBank()->printRotatedScaledSprite( frameHdr, x, y, 4096, 4096, m_heading, m_ot ); CGameScene::getSpriteBank()->printRotatedScaledSprite( frameHdr, x, y, 4096, 4096, m_heading, m_ot );
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
DVECTOR CProjectile::getScreenOffset() DVECTOR CProjectile::getScreenOffset()
{ {
return CLevel::getCameraPos(); return CLevel::getCameraPos();
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::processEvent( GAME_EVENT evt, CThing *sourceThing ) void CProjectile::processEvent( GAME_EVENT evt, CThing *sourceThing )
{ {
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CProjectile::collidedWith(CThing *_thisThing) void CProjectile::collidedWith(CThing *_thisThing)
{ {
switch(_thisThing->getThingType()) switch(_thisThing->getThingType())
@ -396,7 +445,24 @@ void CProjectile::collidedWith(CThing *_thisThing)
} }
} }
/*****************************************************************************/ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CPlayerProjectile *CPlayerProjectile::Create()
{
CPlayerProjectile *projectile;
projectile = (CPlayerProjectile*)CThingManager::GetThing(TYPE_PLAYERPROJECTILE,0);
if ( !projectile )
{
projectile = new ("player projectile") CPlayerProjectile;
}
ASSERT(projectile);
return( projectile );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPlayerProjectile::init() void CPlayerProjectile::init()
{ {
@ -413,6 +479,8 @@ void CPlayerProjectile::init()
// m_isShuttingDown = false; // m_isShuttingDown = false;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPlayerProjectile::init( DVECTOR initPos, s16 initHeading ) void CPlayerProjectile::init( DVECTOR initPos, s16 initHeading )
{ {
init(); init();
@ -433,6 +501,8 @@ void CPlayerProjectile::init( DVECTOR initPos, s16 initHeading )
m_RGB.b = 0; m_RGB.b = 0;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPlayerProjectile::init( DVECTOR initPos, s16 initHeading, PLAYER_PROJECTILE_MOVEMENT_TYPE initMoveType, PLAYER_PROJECTILE_LIFETIME_TYPE initLifeType ) void CPlayerProjectile::init( DVECTOR initPos, s16 initHeading, PLAYER_PROJECTILE_MOVEMENT_TYPE initMoveType, PLAYER_PROJECTILE_LIFETIME_TYPE initLifeType )
{ {
init( initPos, initHeading ); init( initPos, initHeading );
@ -441,6 +511,8 @@ void CPlayerProjectile::init( DVECTOR initPos, s16 initHeading, PLAYER_PROJECTIL
m_lifetimeType = initLifeType; m_lifetimeType = initLifeType;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPlayerProjectile::init( DVECTOR initPos, s16 initHeading, PLAYER_PROJECTILE_MOVEMENT_TYPE initMoveType, PLAYER_PROJECTILE_LIFETIME_TYPE initLifeType, s32 initLifetime ) void CPlayerProjectile::init( DVECTOR initPos, s16 initHeading, PLAYER_PROJECTILE_MOVEMENT_TYPE initMoveType, PLAYER_PROJECTILE_LIFETIME_TYPE initLifeType, s32 initLifetime )
{ {
init( initPos, initHeading, initMoveType, initLifeType ); init( initPos, initHeading, initMoveType, initLifeType );
@ -448,32 +520,44 @@ void CPlayerProjectile::init( DVECTOR initPos, s16 initHeading, PLAYER_PROJECTIL
m_lifetime = initLifetime; m_lifetime = initLifetime;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPlayerProjectile::shutdown() void CPlayerProjectile::shutdown()
{ {
CPlayerProjectileThing::shutdown(); CPlayerProjectileThing::shutdown();
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPlayerProjectile::setMovementType( PLAYER_PROJECTILE_MOVEMENT_TYPE moveType ) void CPlayerProjectile::setMovementType( PLAYER_PROJECTILE_MOVEMENT_TYPE moveType )
{ {
m_movementType = moveType; m_movementType = moveType;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CPlayerProjectile::PLAYER_PROJECTILE_MOVEMENT_TYPE CPlayerProjectile::getMovementType() CPlayerProjectile::PLAYER_PROJECTILE_MOVEMENT_TYPE CPlayerProjectile::getMovementType()
{ {
return( m_movementType ); return( m_movementType );
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPlayerProjectile::setPosition( DVECTOR newPos ) void CPlayerProjectile::setPosition( DVECTOR newPos )
{ {
Pos = newPos; Pos = newPos;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPlayerProjectile::setLifeTime( PLAYER_PROJECTILE_LIFETIME_TYPE lifeType ) void CPlayerProjectile::setLifeTime( PLAYER_PROJECTILE_LIFETIME_TYPE lifeType )
{ {
m_lifetimeType = lifeType; m_lifetimeType = lifeType;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPlayerProjectile::think(int _frames) void CPlayerProjectile::think(int _frames)
{ {
if ( _frames > 2 ) if ( _frames > 2 )
@ -588,6 +672,8 @@ void CPlayerProjectile::think(int _frames)
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPlayerProjectile::render() void CPlayerProjectile::render()
{ {
CPlayerProjectileThing::render(); CPlayerProjectileThing::render();
@ -633,15 +719,21 @@ void CPlayerProjectile::render()
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
DVECTOR CPlayerProjectile::getScreenOffset() DVECTOR CPlayerProjectile::getScreenOffset()
{ {
return CLevel::getCameraPos(); return CLevel::getCameraPos();
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPlayerProjectile::processEvent( GAME_EVENT evt, CThing *sourceThing ) void CPlayerProjectile::processEvent( GAME_EVENT evt, CThing *sourceThing )
{ {
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPlayerProjectile::collidedWith(CThing *_thisThing) void CPlayerProjectile::collidedWith(CThing *_thisThing)
{ {
switch(_thisThing->getThingType()) switch(_thisThing->getThingType())
@ -664,6 +756,8 @@ void CPlayerProjectile::collidedWith(CThing *_thisThing)
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CPlayerProjectile::setRGB( u32 new_RGB ) void CPlayerProjectile::setRGB( u32 new_RGB )
{ {
m_RGB.r = new_RGB & 255; m_RGB.r = new_RGB & 255;

View file

@ -47,6 +47,7 @@ public:
MAX_SUBTYPE =1, MAX_SUBTYPE =1,
}; };
static CProjectile *Create();
void init(); void init();
void init( DVECTOR initPos, s16 initHeading ); void init( DVECTOR initPos, s16 initHeading );
void init( DVECTOR initPos, s16 initHeading, PROJECTILE_MOVEMENT_TYPE initMoveType, PROJECTILE_LIFETIME_TYPE initLifeType ); void init( DVECTOR initPos, s16 initHeading, PROJECTILE_MOVEMENT_TYPE initMoveType, PROJECTILE_LIFETIME_TYPE initLifeType );
@ -105,6 +106,7 @@ public:
MAX_SUBTYPE =1, MAX_SUBTYPE =1,
}; };
static CPlayerProjectile *Create();
void init(); void init();
void init( DVECTOR initPos, s16 initHeading ); void init( DVECTOR initPos, s16 initHeading );
void init( DVECTOR initPos, s16 initHeading, PLAYER_PROJECTILE_MOVEMENT_TYPE initMoveType, PLAYER_PROJECTILE_LIFETIME_TYPE initLifeType ); void init( DVECTOR initPos, s16 initHeading, PLAYER_PROJECTILE_MOVEMENT_TYPE initMoveType, PLAYER_PROJECTILE_LIFETIME_TYPE initLifeType );