diff --git a/source/platform/pbranch.cpp b/source/platform/pbranch.cpp index caa7b5ca7..1b738d479 100644 --- a/source/platform/pbranch.cpp +++ b/source/platform/pbranch.cpp @@ -19,6 +19,10 @@ #include "utils\utils.h" #endif +#ifndef __VID_HEADER_ +#include "system\vid.h" +#endif + #ifndef __GAME_GAME_H__ #include "game\game.h" #endif @@ -158,3 +162,69 @@ void CNpcBranchPlatform::processMovement( int _frames ) setCollisionAngle( newAngle ); } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcBranchPlatform::render() +{ + if ( m_isActive ) + { + CPlatformThing::render(); + + // Render + DVECTOR renderPos; + DVECTOR offset = CLevel::getCameraPos(); + + renderPos.vx = Pos.vx - offset.vx; + renderPos.vy = Pos.vy - offset.vy; + + if ( renderPos.vx >= 0 && renderPos.vx <= VidGetScrW() ) + { + if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() ) + { + SVECTOR rotation; + rotation.vx = 0; + if ( m_reversed ) + { + rotation.vy = 0; + rotation.vz = getCollisionAngle(); + } + else + { + rotation.vy = 2048; + rotation.vz = -getCollisionAngle(); + } + + VECTOR scale; + scale.vx = ONE; + scale.vy = ONE; + scale.vz = ONE; + + m_modelGfx->Render(renderPos,&rotation,&scale); + +#if defined (__USER_paul__) || defined (__USER_charles__) + DVECTOR centre; + int halfLength; + int x1,y1,x2,y2; + + centre=getCollisionCentre(); + halfLength=PLATFORMWIDTH/2; + + x1=-halfLength*mcos(getCollisionAngle()&4095)>>12; + y1=-halfLength*msin(getCollisionAngle()&4095)>>12; + x2=+halfLength*mcos(getCollisionAngle()&4095)>>12; + y2=+halfLength*msin(getCollisionAngle()&4095)>>12; + + centre.vx-=offset.vx; + centre.vy-=offset.vy; + x1+=centre.vx; + y1+=centre.vy; + x2+=centre.vx; + y2+=centre.vy; + + DrawLine(x1,y1,x2,y2,0,255,0,0); +#endif + } + } + } +} diff --git a/source/platform/pbranch.h b/source/platform/pbranch.h index 71fb01262..458a885f6 100644 --- a/source/platform/pbranch.h +++ b/source/platform/pbranch.h @@ -22,6 +22,7 @@ class CNpcBranchPlatform : public CNpcPlatform { public: virtual void postInit(); + virtual void render(); protected: virtual void setWaypoints( sThingPlatform *ThisPlatform ); virtual void processMovement( int _frames ); diff --git a/source/platform/platform.cpp b/source/platform/platform.cpp index b6d2b83e8..880f10b4d 100644 --- a/source/platform/platform.cpp +++ b/source/platform/platform.cpp @@ -105,16 +105,6 @@ -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -// All platforms are fied to this width at the minute.. -#define PLATFORMWIDTH 80 - -// The collision box is this high.. if SB keeps falling through platforms then it *should* be sufficient -// just to up this a bit -#define PLATFORMCOLLISIONHEIGHT 80 - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// class CLayerCollision *CNpcPlatform::m_layerCollision; diff --git a/source/platform/platform.h b/source/platform/platform.h index daf262248..b8a7be6ed 100644 --- a/source/platform/platform.h +++ b/source/platform/platform.h @@ -35,6 +35,16 @@ #include "gfx\sprbank.h" #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// All platforms are fied to this width at the minute.. +#define PLATFORMWIDTH 80 + +// The collision box is this high.. if SB keeps falling through platforms then it *should* be sufficient +// just to up this a bit +#define PLATFORMCOLLISIONHEIGHT 80 + + /*****************************************************************************/ class CNpcPlatform : public CPlatformThing @@ -68,7 +78,7 @@ public: virtual void postInit(); void shutdown(); void think(int _frames); - void render(); + virtual void render(); void setLayerCollision( class CLayerCollision *_layer ) {m_layerCollision=_layer;} void setType( NPC_PLATFORM_UNIT_TYPE newType ) {m_type = newType;} void setTypeFromMapEdit( u16 newType ); diff --git a/source/platform/pseesaw.cpp b/source/platform/pseesaw.cpp index 5c6920e8f..500fba0a0 100644 --- a/source/platform/pseesaw.cpp +++ b/source/platform/pseesaw.cpp @@ -19,6 +19,14 @@ #include "game\game.h" #endif +#ifndef __VID_HEADER_ +#include "system\vid.h" +#endif + +#ifndef __UTILS_HEADER__ +#include "utils\utils.h" +#endif + void CNpcSeesawPlatform::postInit() { @@ -99,4 +107,62 @@ void CNpcSeesawPlatform::processMovement( int _frames ) m_currentAngle = newAngle; setCollisionAngle( newAngle >> 8 ); -} \ No newline at end of file +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CNpcSeesawPlatform::render() +{ + if ( m_isActive ) + { + CPlatformThing::render(); + + // Render + DVECTOR renderPos; + DVECTOR offset = CLevel::getCameraPos(); + + renderPos.vx = Pos.vx - offset.vx; + renderPos.vy = Pos.vy - offset.vy; + + if ( renderPos.vx >= 0 && renderPos.vx <= VidGetScrW() ) + { + if ( renderPos.vy >= 0 && renderPos.vy <= VidGetScrH() ) + { + SVECTOR rotation; + rotation.vx = 0; + rotation.vy = 0; + rotation.vz = getCollisionAngle(); + + VECTOR scale; + scale.vx = ONE; + scale.vy = ONE; + scale.vz = ONE; + + m_modelGfx->Render(renderPos,&rotation,&scale); + +#if defined (__USER_paul__) || defined (__USER_charles__) + DVECTOR centre; + int halfLength; + int x1,y1,x2,y2; + + centre=getCollisionCentre(); + halfLength=PLATFORMWIDTH/2; + + x1=-halfLength*mcos(getCollisionAngle()&4095)>>12; + y1=-halfLength*msin(getCollisionAngle()&4095)>>12; + x2=+halfLength*mcos(getCollisionAngle()&4095)>>12; + y2=+halfLength*msin(getCollisionAngle()&4095)>>12; + + centre.vx-=offset.vx; + centre.vy-=offset.vy; + x1+=centre.vx; + y1+=centre.vy; + x2+=centre.vx; + y2+=centre.vy; + + DrawLine(x1,y1,x2,y2,0,255,0,0); +#endif + } + } + } +} diff --git a/source/platform/pseesaw.h b/source/platform/pseesaw.h index 827eed060..62cf57ba1 100644 --- a/source/platform/pseesaw.h +++ b/source/platform/pseesaw.h @@ -22,6 +22,7 @@ class CNpcSeesawPlatform : public CNpcPlatform { public: virtual void postInit(); + virtual void render(); protected: virtual void processMovement( int _frames ); diff --git a/source/player/psspring.cpp b/source/player/psspring.cpp index 686f7078e..092931d7b 100644 --- a/source/player/psspring.cpp +++ b/source/player/psspring.cpp @@ -82,7 +82,7 @@ void CPlayerStateSpring::enter(CPlayerModeBase *_playerMode) Params: Returns: ---------------------------------------------------------------------- */ -int maxplayerspringframes=40; +int maxplayerspringframes=50; void CPlayerStateSpring::think(CPlayerModeBase *_playerMode) { const PlayerMetrics *metrics;