mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Factor out generation of strings for time values in the bonus screen. This involves the creation of ud.playerbest.
git-svn-id: https://svn.eduke32.com/eduke32@4968 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
c5b3cfa445
commit
d7f846d0b6
8 changed files with 87 additions and 52 deletions
|
@ -3377,6 +3377,11 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
|
||||||
invalidatetile(CROSSHAIR, -1, -1);
|
invalidatetile(CROSSHAIR, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline size_t G_LastMapInfoIndex(void)
|
||||||
|
{
|
||||||
|
return ud.volume_number*MAXLEVELS + ud.last_level - 1;
|
||||||
|
}
|
||||||
|
|
||||||
#define SCORESHEETOFFSET -20
|
#define SCORESHEETOFFSET -20
|
||||||
static void G_ShowScores(void)
|
static void G_ShowScores(void)
|
||||||
{
|
{
|
||||||
|
@ -3385,7 +3390,7 @@ static void G_ShowScores(void)
|
||||||
if (playerswhenstarted > 1 && (GametypeFlags[ud.coop]&GAMETYPE_SCORESHEET))
|
if (playerswhenstarted > 1 && (GametypeFlags[ud.coop]&GAMETYPE_SCORESHEET))
|
||||||
{
|
{
|
||||||
gametext(160,SCORESHEETOFFSET+58+2,"Multiplayer Totals",0,2+8+16);
|
gametext(160,SCORESHEETOFFSET+58+2,"Multiplayer Totals",0,2+8+16);
|
||||||
gametext(160,SCORESHEETOFFSET+58+10,MapInfo[(ud.volume_number*MAXLEVELS)+ud.last_level-1].name,0,2+8+16);
|
gametext(160,SCORESHEETOFFSET+58+10,MapInfo[G_LastMapInfoIndex()].name,0,2+8+16);
|
||||||
|
|
||||||
t = 0;
|
t = 0;
|
||||||
minitext(70,SCORESHEETOFFSET+80,"Name",8,2+8+16+ROTATESPRITE_MAX);
|
minitext(70,SCORESHEETOFFSET+80,"Name",8,2+8+16+ROTATESPRITE_MAX);
|
||||||
|
@ -12400,7 +12405,7 @@ static void G_DisplayMPResultsScreen(void)
|
||||||
if (PLUTOPAK) // JBF 20030804
|
if (PLUTOPAK) // JBF 20030804
|
||||||
rotatesprite_fs((260)<<16,36<<16,65536L,0,PLUTOPAKSPRITE+2,0,0,2+8);
|
rotatesprite_fs((260)<<16,36<<16,65536L,0,PLUTOPAKSPRITE+2,0,0,2+8);
|
||||||
gametext(160,58+2,"Multiplayer Totals",0,2+8+16);
|
gametext(160,58+2,"Multiplayer Totals",0,2+8+16);
|
||||||
gametext(160,58+10,MapInfo[(ud.volume_number*MAXLEVELS)+ud.last_level-1].name,0,2+8+16);
|
gametext(160,58+10,MapInfo[G_LastMapInfoIndex()].name,0,2+8+16);
|
||||||
|
|
||||||
gametext(160,165,"Press any key or button to continue",quotepulseshade,2+8+16);
|
gametext(160,165,"Press any key or button to continue",quotepulseshade,2+8+16);
|
||||||
|
|
||||||
|
@ -12457,13 +12462,63 @@ static void G_DisplayMPResultsScreen(void)
|
||||||
minitext(45,96+(8*7),"Deaths",8,2+8+16+128);
|
minitext(45,96+(8*7),"Deaths",8,2+8+16+128);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t G_PrintTime_ClockPad(void)
|
||||||
|
{
|
||||||
|
int32_t clockpad = 2;
|
||||||
|
int32_t ii, ij;
|
||||||
|
|
||||||
|
for (ii=g_player[myconnectindex].ps->player_par/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) ;
|
||||||
|
clockpad = max(clockpad,ij);
|
||||||
|
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
|
||||||
|
{
|
||||||
|
for (ii=MapInfo[G_LastMapInfoIndex()].partime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) ;
|
||||||
|
clockpad = max(clockpad,ij);
|
||||||
|
if (!NAM && MapInfo[G_LastMapInfoIndex()].designertime)
|
||||||
|
{
|
||||||
|
for (ii=MapInfo[G_LastMapInfoIndex()].designertime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) ;
|
||||||
|
clockpad = max(clockpad,ij);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ud.playerbest > 0) for (ii=ud.playerbest/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) ;
|
||||||
|
clockpad = max(clockpad,ij);
|
||||||
|
|
||||||
|
return clockpad;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char* G_PrintTime2(int32_t time)
|
||||||
|
{
|
||||||
|
Bsprintf(tempbuf, "%0*d:%02d", G_PrintTime_ClockPad(), time/(REALGAMETICSPERSEC*60), (time/REALGAMETICSPERSEC)%60);
|
||||||
|
return tempbuf;
|
||||||
|
}
|
||||||
|
static const char* G_PrintTime3(int32_t time)
|
||||||
|
{
|
||||||
|
Bsprintf(tempbuf, "%0*d:%02d.%02d", G_PrintTime_ClockPad(), time/(REALGAMETICSPERSEC*60), (time/REALGAMETICSPERSEC)%60, ((time%REALGAMETICSPERSEC)*33)/10);
|
||||||
|
return tempbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* G_PrintYourTime(void)
|
||||||
|
{
|
||||||
|
return G_PrintTime3(g_player[myconnectindex].ps->player_par);
|
||||||
|
}
|
||||||
|
const char* G_PrintParTime(void)
|
||||||
|
{
|
||||||
|
return G_PrintTime2(MapInfo[G_LastMapInfoIndex()].partime);
|
||||||
|
}
|
||||||
|
const char* G_PrintDesignerTime(void)
|
||||||
|
{
|
||||||
|
return G_PrintTime2(MapInfo[G_LastMapInfoIndex()].designertime);
|
||||||
|
}
|
||||||
|
const char* G_PrintBestTime(void)
|
||||||
|
{
|
||||||
|
return G_PrintTime3(ud.playerbest);
|
||||||
|
}
|
||||||
|
|
||||||
void G_BonusScreen(int32_t bonusonly)
|
void G_BonusScreen(int32_t bonusonly)
|
||||||
{
|
{
|
||||||
int32_t gfx_offset;
|
int32_t gfx_offset;
|
||||||
int32_t bonuscnt;
|
int32_t bonuscnt;
|
||||||
int32_t clockpad = 2;
|
int32_t clockpad = 2;
|
||||||
char *lastmapname;
|
char *lastmapname;
|
||||||
int32_t playerbest = -1;
|
|
||||||
|
|
||||||
if (g_networkMode == NET_DEDICATED_SERVER)
|
if (g_networkMode == NET_DEDICATED_SERVER)
|
||||||
return;
|
return;
|
||||||
|
@ -12478,9 +12533,9 @@ void G_BonusScreen(int32_t bonusonly)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lastmapname = MapInfo[(ud.volume_number*MAXLEVELS)+ud.last_level-1].name;
|
lastmapname = MapInfo[G_LastMapInfoIndex()].name;
|
||||||
if (!lastmapname) // this isn't right but it's better than no name at all
|
if (!lastmapname) // this isn't right but it's better than no name at all
|
||||||
lastmapname = MapInfo[(ud.m_volume_number*MAXLEVELS)+ud.last_level-1].name;
|
lastmapname = MapInfo[G_LastMapInfoIndex()].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -12561,29 +12616,8 @@ void G_BonusScreen(int32_t bonusonly)
|
||||||
bonuscnt = 0;
|
bonuscnt = 0;
|
||||||
totalclock = 0;
|
totalclock = 0;
|
||||||
|
|
||||||
playerbest = CONFIG_GetMapBestTime(MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].filename);
|
if (g_player[myconnectindex].ps->player_par > 0 && (g_player[myconnectindex].ps->player_par < ud.playerbest || ud.playerbest < 0))
|
||||||
|
CONFIG_SetMapBestTime(MapInfo[G_LastMapInfoIndex()].filename, g_player[myconnectindex].ps->player_par);
|
||||||
if (g_player[myconnectindex].ps->player_par > 0 && (g_player[myconnectindex].ps->player_par < playerbest || playerbest < 0))
|
|
||||||
CONFIG_SetMapBestTime(MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].filename, g_player[myconnectindex].ps->player_par);
|
|
||||||
|
|
||||||
{
|
|
||||||
int32_t ii, ij;
|
|
||||||
|
|
||||||
for (ii=g_player[myconnectindex].ps->player_par/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) ;
|
|
||||||
clockpad = max(clockpad,ij);
|
|
||||||
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
|
|
||||||
{
|
|
||||||
for (ii=MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].partime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) ;
|
|
||||||
clockpad = max(clockpad,ij);
|
|
||||||
if (!NAM && MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].designertime)
|
|
||||||
{
|
|
||||||
for (ii=MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].designertime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) ;
|
|
||||||
clockpad = max(clockpad,ij);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (playerbest > 0) for (ii=playerbest/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) ;
|
|
||||||
clockpad = max(clockpad,ij);
|
|
||||||
}
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -12665,21 +12699,21 @@ void G_BonusScreen(int32_t bonusonly)
|
||||||
yy+=10;
|
yy+=10;
|
||||||
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
|
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
|
||||||
{
|
{
|
||||||
if (MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].partime)
|
if (MapInfo[G_LastMapInfoIndex()].partime)
|
||||||
{
|
{
|
||||||
gametext(10,yy+9,"Par Time:",0,2+8+16);
|
gametext(10,yy+9,"Par Time:",0,2+8+16);
|
||||||
yy+=10;
|
yy+=10;
|
||||||
}
|
}
|
||||||
if (!NAM && !DUKEBETA && MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].designertime)
|
if (!NAM && !DUKEBETA && MapInfo[G_LastMapInfoIndex()].designertime)
|
||||||
{
|
{
|
||||||
gametext(10,yy+9,"3D Realms' Time:",0,2+8+16);
|
gametext(10,yy+9,"3D Realms' Time:",0,2+8+16);
|
||||||
yy+=10;
|
yy+=10;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (playerbest > 0)
|
if (ud.playerbest > 0)
|
||||||
{
|
{
|
||||||
gametext(10,yy+9,(g_player[myconnectindex].ps->player_par > 0 && g_player[myconnectindex].ps->player_par < playerbest)?"Prev Best Time:":"Your Best Time:",0,2+8+16);
|
gametext(10,yy+9,(g_player[myconnectindex].ps->player_par > 0 && g_player[myconnectindex].ps->player_par < ud.playerbest)?"Prev Best Time:":"Your Best Time:",0,2+8+16);
|
||||||
yy += 10;
|
yy += 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12697,13 +12731,9 @@ void G_BonusScreen(int32_t bonusonly)
|
||||||
|
|
||||||
if (g_player[myconnectindex].ps->player_par > 0)
|
if (g_player[myconnectindex].ps->player_par > 0)
|
||||||
{
|
{
|
||||||
Bsprintf(tempbuf,"%0*d:%02d.%02d",clockpad,
|
G_PrintYourTime();
|
||||||
(g_player[myconnectindex].ps->player_par/(REALGAMETICSPERSEC*60)),
|
|
||||||
(g_player[myconnectindex].ps->player_par/REALGAMETICSPERSEC)%60,
|
|
||||||
((g_player[myconnectindex].ps->player_par%REALGAMETICSPERSEC)*33)/10
|
|
||||||
);
|
|
||||||
gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16);
|
gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16);
|
||||||
if (g_player[myconnectindex].ps->player_par < playerbest)
|
if (g_player[myconnectindex].ps->player_par < ud.playerbest)
|
||||||
gametext((320>>2)+89+(clockpad*24),yy+9,"New record!",0,2+8+16);
|
gametext((320>>2)+89+(clockpad*24),yy+9,"New record!",0,2+8+16);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -12712,31 +12742,23 @@ void G_BonusScreen(int32_t bonusonly)
|
||||||
|
|
||||||
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
|
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
|
||||||
{
|
{
|
||||||
if (MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].partime)
|
if (MapInfo[G_LastMapInfoIndex()].partime)
|
||||||
{
|
{
|
||||||
Bsprintf(tempbuf,"%0*d:%02d",clockpad,
|
G_PrintParTime();
|
||||||
(MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].partime/(REALGAMETICSPERSEC*60)),
|
|
||||||
(MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].partime/REALGAMETICSPERSEC)%60);
|
|
||||||
gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16);
|
gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16);
|
||||||
yy+=10;
|
yy+=10;
|
||||||
}
|
}
|
||||||
if (!NAM && !DUKEBETA && MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].designertime)
|
if (!NAM && !DUKEBETA && MapInfo[G_LastMapInfoIndex()].designertime)
|
||||||
{
|
{
|
||||||
Bsprintf(tempbuf,"%0*d:%02d",clockpad,
|
G_PrintDesignerTime();
|
||||||
(MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].designertime/(REALGAMETICSPERSEC*60)),
|
|
||||||
(MapInfo[ud.volume_number*MAXLEVELS+ud.last_level-1].designertime/REALGAMETICSPERSEC)%60);
|
|
||||||
gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16);
|
gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16);
|
||||||
yy+=10;
|
yy+=10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerbest > 0)
|
if (ud.playerbest > 0)
|
||||||
{
|
{
|
||||||
Bsprintf(tempbuf,"%0*d:%02d.%02d",clockpad,
|
G_PrintBestTime();
|
||||||
(playerbest/(REALGAMETICSPERSEC*60)),
|
|
||||||
(playerbest/REALGAMETICSPERSEC)%60,
|
|
||||||
((playerbest%REALGAMETICSPERSEC)*33)/10
|
|
||||||
);
|
|
||||||
gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16);
|
gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16);
|
||||||
yy+=10;
|
yy+=10;
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,6 +167,7 @@ typedef struct {
|
||||||
int32_t player_skill,level_number,volume_number,m_marker,marker,mouseflip;
|
int32_t player_skill,level_number,volume_number,m_marker,marker,mouseflip;
|
||||||
|
|
||||||
vec2_t m_origin;
|
vec2_t m_origin;
|
||||||
|
int32_t playerbest;
|
||||||
|
|
||||||
int32_t configversion;
|
int32_t configversion;
|
||||||
#if !defined LUNATIC
|
#if !defined LUNATIC
|
||||||
|
@ -335,6 +336,11 @@ void A_SpawnRandomGlass(int32_t i,int32_t wallnum,int32_t n);
|
||||||
void A_SpawnWallGlass(int32_t i,int32_t wallnum,int32_t n);
|
void A_SpawnWallGlass(int32_t i,int32_t wallnum,int32_t n);
|
||||||
void G_AddUserQuote(const char *daquote);
|
void G_AddUserQuote(const char *daquote);
|
||||||
void G_BackToMenu(void);
|
void G_BackToMenu(void);
|
||||||
|
|
||||||
|
const char* G_PrintYourTime(void);
|
||||||
|
const char* G_PrintParTime(void);
|
||||||
|
const char* G_PrintDesignerTime(void);
|
||||||
|
const char* G_PrintBestTime(void);
|
||||||
void G_BonusScreen(int32_t bonusonly);
|
void G_BonusScreen(int32_t bonusonly);
|
||||||
//void G_CheatGetInv(void);
|
//void G_CheatGetInv(void);
|
||||||
void G_DisplayRest(int32_t smoothratio);
|
void G_DisplayRest(int32_t smoothratio);
|
||||||
|
|
|
@ -1045,6 +1045,7 @@ const memberlabel_t UserdefsLabels[]=
|
||||||
{ "last_camsprite", USERDEFS_LAST_CAMSPRITE, 0, 0 },
|
{ "last_camsprite", USERDEFS_LAST_CAMSPRITE, 0, 0 },
|
||||||
{ "last_level", USERDEFS_LAST_LEVEL, 0, 0 },
|
{ "last_level", USERDEFS_LAST_LEVEL, 0, 0 },
|
||||||
{ "secretlevel", USERDEFS_SECRETLEVEL, 0, 0 },
|
{ "secretlevel", USERDEFS_SECRETLEVEL, 0, 0 },
|
||||||
|
{ "playerbest", USERDEFS_PLAYERBEST, 0, 0 },
|
||||||
|
|
||||||
{ "const_visibility", USERDEFS_CONST_VISIBILITY, 0, 0 },
|
{ "const_visibility", USERDEFS_CONST_VISIBILITY, 0, 0 },
|
||||||
{ "uw_framerate", USERDEFS_UW_FRAMERATE, 0, 0 },
|
{ "uw_framerate", USERDEFS_UW_FRAMERATE, 0, 0 },
|
||||||
|
|
|
@ -425,6 +425,7 @@ enum UserdefsLabel_t
|
||||||
USERDEFS_RUNKEY_MODE,
|
USERDEFS_RUNKEY_MODE,
|
||||||
USERDEFS_M_ORIGIN_X,
|
USERDEFS_M_ORIGIN_X,
|
||||||
USERDEFS_M_ORIGIN_Y,
|
USERDEFS_M_ORIGIN_Y,
|
||||||
|
USERDEFS_PLAYERBEST,
|
||||||
USERDEFS_END
|
USERDEFS_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -251,6 +251,7 @@ static void __fastcall VM_AccessUserdef(int32_t iSet, int32_t lLabelID, int32_t
|
||||||
case USERDEFS_RUNKEY_MODE: lLabelID = ud.runkey_mode; break;
|
case USERDEFS_RUNKEY_MODE: lLabelID = ud.runkey_mode; break;
|
||||||
case USERDEFS_M_ORIGIN_X: lLabelID = ud.m_origin.x; break;
|
case USERDEFS_M_ORIGIN_X: lLabelID = ud.m_origin.x; break;
|
||||||
case USERDEFS_M_ORIGIN_Y: lLabelID = ud.m_origin.y; break;
|
case USERDEFS_M_ORIGIN_Y: lLabelID = ud.m_origin.y; break;
|
||||||
|
case USERDEFS_PLAYERBEST: lLabelID = ud.playerbest; break;
|
||||||
default: lLabelID = -1; break;
|
default: lLabelID = -1; break;
|
||||||
}
|
}
|
||||||
Gv_SetVarX(lVar2, lLabelID);
|
Gv_SetVarX(lVar2, lLabelID);
|
||||||
|
|
|
@ -868,6 +868,7 @@ local UserdefLabels = {
|
||||||
mouseaiming = UD".mouseaiming",
|
mouseaiming = UD".mouseaiming",
|
||||||
pause_on = UDRO".pause_on",
|
pause_on = UDRO".pause_on",
|
||||||
player_skill = UD".player_skill",
|
player_skill = UD".player_skill",
|
||||||
|
playerbest = UDRO".playerbest",
|
||||||
mouseflip = UDRO".mouseflip",
|
mouseflip = UDRO".mouseflip",
|
||||||
multimode = { "1" },
|
multimode = { "1" },
|
||||||
noexits = UDRO".noexits",
|
noexits = UDRO".noexits",
|
||||||
|
|
|
@ -513,6 +513,7 @@ typedef struct {
|
||||||
int32_t player_skill,level_number,volume_number,m_marker,marker,mouseflip;
|
int32_t player_skill,level_number,volume_number,m_marker,marker,mouseflip;
|
||||||
|
|
||||||
vec2_t m_origin;
|
vec2_t m_origin;
|
||||||
|
int32_t playerbest;
|
||||||
|
|
||||||
int32_t configversion;
|
int32_t configversion;
|
||||||
|
|
||||||
|
|
|
@ -1905,6 +1905,8 @@ int32_t G_EnterLevel(int32_t g)
|
||||||
G_AlignWarpElevators();
|
G_AlignWarpElevators();
|
||||||
resetpspritevars(g);
|
resetpspritevars(g);
|
||||||
|
|
||||||
|
ud.playerbest = CONFIG_GetMapBestTime(MapInfo[mii].filename);
|
||||||
|
|
||||||
G_FadeLoad(0,0,0, 63,0, -7, 4);
|
G_FadeLoad(0,0,0, 63,0, -7, 4);
|
||||||
G_CacheMapData();
|
G_CacheMapData();
|
||||||
G_FadeLoad(0,0,0, 0,63, 7, 4);
|
G_FadeLoad(0,0,0, 0,63, 7, 4);
|
||||||
|
|
Loading…
Reference in a new issue