From 540bea911a84a18f0f12a538c1ea0c74ff4840bd Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 15 Oct 2017 02:33:28 -0400 Subject: [PATCH 1/6] First, minor steps to Record Attack support To-Do: - fix demo desync (desync is only super noticeable on slopes, but a message pops up when the player starts moving regardless) - fix ghosts not appearing - replace that dumb level tally - remove a bunch of things that made the assumption that race & record attack would never mix (ex: "next map x doesn't support race mode, using map y anyway" message) --- src/d_clisrv.c | 2 +- src/d_netcmd.c | 2 ++ src/g_game.c | 27 +++++---------------------- src/m_cond.c | 4 ++-- src/p_mobj.c | 10 ++-------- src/p_setup.c | 2 +- 6 files changed, 13 insertions(+), 34 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index d5300e06..a9690f0d 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3241,7 +3241,7 @@ void SV_StartSinglePlayerServer(void) server = true; netgame = false; multiplayer = false; - gametype = GT_COOP; + gametype = GT_RACE; //srb2kart // no more tic the game with this settings! SV_StopServer(); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 435bbfe4..a6b3b66a 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1863,6 +1863,8 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum) // a copy of color if (players[0].mo) players[0].mo->color = players[0].skincolor; + + CV_StealthSetValue(&cv_kartcc, 150); // srb2kart } if (metalrecording) G_BeginMetal(); diff --git a/src/g_game.c b/src/g_game.c index b03c4ccd..3ab801ab 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3816,8 +3816,8 @@ char *G_BuildMapTitle(INT32 mapnum) // DEMO RECORDING // -#define DEMOVERSION 0x0009 -#define DEMOHEADER "\xF0" "SRB2Replay" "\x0F" +#define DEMOVERSION 0x0001 +#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! @@ -4991,8 +4991,6 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname) switch(oldversion) // demoversion { case DEMOVERSION: // latest always supported - // compatibility available? - case 0x0008: break; // too old, cannot support. default: @@ -5007,10 +5005,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname) Z_Free(buffer); return UINT8_MAX; } p += 4; // "PLAY" - if (oldversion <= 0x0008) - p++; // gamemap - else - p += 2; // gamemap + p += 2; // gamemap p += 16; // mapmd5 flags = READUINT8(p); if (!(flags & aflags)) @@ -5131,8 +5126,6 @@ void G_DoPlayDemo(char *defdemoname) switch(demoversion) { case DEMOVERSION: // latest always supported - // compatibility available? - case 0x0008: break; // too old, cannot support. default: @@ -5158,10 +5151,7 @@ void G_DoPlayDemo(char *defdemoname) return; } demo_p += 4; // "PLAY" - if (demoversion <= 0x0008) - gamemap = READUINT8(demo_p); - else - gamemap = READINT16(demo_p); + gamemap = READINT16(demo_p); demo_p += 16; // mapmd5 demoflags = READUINT8(demo_p); @@ -5361,8 +5351,6 @@ void G_AddGhost(char *defdemoname) switch(ghostversion) { case DEMOVERSION: // latest always supported - // compatibility available? - case 0x0008: break; // too old, cannot support. default: @@ -5387,10 +5375,7 @@ void G_AddGhost(char *defdemoname) Z_Free(buffer); return; } p += 4; // "PLAY" - if (ghostversion <= 0x0008) - p++; // gamemap - else - p += 2; // gamemap + p += 2; // gamemap p += 16; // mapmd5 (possibly check for consistency?) flags = READUINT8(p); if (!(flags & DF_GHOST)) @@ -5591,8 +5576,6 @@ void G_DoPlayMetal(void) switch(metalversion) { case DEMOVERSION: // latest always supported - // compatibility available? - case 0x0008: break; // too old, cannot support. default: diff --git a/src/m_cond.c b/src/m_cond.c index 2ec30f42..c67930d9 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -574,8 +574,8 @@ extraemblem_t extraemblems[MAXEXTRAEMBLEMS] = unlockable_t unlockables[MAXUNLOCKABLES] = { // Name, Objective, Menu Height, ConditionSet, Unlock Type, Variable, NoCecho, NoChecklist - /* 01 */ {"Record Attack", "Complete Greenflower Zone, Act 1", 0, 1, SECRET_RECORDATTACK, 0, true, true, 0}, - /* 02 */ {"NiGHTS Mode", "Complete Floral Field", 0, 2, SECRET_NIGHTSMODE, 0, true, true, 0}, + /* 01 */ {"Record Attack", "Complete Greenflower Zone, Act 1", 0, -1, SECRET_RECORDATTACK, 0, true, true, 0}, + /* 02 */ {"NiGHTS Mode", "Complete Floral Field", 0, -1, SECRET_NIGHTSMODE, 0, true, true, 0}, /* 03 */ {"Play Credits", "Complete 1P Mode", 30, 10, SECRET_CREDITS, 0, true, true, 0}, /* 04 */ {"Sound Test", "Complete 1P Mode", 40, 10, SECRET_SOUNDTEST, 0, false, false, 0}, diff --git a/src/p_mobj.c b/src/p_mobj.c index 90c2cdf8..1199339c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8920,9 +8920,7 @@ void P_RespawnSpecials(void) mapthing_t *mthing = NULL; // only respawn items when cv_itemrespawn is on - if (!(netgame || multiplayer) // Never respawn in single player - || gametype == GT_COOP // Never respawn in co-op gametype - || !cv_itemrespawn.value) // cvar is turned off + if (!cv_itemrespawn.value) return; // Don't respawn in special stages! @@ -9505,12 +9503,8 @@ void P_SpawnMapThing(mapthing_t *mthing) if (modeattacking) // Record Attack special stuff { - // Don't spawn starposts that wouldn't be usable - if (i == MT_STARPOST) - return; - // Emerald Tokens -->> Score Tokens - else if (i == MT_EMMY) + if (i == MT_EMMY) return; /// \todo // 1UPs -->> Score TVs diff --git a/src/p_setup.c b/src/p_setup.c index de0172eb..6996ab0e 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -224,7 +224,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) DEH_WriteUndoline("LEVELFLAGS", va("%d", mapheaderinfo[num]->levelflags), UNDO_NONE); mapheaderinfo[num]->levelflags = 0; DEH_WriteUndoline("MENUFLAGS", va("%d", mapheaderinfo[num]->menuflags), UNDO_NONE); - mapheaderinfo[num]->menuflags = 0; + mapheaderinfo[num]->menuflags = LF2_RECORDATTACK|LF2_NOVISITNEEDED; // 0 // TODO grades support for delfile (pfft yeah right) P_DeleteGrades(num); // an even further impossibility, delfile custom opts support From 3e74ac2b97f7b881b242418429497e29dafe31c5 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 16 Oct 2017 07:11:48 -0400 Subject: [PATCH 2/6] Ghost scale fix --- src/g_game.c | 2 +- src/g_game.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 3ab801ab..0e357e47 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4019,7 +4019,7 @@ void G_GhostAddColor(ghostcolor_t color) ghostext.color = (UINT8)color; } -void G_GhostAddScale(UINT16 scale) +void G_GhostAddScale(fixed_t scale) { if (!demorecording || !(demoflags & DF_GHOST)) return; diff --git a/src/g_game.h b/src/g_game.h index 6d412551..ada82404 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -139,7 +139,7 @@ void G_GhostAddSpin(void); void G_GhostAddRev(void); void G_GhostAddColor(ghostcolor_t color); void G_GhostAddFlip(void); -void G_GhostAddScale(UINT16 scale); +void G_GhostAddScale(fixed_t scale); void G_GhostAddHit(mobj_t *victim); void G_WriteGhostTic(mobj_t *ghost); void G_ConsGhostTic(void); From b5e0a80c359e45a08c6cae864193da2c6ea9a216 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 16 Oct 2017 17:52:42 -0400 Subject: [PATCH 3/6] Oho, here's the problem! Too many fixed_t! --- src/g_game.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 0e357e47..7c0b2d41 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4831,8 +4831,8 @@ void G_BeginRecording(void) WRITEUINT8(demo_p,player->mindash>>FRACBITS); WRITEUINT8(demo_p,player->maxdash>>FRACBITS); // SRB2kart - WRITEUINT8(demo_p,player->kartspeed>>FRACBITS); - WRITEUINT8(demo_p,player->kartweight>>FRACBITS); + WRITEUINT8(demo_p,player->kartspeed); + WRITEUINT8(demo_p,player->kartweight); // WRITEUINT8(demo_p,player->normalspeed>>FRACBITS); WRITEUINT8(demo_p,player->runspeed>>FRACBITS); @@ -5062,9 +5062,9 @@ void G_DoPlayDemo(char *defdemoname) UINT8 i; lumpnum_t l; char skin[17],color[17],*n,*pdemoname; - UINT8 version,subversion,charability,charability2,thrustfactor,accelstart,acceleration; + UINT8 version,subversion,charability,charability2,kartspeed,kartweight,thrustfactor,accelstart,acceleration; UINT32 randseed; - fixed_t actionspd,mindash,maxdash,kartspeed,kartweight,normalspeed,runspeed,jumpfactor; + fixed_t actionspd,mindash,maxdash,normalspeed,runspeed,jumpfactor; char msg[1024]; skin[16] = '\0'; @@ -5201,8 +5201,8 @@ void G_DoPlayDemo(char *defdemoname) mindash = (fixed_t)READUINT8(demo_p)< Date: Mon, 16 Oct 2017 20:23:26 -0400 Subject: [PATCH 4/6] Some cleanup No longer save score/rings, use the Race tally as a placeholder replacement for the butchered vanilla one --- src/g_game.c | 30 ++++++++-------------------- src/g_game.h | 2 +- src/hu_stuff.c | 24 ++++++++++------------ src/m_menu.c | 54 ++++++++++++++++++++------------------------------ src/y_inter.c | 51 +++++++++++++++++++++++------------------------ 5 files changed, 66 insertions(+), 95 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 7c0b2d41..e99b6420 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -645,7 +645,7 @@ void G_SetNightsRecords(void) // Save demo! bestdemo[255] = '\0'; lastdemo[255] = '\0'; - G_SetDemoTime(totaltime, totalscore, 0); + G_SetDemoTime(totaltime, totalscore); G_CheckDemoStatus(); I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755); @@ -2939,7 +2939,7 @@ static void G_DoCompleted(void) // a map of the proper gametype -- skip levels that don't support // the current gametype. (Helps avoid playing boss levels in Race, // for instance). - if (!token && !G_IsSpecialStage(gamemap) + if (!token && !G_IsSpecialStage(gamemap) && !modeattacking && (nextmap >= 0 && nextmap < NUMMAPS)) { register INT16 cm = nextmap; @@ -4786,8 +4786,6 @@ void G_BeginRecording(void) case ATTACKING_RECORD: // 1 demotime_p = demo_p; WRITEUINT32(demo_p,UINT32_MAX); // time - WRITEUINT32(demo_p,0); // score - WRITEUINT16(demo_p,0); // rings break; case ATTACKING_NIGHTS: // 2 demotime_p = demo_p; @@ -4894,15 +4892,13 @@ void G_BeginMetal(void) oldmetal.angle = mo->angle; } -void G_SetDemoTime(UINT32 ptime, UINT32 pscore, UINT16 prings) +void G_SetDemoTime(UINT32 ptime, UINT32 pscore) { if (!demorecording || !demotime_p) return; if (demoflags & DF_RECORDATTACK) { WRITEUINT32(demotime_p, ptime); - WRITEUINT32(demotime_p, pscore); - WRITEUINT16(demotime_p, prings); demotime_p = NULL; } else if (demoflags & DF_NIGHTSATTACK) @@ -4922,7 +4918,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname) UINT8 *buffer,*p; UINT8 flags; UINT32 oldtime, newtime, oldscore, newscore; - UINT16 oldrings, newrings, oldversion; + UINT16 oldversion; size_t bufsize ATTRUNUSED; UINT8 c; UINT16 s ATTRUNUSED; @@ -4955,14 +4951,12 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname) if (flags & DF_RECORDATTACK) { newtime = READUINT32(p); - newscore = READUINT32(p); - newrings = READUINT16(p); + newscore = 0; } else if (flags & DF_NIGHTSATTACK) { newtime = READUINT32(p); newscore = READUINT32(p); - newrings = 0; } else // appease compiler return 0; @@ -5017,14 +5011,12 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname) if (flags & DF_RECORDATTACK) { oldtime = READUINT32(p); - oldscore = READUINT32(p); - oldrings = READUINT16(p); + oldscore = 0; } else if (flags & DF_NIGHTSATTACK) { oldtime = READUINT32(p); oldscore = READUINT32(p); - oldrings = 0; } else // appease compiler return UINT8_MAX; @@ -5033,14 +5025,11 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname) c = 0; if (newtime < oldtime - || (newtime == oldtime && (newscore > oldscore || newrings > oldrings))) + || (newtime == oldtime && (newscore > oldscore))) c |= 1; // Better time if (newscore > oldscore || (newscore == oldscore && newtime < oldtime)) c |= 1<<1; // Better score - if (newrings > oldrings - || (newrings == oldrings && newtime < oldtime)) - c |= 1<<2; // Better rings return c; } @@ -5160,7 +5149,6 @@ void G_DoPlayDemo(char *defdemoname) hu_demoscore = 0; hu_demotime = UINT32_MAX; - hu_demorings = 0; switch (modeattacking) { @@ -5168,8 +5156,6 @@ void G_DoPlayDemo(char *defdemoname) break; case ATTACKING_RECORD: // 1 hu_demotime = READUINT32(demo_p); - hu_demoscore = READUINT32(demo_p); - hu_demorings = READUINT16(demo_p); break; case ATTACKING_NIGHTS: // 2 hu_demotime = READUINT32(demo_p); @@ -5390,7 +5376,7 @@ void G_AddGhost(char *defdemoname) case ATTACKING_NONE: // 0 break; case ATTACKING_RECORD: // 1 - p += 10; // demo time, score, and rings + p += 4; // demo time break; case ATTACKING_NIGHTS: // 2 p += 8; // demo time left, score diff --git a/src/g_game.h b/src/g_game.h index ada82404..79fc3e5b 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -120,7 +120,7 @@ void G_BeginRecording(void); void G_BeginMetal(void); // Only called by shutdown code. -void G_SetDemoTime(UINT32 ptime, UINT32 pscore, UINT16 prings); +void G_SetDemoTime(UINT32 ptime, UINT32 pscore); UINT8 G_CmpDemoTime(char *oldname, char *newname); typedef enum diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 857094ab..286bf4b0 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1038,30 +1038,28 @@ static void HU_drawGametype(void) // UINT32 hu_demoscore; UINT32 hu_demotime; -UINT16 hu_demorings; static void HU_DrawDemoInfo(void) { - V_DrawString(4, 188-24, V_YELLOWMAP, va(M_GetText("%s's replay"), player_names[0])); + UINT8 timeoffset = 8; + V_DrawString(4, 188-16, V_YELLOWMAP, va(M_GetText("%s's replay"), player_names[0])); if (modeattacking) { - V_DrawString(4, 188-16, V_YELLOWMAP|V_MONOSPACE, "SCORE:"); - V_DrawRightAlignedString(120, 188-16, V_MONOSPACE, va("%d", hu_demoscore)); + if (modeattacking == ATTACKING_NIGHTS) + { + V_DrawString(4, 188-8, V_YELLOWMAP|V_MONOSPACE, "SCORE:"); + V_DrawRightAlignedString(120, 188-8, V_MONOSPACE, va("%d", hu_demoscore)); + timeoffset = 0; + } - V_DrawString(4, 188- 8, V_YELLOWMAP|V_MONOSPACE, "TIME:"); + V_DrawString(4, 188- timeoffset, V_YELLOWMAP|V_MONOSPACE, "TIME:"); if (hu_demotime != UINT32_MAX) - V_DrawRightAlignedString(120, 188- 8, V_MONOSPACE, va("%i:%02i.%02i", + V_DrawRightAlignedString(120, 188- timeoffset, V_MONOSPACE, va("%i:%02i.%02i", G_TicsToMinutes(hu_demotime,true), G_TicsToSeconds(hu_demotime), G_TicsToCentiseconds(hu_demotime))); else - V_DrawRightAlignedString(120, 188- 8, V_MONOSPACE, "--:--.--"); - - if (modeattacking == ATTACKING_RECORD) - { - V_DrawString(4, 188 , V_YELLOWMAP|V_MONOSPACE, "RINGS:"); - V_DrawRightAlignedString(120, 188 , V_MONOSPACE, va("%d", hu_demorings)); - } + V_DrawRightAlignedString(120, 188- timeoffset, V_MONOSPACE, "--:--.--"); } } diff --git a/src/m_menu.c b/src/m_menu.c index 3fde232a..df34b1f2 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -111,14 +111,14 @@ const char *quitmsg[NUM_QUITMESSAGES]; // Stuff for customizing the player select screen Tails 09-22-2003 description_t description[32] = { - {"\x82Sonic\x80 is the fastest of the three, but also the hardest to control. Beginners beware, but experts will find Sonic very powerful.\n\n\x82""Ability:\x80 Speed Thok\nDouble jump to zoom forward with a huge burst of speed.\n\n\x82Tip:\x80 Simply letting go of forward does not slow down in SRB2. To slow down, hold the opposite direction.", "", "sonic"}, - {"\x82Tails\x80 is the most mobile of the three, but has the slowest speed. Because of his mobility, he's well-\nsuited to beginners.\n\n\x82""Ability:\x80 Fly\nDouble jump to start flying for a limited time. Repetitively hit the jump button to ascend.\n\n\x82Tip:\x80 To quickly descend while flying, hit the spin button.", "", "tails"}, - {"\x82Knuckles\x80 is well-\nrounded and can destroy breakable walls simply by touching them, but he can't jump as high as the other two.\n\n\x82""Ability:\x80 Glide & Climb\nDouble jump to glide in the air as long as jump is held. Glide into a wall to climb it.\n\n\x82Tip:\x80 Press spin while climbing to jump off the wall; press jump instead to jump off\nand face away from\nthe wall.", "", "knuckles"}, - {"\x82Sonic & Tails\x80 team up to take on Dr. Eggman!\nControl Sonic while Tails desperately struggles to keep up.\n\nPlayer 2 can control Tails directly by setting the controls in the options menu.\nTails's directional controls are relative to Player 1's camera.\n\nTails can pick up Sonic while flying and carry him around.", "CHRS&T", "sonic&tails"}, - {"???", "", ""}, - {"???", "", ""}, - {"???", "", ""}, - {"???", "", ""}, + {"\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"}, {"???", "", ""}, {"???", "", ""}, {"???", "", ""}, @@ -723,9 +723,7 @@ enum static menuitem_t SP_ReplayMenu[] = { - {IT_WHITESTRING|IT_CALL, NULL, "Replay Best Score", M_ReplayTimeAttack, 0}, - {IT_WHITESTRING|IT_CALL, NULL, "Replay Best Time", M_ReplayTimeAttack, 8}, - {IT_WHITESTRING|IT_CALL, NULL, "Replay Best Rings", M_ReplayTimeAttack,16}, + {IT_WHITESTRING|IT_CALL, NULL, "Replay Best Time", M_ReplayTimeAttack, 16}, {IT_WHITESTRING|IT_CALL, NULL, "Replay Last", M_ReplayTimeAttack,29}, {IT_WHITESTRING|IT_CALL, NULL, "Replay Guest", M_ReplayTimeAttack,37}, @@ -1829,7 +1827,7 @@ static void Nextmap_OnChange(void) // Check if file exists, if not, disable REPLAY option sprintf(tabase,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), cv_chooseskin.string); - for (i = 0; i < 5; i++) { + for (i = 0; i < 3; i++) { SP_ReplayMenu[i].status = IT_DISABLED; SP_GuestReplayMenu[i].status = IT_DISABLED; } @@ -1838,26 +1836,16 @@ static void Nextmap_OnChange(void) SP_GuestReplayMenu[0].status = IT_WHITESTRING|IT_CALL; active = true; } - if (FIL_FileExists(va("%s-score-best.lmp", tabase))) { + if (FIL_FileExists(va("%s-last.lmp", tabase))) { SP_ReplayMenu[1].status = IT_WHITESTRING|IT_CALL; SP_GuestReplayMenu[1].status = IT_WHITESTRING|IT_CALL; active = true; } - if (FIL_FileExists(va("%s-rings-best.lmp", tabase))) { + if (FIL_FileExists(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)))) { SP_ReplayMenu[2].status = IT_WHITESTRING|IT_CALL; SP_GuestReplayMenu[2].status = IT_WHITESTRING|IT_CALL; active = true; } - if (FIL_FileExists(va("%s-last.lmp", tabase))) { - SP_ReplayMenu[3].status = IT_WHITESTRING|IT_CALL; - SP_GuestReplayMenu[3].status = IT_WHITESTRING|IT_CALL; - active = true; - } - if (FIL_FileExists(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)))) { - SP_ReplayMenu[4].status = IT_WHITESTRING|IT_CALL; - SP_GuestReplayMenu[4].status = IT_WHITESTRING|IT_CALL; - active = true; - } if (active) { SP_TimeAttackMenu[taguest].status = IT_WHITESTRING|IT_SUBMENU; SP_TimeAttackMenu[tareplay].status = IT_WHITESTRING|IT_SUBMENU; @@ -5588,19 +5576,16 @@ static void M_ReplayTimeAttack(INT32 choice) { switch(choice) { default: - case 0: // best score - which = "score-best"; - break; - case 1: // best time + case 0: // best time which = "time-best"; break; - case 2: // best rings - which = "rings-best"; - break; - case 3: // last + case 1: // last which = "last"; break; - case 4: // guest + /*case 2: // best staff + which = "staff-best"; + break;*/ + case 2: // guest // srb2/replay/main/map01-guest.lmp G_DoPlayDemo(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value))); return; @@ -5621,6 +5606,9 @@ static void M_ReplayTimeAttack(INT32 choice) case 2: // last which = "last"; break; + /*case 3: // best staff + which = "staff-best"; + break;*/ case 3: // guest which = "guest"; break; diff --git a/src/y_inter.c b/src/y_inter.c index c23cf735..67c85851 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -846,7 +846,10 @@ void Y_Ticker(void) if (r) S_StartSound(NULL, sfx_menu1); else - endtic = intertic + 3*TICRATE; // 3 second pause after end of tally + if (modeattacking) + endtic = intertic + 10*TICRATE; // 10 second pause after end of tally + else + endtic = intertic + 3*TICRATE; // 3 second pause after end of tally } else if (intertype == int_match || intertype == int_ctf || intertype == int_teammatch) // match { @@ -883,19 +886,13 @@ static void Y_UpdateRecordReplays(void) if (!mainrecords[gamemap-1]) G_AllocMainRecordData(gamemap-1); - if (players[consoleplayer].score > mainrecords[gamemap-1]->score) - mainrecords[gamemap-1]->score = players[consoleplayer].score; - if ((mainrecords[gamemap-1]->time == 0) || (players[consoleplayer].realtime < mainrecords[gamemap-1]->time)) mainrecords[gamemap-1]->time = players[consoleplayer].realtime; - if ((UINT16)(players[consoleplayer].health - 1) > mainrecords[gamemap-1]->rings) - mainrecords[gamemap-1]->rings = (UINT16)(players[consoleplayer].health - 1); - // Save demo! bestdemo[255] = '\0'; lastdemo[255] = '\0'; - G_SetDemoTime(players[consoleplayer].realtime, players[consoleplayer].score, (UINT16)(players[consoleplayer].health-1)); + G_SetDemoTime(players[consoleplayer].realtime, 0); G_CheckDemoStatus(); I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755); @@ -921,24 +918,6 @@ static void Y_UpdateRecordReplays(void) CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD TIME!"), M_GetText("Saved replay as"), bestdemo); } - snprintf(bestdemo, 255, "%s-%s-score-best.lmp", gpath, cv_chooseskin.string); - if (!FIL_FileExists(bestdemo) || (G_CmpDemoTime(bestdemo, lastdemo) & (1<<1))) - { // Better score, save this demo. - if (FIL_FileExists(bestdemo)) - remove(bestdemo); - FIL_WriteFile(bestdemo, buf, len); - CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW HIGH SCORE!"), M_GetText("Saved replay as"), bestdemo); - } - - snprintf(bestdemo, 255, "%s-%s-rings-best.lmp", gpath, cv_chooseskin.string); - if (!FIL_FileExists(bestdemo) || (G_CmpDemoTime(bestdemo, lastdemo) & (1<<2))) - { // Better rings, save this demo. - if (FIL_FileExists(bestdemo)) - remove(bestdemo); - FIL_WriteFile(bestdemo, buf, len); - CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW MOST RINGS!"), M_GetText("Saved replay as"), bestdemo); - } - //CONS_Printf("%s '%s'\n", M_GetText("Saved replay as"), lastdemo); Z_Free(buf); @@ -980,9 +959,11 @@ void Y_StartIntermission(void) else intertype = (maptol & TOL_NIGHTS) ? int_nights : int_coop; */ + /* // srb2kart: time attack tally is UGLY rn if (modeattacking) intertype = int_timeattack; else + */ intertype = int_race; } else @@ -1286,6 +1267,24 @@ void Y_StartIntermission(void) case int_race: // (time-only race) { + if ((!modifiedgame || savemoddata) && !multiplayer && !demoplayback) // remove this once we have a proper time attack screen + { + // setup time data + data.coop.tics = players[consoleplayer].realtime; + + // Update visitation flags + mapvisited[gamemap-1] |= MV_BEATEN; + if (ALL7EMERALDS(emeralds)) + mapvisited[gamemap-1] |= MV_ALLEMERALDS; + if (ultimatemode) + mapvisited[gamemap-1] |= MV_ULTIMATE; + if (data.coop.gotperfbonus) + mapvisited[gamemap-1] |= MV_PERFECT; + + if (modeattacking == ATTACKING_RECORD) + Y_UpdateRecordReplays(); + } + // Calculate who won Y_CalculateTournamentPoints(); From 3994008d31fdd46f896bbce61575a6718e18f436 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 17 Oct 2017 23:14:51 -0400 Subject: [PATCH 5/6] 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); } From eda571e2d38c7ee7fc800ba230f2e1bb07a1e7e4 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 17 Oct 2017 23:55:44 -0400 Subject: [PATCH 6/6] Really minor tweaks --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 92abcff4..2aefc2d8 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -111,7 +111,7 @@ const char *quitmsg[NUM_QUITMESSAGES]; // Stuff for customizing the player select screen Tails 09-22-2003 description_t description[32] = { - {"\x82Sonic\x80", "", "sonic"}, + {"\x82Sonic\x80\n\x82Speed:\x80 6\n\x82Weight:\x80 4", "", "sonic"}, {"???", "", ""}, {"???", "", ""}, {"???", "", ""},