mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- the remaining Exhumed screens.
These are not tested yet, a bit more work is needed to allow this.
This commit is contained in:
parent
a43259c40c
commit
e580407d7d
2 changed files with 94 additions and 73 deletions
|
@ -57,7 +57,6 @@ public:
|
||||||
|
|
||||||
virtual bool OnEvent(event_t* evt) { return false; }
|
virtual bool OnEvent(event_t* evt) { return false; }
|
||||||
virtual void OnTick() { /*state = finished;*/ }
|
virtual void OnTick() { /*state = finished;*/ }
|
||||||
virtual int Frame(uint64_t clock, bool skiprequest) { return 1; }
|
|
||||||
virtual void Draw(double smoothratio) {}
|
virtual void Draw(double smoothratio) {}
|
||||||
|
|
||||||
int Frame(uint64_t clock, bool skiprequest, double smoothratio)
|
int Frame(uint64_t clock, bool skiprequest, double smoothratio)
|
||||||
|
@ -66,7 +65,7 @@ public:
|
||||||
Draw(smoothratio);
|
Draw(smoothratio);
|
||||||
if (state == skipped) return -1;
|
if (state == skipped) return -1;
|
||||||
if (state == finished) return 0;
|
if (state == finished) return 0;
|
||||||
return Frame(clock, skiprequest);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetFadeState() const { return fadestate; }
|
int GetFadeState() const { return fadestate; }
|
||||||
|
|
|
@ -963,16 +963,17 @@ void uploadCinemaPalettes()
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
class DCinema : public DScreenJob
|
class DCinema : public DSkippableScreenJob
|
||||||
{
|
{
|
||||||
TextOverlay text;
|
TextOverlay text;
|
||||||
short cinematile;
|
short cinematile;
|
||||||
int currentCinemaPalette;
|
int currentCinemaPalette;
|
||||||
int edx;
|
int edx;
|
||||||
int check;
|
int check;
|
||||||
|
int cont = 1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DCinema(int nVal, int checklevel = -1) : DScreenJob(fadein|fadeout)
|
DCinema(int nVal, int checklevel = -1) : DSkippableScreenJob(fadein|fadeout)
|
||||||
{
|
{
|
||||||
if (nVal < 0 || nVal >5) return;
|
if (nVal < 0 || nVal >5) return;
|
||||||
cinematile = cinemas[nVal].tile;
|
cinematile = cinemas[nVal].tile;
|
||||||
|
@ -984,12 +985,17 @@ public:
|
||||||
check = checklevel;
|
check = checklevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Frame(uint64_t clock, bool skiprequest) override
|
void OnTick() override
|
||||||
{
|
{
|
||||||
|
if (ticks == 1)
|
||||||
if (clock == 0)
|
|
||||||
{
|
{
|
||||||
if (check > 0 && check != selectedlevelnew) return 0; // immediately abort if the player selected a different level on the map
|
if (check > 0 && check != selectedlevelnew)
|
||||||
|
{
|
||||||
|
state = finished;
|
||||||
|
return; // immediately abort if the player selected a different level on the map
|
||||||
|
}
|
||||||
|
|
||||||
|
check = -1;
|
||||||
StopAllSounds();
|
StopAllSounds();
|
||||||
if (edx != -1)
|
if (edx != -1)
|
||||||
{
|
{
|
||||||
|
@ -997,19 +1003,26 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!cont)
|
||||||
|
{
|
||||||
|
state = finished;
|
||||||
|
// quit the game if we've finished level 4 and displayed the advert text
|
||||||
|
if (isShareware() && currentCinemaPalette == 3)
|
||||||
|
{
|
||||||
|
gameaction = ga_mainmenu;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Draw(double smoothratio) override
|
||||||
|
{
|
||||||
twod->ClearScreen();
|
twod->ClearScreen();
|
||||||
|
if (check < 0) return;
|
||||||
DrawTexture(twod, tileGetTexture(cinematile), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_TranslationIndex, TRANSLATION(Translation_BasePalettes, currentCinemaPalette), TAG_DONE);
|
DrawTexture(twod, tileGetTexture(cinematile), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_TranslationIndex, TRANSLATION(Translation_BasePalettes, currentCinemaPalette), TAG_DONE);
|
||||||
|
|
||||||
text.DisplayText();
|
text.DisplayText();
|
||||||
auto cont = text.AdvanceCinemaText(clock * (120. / 1'000'000'000));
|
cont = text.AdvanceCinemaText((ticks + smoothratio) * (120. / GameTicRate));
|
||||||
int ret = skiprequest ? -1 : cont ? 1 : 0;
|
|
||||||
|
|
||||||
// quit the game if we've finished level 4 and displayed the advert text
|
|
||||||
if (isShareware() && currentCinemaPalette == 3 && ret != 1)
|
|
||||||
{
|
|
||||||
gameaction = ga_mainmenu;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1029,6 +1042,7 @@ class DLastLevelCinema : public DScreenJob
|
||||||
int nextclock = 4;
|
int nextclock = 4;
|
||||||
unsigned int nStringTypeOn, nCharTypeOn;
|
unsigned int nStringTypeOn, nCharTypeOn;
|
||||||
int screencnt = 0;
|
int screencnt = 0;
|
||||||
|
bool skiprequest = false;
|
||||||
|
|
||||||
TArray<FString> screentext;
|
TArray<FString> screentext;
|
||||||
|
|
||||||
|
@ -1142,91 +1156,81 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Frame(uint64_t clock, bool skiprequest) override
|
bool OnEvent(event_t* ev)
|
||||||
{
|
{
|
||||||
if (clock == 0)
|
if (ev->type == EV_KeyDown) skiprequest = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnTick() override
|
||||||
|
{
|
||||||
|
if (ticks == 1)
|
||||||
{
|
{
|
||||||
PlayLocalSound(StaticSound[kSound75], 0, false, CHANF_UI);
|
PlayLocalSound(StaticSound[kSound75], 0, false, CHANF_UI);
|
||||||
phase = 1;
|
phase = 1;
|
||||||
}
|
}
|
||||||
int currentclock = clock * 120 / 1'000'000'000;
|
|
||||||
twod->ClearScreen();
|
|
||||||
DrawTexture(twod, tileGetTexture(kTileLoboLaptop), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
|
|
||||||
switch (phase)
|
switch (phase)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
if (currentclock >= nextclock)
|
Phase1();
|
||||||
{
|
if (skiprequest || ticks >= 60)
|
||||||
Phase1();
|
|
||||||
nextclock += 4;
|
|
||||||
}
|
|
||||||
if (skiprequest || currentclock >= 240)
|
|
||||||
{
|
{
|
||||||
InitPhase2();
|
InitPhase2();
|
||||||
phase = 2;
|
phase = 2;
|
||||||
skiprequest = 0;
|
skiprequest = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if (currentclock >= nextclock)
|
if (screentext[nStringTypeOn][nCharTypeOn] != ' ')
|
||||||
|
PlayLocalSound(StaticSound[kSound71], 0, false, CHANF_UI);
|
||||||
|
|
||||||
|
nCharTypeOn++;
|
||||||
|
if (screentext[nStringTypeOn][nCharTypeOn] == 0)
|
||||||
{
|
{
|
||||||
if (screentext[nStringTypeOn][nCharTypeOn] != ' ')
|
nCharTypeOn = 0;
|
||||||
PlayLocalSound(StaticSound[kSound71], 0, false, CHANF_UI);
|
nStringTypeOn++;
|
||||||
|
if (nStringTypeOn >= screentext.Size())
|
||||||
nCharTypeOn++;
|
|
||||||
nextclock += 4;
|
|
||||||
if (screentext[nStringTypeOn][nCharTypeOn] == 0)
|
|
||||||
{
|
{
|
||||||
nCharTypeOn = 0;
|
nextclock = (GameTicRate * (screentext.Size() + 2)) + ticks;
|
||||||
nStringTypeOn++;
|
phase = 3;
|
||||||
if (nStringTypeOn >= screentext.Size())
|
|
||||||
{
|
|
||||||
nextclock = (kTimerTicks * (screentext.Size() + 2)) + currentclock;
|
|
||||||
phase = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
DisplayPhase2();
|
|
||||||
if (skiprequest)
|
if (skiprequest)
|
||||||
{
|
{
|
||||||
nextclock = (kTimerTicks * (screentext.Size() + 2)) + currentclock;
|
nextclock = (GameTicRate * (screentext.Size() + 2)) + ticks;
|
||||||
phase = 4;
|
phase = 4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
DisplayPhase2();
|
if (ticks >= nextclock || skiprequest)
|
||||||
if (currentclock >= nextclock || skiprequest)
|
|
||||||
{
|
{
|
||||||
PlayLocalSound(StaticSound[kSound75], 0, false, CHANF_UI);
|
PlayLocalSound(StaticSound[kSound75], 0, false, CHANF_UI);
|
||||||
phase = 4;
|
phase = 4;
|
||||||
nextclock = currentclock + 240;
|
nextclock = ticks + 60;
|
||||||
skiprequest = 0;
|
skiprequest = false;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
if (currentclock >= nextclock)
|
if (ticks >= nextclock)
|
||||||
{
|
{
|
||||||
skiprequest |= !Phase3();
|
skiprequest |= !Phase3();
|
||||||
nextclock += 4;
|
|
||||||
}
|
}
|
||||||
if (skiprequest || currentclock >= 240)
|
if (skiprequest)
|
||||||
{
|
{
|
||||||
// Go to the next text page.
|
state = finished;
|
||||||
if (screencnt != 2)
|
|
||||||
{
|
|
||||||
screencnt++;
|
|
||||||
nextclock = currentclock + 240;
|
|
||||||
skiprequest = 0;
|
|
||||||
phase = 1;
|
|
||||||
}
|
|
||||||
else return skiprequest ? -1 : 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
}
|
||||||
|
|
||||||
|
void Draw(double) override
|
||||||
|
{
|
||||||
|
twod->ClearScreen();
|
||||||
|
DrawTexture(twod, tileGetTexture(kTileLoboLaptop), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
|
||||||
|
if (phase == 2 || phase == 3) DisplayPhase2();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1243,6 +1247,7 @@ class DExCredits : public DScreenJob
|
||||||
TArray<FString> pagelines;
|
TArray<FString> pagelines;
|
||||||
uint64_t page;
|
uint64_t page;
|
||||||
uint64_t pagetime;
|
uint64_t pagetime;
|
||||||
|
bool skiprequest = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DExCredits()
|
DExCredits()
|
||||||
|
@ -1253,35 +1258,53 @@ public:
|
||||||
credits = text.Split("\n\n");
|
credits = text.Split("\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
bool OnEvent(event_t* ev)
|
||||||
int Frame(uint64_t clock, bool skiprequest) override
|
|
||||||
{
|
{
|
||||||
if (clock == 0)
|
if (ev->type == EV_KeyDown) skiprequest = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnTick() override
|
||||||
|
{
|
||||||
|
if (ticks == 1)
|
||||||
{
|
{
|
||||||
if (credits.Size() == 0) return 0;
|
if (credits.Size() == 0)
|
||||||
|
{
|
||||||
|
state = finished;
|
||||||
|
return;
|
||||||
|
}
|
||||||
playCDtrack(19, false);
|
playCDtrack(19, false);
|
||||||
pagetime = 0;
|
pagetime = 0;
|
||||||
page = -1;
|
page = -1;
|
||||||
}
|
}
|
||||||
if (clock >= pagetime || skiprequest)
|
|
||||||
|
if (ticks >= pagetime || skiprequest)
|
||||||
{
|
{
|
||||||
page++;
|
page++;
|
||||||
if (page < credits.Size())
|
if (page < credits.Size())
|
||||||
pagelines = credits[page].Split("\n");
|
pagelines = credits[page].Split("\n");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (skiprequest || !CDplaying()) return 0;
|
if (skiprequest || !CDplaying())
|
||||||
|
{
|
||||||
|
state = finished;
|
||||||
|
return;
|
||||||
|
}
|
||||||
pagelines.Clear();
|
pagelines.Clear();
|
||||||
}
|
}
|
||||||
pagetime = clock + 2'000'000'000; //
|
pagetime = ticks + 60; //
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Draw(double smoothratio) override
|
||||||
|
{
|
||||||
twod->ClearScreen();
|
twod->ClearScreen();
|
||||||
|
|
||||||
int y = 100 - ((10 * (pagelines.Size() - 1)) / 2);
|
int y = 100 - ((10 * (pagelines.Size() - 1)) / 2);
|
||||||
|
|
||||||
for (unsigned i = 0; i < pagelines.Size(); i++)
|
for (unsigned i = 0; i < pagelines.Size(); i++)
|
||||||
{
|
{
|
||||||
uint64_t ptime = (pagetime-clock) / 1'000'000;
|
int ptime = clamp((pagetime - ticks - smoothratio) * 1000 / GameTicRate, 0, 2000); // in milliseconds
|
||||||
int light;
|
int light;
|
||||||
|
|
||||||
if (ptime < 255) light = ptime;
|
if (ptime < 255) light = ptime;
|
||||||
|
@ -1294,7 +1317,6 @@ private:
|
||||||
DrawText(twod, SmallFont, CR_UNTRANSLATED, 160 - nStringWidth / 2, y, pagelines[i], DTA_FullscreenScale, FSMode_Fit320x200, DTA_Color, color, TAG_DONE);
|
DrawText(twod, SmallFont, CR_UNTRANSLATED, 160 - nStringWidth / 2, y, pagelines[i], DTA_FullscreenScale, FSMode_Fit320x200, DTA_Color, color, TAG_DONE);
|
||||||
y += 10;
|
y += 10;
|
||||||
}
|
}
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue