API cleanup, fix some lingering InvalWindowRects

This commit is contained in:
elasota
2020-03-14 06:38:46 -04:00
parent 3d37ded31d
commit cea0bde015
18 changed files with 37 additions and 213 deletions

View File

@@ -61,7 +61,7 @@ void DoAbout (void)
{
messagePtr = (**version).shortVersion + 1 + (**version).shortVersion[0];
BlockMove((Ptr)messagePtr, &longVersion, ((UInt8)*messagePtr) + 1);
memcpy(&longVersion, messagePtr, ((UInt8)*messagePtr) + 1);
SetDialogString(aboutDialog, kTextItemVers, longVersion);
}

View File

@@ -56,6 +56,7 @@ PLError_t DoOpenDocAE (const AppleEvent *theAE, AppleEvent *reply, UInt32 ref)
DescType returnedType;
PLError_t theErr, whoCares;
short i;
bool redrawMainWindow = false;
theErr = AEGetParamDesc(theAE, keyDirectObject, typeAEList, &docList);
if (theErr != PLErrors::kNone)
@@ -112,7 +113,7 @@ PLError_t DoOpenDocAE (const AppleEvent *theAE, AppleEvent *reply, UInt32 ref)
Rect updateRect;
SetRect(&updateRect, splashOriginH + 474, splashOriginV + 304, splashOriginH + 474 + 166, splashOriginV + 304 + 12);
InvalWindowRect(mainWindow, &updateRect);
redrawMainWindow = true;
}
}
}
@@ -120,6 +121,9 @@ PLError_t DoOpenDocAE (const AppleEvent *theAE, AppleEvent *reply, UInt32 ref)
}
#endif
whoCares = AEDisposeDesc(&docList);
if (redrawMainWindow)
UpdateMainWindow();
return theErr;
}

View File

@@ -648,8 +648,8 @@ void CheckDuplicateFloorSuite (void)
{
bitPlace = (((*thisHouse)->rooms[i].floor + 7) * 128) +
(*thisHouse)->rooms[i].suite;
if ((bitPlace < 0) || (bitPlace >= 8192))
DebugStr(PSTR("Blew array"));
//if ((bitPlace < 0) || (bitPlace >= 8192))
// DebugStr(PSTR("Blew array"));
if (pidgeonHoles[bitPlace] != 0)
{
houseErrors++;

View File

@@ -173,7 +173,7 @@ void VariableInit (void)
fadeInSequence[14] = 9;
fadeInSequence[15] = 10;
doubleTime = GetDblTime();
doubleTime = 30; // PL_NotYetImplemented_TODO: Get this from the system settings
mirrorRects = nil;
mainWindow = nil;

View File

@@ -206,7 +206,6 @@ void UpdateLinkWindow (void)
return;
SetPortWindowPort(linkWindow);
DrawControls(linkWindow);
UpdateLinkControl();
#endif
}
@@ -259,6 +258,8 @@ void OpenLinkWindow (void)
linkObject = 255;
isLinkOpen = true;
UpdateLinkWindow();
}
#endif
}

View File

@@ -187,7 +187,7 @@ void UpdateClipboardMenus (void)
mm->SetItemText(houseMenu, iCopy - 1, title);
GetLocalizedString(38, title);
mm->SetItemText(houseMenu, iClear - 1, title);
mm->SetItemEnabled(houseMenu, iDuplicate - 1, false);
mm->SetItemEnabled(houseMenu, iDuplicate - 1, true);
}
else
{

View File

@@ -222,7 +222,7 @@ PLError_t LoadMusicSounds (void)
if (theMusicData[i] == nil)
return PLErrors::kOutOfMemory;
BlockMove(static_cast<Byte*>(*theSound), theMusicData[i], soundDataSize);
memcpy(theMusicData[i], static_cast<Byte*>(*theSound), soundDataSize);
theSound.Dispose();
}
return (theErr);

View File

@@ -306,7 +306,7 @@ void DragHandle (Window *window, DrawSurface *surface, Point where)
DragMarqueeHandle(window, surface, where, &hDelta);
thisRoom->objects[objActive].data.f.length = hDelta;
whoCares = KeepObjectLegal();
InvalWindowRect(mainWindow, &mainWindowRect);
redrawMainWindow = true;
GetThisRoomsObjRects();
ReadyBackground(thisRoom->background, thisRoom->tiles);
DrawThisRoomsObjects();
@@ -1150,6 +1150,7 @@ void DuplicateObject (void)
Point placePt;
short direction, dist;
Boolean handled;
bool redrawMainWindow = false;
tempObject = thisRoom->objects[objActive];
@@ -1313,7 +1314,7 @@ void DuplicateObject (void)
ReadyBackground(thisRoom->background, thisRoom->tiles);
GetThisRoomsObjRects();
DrawThisRoomsObjects();
InvalWindowRect(mainWindow, &mainWindowRect);
redrawMainWindow = true;
if (handled)
{
@@ -1323,6 +1324,9 @@ void DuplicateObject (void)
else
StartMarquee(&roomObjectRects[objActive]);
}
if (redrawMainWindow)
UpdateMainWindow();
}
//-------------------------------------------------------------- MoveObject
@@ -1657,51 +1661,6 @@ void MoveObject (short whichWay, Boolean shiftDown)
UpdateMenus(false);
GetThisRoomsObjRects();
if (objActive == kInitialGliderSelected)
{
InvalWindowRect(mainWindow, &wasRect);
InvalWindowRect(mainWindow, &initialGliderRect);
}
else if (objActive == kLeftGliderSelected)
{
InvalWindowRect(mainWindow, &wasRect);
InvalWindowRect(mainWindow, &leftStartGliderDest);
}
else if (objActive == kRightGliderSelected)
{
InvalWindowRect(mainWindow, &wasRect);
InvalWindowRect(mainWindow, &rightStartGliderDest);
}
else
{
switch (thisRoom->objects[objActive].what)
{
case kTiki:
case kTable:
case kShelf:
case kCabinet:
case kDeckTable:
case kStool:
case kCounter:
case kDresser:
case kGreaseRt:
case kGreaseLf:
case kSlider:
case kMailboxLf:
case kMailboxRt:
case kTrackLight:
case kMirror:
case kWallWindow:
InvalWindowRect(mainWindow, &mainWindowRect);
break;
default:
InvalWindowRect(mainWindow, &wasRect);
InvalWindowRect(mainWindow, &roomObjectRects[objActive]);
break;
}
}
ReadyBackground(thisRoom->background, thisRoom->tiles);
DrawThisRoomsObjects();
@@ -1721,6 +1680,8 @@ void MoveObject (short whichWay, Boolean shiftDown)
else
StartMarquee(&roomObjectRects[objActive]);
}
UpdateMainWindow();
#endif
}

View File

@@ -967,7 +967,6 @@ void BringSendFrontBack (Boolean bringFront)
fileDirty = true;
UpdateMenus(false);
InvalWindowRect(mainWindow, &mainWindowRect);
DeselectObject();
GetThisRoomsObjRects();
ReadyBackground(thisRoom->background, thisRoom->tiles);
@@ -975,6 +974,8 @@ void BringSendFrontBack (Boolean bringFront)
GenerateRetroLinks();
InitCursor();
UpdateMainWindow();
}
#endif

View File

@@ -229,7 +229,6 @@ int16_t LoadFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
return kScrollDownItem;
case PL_KEY_SPECIAL(kUpArrow):
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
thisHouseIndex -= 4;
if (thisHouseIndex < 0)
{
@@ -243,23 +242,20 @@ int16_t LoadFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
if (thisHouseIndex >= screenCount)
thisHouseIndex -= 4;
}
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
UpdateLoadDialog(dial);
return 0;
case PL_KEY_SPECIAL(kDownArrow):
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
thisHouseIndex += 4;
screenCount = housesFound - housePage;
if (screenCount > kDispFiles)
screenCount = kDispFiles;
if (thisHouseIndex >= screenCount)
thisHouseIndex %= 4;
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
UpdateLoadDialog(dial);
return 0;
case PL_KEY_SPECIAL(kLeftArrow):
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
thisHouseIndex--;
if (thisHouseIndex < 0)
{
@@ -268,19 +264,18 @@ int16_t LoadFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
screenCount = kDispFiles;
thisHouseIndex = screenCount - 1;
}
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
UpdateLoadDialog(dial);
return 0;
case PL_KEY_SPECIAL(kTab):
case PL_KEY_SPECIAL(kRightArrow):
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
thisHouseIndex++;
screenCount = housesFound - housePage;
if (screenCount > kDispFiles)
screenCount = kDispFiles;
if (thisHouseIndex >= screenCount)
thisHouseIndex = 0;
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
UpdateLoadDialog(dial);
return 0;
default:
@@ -308,10 +303,7 @@ int16_t LoadFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
thisHouseIndex = screenCount - 1;
}
if (wasIndex != thisHouseIndex)
{
InvalWindowRect(dial->GetWindow(), &loadHouseRects[wasIndex]);
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
}
UpdateLoadDialog(dial);
}
return 0;
}

View File

@@ -205,7 +205,7 @@ PLError_t LoadTriggerSound (short soundID)
}
else
{
BlockMove((Byte*)(*theSound), theSoundData[kMaxSounds - 1], soundDataSize);
memcpy(theSoundData[kMaxSounds - 1], (Byte*)(*theSound), soundDataSize);
theSound.Dispose();
}
}
@@ -246,7 +246,7 @@ PLError_t LoadBufferSounds (void)
if (theSoundData[i] == nil)
return (PLErrors::kOutOfMemory);
BlockMove(*theSound, theSoundData[i], soundDataSize);
memcpy(theSoundData[i], *theSound, soundDataSize);
theSound.Dispose();
}

View File

@@ -268,7 +268,7 @@ void CreatePointers (void)
{
GP_STATIC_ASSERT(sizeof(demoType) == 6);
BlockMove(*tempHandle, demoData, kDemoLength);
memcpy(demoData, *tempHandle, kDemoLength);
tempHandle.Dispose();
}
#endif

View File

@@ -114,7 +114,9 @@ void RedAlert (short errorNumber)
// CenterAlert(rDeathAlertID);
dummyInt = PortabilityLayer::DialogManager::GetInstance()->DisplayAlert(rDeathAlertID, &substitutions);
ExitToShell();
//ExitToShell();
PL_NotYetImplemented_TODO("Exit");
}
//-------------------------------------------------------------- CreateOffScreenBitMap