From 3994008d31fdd46f896bbce61575a6718e18f436 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 17 Oct 2017 23:14:51 -0400 Subject: [PATCH] More score/rings cleanup, hide some hud elements, and most importantly: staff ghosts! Would be nice to have an option to directly replay a specific staff ghost, but this should be fine for now --- src/d_netcmd.c | 1 + src/g_game.c | 2 +- src/g_game.h | 2 +- src/k_kart.c | 5 ++-- src/m_menu.c | 65 +++++++++++++++++++++++++------------------------- src/p_setup.c | 32 +++++++++++++++++++++---- 6 files changed, 67 insertions(+), 40 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index b8655c39..b72a37d4 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -704,6 +704,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_ghost_bestrings); CV_RegisterVar(&cv_ghost_last); CV_RegisterVar(&cv_ghost_guest); + CV_RegisterVar(&cv_ghost_staff); COM_AddCommand("displayplayer", Command_Displayplayer_f); COM_AddCommand("tunes", Command_Tunes_f); diff --git a/src/g_game.c b/src/g_game.c index e686d573..57b9b84b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3813,7 +3813,7 @@ char *G_BuildMapTitle(INT32 mapnum) #define DEMOHEADER "\xF0" "KartReplay" "\x0F" #define DF_GHOST 0x01 // This demo contains ghost data too! -#define DF_RECORDATTACK 0x02 // This demo is from record attack and contains its final completion time, score, and rings! +#define DF_RECORDATTACK 0x02 // This demo is from record attack and contains its final completion time! #define DF_NIGHTSATTACK 0x04 // This demo is from NiGHTS attack and contains its time left, score, and mares! #define DF_ATTACKMASK 0x06 // This demo is from ??? attack and contains ??? #define DF_ATTACKSHIFT 1 diff --git a/src/g_game.h b/src/g_game.h index 79fc3e5b..2674846a 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -58,7 +58,7 @@ extern consvar_t cv_crosshair, cv_crosshair2; extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_mousemove; extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_fireaxis,cv_firenaxis; extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_fireaxis2,cv_firenaxis2; -extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_ghost_last, cv_ghost_guest; +extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_ghost_last, cv_ghost_guest, cv_ghost_staff; // mouseaiming (looking up/down with the mouse or keyboard) #define KB_LOOKSPEED (1<<25) diff --git a/src/k_kart.c b/src/k_kart.c index 4562bd7b..936dbcfb 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4031,7 +4031,7 @@ void K_drawKartHUD(void) // If not splitscreen, draw... // The little triple-item icons at the bottom // The top-four faces on the left - if (!splitscreen) + if (!(splitscreen || modeattacking)) { //K_DrawKartTripleItem(); K_drawKartPositionFaces(); @@ -4048,7 +4048,8 @@ void K_drawKartHUD(void) V_DrawKartString(LAPS_X+33, STRINGY(LAPS_Y+3), 0, va("%d/%d", stplyr->laps+1, cv_numlaps.value)); // Draw the numerical position - K_DrawKartPositionNum(stplyr->kartstuff[k_position]); + if (!modeattacking) + K_DrawKartPositionNum(stplyr->kartstuff[k_position]); // Draw the speedometer // TODO: Make a better speedometer. diff --git a/src/m_menu.c b/src/m_menu.c index 23ab42af..92abcff4 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -112,13 +112,13 @@ const char *quitmsg[NUM_QUITMESSAGES]; description_t description[32] = { {"\x82Sonic\x80", "", "sonic"}, - {"\x82Tails\x80", "", "tails"}, - {"\x82Knuckles\x80", "", "knuckles"}, - {"\x82Metal Sonic\x80", "", "metalsonic"}, - {"???", "", ""}, // {"\x82Blonic\x80", "", "blonic"}, - {"???", "", ""}, // {"\x82Blails\x80", "", "blails"}, - {"???", "", ""}, // {"\x82Bluckles\x80", "", "bluckles"}, - {"???", "", ""}, // {"\x82Bletal Blonic\x80", "", "bletalblonic"}, + {"???", "", ""}, + {"???", "", ""}, + {"???", "", ""}, + {"???", "", ""}, + {"???", "", ""}, + {"???", "", ""}, + {"???", "", ""}, {"???", "", ""}, {"???", "", ""}, {"???", "", ""}, @@ -415,6 +415,7 @@ consvar_t cv_ghost_besttime = {"ghost_besttime", "Show", CV_SAVE, ghost_cons_t consvar_t cv_ghost_bestrings = {"ghost_bestrings", "Show", CV_SAVE, ghost_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_ghost_last = {"ghost_last", "Show", CV_SAVE, ghost_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_ghost_guest = {"ghost_guest", "Show", CV_SAVE, ghost2_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_ghost_staff = {"ghost_staff", "Show", CV_SAVE, ghost2_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //Console variables used solely in the menu system. //todo: add a way to use non-console variables in the menu @@ -767,23 +768,23 @@ static menuitem_t SP_NightsGuestReplayMenu[] = static menuitem_t SP_GhostMenu[] = { - {IT_STRING|IT_CVAR, NULL, "Best Score", &cv_ghost_bestscore, 0}, - {IT_STRING|IT_CVAR, NULL, "Best Time", &cv_ghost_besttime, 8}, - {IT_STRING|IT_CVAR, NULL, "Best Rings", &cv_ghost_bestrings,16}, - {IT_STRING|IT_CVAR, NULL, "Last", &cv_ghost_last, 24}, + {IT_STRING|IT_CVAR, NULL, "Best Time", &cv_ghost_besttime, 8}, + {IT_STRING|IT_CVAR, NULL, "Last", &cv_ghost_last, 16}, - {IT_STRING|IT_CVAR, NULL, "Guest", &cv_ghost_guest, 37}, + {IT_STRING|IT_CVAR, NULL, "Guest", &cv_ghost_guest, 29}, + {IT_STRING|IT_CVAR, NULL, "Staff Attack",&cv_ghost_staff, 37}, {IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SP_TimeAttackDef, 50} }; static menuitem_t SP_NightsGhostMenu[] = { - {IT_STRING|IT_CVAR, NULL, "Best Score", &cv_ghost_bestscore, 8}, - {IT_STRING|IT_CVAR, NULL, "Best Time", &cv_ghost_besttime, 16}, - {IT_STRING|IT_CVAR, NULL, "Last", &cv_ghost_last, 24}, + {IT_STRING|IT_CVAR, NULL, "Best Score", &cv_ghost_bestscore, 0}, + {IT_STRING|IT_CVAR, NULL, "Best Time", &cv_ghost_besttime, 8}, + {IT_STRING|IT_CVAR, NULL, "Last", &cv_ghost_last, 16}, - {IT_STRING|IT_CVAR, NULL, "Guest", &cv_ghost_guest, 37}, + {IT_STRING|IT_CVAR, NULL, "Guest", &cv_ghost_guest, 29}, + {IT_STRING|IT_CVAR, NULL, "Staff Attack",&cv_ghost_staff, 37}, {IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SP_NightsAttackDef, 50} }; @@ -828,9 +829,9 @@ static menuitem_t SP_LevelStatsMenu[] = menuitem_t PlayerMenu[32] = { {IT_CALL, NULL, NULL, M_ChoosePlayer, 0}, - {IT_CALL, NULL, NULL, M_ChoosePlayer, 0}, - {IT_CALL, NULL, NULL, M_ChoosePlayer, 0}, - {IT_CALL, NULL, NULL, M_ChoosePlayer, 0}, + {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, + {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, + {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, {IT_DISABLED, NULL, NULL, M_ChoosePlayer, 0}, @@ -5171,23 +5172,23 @@ static void M_DrawGameStats(void) V_DrawCenteredString(BASEVIDWIDTH/2, 90, 0, "* COMBINED RECORDS *"); - sprintf(beststr, "%u", bestscore); + /*sprintf(beststr, "%u", bestscore); V_DrawString(32, 100, V_YELLOWMAP, "SCORE:"); V_DrawRightAlignedString(BASEVIDWIDTH-32, 100, 0, beststr); if (mapsunfinished[0]) - V_DrawRightAlignedString(BASEVIDWIDTH-32, 108, V_REDMAP, va("(%d unfinished)", mapsunfinished[0])); + V_DrawRightAlignedString(BASEVIDWIDTH-32, 108, V_REDMAP, va("(%d unfinished)", mapsunfinished[0]));*/ sprintf(beststr, "%i:%02i:%02i.%02i", G_TicsToHours(besttime), G_TicsToMinutes(besttime, false), G_TicsToSeconds(besttime), G_TicsToCentiseconds(besttime)); - V_DrawString(32, 120, V_YELLOWMAP, "TIME:"); - V_DrawRightAlignedString(BASEVIDWIDTH-32, 120, 0, beststr); + V_DrawString(32, 100, V_YELLOWMAP, "TIME:"); + V_DrawRightAlignedString(BASEVIDWIDTH-32, 100, 0, beststr); if (mapsunfinished[1]) - V_DrawRightAlignedString(BASEVIDWIDTH-32, 128, V_REDMAP, va("(%d unfinished)", mapsunfinished[1])); + V_DrawRightAlignedString(BASEVIDWIDTH-32, 108, V_REDMAP, va("(%d unfinished)", mapsunfinished[1])); - sprintf(beststr, "%u", bestrings); + /*sprintf(beststr, "%u", bestrings); V_DrawString(32, 140, V_YELLOWMAP, "RINGS:"); V_DrawRightAlignedString(BASEVIDWIDTH-32, 140, 0, beststr); if (mapsunfinished[2]) - V_DrawRightAlignedString(BASEVIDWIDTH-32, 148, V_REDMAP, va("(%d unfinished)", mapsunfinished[2])); + V_DrawRightAlignedString(BASEVIDWIDTH-32, 148, V_REDMAP, va("(%d unfinished)", mapsunfinished[2]));*/ } static void M_HandleGameStats(INT32 choice) @@ -5297,13 +5298,13 @@ void M_DrawTimeAttackMenu(void) V_DrawCenteredString(104, 32, 0, "* LEVEL RECORDS *"); - if (!mainrecords[cv_nextmap.value-1] || !mainrecords[cv_nextmap.value-1]->score) + /*if (!mainrecords[cv_nextmap.value-1] || !mainrecords[cv_nextmap.value-1]->score) sprintf(beststr, "(none)"); else sprintf(beststr, "%u", mainrecords[cv_nextmap.value-1]->score); V_DrawString(104-72, 48, V_YELLOWMAP, "SCORE:"); - V_DrawRightAlignedString(104+72, 48, V_ALLOWLOWERCASE, beststr); + V_DrawRightAlignedString(104+72, 48, V_ALLOWLOWERCASE, beststr);*/ if (!mainrecords[cv_nextmap.value-1] || !mainrecords[cv_nextmap.value-1]->time) sprintf(beststr, "(none)"); @@ -5315,13 +5316,13 @@ void M_DrawTimeAttackMenu(void) V_DrawString(104-72, 58, V_YELLOWMAP, "TIME:"); V_DrawRightAlignedString(104+72, 58, V_ALLOWLOWERCASE, beststr); - if (!mainrecords[cv_nextmap.value-1] || !mainrecords[cv_nextmap.value-1]->rings) + /*if (!mainrecords[cv_nextmap.value-1] || !mainrecords[cv_nextmap.value-1]->rings) sprintf(beststr, "(none)"); else sprintf(beststr, "%hu", mainrecords[cv_nextmap.value-1]->rings); V_DrawString(104-72, 68, V_YELLOWMAP, "RINGS:"); - V_DrawRightAlignedString(104+72, 68, V_ALLOWLOWERCASE, beststr); + V_DrawRightAlignedString(104+72, 68, V_ALLOWLOWERCASE, beststr);*/ // Draw record emblems. em = M_GetLevelEmblems(cv_nextmap.value); @@ -5329,9 +5330,9 @@ void M_DrawTimeAttackMenu(void) { switch (em->type) { - case ET_SCORE: yHeight = 48; break; + //case ET_SCORE: yHeight = 48; break; case ET_TIME: yHeight = 58; break; - case ET_RINGS: yHeight = 68; break; + //case ET_RINGS: yHeight = 68; break; default: goto skipThisOne; } diff --git a/src/p_setup.c b/src/p_setup.c index d22a880e..6cf687fa 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2392,7 +2392,7 @@ static void P_LoadRecordGhosts(void) sprintf(gpath,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(gamemap)); // Best Score ghost - if (cv_ghost_bestscore.value) + /*if (cv_ghost_bestscore.value) { for (i = 0; i < numskins; ++i) { @@ -2402,7 +2402,7 @@ static void P_LoadRecordGhosts(void) if (FIL_FileExists(va("%s-%s-score-best.lmp", gpath, skins[i].name))) G_AddGhost(va("%s-%s-score-best.lmp", gpath, skins[i].name)); } - } + }*/ // Best Time ghost if (cv_ghost_besttime.value) @@ -2418,7 +2418,7 @@ static void P_LoadRecordGhosts(void) } // Best Rings ghost - if (cv_ghost_bestrings.value) + /*if (cv_ghost_bestrings.value) { for (i = 0; i < numskins; ++i) { @@ -2428,7 +2428,7 @@ static void P_LoadRecordGhosts(void) if (FIL_FileExists(va("%s-%s-rings-best.lmp", gpath, skins[i].name))) G_AddGhost(va("%s-%s-rings-best.lmp", gpath, skins[i].name)); } - } + }*/ // Last ghost if (cv_ghost_last.value) @@ -2446,6 +2446,18 @@ static void P_LoadRecordGhosts(void) // Guest ghost if (cv_ghost_guest.value && FIL_FileExists(va("%s-guest.lmp", gpath))) G_AddGhost(va("%s-guest.lmp", gpath)); + + // Staff Attack ghosts + if (cv_ghost_staff.value) + { + lumpnum_t l; + UINT8 i = 1; + while (i <= 99 && (l = W_CheckNumForName(va("%sK%02u",G_BuildMapName(gamemap),i))) != LUMPERROR) + { + G_AddGhost(va("%sK%02u",G_BuildMapName(gamemap),i)); + i++; + } + } free(gpath); } @@ -2476,6 +2488,18 @@ static void P_LoadNightsGhosts(void) if (cv_ghost_guest.value && FIL_FileExists(va("%s-guest.lmp", gpath))) G_AddGhost(va("%s-guest.lmp", gpath)); + // Staff Attack ghosts + if (cv_ghost_staff.value) + { + lumpnum_t l; + UINT8 i = 1; + while (i <= 99 && (l = W_CheckNumForName(va("%sN%02u",G_BuildMapName(gamemap),i))) != LUMPERROR) + { + G_AddGhost(va("%sN%02u",G_BuildMapName(gamemap),i)); + i++; + } + } + free(gpath); }