mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- made Exhumed's text scroller a universal component of the cutscene system, usable by all games.
This commit is contained in:
parent
f69fe334fc
commit
d2ed4e703d
2 changed files with 57 additions and 51 deletions
|
@ -535,3 +535,58 @@ class ScreenJobRunner : Object
|
|||
Append(MoviePlayerJob.CreateWithSoundInfo(fn, sounds, 0, framerate));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// scrolling text, like Exhumed's story screens.
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class TextOverlay
|
||||
{
|
||||
int nHeight;
|
||||
double nCrawlY;
|
||||
int palette;
|
||||
int crange;
|
||||
bool drawclean;
|
||||
BrokenLines screentext;
|
||||
|
||||
void Init(String text, int cr = Font.CR_UNTRANSLATED, int pal = 0, bool clean = false)
|
||||
{
|
||||
screentext = SmallFont.BreakLines(StringTable.Localize(text), 320);
|
||||
nCrawlY = 199;
|
||||
nHeight = screentext.Count() * 10;
|
||||
palette = pal;
|
||||
crange = cr;
|
||||
drawclean = clean;
|
||||
}
|
||||
|
||||
void DisplayText()
|
||||
{
|
||||
if (nHeight + nCrawlY > 0)
|
||||
{
|
||||
double y = nCrawlY;
|
||||
for (int i = 0; i < screentext.Count() && y <= 199; i++)
|
||||
{
|
||||
if (y >= -10)
|
||||
{
|
||||
int x = 160 - screenText.StringWidth(i)/2;
|
||||
if (!drawclean) Screen.DrawText(SmallFont, crange, x, y, screentext.StringAt(i), DTA_FullscreenScale, FSMode_Fit320x200, DTA_TranslationIndex, palette);
|
||||
else Screen.DrawText(SmallFont, crange, x, y, screentext.StringAt(i), DTA_Clean, true, DTA_TranslationIndex, palette);
|
||||
}
|
||||
y += 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ScrollText(double clock)
|
||||
{
|
||||
if (nHeight + nCrawlY > 0 || musplaying.handle)
|
||||
{
|
||||
nCrawlY = 199 - clock / 15.;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -450,55 +450,6 @@ class MapScreen : ScreenJob
|
|||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class TextOverlay
|
||||
{
|
||||
int nHeight;
|
||||
double nCrawlY;
|
||||
int palette;
|
||||
BrokenLines screentext;
|
||||
|
||||
void Init(String text, int pal)
|
||||
{
|
||||
screentext = SmallFont.BreakLines(StringTable.Localize(text), 320);
|
||||
nCrawlY = 199;
|
||||
nHeight = screentext.Count() * 10;
|
||||
palette = pal;
|
||||
}
|
||||
|
||||
void DisplayText()
|
||||
{
|
||||
if (nHeight + nCrawlY > 0)
|
||||
{
|
||||
double y = nCrawlY;
|
||||
for (int i = 0; i < screentext.Count() && y <= 199; i++)
|
||||
{
|
||||
if (y >= -10)
|
||||
{
|
||||
int x = 160 - screenText.StringWidth(i)/2;
|
||||
Screen.DrawText(SmallFont, Font.CR_UNDEFINED, x, y, screentext.StringAt(i), DTA_FullscreenScale, FSMode_Fit320x200, DTA_TranslationIndex, palette);
|
||||
}
|
||||
y += 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool AdvanceCinemaText(double clock)
|
||||
{
|
||||
if (nHeight + nCrawlY > 0 || musplaying.handle)
|
||||
{
|
||||
nCrawlY = 199 - clock / 15.;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// cinema (this has been stripped off all game logic that was still in here)
|
||||
|
@ -520,7 +471,7 @@ class Cinema : SkippableScreenJob
|
|||
cinematile = TexMan.CheckForTexture(bgTexture, TexMan.Type_Any);
|
||||
textov = new("TextOverlay");
|
||||
palette = Translation.MakeID(Translation_BasePalette, pal);
|
||||
textov.Init(text, palette);
|
||||
textov.Init(text, Font.CR_UNDEFINED, palette);
|
||||
cdtrack = cdtrk;
|
||||
return self;
|
||||
}
|
||||
|
@ -543,7 +494,7 @@ class Cinema : SkippableScreenJob
|
|||
{
|
||||
Screen.DrawTexture(cinematile, false, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_TranslationIndex, palette);
|
||||
textov.DisplayText();
|
||||
done = textov.AdvanceCinemaText((ticks + smoothratio) * (120. / GameTicRate));
|
||||
done = textov.ScrollText((ticks + smoothratio) * (120. / GameTicRate));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue