mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Best map par time tracking from JonoF
git-svn-id: https://svn.eduke32.com/eduke32@322 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
fc172fe3ea
commit
e6fa910614
4 changed files with 95 additions and 24 deletions
|
@ -894,6 +894,41 @@ void CONFIG_WriteSetup( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32 CONFIG_GetMapBestTime(char *mapname)
|
||||||
|
{
|
||||||
|
int32 t = -1;
|
||||||
|
char m[BMAX_PATH], *p;
|
||||||
|
|
||||||
|
strcpy(m, mapname);
|
||||||
|
p = strrchr(m, '/');
|
||||||
|
if (!p) p = strrchr(m, '\\');
|
||||||
|
if (p) strcpy(m, p);
|
||||||
|
for (p=m;*p;p++) *p = tolower(*p);
|
||||||
|
|
||||||
|
if (!setupread) return -1;
|
||||||
|
if (scripthandle < 0) return -1;
|
||||||
|
SCRIPT_GetNumber(scripthandle, "MapTimes", m, &t);
|
||||||
|
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 CONFIG_SetMapBestTime(char *mapname, int32 tm)
|
||||||
|
{
|
||||||
|
char m[BMAX_PATH], *p;
|
||||||
|
|
||||||
|
strcpy(m, mapname);
|
||||||
|
p = strrchr(m, '/');
|
||||||
|
if (!p) p = strrchr(m, '\\');
|
||||||
|
if (p) strcpy(m, p);
|
||||||
|
for (p=m;*p;p++) *p = tolower(*p);
|
||||||
|
|
||||||
|
if (scripthandle < 0) scripthandle = SCRIPT_Init(setupfilename);
|
||||||
|
if (scripthandle < 0) return -1;
|
||||||
|
|
||||||
|
SCRIPT_PutNumber(scripthandle, "MapTimes", mapname, tm, false, false);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* vim:ts=4:sw=4:
|
* vim:ts=4:sw=4:
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -72,4 +72,7 @@ void CONFIG_WriteSetup( void );
|
||||||
void CONFIG_SetupMouse( void );
|
void CONFIG_SetupMouse( void );
|
||||||
void CONFIG_SetupJoystick( void );
|
void CONFIG_SetupJoystick( void );
|
||||||
|
|
||||||
|
int32 CONFIG_GetMapBestTime(char *mapname);
|
||||||
|
int32 CONFIG_SetMapBestTime(char *mapname, int32 tm);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10614,6 +10614,8 @@ void dobonus(char bonusonly)
|
||||||
short bonuscnt;
|
short bonuscnt;
|
||||||
int clockpad = 2;
|
int clockpad = 2;
|
||||||
char *lastmapname;
|
char *lastmapname;
|
||||||
|
int32 playerbest = -1;
|
||||||
|
|
||||||
long breathe[] =
|
long breathe[] =
|
||||||
{
|
{
|
||||||
0, 30,VICTORY1+1,176,59,
|
0, 30,VICTORY1+1,176,59,
|
||||||
|
@ -10998,6 +11000,15 @@ FRAGBONUS:
|
||||||
bonuscnt = 0;
|
bonuscnt = 0;
|
||||||
totalclock = 0; tinc = 0;
|
totalclock = 0; tinc = 0;
|
||||||
|
|
||||||
|
playerbest = CONFIG_GetMapBestTime(level_file_names[ud.volume_number*11+ud.last_level-1]);
|
||||||
|
|
||||||
|
if (ps[myconnectindex].player_par < playerbest || playerbest == -1)
|
||||||
|
{
|
||||||
|
CONFIG_SetMapBestTime(level_file_names[ud.volume_number*11+ud.last_level-1], ps[myconnectindex].player_par);
|
||||||
|
if(playerbest != -1)
|
||||||
|
playerbest = ps[myconnectindex].player_par;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int ii, ij;
|
int ii, ij;
|
||||||
|
|
||||||
|
@ -11007,10 +11018,15 @@ FRAGBONUS:
|
||||||
clockpad = max(clockpad,ij);
|
clockpad = max(clockpad,ij);
|
||||||
for (ii=designertime[ud.volume_number*11+ud.last_level-1]/(26*60), ij=1; ii>9; ii/=10, ij++) ;
|
for (ii=designertime[ud.volume_number*11+ud.last_level-1]/(26*60), ij=1; ii>9; ii/=10, ij++) ;
|
||||||
clockpad = max(clockpad,ij);
|
clockpad = max(clockpad,ij);
|
||||||
|
if (playerbest > 0) for (ii=playerbest/(26*60), ij=1; ii>9; ii/=10, ij++) ;
|
||||||
|
clockpad = max(clockpad,ij);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
|
int yy = 0, zz;
|
||||||
|
|
||||||
handleevents();
|
handleevents();
|
||||||
AudioUpdate();
|
AudioUpdate();
|
||||||
|
|
||||||
|
@ -11076,13 +11092,16 @@ FRAGBONUS:
|
||||||
|
|
||||||
if( totalclock > (60*3) )
|
if( totalclock > (60*3) )
|
||||||
{
|
{
|
||||||
gametext(10,59+9,"Your Time:",0,2+8+16);
|
yy = zz = 59;
|
||||||
gametext(10,69+9,"Par time:",0,2+8+16);
|
gametext(10,yy+9,"Your Time:",0,2+8+16); yy+=10;
|
||||||
if (!NAM)
|
gametext(10,yy+9,"Par Time:",0,2+8+16); yy+=10;
|
||||||
gametext(10,78+9,"3D Realms' Time:",0,2+8+16);
|
if (!NAM) { gametext(10,yy+9,"3D Realms' Time:",0,2+8+16); yy+=10; }
|
||||||
|
if (playerbest > 0) { gametext(10,yy+9,"Your Best Time:",0,2+8+16); yy += 10; }
|
||||||
|
|
||||||
if(bonuscnt == 0)
|
if(bonuscnt == 0)
|
||||||
bonuscnt++;
|
bonuscnt++;
|
||||||
|
|
||||||
|
yy = zz;
|
||||||
if( totalclock > (60*4) )
|
if( totalclock > (60*4) )
|
||||||
{
|
{
|
||||||
if(bonuscnt == 1)
|
if(bonuscnt == 1)
|
||||||
|
@ -11094,25 +11113,34 @@ FRAGBONUS:
|
||||||
Bsprintf(tempbuf,"%0*ld:%02ld",clockpad,
|
Bsprintf(tempbuf,"%0*ld:%02ld",clockpad,
|
||||||
(ps[myconnectindex].player_par/(26*60)),
|
(ps[myconnectindex].player_par/(26*60)),
|
||||||
(ps[myconnectindex].player_par/26)%60);
|
(ps[myconnectindex].player_par/26)%60);
|
||||||
gametext((320>>2)+71,60+9,tempbuf,0,2+8+16);
|
gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); yy+=10;
|
||||||
|
|
||||||
Bsprintf(tempbuf,"%0*ld:%02ld",clockpad,
|
Bsprintf(tempbuf,"%0*ld:%02ld",clockpad,
|
||||||
(partime[ud.volume_number*11+ud.last_level-1]/(26*60)),
|
(partime[ud.volume_number*11+ud.last_level-1]/(26*60)),
|
||||||
(partime[ud.volume_number*11+ud.last_level-1]/26)%60);
|
(partime[ud.volume_number*11+ud.last_level-1]/26)%60);
|
||||||
gametext((320>>2)+71,69+9,tempbuf,0,2+8+16);
|
gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); yy+=10;
|
||||||
|
|
||||||
if (!NAM) {
|
if (!NAM) {
|
||||||
Bsprintf(tempbuf,"%0*ld:%02ld",clockpad,
|
Bsprintf(tempbuf,"%0*ld:%02ld",clockpad,
|
||||||
(designertime[ud.volume_number*11+ud.last_level-1]/(26*60)),
|
(designertime[ud.volume_number*11+ud.last_level-1]/(26*60)),
|
||||||
(designertime[ud.volume_number*11+ud.last_level-1]/26)%60);
|
(designertime[ud.volume_number*11+ud.last_level-1]/26)%60);
|
||||||
gametext((320>>2)+71,78+9,tempbuf,0,2+8+16);
|
gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); yy+=10;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (playerbest > 0) {
|
||||||
|
sprintf(tempbuf,"%0*ld:%02ld",clockpad,
|
||||||
|
(playerbest/(26*60)),
|
||||||
|
(playerbest/26)%60);
|
||||||
|
gametext((320>>2)+71,yy+9,tempbuf,0,2+8+16); yy+=10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zz = yy += 5;
|
||||||
if( totalclock > (60*6) )
|
if( totalclock > (60*6) )
|
||||||
{
|
{
|
||||||
gametext(10,94+9,"Enemies Killed:",0,2+8+16);
|
gametext(10,yy+9,"Enemies Killed:",0,2+8+16); yy += 10;
|
||||||
gametext(10,99+4+9,"Enemies Left:",0,2+8+16);
|
gametext(10,yy+9,"Enemies Left:",0,2+8+16); yy += 10;
|
||||||
|
|
||||||
if(bonuscnt == 2)
|
if(bonuscnt == 2)
|
||||||
{
|
{
|
||||||
|
@ -11120,6 +11148,8 @@ FRAGBONUS:
|
||||||
sound(FLY_BY);
|
sound(FLY_BY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
yy = zz;
|
||||||
|
|
||||||
if( totalclock > (60*7) )
|
if( totalclock > (60*7) )
|
||||||
{
|
{
|
||||||
if(bonuscnt == 3)
|
if(bonuscnt == 3)
|
||||||
|
@ -11127,28 +11157,31 @@ FRAGBONUS:
|
||||||
bonuscnt++;
|
bonuscnt++;
|
||||||
sound(PIPEBOMB_EXPLODE);
|
sound(PIPEBOMB_EXPLODE);
|
||||||
}
|
}
|
||||||
Bsprintf(tempbuf,"%-3ld",ps[myconnectindex].actors_killed);
|
sprintf(tempbuf,"%-3ld",ps[myconnectindex].actors_killed);
|
||||||
gametext((320>>2)+70,93+9,tempbuf,0,2+8+16);
|
gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10;
|
||||||
if(ud.player_skill > 3 )
|
if(ud.player_skill > 3 )
|
||||||
{
|
{
|
||||||
Bsprintf(tempbuf,"N/A");
|
sprintf(tempbuf,"N/A");
|
||||||
gametext((320>>2)+70,99+4+9,tempbuf,0,2+8+16);
|
gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( (ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed) < 0 )
|
if( (ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed) < 0 )
|
||||||
Bsprintf(tempbuf,"%-3d",0);
|
sprintf(tempbuf,"%-3d",0);
|
||||||
else Bsprintf(tempbuf,"%-3ld",ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed);
|
else sprintf(tempbuf,"%-3ld",ps[myconnectindex].max_actors_killed-ps[myconnectindex].actors_killed);
|
||||||
gametext((320>>2)+70,99+4+9,tempbuf,0,2+8+16);
|
gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zz = yy += 5;
|
||||||
if( totalclock > (60*9) )
|
if( totalclock > (60*9) )
|
||||||
{
|
{
|
||||||
gametext(10,120+9,"Secrets Found:",0,2+8+16);
|
gametext(10,yy+9,"Secrets Found:",0,2+8+16); yy += 10;
|
||||||
gametext(10,130+9,"Secrets Missed:",0,2+8+16);
|
gametext(10,yy+9,"Secrets Missed:",0,2+8+16); yy += 10;
|
||||||
if(bonuscnt == 4) bonuscnt++;
|
if(bonuscnt == 4) bonuscnt++;
|
||||||
|
|
||||||
|
yy = zz;
|
||||||
if( totalclock > (60*10) )
|
if( totalclock > (60*10) )
|
||||||
{
|
{
|
||||||
if(bonuscnt == 5)
|
if(bonuscnt == 5)
|
||||||
|
@ -11156,12 +11189,12 @@ FRAGBONUS:
|
||||||
bonuscnt++;
|
bonuscnt++;
|
||||||
sound(PIPEBOMB_EXPLODE);
|
sound(PIPEBOMB_EXPLODE);
|
||||||
}
|
}
|
||||||
Bsprintf(tempbuf,"%-3ld",ps[myconnectindex].secret_rooms);
|
sprintf(tempbuf,"%-3ld",ps[myconnectindex].secret_rooms);
|
||||||
gametext((320>>2)+70,120+9,tempbuf,0,2+8+16);
|
gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10;
|
||||||
if( ps[myconnectindex].secret_rooms > 0 )
|
if( ps[myconnectindex].secret_rooms > 0 )
|
||||||
Bsprintf(tempbuf,"%-3ld%%",(100*ps[myconnectindex].secret_rooms/ps[myconnectindex].max_secret_rooms));
|
sprintf(tempbuf,"%-3ld%%",(100*ps[myconnectindex].secret_rooms/ps[myconnectindex].max_secret_rooms));
|
||||||
Bsprintf(tempbuf,"%-3ld",ps[myconnectindex].max_secret_rooms-ps[myconnectindex].secret_rooms);
|
sprintf(tempbuf,"%-3ld",ps[myconnectindex].max_secret_rooms-ps[myconnectindex].secret_rooms);
|
||||||
gametext((320>>2)+70,130+9,tempbuf,0,2+8+16);
|
gametext((320>>2)+70,yy+9,tempbuf,0,2+8+16); yy += 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1601,7 +1601,7 @@ cheat_for_port_credits:
|
||||||
minitext(160-(Bstrlen(p)<<1), 76+8+10-l, p, 8, 10+16+128);
|
minitext(160-(Bstrlen(p)<<1), 76+8+10-l, p, 8, 10+16+128);
|
||||||
|
|
||||||
gametext(160,103-l,"RENDERING FEATURES",0,2+8+16);
|
gametext(160,103-l,"RENDERING FEATURES",0,2+8+16);
|
||||||
p = "Pierre-Loup Archambeaud Griffais";
|
p = "Pierre-Loup \"Plagman\" Griffais";
|
||||||
minitext(161-(Bstrlen(p)<<1), 104+10-l, p, 4, 10+16+128);
|
minitext(161-(Bstrlen(p)<<1), 104+10-l, p, 4, 10+16+128);
|
||||||
minitext(160-(Bstrlen(p)<<1), 103+10-l, p, 8, 10+16+128);
|
minitext(160-(Bstrlen(p)<<1), 103+10-l, p, 8, 10+16+128);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue