mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-05-06 01:04:07 +00:00
shmup better with fake
This commit is contained in:
parent
87974ac1f4
commit
d2c2140cc9
33
shmup.cpp
33
shmup.cpp
@ -113,17 +113,27 @@ typedef multimap<cell*, monster*>::iterator mit;
|
|||||||
vector<monster*> active, nonvirtual, additional;
|
vector<monster*> active, nonvirtual, additional;
|
||||||
|
|
||||||
cell *findbaseAround(hyperpoint p, cell *around, int maxsteps) {
|
cell *findbaseAround(hyperpoint p, cell *around, int maxsteps) {
|
||||||
|
|
||||||
|
if(fake::in()) {
|
||||||
|
auto p0 = inverse(ggmatrix(around)) * p;
|
||||||
|
virtualRebase(around, p0);
|
||||||
|
return around;
|
||||||
|
}
|
||||||
|
|
||||||
|
cell *best = around;
|
||||||
|
transmatrix T = ggmatrix(around);
|
||||||
|
horo_distance d0(p, T);
|
||||||
|
|
||||||
for(int k=0; k<maxsteps; k++) {
|
for(int k=0; k<maxsteps; k++) {
|
||||||
cell *best = around;
|
|
||||||
horo_distance d0(p, ggmatrix(around));
|
|
||||||
for(int i=0; i<around->type; i++) {
|
for(int i=0; i<around->type; i++) {
|
||||||
cell *c2 = around->move(i);
|
cell *c2 = around->move(i);
|
||||||
if(c2) {
|
if(c2) {
|
||||||
horo_distance d1(p, ggmatrix(c2));
|
transmatrix U = fake::in() ? T * currentmap->adj(around, i) : ggmatrix(c2);
|
||||||
if(d1 < d0) { best = c2; d0 = d1; }
|
horo_distance d1(p, U);
|
||||||
|
if(d1 < d0) { best = c2; d0 = d1; T = U; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(best == around) return best;
|
if(best == around) break;
|
||||||
around = best;
|
around = best;
|
||||||
}
|
}
|
||||||
return around;
|
return around;
|
||||||
@ -177,15 +187,18 @@ void monster::rebasePat(const transmatrix& new_pat, cell *c2) {
|
|||||||
current_display->which_copy = ggmatrix(base);
|
current_display->which_copy = ggmatrix(base);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(quotient) {
|
if(quotient || fake::in()) {
|
||||||
at = inverse(gmatrix[base]) * new_pat;
|
at = inverse(gmatrix[base]) * new_pat;
|
||||||
transmatrix old_at = at;
|
transmatrix old_at = at;
|
||||||
virtualRebase(this);
|
virtualRebase(this);
|
||||||
fix_to_2(at);
|
fix_to_2(at);
|
||||||
if(base != c2) {
|
if(base != c2) {
|
||||||
auto T = calc_relative_matrix(c2, base, tC0(at));
|
if(fake::in()) println(hlog, "fake error");
|
||||||
base = c2;
|
else {
|
||||||
at = inverse(T) * at;
|
auto T = calc_relative_matrix(c2, base, tC0(at));
|
||||||
|
base = c2;
|
||||||
|
at = inverse(T) * at;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(multi::players == 1 && this == shmup::pc[0] && !eqmatrix(old_at, at))
|
if(multi::players == 1 && this == shmup::pc[0] && !eqmatrix(old_at, at))
|
||||||
current_display->which_copy = current_display->which_copy * old_at * inverse(at);
|
current_display->which_copy = current_display->which_copy * old_at * inverse(at);
|
||||||
@ -1624,7 +1637,7 @@ void moveBullet(monster *m, int delta) {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
nat = parallel_transport(nat, m->ori, fronttangent(delta * SCALE * m->vel / speedfactor()));
|
nat = parallel_transport(nat, m->ori, fronttangent(delta * SCALE * m->vel / speedfactor()));
|
||||||
cell *c2 = m->findbase(nat, 1);
|
cell *c2 = m->findbase(nat, fake::in() ? 10 : 1);
|
||||||
|
|
||||||
if(m->parent && isPlayer(m->parent) && markOrb(itOrbLava) && c2 != m->base && !isPlayerOn(m->base))
|
if(m->parent && isPlayer(m->parent) && markOrb(itOrbLava) && c2 != m->base && !isPlayerOn(m->base))
|
||||||
makeflame(m->base, 5, false);
|
makeflame(m->base, 5, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user