Record best lap time in Record Attack

- Record Attack replays now save best lap time
- Removed instances of NiGHTS Attack
- Removed a lot of unlockable that have no use in Kart (ultimate mode,
perfect bonus, score emblems, etc)
- Removed all methods of activating ultimate mode
This commit is contained in:
TehRealSalt 2018-01-21 19:15:26 -05:00
parent 9339b96449
commit 672c4b5298
22 changed files with 406 additions and 317 deletions

View File

@ -940,6 +940,7 @@ static inline void resynch_write_others(resynchend_pak *rst)
rst->numboxes[i] = 0;
rst->totalring[i] = 0;
rst->realtime[i] = 0;
rst->laptime[i] = 0;
rst->laps[i] = 0;
continue;
}
@ -951,6 +952,7 @@ static inline void resynch_write_others(resynchend_pak *rst)
rst->numboxes[i] = SHORT(players[i].numboxes);
rst->totalring[i] = SHORT(players[i].totalring);
rst->realtime[i] = (tic_t)LONG(players[i].realtime);
rst->laptime[i] = (tic_t)LONG(players[i].laptime);
rst->laps[i] = players[i].laps;
}
@ -972,6 +974,7 @@ static inline void resynch_read_others(resynchend_pak *p)
players[i].numboxes = SHORT(p->numboxes[i]);
players[i].totalring = SHORT(p->totalring[i]);
players[i].realtime = (tic_t)LONG(p->realtime[i]);
players[i].laptime = (tic_t)LONG(p->laptime[i]);
players[i].laps = p->laps[i];
}
}

View File

@ -169,6 +169,7 @@ typedef struct
INT16 numboxes[MAXPLAYERS];
INT16 totalring[MAXPLAYERS];
tic_t realtime[MAXPLAYERS];
tic_t laptime[MAXPLAYERS];
UINT8 laps[MAXPLAYERS];
} ATTRPACK resynchend_pak;

View File

@ -1409,11 +1409,11 @@ void D_SRB2Main(void)
return;
}
if (M_CheckParm("-ultimatemode"))
/*if (M_CheckParm("-ultimatemode"))
{
autostart = true;
ultimatemode = true;
}
}*/
if (autostart || netgame || M_CheckParm("+connect") || M_CheckParm("-connect"))
{

View File

@ -751,9 +751,8 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_itemfinder);
// time attack ghost options are also saved to config
CV_RegisterVar(&cv_ghost_bestscore);
CV_RegisterVar(&cv_ghost_besttime);
//CV_RegisterVar(&cv_ghost_bestlap);
CV_RegisterVar(&cv_ghost_bestlap);
CV_RegisterVar(&cv_ghost_last);
CV_RegisterVar(&cv_ghost_guest);
CV_RegisterVar(&cv_ghost_staff);

View File

@ -463,6 +463,7 @@ typedef struct player_s
INT16 numboxes; // Number of item boxes obtained for Race Mode
INT16 totalring; // Total number of rings obtained for Race Mode
tic_t realtime; // integer replacement for leveltime
tic_t laptime; // SRB2kart: Time spent on current lap, used for Record Attack
UINT8 laps; // Number of laps (optional)
////////////////////

View File

@ -2175,16 +2175,16 @@ static void reademblemdata(MYFILE *f, INT32 num)
emblemlocations[num-1].type = ET_GLOBAL;
else if (fastcmp(word2, "SKIN"))
emblemlocations[num-1].type = ET_SKIN;
else if (fastcmp(word2, "SCORE"))
emblemlocations[num-1].type = ET_SCORE;
/*else if (fastcmp(word2, "SCORE"))
emblemlocations[num-1].type = ET_SCORE;*/
else if (fastcmp(word2, "TIME"))
emblemlocations[num-1].type = ET_TIME;
else if (fastcmp(word2, "RINGS"))
/*else if (fastcmp(word2, "RINGS"))
emblemlocations[num-1].type = ET_RINGS;
else if (fastcmp(word2, "NGRADE"))
emblemlocations[num-1].type = ET_NGRADE;
else if (fastcmp(word2, "NTIME"))
emblemlocations[num-1].type = ET_NTIME;
emblemlocations[num-1].type = ET_NTIME;*/
else
emblemlocations[num-1].type = (UINT8)value;
}
@ -2229,24 +2229,24 @@ static void reademblemdata(MYFILE *f, INT32 num)
// Default sprite and color definitions for lazy people like me
if (!emblemlocations[num-1].sprite) switch (emblemlocations[num-1].type)
{
case ET_RINGS:
/*case ET_RINGS:
emblemlocations[num-1].sprite = 'R'; break;
case ET_SCORE: case ET_NGRADE:
emblemlocations[num-1].sprite = 'S'; break;
case ET_TIME: case ET_NTIME:
emblemlocations[num-1].sprite = 'S'; break;*/
case ET_TIME: //case ET_NTIME:
emblemlocations[num-1].sprite = 'T'; break;
default:
emblemlocations[num-1].sprite = 'A'; break;
}
if (!emblemlocations[num-1].color) switch (emblemlocations[num-1].type)
{
case ET_RINGS:
/*case ET_RINGS:
emblemlocations[num-1].color = SKINCOLOR_GOLD; break;
case ET_SCORE:
emblemlocations[num-1].color = SKINCOLOR_BROWN; break;
case ET_NGRADE:
emblemlocations[num-1].color = SKINCOLOR_TEAL; break;
case ET_TIME: case ET_NTIME:
emblemlocations[num-1].color = SKINCOLOR_TEAL; break;*/
case ET_TIME: //case ET_NTIME:
emblemlocations[num-1].color = SKINCOLOR_GREY; break;
default:
emblemlocations[num-1].color = SKINCOLOR_BLUE; break;
@ -2485,25 +2485,25 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
re = atoi(params[1]);
}
else if ((offset=0) || fastcmp(params[0], "GAMECLEAR")
|| (++offset && fastcmp(params[0], "ALLEMERALDS"))
|| (++offset && fastcmp(params[0], "ULTIMATECLEAR")))
|| (++offset && fastcmp(params[0], "ALLEMERALDS")))
//|| (++offset && fastcmp(params[0], "ULTIMATECLEAR")))
{
ty = UC_GAMECLEAR + offset;
re = (params[1]) ? atoi(params[1]) : 1;
}
else if ((offset=0) || fastcmp(params[0], "OVERALLSCORE")
|| (++offset && fastcmp(params[0], "OVERALLTIME"))
|| (++offset && fastcmp(params[0], "OVERALLRINGS")))
else if ((offset=0) || fastcmp(params[0], "OVERALLTIME"))
//|| (++offset && fastcmp(params[0], "OVERALLSCORE"))
//|| (++offset && fastcmp(params[0], "OVERALLRINGS")))
{
PARAMCHECK(1);
ty = UC_OVERALLSCORE + offset;
ty = UC_OVERALLTIME + offset;
re = atoi(params[1]);
}
else if ((offset=0) || fastcmp(params[0], "MAPVISITED")
|| (++offset && fastcmp(params[0], "MAPBEATEN"))
|| (++offset && fastcmp(params[0], "MAPALLEMERALDS"))
|| (++offset && fastcmp(params[0], "MAPULTIMATE"))
|| (++offset && fastcmp(params[0], "MAPPERFECT")))
|| (++offset && fastcmp(params[0], "MAPALLEMERALDS")))
//|| (++offset && fastcmp(params[0], "MAPULTIMATE"))
//|| (++offset && fastcmp(params[0], "MAPPERFECT")))
{
PARAMCHECK(1);
ty = UC_MAPVISITED + offset;
@ -2520,12 +2520,12 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
return;
}
}
else if ((offset=0) || fastcmp(params[0], "MAPSCORE")
|| (++offset && fastcmp(params[0], "MAPTIME"))
|| (++offset && fastcmp(params[0], "MAPRINGS")))
else if ((offset=0) || fastcmp(params[0], "MAPTIME"))
//|| (++offset && fastcmp(params[0], "MAPSCORE"))
//|| (++offset && fastcmp(params[0], "MAPRINGS")))
{
PARAMCHECK(2);
ty = UC_MAPSCORE + offset;
ty = UC_MAPTIME + offset;
re = atoi(params[2]);
// Convert to map number if it appears to be one
@ -2540,7 +2540,7 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
return;
}
}
else if ((offset=0) || fastcmp(params[0], "NIGHTSSCORE")
/*else if ((offset=0) || fastcmp(params[0], "NIGHTSSCORE")
|| (++offset && fastcmp(params[0], "NIGHTSTIME"))
|| (++offset && fastcmp(params[0], "NIGHTSGRADE")))
{
@ -2567,7 +2567,7 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
else
x2 = 0;
}
}*/
else if (fastcmp(params[0], "TRIGGER"))
{
PARAMCHECK(1);

View File

@ -62,7 +62,7 @@ extern boolean metalrecording;
#define ATTACKING_NONE 0
#define ATTACKING_RECORD 1
#define ATTACKING_NIGHTS 2
//#define ATTACKING_NIGHTS 2
extern UINT8 modeattacking;
// menu demo things
@ -343,9 +343,10 @@ extern INT32 nummaprings, nummapboxes, numgotboxes; //keep track of spawned ring
*/
typedef struct
{
tic_t time; ///< Time in which the level was finished.
UINT32 score; ///< Score when the level was finished.
UINT16 rings; ///< Rings when the level was finished.
tic_t time; ///< Time in which the level was finished.
tic_t lap; ///< Best lap time for this level.
//UINT32 score; ///< Score when the level was finished.
//UINT16 rings; ///< Rings when the level was finished.
} recorddata_t;
/** Setup for one NiGHTS map.
@ -359,29 +360,29 @@ typedef struct
#define GRADE_A 5
#define GRADE_S 6
typedef struct
/*typedef struct
{
// 8 mares, 1 overall (0)
UINT8 nummares;
UINT32 score[9];
UINT8 grade[9];
tic_t time[9];
} nightsdata_t;
} nightsdata_t;*/
extern nightsdata_t *nightsrecords[NUMMAPS];
//extern nightsdata_t *nightsrecords[NUMMAPS];
extern recorddata_t *mainrecords[NUMMAPS];
// mapvisited is now a set of flags that says what we've done in the map.
#define MV_VISITED 1
#define MV_BEATEN 2
#define MV_ALLEMERALDS 4
#define MV_ULTIMATE 8
#define MV_PERFECT 16
#define MV_MAX 31 // used in gamedata check
#define MV_VISITED 1
#define MV_BEATEN 2
#define MV_ALLEMERALDS 4
//#define MV_ULTIMATE 8
//#define MV_PERFECT 16
#define MV_MAX 7 // used in gamedata check
extern UINT8 mapvisited[NUMMAPS];
// Temporary holding place for nights data for the current map
nightsdata_t ntemprecords;
//nightsdata_t ntemprecords;
extern UINT32 token; ///< Number of tokens collected in a level
extern UINT32 tokenlist; ///< List of tokens collected
@ -443,12 +444,13 @@ extern UINT8 gamespeed;
extern boolean franticitems;
extern boolean mirrormode;
extern boolean comeback;
extern tic_t bestlap;
extern tic_t hidetime;
extern UINT32 timesBeaten; // # of times the game has been beaten.
extern UINT32 timesBeatenWithEmeralds;
extern UINT32 timesBeatenUltimate;
//extern UINT32 timesBeatenUltimate;
// ===========================
// Internal parameters, fixed.

View File

@ -816,8 +816,8 @@ void F_GameEvaluationDrawer(void)
if (ALL7EMERALDS(emeralds))
++timesBeatenWithEmeralds;
if (ultimatemode)
++timesBeatenUltimate;
/*if (ultimatemode)
++timesBeatenUltimate;*/
if (M_UpdateUnlockablesAndExtraEmblems())
S_StartSound(NULL, sfx_ncitem);

View File

@ -173,11 +173,11 @@ boolean gamedataloaded = false;
// Time attack data for levels
// These are dynamically allocated for space reasons now
recorddata_t *mainrecords[NUMMAPS] = {NULL};
nightsdata_t *nightsrecords[NUMMAPS] = {NULL};
//nightsdata_t *nightsrecords[NUMMAPS] = {NULL};
UINT8 mapvisited[NUMMAPS];
// Temporary holding place for nights data for the current map
nightsdata_t ntemprecords;
//nightsdata_t ntemprecords;
UINT32 bluescore, redscore; // CTF and Team Match team scores
@ -244,13 +244,14 @@ UINT8 gamespeed; // Game's current speed (or difficulty, or cc, or etc); 0-2 for
boolean mirrormode; // Mirror Mode currently enabled?
boolean franticitems; // Frantic items currently enabled?
boolean comeback; // Battle Mode's karma comeback is on/off
tic_t bestlap; // Best lap time, should be local
tic_t hidetime;
// Grading
UINT32 timesBeaten;
UINT32 timesBeatenWithEmeralds;
UINT32 timesBeatenUltimate;
//UINT32 timesBeatenUltimate;
static char demoname[64];
boolean demorecording;
@ -538,12 +539,12 @@ void G_AllocMainRecordData(INT16 i)
memset(mainrecords[i], 0, sizeof(recorddata_t));
}
void G_AllocNightsRecordData(INT16 i)
/*void G_AllocNightsRecordData(INT16 i)
{
if (!nightsrecords[i])
nightsrecords[i] = Z_Malloc(sizeof(nightsdata_t), PU_STATIC, NULL);
memset(nightsrecords[i], 0, sizeof(nightsdata_t));
}
}*/
// MAKE SURE YOU SAVE DATA BEFORE CALLING THIS
void G_ClearRecords(void)
@ -556,22 +557,22 @@ void G_ClearRecords(void)
Z_Free(mainrecords[i]);
mainrecords[i] = NULL;
}
if (nightsrecords[i])
/*if (nightsrecords[i])
{
Z_Free(nightsrecords[i]);
nightsrecords[i] = NULL;
}
}*/
}
}
// For easy retrieval of records
UINT32 G_GetBestScore(INT16 map)
/*UINT32 G_GetBestScore(INT16 map)
{
if (!mainrecords[map-1])
return 0;
return mainrecords[map-1]->score;
}
}*/
tic_t G_GetBestTime(INT16 map)
{
@ -581,15 +582,25 @@ tic_t G_GetBestTime(INT16 map)
return mainrecords[map-1]->time;
}
UINT16 G_GetBestRings(INT16 map)
// Not needed
/*tic_t G_GetBestLap(INT16 map)
{
if (!mainrecords[map-1] || mainrecords[map-1]->lap <= 0)
return (tic_t)UINT32_MAX;
return mainrecords[map-1]->lap;
}*/
/*UINT16 G_GetBestRings(INT16 map)
{
if (!mainrecords[map-1])
return 0;
return mainrecords[map-1]->rings;
}
}*/
UINT32 G_GetBestNightsScore(INT16 map, UINT8 mare)
// No NiGHTS records for SRB2Kart
/*UINT32 G_GetBestNightsScore(INT16 map, UINT8 mare)
{
if (!nightsrecords[map-1])
return 0;
@ -733,7 +744,7 @@ void G_SetNightsRecords(void)
// If the mare count changed, this will update the score display
CV_AddValue(&cv_nextmap, 1);
CV_AddValue(&cv_nextmap, -1);
}
}*/
// for consistency among messages: this modifies the game and removes savemoddata.
void G_SetGameModified(boolean silent)
@ -2254,6 +2265,17 @@ static inline void G_PlayerFinishLevel(INT32 player)
if (rendermode == render_soft)
V_SetPaletteLump(GetPalette()); // Reset the palette
// SRB2kart: Increment the "matches played" counter.
if (player == consoleplayer && ((!modifiedgame || savemoddata) && !demoplayback)) // SRB2kart: Yes, let stuff unlock stuff in MP
{
matchesplayed++;
if (M_UpdateUnlockablesAndExtraEmblems())
{
S_StartSound(NULL, sfx_ncitem);
G_SaveGameData(); // only save if unlocked something
}
}
}
//
@ -2312,6 +2334,7 @@ void G_PlayerReborn(INT32 player)
INT32 balloon;
INT32 comebackpoints;
INT32 comebackshowninfo;
tic_t laptime;
score = players[player].score;
lives = players[player].lives;
@ -2370,6 +2393,7 @@ void G_PlayerReborn(INT32 player)
balloon = players[player].kartstuff[k_balloon];
comebackpoints = players[player].kartstuff[k_comebackpoints];
comebackshowninfo = players[player].kartstuff[k_comebackshowninfo];
laptime = players[player].laptime;
p = &players[player];
memset(p, 0, sizeof (*p));
@ -2432,6 +2456,8 @@ void G_PlayerReborn(INT32 player)
p->kartstuff[k_comebackshowninfo] = comebackshowninfo;
p->kartstuff[k_comebacktimer] = comebacktime;
p->laptime = laptime;
// Don't do anything immediately
p->pflags |= PF_USEDOWN;
p->pflags |= PF_ATTACKDOWN;
@ -3338,12 +3364,13 @@ void G_LoadGameData(void)
UINT8 rtemp;
//For records
UINT32 recscore;
tic_t rectime;
UINT16 recrings;
tic_t rectime;
tic_t reclap;
//UINT32 recscore;
//UINT16 recrings;
UINT8 recmares;
INT32 curmare;
//UINT8 recmares;
//INT32 curmare;
// Clear things so previously read gamedata doesn't transfer
// to new gamedata
@ -3427,29 +3454,31 @@ void G_LoadGameData(void)
timesBeaten = READUINT32(save_p);
timesBeatenWithEmeralds = READUINT32(save_p);
timesBeatenUltimate = READUINT32(save_p);
//timesBeatenUltimate = READUINT32(save_p);
// Main records
for (i = 0; i < NUMMAPS; ++i)
{
recscore = READUINT32(save_p);
rectime = (tic_t)READUINT32(save_p);
recrings = READUINT16(save_p);
rectime = (tic_t)READUINT32(save_p);
reclap = (tic_t)READUINT32(save_p);
//recscore = READUINT32(save_p);
//recrings = READUINT16(save_p);
if (recrings > 10000 || recscore > MAXSCORE)
goto datacorrupt;
/*if (recrings > 10000 || recscore > MAXSCORE)
goto datacorrupt;*/
if (recscore || rectime || recrings)
if (rectime || reclap)
{
G_AllocMainRecordData((INT16)i);
mainrecords[i]->score = recscore;
mainrecords[i]->time = rectime;
mainrecords[i]->rings = recrings;
mainrecords[i]->lap = reclap;
//mainrecords[i]->score = recscore;
//mainrecords[i]->rings = recrings;
}
}
// Nights records
for (i = 0; i < NUMMAPS; ++i)
/*for (i = 0; i < NUMMAPS; ++i)
{
if ((recmares = READUINT8(save_p)) == 0)
continue;
@ -3467,7 +3496,7 @@ void G_LoadGameData(void)
}
nightsrecords[i]->nummares = recmares;
}
}*/
// done
Z_Free(savebuffer);
@ -3500,7 +3529,7 @@ void G_SaveGameData(void)
INT32 i, j;
UINT8 btemp;
INT32 curmare;
//INT32 curmare;
if (!gamedataloaded)
return; // If never loaded (-nodata), don't save
@ -3568,27 +3597,27 @@ void G_SaveGameData(void)
WRITEUINT32(save_p, timesBeaten);
WRITEUINT32(save_p, timesBeatenWithEmeralds);
WRITEUINT32(save_p, timesBeatenUltimate);
//WRITEUINT32(save_p, timesBeatenUltimate);
// Main records
for (i = 0; i < NUMMAPS; i++)
{
if (mainrecords[i])
{
WRITEUINT32(save_p, mainrecords[i]->score);
WRITEUINT32(save_p, mainrecords[i]->time);
WRITEUINT16(save_p, mainrecords[i]->rings);
WRITEUINT32(save_p, mainrecords[i]->lap);
//WRITEUINT32(save_p, mainrecords[i]->score);
//WRITEUINT16(save_p, mainrecords[i]->rings);
}
else
{
WRITEUINT32(save_p, 0);
WRITEUINT32(save_p, 0);
WRITEUINT16(save_p, 0);
}
}
// NiGHTS records
for (i = 0; i < NUMMAPS; i++)
/*for (i = 0; i < NUMMAPS; i++)
{
if (!nightsrecords[i] || !nightsrecords[i]->nummares)
{
@ -3604,7 +3633,7 @@ void G_SaveGameData(void)
WRITEUINT8(save_p, nightsrecords[i]->grade[curmare]);
WRITEUINT32(save_p, nightsrecords[i]->time[curmare]);
}
}
}*/
length = save_p - savebuffer;
@ -4970,12 +4999,13 @@ void G_BeginRecording(void)
case ATTACKING_RECORD: // 1
demotime_p = demo_p;
WRITEUINT32(demo_p,UINT32_MAX); // time
WRITEUINT32(demo_p,UINT32_MAX); // lap
break;
case ATTACKING_NIGHTS: // 2
/*case ATTACKING_NIGHTS: // 2
demotime_p = demo_p;
WRITEUINT32(demo_p,UINT32_MAX); // time
WRITEUINT32(demo_p,0); // score
break;
break;*/
default: // 3
break;
}
@ -5076,21 +5106,22 @@ void G_BeginMetal(void)
oldmetal.angle = mo->angle;
}
void G_SetDemoTime(UINT32 ptime, UINT32 pscore)
void G_SetDemoTime(UINT32 ptime, UINT32 plap)
{
if (!demorecording || !demotime_p)
return;
if (demoflags & DF_RECORDATTACK)
{
WRITEUINT32(demotime_p, ptime);
WRITEUINT32(demotime_p, plap);
demotime_p = NULL;
}
else if (demoflags & DF_NIGHTSATTACK)
/*else if (demoflags & DF_NIGHTSATTACK)
{
WRITEUINT32(demotime_p, ptime);
WRITEUINT32(demotime_p, pscore);
demotime_p = NULL;
}
}*/
}
// Returns bitfield:
@ -5101,7 +5132,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
{
UINT8 *buffer,*p;
UINT8 flags;
UINT32 oldtime, newtime, oldscore, newscore;
UINT32 oldtime, newtime, oldlap, newlap;
UINT16 oldversion;
size_t bufsize ATTRUNUSED;
UINT8 c;
@ -5135,13 +5166,13 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
if (flags & DF_RECORDATTACK)
{
newtime = READUINT32(p);
newscore = 0;
newlap = READUINT32(p);
}
else if (flags & DF_NIGHTSATTACK)
/*else if (flags & DF_NIGHTSATTACK)
{
newtime = READUINT32(p);
newscore = READUINT32(p);
}
}*/
else // appease compiler
return 0;
@ -5195,13 +5226,13 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
if (flags & DF_RECORDATTACK)
{
oldtime = READUINT32(p);
oldscore = 0;
oldlap = READUINT32(p);
}
else if (flags & DF_NIGHTSATTACK)
/*else if (flags & DF_NIGHTSATTACK)
{
oldtime = READUINT32(p);
oldscore = READUINT32(p);
}
}*/
else // appease compiler
return UINT8_MAX;
@ -5209,11 +5240,11 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
c = 0;
if (newtime < oldtime
|| (newtime == oldtime && (newscore > oldscore)))
|| (newtime == oldtime && (newlap < oldlap)))
c |= 1; // Better time
if (newscore > oldscore
|| (newscore == oldscore && newtime < oldtime))
c |= 1<<1; // Better score
if (newlap < oldlap
|| (newlap == oldlap && newtime < oldtime))
c |= 1<<1; // Better lap time
return c;
}
@ -5331,8 +5362,8 @@ void G_DoPlayDemo(char *defdemoname)
modeattacking = (demoflags & DF_ATTACKMASK)>>DF_ATTACKSHIFT;
CON_ToggleOff();
hu_demoscore = 0;
hu_demotime = UINT32_MAX;
hu_demolap = UINT32_MAX;
switch (modeattacking)
{
@ -5340,11 +5371,12 @@ void G_DoPlayDemo(char *defdemoname)
break;
case ATTACKING_RECORD: // 1
hu_demotime = READUINT32(demo_p);
hu_demolap = READUINT32(demo_p);
break;
case ATTACKING_NIGHTS: // 2
/*case ATTACKING_NIGHTS: // 2
hu_demotime = READUINT32(demo_p);
hu_demoscore = READUINT32(demo_p);
break;
break;*/
default: // 3
modeattacking = ATTACKING_NONE;
break;
@ -5560,11 +5592,11 @@ void G_AddGhost(char *defdemoname)
case ATTACKING_NONE: // 0
break;
case ATTACKING_RECORD: // 1
p += 4; // demo time
p += 8; // demo time, lap
break;
case ATTACKING_NIGHTS: // 2
/*case ATTACKING_NIGHTS: // 2
p += 8; // demo time left, score
break;
break;*/
default: // 3
break;
}

View File

@ -60,7 +60,7 @@ extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_fireaxis,cv_
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_fireaxis2,cv_firenaxis2;
extern consvar_t cv_sideaxis3,cv_turnaxis3,cv_moveaxis3,cv_lookaxis3,cv_fireaxis3,cv_firenaxis3;
extern consvar_t cv_sideaxis4,cv_turnaxis4,cv_moveaxis4,cv_lookaxis4,cv_fireaxis4,cv_firenaxis4;
extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_last, cv_ghost_guest, cv_ghost_staff; //cv_ghost_bestlap
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
// mouseaiming (looking up/down with the mouse or keyboard)
#define KB_LOOKSPEED (1<<25)
@ -121,7 +121,7 @@ void G_BeginRecording(void);
void G_BeginMetal(void);
// Only called by shutdown code.
void G_SetDemoTime(UINT32 ptime, UINT32 pscore);
void G_SetDemoTime(UINT32 ptime, UINT32 plap);
UINT8 G_CmpDemoTime(char *oldname, char *newname);
typedef enum
@ -196,18 +196,19 @@ void G_SetGamestate(gamestate_t newstate);
// Gamedata record shit
void G_AllocMainRecordData(INT16 i);
void G_AllocNightsRecordData(INT16 i);
//void G_AllocNightsRecordData(INT16 i);
void G_ClearRecords(void);
UINT32 G_GetBestScore(INT16 map);
//UINT32 G_GetBestScore(INT16 map);
tic_t G_GetBestTime(INT16 map);
UINT16 G_GetBestRings(INT16 map);
UINT32 G_GetBestNightsScore(INT16 map, UINT8 mare);
tic_t G_GetBestNightsTime(INT16 map, UINT8 mare);
UINT8 G_GetBestNightsGrade(INT16 map, UINT8 mare);
//tic_t G_GetBestLap(INT16 map);
//UINT16 G_GetBestRings(INT16 map);
//UINT32 G_GetBestNightsScore(INT16 map, UINT8 mare);
//tic_t G_GetBestNightsTime(INT16 map, UINT8 mare);
//UINT8 G_GetBestNightsGrade(INT16 map, UINT8 mare);
void G_AddTempNightsRecords(UINT32 pscore, tic_t ptime, UINT8 mare);
void G_SetNightsRecords(void);
//void G_AddTempNightsRecords(UINT32 pscore, tic_t ptime, UINT8 mare);
//void G_SetNightsRecords(void);
FUNCMATH INT32 G_TicsToHours(tic_t tics);
FUNCMATH INT32 G_TicsToMinutes(tic_t tics, boolean full);

View File

@ -1101,30 +1101,31 @@ static void HU_drawGametype(void)
//
// demo info stuff
//
UINT32 hu_demoscore;
UINT32 hu_demotime;
UINT32 hu_demolap;
static void HU_DrawDemoInfo(void)
{
UINT8 timeoffset = 8;
V_DrawString(4, 188-16, V_YELLOWMAP, va(M_GetText("%s's replay"), player_names[0]));
if (modeattacking)
{
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- timeoffset, V_YELLOWMAP|V_MONOSPACE, "TIME:");
V_DrawString(4, 188-8, V_YELLOWMAP|V_MONOSPACE, "BEST TIME:");
if (hu_demotime != UINT32_MAX)
V_DrawRightAlignedString(120, 188- timeoffset, V_MONOSPACE, va("%i:%02i.%02i",
V_DrawRightAlignedString(120, 188-8, V_MONOSPACE, va("%i:%02i.%02i",
G_TicsToMinutes(hu_demotime,true),
G_TicsToSeconds(hu_demotime),
G_TicsToCentiseconds(hu_demotime)));
else
V_DrawRightAlignedString(120, 188- timeoffset, V_MONOSPACE, "--:--.--");
V_DrawRightAlignedString(120, 188-8, V_MONOSPACE, "--:--.--");
V_DrawString(4, 188, V_YELLOWMAP|V_MONOSPACE, "BEST LAP:");
if (hu_demolap != UINT32_MAX)
V_DrawRightAlignedString(120, 188, V_MONOSPACE, va("%i:%02i.%02i",
G_TicsToMinutes(hu_demolap,true),
G_TicsToSeconds(hu_demolap),
G_TicsToCentiseconds(hu_demolap)));
else
V_DrawRightAlignedString(120, 188, V_MONOSPACE, "--:--.--");
}
}

View File

@ -118,7 +118,6 @@ void HU_SetCEchoFlags(INT32 flags);
void HU_DoCEcho(const char *msg);
// Demo playback info
extern UINT32 hu_demoscore;
extern UINT32 hu_demotime;
extern UINT16 hu_demorings;
extern UINT32 hu_demolap;
#endif

View File

@ -228,6 +228,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->totalring);
else if (fastcmp(field,"realtime"))
lua_pushinteger(L, plr->realtime);
else if (fastcmp(field,"laptime"))
lua_pushinteger(L, plr->laptime);
else if (fastcmp(field,"laps"))
lua_pushinteger(L, plr->laps);
else if (fastcmp(field,"ctfteam"))
@ -501,6 +503,8 @@ static int player_set(lua_State *L)
plr->totalring = (INT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"realtime"))
plr->realtime = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"laptime"))
plr->laptime = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"laps"))
plr->laps = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"ctfteam"))

View File

