mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Attract: play demo for 30 seconds, starts at random timestamp
- Starting timestamp is not truly "random"
- Uses a lookup table because I didn't like the PRNG
distribution
This commit is contained in:
parent
7a5020470d
commit
244d5e1063
2 changed files with 48 additions and 6 deletions
|
|
@ -65,6 +65,9 @@ static tic_t stoptimer;
|
||||||
|
|
||||||
static boolean keypressed = false;
|
static boolean keypressed = false;
|
||||||
|
|
||||||
|
static tic_t attractcountdown; // Countdown until attract demo ends
|
||||||
|
static boolean attractcredit; // Show music credit once attract demo begins
|
||||||
|
|
||||||
static INT32 menuanimtimer; // Title screen: background animation timing
|
static INT32 menuanimtimer; // Title screen: background animation timing
|
||||||
altview_t titlemapcam = {0};
|
altview_t titlemapcam = {0};
|
||||||
|
|
||||||
|
|
@ -1747,7 +1750,7 @@ void F_TitleScreenTicker(boolean run)
|
||||||
UINT16 mapnum;
|
UINT16 mapnum;
|
||||||
UINT8 numstaff;
|
UINT8 numstaff;
|
||||||
static boolean use_netreplay = false;
|
static boolean use_netreplay = false;
|
||||||
staffbrief_t *brief;
|
staffbrief_t *brief = NULL;
|
||||||
|
|
||||||
if ((use_netreplay = !use_netreplay))
|
if ((use_netreplay = !use_netreplay))
|
||||||
{
|
{
|
||||||
|
|
@ -1785,6 +1788,38 @@ loadreplay:
|
||||||
demo.attract = DEMO_ATTRACT_TITLE;
|
demo.attract = DEMO_ATTRACT_TITLE;
|
||||||
demo.ignorefiles = true;
|
demo.ignorefiles = true;
|
||||||
demo.loadfiles = false;
|
demo.loadfiles = false;
|
||||||
|
|
||||||
|
attractcountdown = INFTICS;
|
||||||
|
|
||||||
|
if (brief)
|
||||||
|
{
|
||||||
|
// "Random" table of times to skip forward in the demo.
|
||||||
|
// I didn't want to use real random functions because I didn't like the distribution.
|
||||||
|
tic_t table[] = {
|
||||||
|
0,
|
||||||
|
15*TICRATE,
|
||||||
|
brief->lap / 2, // references to brief->lap will skip to the end of Prison replays
|
||||||
|
0,
|
||||||
|
40*TICRATE,
|
||||||
|
brief->lap,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
brief->time,
|
||||||
|
};
|
||||||
|
UINT8 numintable = sizeof table / sizeof *table;
|
||||||
|
|
||||||
|
static UINT8 index = UINT8_MAX;
|
||||||
|
if (index == UINT8_MAX)
|
||||||
|
index = M_RandomKey(numintable);
|
||||||
|
else
|
||||||
|
index = (index + 1) % numintable;
|
||||||
|
|
||||||
|
attractcountdown = min(30*TICRATE, brief->time);
|
||||||
|
g_fast_forward = min(table[index], brief->time - attractcountdown);
|
||||||
|
// Show title screen music credit at beginning of demo
|
||||||
|
attractcredit = true;
|
||||||
|
}
|
||||||
|
|
||||||
G_DoPlayDemoEx(dname, dlump);
|
G_DoPlayDemoEx(dname, dlump);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1792,6 +1827,18 @@ loadreplay:
|
||||||
void F_AttractDemoTicker(void)
|
void F_AttractDemoTicker(void)
|
||||||
{
|
{
|
||||||
keypressed = false;
|
keypressed = false;
|
||||||
|
|
||||||
|
if (attractcountdown > 0 && !g_fast_forward)
|
||||||
|
{
|
||||||
|
if (attractcredit)
|
||||||
|
{
|
||||||
|
S_ShowMusicCredit();
|
||||||
|
attractcredit = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attractcountdown > 0 && !--attractcountdown)
|
||||||
|
G_CheckDemoStatus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================
|
// ================
|
||||||
|
|
|
||||||
|
|
@ -8858,11 +8858,6 @@ void P_PostLoadLevel(void)
|
||||||
G_BeginRecording(); // I AM NOW READY TO RECORD.
|
G_BeginRecording(); // I AM NOW READY TO RECORD.
|
||||||
demo.deferstart = true;
|
demo.deferstart = true;
|
||||||
|
|
||||||
if (demo.attract == DEMO_ATTRACT_TITLE)
|
|
||||||
{
|
|
||||||
S_ShowMusicCredit();
|
|
||||||
}
|
|
||||||
|
|
||||||
nextmapoverride = 0;
|
nextmapoverride = 0;
|
||||||
skipstats = 0;
|
skipstats = 0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue