This commit is contained in:
Charles 2001-04-24 22:05:29 +00:00
parent 6be6fdb917
commit be70fbdcfa
9 changed files with 135 additions and 11 deletions

View file

@ -162,6 +162,20 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] =
NPC_PLATFORM_TIMER_NONE,
},
{ // NPC_FISH_HOOK_2_PLATFORM
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
3,
128,
true,
DAMAGE__NONE,
0,
4,
NPC_PLATFORM_INFINITE_LIFE,
0,
NPC_PLATFORM_TIMER_NONE,
},
{ // NPC_PLAYER_BUBBLE_PLATFORM
ACTORS_CLAM_SBK,
ANIM_CLAM_SIDESNAP,
@ -189,5 +203,6 @@ CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATF
NPC_GEYSER_PLATFORM,
NPC_BOBBING_PLATFORM,
NPC_CART_PLATFORM,
NPC_FISH_HOOK_2_PLATFORM,
NPC_PLAYER_BUBBLE_PLATFORM,
};

View file

@ -79,6 +79,10 @@
#include "platform\pfalling.h"
#endif
#ifndef __PLATFORM_PPENDULM_H__
#include "platform\ppendulm.h"
#endif
#ifndef __PLATFORM_PPLAYER_H__
#include "platform\pplayer.h"
#endif
@ -91,7 +95,6 @@ class CLayerCollision *CNpcPlatform::m_layerCollision;
CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
{
int pointNum;
CNpcPlatform *platform;
NPC_PLATFORM_UNIT_TYPE platformType = getTypeFromMapEdit( ThisPlatform->Type );
@ -152,8 +155,15 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
break;
}
case NPC_FISH_HOOK_2_PLATFORM:
{
platform = new ("fish hook 2 platform") CNpcPendulumPlatform;
break;
}
default:
{
ASSERT( 0 );
platform = new ("platform") CNpcPlatform;
break;
}
@ -161,6 +171,20 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
ASSERT(platform);
platform->setType( platformType );
platform->setGraphic( ThisPlatform );
platform->setWaypoints( ThisPlatform );
platform->setTiltable( false );
return( platform );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPlatform::setWaypoints( sThingPlatform *ThisPlatform )
{
int pointNum;
u16 *PntList=(u16*)MakePtr(ThisPlatform,sizeof(sThingPlatform));
@ -175,10 +199,9 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
startPos.vx = newXPos << 4;
startPos.vy = newYPos << 4;
platform->init( startPos );
platform->setTiltable( false );
init( startPos );
platform->addWaypoint( newXPos, newYPos );
addWaypoint( newXPos, newYPos );
if ( ThisPlatform->PointCount > 1 )
{
@ -189,11 +212,17 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
newYPos = (u16) *PntList;
PntList++;
platform->addWaypoint( newXPos, newYPos );
addWaypoint( newXPos, newYPos );
}
}
}
return( platform );
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPlatform::setGraphic( sThingPlatform *ThisPlatform )
{
m_modelGfx = new ("ModelGfx") CModelGfx;
m_modelGfx->SetModel( ThisPlatform->Gfx );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -203,9 +232,6 @@ void CNpcPlatform::init()
CPlatformThing::init();
m_modelGfx=new ("ModelGfx") CModelGfx;
m_modelGfx->SetModel(0);
m_animPlaying = true;
m_animNo = m_data[m_type].initAnim;
m_frame = 0;

View file

@ -52,6 +52,7 @@ public:
NPC_BOBBING_PLATFORM,
NPC_FALLING_PLATFORM,
NPC_CART_PLATFORM,
NPC_FISH_HOOK_2_PLATFORM,
NPC_PLAYER_BUBBLE_PLATFORM,
NPC_PLATFORM_TYPE_MAX,
};
@ -70,6 +71,8 @@ public:
virtual s32 getNewYPos( CThing *_thisThing );
void setTiltable( bool isTiltable );
void addWaypoint( s32 xPos, s32 yPos );
void setGraphic( sThingPlatform *ThisPlatform );
virtual void setWaypoints( sThingPlatform *ThisPlatform );
static NPC_PLATFORM_UNIT_TYPE getTypeFromMapEdit( u16 newType );
static CNpcPlatform *Create(sThingPlatform *ThisPlatform);
@ -91,6 +94,16 @@ protected:
NPC_PLATFORM_TIMER_RESPAWN = 1,
};
enum
{
EXTEND_UP = true,
EXTEND_DOWN = false,
EXTEND_RIGHT = true,
EXTEND_LEFT = false,
EXTEND_CLOCKWISE = true,
EXTEND_ANTICLOCKWISE = false,
};
typedef struct NPC_PLATFORM_DATA_TYPE
{
FileEquate ActorType;
@ -157,6 +170,7 @@ protected:
bool m_tiltable;
s32 m_tiltAngle;
s32 m_tiltVelocity;
bool m_extendDir;
int m_frame;
int m_animNo;

View file

@ -15,14 +15,53 @@
#include "platform\ppendulm.h"
#endif
#ifndef __UTILS_HEADER__
#include "utils\utils.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPendulumPlatform::postInit()
{
m_extendDir = EXTEND_LEFT;
m_extension = 0;
m_heading = 1024;
m_length = 200;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPendulumPlatform::setWaypoints( sThingPlatform *ThisPlatform )
{
int pointNum;
u16 *PntList=(u16*)MakePtr(ThisPlatform,sizeof(sThingPlatform));
u16 initYPos, newXPos, newYPos;
newXPos = (u16) *PntList;
PntList++;
initYPos = newYPos = (u16) *PntList;
PntList++;
DVECTOR startPos;
startPos.vx = newXPos << 4;
startPos.vy = newYPos << 4;
init( startPos );
if ( ThisPlatform->PointCount > 1 )
{
newXPos = (u16) *PntList;
PntList++;
newYPos = (u16) *PntList;
PntList++;
m_length = ( newYPos - initYPos ) << 4;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPendulumPlatform::processMovement( int _frames )
{
if ( m_extendDir == EXTEND_LEFT )

View file

@ -23,6 +23,7 @@ class CNpcPendulumPlatform : public CNpcPlatform
public:
virtual void postInit();
protected:
virtual void setWaypoints( sThingPlatform *ThisPlatform );
virtual void processMovement( int _frames );
s32 m_length;