Get TVs working

This commit is contained in:
elasota
2020-02-20 03:13:15 -05:00
parent fcd8fdb17e
commit 36f10c60b4
16 changed files with 360 additions and 244 deletions

View File

@@ -193,8 +193,7 @@ Boolean DoWeHaveSoundManager3 (void)
Boolean DoWeHaveQuickTime (void)
{
PL_NotYetImplemented_TODO("Movies");
return false;
return true;
}
//-------------------------------------------------------------- DoWeHaveDragManager

View File

@@ -39,7 +39,7 @@ extern Rect clutterSrcRect;
extern Rect flowerSrc[];
extern Rect *srcRects;
extern Movie theMovie;
extern AnimationPlayer theMovie;
extern Rect movieRect;
extern Boolean hasMovie, tvInRoom;

View File

@@ -11,6 +11,7 @@
#include "PLStringCompare.h"
#include "PLTextUtils.h"
#include "PLPasStr.h"
#include "BitmapImage.h"
#include "DialogManager.h"
#include "Externs.h"
#include "Environ.h"
@@ -34,7 +35,7 @@ void CloseHouseMovie (void);
Boolean IsFileReadOnly (const VFileSpec &);
Movie theMovie;
AnimationPlayer theMovie;
Rect movieRect;
PortabilityLayer::ResourceArchive *houseResFork;
short wasHouseVersion;
@@ -52,31 +53,12 @@ extern Boolean phoneBitSet, bannerStarCountOn;
//============================================================== Functions
//-------------------------------------------------------------- LoopMovie
void LoopMovie (void)
{
THandle<long> theLoop;
UserData theUserData;
short theCount;
theLoop = NewHandle(sizeof(long)).StaticCast<long>();
(**theLoop) = 0;
theUserData = GetMovieUserData(theMovie);
theCount = CountUserDataType(theUserData, 'LOOP');
while (theCount--)
{
RemoveUserData(theUserData, 'LOOP', 1);
}
AddUserData(theUserData, theLoop.StaticCast<void>(), 'LOOP');
}
//-------------------------------------------------------------- OpenHouseMovie
void OpenHouseMovie (void)
{
#ifdef COMPILEQT
TimeBase theTime;
VFileSpec theSpec;
VFileInfo finderInfo;
Handle spaceSaver;
@@ -92,60 +74,24 @@ void OpenHouseMovie (void)
theErr = FSpGetFInfo(theSpec, finderInfo);
if (theErr != PLErrors::kNone)
return;
theErr = OpenMovieFile(theSpec, &movieRefNum, 0);
if (theErr != PLErrors::kNone)
AnimationPackage *anim = AnimationPackage::Create();
if (!anim)
return;
if (!anim->Load(theSpec.m_dir, theSpec.m_name))
{
anim->Destroy();
YellowAlert(kYellowQTMovieNotLoaded, theErr);
return;
}
theErr = NewMovieFromFile(&theMovie, movieRefNum, nil, theSpec.m_name,
newMovieActive, &dataRefWasChanged);
if (theErr != PLErrors::kNone)
{
YellowAlert(kYellowQTMovieNotLoaded, theErr);
theErr = CloseMovieFile(movieRefNum);
return;
}
theErr = CloseMovieFile(movieRefNum);
spaceSaver = NewHandle(307200L);
if (spaceSaver == nil)
{
YellowAlert(kYellowQTMovieNotLoaded, 749);
CloseHouseMovie();
return;
}
GoToBeginningOfMovie(theMovie);
theErr = LoadMovieIntoRam(theMovie,
GetMovieTime(theMovie, 0L), GetMovieDuration(theMovie), 0);
if (theErr != PLErrors::kNone)
{
YellowAlert(kYellowQTMovieNotLoaded, theErr);
spaceSaver.Dispose();
CloseHouseMovie();
return;
}
spaceSaver.Dispose();
theErr = PrerollMovie(theMovie, 0, 0x000F0000);
if (theErr != PLErrors::kNone)
{
YellowAlert(kYellowQTMovieNotLoaded, theErr);
CloseHouseMovie();
return;
}
theTime = GetMovieTimeBase(theMovie);
SetTimeBaseFlags(theTime, loopTimeBase);
SetMovieMasterTimeBase(theMovie, theTime, nil);
LoopMovie();
GetMovieBox(theMovie, &movieRect);
movieRect = (*anim->GetFrame(0))->GetRect();
hasMovie = true;
theMovie.SetPackage(anim);
AnimationManager::GetInstance()->RegisterPlayer(&theMovie);
}
#endif
}
@@ -159,9 +105,10 @@ void CloseHouseMovie (void)
if ((thisMac.hasQT) && (hasMovie))
{
theErr = LoadMovieIntoRam(theMovie,
GetMovieTime(theMovie, 0L), GetMovieDuration(theMovie), flushFromRam);
DisposeMovie(theMovie);
AnimationManager::GetInstance()->RemovePlayer(&theMovie);
theMovie.m_animPackage->Destroy();
theMovie.m_animPackage = nullptr;
}
#endif
hasMovie = false;
@@ -195,8 +142,10 @@ Boolean OpenHouse (void)
houseOpen = true;
OpenHouseResFork();
hasMovie = false;
if (hasMovie)
CloseHouseMovie();
tvInRoom = false;
tvWithMovieNumber = -1;
OpenHouseMovie();

