This commit is contained in:
Paul 2001-07-26 20:00:55 +00:00
parent f1fe0ed2da
commit cf9a66a91e
11 changed files with 55 additions and 24 deletions

View file

@ -701,7 +701,6 @@ void CPlayer::shutdown()
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
static int oldmode=-1; static int oldmode=-1;
int newmode=-1; int newmode=-1;
void CPlayer::think(int _frames) void CPlayer::think(int _frames)
{ {
int i; int i;
@ -1124,7 +1123,7 @@ if(PadGetDown(0)&PAD_TRIANGLE)
} }
// Ledge look-ahead stuff // Ledge look-ahead stuff
if(m_ledgeLookAhead&&m_ledgeLookAhead==m_lastLedgeLookAhead) if(m_ledgeLookAhead)
{ {
if(m_ledgeLookTimer<ledgeTimer) if(m_ledgeLookTimer<ledgeTimer)
{ {
@ -1134,25 +1133,22 @@ if(PadGetDown(0)&PAD_TRIANGLE)
{ {
int limit; int limit;
limit=(m_ledgeLookAhead*MAP2D_BLOCKSTEPSIZE)<<ledgeShift; limit=(m_ledgeLookAhead*MAP2D_BLOCKSTEPSIZE)<<ledgeShift;
if(m_ledgeLookAhead>0) if(m_ledgeLookOffset<limit)
{ {
// Look down
m_ledgeLookOffset+=ledgeSpeedIn*_frames;
if(m_ledgeLookOffset>limit)
{
m_ledgeLookOffset=limit;
}
}
else if(m_ledgeLookOffset>limit)
{
// Look up
m_ledgeLookOffset-=ledgeSpeedIn*_frames;
if(m_ledgeLookOffset<limit) if(m_ledgeLookOffset<limit)
{ {
// Look down m_ledgeLookOffset=limit;
m_ledgeLookOffset+=ledgeSpeedIn*_frames;
if(m_ledgeLookOffset>limit)
{
m_ledgeLookOffset=limit;
}
}
else if(m_ledgeLookOffset>limit)
{
// Look up
m_ledgeLookOffset-=ledgeSpeedIn*_frames;
if(m_ledgeLookOffset<limit)
{
m_ledgeLookOffset=limit;
}
} }
} }
} }
@ -1180,8 +1176,6 @@ if(PadGetDown(0)&PAD_TRIANGLE)
} }
} }
} }
m_lastLedgeLookAhead=m_ledgeLookAhead;
m_ledgeLookAhead=0;
// Camera focus point stuff // Camera focus point stuff
calcCameraFocusPointTarget(); calcCameraFocusPointTarget();
@ -1600,6 +1594,21 @@ int CPlayer::getHeightFromGroundNoPlatform(int _x,int _y,int _maxHeight=32)
return( CGameScene::getCollision()->getHeightFromGround(_x,_y,_maxHeight) ); return( CGameScene::getCollision()->getHeightFromGround(_x,_y,_maxHeight) );
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CPlayer::setLedgeLookAhead(int _lookAhead)
{
if(m_ledgeLookAhead!=_lookAhead)
{
m_ledgeLookAhead=_lookAhead;
m_ledgeLookTimer=0;
}
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
Function: Function:
Purpose: Purpose:
@ -1898,7 +1907,7 @@ void CPlayer::respawn()
m_cameraPos.vy=m_currentCamFocusPoint.vy; m_cameraPos.vy=m_currentCamFocusPoint.vy;
m_padLookAroundTimer=0; m_padLookAroundTimer=0;
m_ledgeLookAhead=m_lastLedgeLookAhead=0; m_ledgeLookAhead=0;
m_ledgeLookOffset=0; m_ledgeLookOffset=0;
m_ledgeLookTimer=0; m_ledgeLookTimer=0;
m_tryingToManuallyPickupWeapon=false; m_tryingToManuallyPickupWeapon=false;

View file

@ -248,7 +248,7 @@ public:
int getHeightFromPlatformNoGround(int _x,int _y,int _maxHeight=32); int getHeightFromPlatformNoGround(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 setLedgeLookAhead(int _lookAhead);
void addLife(); void addLife();
void addSpatula(int Count=1) {m_numSpatulasHeld+=Count;} void addSpatula(int Count=1) {m_numSpatulasHeld+=Count;}
@ -337,7 +337,7 @@ 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_ledgeLookAhead;
int m_ledgeLookOffset; int m_ledgeLookOffset;
int m_ledgeLookTimer; int m_ledgeLookTimer;

View file

@ -68,7 +68,7 @@ void CLookTrigger::collidedWith(CThing *_thisThing)
collArea.y2=collArea.y1+10; collArea.y2=collArea.y1+10;
if(checkCollisionAgainstArea(&collArea)) if(checkCollisionAgainstArea(&collArea))
{ {
((CPlayer*)_thisThing)->setLedgeLookAhead(+4); ((CPlayer*)_thisThing)->setLedgeLookAhead(m_val0);
} }
break; break;

View file

@ -163,6 +163,10 @@
#include "triggers\tspeech.h" #include "triggers\tspeech.h"
#endif #endif
#ifndef __TRIGGERS_TLOOK_H__
#include "triggers\tlook.h"
#endif
#ifndef __GAME_GAME_H__ #ifndef __GAME_GAME_H__
#include "game\game.h" #include "game\game.h"
#endif #endif
@ -427,6 +431,10 @@ CTrigger *trigger;
break; break;
} }
case TRIGGER_CAMERAYPOSITIONTRIGGER:
trigger = (CLookTrigger*)new("LookTrigger") CLookTrigger();
break;
default: default:
trigger=NULL; trigger=NULL;
} }
@ -445,6 +453,7 @@ CTrigger *trigger=Create(ThisTrigger->Type);
trigger->setPositionAndSize(ThisTrigger->Pos.X<<4,ThisTrigger->Pos.Y<<4,ThisTrigger->Width<<4,ThisTrigger->Height<<4); trigger->setPositionAndSize(ThisTrigger->Pos.X<<4,ThisTrigger->Pos.Y<<4,ThisTrigger->Width<<4,ThisTrigger->Height<<4);
trigger->setTargetBox(ThisTrigger->TargetPos.X<<4,ThisTrigger->TargetPos.Y<<4,ThisTrigger->TargetSize.X<<4,ThisTrigger->TargetSize.Y<<4); trigger->setTargetBox(ThisTrigger->TargetPos.X<<4,ThisTrigger->TargetPos.Y<<4,ThisTrigger->TargetSize.X<<4,ThisTrigger->TargetSize.Y<<4);
trigger->setVal(ThisTrigger->Val0);
switch( ThisTrigger->Type ) switch( ThisTrigger->Type )
{ {
@ -520,4 +529,14 @@ void CTrigger::setTargetBox(int _x,int _y,int _w,int _h)
m_boxY2=_y+_h; m_boxY2=_y+_h;
} }
/*----------------------------------------------------------------------
Function:
Purpose:
Params:
Returns:
---------------------------------------------------------------------- */
void CTrigger::setVal(int _val)
{
m_val0=_val;
}

View file

@ -67,6 +67,7 @@ enum TRIGGER_TYPE
TRIGGER_SPEECH_FIRST_BUBBLE, TRIGGER_SPEECH_FIRST_BUBBLE,
TRIGGER_SPEECH_USE_BUBBLE, TRIGGER_SPEECH_USE_BUBBLE,
TRIGGER_SPEECH_WEIGHT, TRIGGER_SPEECH_WEIGHT,
TRIGGER_CAMERAYPOSITIONTRIGGER,
// Code based triggers // Code based triggers
TRIGGER_PLATFORM, TRIGGER_PLATFORM,
@ -90,11 +91,13 @@ static CTrigger *Create(int Type);
static CTrigger *Create(sThingTrigger *ThisTrigger); static CTrigger *Create(sThingTrigger *ThisTrigger);
virtual void setPositionAndSize(int _x,int _y,int _w,int _h); virtual void setPositionAndSize(int _x,int _y,int _w,int _h);
virtual void setTargetBox(int _x,int _y,int _w,int _h); virtual void setTargetBox(int _x,int _y,int _w,int _h);
void setVal(int _val);
protected: protected:
virtual void collidedWith(CThing *_thisThing){}; virtual void collidedWith(CThing *_thisThing){};
int m_boxX1,m_boxY1,m_boxX2,m_boxY2; int m_boxX1,m_boxY1,m_boxX2,m_boxY2;
int m_val0;
}; };