mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-05-28 20:14:06 +00:00
racing:: improved Euclidean track generation
This commit is contained in:
parent
f6226665d0
commit
d5ce7dc30b
@ -817,6 +817,12 @@ eLand getEuclidLand(int c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setLandEuclid(cell *c) {
|
void setLandEuclid(cell *c) {
|
||||||
|
#if CAP_RACING
|
||||||
|
if(racing::track_ready) {
|
||||||
|
setland(c, laMemory);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
setland(c, specialland);
|
setland(c, specialland);
|
||||||
if(specialland == laCrossroads4 || chaosmode) {
|
if(specialland == laCrossroads4 || chaosmode) {
|
||||||
int x, y;
|
int x, y;
|
||||||
|
2
hyper.h
2
hyper.h
@ -4677,7 +4677,7 @@ bool do_draw(cell *c, const transmatrix& T);
|
|||||||
|
|
||||||
#if CAP_RACING
|
#if CAP_RACING
|
||||||
namespace racing {
|
namespace racing {
|
||||||
extern bool on, player_relative;
|
extern bool on, player_relative, track_ready;
|
||||||
void generate_track();
|
void generate_track();
|
||||||
void show();
|
void show();
|
||||||
void prepare_subscreens();
|
void prepare_subscreens();
|
||||||
|
35
racing.cpp
35
racing.cpp
@ -11,6 +11,7 @@ namespace racing {
|
|||||||
|
|
||||||
bool on;
|
bool on;
|
||||||
bool player_relative = false;
|
bool player_relative = false;
|
||||||
|
bool track_ready;
|
||||||
|
|
||||||
static const int LENGTH = 250;
|
static const int LENGTH = 250;
|
||||||
static const int TWIDTH = 6;
|
static const int TWIDTH = 6;
|
||||||
@ -76,13 +77,28 @@ void generate_track() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while(goal != s) {
|
if(euclid) {
|
||||||
track.push_back(goal);
|
using namespace hyperpoint_vec;
|
||||||
forCellEx(c2, goal) if(celldist(c2) < celldist(goal)) { goal = c2; break; }
|
track.push_back(s);
|
||||||
|
hyperpoint h = tC0(calc_relative_matrix(goal, s, C0)) - C0;
|
||||||
|
cell *x = s;
|
||||||
|
hyperpoint h1 = C0;
|
||||||
|
for(int i=0; i<=1000; i++) {
|
||||||
|
h1 += h / 1000.;
|
||||||
|
virtualRebase(x, h1, true);
|
||||||
|
if(x != track.back()) track.push_back(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
while(goal != s) {
|
||||||
|
track.push_back(goal);
|
||||||
|
forCellEx(c2, goal) if(celldist(c2) < celldist(goal)) { goal = c2; break; }
|
||||||
|
}
|
||||||
|
|
||||||
|
track.push_back(s);
|
||||||
|
reverse(track.begin(), track.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
track.push_back(s);
|
|
||||||
reverse(track.begin(), track.end());
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -196,6 +212,8 @@ void generate_track() {
|
|||||||
if(i >= 5) c->item = itBone;
|
if(i >= 5) c->item = itBone;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
track_ready = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<tuple<int, cell*, transmatrix, ld> > history;
|
vector<tuple<int, cell*, transmatrix, ld> > history;
|
||||||
@ -315,6 +333,11 @@ bool akh(int sym, int uni) {
|
|||||||
#if CAP_COMMANDLINE
|
#if CAP_COMMANDLINE
|
||||||
auto hook =
|
auto hook =
|
||||||
addHook(hooks_args, 100, readArgs)
|
addHook(hooks_args, 100, readArgs)
|
||||||
|
+ addHook(clearmemory, 0, []() {
|
||||||
|
track_ready = false;
|
||||||
|
track.clear();
|
||||||
|
trackstage.clear();
|
||||||
|
})
|
||||||
// + addHook(hooks_handleKey, 120, akh);
|
// + addHook(hooks_handleKey, 120, akh);
|
||||||
;
|
;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user