shallow water graphics and mechanics

This commit is contained in:
Zeno Rogue 2020-02-26 01:15:30 +01:00
parent 87254a551e
commit 99e64d862d
9 changed files with 37 additions and 10 deletions

View File

@ -140,6 +140,9 @@ void celldrawer::setcolors() {
case laAlchemist:
fcol = floorcolors[c->land]; break;
case laWet:
fcol = c->wall == waShallow ? 0x40C0C0 : 0x40FF40; break;
#if CAP_COMPLEX2
case laVariant: {
int b = getBits(c);
@ -1332,6 +1335,7 @@ void celldrawer::draw_features() {
case waFrozenLake: case waLake: case waCamelotMoat:
case waSea: case waOpenGate: case waBubble: case waDock:
case waDeepWater: case waShallow:
case waSulphur: case waMercury:
break;
@ -1984,8 +1988,11 @@ void celldrawer::draw_wall_full() {
else if(qfi.fshape == &cgi.shCaveFloor)
set_floor(cgi.shCaveSeabed);
int sid = SIDE_LTOB;
if(c->wall == waShallow) sid = SIDE_ASHA;
if(WDIM == 2 && GDIM == 3 && qfi.fshape)
draw_shapevec(c, V, qfi.fshape->levels[SIDE_LTOB], col, PPR::LAKEBOTTOM);
draw_shapevec(c, V, qfi.fshape->levels[sid], col, PPR::LAKEBOTTOM);
else
draw_qfi(c, mscale(V, cgi.BOTTOM), col, PPR::LAKEBOTTOM);
@ -2096,11 +2103,17 @@ void celldrawer::draw_wall_full() {
#if CAP_SHAPES
int sha = shallow(c);
if(wmspatial && sha && WDIM == 2) {
#define D(v) darkena(gradient(0, col, 0, v * (sphere ? spherity(V * currentmap->adj(c,i)) : 1), 1), fd, 0xFF)
if(wmspatial && c->wall == waShallow && WDIM == 2) {
color_t col = (highwall(c) || c->wall == waTower) ? wcol : fcol;
forCellIdEx(c2, i, c) if(chasmgraph(c2) && c2->wall != waShallow)
if(placeSidewall(c, i, SIDE_BSHA, V, D(.6))) break;
}
else if(wmspatial && sha && WDIM == 2) {
color_t col = (highwall(c) || c->wall == waTower) ? wcol : fcol;
if(!chasmg) {
#define D(v) darkena(gradient(0, col, 0, v * (sphere ? spherity(V * currentmap->adj(c,i)) : 1), 1), fd, 0xFF)
// #define D(v) darkena(col, fd, 0xFF)
if(sha & 1) {
@ -2108,8 +2121,11 @@ void celldrawer::draw_wall_full() {
if(placeSidewall(c, i, SIDE_LAKE, V, D(.8))) break;
}
if(sha & 2) {
forCellIdEx(c2, i, c) if(chasmgraph(c2))
if(placeSidewall(c, i, SIDE_LTOB, V, D(.7))) break;
forCellIdEx(c2, i, c) {
if(chasmgraph(c2)) {
if(placeSidewall(c, i, c2->wall == waShallow ? SIDE_ASHA : SIDE_LTOB, V, D(.7))) break;
}
}
}
if(sha & 4) {
bool dbot = true;

View File

@ -1803,7 +1803,7 @@ EX void reverse_priority(PPR p) {
EX void reverse_side_priorities() {
for(PPR p: {PPR::REDWALLs, PPR::REDWALLs2, PPR::REDWALLs3, PPR::WALL3s,
PPR::LAKEWALL, PPR::INLAKEWALL, PPR::BELOWBOTTOM})
PPR::LAKEWALL, PPR::INLAKEWALL, PPR::BELOWBOTTOM, PPR::BSHALLOW, PPR::ASHALLOW})
reverse_priority(p);
}

View File

@ -630,7 +630,7 @@ EX void moverefresh(bool turn IS(true)) {
fallMonster(c, AF_FALL);
}
}
else if(!isWateryOrBoat(c)) {
else if(!isWateryOrBoat(c) && c->wall != waShallow) {
if(c->monst == moGreaterShark)
c->monst = moGreaterM;
else if(c->monst == moShark || c->monst == moCShark) {

View File

@ -333,6 +333,7 @@ EX int chasmgraph(cell *c) {
if(c->wall == waChasm || c->wall == waInvisibleFloor) return 2;
if(isChasmy(c)) return 1;
if(isWateryOrBoat(c)) return 1;
if(c->wall == waShallow) return 1;
if(wmescher && c->wall == waBarrier && c->land == laOceanWall) return 1;
if(c->wall == waReptileBridge) return 1;
return 0;

View File

@ -46,7 +46,9 @@ struct hpcshape {
#define SIDE_SKY 8
#define SIDE_HIGH 9
#define SIDE_HIGH2 10
#define SIDEPARS 11
#define SIDE_ASHA 11
#define SIDE_BSHA 12
#define SIDEPARS 13
#define BADMODEL 0
@ -140,7 +142,8 @@ struct geometry_information {
LEG0, LEG1, LEG, LEG3, GROIN, GROIN1, GHOST,
BODY, BODY1, BODY2, BODY3,
NECK1, NECK, NECK3, HEAD, HEAD1, HEAD2, HEAD3,
ALEG0, ALEG, ABODY, AHEAD, BIRD, LOWSKY, SKY, HIGH, HIGH2;
ALEG0, ALEG, ABODY, AHEAD, BIRD, LOWSKY, SKY, HIGH, HIGH2,
SHALLOW;
ld human_height, slev;
ld eyelevel_familiar, eyelevel_human, eyelevel_dog;
@ -767,6 +770,7 @@ EX namespace geom3 {
for(int s=0; s<=3; s++)
SLEV[s] = lev_to_factor(vid.rock_wall_ratio * wh * s/3);
LAKE = lev_to_factor(-vid.lake_top);
SHALLOW = lev_to_factor(-.4);
HELLSPIKE = lev_to_factor(-(vid.lake_top+vid.lake_bottom)/2);
BOTTOM = lev_to_factor(-vid.lake_bottom);
LOWSKY = lev_to_factor(2 * wh);

View File

@ -3245,6 +3245,8 @@ EX bool placeSidewall(cell *c, int i, int sidepar, const transmatrix& V, color_t
else if(sidepar == SIDE_LAKE) prio = PPR::LAKEWALL;
else if(sidepar == SIDE_LTOB) prio = PPR::INLAKEWALL;
else if(sidepar == SIDE_BTOI) prio = PPR::BELOWBOTTOM;
else if(sidepar == SIDE_ASHA) prio = PPR::ASHALLOW;
else if(sidepar == SIDE_BSHA) prio = PPR::BSHALLOW;
else prio = PPR::REDWALL-2+4*(sidepar-SIDE_SLEV);
dynamicval<bool> ncor(approx_nearcorner, true);

View File

@ -546,6 +546,7 @@ enum class PPR {
LAKEBOTTOM, HELLSPIKE,
INLAKEWALLm, INLAKEWALL, INLAKEWALLp,
INLAKEWALL_FALLANIM,
BSHALLOW, SHALLOW, ASHALLOW,
SUBLAKELEV, LAKELEV, BOATLEV, BOATLEV2, BOATLEV3,
LAKEWALLm, LAKEWALL, LAKEWALLp,
LAKEWALL_FALLANIM,

View File

@ -386,7 +386,7 @@ bool sharkpassable(cell *w, cell *c) {
if(w == c || !c) return true;
if(nonAdjacent(w,c)) return false;
if(isPlayerOn(w)) return true;
if(!isWatery(w)) return false;
if(!isWatery(w) && w->wall != waShallow) return false;
if(sword::at(w, 0)) return false;
// don't go against the current

View File

@ -307,6 +307,7 @@ void geometry_information::make_sidewalls() {
dfloor_table[SIDE_HIGH] = HIGH;
dfloor_table[SIDE_HIGH2] = HIGH2;
dfloor_table[SIDE_SKY ] = SKY;
dfloor_table[SIDE_ASHA] = SHALLOW;
// sidewall parameters for the 3D mode
for(int k=0; k<SIDEPARS; k++) {
@ -319,6 +320,8 @@ void geometry_information::make_sidewalls() {
else if(k==SIDE_HIGH) dlow = WALL, dhi = HIGH;
else if(k==SIDE_HIGH2) dlow = HIGH, dhi = HIGH2;
else if(k==SIDE_SKY) dlow = HIGH2, dhi = SKY;
else if(k==SIDE_BSHA) dlow = BOTTOM, dhi = SHALLOW;
else if(k==SIDE_ASHA) dlow = SHALLOW, dhi = LAKE;
else dlow = SLEV[k-SIDE_SLEV], dhi = SLEV[k-SIDE_SLEV+1];
dlow_table[k] = dlow;
dhi_table[k] = dhi;