This commit is contained in:
Charles 2001-04-27 11:52:40 +00:00
parent f0dfe1ac95
commit c3df1a873c
3 changed files with 25 additions and 14 deletions

View file

@ -247,11 +247,19 @@ void CNpcPlatform::setGraphic( sThingPlatform *ThisPlatform )
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPlatform::setGraphic( u8 graphicNum )
{
m_modelGfx = new ("ModelGfx") CModelGfx;
m_modelGfx->SetModel( graphicNum );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPlatform::init() void CNpcPlatform::init()
{ {
CPlatformThing::init(); CPlatformThing::init();
m_animPlaying = true; m_animPlaying = true;
m_animNo = m_data[m_type].initAnim; m_animNo = m_data[m_type].initAnim;
m_frame = 0; m_frame = 0;
@ -412,7 +420,7 @@ void CNpcPlatform::processLifetime( int _frames )
void CNpcPlatform::think(int _frames) void CNpcPlatform::think(int _frames)
{ {
if ( m_isActive ) if ( m_isActive )
{ {
if ( m_tiltable ) if ( m_tiltable )
@ -650,12 +658,12 @@ void CNpcPlatform::render()
centre=getCollisionCentre(); centre=getCollisionCentre();
area=getCollisionArea(); area=getCollisionArea();
halfLength=(area.x2-area.x1)/2; halfLength=(area.x2-area.x1)/2;
x1=-halfLength*mcos(getCollisionAngle()&4095)>>12; x1=-halfLength*mcos(getCollisionAngle()&4095)>>12;
y1=-halfLength*msin(getCollisionAngle()&4095)>>12; y1=-halfLength*msin(getCollisionAngle()&4095)>>12;
x2=+halfLength*mcos(getCollisionAngle()&4095)>>12; x2=+halfLength*mcos(getCollisionAngle()&4095)>>12;
y2=+halfLength*msin(getCollisionAngle()&4095)>>12; y2=+halfLength*msin(getCollisionAngle()&4095)>>12;
centre.vx-=offset.vx; centre.vx-=offset.vx;
centre.vy-=offset.vy; centre.vy-=offset.vy;
x1+=centre.vx; x1+=centre.vx;
@ -714,7 +722,7 @@ s32 CNpcPlatform::getNewYPos(CThing *_thisThing)
// now find the highest y pos // now find the highest y pos
// first set highestY to lowest of the four points // first set highestY to lowest of the four points
s16 highestY = testPoints[0].vy; s16 highestY = testPoints[0].vy;
for ( i = 1 ; i < 4 ; i++ ) for ( i = 1 ; i < 4 ; i++ )
@ -976,4 +984,4 @@ void CNpcPlatform::setTypeFromMapEdit( u16 newType )
CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::getTypeFromMapEdit( u16 newType ) CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::getTypeFromMapEdit( u16 newType )
{ {
return( mapEditConvertTable[newType] ); return( mapEditConvertTable[newType] );
} }

View file

@ -3,9 +3,9 @@
platform.h platform.h
Author: CRB Author: CRB
Created: Created:
Project: Spongebob Project: Spongebob
Purpose: Purpose:
Copyright (c) 2000 Climax Development Ltd Copyright (c) 2000 Climax Development Ltd
@ -76,8 +76,9 @@ public:
void setTiltable( bool isTiltable ); void setTiltable( bool isTiltable );
void addWaypoint( s32 xPos, s32 yPos ); void addWaypoint( s32 xPos, s32 yPos );
void setGraphic( sThingPlatform *ThisPlatform ); void setGraphic( sThingPlatform *ThisPlatform );
void setGraphic( u8 graphicNum );
virtual void setWaypoints( sThingPlatform *ThisPlatform ); virtual void setWaypoints( sThingPlatform *ThisPlatform );
static NPC_PLATFORM_UNIT_TYPE getTypeFromMapEdit( u16 newType ); static NPC_PLATFORM_UNIT_TYPE getTypeFromMapEdit( u16 newType );
static CNpcPlatform *Create(sThingPlatform *ThisPlatform); static CNpcPlatform *Create(sThingPlatform *ThisPlatform);
@ -154,7 +155,7 @@ protected:
static class CLayerCollision *m_layerCollision; static class CLayerCollision *m_layerCollision;
// internal variables // internal variables
NPC_PLATFORM_UNIT_TYPE m_type; NPC_PLATFORM_UNIT_TYPE m_type;
CNpcPath m_npcPath; CNpcPath m_npcPath;
s32 m_heading; s32 m_heading;
@ -191,4 +192,4 @@ protected:
/*****************************************************************************/ /*****************************************************************************/
#endif #endif

View file

@ -3,9 +3,9 @@
pmbubble.cpp pmbubble.cpp
Author: PKG Author: PKG
Created: Created:
Project: Spongebob Project: Spongebob
Purpose: Purpose:
Copyright (c) 2001 Climax Development Ltd Copyright (c) 2001 Climax Development Ltd
@ -106,6 +106,8 @@ void CPlayerModeBubbleMixture::think()
DVECTOR pos; DVECTOR pos;
bubble=new ("bubble platform") CNpcPlayerBubblePlatform; bubble=new ("bubble platform") CNpcPlayerBubblePlatform;
bubble->setType( CNpcPlatform::NPC_PLAYER_BUBBLE_PLATFORM ); bubble->setType( 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;
@ -211,4 +213,4 @@ int CPlayerModeBubbleMixture::canBlowBubbleFromThisState()
} }
/*=========================================================================== /*===========================================================================
end */ end */