mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 12:09:36 +00:00
Cleanup, add scanline mask builder
This commit is contained in:
@@ -54,8 +54,6 @@ Boolean KeepObjectLegal (void)
|
||||
|
||||
if (objActive == kInitialGliderSelected)
|
||||
{
|
||||
wasState = HGetState((Handle)thisHouse);
|
||||
HLock((Handle)thisHouse);
|
||||
if ((*thisHouse)->initial.h < 0)
|
||||
(*thisHouse)->initial.h = 0;
|
||||
if ((*thisHouse)->initial.v < 0)
|
||||
@@ -64,7 +62,6 @@ Boolean KeepObjectLegal (void)
|
||||
(*thisHouse)->initial.h = kRoomWide - kGliderWide;
|
||||
if ((*thisHouse)->initial.v > (kTileHigh - kGliderHigh))
|
||||
(*thisHouse)->initial.v = kTileHigh - kGliderHigh;
|
||||
HSetState((Handle)thisHouse, wasState);
|
||||
return (true);
|
||||
}
|
||||
|
||||
@@ -605,13 +602,8 @@ void WrapBannerAndTrailer (void)
|
||||
{
|
||||
char wasState;
|
||||
|
||||
wasState = HGetState((Handle)thisHouse);
|
||||
HLock((Handle)thisHouse);
|
||||
|
||||
WrapText((*thisHouse)->banner, 40);
|
||||
WrapText((*thisHouse)->trailer, 64);
|
||||
|
||||
HSetState((Handle)thisHouse, wasState);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- ValidateNumberOfRooms
|
||||
@@ -623,9 +615,6 @@ void ValidateNumberOfRooms (void)
|
||||
long countedRooms, reportsRooms;
|
||||
char wasState;
|
||||
|
||||
wasState = HGetState((Handle)thisHouse);
|
||||
HLock((Handle)thisHouse);
|
||||
|
||||
reportsRooms = (long)(*thisHouse)->nRooms;
|
||||
countedRooms = (GetHandleSize((Handle)thisHouse) -
|
||||
sizeof(houseType)) / sizeof(roomType);
|
||||
@@ -635,8 +624,6 @@ void ValidateNumberOfRooms (void)
|
||||
numberRooms = (*thisHouse)->nRooms;
|
||||
houseErrors++;
|
||||
}
|
||||
|
||||
HSetState((Handle)thisHouse, wasState);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- CheckDuplicateFloorSuite
|
||||
@@ -654,9 +641,6 @@ void CheckDuplicateFloorSuite (void)
|
||||
if (pidgeonHoles == nil)
|
||||
return;
|
||||
|
||||
wasState = HGetState((Handle)thisHouse);
|
||||
HLock((Handle)thisHouse);
|
||||
|
||||
numRooms = (*thisHouse)->nRooms;
|
||||
for (i = 0; i < numRooms; i++)
|
||||
{
|
||||
@@ -676,8 +660,6 @@ void CheckDuplicateFloorSuite (void)
|
||||
}
|
||||
}
|
||||
|
||||
HSetState((Handle)thisHouse, wasState);
|
||||
|
||||
DisposePtr((Ptr)pidgeonHoles);
|
||||
}
|
||||
|
||||
@@ -691,9 +673,6 @@ void CompressHouse (void)
|
||||
char wasState;
|
||||
Boolean compressing, probing;
|
||||
|
||||
wasState = HGetState((Handle)thisHouse);
|
||||
HLock((Handle)thisHouse);
|
||||
|
||||
wasFirstRoom = (*thisHouse)->firstRoom;
|
||||
compressing = true;
|
||||
roomNumber = (*thisHouse)->nRooms - 1; // start with last room
|
||||
@@ -729,8 +708,6 @@ void CompressHouse (void)
|
||||
compressing = false;
|
||||
}
|
||||
while (compressing);
|
||||
|
||||
HSetState((Handle)thisHouse, wasState);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- LopOffExtraRooms
|
||||
@@ -744,9 +721,6 @@ void LopOffExtraRooms (void)
|
||||
char wasState;
|
||||
Str255 message;
|
||||
|
||||
wasState = HGetState((Handle)thisHouse);
|
||||
HLock((Handle)thisHouse);
|
||||
|
||||
count = 0;
|
||||
r = (*thisHouse)->nRooms; // begin at last room
|
||||
do
|
||||
@@ -763,19 +737,16 @@ void LopOffExtraRooms (void)
|
||||
{
|
||||
r = (*thisHouse)->nRooms - count;
|
||||
newSize = sizeof(houseType) + (sizeof(roomType) * (long)r);
|
||||
HUnlock((Handle)thisHouse); // resize house handle (shrink)
|
||||
SetHandleSize((Handle)thisHouse, newSize);
|
||||
SetHandleSize((Handle)thisHouse, newSize); // resize house handle (shrink)
|
||||
if (MemError() != noErr) // problem?
|
||||
{
|
||||
ForeColor(redColor);
|
||||
GetLocalizedString(16, message);
|
||||
SetMessageWindowMessage(message);
|
||||
}
|
||||
HLock((Handle)thisHouse); // reflect new room count
|
||||
(*thisHouse)->nRooms -= count;
|
||||
numberRooms = (*thisHouse)->nRooms;
|
||||
}
|
||||
HSetState((Handle)thisHouse, wasState);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- ValidateRoomNumbers
|
||||
@@ -788,9 +759,6 @@ void ValidateRoomNumbers (void)
|
||||
char wasState;
|
||||
Str255 message;
|
||||
|
||||
wasState = HGetState((Handle)thisHouse);
|
||||
HLock((Handle)thisHouse);
|
||||
|
||||
numRooms = (*thisHouse)->nRooms;
|
||||
if (numRooms < 0)
|
||||
{
|
||||
@@ -823,8 +791,6 @@ void ValidateRoomNumbers (void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HSetState((Handle)thisHouse, wasState);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- CountUntitledRooms
|
||||
@@ -836,9 +802,6 @@ void CountUntitledRooms (void)
|
||||
short i, numRooms;
|
||||
char wasState;
|
||||
|
||||
wasState = HGetState((Handle)thisHouse);
|
||||
HLock((Handle)thisHouse);
|
||||
|
||||
numRooms = (*thisHouse)->nRooms;
|
||||
for (i = 0; i < numRooms; i++)
|
||||
{
|
||||
@@ -846,8 +809,6 @@ void CountUntitledRooms (void)
|
||||
(EqualString((*thisHouse)->rooms[i].name, PSTR("Untitled Room"), false, true)))
|
||||
houseErrors++;
|
||||
}
|
||||
|
||||
HSetState((Handle)thisHouse, wasState);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- CheckRoomNameLength
|
||||
@@ -859,9 +820,6 @@ void CheckRoomNameLength (void)
|
||||
short i, numRooms;
|
||||
char wasState;
|
||||
|
||||
wasState = HGetState((Handle)thisHouse);
|
||||
HLock((Handle)thisHouse);
|
||||
|
||||
numRooms = (*thisHouse)->nRooms;
|
||||
for (i = 0; i < numRooms; i++)
|
||||
{
|
||||
@@ -874,8 +832,6 @@ void CheckRoomNameLength (void)
|
||||
houseErrors++;
|
||||
}
|
||||
}
|
||||
|
||||
HSetState((Handle)thisHouse, wasState);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- MakeSureNumObjectsJives
|
||||
@@ -887,9 +843,6 @@ void MakeSureNumObjectsJives (void)
|
||||
short i, h, numRooms, count;
|
||||
char wasState;
|
||||
|
||||
wasState = HGetState((Handle)thisHouse);
|
||||
HLock((Handle)thisHouse);
|
||||
|
||||
numRooms = (*thisHouse)->nRooms;
|
||||
for (i = 0; i < numRooms; i++)
|
||||
{
|
||||
@@ -908,8 +861,6 @@ void MakeSureNumObjectsJives (void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HSetState((Handle)thisHouse, wasState);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- KeepAllObjectsLegal
|
||||
@@ -922,9 +873,6 @@ void KeepAllObjectsLegal (void)
|
||||
char wasState;
|
||||
Str255 message;
|
||||
|
||||
wasState = HGetState((Handle)thisHouse);
|
||||
HLock((Handle)thisHouse);
|
||||
|
||||
numRooms = (*thisHouse)->nRooms;
|
||||
for (i = 0; i < numRooms; i++)
|
||||
{
|
||||
@@ -950,8 +898,6 @@ void KeepAllObjectsLegal (void)
|
||||
CopyThisRoomToRoom();
|
||||
}
|
||||
}
|
||||
|
||||
HSetState((Handle)thisHouse, wasState);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- CheckForStaircasePairs
|
||||
@@ -965,9 +911,6 @@ void CheckForStaircasePairs (void)
|
||||
Boolean hasStairs;
|
||||
Str255 message;
|
||||
|
||||
wasState = HGetState((Handle)thisHouse);
|
||||
HLock((Handle)thisHouse);
|
||||
|
||||
numRooms = (*thisHouse)->nRooms;
|
||||
for (i = 0; i < numRooms; i++)
|
||||
{
|
||||
@@ -1040,8 +983,6 @@ void CheckForStaircasePairs (void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HSetState((Handle)thisHouse, wasState);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user