From a8a436a7a0abbc67449249141277ca559be39bbd Mon Sep 17 00:00:00 2001 From: Daveo Date: Wed, 2 May 2001 00:06:46 +0000 Subject: [PATCH] --- source/game/game.cpp | 2 +- source/level/level.cpp | 1 + source/platform/pbranch.cpp | 10 ++++++++-- source/thing/thing.cpp | 12 ++++++++++++ source/thing/thing.h | 2 ++ source/triggers/tteleprt.cpp | 10 ++++++++++ 6 files changed, 34 insertions(+), 3 deletions(-) diff --git a/source/game/game.cpp b/source/game/game.cpp index b6573a1ff..b2c180071 100644 --- a/source/game/game.cpp +++ b/source/game/game.cpp @@ -239,7 +239,7 @@ void CGameScene::think(int _frames) else if(s_levelFinished) { s_globalLevelSelectThing++; -// s_globalLevelSelectThing&=3; + s_globalLevelSelectThing&=3; // Ch1 only Bodge shutdownLevel(); initLevel(); diff --git a/source/level/level.cpp b/source/level/level.cpp index d7f047590..b3aabda7a 100644 --- a/source/level/level.cpp +++ b/source/level/level.cpp @@ -315,6 +315,7 @@ void CLevel::initLayers() trigger->init(); trigger->setPositionAndSize(TriggerList->Pos.X<<4,TriggerList->Pos.Y<<4, TriggerList->Width<<4,TriggerList->Height<<4); + trigger->setTargetPos(TriggerList->TargetPos.X<<4,TriggerList->TargetPos.Y<<4); TriggerList++; } } diff --git a/source/platform/pbranch.cpp b/source/platform/pbranch.cpp index 1b738d479..9b71caa46 100644 --- a/source/platform/pbranch.cpp +++ b/source/platform/pbranch.cpp @@ -165,6 +165,8 @@ void CNpcBranchPlatform::processMovement( int _frames ) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +int BX=-20; +int BY=-30; void CNpcBranchPlatform::render() { if ( m_isActive ) @@ -175,8 +177,8 @@ void CNpcBranchPlatform::render() DVECTOR renderPos; DVECTOR offset = CLevel::getCameraPos(); - renderPos.vx = Pos.vx - offset.vx; - renderPos.vy = Pos.vy - offset.vy; + renderPos.vx = Pos.vx - offset.vx ; + renderPos.vy = Pos.vy - offset.vy ; if ( renderPos.vx >= 0 && renderPos.vx <= VidGetScrW() ) { @@ -188,11 +190,15 @@ void CNpcBranchPlatform::render() { rotation.vy = 0; rotation.vz = getCollisionAngle(); + renderPos.vx-= BX; + renderPos.vy+= BY; } else { rotation.vy = 2048; rotation.vz = -getCollisionAngle(); + renderPos.vx+= BX; + renderPos.vy+= BY; } VECTOR scale; diff --git a/source/thing/thing.cpp b/source/thing/thing.cpp index d68767681..26f46fd95 100644 --- a/source/thing/thing.cpp +++ b/source/thing/thing.cpp @@ -875,5 +875,17 @@ void CTriggerThing::setPositionAndSize(int _x,int _y,int _w,int _h) setCollisionSize(_w,_h); } +/*---------------------------------------------------------------------- + Function: + Purpose: + Params: + Returns: + ---------------------------------------------------------------------- */ +void CTriggerThing::setTargetPos(int _x,int _y) +{ + TargetPos.vx=_x; + TargetPos.vy=_y; +} + /*=========================================================================== end */ diff --git a/source/thing/thing.h b/source/thing/thing.h index 4f8eed8d7..db0dc6250 100644 --- a/source/thing/thing.h +++ b/source/thing/thing.h @@ -216,6 +216,8 @@ class CTriggerThing : public CThing public: virtual TYPE getThingType() {return TYPE_TRIGGER;} virtual void setPositionAndSize(int _x,int _y,int _w,int _h); // Wonder if this might be better in CThing? (pkg) + virtual void setTargetPos(int _x,int _y); // Wonder if this might be better in CThing? (pkg) + DVECTOR TargetPos; }; class CHazardThing : public CThing { diff --git a/source/triggers/tteleprt.cpp b/source/triggers/tteleprt.cpp index 9368ed983..6e2a5e259 100644 --- a/source/triggers/tteleprt.cpp +++ b/source/triggers/tteleprt.cpp @@ -53,6 +53,16 @@ ---------------------------------------------------------------------- */ void CTeleportTrigger::collidedWith(CThing *_thisThing) { + CRECT collisionArea; + DVECTOR respawnPos; + + ASSERT(_thisThing->getThingType()==TYPE_PLAYER); + + collisionArea=getCollisionArea(); + respawnPos.vx=collisionArea.x1+((collisionArea.x2-collisionArea.x1)/2); + respawnPos.vy=collisionArea.y2; + ((CPlayer*)_thisThing)->setPos(TargetPos); + /* CRECT collisionArea; DVECTOR respawnPos;