This commit is contained in:
Charles 2001-05-25 20:00:13 +00:00
parent 1d62c1aa7e
commit a17ebb002a
4 changed files with 50 additions and 24 deletions

View file

@ -61,7 +61,8 @@ void CNpcGeyserPlatformGenerator::think( int _frames )
{
case NPC_BUBBLE_PLATFORM:
{
newPlatform = new ("falling platform") CNpcBubblePlatform;
//newPlatform = new ("falling platform") CNpcBubblePlatform;
newPlatform = CNpcPlatform::Create( m_targetType );
break;
}

View file

@ -70,7 +70,8 @@ void CNpcFallingPlatformGenerator::think( int _frames )
case NPC_CRATE_PLATFORM:
case NPC_VERTICAL_OILDRUM_PLATFORM:
{
newPlatform = new ("falling platform") CNpcFallingNoRespawnPlatform;
//newPlatform = new ("falling platform") CNpcFallingNoRespawnPlatform;
newPlatform = CNpcPlatform::Create( m_targetType );
break;
}

View file

@ -169,12 +169,10 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
CNpcPlatform *CNpcPlatform::Create(int Type)
{
CNpcPlatform *platform;
NPC_PLATFORM_UNIT_TYPE Type = getTypeFromMapEdit( ThisPlatform->Type );
platform = (CNpcPlatform*)CThingManager::GetThing(CThing::TYPE_PLATFORM,Type);
if (!platform)
switch( Type )
@ -182,7 +180,6 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
case NPC_LINEAR_PLATFORM:
{
platform = new ("linear platform") CNpcLinearPlatform;
break;
}
@ -268,19 +265,7 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
case NPC_DUAL_PLATFORM:
{
CNpcDualPlatform *dualPlatformMaster;
platform = dualPlatformMaster = new ("dual platform master") CNpcDualPlatform;
dualPlatformMaster->setMaster( true );
CNpcDualPlatform *dualPlatformSlave;
dualPlatformSlave = new ("dual platform slave") CNpcDualPlatform;
dualPlatformSlave->setMaster( false );
dualPlatformMaster->setOtherPlatform( dualPlatformSlave );
dualPlatformSlave->setOtherPlatform( dualPlatformMaster );
dualPlatformSlave->setType( Type );
dualPlatformSlave->setGraphic( ThisPlatform );
dualPlatformSlave->setTiltable( false );
platform = new ("dual platform master") CNpcDualPlatform;
break;
}
@ -389,12 +374,8 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
}
ASSERT(platform);
platform->setType( Type );
platform->setType( (NPC_PLATFORM_UNIT_TYPE) Type );
platform->setThingSubType( Type );
platform->setGraphic( ThisPlatform );
platform->setWaypoints( ThisPlatform );
platform->setTiltable( false );
return( platform );
@ -402,6 +383,48 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
{
CNpcPlatform *platform;
NPC_PLATFORM_UNIT_TYPE Type = getTypeFromMapEdit( ThisPlatform->Type );
platform=Create(Type);
switch( Type )
{
case NPC_DUAL_PLATFORM:
{
CNpcDualPlatform *dualPlatformMaster = (CNpcDualPlatform *) platform;
dualPlatformMaster->setMaster( true );
CNpcDualPlatform *dualPlatformSlave;
dualPlatformSlave = (CNpcDualPlatform *) CNpcPlatform::Create( NPC_DUAL_PLATFORM );
dualPlatformSlave->setMaster( false );
dualPlatformSlave->setType( Type );
dualPlatformSlave->setGraphic( ThisPlatform );
dualPlatformSlave->setTiltable( false );
dualPlatformMaster->setOtherPlatform( dualPlatformSlave );
dualPlatformSlave->setOtherPlatform( dualPlatformMaster );
break;
}
default:
break;
}
ASSERT(platform);
platform->setGraphic( ThisPlatform );
platform->setWaypoints( ThisPlatform );
return( platform );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcPlatform::setWaypoints( sThingPlatform *ThisPlatform )
{
int pointNum;

View file

@ -115,6 +115,7 @@ public:
NPC_PLATFORM_UNIT_TYPE getType() {return( m_type );}
static NPC_PLATFORM_UNIT_TYPE getTypeFromMapEdit( u16 newType );
static CNpcPlatform *Create(int Type);
static CNpcPlatform *Create(sThingPlatform *ThisPlatform);
void setSpeed( s16 newSpeed ) {m_speed = newSpeed;}