This commit is contained in:
parent
6b0f5d9956
commit
2d65d44406
9 changed files with 245 additions and 4 deletions
|
@ -133,7 +133,8 @@ platform_src := platform \
|
|||
pdrop \
|
||||
psswitch \
|
||||
plift \
|
||||
plurve
|
||||
plurve \
|
||||
psoil
|
||||
|
||||
hazard_src := hazard \
|
||||
hfalling \
|
||||
|
|
|
@ -514,6 +514,18 @@ CNpcPlatform::NPC_PLATFORM_DATA CNpcPlatform::m_data[NPC_PLATFORM_TYPE_MAX] =
|
|||
2,
|
||||
NPC_PLATFORM_TIMER_NONE,
|
||||
},
|
||||
|
||||
{ // NPC_STEERABLE_OILDRUM_PLATFORM
|
||||
3,
|
||||
128,
|
||||
true,
|
||||
DAMAGE__NONE,
|
||||
0,
|
||||
4,
|
||||
NPC_PLATFORM_INFINITE_LIFE,
|
||||
0,
|
||||
NPC_PLATFORM_TIMER_NONE,
|
||||
},
|
||||
};
|
||||
|
||||
CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATFORM_TYPE_MAX] =
|
||||
|
@ -554,6 +566,7 @@ CNpcPlatform::NPC_PLATFORM_UNIT_TYPE CNpcPlatform::mapEditConvertTable[NPC_PLATF
|
|||
NPC_STEAM_SWITCH_PLATFORM,
|
||||
NPC_LIFT_PLATFORM,
|
||||
NPC_LOVE_BOAT_PLATFORM,
|
||||
NPC_STEERABLE_OILDRUM_PLATFORM,
|
||||
NPC_CONVEYOR_PLATFORM,
|
||||
NPC_PLAYER_BUBBLE_PLATFORM,
|
||||
NPC_CLAM_PLATFORM,
|
||||
|
|
|
@ -187,6 +187,10 @@
|
|||
#include "platform\plurve.h"
|
||||
#endif
|
||||
|
||||
#ifndef __PLATFORM_PSOIL_H__
|
||||
#include "platform\psoil.h"
|
||||
#endif
|
||||
|
||||
#include "fx\fx.h"
|
||||
#include "fx\fxjfish.h"
|
||||
|
||||
|
@ -431,6 +435,12 @@ CNpcPlatform *CNpcPlatform::Create(int Type)
|
|||
break;
|
||||
}
|
||||
|
||||
case NPC_STEERABLE_OILDRUM_PLATFORM:
|
||||
{
|
||||
platform = new ("steerable oildrum platform") CNpcSteerableOildrumPlatform;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
ASSERT( 0 );
|
||||
|
|
|
@ -93,6 +93,7 @@ public:
|
|||
NPC_STEAM_SWITCH_PLATFORM,
|
||||
NPC_LIFT_PLATFORM,
|
||||
NPC_LOVE_BOAT_PLATFORM,
|
||||
NPC_STEERABLE_OILDRUM_PLATFORM,
|
||||
NPC_PLATFORM_TYPE_MAX,
|
||||
};
|
||||
enum
|
||||
|
|
|
@ -134,7 +134,7 @@ void CNpcSteerableBarrelPlatform::processMovement( int _frames )
|
|||
|
||||
// check for collision
|
||||
|
||||
if ( CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy ) < -maxHeight )
|
||||
if ( CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy + 14 ) < -maxHeight )
|
||||
{
|
||||
moveX = 0;
|
||||
m_currentSpeed = 0;
|
||||
|
@ -153,7 +153,7 @@ void CNpcSteerableBarrelPlatform::processMovement( int _frames )
|
|||
|
||||
// check for vertical movement
|
||||
|
||||
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy, yMovement + 16 );
|
||||
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy + 14, yMovement + 16 );
|
||||
|
||||
if ( groundHeight <= yMovement )
|
||||
{
|
||||
|
|
181
source/platform/psoil.cpp
Normal file
181
source/platform/psoil.cpp
Normal file
|
@ -0,0 +1,181 @@
|
|||
/*=========================================================================
|
||||
|
||||
psoil.h
|
||||
|
||||
Author: CRB
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2001 Climax Development Ltd
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __PLATFORM_PSOIL_H__
|
||||
#include "platform\psoil.h"
|
||||
#endif
|
||||
|
||||
#ifndef __GAME_GAME_H__
|
||||
#include "game\game.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VID_HEADER_
|
||||
#include "system\vid.h"
|
||||
#endif
|
||||
|
||||
#ifndef __UTILS_HEADER__
|
||||
#include "utils\utils.h"
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CNpcSteerableOildrumPlatform::processMovement( int _frames )
|
||||
{
|
||||
s32 maxHeight = 20;
|
||||
s32 fallSpeed = 3;
|
||||
s8 yMovement = fallSpeed * _frames;
|
||||
s32 groundHeight;
|
||||
|
||||
s32 moveX = 0;
|
||||
s32 moveY = 0;
|
||||
|
||||
CPlayer *player = GameScene.getPlayer();
|
||||
|
||||
if ( m_contact )
|
||||
{
|
||||
DVECTOR playerPos = player->getPos();
|
||||
|
||||
DVECTOR *playerVel = player->getMoveVelocity();
|
||||
|
||||
/*s32 speedChange = -playerVel->vx << 8;
|
||||
|
||||
if ( speedChange > ( _frames << 5 ) )
|
||||
{
|
||||
speedChange = _frames << 5;
|
||||
}
|
||||
else if ( speedChange < -( _frames << 5 ) )
|
||||
{
|
||||
speedChange = -_frames << 5;
|
||||
}
|
||||
|
||||
m_currentSpeed += speedChange;
|
||||
|
||||
if ( m_currentSpeed > ( m_speed << 8 ) )
|
||||
{
|
||||
m_currentSpeed = ( m_speed << 8 );
|
||||
}
|
||||
else if ( m_currentSpeed < -( m_speed << 8 ) )
|
||||
{
|
||||
m_currentSpeed = -( m_speed << 8 );
|
||||
}*/
|
||||
|
||||
m_currentSpeed = -playerVel->vx << 4;
|
||||
|
||||
/*s32 playerX = playerPos.vx - this->Pos.vx;
|
||||
|
||||
if ( playerX > 5 )
|
||||
{
|
||||
// increase barrel speed to right
|
||||
|
||||
m_currentSpeed += _frames << 2;
|
||||
|
||||
if ( m_currentSpeed > ( m_speed << 8 ) )
|
||||
{
|
||||
m_currentSpeed = ( m_speed << 8 );
|
||||
}
|
||||
}
|
||||
else if ( playerX < -5 )
|
||||
{
|
||||
m_currentSpeed -= _frames << 2;
|
||||
|
||||
if ( m_currentSpeed < -( m_speed << 8 ) )
|
||||
{
|
||||
m_currentSpeed = -( m_speed << 8 );
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
// reduce speed
|
||||
|
||||
/*s32 speedReduce = -m_currentSpeed;
|
||||
|
||||
if ( speedReduce > _frames )
|
||||
{
|
||||
speedReduce = _frames;
|
||||
}
|
||||
else if ( speedReduce < -_frames )
|
||||
{
|
||||
speedReduce = -_frames;
|
||||
}
|
||||
|
||||
m_currentSpeed += speedReduce;*/
|
||||
|
||||
m_currentSpeed = 0;
|
||||
}
|
||||
|
||||
/*m_moveXHighRes += m_currentSpeed * _frames;
|
||||
|
||||
moveX = m_moveXHighRes >> 8;
|
||||
m_moveXHighRes -= moveX << 8;*/
|
||||
|
||||
moveX = ( m_currentSpeed * _frames ) >> 8;
|
||||
|
||||
// check for collision
|
||||
|
||||
if ( CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy + 20 ) < -maxHeight )
|
||||
{
|
||||
moveX = 0;
|
||||
m_currentSpeed = 0;
|
||||
}
|
||||
|
||||
m_rotation += ( m_currentSpeed * 30 * _frames ) >> 10;
|
||||
m_rotation &= 4095;
|
||||
|
||||
if ( m_contact )
|
||||
{
|
||||
DVECTOR shove;
|
||||
shove.vx = moveX;
|
||||
shove.vy = 0;
|
||||
player->shove(shove);
|
||||
}
|
||||
|
||||
// check for vertical movement
|
||||
|
||||
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx + moveX, Pos.vy + 20, yMovement + 16 );
|
||||
|
||||
if ( groundHeight <= yMovement )
|
||||
{
|
||||
// groundHeight <= yMovement indicates either just above ground or on or below ground
|
||||
|
||||
moveY = groundHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
// fall
|
||||
|
||||
moveY = yMovement;
|
||||
}
|
||||
|
||||
Pos.vx += moveX;
|
||||
Pos.vy += moveY;
|
||||
|
||||
s32 minX, maxX;
|
||||
|
||||
m_npcPath.getPathXExtents( &minX, &maxX );
|
||||
|
||||
if ( minX != maxX )
|
||||
{
|
||||
if ( Pos.vx < minX )
|
||||
{
|
||||
Pos.vx = minX;
|
||||
m_currentSpeed = 0;
|
||||
}
|
||||
else if ( Pos.vx > maxX )
|
||||
{
|
||||
Pos.vx = maxX;
|
||||
m_currentSpeed = 0;
|
||||
}
|
||||
}
|
||||
}
|
27
source/platform/psoil.h
Normal file
27
source/platform/psoil.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*=========================================================================
|
||||
|
||||
psoil.h
|
||||
|
||||
Author: CRB
|
||||
Created:
|
||||
Project: Spongebob
|
||||
Purpose:
|
||||
|
||||
Copyright (c) 2001 Climax Development Ltd
|
||||
|
||||
===========================================================================*/
|
||||
|
||||
#ifndef __PLATFORM_PSOIL_H__
|
||||
#define __PLATFORM_PSOIL_H__
|
||||
|
||||
#ifndef __PLATFORM_PSBARREL_H__
|
||||
#include "platform\psbarrel.h"
|
||||
#endif
|
||||
|
||||
class CNpcSteerableOildrumPlatform : public CNpcSteerableBarrelPlatform
|
||||
{
|
||||
protected:
|
||||
virtual void processMovement( int _frames );
|
||||
};
|
||||
|
||||
#endif
|
|
@ -110,7 +110,7 @@ FixedPathBarrelPlatform=1
|
|||
SteerableBarrelPlatform=24
|
||||
RockGeyser=7
|
||||
Retracting=6
|
||||
RollingOildrumPlatform=24
|
||||
RollingOildrumPlatform=36
|
||||
RisingBridge=27
|
||||
BalloonBridge=28
|
||||
TrapdoorLeft=29
|
||||
|
|
|
@ -1645,6 +1645,14 @@ SOURCE=..\..\..\source\platform\pseesaw.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\platform\psoil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\platform\psoil.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\platform\psswitch.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
Loading…
Add table
Reference in a new issue