This commit is contained in:
parent
ef05298c70
commit
fbace83cd3
17 changed files with 168 additions and 93 deletions
|
@ -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 ) );
|
||||
|
|
|
@ -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 ) );
|
||||
|
|
|
@ -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;
|
||||
|
||||
s32 groundHeight = m_layerCollision->getHeightFromGround( Pos.vx, Pos.vy, 16 );
|
||||
|
||||
if ( groundHeight < 8 )
|
||||
{
|
||||
Pos.vy += groundHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
Pos.vy += otherDelta.vy;
|
||||
}
|
||||
|
||||
m_heading = headingFromTarget;
|
||||
|
||||
|
|
|
@ -299,6 +299,7 @@ protected:
|
|||
u8 m_isBlowerOn;
|
||||
DVECTOR m_caughtPos;
|
||||
s16 m_speed;
|
||||
u8 m_isDying;
|
||||
|
||||
s32 m_frame;
|
||||
int m_animNo;
|
||||
|
|
|
@ -27,6 +27,10 @@
|
|||
#include "system\vid.h"
|
||||
#endif
|
||||
|
||||
#ifndef __GAME_GAME_H__
|
||||
#include "game\game.h"
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -70,10 +74,26 @@ void CNpcSmallJellyfishBackgroundEnemy::processMovement( int _frames )
|
|||
u8 directionChange = getRnd() % 100;
|
||||
|
||||
if ( directionChange == 0 )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 moveX, moveY, moveDist, moveVel;
|
||||
|
@ -135,7 +155,7 @@ void CNpcSmallJellyfishBackgroundEnemy::processMovement( int _frames )
|
|||
|
||||
if ( processGroundCollisionReverse( &moveX, &moveY ) )
|
||||
{
|
||||
m_targetHeading += 2048;
|
||||
m_targetHeading += 1024;
|
||||
m_targetHeading &= 4095;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
u8 CJellyfishGenerator::m_jellyfishCount;
|
||||
s32 CJellyfishGenerator::m_timer;
|
||||
u8 CJellyfishGenerator::m_on;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -47,12 +48,32 @@ 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_on )
|
||||
{
|
||||
if ( m_timer <= 0 )
|
||||
{
|
||||
if ( m_jellyfishCount < 10 )
|
||||
|
@ -96,6 +117,7 @@ void CJellyfishGenerator::think( int _frames, CLevel *level )
|
|||
{
|
||||
m_timer -= _frames;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -31,6 +31,7 @@ public:
|
|||
protected:
|
||||
static u8 m_jellyfishCount;
|
||||
static s32 m_timer;
|
||||
static u8 m_on;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
@ -921,6 +921,7 @@ void CNpcPlatform::render()
|
|||
DrawLine(x1,y1,x2,y2,0,255,0,0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -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,7 +161,8 @@ 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;
|
||||
|
||||
|
@ -205,7 +208,5 @@ void CNpcPendulumPlatform::render()
|
|||
DrawLine( x1, y1, x2, y2, 0, 0, 0, 0 );
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue