Glider4/RoomEditor_103/Sources/E-FlyGlider.p

1 line
47 KiB
OpenEdge ABL
Raw Normal View History

unit FlyGlider; interface uses Palettes, Globals, Utilities, Drawing, ObjectStuff; procedure ResetGlider; procedure ExtractEventRects; procedure ReadyRoom; procedure FlyGlider; var nObjects: Integer; timeIs: LongInt; testRoom: roomData; {=================================} implementation {=================================} procedure CenterMouse; const MBState = $172; MTemp = $828; RawMouse = $82C; Mouse = $830; CrsrNew = $8CE; CrsrCouple = $8CF; Couple = $FF; Uncouple = $00; var center: Point; lowGlob: Integer; lowMem: Ptr; pointPtr: ^Point; begin SetPt(center, 256, 171); lowMem := Pointer(rawMouse); pointPtr := @lowMem^; pointPtr^ := center; lowMem := Pointer(MTemp); pointPtr := @lowMem^; pointPtr^ := center; lowMem := Pointer(CrsrNew); lowMem^ := $FFFF; end; {=================================} procedure ReadyGlider; var mousePt: Point; dummyLong, timeToStop: LongInt; tempRect: Rect; begin with theGlider do begin bands := 0; forVel := 4; energy := 0; mode := fadingIn; phase := 0; isForward := TRUE; isRight := TRUE; if (isRight) then SetRect(destRect, 0, 40, 48, 60) else SetRect(destRect, 464, 40, 512, 60); oldRect := destRect; wholeRect := destRect; srcNum := 0; mass := currMass; end; lifeNormal := FALSE; PenNormal; PenMode(patXOr); FrameRect(theGlider.destRect); repeat until not Button; repeat with theGlider do begin FrameRect(oldRect); GetMouse(mousePt); SetRect(destRect, -24, -10, 24, 10); OffsetRect(destRect, mousePt.h, mousePt.v); FrameRect(destRect); oldRect := destRect; end; until Button; FrameRect(theGlider.oldRect); tempRect := theGlider.oldRect; InsetRect(tempRect, -1, -1); FrameRect(tempRect); with theGlider do begin oldRect := destRect; wholeRect := destRect; shadoDest := destRect; shadoDest.top := floorVert; shadoDest.bottom := floorVert + 11; oldShado := shadoDest; wholeShado := shadoDest; touchRect := destRect; InsetRect(touchRect, 10, 5); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, GrafPtr(mainWndo)^.portBits, glideRct[srcNum], glideRct[srcNum], destRect) else CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, glideRct[srcNum], glideRct[srcNum], destRect) end; timeToStop := TickCount + 120; repeat SpinBall; Delay(2, dummyLong); until (TickCount > timeToStop); FrameRect(tempRect); end; {=================================} procedure ExtractEventRects; var index, tempInt, tempNum: Integer; tempRect: Rect; {-------------------------} procedure SetUpGrease; begin nCycleObs := nCycleObs + 1; with testRoom.theObjects[index] do begin if (isOn) then begin eventRect[index] := boundRect; with cycleObjects[nCycleObs] do begin kindIs := grease; tiedTo := index; wholeRect := eventRect[index]; oldRect := wholeRect; reset := 0; {phase=not spilled} accel := grease; {graphic # to display} velocity := wholeRect.right;{current length of spill} position := amount; {full length of spill} end; end else begin eventRect[index].left := boundRect.right; eventRect[index].bottom := boundRect.bottom; eventRect[index].right := amount; eventRect[index].top := boundRect.bottom - 4; with cycleObjects[nCycleObs] do begin kindIs := grease; tiedTo := index; wholeRect := boundRect; oldRect := wholeRect; reset := 999; {phase=spilled} accel := 59; {graphic # to display} velocity := amount; {current length of spill} position := amount; {length of spill} end; end; end; end; {-------------------------} procedure FrameOutlet; begin nCycleObs := nCycleObs + 1; eventRect[index] := testRoom.theObjects[index].boundRect; with cycleObjects[nCycleObs] do begin kindIs := outlet; tiedTo := index; eventKind[tied