mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 14:37:16 +00:00
shRing refactor
This commit is contained in:
parent
61891c4eb8
commit
4f7b01e0a6
191
polygons.cpp
191
polygons.cpp
@ -544,46 +544,48 @@ void geometry_information::procedural_shapes() {
|
|||||||
|
|
||||||
RING(i)
|
RING(i)
|
||||||
hpcpush(hpxy(sin(i*2*M_PI/S84)*0.242 * orbsize, cos(i*2*M_PI/S84)*0.177*orbsize));
|
hpcpush(hpxy(sin(i*2*M_PI/S84)*0.242 * orbsize, cos(i*2*M_PI/S84)*0.177*orbsize));
|
||||||
|
|
||||||
|
auto make_ring = [this] (hpcshape& sh, reaction_t f) {
|
||||||
|
bshape(sh, PPR::ITEM);
|
||||||
|
RING(i)
|
||||||
|
hpcpush(ddi(i, orbsize * .25) * C0);
|
||||||
|
first = true;
|
||||||
|
f();
|
||||||
|
first = true;
|
||||||
|
hpcpush(ddi(0, orbsize * .25) * C0);
|
||||||
|
};
|
||||||
|
|
||||||
|
make_ring(shRing, [this] {
|
||||||
|
REVPRING(i) {
|
||||||
|
println(hlog, "called for i = ", i);
|
||||||
|
hpcpush(ddi(i, orbsize * .30) * C0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
bshape(shRing, PPR::ITEM);
|
make_ring(shSpikedRing, [this] {
|
||||||
RING(i)
|
REVPRING(i)
|
||||||
hpcpush(ddi(i, orbsize * .25) * C0);
|
hpcpush(ddi(i, orbsize * (int(i)&1?.35:.30)) * C0);
|
||||||
REVPRING(i)
|
});
|
||||||
hpcpush(ddi(i, orbsize * .30) * C0);
|
|
||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
|
||||||
|
|
||||||
bshape(shSpikedRing, PPR::ITEM);
|
make_ring(shTargetRing, [this] {
|
||||||
RING(i)
|
REVPRING(i)
|
||||||
hpcpush(ddi(i, orbsize * .25) * C0);
|
hpcpush(ddi(i, orbsize * (i >= S42-6 && i <= S42+6 ?.36:.30)) * C0);
|
||||||
REVPRING(i)
|
});
|
||||||
hpcpush(ddi(i, orbsize * (int(i)&1?.35:.30)) * C0);
|
|
||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
|
||||||
|
|
||||||
bshape(shTargetRing, PPR::ITEM);
|
make_ring(shFrogRing, [this] {
|
||||||
RING(i)
|
REVPRING(i)
|
||||||
hpcpush(ddi(i, orbsize * .25) * C0);
|
hpcpush(ddi(i, orbsize * (((i >= S42-8 && i <= S42-2) || (i >= S42+2 && i <= S42+8)) ?.36:.30)) * C0);
|
||||||
REVPRING(i)
|
});
|
||||||
hpcpush(ddi(i, orbsize * (i >= S42-6 && i <= S42+6 ?.36:.30)) * C0);
|
|
||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
|
||||||
|
|
||||||
bshape(shFrogRing, PPR::ITEM);
|
make_ring(shSpearRing, [this] {
|
||||||
RING(i)
|
REVPRING(i) {
|
||||||
hpcpush(ddi(i, orbsize * .25) * C0);
|
double d = i - S42;
|
||||||
REVPRING(i)
|
if(d<0) d = -d;
|
||||||
hpcpush(ddi(i, orbsize * (((i >= S42-8 && i <= S42-2) || (i >= S42+2 && i <= S42+8)) ?.36:.30)) * C0);
|
d = 8 - 2 * d;
|
||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
if(d<0) d = 0;
|
||||||
|
hpcpush(ddi(i, orbsize * (.3 + .04 * d)) * C0);
|
||||||
bshape(shSpearRing, PPR::ITEM);
|
}
|
||||||
RING(i)
|
});
|
||||||
hpcpush(ddi(i, orbsize * .25) * C0);
|
|
||||||
REVPRING(i) {
|
|
||||||
double d = i - S42;
|
|
||||||
if(d<0) d = -d;
|
|
||||||
d = 8 - 2 * d;
|
|
||||||
if(d<0) d = 0;
|
|
||||||
hpcpush(ddi(i, orbsize * (.3 + .04 * d)) * C0);
|
|
||||||
}
|
|
||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
|
||||||
|
|
||||||
/* three nice spikes
|
/* three nice spikes
|
||||||
bshape(shLoveRing, PPR::ITEM);
|
bshape(shLoveRing, PPR::ITEM);
|
||||||
@ -600,84 +602,67 @@ void geometry_information::procedural_shapes() {
|
|||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
hpcpush(ddi(0, orbsize * .25) * C0);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bshape(shLoveRing, PPR::ITEM);
|
make_ring(shLoveRing, [this] {
|
||||||
RING(i) hpcpush(ddi(i, orbsize * .25) * C0);
|
REVPRING(i) {
|
||||||
REVPRING(i) {
|
double j = i*3;
|
||||||
double j = i*3;
|
while(j >= S84) j -= S84;
|
||||||
while(j >= S84) j -= S84;
|
double d = j - S42;
|
||||||
double d = j - S42;
|
d = d / 9;
|
||||||
d = d / 9;
|
if(d<0) d = -d;
|
||||||
if(d<0) d = -d;
|
d = 8 - 2 * d;
|
||||||
d = 8 - 2 * d;
|
if(d<0) d = 0;
|
||||||
if(d<0) d = 0;
|
if(d >= 6) d -= (d-6)/3;
|
||||||
if(d >= 6) d -= (d-6)/3;
|
hpcpush(ddi(i, orbsize * (.27 + .02 * d)) * C0);
|
||||||
hpcpush(ddi(i, orbsize * (.27 + .02 * d)) * C0);
|
}
|
||||||
}
|
});
|
||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
|
||||||
|
|
||||||
auto dmod = [] (ld a, ld b) { return a - int(a/b)*b; };
|
auto dmod = [] (ld a, ld b) { return a - int(a/b)*b; };
|
||||||
|
|
||||||
bshape(shSawRing, PPR::ITEM);
|
make_ring(shSawRing, [this] {
|
||||||
RING(i)
|
REVPRING(i)
|
||||||
hpcpush(ddi(i, orbsize * .25) * C0);
|
hpcpush(ddi(i, orbsize * (.3 + (int(i) & 3) * .02)) * C0);
|
||||||
REVPRING(i)
|
});
|
||||||
hpcpush(ddi(i, orbsize * (.3 + (int(i) & 3) * .02)) * C0);
|
|
||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
|
||||||
|
|
||||||
bshape(shMoveRing, PPR::ITEM);
|
make_ring(shMoveRing, [this] {
|
||||||
RING(i)
|
REVPRING(i) {
|
||||||
hpcpush(ddi(i, orbsize * .25) * C0);
|
int ii = i + 3;
|
||||||
REVPRING(i) {
|
if(int(ii) % 7 == 0) {
|
||||||
int ii = i + 3;
|
hpcpush(ddi(i-2, orbsize * (.3 - .02)) * C0);
|
||||||
if(int(ii) % 7 == 0) {
|
hpcpush(ddi(i-1, orbsize * (.3 - .01)) * C0);
|
||||||
hpcpush(ddi(i-2, orbsize * (.3 - .02)) * C0);
|
}
|
||||||
hpcpush(ddi(i-1, orbsize * (.3 - .01)) * C0);
|
hpcpush(ddi(i, orbsize * (.3 + (int(ii) % 7) * .01)) * C0);
|
||||||
}
|
}
|
||||||
hpcpush(ddi(i, orbsize * (.3 + (int(ii) % 7) * .01)) * C0);
|
});
|
||||||
}
|
|
||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
|
||||||
|
|
||||||
bshape(shGearRing, PPR::ITEM);
|
make_ring(shGearRing, [dmod, this] {
|
||||||
RING(i)
|
REVPRING(i)
|
||||||
hpcpush(ddi(i, orbsize * .25) * C0);
|
hpcpush(ddi(i, orbsize * ((dmod(i, 6)<3)?.3:.36)) * C0);
|
||||||
REVPRING(i)
|
});
|
||||||
hpcpush(ddi(i, orbsize * ((dmod(i, 6)<3)?.3:.36)) * C0);
|
|
||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
|
||||||
|
|
||||||
bshape(shProtectiveRing, PPR::ITEM);
|
make_ring(shProtectiveRing, [dmod, this] {
|
||||||
RING(i)
|
REVPRING(i)
|
||||||
hpcpush(ddi(i, orbsize * .25) * C0);
|
hpcpush(ddi(i, orbsize * ((dmod(i, 12)<3)?.3:.36)) * C0);
|
||||||
REVPRING(i)
|
});
|
||||||
hpcpush(ddi(i, orbsize * ((dmod(i, 12)<3)?.3:.36)) * C0);
|
|
||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
|
||||||
|
|
||||||
bshape(shPowerGearRing, PPR::ITEM);
|
make_ring(shPowerGearRing, [dmod, this] {
|
||||||
RING(i)
|
REVPRING(i)
|
||||||
hpcpush(ddi(i, orbsize * .25) * C0);
|
hpcpush(ddi(i, orbsize * ((dmod(i, 6)<3)?.3:(dmod(i,12) < 6) ? .36 : .42)) * C0);
|
||||||
REVPRING(i)
|
});
|
||||||
hpcpush(ddi(i, orbsize * ((dmod(i, 6)<3)?.3:(dmod(i,12) < 6) ? .36 : .42)) * C0);
|
|
||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
|
||||||
|
|
||||||
bshape(shTerraRing, PPR::ITEM);
|
make_ring(shTerraRing, [dmod, this] {
|
||||||
RING(i)
|
REVPRING(i)
|
||||||
hpcpush(ddi(i, orbsize * .25) * C0);
|
hpcpush(ddi(i, orbsize * ((dmod(i, 6)<3)?.36:(dmod(i,12) < 6) ? .3 : .42)) * C0);
|
||||||
REVPRING(i)
|
});
|
||||||
hpcpush(ddi(i, orbsize * ((dmod(i, 6)<3)?.36:(dmod(i,12) < 6) ? .3 : .42)) * C0);
|
|
||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
|
||||||
|
|
||||||
bshape(shPeaceRing, PPR::ITEM);
|
make_ring(shPeaceRing, [dmod, this] {
|
||||||
RING(i)
|
REVPRING(i)
|
||||||
hpcpush(ddi(i, orbsize * .25) * C0);
|
hpcpush(ddi(i, orbsize * (dmod(i, S28) < SD7?.36 : .3)) * C0);
|
||||||
REVPRING(i)
|
});
|
||||||
hpcpush(ddi(i, orbsize * (dmod(i, S28) < SD7?.36 : .3)) * C0);
|
|
||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
|
||||||
|
|
||||||
bshape(shHeptaRing, PPR::ITEM);
|
make_ring(shHeptaRing, [dmod, this] {
|
||||||
RING(i)
|
REVPRING(i)
|
||||||
hpcpush(ddi(i, orbsize * .25) * C0);
|
hpcpush(ddi(i, orbsize * (dmod(i, S12) < SD3?.4 : .27)) * C0);
|
||||||
REVPRING(i)
|
});
|
||||||
hpcpush(ddi(i, orbsize * (dmod(i, S12) < SD3?.4 : .27)) * C0);
|
|
||||||
hpcpush(ddi(0, orbsize * .25) * C0);
|
|
||||||
|
|
||||||
bshape(shCompass1, PPR::ITEM);
|
bshape(shCompass1, PPR::ITEM);
|
||||||
RING(i)
|
RING(i)
|
||||||
|
Loading…
Reference in New Issue
Block a user