mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-05-05 08:44:07 +00:00
sword:: removed the dependence on the S* constants
This commit is contained in:
parent
f37c8d2f1c
commit
111bc3697d
16
complex.cpp
16
complex.cpp
@ -2606,11 +2606,11 @@ namespace sword {
|
|||||||
cell *pos(cell *c, int s) {
|
cell *pos(cell *c, int s) {
|
||||||
int t = c->type;
|
int t = c->type;
|
||||||
s *= 2;
|
s *= 2;
|
||||||
s += S42/t;
|
s += sword_angles/t;
|
||||||
s %= S84;
|
s %= (2 * sword_angles);
|
||||||
if(s<0) s += S84;
|
if(s<0) s += sword_angles * 2;
|
||||||
s *= t;
|
s *= t;
|
||||||
s /= S84;
|
s /= (sword_angles * 2);
|
||||||
return c->move(s);
|
return c->move(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2619,7 +2619,7 @@ namespace sword {
|
|||||||
|
|
||||||
cell *pos(int id, bool rev) {
|
cell *pos(int id, bool rev) {
|
||||||
if(!orbcount(rev)) return NULL;
|
if(!orbcount(rev)) return NULL;
|
||||||
return pos(playerpos(id), angle[id] + (rev ? S21 : 0));
|
return pos(playerpos(id), angle[id] + (rev ? sword_angles/2 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool at(cell *where, bool noplayer) {
|
bool at(cell *where, bool noplayer) {
|
||||||
@ -2643,13 +2643,13 @@ namespace sword {
|
|||||||
int s2 = neighborId(c2, c1);
|
int s2 = neighborId(c2, c1);
|
||||||
if(s1 < 0 || s2 < 0) return angle;
|
if(s1 < 0 || s2 < 0) return angle;
|
||||||
if(c1->c.mirror(s1))
|
if(c1->c.mirror(s1))
|
||||||
return ((s2*S42/c2->type - angle + s1*S42/c1->type) + S21) % S42;
|
return ((s2*sword_angles/c2->type - angle + s1*sword_angles/c1->type) + sword_angles/2) % sword_angles;
|
||||||
else
|
else
|
||||||
return ((s2*S42/c2->type - s1*S42/c1->type) + S21 + angle) % S42;
|
return ((s2*sword_angles/c2->type - s1*sword_angles/c1->type) + sword_angles/2 + angle) % sword_angles;
|
||||||
}
|
}
|
||||||
|
|
||||||
void shuffle(int i) {
|
void shuffle(int i) {
|
||||||
sword::angle[i] = euclid ? S7*hrand(6) : PURE ? 3*hrand(S14)+1 : hrand(S42);
|
sword::angle[i] = euclid ? S7*hrand(6) : PURE ? 3*hrand(sword_angles/3)+1 : hrand(sword_angles);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
|
4
game.cpp
4
game.cpp
@ -5256,8 +5256,8 @@ void sideAttack(cell *mf, int dir, eMonster who, int bonuskill) {
|
|||||||
|
|
||||||
template<class T> void do_swords(cell *mf, cell *mt, eMonster who, const T& f) {
|
template<class T> void do_swords(cell *mf, cell *mt, eMonster who, const T& f) {
|
||||||
for(int bb=0; bb<2; bb++) if(who == moPlayer && sword::orbcount(bb)) {
|
for(int bb=0; bb<2; bb++) if(who == moPlayer && sword::orbcount(bb)) {
|
||||||
cell *sf = sword::pos(mf, sword::angle[multi::cpid] + (bb?S21:0));
|
cell *sf = sword::pos(mf, sword::angle[multi::cpid] + (bb?sword_angles/2:0));
|
||||||
cell *st = sword::pos(mt, sword::shift(mf, mt, sword::angle[multi::cpid]) + (bb?S21:0));
|
cell *st = sword::pos(mt, sword::shift(mf, mt, sword::angle[multi::cpid]) + (bb?sword_angles/2:0));
|
||||||
f(st, bb);
|
f(st, bb);
|
||||||
if(sf != st && !isNeighbor(sf,st)) {
|
if(sf != st && !isNeighbor(sf,st)) {
|
||||||
// also attack the in-transit cell
|
// also attack the in-transit cell
|
||||||
|
14
graph.cpp
14
graph.cpp
@ -336,30 +336,30 @@ void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) {
|
|||||||
|
|
||||||
else {
|
else {
|
||||||
int& ang = angle[multi::cpid];
|
int& ang = angle[multi::cpid];
|
||||||
ang %= S42;
|
ang %= sword_angles;
|
||||||
|
|
||||||
#if CAP_QUEUE || CAP_SHAPES
|
#if CAP_QUEUE || CAP_SHAPES
|
||||||
transmatrix Vnow = gmatrix[c] * rgpushxto0(inverse(gmatrix[c]) * tC0(V)) * ddspin(c,0,M_PI); // (IRREGULAR ? ddspin(c,0,M_PI) : spin(-hexshiftat(c)));
|
transmatrix Vnow = gmatrix[c] * rgpushxto0(inverse(gmatrix[c]) * tC0(V)) * ddspin(c,0,M_PI); // (IRREGULAR ? ddspin(c,0,M_PI) : spin(-hexshiftat(c)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CAP_QUEUE
|
#if CAP_QUEUE
|
||||||
if(!euclid) for(int a=0; a<S42; a++) {
|
if(!euclid) for(int a=0; a<sword_angles; a++) {
|
||||||
int dda = S42 + (-1-2*a);
|
int dda = sword_angles + (-1-2*a);
|
||||||
if(a == ang && items[itOrbSword]) continue;
|
if(a == ang && items[itOrbSword]) continue;
|
||||||
if(PURE && a%3 != ang%3) continue;
|
if(PURE && a%3 != ang%3) continue;
|
||||||
if((a+S21)%S42 == ang && items[itOrbSword2]) continue;
|
if((a+sword_angles/2)%sword_angles == ang && items[itOrbSword2]) continue;
|
||||||
bool longer = sword::pos(cwt.at, a-1) != sword::pos(cwt.at, a+1);
|
bool longer = sword::pos(cwt.at, a-1) != sword::pos(cwt.at, a+1);
|
||||||
color_t col = darkena(0xC0C0C0, 0, 0xFF);
|
color_t col = darkena(0xC0C0C0, 0, 0xFF);
|
||||||
queueline(Vnow*xspinpush0(dda * M_PI / S42, PURE ? 0.6 * scalefactor : longer ? 0.36 : 0.4), Vnow*xspinpush0(dda * M_PI/S42, PURE ? 0.7 * scalefactor : longer ? 0.44 : 0.42), col, 1);
|
queueline(Vnow*xspinpush0(dda * M_PI / sword_angles, PURE ? 0.6 * scalefactor : longer ? 0.36 : 0.4), Vnow*xspinpush0(dda * M_PI/sword_angles, PURE ? 0.7 * scalefactor : longer ? 0.44 : 0.42), col, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CAP_SHAPES
|
#if CAP_SHAPES
|
||||||
if(items[itOrbSword])
|
if(items[itOrbSword])
|
||||||
queuepoly(Vnow*spin(M_PI+(-1-2*ang)*2*M_PI/S84), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword].color, 0, 0x80 + 0x70 * sintick(200)));
|
queuepoly(Vnow*spin(M_PI+(-1-2*ang)*M_PI/sword_angles), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword].color, 0, 0x80 + 0x70 * sintick(200)));
|
||||||
|
|
||||||
if(items[itOrbSword2])
|
if(items[itOrbSword2])
|
||||||
queuepoly(Vnow*spin((-1-2*ang)*2*M_PI/S84), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword2].color, 0, 0x80 + 0x70 * sintick(200)));
|
queuepoly(Vnow*spin((-1-2*ang)*M_PI/sword_angles), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword2].color, 0, 0x80 + 0x70 * sintick(200)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user