mirror of
https://github.com/softdorothy/Glider4.git
synced 2024-06-15 14:29:33 +00:00
1 line
62 KiB
OpenEdge ABL
1 line
62 KiB
OpenEdge ABL
|
unit PlayUtils;
interface
uses
Palettes, Globals, SMS, GlobalUtils, FileInNOut;
procedure ForceMainToVisible;
procedure LoadABackground (whichID: Integer);
procedure ArrangeTiles;
procedure DrawAllObjects;
procedure BumpTheScore;
procedure StartScoreRolling;
procedure UpdateBandNumbers;
procedure PopTokenBand;
procedure UpdateBatteryEnergy;
procedure PopTokenBattery;
procedure DrawHeadline;
procedure ResetGlider;
procedure ResetAnimate (typeIs, index: Integer);
procedure ExtractEventRects;
procedure ReadyRoom;
procedure SortHiScores;
function DoQuit: Boolean;
implementation
{=================================}
procedure ForceMainToVisible;
begin
if ((areFlipping) and (mainScreenHidden)) then
begin
CopyBits(offLoadMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, nil);
mainScreenHidden := FALSE;
SetPage(mainScreenHidden);
CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, nil);
end;
end;
{=================================}
procedure ArrangeTiles;
var
wasPort: GrafPtr;
i, panel: Integer;
begin
for i := 0 to 7 do
begin
panel := thisHouse.theRooms[roomAt].tileOrder[i];
if (inColor) then
CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, BitMapPtr(virginCPtr^.portPixMap^)^, tileRects[panel], tileRects[i], srcCopy, nil)
else
CopyBits(offLoadMap, offVirginMap, tileRects[panel], tileRects[i], srcCopy, nil);
end;
if (inColor) then
CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeArea, wholeArea, srcCopy, nil)
else
CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, nil);
end;
{=================================}
procedure LoadABackground;
var
refNumber: Integer;
tempByte: SignedByte;
thePict: PicHandle;
wasPort: GrafPtr;
begin
refNumber := OpenResFile(resourceName);
if (refNumber = -1) then
begin
UseResFile(gliderResNum);
GenericAlert(kErrGraphicsNotFound);
if (not DoOpen(kArtType)) then
begin
ShowMenuBar;
Exit(LoadABackground);
end;
refNumber := OpenResFile(resourceName);
if (refNumber = -1) then
begin
GenericAlert(kErrGraphicsNotFound);
ShowMenuBar;
playing := FALSE;
Exit(LoadABackground);
end;
end;
if (areFlipping) then
ForceMainToVisible;
GetPort(wasPort);
if (inColor) then
SetPort(GrafPtr(loadCPtr))
else
SetPort(offLoadPort);
thePict := GetPicture(whichID);
if (thePict <> nil) then
begin
tempByte := HGetState(Handle(thePict));
HLock(Handle(thePict));
DrawPicture(thePict, wholeArea);
HSetState(Handle(thePict), tempByte);
end
else
begin
case whichID of {try to substitute}
205:
thePict := GetPicture(201);
206:
thePict := GetPicture(204);
207:
thePict := GetPicture(200);
208:
thePict := GetPicture(203);
209:
thePict := GetPicture(200);
otherwise
begin
GenericAlert(kErrGraphicLoad);
ShowMenuBar;
playing := FALSE;
Exit(LoadABackground);
end;
end;
if (thePict <> nil) then
begin
tempByte := HGetState(Handle(thePict));
HLock(Handle(thePict));
DrawPicture(thePict, wholeArea);
HSetState(Handle(thePict), tempByte);
end
else
begin
GenericAlert(kErrGraphicLoad);
ShowMenuBar;
playing := FALSE;
Exit(LoadABackground);
end;
end;
ReleaseResource(Handle(thePict));
SetPort(wasPort);
CloseResFile(refNumber);
UseResFile(gliderResNum);
end;
{=================================}
procedure FillNFrame (theColor: RGBColor; theRect: Rect);
begin
RGBForeColor(theColor);
PaintRect(theRect);
RGBForeColor(rgbBlack);
FrameRect(theRect);
end;
{=================================}
procedure GrayNFrame (theRect: Rect);
begin
FillRect(theRect, gray);
FrameRect(theRect);
end;
{=================================}
procedure HiLiteARect (theColor: RGBColor; theRect: Rect);
begin
RGBForeColor(theColor);
MoveTo(theRect.left + 1, theRect.top + 1);
LineTo(theRect.right - 2, theRect.top + 1);
LineTo(theRect.right - 2, th
|