mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-05-10 11:14:07 +00:00
rogueviz::ads:: achievements/leaderboards
This commit is contained in:
parent
99fe9da2b9
commit
e29cbda259
@ -250,4 +250,6 @@ void load_hiscores();
|
||||
string get_main_help();
|
||||
int generate_mouseovers();
|
||||
|
||||
bool all_params_default();
|
||||
|
||||
}}
|
||||
|
@ -19,6 +19,7 @@ void fill_gamedata() {
|
||||
char buf[128]; strftime(buf, 128, "%c", localtime(&timer)); cur.timerend = buf;
|
||||
cur.seconds = int(timer - timerstart);
|
||||
for(int a=0; a<3; a++) cur.scores[a] = pdata.score[a];
|
||||
if(main_rock) cur.scores[0] = current.shift;
|
||||
shstream hs;
|
||||
print(hs, main_rock ? "2 " : "1 ");
|
||||
print(hs, DS_(simspeed), " ", DS_(accel), " ", DS_(how_much_invincibility), " ", vid.creature_scale, " ", DS_(missile_rapidity));
|
||||
@ -64,11 +65,23 @@ void game_over_with_message(const string& reason) {
|
||||
if(pdata.fuel <= 0) cur.deathreason += " while out of fuel";
|
||||
if(pdata.ammo <= 0) cur.deathreason += " while out of ammo";
|
||||
game_over = true;
|
||||
#if RVCOL
|
||||
if(main_rock && all_params_default())
|
||||
rogueviz::rv_leaderboard("de Sitter", current.shift * 1000, 1, rvlc::ms);
|
||||
if(!main_rock && all_params_default()) {
|
||||
auto& s = pdata.score;
|
||||
string data = lalign(0, s[0], " ", s[1], " ", s[2]);
|
||||
rogueviz::rv_leaderboard("anti de Sitter: total score", s[0] + s[1] + s[2], 1, rvlc::num, data);
|
||||
rogueviz::rv_leaderboard("anti de Sitter: platinum", s[0], 1, rvlc::num, data);
|
||||
rogueviz::rv_leaderboard("anti de Sitter: plasteel", s[1], 1, rvlc::num, data);
|
||||
rogueviz::rv_leaderboard("anti de Sitter: uranium", s[2], 1, rvlc::num, data);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void save_to_hiscores() {
|
||||
if(!main_rock && (pdata.score[0] + pdata.score[1] + pdata.score[2] == 0)) return;
|
||||
if(main_rock && pdata.score[0] < 5) return;
|
||||
if(main_rock && current.shift < 5) return;
|
||||
save(cur);
|
||||
allsaves.push_back(cur);
|
||||
}
|
||||
|
@ -9,6 +9,38 @@ void adjust_for_scale() {
|
||||
else max_gen_per_frame = 3, draw_per_frame = 1000;
|
||||
}
|
||||
|
||||
vector<void*> get_all_params() {
|
||||
vector<void*> vec = {&DS_(simspeed), &DS_(accel), &DS_(how_much_invincibility), &vid.creature_scale, &DS_(missile_rapidity)};
|
||||
if(!main_rock) {
|
||||
vec.push_back(&rock_max_rapidity);
|
||||
vec.push_back(&rock_density);
|
||||
}
|
||||
auto all = [&] (player_data& d) {
|
||||
vec.push_back(&d.hitpoints);
|
||||
vec.push_back(&d.ammo);
|
||||
vec.push_back(&d.fuel);
|
||||
vec.push_back(&d.oxygen);
|
||||
};
|
||||
all(DS_(max_pdata));
|
||||
all(DS_(tank_pdata));
|
||||
return vec;
|
||||
}
|
||||
|
||||
bool all_params_default() {
|
||||
for(auto v: get_all_params()) {
|
||||
for(auto& fs: params)
|
||||
if(fs.second->affects(v) && fs.second->dosave()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void all_params_reset() {
|
||||
for(auto v: get_all_params())
|
||||
for(auto& fs: params)
|
||||
if(fs.second->affects(v))
|
||||
fs.second->reset();
|
||||
}
|
||||
|
||||
void edit_difficulty() {
|
||||
cmode = sm::SIDE | sm::MAYDARK;
|
||||
gamescreen();
|
||||
@ -49,6 +81,9 @@ void edit_difficulty() {
|
||||
});
|
||||
}
|
||||
|
||||
dialog::addBoolItem(XLAT("all default"), all_params_default(), 'D');
|
||||
dialog::add_action([] { all_params_reset(); restart(); });
|
||||
|
||||
dialog::addBack();
|
||||
dialog::display();
|
||||
}
|
||||
|
@ -200,6 +200,9 @@ void gain_resource(eResourceType rsrc) {
|
||||
D(rtOxygen, oxygen)
|
||||
for(auto r: {rtGoldGate, rtGoldRocks, rtGoldTurret}) {
|
||||
D(r, score[treasure_id(r)])
|
||||
#ifdef RVCOL
|
||||
if(pdata.score[0] + pdata.score[1] + pdata.score[2] == 30 && all_params_default()) rogueviz::rv_achievement("ADSGAME");
|
||||
#endif
|
||||
}
|
||||
playSound(nullptr, rsrc_sound[rsrc]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user