Pararena2/Sources/Initialize.c

1 line
24 KiB
C
Raw Normal View History

/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Initialization Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "UnivUtilities.h" #include "Globals.h" #include "AppleTalkDDP.h" #include "Initialize.h" #include "AnimCursor.h" #include "MainWindow.h" #include <Sound.h> #include "Render.h" #include "Environ.h" #include "InitGameStructs.h" #include "TeamSetUp.h" #include "Menu.h" #include "ValidInstall.h" /*======================================================== ToolBoxInit */ void ToolBoxInit (void) { short count; InitGraf(&thePort); InitFonts(); FlushEvents(everyEvent, kRemoveAllEvents); InitWindows(); InitMenus(); TEInit(); InitDialogs(kNilPointer); InitCursor(); MaxApplZone(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); for (count = 1; count <= 3; count++) EventAvail(everyEvent, &theEvent); inBackground = FALSE; } /*======================================================== BitMapInit */ void BitMapInit (void) { PicHandle thePict; short mapWidth, mapHeight; SpinCursor(7); /* Set up offscreen bit map for various game objects */ offPartsPtr = (GrafPtr)(NewPtr(sizeof(GrafPort))); OpenPort(offPartsPtr); mapWidth = 400; mapHeight = 264; SetRect(&offPartsRect, 0, 0, mapWidth, mapHeight); partsRowBytes = ((offPartsRect.right - offPartsRect.left + 15) / 16) * 2; offPartsBits.rowBytes = partsRowBytes; offPartsBits.bounds = offPartsRect; offPartsBits.baseAddr = NewPtr((long)offPartsBits.rowBytes * (offPartsRect.bottom - offPartsRect.top)); if (offPartsBits.baseAddr == kNilPointer) DeathError(kErrNoMemory); if (MemError() != noErr) DeathError(kErrNoMemory); SetPortBits(&offPartsBits); ClipRect(&offPartsRect); EraseRect(&offPartsRect); thePict = GetPicture(rPartsPict1BitID); if (thePict != kNilPointer) { DrawPicture(thePict, &offPartsRect); ReleaseResource((Handle)thePict); } else DeathError(kErrNoPictRsrc); /* Set up offscreen bit map for preloading assembled graphics */ offWorkPtr = (GrafPtr)(NewPtr(sizeof(GrafPort))); OpenPort(offWorkPtr); mapWidth = screenWide; mapHeight = screenHigh; SetRect(&offWorkRect, 0, 0, mapWidth, mapHeight); workRowBytes = ((offWorkRect.right - offWorkRect.left + 15) / 16) * 2; offWorkBits.rowBytes = workRowBytes; offWorkBits.bounds = offWorkRect; offWorkBits.baseAddr = NewPtr((long)offWorkBits.rowBytes * (offWorkRect.bottom - offWorkRect.top)); if (offWorkBits.baseAddr == kNilPointer) DeathError(kErrNoMemory); if (MemError() != noErr) DeathError(kErrNoMemory); SetPortBits(&offWorkBits); ClipRect(&offWorkRect); EraseRect(&offWorkRect); /* Set up offscreen bit map for a virgin copy of background */ offBackPtr = (GrafPtr)(NewPtr(sizeof(GrafPort))); OpenPort(offBackPtr); mapWidth = screenWide; mapHeight = screenHigh; SetRect(&offBackRect, 0, 0, mapWidth, mapHeight); backRowBytes = ((offBackRect.right - offBackRect.left + 15) / 16) * 2; offBackBits.rowBytes = backRowBytes; offBackBits.bounds = offBackRect; offBackBits.baseAddr = NewPtr((long)offBackBits.rowBytes * (offBackRect.bottom - offBackRect.top)); if (offBackBits.baseAddr == kNilPointer) DeathError(kErrNoMemory); if (MemError() != noErr) DeathError(kErrNoMemory); SetPortBits(&offBackBits); ClipRect(&offBackRect); EraseRect(&offBackRect); LoadBackgroundPict(); CopyBits(&offBackBits, &offWorkBits, &offBackRect, &offBackRect, srcCopy, nil); CopyBits(&offBackBits, &offPartsBits, &rightArrowDest, &rightArrowStorage, srcCopy, nil); CopyBits(&offBackBits, &offPartsBits, &leftArrowDest, &leftArrowStorage, srcCopy, nil); } /*======================================================== PixMapInit