Add flicker effect to chrome (replaces zooms)

This commit is contained in:
elasota
2020-05-18 03:30:25 -04:00
parent 5c07ce08bb
commit 8135c68c49
11 changed files with 292 additions and 63 deletions

View File

@@ -16,6 +16,8 @@
#include "RectUtils.h"
#include "Room.h"
#include "Utilities.h"
#include "WindowDef.h"
#include "WindowManager.h"
#define kBannerPageTopPICT 1993
@@ -196,23 +198,32 @@ void BringUpBanner (void)
// in a house. It comes up when the player gets a star (the game is paused<65>
// and the user informed as to how many remain).
void DisplayStarsRemaining (void)
void DisplayStarsRemaining(void)
{
Rect src, bounds;
Str255 theStr;
DrawSurface *surface = mainWindow->GetDrawSurface();
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
QSetRect(&bounds, 0, 0, 256, 64);
CenterRectInRect(&bounds, &thisMac.fullScreen);
QOffsetRect(&bounds, -thisMac.fullScreen.left, -thisMac.fullScreen.top);
src = bounds;
InsetRect(&src, 64, 32);
QOffsetRect(&bounds, 0, -20);
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(bounds, 0, true, 0, 0, PSTR(""));
// Zero out
QOffsetRect(&bounds, -bounds.left, -bounds.top);
Window *starsWindow = wm->CreateWindow(wdef);
wm->PutWindowBehind(starsWindow, wm->GetPutInFrontSentinel());
DrawSurface *surface = starsWindow->GetDrawSurface();
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
NumToString((long)numStarsRemaining, theStr);
QOffsetRect(&bounds, 0, -20);
if (numStarsRemaining < 2)
LoadScaledGraphic(surface, kStarRemainingPICT, &bounds);
else
@@ -221,10 +232,16 @@ void DisplayStarsRemaining (void)
const Point textPoint = Point::Create(bounds.left + 102 - (surface->MeasureString(theStr) / 2), bounds.top + 23);
ColorText(surface, textPoint, theStr, 4L);
}
if (doZooms)
wm->FlickerWindowIn(starsWindow, 32);
DelayTicks(60);
if (WaitForInputEvent(30))
RestoreEntireGameScreen();
CopyRectWorkToMain(&bounds);
WaitForInputEvent(30);
if (doZooms)
wm->FlickerWindowOut(starsWindow, 32);
wm->DestroyWindow(starsWindow);
}

View File

@@ -26,6 +26,7 @@
#include "PLStandardColors.h"
#include "PLTimeTaggedVOSEvent.h"
#include "Utilities.h"
#include "WindowManager.h"
namespace PortabilityLayer
{
@@ -506,6 +507,8 @@ void GetHighScoreName (short place)
Str255 scoreStr, placeStr, tempStr;
short item;
Boolean leaving;
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
InitCursor();
NumToString(theScore, scoreStr);
@@ -522,6 +525,12 @@ void GetHighScoreName (short place)
UpdateNameDialog(theDial);
//Window *exclStack = theDial->GetWindow();
//wm->SwapExclusiveWindow(exclStack); // Push exclusive window for zooms
if (doZooms)
wm->FlickerWindowIn(theDial->GetWindow(), 64);
while (!leaving)
{
item = theDial->ExecuteModal(NameFilter);
@@ -533,6 +542,9 @@ void GetHighScoreName (short place)
leaving = true;
}
}
if (doZooms)
wm->FlickerWindowOut(theDial->GetWindow(), 64);
theDial->Destroy();
}
@@ -610,6 +622,8 @@ void GetHighScoreBanner (void)
Str255 tempStr;
short item;
Boolean leaving;
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
BringUpDialog(&theDial, kHighBannerDialogID, nullptr);
@@ -618,7 +632,10 @@ void GetHighScoreBanner (void)
leaving = false;
UpdateBannerDialog(theDial);
if (doZooms)
wm->FlickerWindowIn(theDial->GetWindow(), 64);
while (!leaving)
{
item = theDial->ExecuteModal(BannerFilter);
@@ -630,6 +647,9 @@ void GetHighScoreBanner (void)
leaving = true;
}
}
if (doZooms)
wm->FlickerWindowOut(theDial->GetWindow(), 64);
theDial->Destroy();
}

View File

@@ -134,6 +134,9 @@ void OpenMessageWindow (const PLPasStr &title)
mssgWindowExclusiveStack = mssgWindow;
wm->SwapExclusiveWindow(mssgWindowExclusiveStack); // Push exclusive window
if (doZooms)
wm->FlickerWindowIn(mssgWindow, 32);
}
//-------------------------------------------------------------- SetMessageWindowMessage
@@ -166,7 +169,12 @@ void SetMessageWindowMessage (StringPtr message, const PortabilityLayer::RGBACol
void CloseMessageWindow (void)
{
PortabilityLayer::WindowManager::GetInstance()->SwapExclusiveWindow(mssgWindowExclusiveStack); // Pop exclusive window
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
if (doZooms)
wm->FlickerWindowOut(mssgWindow, 32);
wm->SwapExclusiveWindow(mssgWindowExclusiveStack); // Pop exclusive window
assert(mssgWindowExclusiveStack == mssgWindow);
mssgWindowExclusiveStack = nullptr;