mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- removed debug output and fixed fade flag setup and missing OnTick return
This commit is contained in:
parent
26a7700579
commit
06abc0cfe2
3 changed files with 5 additions and 26 deletions
|
@ -333,7 +333,6 @@ static void GameTicker()
|
||||||
case GS_INTRO:
|
case GS_INTRO:
|
||||||
if (ScreenJobTick())
|
if (ScreenJobTick())
|
||||||
{
|
{
|
||||||
Printf("Sending event\n");
|
|
||||||
// synchronize termination with the playsim.
|
// synchronize termination with the playsim.
|
||||||
Net_WriteByte(DEM_ENDSCREENJOB);
|
Net_WriteByte(DEM_ENDSCREENJOB);
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,7 +232,6 @@ void DeleteScreenJob()
|
||||||
|
|
||||||
void EndScreenJob()
|
void EndScreenJob()
|
||||||
{
|
{
|
||||||
Printf("EndScreenJob\n");
|
|
||||||
DeleteScreenJob();
|
DeleteScreenJob();
|
||||||
if (completion) completion(false);
|
if (completion) completion(false);
|
||||||
completion = nullptr;
|
completion = nullptr;
|
||||||
|
@ -275,7 +274,8 @@ bool ScreenJobTick()
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
VMValue parm[] = { runner };
|
VMValue parm[] = { runner };
|
||||||
VMCall(func, parm, 1, nullptr, 0);
|
VMReturn ret(&result);
|
||||||
|
VMCall(func, parm, 1, &ret, 1);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,9 @@ class ScreenJob : Object
|
||||||
stopsound = 8,
|
stopsound = 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
void Init(int flags = 0, float fadet = 250.f)
|
void Init(int fflags = 0, float fadet = 250.f)
|
||||||
{
|
{
|
||||||
flags = fadet;
|
flags = fflags;
|
||||||
fadetime = fadet;
|
fadetime = fadet;
|
||||||
jobstate = running;
|
jobstate = running;
|
||||||
}
|
}
|
||||||
|
@ -76,10 +76,8 @@ class SkippableScreenJob : ScreenJob
|
||||||
|
|
||||||
override bool OnEvent(InputEvent evt)
|
override bool OnEvent(InputEvent evt)
|
||||||
{
|
{
|
||||||
Console.Printf("OnEvent");
|
|
||||||
if (evt.type == InputEvent.Type_KeyDown && !Raze.specialKeyEvent(evt))
|
if (evt.type == InputEvent.Type_KeyDown && !Raze.specialKeyEvent(evt))
|
||||||
{
|
{
|
||||||
Console.Printf("Skip requested");
|
|
||||||
jobstate = skipped;
|
jobstate = skipped;
|
||||||
OnSkip();
|
OnSkip();
|
||||||
}
|
}
|
||||||
|
@ -272,25 +270,19 @@ class MoviePlayerJob : SkippableScreenJob
|
||||||
|
|
||||||
override void Draw(double smoothratio)
|
override void Draw(double smoothratio)
|
||||||
{
|
{
|
||||||
Console.Printf("MoviePlayer.Draw state = %d", jobstate);
|
|
||||||
|
|
||||||
if (!player)
|
if (!player)
|
||||||
{
|
{
|
||||||
Console.Printf("MoviePlayer.Draw: end");
|
|
||||||
jobstate = stopped;
|
jobstate = stopped;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!started)
|
if (!started)
|
||||||
{
|
{
|
||||||
Console.Printf("MoviePlayer.Draw: start");
|
|
||||||
started = true;
|
started = true;
|
||||||
player.Start();
|
player.Start();
|
||||||
}
|
}
|
||||||
double clock = (ticks + smoothratio) * 1000000000. / GameTicRate;
|
double clock = (ticks + smoothratio) * 1000000000. / GameTicRate;
|
||||||
Console.Printf("MoviePlayer.Frame %d %f", ticks, clock);
|
|
||||||
if (jobstate == running && !player.Frame(clock))
|
if (jobstate == running && !player.Frame(clock))
|
||||||
{
|
{
|
||||||
Console.Printf("MoviePlayer.finish");
|
|
||||||
jobstate = finished;
|
jobstate = finished;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -358,7 +350,6 @@ class ScreenJobRunner : Object
|
||||||
|
|
||||||
void Append(ScreenJob job)
|
void Append(ScreenJob job)
|
||||||
{
|
{
|
||||||
Console.Printf("Appending job of type " .. job.GetClassName() );
|
|
||||||
jobs.Push(job);
|
jobs.Push(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +363,6 @@ class ScreenJobRunner : Object
|
||||||
{
|
{
|
||||||
if (index == jobs.Size()-1)
|
if (index == jobs.Size()-1)
|
||||||
{
|
{
|
||||||
Console.Printf("AdvanceJob: reached end of list");
|
|
||||||
index++;
|
index++;
|
||||||
return; // we need to retain the last element until the runner is done.
|
return; // we need to retain the last element until the runner is done.
|
||||||
}
|
}
|
||||||
|
@ -387,7 +377,6 @@ class ScreenJobRunner : Object
|
||||||
actionState = clearbefore ? State_Clear : State_Run;
|
actionState = clearbefore ? State_Clear : State_Run;
|
||||||
if (index < jobs.Size())
|
if (index < jobs.Size())
|
||||||
{
|
{
|
||||||
Console.Printf("AdvanceJob: starting job at index %d, type %s", index, jobs[index].GetClassName());
|
|
||||||
jobs[index].fadestate = !paused && jobs[index].flags & ScreenJob.fadein? ScreenJob.fadein : ScreenJob.visible;
|
jobs[index].fadestate = !paused && jobs[index].flags & ScreenJob.fadein? ScreenJob.fadein : ScreenJob.visible;
|
||||||
jobs[index].Start();
|
jobs[index].Start();
|
||||||
}
|
}
|
||||||
|
@ -415,7 +404,6 @@ class ScreenJobRunner : Object
|
||||||
double ms = (job.ticks + smoothratio) * 1000 / GameTicRate / job.fadetime;
|
double ms = (job.ticks + smoothratio) * 1000 / GameTicRate / job.fadetime;
|
||||||
double screenfade = clamp(ms, 0., 1.);
|
double screenfade = clamp(ms, 0., 1.);
|
||||||
Screen.SetScreenFade(screenfade);
|
Screen.SetScreenFade(screenfade);
|
||||||
Console.Printf("DisplayFrame: fading in %s with %f", job.GetClassName(), screenfade);
|
|
||||||
if (screenfade == 1.) job.fadestate = ScreenJob.visible;
|
if (screenfade == 1.) job.fadestate = ScreenJob.visible;
|
||||||
}
|
}
|
||||||
int state = job.DrawFrame(smoothratio);
|
int state = job.DrawFrame(smoothratio);
|
||||||
|
@ -438,7 +426,6 @@ class ScreenJobRunner : Object
|
||||||
Screen.SetScreenFade(screenfade);
|
Screen.SetScreenFade(screenfade);
|
||||||
job.DrawFrame(1.);
|
job.DrawFrame(1.);
|
||||||
Screen.SetScreenFade(1.);
|
Screen.SetScreenFade(1.);
|
||||||
Console.Printf("FadeoutFrame: fading out %s with %f", job.GetClassName(), screenfade);
|
|
||||||
return (screenfade > 0.);
|
return (screenfade > 0.);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,7 +439,6 @@ class ScreenJobRunner : Object
|
||||||
{
|
{
|
||||||
if (paused || index >= jobs.Size()) return false;
|
if (paused || index >= jobs.Size()) return false;
|
||||||
if (jobs[index].jobstate != ScreenJob.running) return false;
|
if (jobs[index].jobstate != ScreenJob.running) return false;
|
||||||
if (ev.type == InputEvent.Type_KeyDown) Console.Printf("OnEvent: dispatching key %d to job %s", ev.keyScan, jobs[index].GetClassName());
|
|
||||||
return jobs[index].OnEvent(ev);
|
return jobs[index].OnEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,19 +458,16 @@ class ScreenJobRunner : Object
|
||||||
AdvanceJob(terminateState < 0);
|
AdvanceJob(terminateState < 0);
|
||||||
if (index >= jobs.Size())
|
if (index >= jobs.Size())
|
||||||
{
|
{
|
||||||
Console.Printf("OnTick: done");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (jobs[index].jobstate == ScreenJob.running)
|
if (jobs[index].jobstate == ScreenJob.running)
|
||||||
{
|
{
|
||||||
jobs[index].ticks++;
|
jobs[index].ticks++;
|
||||||
Console.Printf("OnTick: job %s, ticks = %d", jobs[index].GetClassName(), jobs[index].ticks);
|
|
||||||
jobs[index].OnTick();
|
jobs[index].OnTick();
|
||||||
}
|
}
|
||||||
else if (jobs[index].jobstate == ScreenJob.stopping)
|
else if (jobs[index].jobstate == ScreenJob.stopping)
|
||||||
{
|
{
|
||||||
Console.Printf("OnTick: fadeticks for %s", jobs[index].GetClassName());
|
|
||||||
fadeticks++;
|
fadeticks++;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -497,7 +480,7 @@ class ScreenJobRunner : Object
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
virtual bool RunFrame(double smoothratio)
|
virtual bool RunFrame(double smoothratio)
|
||||||
{
|
{
|
||||||
// ensure that we won't go back in time if the menu is dismissed without advancing our ticker
|
// ensure that we won't go back in time if the menu is dismissed without advancing our ticker
|
||||||
if (index < jobs.Size())
|
if (index < jobs.Size())
|
||||||
{
|
{
|
||||||
|
@ -518,8 +501,6 @@ class ScreenJobRunner : Object
|
||||||
terminateState = DisplayFrame(smoothratio);
|
terminateState = DisplayFrame(smoothratio);
|
||||||
if (terminateState < 1 && index < jobs.Size())
|
if (terminateState < 1 && index < jobs.Size())
|
||||||
{
|
{
|
||||||
Console.Printf("RunFrame: job %s, state %d", jobs[index].GetClassName(), terminateState);
|
|
||||||
|
|
||||||
if (jobs[index].flags & ScreenJob.fadeout)
|
if (jobs[index].flags & ScreenJob.fadeout)
|
||||||
{
|
{
|
||||||
jobs[index].fadestate = ScreenJob.fadeout;
|
jobs[index].fadestate = ScreenJob.fadeout;
|
||||||
|
@ -529,7 +510,6 @@ class ScreenJobRunner : Object
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.Printf("RunState: advancing");
|
|
||||||
advance = true;
|
advance = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue