This commit is contained in:
Charles 2001-05-10 16:47:35 +00:00
parent ef05298c70
commit fbace83cd3
17 changed files with 168 additions and 93 deletions

View File

@ -68,7 +68,7 @@ void CNpcMotherJellyfishBackground::render()
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false);
m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, 8192, 8192 );
m_actorGfx->RotateScale( SprFrame, renderPos, 0, 8192, 8192 );
sBBox boundingBox = m_actorGfx->GetBBox();
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );

View File

@ -334,7 +334,7 @@ void CNpcMotherJellyfishEnemy::render()
if ( renderPos.vy + collisionRect.y2 >= 0 && renderPos.vy + collisionRect.y1 <= VidGetScrH() )
{
SprFrame = m_actorGfx->Render(renderPos,m_animNo,( m_frame >> 8 ),false);
m_actorGfx->RotateScale( SprFrame, renderPos, m_drawRotation, 8192, 8192 );
m_actorGfx->RotateScale( SprFrame, renderPos, 0, 8192, 8192 );
sBBox boundingBox = m_actorGfx->GetBBox();
setCollisionSize( ( boundingBox.XMax - boundingBox.XMin ), ( boundingBox.YMax - boundingBox.YMin ) );

View File

@ -612,6 +612,7 @@ void CNpcEnemy::init()
m_reversed = false;
m_salvoCount = 0;
m_isActive = true;
m_isDying = false;
m_health = m_data[this->m_type].initHealth;
@ -663,6 +664,7 @@ void CNpcEnemy::reinit()
m_reversed = false;
m_salvoCount = 0;
m_isActive = true;
m_isDying = false;
m_health = m_data[this->m_type].initHealth;
@ -764,7 +766,7 @@ void CNpcEnemy::think(int _frames)
{
if ( m_isActive )
{
if ( m_animPlaying )
if ( m_animPlaying && !m_isDying )
{
s32 frameCount;
@ -844,7 +846,7 @@ void CNpcEnemy::processAttackCollision()
void CNpcEnemy::collidedWith( CThing *_thisThing )
{
if ( m_isActive && !m_isCaught )
if ( m_isActive && !m_isCaught && !m_isDying )
{
switch(_thisThing->getThingType())
{
@ -1208,6 +1210,9 @@ void CNpcEnemy::processShot( int _frames )
m_frame = 0;
m_state = NPC_GENERIC_HIT_DEATH_END;
m_isDying = true;
m_speed = -5;
if (m_data[m_type].skelType)
{
m_actorGfx->SetOtPos( 0 );
@ -1218,7 +1223,15 @@ void CNpcEnemy::processShot( int _frames )
case NPC_GENERIC_HIT_DEATH_END:
{
Pos.vy += 5 * _frames;
m_drawRotation += 64 * _frames;
m_drawRotation &= 4095;
Pos.vy += m_speed * _frames;
if ( m_speed < 5 )
{
m_speed++;
}
DVECTOR offset = CLevel::getCameraPos();
@ -1387,7 +1400,7 @@ void CNpcEnemy::processEvent( GAME_EVENT evt, CThing *sourceThing )
bool CNpcEnemy::canBeCaughtByNet()
{
return( m_isActive && m_data[m_type].canBeNetted );
return( m_isActive && !m_isDying && m_data[m_type].canBeNetted );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -1414,7 +1427,7 @@ void CNpcEnemy::caughtWithNet()
int CNpcEnemy::canCollide()
{
return( m_isActive );
return( m_isActive && !m_isDying );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -1480,7 +1493,17 @@ void CNpcEnemy::processUserCollision( CThing *thisThing )
}
Pos.vx += otherDelta.vx;
Pos.vy += otherDelta.vy;
s32 groundHeight = m_layerCollision->getHeightFromGround( Pos.vx, Pos.vy, 16 );
if ( groundHeight < 8 )
{
Pos.vy += groundHeight;
}
else
{
Pos.vy += otherDelta.vy;
}
m_heading = headingFromTarget;

View File

@ -299,6 +299,7 @@ protected:
u8 m_isBlowerOn;
DVECTOR m_caughtPos;
s16 m_speed;
u8 m_isDying;
s32 m_frame;
int m_animNo;

View File

@ -27,6 +27,10 @@
#include "system\vid.h"
#endif
#ifndef __GAME_GAME_H__
#include "game\game.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -71,7 +75,23 @@ void CNpcSmallJellyfishBackgroundEnemy::processMovement( int _frames )
if ( directionChange == 0 )
{
m_targetHeading += -1024 + ( getRnd() % 2049 );
CPlayer *player = GameScene.getPlayer();
if ( player->isHoldingNet() )
{
if ( ( getRnd() % 4 ) == 0 )
{
m_targetHeading = ratan2( playerYDist, playerXDist );
}
else
{
m_targetHeading += -1024 + ( getRnd() % 2049 );
}
}
else
{
m_targetHeading += -1024 + ( getRnd() % 2049 );
}
}
}
}
@ -135,7 +155,7 @@ void CNpcSmallJellyfishBackgroundEnemy::processMovement( int _frames )
if ( processGroundCollisionReverse( &moveX, &moveY ) )
{
m_targetHeading += 2048;
m_targetHeading += 1024;
m_targetHeading &= 4095;
}

View File

@ -40,6 +40,7 @@
u8 CJellyfishGenerator::m_jellyfishCount;
s32 CJellyfishGenerator::m_timer;
u8 CJellyfishGenerator::m_on;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -47,54 +48,75 @@ void CJellyfishGenerator::init()
{
m_timer = 1 * GameState::getOneSecondInFrames();
m_jellyfishCount = 0;
m_on = true;
switch( CLevel::getCurrentChapter() )
{
case 1:
{
switch( CLevel::getCurrentChapterLevel() )
{
case 2:
{
m_on = false;
}
}
break;
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CJellyfishGenerator::think( int _frames, CLevel *level )
{
if ( m_timer <= 0 )
if ( m_on )
{
if ( m_jellyfishCount < 10 )
if ( m_timer <= 0 )
{
// add jellyfish
m_timer = 1 * GameState::getOneSecondInFrames();
m_jellyfishCount++;
CNpcEnemy *enemy;
enemy = new( "jellyfish" ) CNpcSmallJellyfishBackgroundEnemy;
ASSERT(enemy);
enemy->setType( CNpcEnemy::NPC_SMALL_JELLYFISH_BACKGROUND );
enemy->init();
enemy->setLayerCollision( level->getCollisionLayer() );
DVECTOR offset = CLevel::getCameraPos();
DVECTOR startPos;
if ( ( getRnd() % 10 ) > 4 )
if ( m_jellyfishCount < 10 )
{
CNpcSmallJellyfishBackgroundEnemy *jfish = ( CNpcSmallJellyfishBackgroundEnemy * ) enemy;
jfish->setTargetHeading( 0 );
startPos.vx = offset.vx - 20;
}
else
{
CNpcSmallJellyfishBackgroundEnemy *jfish = ( CNpcSmallJellyfishBackgroundEnemy * ) enemy;
jfish->setTargetHeading( 2048 );
startPos.vx = offset.vx + VidGetScrW() + 20;
}
// add jellyfish
startPos.vy = offset.vy + ( getRnd() % VidGetScrH() );
m_timer = 1 * GameState::getOneSecondInFrames();
enemy->setStartPos( startPos.vx >> 4, startPos.vy >> 4 );
enemy->postInit();
m_jellyfishCount++;
CNpcEnemy *enemy;
enemy = new( "jellyfish" ) CNpcSmallJellyfishBackgroundEnemy;
ASSERT(enemy);
enemy->setType( CNpcEnemy::NPC_SMALL_JELLYFISH_BACKGROUND );
enemy->init();
enemy->setLayerCollision( level->getCollisionLayer() );
DVECTOR offset = CLevel::getCameraPos();
DVECTOR startPos;
if ( ( getRnd() % 10 ) > 4 )
{
CNpcSmallJellyfishBackgroundEnemy *jfish = ( CNpcSmallJellyfishBackgroundEnemy * ) enemy;
jfish->setTargetHeading( 0 );
startPos.vx = offset.vx - 20;
}
else
{
CNpcSmallJellyfishBackgroundEnemy *jfish = ( CNpcSmallJellyfishBackgroundEnemy * ) enemy;
jfish->setTargetHeading( 2048 );
startPos.vx = offset.vx + VidGetScrW() + 20;
}
startPos.vy = offset.vy + ( getRnd() % VidGetScrH() );
enemy->setStartPos( startPos.vx >> 4, startPos.vy >> 4 );
enemy->postInit();
}
}
else
{
m_timer -= _frames;
}
}
else
{
m_timer -= _frames;
}
}

View File

@ -31,6 +31,7 @@ public:
protected:
static u8 m_jellyfishCount;
static s32 m_timer;
static u8 m_on;
};
#endif

View File

@ -258,6 +258,7 @@ void CNpcBranchPlatform::render()
m_modelGfx->Render(renderPos,&rotation,&scale);
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR offset = CLevel::getCameraPos();
DVECTOR size;
DVECTOR centre;
int halfLength;

View File

@ -167,6 +167,7 @@ void CNpcCartPlatform::render()
m_modelGfx->Render(renderPos,&rotation,&scale);
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR offset = CLevel::getCameraPos();
DVECTOR size;
DVECTOR centre;
int halfLength;

View File

@ -216,6 +216,7 @@ void CNpcDualPlatform::render()
m_modelGfx->Render(renderPos);
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR offset = CLevel::getCameraPos();
DVECTOR size;
DVECTOR centre;
int halfLength;

View File

@ -49,7 +49,7 @@ void CNpcFallingPlatformGenerator::think( int _frames )
if ( m_timer < 0 )
{
m_timer = GameState::getOneSecondInFrames() + ( getRnd() % ( ( m_data[m_type].initTimer - 1 ) * GameState::getOneSecondInFrames() ) );
m_timer = ( 3 * GameState::getOneSecondInFrames() ) + ( getRnd() % ( ( m_data[m_type].initTimer - 1 ) * GameState::getOneSecondInFrames() ) );
// generate new falling platform

View File

@ -87,6 +87,7 @@ void CNpcFishHookPlatform::render()
m_modelGfx->Render(renderPos);
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR offset = CLevel::getCameraPos();
DVECTOR size;
DVECTOR centre;
int halfLength;

View File

@ -143,7 +143,7 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] =
},
{ // NPC_FISH_HOOK_2_PLATFORM
3,
8,
128,
true,
DAMAGE__NONE,

View File

@ -894,9 +894,9 @@ void CNpcPlatform::render()
DVECTOR &renderPos=getRenderPos();
m_modelGfx->Render(renderPos);
}
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR offset = CLevel::getCameraPos();
DVECTOR size;
DVECTOR centre;
int halfLength;
@ -920,6 +920,7 @@ void CNpcPlatform::render()
DrawLine(x1,y1,x2,y2,0,255,0,0);
#endif
}
}
}

View File

@ -100,7 +100,7 @@ void CNpcPendulumPlatform::processMovement( int _frames )
}
else
{
m_extension += _frames << 3;
m_extension += m_speed * _frames;
}
}
else
@ -111,7 +111,7 @@ void CNpcPendulumPlatform::processMovement( int _frames )
}
else
{
m_extension -= _frames << 3;
m_extension -= m_speed * _frames;
}
}
@ -126,6 +126,8 @@ void CNpcPendulumPlatform::render()
int x1,y1,x2,y2;
int x1Boundary,y1Boundary,x2Boundary,y2Boundary;
DVECTOR offset = CLevel::getCameraPos();
if ( m_isActive )
{
CPlatformThing::render();
@ -159,53 +161,52 @@ void CNpcPendulumPlatform::render()
DrawLine(x1,y1,x2,y2,0,255,0,0);
#endif
/*
x1 = x1Boundary = Pos.vx - offset.vx;
x2 = x2Boundary = m_lineBase.vx - offset.vx;
}
y1 = y1Boundary = Pos.vy - offset.vy;
y2 = y2Boundary = m_lineBase.vy - offset.vy;
x1 = x1Boundary = Pos.vx - offset.vx;
x2 = x2Boundary = m_lineBase.vx - offset.vx;
int angle = ratan2( x1 - x2, y1 - y2 );
y1 = y1Boundary = Pos.vy - offset.vy;
y2 = y2Boundary = m_lineBase.vy - offset.vy;
if ( y2 < 0 )
int angle = ratan2( x1 - x2, y1 - y2 );
if ( y2 < 0 )
{
int yDiff = -y2;
y2 = y2Boundary = 0;
int hyp = ( yDiff << 12 ) / rcos( angle );
x2 += ( hyp * rsin( angle ) ) >> 12;
}
if ( y1 > VidGetScrH() )
{
int yDiff = y1 - VidGetScrH();
y1 = y1Boundary = VidGetScrH();
int hyp = ( yDiff << 12 ) / rcos( angle );
x1 -= ( hyp * rsin( angle ) ) >> 12;
}
if ( x1Boundary > x2Boundary )
{
int tempX = x1Boundary;
x1Boundary = x2Boundary;
x2Boundary = tempX;
}
if ( y1Boundary > y2Boundary )
{
int tempY = y1Boundary;
y1Boundary = y2Boundary;
y2Boundary = tempY;
}
if ( x2Boundary >= 0 && x1Boundary <= VidGetScrW() )
{
if ( y2Boundary >= 0 && y1Boundary <= VidGetScrH() )
{
int yDiff = -y2;
y2 = y2Boundary = 0;
int hyp = ( yDiff << 12 ) / rcos( angle );
x2 += ( hyp * rsin( angle ) ) >> 12;
DrawLine( x1, y1, x2, y2, 0, 0, 0, 0 );
}
if ( y1 > VidGetScrH() )
{
int yDiff = y1 - VidGetScrH();
y1 = y1Boundary = VidGetScrH();
int hyp = ( yDiff << 12 ) / rcos( angle );
x1 -= ( hyp * rsin( angle ) ) >> 12;
}
if ( x1Boundary > x2Boundary )
{
int tempX = x1Boundary;
x1Boundary = x2Boundary;
x2Boundary = tempX;
}
if ( y1Boundary > y2Boundary )
{
int tempY = y1Boundary;
y1Boundary = y2Boundary;
y2Boundary = tempY;
}
if ( x2Boundary >= 0 && x1Boundary <= VidGetScrW() )
{
if ( y2Boundary >= 0 && y1Boundary <= VidGetScrH() )
{
DrawLine( x1, y1, x2, y2, 0, 0, 0, 0 );
}
}
*/
}
}
}

View File

@ -126,6 +126,7 @@ void CNpcRetractingPlatform::render()
m_modelGfx->Render(renderPos,&rotation,&scale);
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR offset = CLevel::getCameraPos();
DVECTOR size;
DVECTOR centre;
int halfLength;

View File

@ -134,6 +134,7 @@ void CNpcSeesawPlatform::render()
m_modelGfx->Render(renderPos,&rotation,&scale);
#if defined (__USER_paul__) || defined (__USER_charles__)
DVECTOR offset = CLevel::getCameraPos();
DVECTOR size;
DVECTOR centre;
int halfLength;