From 9dc49fa297e54e67fb4eacaa4d78dd464fc01752 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 17 Oct 2017 12:54:59 +0200 Subject: [PATCH] nicer bridges over mercury --- graph.cpp | 105 +++++++++++++++++++++++++++++++++++++-------------- landgen.cpp | 7 ++++ polygons.cpp | 9 +++++ 3 files changed, 93 insertions(+), 28 deletions(-) diff --git a/graph.cpp b/graph.cpp index db9683ac..7bc86c2f 100644 --- a/graph.cpp +++ b/graph.cpp @@ -3031,6 +3031,53 @@ bool allemptynear(cell *c) { static const int trapcol[4] = {0x904040, 0xA02020, 0xD00000, 0x303030}; static const int terracol[8] = {0xD000, 0xE25050, 0xD0D0D0, 0x606060, 0x303030, 0x181818, 0x0080, 0x8080}; +// how much to darken +int getfd(cell *c) { + switch(c->land) { + case laRedRock: + case laReptile: + case laCanvas: + return 0; + + case laTerracotta: + case laMercuryRiver: + return c->wall == waMercury ? 0 : 1; + + case laKraken: + case laBurial: + case laIvoryTower: + case laDungeon: + case laMountain: + case laEndorian: + case laCaribbean: + case laWhirlwind: + case laRose: + case laWarpSea: + case laTortoise: + case laDragon: + case laHalloween: + case laHunting: + case laOcean: + case laLivefjord: + case laWhirlpool: + case laAlchemist: + case laIce: + case laGraveyard: + case laBlizzard: + case laRlyeh: + case laTemple: + case laWineyard: + case laDeadCaves: + case laPalace: + case laCA: + return 1; + + case laTrollheim: + default: + return 2; + } + } + void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { qfi.shape = NULL; qfi.special = false; @@ -3304,33 +3351,8 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { chasmg = chasmgraph(c); - int fd = - c->land == laRedRock ? 0 : - (c->land == laOcean || c->land == laLivefjord || c->land == laWhirlpool) ? 1 : - c->land == laAlchemist || c->land == laIce || c->land == laGraveyard || c->land == laBlizzard || - c->land == laRlyeh || c->land == laTemple || c->land == laWineyard || - c->land == laDeadCaves || c->land == laPalace || c->land == laCA ? 1 : - c->land == laCanvas ? 0 : - c->land == laKraken ? 1 : - c->land == laBurial ? 1 : - c->land == laIvoryTower ? 1 : - c->land == laDungeon ? 1 : - c->land == laMountain ? 1 : - c->land == laEndorian ? 1 : - c->land == laCaribbean ? 1 : - c->land == laWhirlwind ? 1 : - c->land == laRose ? 1 : - c->land == laWarpSea ? 1 : - c->land == laTortoise ? 1 : - c->land == laDragon ? 1 : - c->land == laHalloween ? 1 : - c->land == laTrollheim ? 2 : - c->land == laReptile ? 0 : - c->land == laHunting ? 1 : - c->land == laTerracotta ? 1 : - c->land == laMercuryRiver ? 0 : - 2; - + int fd = getfd(c); + if(c->wall == waMagma) fd = 0; poly_outline = OUTLINE_DEFAULT; @@ -3726,8 +3748,35 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { else if(c->land == laRedRock) qfloor(c, Vf, eoh ? shFloor[ct6] : shDesertFloor[ct6], darkena(fcol, fd, 0xFF)); - else if(c->land == laPalace || c->land == laTerracotta || c->land == laMercuryRiver) + else if(c->land == laPalace || c->land == laTerracotta) qfloor(c, Vf, (eoh?shFloor:shPalaceFloor)[ct6], darkena(fcol, fd, 0xFF)); + + else if(c->land == laMercuryRiver) { + if(eoh) + qfloor(c, Vf, shFloor[ct6], darkena(fcol, fd, 0xFF)); + else { + int bridgedir = -1; + if(c->type == 6) { + for(int i=1; itype; i+=2) + if(pseudohept(c->mov[(i+5)%6]) && c->mov[(i+5)%6]->land == laMercuryRiver) + if(pseudohept(c->mov[(i+1)%6]) && c->mov[(i+1)%6]->land == laMercuryRiver) + bridgedir = i; + } + if(bridgedir == -1) + qfloor(c, Vf, (eoh?shFloor:shPalaceFloor)[ct6], darkena(fcol, fd, 0xFF)); + else { + transmatrix bspin = ddspin(c, bridgedir); + qfloor(c, Vf, bspin, shMercuryBridge[0], darkena(fcol, fd, 0xFF)); + // only needed in one direction + if(c < c->mov[bridgedir]) { + bspin = Vf * bspin; + queuepoly(bspin, shMercuryBridge[1], darkena(fcol, fd+1, 0xFF)); + queuepolyat(mscale(bspin, geom3::LAKE), shMercuryBridge[1], darkena(gradient(0, winf[waMercury].color, 0, 0.8,1), 0, 0x80), PPR_LAKELEV); + queuepolyat(mscale(bspin, geom3::BOTTOM), shMercuryBridge[1], darkena(0x202020, 0, 0xFF), PPR_LAKEBOTTOM); + } + } + } + } else { qfloor(c, Vf, shFloor[ct6], darkena(fcol, fd, 0xFF)); diff --git a/landgen.cpp b/landgen.cpp index b9011048..665b75fd 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -821,6 +821,13 @@ void giantLandSwitch(cell *c, int d, cell *from) { c->landparam--; } } + if(d == 7) { + int nearriver = 0; + forCellEx(c2, c) + if(c2->wall == waMercury && pseudohept(c2)) + nearriver++; + if(nearriver == 2) c->land = laMercuryRiver; + } ONEMPTY { bool nearwarrior = false; forCellEx(c2, c) if(c2->wall == waTerraWarrior) nearwarrior = true; diff --git a/polygons.cpp b/polygons.cpp index 87e5c98e..7b4cdf81 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -642,6 +642,7 @@ hpcshape shSemiFloor[2], shSemiBFloor[2], shSemiFloorShadow, shDesertFloor[2], shRedRockFloor[3][2], shPalaceFloor[2], shNewFloor[2], shTrollFloor[2], + shMercuryBridge[2], shLeafFloor[2], shBarrowFloor[3], shTriheptaFloor[11], shTriheptaFloor2[2], shTriheptaEuc[3], @@ -1359,6 +1360,10 @@ void buildpolys() { bshape(shTriheptaEucShadow[2], PPR_FLOOR, scalef*SHADMUL, 44); bshape(shPalaceFloor[0], PPR_FLOOR, scalef*spzoom6, 45); bshape(shPalaceFloor[1], PPR_FLOOR, scalef*spzoomd7, 46); + + bshape(shMercuryBridge[0], PPR_FLOOR, scalef*spzoom6, 365); + bshape(shMercuryBridge[1], PPR_FLOOR, scalef*spzoomd7, 366); + bshape(shPalaceGate, PPR_STRUCT1, scalef, 47); bshape(shSemiFeatherFloor[0], PPR_FLOOR, scalef*spzoom6, 48); bshape(shSemiFeatherFloor[1], PPR_FLOOR, scalef*spzoom6, 49); @@ -2851,6 +2856,10 @@ NEWSHAPE, 362, 1, 1, -0.098710,-0.040954, -0.120861,-0.011561, -0.169793,0.00105 NEWSHAPE, 363, 1, 2, -0.252495,0.014545, -0.330447,0.029660, -0.319594,0.016402, -0.419249,0.040217, -0.457189,-0.013336, NEWSHAPE, 364, 1, 2, -0.486619,0.002830, -0.418060,0.040577, -0.427473,0.022591, -0.408958,0.019603, -0.426031,0.010325, -0.407739,0.001037, + +NEWSHAPE, 365, 1, 2, -0.236444,-0.000864, -0.300824,-0.142089, 0.027603,-0.331178, 0.117026,-0.205327, +NEWSHAPE, 366, 1, 2, 0.120242,0.202432, 0.476077,0.202192, + NEWSHAPE };