Move GP ranking data to grandprixinfo

This commit is contained in:
Sally Coolatta 2023-03-05 19:33:43 -05:00
parent ca178324de
commit 23a00b1d00
8 changed files with 37 additions and 36 deletions

View file

@ -3887,7 +3887,7 @@ static void G_GetNextMap(void)
// Special stage
else if (grandprixinfo.roundnum >= grandprixinfo.cup->numlevels)
{
gp_rank_e grade = K_CalculateGPGrade(&g_gpRank);
gp_rank_e grade = K_CalculateGPGrade(&grandprixinfo.rank);
if (grade >= GRADE_A) // On A rank pace? Then you get a chance for S rank!
{
@ -4117,7 +4117,7 @@ static void G_DoCompleted(void)
G_SetGamestate(GS_NULL);
wipegamestate = GS_NULL;
g_gpRank.position = MAXPLAYERS;
grandprixinfo.rank.position = MAXPLAYERS;
for (i = 0; i < MAXPLAYERS; i++)
{
@ -4147,7 +4147,7 @@ static void G_DoCompleted(void)
if (players[i].bot == false)
{
g_gpRank.position = min(g_gpRank.position, K_GetPodiumPosition(&players[i]));
grandprixinfo.rank.position = min(grandprixinfo.rank.position, K_GetPodiumPosition(&players[i]));
}
}
}
@ -5488,7 +5488,7 @@ void G_SetRetryFlag(void)
{
if (retrying == false)
{
g_gpRank.continuesUsed++;
grandprixinfo.rank.continuesUsed++;
}
retrying = true;

View file

@ -15,14 +15,18 @@
#include "doomdef.h"
#include "doomstat.h"
#include "k_rank.h" // gpRank_t
#ifdef __cplusplus
extern "C" {
#endif
#define GPEVENT_NONE 0
#define GPEVENT_BONUS 1
#define GPEVENT_SPECIAL 2
typedef enum
{
GPEVENT_NONE = 0,
GPEVENT_BONUS,
GPEVENT_SPECIAL,
} gpEvent_e;
extern struct grandprixinfo
{
@ -34,7 +38,8 @@ extern struct grandprixinfo
boolean masterbots; ///< If true, all bots should be max difficulty (Master Mode)
boolean initalize; ///< If true, we need to initialize a new session.
boolean wonround; ///< If false, then we retry the map instead of going to the next.
UINT8 eventmode; ///< See GPEVENT_ constants
gpEvent_e eventmode; ///< Special event mode, bots are set to spectate and a special gametype is played
gpRank_t rank; ///< Struct containing grading information. (See also: k_rank.h)
} grandprixinfo;
/*--------------------------------------------------

View file

@ -4818,22 +4818,22 @@ static void K_DrawGPRankDebugger(void)
return;
}
grade = K_CalculateGPGrade(&g_gpRank);
grade = K_CalculateGPGrade(&grandprixinfo.rank);
V_DrawThinString(0, 0, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE,
va("POS: %d / %d", g_gpRank.position, RANK_NEUTRAL_POSITION));
va("POS: %d / %d", grandprixinfo.rank.position, RANK_NEUTRAL_POSITION));
V_DrawThinString(0, 10, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE,
va("PTS: %d / %d", g_gpRank.winPoints, g_gpRank.totalPoints));
va("PTS: %d / %d", grandprixinfo.rank.winPoints, grandprixinfo.rank.totalPoints));
V_DrawThinString(0, 20, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE,
va("LAPS: %d / %d", g_gpRank.laps, g_gpRank.totalLaps));
va("LAPS: %d / %d", grandprixinfo.rank.laps, grandprixinfo.rank.totalLaps));
V_DrawThinString(0, 30, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE,
va("CONTINUES: %d", g_gpRank.continuesUsed));
va("CONTINUES: %d", grandprixinfo.rank.continuesUsed));
V_DrawThinString(0, 40, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE,
va("CAPSULES: %d / %d", g_gpRank.capsules, g_gpRank.totalCapsules));
va("CAPSULES: %d / %d", grandprixinfo.rank.capsules, grandprixinfo.rank.totalCapsules));
V_DrawThinString(0, 50, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE,
va("RINGS: %d / %d", g_gpRank.rings, g_gpRank.totalRings));
va("RINGS: %d / %d", grandprixinfo.rank.rings, grandprixinfo.rank.totalRings));
V_DrawThinString(0, 60, V_SNAPTOTOP|V_SNAPTOLEFT|V_6WIDTHSPACE|V_ALLOWLOWERCASE,
va("EMERALD: %s", (g_gpRank.specialWon == true) ? "YES" : "NO"));
va("EMERALD: %s", (grandprixinfo.rank.specialWon == true) ? "YES" : "NO"));
switch (grade)
{

View file

@ -50,7 +50,7 @@
static struct podiumData_s
{
boolean ranking;
gpRank_t rankData;
gpRank_t rank;
gp_rank_e grade;
UINT8 state;
UINT8 delay;
@ -280,8 +280,8 @@ void K_ResetCeremony(void)
return;
}
podiumData.rankData = g_gpRank;
podiumData.grade = K_CalculateGPGrade(&podiumData.rankData);
podiumData.rank = grandprixinfo.rank;
podiumData.grade = K_CalculateGPGrade(&podiumData.rank);
}
/*--------------------------------------------------
@ -430,49 +430,49 @@ void K_CeremonyDrawer(void)
case 1:
{
V_DrawString(x, y, V_ALLOWLOWERCASE,
va("POS: %d / %d", podiumData.rankData.position, RANK_NEUTRAL_POSITION)
va("POS: %d / %d", podiumData.rank.position, RANK_NEUTRAL_POSITION)
);
break;
}
case 2:
{
V_DrawString(x, y, V_ALLOWLOWERCASE,
va("PTS: %d / %d", podiumData.rankData.winPoints, podiumData.rankData.totalPoints)
va("PTS: %d / %d", podiumData.rank.winPoints, podiumData.rank.totalPoints)
);
break;
}
case 3:
{
V_DrawString(x, y, V_ALLOWLOWERCASE,
va("LAPS: %d / %d", podiumData.rankData.laps, podiumData.rankData.totalLaps)
va("LAPS: %d / %d", podiumData.rank.laps, podiumData.rank.totalLaps)
);
break;
}
case 4:
{
V_DrawString(x, y, V_ALLOWLOWERCASE,
va("CONTINUES: %d", podiumData.rankData.continuesUsed)
va("CONTINUES: %d", podiumData.rank.continuesUsed)
);
break;
}
case 5:
{
V_DrawString(x, y, V_ALLOWLOWERCASE,
va("CAPSULES: %d / %d", podiumData.rankData.capsules, podiumData.rankData.totalCapsules)
va("CAPSULES: %d / %d", podiumData.rank.capsules, podiumData.rank.totalCapsules)
);
break;
}
case 6:
{
V_DrawString(x, y, V_ALLOWLOWERCASE,
va("RINGS: %d / %d", podiumData.rankData.rings, podiumData.rankData.totalRings)
va("RINGS: %d / %d", podiumData.rank.rings, podiumData.rank.totalRings)
);
break;
}
case 7:
{
V_DrawString(x, y, V_ALLOWLOWERCASE,
va("EMERALD: %s", (podiumData.rankData.specialWon == true) ? "YES" : "NO")
va("EMERALD: %s", (podiumData.rank.specialWon == true) ? "YES" : "NO")
);
break;
}

View file

@ -23,8 +23,6 @@
#include "fastcmp.h"
#include "byteptr.h"
gpRank_t g_gpRank = {0};
// I was ALMOST tempted to start tearing apart all
// of the map loading code and turning it into C++
// and making it properly split between read-only

View file

@ -44,8 +44,6 @@ struct gpRank_t
boolean specialWon;
};
extern gpRank_t g_gpRank;
typedef enum
{
GRADE_E,

View file

@ -7389,7 +7389,7 @@ static void P_InitGametype(void)
{
if (grandprixinfo.initalize == true)
{
K_InitGrandPrixRank(&g_gpRank);
K_InitGrandPrixRank(&grandprixinfo.rank);
K_InitGrandPrixBots();
grandprixinfo.initalize = false;
}

View file

@ -1355,7 +1355,7 @@ void P_DoPlayerExit(player_t *player)
if (RINGTOTAL(player) > 0)
{
player->totalring += RINGTOTAL(player);
g_gpRank.rings += RINGTOTAL(player);
grandprixinfo.rank.rings += RINGTOTAL(player);
extra = player->totalring / lifethreshold;
@ -1369,15 +1369,15 @@ void P_DoPlayerExit(player_t *player)
if (grandprixinfo.eventmode == GPEVENT_NONE)
{
g_gpRank.winPoints += K_CalculateGPRankPoints(player->position, g_gpRank.totalPlayers);
g_gpRank.laps += player->lapPoints;
grandprixinfo.rank.winPoints += K_CalculateGPRankPoints(player->position, grandprixinfo.rank.totalPlayers);
grandprixinfo.rank.laps += player->lapPoints;
}
else if (grandprixinfo.eventmode == GPEVENT_SPECIAL)
{
g_gpRank.specialWon = true;
grandprixinfo.rank.specialWon = true;
}
g_gpRank.capsules += numtargets;
grandprixinfo.rank.capsules += numtargets;
}
}
}