mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
parially done mirrors; field pattern in weirdhyperbolic; fake other patterns in weirdhyperbolic
This commit is contained in:
parent
ce3c066b0f
commit
345bd94c0d
@ -915,8 +915,8 @@ void buildBigStuff(cell *c, cell *from) {
|
||||
else if(c->land == laPrairie && c->LHU.fi.walldist == 0) {
|
||||
for(int bd=0; bd<7; bd++) {
|
||||
int fval2 = createStep(c->master, bd)->fieldval;
|
||||
int wd = fp43.gmul(fval2, fp43.inverses[c->fval-1]);
|
||||
if(fp43.distwall[wd] == 0) {
|
||||
int wd = currfp.gmul(fval2, currfp.inverses[c->fval-1]);
|
||||
if(currfp.distwall[wd] == 0) {
|
||||
buildBarrier(c, bd);
|
||||
break;
|
||||
}
|
||||
|
38
cell.cpp
38
cell.cpp
@ -487,7 +487,7 @@ struct hrmap_quotient : hrmap {
|
||||
hrmap_quotient() {
|
||||
|
||||
if(quotient == 2) {
|
||||
connections = fp43.connections;
|
||||
connections = currfp.connections;
|
||||
}
|
||||
else {
|
||||
heptspin hs; hs.h = base.origin; hs.spin = 0;
|
||||
@ -715,7 +715,7 @@ void initcells() {
|
||||
|
||||
allmaps.push_back(currentmap);
|
||||
|
||||
if(S7 <= 7 && S6 <= 6) windmap::create();
|
||||
windmap::create();
|
||||
|
||||
// origin->emeraldval =
|
||||
}
|
||||
@ -824,8 +824,8 @@ bool ishex1(cell *c) {
|
||||
|
||||
int emeraldval(cell *c) {
|
||||
if(euclid) return eupattern(c);
|
||||
if(sphere || weirdhyperbolic) return 0;
|
||||
if(c->type == 7)
|
||||
if(sphere) return 0;
|
||||
if(ctof(c))
|
||||
return c->master->emeraldval >> 3;
|
||||
else {
|
||||
return emerald_hexagon(
|
||||
@ -1045,8 +1045,8 @@ int fiftyval049(cell *c) {
|
||||
// zebraval
|
||||
|
||||
int zebra40(cell *c) {
|
||||
if(c->type != 6) return (c->master->zebraval/10);
|
||||
else if(sphere || S7>7 || S6>6) return 0;
|
||||
if(ctof(c)) return (c->master->zebraval/10);
|
||||
else if(sphere) return 0;
|
||||
else if(euclid) return eupattern(c);
|
||||
else {
|
||||
int ii[3], z;
|
||||
@ -1403,7 +1403,7 @@ cell *heptatdir(cell *c, int d) {
|
||||
namespace fieldpattern {
|
||||
|
||||
pair<int, bool> fieldval(cell *c) {
|
||||
if(c->type == 7) return make_pair(c->master->fieldval, false);
|
||||
if(ctof(c)) return make_pair(c->master->fieldval, false);
|
||||
else return make_pair(btspin(c->master->fieldval, c->spin(0)), true);
|
||||
}
|
||||
|
||||
@ -1423,10 +1423,10 @@ int fieldval_uniq(cell *c) {
|
||||
if(i<0) i += torusconfig::qty;
|
||||
return i;
|
||||
}
|
||||
if(ctof(c)) return c->master->fieldval/7;
|
||||
if(ctof(c)) return c->master->fieldval/S7;
|
||||
else {
|
||||
int z = 0;
|
||||
for(int u=0; u<6; u+=2)
|
||||
for(int u=0; u<S6; u+=2)
|
||||
z = max(z, btspin(createMov(c, u)->master->fieldval, c->spin(u)));
|
||||
return -1-z;
|
||||
}
|
||||
@ -1436,28 +1436,32 @@ int fieldval_uniq_rand(cell *c, int randval) {
|
||||
if(sphere || torus || euclid)
|
||||
// we do not care in these cases
|
||||
return fieldval_uniq(c);
|
||||
if(c->type != 6) return fp43.gmul(c->master->fieldval, randval)/7;
|
||||
if(ctof(c)) return currfp.gmul(c->master->fieldval, randval)/7;
|
||||
else {
|
||||
int z = 0;
|
||||
for(int u=0; u<6; u+=2)
|
||||
z = max(z, btspin(fp43.gmul(createMov(c, u)->master->fieldval, randval), c->spin(u)));
|
||||
z = max(z, btspin(currfp.gmul(createMov(c, u)->master->fieldval, randval), c->spin(u)));
|
||||
return -1-z;
|
||||
}
|
||||
}
|
||||
|
||||
int subpathid = fp43.matcode[fp43.strtomatrix("RRRPRRRRRPRRRP")];
|
||||
int subpathorder = fp43.order(fp43.matrices[subpathid]);
|
||||
int subpathid = currfp.matcode[currfp.strtomatrix("RRRPRRRRRPRRRP")];
|
||||
int subpathorder = currfp.order(currfp.matrices[subpathid]);
|
||||
|
||||
pair<int, int> subval(cell *c, int _subpathid = subpathid, int _subpathorder = subpathorder) {
|
||||
if(c->type == 6)
|
||||
return min(min(subval(createMov(c, 0)),subval(createMov(c, 2))), subval(createMov(c, 4)));
|
||||
if(!ctof(c)) {
|
||||
auto m = subval(createMov(c, 0));
|
||||
for(int u=2; u<S6; u+=2)
|
||||
m = min(m, subval(createMov(c, u)));
|
||||
return m;
|
||||
}
|
||||
else {
|
||||
pair<int, int> pbest, pcur;
|
||||
pcur.first = c->master->fieldval;
|
||||
pcur.second = 0;
|
||||
pbest = pcur;
|
||||
for(int i=0; i<_subpathorder; i++) {
|
||||
pcur.first = fp43.gmul(pcur.first, _subpathid);
|
||||
pcur.first = currfp.gmul(pcur.first, _subpathid);
|
||||
pcur.second++;
|
||||
if(pcur < pbest) pbest = pcur;
|
||||
}
|
||||
@ -1485,7 +1489,7 @@ int celldistance(cell *c1, cell *c2) {
|
||||
}
|
||||
|
||||
if(quotient == 2)
|
||||
return fp43.getdist(fieldpattern::fieldval(c1), fieldpattern::fieldval(c2));
|
||||
return currfp.getdist(fieldpattern::fieldval(c1), fieldpattern::fieldval(c2));
|
||||
|
||||
int d1 = celldist(c1), d2 = celldist(c2);
|
||||
|
||||
|
@ -1866,14 +1866,16 @@ eLand land_sph[LAND_SPH] = {
|
||||
laWildWest, laPalace, laBull, laPrairie, laCA
|
||||
};
|
||||
|
||||
#define LAND_OCT 25
|
||||
#define LAND_OCT 33
|
||||
eLand land_oct[LAND_OCT] = {
|
||||
laIce, laDesert, laCaves, laJungle, laAlchemist,
|
||||
laGraveyard, laRlyeh, laHell, laCocytus, laMotion,
|
||||
laDryForest, laDeadCaves, laRedRock, laMinefield, laLivefjord,
|
||||
laStorms, laOvergrown, laRose, laKraken, laBurial,
|
||||
laTrollheim, laBull, laHunting,
|
||||
laCaribbean, laCamelot
|
||||
laCaribbean, laCamelot, laPalace, laMirrorOld,
|
||||
laVolcano, laBlizzard, laTerracotta,
|
||||
laWineyard, laPower, laEmerald
|
||||
};
|
||||
|
||||
|
||||
|
59
complex.cpp
59
complex.cpp
@ -1124,20 +1124,20 @@ namespace mirror {
|
||||
}
|
||||
return;
|
||||
}
|
||||
for(int i=0; i<6; i++) {
|
||||
for(int i=0; i<S6; i++) {
|
||||
cwstep(cw);
|
||||
if(cw.c->type == 6) {
|
||||
if(!ctof(cw.c)) {
|
||||
cwspin(cw, 2);
|
||||
cwstep(cw);
|
||||
cwspin(cw, 4-i);
|
||||
cwspin(cw, S6-2-i);
|
||||
createMirror(cw, cpid);
|
||||
cwspin(cw, 6-4+i);
|
||||
cwspin(cw, 2+i);
|
||||
cwstep(cw);
|
||||
cwspin(cw, 2);
|
||||
cwspin(cw, S6-4);
|
||||
cwstep(cw);
|
||||
cwspin(cw, 2-i);
|
||||
createMirror(cw, cpid);
|
||||
cwspin(cw, 6-2+i);
|
||||
cwspin(cw, S6-2+i);
|
||||
cwstep(cw);
|
||||
cwspin(cw, 2);
|
||||
}
|
||||
@ -2066,6 +2066,7 @@ void livecaves() {
|
||||
else if(w == waGargoyle) c->aitmp--;
|
||||
else if(w == waGargoyleFloor) c->aitmp--;
|
||||
else if(w == waGargoyleBridge) c->aitmp--;
|
||||
else if(w == waStone) ;
|
||||
else if(w == waDeadTroll) c->aitmp -= 5;
|
||||
else if(w == waDeadTroll2) c->aitmp -= 3;
|
||||
else if(w == waPetrified || w == waPetrifiedBridge) c->aitmp -= 2;
|
||||
@ -2703,9 +2704,9 @@ namespace prairie {
|
||||
}
|
||||
else {
|
||||
if(!from) {
|
||||
for(int i=0; i<size(fp43.matrices); i++)
|
||||
if(fp43.distflower[i] == 0)
|
||||
c->fval = fp43.inverses[i]+1;
|
||||
for(int i=0; i<size(currfp.matrices); i++)
|
||||
if(currfp.distflower[i] == 0)
|
||||
c->fval = currfp.inverses[i]+1;
|
||||
}
|
||||
else if(from && from->land == laPrairie && from->fval)
|
||||
c->fval = from->fval;
|
||||
@ -2729,15 +2730,15 @@ namespace prairie {
|
||||
}
|
||||
}
|
||||
pair<int,bool> fv = fieldpattern::fieldval(c);
|
||||
fv = fp43.gmul(fv, fp43.inverses[c->fval-1]);
|
||||
fv = currfp.gmul(fv, fp43.inverses[c->fval-1]);
|
||||
|
||||
rd = fp43.getdist(fv, fp43.distriver);
|
||||
int rl = fp43.getdist(fv, fp43.distriverleft);
|
||||
int rr = fp43.getdist(fv, fp43.distriverright);
|
||||
rd = currfp.getdist(fv, fp43.distriver);
|
||||
int rl = currfp.getdist(fv, fp43.distriverleft);
|
||||
int rr = currfp.getdist(fv, fp43.distriverright);
|
||||
|
||||
c->LHU.fi.flowerdist = fp43.getdist(fv, fp43.distflower);
|
||||
c->LHU.fi.walldist = fp43.getdist(fv, fp43.distwall);
|
||||
c->LHU.fi.walldist2 = fp43.getdist(fv, fp43.distwall2);
|
||||
c->LHU.fi.flowerdist = currfp.getdist(fv, fp43.distflower);
|
||||
c->LHU.fi.walldist = currfp.getdist(fv, fp43.distwall);
|
||||
c->LHU.fi.walldist2 = currfp.getdist(fv, fp43.distwall2);
|
||||
|
||||
c->LHU.fi.rval = 0;
|
||||
if(rd <= 7 && rl < rr)
|
||||
@ -2751,7 +2752,7 @@ namespace prairie {
|
||||
if(c->LHU.fi.walldist == 0) c->wall = waBarrier;
|
||||
|
||||
if(0) if(c->type == 7) for(int i=0; i<7; i++) {
|
||||
eItem m = fp43.markers[fieldpattern::btspin(c->master->fieldval,i)];
|
||||
eItem m = currfp.markers[fieldpattern::btspin(c->master->fieldval,i)];
|
||||
if(m) {
|
||||
if(c->item) c->item = itBuggy2;
|
||||
else c->item = m, c->mondir = i;
|
||||
@ -3054,13 +3055,16 @@ namespace windmap {
|
||||
if(N == 18920) precomp = windcodes18920;
|
||||
if(N == 5676) precomp = windcodes5676;
|
||||
|
||||
if(precomp && size(fp43.matrices)) {
|
||||
int randval = hrand(size(fp43.matrices));
|
||||
if(precomp && size(currfp.matrices)) {
|
||||
int randval = hrand(size(currfp.matrices));
|
||||
for(int i=0; i<N; i++)
|
||||
windcodes[i] = precomp[getid[fieldpattern::fieldval_uniq_rand(samples[i], randval)]-1];
|
||||
return;
|
||||
}
|
||||
|
||||
int tries = 0;
|
||||
tryagain:
|
||||
|
||||
for(int i=0; i<N; i++) windcodes[i] = hrand(256);
|
||||
|
||||
bool inqueue[N];
|
||||
@ -3069,7 +3073,7 @@ namespace windmap {
|
||||
random_shuffle(tocheck.begin(), tocheck.end());
|
||||
|
||||
for(int a=0; a<size(tocheck); a++) {
|
||||
if(a >= 200*N) break;
|
||||
if(a >= 200*N) { printf("does not converge\n"); break; }
|
||||
int bestval = 1000000000, best = 0;
|
||||
int i = tocheck[a];
|
||||
for(int k=0; k<256; k++) {
|
||||
@ -3089,7 +3093,19 @@ namespace windmap {
|
||||
inqueue[i] = false;
|
||||
windcodes[i] = best;
|
||||
}
|
||||
if(false) {
|
||||
|
||||
int ingroup[4];
|
||||
for(int u=0; u<4; u++) ingroup[u] = 0;
|
||||
for(int i=0; i<N; i++) ingroup[windcodes[i] >> 6]++;
|
||||
for(int u=0; u<4; u++) if(!ingroup[u]) {
|
||||
tries++;
|
||||
if(tries < 5) goto tryagain;
|
||||
}
|
||||
if(tries >= 5) {
|
||||
addMessage("Failed to generate an interesting wind/lava pattern.");
|
||||
}
|
||||
|
||||
if(true) {
|
||||
printf("tocheck size = %d\n", size(tocheck));
|
||||
printf("if(N == %d) {\n", N);
|
||||
printf(" windcodes = {");
|
||||
@ -3101,7 +3117,6 @@ namespace windmap {
|
||||
}
|
||||
|
||||
int at(cell *c) {
|
||||
if(weirdhyperbolic) return ((size_t)c) % 255;
|
||||
return windmap::windcodes[windmap::getId(c)];
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,6 @@ movedir vectodir(const hyperpoint& P) {
|
||||
binv = dirdist[i];
|
||||
res.d = i;
|
||||
res.subdir = dirdist[(i+1)%cwt.c->type] < dirdist[(i+cwt.c->type-1)%cwt.c->type] ? 1 : -1;
|
||||
if(sphere) res.subdir = -res.subdir;
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,8 +116,6 @@ void calcMousedest() {
|
||||
if(cwt.mirrored)
|
||||
mousedest.d = fixdir(-mousedest.d, cwt.c),
|
||||
mousedest.subdir = -mousedest.subdir;
|
||||
|
||||
if(sphere) mousedest.subdir = -mousedest.subdir;
|
||||
}
|
||||
|
||||
if(vid.revcontrol == true) { mouseh[0] = -mouseh[0]; mouseh[1] = -mouseh[1]; }
|
||||
|
@ -34,7 +34,7 @@ bool operator < (const matrix& A, const matrix& B) {
|
||||
}
|
||||
|
||||
int btspin(int id, int d) {
|
||||
return 7*(id/7) + (id + d) % 7;
|
||||
return S7*(id/S7) + (id + d) % S7;
|
||||
}
|
||||
|
||||
struct fpattern {
|
||||
@ -153,8 +153,8 @@ struct fpattern {
|
||||
vector<int> connections;
|
||||
|
||||
vector<int> inverses;
|
||||
vector<int> rrf; // rrf[i] equals gmul(i, 6)
|
||||
vector<int> rpf; // rpf[i] equals gmul(i, 7)
|
||||
vector<int> rrf; // rrf[i] equals gmul(i, S7-1)
|
||||
vector<int> rpf; // rpf[i] equals gmul(i, S7)
|
||||
|
||||
matrix mpow(matrix M, int N) {
|
||||
while((N&1) == 0) N >>= 1, M = mmul(M, M);
|
||||
@ -184,7 +184,7 @@ struct fpattern {
|
||||
string decodepath(int i) {
|
||||
string s;
|
||||
while(i) {
|
||||
if(i % 7) i--, s += 'R';
|
||||
if(i % S7) i--, s += 'R';
|
||||
else i = connections[i], s += 'P';
|
||||
}
|
||||
return s;
|
||||
@ -242,7 +242,10 @@ struct fpattern {
|
||||
R[0][1] = sn; R[1][0] = sub(0, sn);
|
||||
|
||||
matrix Z = R;
|
||||
for(int i=0; i<6; i++) Z = mmul(Z, R);
|
||||
for(int i=1; i<S7; i++) {
|
||||
if(Z == Id) goto nextcs;
|
||||
Z = mmul(Z, R);
|
||||
}
|
||||
|
||||
if(Z != Id) continue;
|
||||
if(R[0][0] == 1) continue;
|
||||
@ -257,10 +260,16 @@ struct fpattern {
|
||||
P[2][0] = sh;
|
||||
P[2][2] = ch;
|
||||
|
||||
matrix Z = mmul(P, R);
|
||||
Z = mmul(Z, mmul(Z, Z));
|
||||
if(Z == Id) return 0;
|
||||
matrix Z1 = mmul(P, R);
|
||||
matrix Z = Z1;
|
||||
for(int i=1; i<S3; i++) {
|
||||
if(Z == Id) goto nextch;
|
||||
Z = mmul(Z, Z1);
|
||||
}
|
||||
if(Z == Id) return 0;
|
||||
nextch: ;
|
||||
}
|
||||
nextcs: ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,7 +286,7 @@ struct fpattern {
|
||||
|
||||
matcode.clear(); matrices.clear();
|
||||
add(Id);
|
||||
if(matrices.size() != 7) { printf("Error: rotation crash\n"); exit(1); }
|
||||
if(size(matrices) != S7) { printf("Error: rotation crash #1 (%d)\n", size(matrices)); exit(1); }
|
||||
|
||||
connections.clear();
|
||||
|
||||
@ -289,7 +298,7 @@ struct fpattern {
|
||||
|
||||
add(PM);
|
||||
|
||||
if(matrices.size() % 7) { printf("Error: rotation crash\n"); exit(1); }
|
||||
if(size(matrices) % S7) { printf("Error: rotation crash (%d)\n", size(matrices)); exit(1); }
|
||||
|
||||
if(!matcode.count(PM)) { printf("Error: not marked\n"); exit(1); }
|
||||
|
||||
@ -301,12 +310,12 @@ struct fpattern {
|
||||
|
||||
DEBB(DF_FIELD, (debugfile, "Number of heptagons: %d\n", N));
|
||||
|
||||
rrf.resize(N); rrf[0] = 6;
|
||||
rrf.resize(N); rrf[0] = S7-1;
|
||||
for(int i=0; i<N; i++)
|
||||
rrf[btspin(i,1)] = btspin(rrf[i], 1),
|
||||
rrf[connections[i]] = connections[rrf[i]];
|
||||
|
||||
rpf.resize(N); rpf[0] = 7;
|
||||
rpf.resize(N); rpf[0] = S7;
|
||||
for(int i=0; i<N; i++)
|
||||
rpf[btspin(i,1)] = btspin(rpf[i], 1),
|
||||
rpf[connections[i]] = connections[rpf[i]];
|
||||
@ -323,7 +332,7 @@ struct fpattern {
|
||||
|
||||
if(0) for(int i=0; i<size(matrices); i++) {
|
||||
printf("%5d/%4d", connections[i], inverses[i]);
|
||||
if(i%7 == 6) printf("\n");
|
||||
if(i%S7 == S7-1) printf("\n");
|
||||
}
|
||||
|
||||
DEBB(DF_FIELD, (debugfile, "Built.\n"));
|
||||
@ -371,7 +380,7 @@ struct fpattern {
|
||||
if(dists[at] <= i) continue;
|
||||
maxd = i;
|
||||
dists[at] = i;
|
||||
for(int q=0; q<7; q++) {
|
||||
for(int q=0; q<S7; q++) {
|
||||
dists[at] = i;
|
||||
if(purehepta)
|
||||
indist[i+1].push_back(connections[at]);
|
||||
@ -409,17 +418,17 @@ struct fpattern {
|
||||
|
||||
otherpole = 0;
|
||||
|
||||
for(int i=0; i<N; i+=7) {
|
||||
for(int i=0; i<N; i+=S7) {
|
||||
int mp = 0;
|
||||
for(int q=0; q<7; q++) if(disthep[connections[i+q]] < disthep[i]) mp++;
|
||||
if(mp == 7) {
|
||||
for(int q=0; q<S7; q++) if(disthep[connections[i+q]] < disthep[i]) mp++;
|
||||
if(mp == S7) {
|
||||
bool eq = true;
|
||||
for(int q=0; q<7; q++) if(disthep[connections[i+q]] != disthep[connections[i]]) eq = false;
|
||||
for(int q=0; q<S7; q++) if(disthep[connections[i+q]] != disthep[connections[i]]) eq = false;
|
||||
if(eq) {
|
||||
// for(int q=0; q<7; q++) printf("%3d", disthep[connections[i+q]]);
|
||||
// for(int q=0; q<S7; q++) printf("%3d", disthep[connections[i+q]]);
|
||||
// printf(" (%2d) at %d\n", disthep[i], i);
|
||||
if(disthep[i] > disthep[otherpole]) otherpole = i;
|
||||
// for(int r=0; r<7; r++) {
|
||||
// for(int r=0; r<S7; r++) {
|
||||
// printf("Matrix: "); for(int a=0; a<3; a++) for(int b=0; b<3; b++)
|
||||
// printf("%4d", matrices[i+r][a][b]); printf("\n");
|
||||
// }
|
||||
@ -679,6 +688,26 @@ void info() {
|
||||
printf("cases found = %d (%d hard)\n", cases, hard);
|
||||
}
|
||||
|
||||
fpattern& getcurrfp() {
|
||||
if(S7 == 8 && S3 == 3) {
|
||||
static fpattern fp(17);
|
||||
return fp;
|
||||
}
|
||||
if(S7 == 5 && S3 == 4) {
|
||||
static fpattern fp(11);
|
||||
return fp;
|
||||
}
|
||||
if(S7 == 6 && S3 == 4) {
|
||||
static fpattern fp(13);
|
||||
return fp;
|
||||
}
|
||||
if(S7 == 7 && S3 == 4) {
|
||||
static fpattern fp(13);
|
||||
return fp;
|
||||
}
|
||||
return fp43;
|
||||
}
|
||||
|
||||
using fieldpattern::fp43;
|
||||
}
|
||||
|
||||
#define currfp fieldpattern::getcurrfp()
|
||||
|
11
game.cpp
11
game.cpp
@ -3605,9 +3605,10 @@ int determinizeBullPush(cellwalker bull) {
|
||||
int dirs[2], positive;
|
||||
cwstep(bull);
|
||||
cell *c2 = bull.c;
|
||||
if(c2->type == 6) return 1; // irrelevant
|
||||
cwspin(bull, 3); dirs[0] = positive = bull.spin;
|
||||
cwspin(bull, -6); dirs[1] = bull.spin;
|
||||
if(!(c2->type & 1)) return 1; // irrelevant
|
||||
int d = c2->type / 2;
|
||||
cwspin(bull, d); dirs[0] = positive = bull.spin;
|
||||
cwspin(bull, -2*d); dirs[1] = bull.spin;
|
||||
determinizeBull(c2, dirs, nc);
|
||||
if(dirs[0] == positive) return -1;
|
||||
return 1;
|
||||
@ -3660,11 +3661,11 @@ template<class T>
|
||||
cell *determinePush(cellwalker who, cell *c2, int subdir, T valid) {
|
||||
cellwalker push = who;
|
||||
cwstep(push);
|
||||
int pd = push.c->type == 8 ? 4 : 3;
|
||||
int pd = push.c->type/2;
|
||||
cwspin(push, pd * -subdir);
|
||||
cwstep(push);
|
||||
if(valid(push.c)) return push.c;
|
||||
if(c2->type == 7) {
|
||||
if(c2->type&1) {
|
||||
cwstep(push);
|
||||
cwspin(push, 1 * -subdir);
|
||||
cwstep(push);
|
||||
|
@ -2176,6 +2176,10 @@ void drawTowerFloor(const transmatrix& V, cell *c, int col, cellfunction *cf = c
|
||||
void drawZebraFloor(const transmatrix& V, cell *c, int col) {
|
||||
|
||||
if(euclid) { qfloor(c, V, shTower[10], col); return; }
|
||||
if(weirdhyperbolic) {
|
||||
int ct6 = ctof(c);
|
||||
qfloor(c, V, PLAINFLOOR, col); return;
|
||||
}
|
||||
|
||||
int i = zebra40(c);
|
||||
i &= ~3;
|
||||
@ -5309,7 +5313,7 @@ auto graphcm = addHook(clearmemory, 0, [] () {
|
||||
|
||||
void resetGeometry() {
|
||||
precalc();
|
||||
fp43.analyze();
|
||||
currfp.analyze();
|
||||
#if CAP_GL
|
||||
resetGL();
|
||||
#endif
|
||||
|
10
heptagon.cpp
10
heptagon.cpp
@ -4,13 +4,13 @@
|
||||
// heptagon here refers to underlying heptagonal tesselation
|
||||
// (which you can see by changing the conditions in graph.cpp)
|
||||
|
||||
#define MIRR(x) x.mirrored
|
||||
|
||||
// automaton state
|
||||
enum hstate { hsOrigin, hsA, hsB, hsError, hsA0, hsA1, hsB0, hsB1, hsC };
|
||||
|
||||
#define MODFIXER 23520
|
||||
|
||||
#define MIRR(x) x.mirrored
|
||||
|
||||
int fixrot(int a) { return (a+MODFIXER)% S7; }
|
||||
int fix42(int a) { return (a+MODFIXER)% S42; }
|
||||
|
||||
@ -133,16 +133,14 @@ heptagon *buildHeptagon(heptagon *parent, int d, hstate s, int pard = 0, int fix
|
||||
if(parent->c7) {
|
||||
h->c7 = newCell(S7, h);
|
||||
h->rval0 = h->rval1 = 0; h->cdata = NULL;
|
||||
if(!weirdhyperbolic) {
|
||||
h->emeraldval = emerald_heptagon(parent->emeraldval, d);
|
||||
h->zebraval = zebra_heptagon(parent->zebraval, d);
|
||||
h->fieldval = fp43.connections[fieldpattern::btspin(parent->fieldval, d)];
|
||||
h->fieldval = currfp.connections[fieldpattern::btspin(parent->fieldval, d)];
|
||||
if(parent->s == hsOrigin)
|
||||
h->fiftyval = fiftytable[0][d];
|
||||
h->fiftyval = firstfiftyval(d);
|
||||
else
|
||||
h->fiftyval = nextfiftyval(parent->fiftyval, parent->move[0]->fiftyval, d);
|
||||
}
|
||||
}
|
||||
else {
|
||||
h->c7 = NULL;
|
||||
h->emeraldval = 0;
|
||||
|
12
hyper.cpp
12
hyper.cpp
@ -236,7 +236,7 @@ else if(args()[0] == '-' && args()[1] == x && args()[2] == '0') { showstartmenu
|
||||
}
|
||||
else if(argis("-qs")) {
|
||||
autocheat = true;
|
||||
shift(); fp43.qpaths.push_back(args());
|
||||
shift(); currfp.qpaths.push_back(args());
|
||||
}
|
||||
else if(argis("-fix")) {
|
||||
fixseed = true; autocheat = true;
|
||||
@ -255,7 +255,7 @@ else if(args()[0] == '-' && args()[1] == x && args()[2] == '0') { showstartmenu
|
||||
&p, "ientspace::rvadd, "ientspace::rvdir
|
||||
);
|
||||
autocheat = true;
|
||||
fp43.init(p);
|
||||
currfp.init(p);
|
||||
}
|
||||
else if(argis("-tpar")) {
|
||||
shift(); sscanf(args(), "%d,%d,%d",
|
||||
@ -266,14 +266,14 @@ else if(args()[0] == '-' && args()[1] == x && args()[2] == '0') { showstartmenu
|
||||
}
|
||||
else if(argis("-cs")) {
|
||||
shift();
|
||||
fieldpattern::matrix M = fp43.strtomatrix(args());
|
||||
fieldpattern::subpathid = fp43.matcode[M];
|
||||
fieldpattern::subpathorder = fp43.order(M);
|
||||
fieldpattern::matrix M = currfp.strtomatrix(args());
|
||||
fieldpattern::subpathid = currfp.matcode[M];
|
||||
fieldpattern::subpathorder = currfp.order(M);
|
||||
autocheat = true;
|
||||
}
|
||||
else if(argis("-csp")) {
|
||||
autocheat = true;
|
||||
fp43.findsubpath();
|
||||
currfp.findsubpath();
|
||||
}
|
||||
else if(argis("-fi")) {
|
||||
fieldpattern::info();
|
||||
|
17
landgen.cpp
17
landgen.cpp
@ -313,7 +313,8 @@ void giantLandSwitch(cell *c, int d, cell *from) {
|
||||
}
|
||||
else {
|
||||
int v = emeraldval(c);
|
||||
if((v&3) >= 2)
|
||||
if(v == 0) c->wall = waStone;
|
||||
else if((v&3) >= 2)
|
||||
c->wall = waCavewall;
|
||||
else c->wall = waCavefloor;
|
||||
}
|
||||
@ -373,6 +374,8 @@ void giantLandSwitch(cell *c, int d, cell *from) {
|
||||
if(y0 == 3 || y0 == 4) v=24; else v=0;
|
||||
}
|
||||
else v = emeraldval(c);
|
||||
if(v == 0) c->wall = waStone;
|
||||
else {
|
||||
v &= ~3;
|
||||
if((v == 24 || v == 32 || v == 56))
|
||||
c->wall = waEternalFire;
|
||||
@ -388,6 +391,7 @@ void giantLandSwitch(cell *c, int d, cell *from) {
|
||||
c->item = protectedItems[hrand(18)];
|
||||
}
|
||||
}
|
||||
}
|
||||
// seal entrances to the Land of Power.
|
||||
if(d == 7 && c->type == 7) {
|
||||
bool onwall = false;
|
||||
@ -411,7 +415,7 @@ void giantLandSwitch(cell *c, int d, cell *from) {
|
||||
itOrbFlash, itOrbSpeed, itOrbFire, itOrbWinter, itOrbAether, itOrbLife};
|
||||
c->item = powerorbs[hrand(6)];
|
||||
}
|
||||
else if(c->type == 6 && hrand(5000) < 10)
|
||||
else if(!ctof(c) && hrand(5000) < 10)
|
||||
c->wall = hrand(2) ? waMirror : waCloud;
|
||||
else if(hrand(1000) < 10 + (items[itPower] ? 10:0) + (items[itPower] + yendor::hardness()))
|
||||
c->monst = eMonster(moWitch + hrand(NUMWITCH));
|
||||
@ -449,6 +453,8 @@ void giantLandSwitch(cell *c, int d, cell *from) {
|
||||
}
|
||||
else {
|
||||
int v = emeraldval(c);
|
||||
if(v == 0) c->wall = waStone;
|
||||
else {
|
||||
int w = v / 4;
|
||||
if(randomPatternsMode) c->wall = RANDPAT ? waVinePlant : waNone;
|
||||
else if(w == 9 || w == 10 || w == 7 || w == 8) {
|
||||
@ -461,6 +467,7 @@ void giantLandSwitch(cell *c, int d, cell *from) {
|
||||
else c->wall = waNone;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(d == 7 && c->wall == waVinePlant && hrand(100) < (randomPatternsMode ? 2 : 10) && !peace::on)
|
||||
c->monst = moVineSpirit;
|
||||
ONEMPTY {
|
||||
@ -1841,11 +1848,11 @@ void giantLandSwitch(cell *c, int d, cell *from) {
|
||||
ONEMPTY {
|
||||
if(purehepta && c->land == laCrossroads5 && hrand(100) < 60)
|
||||
c->wall = waBarrier;
|
||||
else if(c->type == 6 && !inv::on && items[itShard] >= 10 && hrand(8000) < 120*orbcrossfun(items[itShard]))
|
||||
else if(!ctof(c) && !inv::on && items[itShard] >= 10 && hrand(8000) < 120*orbcrossfun(items[itShard]))
|
||||
c->wall = hrand(2) ? waMirror : waCloud;
|
||||
else if(c->type == 6 && hyperstonesUnlocked() && hrand(8000) < 100)
|
||||
else if(!ctof(c) && hyperstonesUnlocked() && hrand(8000) < 100)
|
||||
c->wall = hrand(2) ? waMirror : waCloud;
|
||||
else if(c->type == 6 && tactic::on && isCrossroads(tactic::lasttactic) && hrand(8000) < 120)
|
||||
else if(!ctof(c) && tactic::on && isCrossroads(tactic::lasttactic) && hrand(8000) < 120)
|
||||
c->wall = hrand(2) ? waMirror : waCloud;
|
||||
else if(c->land == laCrossroads4 && hrand(24000) < 10 && tactic::on)
|
||||
c->wall = waRose;
|
||||
|
@ -1752,22 +1752,22 @@ namespace mapeditor {
|
||||
int generateCanvas(cell *c) {
|
||||
if(whichCanvas == 'C') {
|
||||
using namespace fieldpattern;
|
||||
int z = fp43.getdist(fieldval(c), make_pair(0,false));
|
||||
if(z < fp43.circrad) return 0x00C000;
|
||||
int z2 = fp43.getdist(fieldval(c), make_pair(fp43.otherpole,false));
|
||||
if(z2 < fp43.disthep[fp43.otherpole] - fp43.circrad)
|
||||
int z = currfp.getdist(fieldval(c), make_pair(0,false));
|
||||
if(z < currfp.circrad) return 0x00C000;
|
||||
int z2 = currfp.getdist(fieldval(c), make_pair(fp43.otherpole,false));
|
||||
if(z2 < currfp.disthep[fp43.otherpole] - fp43.circrad)
|
||||
return 0x3000;
|
||||
return 0x6000;
|
||||
}
|
||||
if(whichCanvas == 'D') {
|
||||
using namespace fieldpattern;
|
||||
int z = fp43.getdist(fieldval(c), make_pair(0,false));
|
||||
return 255 * (fp43.maxdist+1-z) / fp43.maxdist;
|
||||
int z = currfp.getdist(fieldval(c), make_pair(0,false));
|
||||
return 255 * (currfp.maxdist+1-z) / fp43.maxdist;
|
||||
}
|
||||
if(whichCanvas == 'N') {
|
||||
using namespace fieldpattern;
|
||||
int z = fp43.getdist(fieldval(c), make_pair(0,false));
|
||||
int z2 = fp43.getdist(fieldval(c), make_pair(fp43.otherpole,false));
|
||||
int z = currfp.getdist(fieldval(c), make_pair(0,false));
|
||||
int z2 = currfp.getdist(fieldval(c), make_pair(fp43.otherpole,false));
|
||||
if(z < z2) return 0x00C000;
|
||||
if(z > z2) return 0xC00000;
|
||||
return 0xCCCC00;
|
||||
|
@ -650,7 +650,7 @@ void showPickGeometry() {
|
||||
if(tq & qTORUS) worldsize = torusconfig::qty;
|
||||
if(tq & qZEBRA) worldsize = targettrunc ? 12 : 40;
|
||||
if(tq & qFIELD) {
|
||||
worldsize = size(fp43.matrices) / ts;
|
||||
worldsize = size(currfp.matrices) / ts;
|
||||
if(!targettrunc) worldsize = (10*worldsize) / 3;
|
||||
}
|
||||
|
||||
|
12
patterns.cpp
12
patterns.cpp
@ -7,6 +7,8 @@
|
||||
// rules for the emeraldvalues of heptagons.
|
||||
int emerald_heptagon(int parent, int dir) {
|
||||
|
||||
if(S7 == 8 && dir > 3) dir--;
|
||||
|
||||
// no emeraldgen here
|
||||
if(parent == 0) return 0;
|
||||
|
||||
@ -357,6 +359,7 @@ int emerald_heptagon(int parent, int dir) {
|
||||
|
||||
#undef RULE
|
||||
|
||||
if(weirdhyperbolic) return 0;
|
||||
printf("HEPTAGONAL RULE MISSING for (%d,%d)\n", parent,dir);
|
||||
exit(1);
|
||||
}
|
||||
@ -408,6 +411,7 @@ int emerald_hexagon(int a, int b, int c) {
|
||||
if(a==34 && b == 35 && c== 41) return 59;
|
||||
if(a==34 && b == 40 && c== 35) return 58;
|
||||
if(a==34 && b == 41 && c== 35) return 25;
|
||||
if(!weirdhyperbolic)
|
||||
printf("HEXAGONAL RULE MISSING for (%d,%d,%d)\n", a,b,c);
|
||||
return 0;
|
||||
// exit(1);
|
||||
@ -1005,9 +1009,16 @@ RULE50(0x1df, 0x0c6, 0x1ae, 0x0ff, 0x0df, 0x1b7, 0x0f7, 0x1a6)
|
||||
|
||||
#undef RULE50
|
||||
|
||||
int firstfiftyval(int d) {
|
||||
if(S7 == 8 && d > 3) d--;
|
||||
return fiftytable[0][d];
|
||||
}
|
||||
|
||||
int nextfiftyval(int par, int gpar, int d) {
|
||||
if(S7 == 8 && d > 3) d--;
|
||||
for(int i=0; i<7; i++) if(fiftytable[par][i] == gpar)
|
||||
return fiftytable[par][(i+d)%7];
|
||||
if(weirdhyperbolic) return 0;
|
||||
printf("fifty pattern error!\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -1052,6 +1063,7 @@ int zebratable6[28][3] = {
|
||||
|
||||
// rules for the emeraldvalues of heptagons.
|
||||
int zebra_heptagon(int parent, int dir) {
|
||||
if(S7 == 8 && dir > 3) dir--;
|
||||
return zebratable[parent/10-4][(70+dir-(parent%10))%7];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user