This commit is contained in:
parent
c27dd4413b
commit
e7a4db50cc
11 changed files with 381 additions and 2 deletions
|
@ -122,7 +122,8 @@ platform_src := platform \
|
||||||
psbarrel \
|
psbarrel \
|
||||||
pjellfsh \
|
pjellfsh \
|
||||||
pclam \
|
pclam \
|
||||||
pfishhk3
|
pfishhk3 \
|
||||||
|
prbridge
|
||||||
|
|
||||||
hazard_src := hazard \
|
hazard_src := hazard \
|
||||||
hfalling \
|
hfalling \
|
||||||
|
@ -275,7 +276,8 @@ triggers_src := tcamlock \
|
||||||
tlook \
|
tlook \
|
||||||
trestart \
|
trestart \
|
||||||
tteleprt \
|
tteleprt \
|
||||||
twater
|
twater \
|
||||||
|
tplatfrm
|
||||||
|
|
||||||
utils_src := utils \
|
utils_src := utils \
|
||||||
sincos \
|
sincos \
|
||||||
|
|
|
@ -371,6 +371,18 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] =
|
||||||
NPC_PLATFORM_TIMER_NONE,
|
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
|
{ // NPC_PLAYER_BUBBLE_PLATFORM
|
||||||
3,
|
3,
|
||||||
128,
|
128,
|
||||||
|
@ -425,6 +437,7 @@ CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATF
|
||||||
NPC_STEERABLE_BARREL_PLATFORM,
|
NPC_STEERABLE_BARREL_PLATFORM,
|
||||||
NPC_JELLYFISH_PLATFORM,
|
NPC_JELLYFISH_PLATFORM,
|
||||||
NPC_FISH_HOOK_3_PLATFORM,
|
NPC_FISH_HOOK_3_PLATFORM,
|
||||||
|
NPC_RISING_BRIDGE_PLATFORM,
|
||||||
NPC_PLAYER_BUBBLE_PLATFORM,
|
NPC_PLAYER_BUBBLE_PLATFORM,
|
||||||
NPC_CLAM_PLATFORM,
|
NPC_CLAM_PLATFORM,
|
||||||
};
|
};
|
||||||
|
|
|
@ -147,6 +147,10 @@
|
||||||
#include "platform\pfishhk3.h"
|
#include "platform\pfishhk3.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_PRBRIDGE_H__
|
||||||
|
#include "platform\prbridge.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "fx\fx.h"
|
#include "fx\fx.h"
|
||||||
#include "fx\fxjfish.h"
|
#include "fx\fxjfish.h"
|
||||||
|
|
||||||
|
@ -344,6 +348,12 @@ CNpcPlatform *CNpcPlatform::Create(sThingPlatform *ThisPlatform)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case NPC_RISING_BRIDGE_PLATFORM:
|
||||||
|
{
|
||||||
|
platform = new ("rising bridge platform") CNpcRisingBridgePlatform;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
ASSERT( 0 );
|
ASSERT( 0 );
|
||||||
|
|
|
@ -81,6 +81,7 @@ public:
|
||||||
NPC_STEERABLE_BARREL_PLATFORM,
|
NPC_STEERABLE_BARREL_PLATFORM,
|
||||||
NPC_JELLYFISH_PLATFORM,
|
NPC_JELLYFISH_PLATFORM,
|
||||||
NPC_FISH_HOOK_3_PLATFORM,
|
NPC_FISH_HOOK_3_PLATFORM,
|
||||||
|
NPC_RISING_BRIDGE_PLATFORM,
|
||||||
NPC_PLAYER_BUBBLE_PLATFORM,
|
NPC_PLAYER_BUBBLE_PLATFORM,
|
||||||
NPC_CLAM_PLATFORM,
|
NPC_CLAM_PLATFORM,
|
||||||
NPC_PLATFORM_TYPE_MAX,
|
NPC_PLATFORM_TYPE_MAX,
|
||||||
|
@ -105,6 +106,7 @@ public:
|
||||||
void setGraphic( sThingPlatform *ThisPlatform );
|
void setGraphic( sThingPlatform *ThisPlatform );
|
||||||
void setGraphic( u8 graphicNum );
|
void setGraphic( u8 graphicNum );
|
||||||
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
||||||
|
virtual void trigger() {;}
|
||||||
|
|
||||||
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);
|
||||||
|
|
120
source/platform/prbridge.cpp
Normal file
120
source/platform/prbridge.cpp
Normal 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 );
|
||||||
|
}
|
34
source/platform/prbridge.h
Normal file
34
source/platform/prbridge.h
Normal 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
|
110
source/triggers/tplatfrm.cpp
Normal file
110
source/triggers/tplatfrm.cpp
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
tplatfrm.cpp
|
||||||
|
|
||||||
|
Author: PKG
|
||||||
|
Created:
|
||||||
|
Project: Spongebob
|
||||||
|
Purpose:
|
||||||
|
|
||||||
|
Copyright (c) 2001 Climax Development Ltd
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Includes
|
||||||
|
-------- */
|
||||||
|
|
||||||
|
#include "triggers\tplatfrm.h"
|
||||||
|
|
||||||
|
#ifndef __GAME_GAME_H__
|
||||||
|
#include "game\game.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Std Lib
|
||||||
|
------- */
|
||||||
|
|
||||||
|
/* Data
|
||||||
|
---- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Tyepdefs && Defines
|
||||||
|
------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Structure defintions
|
||||||
|
-------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function Prototypes
|
||||||
|
------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Vars
|
||||||
|
---- */
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
#if defined (__USER_art__) || defined (__USER_sbart__)
|
||||||
|
#include "gfx\prim.h"
|
||||||
|
void CPlatformTrigger::render()
|
||||||
|
{
|
||||||
|
DVECTOR ofs;
|
||||||
|
CRECT area;
|
||||||
|
|
||||||
|
CTriggerThing::render();
|
||||||
|
|
||||||
|
ofs=CLevel::getCameraPos();
|
||||||
|
area=getCollisionArea();
|
||||||
|
area.x1-=ofs.vx;
|
||||||
|
area.y1-=ofs.vy;
|
||||||
|
area.x2-=ofs.vx;
|
||||||
|
area.y2-=ofs.vy;
|
||||||
|
|
||||||
|
if(area.x1<=511&&area.x2>=0&&
|
||||||
|
area.y1<=255&&area.y2>=0)
|
||||||
|
{
|
||||||
|
POLY_F4 *f4;
|
||||||
|
f4=GetPrimF4();
|
||||||
|
setXY4(f4,area.x1,area.y1,
|
||||||
|
area.x2,area.y1,
|
||||||
|
area.x1,area.y2,
|
||||||
|
area.x2,area.y2);
|
||||||
|
setRGB0(f4,0,255,0);
|
||||||
|
setSemiTrans(f4,true);
|
||||||
|
AddPrimToList(f4,0);
|
||||||
|
DrawLine(area.x1,area.y1,area.x2,area.y1,0,255,0,0);
|
||||||
|
DrawLine(area.x2,area.y1,area.x2,area.y2,0,255,0,0);
|
||||||
|
DrawLine(area.x2,area.y2,area.x1,area.y2,0,255,0,0);
|
||||||
|
DrawLine(area.x1,area.y2,area.x1,area.y1,0,255,0,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Function:
|
||||||
|
Purpose:
|
||||||
|
Params:
|
||||||
|
Returns:
|
||||||
|
---------------------------------------------------------------------- */
|
||||||
|
void CPlatformTrigger::collidedWith(CThing *_thisThing)
|
||||||
|
{
|
||||||
|
ASSERT(_thisThing->getThingType()==TYPE_PLAYER);
|
||||||
|
|
||||||
|
CPlayer *player = (CPlayer *) _thisThing;
|
||||||
|
ATTACK_STATE playerState = player->getAttackState();
|
||||||
|
|
||||||
|
if ( playerState == ATTACK_STATE__BUTT_BOUNCE )
|
||||||
|
{
|
||||||
|
m_platform->trigger();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
end */
|
68
source/triggers/tplatfrm.h
Normal file
68
source/triggers/tplatfrm.h
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/*=========================================================================
|
||||||
|
|
||||||
|
tplatfrm.h
|
||||||
|
|
||||||
|
Author: Charles Blair
|
||||||
|
Created:
|
||||||
|
Project: Spongebob
|
||||||
|
Purpose:
|
||||||
|
|
||||||
|
Copyright (c) 2001 Climax Development Ltd
|
||||||
|
|
||||||
|
===========================================================================*/
|
||||||
|
|
||||||
|
#ifndef __TRIGGERS_TPLATFRM_H__
|
||||||
|
#define __TRIGGERS_TPLATFRM_H__
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Includes
|
||||||
|
-------- */
|
||||||
|
|
||||||
|
#ifndef __THING_THING_H__
|
||||||
|
#include "thing/thing.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_PLATFORM_H__
|
||||||
|
#include "platform\platform.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Std Lib
|
||||||
|
------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Tyepdefs && Defines
|
||||||
|
------------------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Structure defintions
|
||||||
|
-------------------- */
|
||||||
|
|
||||||
|
class CPlatformTrigger : public CTriggerThing
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
#if defined (__USER_art__) || defined (__USER_sbart__)
|
||||||
|
virtual void render();
|
||||||
|
#endif
|
||||||
|
virtual void setPlatform( CNpcPlatform *platform ) {m_platform = platform;}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
|
||||||
|
CNpcPlatform *m_platform;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Globals
|
||||||
|
------- */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------
|
||||||
|
Functions
|
||||||
|
--------- */
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#endif /* __TRIGGERS_TPLATFRM_H__ */
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
end */
|
|
@ -110,6 +110,7 @@ SteerableBarrelPlatform=24
|
||||||
RockGeyser=7
|
RockGeyser=7
|
||||||
Retracting=6
|
Retracting=6
|
||||||
RollingOildrumPlatform=24
|
RollingOildrumPlatform=24
|
||||||
|
RisingBridge=27
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
# Triggers
|
# Triggers
|
||||||
|
|
|
@ -105,3 +105,6 @@ Gfx=..\..\Graphics\platforms\Wooden\Wooden.gin
|
||||||
|
|
||||||
[RollingOildrumPlatform]
|
[RollingOildrumPlatform]
|
||||||
Gfx=..\..\Graphics\platforms\rolling_oildrum\roll_oil.gin
|
Gfx=..\..\Graphics\platforms\rolling_oildrum\roll_oil.gin
|
||||||
|
|
||||||
|
[RisingBridge]
|
||||||
|
Gfx=..\..\Graphics\platforms\seesaw\seesaw_wooden.gin
|
||||||
|
|
|
@ -1397,6 +1397,14 @@ SOURCE=..\..\..\source\platform\praft.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\platform\prbridge.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\platform\prbridge.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\..\source\platform\pretract.cpp
|
SOURCE=..\..\..\source\platform\pretract.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -1841,6 +1849,14 @@ SOURCE=..\..\..\source\triggers\tlook.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\triggers\tplatfrm.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\..\..\source\triggers\tplatfrm.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\..\..\source\triggers\trestart.cpp
|
SOURCE=..\..\..\source\triggers\trestart.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue