1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-28 11:00:34 +00:00

ASCII/3D mode, also reacts to neon settings

This commit is contained in:
Zeno Rogue 2020-01-30 17:45:05 +01:00
parent 34d5ec2242
commit 8005b39f6f
5 changed files with 104 additions and 8 deletions

View File

@ -21,6 +21,9 @@ struct celldrawer {
transmatrix Vboat;
transmatrix Vd;
int sl;
color_t asciiborder;
color_t asciicol1;
char asciichar1;
void addaura();
void setcolors();
@ -2079,9 +2082,12 @@ void celldrawer::draw_wall_full() {
if(mines == 0) asciichar = ' ';
else asciichar = '0' + mines, asciicol = minecolors[mines%10];
}
else if(asciichar == '@') asciicol = minecolors[mines%10];
else if(asciichar == '@') {
asciicol = minecolors[mines%10];
}
}
if(wmascii && !(c->item || c->monst || c->cpdist == 0)) error = true;
if(wmascii && !((c->item && !itemHiddenFromSight(c)) || c->monst || c->cpdist == 0)) error = true;
asciiborder = bordcolor;
}
#if CAP_SHAPES
@ -2141,6 +2147,7 @@ void celldrawer::draw_item_full() {
if(it) {
asciichar = iinf[it].glyph, asciicol = icol = iinf[it].color;
if(doHighlight()) asciiborder = kind_outline(it) >> 8;
if(it == itCompass && isPlayerOn(c)) {
cell *c1 = c ? findcompass(c) : NULL;
@ -2201,6 +2208,8 @@ void celldrawer::draw_monster_full() {
}
asciicol = moncol;
if(doHighlight() && !noHighlight(c->monst))
asciiborder = (isFriendly(c) ? OUTLINE_FRIEND : OUTLINE_ENEMY) >> 8;
if(isDragon(c->monst) || isKraken(c->monst)) if(!c->hitpoints)
asciicol = 0x505050;
@ -2215,6 +2224,8 @@ void celldrawer::draw_monster_full() {
if(c->cpdist == 0 && mapeditor::drawplayer) {
asciichar = '@';
if(!mmitem) asciicol = moncol = cheater ? 0xFF3030 : 0xD0D0D0;
if(doHighlight())
asciiborder = OUTLINE_FRIEND >> 8;
}
#if CAP_SHAPES
@ -2482,6 +2493,14 @@ void celldrawer::draw() {
asciichar = winf[c->wall].glyph;
asciicol = wcol;
asciichar1 = asciichar;
asciicol1 = asciicol;
if(c->wall == waBoat) {
asciicol1 = fcol;
asciichar1 = '=';
}
onradar = true;
@ -2528,7 +2547,50 @@ void celldrawer::draw() {
#if CAP_QUEUE
if(error) {
queuestr(V, 1, s0+asciichar, darkenedby(asciicol, darken), 2);
int sl;
string s = s0+asciichar;
dynamicval<color_t> p(poly_outline, asciiborder << 8);
if(!wmascii3)
queuestrn(V, 1, s, darkenedby(asciicol, darken), 2);
else if(highwall(c) && conegraph(c)) {
const int layers = 1 << detaillevel;
string s1 = s0+asciichar1;
poly_outline = bordcolor << 8;
for(int z=0; z<layers; z++)
queuestrn(mscale(V, zgrad0(0, geom3::actual_wall_height(), z, layers)), 1. - z * .5 / layers, s1, darkenedby(gradient(bordcolor, asciicol1, -layers, z, layers), darken), 1);
poly_outline = asciiborder << 8;
queuestrn(mscale(V, cgi.WALL), asciicol == asciicol1 && asciichar == asciichar1 ? .5 : 1, s, darkenedby(asciicol, darken), 2);
}
else if(highwall(c)) {
const int layers = 1 << detaillevel;
string s1 = s0+asciichar1;
poly_outline = bordcolor << 8;
for(int z=0; z<layers; z++)
queuestrn(mscale(V, zgrad0(0, geom3::actual_wall_height(), z, layers)), 1, s1, darkenedby(gradient(bordcolor, asciicol1, -layers, z, layers), darken), 1);
poly_outline = asciiborder << 8;
queuestrn(mscale(V, cgi.WALL), 1, s, darkenedby(asciicol, darken), 2);
}
else if((sl = snakelevel(c))) {
string s1 = s0+asciichar1;
poly_outline = bordcolor << 8;
for(int z=0; z<sl*4; z++) if(z%4 == 0)
queuestrn(mscale(V, zgrad0(0, cgi.slev * sl, z, sl*4)), 1, s1, darkenedby(gradient(bordcolor, asciicol1, -sl, z, sl*4), darken), 1);
poly_outline = asciiborder << 8;
queuestrn(mscale(V, cgi.SLEV[sl]), 1, s, darkenedby(asciicol, darken), 2);
}
// else if(c->wall == waChasm) {
// const int layers = 1 << detaillevel;
// queuestr(mscale(V, BOTTOM), zgrad0(0, -vid.lake_bottom, z, layers)), 1, s, darkenedby(gradient(asciicol, 0, 0, z, layers+1), darken), z==0?2:1);
// }
else if(chasmgraph(c)) {
string s1 = s0+asciichar1;
poly_outline = bordcolor << 8;
queuestrn(mscale(V, cgi.BOTTOM), 1, s1, darkenedby(gradient(bordcolor, asciicol1, 0, 0.3, 1), darken), 2);
poly_outline = asciiborder << 8;
queuestrn(V, 1, s, darkenedby(asciicol, darken), 2);
}
else
queuestrn(V, 1, s, darkenedby(asciicol, darken), 2);
}
draw_grid();

View File

@ -2228,6 +2228,39 @@ EX void queuestr(const transmatrix& V, double size, const string& chr, color_t c
queuestr(xc, yc, sc, scale_in_pixels(V) * size, chr, col, frame, align);
}
EX void queuestrn(const transmatrix& V, double size, const string& chr, color_t col, int frame IS(0), int align IS(8)) {
switch(neon_mode) {
case 0:
queuestr(V, size, chr, col, frame, align);
break;
case 1: {
dynamicval<color_t> c(poly_outline, col << 8);
queuestr(V, size, chr, 0, frame, align);
break;
}
case 2: {
queuestr(V, size, chr, col, 0, align);
break;
}
case 3: {
dynamicval<color_t> c(poly_outline, (col << 8) | 0xFF);
queuestr(V, size, chr, (col & 0xFEFEFE) >> 1, frame, align);
break;
}
case 4: {
dynamicval<color_t> c(poly_outline, poly_outline);
if(poly_outline > 0xFF) {
col = magentize(col << 8) >> 8;
poly_outline = 0xFF;
}
else {
col = monochromatize(col << 8) >> 8;
}
queuestr(V, size, chr, col, frame, align);
}
}
}
EX void queuecircle(const transmatrix& V, double size, color_t col) {
int xc, yc, sc;
if(!getcoord0_checked(tC0(V), xc, yc, sc)) return;

View File

@ -339,7 +339,7 @@ EX int chasmgraph(cell *c) {
}
EX bool conegraph(cell *c) {
return wmescher && wmspatial && (conegraphtype(c) || (c->wall == waBarrier && c->land == laOceanWall));
return ((wmescher && wmspatial) || wmascii3) && (conegraphtype(c) || (c->wall == waBarrier && c->land == laOceanWall));
}
EX bool hornStuns(cell *c) {

View File

@ -19,7 +19,7 @@ EX bool wallopt;
EX bool in_wallopt() { return wallopt || racing::on; }
EX bool spatial_graphics;
EX bool wmspatial, wmescher, wmplain, wmblack, wmascii;
EX bool wmspatial, wmescher, wmplain, wmblack, wmascii, wmascii3;
EX bool mmspatial, mmhigh, mmmon, mmitem;
EX int detaillevel = 0;
@ -2290,7 +2290,7 @@ EX int cellcolor(cell *c) {
if(c->wall == waMirror) return c->land == laMirror ? OUTLINE_TREASURE : OUTLINE_ORB;
if(c->item) {
if(c->item && !itemHiddenFromSight(c)) {
int k = itemclass(c->item);
if(k == IC_TREASURE)
return OUTLINE_TREASURE;
@ -4431,7 +4431,8 @@ EX void drawthemap() {
wmspatial = vid.wallmode == 4 || vid.wallmode == 5;
wmescher = vid.wallmode == 3 || vid.wallmode == 5;
wmplain = vid.wallmode == 2 || vid.wallmode == 4;
wmascii = vid.wallmode == 0;
wmascii = vid.wallmode == 0 || vid.wallmode == 6;
wmascii3 = vid.wallmode == 6;
wmblack = vid.wallmode == 1;
mmitem = vid.monmode >= 1;

View File

@ -345,7 +345,7 @@ EX void showGraphQuickKeys() {
dialog::addBoolItem(XLAT("third person perspective"), vid.yshift > 0 && vid.sspeed > -5, '3');
}
const char *wdmodes[6] = {"ASCII", "black", "plain", "Escher", "plain/3D", "Escher/3D"};
const char *wdmodes[7] = {"ASCII", "black", "plain", "Escher", "plain/3D", "Escher/3D", "ASCII/3D"};
dialog::addSelItem(XLAT("wall display mode"), XLAT(wdmodes[vid.wallmode]), '5');
const char *mdmodes[6] = {"ASCII", "items only", "items and monsters", "high contrast",