mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 13:07:16 +00:00
gametime available in formulas
This commit is contained in:
parent
99bc842c57
commit
727ae8a260
4
quit.cpp
4
quit.cpp
@ -26,6 +26,10 @@ EX int getgametime() {
|
||||
return (int) (savetime + (timerstopped ? 0 : (time(NULL) - timerstart)));
|
||||
}
|
||||
|
||||
EX ld getgametime_precise() {
|
||||
return savetime + (timerstopped ? 0 : (ticks - tickstart) / 1000.);
|
||||
}
|
||||
|
||||
EX string getgametime_s(int timespent IS(getgametime())) {
|
||||
return hr::format("%d:%02d", timespent/60, timespent % 60);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ EX int truelotus;
|
||||
|
||||
EX int asteroids_generated, asteroid_orbs_generated;
|
||||
|
||||
EX time_t timerstart, savetime;
|
||||
EX time_t timerstart, savetime, tickstart;
|
||||
EX bool timerstopped;
|
||||
EX int savecount;
|
||||
EX int save_turns;
|
||||
@ -378,6 +378,7 @@ EX void initgame() {
|
||||
if(!safety) {
|
||||
usedSafety = false;
|
||||
timerstart = time(NULL); turncount = 0; rosewave = 0; rosephase = 0;
|
||||
tickstart = ticks;
|
||||
noiseuntil = 0;
|
||||
sagephase = 0; hardcoreAt = 0;
|
||||
timerstopped = false;
|
||||
|
1
util.cpp
1
util.cpp
@ -393,6 +393,7 @@ cld exp_parser::parse(int prio) {
|
||||
else if(number == "mousey") res = mousey;
|
||||
else if(number == "turncount") res = turncount;
|
||||
else if(number == "framecount") res = frameid;
|
||||
else if(number == "gametime") res = getgametime_precise();
|
||||
else if(number == "last_a") res = anims::last_anim_vars[0];
|
||||
else if(number == "last_b") res = anims::last_anim_vars[1];
|
||||
else if(number == "last_c") res = anims::last_anim_vars[2];
|
||||
|
Loading…
Reference in New Issue
Block a user