This commit is contained in:
Paul 2001-04-17 20:09:33 +00:00
parent b8ab5fb31e
commit 2145a8d6c7
9 changed files with 96 additions and 37 deletions

View File

@ -189,7 +189,8 @@ system_src := main \
thing_src := thing
triggers_src := tlevexit
triggers_src := tlevexit \
tlook
utils_src := utils \
sincos \

View File

@ -23,6 +23,10 @@
#include "triggers\tlevexit.h"
#endif
#ifndef __TRIGGERS_TLOOK_H__
#include "triggers\tlook.h"
#endif
#ifndef __PICKUPS_PICKUP_H__
#include "pickups\pickup.h"
#endif
@ -620,19 +624,22 @@ sLvlHdr *LevelHdr=(sLvlHdr*)LevelBuffer;
PAUL_DBGMSG("%d triggers",TriggerCount);
for(int i=0;i<TriggerCount;i++)
{
CTriggerThing *trigger=NULL; // I hate having to do this just to keep the compiler quiet :/ (pkg)
switch(TriggerList->Type)
{
// Exit trigger
case 0:
{
CLevelExitTrigger *exit;
exit=new ("LevelExitTrigger") CLevelExitTrigger();
exit->init();
exit->setExitPosition(TriggerList->Pos.X<<4,TriggerList->Pos.Y<<4,
TriggerList->Width<<4,TriggerList->Height<<4);
trigger=(CTriggerThing*)new ("LevelExitTrigger") CLevelExitTrigger();
break;
// Look down trigger
case 1:
trigger=(CTriggerThing*)new ("LookTrigger") CLookTrigger();
break;
}
}
trigger->init();
trigger->setPositionAndSize(TriggerList->Pos.X<<4,TriggerList->Pos.Y<<4,
TriggerList->Width<<4,TriggerList->Height<<4);
TriggerList++;
}
}

View File

@ -283,13 +283,15 @@ void CPlayer::shutdown()
int looktimeout=20;
int lookmaxoffsetup=3*16;
int lookmaxoffsetdown=6*16;
int lookmaxoffsetup=3*MAP2D_BLOCKSTEPSIZE;
int lookmaxoffsetdown=6*MAP2D_BLOCKSTEPSIZE;
int lookspeed=2;
int lookreturnspeed=80;
int ledgexsearch=4;
int ledgemaxylook=4;
int ledgeTimer=25;
int ledgeSpeedIn=1;
int ledgeSpeedOut=3;
int ledgeShift=2;
/*----------------------------------------------------------------------
Function:
@ -417,14 +419,65 @@ else if(Pos.vy>m_mapEdge.vy-64)Pos.vy=m_mapEdge.vy-64;
}
}
// Ledge look-ahead stuff
if(m_ledgeLookAhead&&m_ledgeLookAhead==m_lastLedgeLookAhead)
{
// timer..
if(m_ledgeLookTimer<ledgeTimer)
{
m_ledgeLookTimer+=ledgeSpeedIn*_frames;
}
else
{
int limit;
limit=(m_ledgeLookAhead*MAP2D_BLOCKSTEPSIZE)<<ledgeShift;
if(m_ledgeLookOffset<limit)
{
m_ledgeLookOffset+=_frames;
if(m_ledgeLookOffset>limit)
{
m_ledgeLookOffset=limit;
}
}
}
}
else
{
if(m_ledgeLookOffset>0)
{
m_ledgeLookOffset-=ledgeSpeedOut*_frames;
if(m_ledgeLookOffset<=0)
{
m_ledgeLookOffset=0;
m_ledgeLookTimer=0;
}
}
else if(m_ledgeLookOffset<0)
{
m_ledgeLookOffset+=ledgeSpeedOut*_frames;
if(m_ledgeLookOffset>=0)
{
m_ledgeLookOffset=0;
m_ledgeLookTimer=0;
}
}
}
m_lastLedgeLookAhead=m_ledgeLookAhead;
m_ledgeLookAhead=0;
// Camera focus point stuff
m_currentCamFocusPointTarget.vx=Pos.vx+MAP2D_CENTRE_X;
m_currentCamFocusPointTarget.vy=Pos.vy+MAP2D_CENTRE_Y;
m_currentCamFocusPoint.vx+=(m_currentCamFocusPointTarget.vx-m_currentCamFocusPoint.vx)>>cammove;
m_currentCamFocusPoint.vy+=(m_currentCamFocusPointTarget.vy-m_currentCamFocusPoint.vy)>>cammove;
m_currentCamFocusPointTarget.vy=Pos.vy+MAP2D_CENTRE_Y+(m_ledgeLookOffset>>ledgeShift);
for(i=0;i<_frames;i++)
{
m_currentCamFocusPoint.vx+=(m_currentCamFocusPointTarget.vx-m_currentCamFocusPoint.vx)>>cammove;
m_currentCamFocusPoint.vy+=(m_currentCamFocusPointTarget.vy-m_currentCamFocusPoint.vy)>>cammove;
}
m_cameraPos.vx=m_currentCamFocusPoint.vx;
m_cameraPos.vy=m_currentCamFocusPoint.vy+m_cameraLookOffset;
// Limit camera scroll to the edges of the map
if(m_cameraPos.vx<0)
{
@ -762,6 +815,9 @@ void CPlayer::respawn()
m_currentCamFocusPoint.vx=Pos.vx+MAP2D_CENTRE_X;
m_currentCamFocusPoint.vy=Pos.vy+MAP2D_CENTRE_Y;
m_padLookAroundTimer=0;
m_ledgeLookAhead=m_lastLedgeLookAhead=0;
m_ledgeLookOffset=0;
m_ledgeLookTimer=0;
m_glassesFlag=0;
m_squeakyBootsTimer=0;

View File

@ -161,6 +161,8 @@ public:
int getHeightFromGround(int _x,int _y,int _maxHeight=32);
int getHeightFromGroundNoPlatform(int _x,int _y,int _maxHeight=32);
void setLedgeLookAhead(int _lookAhead) {m_ledgeLookAhead=_lookAhead;}
void addHealth(int _health);
void addLife();
ATTACK_STATE getAttackState();
@ -210,6 +212,9 @@ private:
DVECTOR m_currentCamFocusPoint;
int m_facing;
int m_padLookAroundTimer;
int m_ledgeLookAhead,m_lastLedgeLookAhead;
int m_ledgeLookOffset;
int m_ledgeLookTimer;
enum

View File

@ -726,17 +726,19 @@ void CThing::processEvent(GAME_EVENT _event,CThing *_sourceThing)
// do nothing by default - ignore event
}
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
/*void CThing::shove( DVECTOR move )
void CTriggerThing::setPositionAndSize(int _x,int _y,int _w,int _h)
{
Pos.vx += move.vx;
Pos.vy += move.vy;
}*/
Pos.vx=_x+(_w/2);
Pos.vy=_y+(_h/2);
setCollisionSize(_w,_h);
}
/*===========================================================================
end */

View File

@ -111,7 +111,6 @@ public:
DVECTOR getPos() {return Pos;}
void setPos(DVECTOR newPos) {Pos=newPos;}
DVECTOR getPosDelta() {return PosDelta;}
//virtual void shove(DVECTOR move);
CThing *getNext() {return Next;}
@ -213,6 +212,7 @@ 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)
};

View File

@ -87,20 +87,6 @@ void CLevelExitTrigger::render()
}
#endif
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CLevelExitTrigger::setExitPosition(int _x,int _y,int _w,int _h)
{
Pos.vx=_x+(_w/2);
Pos.vy=_y+(_h/2);
setCollisionSize(_w,_h);
}
/*----------------------------------------------------------------------
Function:
Purpose:
@ -116,6 +102,5 @@ void CLevelExitTrigger::collidedWith(CThing *_thisThing)
#endif
}
/*===========================================================================
end */

View File

@ -40,7 +40,6 @@ public:
#if defined (__USER_art__) || defined (__USER_sbart__)
virtual void render();
#endif
void setExitPosition(int _x,int _y,int _w,int _h);
protected:
virtual void collidedWith(CThing *_thisThing);

View File

@ -21,6 +21,10 @@
#include "game\game.h"
#endif
#ifndef __PLAYER_PLAYER_H__
#include "player\player.h"
#endif
/* Std Lib
------- */
@ -54,7 +58,7 @@ void CLookTrigger::collidedWith(CThing *_thisThing)
{
ASSERT(_thisThing->getThingType()==TYPE_PLAYER);
GameScene.getPlayer()->setLedgeLookAhead(+4);
}
/*===========================================================================