Fixed bug #33; Crossfades are consistent and don't glitch anymore

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@891 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2003-03-16 18:38:48 +00:00
parent 441ef5c97f
commit acc4111de8
15 changed files with 117 additions and 90 deletions
+3
View File
@@ -1,4 +1,7 @@
Changes towards version 0.3: Changes towards version 0.3:
- Crossfade code now explicitly caches the screen to transition from, and
thus no longer glitches. The code needed a slight rewrite, but this
does fix bug #33 -McMartin
- Melee scaling is now trilinear by default, but it's still possible to - Melee scaling is now trilinear by default, but it's still possible to
choose nearest neighbour with --meleescale; fixes #34 -Mika choose nearest neighbour with --meleescale; fixes #34 -Mika
- Minimum scaling extent is now 1,1; fixes mostly small-objects-disappearing - Minimum scaling extent is now 1,1; fixes mostly small-objects-disappearing
+9 -6
View File
@@ -208,20 +208,23 @@ first_time = (BOOLEAN)(LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE);
do do
{ {
extern UWORD nth_frame; extern UWORD nth_frame;
RECT r;
if (first_time)
{
r.corner.x = SIS_ORG_X;
r.corner.y = SIS_ORG_Y;
r.extent.width = SIS_SCREEN_WIDTH;
r.extent.height = SIS_SCREEN_HEIGHT;
SetTransitionSource (&r);
}
BatchGraphics (); BatchGraphics ();
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE) if (LOBYTE (GLOBAL (CurrentActivity)) == IN_HYPERSPACE)
SeedUniverse (); SeedUniverse ();
RedrawQueue (TRUE); RedrawQueue (TRUE);
if (first_time) if (first_time)
{ {
RECT r;
first_time = FALSE; first_time = FALSE;
r.corner.x = SIS_ORG_X;
r.corner.y = SIS_ORG_Y;
r.extent.width = SIS_SCREEN_WIDTH;
r.extent.height = SIS_SCREEN_HEIGHT;
ScreenTransition (3, &r); ScreenTransition (3, &r);
} }
UnbatchGraphics (); UnbatchGraphics ();
+3
View File
@@ -1492,7 +1492,9 @@ static BOOLEAN
DoCommunication (INPUT_STATE InputState, PENCOUNTER_STATE pES) DoCommunication (INPUT_STATE InputState, PENCOUNTER_STATE pES)
{ {
if (!(CommData.AlienTransitionDesc.AnimFlags & (TALK_INTRO | TALK_DONE))) if (!(CommData.AlienTransitionDesc.AnimFlags & (TALK_INTRO | TALK_DONE)))
{
AlienTalkSegue ((COUNT)~0); AlienTalkSegue ((COUNT)~0);
}
if (GLOBAL (CurrentActivity) & CHECK_ABORT) if (GLOBAL (CurrentActivity) & CHECK_ABORT)
; ;
@@ -1719,6 +1721,7 @@ HailAlien (void)
r.corner.y = SIS_ORG_Y; r.corner.y = SIS_ORG_Y;
r.extent.width = SIS_SCREEN_WIDTH; r.extent.width = SIS_SCREEN_WIDTH;
SetTransitionSource (NULL);
BatchGraphics (); BatchGraphics ();
if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE) if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
{ {
+1
View File
@@ -84,6 +84,7 @@ FreeHyperData ();
TimeIn = GetTimeCounter (); TimeIn = GetTimeCounter ();
for (i = 1; i < NUM_CREDITS; ++i) for (i = 1; i < NUM_CREDITS; ++i)
{ {
SetTransitionSource (&r);
BatchGraphics (); BatchGraphics ();
s.frame = f[0]; s.frame = f[0];
DrawStamp (&s); DrawStamp (&s);
+2
View File
@@ -189,6 +189,7 @@ DestroyMusic (MR);
SetSemaphore (GraphicsSem); SetSemaphore (GraphicsSem);
s.origin.x = s.origin.y = 0; s.origin.x = s.origin.y = 0;
SetTransitionSource (NULL);
BatchGraphics (); BatchGraphics ();
SetContextBackGroundColor (BLACK_COLOR); SetContextBackGroundColor (BLACK_COLOR);
@@ -293,6 +294,7 @@ SetSemaphore (GraphicsSem);
UnbatchGraphics (); UnbatchGraphics ();
DestroyDrawable (ReleaseDrawable (SegueFrame)); DestroyDrawable (ReleaseDrawable (SegueFrame));
ScreenTransition (3, NULL);
SetResourceIndex (hOldIndex); SetResourceIndex (hOldIndex);
+7 -12
View File
@@ -909,6 +909,7 @@ DoPickGame (INPUT_STATE InputState, PMENU_STATE pMS)
} }
SetSemaphore (GraphicsSem); SetSemaphore (GraphicsSem);
SetTransitionSource (NULL);
BatchGraphics (); BatchGraphics ();
Restart: Restart:
SetContext (SpaceContext); SetContext (SpaceContext);
@@ -994,12 +995,7 @@ if (pSolarSysState)
} }
else else
{ {
extern BOOLEAN extern BOOLEAN LoadGame (COUNT which_game, SUMMARY_DESC *summary_desc);
LoadGame
(COUNT
which_game,
SUMMARY_DESC
*summary_desc);
ConfirmSaveLoad (0); ConfirmSaveLoad (0);
if (LoadGame ((COUNT)pMS->CurState, NULL_PTR)) if (LoadGame ((COUNT)pMS->CurState, NULL_PTR))
@@ -1029,7 +1025,9 @@ pMS->ModuleFrame = 0;
if (NewState != pMS->CurState) if (NewState != pMS->CurState)
{ {
RECT r;
SetSemaphore (GraphicsSem); SetSemaphore (GraphicsSem);
BatchGraphics (); BatchGraphics ();
if (((SUMMARY_DESC *)pMS->CurString)[NewState].year_index != 0) if (((SUMMARY_DESC *)pMS->CurString)[NewState].year_index != 0)
{ {
@@ -1070,26 +1068,22 @@ ChangeGameSelection:
{ {
if (first_time) if (first_time)
{ {
RECT r;
r.corner.x = SIS_ORG_X; r.corner.x = SIS_ORG_X;
r.corner.y = SIS_ORG_Y; r.corner.y = SIS_ORG_Y;
r.extent.width = SIS_SCREEN_WIDTH; r.extent.width = SIS_SCREEN_WIDTH;
r.extent.height = SIS_SCREEN_HEIGHT; r.extent.height = SIS_SCREEN_HEIGHT;
ScreenTransition (3, &r); ScreenTransition (3, &r);
} }
UnbatchGraphics (); UnbatchGraphics ();
} }
{
RECT r;
r.corner.x = 3 + (NewState * 21); r.corner.x = 3 + (NewState * 21);
r.corner.y = 176; r.corner.y = 176;
r.extent.width = 18; r.extent.width = 18;
r.extent.height = 18; r.extent.height = 18;
SetFlashRect (&r, (FRAME)0); SetFlashRect (&r, (FRAME)0);
}
ClearSemaphore (GraphicsSem); ClearSemaphore (GraphicsSem);
} }
} }
@@ -1153,6 +1147,7 @@ PickGame (PMENU_STATE
|| !(pSolarSysState || !(pSolarSysState
&& pSolarSysState->MenuState.Initialized < 3)) && pSolarSysState->MenuState.Initialized < 3))
{ {
SetTransitionSource (&DlgRect);
BatchGraphics (); BatchGraphics ();
DrawStamp(&DlgStamp); DrawStamp(&DlgStamp);
ScreenTransition (3, &DlgRect); ScreenTransition (3, &DlgRect);
@@ -56,6 +56,7 @@ void SetGraphicGrabOther (int grab_other);
void SetGraphicScale (int scale); void SetGraphicScale (int scale);
int GetGraphicScale (void); int GetGraphicScale (void);
void SetGraphicUseOtherExtra (int other); void SetGraphicUseOtherExtra (int other);
void SetTransitionSource (PRECT pRect);
void ScreenTransition (int transition, PRECT pRect); void ScreenTransition (int transition, PRECT pRect);
extern float FrameRate; extern float FrameRate;
@@ -114,6 +114,12 @@ transition_task_func (void *data)
return 0; return 0;
} }
void
SetTransitionSource (PRECT pRect)
{
TFB_DrawScreen_Copy(pRect, TFB_SCREEN_MAIN, TFB_SCREEN_TRANSITION);
}
// Status: Implemented // Status: Implemented
void void
ScreenTransition (int TransType, PRECT pRect) ScreenTransition (int TransType, PRECT pRect)
@@ -140,8 +146,6 @@ ScreenTransition (int TransType, PRECT pRect)
TransitionClipRect.h = ScreenHeight; TransitionClipRect.h = ScreenHeight;
} }
SDL_BlitSurface (SDL_Screen, &TransitionClipRect, TransitionScreen, &TransitionClipRect);
#ifdef HAVE_OPENGL #ifdef HAVE_OPENGL
if (GraphicsDriver == TFB_GFXDRIVER_SDL_OPENGL) if (GraphicsDriver == TFB_GFXDRIVER_SDL_OPENGL)
{ {
+1
View File
@@ -600,6 +600,7 @@ DoOutfit (INPUT_STATE InputState, PMENU_STATE pMS)
LoadGraphic (OUTFIT_PMAP_ANIM) LoadGraphic (OUTFIT_PMAP_ANIM)
); );
SetTransitionSource (NULL);
BatchGraphics (); BatchGraphics ();
DrawSISFrame (); DrawSISFrame ();
SetSemaphore(GraphicsSem); SetSemaphore(GraphicsSem);
+2
View File
@@ -1515,6 +1515,7 @@ InitPlanetSide (void)
SetContextClipRect (&r); SetContextClipRect (&r);
SetContextClipping (TRUE); SetContextClipping (TRUE);
SetTransitionSource (&r);
BatchGraphics (); BatchGraphics ();
{ {
@@ -1856,6 +1857,7 @@ ReturnToOrbit (PRECT pRect)
OldContext = SetContext (SpaceContext); OldContext = SetContext (SpaceContext);
SetContextClipRect (pRect); SetContextClipRect (pRect);
SetTransitionSource (pRect);
BatchGraphics (); BatchGraphics ();
DrawStarBackGround (TRUE); DrawStarBackGround (TRUE);
SetContext (ScanContext); SetContext (ScanContext);
+2 -1
View File
@@ -64,6 +64,7 @@ LoadPlanet (BOOLEAN IsDefined)
SetSemaphore (GraphicsSem); SetSemaphore (GraphicsSem);
BatchGraphics (); BatchGraphics ();
SetTransitionSource (NULL);
if (!(LastActivity & CHECK_LOAD)) if (!(LastActivity & CHECK_LOAD))
DrawStarBackGround (TRUE); DrawStarBackGround (TRUE);
@@ -176,7 +177,7 @@ LoadPlanet (BOOLEAN IsDefined)
BatchGraphics(); BatchGraphics();
DrawPlanet (SIS_SCREEN_WIDTH - MAP_WIDTH, SIS_SCREEN_HEIGHT - MAP_HEIGHT, 0, 0); DrawPlanet (SIS_SCREEN_WIDTH - MAP_WIDTH, SIS_SCREEN_HEIGHT - MAP_HEIGHT, 0, 0);
UnbatchGraphics(); UnbatchGraphics();
ScreenTransition (3, &r); ScreenTransition (3, &r); // How does this work?
UnbatchGraphics (); UnbatchGraphics ();
LoadIntoExtraScreen (&r); LoadIntoExtraScreen (&r);
ClearSemaphore (GraphicsSem); ClearSemaphore (GraphicsSem);
+5
View File
@@ -268,6 +268,11 @@ DrawStarMap (COUNT race_update, PRECT pClipRect)
SetFrameHot (Screen, SetFrameHot (Screen,
MAKE_HOT_SPOT (pClipRect->corner.x, pClipRect->corner.y)); MAKE_HOT_SPOT (pClipRect->corner.x, pClipRect->corner.y));
} }
if (transition_pending)
{
SetTransitionSource (NULL);
}
BatchGraphics (); BatchGraphics ();
which_space = GET_GAME_STATE (ARILOU_SPACE_SIDE); which_space = GET_GAME_STATE (ARILOU_SPACE_SIDE);
+10 -6
View File
@@ -490,6 +490,7 @@ ShowPlanet:
GenerateMoons (); GenerateMoons ();
NewWaitPlanet = 0; NewWaitPlanet = 0;
SetTransitionSource (NULL);
BatchGraphics (); BatchGraphics ();
SetGraphicGrabOther (1); SetGraphicGrabOther (1);
DrawSystem (pSolarSysState->pBaseDesc->pPrevDesc->radius, TRUE); DrawSystem (pSolarSysState->pBaseDesc->pPrevDesc->radius, TRUE);
@@ -673,7 +674,12 @@ void
ZoomSystem (void) ZoomSystem (void)
{ {
RECT r; RECT r;
r.corner.x = SIS_ORG_X;
r.corner.y = SIS_ORG_Y;
r.extent.width = SIS_SCREEN_WIDTH;
r.extent.height = SIS_SCREEN_HEIGHT;
SetTransitionSource (&r);
BatchGraphics (); BatchGraphics ();
if (pSolarSysState->pBaseDesc == pSolarSysState->MoonDesc) if (pSolarSysState->pBaseDesc == pSolarSysState->MoonDesc)
DrawSystem (pSolarSysState->pBaseDesc->pPrevDesc->radius, TRUE); DrawSystem (pSolarSysState->pBaseDesc->pPrevDesc->radius, TRUE);
@@ -684,10 +690,6 @@ ZoomSystem (void)
DrawSystem (pSolarSysState->SunDesc[0].radius, FALSE); DrawSystem (pSolarSysState->SunDesc[0].radius, FALSE);
} }
r.corner.x = SIS_ORG_X;
r.corner.y = SIS_ORG_Y;
r.extent.width = SIS_SCREEN_WIDTH;
r.extent.height = SIS_SCREEN_HEIGHT;
ScreenTransition (3, &r); ScreenTransition (3, &r);
UnbatchGraphics (); UnbatchGraphics ();
LoadIntoExtraScreen (&r); LoadIntoExtraScreen (&r);
@@ -974,9 +976,10 @@ ScaleSystem (void)
CONTEXT OldContext; CONTEXT OldContext;
OldContext = SetContext (SpaceContext); OldContext = SetContext (SpaceContext);
GetContextClipRect (&r);
SetTransitionSource (&r);
BatchGraphics (); BatchGraphics ();
DrawSystem (pSolarSysState->SunDesc[0].radius, FALSE); DrawSystem (pSolarSysState->SunDesc[0].radius, FALSE);
GetContextClipRect (&r);
ScreenTransition (3, &r); ScreenTransition (3, &r);
UnbatchGraphics (); UnbatchGraphics ();
LoadIntoExtraScreen (&r); LoadIntoExtraScreen (&r);
@@ -1085,8 +1088,8 @@ TheMess:
if (old_radius) if (old_radius)
ScaleSystem (); ScaleSystem ();
SetTransitionSource (NULL);
BatchGraphics (); BatchGraphics ();
if (!(draw_sys_flags & DRAW_REFRESH)) // don't repair from Extra or draw ship if forcing repair if (!(draw_sys_flags & DRAW_REFRESH)) // don't repair from Extra or draw ship if forcing repair
{ {
CONTEXT OldContext; CONTEXT OldContext;
@@ -1405,6 +1408,7 @@ LoadLanderData ();
if (pSolarSysState->MenuState.Initialized == 0) if (pSolarSysState->MenuState.Initialized == 0)
{ {
SetTransitionSource (NULL);
BatchGraphics (); BatchGraphics ();
draw_sys_flags |= UNBATCH_SYS; draw_sys_flags |= UNBATCH_SYS;
+1
View File
@@ -1205,6 +1205,7 @@ DoShipyard (INPUT_STATE InputState, PMENU_STATE pMS)
pMS->hMusic = LoadMusicInstance (SHIPYARD_MUSIC); pMS->hMusic = LoadMusicInstance (SHIPYARD_MUSIC);
SetTransitionSource (NULL);
BatchGraphics (); BatchGraphics ();
DrawSISFrame (); DrawSISFrame ();
+1
View File
@@ -314,6 +314,7 @@ s.origin.x = SAFE_X, s.origin.y = SAFE_Y + 4;
pMS->hMusic = LoadMusicInstance (STARBASE_MUSIC); pMS->hMusic = LoadMusicInstance (STARBASE_MUSIC);
SetSemaphore (GraphicsSem); SetSemaphore (GraphicsSem);
SetTransitionSource (NULL);
BatchGraphics (); BatchGraphics ();
SetContextBackGroundColor (BLACK_COLOR); SetContextBackGroundColor (BLACK_COLOR);
ClearDrawable (); ClearDrawable ();