better sky for R'Lyeh, Temple, and Ruined City

This commit is contained in:
Zeno Rogue 2019-06-17 19:36:29 +02:00
parent b7e84ec04c
commit c039f229e3
3 changed files with 83 additions and 22 deletions

View File

@ -1528,6 +1528,7 @@ void moreBigStuff(cell *c) {
c->land = laTemple, c->wall = waNone, c->monst = moNone, c->item = itNone;
}
if(d % TEMPLE_EACH==0) {
c->landparam = 0;
if(geometry == gSpace534) {
int i = 0;
forCellCM(c2, c) if(celldistAlt(c2) < celldistAlt(c)) i++;
@ -1553,7 +1554,9 @@ void moreBigStuff(cell *c) {
}
if(q == 2) c->wall = waColumn;
}
c->landparam = 1;
}
else c->landparam = 2;
}
}

View File

@ -4657,15 +4657,17 @@ int ceiling_category(cell *c) {
case laSwitch:
return 3;
case laRlyeh:
case laTemple:
case laRuins:
return 5;
case laPalace:
case laPrincessQuest:
default:
return 4;
case laRuins:
return 6;
case laTemple:
case laRlyeh:
return 7;
}
}
@ -4753,6 +4755,16 @@ void dqi_sky::draw() {
glDrawArrays(GL_TRIANGLES, 0, isize(skyvertices));
}
color_t skycolor(cell *c) {
int cd = (euclid || stdhyperbolic) ? getCdata(c, 1) : 0;
int z = (cd * 5) & 127;
if(z >= 64) z = 127 - z;
if(c->land == laHell)
return z < 32 ? gradient(0x400000, 0xFF0000, 0, z, 32) : gradient(0xFF0000, 0xFFFF00, 32, z, 63);
else
return gradient(0x4040FF, 0xFFFFFF, 0, z, 63);
}
void draw_ceiling(cell *c, const transmatrix& V, int fd, color_t& fcol, color_t& wcol) {
if(pmodel != mdPerspective || sphere) return;
@ -4815,15 +4827,8 @@ void draw_ceiling(cell *c, const transmatrix& V, int fd, color_t& fcol, color_t&
col = c->wall == waChasm ? 0xFFFFFF : 0x4040FF;
break;
default: {
int cd = (euclid || stdhyperbolic) ? getCdata(c, 1) : 0;
int z = (cd * 5) & 127;
if(z >= 64) z = 127 - z;
if(c->land == laHell)
col = z < 32 ? gradient(0x400000, 0xFF0000, 0, z, 32) : gradient(0xFF0000, 0xFFFF00, 32, z, 63);
else
col = gradient(0x4040FF, 0xFFFFFF, 0, z, 63);
}
default:
col = skycolor(c);
}
if(sky) sky->sky.emplace_back(c, V, col);
return;
@ -4869,6 +4874,43 @@ void draw_ceiling(cell *c, const transmatrix& V, int fd, color_t& fcol, color_t&
break;
}
case 6: {
if(sky) sky->sky.emplace_back(c, V, skycolor(c));
if(camera_level <= cgi.HIGH2) return;
color_t wcol2 = winf[waRuinWall].color;
if(c->landparam == 1)
forCellIdEx(c2, i, c) if(c2->landparam != 1)
placeSidewall(c, i, SIDE_HIGH, V, darkena(wcol2, fd, 0xFF));
if(c->landparam != 2)
forCellIdEx(c2, i, c) if(c2->landparam == 2)
placeSidewall(c, i, SIDE_HIGH2, V, darkena(wcol2, fd, 0xFF));
if(c->landparam == 0)
if(qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_HIGH], darkena(wcol2, fd, 0xFF), PPR::WALL);
if(c->landparam == 1)
if(qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], darkena(wcol2, fd, 0xFF), PPR::WALL);
break;
}
case 7: {
if(sky) sky->sky.emplace_back(c, V, 0x00000F);
if(fieldpattern::fieldval_uniq(c) % 3 == 0) {
queuepolyat(V * zpush(cgi.SKY+1), cgi.shNightStar, 0xFFFFFFFF, PPR::SKY);
}
if(camera_level <= cgi.HIGH2) return;
color_t wcol2 = winf[waColumn].color;
if(c->landparam == 1)
forCellIdEx(c2, i, c) if(c2->landparam != 1)
placeSidewall(c, i, SIDE_HIGH, V, darkena(wcol2, fd, 0xFF));
if(c->landparam != 2)
forCellIdEx(c2, i, c) if(c2->landparam == 2)
placeSidewall(c, i, SIDE_HIGH2, V, darkena(wcol2, fd, 0xFF));
if(c->landparam == 0)
if(qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_HIGH], darkena(wcol2, fd, 0xFF), PPR::WALL);
if(c->landparam == 1)
if(qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], darkena(wcol2, fd, 0xFF), PPR::WALL);
break;
}
case 5: {
if(sky) sky->sky.emplace_back(c, V, 0x00000F);
if(camera_level <= cgi.WALL) return;

View File

@ -1397,6 +1397,20 @@ void giantLandSwitch(cell *c, int d, cell *from) {
if(buildIvy(c, 0, 3) && !peace::on) c->item = itStatue;
}
}
if(c->mpdist >= 7) {
if(c->wall == waColumn) c->landparam = 1;
else {
int i = 0, j = 0;
for(int k=0; k<c->type; k++)
if(c->move(k) && c->move(k)->wall == waColumn) {
i++;
if(c->modmove(k+1) && c->modmove(k+1)->wall == waColumn) j++;
if(c->modmove(k+2) && c->modmove(k+2)->wall == waColumn) j++;
}
if(i > 2 || (i == 2 && !j)) c->landparam = 1;
else c->landparam = 2;
}
}
break;
case laTemple:
@ -2144,14 +2158,16 @@ void giantLandSwitch(cell *c, int d, cell *from) {
c->wall = RANDPAT ? waRuinWall : waNone;
}
else {
if(out_ruin(c)) {
if(hrand(100) < 3)
c->wall = waRuinWall;
}
else if(hrand(100) < 75) {
forCellEx(c2, c) if(out_ruin(c2))
c->wall = waRuinWall;
}
c->landparam = 2;
if(out_ruin(c))
c->landparam = 0;
else forCellEx(c2, c) if(out_ruin(c2))
c->landparam = 1;
if(c->landparam == 0 && hrand(100) < 3)
c->wall = waRuinWall, c->landparam = 1;
if(c->landparam == 1 && hrand(100) < 75)
c->wall = waRuinWall;
}
if(hrand_monster(40000) < kf && !c->monst && !c->wall && !shmup::on) {
cell *c1 = c;