mirror of
https://github.com/softdorothy/GliderPRO.git
synced 2024-06-02 11:41:30 +00:00
1 line
40 KiB
C
1 line
40 KiB
C
|
//============================================================================
//----------------------------------------------------------------------------
// Player.c
//----------------------------------------------------------------------------
//============================================================================
#include "Externs.h"
#include "Play.h"
#include "RectUtils.h"
#define kGravity 3
#define kHImpulse 2
#define kVImpulse 2
#define kMaxHVel 16
#define kShredderCountdown -68
void MoveGlider (gliderPtr);
void MoveGliderNormal (gliderPtr);
void MoveGliderBurning (gliderPtr);
void FadeGliderIn (gliderPtr);
void TransportGliderIn (gliderPtr);
void FadeGliderOut (gliderPtr);
void MoveGliderUpStairs (gliderPtr);
void MoveGliderDownStairs (gliderPtr);
void MoveGliderFaceLeft (gliderPtr);
void MoveGliderFaceRight (gliderPtr);
void TransportGliderOut (gliderPtr);
void MoveGliderDownDuct (gliderPtr);
void MoveGliderUpDuct (gliderPtr);
void MoveGliderInMailLeft (gliderPtr);
void MoveGliderInMailRight (gliderPtr);
void FinishGliderMailingLeft (gliderPtr);
void FinishGliderMailingRight (gliderPtr);
void MoveGliderFoilGoing (gliderPtr);
void MoveGliderFoilLosing (gliderPtr);
void MoveGliderShredding (gliderPtr);
void HandleIdleGlider (gliderPtr);
gliderType theGlider, theGlider2;
Rect shadowSrcRect;
GWorldPtr shadowSrcMap;
GWorldPtr shadowMaskMap;
Rect shadowSrc[kNumShadowSrcRects];
Rect gliderSrc[kNumGliderSrcRects];
Rect transRect;
long theScore;
short fadeInSequence[kLastFadeSequence];
short rightClip, leftClip, transRoom;
Boolean shadowVisible, onePlayerLeft, playerDead;
extern short numShredded, otherPlayerEscaped;
extern Boolean playing, twoPlayerGame, gameOver, hasMirror;
extern Boolean takingTheStairs, playerSuicide;
//============================================================== Functions
//-------------------------------------------------------------- MoveGlider
void MoveGlider (gliderPtr thisGlider)
{
if (thisGlider->hVel > thisGlider->hDesiredVel)
{
thisGlider->hVel -= kHImpulse;
if (thisGlider->hVel < thisGlider->hDesiredVel)
thisGlider->hVel = thisGlider->hDesiredVel;
}
else if (thisGlider->hVel < thisGlider->hDesiredVel)
{
thisGlider->hVel += kHImpulse;
if (thisGlider->hVel > thisGlider->hDesiredVel)
thisGlider->hVel = thisGlider->hDesiredVel;
}
thisGlider->hDesiredVel = 0;
if (thisGlider->vVel > thisGlider->vDesiredVel)
{
thisGlider->vVel -= kVImpulse;
if (thisGlider->vVel < thisGlider->vDesiredVel)
thisGlider->vVel = thisGlider->vDesiredVel;
}
else if (thisGlider->vVel < thisGlider->vDesiredVel)
{
thisGlider->vVel += kVImpulse;
if (thisGlider->vVel > thisGlider->vDesiredVel)
thisGlider->vVel = thisGlider->vDesiredVel;
}
thisGlider->vDesiredVel = kGravity;
if (thisGlider->hVel < 0)
{
if (thisGlider->hVel < -kMaxHVel)
thisGlider->hVel = -kMaxHVel;
thisGlider->wasHVel = thisGlider->hVel;
thisGlider->whole.right = thisGlider->dest.right;
thisGlider->dest.left += thisGlider->hVel;
thisGlider->dest.right += thisGlider->hVel;
thisGlider->whole.left = thisGlider->dest.left;
thisGlider->wholeShadow.right = thisGlider->destShadow.right;
thisGlider->destShadow.left += thisGlider->hVel;
thisGlider->destShadow.right += thisGlider->hVel;
thisGlider->wholeShadow.left = thisGlider->destShadow.left;
}
else
{
if (thisGlider->hVel > kMaxHVel)
thisGlider->hVel = kMaxHVel;
thisGlider->wasHVel = thisGlider->hVel;
thisGlider->whole.left = thisGlider->dest.left;
thisGlider->dest.left += thisGlider->hVel;
thisGlider->dest.right += thisGlider->hVel;
thisGlider->whole.right = thisGlider->dest.right;
thisGlider->wholeShadow.left = thisGlider->destShadow.left;
thisGlider->destShadow.left += thisGlider->hVel;
thisGlider->destShadow.right += thisGlider->hVel;
thisGlider->wholeShadow.right = thisGlider->destShadow.right;
}
if (thisGlider->vVel < 0)
{
thisGlider->wasVVel = thisGlider->vVel;
thisGlider->whole.bottom = thisGlider->dest.bottom;
thisGlider
|