mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Store total wins in profiles
This commit is contained in:
parent
c7c9f145ca
commit
4f569641fc
5 changed files with 26 additions and 33 deletions
|
|
@ -1698,8 +1698,12 @@ static void M_DrawProfileCard(INT32 x, INT32 y, boolean greyedout, profile_t *p)
|
|||
if (greyedout)
|
||||
return; // only used for profiles we can't select.
|
||||
|
||||
V_DrawFixedPatch((x+30)*FRACUNIT, (y+84)*FRACUNIT, FRACUNIT, 0, pwrlv, colormap);
|
||||
V_DrawCenteredKartString(x+30, y+87, 0, "TEMP");
|
||||
if (p != NULL)
|
||||
{
|
||||
V_DrawFixedPatch((x+30)*FRACUNIT, (y+84)*FRACUNIT, FRACUNIT, 0, pwrlv, colormap);
|
||||
V_DrawCenteredKartString(x+30, y+87, 0, va("%d", p->wins));
|
||||
}
|
||||
|
||||
|
||||
// check what setup_player is doing in priority.
|
||||
if (sp->mdepth >= CSSTEP_CHARS)
|
||||
|
|
|
|||
|
|
@ -72,11 +72,7 @@ profile_t* PR_MakeProfile(
|
|||
// Copy from gamecontrol directly as we'll be setting controls up directly in the profile.
|
||||
memcpy(new->controls, controlarray, sizeof(new->controls));
|
||||
|
||||
// Init both power levels
|
||||
for (i = 0; i < PWRLV_NUMTYPES; i++)
|
||||
{
|
||||
new->powerlevels[i] = (guest ? 0 : PWRLVRECORD_START);
|
||||
}
|
||||
new->wins = 0;
|
||||
|
||||
return new;
|
||||
}
|
||||
|
|
@ -270,11 +266,7 @@ void PR_SaveProfiles(void)
|
|||
WRITESTRINGN(save.p, profilesList[i]->follower, SKINNAMESIZE);
|
||||
WRITEUINT16(save.p, profilesList[i]->followercolor);
|
||||
|
||||
// PWR.
|
||||
for (j = 0; j < PWRLV_NUMTYPES; j++)
|
||||
{
|
||||
WRITEUINT16(save.p, profilesList[i]->powerlevels[j]);
|
||||
}
|
||||
WRITEUINT32(save.p, profilesList[i]->wins);
|
||||
|
||||
// Consvars.
|
||||
WRITEUINT8(save.p, profilesList[i]->kickstartaccel);
|
||||
|
|
@ -397,16 +389,18 @@ void PR_LoadProfiles(void)
|
|||
profilesList[i]->followercolor = PROFILEDEFAULTFOLLOWERCOLOR;
|
||||
}
|
||||
|
||||
// PWR.
|
||||
for (j = 0; j < PWRLV_NUMTYPES; j++)
|
||||
// Profile update 4-->5: PWR isn't in profile data anymore.
|
||||
if (version < 5)
|
||||
{
|
||||
profilesList[i]->powerlevels[j] = READUINT16(save.p);
|
||||
if (profilesList[i]->powerlevels[j] < PWRLVRECORD_MIN
|
||||
|| profilesList[i]->powerlevels[j] > PWRLVRECORD_MAX)
|
||||
for (j = 0; j < PWRLV_NUMTYPES; j++)
|
||||
{
|
||||
// invalid, reset
|
||||
profilesList[i]->powerlevels[j] = PWRLVRECORD_START;
|
||||
READUINT16(save.p);
|
||||
}
|
||||
profilesList[i]->wins = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
profilesList[i]->wins = READUINT32(save.p);
|
||||
}
|
||||
|
||||
// Consvars.
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ struct profile_t
|
|||
char follower[SKINNAMESIZE+1]; // Follower
|
||||
UINT16 followercolor; // Follower color
|
||||
|
||||
UINT16 powerlevels[PWRLV_NUMTYPES]; // PWRLV for each gametype.
|
||||
UINT32 wins; // PWRLV for each gametype.
|
||||
|
||||
// Player-specific consvars.
|
||||
// @TODO: List all of those
|
||||
|
|
|
|||
|
|
@ -68,14 +68,6 @@ void SV_SaveStats(void)
|
|||
if (!server)
|
||||
return;
|
||||
|
||||
/*
|
||||
if (profilesList[PROFILE_GUEST] == NULL)
|
||||
{
|
||||
// Profiles have not been loaded yet, don't overwrite with garbage.
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
// header + version + numtracked + payload
|
||||
if (P_SaveBufferAlloc(&save, headerlen + sizeof(UINT32) + sizeof(UINT8) + (numtracked * sizeof(serverplayer_t))) == false)
|
||||
{
|
||||
|
|
@ -92,11 +84,6 @@ void SV_SaveStats(void)
|
|||
|
||||
WRITEMEM(save.p, trackedList, (numtracked * sizeof(serverplayer_t)));
|
||||
|
||||
for (i = 0; i < numtracked; i++)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
length = save.p - save.buffer;
|
||||
|
||||
if (!FIL_WriteFile(va(pandf, srb2home, SERVERSTATSFILE), save.buffer, length))
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
#include "k_rank.h"
|
||||
#include "k_director.h"
|
||||
#include "g_party.h"
|
||||
#include "k_profiles.h"
|
||||
|
||||
#ifdef HW3SOUND
|
||||
#include "hardware/hw3sound.h"
|
||||
|
|
@ -1378,6 +1379,13 @@ void P_DoPlayerExit(player_t *player)
|
|||
if (modeattacking)
|
||||
G_UpdateRecords();
|
||||
|
||||
profile_t *pr = PR_GetPlayerProfile(player);
|
||||
if (pr != NULL && !losing)
|
||||
{
|
||||
pr->wins++;
|
||||
PR_SaveProfiles();
|
||||
}
|
||||
|
||||
player->karthud[khud_cardanimation] = 0; // srb2kart: reset battle animation
|
||||
|
||||
if (player == &players[consoleplayer])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue