mirror of
https://github.com/softdorothy/GliderPRO.git
synced 2024-12-01 21:50:27 +00:00
1 line
44 KiB
C
1 line
44 KiB
C
|
//============================================================================
//----------------------------------------------------------------------------
// Interactions.c
//----------------------------------------------------------------------------
//============================================================================
#include "Externs.h"
#include "RectUtils.h"
#define kFloorVentLift -6
#define kCeilingVentDrop 8
#define kFanStrength 12
#define kBatterySupply 50 // about 2 rooms worth of thrust
#define kHeliumSupply 150
#define kBandsSupply 8
#define kFoilSupply 8
Boolean GliderHitTop (gliderPtr, Rect *);
Boolean GliderInRect (gliderPtr, Rect *);
void BounceGlider (gliderPtr, Rect *);
void CheckEscapeUpTwo (gliderPtr);
void CheckEscapeUp (gliderPtr);
void CheckEscapeDownTwo (gliderPtr);
void CheckEscapeDown (gliderPtr);
void CheckRoofCollision (gliderPtr);
void CheckEscapeLeftTwo (gliderPtr);
void CheckEscapeLeft (gliderPtr);
void CheckEscapeRightTwo (gliderPtr);
void CheckEscapeRight (gliderPtr);
void CheckGliderInRoom (gliderPtr);
void HandleRewards (gliderPtr, hotPtr);
void HandleMicrowaveAction (hotPtr, gliderPtr);
void HandleHotSpotCollision (gliderPtr, hotPtr, short);
void CheckForHotSpots (void);
void WebGlider (gliderPtr, Rect *);
short otherPlayerEscaped, activeRectEscaped;
extern hotPtr hotSpots;
extern short nHotSpots, leftThresh, rightThresh, thisTiles[];
extern short localNumbers[], thisBackground, numStarsRemaining;
extern Boolean leftOpen, rightOpen, topOpen, bottomOpen, evenFrame;
extern Boolean twoPlayerGame, newState, onePlayerLeft, playerDead;
//============================================================== Functions
//-------------------------------------------------------------- GliderHitSides
Boolean GliderHitTop (gliderPtr thisGlider, Rect *theRect)
{
Rect glideBounds;
short offset;
Boolean hitTop;
glideBounds.left = thisGlider->dest.left + 5;
glideBounds.top = thisGlider->dest.top + 5;
glideBounds.right = thisGlider->dest.right - 5;
glideBounds.bottom = thisGlider->dest.bottom - 5;
glideBounds.left -= thisGlider->wasHVel;
glideBounds.right -= thisGlider->wasHVel;
if (theRect->bottom < glideBounds.top)
hitTop = false;
else if (theRect->top > glideBounds.bottom)
hitTop = false;
else if (theRect->right < glideBounds.left)
hitTop = false;
else if (theRect->left > glideBounds.right)
hitTop = false;
else
hitTop = true;
if (!hitTop)
{
PlayPrioritySound(kFoilHitSound, kFoilHitPriority);
foilTotal--;
if (foilTotal <= 0)
StartGliderFoilLosing(thisGlider);
glideBounds.left += thisGlider->wasHVel;
glideBounds.right += thisGlider->wasHVel;
if (thisGlider->hVel > 0)
offset = 2 + glideBounds.right - theRect->left;
else
offset = 2 + glideBounds.left - theRect->right;
thisGlider->hVel = -thisGlider->hVel - offset;
}
return (hitTop);
}
//-------------------------------------------------------------- SectGlider
Boolean SectGlider (gliderPtr thisGlider, Rect *theRect, Boolean scrutinize)
{
Rect glideBounds;
Boolean itHit;
glideBounds = thisGlider->dest;
if (thisGlider->mode == kGliderBurning)
glideBounds.top += 6;
if (scrutinize)
{
glideBounds.left += 5;
glideBounds.top += 5;
glideBounds.right -= 5;
glideBounds.bottom -= 5;
}
if (theRect->bottom < glideBounds.top)
itHit = false;
else if (theRect->top > glideBounds.bottom)
itHit = false;
else if (theRect->right < glideBounds.left)
itHit = false;
else if (theRect->left > glideBounds.right)
itHit = false;
else
itHit = true;
return (itHit);
}
//-------------------------------------------------------------- GliderInRect
Boolean GliderInRect (gliderPtr thisGlider, Rect *theRect)
{
Rect glideBounds;
glideBounds = thisGlider->dest;
if (glideBounds.top < theRect->top)
return (false);
else if (glideBounds.bottom > theRect->bottom)
return (false);
else if (glideBounds.left < theRect->left)
return (false);
else if (glideBounds.right > theRect->right)
return (false);
else
return (tr
|