mirror of
https://github.com/softdorothy/Glider4.git
synced 2024-06-08 13:29:32 +00:00
1 line
35 KiB
OpenEdge ABL
1 line
35 KiB
OpenEdge ABL
|
unit PlaySetUp;
interface
uses
SMS, Balloons, Palettes, Globals, GlobalUtils, FileInNOut, PlayUtils;
procedure HorizonMouse;
procedure WrapItUp;
procedure OffAMortal;
procedure AdvanceARoom;
procedure RetreatARoom;
procedure UpAFlight (whatRoom: Integer);
procedure DownAFlight (whatRoom: Integer);
procedure Transport (whatRoom: Integer);
implementation
{=================================}
procedure HorizonMouse;
const
MBState = $172;
MTemp = $828;
RawMouse = $82C;
Mouse = $830;
CrsrNew = $8CE;
CrsrCouple = $8CF;
Couple = $FF;
Uncouple = $00;
var
horizon: Point;
lowGlob: Integer;
lowMem: Ptr;
pointPtr: ^Point;
begin
GetMouse(horizon);
horizon.v := 160;
lowMem := Pointer(rawMouse);
pointPtr := @lowMem^;
pointPtr^ := horizon;
lowMem := Pointer(MTemp);
pointPtr := @lowMem^;
pointPtr^ := horizon;
lowMem := Pointer(CrsrNew);
lowMem^ := $FFFF;
end;
{=================================}
procedure ClosingAnimation;
const
waitTicks = 4;
var
i, refNumber, whichTwist: Integer;
twisterDst, tinyGliderDst, tinyGliderSrc, wasRect, wasGlider, boltRect: Rect;
twisterSrc: array[0..3] of Rect;
timeWas: LongInt;
tempByte: SignedByte;
thePict: PicHandle;
boltWasCast, hasLetUpOnButton: Boolean;
{--------------}
procedure CastBolt;
const
cloudBottom = 140;
boltLength = 8;
var
i, start, finish: Integer;
begin
SetRect(boltRect, 512, cloudBottom, 0, (boltLength + 1) * 8 + cloudBottom + 2);
if (inColor) then
RGBForeColor(rgbWhite)
else
PenPat(white);
start := Randomize(100) + 200;
for i := 0 to boltLength do
begin
finish := Randomize(7) - 3 + start;
MoveTo(start, i * 8 + cloudBottom + 1);
LineTo(finish, (i + 1) * 8 + cloudBottom);
if (start <= boltRect.left) then
boltRect.left := start;
if (finish <= boltRect.left) then
boltRect.left := finish;
if (start >= boltRect.right) then
boltRect.right := start;
if (finish >= boltRect.right) then
boltRect.right := finish;
start := finish;
end;
if (inColor) then
RGBForeColor(rgbBlack)
else
PenPat(black);
boltWasCast := TRUE;
InsetRect(boltRect, -2, 0);
end;
{--------------}
begin
RedrawWindowFrame;
SetRect(twisterSrc[0], 208, 126, 256, 188);
SetRect(twisterSrc[1], 208, 189, 256, 251);
SetRect(twisterSrc[2], 208, 252, 256, 314);
SetRect(twisterSrc[3], 256, 268, 304, 330);
SetRect(tinyGliderSrc, 235, 315, 256, 325);
twisterDst := twisterSrc[0];
OffsetRect(twisterDst, -twisterDst.left, -twisterDst.top);
OffsetRect(twisterDst, 230, 138);
tinyGliderDst := tinyGliderSrc;
OffsetRect(tinyGliderDst, -tinyGliderDst.left, -tinyGliderDst.top);
OffsetRect(tinyGliderDst, 420, 90);
wasGlider := tinyGliderDst;
boltWasCast := FALSE;
if (inColor) then
SetPort(GrafPtr(virginCPtr))
else
SetPort(offVirginPort);
refNumber := OpenResFile(resourceName);
if (refNumber = -1) then
begin
UseResFile(gliderResNum);
GenericAlert(kErrGraphicsNotFound);
ShowMenuBar;
if (not DoOpen(kArtType)) then
Exit(ClosingAnimation);
refNumber := OpenResFile(resourceName);
if (refNumber = -1) then
begin
GenericAlert(kErrGraphicsNotFound);
ShowMenuBar;
Exit(ClosingAnimation);
end;
end;
thePict := GetPicture(rFarmPict);
if (thePict <> nil) then
begin
tempByte := HGetState(Handle(thePict));
MoveHHi(Handle(thePict));
HLock(Handle(thePict));
DrawPicture(thePict, wholeArea);
HSetState(Handle(thePict), tempByte);
ReleaseResource(Handle(thePict));
end
else
GenericAlert(kErrGraphicLoad);
CloseResFile(refNumber);
UseResFile(gliderResNum);
DissBlocks;
whichTwist := 0;
PenNormal;
if (inColor) then
SetPort(GrafPtr(mainWndo))
else
SetPort(mainWndo);
hasLetUpOnButton := FALSE;
for i := 1 to 200 do
begin
timeWas := TickCount + waitTicks;
wasRect := twisterDst;
whichTwist := i mod 4;
if ((i mod 4) = 0) then
begin
whichTwist := whichTwist + 1;
if (whichTwis
|