mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-03-02 17:31:07 +00:00
Remove Replay Hut code
This commit is contained in:
parent
3ccfb71f04
commit
3bc7b48b7e
7 changed files with 3 additions and 727 deletions
|
|
@ -47,7 +47,6 @@ struct demovars_s {
|
|||
boolean rewinding; // Rewind in progress
|
||||
|
||||
boolean loadfiles, ignorefiles; // Demo file loading options
|
||||
boolean inreplayhut; // Go back to replayhut after demos
|
||||
boolean quitafterplaying; // quit after playing a demo from cmdline
|
||||
boolean deferstart; // don't start playing demo right away
|
||||
boolean netgame; // multiplayer netgame
|
||||
|
|
|
|||
14
src/k_menu.h
14
src/k_menu.h
|
|
@ -405,11 +405,6 @@ extern menu_t OPTIONS_DataProfileEraseDef;
|
|||
extern menuitem_t EXTRAS_Main[];
|
||||
extern menu_t EXTRAS_MainDef;
|
||||
|
||||
extern menuitem_t EXTRAS_ReplayHut[];
|
||||
extern menu_t EXTRAS_ReplayHutDef;
|
||||
|
||||
extern menuitem_t EXTRAS_ReplayStart[];
|
||||
extern menu_t EXTRAS_ReplayStartDef;
|
||||
|
||||
extern menuitem_t EXTRAS_EggTV[];
|
||||
extern menu_t EXTRAS_EggTVDef;
|
||||
|
|
@ -1036,11 +1031,6 @@ void M_ExtrasTick(void);
|
|||
boolean M_ExtrasInputs(INT32 ch);
|
||||
boolean M_ExtrasQuit(void); // resets buttons when you quit
|
||||
|
||||
// Extras: Replay Hut
|
||||
void M_HandleReplayHutList(INT32 choice);
|
||||
boolean M_QuitReplayHut(void);
|
||||
void M_HutStartReplay(INT32 choice);
|
||||
void M_PrepReplayList(void);
|
||||
|
||||
// Extras: Egg TV
|
||||
void M_EggTV(INT32 choice);
|
||||
|
|
@ -1090,8 +1080,6 @@ void M_PlaybackAdjustView(INT32 choice);
|
|||
void M_PlaybackToggleFreecam(INT32 choice);
|
||||
void M_PlaybackQuit(INT32 choice);
|
||||
|
||||
void M_ReplayHut(INT32 choice);
|
||||
|
||||
// Misc menus:
|
||||
#define numaddonsshown 4
|
||||
void M_Addons(INT32 choice);
|
||||
|
|
@ -1156,8 +1144,6 @@ extern tic_t shitsfree;
|
|||
// Extras menu:
|
||||
void M_DrawExtrasMovingButton(void);
|
||||
void M_DrawExtras(void);
|
||||
void M_DrawReplayHut(void);
|
||||
void M_DrawReplayStartMenu(void);
|
||||
|
||||
// Misc menus:
|
||||
#define LOCATIONSTRING1 "Visit \x83SRB2.ORG/MODS\x80 to get & make addons!"
|
||||
|
|
|
|||
402
src/k_menudraw.c
402
src/k_menudraw.c
|
|
@ -4160,408 +4160,6 @@ void M_DrawPlaybackMenu(void)
|
|||
}
|
||||
|
||||
|
||||
// replay hut...
|
||||
// ...dear lord this is messy, but Ima be real I ain't fixing this.
|
||||
|
||||
#define SCALEDVIEWWIDTH (vid.width/vid.dupx)
|
||||
#define SCALEDVIEWHEIGHT (vid.height/vid.dupy)
|
||||
static void M_DrawReplayHutReplayInfo(menudemo_t *demoref)
|
||||
{
|
||||
patch_t *patch = NULL;
|
||||
UINT8 *colormap;
|
||||
INT32 x, y;
|
||||
|
||||
switch (demoref->type)
|
||||
{
|
||||
case MD_NOTLOADED:
|
||||
V_DrawCenteredString(160, 40, 0, "Loading replay information...");
|
||||
break;
|
||||
|
||||
case MD_INVALID:
|
||||
V_DrawCenteredString(160, 40, warningflags, "This replay cannot be played.");
|
||||
break;
|
||||
|
||||
case MD_SUBDIR:
|
||||
break; // Can't think of anything to draw here right now
|
||||
|
||||
case MD_OUTDATED:
|
||||
V_DrawThinString(17, 64, V_ALLOWLOWERCASE|V_TRANSLUCENT|highlightflags, "Recorded on an outdated version.");
|
||||
/* FALLTHRU */
|
||||
default:
|
||||
// Draw level stuff
|
||||
x = 15; y = 15;
|
||||
|
||||
K_DrawMapThumbnail(
|
||||
x<<FRACBITS, y<<FRACBITS,
|
||||
80<<FRACBITS,
|
||||
((demoref->kartspeed & DF_ENCORE) ? V_FLIP : 0),
|
||||
demoref->map,
|
||||
NULL);
|
||||
|
||||
if (demoref->kartspeed & DF_ENCORE)
|
||||
{
|
||||
static angle_t rubyfloattime = 0;
|
||||
const fixed_t rubyheight = FINESINE(rubyfloattime>>ANGLETOFINESHIFT);
|
||||
V_DrawFixedPatch((x+40)<<FRACBITS, ((y+25)<<FRACBITS) - (rubyheight<<1), FRACUNIT, 0, W_CachePatchName("RUBYICON", PU_CACHE), NULL);
|
||||
rubyfloattime += FixedMul(ANGLE_MAX/NEWTICRATE, renderdeltatics);
|
||||
}
|
||||
|
||||
x += 85;
|
||||
|
||||
if (demoref->map < nummapheaders && mapheaderinfo[demoref->map])
|
||||
{
|
||||
char *title = G_BuildMapTitle(demoref->map+1);
|
||||
V_DrawString(x, y, 0, title);
|
||||
Z_Free(title);
|
||||
}
|
||||
else
|
||||
V_DrawString(x, y, V_ALLOWLOWERCASE|V_TRANSLUCENT, "Level is not loaded.");
|
||||
|
||||
if (demoref->numlaps)
|
||||
V_DrawThinString(x, y+9, V_ALLOWLOWERCASE, va("(%d laps)", demoref->numlaps));
|
||||
|
||||
{
|
||||
const char *gtstring;
|
||||
if (demoref->gametype < 0)
|
||||
{
|
||||
gtstring = "Custom (not loaded)";
|
||||
}
|
||||
else
|
||||
{
|
||||
gtstring = gametypes[demoref->gametype]->name;
|
||||
|
||||
if ((gametypes[demoref->gametype]->rules & GTR_CIRCUIT))
|
||||
gtstring = va("%s (%s)", gtstring, kartspeed_cons_t[(demoref->kartspeed & ~DF_ENCORE) + 1].strvalue);
|
||||
}
|
||||
|
||||
V_DrawString(x, y+20, V_ALLOWLOWERCASE, gtstring);
|
||||
}
|
||||
|
||||
if (!demoref->standings[0].ranking)
|
||||
{
|
||||
// No standings were loaded!
|
||||
V_DrawString(x, y+39, V_ALLOWLOWERCASE|V_TRANSLUCENT, "No standings available.");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
V_DrawThinString(x, y+29, highlightflags, "WINNER");
|
||||
V_DrawString(x+38, y+30, V_ALLOWLOWERCASE, demoref->standings[0].name);
|
||||
|
||||
if (demoref->gametype >= 0)
|
||||
{
|
||||
if (gametypes[demoref->gametype]->rules & GTR_POINTLIMIT)
|
||||
{
|
||||
V_DrawThinString(x, y+39, highlightflags, "SCORE");
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawThinString(x, y+39, highlightflags, "TIME");
|
||||
}
|
||||
|
||||
if (demoref->standings[0].timeorscore == (UINT32_MAX-1))
|
||||
{
|
||||
V_DrawThinString(x+32, y+39, 0, "NO CONTEST");
|
||||
}
|
||||
else if (gametypes[demoref->gametype]->rules & GTR_POINTLIMIT)
|
||||
{
|
||||
V_DrawString(x+32, y+40, 0, va("%d", demoref->standings[0].timeorscore));
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawRightAlignedString(x+84, y+40, 0, va("%d'%02d\"%02d",
|
||||
G_TicsToMinutes(demoref->standings[0].timeorscore, true),
|
||||
G_TicsToSeconds(demoref->standings[0].timeorscore),
|
||||
G_TicsToCentiseconds(demoref->standings[0].timeorscore)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// Character face!
|
||||
|
||||
// Lat: 08/06/2020: For some reason missing skins have their value set to 255 (don't even ask me why I didn't write this)
|
||||
// and for an even STRANGER reason this passes the first check below, so we're going to make sure that the skin here ISN'T 255 before we do anything stupid.
|
||||
|
||||
if (demoref->standings[0].skin < numskins)
|
||||
{
|
||||
patch = faceprefix[demoref->standings[0].skin][FACE_WANTED];
|
||||
colormap = R_GetTranslationColormap(
|
||||
demoref->standings[0].skin,
|
||||
demoref->standings[0].color,
|
||||
GTC_MENUCACHE);
|
||||
}
|
||||
else
|
||||
{
|
||||
patch = W_CachePatchName("M_NOWANT", PU_CACHE);
|
||||
colormap = R_GetTranslationColormap(
|
||||
TC_RAINBOW,
|
||||
demoref->standings[0].color,
|
||||
GTC_MENUCACHE);
|
||||
}
|
||||
|
||||
V_DrawMappedPatch(BASEVIDWIDTH-15 - SHORT(patch->width), y+20, 0, patch, colormap);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void M_DrawReplayHut(void)
|
||||
{
|
||||
INT32 x, y, cursory = 0;
|
||||
INT16 i;
|
||||
INT16 replaylistitem = currentMenu->numitems-2;
|
||||
boolean processed_one_this_frame = false;
|
||||
|
||||
static UINT16 replayhutmenuy = 0;
|
||||
|
||||
M_DrawEggaChannel();
|
||||
|
||||
// Draw menu choices
|
||||
x = currentMenu->x;
|
||||
y = currentMenu->y;
|
||||
|
||||
if (itemOn > replaylistitem)
|
||||
{
|
||||
itemOn = replaylistitem;
|
||||
dir_on[menudepthleft] = sizedirmenu-1;
|
||||
extrasmenu.replayScrollTitle = 0; extrasmenu.replayScrollDelay = TICRATE; extrasmenu.replayScrollDir = 1;
|
||||
}
|
||||
else if (itemOn < replaylistitem)
|
||||
{
|
||||
dir_on[menudepthleft] = 0;
|
||||
extrasmenu.replayScrollTitle = 0; extrasmenu.replayScrollDelay = TICRATE; extrasmenu.replayScrollDir = 1;
|
||||
}
|
||||
|
||||
if (itemOn == replaylistitem)
|
||||
{
|
||||
INT32 maxy;
|
||||
// Scroll menu items if needed
|
||||
cursory = y + currentMenu->menuitems[replaylistitem].mvar1 + dir_on[menudepthleft]*10;
|
||||
maxy = y + currentMenu->menuitems[replaylistitem].mvar1 + sizedirmenu*10;
|
||||
|
||||
if (cursory > maxy - 20)
|
||||
cursory = maxy - 20;
|
||||
|
||||
if (cursory - replayhutmenuy > SCALEDVIEWHEIGHT-50)
|
||||
replayhutmenuy += (cursory-SCALEDVIEWHEIGHT-replayhutmenuy + 51)/2;
|
||||
else if (cursory - replayhutmenuy < 110)
|
||||
replayhutmenuy += (max(0, cursory-110)-replayhutmenuy - 1)/2;
|
||||
}
|
||||
else
|
||||
replayhutmenuy /= 2;
|
||||
|
||||
y -= replayhutmenuy;
|
||||
|
||||
// Draw static menu items
|
||||
for (i = 0; i < replaylistitem; i++)
|
||||
{
|
||||
INT32 localy = y + currentMenu->menuitems[i].mvar1;
|
||||
|
||||
if (localy < 65)
|
||||
continue;
|
||||
|
||||
if (i == itemOn)
|
||||
cursory = localy;
|
||||
|
||||
if ((currentMenu->menuitems[i].status & IT_DISPLAY)==IT_STRING)
|
||||
V_DrawString(x, localy, 0, currentMenu->menuitems[i].text);
|
||||
else
|
||||
V_DrawString(x, localy, highlightflags, currentMenu->menuitems[i].text);
|
||||
}
|
||||
|
||||
y += currentMenu->menuitems[replaylistitem].mvar1;
|
||||
|
||||
for (i = 0; i < (INT16)sizedirmenu; i++)
|
||||
{
|
||||
INT32 localy = y+i*10;
|
||||
INT32 localx = x;
|
||||
|
||||
if (localy < 65)
|
||||
continue;
|
||||
if (localy >= SCALEDVIEWHEIGHT)
|
||||
break;
|
||||
|
||||
if (extrasmenu.demolist[i].type == MD_NOTLOADED && !processed_one_this_frame)
|
||||
{
|
||||
processed_one_this_frame = true;
|
||||
G_LoadDemoInfo(&extrasmenu.demolist[i]);
|
||||
}
|
||||
|
||||
if (extrasmenu.demolist[i].type == MD_SUBDIR)
|
||||
{
|
||||
localx += 8;
|
||||
V_DrawScaledPatch(x - 4, localy, 0, W_CachePatchName(dirmenu[i][DIR_TYPE] == EXT_UP ? "M_RBACK" : "M_RFLDR", PU_CACHE));
|
||||
}
|
||||
|
||||
if (itemOn == replaylistitem && i == (INT16)dir_on[menudepthleft])
|
||||
{
|
||||
cursory = localy;
|
||||
|
||||
if (extrasmenu.replayScrollDelay)
|
||||
extrasmenu.replayScrollDelay--;
|
||||
else if (extrasmenu.replayScrollDir > 0)
|
||||
{
|
||||
if (extrasmenu.replayScrollTitle < (V_StringWidth(extrasmenu.demolist[i].title, 0) - (SCALEDVIEWWIDTH - (x<<1)))<<1)
|
||||
extrasmenu.replayScrollTitle++;
|
||||
else
|
||||
{
|
||||
extrasmenu.replayScrollDelay = TICRATE;
|
||||
extrasmenu.replayScrollDir = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (extrasmenu.replayScrollTitle > 0)
|
||||
extrasmenu.replayScrollTitle--;
|
||||
else
|
||||
{
|
||||
extrasmenu.replayScrollDelay = TICRATE;
|
||||
extrasmenu.replayScrollDir = 1;
|
||||
}
|
||||
}
|
||||
|
||||
V_DrawString(localx - (extrasmenu.replayScrollTitle>>1), localy, highlightflags|V_ALLOWLOWERCASE, extrasmenu.demolist[i].title);
|
||||
}
|
||||
else
|
||||
V_DrawString(localx, localy, V_ALLOWLOWERCASE, extrasmenu.demolist[i].title);
|
||||
}
|
||||
|
||||
// Draw scrollbar
|
||||
y = sizedirmenu*10 + currentMenu->menuitems[replaylistitem].mvar1 + 30;
|
||||
if (y > SCALEDVIEWHEIGHT-80)
|
||||
{
|
||||
V_DrawFill(BASEVIDWIDTH-4, 75, 4, SCALEDVIEWHEIGHT-80, 159);
|
||||
V_DrawFill(BASEVIDWIDTH-3, 76 + (SCALEDVIEWHEIGHT-80) * replayhutmenuy / y, 2, (((SCALEDVIEWHEIGHT-80) * (SCALEDVIEWHEIGHT-80))-1) / y - 1, 149);
|
||||
}
|
||||
|
||||
// Draw the cursor
|
||||
V_DrawScaledPatch(currentMenu->x - 24, cursory, 0,
|
||||
W_CachePatchName("M_CURSOR", PU_CACHE));
|
||||
V_DrawString(currentMenu->x, cursory, highlightflags, currentMenu->menuitems[itemOn].text);
|
||||
|
||||
// Now draw some replay info!
|
||||
V_DrawFill(10, 10, 300, 60, 159);
|
||||
|
||||
if (itemOn == replaylistitem)
|
||||
{
|
||||
M_DrawReplayHutReplayInfo(&extrasmenu.demolist[dir_on[menudepthleft]]);
|
||||
}
|
||||
}
|
||||
|
||||
void M_DrawReplayStartMenu(void)
|
||||
{
|
||||
const char *warning;
|
||||
UINT8 i;
|
||||
menudemo_t *demoref = &extrasmenu.demolist[dir_on[menudepthleft]];
|
||||
|
||||
M_DrawEggaChannel();
|
||||
M_DrawGenericMenu();
|
||||
|
||||
#define STARTY 62-(extrasmenu.replayScrollTitle>>1)
|
||||
// Draw rankings beyond first
|
||||
for (i = 1; i < MAXPLAYERS && demoref->standings[i].ranking; i++)
|
||||
{
|
||||
patch_t *patch;
|
||||
UINT8 *colormap;
|
||||
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-100, STARTY + i*20,highlightflags, va("%2d", demoref->standings[i].ranking));
|
||||
V_DrawThinString(BASEVIDWIDTH-96, STARTY + i*20, V_ALLOWLOWERCASE, demoref->standings[i].name);
|
||||
|
||||
if (demoref->standings[i].timeorscore == UINT32_MAX-1)
|
||||
V_DrawThinString(BASEVIDWIDTH-92, STARTY + i*20 + 9, 0, "NO CONTEST");
|
||||
else if (demoref->gametype < 0)
|
||||
;
|
||||
else if (gametypes[demoref->gametype]->rules & GTR_POINTLIMIT)
|
||||
V_DrawString(BASEVIDWIDTH-92, STARTY + i*20 + 9, 0, va("%d", demoref->standings[i].timeorscore));
|
||||
else
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH-40, STARTY + i*20 + 9, 0, va("%d'%02d\"%02d",
|
||||
G_TicsToMinutes(demoref->standings[i].timeorscore, true),
|
||||
G_TicsToSeconds(demoref->standings[i].timeorscore),
|
||||
G_TicsToCentiseconds(demoref->standings[i].timeorscore)
|
||||
));
|
||||
|
||||
// Character face!
|
||||
|
||||
// Lat: 08/06/2020: For some reason missing skins have their value set to 255 (don't even ask me why I didn't write this)
|
||||
// and for an even STRANGER reason this passes the first check below, so we're going to make sure that the skin here ISN'T 255 before we do anything stupid.
|
||||
|
||||
if (demoref->standings[i].skin < numskins)
|
||||
{
|
||||
patch = faceprefix[demoref->standings[i].skin][FACE_RANK];
|
||||
colormap = R_GetTranslationColormap(
|
||||
demoref->standings[i].skin,
|
||||
demoref->standings[i].color,
|
||||
GTC_MENUCACHE);
|
||||
}
|
||||
else
|
||||
{
|
||||
patch = W_CachePatchName("M_NORANK", PU_CACHE);
|
||||
colormap = R_GetTranslationColormap(
|
||||
TC_RAINBOW,
|
||||
demoref->standings[i].color,
|
||||
GTC_MENUCACHE);
|
||||
}
|
||||
|
||||
V_DrawMappedPatch(BASEVIDWIDTH-5 - SHORT(patch->width), STARTY + i*20, 0, patch, colormap);
|
||||
}
|
||||
#undef STARTY
|
||||
|
||||
// Handle scrolling rankings
|
||||
if (extrasmenu.replayScrollDelay)
|
||||
extrasmenu.replayScrollDelay--;
|
||||
else if (extrasmenu.replayScrollDir > 0)
|
||||
{
|
||||
if (extrasmenu.replayScrollTitle < (i*20 - SCALEDVIEWHEIGHT + 100)<<1)
|
||||
extrasmenu.replayScrollTitle++;
|
||||
else
|
||||
{
|
||||
extrasmenu.replayScrollDelay = TICRATE;
|
||||
extrasmenu.replayScrollDir = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (extrasmenu.replayScrollTitle > 0)
|
||||
extrasmenu.replayScrollTitle--;
|
||||
else
|
||||
{
|
||||
extrasmenu.replayScrollDelay = TICRATE;
|
||||
extrasmenu.replayScrollDir = 1;
|
||||
}
|
||||
}
|
||||
|
||||
V_DrawFill(10, 10, 300, 60, 159);
|
||||
M_DrawReplayHutReplayInfo(demoref);
|
||||
|
||||
V_DrawString(10, 72, highlightflags|V_ALLOWLOWERCASE, demoref->title);
|
||||
|
||||
// Draw a warning prompt if needed
|
||||
switch (demoref->addonstatus)
|
||||
{
|
||||
case DFILE_ERROR_CANNOTLOAD:
|
||||
warning = "Some addons in this replay cannot be loaded.\nYou can watch anyway, but desyncs may occur.";
|
||||
break;
|
||||
|
||||
case DFILE_ERROR_NOTLOADED:
|
||||
case DFILE_ERROR_INCOMPLETEOUTOFORDER:
|
||||
warning = "Loading addons will mark your game as modified, and Record Attack may be unavailable.\nYou can watch without loading addons, but desyncs may occur.";
|
||||
break;
|
||||
|
||||
case DFILE_ERROR_EXTRAFILES:
|
||||
warning = "You have addons loaded that were not present in this replay.\nYou can watch anyway, but desyncs may occur.";
|
||||
break;
|
||||
|
||||
case DFILE_ERROR_OUTOFORDER:
|
||||
warning = "You have this replay's addons loaded, but they are out of order.\nYou can watch anyway, but desyncs may occur.";
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
V_DrawSmallString(4, BASEVIDHEIGHT-14, V_ALLOWLOWERCASE, warning);
|
||||
}
|
||||
|
||||
// Draw misc menus:
|
||||
|
||||
// Addons
|
||||
|
|
|
|||
|
|
@ -481,16 +481,6 @@ menu_t *M_SpecificMenuRestore(menu_t *torestore)
|
|||
M_SetupRaceMenu(-1);
|
||||
M_SetupDifficultyOptions((cupgrid.grandprix == false));
|
||||
}
|
||||
else if (torestore == &EXTRAS_ReplayHutDef)
|
||||
{
|
||||
// Handle modifications to the folder while playing
|
||||
M_ReplayHut(0);
|
||||
|
||||
if (demo.inreplayhut == false)
|
||||
{
|
||||
torestore = &EXTRAS_MainDef;
|
||||
}
|
||||
}
|
||||
else if (torestore == &PLAY_MP_OptSelectDef)
|
||||
{
|
||||
// Ticker init
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ target_sources(SRB2SDL2 PRIVATE
|
|||
extras-addons.c
|
||||
extras-challenges.c
|
||||
extras-egg-tv.cpp
|
||||
extras-replay-hut.c
|
||||
extras-statistics.c
|
||||
main-1.c
|
||||
main-profile-select.c
|
||||
|
|
|
|||
|
|
@ -1,296 +0,0 @@
|
|||
/// \file menus/extras-replay-hut.c
|
||||
/// \brief Extras Menu: Replay Hut
|
||||
|
||||
#include "../k_menu.h"
|
||||
#include "../filesrch.h" // Addfile
|
||||
#include "../d_main.h"
|
||||
#include "../s_sound.h"
|
||||
#include "../v_video.h"
|
||||
#include "../z_zone.h"
|
||||
|
||||
// extras menu: replay hut
|
||||
menuitem_t EXTRAS_ReplayHut[] =
|
||||
{
|
||||
{IT_KEYHANDLER|IT_NOTHING, "", "", // Dummy menuitem for the replay list
|
||||
NULL, {.routine = M_HandleReplayHutList}, 0, 0},
|
||||
|
||||
{IT_NOTHING, "", "", // Dummy for handling wrapping to the top of the menu..
|
||||
NULL, {NULL}, 0, 0},
|
||||
};
|
||||
|
||||
menu_t EXTRAS_ReplayHutDef =
|
||||
{
|
||||
sizeof (EXTRAS_ReplayHut)/sizeof (menuitem_t),
|
||||
&EXTRAS_MainDef,
|
||||
0,
|
||||
EXTRAS_ReplayHut,
|
||||
30, 80,
|
||||
0, 0,
|
||||
0,
|
||||
"REPLAY",
|
||||
41, 1,
|
||||
M_DrawReplayHut,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
menuitem_t EXTRAS_ReplayStart[] =
|
||||
{
|
||||
{IT_CALL |IT_STRING, "Load Addons and Watch", NULL,
|
||||
NULL, {.routine = M_HutStartReplay}, 0, 0},
|
||||
|
||||
{IT_CALL |IT_STRING, "Load Without Addons", NULL,
|
||||
NULL, {.routine = M_HutStartReplay}, 10, 0},
|
||||
|
||||
{IT_CALL |IT_STRING, "Watch Replay", NULL,
|
||||
NULL, {.routine = M_HutStartReplay}, 10, 0},
|
||||
|
||||
{IT_SUBMENU |IT_STRING, "Go Back", NULL,
|
||||
NULL, {.submenu = &EXTRAS_ReplayHutDef}, 30, 0},
|
||||
};
|
||||
|
||||
|
||||
menu_t EXTRAS_ReplayStartDef =
|
||||
{
|
||||
sizeof (EXTRAS_ReplayStart)/sizeof (menuitem_t),
|
||||
&EXTRAS_ReplayHutDef,
|
||||
0,
|
||||
EXTRAS_ReplayStart,
|
||||
27, 80,
|
||||
0, 0,
|
||||
0,
|
||||
"REPLAY",
|
||||
41, 1,
|
||||
M_DrawReplayStartMenu,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
void M_PrepReplayList(void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (extrasmenu.demolist)
|
||||
Z_Free(extrasmenu.demolist);
|
||||
|
||||
extrasmenu.demolist = Z_Calloc(sizeof(menudemo_t) * sizedirmenu, PU_STATIC, NULL);
|
||||
|
||||
for (i = 0; i < sizedirmenu; i++)
|
||||
{
|
||||
if (dirmenu[i][DIR_TYPE] == EXT_UP)
|
||||
{
|
||||
extrasmenu.demolist[i].type = MD_SUBDIR;
|
||||
sprintf(extrasmenu.demolist[i].title, "UP");
|
||||
}
|
||||
else if (dirmenu[i][DIR_TYPE] == EXT_FOLDER)
|
||||
{
|
||||
extrasmenu.demolist[i].type = MD_SUBDIR;
|
||||
strncpy(extrasmenu.demolist[i].title, dirmenu[i] + DIR_STRING, 64);
|
||||
}
|
||||
else
|
||||
{
|
||||
extrasmenu.demolist[i].type = MD_NOTLOADED;
|
||||
snprintf(extrasmenu.demolist[i].filepath, sizeof extrasmenu.demolist[i].filepath,
|
||||
// 255 = UINT8 limit. dirmenu entries are restricted to this length (see DIR_LEN).
|
||||
"%s%.255s", menupath, dirmenu[i] + DIR_STRING);
|
||||
sprintf(extrasmenu.demolist[i].title, ".....");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void M_ReplayHut(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
|
||||
if (demo.inreplayhut)
|
||||
{
|
||||
demo.rewinding = false;
|
||||
CL_ClearRewinds();
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(menupath, 1024, "%s"PATHSEP"media"PATHSEP"replay"PATHSEP"online"PATHSEP, srb2home);
|
||||
menupathindex[(menudepthleft = menudepth-1)] = strlen(menupath);
|
||||
}
|
||||
|
||||
if (!preparefilemenu(false, true))
|
||||
{
|
||||
M_StartMessage("No replays found.\n\nPress (B)\n", NULL, MM_NOTHING);
|
||||
demo.inreplayhut = false;
|
||||
return;
|
||||
}
|
||||
else if (!demo.inreplayhut)
|
||||
{
|
||||
dir_on[menudepthleft] = 0;
|
||||
}
|
||||
|
||||
extrasmenu.replayScrollTitle = 0;
|
||||
extrasmenu.replayScrollDelay = TICRATE;
|
||||
extrasmenu.replayScrollDir = 1;
|
||||
|
||||
M_PrepReplayList();
|
||||
|
||||
if (!demo.inreplayhut)
|
||||
M_SetupNextMenu(&EXTRAS_ReplayHutDef, false);
|
||||
|
||||
demo.inreplayhut = true;
|
||||
}
|
||||
|
||||
// key handler
|
||||
void M_HandleReplayHutList(INT32 choice)
|
||||
{
|
||||
|
||||
const UINT8 pid = 0;
|
||||
(void) choice;
|
||||
|
||||
if (menucmd[pid].dpad_ud < 0)
|
||||
{
|
||||
if (dir_on[menudepthleft])
|
||||
dir_on[menudepthleft]--;
|
||||
else
|
||||
return;
|
||||
//M_PrevOpt();
|
||||
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
M_SetMenuDelay(pid);
|
||||
extrasmenu.replayScrollTitle = 0; extrasmenu.replayScrollDelay = TICRATE; extrasmenu.replayScrollDir = 1;
|
||||
}
|
||||
|
||||
else if (menucmd[pid].dpad_ud > 0)
|
||||
{
|
||||
if (dir_on[menudepthleft] < sizedirmenu-1)
|
||||
dir_on[menudepthleft]++;
|
||||
else
|
||||
return;
|
||||
//itemOn = 0; // Not M_NextOpt because that would take us to the extra dummy item
|
||||
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
M_SetMenuDelay(pid);
|
||||
extrasmenu.replayScrollTitle = 0; extrasmenu.replayScrollDelay = TICRATE; extrasmenu.replayScrollDir = 1;
|
||||
}
|
||||
|
||||
else if (M_MenuBackPressed(pid))
|
||||
{
|
||||
M_SetMenuDelay(pid);
|
||||
M_QuitReplayHut();
|
||||
}
|
||||
|
||||
else if (M_MenuConfirmPressed(pid))
|
||||
{
|
||||
M_SetMenuDelay(pid);
|
||||
switch (dirmenu[dir_on[menudepthleft]][DIR_TYPE])
|
||||
{
|
||||
case EXT_FOLDER:
|
||||
strcpy(&menupath[menupathindex[menudepthleft]],dirmenu[dir_on[menudepthleft]]+DIR_STRING);
|
||||
if (menudepthleft)
|
||||
{
|
||||
menupathindex[--menudepthleft] = strlen(menupath);
|
||||
menupath[menupathindex[menudepthleft]] = 0;
|
||||
|
||||
if (!preparefilemenu(false, true))
|
||||
{
|
||||
S_StartSound(NULL, sfx_s224);
|
||||
M_StartMessage(va("%c%s\x80\nThis folder is empty.\n\nPress (B)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), M_AddonsHeaderPath()),NULL,MM_NOTHING);
|
||||
menupath[menupathindex[++menudepthleft]] = 0;
|
||||
|
||||
if (!preparefilemenu(true, true))
|
||||
{
|
||||
M_QuitReplayHut();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
dir_on[menudepthleft] = 1;
|
||||
M_PrepReplayList();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
S_StartSound(NULL, sfx_s26d);
|
||||
M_StartMessage(va("%c%s\x80\nThis folder is too deep to navigate to!\n\nPress (B)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), M_AddonsHeaderPath()),NULL,MM_NOTHING);
|
||||
menupath[menupathindex[menudepthleft]] = 0;
|
||||
}
|
||||
break;
|
||||
case EXT_UP:
|
||||
S_StartSound(NULL, sfx_s3k5b);
|
||||
menupath[menupathindex[++menudepthleft]] = 0;
|
||||
if (!preparefilemenu(false, true))
|
||||
{
|
||||
M_QuitReplayHut();
|
||||
return;
|
||||
}
|
||||
M_PrepReplayList();
|
||||
break;
|
||||
default:
|
||||
M_SetupNextMenu(&EXTRAS_ReplayStartDef, true);
|
||||
|
||||
extrasmenu.replayScrollTitle = 0;
|
||||
extrasmenu.replayScrollDelay = TICRATE;
|
||||
extrasmenu.replayScrollDir = 1;
|
||||
|
||||
switch (extrasmenu.demolist[dir_on[menudepthleft]].addonstatus)
|
||||
{
|
||||
case DFILE_ERROR_CANNOTLOAD:
|
||||
// Only show "Watch Replay Without Addons"
|
||||
EXTRAS_ReplayStart[0].status = IT_DISABLED;
|
||||
EXTRAS_ReplayStart[1].status = IT_CALL|IT_STRING;
|
||||
//EXTRAS_ReplayStart[1].alphaKey = 0;
|
||||
EXTRAS_ReplayStart[2].status = IT_DISABLED;
|
||||
itemOn = 1;
|
||||
break;
|
||||
|
||||
case DFILE_ERROR_NOTLOADED:
|
||||
case DFILE_ERROR_INCOMPLETEOUTOFORDER:
|
||||
// Show "Load Addons and Watch Replay" and "Watch Replay Without Addons"
|
||||
EXTRAS_ReplayStart[0].status = IT_CALL|IT_STRING;
|
||||
EXTRAS_ReplayStart[1].status = IT_CALL|IT_STRING;
|
||||
//EXTRAS_ReplayStart[1].alphaKey = 10;
|
||||
EXTRAS_ReplayStart[2].status = IT_DISABLED;
|
||||
itemOn = 0;
|
||||
break;
|
||||
|
||||
case DFILE_ERROR_EXTRAFILES:
|
||||
case DFILE_ERROR_OUTOFORDER:
|
||||
default:
|
||||
// Show "Watch Replay"
|
||||
EXTRAS_ReplayStart[0].status = IT_DISABLED;
|
||||
EXTRAS_ReplayStart[1].status = IT_DISABLED;
|
||||
EXTRAS_ReplayStart[2].status = IT_CALL|IT_STRING;
|
||||
//EXTRAS_ReplayStart[2].alphaKey = 0;
|
||||
itemOn = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean M_QuitReplayHut(void)
|
||||
{
|
||||
if (extrasmenu.demolist)
|
||||
Z_Free(extrasmenu.demolist);
|
||||
extrasmenu.demolist = NULL;
|
||||
|
||||
demo.inreplayhut = false;
|
||||
|
||||
M_GoBack(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
void M_HutStartReplay(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
|
||||
restoreMenu = &EXTRAS_ReplayHutDef;
|
||||
|
||||
M_ClearMenus(false);
|
||||
demo.loadfiles = (itemOn == 0);
|
||||
demo.ignorefiles = (itemOn != 0);
|
||||
|
||||
G_DoPlayDemo(extrasmenu.demolist[dir_on[menudepthleft]].filepath);
|
||||
}
|
||||
|
|
@ -257,10 +257,10 @@ void M_PlaybackQuit(INT32 choice)
|
|||
(void)choice;
|
||||
G_StopDemo();
|
||||
|
||||
if (demo.inreplayhut)
|
||||
M_StartControlPanel();
|
||||
else if (modeattacking)
|
||||
if (modeattacking)
|
||||
M_EndModeAttackRun();
|
||||
else if (restoreMenu)
|
||||
M_StartControlPanel();
|
||||
else
|
||||
D_StartTitle();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue