mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- moved the cutscene core to 'engine'.
More adjustments for making this code compatible with GZDoom.
This commit is contained in:
parent
e10bcf6294
commit
0d793a59fd
12 changed files with 109 additions and 90 deletions
|
@ -50,6 +50,8 @@
|
||||||
#include "i_interface.h"
|
#include "i_interface.h"
|
||||||
#include "base_sbar.h"
|
#include "base_sbar.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
|
#include "s_soundinternal.h"
|
||||||
|
#include "i_time.h"
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
@ -989,6 +991,44 @@ DEFINE_ACTION_FUNCTION(_Console, Printf)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void StopAllSounds()
|
||||||
|
{
|
||||||
|
soundEngine->StopAllChannels();
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_System, StopAllSounds, StopAllSounds)
|
||||||
|
{
|
||||||
|
StopAllSounds();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Mus_Stop()
|
||||||
|
{
|
||||||
|
S_StopMusic(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_System, StopMusic, Mus_Stop)
|
||||||
|
{
|
||||||
|
Mus_Stop();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_System, SoundEnabled, SoundEnabled)
|
||||||
|
{
|
||||||
|
ACTION_RETURN_INT(SoundEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_System, MusicEnabled, MusicEnabled)
|
||||||
|
{
|
||||||
|
ACTION_RETURN_INT(MusicEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_System, GetTimeFrac, I_GetTimeFrac)
|
||||||
|
{
|
||||||
|
ACTION_RETURN_FLOAT(I_GetTimeFrac());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DEFINE_GLOBAL_NAMED(mus_playing, musplaying);
|
DEFINE_GLOBAL_NAMED(mus_playing, musplaying);
|
||||||
DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, name);
|
DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, name);
|
||||||
DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, baseorder);
|
DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, baseorder);
|
||||||
|
|
|
@ -1480,33 +1480,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Raze, ShadeToLight, shadeToLight)
|
||||||
ACTION_RETURN_INT(shadeToLight(shade));
|
ACTION_RETURN_INT(shadeToLight(shade));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(_Raze, StopAllSounds, FX_StopAllSounds)
|
|
||||||
{
|
|
||||||
FX_StopAllSounds();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(_Raze, StopMusic, Mus_Stop)
|
|
||||||
{
|
|
||||||
Mus_Stop();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(_Raze, SoundEnabled, SoundEnabled)
|
|
||||||
{
|
|
||||||
ACTION_RETURN_INT(SoundEnabled());
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(_Raze, MusicEnabled, MusicEnabled)
|
|
||||||
{
|
|
||||||
ACTION_RETURN_INT(MusicEnabled());
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(_Raze, GetTimeFrac, I_GetTimeFrac)
|
|
||||||
{
|
|
||||||
ACTION_RETURN_FLOAT(I_GetTimeFrac());
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(_Raze, PlayerName)
|
DEFINE_ACTION_FUNCTION(_Raze, PlayerName)
|
||||||
{
|
{
|
||||||
PARAM_PROLOGUE;
|
PARAM_PROLOGUE;
|
||||||
|
|
|
@ -3,6 +3,7 @@ version "4.3"
|
||||||
#include "zscript/engine/dynarrays.zs"
|
#include "zscript/engine/dynarrays.zs"
|
||||||
#include "zscript/engine/inputevents.zs"
|
#include "zscript/engine/inputevents.zs"
|
||||||
#include "zscript/engine/dictionary.zs"
|
#include "zscript/engine/dictionary.zs"
|
||||||
|
#include "zscript/engine/screenjob.zs"
|
||||||
|
|
||||||
#include "zscript/engine/ui/menu/colorpickermenu.zs"
|
#include "zscript/engine/ui/menu/colorpickermenu.zs"
|
||||||
#include "zscript/engine/ui/menu/joystickmenu.zs"
|
#include "zscript/engine/ui/menu/joystickmenu.zs"
|
||||||
|
@ -28,7 +29,7 @@ version "4.3"
|
||||||
|
|
||||||
#include "zscript/constants.zs"
|
#include "zscript/constants.zs"
|
||||||
#include "zscript/razebase.zs"
|
#include "zscript/razebase.zs"
|
||||||
#include "zscript/screenjob.zs"
|
#include "zscript/summary.zs"
|
||||||
#include "zscript/statusbar.zs"
|
#include "zscript/statusbar.zs"
|
||||||
#include "zscript/games/duke/dukegame.zs"
|
#include "zscript/games/duke/dukegame.zs"
|
||||||
#include "zscript/games/duke/ui/sbar.zs"
|
#include "zscript/games/duke/ui/sbar.zs"
|
||||||
|
|
|
@ -180,6 +180,27 @@ struct _ native // These are the global variables, the struct is only here to av
|
||||||
native MenuDelegateBase menuDelegate;
|
native MenuDelegateBase menuDelegate;
|
||||||
native readonly int consoleplayer;
|
native readonly int consoleplayer;
|
||||||
native readonly double NotifyFontScale;
|
native readonly double NotifyFontScale;
|
||||||
|
native readonly int paused;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct System native
|
||||||
|
{
|
||||||
|
native static void StopMusic();
|
||||||
|
native static void StopAllSounds();
|
||||||
|
native static bool SoundEnabled();
|
||||||
|
native static bool MusicEnabled();
|
||||||
|
native static double GetTimeFrac();
|
||||||
|
|
||||||
|
static bool specialKeyEvent(InputEvent ev)
|
||||||
|
{
|
||||||
|
if (ev.type == InputEvent.Type_KeyDown || ev.type == InputEvent.Type_KeyUp)
|
||||||
|
{
|
||||||
|
int key = ev.KeyScan;
|
||||||
|
if (key == InputEvent.KEY_VOLUMEDOWN || key == InputEvent.KEY_VOLUMEUP || (key > InputEvent.KEY_LASTJOYBUTTON && key < InputEvent.KEY_PAD_LTHUMB_RIGHT)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MusPlayingInfo native
|
struct MusPlayingInfo native
|
||||||
|
|
|
@ -57,8 +57,8 @@ class ScreenJob : Object
|
||||||
int GetFadeState() { return fadestate; }
|
int GetFadeState() { return fadestate; }
|
||||||
override void OnDestroy()
|
override void OnDestroy()
|
||||||
{
|
{
|
||||||
if (flags & stopmusic) Raze.StopMusic();
|
if (flags & stopmusic) System.StopMusic();
|
||||||
if (flags & stopsound) Raze.StopAllSounds();
|
if (flags & stopsound) System.StopAllSounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ class SkippableScreenJob : ScreenJob
|
||||||
|
|
||||||
override bool OnEvent(InputEvent evt)
|
override bool OnEvent(InputEvent evt)
|
||||||
{
|
{
|
||||||
if (evt.type == InputEvent.Type_KeyDown && !Raze.specialKeyEvent(evt))
|
if (evt.type == InputEvent.Type_KeyDown && !System.specialKeyEvent(evt))
|
||||||
{
|
{
|
||||||
jobstate = skipped;
|
jobstate = skipped;
|
||||||
OnSkip();
|
OnSkip();
|
||||||
|
@ -186,34 +186,6 @@ class ImageScreen : SkippableScreenJob
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// this is to have a unified interface to the summary screens
|
|
||||||
// that can be set up automatically by the games to avoid direct access to game data.
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class SummaryScreenBase : ScreenJob
|
|
||||||
{
|
|
||||||
MapRecord level;
|
|
||||||
SummaryInfo stats;
|
|
||||||
|
|
||||||
void SetParameters(MapRecord map, SummaryInfo thestats)
|
|
||||||
{
|
|
||||||
level = map;
|
|
||||||
stats = thestats;
|
|
||||||
}
|
|
||||||
|
|
||||||
String FormatTime(int time)
|
|
||||||
{
|
|
||||||
if (time >= 60 * 50)
|
|
||||||
return String.Format("%02d:%02d:%02d", time / (60*60), (time / 60) % 60, time % 60);
|
|
||||||
else
|
|
||||||
return String.Format("%02d:%02d", (time / 60) % 60, time % 60);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// internal polymorphic movie player object
|
// internal polymorphic movie player object
|
|
@ -147,7 +147,7 @@ class BloodSummaryScreen : SummaryScreenBase
|
||||||
|
|
||||||
override bool OnEvent(InputEvent ev)
|
override bool OnEvent(InputEvent ev)
|
||||||
{
|
{
|
||||||
if (ev.type == InputEvent.Type_KeyDown && !Raze.specialKeyEvent(ev))
|
if (ev.type == InputEvent.Type_KeyDown && !System.specialKeyEvent(ev))
|
||||||
{
|
{
|
||||||
jobstate = skipped;
|
jobstate = skipped;
|
||||||
return true;
|
return true;
|
||||||
|
@ -202,7 +202,7 @@ class BloodSummaryScreen : SummaryScreenBase
|
||||||
|
|
||||||
override void OnDestroy()
|
override void OnDestroy()
|
||||||
{
|
{
|
||||||
Raze.StopAllSounds();
|
System.StopAllSounds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ struct Duke native
|
||||||
|
|
||||||
static void PlayBonusMusic()
|
static void PlayBonusMusic()
|
||||||
{
|
{
|
||||||
if (Raze.MusicEnabled())
|
if (System.MusicEnabled())
|
||||||
PlaySound(DukeSnd.BONUSMUSIC, CHAN_AUTO, CHANF_UI);
|
PlaySound(DukeSnd.BONUSMUSIC, CHAN_AUTO, CHANF_UI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ class Episode3End : ImageScreen
|
||||||
|
|
||||||
override void OnSkip()
|
override void OnSkip()
|
||||||
{
|
{
|
||||||
Raze.StopAllSounds();
|
System.StopAllSounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
override void OnTick()
|
override void OnTick()
|
||||||
|
@ -367,7 +367,7 @@ class Episode3End : ImageScreen
|
||||||
if (!Duke.CheckSoundPlaying(DukeSnd.ENDSEQVOL3SND9))
|
if (!Duke.CheckSoundPlaying(DukeSnd.ENDSEQVOL3SND9))
|
||||||
{
|
{
|
||||||
soundstate++;
|
soundstate++;
|
||||||
finishtime = ticks + GameTicRate * (Raze.SoundEnabled() ? 1 : 5); // if sound is off this wouldn't wait without a longer delay here.
|
finishtime = ticks + GameTicRate * (System.SoundEnabled() ? 1 : 5); // if sound is off this wouldn't wait without a longer delay here.
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ class Episode3End : ImageScreen
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (jobstate != running) Raze.StopAllSounds();
|
if (jobstate != running) System.StopAllSounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
override void OnDestroy()
|
override void OnDestroy()
|
||||||
|
@ -600,7 +600,7 @@ class DukeLevelSummaryScreen : SummaryScreenBase
|
||||||
|
|
||||||
override bool OnEvent(InputEvent ev)
|
override bool OnEvent(InputEvent ev)
|
||||||
{
|
{
|
||||||
if (ev.type == InputEvent.Type_KeyDown && !Raze.specialKeyEvent(ev))
|
if (ev.type == InputEvent.Type_KeyDown && !System.specialKeyEvent(ev))
|
||||||
{
|
{
|
||||||
if ((displaystate & printStatsAll) != printStatsAll)
|
if ((displaystate & printStatsAll) != printStatsAll)
|
||||||
{
|
{
|
||||||
|
@ -837,7 +837,7 @@ class RRLevelSummaryScreen : SummaryScreenBase
|
||||||
|
|
||||||
override bool OnEvent(InputEvent ev)
|
override bool OnEvent(InputEvent ev)
|
||||||
{
|
{
|
||||||
if (ev.type == InputEvent.Type_KeyDown && !Raze.specialKeyEvent(ev))
|
if (ev.type == InputEvent.Type_KeyDown && !System.specialKeyEvent(ev))
|
||||||
{
|
{
|
||||||
if ((displaystate & printStatsAll) != printStatsAll)
|
if ((displaystate & printStatsAll) != printStatsAll)
|
||||||
{
|
{
|
||||||
|
|
|
@ -345,7 +345,7 @@ class MapScreen : ScreenJob
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Raze.specialKeyEvent(ev)) jobstate = skipped;
|
if (!System.specialKeyEvent(ev)) jobstate = skipped;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -527,7 +527,7 @@ class Cinema : SkippableScreenJob
|
||||||
|
|
||||||
override void Start()
|
override void Start()
|
||||||
{
|
{
|
||||||
Raze.StopAllSounds();
|
System.StopAllSounds();
|
||||||
if (cdtrack != -1)
|
if (cdtrack != -1)
|
||||||
{
|
{
|
||||||
Exhumed.playCDtrack(cdtrack, false);
|
Exhumed.playCDtrack(cdtrack, false);
|
||||||
|
@ -652,7 +652,7 @@ class LastLevelCinema : ScreenJob
|
||||||
|
|
||||||
override bool OnEvent(InputEvent ev)
|
override bool OnEvent(InputEvent ev)
|
||||||
{
|
{
|
||||||
if (ev.type == InputEvent.Type_KeyDown && !Raze.specialKeyEvent(ev)) skiprequest = true;
|
if (ev.type == InputEvent.Type_KeyDown && !System.specialKeyEvent(ev)) skiprequest = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,7 +775,7 @@ class ExCredits : ScreenJob
|
||||||
|
|
||||||
override bool OnEvent(InputEvent ev)
|
override bool OnEvent(InputEvent ev)
|
||||||
{
|
{
|
||||||
if (ev.type == InputEvent.Type_KeyDown && !Raze.specialKeyEvent(ev)) skiprequest = true;
|
if (ev.type == InputEvent.Type_KeyDown && !System.specialKeyEvent(ev)) skiprequest = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -919,7 +919,7 @@ class ExhumedCutscenes
|
||||||
|
|
||||||
static void BuildGameOverScene(ScreenJobRunner runner, MapRecord map)
|
static void BuildGameOverScene(ScreenJobRunner runner, MapRecord map)
|
||||||
{
|
{
|
||||||
Raze.StopMusic();
|
System.StopMusic();
|
||||||
Exhumed.PlayLocalSound(ExhumedSnd.kSoundJonLaugh2, 0, false, CHANF_UI);
|
Exhumed.PlayLocalSound(ExhumedSnd.kSoundJonLaugh2, 0, false, CHANF_UI);
|
||||||
runner.Append(ImageScreen.CreateNamed("Gameover", ScreenJob.fadein | ScreenJob.fadeout, 0x7fffffff, Translation.MakeID(Translation_BasePalette, 16)));
|
runner.Append(ImageScreen.CreateNamed("Gameover", ScreenJob.fadein | ScreenJob.fadeout, 0x7fffffff, Translation.MakeID(Translation_BasePalette, 16)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ class SWSummaryScreen : SummaryScreenBase
|
||||||
|
|
||||||
override bool OnEvent(InputEvent ev)
|
override bool OnEvent(InputEvent ev)
|
||||||
{
|
{
|
||||||
if (ev.type == InputEvent.Type_KeyDown && !Raze.specialKeyEvent(ev))
|
if (ev.type == InputEvent.Type_KeyDown && !System.specialKeyEvent(ev))
|
||||||
{
|
{
|
||||||
if (animstate == 0) animstate = 1;
|
if (animstate == 0) animstate = 1;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ class SWSummaryScreen : SummaryScreenBase
|
||||||
|
|
||||||
override void Start()
|
override void Start()
|
||||||
{
|
{
|
||||||
Raze.StopAllSounds();
|
System.StopAllSounds();
|
||||||
SW.PlaySong(1);
|
SW.PlaySong(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,6 @@ extend struct _
|
||||||
{
|
{
|
||||||
native @UserConfigStruct userConfig;
|
native @UserConfigStruct userConfig;
|
||||||
native readonly MapRecord currentLevel;
|
native readonly MapRecord currentLevel;
|
||||||
native readonly int paused;
|
|
||||||
native readonly int automapMode;
|
native readonly int automapMode;
|
||||||
native readonly int PlayClock;
|
native readonly int PlayClock;
|
||||||
}
|
}
|
||||||
|
@ -143,27 +142,12 @@ struct Raze
|
||||||
}
|
}
|
||||||
|
|
||||||
native static Color shadeToLight(int shade);
|
native static Color shadeToLight(int shade);
|
||||||
native static void StopAllSounds();
|
|
||||||
native static bool SoundEnabled();
|
|
||||||
native static void StopMusic();
|
|
||||||
native static bool MusicEnabled();
|
|
||||||
native static String PlayerName(int i);
|
native static String PlayerName(int i);
|
||||||
native static double GetTimeFrac();
|
|
||||||
native static int bsin(int angle, int shift = 0);
|
native static int bsin(int angle, int shift = 0);
|
||||||
native static int bcos(int angle, int shift = 0);
|
native static int bcos(int angle, int shift = 0);
|
||||||
native static TextureID PickTexture(TextureID texid);
|
native static TextureID PickTexture(TextureID texid);
|
||||||
native static int GetBuildTime();
|
native static int GetBuildTime();
|
||||||
|
|
||||||
static bool specialKeyEvent(InputEvent ev)
|
|
||||||
{
|
|
||||||
if (ev.type == InputEvent.Type_KeyDown || ev.type == InputEvent.Type_KeyUp)
|
|
||||||
{
|
|
||||||
int key = ev.KeyScan;
|
|
||||||
if (key == InputEvent.KEY_VOLUMEDOWN || key == InputEvent.KEY_VOLUMEUP || (key > InputEvent.KEY_LASTJOYBUTTON && key < InputEvent.KEY_PAD_LTHUMB_RIGHT)) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// game check shortcuts
|
// game check shortcuts
|
||||||
static bool isNam()
|
static bool isNam()
|
||||||
{
|
{
|
||||||
|
|
28
wadsrc/static/zscript/summary.zs
Normal file
28
wadsrc/static/zscript/summary.zs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// this is to have a unified interface to the summary screens
|
||||||
|
// that can be set up automatically by the games to avoid direct access to game data.
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class SummaryScreenBase : ScreenJob
|
||||||
|
{
|
||||||
|
MapRecord level;
|
||||||
|
SummaryInfo stats;
|
||||||
|
|
||||||
|
void SetParameters(MapRecord map, SummaryInfo thestats)
|
||||||
|
{
|
||||||
|
level = map;
|
||||||
|
stats = thestats;
|
||||||
|
}
|
||||||
|
|
||||||
|
String FormatTime(int time)
|
||||||
|
{
|
||||||
|
if (time >= 60 * 50)
|
||||||
|
return String.Format("%02d:%02d:%02d", time / (60*60), (time / 60) % 60, time % 60);
|
||||||
|
else
|
||||||
|
return String.Format("%02d:%02d", (time / 60) % 60, time % 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue