This commit is contained in:
parent
ec7b344da1
commit
9d18ec51df
@ -23,6 +23,14 @@
|
||||
#include "utils\utils.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLAYER_PLAYER_H__
|
||||
#include "player\player.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VID_HEADER_
|
||||
#include "system\vid.h"
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -31,6 +39,8 @@ void CNpcGaryFriend::postInit()
|
||||
CNpcFriend::postInit();
|
||||
|
||||
m_started = false;
|
||||
m_fallDeath = false;
|
||||
m_drawRotation = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -39,6 +49,27 @@ void CNpcGaryFriend::think( int _frames )
|
||||
{
|
||||
CNpcFriend::think(_frames);
|
||||
|
||||
if ( m_fallDeath )
|
||||
{
|
||||
m_drawRotation += 64 * _frames;
|
||||
m_drawRotation &= 4095;
|
||||
|
||||
Pos.vy += m_speed * _frames;
|
||||
|
||||
if ( m_speed < 5 )
|
||||
{
|
||||
m_speed++;
|
||||
}
|
||||
|
||||
DVECTOR offset = CLevel::getCameraPos();
|
||||
|
||||
if ( Pos.vy - offset.vy > VidGetScrH() )
|
||||
{
|
||||
setToShutdown();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s8 multiplier = -1 + ( 2 * m_extension );
|
||||
s32 maxHeight = 20;
|
||||
s32 fallSpeed = 3;
|
||||
@ -49,6 +80,25 @@ void CNpcGaryFriend::think( int _frames )
|
||||
|
||||
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
|
||||
|
||||
switch ( CGameScene::getCollision()->getCollisionBlock( Pos.vx, Pos.vy ) & COLLISION_TYPE_MASK )
|
||||
{
|
||||
case COLLISION_TYPE_FLAG_DEATH_FALL:
|
||||
case COLLISION_TYPE_FLAG_DEATH_INSTANT:
|
||||
case COLLISION_TYPE_FLAG_DEATH_LIQUID:
|
||||
{
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
player->takeDamage( DAMAGE__KILL_OUTRIGHT );
|
||||
|
||||
m_speed = -5;
|
||||
m_fallDeath = true;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ( m_platform )
|
||||
{
|
||||
s32 platformHeight = m_platform->getHeightFromPlatformAtPosition( Pos.vx, Pos.vy );
|
||||
@ -120,6 +170,7 @@ void CNpcGaryFriend::think( int _frames )
|
||||
Pos.vy += yMovement;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -155,13 +206,16 @@ void CNpcGaryFriend::render()
|
||||
{
|
||||
CNpcThing::render();
|
||||
|
||||
POLY_FT4 *frame;
|
||||
|
||||
// Render
|
||||
|
||||
if (canRender())
|
||||
{
|
||||
DVECTOR &renderPos=getRenderPos();
|
||||
|
||||
m_actorGfx->Render(renderPos,m_animNo,(m_frame>>8),m_reversed);
|
||||
frame = m_actorGfx->Render(renderPos,m_animNo,(m_frame>>8),m_reversed);
|
||||
m_actorGfx->RotateScale( frame, renderPos, m_drawRotation, 4096, 4096 );
|
||||
|
||||
sBBox boundingBox = m_actorGfx->GetBBox();
|
||||
boundingBox.YMax = 0;
|
||||
|
@ -35,6 +35,9 @@ public:
|
||||
protected:
|
||||
DVECTOR m_triggerPos;
|
||||
u8 m_started;
|
||||
u8 m_fallDeath;
|
||||
s16 m_speed;
|
||||
s16 m_drawRotation;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user