GliderPRO/Sources/Transit.c

1 line
14 KiB
C
Raw Normal View History

//============================================================================ //---------------------------------------------------------------------------- // Transit.c //---------------------------------------------------------------------------- //============================================================================ #include "Externs.h" #include "Environ.h" #include "RectUtils.h" void HandleRoomVisitation (void); short linkedToWhat; Boolean takingTheStairs, firstPlayer; extern Rect justRoomsRect, transRect; extern short transRoom, otherPlayerEscaped; extern short localNumbers[9]; extern Boolean topOpen, twoPlayerGame, onePlayerLeft; extern Boolean playerDead, playerSuicide, tvOn; //============================================================== Functions //-------------------------------------------------------------- WhatAreWeLinkedTo short WhatAreWeLinkedTo (short where, Byte who) { short what, whatType; char wasState; wasState = HGetState((Handle)thisHouse); HLock((Handle)thisHouse); what = (*thisHouse)->rooms[where].objects[who].what; HSetState((Handle)thisHouse, wasState); switch (what) { case kMailboxLf: whatType = kLinkedToLeftMailbox; break; case kMailboxRt: whatType = kLinkedToRightMailbox; break; case kCeilingTrans: whatType = kLinkedToCeilingDuct; break; default: whatType = kLinkedToOther; break; } return (whatType); } //-------------------------------------------------------------- ReadyGliderFromTransit void ReadyGliderFromTransit (gliderPtr thisGlider, short toWhat) { Rect tempRect; if ((twoPlayerGame) && (onePlayerLeft) && (thisGlider->which == playerDead)) return; FlagGliderNormal(thisGlider); switch (toWhat) { case kLinkedToOther: StartGliderTransportingIn(thisGlider); // set glider's mode tempRect = thisGlider->dest; // position glider CenterRectInRect(&tempRect, &transRect); thisGlider->dest.left = tempRect.left; thisGlider->dest.right = tempRect.right; thisGlider->dest.top = tempRect.top; thisGlider->dest.bottom = tempRect.bottom; thisGlider->destShadow.left = tempRect.left; thisGlider->destShadow.right = tempRect.right; thisGlider->whole = thisGlider->dest; thisGlider->wholeShadow = thisGlider->destShadow; thisGlider->enteredRect = thisGlider->dest; break; case kLinkedToLeftMailbox: StartGliderMailingOut(thisGlider); thisGlider->clip = transRect; // fix clip thisGlider->clip.right -= 64; thisGlider->clip.bottom -= 25; tempRect = thisGlider->dest; thisGlider->dest.left = thisGlider->clip.right; thisGlider->dest.right = thisGlider->dest.left; thisGlider->dest.bottom = thisGlider->clip.bottom - 4; thisGlider->dest.top = thisGlider->dest.bottom - RectTall(&tempRect); thisGlider->destShadow.left = thisGlider->dest.left; thisGlider->destShadow.right = thisGlider->dest.right; thisGlider->whole = thisGlider->dest; thisGlider->wholeShadow = thisGlider->destShadow; break; case kLinkedToRightMailbox: StartGliderMailingOut(thisGlider); thisGlider->clip = transRect; // fix clip thisGlider->clip.left += 79; thisGlider->clip.bottom -= 25; tempRect = thisGlider->dest; thisGlider->dest.right = thisGlider->clip.left; thisGlider->dest.left = thisGlider->dest.right; thisGlider->dest.bottom = thisGlider->clip.bottom - 4; thisGlider->dest.top = thisGlider->dest.bottom - RectTall(&tempRect); thisGlider->destShadow.left = thisGlider->dest.left; thisGlider->destShadow.right = thisGlider->dest.right; thisGlider->whole = thisGlider->dest; thisGlider->wholeShadow = thisGlider->destShadow; break; case kLinkedToCeilingDuct: StartGliderDuctingIn(thisGlider); tempRect = thisGlider->dest; // set glider's position CenterRectInRect(&tempRect, &transRect); thisGlider->dest.left = tempRect.left; thisGlider->dest.right = tempRect.right; thisGlider->dest.top = tempRect.top; thisGlider->dest.bottom = thisGlider->dest.top; QOffsetRect(&thisGlider->dest, 0, -RectTall(&tempRect)); thisGlider->destShadow.left = tempRe