This commit is contained in:
parent
b8ab5fb31e
commit
2145a8d6c7
9 changed files with 96 additions and 37 deletions
|
@ -189,7 +189,8 @@ system_src := main \
|
||||||
|
|
||||||
thing_src := thing
|
thing_src := thing
|
||||||
|
|
||||||
triggers_src := tlevexit
|
triggers_src := tlevexit \
|
||||||
|
tlook
|
||||||
|
|
||||||
utils_src := utils \
|
utils_src := utils \
|
||||||
sincos \
|
sincos \
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
#include "triggers\tlevexit.h"
|
#include "triggers\tlevexit.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __TRIGGERS_TLOOK_H__
|
||||||
|
#include "triggers\tlook.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __PICKUPS_PICKUP_H__
|
#ifndef __PICKUPS_PICKUP_H__
|
||||||
#include "pickups\pickup.h"
|
#include "pickups\pickup.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -620,19 +624,22 @@ sLvlHdr *LevelHdr=(sLvlHdr*)LevelBuffer;
|
||||||
PAUL_DBGMSG("%d triggers",TriggerCount);
|
PAUL_DBGMSG("%d triggers",TriggerCount);
|
||||||
for(int i=0;i<TriggerCount;i++)
|
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)
|
switch(TriggerList->Type)
|
||||||
{
|
{
|
||||||
// Exit trigger
|
// Exit trigger
|
||||||
case 0:
|
case 0:
|
||||||
{
|
trigger=(CTriggerThing*)new ("LevelExitTrigger") CLevelExitTrigger();
|
||||||
CLevelExitTrigger *exit;
|
break;
|
||||||
exit=new ("LevelExitTrigger") CLevelExitTrigger();
|
|
||||||
exit->init();
|
// Look down trigger
|
||||||
exit->setExitPosition(TriggerList->Pos.X<<4,TriggerList->Pos.Y<<4,
|
case 1:
|
||||||
TriggerList->Width<<4,TriggerList->Height<<4);
|
trigger=(CTriggerThing*)new ("LookTrigger") CLookTrigger();
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
trigger->init();
|
||||||
|
trigger->setPositionAndSize(TriggerList->Pos.X<<4,TriggerList->Pos.Y<<4,
|
||||||
|
TriggerList->Width<<4,TriggerList->Height<<4);
|
||||||
TriggerList++;
|
TriggerList++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,13 +283,15 @@ void CPlayer::shutdown()
|
||||||
|
|
||||||
|
|
||||||
int looktimeout=20;
|
int looktimeout=20;
|
||||||
int lookmaxoffsetup=3*16;
|
int lookmaxoffsetup=3*MAP2D_BLOCKSTEPSIZE;
|
||||||
int lookmaxoffsetdown=6*16;
|
int lookmaxoffsetdown=6*MAP2D_BLOCKSTEPSIZE;
|
||||||
int lookspeed=2;
|
int lookspeed=2;
|
||||||
int lookreturnspeed=80;
|
int lookreturnspeed=80;
|
||||||
|
|
||||||
int ledgexsearch=4;
|
int ledgeTimer=25;
|
||||||
int ledgemaxylook=4;
|
int ledgeSpeedIn=1;
|
||||||
|
int ledgeSpeedOut=3;
|
||||||
|
int ledgeShift=2;
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
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
|
// Camera focus point stuff
|
||||||
m_currentCamFocusPointTarget.vx=Pos.vx+MAP2D_CENTRE_X;
|
m_currentCamFocusPointTarget.vx=Pos.vx+MAP2D_CENTRE_X;
|
||||||
m_currentCamFocusPointTarget.vy=Pos.vy+MAP2D_CENTRE_Y;
|
m_currentCamFocusPointTarget.vy=Pos.vy+MAP2D_CENTRE_Y+(m_ledgeLookOffset>>ledgeShift);
|
||||||
m_currentCamFocusPoint.vx+=(m_currentCamFocusPointTarget.vx-m_currentCamFocusPoint.vx)>>cammove;
|
for(i=0;i<_frames;i++)
|
||||||
m_currentCamFocusPoint.vy+=(m_currentCamFocusPointTarget.vy-m_currentCamFocusPoint.vy)>>cammove;
|
{
|
||||||
|
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.vx=m_currentCamFocusPoint.vx;
|
||||||
m_cameraPos.vy=m_currentCamFocusPoint.vy+m_cameraLookOffset;
|
m_cameraPos.vy=m_currentCamFocusPoint.vy+m_cameraLookOffset;
|
||||||
|
|
||||||
|
|
||||||
// Limit camera scroll to the edges of the map
|
// Limit camera scroll to the edges of the map
|
||||||
if(m_cameraPos.vx<0)
|
if(m_cameraPos.vx<0)
|
||||||
{
|
{
|
||||||
|
@ -762,6 +815,9 @@ void CPlayer::respawn()
|
||||||
m_currentCamFocusPoint.vx=Pos.vx+MAP2D_CENTRE_X;
|
m_currentCamFocusPoint.vx=Pos.vx+MAP2D_CENTRE_X;
|
||||||
m_currentCamFocusPoint.vy=Pos.vy+MAP2D_CENTRE_Y;
|
m_currentCamFocusPoint.vy=Pos.vy+MAP2D_CENTRE_Y;
|
||||||
m_padLookAroundTimer=0;
|
m_padLookAroundTimer=0;
|
||||||
|
m_ledgeLookAhead=m_lastLedgeLookAhead=0;
|
||||||
|
m_ledgeLookOffset=0;
|
||||||
|
m_ledgeLookTimer=0;
|
||||||
|
|
||||||
m_glassesFlag=0;
|
m_glassesFlag=0;
|
||||||
m_squeakyBootsTimer=0;
|
m_squeakyBootsTimer=0;
|
||||||
|
|
|
@ -161,6 +161,8 @@ public:
|
||||||
int getHeightFromGround(int _x,int _y,int _maxHeight=32);
|
int getHeightFromGround(int _x,int _y,int _maxHeight=32);
|
||||||
int getHeightFromGroundNoPlatform(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 addHealth(int _health);
|
||||||
void addLife();
|
void addLife();
|
||||||
ATTACK_STATE getAttackState();
|
ATTACK_STATE getAttackState();
|
||||||
|
@ -210,6 +212,9 @@ private:
|
||||||
DVECTOR m_currentCamFocusPoint;
|
DVECTOR m_currentCamFocusPoint;
|
||||||
int m_facing;
|
int m_facing;
|
||||||
int m_padLookAroundTimer;
|
int m_padLookAroundTimer;
|
||||||
|
int m_ledgeLookAhead,m_lastLedgeLookAhead;
|
||||||
|
int m_ledgeLookOffset;
|
||||||
|
int m_ledgeLookTimer;
|
||||||
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
|
@ -726,17 +726,19 @@ void CThing::processEvent(GAME_EVENT _event,CThing *_sourceThing)
|
||||||
// do nothing by default - ignore event
|
// do nothing by default - ignore event
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Function:
|
Function:
|
||||||
Purpose:
|
Purpose:
|
||||||
Params:
|
Params:
|
||||||
Returns:
|
Returns:
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
/*void CThing::shove( DVECTOR move )
|
void CTriggerThing::setPositionAndSize(int _x,int _y,int _w,int _h)
|
||||||
{
|
{
|
||||||
Pos.vx += move.vx;
|
Pos.vx=_x+(_w/2);
|
||||||
Pos.vy += move.vy;
|
Pos.vy=_y+(_h/2);
|
||||||
}*/
|
setCollisionSize(_w,_h);
|
||||||
|
}
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
end */
|
end */
|
||||||
|
|
|
@ -111,7 +111,6 @@ public:
|
||||||
DVECTOR getPos() {return Pos;}
|
DVECTOR getPos() {return Pos;}
|
||||||
void setPos(DVECTOR newPos) {Pos=newPos;}
|
void setPos(DVECTOR newPos) {Pos=newPos;}
|
||||||
DVECTOR getPosDelta() {return PosDelta;}
|
DVECTOR getPosDelta() {return PosDelta;}
|
||||||
//virtual void shove(DVECTOR move);
|
|
||||||
CThing *getNext() {return Next;}
|
CThing *getNext() {return Next;}
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,6 +212,7 @@ class CTriggerThing : public CThing
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual TYPE getThingType() {return TYPE_TRIGGER;}
|
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)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -87,20 +87,6 @@ void CLevelExitTrigger::render()
|
||||||
}
|
}
|
||||||
#endif
|
#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:
|
Function:
|
||||||
Purpose:
|
Purpose:
|
||||||
|
@ -116,6 +102,5 @@ void CLevelExitTrigger::collidedWith(CThing *_thisThing)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
end */
|
end */
|
||||||
|
|
|
@ -40,7 +40,6 @@ public:
|
||||||
#if defined (__USER_art__) || defined (__USER_sbart__)
|
#if defined (__USER_art__) || defined (__USER_sbart__)
|
||||||
virtual void render();
|
virtual void render();
|
||||||
#endif
|
#endif
|
||||||
void setExitPosition(int _x,int _y,int _w,int _h);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void collidedWith(CThing *_thisThing);
|
virtual void collidedWith(CThing *_thisThing);
|
||||||
|
|
|
@ -21,6 +21,10 @@
|
||||||
#include "game\game.h"
|
#include "game\game.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PLAYER_PLAYER_H__
|
||||||
|
#include "player\player.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Std Lib
|
/* Std Lib
|
||||||
------- */
|
------- */
|
||||||
|
@ -54,7 +58,7 @@ void CLookTrigger::collidedWith(CThing *_thisThing)
|
||||||
{
|
{
|
||||||
ASSERT(_thisThing->getThingType()==TYPE_PLAYER);
|
ASSERT(_thisThing->getThingType()==TYPE_PLAYER);
|
||||||
|
|
||||||
|
GameScene.getPlayer()->setLedgeLookAhead(+4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue