do_subtitles no longer tries to draw to the screen, thuscompleting one
more step in themain, audio, and graphics thread seperation. Thiis also should illiminate all of the subtitle text overlap issues (bug232) git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@866 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Changes towards version 0.3:
|
||||
- fix subtitle text overlap issues (bug 232)
|
||||
- 'Esc' now leaves planet surface (bug233) -PhracturedBlue
|
||||
- Fix race on exiting starbase (bug 230) -PracturedBlue
|
||||
- Cleanup shipyard door animation (bug 215) -PhracturedBlue
|
||||
|
||||
+40
-13
@@ -101,6 +101,7 @@ enum
|
||||
WAIT_SUBTITLE,
|
||||
};
|
||||
static int subtitle_state = DONE_SUBTITLE;
|
||||
static Mutex subtitle_mutex;
|
||||
|
||||
/* _count_lines - mostly stolen from add_text, just sees how many lines
|
||||
a given input string would take to display given the
|
||||
@@ -472,6 +473,20 @@ xform_complete (void)
|
||||
ClearSemaphore (XFormControl.XFormSem);
|
||||
}
|
||||
|
||||
void
|
||||
init_communication (void)
|
||||
{
|
||||
subtitle_mutex = CreateMutex ();
|
||||
init_xform_control ();
|
||||
}
|
||||
|
||||
void
|
||||
uninit_communication (void)
|
||||
{
|
||||
DestroyMutex (subtitle_mutex);
|
||||
uninit_xform_control ();
|
||||
}
|
||||
|
||||
static BOOLEAN ColorChange;
|
||||
static BOOLEAN ClearSubtitle = FALSE;
|
||||
|
||||
@@ -1148,6 +1163,15 @@ int ambient_anim_task(void* data)
|
||||
{
|
||||
CONTEXT OldContext;
|
||||
BOOLEAN CheckSub = 0;
|
||||
BOOLEAN ClearSub;
|
||||
int sub_state;
|
||||
|
||||
LockMutex (subtitle_mutex);
|
||||
ClearSub = ClearSubtitle;
|
||||
sub_state = subtitle_state;
|
||||
ClearSubtitle = FALSE;
|
||||
UnlockMutex (subtitle_mutex);
|
||||
|
||||
|
||||
OldContext = SetContext (TaskContext);
|
||||
|
||||
@@ -1159,15 +1183,15 @@ int ambient_anim_task(void* data)
|
||||
DrawAlienFrame (TalkFrame, &Sequencer[CommData.NumAnimations - 1]);
|
||||
CommData.AlienFrame = F;
|
||||
ColorChange = FALSE;
|
||||
ClearSubtitle = FALSE;
|
||||
ClearSub = FALSE;
|
||||
CheckSub = 1;
|
||||
}
|
||||
if (Change || ClearSubtitle)
|
||||
if (Change || ClearSub)
|
||||
{
|
||||
STAMP s;
|
||||
s.origin.x = -SAFE_X;
|
||||
s.origin.y = 0;
|
||||
if (ClearSubtitle)
|
||||
if (ClearSub)
|
||||
{
|
||||
s.frame = CommFrame;
|
||||
DrawStamp (&s);
|
||||
@@ -1175,14 +1199,14 @@ int ambient_anim_task(void* data)
|
||||
i = CommData.NumAnimations;
|
||||
while (i--)
|
||||
{
|
||||
if ((ClearSubtitle || FrameChanged[i]))
|
||||
if ((ClearSub || FrameChanged[i]))
|
||||
{
|
||||
s.frame = AnimFrame[i];
|
||||
DrawStamp (&s);
|
||||
FrameChanged[i] = 0;
|
||||
}
|
||||
}
|
||||
if (ClearSubtitle && TransitionFrame)
|
||||
if (ClearSub && TransitionFrame)
|
||||
{
|
||||
s.frame = TransitionFrame;
|
||||
DrawStamp (&s);
|
||||
@@ -1199,12 +1223,11 @@ int ambient_anim_task(void* data)
|
||||
DrawStamp (&s);
|
||||
TalkFrameChanged = FALSE;
|
||||
}
|
||||
ClearSubtitle = FALSE;
|
||||
Change = FALSE;
|
||||
CheckSub = 1;
|
||||
}
|
||||
|
||||
if (CheckSub && subtitle_state >= SPACE_SUBTITLE)
|
||||
if (CheckSub && sub_state >= SPACE_SUBTITLE)
|
||||
{
|
||||
TEXT t;
|
||||
|
||||
@@ -2040,8 +2063,13 @@ int
|
||||
do_subtitles (UNICODE *pStr)
|
||||
{
|
||||
static UNICODE *last_page = NULL;
|
||||
LockMutex (subtitle_mutex);
|
||||
if (pStr == 0)
|
||||
return (subtitle_state = DONE_SUBTITLE);
|
||||
{
|
||||
subtitle_state = DONE_SUBTITLE;
|
||||
UnlockMutex (subtitle_mutex);
|
||||
return (subtitle_state);
|
||||
}
|
||||
else if (pStr == (void *)~0)
|
||||
{
|
||||
subtitle_state = WAIT_SUBTITLE;
|
||||
@@ -2049,7 +2077,10 @@ do_subtitles (UNICODE *pStr)
|
||||
else
|
||||
{
|
||||
if (last_page == pStr)
|
||||
{
|
||||
UnlockMutex (subtitle_mutex);
|
||||
return (subtitle_state);
|
||||
}
|
||||
subtitle_state = READ_SUBTITLE;
|
||||
ClearSubtitle = TRUE;
|
||||
// fprintf (stderr, "changed page to: %d\n", cur_page);
|
||||
@@ -2061,7 +2092,6 @@ do_subtitles (UNICODE *pStr)
|
||||
case READ_SUBTITLE:
|
||||
{
|
||||
TEXT t;
|
||||
CONTEXT OldContext;
|
||||
|
||||
if (optSubtitles)
|
||||
{
|
||||
@@ -2073,10 +2103,6 @@ do_subtitles (UNICODE *pStr)
|
||||
}
|
||||
t = CommData.AlienTextTemplate;
|
||||
|
||||
OldContext = SetContext (TaskContext);
|
||||
add_text (1, &t);
|
||||
SetContext (OldContext);
|
||||
|
||||
CommData.AlienTextTemplate.CharCount = t.pStr - CommData.AlienTextTemplate.pStr;
|
||||
subtitle_state = WAIT_SUBTITLE;
|
||||
break;
|
||||
@@ -2089,6 +2115,7 @@ do_subtitles (UNICODE *pStr)
|
||||
case DONE_SUBTITLE:
|
||||
break;
|
||||
}
|
||||
UnlockMutex (subtitle_mutex);
|
||||
|
||||
return (subtitle_state);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#ifndef _COMM_H
|
||||
#define _COMM_H
|
||||
|
||||
void init_xform_control (void);
|
||||
|
||||
void init_communication (void);
|
||||
void uninit_communication (void);
|
||||
#endif /* _COMM_H */
|
||||
|
||||
|
||||
+1
-1
@@ -317,7 +317,7 @@ main (int argc, char *argv[])
|
||||
|
||||
GraphicsSem = CreateSemaphore (1, "Graphics");
|
||||
RenderingCond = CreateCondVar ();
|
||||
init_xform_control ();
|
||||
init_communication ();
|
||||
|
||||
TFB_InitGraphics (gfxdriver, gfxflags, width, height, bpp);
|
||||
TFB_SetGamma (gamma);
|
||||
|
||||
Reference in New Issue
Block a user