mirror of
https://github.com/softdorothy/GliderPRO.git
synced 2024-11-26 02:49:20 +00:00
1 line
8.6 KiB
C
1 line
8.6 KiB
C
|
//============================================================================
//----------------------------------------------------------------------------
// Link.c
//----------------------------------------------------------------------------
//============================================================================
#include "Externs.h"
#include "Environ.h"
#include "ObjectEdit.h"
#include "RectUtils.h"
#define kLinkControlID 130
#define kUnlinkControlID 131
void DoLink (void);
void DoUnlink (void);
Rect linkWindowRect;
ControlHandle linkControl, unlinkControl;
WindowPtr linkWindow;
short isLinkH, isLinkV, linkRoom, linkType;
Byte linkObject;
Boolean isLinkOpen, linkerIsSwitch;
//============================================================== Functions
//-------------------------------------------------------------- MergeFloorSuite
short MergeFloorSuite (short floor, short suite)
{
return ((suite * 100) + floor);
}
//-------------------------------------------------------------- ExtractFloorSuite
void ExtractFloorSuite (short combo, short *floor, short *suite)
{
if ((*thisHouse)->version < 0x0200) // old floor/suite combo
{
*floor = (combo / 100) - kNumUndergroundFloors;
*suite = combo % 100;
}
else
{
*suite = combo / 100;
*floor = (combo % 100) - kNumUndergroundFloors;
}
}
//-------------------------------------------------------------- UpdateLinkControl
void UpdateLinkControl (void)
{
#ifndef COMPILEDEMO
if (linkWindow == nil)
return;
switch (linkType)
{
case kSwitchLinkOnly:
if (objActive == kNoObjectSelected)
HiliteControl(linkControl, kControlInactive);
else
switch (thisRoom->objects[objActive].what)
{
case kFloorVent:
case kCeilingVent:
case kFloorBlower:
case kCeilingBlower:
case kSewerGrate:
case kLeftFan:
case kRightFan:
case kInvisBlower:
case kGrecoVent:
case kSewerBlower:
case kLiftArea:
case kRedClock:
case kBlueClock:
case kYellowClock:
case kCuckoo:
case kPaper:
case kBattery:
case kBands:
case kFoil:
case kInvisBonus:
case kHelium:
case kDeluxeTrans:
case kCeilingLight:
case kLightBulb:
case kTableLamp:
case kHipLamp:
case kDecoLamp:
case kFlourescent:
case kTrackLight:
case kInvisLight:
case kShredder:
case kToaster:
case kMacPlus:
case kTV:
case kCoffee:
case kOutlet:
case kVCR:
case kStereo:
case kMicrowave:
case kBalloon:
case kCopterLf:
case kCopterRt:
case kDartLf:
case kDartRt:
case kBall:
case kDrip:
case kFish:
HiliteControl(linkControl, kControlActive);
break;
default:
HiliteControl(linkControl, kControlInactive);
break;
}
break;
case kTriggerLinkOnly:
if (objActive == kNoObjectSelected)
HiliteControl(linkControl, kControlInactive);
else
switch (thisRoom->objects[objActive].what)
{
case kGreaseRt:
case kGreaseLf:
case kToaster:
case kGuitar:
case kCoffee:
case kOutlet:
case kBalloon:
case kCopterLf:
case kCopterRt:
case kDartLf:
case kDartRt:
case kDrip:
case kFish:
HiliteControl(linkControl, kControlActive);
break;
case kLightSwitch:
case kMachineSwitch:
case kThermostat:
case kPowerSwitch:
case kKnifeSwitch:
case kInvisSwitch:
if (linkRoom == thisRoomNumber)
HiliteControl(linkControl, kControlActive);
break;
default:
HiliteControl(linkControl, kControlInactive);
break;
}
break;
case kTransportLinkOnly:
if (objActive == kNoObjectSelected)
HiliteControl(linkControl, kControlInactive);
else
switch (thisRoom->objects[objActive].what)
{
case kMailboxLf:
case kMailboxRt:
case kCeilingTrans:
case kInvisTrans:
case kDeluxeTrans:
case kInvisLight:
case kOzma:
case kMirror:
case kFireplace:
case kWallWindow:
case kCalendar:
case kBulletin:
case kCloud:
HiliteControl(linkControl, kControlActi
|