Pararena2/Sources/Environ.c

1 line
6.5 KiB
C
Raw Normal View History

//============================================================ //============================================================ //== == //== Environ-Checking Routines == //== == //============================================================ //============================================================ //======================================================== Includes #include "Globals.h" #include "UnivUtilities.h" #include "Environ.h" //======================================================== Functions //======================================================== TrapExists Boolean TrapExists (short trapNumber) { return ((NGetTrapAddress(trapNumber, ToolTrap) != NGetTrapAddress(kUnimpTrap, ToolTrap))); } //======================================================== DoWeHaveGestalt Boolean DoWeHaveGestalt (void) { return (TrapExists(kGestaltTrap)); } //======================================================== DoWeHaveWNE Boolean DoWeHaveWNE (void) { return (TrapExists(kWNETrap)); } //======================================================== DoWeHaveColor Boolean DoWeHaveColor (void) { SysEnvRec thisWorld; SysEnvirons(2, &thisWorld); return (thisWorld.hasColorQD); } //======================================================== DoWeHaveSystem602 Boolean DoWeHaveSystem602 (void) { SysEnvRec thisWorld; Boolean haveIt; SysEnvirons(2, &thisWorld); if (thisWorld.systemVersion >= 0x0602) haveIt = TRUE; else haveIt = FALSE; return (haveIt); } //======================================================== DoWeHaveSystem605 Boolean DoWeHaveSystem605 (void) { SysEnvRec thisWorld; Boolean haveIt; SysEnvirons(2, &thisWorld); if (thisWorld.systemVersion >= 0x0605) haveIt = TRUE; else haveIt = FALSE; return (haveIt); } //======================================================== DoWeHaveSystem7 Boolean DoWeHaveSystem7 (void) { SysEnvRec thisWorld; Boolean haveIt; SysEnvirons(2, &thisWorld); if (thisWorld.systemVersion >= 0x0700) haveIt = TRUE; else haveIt = FALSE; return (haveIt); } //======================================================== HowWillWeDisplay short HowWillWeDisplay (Boolean commandKeyHeld) { short displayAs, isWide, isTall; isWide = screenBits.bounds.right - screenBits.bounds.left; isTall = screenBits.bounds.bottom - screenBits.bounds.top; if (commandKeyHeld) { if ((isWide >= 512) && (isTall >= 384) && isColor) displayAs = kDisplay12Inch; else displayAs = kDisplay9Inch; } else { if ((isWide >= 640) && (isTall >= 480)) displayAs = kDisplay13Inch; else { if ((isWide >= 512) && (isTall >= 384) && isColor) displayAs = kDisplay12Inch; else displayAs = kDisplay9Inch; } } return(displayAs); } //======================================================== WhatsOurDepth short WhatsOurDepth (void) { GDHandle theDevice; short thisDepth; char wasState; if (thisMac.hasColor) { theDevice = GetMainDevice(); if (theDevice != kNilPointer) { wasState = HGetState((Handle)theDevice); HLock((Handle)theDevice); thisDepth = (**(**theDevice).gdPMap).pixelSize; HSetState((Handle)theDevice, wasState); } else DeathError(kErrNoDevice); } else thisDepth = 1; return (thisDepth); } //======================================================== CanWeDisplay4Bit Boolean CanWeDisplay4Bit (void) { GDHandle theDevice; short canDepth; short GDTypeFlag = 1, colorFlag = 1; Boolean canDo; canDo = FALSE; if (thisMac.hasColor && thisMac.canSwitch) { theDevice = GetMainDevice(); if (theDevice != kNilPointer) { HLock((Handle)theDevice); canDepth = HasDepth(theDevice, 4, GDTypeFlag, colorFlag); HUnlock((Handle)theDevice); if (canDepth != 0) canDo = TRUE; } else DeathError(kErrNoDevice); } return (canDo); } //======================================================== SwitchDepthOrAbort void SwitchDepthOrAbort (void) { GDHandle theDevice; AlertTHndl alertHandle; Rect ale