This commit is contained in:
parent
ce72350adc
commit
6ef299f292
9 changed files with 225 additions and 1 deletions
|
@ -130,7 +130,8 @@ platform_src := platform \
|
|||
pconveyr \
|
||||
pplayer \
|
||||
pcbubble \
|
||||
pdrop
|
||||
pdrop \
|
||||
psswitch
|
||||
|
||||
hazard_src := hazard \
|
||||
hfalling \
|
||||
|
|
|
@ -478,6 +478,18 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] =
|
|||
0,
|
||||
NPC_PLATFORM_TIMER_NONE,
|
||||
},
|
||||
|
||||
{ // NPC_STEAM_SWITCH_PLATFORM
|
||||
2,
|
||||
128,
|
||||
true,
|
||||
DAMAGE__NONE,
|
||||
0,
|
||||
2,
|
||||
NPC_PLATFORM_INFINITE_LIFE,
|
||||
0,
|
||||
NPC_PLATFORM_TIMER_NONE,
|
||||
},
|
||||
};
|
||||
|
||||
CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATFORM_TYPE_MAX] =
|
||||
|
@ -515,6 +527,7 @@ CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATF
|
|||
NPC_CONVEYOR_GENERATOR,
|
||||
NPC_COLLAPSING_ACRID_PLATFORM,
|
||||
NPC_DROP_PLATFORM,
|
||||
NPC_STEAM_SWITCH_PLATFORM,
|
||||
NPC_CONVEYOR_PLATFORM,
|
||||
NPC_PLAYER_BUBBLE_PLATFORM,
|
||||
NPC_CLAM_PLATFORM,
|
||||
|
|
|
@ -175,6 +175,10 @@
|
|||
#include "platform\pdrop.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLATFORM_PSSWITCH_H__
|
||||
#include "platform\psswitch.h"
|
||||
#endif
|
||||
|
||||
#include "fx\fx.h"
|
||||
#include "fx\fxjfish.h"
|
||||
|
||||
|
@ -401,6 +405,12 @@ CNpcPlatform *CNpcPlatform::Create(int Type)
|
|||
break;
|
||||
}
|
||||
|
||||
case NPC_STEAM_SWITCH_PLATFORM:
|
||||
{
|
||||
platform = new ("steam switch platform") CNpcSteamSwitchPlatform;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
ASSERT( 0 );
|
||||
|
|
|
@ -90,6 +90,7 @@ public:
|
|||
NPC_CLAM_PLATFORM,
|
||||
NPC_COLLAPSING_ACRID_PLATFORM,
|
||||
NPC_DROP_PLATFORM,
|
||||
NPC_STEAM_SWITCH_PLATFORM,
|
||||
NPC_PLATFORM_TYPE_MAX,
|
||||
};
|
||||
enum
|
||||
|
|
148
source/platform/psswitch.cpp
Normal file
148
source/platform/psswitch.cpp
Normal file
|
@ -0,0 +1,148 @@
|
|||
/*=========================================================================
|
||||
|
||||
psswitch.cpp
|
||||
|
||||
Author: CRB
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2001 Climax Development Ltd
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __PLATFORM_PSSWITCH_H__
|
||||
#include "platform\psswitch.h"
|
||||
#endif
|
||||
|
||||
#ifndef __GAME_GAME_H__
|
||||
#include "game\game.h"
|
||||
#endif
|
||||
|
||||
#ifndef __UTILS_HEADER__
|
||||
#include "utils\utils.h"
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcSteamSwitchPlatform::postInit()
|
||||
{
|
||||
CNpcPlatform::postInit();
|
||||
|
||||
m_state = NPC_STEAM_SWITCH_STOP;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcSteamSwitchPlatform::processMovement( int _frames )
|
||||
{
|
||||
switch( m_state )
|
||||
{
|
||||
case NPC_STEAM_SWITCH_STOP:
|
||||
{
|
||||
if ( m_contact )
|
||||
{
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
ATTACK_STATE playerState = player->getAttackState();
|
||||
|
||||
if ( playerState == ATTACK_STATE__BUTT_BOUNCE )
|
||||
{
|
||||
m_state = NPC_STEAM_SWITCH_DEPRESS;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case NPC_STEAM_SWITCH_DEPRESS:
|
||||
{
|
||||
s32 extension = m_maxExtension - m_extension;
|
||||
s32 maxMove = m_speed * _frames;
|
||||
|
||||
if ( extension > maxMove )
|
||||
{
|
||||
extension = maxMove;
|
||||
}
|
||||
else if ( extension < -maxMove )
|
||||
{
|
||||
extension = -maxMove;
|
||||
}
|
||||
|
||||
if ( extension )
|
||||
{
|
||||
m_extension += extension;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_state = NPC_STEAM_SWITCH_RETURN;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case NPC_STEAM_SWITCH_RETURN:
|
||||
{
|
||||
s32 extension = -m_extension;
|
||||
s32 maxMove = m_speed * _frames;
|
||||
|
||||
if ( extension > maxMove )
|
||||
{
|
||||
extension = maxMove;
|
||||
}
|
||||
else if ( extension < -maxMove )
|
||||
{
|
||||
extension = -maxMove;
|
||||
}
|
||||
|
||||
if ( extension )
|
||||
{
|
||||
m_extension += extension;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_state = NPC_STEAM_SWITCH_STOP;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Pos.vy = m_base.vy + m_extension;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcSteamSwitchPlatform::setWaypoints( sThingPlatform *ThisPlatform )
|
||||
{
|
||||
int pointNum;
|
||||
|
||||
u16 *PntList=(u16*)MakePtr(ThisPlatform,sizeof(sThingPlatform));
|
||||
|
||||
u16 newXPos, newYPos;
|
||||
|
||||
newXPos = (u16) *PntList;
|
||||
PntList++;
|
||||
newYPos = (u16) *PntList;
|
||||
PntList++;
|
||||
|
||||
DVECTOR startPos;
|
||||
startPos.vx = ( newXPos << 4 ) + 8;
|
||||
startPos.vy = ( newYPos << 4 ) + 16;
|
||||
|
||||
init( startPos );
|
||||
|
||||
if ( ThisPlatform->PointCount > 1 )
|
||||
{
|
||||
newXPos = (u16) *PntList;
|
||||
PntList++;
|
||||
newYPos = (u16) *PntList;
|
||||
PntList++;
|
||||
|
||||
m_maxExtension = ( ( newYPos << 4 ) + 16 ) - startPos.vy;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_maxExtension = 100;
|
||||
}
|
||||
}
|
39
source/platform/psswitch.h
Normal file
39
source/platform/psswitch.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*=========================================================================
|
||||
|
||||
psswitch.h
|
||||
|
||||
Author: CRB
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2001 Climax Development Ltd
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __PLATFORM_PSSWITCH_H__
|
||||
#define __PLATFORM_PSSWITCH_H__
|
||||
|
||||
#ifndef __PLATFORM_PLATFORM_H__
|
||||
#include "platform\platform.h"
|
||||
#endif
|
||||
|
||||
class CNpcSteamSwitchPlatform : public CNpcPlatform
|
||||
{
|
||||
public:
|
||||
virtual void postInit();
|
||||
virtual void setWaypoints( sThingPlatform *ThisPlatform );
|
||||
protected:
|
||||
virtual void processMovement( int _frames );
|
||||
|
||||
enum NPC_STEAM_SWITCH_STATE
|
||||
{
|
||||
NPC_STEAM_SWITCH_STOP = 0,
|
||||
NPC_STEAM_SWITCH_DEPRESS = 1,
|
||||
NPC_STEAM_SWITCH_RETURN,
|
||||
};
|
||||
|
||||
s32 m_maxExtension;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -122,6 +122,7 @@ AcridBubble=31
|
|||
LeafRaft=19
|
||||
OilRigPlatform=1
|
||||
RockBridge=32
|
||||
SteamSwitch=33
|
||||
|
||||
################################################
|
||||
# Triggers
|
||||
|
|
|
@ -139,3 +139,6 @@ Gfx=..\..\Graphics\platforms\oilrig\oilrigplatform.gin
|
|||
[RockBridge]
|
||||
Gfx=..\..\Graphics\platforms\rockbridge\rockbridge.gin
|
||||
|
||||
[SteamSwitch]
|
||||
Gfx=..\..\Graphics\platforms\steam_switch\steam_switch.gin
|
||||
|
||||
|
|
|
@ -1629,6 +1629,14 @@ SOURCE=..\..\..\source\platform\pseesaw.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\platform\psswitch.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\platform\psswitch.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\platform\ptrpdoor.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
Loading…
Add table
Reference in a new issue