1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-08-29 16:57:56 +00:00

rogueviz:: ads:: in dsgame, better score handling -- ignore nan, keep highest

This commit is contained in:
Zeno Rogue
2025-06-25 13:37:32 +02:00
parent 36e0d8bba2
commit c8db1ccb1b
4 changed files with 5 additions and 5 deletions

View File

@@ -405,15 +405,16 @@ bool ds_turn(int idelta) {
current.T = lorentz(3, 2, -tc) * current.T; current.T = lorentz(3, 2, -tc) * current.T;
auto& mshift = main_rock->pt_main.shift; auto& mshift = main_rock->pt_main.shift;
if(mshift) { if(mshift && !isnan(mshift)) {
#if RVCOL #if RVCOL
constexpr ld win_time = 60; constexpr ld win_time = 60;
if(current.shift < win_time && (current.shift + mshift) >= win_time && !game_over && no_param_change) if(pdata.score[0] < win_time && (current.shift + mshift) >= win_time && !game_over && no_param_change)
rogueviz::rv_achievement("DSGAME"); rogueviz::rv_achievement("DSGAME");
#endif #endif
current.shift += mshift; current.shift += mshift;
current.T = current.T * lorentz(2, 3, mshift); current.T = current.T * lorentz(2, 3, mshift);
mshift = 0; mshift = 0;
pdata.score[0] = max(pdata.score[0], current.shift);
} }
fixmatrix(current.T); fixmatrix(current.T);

View File

@@ -81,7 +81,7 @@ struct player_data {
int ammo; int ammo;
ld fuel; ld fuel;
ld oxygen; ld oxygen;
int score[score_types]; ld score[score_types];
}; };
ld ads_how_much_invincibility = TAU / 4; ld ads_how_much_invincibility = TAU / 4;

View File

@@ -19,7 +19,6 @@ void fill_gamedata() {
char buf[128]; strftime(buf, 128, "%c", localtime(&timer)); cur.timerend = buf; char buf[128]; strftime(buf, 128, "%c", localtime(&timer)); cur.timerend = buf;
cur.seconds = int(timer - timerstart); cur.seconds = int(timer - timerstart);
for(int a=0; a<3; a++) cur.scores[a] = pdata.score[a]; for(int a=0; a<3; a++) cur.scores[a] = pdata.score[a];
if(main_rock) cur.scores[0] = current.shift;
shstream hs; shstream hs;
print(hs, main_rock ? "2 " : "1 "); print(hs, main_rock ? "2 " : "1 ");
print(hs, DS_(simspeed), " ", DS_(accel), " ", DS_(how_much_invincibility), " ", vid.creature_scale, " ", DS_(missile_rapidity)); print(hs, DS_(simspeed), " ", DS_(accel), " ", DS_(how_much_invincibility), " ", vid.creature_scale, " ", DS_(missile_rapidity));

View File

@@ -107,7 +107,7 @@ void display(int id, int y, ld val, ld maxv, ld tank, ld unit) {
if(maxv == 0) { if(maxv == 0) {
string s; string s;
if(main_rock) s = hr::format(tformat, current.shift); if(main_rock) s = hr::format(tformat, pdata.score[0]);
else s = its(val + .5); else s = its(val + .5);
queuestr(sta, ctr, 0, 20, s, col >> 8, 1, 0); queuestr(sta, ctr, 0, 20, s, col >> 8, 1, 0);