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;
CProjectile *projectile;
projectile = new( "test projectile" ) CProjectile;
projectile = CProjectile::Create();
projectile->init( projPos, m_heading );
m_controlFunc = NPC_CONTROL_MOVEMENT;
@ -450,7 +450,7 @@ void CNpcAnemone2Enemy::processClose( int _frames )
spikePos.vx += result.vx;
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->setState( CProjectile::PROJECTILE_ATTACK );
projectile->setSpeed( 5 );
@ -592,7 +592,7 @@ void CNpcAnemone3Enemy::processClose( int _frames )
projPos.vx += rcos( m_heading ) >> 9;
projPos.vy += rsin( m_heading ) >> 9;
projectile = new( "test projectile" ) CProjectile;
projectile = CProjectile::Create();
projectile->init( projPos,
m_fireHeading,
CProjectile::PROJECTILE_GAS_CLOUD,

View file

@ -19,10 +19,6 @@
#include "enemy\nclam.h"
#endif
#ifndef __PLATFORM_PCLAM_H__
#include "platform\pclam.h"
#endif
#ifndef __PLATFORM_PLATFORM_H__
#include "platform\platform.h"
#endif
@ -200,9 +196,10 @@ void CNpcStaticClamEnemy::postInit()
// 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->init( Pos );
platform->setTiltable( false );

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -195,6 +195,14 @@
#include "platform\pbubtube.h"
#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\fxjfish.h"
@ -451,6 +459,19 @@ CNpcPlatform *CNpcPlatform::Create(int Type)
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:
{
ASSERT( 0 );

View file

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

View file

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

View file

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

View file

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

View file

@ -25,6 +25,25 @@
#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 )
{
CPlayerProjectile::think( _frames );
@ -33,12 +52,16 @@ void CEnemyAsSpriteProjectile::think( int _frames )
m_rotation &= 4095;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CEnemyAsSpriteProjectile::setGraphic( int frame )
{
m_spriteFrame = frame;
m_rotation = 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CEnemyAsSpriteProjectile::setRGB( int R, int G, int B )
{
m_R = R;
@ -46,6 +69,8 @@ void CEnemyAsSpriteProjectile::setRGB( int R, int G, int B )
m_B = B;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CEnemyAsSpriteProjectile::render()
{
sFrameHdr *frameHdr;

View file

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

View file

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

View file

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