From 3ede3601ea9e71237c19f441dd36c7de40787316 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 29 Oct 2017 23:54:26 +0100 Subject: [PATCH] started working on the 'Dual Land' --- classes.cpp | 22 +++++++++++++--------- classes.h | 5 +++-- game.cpp | 2 ++ graph.cpp | 36 +++++++++++++++++++++++++++++++++--- landgen.cpp | 5 +++++ menus.cpp | 1 + polygons.cpp | 20 ++++++++++++++------ 7 files changed, 71 insertions(+), 20 deletions(-) diff --git a/classes.cpp b/classes.cpp index 52563d56..38f482e2 100644 --- a/classes.cpp +++ b/classes.cpp @@ -1557,11 +1557,12 @@ const landtype linf[landtypes] = { { 0x8080FF, "Blizzard", blizzarddesc}, { 0x207068, "Hunting Ground", huntingdesc}, { 0xE2725B, "Terracotta Army", terraldesc}, - { 0xE2725B, "Terracotta Army", terraldesc} + { 0xE2725B, "Terracotta Army", terraldesc}, + { 0xE04040, "Dual", NODESCYET} }; #define LAND_OVER 57 -#define LAND_OVERX 59 +#define LAND_OVERX 60 eLand land_over[LAND_OVERX] = { laIce, laCaves, laDesert, laHunting, laMotion, laJungle, laAlchemist, @@ -1581,10 +1582,10 @@ eLand land_over[LAND_OVERX] = { laHell, laCrossroads3, laCocytus, laPower, laCrossroads4, laCrossroads5, // EXTRA - laWildWest, laHalloween + laWildWest, laHalloween, laDual }; -#define LAND_EUC 53 +#define LAND_EUC 54 eLand land_euc[LAND_EUC] = { laIce, laCaves, laDesert, laMotion, laJungle, laCrossroads, @@ -1599,10 +1600,11 @@ eLand land_euc[LAND_EUC] = { laWildWest, laReptile, laMountain, laBull, laPrairie, laVolcano, laHunting, laBlizzard, laTerracotta, + laDual }; // MISSING: laCrossroads2 -#define LAND_SPH 39 +#define LAND_SPH 40 eLand land_sph[LAND_SPH] = { laHalloween, laIce, laCaves, laDesert, laMotion, laJungle, @@ -1615,19 +1617,21 @@ eLand land_sph[LAND_SPH] = { laEmerald, laDragon, laTortoise, laHell, laCrossroads3, laCocytus, laPower, laElementalWall, laCrossroads4, - laWildWest, laPalace, laBull, laPrairie, laCA + laWildWest, laPalace, laBull, laPrairie, laCA, + laDual }; -#define LAND_OCT 33 +#define LAND_OCT 36 eLand land_oct[LAND_OCT] = { - laIce, laDesert, laCaves, laJungle, laAlchemist, + laWarpCoast, 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, laPalace, laMirrorOld, laVolcano, laBlizzard, laTerracotta, - laWineyard, laPower, laEmerald + laWineyard, laPower, laEmerald, laWhirlpool, + laDual }; diff --git a/classes.h b/classes.h index 89565ba7..73063894 100644 --- a/classes.h +++ b/classes.h @@ -158,7 +158,7 @@ enum eWall { waNone, waIcewall, waBarrier, waFloorA, waFloorB, waCavewall, waCav waArrowTrap, waMercury, waMagma }; -static const int landtypes = 77; +static const int landtypes = 78; struct landtype { int color; @@ -183,7 +183,8 @@ enum eLand { laNone, laBarrier, laCrossroads, laDesert, laIce, laCaves, laJungle laPrairie, laBull, laCrossroads5, laCA, laMirrorWall, laMirrored, laMirrorWall2, laMirrored2, laMirrorOld, - laVolcano, laBlizzard, laHunting, laTerracotta, laMercuryRiver + laVolcano, laBlizzard, laHunting, laTerracotta, laMercuryRiver, + laDual }; enum eGeometry {gNormal, gEuclid, gSphere, gElliptic, gQuotient, gQuotient2, gTorus, gOctagon, g45, g46, g47, gSmallSphere, gTinySphere, gGUARD}; diff --git a/game.cpp b/game.cpp index a263eae4..f7ab086b 100644 --- a/game.cpp +++ b/game.cpp @@ -2896,6 +2896,8 @@ bool makeEmpty(cell *c) { c->wall = waFrozenLake; else if(c->land == laAlchemist || c->land == laCanvas) ; + else if(c->land == laDual) + ; else if(c->land == laCaves || c->land == laEmerald) c->wall = waCavefloor; else if(c->land == laDeadCaves) diff --git a/graph.cpp b/graph.cpp index e382c27d..9655d7dd 100644 --- a/graph.cpp +++ b/graph.cpp @@ -2431,7 +2431,7 @@ void setcolors(cell *c, int& wcol, int &fcol) { case laBurial: case laTrollheim: case laBarrier: case laOceanWall: case laCrossroads2: case laCrossroads3: case laCrossroads4: case laCrossroads5: case laRose: case laPower: case laWildWest: case laHalloween: case laRedRock: - case laDragon: case laStorms: case laTerracotta: case laMercuryRiver: + case laDragon: case laStorms: case laTerracotta: case laMercuryRiver: case laDual: fcol = linf[c->land].color; break; case laDesert: fcol = 0xEDC9AF; break; @@ -2818,6 +2818,12 @@ void floorShadow(cell *c, const transmatrix& V, int col, bool warp) { else queuepolyat(V * applyPatterndir(c), shTriheptaFloorShadow[ctof(c)], col, PPR_WALLSHADOW); } + else if(c->land == laDual) { + if(euclid && ishex1(c)) + queuepolyat(V * pispin, shBigTriShadow, col, PPR_WALLSHADOW); + else + queuepolyat(V, shBigTriShadow, col, PPR_WALLSHADOW); + } else { queuepolyat(V, shFloorShadow[ctof(c)], col, PPR_WALLSHADOW); } @@ -2838,6 +2844,12 @@ void plainfloor(cell *c, bool warp, const transmatrix &V, int col, int prio) { else queuepolyat(V * applyPatterndir(c), shTriheptaFloor[sphere ? ctof(c) : mapeditor::nopattern(c)], col, prio); } + else if(c->land == laDual) { + if(euclid && ishex1(c)) + queuepolyat(V * pispin, shBigTriangle, col, prio); + else + queuepolyat(V, shBigTriangle, col, prio); + } else { queuepolyat(V, shFloor[ctof(c)], col, prio); } @@ -2854,11 +2866,19 @@ void fullplainfloor(cell *c, bool warp, const transmatrix &V, int col, int prio) else queuepolyat(V * applyPatterndir(c), shTriheptaFloor[sphere ? ctof(c) : mapeditor::nopattern(c)], col, prio); } + else if(c->land == laDual) { + if(euclid && ishex1(c)) + queuepolyat(V * pispin, shBigTriangle, col, prio); + else + queuepolyat(V, shBigTriangle, col, prio); + } else { queuepolyat(V, shFullFloor[ctof(c)], col, prio); } } +void qfloor_eswap(cell *c, const transmatrix& V, const hpcshape& sh, int col); + void qplainfloor(cell *c, bool warp, const transmatrix &V, int col) { if(warp) { if(euclid) { @@ -2870,6 +2890,8 @@ void qplainfloor(cell *c, bool warp, const transmatrix &V, int col) { else qfloor(c, V, applyPatterndir(c), shTriheptaFloor[sphere ? ctof(c) : mapeditor::nopattern(c)], col); } + else if(c->land == laDual) + qfloor_eswap(c, V, shBigTriangle, col); else { qfloor(c, V, shFloor[ctof(c)], col); } @@ -2925,6 +2947,10 @@ void escherSidewall(cell *c, int sidepar, const transmatrix& V, int col) { void placeSidewall(cell *c, int i, int sidepar, const transmatrix& V, bool warp, bool mirr, int col) { if(shmup::on || purehepta) warp = false; if(warp && !ishept(c) && (!c->mov[i] || !ishept(c->mov[i]))) return; + if(c->land == laDual) { + if(ctof(c)) return; + if(euclid ? (ishex1(c) ? !(i&1) : (i&1)) : !(i&1)) return; + } int prio; /* if(mirr) prio = PPR_GLASS - 2; else */ if(sidepar == SIDE_WALL) prio = PPR_WALL3 - 2; @@ -2944,9 +2970,9 @@ void placeSidewall(cell *c, int i, int sidepar, const transmatrix& V, bool warp, // queuepoly(V2 * xpush(.1), shSnowball, aw ? 0xFFFFFFFF : 0xFF0000FF); // prio += c->cpdist - c->mov[i]->cpdist; - + queuepolyat(V2, - (mirr?shMFloorSide:warp?shTriheptaSide:shFloorSide)[sidepar][ctof(c)], col, prio); + (mirr?shMFloorSide:warp?shTriheptaSide:c->land == laDual?shBigTriSide:shFloorSide)[sidepar][ctof(c)], col, prio); } bool openorsafe(cell *c) { @@ -3591,6 +3617,10 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { else if(isWarped(c) && euclid) qfloor_eswap(c, Vf, shTriheptaFloor[ctof(c)], darkena(fcol, fd, 0xFF)); + else if(c->land == laDual && !purehepta && !ctof(c)) { + qfloor_eswap(c, Vf, shBigTriangle, darkena(fcol, fd, 0xFF)); + } + else if(isWarped(c) && !purehepta && !shmup::on) { int np = mapeditor::nopattern(c); if(c->landparam == 1337) np = 0; // for the achievement screenshot diff --git a/landgen.cpp b/landgen.cpp index f1dda77b..ec2107a4 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -1919,6 +1919,11 @@ void giantLandSwitch(cell *c, int d, cell *from) { case laMercuryRiver: // do nothing! break; + + case laDual: + if(d == 9 && (ctof(c) || hrand(100) < 5)) + c->wall = waChasm; + break; } } diff --git a/menus.cpp b/menus.cpp index 197b684f..b8551f0c 100644 --- a/menus.cpp +++ b/menus.cpp @@ -728,6 +728,7 @@ void showEuclideanMenu() { landvisited[laHalloween] = true; landvisited[laWarpCoast] = true; landvisited[laGraveyard] = true; + landvisited[laDual] = true; landvisited[laCA] = true; // for(int i=2; i