@ -58,7 +58,7 @@ typedef struct
// ==========================================================================
// Cheat responders
static UINT8 cheatf_ultimate(void)
/*static UINT8 cheatf_ultimate(void)
{
if (menuactive && (currentMenu != &MainDef && currentMenu != &SP_LoadDef))
return 0; // Only on the main menu, or the save select!
@ -70,7 +70,7 @@ static UINT8 cheatf_ultimate(void)
if (currentMenu == &SP_LoadDef)
M_ForceSaveSlotSelected(NOSAVESLOT);
return 1;
}
}*/
static UINT8 cheatf_warp(void)
{
@ -121,17 +121,17 @@ static UINT8 cheatf_devmode(void)
}
#endif
static cheatseq_t cheat_ultimate = {
/*static cheatseq_t cheat_ultimate = {
0, cheatf_ultimate,
{ SCRAMBLE('u'), SCRAMBLE('l'), SCRAMBLE('t'), SCRAMBLE('i'), SCRAMBLE('m'), SCRAMBLE('a'), SCRAMBLE('t'), SCRAMBLE('e'), 0xff }
};
};*/
static cheatseq_t cheat_ultimate_joy = {
/*static cheatseq_t cheat_ultimate_joy = {
0, cheatf_ultimate,
{ SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_DOWNARROW), SCRAMBLE(KEY_DOWNARROW),
SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_RIGHTARROW), SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_RIGHTARROW),
SCRAMBLE(KEY_ENTER), 0xff }
};
};*/
static cheatseq_t cheat_warp = {
0, cheatf_warp,

View File

@ -106,7 +106,7 @@ emblem_t emblemlocations[MAXEMBLEMS] =
// Default Extra Emblems
extraemblem_t extraemblems[MAXEXTRAEMBLEMS] =
{
{"Experienced Driver", "Play 100 Matches", 10, 'X', SKINCOLOR_BLUE, 0},
{"Experienced Driver", "Play 50 Matches", 10, 'X', SKINCOLOR_BLUE, 0},
};
// Default Unlockables
@ -130,16 +130,16 @@ void M_SetupDefaultConditionSets(void)
{
memset(conditionSets, 0, sizeof(conditionSets));
// -- 1: Collect 5 emblems OR play 25 matches
// -- 1: Collect 5 emblems OR play 10 matches
M_AddRawCondition(1, 1, UC_TOTALEMBLEMS, 5, 0, 0);
M_AddRawCondition(1, 2, UC_MATCHESPLAYED, 25, 0, 0);
M_AddRawCondition(1, 2, UC_MATCHESPLAYED, 10, 0, 0);
// -- 2: Collect 15 emblems OR play 50 matches
// -- 2: Collect 15 emblems OR play 30 matches
M_AddRawCondition(2, 1, UC_TOTALEMBLEMS, 15, 0, 0);
M_AddRawCondition(2, 2, UC_MATCHESPLAYED, 50, 0, 0);
M_AddRawCondition(2, 2, UC_MATCHESPLAYED, 30, 0, 0);
// -- 10: Play 100 matches
M_AddRawCondition(10, 1, UC_TOTALEMBLEMS, 20, 0, 0);
// -- 10: Play 50 matches
M_AddRawCondition(10, 1, UC_TOTALEMBLEMS, 50, 0, 0);
}
void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1, INT16 x2)
@ -190,7 +190,7 @@ void M_ClearSecrets(void)
for (i = 0; i < MAXCONDITIONSETS; ++i)
conditionSets[i].achieved = false;
timesBeaten = timesBeatenWithEmeralds = timesBeatenUltimate = 0;
timesBeaten = timesBeatenWithEmeralds = 0;
// Re-unlock any always unlocked things
M_SilentUpdateUnlockablesAndEmblems();
@ -211,28 +211,28 @@ static UINT8 M_CheckCondition(condition_t *cn)
return (timesBeaten >= (unsigned)cn->requirement);
case UC_ALLEMERALDS: // Requires game beaten with all 7 emeralds >= x times
return (timesBeatenWithEmeralds >= (unsigned)cn->requirement);
case UC_ULTIMATECLEAR: // Requires game beaten on ultimate >= x times (in other words, never)
return (timesBeatenUltimate >= (unsigned)cn->requirement);
case UC_OVERALLSCORE: // Requires overall score >= x
return (M_GotHighEnoughScore(cn->requirement));
/*case UC_ULTIMATECLEAR: // Requires game beaten on ultimate >= x times (in other words, never)
return (timesBeatenUltimate >= (unsigned)cn->requirement);*/
case UC_OVERALLTIME: // Requires overall time <= x
return (M_GotLowEnoughTime(cn->requirement));
/*case UC_OVERALLSCORE: // Requires overall score >= x
return (M_GotHighEnoughScore(cn->requirement));
case UC_OVERALLRINGS: // Requires overall rings >= x
return (M_GotHighEnoughRings(cn->requirement));
return (M_GotHighEnoughRings(cn->requirement));*/
case UC_MAPVISITED: // Requires map x to be visited
return ((mapvisited[cn->requirement - 1] & MV_VISITED) == MV_VISITED);
case UC_MAPBEATEN: // Requires map x to be beaten
return ((mapvisited[cn->requirement - 1] & MV_BEATEN) == MV_BEATEN);
case UC_MAPALLEMERALDS: // Requires map x to be beaten with all emeralds in possession
return ((mapvisited[cn->requirement - 1] & MV_ALLEMERALDS) == MV_ALLEMERALDS);
case UC_MAPULTIMATE: // Requires map x to be beaten on ultimate
/*case UC_MAPULTIMATE: // Requires map x to be beaten on ultimate
return ((mapvisited[cn->requirement - 1] & MV_ULTIMATE) == MV_ULTIMATE);
case UC_MAPPERFECT: // Requires map x to be beaten with a perfect bonus
return ((mapvisited[cn->requirement - 1] & MV_PERFECT) == MV_PERFECT);
case UC_MAPSCORE: // Requires score on map >= x
return (G_GetBestScore(cn->extrainfo1) >= (unsigned)cn->requirement);
return ((mapvisited[cn->requirement - 1] & MV_PERFECT) == MV_PERFECT);*/
case UC_MAPTIME: // Requires time on map <= x
return (G_GetBestTime(cn->extrainfo1) <= (unsigned)cn->requirement);
/*case UC_MAPSCORE: // Requires score on map >= x
return (G_GetBestScore(cn->extrainfo1) >= (unsigned)cn->requirement);
case UC_MAPRINGS: // Requires rings on map >= x
return (G_GetBestRings(cn->extrainfo1) >= cn->requirement);
case UC_NIGHTSSCORE:
@ -240,7 +240,7 @@ static UINT8 M_CheckCondition(condition_t *cn)
case UC_NIGHTSTIME:
return (G_GetBestNightsTime(cn->extrainfo1, (UINT8)cn->extrainfo2) <= (unsigned)cn->requirement);
case UC_NIGHTSGRADE:
return (G_GetBestNightsGrade(cn->extrainfo1, (UINT8)cn->extrainfo2) >= cn->requirement);
return (G_GetBestNightsGrade(cn->extrainfo1, (UINT8)cn->extrainfo2) >= cn->requirement);*/
case UC_TRIGGER: // requires map trigger set
return !!(unlocktriggers & (1 << cn->requirement));
case UC_TOTALEMBLEMS: // Requires number of emblems >= x
@ -409,13 +409,13 @@ UINT8 M_CheckLevelEmblems(void)
switch (emblemlocations[i].type)
{
case ET_SCORE: // Requires score on map >= x
/*case ET_SCORE: // Requires score on map >= x
res = (G_GetBestScore(levelnum) >= (unsigned)valToReach);
break;
break;*/
case ET_TIME: // Requires time on map <= x
res = (G_GetBestTime(levelnum) <= (unsigned)valToReach);
break;
case ET_RINGS: // Requires rings on map >= x
/*case ET_RINGS: // Requires rings on map >= x
res = (G_GetBestRings(levelnum) >= valToReach);
break;
case ET_NGRADE: // Requires NiGHTS grade on map >= x
@ -423,7 +423,7 @@ UINT8 M_CheckLevelEmblems(void)
break;
case ET_NTIME: // Requires NiGHTS time on map <= x
res = (G_GetBestNightsTime(levelnum, 0) <= (unsigned)valToReach);
break;
break;*/
default: // unreachable but shuts the compiler up.
continue;
}
@ -507,7 +507,7 @@ UINT8 M_GotEnoughEmblems(INT32 number)
return false;
}
UINT8 M_GotHighEnoughScore(INT32 tscore)
/*UINT8 M_GotHighEnoughScore(INT32 tscore)
{
INT32 mscore = 0;
INT32 i;
@ -523,7 +523,7 @@ UINT8 M_GotHighEnoughScore(INT32 tscore)
return true;
}
return false;
}
}*/
UINT8 M_GotLowEnoughTime(INT32 tictime)
{
@ -543,7 +543,7 @@ UINT8 M_GotLowEnoughTime(INT32 tictime)
return true;
}
UINT8 M_GotHighEnoughRings(INT32 trings)
/*UINT8 M_GotHighEnoughRings(INT32 trings)
{
INT32 mrings = 0;
INT32 i;
@ -559,7 +559,7 @@ UINT8 M_GotHighEnoughRings(INT32 trings)
return true;
}
return false;
}
}*/
// ----------------
// Misc Emblem shit

View File

@ -21,24 +21,24 @@
typedef enum
{
UC_PLAYTIME, // PLAYTIME [tics]
UC_MATCHESPLAYED, // MATCHESPLAYED [x played]
UC_MATCHESPLAYED, // SRB2Kart: MATCHESPLAYED [x played]
UC_GAMECLEAR, // GAMECLEAR <x times>
UC_ALLEMERALDS, // ALLEMERALDS <x times>
UC_ULTIMATECLEAR, // ULTIMATECLEAR <x times>
UC_OVERALLSCORE, // OVERALLSCORE [score to beat]
//UC_ULTIMATECLEAR, // ULTIMATECLEAR <x times>
//UC_OVERALLSCORE, // OVERALLSCORE [score to beat]
UC_OVERALLTIME, // OVERALLTIME [time to beat, tics]
UC_OVERALLRINGS, // OVERALLRINGS [rings to beat]
//UC_OVERALLRINGS, // OVERALLRINGS [rings to beat]
UC_MAPVISITED, // MAPVISITED [map number]
UC_MAPBEATEN, // MAPBEATEN [map number]
UC_MAPALLEMERALDS, // MAPALLEMERALDS [map number]
UC_MAPULTIMATE, // MAPULTIMATE [map number]
UC_MAPPERFECT, // MAPPERFECT [map number]
UC_MAPSCORE, // MAPSCORE [map number] [score to beat]
//UC_MAPULTIMATE, // MAPULTIMATE [map number]
//UC_MAPPERFECT, // MAPPERFECT [map number]
//UC_MAPSCORE, // MAPSCORE [map number] [score to beat]
UC_MAPTIME, // MAPTIME [map number] [time to beat, tics]
UC_MAPRINGS, // MAPRINGS [map number] [rings to beat]
UC_NIGHTSSCORE, // NIGHTSSCORE [map number] <mare, omit or "0" for overall> [score to beat]
UC_NIGHTSTIME, // NIGHTSTIME [map number] <mare, omit "0" overall> [time to beat, tics]
UC_NIGHTSGRADE, // NIGHTSGRADE [map number] <mare, omit "0" overall> [grade]
//UC_MAPRINGS, // MAPRINGS [map number] [rings to beat]
//UC_NIGHTSSCORE, // NIGHTSSCORE [map number] <mare, omit or "0" for overall> [score to beat]
//UC_NIGHTSTIME, // NIGHTSTIME [map number] <mare, omit "0" overall> [time to beat, tics]
//UC_NIGHTSGRADE, // NIGHTSGRADE [map number] <mare, omit "0" overall> [grade]
UC_TRIGGER, // TRIGGER [trigger number]
UC_TOTALEMBLEMS, // TOTALEMBLEMS [number of emblems]
UC_EMBLEM, // EMBLEM [emblem number]
@ -69,11 +69,11 @@ typedef struct
// Emblem information
#define ET_GLOBAL 0 // Global map emblem, var == color
#define ET_SKIN 1 // Skin specific emblem, var == skin
#define ET_SCORE 2
#define ET_TIME 3
#define ET_RINGS 4
#define ET_NGRADE 5
#define ET_NTIME 6
//#define ET_SCORE 2
#define ET_TIME 2
//#define ET_RINGS 4
//#define ET_NGRADE 5
//#define ET_NTIME 6
typedef struct
{
@ -172,8 +172,8 @@ const char *M_GetExtraEmblemPatch(extraemblem_t *em);
// They stop checking upon reaching the target number so they
// should be (theoretically?) slightly faster.
UINT8 M_GotEnoughEmblems(INT32 number);
UINT8 M_GotHighEnoughScore(INT32 tscore);
//UINT8 M_GotHighEnoughScore(INT32 tscore);
UINT8 M_GotLowEnoughTime(INT32 tictime);
UINT8 M_GotHighEnoughRings(INT32 trings);
//UINT8 M_GotHighEnoughRings(INT32 trings);
#define M_Achieved(a) ((a) >= MAXCONDITIONSETS || conditionSets[a].achieved)

View File

@ -245,14 +245,14 @@ static void M_Statistics(INT32 choice);
static void M_HandleStaffReplay(INT32 choice);
static void M_ReplayTimeAttack(INT32 choice);
static void M_ChooseTimeAttack(INT32 choice);
static void M_ChooseNightsAttack(INT32 choice);
//static void M_ChooseNightsAttack(INT32 choice);
static void M_ModeAttackRetry(INT32 choice);
static void M_ModeAttackEndGame(INT32 choice);
static void M_SetGuestReplay(INT32 choice);
static void M_ChoosePlayer(INT32 choice);
menu_t SP_GameStatsDef, SP_LevelStatsDef;
static menu_t SP_TimeAttackDef, SP_ReplayDef, SP_GuestReplayDef, SP_GhostDef;
static menu_t SP_NightsAttackDef, SP_NightsReplayDef, SP_NightsGuestReplayDef, SP_NightsGhostDef;
//static menu_t SP_NightsAttackDef, SP_NightsReplayDef, SP_NightsGuestReplayDef, SP_NightsGhostDef;
// Multiplayer
#ifndef NONET
@ -338,7 +338,7 @@ static void M_DrawLoad(void);
static void M_DrawLevelStats(void);
static void M_DrawGameStats(void);
static void M_DrawTimeAttackMenu(void);
static void M_DrawNightsAttackMenu(void);
//static void M_DrawNightsAttackMenu(void);
static void M_DrawSetupChoosePlayerMenu(void);
static void M_DrawControl(void);
static void M_DrawVideoMode(void);
@ -378,7 +378,7 @@ static void M_HandleVideoMode(INT32 choice);
// Consvar onchange functions
static void Nextmap_OnChange(void);
static void Newgametype_OnChange(void);
static void Dummymares_OnChange(void);
//static void Dummymares_OnChange(void);
static void Dummystaff_OnChange(void);
// ==========================================================================
@ -435,9 +435,8 @@ static consvar_t cv_autorecord = {"autorecord", "Yes", 0, CV_YesNo, NULL, 0, NUL
CV_PossibleValue_t ghost_cons_t[] = {{0, "Hide"}, {1, "Show"}, {2, "Show All"}, {0, NULL}};
CV_PossibleValue_t ghost2_cons_t[] = {{0, "Hide"}, {1, "Show"}, {0, NULL}};
consvar_t cv_ghost_bestscore = {"ghost_bestscore", "Show All", CV_SAVE, ghost_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ghost_besttime = {"ghost_besttime", "Show All", CV_SAVE, ghost_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
//consvar_t cv_ghost_bestlap = {"ghost_bestlap", "Show All", CV_SAVE, ghost_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ghost_bestlap = {"ghost_bestlap", "Show All", CV_SAVE, ghost_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ghost_last = {"ghost_last", "Show All", 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};
@ -449,9 +448,9 @@ static CV_PossibleValue_t dummyteam_cons_t[] = {{0, "Spectator"}, {1, "Red"}, {2
static CV_PossibleValue_t dummyscramble_cons_t[] = {{0, "Random"}, {1, "Points"}, {0, NULL}};
static CV_PossibleValue_t ringlimit_cons_t[] = {{0, "MIN"}, {9999, "MAX"}, {0, NULL}};
static CV_PossibleValue_t liveslimit_cons_t[] = {{0, "MIN"}, {99, "MAX"}, {0, NULL}};
static CV_PossibleValue_t dummymares_cons_t[] = {
/*static CV_PossibleValue_t dummymares_cons_t[] = {
{-1, "END"}, {0,"Overall"}, {1,"Mare 1"}, {2,"Mare 2"}, {3,"Mare 3"}, {4,"Mare 4"}, {5,"Mare 5"}, {6,"Mare 6"}, {7,"Mare 7"}, {8,"Mare 8"}, {0,NULL}
};
};*/
static CV_PossibleValue_t dummystaff_cons_t[] = {{0, "MIN"}, {100, "MAX"}, {0, NULL}};
static consvar_t cv_dummyteam = {"dummyteam", "Spectator", CV_HIDEN, dummyteam_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -459,7 +458,7 @@ static consvar_t cv_dummyscramble = {"dummyscramble", "Random", CV_HIDEN, dummys
static consvar_t cv_dummyrings = {"dummyrings", "0", CV_HIDEN, ringlimit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static consvar_t cv_dummylives = {"dummylives", "0", CV_HIDEN, liveslimit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static consvar_t cv_dummycontinues = {"dummycontinues", "0", CV_HIDEN, liveslimit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static consvar_t cv_dummymares = {"dummymares", "Overall", CV_HIDEN|CV_CALL, dummymares_cons_t, Dummymares_OnChange, 0, NULL, NULL, 0, 0, NULL};
//static consvar_t cv_dummymares = {"dummymares", "Overall", CV_HIDEN|CV_CALL, dummymares_cons_t, Dummymares_OnChange, 0, NULL, NULL, 0, 0, NULL};
static consvar_t cv_dummystaff = {"dummystaff", "0", CV_HIDEN|CV_CALL, dummystaff_cons_t, Dummystaff_OnChange, 0, NULL, NULL, 0, 0, NULL};
// ==========================================================================
@ -761,7 +760,8 @@ enum
static menuitem_t SP_ReplayMenu[] =
{
{IT_WHITESTRING|IT_CALL, NULL, "Replay Best Time", M_ReplayTimeAttack, 8},
{IT_WHITESTRING|IT_CALL, NULL, "Replay Best Time", M_ReplayTimeAttack, 0},
{IT_WHITESTRING|IT_CALL, NULL, "Replay Best Lap", M_ReplayTimeAttack, 8},
{IT_WHITESTRING|IT_CALL, NULL, "Replay Last", M_ReplayTimeAttack,21},
{IT_WHITESTRING|IT_CALL, NULL, "Replay Guest", M_ReplayTimeAttack,29},
@ -770,7 +770,7 @@ static menuitem_t SP_ReplayMenu[] =
{IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SP_TimeAttackDef, 50}
};
static menuitem_t SP_NightsReplayMenu[] =
/*static menuitem_t SP_NightsReplayMenu[] =
{
{IT_WHITESTRING|IT_CALL, NULL, "Replay Best Score", M_ReplayTimeAttack, 0},
{IT_WHITESTRING|IT_CALL, NULL, "Replay Best Time", M_ReplayTimeAttack,16},
@ -780,11 +780,12 @@ static menuitem_t SP_NightsReplayMenu[] =
{IT_WHITESTRING|IT_KEYHANDLER, NULL, "Replay Staff",M_HandleStaffReplay,37},
{IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SP_NightsAttackDef, 50}
};
};*/
static menuitem_t SP_GuestReplayMenu[] =
{
{IT_WHITESTRING|IT_CALL, NULL, "Save Best Time as Guest", M_SetGuestReplay,16},
{IT_WHITESTRING|IT_CALL, NULL, "Save Best Time as Guest", M_SetGuestReplay, 8},
{IT_WHITESTRING|IT_CALL, NULL, "Save Best Lap as Guest", M_SetGuestReplay,16},
{IT_WHITESTRING|IT_CALL, NULL, "Save Last as Guest", M_SetGuestReplay,24},
{IT_WHITESTRING|IT_CALL, NULL, "Delete Guest Replay", M_SetGuestReplay,37},
@ -792,7 +793,7 @@ static menuitem_t SP_GuestReplayMenu[] =
{IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SP_TimeAttackDef, 50}
};
static menuitem_t SP_NightsGuestReplayMenu[] =
/*static menuitem_t SP_NightsGuestReplayMenu[] =
{
{IT_WHITESTRING|IT_CALL, NULL, "Save Best Score as Guest", M_SetGuestReplay, 8},
{IT_WHITESTRING|IT_CALL, NULL, "Save Best Time as Guest", M_SetGuestReplay,16},
@ -801,11 +802,12 @@ static menuitem_t SP_NightsGuestReplayMenu[] =
{IT_WHITESTRING|IT_CALL, NULL, "Delete Guest Replay", M_SetGuestReplay,37},
{IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SP_NightsAttackDef, 50}
};
};*/
static menuitem_t SP_GhostMenu[] =
{
{IT_STRING|IT_CVAR, NULL, "Best Time", &cv_ghost_besttime, 8},
{IT_STRING|IT_CVAR, NULL, "Best Time", &cv_ghost_besttime, 0},
{IT_STRING|IT_CVAR, NULL, "Best Lap", &cv_ghost_bestlap, 8},
{IT_STRING|IT_CVAR, NULL, "Last", &cv_ghost_last, 16},
{IT_STRING|IT_CVAR, NULL, "Guest", &cv_ghost_guest, 29},
@ -814,7 +816,7 @@ static menuitem_t SP_GhostMenu[] =
{IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SP_TimeAttackDef, 50}
};
static menuitem_t SP_NightsGhostMenu[] =
/*static menuitem_t SP_NightsGhostMenu[] =
{
{IT_STRING|IT_CVAR, NULL, "Best Score", &cv_ghost_bestscore, 0},
{IT_STRING|IT_CVAR, NULL, "Best Time", &cv_ghost_besttime, 8},
@ -824,10 +826,10 @@ static menuitem_t SP_NightsGhostMenu[] =
{IT_STRING|IT_CVAR, NULL, "Staff Attack",&cv_ghost_staff, 37},
{IT_WHITESTRING|IT_SUBMENU, NULL, "Back", &SP_NightsAttackDef, 50}
};
};*/
// Single Player Nights Attack
static menuitem_t SP_NightsAttackMenu[] =
/*static menuitem_t SP_NightsAttackMenu[] =
{
{IT_STRING|IT_CVAR, NULL, "Level", &cv_nextmap, 44},
{IT_STRING|IT_CVAR, NULL, "Show Records For", &cv_dummymares, 54},
@ -836,7 +838,7 @@ static menuitem_t SP_NightsAttackMenu[] =
{IT_DISABLED, NULL, "Replay...", &SP_NightsReplayDef, 118},
{IT_DISABLED, NULL, "Ghosts...", &SP_NightsGhostDef, 128},
{IT_WHITESTRING|IT_CALL|IT_CALL_NOTMODIFIED, NULL, "Start", M_ChooseNightsAttack, 138},
};
};*/
enum
{
@ -1667,7 +1669,7 @@ static menu_t SP_GhostDef =
NULL
};
static menu_t SP_NightsAttackDef =
/*static menu_t SP_NightsAttackDef =
{
"M_NIGHTS",
sizeof (SP_NightsAttackMenu)/sizeof (menuitem_t),
@ -1710,7 +1712,7 @@ static menu_t SP_NightsGhostDef =
32, 120,
0,
NULL
};
};*/
menu_t SP_PlayerDef =
@ -1899,7 +1901,7 @@ static void Nextmap_OnChange(void)
leveltitle = G_BuildMapTitle(cv_nextmap.value);
cv_nextmap.string = cv_nextmap.zstring = leveltitle ? leveltitle : Z_StrDup(G_BuildMapName(cv_nextmap.value));
if (currentMenu == &SP_NightsAttackDef)
/*if (currentMenu == &SP_NightsAttackDef)
{
CV_StealthSetValue(&cv_dummymares, 0);
// Hide the record changing CVAR if only one mare is available.
@ -1960,7 +1962,7 @@ static void Nextmap_OnChange(void)
itemOn = nastart;
}
}
else if (currentMenu == &SP_TimeAttackDef)
else*/ if (currentMenu == &SP_TimeAttackDef)
{
CV_StealthSetValue(&cv_dummystaff, 0);
@ -1971,7 +1973,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 < 4; i++) {
for (i = 0; i < 5; i++) {
SP_ReplayMenu[i].status = IT_DISABLED;
SP_GuestReplayMenu[i].status = IT_DISABLED;
}
@ -1980,18 +1982,23 @@ static void Nextmap_OnChange(void)
SP_GuestReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
active |= 3;
}
if (FIL_FileExists(va("%s-last.lmp", tabase))) {
if (FIL_FileExists(va("%s-lap-best.lmp", tabase))) {
SP_ReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
SP_GuestReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
active |= 3;
}
if (FIL_FileExists(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)))) {
if (FIL_FileExists(va("%s-last.lmp", tabase))) {
SP_ReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
SP_GuestReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
active |= 3;
}
if (FIL_FileExists(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)))) {
SP_ReplayMenu[3].status = IT_WHITESTRING|IT_CALL;
SP_GuestReplayMenu[3].status = IT_WHITESTRING|IT_CALL;
active |= 3;
}
if ((l = W_CheckNumForName(va("%sS01",G_BuildMapName(cv_nextmap.value)))) != LUMPERROR) {
SP_ReplayMenu[3].status = IT_WHITESTRING|IT_KEYHANDLER;
SP_ReplayMenu[4].status = IT_WHITESTRING|IT_KEYHANDLER;
CV_StealthSetValue(&cv_dummystaff, 1);
active |= 1;
}
@ -2013,7 +2020,7 @@ static void Nextmap_OnChange(void)
}
}
static void Dummymares_OnChange(void)
/*static void Dummymares_OnChange(void)
{
if (!nightsrecords[cv_nextmap.value-1])
{
@ -2029,7 +2036,7 @@ static void Dummymares_OnChange(void)
else if (cv_dummymares.value > mares)
CV_StealthSetValue(&cv_dummymares, 0);
}
}
}*/
static void Dummystaff_OnChange(void)
{
@ -2567,7 +2574,7 @@ boolean M_Responder(event_t *ev)
multiplayer = false;
}
if (currentMenu == &SP_TimeAttackDef || currentMenu == &SP_NightsAttackDef)
if (currentMenu == &SP_TimeAttackDef) //|| currentMenu == &SP_NightsAttackDef
{
// D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate.
menuactive = false;
@ -2903,7 +2910,7 @@ void M_Init(void)
CV_RegisterVar(&cv_dummyrings);
CV_RegisterVar(&cv_dummylives);
CV_RegisterVar(&cv_dummycontinues);
CV_RegisterVar(&cv_dummymares);
//CV_RegisterVar(&cv_dummymares);
CV_RegisterVar(&cv_dummystaff);
quitmsg[QUITMSG] = M_GetText("Eggman's tied explosives\nto your girlfriend, and\nwill activate them if\nyou press the 'Y' key!\nPress 'N' to save her!\n\n(Press 'Y' to quit)");
@ -3131,10 +3138,10 @@ static void M_DrawMapEmblems(INT32 mapnum, INT32 x, INT32 y)
{
switch (emblem->type)
{
case ET_SCORE: case ET_TIME: case ET_RINGS:
case ET_TIME: //case ET_SCORE: case ET_RINGS:
curtype = 1; break;
case ET_NGRADE: case ET_NTIME:
curtype = 2; break;
/*case ET_NGRADE: case ET_NTIME:
curtype = 2; break;*/
default:
curtype = 0; break;
}
@ -3350,7 +3357,7 @@ static void M_DrawPauseMenu(void)
switch (emblem->type)
{
case ET_SCORE:
/*case ET_SCORE:
snprintf(targettext, 9, "%d", emblem->var);
snprintf(currenttext, 9, "%u", G_GetBestScore(gamemap));
@ -3358,7 +3365,7 @@ static void M_DrawPauseMenu(void)
currenttext[8] = 0;
emblemslot = 0;
break;
break;*/
case ET_TIME:
emblemslot = emblem->var; // dumb hack
snprintf(targettext, 9, "%i:%02i.%02i",
@ -3380,7 +3387,7 @@ static void M_DrawPauseMenu(void)
emblemslot = 1;
break;
case ET_RINGS:
/*case ET_RINGS:
snprintf(targettext, 9, "%d", emblem->var);
snprintf(currenttext, 9, "%u", G_GetBestRings(gamemap));
@ -3418,7 +3425,7 @@ static void M_DrawPauseMenu(void)
currenttext[8] = 0;
emblemslot = 2;
break;
break;*/
default:
goto bademblem;
}
@ -3447,17 +3454,17 @@ static void M_DrawPauseMenu(void)
switch (emblem->type)
{
case ET_SCORE:
/*case ET_SCORE:
case ET_NGRADE:
V_DrawString(56, 44 + (i*8), V_YELLOWMAP, "SCORE:");
break;
break;*/
case ET_TIME:
case ET_NTIME:
//case ET_NTIME:
V_DrawString(56, 44 + (i*8), V_YELLOWMAP, "TIME:");
break;
case ET_RINGS:
/*case ET_RINGS:
V_DrawString(56, 44 + (i*8), V_YELLOWMAP, "RINGS:");
break;
break;*/
}
V_DrawRightAlignedString(284, 44 + (i*8), V_MONOSPACE, emblem_text[i]);
}
@ -5329,11 +5336,11 @@ static void M_DrawGameStats(void)
char beststr[40];
tic_t besttime = 0;
UINT32 bestscore = 0;
UINT32 bestrings = 0;
//UINT32 bestscore = 0;
//UINT32 bestrings = 0;
INT32 i;
INT32 mapsunfinished[3] = {0, 0, 0};
INT32 mapsunfinished = 0; //INT32 mapsunfinished[3] = {0, 0, 0};
M_DrawMenuTitle();
V_DrawCenteredString(BASEVIDWIDTH/2, 24, V_YELLOWMAP, "PAGE 1 OF 2");
@ -5354,26 +5361,27 @@ static void M_DrawGameStats(void)
if (!mainrecords[i])
{
mapsunfinished[0]++;
/*mapsunfinished[0]++;
mapsunfinished[1]++;
mapsunfinished[2]++;
mapsunfinished[2]++;*/
mapsunfinished++;
continue;
}
if (mainrecords[i]->score > 0)
/*if (mainrecords[i]->score > 0)
bestscore += mainrecords[i]->score;
else
mapsunfinished[0]++;
mapsunfinished[0]++;*/
if (mainrecords[i]->time > 0)
besttime += mainrecords[i]->time;
else
mapsunfinished[1]++;
mapsunfinished++; //mapsunfinished[1]++;
if (mainrecords[i]->rings > 0)
/*if (mainrecords[i]->rings > 0)
bestrings += mainrecords[i]->rings;
else
mapsunfinished[2]++;
mapsunfinished[2]++;*/
}
@ -5388,8 +5396,8 @@ static void M_DrawGameStats(void)
sprintf(beststr, "%i:%02i:%02i.%02i", G_TicsToHours(besttime), G_TicsToMinutes(besttime, false), G_TicsToSeconds(besttime), G_TicsToCentiseconds(besttime));
V_DrawString(32, 140, V_YELLOWMAP, "TIME:");
V_DrawRightAlignedString(BASEVIDWIDTH-32, 140, 0, beststr);
if (mapsunfinished[1])
V_DrawRightAlignedString(BASEVIDWIDTH-32, 148, V_REDMAP, va("(%d unfinished)", mapsunfinished[1]));
if (mapsunfinished)
V_DrawRightAlignedString(BASEVIDWIDTH-32, 148, V_REDMAP, va("(%d unfinished)", mapsunfinished));
/*sprintf(beststr, "%u", bestrings);
V_DrawString(32, 140, V_YELLOWMAP, "RINGS:");
@ -5525,8 +5533,18 @@ void M_DrawTimeAttackMenu(void)
G_TicsToSeconds(mainrecords[cv_nextmap.value-1]->time),
G_TicsToCentiseconds(mainrecords[cv_nextmap.value-1]->time));
V_DrawString(104-72, 58, V_YELLOWMAP, "TIME:");
V_DrawRightAlignedString(104+72, 58, V_ALLOWLOWERCASE, beststr);
V_DrawString(104-72, 53, V_YELLOWMAP, "BEST TIME:");
V_DrawRightAlignedString(104+72, 53, V_ALLOWLOWERCASE, beststr);
if (!mainrecords[cv_nextmap.value-1] || !mainrecords[cv_nextmap.value-1]->lap)
sprintf(beststr, "(none)");
else
sprintf(beststr, "%i:%02i.%02i", G_TicsToMinutes(mainrecords[cv_nextmap.value-1]->lap, true),
G_TicsToSeconds(mainrecords[cv_nextmap.value-1]->lap),
G_TicsToCentiseconds(mainrecords[cv_nextmap.value-1]->lap));
V_DrawString(104-72, 63, V_YELLOWMAP, "BEST LAP:");
V_DrawRightAlignedString(104+72, 63, V_ALLOWLOWERCASE, beststr);
// Draw record emblems.
em = M_GetLevelEmblems(cv_nextmap.value);
@ -5534,8 +5552,7 @@ void M_DrawTimeAttackMenu(void)
{
switch (em->type)
{
//case ET_SCORE: yHeight = 48; break;
case ET_TIME: yHeight = 58; break;
case ET_TIME: yHeight = 53; break;
default:
goto skipThisOne;
}
@ -5602,7 +5619,7 @@ static void M_TimeAttack(INT32 choice)
}
// Drawing function for Nights Attack
void M_DrawNightsAttackMenu(void)
/*void M_DrawNightsAttackMenu(void)
{
patch_t *PictureOfLevel;
lumpnum_t lumpnum;
@ -5704,7 +5721,7 @@ void M_DrawNightsAttackMenu(void)
y + SP_NightsAttackMenu[0].alphaKey, V_YELLOWMAP|V_TRANSLUCENT, ncv->string);
}
}
}
}*/
// Going to Nights Attack menu...
/*static void M_NightsAttack(INT32 choice)
@ -5735,7 +5752,7 @@ void M_DrawNightsAttackMenu(void)
}*/
// Player has selected the "START" from the nights attack screen
static void M_ChooseNightsAttack(INT32 choice)
/*static void M_ChooseNightsAttack(INT32 choice)
{
char nameofdemo[256];
(void)choice;
@ -5754,7 +5771,7 @@ static void M_ChooseNightsAttack(INT32 choice)
G_RecordDemo(nameofdemo);
G_DeferedInitNew(false, G_BuildMapName(cv_nextmap.value), 0, 0, false);
}
}*/
// Player has selected the "START" from the time attack screen
static void M_ChooseTimeAttack(INT32 choice)
@ -5844,12 +5861,15 @@ static void M_ReplayTimeAttack(INT32 choice)
case 0: // best time
which = "time-best";
break;
case 1: // last
case 1: // best lap
which = "lap-best";
break;
case 2: // last
which = "last";
break;
case 2: // best staff
case 3: // best staff
return; // M_HandleStaffReplay
case 3: // guest
case 4: // 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;
@ -5857,7 +5877,7 @@ static void M_ReplayTimeAttack(INT32 choice)
// srb2/replay/main/map01-sonic-time-best.lmp
G_DoPlayDemo(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), cv_chooseskin.string, which));
}
else if (currentMenu == &SP_NightsReplayDef)
/*else if (currentMenu == &SP_NightsReplayDef)
{
switch(choice) {
default:
@ -5878,7 +5898,7 @@ static void M_ReplayTimeAttack(INT32 choice)
}
// srb2/replay/main/map01-score-best.lmp
G_DoPlayDemo(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), which));
}
}*/
}
static void M_EraseGuest(INT32 choice)
@ -5887,24 +5907,21 @@ static void M_EraseGuest(INT32 choice)
(void)choice;
if (FIL_FileExists(rguest))
remove(rguest);
if (currentMenu == &SP_NightsGuestReplayDef)
/*if (currentMenu == &SP_NightsGuestReplayDef)
M_SetupNextMenu(&SP_NightsAttackDef);
else
else*/
M_SetupNextMenu(&SP_TimeAttackDef);
CV_AddValue(&cv_nextmap, -1);
CV_AddValue(&cv_nextmap, 1);
M_StartMessage(M_GetText("Guest replay data erased.\n"),NULL,MM_NOTHING);
}
static void M_OverwriteGuest(const char *which, boolean nights)
static void M_OverwriteGuest(const char *which)
{
char *rguest = Z_StrDup(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)));
UINT8 *buf;
size_t len;
if (!nights)
len = FIL_ReadFile(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), cv_chooseskin.string, which), &buf);
else
len = FIL_ReadFile(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), which), &buf);
len = FIL_ReadFile(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), cv_chooseskin.string, which), &buf);
if (!len) {
return;
}
@ -5914,9 +5931,9 @@ static void M_OverwriteGuest(const char *which, boolean nights)
}
FIL_WriteFile(rguest, buf, len);
Z_Free(rguest);
if (currentMenu == &SP_NightsGuestReplayDef)
/*if (currentMenu == &SP_NightsGuestReplayDef)
M_SetupNextMenu(&SP_NightsAttackDef);
else
else*/
M_SetupNextMenu(&SP_TimeAttackDef);
CV_AddValue(&cv_nextmap, -1);
CV_AddValue(&cv_nextmap, 1);
@ -5926,45 +5943,49 @@ static void M_OverwriteGuest(const char *which, boolean nights)
static void M_OverwriteGuest_Time(INT32 choice)
{
(void)choice;
M_OverwriteGuest("time-best", currentMenu == &SP_NightsGuestReplayDef);
M_OverwriteGuest("time-best");
}
static void M_OverwriteGuest_Lap(INT32 choice)
{
(void)choice;
M_OverwriteGuest("lap-best");
}
/* SRB2Kart
static void M_OverwriteGuest_Score(INT32 choice)
{
(void)choice;
M_OverwriteGuest("score-best", currentMenu == &SP_NightsGuestReplayDef);
M_OverwriteGuest("score-best");
}
/* // srb2kart
static void M_OverwriteGuest_Rings(INT32 choice)
{
(void)choice;
M_OverwriteGuest("rings-best", false);
M_OverwriteGuest("rings-best");
}*/
static void M_OverwriteGuest_Last(INT32 choice)
{
(void)choice;
M_OverwriteGuest("last", currentMenu == &SP_NightsGuestReplayDef);
M_OverwriteGuest("last");
}
static void M_SetGuestReplay(INT32 choice)
{
void (*which)(INT32);
if (currentMenu == &SP_TimeAttackDef && choice <= 0)
choice++; // skip best score
switch(choice)
{
case 0: // best score
which = M_OverwriteGuest_Score;
break;
case 1: // best time
case 0: // best time
which = M_OverwriteGuest_Time;
break;
case 3: // last
case 1: // best lap
which = M_OverwriteGuest_Lap;
break;
case 2: // last
which = M_OverwriteGuest_Last;
break;
case 4: // guest
case 3: // guest
default:
M_StartMessage(M_GetText("Are you sure you want to\ndelete the guest replay data?\n\n(Press 'Y' to confirm)\n"),M_EraseGuest,MM_YESNO);
return;
@ -5981,8 +6002,8 @@ static void M_ModeAttackRetry(INT32 choice)
G_CheckDemoStatus(); // Cancel recording
if (modeattacking == ATTACKING_RECORD)
M_ChooseTimeAttack(0);
else if (modeattacking == ATTACKING_NIGHTS)
M_ChooseNightsAttack(0);
/*else if (modeattacking == ATTACKING_NIGHTS)
M_ChooseNightsAttack(0);*/
}
static void M_ModeAttackEndGame(INT32 choice)
@ -6000,9 +6021,9 @@ static void M_ModeAttackEndGame(INT32 choice)
case ATTACKING_RECORD:
currentMenu = &SP_TimeAttackDef;
break;
case ATTACKING_NIGHTS:
/*case ATTACKING_NIGHTS:
currentMenu = &SP_NightsAttackDef;
break;
break;*/
}
itemOn = currentMenu->lastOn;
G_SetGamestate(GS_TIMEATTACK);

View File

@ -182,6 +182,7 @@ static void P_NetArchivePlayers(void)
WRITEINT16(save_p, players[i].numboxes);
WRITEINT16(save_p, players[i].totalring);
WRITEUINT32(save_p, players[i].realtime);
WRITEUINT32(save_p, players[i].laptime); // SRB2kart
WRITEUINT8(save_p, players[i].laps);
////////////////////
@ -198,6 +199,7 @@ static void P_NetArchivePlayers(void)
WRITEINT16(save_p, players[i].starposty);
WRITEINT16(save_p, players[i].starpostz);
WRITEINT32(save_p, players[i].starpostnum);
WRITEINT32(save_p, players[i].starpostcount);
WRITEANGLE(save_p, players[i].starpostangle);
WRITEANGLE(save_p, players[i].angle_pos);
@ -365,6 +367,7 @@ static void P_NetUnArchivePlayers(void)
players[i].numboxes = READINT16(save_p); // Number of item boxes obtained for Race Mode
players[i].totalring = READINT16(save_p); // Total number of rings obtained for Race Mode
players[i].realtime = READUINT32(save_p); // integer replacement for leveltime
players[i].laptime = READUINT32(save_p); // SRB2kart: used to track best lap time
players[i].laps = READUINT8(save_p); // Number of laps (optional)
////////////////////
@ -381,6 +384,7 @@ static void P_NetUnArchivePlayers(void)
players[i].starposty = READINT16(save_p);
players[i].starpostz = READINT16(save_p);
players[i].starpostnum = READINT32(save_p);
players[i].starpostcount = READINT32(save_p);
players[i].starpostangle = READANGLE(save_p);
players[i].angle_pos = READANGLE(save_p);
@ -3230,6 +3234,12 @@ static void P_NetArchiveMisc(void)
WRITEUINT32(save_p, hidetime);
// SRB2kart
WRITEUINT8(save_p, gamespeed);
WRITEUINT8(save_p, mirrormode);
WRITEUINT8(save_p, franticitems);
WRITEUINT8(save_p, comeback);
// Is it paused?
if (paused)
WRITEUINT8(save_p, 0x2f);
@ -3307,6 +3317,12 @@ static inline boolean P_NetUnArchiveMisc(void)
hidetime = READUINT32(save_p);
// SRB2kart
gamespeed = READUINT8(save_p);
mirrormode = (boolean)READUINT8(save_p);
franticitems = (boolean)READUINT8(save_p);
comeback = (boolean)READUINT8(save_p);
// Is it paused?
if (READUINT8(save_p) == 0x2f)
paused = true;

View File

@ -2190,7 +2190,7 @@ static void P_LevelInitStuff(void)
// special stage
stagefailed = false;
// Reset temporary record data
memset(&ntemprecords, 0, sizeof(nightsdata_t));
//memset(&ntemprecords, 0, sizeof(nightsdata_t));
// earthquake camera
memset(&quake,0,sizeof(struct quake));
@ -2204,6 +2204,7 @@ static void P_LevelInitStuff(void)
}
players[i].realtime = countdown = countdown2 = 0;
players[i].laptime = 0; // SRB2Kart
players[i].gotcontinue = false;
@ -2434,19 +2435,6 @@ 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)
{
for (i = 0; i < numskins; ++i)
{
if (cv_ghost_bestscore.value == 1 && players[consoleplayer].skin != i)
continue;
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)
{
@ -2460,8 +2448,8 @@ static void P_LoadRecordGhosts(void)
}
}
// Best lap ghost
/*if (cv_ghost_bestlap.value)
// Best Lap ghost
if (cv_ghost_bestlap.value)
{
for (i = 0; i < numskins; ++i)
{
@ -2471,7 +2459,7 @@ static void P_LoadRecordGhosts(void)
if (FIL_FileExists(va("%s-%s-lap-best.lmp", gpath, skins[i].name)))
G_AddGhost(va("%s-%s-lap-best.lmp", gpath, skins[i].name));
}
}*/
}
// Last ghost
if (cv_ghost_last.value)
@ -2505,7 +2493,7 @@ static void P_LoadRecordGhosts(void)
free(gpath);
}
static void P_LoadNightsGhosts(void)
/*static void P_LoadNightsGhosts(void)
{
const size_t glen = strlen(srb2home)+1+strlen("replay")+1+strlen(timeattackfolder)+1+strlen("MAPXX")+1;
char *gpath = malloc(glen);
@ -2544,7 +2532,7 @@ static void P_LoadNightsGhosts(void)
}
free(gpath);
}
}*/
/** Loads a level from a lump or external wad.
*
@ -2843,8 +2831,8 @@ boolean P_SetupLevel(boolean skipprecip)
if (modeattacking == ATTACKING_RECORD && !demoplayback)
P_LoadRecordGhosts();
else if (modeattacking == ATTACKING_NIGHTS && !demoplayback)
P_LoadNightsGhosts();
/*else if (modeattacking == ATTACKING_NIGHTS && !demoplayback)
P_LoadNightsGhosts();*/
if (G_TagGametype())
{

View File

@ -4156,6 +4156,10 @@ DoneSection2:
CONS_Printf(M_GetText("%s started lap %u\n"), player_names[player-players], (UINT32)player->laps+1);
}
// SRB2Kart: save best lap for record attack
bestlap = player->laptime;
player->laptime = 0;
// Reset starposts (checkpoints) info
// SRB2kart 200117
player->starpostangle = player->starpostnum = 0;

View File

@ -732,8 +732,8 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
}
// Add score to leaderboards now
if (!(netgame||multiplayer) && P_IsLocalPlayer(&players[i]))
G_AddTempNightsRecords(players[i].marescore, leveltime - player->marebegunat, players[i].mare + 1);
/*if (!(netgame||multiplayer) && P_IsLocalPlayer(&players[i]))
G_AddTempNightsRecords(players[i].marescore, leveltime - player->marebegunat, players[i].mare + 1);*/
// transfer scores anyway
players[i].lastmarescore = players[i].marescore;
@ -755,8 +755,8 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
player->finishedrings = (INT16)(player->health - 1);
// Add score to temp leaderboards
if (!(netgame||multiplayer) && P_IsLocalPlayer(player))
G_AddTempNightsRecords(player->marescore, leveltime - player->marebegunat, (UINT8)(oldmare + 1));
/*if (!(netgame||multiplayer) && P_IsLocalPlayer(player))
G_AddTempNightsRecords(player->marescore, leveltime - player->marebegunat, (UINT8)(oldmare + 1));*/
// Starting a new mare, transfer scores
player->lastmarescore = player->marescore;
@ -1645,19 +1645,6 @@ void P_DoPlayerExit(player_t *player)
if (player->exiting)
return;
// SRB2kart: Increment the "matches played" counter.
// Why here of all places instead of the intermission screen?!?
// To prevent someone from using "exitlevel" to unlock everything!
if (player == &players[consoleplayer] && ((!modifiedgame || savemoddata) && !demoplayback)) // SRB2kart: Unlock stuff in MP
{
matchesplayed++;
if (M_UpdateUnlockablesAndExtraEmblems())
{
S_StartSound(NULL, sfx_ncitem);
G_SaveGameData(); // only save if unlocked something
}
}
if (gametype == GT_RACE || gametype == GT_COMPETITION) // If in Race Mode, allow
{
// SRB2kart 120217
@ -8097,9 +8084,18 @@ static void P_DeathThink(player_t *player)
if (!(countdown2 && !countdown) && !player->exiting && !(player->pflags & PF_TIMEOVER))
{
if (leveltime >= 4*TICRATE)
{
player->realtime = leveltime - 4*TICRATE;
if (player->spectator || !circuitmap)
player->laptime = 0;
else
player->laptime++; // This is too complicated to sync to realtime, just sorta hope for the best :V
}
else
{
player->realtime = 0;
player->laptime = 0;
}
}
if ((gametype == GT_RACE || gametype == GT_COMPETITION || (gametype == GT_COOP && (multiplayer || netgame))) && (player->lives <= 0))
@ -9407,9 +9403,18 @@ void P_PlayerThink(player_t *player)
if (!player->exiting)
{
if (leveltime >= 4*TICRATE)
{
player->realtime = leveltime - 4*TICRATE;
if (player->spectator || !circuitmap)
player->laptime = 0;
else
player->laptime++; // This is too complicated to sync to realtime, just sorta hope for the best :V
}
else
{
player->realtime = 0;
player->laptime = 0;
}
}
if ((netgame || splitscreen) && player->spectator && cmd->buttons & BT_ATTACK && !player->powers[pw_flashing])

View File

@ -907,10 +907,13 @@ static void Y_UpdateRecordReplays(void)
if ((mainrecords[gamemap-1]->time == 0) || (players[consoleplayer].realtime < mainrecords[gamemap-1]->time))
mainrecords[gamemap-1]->time = players[consoleplayer].realtime;
if ((mainrecords[gamemap-1]->lap == 0) || (bestlap < mainrecords[gamemap-1]->lap))
mainrecords[gamemap-1]->lap = bestlap;
// Save demo!
bestdemo[255] = '\0';
lastdemo[255] = '\0';
G_SetDemoTime(players[consoleplayer].realtime, 0);
G_SetDemoTime(players[consoleplayer].realtime, bestlap);
G_CheckDemoStatus();
I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755);
@ -936,6 +939,15 @@ 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-lap-best.lmp", gpath, cv_chooseskin.string);
if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & (1<<1))
{ // Better lap time, 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 RECORD LAP!"), M_GetText("Saved replay as"), bestdemo);
}
//CONS_Printf("%s '%s'\n", M_GetText("Saved replay as"), lastdemo);
Z_Free(buf);
@ -1033,7 +1045,7 @@ void Y_StartIntermission(void)
{
case int_nights:
// Can't fail
G_SetNightsRecords();
//G_SetNightsRecords();
// Check records
{
@ -1059,10 +1071,10 @@ void Y_StartIntermission(void)
mapvisited[gamemap-1] |= MV_BEATEN;
if (ALL7EMERALDS(emeralds))
mapvisited[gamemap-1] |= MV_ALLEMERALDS;
if (ultimatemode)
/*if (ultimatemode)
mapvisited[gamemap-1] |= MV_ULTIMATE;
if (data.coop.gotperfbonus)
mapvisited[gamemap-1] |= MV_PERFECT;
mapvisited[gamemap-1] |= MV_PERFECT;*/
if (modeattacking == ATTACKING_RECORD)
Y_UpdateRecordReplays();
@ -1313,10 +1325,10 @@ void Y_StartIntermission(void)
mapvisited[gamemap-1] |= MV_BEATEN;
if (ALL7EMERALDS(emeralds))
mapvisited[gamemap-1] |= MV_ALLEMERALDS;
if (ultimatemode)
/*if (ultimatemode)
mapvisited[gamemap-1] |= MV_ULTIMATE;
if (data.coop.gotperfbonus)
mapvisited[gamemap-1] |= MV_PERFECT;
mapvisited[gamemap-1] |= MV_PERFECT;*/
if (modeattacking == ATTACKING_RECORD)
Y_UpdateRecordReplays();