GliderPRO/Sources/Modes.c

1 line
19 KiB
C
Raw Normal View History

//============================================================================ //---------------------------------------------------------------------------- // Modes.c //---------------------------------------------------------------------------- //============================================================================ #include "Externs.h" #include "RectUtils.h" short saidFollow; extern Rect gliderSrc[]; extern Rect transRect; extern short fadeInSequence[], linkedToWhat; extern short rightClip, leftClip, transRoom; extern Boolean hasMirror, shadowVisible, firstPlayer, twoPlayerGame; extern Boolean onePlayerLeft, playerDead; //============================================================== Functions //-------------------------------------------------------------- StartGliderFadingIn void StartGliderFadingIn (gliderPtr thisGlider) { if (foilTotal <= 0) showFoil = false; thisGlider->mode = kGliderFadingIn; thisGlider->whole = thisGlider->dest; thisGlider->frame = 0; thisGlider->dontDraw = false; if (thisGlider->facing == kFaceLeft) { thisGlider->src = gliderSrc[fadeInSequence[thisGlider->frame] + kLeftFadeOffset]; thisGlider->mask = gliderSrc[fadeInSequence[thisGlider->frame] + kLeftFadeOffset]; } else { thisGlider->src = gliderSrc[fadeInSequence[thisGlider->frame]]; thisGlider->mask = gliderSrc[fadeInSequence[thisGlider->frame]]; } } //-------------------------------------------------------------- StartGliderTransportingIn void StartGliderTransportingIn (gliderPtr thisGlider) { if (foilTotal <= 0) showFoil = false; thisGlider->mode = kGliderTransportingIn; thisGlider->whole = thisGlider->dest; thisGlider->frame = 0; thisGlider->dontDraw = false; if (thisGlider->facing == kFaceLeft) { thisGlider->src = gliderSrc[fadeInSequence[thisGlider->frame] + kLeftFadeOffset]; thisGlider->mask = gliderSrc[fadeInSequence[thisGlider->frame] + kLeftFadeOffset]; } else { thisGlider->src = gliderSrc[fadeInSequence[thisGlider->frame]]; thisGlider->mask = gliderSrc[fadeInSequence[thisGlider->frame]]; } } //-------------------------------------------------------------- StartGliderFadingOut void StartGliderFadingOut (gliderPtr thisGlider) { Rect tempBounds; if (thisGlider->mode == kGliderFadingOut) return; if (thisGlider->mode == kGliderGoingFoil) DeckGliderInFoil(thisGlider); else if (thisGlider->mode == kGliderLosingFoil) RemoveFoilFromGlider(thisGlider); if (RectTall(&thisGlider->dest) > kGliderHigh) { tempBounds = thisGlider->dest; QOffsetRect(&tempBounds, playOriginH, playOriginV); AddRectToWorkRects(&tempBounds); if (hasMirror) { tempBounds = thisGlider->dest; QOffsetRect(&tempBounds, playOriginH - 20, playOriginV - 16); AddRectToWorkRects(&tempBounds); } thisGlider->dest.right = thisGlider->dest.left + kGliderWide; thisGlider->dest.top = thisGlider->dest.bottom - kGliderHigh; } thisGlider->mode = kGliderFadingOut; thisGlider->whole = thisGlider->dest; thisGlider->frame = kLastFadeSequence - 1; if (thisGlider->facing == kFaceLeft) { thisGlider->src = gliderSrc[fadeInSequence[thisGlider->frame] + kLeftFadeOffset]; thisGlider->mask = gliderSrc[fadeInSequence[thisGlider->frame] + kLeftFadeOffset]; } else { thisGlider->src = gliderSrc[fadeInSequence[thisGlider->frame]]; thisGlider->mask = gliderSrc[fadeInSequence[thisGlider->frame]]; } } //-------------------------------------------------------------- StartGliderGoingUpStairs void StartGliderGoingUpStairs (gliderPtr thisGlider) { if (thisGlider->mode == kGliderGoingFoil) DeckGliderInFoil(thisGlider); else if (thisGlider->mode == kGliderLosingFoil) RemoveFoilFromGlider(thisGlider); if (thisGlider->mode == kGliderBurning) thisGlider->frame = kWasBurning; else thisGlider->frame = 0; thisGlider->mode = kGliderGoingUp; } //-------------------------------------------------------------- StartGliderGoingDownStairs void StartGliderGoingDownStairs (gliderPtr thisGlider) { if (thisGlider->mode == kGliderGoi