This commit is contained in:
Charles 2001-05-23 16:01:00 +00:00
parent c27dd4413b
commit e7a4db50cc
11 changed files with 381 additions and 2 deletions

View file

@ -371,6 +371,18 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] =
NPC_PLATFORM_TIMER_NONE,
},
{ // NPC_RISING_BRIDGE_PLATFORM
3,
128,
true,
DAMAGE__NONE,
0,
4,
NPC_PLATFORM_INFINITE_LIFE,
0,
NPC_PLATFORM_TIMER_NONE,
},
{ // NPC_PLAYER_BUBBLE_PLATFORM
3,
128,
@ -425,6 +437,7 @@ CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATF
NPC_STEERABLE_BARREL_PLATFORM,
NPC_JELLYFISH_PLATFORM,
NPC_FISH_HOOK_3_PLATFORM,
NPC_RISING_BRIDGE_PLATFORM,
NPC_PLAYER_BUBBLE_PLATFORM,
NPC_CLAM_PLATFORM,
};

View file

@ -147,6 +147,10 @@
#include "platform\pfishhk3.h"
#endif
#ifndef __PLATFORM_PRBRIDGE_H__
#include "platform\prbridge.h"
#endif
#include "fx\fx.h"
#include "fx\fxjfish.h"
@ -344,6 +348,12 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
break;
}
case NPC_RISING_BRIDGE_PLATFORM:
{
platform = new ("rising bridge platform") CNpcRisingBridgePlatform;
break;
}
default:
{
ASSERT( 0 );

View file

@ -81,6 +81,7 @@ public:
NPC_STEERABLE_BARREL_PLATFORM,
NPC_JELLYFISH_PLATFORM,
NPC_FISH_HOOK_3_PLATFORM,
NPC_RISING_BRIDGE_PLATFORM,
NPC_PLAYER_BUBBLE_PLATFORM,
NPC_CLAM_PLATFORM,
NPC_PLATFORM_TYPE_MAX,
@ -105,6 +106,7 @@ public:
void setGraphic( sThingPlatform *ThisPlatform );
void setGraphic( u8 graphicNum );
virtual void setWaypoints( sThingPlatform *ThisPlatform );
virtual void trigger() {;}
static NPC_PLATFORM_UNIT_TYPE getTypeFromMapEdit( u16 newType );
static CNpcPlatform *Create(sThingPlatform *ThisPlatform);

View file

@ -0,0 +1,120 @@
/*=========================================================================
prbridge.cpp
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __PLATFORM_PRBRIDGE_H__
#include "platform\prbridge.h"
#endif
#ifndef __TRIGGERS_TPLATFRM_H__
#include "triggers\tplatfrm.h"
#endif
#ifndef __UTILS_HEADER__
#include "utils\utils.h"
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcRisingBridgePlatform::postInit()
{
CNpcPlatform::postInit();
m_triggered = false;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcRisingBridgePlatform::trigger()
{
m_triggered = true;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcRisingBridgePlatform::setWaypoints( sThingPlatform *ThisPlatform )
{
ASSERT( ThisPlatform->PointCount == 3 );
u16 *PntList=(u16*)MakePtr(ThisPlatform,sizeof(sThingPlatform));
u16 newXPos, newYPos;
// get master platform init pos
newXPos = (u16) *PntList;
PntList++;
newYPos = (u16) *PntList;
PntList++;
DVECTOR startPos;
startPos.vx = newXPos << 4;
startPos.vy = newYPos << 4;
init( startPos );
m_extension = 0;
// get master platform max vertical extension
newXPos = (u16) *PntList;
PntList++;
newYPos = (u16) *PntList;
PntList++;
m_maxExtension = abs( ( newYPos << 4 ) - startPos.vy ) << 8;
// get slave trigger position
newXPos = (u16) *PntList;
PntList++;
newYPos = (u16) *PntList;
PntList++;
CPlatformTrigger *trigger = NULL; // I hate having to do this just to keep the compiler quiet :/ (pkg)
trigger = new ("PlatformTrigger") CPlatformTrigger();
ASSERT( trigger );
trigger->init();
trigger->setPositionAndSize( newXPos << 4, newYPos << 4, 100, 0 );
//trigger->setTargetBox(TriggerList->TargetPos.X<<4,TriggerList->TargetPos.Y<<4,TriggerList->TargetSize.X<<4,TriggerList->TargetSize.Y<<4);
trigger->setPlatform( this );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void CNpcRisingBridgePlatform::processMovement( int _frames )
{
if ( m_triggered )
{
m_triggered = false;
m_extension += ( m_data[m_type].speed * _frames ) << 8;
if ( m_extension > m_maxExtension )
{
m_extension = m_maxExtension;
}
}
else
{
m_extension -= 64 * _frames;
if ( m_extension < 0 )
{
m_extension = 0;
}
}
Pos.vy = m_base.vy - ( m_extension >> 8 );
}

View file

@ -0,0 +1,34 @@
/*=========================================================================
prbridge.h
Author: CRB
Created:
Project: Spongebob
Purpose:
Copyright (c) 2001 Climax Development Ltd
===========================================================================*/
#ifndef __PLATFORM_PRBRIDGE_H__
#define __PLATFORM_PRBRIDGE_H__
#ifndef __PLATFORM_PLATFORM_H__
#include "platform\platform.h"
#endif
class CNpcRisingBridgePlatform : public CNpcPlatform
{
public:
virtual void postInit();
virtual void trigger();
protected:
virtual void setWaypoints( sThingPlatform *ThisPlatform );
virtual void processMovement( int _frames );
s32 m_maxExtension;
u8 m_triggered;
};
#endif