mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-25 21:31:44 +00:00
Support netreplays in titledemos
TDEMO###, where ### is a number from 1 to 255.
This commit is contained in:
parent
a6dff0a324
commit
c260e27cd9
5 changed files with 75 additions and 32 deletions
|
@ -151,8 +151,8 @@ extern FILE *logstream;
|
||||||
#else
|
#else
|
||||||
#define VERSION 100 // Game version
|
#define VERSION 100 // Game version
|
||||||
#define SUBVERSION 3 // more precise version number
|
#define SUBVERSION 3 // more precise version number
|
||||||
#define VERSIONSTRING "v1.0.3"
|
#define VERSIONSTRING "v1.0.3 Netreplays"
|
||||||
#define VERSIONSTRINGW L"v1.0.3"
|
#define VERSIONSTRINGW L"v1.0.3 Netreplays"
|
||||||
// Hey! If you change this, add 1 to the MODVERSION below!
|
// Hey! If you change this, add 1 to the MODVERSION below!
|
||||||
// Otherwise we can't force updates!
|
// Otherwise we can't force updates!
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1024,11 +1024,28 @@ void F_TitleScreenTicker(boolean run)
|
||||||
// is it time?
|
// is it time?
|
||||||
if (!(--demoIdleLeft))
|
if (!(--demoIdleLeft))
|
||||||
{
|
{
|
||||||
|
static boolean use_netreplay = false;
|
||||||
|
|
||||||
char dname[9];
|
char dname[9];
|
||||||
lumpnum_t l;
|
lumpnum_t l;
|
||||||
const char *mapname;
|
const char *mapname;
|
||||||
UINT8 numstaff;
|
UINT8 numstaff;
|
||||||
|
|
||||||
|
if ((use_netreplay = !use_netreplay))
|
||||||
|
{
|
||||||
|
numstaff = 1;
|
||||||
|
while ((l = W_CheckNumForName(va("TDEMO%03u", numstaff))) != LUMPERROR)
|
||||||
|
numstaff++;
|
||||||
|
numstaff--;
|
||||||
|
|
||||||
|
if (numstaff)
|
||||||
|
{
|
||||||
|
numstaff = M_RandomKey(numstaff)+1;
|
||||||
|
snprintf(dname, 9, "TDEMO%03u", numstaff);
|
||||||
|
goto loadreplay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// prevent console spam if failed
|
// prevent console spam if failed
|
||||||
demoIdleLeft = demoIdleTime;
|
demoIdleLeft = demoIdleTime;
|
||||||
|
|
||||||
|
@ -1079,6 +1096,7 @@ void F_TitleScreenTicker(boolean run)
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
loadreplay:
|
||||||
titledemo = fromtitledemo = true;
|
titledemo = fromtitledemo = true;
|
||||||
demo_ignorefiles = true;
|
demo_ignorefiles = true;
|
||||||
demo_loadfiles = false;
|
demo_loadfiles = false;
|
||||||
|
|
17
src/g_game.c
17
src/g_game.c
|
@ -6653,7 +6653,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
{
|
{
|
||||||
if (titledemo) // Titledemos should always play and ought to always be compatible with whatever wadlist is running.
|
if (titledemo) // Titledemos should always play and ought to always be compatible with whatever wadlist is running.
|
||||||
G_SkipDemoExtraFiles(&demo_p);
|
G_SkipDemoExtraFiles(&demo_p);
|
||||||
if (demo_loadfiles)
|
else if (demo_loadfiles)
|
||||||
G_LoadDemoExtraFiles(&demo_p);
|
G_LoadDemoExtraFiles(&demo_p);
|
||||||
else if (demo_ignorefiles)
|
else if (demo_ignorefiles)
|
||||||
G_SkipDemoExtraFiles(&demo_p);
|
G_SkipDemoExtraFiles(&demo_p);
|
||||||
|
@ -6839,6 +6839,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
|
|
||||||
if (multiplayer) {
|
if (multiplayer) {
|
||||||
boolean spectator;
|
boolean spectator;
|
||||||
|
UINT8 slots[MAXPLAYERS], numslots = 0;
|
||||||
|
|
||||||
// Load players that were in-game when the map started
|
// Load players that were in-game when the map started
|
||||||
p = READUINT8(demo_p);
|
p = READUINT8(demo_p);
|
||||||
|
@ -6850,6 +6851,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
spectator = true;
|
spectator = true;
|
||||||
p &= ~DEMO_SPECTATOR;
|
p &= ~DEMO_SPECTATOR;
|
||||||
}
|
}
|
||||||
|
slots[numslots] = p; numslots++;
|
||||||
|
|
||||||
if (!playeringame[displayplayer] || players[displayplayer].spectator)
|
if (!playeringame[displayplayer] || players[displayplayer].spectator)
|
||||||
displayplayer = consoleplayer = secondarydisplayplayer = thirddisplayplayer = fourthdisplayplayer = p;
|
displayplayer = consoleplayer = secondarydisplayplayer = thirddisplayplayer = fourthdisplayplayer = p;
|
||||||
|
@ -6895,6 +6897,17 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
}
|
}
|
||||||
|
|
||||||
splitscreen = 0;
|
splitscreen = 0;
|
||||||
|
|
||||||
|
if (titledemo)
|
||||||
|
{
|
||||||
|
splitscreen = min(min(3, numslots-1), max(0, M_RandomKey(6)-1)); // Bias toward 1p and 4p views
|
||||||
|
|
||||||
|
for (p = 0; p <= splitscreen; p++)
|
||||||
|
G_ResetView(p+1, slots[M_RandomKey(numslots)], false);
|
||||||
|
|
||||||
|
CONS_Printf("%d - %d %d %d %d\n", splitscreen, displayplayer, secondarydisplayplayer, thirddisplayplayer, fourthdisplayplayer);
|
||||||
|
}
|
||||||
|
|
||||||
R_ExecuteSetViewSize();
|
R_ExecuteSetViewSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7438,7 +7451,7 @@ boolean G_CheckDemoStatus(void)
|
||||||
if (singledemo)
|
if (singledemo)
|
||||||
I_Quit();
|
I_Quit();
|
||||||
|
|
||||||
if (multiplayer)
|
if (multiplayer && !titledemo)
|
||||||
G_ExitLevel();
|
G_ExitLevel();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
66
src/k_kart.c
66
src/k_kart.c
|
@ -8107,19 +8107,12 @@ static void K_drawInput(void)
|
||||||
if (timeinmap < 113)
|
if (timeinmap < 113)
|
||||||
{
|
{
|
||||||
INT32 count = ((INT32)(timeinmap) - 105);
|
INT32 count = ((INT32)(timeinmap) - 105);
|
||||||
offs = (titledemo ? 128 : 64);
|
offs = 64;
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
offs >>= 1;
|
offs >>= 1;
|
||||||
x += offs;
|
x += offs;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (titledemo)
|
|
||||||
{
|
|
||||||
V_DrawTinyScaledPatch(x-54, 128, splitflags, W_CachePatchName("TTKBANNR", PU_CACHE));
|
|
||||||
V_DrawTinyScaledPatch(x-54, 128+25, splitflags, W_CachePatchName("TTKART", PU_CACHE));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define BUTTW 8
|
#define BUTTW 8
|
||||||
#define BUTTH 11
|
#define BUTTH 11
|
||||||
|
|
||||||
|
@ -8413,7 +8406,7 @@ void K_drawKartHUD(void)
|
||||||
&& comeback
|
&& comeback
|
||||||
&& stplyr->playerstate == PST_LIVE)));
|
&& stplyr->playerstate == PST_LIVE)));
|
||||||
|
|
||||||
if (!battlefullscreen || splitscreen)
|
if (!titledemo && (!battlefullscreen || splitscreen))
|
||||||
{
|
{
|
||||||
// Draw the CHECK indicator before the other items, so it's overlapped by everything else
|
// Draw the CHECK indicator before the other items, so it's overlapped by everything else
|
||||||
if (cv_kartcheck.value && !splitscreen && !players[displayplayer].exiting)
|
if (cv_kartcheck.value && !splitscreen && !players[displayplayer].exiting)
|
||||||
|
@ -8428,7 +8421,7 @@ void K_drawKartHUD(void)
|
||||||
K_drawKartWanted();
|
K_drawKartWanted();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cv_kartminimap.value && !titledemo)
|
if (cv_kartminimap.value)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
if (LUA_HudEnabled(hud_minimap))
|
if (LUA_HudEnabled(hud_minimap))
|
||||||
|
@ -8469,26 +8462,45 @@ void K_drawKartHUD(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stplyr->spectator) // Bottom of the screen elements, don't need in spectate mode
|
if (!stplyr->spectator) // Bottom of the screen elements, don't need in spectate mode
|
||||||
{
|
{
|
||||||
if (G_RaceGametype()) // Race-only elements
|
if (titledemo) // Draw title logo instead in titledemos
|
||||||
{
|
{
|
||||||
if (!titledemo)
|
INT32 x = BASEVIDWIDTH - 32, y = 128, offs;
|
||||||
{
|
|
||||||
// Draw the lap counter
|
if (splitscreen == 3)
|
||||||
#ifdef HAVE_BLUA
|
{
|
||||||
if (LUA_HudEnabled(hud_gametypeinfo))
|
x = BASEVIDWIDTH/2 + 10;
|
||||||
#endif
|
y = BASEVIDHEIGHT/2 - 30;
|
||||||
K_drawKartLaps();
|
}
|
||||||
|
|
||||||
if (!splitscreen)
|
if (timeinmap < 113)
|
||||||
{
|
{
|
||||||
// Draw the speedometer
|
INT32 count = ((INT32)(timeinmap) - 104);
|
||||||
// TODO: Make a better speedometer.
|
offs = 256;
|
||||||
|
while (count-- > 0)
|
||||||
|
offs >>= 1;
|
||||||
|
x += offs;
|
||||||
|
}
|
||||||
|
|
||||||
|
V_DrawTinyScaledPatch(x-54, y, 0, W_CachePatchName("TTKBANNR", PU_CACHE));
|
||||||
|
V_DrawTinyScaledPatch(x-54, y+25, 0, W_CachePatchName("TTKART", PU_CACHE));
|
||||||
|
}
|
||||||
|
else if (G_RaceGametype()) // Race-only elements
|
||||||
|
{
|
||||||
|
// Draw the lap counter
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
if (LUA_HudEnabled(hud_speedometer))
|
if (LUA_HudEnabled(hud_gametypeinfo))
|
||||||
#endif
|
#endif
|
||||||
K_drawKartSpeedometer();
|
K_drawKartLaps();
|
||||||
}
|
|
||||||
|
if (!splitscreen)
|
||||||
|
{
|
||||||
|
// Draw the speedometer
|
||||||
|
// TODO: Make a better speedometer.
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
if (LUA_HudEnabled(hud_speedometer))
|
||||||
|
#endif
|
||||||
|
K_drawKartSpeedometer();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isfreeplay)
|
if (isfreeplay)
|
||||||
|
|
|
@ -1907,7 +1907,7 @@ static void ST_overlayDrawer(void)
|
||||||
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_ALLOWLOWERCASE, player_names[stplyr-players]);
|
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_ALLOWLOWERCASE, player_names[stplyr-players]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (!titledemo)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!splitscreen)
|
if (!splitscreen)
|
||||||
|
|
Loading…
Reference in a new issue