mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 20:42:11 +00:00
get rid of the GetStats interface function.
Now that all data it retrieves is available in shared code it is no longer needed.
This commit is contained in:
parent
19dfd84320
commit
4dcf0fd3c4
11 changed files with 24 additions and 56 deletions
|
@ -74,7 +74,6 @@ struct GameInterface
|
|||
virtual void loadPalette() = 0;
|
||||
virtual void FreeLevelData();
|
||||
virtual void PlayHudSound() {}
|
||||
virtual GameStats getStats() { return {}; }
|
||||
virtual void MenuOpened() {}
|
||||
virtual void MenuClosed() {}
|
||||
virtual void MenuSound(EMenuSounds snd) {}
|
||||
|
|
|
@ -195,8 +195,8 @@ bool WriteSavegame(const char* filename, const char *name)
|
|||
char buf[100];
|
||||
mysnprintf(buf, countof(buf), GAMENAME " %s", GetVersionString());
|
||||
auto savesig = gi->GetSaveSig();
|
||||
auto gs = gi->getStats();
|
||||
FStringf timeStr("%02d:%02d", gs.timesecnd / 60, gs.timesecnd % 60);
|
||||
auto gs = PlayClock / 120;
|
||||
FStringf timeStr("%02d:%02d", gs / 60, gs % 60);
|
||||
auto lev = currentLevel;
|
||||
|
||||
savegameinfo.OpenWriter(true);
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
#include "engineerrors.h"
|
||||
#include "gamestruct.h"
|
||||
#include "printf.h"
|
||||
#include "mapinfo.h"
|
||||
#include "gamecontrol.h"
|
||||
|
||||
CVAR(Int, savestatistics, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR(String, statfile, GAMENAMELOWERCASE "stat.txt", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
@ -65,6 +67,7 @@ struct OneLevel
|
|||
{
|
||||
int totalkills = 0, killcount = 0;
|
||||
int totalsecrets = 0, secretcount = 0;
|
||||
int supersecrets = 0;
|
||||
int leveltime = 0;
|
||||
FString Levelname;
|
||||
};
|
||||
|
@ -137,8 +140,11 @@ static void ParseStatistics(const char *fn, TArray<FStatistics> &statlist)
|
|||
|
||||
int h,m,s;
|
||||
sc.MustGetString();
|
||||
sscanf(sc.String, "%d:%d:%d", &h, &m, &s);
|
||||
session.timeneeded= ((((h*60)+m)*60)+s);
|
||||
if (3 == sscanf(sc.String, "%d:%d:%d", &h, &m, &s))
|
||||
{
|
||||
session.timeneeded = ((((h * 60) + m) * 60) + s);
|
||||
}
|
||||
else session.timeneeded = 0;
|
||||
|
||||
sc.MustGetNumber();
|
||||
session.skill=sc.Number;
|
||||
|
@ -155,8 +161,11 @@ static void ParseStatistics(const char *fn, TArray<FStatistics> &statlist)
|
|||
|
||||
int hour,min,sec;
|
||||
sc.MustGetString();
|
||||
sscanf(sc.String, "%d:%d:%d", &hour, &min, &sec);
|
||||
lstats.timeneeded= ((((hour*60)+min)*60)+sec);
|
||||
if (3 == sscanf(sc.String, "%d:%d:%d", &hour, &min, &sec))
|
||||
{
|
||||
lstats.timeneeded = ((((hour * 60) + min) * 60) + sec);
|
||||
}
|
||||
else lstats.timeneeded = 0;
|
||||
|
||||
lstats.skill = 0;
|
||||
}
|
||||
|
@ -394,12 +403,13 @@ static void StoreLevelStats()
|
|||
LevelData.Reserve(1);
|
||||
LevelData[i].Levelname = LevelName; // should never happen
|
||||
}
|
||||
auto stat = gi->getStats();
|
||||
LevelData[i].totalkills = stat.tkill;
|
||||
LevelData[i].killcount = stat.kill;
|
||||
LevelData[i].totalsecrets = stat.tsecret;
|
||||
LevelData[i].secretcount = stat.secret;
|
||||
LevelData[i].leveltime = stat.timesecnd;
|
||||
SummaryInfo info{};
|
||||
Level.fillSummary(info);
|
||||
LevelData[i].totalkills = info.maxkills;
|
||||
LevelData[i].killcount = info.kills;
|
||||
LevelData[i].totalsecrets = info.maxsecrets;
|
||||
LevelData[i].secretcount = info.secrets;
|
||||
LevelData[i].leveltime = PlayClock / 120;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -449,6 +459,7 @@ void STAT_Update(bool endofgame)
|
|||
FString lsection = ExtractFileBase(LevelData[i].Levelname);
|
||||
lsection.ToUpper();
|
||||
infostring.Format("%4d/%4d, %3d/%3d", LevelData[i].killcount, LevelData[i].totalkills, LevelData[i].secretcount, LevelData[i].totalsecrets);
|
||||
if (LevelData[i].supersecrets > 0) infostring.AppendFormat(":%d", LevelData[i].supersecrets);
|
||||
LevelStatEntry(es, lsection, infostring, LevelData[i].leveltime);
|
||||
}
|
||||
SaveStatistics(statfile, EpisodeStatistics);
|
||||
|
@ -494,6 +505,7 @@ FSerializer& Serialize(FSerializer& arc, const char* key, OneLevel& l, OneLevel*
|
|||
("killcount", l.killcount)
|
||||
("totalsecrets", l.totalsecrets)
|
||||
("secretcount", l.secretcount)
|
||||
("supersecrets", l.supersecrets)
|
||||
("leveltime", l.leveltime)
|
||||
("levelname", l.Levelname)
|
||||
.EndObject();
|
||||
|
|
|
@ -139,8 +139,6 @@ struct GameInterface : public ::GameInterface
|
|||
void reapplyInputBits(InputPacket* const input) override { input->actions |= gPlayer[myconnectindex].input.actions & (~(SB_BUTTON_MASK | SB_RUN | SB_WEAPONMASK_BITS) | SB_CENTERVIEW); }
|
||||
void doPlayerMovement(const float scaleAdjust) override { gameInput.processMovement(&gPlayer[myconnectindex].Angles, scaleAdjust); }
|
||||
unsigned getCrouchState() override;
|
||||
|
||||
GameStats getStats() override;
|
||||
};
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -100,17 +100,6 @@ void viewDrawText(FFont* pFont, const char* pString, int x, int y, int nShade, i
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
GameStats GameInterface::getStats()
|
||||
{
|
||||
return { Level.kills.got, Level.kills.max, Level.secrets.got, Level.secrets.max, gFrameCount / kTicsPerSec, gPlayer[myconnectindex].fragCount };
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void viewDrawAimedPlayerName(PLAYER* pPlayer)
|
||||
{
|
||||
if (!cl_idplayers || (pPlayer->aim.XY().isZero()))
|
||||
|
|
|
@ -30,7 +30,6 @@ struct GameInterface : public ::GameInterface
|
|||
void SetupSpecialTextures(TilesetBuildInfo& info) override;
|
||||
bool GenerateSavePic() override;
|
||||
void PlayHudSound() override;
|
||||
GameStats getStats() override;
|
||||
void MenuOpened() override;
|
||||
void MenuSound(EMenuSounds snd) override;
|
||||
bool CanSave() override;
|
||||
|
|
|
@ -49,19 +49,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
|
|||
BEGIN_DUKE_NS
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// debug output
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
GameStats GameInterface::getStats()
|
||||
{
|
||||
player_struct* p = &ps[myconnectindex];
|
||||
return { Level.kills.got, Level.kills.max, Level.secrets.got, Level.secrets.max, p->player_par / REALGAMETICSPERSEC, p->frag };
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
|
|
@ -524,11 +524,6 @@ bool GameInterface::CanSave()
|
|||
return !bRecord && !bPlayback && !bInDemo && nTotalPlayers == 1 && nFreeze == 0;
|
||||
}
|
||||
|
||||
::GameStats GameInterface::getStats()
|
||||
{
|
||||
return { Level.kills.got, Level.kills.max, Level.secrets.got, Level.secrets.max, PlayClock / 120, 0 };
|
||||
}
|
||||
|
||||
::GameInterface* CreateInterface()
|
||||
{
|
||||
return new GameInterface;
|
||||
|
|
|
@ -242,8 +242,6 @@ struct GameInterface : public ::GameInterface
|
|||
void reapplyInputBits(InputPacket* const input) override { input->actions |= PlayerList[nLocalPlayer].input.actions & SB_CENTERVIEW; }
|
||||
void doPlayerMovement(const float scaleAdjust) override { gameInput.processMovement(&PlayerList[nLocalPlayer].Angles, scaleAdjust); }
|
||||
unsigned getCrouchState() override;
|
||||
|
||||
::GameStats getStats() override;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -818,12 +818,6 @@ int StdRandomRange(int range)
|
|||
return new GameInterface;
|
||||
}
|
||||
|
||||
GameStats GameInterface::getStats()
|
||||
{
|
||||
PLAYER* pp = Player + myconnectindex;
|
||||
return { Level.kills.got, Level.kills.max, Level.secrets.got, Level.secrets.max, PlayClock / 120, 0 };
|
||||
}
|
||||
|
||||
void GameInterface::FreeLevelData()
|
||||
{
|
||||
TerminateLevel();
|
||||
|
|
|
@ -1904,9 +1904,6 @@ struct GameInterface : public ::GameInterface
|
|||
const auto pp = &Player[myconnectindex];
|
||||
gameInput.processMovement(&pp->Angles, scaleAdjust, 0, !pp->sop, pp->sop_control ? (3.f / 1.40625f) : 1.f);
|
||||
}
|
||||
|
||||
|
||||
GameStats getStats() override;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue