mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- MP summary screen ported.
This commit is contained in:
parent
7fbe153ae7
commit
4636a52699
5 changed files with 213 additions and 0 deletions
|
@ -1459,6 +1459,13 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Raze, MusicEnabled, MusicEnabled)
|
|||
ACTION_RETURN_INT(MusicEnabled());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Raze, PlayerName)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(index);
|
||||
ACTION_RETURN_STRING(unsigned(index) >= MAXPLAYERS ? "" : PlayerName(index));
|
||||
}
|
||||
|
||||
extern bool demoplayback;
|
||||
DEFINE_GLOBAL(multiplayer)
|
||||
DEFINE_GLOBAL(netgame)
|
||||
|
@ -1466,3 +1473,18 @@ DEFINE_GLOBAL(gameaction)
|
|||
DEFINE_GLOBAL(gamestate)
|
||||
DEFINE_GLOBAL(demoplayback)
|
||||
DEFINE_GLOBAL(consoleplayer)
|
||||
DEFINE_GLOBAL(currentLevel)
|
||||
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, parTime)
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, designerTime)
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, fileName)
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, labelName)
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, name)
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, music)
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, cdSongId)
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, flags)
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, levelNumber)
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, nextLevel)
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, nextSecret)
|
||||
//native readonly String messages[MAX_MESSAGES];
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, author)
|
||||
|
|
|
@ -25,6 +25,12 @@ struct Duke native
|
|||
native static int PlaySound(int num, int channel = CHAN_AUTO, int flags = 0, float vol =0.8f);
|
||||
native static bool CheckSoundPlaying(int num);
|
||||
|
||||
static void PlayBonusMusic()
|
||||
{
|
||||
if (Raze.MusicEnabled())
|
||||
PlaySound(DukeSnd.BONUSMUSIC, CHAN_AUTO, CHANF_UI);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// wrappers around DrawText to allow easier reuse of the old code.
|
||||
|
|
|
@ -411,3 +411,105 @@ class Episode5End : ImageScreen
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class DukeMultiplayerBonusScreen : SkippableScreenJob
|
||||
{
|
||||
int playerswhenstarted;
|
||||
|
||||
void Init(int pos)
|
||||
{
|
||||
Super.Init(fadein|fadeout);
|
||||
playerswhenstarted = pos;
|
||||
}
|
||||
|
||||
override void Start()
|
||||
{
|
||||
Duke.PlayBonusMusic();
|
||||
}
|
||||
|
||||
override void Draw(double smoothratio)
|
||||
{
|
||||
String tempbuf;
|
||||
int currentclock = int((ticks + smoothratio) * 120 / GameTicRate);
|
||||
Screen.ClearScreen();
|
||||
Screen.DrawTexture(TexMan.CheckForTexture("MENUSCREEN"), false, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_Color, 0xff808080, DTA_LegacyRenderStyle, STYLE_Normal);
|
||||
Screen.DrawTexture(TexMan.CheckForTexture("INGAMEDUKETHREEDEE"), true, 160, 34, DTA_FullscreenScale, FSMode_Fit320x200, DTA_CenterOffsetRel, true);
|
||||
if (Raze.isPlutoPak()) Screen.DrawTexture(TexMan.CheckForTexture("MENUPLUTOPAKSPRITE"), true, 260, 36, DTA_FullscreenScale, FSMode_Fit320x200, DTA_CenterOffsetRel, true);
|
||||
|
||||
Duke.GameText(160, 58 + 2, "$Multiplayer Totals", 0, 0);
|
||||
Duke.GameText(160, 58 + 10, currentLevel.DisplayName(), 0, 0);
|
||||
Duke.GameText(160, 165, "$Presskey", 8 - int(sin(currentclock / 10.) * 8), 0);
|
||||
|
||||
int t = 0;
|
||||
|
||||
Duke.MiniText(38, 80, "$Name", 0, -1, 8);
|
||||
Duke.MiniText(269+20, 80, "$Kills", 0, 1, 8);
|
||||
|
||||
for (int i = 0; i < playerswhenstarted; i++)
|
||||
{
|
||||
tempbuf.Format("%-4d", i + 1);
|
||||
Duke.MiniText(92 + (i * 23), 80, tempbuf, 0, -1, 3);
|
||||
}
|
||||
|
||||
for (int i = 0; i < playerswhenstarted; i++)
|
||||
{
|
||||
int xfragtotal = 0;
|
||||
tempbuf.Format("%d", i + 1);
|
||||
|
||||
Duke.MiniText(30, 90 + t, tempbuf, 0);
|
||||
Duke.MiniText(38, 90 + t, Raze.PlayerName(i), 0, -1, Raze.playerPalette(i));
|
||||
|
||||
for (int y = 0; y < playerswhenstarted; y++)
|
||||
{
|
||||
int frag = Raze.playerFrags(i, y);
|
||||
if (i == y)
|
||||
{
|
||||
int fraggedself = Raze.playerFraggedSelf(y);
|
||||
tempbuf.Format("%-4d", fraggedself);
|
||||
Duke.MiniText(92 + (y * 23), 90 + t, tempbuf, 0, -1, 2);
|
||||
xfragtotal -= fraggedself;
|
||||
}
|
||||
else
|
||||
{
|
||||
tempbuf.Format("%-4d", frag);
|
||||
Duke.MiniText(92 + (y * 23), 90 + t, tempbuf, 0);
|
||||
xfragtotal += frag;
|
||||
}
|
||||
/*
|
||||
if (myconnectindex == connecthead)
|
||||
{
|
||||
tempbuf.Format("stats %ld killed %ld %ld\n", i + 1, y + 1, frag);
|
||||
sendscore(tempbuf);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
tempbuf.Format("%-4d", xfragtotal);
|
||||
Duke.MiniText(101 + (8 * 23), 90 + t, tempbuf, 0, -1, 2);
|
||||
|
||||
t += 7;
|
||||
}
|
||||
|
||||
for (int y = 0; y < playerswhenstarted; y++)
|
||||
{
|
||||
int yfragtotal = 0;
|
||||
for (int i = 0; i < playerswhenstarted; i++)
|
||||
{
|
||||
if (i == y)
|
||||
yfragtotal += Raze.playerFraggedself(i);
|
||||
int frag = Raze.playerFrags(i, y);
|
||||
yfragtotal += frag;
|
||||
}
|
||||
tempbuf.Format("%-4d", yfragtotal);
|
||||
Duke.MiniText(92 + (y * 23), 96 + (8 * 7), tempbuf, 0, -1, 2);
|
||||
}
|
||||
|
||||
Duke.MiniText(45, 96 + (8 * 7), "$Deaths", 0, -1, 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,46 @@ struct UserConfigStruct native
|
|||
extend struct _
|
||||
{
|
||||
native @UserConfigStruct userConfig;
|
||||
native MapRecord currentLevel;
|
||||
}
|
||||
|
||||
struct MapRecord native
|
||||
{
|
||||
enum MIFlags
|
||||
{
|
||||
FORCEEOG = 1,
|
||||
USERMAP = 2,
|
||||
}
|
||||
|
||||
native readonly int parTime;
|
||||
native readonly int designerTime;
|
||||
native readonly String fileName;
|
||||
native readonly String labelName;
|
||||
native readonly String name;
|
||||
native readonly String music;
|
||||
native readonly int cdSongId;
|
||||
native readonly int flags;
|
||||
native readonly int levelNumber;
|
||||
|
||||
// The rest is only used by Blood
|
||||
native readonly int nextLevel;
|
||||
native readonly int nextSecret;
|
||||
//native readonly String messages[MAX_MESSAGES];
|
||||
native readonly String author;
|
||||
|
||||
String GetLabelName()
|
||||
{
|
||||
if (flags & USERMAP) return "$TXT_USERMAP";
|
||||
return labelName;
|
||||
}
|
||||
String DisplayName()
|
||||
{
|
||||
if (name == "") return labelName;
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct Raze
|
||||
{
|
||||
static int calcSinTableValue(int ang)
|
||||
|
@ -50,6 +88,7 @@ struct Raze
|
|||
native static void StopAllSounds();
|
||||
native static bool SoundEnabled();
|
||||
native static bool MusicEnabled();
|
||||
native static String PlayerName(int i);
|
||||
|
||||
// game check shortcuts
|
||||
static bool isNam()
|
||||
|
@ -97,6 +136,22 @@ struct Raze
|
|||
return gameinfo.gametype & GAMEFLAG_BLOOD;
|
||||
}
|
||||
|
||||
// Dont know yet how to best export this, so for now these are just placeholders as MP is not operational anyway.
|
||||
static int playerPalette(int i)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int playerFrags(int i, int j)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int playerFraggedSelf(int i)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -85,3 +85,31 @@ class ImageScreen : SkippableScreenJob native
|
|||
//override void OnTick();
|
||||
//override void Draw(double smooth);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// 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;
|
||||
int kills, maxkills;
|
||||
int secrets, maxsecrets, supersecrets;
|
||||
int time;
|
||||
bool cheatflag;
|
||||
|
||||
void SetParameters(MapRecord map, int kills_, int maxkills_, int secrets_, int maxsecrets_, int supersecrets_, int time_, bool cheated)
|
||||
{
|
||||
level = map;
|
||||
kills = kills_;
|
||||
maxkills = maxkills_;
|
||||
secrets = secrets_;
|
||||
maxsecrets = maxsecrets_;
|
||||
supersecrets = supersecrets_;
|
||||
time = time_;
|
||||
cheatflag = cheated;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue