1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-27 11:57:40 +00:00

MAJOR CHANGE: replaced (transmatrix,band_shift) pair with shiftmatrix

This commit is contained in:
Zeno Rogue
2020-07-27 18:49:04 +02:00
parent d046023164
commit 82f32607e6
47 changed files with 1266 additions and 1129 deletions

View File

@@ -119,8 +119,7 @@ EX namespace fake {
return S1 * xpush(cgi.adjcheck) * S2;
}
void draw_recursive(cell *c, const transmatrix& V, ld a0, ld a1, cell *parent, int depth) {
band_shift = 0;
void draw_recursive(cell *c, const shiftmatrix& V, ld a0, ld a1, cell *parent, int depth) {
if(!do_draw(c, V)) return;
drawcell(c, V);
@@ -136,7 +135,7 @@ EX namespace fake {
curvepoint(spin(-a1) * xpush0(d+.2));
curvepoint(spin(-a1) * xpush0(d));
curvepoint(spin(-a0) * xpush0(d));
queuecurve(0xFF0000FF, 0, PPR::LINE);
queuecurve(shiftless(Id), 0xFF0000FF, 0, PPR::LINE);
}
@@ -144,11 +143,11 @@ EX namespace fake {
for(int i=0; i<c->type; i++) if(c->move(i) && c->move(i) != parent) {
auto h0 = V * befake(FPIU(get_corner_position(c, i)));
auto h1 = V * befake(FPIU(get_corner_position(c, (i+1) % c->type)));
ld b0 = atan2(h0);
ld b1 = atan2(h1);
ld b0 = atan2(unshift(h0));
ld b1 = atan2(unshift(h1));
while(b1 < b0) b1 += 2 * M_PI;
if(a0 == -1) {
draw_recursive(c->move(i), V * adj(c, i), b0, b1, c, depth+1);
draw_recursive(c->move(i), optimized_shift(V * adj(c, i)), b0, b1, c, depth+1);
}
else {
if(b1 - b0 > M_PI) continue;
@@ -163,7 +162,7 @@ EX namespace fake {
if(b0 > b1) continue;
draw_recursive(c->move(i), V * adj(c, i), b0, b1, c, depth+1);
draw_recursive(c->move(i), optimized_shift(V * adj(c, i)), b0, b1, c, depth+1);
}
}
}
@@ -201,7 +200,7 @@ EX namespace fake {
limit = INT_MAX;
if(ordered_mode && !(multiple && multiple_special_draw)) {
using pct = pair<cell*, transmatrix>;
using pct = pair<cell*, shiftmatrix>;
auto comparer = [] (pct& a1, pct& a2) {
if(ordered_mode > 2) {
auto val = [] (pct& a) {
@@ -215,7 +214,7 @@ EX namespace fake {
};
std::priority_queue<pct, std::vector<pct>, decltype(comparer)> myqueue(comparer);
auto enq = [&] (cell *c, const transmatrix& V) {
auto enq = [&] (cell *c, const shiftmatrix& V) {
if(!c) return;
if(ordered_mode == 1 || ordered_mode == 3) {
if(dq::visited_c.count(c)) return;
@@ -229,8 +228,8 @@ EX namespace fake {
while(!myqueue.empty()) {
auto& p = myqueue.top();
id++;
cell *c = get<0>(p);
transmatrix V = get<1>(p);
cell *c = p.first;
shiftmatrix V = p.second;
myqueue.pop();
if(ordered_mode == 2 || ordered_mode == 4) {
@@ -246,7 +245,7 @@ EX namespace fake {
if(id > limit) continue;
for(int i=0; i<c->type; i++) if(c->move(i)) {
enq(c->move(i), V * adj(c, i));
enq(c->move(i), optimized_shift(V * adj(c, i)));
}
}
@@ -259,10 +258,8 @@ EX namespace fake {
while(!dq::drawqueue_c.empty()) {
auto& p = dq::drawqueue_c.front();
id++;
cell *c = get<0>(p);
transmatrix V = get<1>(p);
dynamicval<ld> b(band_shift, get<2>(p));
bandfixer bf(V);
cell *c = p.first;
shiftmatrix V = p.second;
dq::drawqueue_c.pop();
if(!do_draw(c, V)) continue;
@@ -272,7 +269,7 @@ EX namespace fake {
if(id > limit) continue;
for(int i=0; i<c->type; i++) if(c->move(i)) {
enqueue(c->move(i), V * adj(c, i));
enqueue(c->move(i), optimized_shift(V * adj(c, i)));
}
}
}
@@ -530,7 +527,7 @@ EX void change_around() {
if(around >= 0 && around <= 2) return;
ld t = in() ? scale : 1;
hyperpoint h = inverse_exp(tC0(View));
hyperpoint h = inverse_exp(shiftless(tC0(View)));
transmatrix T = gpushxto0(tC0(View)) * View;
ld range = sightranges[geometry];