- hooked up the statistics code with EDuke and RedNukem frontends.

Not sure about the end of game conditions, I wasn't able to test that part yet.
This commit is contained in:
Christoph Oelckers 2019-11-12 22:45:11 +01:00
parent 74ed8fd1d9
commit 6ccef7201e
6 changed files with 31 additions and 5 deletions

View File

@ -397,6 +397,7 @@ static void StoreLevelStats()
void STAT_Update(bool endofgame)
{
if (*StartEpisode == 0) return;
const char* fn = "?";
// record the current level's stats.
StoreLevelStats();
@ -439,9 +440,16 @@ void STAT_Update(bool endofgame)
LevelStatEntry(es, lsection, infostring, LevelData[i].leveltime);
}
SaveStatistics(statfile, EpisodeStatistics);
LevelData.Clear();
*StartEpisode = *LevelName = 0;
}
}
void STAT_Cancel()
{
LevelData.Clear();
*StartEpisode = *LevelName = 0;
}
//==========================================================================
//

View File

@ -0,0 +1,7 @@
#pragma once
void STAT_StartNewGame(const char *episode, int skill);
void STAT_NewLevel(const char* mapname);
void STAT_Update(bool endofgame);
void STAT_Cancel();

View File

@ -44,7 +44,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gameconfigfile.h"
#include "printf.h"
#include "m_argv.h"
#include "filesystem/filesystem.h"
#include "filesystem.h"
#include "statistics.h"
// Uncomment to prevent anything except mirrors from drawing. It is sensible to
// also uncomment ENGINE_CLEAR_SCREEN in build/src/engine_priv.h.
@ -6014,6 +6015,7 @@ static int G_EndOfLevel(void)
{
auto &p = *g_player[myconnectindex].ps;
STAT_Update(ud.eog);
P_SetGamePalette(&p, BASEPAL, 0);
P_UpdateScreenPal(&p);

View File

@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "duke3d.h"
#include "menus.h"
#include "savegame.h"
#include "statistics.h"
BEGIN_DUKE_NS
static uint8_t precachehightile[2][(MAXTILES+7)>>3];
@ -1337,6 +1338,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
ud.secretlevel = 0;
ud.skill_voice = -1;
ud.volume_number = volumeNum;
STAT_StartNewGame(g_volumeNames[volumeNum], skillNum);
g_lastAutoSaveArbitraryID = -1;
g_lastautosave.reset();
@ -1853,7 +1855,7 @@ int G_EnterLevel(int gameMode)
OSD_Printf(OSD_ERROR "Map \"%s\" not found or invalid map version!\n", boardfilename);
return 1;
}
STAT_NewLevel(boardfilename);
G_LoadMapHack(levelName, boardfilename);
G_SetupFilenameBasedMusic(levelName, boardfilename);
}
@ -1864,6 +1866,7 @@ int G_EnterLevel(int gameMode)
}
else
{
STAT_NewLevel(m.filename);
G_LoadMapHack(levelName, m.filename);
}

View File

@ -45,6 +45,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "printf.h"
#include "m_argv.h"
#include "filesystem/filesystem.h"
#include "statistics.h"
// Uncomment to prevent anything except mirrors from drawing. It is sensible to
// also uncomment ENGINE_CLEAR_SCREEN in build/src/engine_priv.h.
@ -7434,7 +7435,8 @@ void G_BackToMenu(void)
static int G_EndOfLevel(void)
{
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
STAT_Update(ud.eog);
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 0);
P_UpdateScreenPal(g_player[myconnectindex].ps);
if (g_player[myconnectindex].ps->gm&MODE_EOL)

View File

@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "demo.h"
#include "savegame.h"
#include "cmdline.h"
#include "statistics.h"
BEGIN_RR_NS
@ -1899,6 +1900,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
ud.player_skill = skillNum;
ud.secretlevel = 0;
ud.from_bonus = 0;
STAT_StartNewGame(g_volumeNames[volumeNum], skillNum);
ud.last_level = -1;
g_lastAutoSaveArbitraryID = -1;
@ -2398,7 +2400,8 @@ int G_EnterLevel(int gameMode)
return 1;
}
G_LoadMapHack(levelName, boardfilename);
STAT_NewLevel(boardfilename);
G_LoadMapHack(levelName, boardfilename);
G_SetupFilenameBasedMusic(levelName, boardfilename, m_level_number);
}
else if (engineLoadBoard(g_mapInfo[mii].filename, VOLUMEONE, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0)
@ -2408,7 +2411,8 @@ int G_EnterLevel(int gameMode)
}
else
{
G_LoadMapHack(levelName, g_mapInfo[mii].filename);
STAT_NewLevel(g_mapInfo[mii].filename);
G_LoadMapHack(levelName, g_mapInfo[mii].filename);
}
if (RR && !RRRA && ud.volume_number == 1 && ud.level_number == 1)