Merge branch 'master' into misc-windows

This commit is contained in:
Zeno Rogue authored and GitHub committed 2018-06-28 15:13:42 +02:00
commit 0d0eb06886
19 files changed
+400 -330

No files matched your search

+1 -10
View File
@@ -970,15 +970,6 @@ int wallchance(cell *c, bool deepOcean) {
50;
}
bool mouse_reachability_test(cell *c) {
if(c->pathdist != PINFD)
return true;
forCellEx(c2, c)
if(passable(c, c2, 0) && c2->mpdist < c->mpdist)
return mouse_reachability_test(c2);
return false;
}
bool horo_ok() {
// do the horocycles work in the current geometry?
// (they work in ALL hyperbolic geometries currently!)
@@ -1139,7 +1130,7 @@ void buildBigStuff(cell *c, cell *from) {
createAlternateMap(c, 2, hsA);
if(c->land == laPalace && ctof(c) && !princess::generating && !shmup::on && multi::players == 1 && horo_ok() && !weirdhyperbolic &&
(princess::forceMouse ? mouse_reachability_test(from) :
(princess::forceMouse ? canReachPlayer(from, moMouse) :
(hrand(2000) < (peace::on ? 100 : 20))) &&
!c->master->alt &&
(princess::challenge || kills[moVizier] || peace::on) && !tactic::on && !yendor::on) {
+4 -4
View File
@@ -59,7 +59,7 @@ vector<blizzardcell*> bcells;
int N;
blizzardcell* getbcell(cell *c) {
int i = c->aitmp;
int i = c->listindex;
if(i<0 || i >= N) return NULL;
if(bcells[i]->c != c) return NULL;
return bcells[i];
@@ -80,8 +80,8 @@ void drawBlizzards() {
N = isize(bcells);
for(int i=0; i<N; i++) {
auto& bc = *bcells[i];
bc.tmp = bc.c->aitmp,
bc.c->aitmp = i;
bc.tmp = bc.c->listindex,
bc.c->listindex = i;
bc.gm = &gmatrix[bc.c];
bc.wmap = windmap::at(bc.c);
}
@@ -223,7 +223,7 @@ void drawBlizzards() {
}
for(auto bc: bcells)
bc->c->aitmp = bc->tmp;
bc->c->listindex = bc->tmp;
}
vector<cell*> arrowtraps;
+12
View File
@@ -2513,3 +2513,15 @@ non-game:
2018.06.24 01:19 Update 10.4g
- fixed Arrow Traps not killing anything (and possibly other similar cases)
- fixed the 'skip start menu' option
2018.06.28 14:14 Update 10.4h
- fixed the map not being generated far enough in non-std geometries after Teleport (and other orbs)
- fixed the missing message when picking up orbs from a boat
- rewritten various pathfinding (and similar) algorithms in a more robust way
- Orb of Freedom is now checked after the Terracotta Warriors, and it consider active arrow traps as impassable
- kills-at-once achievements now also count the 'original' kill; it no longer counts if a monster performs the killing
- in quotient geometries, the whole world is now generated from the start (otherwise e.g. Blizzard breaks down); also the windmap (used in Blizzard/Volcanic) is now generated correctly in field quotient
- an option to display all floors as 'full', i.e., without spaces between them ('r' in map/graphics editor)
- new commandline options: -fsh (floor shape display) and -noshadow (disable shadows)
- fixed a bug with Orb of Mirror display in OSM
+151 -123
View File
@@ -104,8 +104,8 @@ namespace whirlwind {
}
}
void moveAt(cell *c) {
if(eq(c->aitmp, sval)) return;
void moveAt(cell *c, manual_celllister& cl) {
if(cl.listed(c)) return;
calcdirs(c);
if(qdirs != 1) return;
vector<cell*> whirlline;
@@ -129,7 +129,7 @@ namespace whirlwind {
// printf("Cycle built from %p, length = %d\n", c, z);
for(int i=0; i<z; i++) {
// printf("%d%c", whirlline[i]->mpdist, whirlline[i]->item ? '*' : ' ');
whirlline[i]->aitmp = sval;
cl.add(whirlline[i]);
if(whirlline[i]->mpdist == BARLEV)
switchTreasure(whirlline[i]);
}
@@ -143,16 +143,16 @@ namespace whirlwind {
}
void move() {
sval++;
manual_celllister cl;
for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
moveAt(c);
moveAt(c, cl);
}
// Keys and Orbs of Yendor always move
using namespace yendor;
for(int i=0; i<isize(yi); i++) {
moveAt(yi[i].path[0]);
moveAt(yi[i].path[YDIST-1]);
moveAt(yi[i].path[0], cl);
moveAt(yi[i].path[YDIST-1], cl);
}
}
@@ -265,23 +265,23 @@ namespace elec {
vector<cell*> chargecells;
bool hasdata(cell *c) {
return c->aitmp >= 0 && c->aitmp < isize(charges) && charges[c->aitmp].c == c;
return c->listindex >= 0 && c->listindex < isize(charges) && charges[c->listindex].c == c;
}
void connect(int from, cell *c) {
if(hasdata(c)) {
// seen again: set the lowlink
if(!charges[c->aitmp].instack) return;
// printf("edge %d-%d\n", from, c->aitmp);
if(c->aitmp < charges[from].lowlink)
charges[from].lowlink = c->aitmp;
if(!charges[c->listindex].instack) return;
// printf("edge %d-%d\n", from, c->listindex);
if(c->listindex < charges[from].lowlink)
charges[from].lowlink = c->listindex;
}
else {
int id = isize(charges);
charges.push_back(chargedata());
{chargedata& ch(charges[id]);
ch.c = c; ch.otmp = c->aitmp; ch.lowlink = id; c->aitmp = id;
ch.c = c; ch.otmp = c->listindex; ch.lowlink = id; c->listindex = id;
ch.instack = true; ch.fire = false;
}
// c->landparam = id;
@@ -304,7 +304,7 @@ namespace elec {
for(int i=0; i<c->type; i++) {
cell *c2 = c->mov[i];
if(!c2) continue;
if(c2->aitmp == from) continue;
if(c2->listindex == from) continue;
eCharge ct = getCharge(c2);
if(conduct(chh, ct))
connect(id, c2);
@@ -349,29 +349,31 @@ namespace elec {
c->wall = waMetal; */
}
void listChargedCells(cell *c, eCharge last = ecConductor) {
if(eq(c->aitmp, sval)) return;
void listChargedCells(cell *c, manual_celllister& cl, eCharge last = ecConductor) {
if(cl.listed(c)) return;
eCharge here = getCharge(c);
/* if(c->cpdist <= 2) {
printf("monst=%s ", dnameof(c->monst));
printf("wall=%s ", dnameof(c->wall));
printf("c=%p here=%d last=%d\n", c, here, last);
} */
if(here == ecIsolator) c->aitmp = sval;
if(here == ecIsolator) cl.add(c);
if(!conduct(last, here)) return;
if(here == ecCharged) chargecells.push_back(c);
c->aitmp = sval;
cl.add(c);
for(int i=0; i<c->type; i++) {
cell *c2 = c->mov[i];
if(c2) listChargedCells(c2, here);
if(c2) listChargedCells(c2, cl, here);
}
}
void init() {
chargecells.clear();
if(!haveelec && !afterOrb) return;
sval++;
for(int i=0; i<isize(dcal); i++) listChargedCells(dcal[i]);
if(1) {
manual_celllister cl;
for(int i=0; i<isize(dcal); i++) listChargedCells(dcal[i], cl);
}
charges.resize(2);
charges[0].lowlink = 0; charges[1].lowlink = 1;
@@ -406,7 +408,7 @@ namespace elec {
void cleanup() {
for(int i=2; i<isize(charges); i++)
charges[i].c->aitmp = charges[i].otmp;
charges[i].c->listindex = charges[i].otmp;
charges.resize(0);
}
@@ -429,8 +431,8 @@ namespace elec {
}
bool affected(cell *c) {
if(c->aitmp >= 0 && c->aitmp < isize(charges) && charges[c->aitmp].c == c)
return charges[c->aitmp].fire;
if(c->listindex >= 0 && c->listindex < isize(charges) && charges[c->listindex].c == c)
return charges[c->listindex].fire;
return false;
}
@@ -1011,9 +1013,9 @@ namespace whirlpool {
generate(wto);
}
void moveAt(cell *c) {
void moveAt(cell *c, manual_celllister& cl) {
if(c->land != laWhirlpool) return;
if(eq(c->aitmp, sval)) return;
if(cl.listed(c)) return;
if(!(euclid || c->master->alt)) return;
cell *c2 = get(c, 1);
if(!c2) return;
@@ -1027,7 +1029,7 @@ namespace whirlpool {
int z = isize(whirlline);
for(int i=0; i<z; i++)
whirlline[i]->aitmp = sval;
cl.add(whirlline[i]);
whirlMove(NULL, whirlline[0]);
@@ -1038,16 +1040,16 @@ namespace whirlpool {
}
void move() {
sval++;
manual_celllister cl;
for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
moveAt(c);
moveAt(c, cl);
}
// Keys and Orbs of Yendor always move
using namespace yendor;
for(int i=0; i<isize(yi); i++) {
moveAt(yi[i].path[0]);
moveAt(yi[i].path[YDIST-1]);
moveAt(yi[i].path[0], cl);
moveAt(yi[i].path[YDIST-1], cl);
}
}
}
@@ -1466,7 +1468,7 @@ namespace hive {
}
void bugcell(cell *c) {
short& i(c->aitmp);
int& i(c->listindex);
if(i >= 0 && i < isize(buginfo) && buginfo[i].where == c)
return;
i = isize(buginfo);
@@ -1528,9 +1530,9 @@ namespace hive {
for(int dir=0; dir<c->type; dir++) {
cell *c2 = c->mov[dir];
if(!c2) continue;
if(c2->aitmp < 0 || c2->aitmp >= isize(buginfo)) continue;
if(c2->listindex < 0 || c2->listindex >= isize(buginfo)) continue;
if(!passable(c, c2, P_MONSTER)) continue;
int j = c2->aitmp;
int j = c2->listindex;
if(buginfo[j].where != c2) continue;
if(buginfo[j].dist[k] < d) goodmoves++;
bugQueueInsert(k, j, d+1);
@@ -1610,11 +1612,11 @@ namespace hive {
qual = c2->monst == moDeadBug ? -60: isBugEnemy(c2,k) ? 2 : -20;
else if(!passable(c2, c, 0))
qual = passable(c2, c, P_DEADLY) ? -30 : -60;
else if(c2->aitmp < 0 || c2->aitmp >= isize(buginfo)) qual = -15;
else if(buginfo[c2->aitmp].where != c2) qual = -15;
else if(buginfo[c2->aitmp].dist[k] < b.dist[k])
else if(c2->listindex < 0 || c2->listindex >= isize(buginfo)) qual = -15;
else if(buginfo[c2->listindex].where != c2) qual = -15;
else if(buginfo[c2->listindex].dist[k] < b.dist[k])
qual = 1;
else if(buginfo[c2->aitmp].dist[k] == b.dist[k])
else if(buginfo[c2->listindex].dist[k] == b.dist[k])
qual = 0;
// printf("%d->#%d %d: %d\n", i, dir, c2->tmp, qual);
if(qual > bqual) bqual = qual, q=0;
@@ -1664,7 +1666,7 @@ namespace hive {
}
void bugcitycell(cell *c, int d) {
short& i = c->aitmp;
int& i = c->listindex;
if(i >= 0 && i < isize(buginfo) && buginfo[i].where == c)
return;
i = isize(buginfo);
@@ -1793,14 +1795,13 @@ namespace heat {
vector<cell*> offscreen2;
sval++;
manual_celllister cl;
int gr = gamerange();
for(cell *c: offscreen_heat) {
if(c->cpdist > gr && !doall) {
if(eq(c->aitmp, sval)) continue;
c->aitmp = sval;
if(!cl.add(c)) continue;
if(isIcyLand(c)) {
if(HEAT(c) < .01 && HEAT(c) > -.01)
HEAT(c) = 0;
@@ -1941,13 +1942,12 @@ namespace heat {
vector<cell*> offscreen2;
sval++;
manual_celllister cl;
vector<cell*>& allcells = currentmap->allcells();
for(int x: {0,1}) for(cell *c: x==0 ? allcells : offscreen_fire) {
if(eq(c->aitmp, sval)) continue;
c->aitmp = sval;
if(!cl.add(c)) continue;
if(isFireOrMagma(c)) {
if(c->wall == waMagma) c->wparam = 20;
@@ -2046,94 +2046,98 @@ void livecaves() {
vector<cell*> bringlife;
int gr = gamerange();
int heatvals[dcs];
for(int i=0; i<dcs; i++) {
cell *c = allcells[i];
if(!doall && c->cpdist > gr+1) break;
int & hv = heatvals[i];
if(c->wall == waCavefloor || c->wall == waCavewall || c->wall == waDeadTroll) {
c->aitmp = 0;
hv = 0;
if(c->monst == moDarkTroll) c->monst = moTroll;
if(c->item || c->monst || c->cpdist == 0) continue;
forCellEx(c2, c) {
eWall w = c2->wall;
if(w == waDeadfloor) c->aitmp++, bringlife.push_back(c2);
if(w == waDeadfloor) hv++, bringlife.push_back(c2);
else if(w == waDeadwall || (w == waDeadfloor2 && !c2->monst))
c->aitmp--, bringlife.push_back(c2);
else if(w == waCavefloor) c->aitmp++;
else if(w == waCavewall) c->aitmp--;
else if(w == waRubble) c->aitmp--;
else if(w == waGargoyle) c->aitmp--;
else if(w == waGargoyleFloor) c->aitmp--;
else if(w == waGargoyleBridge) c->aitmp--;
hv--, bringlife.push_back(c2);
else if(w == waCavefloor) hv++;
else if(w == waCavewall) hv--;
else if(w == waRubble) hv--;
else if(w == waGargoyle) hv--;
else if(w == waGargoyleFloor) hv--;
else if(w == waGargoyleBridge) hv--;
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;
else if(w == waVinePlant) c->aitmp--;
else if(w == waDeadTroll) hv -= 5;
else if(w == waDeadTroll2) hv -= 3;
else if(w == waPetrified || w == waPetrifiedBridge) hv -= 2;
else if(w == waVinePlant) hv--;
else if(chaosmode && c2->land != laCaves && c2->land != laEmerald) ;
else if(c2->land == laTrollheim) ; // trollheim floor does not count
else if(w != waBarrier) c->aitmp += 5;
else if(w != waBarrier) hv += 5;
if(sword::at(c)) c->aitmp += 500;
if(sword::at(c)) hv += 500;
if(c2->cpdist == 0 && markOrb(itOrbDigging)) c->aitmp+=100;
if(c2->cpdist == 0 && markOrb(itOrbDigging)) hv+=100;
if(items[itOrbEmpathy] && isFriendly(c2) && markEmpathy(itOrbDigging))
c->aitmp+=100;
if(w == waThumperOn) c->aitmp+=100;
if(w == waFire) c->aitmp+=100;
if(w == waBigStatue) c->aitmp-=100;
if(c2->item && !peace::on) c->aitmp+=2;
if(c2->monst == moZombie) c->aitmp += 10;
if(c2->monst == moGhost) c->aitmp += 10;
if(c2->monst == moTentacleGhost) c->aitmp += 10;
if(c2->monst == moFriendlyGhost) c->aitmp += 10;
if(c2->monst == moSkeleton) c->aitmp ++;
if(c2->monst == moGargoyle) c->aitmp--;
if(c2->monst == moDraugr) c->aitmp--;
if(isDragon(c2->monst)) c->aitmp++;
if(c2->monst == moNecromancer) c->aitmp += 10;
if(c2->monst == moWormtail) c->aitmp++;
if(c2->monst == moTentacletail) c->aitmp-=2;
if(isIvy(c2)) c->aitmp--;
if(isDemon(c2)) c->aitmp-=3;
hv+=100;
if(w == waThumperOn) hv+=100;
if(w == waFire) hv+=100;
if(w == waBigStatue) hv-=100;
if(c2->item && !peace::on) hv+=2;
if(c2->monst == moZombie) hv += 10;
if(c2->monst == moGhost) hv += 10;
if(c2->monst == moTentacleGhost) hv += 10;
if(c2->monst == moFriendlyGhost) hv += 10;
if(c2->monst == moSkeleton) hv ++;
if(c2->monst == moGargoyle) hv--;
if(c2->monst == moDraugr) hv--;
if(isDragon(c2->monst)) hv++;
if(c2->monst == moNecromancer) hv += 10;
if(c2->monst == moWormtail) hv++;
if(c2->monst == moTentacletail) hv-=2;
if(isIvy(c2)) hv--;
if(isDemon(c2)) hv-=3;
// if(c2->monst) c->tmp++;
// if(c2->monst == moTroll) c->tmp -= 3;
}
}
else if(c->land == laLivefjord) {
c->aitmp = 0;
hv = 0;
if(c->monst == moWaterElemental)
c->aitmp += 1000;
hv += 1000;
if(isPlayerInBoatOn(c) && markOrb(itOrbWater))
c->aitmp += 1000;
hv += 1000;
if(c->monst == moEarthElemental)
c->aitmp -= 1000;
hv -= 1000;
if(isPlayerOn(c) && markOrb(itOrbDigging))
c->aitmp -= 1000;
hv -= 1000;
for(int j=0; j<c->type; j++) if(c->mov[j]) {
cell *c2 = c->mov[j];
if(c2->wall == waNone || c2->wall == waStrandedBoat)
c->aitmp -= (c2->land == laLivefjord ? 1 : 100);
hv -= (c2->land == laLivefjord ? 1 : 100);
if(c2->wall == waTempFloor || c2->wall == waTempBridge || c2->wall == waTempBridgeBlocked)
;
else if(c2->wall == waDeadTroll || c2->wall == waDeadTroll2 || c2->wall == waThumperOn || isFire(c2) || snakelevel(c2))
c->aitmp -= 10;
hv -= 10;
else if(c2->wall == waPetrified || c2->wall == waPetrifiedBridge)
c->aitmp -= 10;
hv -= 10;
if(c2->wall == waBigStatue)
c->aitmp -= 10;
hv -= 10;
if(c2->wall == waSea || c2->wall == waBoat)
c->aitmp += (c2->land == laLivefjord ? 1 : 100);
hv += (c2->land == laLivefjord ? 1 : 100);
if(c2->monst == moWaterElemental)
c->aitmp += 1000;
hv += 1000;
if(isPlayerOn(c2) && c2->wall == waBoat && markOrb(itOrbWater))
c->aitmp += 1000;
hv += 1000;
if(c2->monst == moEarthElemental)
c->aitmp -= 1000;
hv -= 1000;
if(isPlayerOn(c2) && markOrb(itOrbDigging))
c->aitmp -= 1000;
hv -= 1000;
if(items[itOrbEmpathy] && isFriendly(c2) && markEmpathy(itOrbDigging))
c->aitmp -= 1000;
hv -= 1000;
if(c2->wall == waBarrier) {
bool landbar = false;
@@ -2143,8 +2147,8 @@ void livecaves() {
if(!isSealand(c3->land))
landbar = true;
}
if(landbar) c->aitmp -= 5;
else c->aitmp += 5;
if(landbar) hv -= 5;
else hv += 5;
}
}
}
@@ -2153,13 +2157,14 @@ void livecaves() {
for(int i=0; i<dcs; i++) {
cell *c = allcells[i];
if(!doall && c->cpdist > gr+1) break;
int hv = heatvals[i];
if(c->wall == waCavefloor || c->wall == waCavewall) {
// if(c->land != laCaves) continue;
// if(c->wall == waThumper || c->wall == waBonfire) continue;
if(c->aitmp > 0) c->wall = waCavefloor;
if(c->aitmp < 0) {
if(hv > 0) c->wall = waCavefloor;
if(hv < 0) {
c->wall = waCavewall;
if(c->land != laCaves && c->land != laDeadCaves && c->land != laEmerald && !gardener) {
gardener = true;
@@ -2168,14 +2173,14 @@ void livecaves() {
}
}
else if(c->land == laLivefjord) {
if(c->aitmp > 0 && c->wall == waStrandedBoat) c->wall = waBoat;
if(c->aitmp > 0 && c->wall == waNone) {
if(hv > 0 && c->wall == waStrandedBoat) c->wall = waBoat;
if(hv > 0 && c->wall == waNone) {
if(c->item && c->cpdist == 1 && markOrb(itOrbWater))
collectItem(c);
c->wall = waSea;
}
if(c->aitmp < 0 && c->wall == waBoat) c->wall = waStrandedBoat;
if(c->aitmp < 0 && c->wall == waSea) c->wall = waNone;
if(hv < 0 && c->wall == waBoat) c->wall = waStrandedBoat;
if(hv < 0 && c->wall == waSea) c->wall = waNone;
}
}
@@ -2573,6 +2578,7 @@ namespace kraken {
}
void attacks() {
pathdata pd(2);
bool offboat[MAXPLAYER];
for(int i=0; i<MAXPLAYER; i++) offboat[i] = false;
for(int i=0; i<isize(dcal); i++) {
@@ -2632,8 +2638,7 @@ namespace kraken {
vector<pair<cell*, cell*> > acells;
acells.push_back(make_pair(c2, c));
forCellIdEx(c3, i, c) {
c3->monst = moKrakenT, c3->mondir = c->spn(i),
c3->aitmp = sval;
c3->monst = moKrakenT, c3->mondir = c->spn(i), onpath(c3, 0);
int i0 = (i+c->spn(c->mondir)-c->mondir+99) % c2->type;
c3->hitpoints = hpcount[i0];
acells.push_back(make_pair(c2->mov[i0], c3));
@@ -2665,7 +2670,7 @@ namespace kraken {
}
commitAnimations(LAYER_BIG);
sleep(c);
c->aitmp = sval;
onpath(c, 0);
return;
}
@@ -2834,23 +2839,21 @@ namespace prairie {
if(c2) c->mondir = neighborId(c, c2);
}
void moveAt(cell *c) {
if(eq(c->aitmp, sval)) return;
void moveAt(cell *c, manual_celllister& cl) {
if(!cl.add(c)) return;
vector<cell*> whirlline;
whirlline.push_back(c);
c->aitmp = sval;
cell *c2 = prev(c);
while(c2 && !eq(c2->aitmp, sval)) {
whirlline.push_back(c2), c2->aitmp = sval;
while(c2 && !cl.add(c2)) {
whirlline.push_back(c2);
c2 = prev(c2);
// in sphere/quotient geometries, never break before a bull
if((sphere || quotient) && !c2->monst) break;
}
reverse(whirlline.begin(), whirlline.end());
c2 = next(c);
while(c2 && !eq(c2->aitmp, sval)) whirlline.push_back(c2), c2->aitmp = sval, c2 = next(c2);
while(c2 && cl.add(c2)) whirlline.push_back(c2), c2 = next(c2);
int qty = isize(whirlline);
// for(int i=0; i<qty; i++) whirlline[i]->aitmp = sval;
if(shmup::on) {
for(int i=0; i<qty; i++) if(whirlline[i]->cpdist <= gamerange()) {
generateBeast(whirlline[i]);
@@ -2887,10 +2890,10 @@ namespace prairie {
}
void move() {
sval++;
manual_celllister cl;
for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
if(isriver(c)) moveAt(c);
if(isriver(c)) moveAt(c, cl);
}
for(int i=0; i<isize(beaststogen); i++)
generateBeast(beaststogen[i]);
@@ -3044,36 +3047,61 @@ auto ccm = addHook(clearmemory, 0, [] () {
// windcode arrays precomputed for speed
int windcodes18920[] = {164,182,171,158,148,155,163,174,188,205,193,160,167,160,140,128,146,153,159,161,167,180,186,202,190,229,234,24,120,146,165,177,179,169,146,125,113,93,131,157,147,155,158,161,162,157,157,162,173,187,198,176,163,242,204,234,238,249,1,30,77,120,153,165,140,173,173,204,200,165,150,184,130,119,104,86,71,54,70,208,168,141,133,169,158,167,161,161,166,171,142,144,165,153,159,166,175,203,186,216,191,221,168,149,114,70,26,225,241,220,229,244,10,251,7,19,50,85,110,129,148,145,173,180,143,178,174,166,144,54,248,215,170,166,153,134,182,116,118,122,114,96,77,57,69,78,62,18,47,228,189,164,148,126,110,81,217,169,151,156,250,163,168,156,154,170,183,192,149,118,120,138,182,152,158,156,158,164,169,171,202,217,181,243,235,206,182,241,159,149,169,125,97,77,53,28,40,252,234,237,218,4,192,204,220,244,246,24,248,250,1,12,31,4,56,98,120,127,134,129,161,139,156,105,153,209,205,187,148,177,180,177,167,152,174,117,81,44,4,201,232,161,168,162,174,165,153,139,115,160,94,103,120,127,125,129,118,94,66,50,28,40,78,89,50,97,81,76,54,16,10,230,195,174,157,151,162,139,122,98,81,27,58,2,7,245,89,127,132,146,158,249,162,174,191,64,124,230,150,173,193,209,211,224,146,119,174,87,90,93,118,139,203,159,167,164,149,150,157,155,165,172,169,161,159,214,219,195,221,172,11,9,253,253,225,206,187,170,252,166,155,149,141,168,124,101,83,81,68,55,48,38,29,45,26,19,206,254,232,219,199,24,159,174,171,187,208,249,17,219,241,43,29,250,248,241,244,248,1,3,17,30,1,37,63,128,134,147,141,135,124,134,125,173,186,161,114,161,52,50,79,236,241,243,236,163,169,157,150,168,181,186,184,184,171,172,170,149,178,131,108,91,73,64,41,10,216,202,233,154,152,161,177,144,182,176,186,166,152,145,133,106,85,119,112,67,76,85,112,135,129,124,134,132,142,139,125,89,71,42,32,26,45,227,32,71,91,97,112,26,106,89,127,83,88,88,65,30,255,243,220,229,201,174,171,164,154,161,153,146,157,142,139,137,93,78,75,67,36,3,57,255,26,30,48,241,93,105,73,116,121,132,147,161,169,233,232,157,151,180,201,219,6,32,94,129,232,142,159,177,190,207,220,241,237,226,252,170,144,119,95,193,56,60,72,62,70,96,124,136,149,212,223,170,177,183,178,171,149,144,141,144,154,150,157,168,175,184,178,167,139,143,146,208,228,229,232,196,209,231,180,148,6,26,41,37,251,242,232,26,217,212,191,169,160,155,241,251,177,161,174,147,145,144,150,147,167,130,100,75,83,79,65,79,75,40,45,48,49,45,35,46,18,49,73,52,117,48,170,255,239,19,220,221,219,208,184,56,138,133,145,160,155,167,179,185,226,14,46,119,196,237,243,41,83,19,8,1,251,243,232,231,234,249,235,248,245,5,247,7,18,21,21,9,21,29,33,187,158,223,154,168,167,153,128,142,114,116,118,133,115,184,194,170,216,208,209,109,92,162,45,19,13,255,65,241,247,253,255,14,26,82,139,164,157,159,162,167,167,183,144,193,192,188,192,189,197,167,169,173,173,184,191,172,151,179,138,123,108,87,81,98,75,78,70,51,248,29,198,230,213,39,222,157,156,146,140,140,151,176,195,123,187,185,185,182,198,175,159,145,144,146,150,141,96,68,57,83,91,67,50,54,51,54,63,99,129,157,153,124,114,140,89,153,144,133,140,160,158,162,146,58,72,59,60,18,3,6,16,6,75,123,45,170,22,102,98,50,102,98,100,110,149,245,132,108,84,80,166,82,87,90,102,120,108,92,254,11,248,219,228,197,226,205,236,171,147,159,161,163,163,141,154,145,185,165,146,146,144,153,142,143,150,224,57,174,69,68,66,63,69,68,42,15,49,226,64,245,27,231,49,47,43,37,50,232,90,102,100,103,71,106,117,113,117,126,136,148,165,177,199,217,228,206,63,107,246,124,217,215,225,225,230,2,15,238,13,1,171,134,132,221,135,147,165,185,191,179,202,212,227,244,18,9,248,240,1,242,24,178,161,192,143,125,108,96,79,209,53,37,29,34,64,38,51,53,68,86,116,140,130,136,154,221,220,233,189,190,173,194,193,191,191,164,189,149,144,145,141,140,129,128,143,139,154,145,159,173,173,174,186,203,193,183,158,177,120,121,126,116,129,207,201,214,20,239,229,239,251,207,225,198,248,165,195,113,1,14,253,31,51,79,73,78,242,201,238,243,210,114,212,220,226,209,189,167,147,145,156,142,221,227,214,194,199,171,152,173,137,138,142,134,134,154,165,166,152,173,166,141,118,88,64,35,101,91,76,72,15,78,103,163,251,11,33,45,56,42,52,42,49,57,23,58,2,244,87,20,93,76,72,73,133,137,101,149,178,255,4,246,224,40,203,213,206,221,224,220,204,165,185,86,95,108,115,124,117,127,127,138,148,146,161,165,163,165,201,152,243,35,54,79,118,160,201,238,20,248,228,221,138,8,125,14,10,24,25,255,253,234,231,221,224,221,223,224,233,254,223,7,236,227,232,21,241,254,236,15,26,22,18,13,10,28,16,9,19,19,12,254,228,205,183,163,254,150,161,188,194,194,173,160,131,118,147,119,108,97,93,114,215,54,99,105,176,197,196,209,164,246,238,229,238,0,23,54,85,135,158,162,35,13,49,249,251,243,244,233,38,224,253,0,1,2,254,10,25,34,59,92,114,146,167,181,171,126,156,163,161,167,185,136,177,193,199,109,207,201,196,188,183,193,206,204,194,210,169,158,161,169,172,171,190,159,209,214,199,174,153,140,165,183,143,143,120,114,115,83,84,83,75,102,72,79,90,87,90,81,73,254,228,49,202,180,148,66,208,49,58,209,215,155,168,166,169,144,49,109,208,129,126,172,199,215,215,122,94,183,183,193,184,187,188,195,196,212,181,166,152,131,135,141,142,143,152,185,2Line truncated
int windcodes18920[] = {164,182,171,158,148,155,163,174,188,205,193,160,167,160,140,128,146,153,159,161,167,180,190,186,202,229,234,24,120,146,165,177,179,169,146,125,113,93,131,157,147,155,158,161,162,157,157,162,173,187,204,198,176,163,242,249,234,238,1,30,77,120,140,153,165,173,173,204,200,184,165,150,130,119,104,86,70,71,54,208,168,141,133,167,169,158,161,161,166,171,165,142,144,153,159,166,175,186,203,225,221,216,191,168,149,114,70,26,10,241,220,229,244,251,7,19,50,85,110,129,143,148,145,173,180,178,174,166,144,54,248,215,182,170,166,153,134,116,118,122,114,96,77,57,47,69,78,62,18,228,189,164,148,126,110,81,250,217,169,151,156,163,168,156,154,170,183,192,182,149,118,120,138,152,158,156,158,164,169,171,181,202,217,234,252,241,243,235,206,182,169,159,149,125,97,77,53,40,28,24,4,237,218,192,204,220,244,246,248,250,1,4,12,31,56,98,120,127,129,134,148,156,161,139,105,153,209,205,187,177,180,177,174,167,152,117,81,44,4,232,201,160,162,161,168,174,165,153,139,115,94,103,120,129,127,125,118,94,66,50,40,28,10,50,78,89,97,81,76,54,16,230,195,174,162,157,151,139,122,98,81,58,27,249,245,2,7,89,127,132,146,158,162,174,191,230,64,124,150,173,193,209,224,211,203,174,146,119,87,90,93,118,139,159,167,164,157,149,150,155,165,172,169,159,161,172,195,214,219,221,206,26,19,252,253,11,9,253,225,206,187,170,168,166,155,149,141,124,101,83,81,68,55,48,45,38,29,29,43,24,254,232,219,199,171,159,174,187,208,249,17,219,241,250,248,241,244,248,1,1,3,17,30,37,63,128,134,147,141,135,125,124,134,150,157,161,173,186,161,114,79,52,50,236,241,243,236,163,169,168,181,186,184,184,178,171,172,170,149,131,108,91,73,64,41,10,233,216,202,112,119,144,154,152,161,177,186,182,176,166,152,145,133,106,85,67,76,85,112,135,142,129,124,134,132,139,125,89,71,42,32,26,32,45,227,220,243,26,71,91,97,112,127,106,89,83,88,88,65,30,255,229,201,174,171,164,157,154,161,153,146,142,139,137,93,78,75,67,57,36,3,232,233,241,255,26,30,48,73,93,105,116,121,132,147,161,169,157,151,180,201,219,232,6,32,94,129,142,159,177,190,207,220,241,252,237,226,223,212,193,170,144,119,95,72,56,60,62,70,96,124,136,149,170,177,183,178,171,154,149,144,141,144,150,157,168,175,184,178,167,146,139,143,148,180,196,208,228,229,232,231,209,170,117,73,52,48,251,241,251,6,26,41,37,26,242,232,217,212,191,169,155,160,167,174,177,161,147,145,144,150,147,130,100,75,65,83,79,79,75,40,45,49,48,49,46,45,35,18,19,41,83,56,19,255,239,220,221,219,208,184,155,138,133,145,160,167,179,185,226,14,46,119,196,237,243,251,8,1,243,232,231,234,235,249,9,5,248,245,247,7,18,21,21,21,29,33,223,187,158,154,168,167,153,142,128,115,118,114,116,133,167,159,162,162,170,184,194,216,208,209,109,92,65,45,19,13,255,241,247,253,255,14,26,82,139,164,157,144,167,183,193,192,188,192,197,189,179,173,167,169,173,184,191,172,151,138,123,108,98,87,81,75,78,70,51,29,248,222,213,198,230,39,67,83,91,123,146,157,156,140,140,151,176,195,198,187,185,185,182,175,159,145,144,146,150,141,96,68,57,51,50,54,54,63,99,129,153,157,160,140,124,114,89,153,144,133,140,158,162,146,59,58,72,60,18,3,6,6,16,22,45,75,123,170,197,219,228,245,50,102,98,102,98,100,110,149,166,132,108,84,80,82,87,90,102,120,108,92,254,11,248,236,226,205,171,147,159,161,163,163,153,145,141,154,185,165,146,146,144,142,143,150,174,224,57,69,68,66,63,68,69,64,49,42,15,226,206,217,228,232,231,245,27,49,47,43,37,50,71,90,102,100,103,106,117,113,117,126,136,148,165,177,199,246,63,107,124,217,215,225,230,225,221,238,2,15,13,1,171,134,132,135,147,165,179,185,191,202,212,227,244,9,18,24,1,248,240,242,233,221,220,209,192,178,161,143,125,108,96,79,64,53,37,29,34,38,51,53,68,86,116,140,130,136,154,173,189,190,194,193,191,191,189,164,139,145,149,144,141,140,129,128,143,154,145,159,174,173,173,186,203,193,183,177,158,129,126,120,121,116,113,165,195,207,214,207,201,20,239,229,239,251,248,225,198,178,149,133,93,76,72,73,101,137,214,221,227,242,253,1,14,31,51,79,73,78,114,201,238,243,210,212,220,226,209,189,167,147,142,145,156,166,173,173,194,199,171,152,142,137,138,134,134,154,165,166,152,141,118,88,64,35,15,101,91,76,72,78,103,163,251,11,33,45,52,56,42,20,87,58,42,49,57,23,244,2,14,8,221,138,125,95,86,40,255,4,246,224,206,203,213,221,224,220,204,185,165,146,124,108,115,117,127,127,138,148,161,165,163,152,165,201,243,35,54,79,118,160,201,238,20,248,228,253,10,24,25,255,234,231,221,224,221,223,224,223,233,254,16,28,21,7,236,227,232,236,241,254,15,26,22,18,13,10,9,19,19,12,254,254,228,205,183,163,150,161,188,194,194,173,160,147,131,118,105,99,114,119,108,97,93,54,215,185,161,156,163,167,162,158,164,176,197,196,209,229,246,238,238,0,23,54,135,85,38,49,35,13,249,251,243,244,233,224,253,0,254,1,2,10,25,34,59,92,114,146,167,181,171,126,109,136,177,193,199,207,201,196,188,183,193,206,210,204,194,183,165,172,169,158,161,169,159,171,190,209,214,199,174,153,140,143,143,120,114,115,102,83,84,83,75,72,79,90,87,90,81,73,49,254,228,215,209,208,202,180,148,66,58,49,52,66,60,63,66,94,122,144,155,168,166,169,208,49,109,129,126,172,199,215,215,212,193,183,183,184,187,188,195,196,181,166,152,141,131,135,14Line truncated
int windcodes5676[] = {152,138,172,172,141,158,157,124,119,130,125,143,190,206,205,187,171,175,136,86,111,80,0,210,177,155,125,96,80,66,162,135,121,119,150,136,86,91,93,193,201,212,203,213,227,230,243,228,210,186,138,68,242,217,216,172,145,199,31,43,57,82,110,119,95,49,31,4,13,17,254,198,173,161,182,204,108,133,122,87,88,103,64,47,44,29,26,255,235,192,133,122,156,154,84,67,68,129,169,191,181,182,140,91,49,51,62,52,76,79,52,19,241,207,175,208,225,235,225,202,207,193,192,235,236,236,224,242,250,237,252,23,13,250,231,230,217,194,193,209,173,105,76,52,39,11,246,236,233,245,240,1,246,206,177,151,91,98,170,212,207,238,5,22,29,34,43,44,45,57,74,80,85,142,153,157,129,126,110,52,13,27,44,41,2,241,248,5,11,18,34,58,59,37,16,216,191,168,172,169,165,167,137,127,231,222,228,251,24,47,81,113,147,163,142,122,82,38,59,80,81,109,154,156,55,33,36,19,42,43,30,16,12,15,24,33,20,13,2,3,6,5,252,231,191,139,91,90,82,103,158,195,205,223,229,57,90,55,42,16,20,30,37,72,128,161,184,207,200,213,220,204,198,206,212,213,185,153,132,103,75,49,23,21,23,24,50,63,53,40,25,25,45,77,92,96,75,69,54,25,23,23,21,2,243,236,220,180,133,134,162,212,241,238,247,236,246,252,250,249,234,196,169,203,221,220,206,162,168,161,106,11,247,241,246,253,242,213,17,235,193,193,240,1,13,22,0,241,228,215,238,10,29,53,31,53,47,12,9,254,234,232,235,249,234,235,228,218,205,167,182,199,208,174,255,247,237,151,184,16,74,73,59,38,23,46,76,10,31,24,252,232,240,253,252,5,222,199,228,9,13,253,241,242,3,42,27,1,12,21,242,213,177,159,186,191,167,112,58,28,47,46,67,119,196,222,238,231,219,195,195,191,16,249,250,3,12,15,18,22,34,31,24,26,41,44,39,45,44,36,23,45,54,44,43,50,88,115,38,53,38,64,105,158,192,191,194,161,189,186,161,152,91,158,144,155,162,111,71,28,1,230,234,7,28,21,28,46,88,76,42,1,224,238,227,233,224,235,251,8,4,2,4,9,26,22,1,20,54,58,57,83,97,120,83,38,31,32,36,109,195,200,202,208,216,130,148,166,191,168,169,180,169,158,161,168,182,197,158,125,131,93,52,34,17,17,250,231,231,243,230,218,235,47,30,16,25,30,21,41,55,96,104,102,113,133,180,196,216,185,142,113,145,150,108,105,63,34,253,250,13,46,63,73,111,85,74,54,77,103,159,197,219,133,191,216,243,16,26,14,15,21,28,38,205,244,32,48,58,44,44,52,40,22,247,254,5,251,8,19,16,255,4,25,35,43,51,34,1,12,20,15,9,255,247,1,17,16,25,4,10,18,14,12,45,17,245,239,228,220,174,150,124,94,87,41,51,68,80,52,45,80,89,104,87,249,196,205,223,224,237,246,240,228,218,211,3,32,62,154,137,79,47,22,24,24,25,6,237,229,234,7,19,32,30,26,12,19,36,85,117,158,175,180,173,157,244,221,220,234,222,204,196,209,233,239,242,232,220,223,196,183,208,206,231,234,224,203,221,237,233,221,209,179,160,138,137,142,132,118,91,76,78,71,56,31,19,9,2,11,14,17,11,3,0,249,19,35,37,80,79,65,53,51,39,26,22,19,12,5,13,16,19,22,45,66,113,102,103,113,135,104,73,60,63,82,65,74,90,50,21,19,1,3,18,24,17,19,35,38,48,249,240,252,244,224,246,253,244,247,223,206,179,138,92,118,139,89,120,126,162,214,243,252,3,3,2,253,236,210,45,25,194,226,255,3,2,254,1,8,5,5,5,14,245,240,248,234,148,161,120,121,180,224,219,230,236,233,225,229,217,233,211,103,110,143,171,157,184,146,102,86,46,16,6,236,250,241,230,238,250,255,253,6,13,5,252,244,229,161,106,53,29,15,246,204,175,173,144,146,247,250,9,2,243,24,30,31,40,52,21,4,246,242,237,237,238,237,191,158,202,239,232,3,14,19,28,38,52,98,152,244,249,43,63,94,100,93,39,21,6,253,2,23,36,50,207,225,213,233,245,226,221,233,14,3,236,198,228,1,251,228,226,220,205,222,228,226,188,129,89,185,167,171,213,211,218,245,36,137,131,85,48,11,241,250,11,14,34,63,87,133,177,193,217,235,8,54,101,90,76,62,57,67,59,41,13,1,6,23,29,41,80,134,168,223,11,31,31,41,38,27,23,16,236,201,194,222,233,237,0,10,4,249,251,14,40,31,7,236,167,136,172,171,15,28,40,44,36,14,5,14,253,234,234,242,244,239,230,0,34,74,88,69,69,16,245,253,248,222,55,61,91,4,5,252,239,217,213,200,150,131,139,145,160,185,209,220,228,210,202,170,131,108,11,246,242,14,27,26,25,28,34,45,60,64,90,151,246,229,236,255,247,253,2,243,235,229,244,10,177,173,195,198,185,202,187,135,103,81,31,246,232,245,241,250,246,251,10,17,16,6,15,21,10,10,19,18,23,29,59,46,31,19,14,20,24,22,10,24,62,57,58,45,28,27,42,58,48,43,53,38,47,38,10,249,15,17,36,68,69,47,29,31,47,12,17,31,48,52,62,121,140,174,210,254,22,47,56,29,2,234,53,39,48,80,88,121,162,179,203,214,223,214,212,229,254,215,158,112,161,208,228,222,218,184,171,158,174,217,242,51,32,156,130,127,156,189,199,210,194,157,105,77,94,64,37,18,14,6,230,217,207,203,224,224,201,230,11,18,38,55,33,18,3,9,16,34,19,218,145,145,120,90,85,66,51,39,20,238,209,173,180,253,245,219,218,237,238,231,232,197,184,236,254,248,240,252,14,30,13,254,4,255,246,254,8,253,4,233,7,36,53,36,33,30,9,12,33,65,85,80,71,52,39,47,61,77,121,112,92,153,144,154,148,115,63,8,20,25,25,19,41,34,30,15,207,101,75,170,169,188,209,201,201,177,207,217,216,199,214,229,254,28,56,102,137,163,167,149,205,163,130,145,159,191,203,188,171,194,164,148,165,128,141,179,189,150,165,170,184,226,234,221,193,227,60,88,134,165,150,143,102,59,43,29,20,17,22,28,23,21,23,27,45,39,20,224,225,237,227,225,243,255,253,252,231,188,180,214Line truncated
namespace windmap {
map<int, int> getid;
vector<vector<int> > neighbors;
vector<cell*> samples;
vector<cellwalker> samples;
int getId(cell *c) {
auto i = fieldpattern::fieldval_uniq(c);
return getid[i]-1;
}
int getId(cellwalker cw) {
auto i = fieldpattern::fieldval_uniq(cw.c);
auto &id = getid[i];
if(id == 0) { samples.push_back(c); id = isize(samples); }
if(id == 0) { samples.push_back(cw); id = isize(samples); }
return id-1;
}
vector<unsigned char> windcodes;
void wcheck(cell *a, cell *b) {
int i = getId(a);
if(b) {
int j = getId(b);
for(auto nn: neighbors[i]) if(nn == j) return;
printf("neigbor not found!\n");
}
else {
printf("%d", windcodes[i]);
for(auto nn: neighbors[i]) printf("n%d ", windcodes[nn]);
printf("\n");
}
}
void create() {
samples.clear();
neighbors.clear();
getid.clear();
getId(currentmap->gamestart());
getId(cellwalker(currentmap->gamestart(), 0));
for(int k=0; k<isize(samples); k++) {
cell *c = samples[k];
cellwalker cw = samples[k];
// cw.spin = 0;
neighbors.emplace_back();
auto &v = neighbors.back();
if(gp::on)
for(int l=0; l<S7; l++) v.push_back(getId(createStep(c->master, l)->c7));
for(int l=0; l<S7; l++) {
heptspin hs(cw.c->master, cw.spin);
hs = hs + l + wstep;
v.push_back(getId(cellwalker(hs.h->c7, hs.spin)));
}
else
for(int l=0; l<c->type; l++) v.push_back(getId(createMov(c, l)));
for(int l=0; l<cw.c->type; l++) v.push_back(getId(cw+l+wstep));
}
int N = isize(samples);
@@ -3088,7 +3116,7 @@ namespace windmap {
if(precomp && hyperbolic && isize(currfp.matrices)) {
int randval = hrand(isize(currfp.matrices));
for(int i=0; i<N; i++)
windcodes[i] = precomp[getid[fieldpattern::fieldval_uniq_rand(samples[i], randval)]-1];
windcodes[i] = precomp[getid[fieldpattern::fieldval_uniq_rand(samples[i].c, randval)]-1];
return;
}
+8 -4
View File
@@ -823,24 +823,28 @@ namespace conformal {
else if(doexiton(sym, uni)) popScreen();
}
set<cell*> inmovehistory, inkillhistory, infindhistory;
void restore() {
sval++;
inmovehistory.clear();
inkillhistory.clear();
infindhistory.clear();
for(int i=0; i<isize(movehistory); i++)
movehistory[i]->aitmp = sval;
inmovehistory.insert(movehistory[i]);
sval++;
int sk = isize(killhistory);
for(int i=0; i<sk; i++) {
eMonster m = killhistory[i].second;
killhistory[i].second = killhistory[i].first->monst;
killhistory[i].first->monst = m;
killhistory[i].first->aitmp = sval;
inkillhistory.insert(killhistory[i].first);
}
int si = isize(findhistory);
for(int i=0; i<si; i++) {
eItem m = findhistory[i].second;
findhistory[i].second = findhistory[i].first->item;
findhistory[i].first->item = m;
findhistory[i].first->aitmp = sval;
infindhistory.insert(findhistory[i].first);
}
}
+1 -1
View File
@@ -333,7 +333,7 @@ void debugScreen() {
dialog::addSelItem("celldist", its(celldist(mouseover)), 0);
dialog::addSelItem("pathdist", its(mouseover->pathdist), 0);
dialog::addSelItem("celldistAlt", mouseover->master->alt ? its(celldistAlt(mouseover)) : "--", 0);
dialog::addSelItem("temporary", its(mouseover->aitmp), 0);
dialog::addSelItem("temporary", its(mouseover->listindex), 0);
if(gp::on)
dialog::addSelItem("whirl", gp::disp(gp::get_local_info(mouseover).relative), 0);
dialog::addBreak(50);
+86 -69
View File
@@ -170,7 +170,7 @@ void initcell(cell *c) {
c->cpdist = INFD; // current distance from the player
c->pathdist = PINFD;// current distance from the player, along paths (used by yetis)
c->landparam = 0; c->landflags = 0; c->wparam = 0;
c->aitmp = 0;
c->listindex = -1;
c->wall = waNone;
c->item = itNone;
c->monst = moNone;
@@ -2747,12 +2747,32 @@ bool nogoSlow(cell *to, cell *from) {
cell *pd_from;
int pd_range;
void onpath(cell *c, int d) {
c->pathdist = d;
pathq.push_back(c);
}
void onpath(cell *c, int d, int sp) {
c->pathdist = d;
pathq.push_back(c);
reachedfrom.push_back(sp);
}
void clear_pathdata() {
for(auto c: pathq) c->pathdist = PINFD;
pathq.clear();
pathqm.clear();
reachedfrom.clear();
}
int pathlock = 0;
void compute_graphical_distance() {
if(pathlock) { printf("path error: compute_graphical_distance\n"); }
cell *c1 = centerover.c ? centerover.c : pd_from ? pd_from : cwt.c;
int sr = get_sightrange_ambush();
if(pd_from == c1 && pd_range == sr) return;
for(auto c: pathq) c->pathdist = PINFD;
pathq.clear();
clear_pathdata();
pd_from = c1;
pd_range = sr;
@@ -2765,23 +2785,14 @@ void compute_graphical_distance() {
if(qb == 0) forCellCM(c1, c) ;
forCellEx(c1, c)
if(c1->pathdist == PINFD)
c1->pathdist = c->pathdist + 1,
pathq.push_back(c1);
onpath(c1, c->pathdist + 1);
}
}
}
void computePathdist(eMonster param) {
pd_from = NULL;
for(auto c: pathq) c->pathdist = PINFD;
pathq.clear();
pathqm.clear();
reachedfrom.clear();
for(int i=0; i<isize(targets); i++) {
pathq.push_back(targets[i]);
targets[i]->pathdist = isPlayerOn(targets[i]) ? 0 : 1;
reachedfrom.push_back(hrand(targets[i]->type));
}
for(cell *c: targets)
onpath(c, isPlayerOn(c) ? 0 : 1, hrand(c->type));
int qtarg = isize(targets);
@@ -2818,8 +2829,7 @@ void computePathdist(eMonster param) {
continue;
}
c2->pathdist = d+1;
pathq.push_back(c2); reachedfrom.push_back(c->spn(i));
onpath(c2, d+1, c->spn(i));
}
}
}
@@ -3770,6 +3780,8 @@ int moveval(cell *c1, cell *c2, int d, flagtype mf) {
// actually they just run away
if(m == moHunterChanging && c2->pathdist > c1->pathdist) return 1600;
if((mf & MF_PATHDIST) && !pathlock) printf("using MF_PATHDIST without path\n");
if(hunt && (mf & MF_PATHDIST) && c2->pathdist < c1->pathdist && !peace::on) return 1500; // good move
// prefer straight direction when wandering
@@ -3941,7 +3953,7 @@ void beastAttack(cell *c, bool player) {
if(c2->monst && c2->stuntime) {
cellwalker bull (c, d);
int subdir = determinizeBullPush(bull);
int pushdir = 0;
int pushdir = NOHINT;
cell *c3 = determinePush(bull, c2, subdir, [c2] (cell *c) { return passable(c, c2, P_BLOW); }, pushdir);
if(c3 && c3 != c2)
pushMonster(c3, c2, pushdir);
@@ -3954,7 +3966,7 @@ void beastAttack(cell *c, bool player) {
if(c2->wall == waThumperOn) {
cellwalker bull (c, d);
int subdir = determinizeBullPush(bull);
int pushdir = 0;
int pushdir = NOHINT;
cell *c3 = determinePush(bull, c2, subdir, [c2] (cell *c) { return canPushThumperOn(c, c2, c); }, pushdir);
if(c3 && c3 != c2)
pushThumper(c2, c3);
@@ -4379,7 +4391,7 @@ void removeIvy(cell *c) {
void moveivy() {
if(isize(ivies) == 0) return;
computePathdist(moIvyRoot);
pathdata pd(moIvyRoot);
for(int i=0; i<isize(ivies); i++) {
cell *c = ivies[i];
cell *co = c;
@@ -4461,7 +4473,7 @@ bool isTargetOrAdjacent(cell *c) {
void groupmove2(cell *c, cell *from, int d, eMonster movtype, flagtype mf) {
if(!c) return;
if(eq(c->aitmp, sval)) return;
if(c->pathdist == 0) return;
if(movtype == moKrakenH && isTargetOrAdjacent(from)) ;
/* else if(passable_for(movtype, from, c, P_ONPLAYER | P_CHAIN | P_MONSTER)) ;
@@ -4518,7 +4530,8 @@ void groupmove2(cell *c, cell *from, int d, eMonster movtype, flagtype mf) {
return;
// in the gravity lands, eagles cannot ascend in their second move
if((mf & MF_ONLYEAGLE) && gravityLevel(c) < gravityLevel(from)) {
c->aitmp = sval; return;
onpath(c, 0);
return;
}
if((mf & MF_NOFRIEND) && isFriendly(c)) return;
if((mf & MF_MOUNT) && !isMounted(c)) return;
@@ -4532,12 +4545,12 @@ void groupmove2(cell *c, cell *from, int d, eMonster movtype, flagtype mf) {
if(c->mov[j] && canAttack(c, c->monst, c->mov[j], c->mov[j]->monst, af)) {
attackMonster(c->mov[j], AF_NORMAL | AF_GETPLAYER | AF_MSG, c->monst);
animateAttack(c, c->mov[j], LAYER_SMALL, j);
c->aitmp = sval;
onpath(c, 0);
// XLATC eagle
return;
}
if(from->cpdist == 0 || from->monst) { c->aitmp = sval; return; }
if(from->cpdist == 0 || from->monst) { onpath(c, 0); return; }
if(movtype == moDragonHead) {
dragon::move(from, c);
@@ -4545,15 +4558,15 @@ void groupmove2(cell *c, cell *from, int d, eMonster movtype, flagtype mf) {
}
moveMonster(from, c, revhint(from, d));
from->aitmp = sval;
onpath(from, 0);
}
c->aitmp = sval;
onpath(c, 0);
// MAXGCELL
if(isize(gendfs) < 1000 || c->cpdist <= 6) gendfs.push_back(c);
}
void groupmove(eMonster movtype, flagtype mf) {
sval++;
pathdata pd(0);
gendfs.clear();
if(mf & MF_MOUNT) {
@@ -4602,9 +4615,9 @@ void groupmove(eMonster movtype, flagtype mf) {
if(movtype != moDragonHead) for(int i=0; i<isize(dcal); i++) {
cell *c = dcal[i];
if((mf & MF_ONLYEAGLE) && c->monst != moEagle && c->monst != moBat) return;
if(movegroup(c->monst) == movtype && !eq(c->aitmp, sval)) {
if(movegroup(c->monst) == movtype && c->pathdist != 0) {
cell *c2 = moveNormal(c, mf);
if(c2) c2->aitmp = sval;
onpath(c2, 0);
}
}
}
@@ -4665,7 +4678,7 @@ int snake_pair(cell *c) {
void hexvisit(cell *c, cell *from, int d, bool mounted, int colorpair) {
if(!c) return;
if(cellUnstable(c) || cellEdgeUnstable(c)) return;
if(eq(c->aitmp, sval)) return;
if(c->pathdist == 0) return;
if(cellUnstableOrChasm(c) || cellUnstableOrChasm(from)) return;
@@ -4690,7 +4703,7 @@ void hexvisit(cell *c, cell *from, int d, bool mounted, int colorpair) {
moveHexSnake(from, c, d, mounted);
}
c->aitmp = sval;
onpath(c, 0);
// MAXGCELL
if(isize(hexdfs) < 2000 || c->cpdist <= 6)
@@ -4698,18 +4711,18 @@ void hexvisit(cell *c, cell *from, int d, bool mounted, int colorpair) {
}
void movehex(bool mounted, int colorpair) {
sval++;
pathdata pd(3);
hexdfs.clear();
if(mounted) {
if(dragon::target && dragon::target->monst != moHexSnake) {
hexdfs.push_back(dragon::target);
dragon::target->aitmp = sval;
onpath(dragon::target, 0);
}
}
else for(int i=0; i<isize(targets); i++) {
hexdfs.push_back(targets[i]);
targets[i]->aitmp = sval;
else for(cell *c: targets) {
hexdfs.push_back(c);
onpath(c, 0);
}
//hexdfs.push_back(cwt.c);
@@ -4977,8 +4990,10 @@ void sideAttack(cell *mf, int dir, eMonster who, int bonuskill) {
sideAttack(mf, dir, who, 2, itOrbSide2);
sideAttack(mf, dir, who, 3, itOrbSide3);
int kills = tkills() - k + bonuskill;
if(kills >= 5) achievement_gain("MELEE5");
if(who == moPlayer) {
int kills = tkills() - k + bonuskill;
if(kills >= 5) achievement_gain("MELEE5");
}
}
void stabbingAttack(cell *mf, cell *mt, eMonster who, int bonuskill) {
@@ -5067,15 +5082,17 @@ void stabbingAttack(cell *mf, cell *mt, eMonster who, int bonuskill) {
}
}
if(numsh) achievement_count("STAB", numsh, 0);
if(who == moPlayer) {
if(numsh) achievement_count("STAB", numsh, 0);
if(numlance && numflail && numsh) achievement_gain("MELEE3");
if(numlance && numflail && numsh) achievement_gain("MELEE3");
if(numlance + numflail + numsh + numslash + bonuskill >= 5) achievement_gain("MELEE5");
if(numsh == 2) {
if(lastdouble == turncount-1) achievement_count("STAB", 4, 0);
lastdouble = turncount;
if(numlance + numflail + numsh + numslash + bonuskill >= 5) achievement_gain("MELEE5");
if(numsh == 2) {
if(lastdouble == turncount-1) achievement_count("STAB", 4, 0);
lastdouble = turncount;
}
}
}
@@ -5198,7 +5215,7 @@ int movevalue(eMonster m, cell *c, cell *c2, flagtype flags) {
void movegolems(flagtype flags) {
if(items[itOrbEmpathy] && items[itOrbSlaying])
flags |= AF_CRUSH;
computePathdist(moMouse);
pathdata pd(moMouse);
int qg = 0;
for(int i=0; i<isize(golems); i++) {
cell *c = golems[i];
@@ -5363,7 +5380,7 @@ void specialMoves() {
}
if(m == moNecromancer) {
computePathdist(moNecromancer);
pathdata pd(moNecromancer);
int gravenum = 0, zombienum = 0;
cell *gtab[8], *ztab[8];
for(int j=0; j<c->type; j++) if(c->mov[j]) {
@@ -5465,7 +5482,7 @@ void specialMoves() {
void moveworms() {
if(!isize(worms)) return;
computePathdist(moWorm);
pathdata pd(moWorm);
int wrm = isize(worms);
for(int i=0; i<wrm; i++) {
moveWorm(worms[i]);
@@ -5728,7 +5745,7 @@ void consMove(cell *c, eMonster param) {
}
void moveNormals(eMonster param) {
computePathdist(param);
pathdata pd(param);
for(int d=0; d<8; d++) movesofgood[d].clear();
@@ -5749,12 +5766,11 @@ void moveNormals(eMonster param) {
}
}
void markAmbush(cell *c) {
if(eq(c->aitmp, sval)) return;
c->aitmp = sval;
void markAmbush(cell *c, manual_celllister& cl) {
if(!cl.add(c)) return;
forCellEx(c2, c)
if(c2->cpdist < c->cpdist)
markAmbush(c2);
markAmbush(c2, cl);
}
int ambush_distance;
@@ -5762,30 +5778,30 @@ bool ambushed;
void checkAmbushState() {
if(havewhat & HF_HUNTER) {
sval++;
manual_celllister cl;
for(cell *c: dcal) {
if(c->monst == moHunterDog) {
if(c->cpdist > ambush_distance)
ambush_distance = c->cpdist;
markAmbush(c);
markAmbush(c, cl);
}
if(c->monst == moHunterGuard && c->cpdist <= 4)
markAmbush(c);
markAmbush(c, cl);
}
if(items[itHunting] > 5 && items[itHunting] <= 22) {
int q = 0;
for(int i=0; i<numplayers(); i++)
forCellEx(c2, playerpos(i))
if(eq(c2->aitmp, sval))
q++;
if(cl.listed(c2))
q++;
if(q == 1) havewhat |= HF_FAILED_AMBUSH;
if(q == 2) {
for(int i=0; i<numplayers(); i++)
forCellEx(c2, playerpos(i))
if(eq(c2->aitmp, sval))
if(cl.listed(c2))
forCellEx(c3, playerpos(i))
if(c3 != c2 && isNeighbor(c2,c3))
if(eq(c3->aitmp, sval))
if(cl.listed(c3))
havewhat |= HF_FAILED_AMBUSH;
}
if(havewhat & HF_FAILED_AMBUSH && ambushed) {
@@ -6330,7 +6346,7 @@ void collectMessage(cell *c2, eItem which) {
else if(which == itGreenStone)
addMessage(XLAT("Another Dead Orb."));
else if(itemclass(which) != IC_TREASURE) {
if(c2->wall != waBoat && !inv::activating)
if(!inv::activating)
addMessage(XLAT("You have found %the1!", which));
}
else if(which == itBabyTortoise) {
@@ -6509,7 +6525,6 @@ int ambush(cell *c, eItem what) {
celllister cl(c, maxdist, 1000000, NULL);
cell *c0 = c;
int d = 0;
cl.prepare();
int dogs0 = 0;
for(cell *cx: cl.lst) {
int dh = cl.getdist(cx);
@@ -7191,15 +7206,15 @@ void monstersTurn() {
heat::processheat();
// if(elec::havecharge) elec::drawcharges();
orbbull::check();
if(!phase1) terracotta();
if(items[itOrbFreedom])
for(int i=0; i<numplayers(); i++)
if(multi::playerActive(i))
checkFreedom(playerpos(i));
orbbull::check();
if(!phase1) terracotta();
DEBT("check");
checkmove();
if(canmove) elec::checklightningfast();
@@ -7643,6 +7658,8 @@ bool movepcto(int d, int subdir, bool checkonly) {
} */
mirror::act(origd, mirror::SPINMULTI | mirror::ATTACK);
int tk = tkills();
if(goodTortoise) {
items[itBabyTortoise] += 4;
@@ -7672,7 +7689,7 @@ bool movepcto(int d, int subdir, bool checkonly) {
}
}
sideAttack(cwt.c, d, moPlayer, 0);
sideAttack(cwt.c, d, moPlayer, tkills() - tk);
lastmovetype = lmAttack; lastmove = c2;
swordAttackStatic();
}
+5 -5
View File
@@ -586,7 +586,7 @@ bool drawItemType(eItem it, cell *c, const transmatrix& V, int icol, int ticks,
poly_outline = OUTLINE_OTHER;
}
if(c && conformal::includeHistory && eq(c->aitmp, sval)) poly_outline = OUTLINE_DEAD;
if(c && conformal::includeHistory && conformal::infindhistory.count(c)) poly_outline = OUTLINE_DEAD;
if(!mmitem && it) return true;
@@ -1809,7 +1809,7 @@ bool dont_face_pc = false;
bool drawMonster(const transmatrix& Vparam, int ct, cell *c, int col) {
bool darkhistory = conformal::includeHistory && eq(c->aitmp, sval);
bool darkhistory = conformal::includeHistory && conformal::inkillhistory.count(c);
if(doHighlight())
poly_outline =
@@ -2981,7 +2981,7 @@ void setcolors(cell *c, int& wcol, int &fcol) {
}
case waFloorA: case waFloorB: // isAlch
if(c->item && !(conformal::includeHistory && eq(c->aitmp, sval)))
if(c->item && !(conformal::includeHistory && conformal::infindhistory.count(c)))
fcol = wcol = iinf[c->item].color;
else
fcol = wcol;
@@ -3648,7 +3648,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
bool hidden = itemHidden(c);
bool hiddens = itemHiddenFromSight(c);
if(conformal::includeHistory && eq(c->aitmp, sval)) {
if(conformal::includeHistory && conformal::infindhistory.count(c)) {
hidden = true;
hiddens = false;
}
@@ -4211,7 +4211,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
queuepoly((*Vdp), shHeptaMarker, wmblack ? 0x80808080 : 0x00000080);
}
if(conformal::includeHistory && eq(c->aitmp, sval-1))
if(conformal::includeHistory && conformal::inmovehistory.count(c))
queuepoly((*Vdp), shHeptaMarker, 0x000000C0);
char xch = winf[c->wall].glyph;
+55 -35
View File
@@ -2,9 +2,9 @@
// It is quite chaotic.
// version numbers
#define VER "10.4g"
#define VERNUM 10407
#define VERNUM_HEX 0xA0B7
#define VER "10.4h"
#define VERNUM 10408
#define VERNUM_HEX 0xA0B8
#include <stdarg.h>
@@ -369,10 +369,7 @@ struct cell : gcell {
// wall parameter, used for remaining power of Bonfires and Thumpers
char wparam;
// 'tmp' is used for:
// pathfinding algorithm used by monsters with atypical movement (which do not use pathdist)
// bugs' pathfinding algorithm
short aitmp;
int listindex;
uint32_t spintable;
int spin(int d) { return tspin(spintable, d); }
@@ -1064,6 +1061,7 @@ namespace conformal {
extern vector<pair<cell*, eMonster> > killhistory;
extern vector<pair<cell*, eItem> > findhistory;
extern vector<cell*> movehistory;
extern set<cell*> inmovehistory, inkillhistory, infindhistory;
extern bool includeHistory;
extern ld rotation;
extern int do_rotate;
@@ -1199,7 +1197,6 @@ bool isAlchAny(cell *c);
#define MODECODES 255
extern cellwalker cwt; // player character position
extern int sval;
extern array<int, ittypes> items;
extern array<int, motypes> kills;
@@ -2546,34 +2543,42 @@ extern vector<hrmap*> allmaps;
// list all cells in distance at most maxdist, or until when maxcount cells are reached
struct celllister {
struct manual_celllister {
vector<cell*> lst;
vector<int> tmps;
vector<int> dists;
void add(cell *c, int d) {
if(eq(c->aitmp, sval)) return;
c->aitmp = sval;
tmps.push_back(c->aitmp);
lst.push_back(c);
dists.push_back(d);
bool listed(cell *c) {
return c->listindex >= 0 && c->listindex < isize(lst) && lst[c->listindex] == c;
}
~celllister() {
for(int i=0; i<isize(lst); i++) lst[i]->aitmp = tmps[i];
bool add(cell *c) {
if(listed(c)) return false;
tmps.push_back(c->listindex);
c->listindex = isize(lst);
lst.push_back(c);
return true;
}
~manual_celllister() {
for(int i=0; i<isize(lst); i++) lst[i]->listindex = tmps[i];
}
};
struct celllister : manual_celllister {
vector<int> dists;
void add_at(cell *c, int d) {
if(add(c)) dists.push_back(d);
}
celllister(cell *orig, int maxdist, int maxcount, cell *breakon) {
lst.clear();
tmps.clear();
dists.clear();
sval++;
add(orig, 0);
add_at(orig, 0);
cell *last = orig;
for(int i=0; i<isize(lst); i++) {
cell *c = lst[i];
if(maxdist) forCellCM(c2, c) {
add(c2, dists[i]+1);
add_at(c2, dists[i]+1);
if(c2 == breakon) return;
}
if(c == last) {
@@ -2583,16 +2588,7 @@ struct celllister {
}
}
void prepare() {
for(int i=0; i<isize(lst); i++) lst[i]->aitmp = i;
}
int getdist(cell *c) { return dists[c->aitmp]; }
bool listed(cell *c) {
return c->aitmp >= 0 && c->aitmp < isize(lst) && lst[c->aitmp] == c;
}
int getdist(cell *c) { return dists[c->listindex]; }
};
hrmap *newAltMap(heptagon *o);
@@ -3569,4 +3565,28 @@ bool confusingGeometry();
int revhint(cell *c, int hint);
extern int pathlock;
extern void computePathdist(eMonster m);
extern void onpath(cell *c, int d);
extern void clear_pathdata();
struct pathdata {
void checklock() {
if(pd_from) pd_from = NULL, clear_pathdata();
if(pathlock) printf("path error\n");
pathlock++;
}
~pathdata() {
pathlock--;
clear_pathdata();
}
pathdata(eMonster m) {
checklock();
computePathdist(m);
}
pathdata(int i) {
checklock();
}
};
}
+6 -11
View File
@@ -60,12 +60,8 @@ bool reptilecheat = false;
#define ONEMPTY if(d == 7 && passable(c, NULL, 0) && !safety)
vector<cell*> noescape_list;
bool blizzard_no_escape1(cell *c) {
if(c->aitmp >= 0 && c->aitmp < isize(noescape_list) && noescape_list[c->aitmp] == c)
return true;
c->aitmp = isize(noescape_list); noescape_list.push_back(c);
bool blizzard_no_escape1(cell *c, manual_celllister &cl) {
if(!cl.add(c)) return true;
if(c->item == itOrbSafety)
return false;
forCellEx(c2, c) {
@@ -73,16 +69,15 @@ bool blizzard_no_escape1(cell *c) {
continue;
if(c2->land != laBlizzard && passable(c2, NULL, 0))
return false;
if(!againstWind(c2, c) && !blizzard_no_escape1(c2))
if(!againstWind(c2, c) && !blizzard_no_escape1(c2, cl))
return false;
}
return true;
}
bool blizzard_no_escape(cell *c) {
sval++;
noescape_list.resize(0);
return blizzard_no_escape1(c);
manual_celllister cl;
return blizzard_no_escape1(c, cl);
}
bool out_ruin(cell *c) {
@@ -383,7 +378,7 @@ void giantLandSwitch(cell *c, int d, cell *from) {
c->monst = moVizier;
c->hitpoints = palaceHP();
}
else if(princess::forceVizier && from->pathdist != PINFD) {
else if(princess::forceVizier && hrand(100) < 10 && canReachPlayer(c, moVizier)) {
c->monst = moVizier;
c->hitpoints = palaceHP();
princess::forceVizier = false;
+15 -19
View File
@@ -267,8 +267,9 @@ namespace mapstream {
c->bardir = NOBARRIERS;
// fixspin(rspin, loadChar(), c->type);
if(vernum < 7400) {
load(c->aitmp);
c->wparam = c->aitmp;
short z;
load(z);
c->wparam = z;
}
else load(c->wparam);
load(c->landparam);
@@ -620,7 +621,7 @@ namespace mapeditor {
vector<pair<cellwalker, cellwalker> > spill_list;
void list_spill(cellwalker tgt, cellwalker src) {
void list_spill(cellwalker tgt, cellwalker src, manual_celllister& cl) {
spill_list.clear(); sval++;
spill_list.emplace_back(tgt, src);
int crad = 0, nextstepat = 0;
@@ -633,8 +634,7 @@ namespace mapeditor {
for(int i=0; i<sd.first.c->type; i++) {
auto sd2 = sd;
sd2.first = sd2.first + i + wstep;
if(eq(sd2.first.c->aitmp, sval)) continue;
sd2.first.c->aitmp = sval;
if(!cl.add(sd2.first.c)) continue;
if(sd2.second.c) {
sd2.second = sd2.second + i + wstep;
if(sd2.second.c->land == laNone) continue;
@@ -668,7 +668,7 @@ namespace mapeditor {
}
#endif
void editAt(cellwalker where) {
void editAt(cellwalker where, manual_celllister& cl) {
if(painttype == 4 && radius) {
if(where.c->type != copysource.c->type) return;
@@ -677,7 +677,7 @@ namespace mapeditor {
where += 1;
}
if(painttype != 4) copysource.c = NULL;
list_spill(where, copysource);
list_spill(where, copysource, cl);
for(auto& st: spill_list)
editCell(st);
@@ -685,34 +685,30 @@ namespace mapeditor {
void allInPattern(cellwalker where) {
manual_celllister cl;
if(!patterns::whichPattern) {
editAt(where);
editAt(where, cl);
return;
}
vector<cell*> v;
v.push_back(where.c);
sval++;
where.c->aitmp = sval;
cl.add(where.c);
int at = 0;
while(at < isize(v)) {
cell *c2 = v[at];
while(at < isize(cl.lst)) {
cell *c2 = cl.lst[at];
at++;
forCellEx(c3, c2)
if(!eq(c3->aitmp, sval))
c3->aitmp = sval, v.push_back(c3);
forCellEx(c3, c2) cl.add(c3);
}
auto si = patterns::getpatterninfo0(where.c);
int cdir = where.spin;
if(cdir >= 0) cdir = cdir - si.dir;
for(cell* c2: v) {
for(cell* c2: cl.lst) {
auto si2 = patterns::getpatterninfo0(c2);
if(si2.id == si.id) {
editAt(cellwalker(c2, cdir>=0 ? fixdir(cdir + si2.dir, c2) : -1));
editAt(cellwalker(c2, cdir>=0 ? fixdir(cdir + si2.dir, c2) : -1), cl);
modelcell[si2.id] = c2;
}
}
+7 -7
View File
@@ -242,18 +242,17 @@ int getSeepcount() {
}
bool canReachPlayer(cell *cf, eMonster m) {
vector<cell*> v;
sval++;
v.push_back(cf); cf->aitmp = sval;
for(int i=0; i<isize(v); i++) {
cell *c = v[i];
manual_celllister cl;
cl.add(cf);
for(int i=0; i<isize(cl.lst) && i < 10000; i++) {
cell *c = cl.lst[i];
for(int j=0; j<c->type; j++) {
cell *c2 = c->mov[j];
if(!c2) continue;
if(eq(c2->aitmp, sval)) continue;
if(cl.listed(c2)) continue;
if(!passable_for(m, c2, c, P_MONSTER | P_ONPLAYER | P_CHAIN)) continue;
if(isPlayerOn(c2)) return true;
c2->aitmp = sval; v.push_back(c2);
cl.add(c2);
}
}
return false;
@@ -304,6 +303,7 @@ eItem wanderingTreasure(cell *c) {
void wandering() {
if(!canmove) return;
pathdata pd(moYeti);
int seepcount = getSeepcount();
int ghostcount = getGhostcount();
if(cwt.c->land == laCA) ghostcount = 0;
+16 -22
View File
@@ -247,29 +247,24 @@ bool distanceBound(cell *c1, cell *c2, int d) {
}
void checkFreedom(cell *cf) {
sval++;
static vector<cell*> avcells;
avcells.clear();
avcells.push_back(cf);
cf->aitmp = sval;
for(int i=0; i<isize(avcells); i++) {
cell *c = avcells[i];
manual_celllister cl;
cl.add(cf);
for(int i=0; i<isize(cl.lst); i++) {
cell *c = cl.lst[i];
if(c->cpdist >= 5) return;
for(int i=0; i<c->type; i++) {
cell *c2 = c->mov[i];
// todo leader
if(cl.listed(c2)) continue;
if(!passable(c2, c, P_ISPLAYER | P_MIRROR | P_LEADER)) continue;
if(eq(c2->aitmp, sval)) continue;
if(c2->wall == waArrowTrap && c2->wparam == 2) continue;
bool monsterhere = false;
for(int j=0; j<c2->type; j++) {
cell *c3 = c2->mov[j];
if(c3 && c3->monst && !isFriendly(c3))
monsterhere = true;
}
if(!monsterhere) {
c2->aitmp = sval;
avcells.push_back(c2);
}
if(!monsterhere) cl.add(c2);
}
}
addMessage(XLAT("Your %1 activates!", itOrbFreedom));
@@ -541,8 +536,7 @@ void teleportTo(cell *dest) {
drainOrb(itOrbTeleport);
movecost(cwt.c, dest);
playerMoveEffects(cwt.c, dest);
for(int i=9; i>=0; i--)
setdist(dest, i, NULL);
afterplayermoved();
bfs();
}
return;
@@ -557,9 +551,7 @@ void teleportTo(cell *dest) {
addMessage(XLAT("You teleport to a new location!"));
mirror::destroyAll();
for(int i=9; i>=0; i--)
setdist(cwt.c, i, NULL);
afterplayermoved();
bfs();
sword::reset();
@@ -1179,11 +1171,13 @@ eItem targetRangedOrb(cell *c, orbAction a) {
}
// (4a) colt
if(!shmup::on && items[itRevolver] && c->monst && canAttack(cwt.c, moPlayer, c, c->monst, AF_GUN)
&& c->pathdist <= GUNRANGE && !monstersnearO(a, cwt.c, c, moPlayer, NULL, cwt.c)) {
if(!isCheck(a)) gun_attack(c);
return itRevolver;
}
if(!shmup::on && items[itRevolver] && c->monst && canAttack(cwt.c, moPlayer, c, c->monst, AF_GUN)) {
pathdata pd(moEagle);
if(c->pathdist <= GUNRANGE && !monstersnearO(a, cwt.c, c, moPlayer, NULL, cwt.c)) {
if(!isCheck(a)) gun_attack(c);
return itRevolver;
}
}
// (5) psi blast (non-shmup variant)
if(!shmup::on && items[itOrbPsi] && c->monst && (isDragon(c->monst) || !isWorm(c)) && c->monst != moShadow && c->monst != moKrakenH) {
+2
View File
@@ -388,6 +388,8 @@ void bantar_frame() {
case 4:
xdst = .5, ydst = 0;
break;
default:
xdst = ydst = 0;
}
/* ld xpos = (!(i&2)) ? xdst : -xdst;
+13 -3
View File
@@ -287,15 +287,15 @@ struct cellcrawler {
vector<cellcrawlerdata> data;
void store(const cellwalker& o, int from, int spin) {
if(eq(o.c->aitmp, sval)) return;
o.c->aitmp = sval;
void store(const cellwalker& o, int from, int spin, manual_celllister& cl) {
if(!add(o.c)) return;
data.emplace_back(o, from, spin);
}
void build(const cellwalker& start) {
sval++;
data.clear();
manual_celllister cl;
store(start, 0, 0);
for(int i=0; i<isize(data); i++) {
cellwalker cw0 = data[i].orig;
@@ -593,6 +593,8 @@ void showbestsamples() {
if(whowon[i])
whowon[i]->samples++;
}
int kohrestrict = 1000000;
void sominit(int initto) {
@@ -614,6 +616,11 @@ void sominit(int initto) {
allcells = cl.lst;
}
else allcells = currentmap->allcells();
if(isize(allcells) > kohrestrict) {
sort(allcells.begin(), allcells.end(), [] (cell *c1, cell *c2) { return hdist0(tC0(shmup::ggmatrix(c1))) < hdist0(tC0(shmup::ggmatrix(c2))); });
allcells.resize(kohrestrict);
}
cells = isize(allcells);
net.resize(cells);
@@ -1177,6 +1184,9 @@ int readArgs() {
start_game();
verify_crawlers();
}
else if(argis("-somrestrict")) {
shift(); kohrestrict = argi();
}
else return 1;
return 0;
+7 -1
View File
@@ -706,6 +706,7 @@ namespace sag {
forgetedges(i);
}
shmup::fixStorage();
}
vector<edgeinfo> sagedges;
@@ -815,6 +816,8 @@ namespace sag {
printf("loglikelihood = %lf\n", (double) loglik);
}
ld min_visible_weight = .1;
void readsag(const char *fname) {
maxweight = 0;
FILE *f = fopen(fname, "rt");
@@ -869,7 +872,7 @@ namespace sag {
} */
for(int i=0; i<isize(sagedges); i++) {
edgeinfo& ei = sagedges[i];
ei.visible = ei.weight >= 0.1;
ei.visible = ei.weight >= min_visible_weight;
// (ei.weight >= maxwei[ei.i] / 5 || ei.weight >= maxwei[ei.j] / 5);
ei.weight2 = pow((double) ei.weight, (double) edgepower) * edgemul;
@@ -1410,6 +1413,9 @@ int readArgs() {
shift(); sag::hightemp = argf();
shift(); sag::lowtemp = argf();
}
else if(argis("-sagmin")) {
shift(); sag::min_visible_weight = argf();
}
// (2) read the edge data
else if(argis("-sagpar")) {
PHASE(3);
+5 -13
View File
@@ -2937,19 +2937,12 @@ void turn(int delta) {
for(int t=1; t<motypes; t++) if(exists[t]) {
pd_from = NULL;
pathdata pd(1);
// build the path data
int pqs = isize(pathq);
for(int i=0; i<pqs; i++) {
pathq[i]->pathdist = PINFD;
}
pathq.clear();
for(int i=0; i<isize(targets); i++) {
targets[i]->pathdist = isPlayerOn(targets[i]) ? 0 : 1;
pathq.push_back(targets[i]);
}
for(cell *c: targets)
onpath(c, isPlayerOn(c) ? 0 : 1);
int qb = 0;
for(qb=0; qb < isize(pathq); qb++) {
@@ -2961,8 +2954,7 @@ void turn(int delta) {
// printf("i=%d cd=%d\n", i, c->mov[i]->cpdist);
if(c2 && c2->pathdist == PINFD && gmatrix.count(c2) &&
(passable_for(eMonster(t), c, c2, P_CHAIN | P_ONPLAYER) || c->wall == waThumperOn)) {
c2->pathdist = d+1;
pathq.push_back(c2);
onpath(c2, d+1);
}
}
}
+3
View File
@@ -291,6 +291,9 @@ void initgame() {
bfs();
checkmove();
playermoved = true;
if(quotient || sphere)
for(cell *c: currentmap->allcells()) setdist(c, 8, NULL);
if(!cheater) gamerange_bonus = genrange_bonus = 0;
}
+3 -3
View File
@@ -1011,14 +1011,14 @@ namespace peace {
clister.emplace_back(cp, cp);
int id = 0;
sval++;
manual_celllister cl;
while(id < isize(clister)) {
cell *c = clister[id].first;
cell *fr = clister[id].second;
setdist(c, 5, NULL);
forCellEx(c2,c)
if(!eq(c2->aitmp, sval) && passable(c2, c, 0) && (c2->land == specialland || c2->land == laTemple) && !c2->item) {
if(!cl.listed(c2) && passable(c2, c, 0) && (c2->land == specialland || c2->land == laTemple) && !c2->item) {
if(!id) fr = c2;
bool next;
if(specialland == laRlyeh)
@@ -1031,7 +1031,7 @@ namespace peace {
goto again;
}
clister.emplace_back(c2, fr);
c2->aitmp = sval;
cl.add(c2);
}
id++;
}