mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- make SummaryInfo a struct instead of passing a list of values to the script classes.
This commit is contained in:
parent
e05f900315
commit
021f1b7832
7 changed files with 62 additions and 35 deletions
|
@ -8706,7 +8706,7 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx)
|
|||
bool writable;
|
||||
ArgList[i] = ArgList[i]->Resolve(ctx); // must be resolved before the address is requested.
|
||||
|
||||
if (ArgList[i]->ValueType->isRealPointer())
|
||||
if (ArgList[i] && ArgList[i]->ValueType->isRealPointer())
|
||||
{
|
||||
auto pointedType = ArgList[i]->ValueType->toPointer()->PointedType;
|
||||
if (pointedType && pointedType->isDynArray())
|
||||
|
|
|
@ -1501,3 +1501,12 @@ DEFINE_FIELD_X(MapRecord, MapRecord, nextLevel)
|
|||
DEFINE_FIELD_X(MapRecord, MapRecord, nextSecret)
|
||||
//native readonly String messages[MAX_MESSAGES];
|
||||
DEFINE_FIELD_X(MapRecord, MapRecord, author)
|
||||
|
||||
DEFINE_FIELD_X(SummaryInfo, SummaryInfo, kills)
|
||||
DEFINE_FIELD_X(SummaryInfo, SummaryInfo, maxkills)
|
||||
DEFINE_FIELD_X(SummaryInfo, SummaryInfo, secrets)
|
||||
DEFINE_FIELD_X(SummaryInfo, SummaryInfo, maxsecrets)
|
||||
DEFINE_FIELD_X(SummaryInfo, SummaryInfo, supersecrets)
|
||||
DEFINE_FIELD_X(SummaryInfo, SummaryInfo, time)
|
||||
DEFINE_FIELD_X(SummaryInfo, SummaryInfo, cheated)
|
||||
DEFINE_FIELD_X(SummaryInfo, SummaryInfo, endofgame)
|
||||
|
|
|
@ -137,6 +137,18 @@ struct MapRecord
|
|||
|
||||
};
|
||||
|
||||
struct SummaryInfo
|
||||
{
|
||||
int kills;
|
||||
int maxkills;
|
||||
int secrets;
|
||||
int maxsecrets;
|
||||
int supersecrets;
|
||||
int time;
|
||||
bool cheated;
|
||||
bool endofgame;
|
||||
};
|
||||
|
||||
extern GlobalCutscenes globalCutscenes;
|
||||
extern VolumeRecord volumeList[MAXVOLUMES];
|
||||
extern MapRecord *currentLevel;
|
||||
|
|
|
@ -26,7 +26,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class DukeCutscenes
|
||||
struct DukeCutscenes
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -171,7 +171,7 @@ class DukeCutscenes
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void BuildE4Intro(ScreenJobRunner runner, MapRecord map)
|
||||
static void BuildE4Intro(ScreenJobRunner runner)
|
||||
{
|
||||
Array<int> soundinfo;
|
||||
|
||||
|
@ -214,10 +214,10 @@ class DukeCutscenes
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void BuildSPSummary(ScreenJobRunner runner, MapRecord map, int kills_, int maxkills_, int secrets_, int maxsecrets_, int supersecrets_, int time_, bool cheated)
|
||||
static void BuildSPSummary(ScreenJobRunner runner, MapRecord map, SummaryInfo stats)
|
||||
{
|
||||
let screen = SummaryScreenBase(new("DukeLevelSummaryScreen").Init());
|
||||
if (screen) screen.SetParameters(map, kills_, maxkills_, secrets_, maxsecrets_, supersecrets_, time_, cheated);
|
||||
if (screen) screen.SetParameters(map, stats);
|
||||
runner.Append(screen);
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ class DukeCutscenes
|
|||
|
||||
}
|
||||
|
||||
class RRCutscenes
|
||||
struct RRCutscenes
|
||||
{
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -275,6 +275,7 @@ class RRCutscenes
|
|||
{
|
||||
if (!Raze.isRRRA())
|
||||
{
|
||||
Array<int> soundinfo;
|
||||
soundinfo.Pushv(1, RRSnd.URANUS + 1);
|
||||
runner.Append(MoviePlayerJob.CreateWithSoundinfo("rr_intro.anm", soundinfo, 0, 9, 9, 9));
|
||||
|
||||
|
@ -286,7 +287,7 @@ class RRCutscenes
|
|||
}
|
||||
else
|
||||
{
|
||||
runner.Append(MoviePlayerJob.Create("redint.mve"), 0);
|
||||
runner.Append(MoviePlayerJob.Create("redint.mve", 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -300,6 +301,7 @@ class RRCutscenes
|
|||
|
||||
static void BuildE1End(ScreenJobRunner runner)
|
||||
{
|
||||
Array<int> soundinfo;
|
||||
soundinfo.Pushv(1, RRSnd.CHKAMMO + 1);
|
||||
runner.Append(MoviePlayerJob.CreateWithSoundinfo("turdmov.anm", soundinfo, 0, 9, 9, 9));
|
||||
}
|
||||
|
@ -313,6 +315,7 @@ class RRCutscenes
|
|||
|
||||
static void BuildE2End(ScreenJobRunner runner)
|
||||
{
|
||||
Array<int> soundinfo;
|
||||
soundinfo.Pushv(1, RRSnd.LN_FINAL + 1);
|
||||
runner.Append(MoviePlayerJob.CreateWithSoundinfo("rr_outro.anm", soundinfo, 0, 9, 9, 9));
|
||||
runner.Append(ImageScreen.CreateNamed("TENSCREEN"));
|
||||
|
@ -335,11 +338,12 @@ class RRCutscenes
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void BuildSPSummary(ScreenJobRunner runner, MapRecord map, int kills_, int maxkills_, int secrets_, int maxsecrets_, int supersecrets_, int time_, bool cheated)
|
||||
static void BuildSPSummary(ScreenJobRunner runner, MapRecord map, SummaryInfo stats)
|
||||
{
|
||||
let screen = SummaryScreenBase(new("RRLevelSummaryScreen").Init(!isRRRA() || map.flags & MapRecord.FORCEEOG));
|
||||
if (screen) screen.SetParameters(map, kills_, maxkills_, secrets_, maxsecrets_, supersecrets_, time_, cheated);
|
||||
runner.Append(screen);
|
||||
let sumscreen = new("RRLevelSummaryScreen").Init(!Raze.isRRRA() || stats.endOfGame);
|
||||
let sumscreens = SummaryScreenBase(sumscreen);
|
||||
if (sumscreens) sumscreens.SetParameters(map, stats);
|
||||
runner.Append(sumscreen);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -683,7 +683,7 @@ class DukeLevelSummaryScreen : SummaryScreenBase
|
|||
|
||||
if (displaystate & printTimeVal)
|
||||
{
|
||||
tempbuf = FormatTime(playtime);
|
||||
tempbuf = FormatTime(stats.time);
|
||||
Duke.GameText((320 >> 2) + 71, 59 + 9, tempbuf, 0);
|
||||
|
||||
tempbuf = FormatTime(level.parTime);
|
||||
|
@ -705,16 +705,16 @@ class DukeLevelSummaryScreen : SummaryScreenBase
|
|||
|
||||
if (displaystate & printKillsVal)
|
||||
{
|
||||
tempbuf = String.Format("%-3d", kills);
|
||||
tempbuf = String.Format("%-3d", stats.kills);
|
||||
Duke.GameText((320 >> 2) + 70, 94 + 9, tempbuf, 0);
|
||||
|
||||
if (maxkills < 0)
|
||||
if (stats.maxkills < 0)
|
||||
{
|
||||
tempbuf = "$TXT_N_A";
|
||||
}
|
||||
else
|
||||
{
|
||||
tempbuf = String.Format("%-3d", max(0, maxkills - kills));
|
||||
tempbuf = String.Format("%-3d", max(0, stats.maxkills - stats.kills));
|
||||
}
|
||||
Duke.GameText((320 >> 2) + 70, 104 + 9, tempbuf, 0);
|
||||
}
|
||||
|
@ -728,9 +728,9 @@ class DukeLevelSummaryScreen : SummaryScreenBase
|
|||
|
||||
if (displaystate & printSecretsVal)
|
||||
{
|
||||
tempbuf = String.Format("%-3d", secrets);
|
||||
tempbuf = String.Format("%-3d", stats.secrets);
|
||||
Duke.GameText((320 >> 2) + 70, 119 + 9, tempbuf, 0);
|
||||
tempbuf = String.Format("%-3d", max(0, maxsecrets - secrets));
|
||||
tempbuf = String.Format("%-3d", max(0, stats.maxsecrets - stats.secrets));
|
||||
Duke.GameText((320 >> 2) + 70, 129 + 9, tempbuf, 0);
|
||||
}
|
||||
}
|
||||
|
@ -918,7 +918,7 @@ class RRLevelSummaryScreen : SummaryScreenBase
|
|||
|
||||
if (displaystate & printTimeVal)
|
||||
{
|
||||
tempbuf = FormatTime(playtime);
|
||||
tempbuf = FormatTime(stats.time);
|
||||
Duke.BigText(191, 48, tempbuf, -1);
|
||||
|
||||
tempbuf = FormatTime(level.parTime);
|
||||
|
@ -937,15 +937,15 @@ class RRLevelSummaryScreen : SummaryScreenBase
|
|||
|
||||
if (displaystate & printKillsVal)
|
||||
{
|
||||
tempbuf.Format("%-3d", kills);
|
||||
tempbuf.Format("%-3d", stats.kills);
|
||||
Duke.BigText(231, 112, tempbuf, -1);
|
||||
if (maxkills < 0)
|
||||
if (stats.maxkills < 0)
|
||||
{
|
||||
tempbuf = "$TXT_N_A";
|
||||
}
|
||||
else
|
||||
{
|
||||
tempbuf = String.Format("%-3d", max(0, maxkills - kills));
|
||||
tempbuf = String.Format("%-3d", max(0, stats.maxkills - stats.kills));
|
||||
}
|
||||
Duke.BigText(231, 128, tempbuf, -1);
|
||||
}
|
||||
|
@ -959,9 +959,9 @@ class RRLevelSummaryScreen : SummaryScreenBase
|
|||
|
||||
if (displaystate & printSecretsVal)
|
||||
{
|
||||
tempbuf = String.Format("%-3d", secrets);
|
||||
tempbuf = String.Format("%-3d", stats.secrets);
|
||||
Duke.BigText(231, 144, tempbuf, -1);
|
||||
tempbuf = String.Format("%-3d", max(0, maxsecrets - secrets));
|
||||
tempbuf = String.Format("%-3d", max(0, stats.maxsecrets - stats.secrets));
|
||||
Duke.BigText(231, 160, tempbuf, -1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,6 +87,17 @@ struct MapRecord native
|
|||
}
|
||||
}
|
||||
|
||||
struct SummaryInfo native
|
||||
{
|
||||
native readonly int kills;
|
||||
native readonly int maxkills;
|
||||
native readonly int secrets;
|
||||
native readonly int maxsecrets;
|
||||
native readonly int supersecrets;
|
||||
native readonly int time;
|
||||
native readonly bool cheated;
|
||||
native readonly bool endofgame;
|
||||
}
|
||||
|
||||
struct Raze
|
||||
{
|
||||
|
|
|
@ -198,21 +198,12 @@ class ImageScreen : SkippableScreenJob
|
|||
class SummaryScreenBase : ScreenJob
|
||||
{
|
||||
MapRecord level;
|
||||
int kills, maxkills;
|
||||
int secrets, maxsecrets, supersecrets;
|
||||
int playtime;
|
||||
bool cheatflag;
|
||||
SummaryInfo stats;
|
||||
|
||||
void SetParameters(MapRecord map, int kills_, int maxkills_, int secrets_, int maxsecrets_, int supersecrets_, int time_, bool cheated)
|
||||
void SetParameters(MapRecord map, SummaryInfo thestats)
|
||||
{
|
||||
level = map;
|
||||
kills = kills_;
|
||||
maxkills = maxkills_;
|
||||
secrets = secrets_;
|
||||
maxsecrets = maxsecrets_;
|
||||
supersecrets = supersecrets_;
|
||||
playtime = time_;
|
||||
cheatflag = cheated;
|
||||
stats = thestats;
|
||||
}
|
||||
|
||||
String FormatTime(int time)
|
||||
|
|
Loading…
Reference in a new issue