View File

@@ -351,14 +351,6 @@ int gpAppMain()
InitSrcRects();
CreateOffscreens(); SpinCursor(2);
OpenMainWindow();
if (thisMac.hasQT)
{
theErr = EnterMovies();
if (theErr != PLErrors::kNone)
thisMac.hasQT = false;
}
InitSound(); SpinCursor(2);
InitMusic(); SpinCursor(2);
BuildHouseList();

View File

@@ -5,7 +5,7 @@
//----------------------------------------------------------------------------
//============================================================================
#include "BitmapImage.h"
#include "Externs.h"
#include "Environ.h"
#include "RectUtils.h"
@@ -679,10 +679,10 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
whoCares = tvScreen1;
ZeroRectCorner(&whoCares);
OffsetRect(&whoCares, itsRect.left + 17, itsRect.top + 10);
GetMovieBox(theMovie, &movieRect);
movieRect = (*theMovie.m_animPackage->GetFrame(0))->GetRect();
CenterRectInRect(&movieRect, &whoCares);
SetMovieBox(theMovie, &movieRect);
SetMovieDisplayClipRgn(theMovie, &whoCares);
theMovie.m_renderRect = movieRect;
theMovie.m_constrainRect = whoCares;
tvOn = thisObject.data.g.state;
}
#endif

View File

@@ -143,7 +143,7 @@ void NewGame (short mode)
#ifdef COMPILEQT
if ((thisMac.hasQT) && (hasMovie))
{
SetMovieGWorld(theMovie, &mainWindow->m_surface, nil);
theMovie.m_surface = &mainWindow->m_surface;
}
#endif
@@ -195,11 +195,11 @@ void NewGame (short mode)
#ifdef COMPILEQT
if ((thisMac.hasQT) && (hasMovie) && (tvInRoom))
{
SetMovieActive(theMovie, true);
theMovie.m_playing = true;
if (tvOn)
{
StartMovie(theMovie);
MoviesTask(theMovie, 0);
AnimationManager::GetInstance()->RegisterPlayer(&theMovie);
AnimationManager::GetInstance()->RefreshPlayer(&theMovie);
}
}
#endif
@@ -218,8 +218,7 @@ void NewGame (short mode)
if ((thisMac.hasQT) && (hasMovie) && (tvInRoom))
{
tvInRoom = false;
StopMovie(theMovie);
SetMovieActive(theMovie, false);
theMovie.m_playing = false;
}
#endif
@@ -399,7 +398,7 @@ void PlayGame (void)
{
#ifdef COMPILEQT
if ((thisMac.hasQT) && (hasMovie) && (tvInRoom) && (tvOn))
MoviesTask(theMovie, 0);
AnimationManager::GetInstance()->RefreshPlayer(&theMovie);
#endif
RenderFrame();
HandleDynamicScoreboard();
@@ -424,7 +423,7 @@ void PlayGame (void)
{
#ifdef COMPILEQT
if ((thisMac.hasQT) && (hasMovie) && (tvInRoom) && (tvOn))
MoviesTask(theMovie, 0);
AnimationManager::GetInstance()->RefreshPlayer(&theMovie);
#endif
RenderFrame();
HandleDynamicScoreboard();

View File

@@ -380,7 +380,7 @@ void ReadyLevel (void)
{
tvInRoom = false;
tvWithMovieNumber = -1;
StopMovie(theMovie);
theMovie.m_playing = false;
}
#endif

View File

@@ -308,8 +308,8 @@ void MoveRoomToRoom (gliderPtr thisGlider, short where)
RenderFrame();
if ((thisMac.hasQT) && (hasMovie) && (tvInRoom) && (tvOn))
{
GoToBeginningOfMovie(theMovie);
StartMovie(theMovie);
theMovie.Restart();
theMovie.m_playing = true;
}
#endif
}
@@ -346,8 +346,8 @@ void TransportRoomToRoom (gliderPtr thisGlider)
RenderFrame();
if ((thisMac.hasQT) && (hasMovie) && (tvInRoom) && (tvOn))
{
GoToBeginningOfMovie(theMovie);
StartMovie(theMovie);
theMovie.Restart();
theMovie.m_playing = true;
}
#endif
}
@@ -385,8 +385,8 @@ void MoveDuctToDuct (gliderPtr thisGlider)
RenderFrame();
if ((thisMac.hasQT) && (hasMovie) && (tvInRoom) && (tvOn))
{
GoToBeginningOfMovie(theMovie);
StartMovie(theMovie);
theMovie.Restart();
theMovie.m_playing = true;
}
#endif
}
@@ -424,8 +424,8 @@ void MoveMailToMail (gliderPtr thisGlider)
RenderFrame();
if ((thisMac.hasQT) && (hasMovie) && (tvInRoom) && (tvOn))
{
GoToBeginningOfMovie(theMovie);
StartMovie(theMovie);
theMovie.Restart();
theMovie.m_playing = true;
}
#endif
}

View File

@@ -44,13 +44,13 @@ void ToggleTV (short index)
{
if (dinahs[index].active)
{
GoToBeginningOfMovie(theMovie);
StartMovie(theMovie);
theMovie.Restart();
theMovie.m_playing = true;
tvOn = true;
}
else
{
StopMovie(theMovie);
theMovie.m_playing = false;
tvOn = false;
}
}