mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
type color_t should now be consistently used for colors; reimplemented drawqueue in OO fashion
This commit is contained in:
parent
491183c375
commit
1ab460ffb1
@ -65,24 +65,16 @@ TTF_Font *font[256];
|
||||
#if CAP_SDL
|
||||
SDL_Surface *s, *s_screen;
|
||||
|
||||
int qpixel_pixel_outside;
|
||||
color_t qpixel_pixel_outside;
|
||||
|
||||
int& qpixel(SDL_Surface *surf, int x, int y) {
|
||||
color_t& qpixel(SDL_Surface *surf, int x, int y) {
|
||||
if(x<0 || y<0 || x >= surf->w || y >= surf->h) return qpixel_pixel_outside;
|
||||
char *p = (char*) surf->pixels;
|
||||
p += y * surf->pitch;
|
||||
int *pi = (int*) (p);
|
||||
color_t *pi = (color_t*) (p);
|
||||
return pi[x];
|
||||
}
|
||||
|
||||
int qpixel3(SDL_Surface *surf, int x, int y) {
|
||||
if(x<0 || y<0 || x >= surf->w || y >= surf->h) return qpixel_pixel_outside;
|
||||
char *p = (char*) surf->pixels;
|
||||
p += y * surf->pitch;
|
||||
p += x;
|
||||
int *pi = (int*) (p);
|
||||
return pi[0];
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CAP_SDLTTF
|
||||
@ -266,7 +258,7 @@ bool model_needs_depth() {
|
||||
return pmodel == mdBall || pmodel == mdHyperboloid || pmodel == mdHemisphere;
|
||||
}
|
||||
|
||||
void setGLProjection(int col) {
|
||||
void setGLProjection(color_t col) {
|
||||
DEBB(DF_GRAPH, (debugfile,"setGLProjection\n"));
|
||||
GLERR("pre_setGLProjection");
|
||||
|
||||
@ -499,7 +491,7 @@ namespace glhr { void texture_vertices(GLfloat *f, int qty, int stride = 2) {
|
||||
GLfloat otver[24];
|
||||
vector<glhr::textured_vertex> tver(4);
|
||||
|
||||
bool gl_print(int x, int y, int shift, int size, const char *s, int color, int align) {
|
||||
bool gl_print(int x, int y, int shift, int size, const char *s, color_t color, int align) {
|
||||
int gsiz = size;
|
||||
if(size > vid.fsize || size > 72) gsiz = 72;
|
||||
|
||||
@ -594,7 +586,7 @@ void gdpush(int t) {
|
||||
graphdata.push_back(t);
|
||||
}
|
||||
|
||||
bool displaychr(int x, int y, int shift, int size, char chr, int col) {
|
||||
bool displaychr(int x, int y, int shift, int size, char chr, color_t col) {
|
||||
gdpush(2); gdpush(x); gdpush(y); gdpush(8);
|
||||
gdpush(col); gdpush(size); gdpush(0);
|
||||
gdpush(1); gdpush(chr);
|
||||
@ -621,7 +613,7 @@ void gdpush_utf8(const string& s) {
|
||||
graphdata[g] = q;
|
||||
}
|
||||
|
||||
bool displayfr(int x, int y, int b, int size, const string &s, int color, int align) {
|
||||
bool displayfr(int x, int y, int b, int size, const string &s, color_t color, int align) {
|
||||
gdpush(2); gdpush(x); gdpush(y); gdpush(align);
|
||||
gdpush(color); gdpush(size); gdpush(b);
|
||||
gdpush_utf8(s);
|
||||
@ -633,16 +625,16 @@ bool displayfr(int x, int y, int b, int size, const string &s, int color, int al
|
||||
my >= -size*3/4 && my <= +size*3/4;
|
||||
}
|
||||
|
||||
bool displaystr(int x, int y, int shift, int size, const string &s, int color, int align) {
|
||||
bool displaystr(int x, int y, int shift, int size, const string &s, color_t color, int align) {
|
||||
return displayfr(x,y,0,size,s,color,align);
|
||||
}
|
||||
|
||||
bool displaystr(int x, int y, int shift, int size, char const *s, int color, int align) {
|
||||
bool displaystr(int x, int y, int shift, int size, char const *s, color_t color, int align) {
|
||||
return displayfr(x,y,0,size,s,color,align);
|
||||
}
|
||||
|
||||
#else
|
||||
bool displaystr(int x, int y, int shift, int size, const char *str, int color, int align) {
|
||||
bool displaystr(int x, int y, int shift, int size, const char *str, color_t color, int align) {
|
||||
|
||||
if(strlen(str) == 0) return false;
|
||||
|
||||
@ -687,7 +679,7 @@ bool displaystr(int x, int y, int shift, int size, const char *str, int color, i
|
||||
SDL_Surface* txt2 = SDL_DisplayFormat(txt);
|
||||
SDL_LockSurface(txt2);
|
||||
SDL_LockSurface(s);
|
||||
int c0 = qpixel(txt2, 0, 0);
|
||||
color_t c0 = qpixel(txt2, 0, 0);
|
||||
for(int yy=0; yy<rect.h; yy++)
|
||||
for(int xx=0; xx<rect.w; xx++) if(qpixel(txt2, xx, yy) != c0)
|
||||
qpixel(s, rect.x+xx-shift, rect.y+yy) |= color & 0xFF0000,
|
||||
@ -705,11 +697,11 @@ bool displaystr(int x, int y, int shift, int size, const char *str, int color, i
|
||||
#endif
|
||||
}
|
||||
|
||||
bool displaystr(int x, int y, int shift, int size, const string &s, int color, int align) {
|
||||
bool displaystr(int x, int y, int shift, int size, const string &s, color_t color, int align) {
|
||||
return displaystr(x, y, shift, size, s.c_str(), color, align);
|
||||
}
|
||||
|
||||
bool displayfrSP(int x, int y, int sh, int b, int size, const string &s, int color, int align, int p) {
|
||||
bool displayfrSP(int x, int y, int sh, int b, int size, const string &s, color_t color, int align, int p) {
|
||||
if(b) {
|
||||
displaystr(x-b, y, 0, size, s, p, align);
|
||||
displaystr(x+b, y, 0, size, s, p, align);
|
||||
@ -726,11 +718,11 @@ bool displayfrSP(int x, int y, int sh, int b, int size, const string &s, int col
|
||||
return displaystr(x, y, 0, size, s, color, align);
|
||||
}
|
||||
|
||||
bool displayfr(int x, int y, int b, int size, const string &s, int color, int align) {
|
||||
bool displayfr(int x, int y, int b, int size, const string &s, color_t color, int align) {
|
||||
return displayfrSP(x, y, 0, b, size, s, color, align, poly_outline>>8);
|
||||
}
|
||||
|
||||
bool displaychr(int x, int y, int shift, int size, char chr, int col) {
|
||||
bool displaychr(int x, int y, int shift, int size, char chr, color_t col) {
|
||||
|
||||
char buf[2];
|
||||
buf[0] = chr; buf[1] = 0;
|
||||
@ -738,7 +730,7 @@ bool displaychr(int x, int y, int shift, int size, char chr, int col) {
|
||||
}
|
||||
#endif
|
||||
|
||||
bool displaynum(int x, int y, int shift, int size, int col, int val, string title) {
|
||||
bool displaynum(int x, int y, int shift, int size, color_t col, int val, string title) {
|
||||
char buf[64];
|
||||
sprintf(buf, "%d", val);
|
||||
bool b1 = displayfr(x-8, y, 1, size, buf, col, 16);
|
||||
@ -803,7 +795,7 @@ void addMessage(string s, char spamtype) {
|
||||
addMessageToLog(m, msgs);
|
||||
}
|
||||
|
||||
int colormix(int a, int b, int c) {
|
||||
color_t colormix(color_t a, color_t b, color_t c) {
|
||||
for(int p=0; p<3; p++)
|
||||
part(a, p) = part(a,p) + (part(b,p) - part(a,p)) * part(c,p) / 255;
|
||||
return a;
|
||||
@ -825,7 +817,7 @@ ld realradius() {
|
||||
return vradius;
|
||||
}
|
||||
|
||||
void drawmessage(const string& s, int& y, int col) {
|
||||
void drawmessage(const string& s, int& y, color_t col) {
|
||||
int rrad = (int) realradius();
|
||||
int space;
|
||||
if(y > vid.ycenter + rrad * vid.stretch)
|
||||
@ -879,7 +871,7 @@ void drawmessages() {
|
||||
for(int j=isize(msgs)-1; j>=0; j--) {
|
||||
int age = msgs[j].flashout * (t - msgs[j].stamp);
|
||||
poly_outline = gradient(bordcolor, backcolor, 0, age, 256*vid.flashtime) << 8;
|
||||
int col = gradient(forecolor, backcolor, 0, age, 256*vid.flashtime);
|
||||
color_t col = gradient(forecolor, backcolor, 0, age, 256*vid.flashtime);
|
||||
drawmessage(fullmsg(msgs[j]), y, col);
|
||||
}
|
||||
}
|
||||
@ -894,19 +886,18 @@ void drawmessages() {
|
||||
}
|
||||
}
|
||||
|
||||
int gradient(int c0, int c1, ld v0, ld v, ld v1) {
|
||||
color_t gradient(color_t c0, color_t c1, ld v0, ld v, ld v1) {
|
||||
int vv = int(256 * ((v-v0) / (v1-v0)));
|
||||
int c = 0;
|
||||
color_t c = 0;
|
||||
for(int a=0; a<3; a++) {
|
||||
int p0 = (c0 >> (8*a)) & 255;
|
||||
int p1 = (c1 >> (8*a)) & 255;
|
||||
int p = (p0*(256-vv) + p1*vv + 127) >> 8;
|
||||
c |= p << (8*a);
|
||||
int p0 = part(c0, a);
|
||||
int p1 = part(c1, a);
|
||||
part(c, a) = (p0*(256-vv) + p1*vv + 127) >> 8;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
void drawCircle(int x, int y, int size, int color) {
|
||||
void drawCircle(int x, int y, int size, color_t color) {
|
||||
if(size < 0) size = -size;
|
||||
#if CAP_GL
|
||||
if(vid.usingGL) {
|
||||
@ -961,7 +952,7 @@ void displaymm(char c, int x, int y, int rad, int size, const string& title, int
|
||||
}
|
||||
}
|
||||
|
||||
bool displayButtonS(int x, int y, const string& name, int col, int align, int size) {
|
||||
bool displayButtonS(int x, int y, const string& name, color_t col, int align, int size) {
|
||||
if(displaystr(x, y, 0, size, name, col, align)) {
|
||||
displaystr(x, y, 0, size, name, 0xFFFF00, align);
|
||||
return true;
|
||||
@ -969,7 +960,7 @@ bool displayButtonS(int x, int y, const string& name, int col, int align, int si
|
||||
else return false;
|
||||
}
|
||||
|
||||
void displayColorButton(int x, int y, const string& name, int key, int align, int rad, int color, int color2) {
|
||||
void displayColorButton(int x, int y, const string& name, int key, int align, int rad, color_t color, color_t color2) {
|
||||
if(displayfr(x, y, rad, vid.fsize, name, color, align)) {
|
||||
if(color2) displayfr(x, y, rad, vid.fsize, name, color2, align);
|
||||
getcstat = key;
|
||||
|
@ -135,7 +135,7 @@ void drawBlizzards() {
|
||||
} */
|
||||
|
||||
forCellIdEx(c2, i, bc.c) if(bc.c == mouseover || c2 == mouseover) {
|
||||
int col = 0x00C00080;
|
||||
color_t col = 0x00C00080;
|
||||
if(c2 == mouseover)
|
||||
col ^= 0xC0C00000;
|
||||
if(isPlayerOn(c2))
|
||||
|
10
classes.h
10
classes.h
@ -1,10 +1,12 @@
|
||||
namespace hr {
|
||||
|
||||
typedef unsigned color_t;
|
||||
|
||||
static const int motypes = 162;
|
||||
|
||||
struct monstertype {
|
||||
char glyph;
|
||||
int color;
|
||||
color_t color;
|
||||
const char *name;
|
||||
const char *help;
|
||||
};
|
||||
@ -77,7 +79,7 @@ static const int ittypes = 130;
|
||||
|
||||
struct itemtype {
|
||||
char glyph;
|
||||
int color;
|
||||
color_t color;
|
||||
const char *name;
|
||||
const char *help;
|
||||
};
|
||||
@ -126,7 +128,7 @@ static const int walltypes = 109;
|
||||
|
||||
struct walltype {
|
||||
char glyph;
|
||||
int color;
|
||||
color_t color;
|
||||
const char *name;
|
||||
const char *help;
|
||||
};
|
||||
@ -169,7 +171,7 @@ enum eWall { waNone, waIcewall, waBarrier, waFloorA, waFloorB, waCavewall, waCav
|
||||
static const int landtypes = 85;
|
||||
|
||||
struct landtype {
|
||||
int color;
|
||||
color_t color;
|
||||
const char *name;
|
||||
const char *help;
|
||||
};
|
||||
|
@ -130,7 +130,7 @@ namespace spiral {
|
||||
|
||||
bool displayhelp = true;
|
||||
|
||||
int& bandpixel(int x, int y) {
|
||||
color_t& bandpixel(int x, int y) {
|
||||
int i = 0;
|
||||
while(i < isize(band) && x >= band[i]->w)
|
||||
x -= band[i]->w, i++;
|
||||
|
20
dialogs.cpp
20
dialogs.cpp
@ -48,11 +48,11 @@ namespace dialog {
|
||||
|
||||
void stopzoom() { zoomoff = true; }
|
||||
|
||||
bool displayfr(int x, int y, int b, int size, const string &s, int color, int align) {
|
||||
bool displayfr(int x, int y, int b, int size, const string &s, color_t color, int align) {
|
||||
return hr::displayfr(x * zoomf + shiftx, y * zoomf + shifty, b, size * zoomf, s, color, align);
|
||||
}
|
||||
|
||||
bool displayfr_highlight(int x, int y, int b, int size, const string &s, int color, int align, int hicolor) {
|
||||
bool displayfr_highlight(int x, int y, int b, int size, const string &s, color_t color, int align, int hicolor) {
|
||||
bool clicked = hr::displayfr(x * zoomf + shiftx, y * zoomf + shifty, b, size * zoomf, s, color, align);
|
||||
if(clicked) hr::displayfr(x * zoomf + shiftx, y * zoomf + shifty, b, size * zoomf, s, hicolor, align);
|
||||
return clicked;
|
||||
@ -174,7 +174,7 @@ namespace dialog {
|
||||
items.push_back(it);
|
||||
}
|
||||
|
||||
void addInfo(string body, int color) {
|
||||
void addInfo(string body, color_t color) {
|
||||
item it;
|
||||
it.type = diInfo;
|
||||
it.body = body;
|
||||
@ -218,7 +218,7 @@ namespace dialog {
|
||||
return items.size()-1;
|
||||
}
|
||||
|
||||
void addTitle(string body, int color, int scale) {
|
||||
void addTitle(string body, color_t color, int scale) {
|
||||
item it;
|
||||
it.type = diTitle;
|
||||
it.body = body;
|
||||
@ -227,7 +227,7 @@ namespace dialog {
|
||||
items.push_back(it);
|
||||
}
|
||||
|
||||
void init(string title, int color, int scale, int brk) {
|
||||
void init(string title, color_t color, int scale, int brk) {
|
||||
init();
|
||||
addTitle(title, color, scale);
|
||||
addBreak(brk);
|
||||
@ -456,17 +456,17 @@ namespace dialog {
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int colorhistory[10] = {
|
||||
color_t colorhistory[10] = {
|
||||
0x202020FF, 0x800000FF, 0x008000FF, 0x000080FF,
|
||||
0x404040FF, 0xC0C0C0FF, 0x804000FF, 0xC0C000FF,
|
||||
0x408040FF, 0xFFD500FF
|
||||
}, lch;
|
||||
|
||||
unsigned int *palette;
|
||||
color_t *palette;
|
||||
|
||||
int colorp = 0;
|
||||
|
||||
unsigned int *colorPointer;
|
||||
color_t *colorPointer;
|
||||
|
||||
bool handleKeyColor(int sym, int uni) {
|
||||
unsigned& color = *colorPointer;
|
||||
@ -524,7 +524,7 @@ namespace dialog {
|
||||
dcenter = vid.xres - dwidth / 2;
|
||||
}
|
||||
|
||||
int color = *colorPointer;
|
||||
color_t color = *colorPointer;
|
||||
|
||||
int ash = 8;
|
||||
|
||||
@ -554,7 +554,7 @@ namespace dialog {
|
||||
for(int i=0; i<4; i++) {
|
||||
int y = vid.yres / 2 + (2-i) * vid.fsize * 2;
|
||||
|
||||
int col = ((i==colorp) && !mousing) ? 0xFFD500 : forecolor;
|
||||
color_t col = ((i==colorp) && !mousing) ? 0xFFD500 : forecolor;
|
||||
|
||||
displayColorButton(dcenter - dwidth/4, y, "(", 0, 16, 0, col);
|
||||
string rgt = ") "; rgt += "ABGR" [i];
|
||||
|
@ -608,7 +608,7 @@ void set_floor(const transmatrix& spin, hpcshape& sh) {
|
||||
qfi.usershape = -1;
|
||||
}
|
||||
|
||||
void draw_shapevec(cell *c, const transmatrix& V, const vector<hpcshape> &shv, int col, PPR prio = PPR::DEFAULT) {
|
||||
void draw_shapevec(cell *c, const transmatrix& V, const vector<hpcshape> &shv, color_t col, PPR prio = PPR::DEFAULT) {
|
||||
if(!c) queuepolyat(V, shv[0], col, prio);
|
||||
else if(GOLDBERG) {
|
||||
int id = gp::get_plainshape_id(c);
|
||||
@ -640,11 +640,11 @@ void draw_shapevec(cell *c, const transmatrix& V, const vector<hpcshape> &shv, i
|
||||
queuepolyat(V, shv[ctof(c)], col, prio);
|
||||
}
|
||||
|
||||
void draw_floorshape(cell *c, const transmatrix& V, const floorshape &fsh, int col, PPR prio = PPR::DEFAULT) {
|
||||
void draw_floorshape(cell *c, const transmatrix& V, const floorshape &fsh, color_t col, PPR prio = PPR::DEFAULT) {
|
||||
draw_shapevec(c, V, fsh.b, col, prio);
|
||||
}
|
||||
|
||||
void draw_qfi(cell *c, const transmatrix& V, int col, PPR prio = PPR::DEFAULT, vector<hpcshape> floorshape::* tab = &floorshape::b) {
|
||||
void draw_qfi(cell *c, const transmatrix& V, color_t col, PPR prio = PPR::DEFAULT, vector<hpcshape> floorshape::* tab = &floorshape::b) {
|
||||
if(qfi.shape)
|
||||
queuepolyat(V * qfi.spin, *qfi.shape, col, prio);
|
||||
else if(qfi.usershape >= 0) {
|
||||
@ -653,10 +653,9 @@ void draw_qfi(cell *c, const transmatrix& V, int col, PPR prio = PPR::DEFAULT, v
|
||||
else if(!qfi.fshape) ;
|
||||
#if CAP_TEXTURE
|
||||
else if(qfi.tinf) {
|
||||
queuetable(V * qfi.spin, qfi.tinf->vertices, isize(qfi.tinf->vertices), texture::config.mesh_color, texture::config.recolor(col), prio == PPR::DEFAULT ? PPR::FLOOR : prio);
|
||||
lastptd().u.poly.tinf = qfi.tinf;
|
||||
if(true)
|
||||
lastptd().u.poly.flags = POLY_INVERSE;
|
||||
auto& poly = queuetable(V * qfi.spin, qfi.tinf->vertices, isize(qfi.tinf->vertices), texture::config.mesh_color, texture::config.recolor(col), prio == PPR::DEFAULT ? PPR::FLOOR : prio);
|
||||
poly.tinf = qfi.tinf;
|
||||
poly.flags = POLY_INVERSE;
|
||||
}
|
||||
#endif
|
||||
else draw_shapevec(c, V, (qfi.fshape->*tab), col, prio);
|
||||
|
196
graph.cpp
196
graph.cpp
@ -112,7 +112,7 @@ int weakfirecolor(int phase) {
|
||||
return gradient(0xFF8000, 0xFF0000, -1, sin((phase + ticks)/500.0), 1);
|
||||
}
|
||||
|
||||
int fc(int ph, int col, int z) {
|
||||
color_t fc(int ph, color_t col, int z) {
|
||||
if(items[itOrbFire]) col = darkena(firecolor(ph), 0, 0xFF);
|
||||
if(items[itOrbAether]) col = (col &~0XFF) | (col&0xFF) / 2;
|
||||
for(int i=0; i<numplayers(); i++) if(multi::playerActive(i))
|
||||
@ -132,7 +132,7 @@ void drawSafety() { safetyat = ticks; }
|
||||
void drawShield(const transmatrix& V, eItem it) {
|
||||
#if CAP_CURVE
|
||||
float ds = ticks / 300.;
|
||||
int col = iinf[it].color;
|
||||
color_t col = iinf[it].color;
|
||||
if(it == itOrbShield && items[itOrbTime] && !orbused[it])
|
||||
col = (col & 0xFEFEFE) / 2;
|
||||
if(sphere && cwt.at->land == laHalloween && !wmblack && !wmascii)
|
||||
@ -148,7 +148,7 @@ void drawShield(const transmatrix& V, eItem it) {
|
||||
void drawSpeed(const transmatrix& V) {
|
||||
#if CAP_CURVE
|
||||
ld ds = ticks / 10.;
|
||||
int col = darkena(iinf[itOrbSpeed].color, 0, 0xFF);
|
||||
color_t col = darkena(iinf[itOrbSpeed].color, 0, 0xFF);
|
||||
for(int b=0; b<S84; b+=S14) {
|
||||
PRING(a)
|
||||
curvepoint(V*xspinpush0((ds+b+a) * M_PI/S42, hexf*a/S84));
|
||||
@ -174,7 +174,7 @@ int ctof012(cell *c) {
|
||||
void drawSafety(const transmatrix& V, int ct) {
|
||||
#if CAP_QUEUE
|
||||
ld ds = ticks / 50.;
|
||||
int col = darkena(iinf[itOrbSafety].color, 0, 0xFF);
|
||||
color_t col = darkena(iinf[itOrbSafety].color, 0, 0xFF);
|
||||
for(int a=0; a<ct; a++)
|
||||
queueline(V*xspinpush0((ds+a*S84/ct) * M_PI/S42, 2*hexf), V*xspinpush0((ds+(a+(ct-1)/2)*S84/ct) * M_PI / S42, 2*hexf), col, vid.linequality);
|
||||
#endif
|
||||
@ -183,7 +183,7 @@ void drawSafety(const transmatrix& V, int ct) {
|
||||
void drawFlash(const transmatrix& V) {
|
||||
#if CAP_CURVE
|
||||
float ds = ticks / 300.;
|
||||
int col = darkena(iinf[itOrbFlash].color, 0, 0xFF);
|
||||
color_t col = darkena(iinf[itOrbFlash].color, 0, 0xFF);
|
||||
col &= ~1;
|
||||
for(int u=0; u<5; u++) {
|
||||
ld rad = hexf * (2.5 + .5 * sin(ds+u*.3));
|
||||
@ -196,7 +196,7 @@ void drawFlash(const transmatrix& V) {
|
||||
void drawLove(const transmatrix& V, int hdir) {
|
||||
#if CAP_CURVE
|
||||
float ds = ticks / 300.;
|
||||
int col = darkena(iinf[itOrbLove].color, 0, 0xFF);
|
||||
color_t col = darkena(iinf[itOrbLove].color, 0, 0xFF);
|
||||
col &= ~1;
|
||||
for(int u=0; u<5; u++) {
|
||||
PRING(a) {
|
||||
@ -215,7 +215,7 @@ void drawLove(const transmatrix& V, int hdir) {
|
||||
void drawWinter(const transmatrix& V, ld hdir) {
|
||||
#if CAP_QUEUE
|
||||
float ds = ticks / 300.;
|
||||
int col = darkena(iinf[itOrbWinter].color, 0, 0xFF);
|
||||
color_t col = darkena(iinf[itOrbWinter].color, 0, 0xFF);
|
||||
for(int u=0; u<20; u++) {
|
||||
ld rad = sin(ds+u * 2 * M_PI / 20) * M_PI / S7;
|
||||
queueline(V*xspinpush0(M_PI+hdir+rad, hexf*.5), V*xspinpush0(M_PI+hdir+rad, hexf*3), col, 2 + vid.linequality);
|
||||
@ -225,7 +225,7 @@ void drawWinter(const transmatrix& V, ld hdir) {
|
||||
|
||||
void drawLightning(const transmatrix& V) {
|
||||
#if CAP_QUEUE
|
||||
int col = darkena(iinf[itOrbLightning].color, 0, 0xFF);
|
||||
color_t col = darkena(iinf[itOrbLightning].color, 0, 0xFF);
|
||||
for(int u=0; u<20; u++) {
|
||||
ld leng = 0.5 / (0.1 + (rand() % 100) / 100.0);
|
||||
ld rad = rand() % 1000;
|
||||
@ -316,7 +316,7 @@ void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) {
|
||||
if(PURE && a%3 != ang%3) continue;
|
||||
if((a+S21)%S42 == ang && items[itOrbSword2]) continue;
|
||||
bool longer = sword::pos(cwt.at, a-1) != sword::pos(cwt.at, a+1);
|
||||
int col = darkena(0xC0C0C0, 0, 0xFF);
|
||||
color_t col = darkena(0xC0C0C0, 0, 0xFF);
|
||||
queueline(Vnow*xspinpush0(dda * M_PI / S42, PURE ? 0.6 * scalefactor : longer ? 0.36 : 0.4), Vnow*xspinpush0(dda * M_PI/S42, PURE ? 0.7 * scalefactor : longer ? 0.44 : 0.42), col, 1);
|
||||
}
|
||||
#endif
|
||||
@ -347,7 +347,7 @@ void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) {
|
||||
for(int u=tim; u<=2500; u++) {
|
||||
if((u-tim)%250) continue;
|
||||
ld rad = hexf * u / 250;
|
||||
int col = darkena(iinf[itOrbSafety].color, 0, 0xFF);
|
||||
color_t col = darkena(iinf[itOrbSafety].color, 0, 0xFF);
|
||||
PRING(a)
|
||||
curvepoint(V*xspinpush0(a * M_PI / S42, rad));
|
||||
queuecurve(col, 0, PPR::LINE);
|
||||
@ -370,10 +370,10 @@ namespace tortoise {
|
||||
void draw(const transmatrix& V, int bits, int small, int stuntime) {
|
||||
|
||||
#if CAP_POLY
|
||||
int eyecolor = getBit(bits, tfEyeHue) ? 0xFF0000 : 0xC0C0C0;
|
||||
int shellcolor = getBit(bits, tfShellHue) ? 0x00C040 : 0xA06000;
|
||||
int scutecolor = getBit(bits, tfScuteHue) ? 0x00C040 : 0xA06000;
|
||||
int skincolor = getBit(bits, tfSkinHue) ? 0x00C040 : 0xA06000;
|
||||
color_t eyecolor = getBit(bits, tfEyeHue) ? 0xFF0000 : 0xC0C0C0;
|
||||
color_t shellcolor = getBit(bits, tfShellHue) ? 0x00C040 : 0xA06000;
|
||||
color_t scutecolor = getBit(bits, tfScuteHue) ? 0x00C040 : 0xA06000;
|
||||
color_t skincolor = getBit(bits, tfSkinHue) ? 0x00C040 : 0xA06000;
|
||||
if(getBit(bits, tfShellSat)) shellcolor = gradient(shellcolor, 0xB0B0B0, 0, .5, 1);
|
||||
if(getBit(bits, tfScuteSat)) scutecolor = gradient(scutecolor, 0xB0B0B0, 0, .5, 1);
|
||||
if(getBit(bits, tfSkinSat)) skincolor = gradient(skincolor, 0xB0B0B0, 0, .5, 1);
|
||||
@ -381,7 +381,7 @@ namespace tortoise {
|
||||
if(getBit(bits, tfSkinDark)) skincolor = gradient(skincolor, 0, 0, .5, 1);
|
||||
|
||||
for(int i=0; i<12; i++) {
|
||||
int col =
|
||||
color_t col =
|
||||
i == 0 ? shellcolor:
|
||||
i < 8 ? scutecolor :
|
||||
skincolor;
|
||||
@ -430,7 +430,7 @@ double footfun(double d) {
|
||||
|
||||
bool ivoryz;
|
||||
|
||||
void animallegs(const transmatrix& V, eMonster mo, int col, double footphase) {
|
||||
void animallegs(const transmatrix& V, eMonster mo, color_t col, double footphase) {
|
||||
#if CAP_POLY
|
||||
footphase /= SCALE;
|
||||
|
||||
@ -479,14 +479,14 @@ void ShadowV(const transmatrix& V, const hpcshape& bp, PPR prio) {
|
||||
if(mmspatial) {
|
||||
if(pmodel == mdHyperboloid || pmodel == mdBall || pmodel == mdHemisphere || noshadow)
|
||||
return; // shadows break the depth testing
|
||||
dynamicval<int> p(poly_outline, OUTLINE_TRANS);
|
||||
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
||||
queuepolyat(V, bp, SHADOW_MON, prio);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void otherbodyparts(const transmatrix& V, int col, eMonster who, double footphase) {
|
||||
void otherbodyparts(const transmatrix& V, color_t col, eMonster who, double footphase) {
|
||||
|
||||
#if CAP_POLY
|
||||
|
||||
@ -732,7 +732,7 @@ bool drawItemType(eItem it, cell *c, const transmatrix& V, int icol, int ticks,
|
||||
if(it == itOrbUndeath) icol = minf[moFriendlyGhost].color;
|
||||
if(it == itOrbRecall) icol = 0x101010;
|
||||
if(it == itOrbSlaying) icol = 0xFF0000;
|
||||
int col = darkena(icol, 0, int(0x80 + 0x70 * sin(ticks / 300.)));
|
||||
color_t col = darkena(icol, 0, int(0x80 + 0x70 * sin(ticks / 300.)));
|
||||
|
||||
if(it == itOrbFish)
|
||||
queuepolyat(V * spin(ticks / 1500.), shFishTail, col, PPR::ITEM_BELOW);
|
||||
@ -759,7 +759,7 @@ bool drawItemType(eItem it, cell *c, const transmatrix& V, int icol, int ticks,
|
||||
void drawTerraWarrior(const transmatrix& V, int t, int hp, double footphase) {
|
||||
#if CAP_POLY
|
||||
ShadowV(V, shPBody);
|
||||
int col = linf[laTerracotta].color;
|
||||
color_t col = linf[laTerracotta].color;
|
||||
int bcol = darkena(false ? 0xC0B23E : col, 0, 0xFF);
|
||||
otherbodyparts(V, bcol, moDesertman, footphase);
|
||||
queuepoly(VBODY, shPBody, bcol);
|
||||
@ -772,7 +772,7 @@ void drawTerraWarrior(const transmatrix& V, int t, int hp, double footphase) {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, int col, double footphase) {
|
||||
bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, color_t col, double footphase) {
|
||||
|
||||
char xch = minf[m].glyph;
|
||||
|
||||
@ -806,7 +806,7 @@ bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, int col, dou
|
||||
queuepoly(VABODY, shWolfBody, fc(0, cs.skincolor, 0));
|
||||
queuepoly(VAHEAD, shFamiliarHead, fc(500, cs.haircolor, 2));
|
||||
if(!shmup::on || shmup::curtime >= shmup::getPlayer()->nextshot) {
|
||||
int col = items[itOrbDiscord] ? watercolor(0) : fc(314, cs.swordcolor, 3);
|
||||
color_t col = items[itOrbDiscord] ? watercolor(0) : fc(314, cs.swordcolor, 3);
|
||||
queuepoly(VAHEAD, shFamiliarEye, col);
|
||||
queuepoly(VAHEAD * Mirror, shFamiliarEye, col);
|
||||
}
|
||||
@ -822,12 +822,12 @@ bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, int col, dou
|
||||
queuepoly(VAHEAD, shDogHead, fc(150, cs.haircolor, 2));
|
||||
|
||||
if(!shmup::on || shmup::curtime >= shmup::getPlayer()->nextshot) {
|
||||
int col = items[itOrbDiscord] ? watercolor(0) : fc(314, cs.swordcolor, 3);
|
||||
color_t col = items[itOrbDiscord] ? watercolor(0) : fc(314, cs.swordcolor, 3);
|
||||
queuepoly(VAHEAD, shWolf1, col);
|
||||
queuepoly(VAHEAD, shWolf2, col);
|
||||
}
|
||||
|
||||
int colnose = items[itOrbDiscord] ? watercolor(0) : fc(314, 0xFF, 3);
|
||||
color_t colnose = items[itOrbDiscord] ? watercolor(0) : fc(314, 0xFF, 3);
|
||||
queuepoly(VAHEAD, shWolf3, colnose);
|
||||
}
|
||||
else if(cs.charid >= 4) {
|
||||
@ -840,7 +840,7 @@ bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, int col, dou
|
||||
queuepoly(VABODY, shCatBody, fc(0, cs.skincolor, 0));
|
||||
queuepoly(VAHEAD, shCatHead, fc(150, cs.haircolor, 2));
|
||||
if(!shmup::on || shmup::curtime >= shmup::getPlayer()->nextshot) {
|
||||
int col = items[itOrbDiscord] ? watercolor(0) : fc(314, cs.swordcolor, 3);
|
||||
color_t col = items[itOrbDiscord] ? watercolor(0) : fc(314, cs.swordcolor, 3);
|
||||
queuepoly(VAHEAD * xpush(.04), shWolf1, col);
|
||||
queuepoly(VAHEAD * xpush(.04), shWolf2, col);
|
||||
}
|
||||
@ -1009,7 +1009,7 @@ bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, int col, dou
|
||||
queuepoly(VBODY, shPBody, darkena(0xC0C0A0, 0, 0xC0));
|
||||
queuepoly(VBODY, shPSword, darkena(0xFFFF00, 0, 0xFF));
|
||||
queuepoly(VBODY, shKnightArmor, darkena(0xD0D0D0, 1, 0xFF));
|
||||
int col;
|
||||
color_t col;
|
||||
if(!eubinary && where && where->master->alt)
|
||||
col = cloakcolor(roundTableRadius(where));
|
||||
else
|
||||
@ -1163,7 +1163,7 @@ bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, int col, dou
|
||||
queuepoly(VAHEAD, shDogHead, darkena(col, 0, 0xFF));
|
||||
|
||||
{
|
||||
dynamicval<int> dp(poly_outline);
|
||||
dynamicval<color_t> dp(poly_outline);
|
||||
int eyecolor = 0x202020;
|
||||
bool redeyes = false;
|
||||
if(m == moHunterDog) eyecolor = 0xFF0000, redeyes = true;
|
||||
@ -1172,10 +1172,8 @@ bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, int col, dou
|
||||
int eyes = darkena(eyecolor, 0, 0xFF);
|
||||
|
||||
if(redeyes) poly_outline = eyes;
|
||||
queuepoly(VAHEAD, shWolf1, eyes);
|
||||
if(redeyes) lastptd().u.poly.flags |= POLY_FORCEWIDE;
|
||||
queuepoly(VAHEAD, shWolf2, eyes);
|
||||
if(redeyes) lastptd().u.poly.flags |= POLY_FORCEWIDE;
|
||||
queuepoly(VAHEAD, shWolf1, eyes).flags |= POLY_FORCEWIDE;
|
||||
queuepoly(VAHEAD, shWolf2, eyes).flags |= POLY_FORCEWIDE;
|
||||
}
|
||||
queuepoly(VAHEAD, shWolf3, darkena(m == moRunDog ? 0x202020 : 0x000000, 0, 0xFF));
|
||||
}
|
||||
@ -1707,8 +1705,8 @@ bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, int col, dou
|
||||
#endif
|
||||
}
|
||||
|
||||
bool drawMonsterTypeDH(eMonster m, cell *where, const transmatrix& V, int col, bool dh, ld footphase) {
|
||||
dynamicval<int> p(poly_outline, poly_outline);
|
||||
bool drawMonsterTypeDH(eMonster m, cell *where, const transmatrix& V, color_t col, bool dh, ld footphase) {
|
||||
dynamicval<color_t> p(poly_outline, poly_outline);
|
||||
if(dh) {
|
||||
poly_outline = OUTLINE_DEAD;
|
||||
darken++;
|
||||
@ -1838,7 +1836,7 @@ void drawWormSegments() {
|
||||
|
||||
bool dont_face_pc = false;
|
||||
|
||||
bool drawMonster(const transmatrix& Vparam, int ct, cell *c, int col) {
|
||||
bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col) {
|
||||
|
||||
bool darkhistory = conformal::includeHistory && conformal::inkillhistory.count(c);
|
||||
|
||||
@ -1925,7 +1923,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, int col) {
|
||||
ld wav = hexsnake ? 0 :
|
||||
c->monst < moTentacle ? 1/1.5 :
|
||||
1;
|
||||
int col0 = col;
|
||||
color_t col0 = col;
|
||||
if(c->monst == moWorm || c->monst == moWormwait)
|
||||
col0 = minf[moWormtail].color;
|
||||
else if(thead)
|
||||
@ -1945,7 +1943,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, int col) {
|
||||
|
||||
else {
|
||||
int hdir = displayspin(c, c->mondir);
|
||||
int col = darkena(0x606020, 0, 0xFF);
|
||||
color_t col = darkena(0x606020, 0, 0xFF);
|
||||
for(int u=-1; u<=1; u++)
|
||||
queueline(Vparam*xspinpush0(hdir+M_PI/2, u*crossf/5), Vparam*xspinpush(hdir, crossf)*xspinpush0(hdir+M_PI/2, u*crossf/5), col, 2 + vid.linequality);
|
||||
}
|
||||
@ -2222,13 +2220,13 @@ void clearaura() {
|
||||
auramemo = 128 * 128 / vid.aurastr;
|
||||
}
|
||||
|
||||
void addauraspecial(const hyperpoint& h, int col, int dir) {
|
||||
void addauraspecial(const hyperpoint& h, color_t col, int dir) {
|
||||
if(!haveaura()) return;
|
||||
int r = int(2*AURA + dir + atan2(h[0], h[1]) * AURA / 2 / M_PI) % AURA;
|
||||
auraspecials.emplace_back(r, col);
|
||||
}
|
||||
|
||||
void addaura(const hyperpoint& h, int col, int fd) {
|
||||
void addaura(const hyperpoint& h, color_t col, int fd) {
|
||||
if(!haveaura()) return;
|
||||
int r = int(2*AURA + atan2(h[0], h[1]) * AURA / 2 / M_PI) % AURA;
|
||||
aurac[r][3] += auramemo << fd;
|
||||
@ -2304,7 +2302,7 @@ void drawaura() {
|
||||
|
||||
if(rm<0 || rm >= AURA) continue;
|
||||
|
||||
int& p = qpixel(s, x, y);
|
||||
color_t& p = qpixel(s, x, y);
|
||||
for(int c=0; c<3; c++) {
|
||||
double c1 = aurac[rm][2-c] / (aurac[rm][3]+.1);
|
||||
double c2 = aurac[rm+1][2-c] / (aurac[rm+1][3]+.1);
|
||||
@ -2465,7 +2463,7 @@ void set_zebrafloor(cell *c) {
|
||||
|
||||
void set_maywarp_floor(cell *c);
|
||||
|
||||
void set_reptile_floor(cell *c, const transmatrix& V, int col, bool nodetails = false) {
|
||||
void set_reptile_floor(cell *c, const transmatrix& V, color_t col, bool nodetails = false) {
|
||||
|
||||
auto si =
|
||||
euclid6 ?
|
||||
@ -2511,7 +2509,7 @@ void set_reptile_floor(cell *c, const transmatrix& V, int col, bool nodetails =
|
||||
if(ecol == -1 || ecol == 0) dcol = darkena(col, 1, 0xFF);
|
||||
else dcol = darkena(ecol, 0, 0x80);
|
||||
|
||||
dynamicval<int> p(poly_outline,
|
||||
dynamicval<color_t> p(poly_outline,
|
||||
doHighlight() && ecol != -1 && ecol != 0 ? OUTLINE_ENEMY : OUTLINE_DEFAULT);
|
||||
|
||||
if(!chasmg) {
|
||||
@ -2527,7 +2525,7 @@ void set_reptile_floor(cell *c, const transmatrix& V, int col, bool nodetails =
|
||||
}
|
||||
}
|
||||
|
||||
void draw_reptile(cell *c, const transmatrix &V, int col) {
|
||||
void draw_reptile(cell *c, const transmatrix &V, color_t col) {
|
||||
auto qfib = qfi;
|
||||
set_reptile_floor(c, V, col, chasmg == 2);
|
||||
draw_qfi(c, V, col);
|
||||
@ -2591,7 +2589,7 @@ void drawMovementArrows(cell *c, transmatrix V) {
|
||||
if(xc.at == c) {
|
||||
transmatrix fixrot = sphereflip * rgpushxto0(sphereflip * tC0(V));
|
||||
// make it more transparent
|
||||
int col = getcs().uicolor;
|
||||
color_t col = getcs().uicolor;
|
||||
col -= (col & 0xFF) >> 1;
|
||||
poly_outline = OUTLINE_DEFAULT;
|
||||
queuepoly(fixrot * spin(-d * M_PI/4), shArrow, col);
|
||||
@ -2628,7 +2626,7 @@ int reptilecolor(cell *c) {
|
||||
}
|
||||
}
|
||||
|
||||
int fcoltab[4] = {0xe3bb97, 0xc2d1b0, 0xebe5cb, 0xA0A0A0};
|
||||
color_t fcoltab[4] = {0xe3bb97, 0xc2d1b0, 0xebe5cb, 0xA0A0A0};
|
||||
return fcoltab[i];
|
||||
}
|
||||
|
||||
@ -2642,7 +2640,7 @@ ld wavefun(ld x) {
|
||||
|
||||
const unsigned int nestcolors[8] = { 0x800000, 0x008000, 0x000080, 0x404040, 0x700070, 0x007070, 0x707000, 0x606060 };
|
||||
|
||||
void setcolors(cell *c, int& wcol, int &fcol) {
|
||||
void setcolors(cell *c, color_t& wcol, color_t& fcol) {
|
||||
|
||||
wcol = fcol = winf[c->wall].color;
|
||||
|
||||
@ -2833,7 +2831,7 @@ void setcolors(cell *c, int& wcol, int &fcol) {
|
||||
|
||||
case laWhirlwind:
|
||||
if(c->land == laWhirlwind) {
|
||||
int wcol[4] = {0x404040, 0x404080, 0x2050A0, 0x5050C0};
|
||||
color_t wcol[4] = {0x404040, 0x404080, 0x2050A0, 0x5050C0};
|
||||
fcol = wcol[whirlwind::fzebra3(c)];
|
||||
}
|
||||
break;
|
||||
@ -2928,12 +2926,12 @@ void setcolors(cell *c, int& wcol, int &fcol) {
|
||||
float h = HEAT(c);
|
||||
bool showcoc = c->land == laCocytus && chaosmode && !wmescher;
|
||||
|
||||
int colorN04 = showcoc ? 0x4080FF : 0x4040FF;
|
||||
int colorN10 = 0x0000FF;
|
||||
int color0 = c->land == laBlizzard ? 0x5050C0 : showcoc ? 0x80C0FF : 0x8080FF;
|
||||
int color02 = 0xFFFFFF;
|
||||
int color06 = 0xFF0000;
|
||||
int color08 = 0xFFFF00;
|
||||
color_t colorN04 = showcoc ? 0x4080FF : 0x4040FF;
|
||||
color_t colorN10 = 0x0000FF;
|
||||
color_t color0 = c->land == laBlizzard ? 0x5050C0 : showcoc ? 0x80C0FF : 0x8080FF;
|
||||
color_t color02 = 0xFFFFFF;
|
||||
color_t color06 = 0xFF0000;
|
||||
color_t color08 = 0xFFFF00;
|
||||
|
||||
if(h < -1)
|
||||
wcol = colorN10;
|
||||
@ -3133,10 +3131,10 @@ bool use_swapped_duals() {
|
||||
return (masterless && !a4) || GOLDBERG;
|
||||
}
|
||||
|
||||
void floorShadow(cell *c, const transmatrix& V, int col) {
|
||||
void floorShadow(cell *c, const transmatrix& V, color_t col) {
|
||||
if(pmodel == mdHyperboloid || pmodel == mdBall || pmodel == mdHemisphere || noshadow)
|
||||
return; // shadows break the depth testing
|
||||
dynamicval<int> p(poly_outline, OUTLINE_TRANS);
|
||||
dynamicval<color_t> p(poly_outline, OUTLINE_TRANS);
|
||||
if(qfi.shape) {
|
||||
queuepolyat(V * qfi.spin * shadowmulmatrix, *qfi.shape, col, PPR::WALLSHADOW);
|
||||
}
|
||||
@ -3167,7 +3165,7 @@ void set_maywarp_floor(cell *c) {
|
||||
|
||||
int wavephase;
|
||||
|
||||
void escherSidewall(cell *c, int sidepar, const transmatrix& V, int col) {
|
||||
void escherSidewall(cell *c, int sidepar, const transmatrix& V, color_t col) {
|
||||
if(sidepar >= SIDE_SLEV && sidepar <= SIDE_SLEV+2) {
|
||||
int sl = sidepar - SIDE_SLEV;
|
||||
for(int z=1; z<=4; z++) if(z == 1 || (z == 4 && detaillevel == 2))
|
||||
@ -3196,7 +3194,7 @@ void escherSidewall(cell *c, int sidepar, const transmatrix& V, int col) {
|
||||
}
|
||||
}
|
||||
|
||||
bool placeSidewall(cell *c, int i, int sidepar, const transmatrix& V, int col) {
|
||||
bool placeSidewall(cell *c, int i, int sidepar, const transmatrix& V, color_t col) {
|
||||
|
||||
if(!qfi.fshape || !qfi.fshape->is_plain || !validsidepar[sidepar] || qfi.usershape >= 0) {
|
||||
escherSidewall(c, sidepar, V, col);
|
||||
@ -3262,7 +3260,7 @@ void pushdown(cell *c, int& q, const transmatrix &V, double down, bool rezoom, b
|
||||
if(down > 0 && repriority) {
|
||||
int qq = q+1;
|
||||
while(qq < isize(ptds))
|
||||
if(qq > q && ptds[qq].prio < ptds[qq-1].prio) {
|
||||
if(qq > q && ptds[qq]->prio < ptds[qq-1]->prio) {
|
||||
swap(ptds[qq], ptds[qq-1]);
|
||||
qq--;
|
||||
}
|
||||
@ -3270,12 +3268,13 @@ void pushdown(cell *c, int& q, const transmatrix &V, double down, bool rezoom, b
|
||||
}
|
||||
|
||||
while(q < isize(ptds)) {
|
||||
polytodraw& ptd = ptds[q++];
|
||||
if(ptd.kind == pkPoly) {
|
||||
auto pp = dynamic_cast<dqi_poly*> (&*ptds[q++]);
|
||||
if(!pp) continue;
|
||||
auto& ptd = *pp;
|
||||
|
||||
double z2;
|
||||
|
||||
double z = zlevel(tC0(ptd.u.poly.V));
|
||||
double z = zlevel(tC0(ptd.V));
|
||||
double lev = geom3::factor_to_lev(z);
|
||||
double nlev = lev - down;
|
||||
|
||||
@ -3285,14 +3284,14 @@ void pushdown(cell *c, int& q, const transmatrix &V, double down, bool rezoom, b
|
||||
|
||||
// xyscale = xyscale + (zscale-xyscale) * (1+sin(ticks / 1000.0)) / 2;
|
||||
|
||||
ptd.u.poly.V = xyzscale( V, xyscale*zscale, zscale)
|
||||
* inverse(V) * ptd.u.poly.V;
|
||||
ptd.V = xyzscale( V, xyscale*zscale, zscale)
|
||||
* inverse(V) * ptd.V;
|
||||
|
||||
if(!repriority) ;
|
||||
else if(nlev < -geom3::lake_bottom-1e-3) {
|
||||
ptd.prio = PPR::BELOWBOTTOM_FALLANIM;
|
||||
if(c->wall != waChasm)
|
||||
ptd.col = 0; // disappear!
|
||||
ptd.color = 0; // disappear!
|
||||
}
|
||||
else if(nlev < -geom3::lake_top-1e-3)
|
||||
ptd.prio = PPR::INLAKEWALL_FALLANIM;
|
||||
@ -3300,7 +3299,6 @@ void pushdown(cell *c, int& q, const transmatrix &V, double down, bool rezoom, b
|
||||
ptd.prio = PPR::LAKEWALL_FALLANIM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool dodrawcell(cell *c) {
|
||||
// do not display out of range cells, unless on torus
|
||||
@ -3397,8 +3395,8 @@ int getfd(cell *c) {
|
||||
}
|
||||
}
|
||||
|
||||
int getSnakelevColor(cell *c, int i, int last, int fd, int wcol) {
|
||||
int col;
|
||||
int getSnakelevColor(cell *c, int i, int last, int fd, color_t wcol) {
|
||||
color_t col;
|
||||
if(c->wall == waTower)
|
||||
col = 0xD0D0D0-i*0x101010;
|
||||
else if(c->land == laSnakeNest)
|
||||
@ -3410,14 +3408,14 @@ int getSnakelevColor(cell *c, int i, int last, int fd, int wcol) {
|
||||
return darkena(col, fd, 0xFF);
|
||||
}
|
||||
|
||||
void draw_wall(cell *c, const transmatrix& V, int wcol, int& zcol, int ct6, int fd) {
|
||||
void draw_wall(cell *c, const transmatrix& V, color_t wcol, color_t& zcol, int ct6, int fd) {
|
||||
zcol = wcol;
|
||||
int wcol0 = wcol;
|
||||
color_t wcol0 = wcol;
|
||||
int starcol = wcol;
|
||||
if(c->wall == waWarpGate) starcol = 0;
|
||||
if(c->wall == waVinePlant) starcol = 0x60C000;
|
||||
|
||||
int wcol2 = gradient(0, wcol0, 0, .8, 1);
|
||||
color_t wcol2 = gradient(0, wcol0, 0, .8, 1);
|
||||
|
||||
if(c->wall == waClosedGate) {
|
||||
int hdir = 0;
|
||||
@ -3482,7 +3480,7 @@ void draw_wall(cell *c, const transmatrix& V, int wcol, int& zcol, int ct6, int
|
||||
|
||||
bool just_gmatrix;
|
||||
|
||||
int colorhash(int i) {
|
||||
int colorhash(color_t i) {
|
||||
return (i * 0x471211 + i*i*0x124159 + i*i*i*0x982165) & 0xFFFFFF;
|
||||
}
|
||||
|
||||
@ -3603,7 +3601,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
return;
|
||||
}
|
||||
|
||||
// int col = 0xFFFFFF - 0x20 * c->maxdist - 0x2000 * c->cpdist;
|
||||
// color_t col = 0xFFFFFF - 0x20 * c->maxdist - 0x2000 * c->cpdist;
|
||||
|
||||
if(!buggyGeneration && c->mpdist > 8 && !cheater && !autocheat) return; // not yet generated
|
||||
/* if(!buggyGeneration && c->mpdist > 7 && !cheater) {
|
||||
@ -3618,7 +3616,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
}
|
||||
|
||||
char ch = winf[c->wall].glyph;
|
||||
int wcol, fcol, asciicol;
|
||||
color_t wcol, fcol, asciicol;
|
||||
|
||||
setcolors(c, wcol, fcol);
|
||||
|
||||
@ -3634,7 +3632,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
fcol = gradient(fcol, 0xC0C0FF, 0, 0.2, 1);
|
||||
|
||||
// addaura(tC0(V), wcol);
|
||||
int zcol = fcol;
|
||||
color_t zcol = fcol;
|
||||
|
||||
if(peace::on && peace::hint && c->land != laTortoise) {
|
||||
int d =
|
||||
@ -3929,7 +3927,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
transmatrix Vdepth = mscale(V2, geom3::WALL);
|
||||
|
||||
queuepolyat(Vdepth, shSemiFloor[0], darkena(vcol, fd, 0xFF), PPR::WALL3A);
|
||||
{dynamicval<int> p(poly_outline, OUTLINE_TRANS); queuepolyat(V2 * spin(M_PI*2/3), shSemiFloorShadow, SHADOW_WALL, PPR::WALLSHADOW); }
|
||||
{dynamicval<color_t> p(poly_outline, OUTLINE_TRANS); queuepolyat(V2 * spin(M_PI*2/3), shSemiFloorShadow, SHADOW_WALL, PPR::WALLSHADOW); }
|
||||
queuepolyat(V2, shSemiFloorSide[SIDE_WALL], darkena(vcol, fd, 0xFF), PPR::WALL3A-2+away(V2));
|
||||
|
||||
if(validsidepar[SIDE_WALL]) forCellIdEx(c2, j, c) {
|
||||
@ -4209,7 +4207,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
}
|
||||
else if(chasmg && wmspatial) {
|
||||
|
||||
int col = c->land == laCocytus ? 0x080808FF : 0x101010FF;
|
||||
color_t col = c->land == laCocytus ? 0x080808FF : 0x101010FF;
|
||||
|
||||
if(qfi.fshape == &shCloudFloor)
|
||||
set_floor(shCloudSeabed);
|
||||
@ -4241,13 +4239,13 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
}
|
||||
|
||||
string label = its(si.id & 255);
|
||||
int col = forecolor ^ colorhash(si.id >> 8);
|
||||
color_t col = forecolor ^ colorhash(si.id >> 8);
|
||||
queuestr(V, .5, label, 0xFF000000 + col);
|
||||
}
|
||||
#endif
|
||||
|
||||
if((cmode & sm::NUMBER) && (dialog::editingDetail())) {
|
||||
int col =
|
||||
color_t col =
|
||||
dist0 < geom3::highdetail ? 0xFF80FF80 :
|
||||
dist0 >= geom3::middetail ? 0xFFFF8080 :
|
||||
0XFFFFFF80;
|
||||
@ -4330,7 +4328,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
case waReptileBridge: {
|
||||
Vboat = &(Vboat0 = V);
|
||||
dynamicval<qfloorinfo> qfi2(qfi, qfi);
|
||||
int col = reptilecolor(c);
|
||||
color_t col = reptilecolor(c);
|
||||
chasmg = 0;
|
||||
set_reptile_floor(c, V, col);
|
||||
draw_qfi(c, V, col);
|
||||
@ -4440,7 +4438,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
|
||||
case waGlass:
|
||||
if(wmspatial) {
|
||||
int col = winf[waGlass].color;
|
||||
color_t col = winf[waGlass].color;
|
||||
int dcol = darkena(col, 0, 0x80);
|
||||
transmatrix Vdepth = mscale((*Vdp), geom3::WALL);
|
||||
draw_floorshape(c, Vdepth, shMFloor, dcol, PPR::WALL); // GLASS
|
||||
@ -4510,7 +4508,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
poly_outline = (c->land == laMirror) ? OUTLINE_TREASURE : OUTLINE_ORB;
|
||||
|
||||
if(wmspatial) {
|
||||
int col = winf[c->wall].color;
|
||||
color_t col = winf[c->wall].color;
|
||||
int dcol = darkena(col, 0, 0xC0);
|
||||
transmatrix Vdepth = mscale((*Vdp), geom3::WALL);
|
||||
draw_floorshape(c, Vdepth, shMFloor, dcol, PPR::WALL); // GLASS
|
||||
@ -4559,7 +4557,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
int sha = shallow(c);
|
||||
|
||||
if(wmspatial && sha) {
|
||||
int col = (highwall(c) || c->wall == waTower) ? wcol : fcol;
|
||||
color_t col = (highwall(c) || c->wall == waTower) ? wcol : fcol;
|
||||
if(!chasmg) {
|
||||
|
||||
#define D(v) darkena(gradient(0, col, 0, v * (sphere ? spherity(V * cellrelmatrix(c,i)) : 1), 1), fd, 0xFF)
|
||||
@ -4597,9 +4595,9 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
forCellIdEx(c2, i, c) if(chasmgraph(c2) == 0) {
|
||||
transmatrix V2 = V * cellrelmatrix(c, i);
|
||||
// if(!behindsphere(V2)) continue;
|
||||
int wcol2, fcol2;
|
||||
color_t wcol2, fcol2;
|
||||
setcolors(c2, wcol2, fcol2);
|
||||
int col = (highwall(c2) || c->wall == waTower) ? wcol2 : fcol2;
|
||||
color_t col = (highwall(c2) || c->wall == waTower) ? wcol2 : fcol2;
|
||||
col = gradient(0, col, 0, spherity(V), 1);
|
||||
int j = c->c.spin(i);
|
||||
if(ticks % 500 < -250) {
|
||||
@ -4625,7 +4623,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
if(fa.walltype == waNone)
|
||||
draw_qfi(c, V, darkena(fcol, fd, 0xFF), PPR::FLOOR);
|
||||
else {
|
||||
int wcol2, fcol2;
|
||||
color_t wcol2, fcol2;
|
||||
eWall w = c->wall; int p = c->wparam;
|
||||
c->wall = fa.walltype; c->wparam = fa.m;
|
||||
setcolors(c, wcol2, fcol2);
|
||||
@ -4786,8 +4784,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
if(vid.linequality > 0) steps <<= vid.linequality;
|
||||
if(vid.linequality < 0) steps >>= -vid.linequality;
|
||||
for(int i=0; i<=steps; i++) curvepoint(V * get_horopoint(y, x1 + (x2-x1) * i / steps));
|
||||
queuecurve(gridcolor(c, c->move(dir)), 0, PPR::LINE);
|
||||
lastptd().u.poly.linewidth = linewidthat(V * get_horopoint(y, (x1+x2)/2), vid.linewidth, 0);
|
||||
queuecurve(gridcolor(c, c->move(dir)), 0, PPR::LINE).linewidth = linewidthat(V * get_horopoint(y, (x1+x2)/2), vid.linewidth, 0);
|
||||
};
|
||||
horizontal(yy, 2*xx, xx, 4, binary::bd_up_right);
|
||||
horizontal(yy, xx, -xx, 8, binary::bd_up);
|
||||
@ -4879,7 +4876,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
|
||||
if(vid.grid && c->bardir != NODIR && c->bardir != NOBARRIERS && c->land != laHauntedWall &&
|
||||
c->barleft != NOWALLSEP_USED) {
|
||||
int col = darkena(0x505050, 0, 0xFF);
|
||||
color_t col = darkena(0x505050, 0, 0xFF);
|
||||
queueline(tC0(V), V*tC0(heptmove[c->bardir]), col, 2 + vid.linequality);
|
||||
queueline(tC0(V), V*tC0(hexmove[c->bardir]), col, 2 + vid.linequality);
|
||||
}
|
||||
@ -4896,8 +4893,8 @@ struct flashdata {
|
||||
cell *where;
|
||||
double angle;
|
||||
int spd; // 0 for flashes, >0 for particles
|
||||
int color;
|
||||
flashdata(int _t, int _s, cell *_w, int col, int sped) {
|
||||
color_t color;
|
||||
flashdata(int _t, int _s, cell *_w, color_t col, int sped) {
|
||||
t=_t; size=_s; where=_w; color = col;
|
||||
angle = rand() % 1000; spd = sped;
|
||||
}
|
||||
@ -4911,11 +4908,11 @@ void drawFlash(cell *c) {
|
||||
void drawBigFlash(cell *c) {
|
||||
flashes.push_back(flashdata(ticks, 2000, c, 0xC0FF00, 0));
|
||||
}
|
||||
void drawParticle(cell *c, int col, int maxspeed) {
|
||||
void drawParticle(cell *c, color_t col, int maxspeed) {
|
||||
if(vid.particles && !confusingGeometry())
|
||||
flashes.push_back(flashdata(ticks, rand() % 16, c, col, 1+rand() % maxspeed));
|
||||
}
|
||||
void drawParticles(cell *c, int col, int qty, int maxspeed) {
|
||||
void drawParticles(cell *c, color_t col, int qty, int maxspeed) {
|
||||
if(vid.particles)
|
||||
while(qty--) drawParticle(c,col, maxspeed);
|
||||
}
|
||||
@ -4940,11 +4937,11 @@ void fallingMonsterAnimation(cell *c, eMonster m, int id) {
|
||||
// drawParticles(c, darkenedby(linf[c->land].color, 1), 4, 50);
|
||||
}
|
||||
|
||||
void queuecircleat(cell *c, double rad, int col) {
|
||||
void queuecircleat(cell *c, double rad, color_t col) {
|
||||
if(!c) return;
|
||||
if(!gmatrix.count(c)) return;
|
||||
if(stereo::mode || sphere) {
|
||||
dynamicval<int> p(poly_outline, col);
|
||||
dynamicval<color_t> p(poly_outline, col);
|
||||
queuepolyat(gmatrix[c] * spin(ticks / 100.), shGem[1], 0, PPR::LINE);
|
||||
return;
|
||||
}
|
||||
@ -5394,7 +5391,7 @@ void drawmovestar(double dx, double dy) {
|
||||
#endif
|
||||
|
||||
else for(int d=0; d<8; d++) {
|
||||
int col = starcol;
|
||||
color_t col = starcol;
|
||||
#if ISPANDORA
|
||||
if(leftclick && (d == 2 || d == 6 || d == 1 || d == 7)) col &= 0xFFFFFF3F;
|
||||
if(rightclick && (d == 2 || d == 6 || d == 3 || d == 5)) col &= 0xFFFFFF3F;
|
||||
@ -5556,15 +5553,14 @@ void drawfullmap() {
|
||||
}
|
||||
if(rad && !haveaura()) {
|
||||
queuecircle(vid.xcenter, vid.ycenter, rad, ringcolor,
|
||||
vid.usingGL ? PPR::CIRCLE : PPR::OUTCIRCLE);
|
||||
if(isbnd) lastptd().u.cir.boundary = true;
|
||||
vid.usingGL ? PPR::CIRCLE : PPR::OUTCIRCLE, isbnd);
|
||||
}
|
||||
if(pmodel == mdBall) ballgeometry();
|
||||
}
|
||||
|
||||
if(pmodel == mdHyperboloid) {
|
||||
#if CAP_QUEUE
|
||||
int col = darkena(0x80, 0, 0x80);
|
||||
color_t col = darkena(0x80, 0, 0x80);
|
||||
queueline(hpxyz(0,0,1), hpxyz(0,0,-vid.alpha), col, 0, PPR::CIRCLE);
|
||||
queueline(xpush0(+4), hpxyz(0,0,0), col, 0, PPR::CIRCLE);
|
||||
queueline(xpush0(+4), hpxyz(0,0,-vid.alpha), col, 0, PPR::CIRCLE);
|
||||
@ -5739,7 +5735,7 @@ void drawscreen() {
|
||||
screens.back()();
|
||||
|
||||
#if !ISMOBILE
|
||||
int col = linf[cwt.at->land].color;
|
||||
color_t col = linf[cwt.at->land].color;
|
||||
if(cwt.at->land == laRedRock) col = 0xC00000;
|
||||
if(!nohelp)
|
||||
displayfr(vid.xres/2, vid.fsize, 2, vid.fsize, mouseovers, col, 8);
|
||||
@ -5772,7 +5768,7 @@ void drawscreen() {
|
||||
if((minefieldNearby || tmines) && !items[itOrbAether] && darken == 0 && normal) {
|
||||
string s;
|
||||
if(tmines > 7) tmines = 7;
|
||||
int col = minecolors[tmines];
|
||||
color_t col = minecolors[tmines];
|
||||
|
||||
if(tmines == 7) seenSevenMines = true;
|
||||
|
||||
@ -5931,7 +5927,7 @@ void animateReplacement(cell *a, cell *b, int layer, int direction_hinta, int di
|
||||
animateMovement(&c1, a, layer, direction_hintb);
|
||||
}
|
||||
|
||||
void drawBug(const cellwalker& cw, int col) {
|
||||
void drawBug(const cellwalker& cw, color_t col) {
|
||||
#if CAP_POLY
|
||||
initquickqueue();
|
||||
transmatrix V = ggmatrix(cw.at);
|
||||
|
2
help.cpp
2
help.cpp
@ -177,7 +177,7 @@ string princedesc() {
|
||||
return XLAT("Apparently a princess is kept locked somewhere, but you won't ever find her in this hyperbolic palace. ");
|
||||
}
|
||||
|
||||
string helptitle(string s, int col) {
|
||||
string helptitle(string s, color_t col) {
|
||||
return "@" + its(col) + "\t" + s + "\n";
|
||||
}
|
||||
|
||||
|
8
hud.cpp
8
hud.cpp
@ -163,7 +163,7 @@ bool graphglyph() {
|
||||
return vid.graphglyph == 2 || (vid.graphglyph == 1 && vid.monmode);
|
||||
}
|
||||
|
||||
bool displayglyph(int cx, int cy, int buttonsize, char glyph, int color, int qty, int flags, int id) {
|
||||
bool displayglyph(int cx, int cy, int buttonsize, char glyph, color_t color, int qty, int flags, int id) {
|
||||
|
||||
bool b =
|
||||
mousex >= cx && mousex < cx+buttonsize && mousey >= cy-buttonsize/2 && mousey <= cy-buttonsize/2+buttonsize;
|
||||
@ -244,7 +244,7 @@ bool displayglyph(int cx, int cy, int buttonsize, char glyph, int color, int qty
|
||||
void displayglyph2(int cx, int cy, int buttonsize, int i) {
|
||||
|
||||
char glyph = i < ittypes ? iinf[i].glyph : minf[i-ittypes].glyph;
|
||||
int color = i < ittypes ? iinf[i].color : minf[i-ittypes].color;
|
||||
color_t color = i < ittypes ? iinf[i].color : minf[i-ittypes].color;
|
||||
int imp = glyphflags(i);
|
||||
|
||||
if(displayglyph(cx, cy, buttonsize, glyph, color, ikmerge(i), imp, i)) {
|
||||
@ -310,12 +310,12 @@ void drawMobileArrow(int i) {
|
||||
transmatrix T;
|
||||
if(!compute_relamatrix(c, cwt.at, i, T)) return;
|
||||
|
||||
// int col = getcs().uicolor;
|
||||
// color_t col = getcs().uicolor;
|
||||
// col -= (col & 0xFF) >> 1;
|
||||
|
||||
bool invalid = !legalmoves[dir];
|
||||
|
||||
int col = cellcolor(c);
|
||||
color_t col = cellcolor(c);
|
||||
if(col == OUTLINE_NONE) col = 0xC0C0C0FF;
|
||||
col -= (col & 0xFF) >> 1;
|
||||
if(invalid) col -= (col & 0xFF) >> 1;
|
||||
|
208
hyper.h
208
hyper.h
@ -44,6 +44,7 @@ using std::out_of_range;
|
||||
using std::get;
|
||||
using std::move;
|
||||
using std::make_tuple;
|
||||
using std::unique_ptr;
|
||||
|
||||
using std::abs;
|
||||
using std::isfinite;
|
||||
@ -299,6 +300,7 @@ struct gcell {
|
||||
// improved tracking in Trollheim
|
||||
union {
|
||||
int32_t landpar;
|
||||
unsigned int landpar_color;
|
||||
float heat;
|
||||
char bytes[4];
|
||||
struct fieldinfo {
|
||||
@ -324,6 +326,7 @@ struct gcell {
|
||||
};
|
||||
|
||||
#define landparam LHU.landpar
|
||||
#define landparam_color LHU.landpar_color
|
||||
|
||||
#define fval LHU.fi.fieldval
|
||||
|
||||
@ -724,7 +727,7 @@ void activateActiv(cell *c, bool msg);
|
||||
|
||||
struct charstyle {
|
||||
int charid;
|
||||
unsigned skincolor, haircolor, dresscolor, swordcolor, dresscolor2, uicolor;
|
||||
color_t skincolor, haircolor, dresscolor, swordcolor, dresscolor2, uicolor;
|
||||
};
|
||||
|
||||
string csname(charstyle& cs);
|
||||
@ -892,8 +895,8 @@ void resetmusic();
|
||||
|
||||
void drawFlash(cell* c);
|
||||
void drawBigFlash(cell* c);
|
||||
void drawParticle(cell *c, int col, int maxspeed = 100);
|
||||
void drawParticles(cell *c, int col, int qty, int maxspeed = 100);
|
||||
void drawParticle(cell *c, color_t col, int maxspeed = 100);
|
||||
void drawParticles(cell *c, color_t col, int qty, int maxspeed = 100);
|
||||
void drawFireParticles(cell *c, int qty, int maxspeed = 100);
|
||||
int firecolor(int phase);
|
||||
|
||||
@ -904,18 +907,20 @@ void movepckeydir(int);
|
||||
|
||||
void centerpc(ld aspd);
|
||||
|
||||
typedef color_t color_t;
|
||||
|
||||
void displayButton(int x, int y, const string& name, int key, int align, int rad = 0);
|
||||
void displayColorButton(int x, int y, const string& name, int key, int align, int rad, int color, int color2 = 0);
|
||||
void displayColorButton(int x, int y, const string& name, int key, int align, int rad, color_t color, color_t color2 = 0);
|
||||
inline string ONOFF(bool b) { return XLAT(b ? "ON" : "OFF"); }
|
||||
int darkened(int c);
|
||||
extern int getcstat;
|
||||
bool displaychr(int x, int y, int shift, int size, char chr, int col);
|
||||
bool displayfr(int x, int y, int b, int size, const string &s, int color, int align);
|
||||
bool displayfrSP(int x, int y, int sh, int b, int size, const string &s, int color, int align, int p);
|
||||
bool displaychr(int x, int y, int shift, int size, char chr, color_t col);
|
||||
bool displayfr(int x, int y, int b, int size, const string &s, color_t color, int align);
|
||||
bool displayfrSP(int x, int y, int sh, int b, int size, const string &s, color_t color, int align, int p);
|
||||
|
||||
bool outofmap(hyperpoint h);
|
||||
void applymodel(hyperpoint H, hyperpoint& Hscr);
|
||||
void drawCircle(int x, int y, int size, int color);
|
||||
void drawCircle(int x, int y, int size, color_t color);
|
||||
void fixcolor(int& col);
|
||||
ld displayspin(cell *c, int d);
|
||||
hyperpoint gethyper(ld x, ld y);
|
||||
@ -923,14 +928,14 @@ void resetview(); extern heptspin viewctr; extern cellwalker centerover;
|
||||
void drawthemap();
|
||||
void drawfullmap();
|
||||
extern function<void()> wrap_drawfullmap;
|
||||
bool displaystr(int x, int y, int shift, int size, const char *str, int color, int align);
|
||||
bool displaystr(int x, int y, int shift, int size, const string& str, int color, int align);
|
||||
bool displaystr(int x, int y, int shift, int size, const char *str, color_t color, int align);
|
||||
bool displaystr(int x, int y, int shift, int size, const string& str, color_t color, int align);
|
||||
|
||||
extern int darken, inmirrorcount;
|
||||
void calcparam();
|
||||
|
||||
#if CAP_SDL
|
||||
int& qpixel(SDL_Surface *surf, int x, int y);
|
||||
color_t& qpixel(SDL_Surface *surf, int x, int y);
|
||||
void setvideomode();
|
||||
void saveHighQualityShot(const char *fname = NULL, const char *caption = NULL, int fade = 255);
|
||||
#endif
|
||||
@ -1288,9 +1293,9 @@ void selectEyeGL(int ed);
|
||||
void selectEyeMask(int ed);
|
||||
extern int ticks;
|
||||
|
||||
extern unsigned backcolor, bordcolor, forecolor;
|
||||
extern color_t backcolor, bordcolor, forecolor;
|
||||
|
||||
void setGLProjection(int col = backcolor);
|
||||
void setGLProjection(color_t col = backcolor);
|
||||
|
||||
// passable flags
|
||||
|
||||
@ -1658,7 +1663,7 @@ namespace dialog {
|
||||
string value;
|
||||
string keycaption;
|
||||
int key;
|
||||
int color, colorv, colork, colors, colorc;
|
||||
color_t color, colorv, colork, colors, colorc;
|
||||
int scale;
|
||||
double param;
|
||||
int position;
|
||||
@ -1682,7 +1687,7 @@ namespace dialog {
|
||||
extern reaction_t reaction, extra_options;
|
||||
|
||||
item& lastItem();
|
||||
extern unsigned int *palette;
|
||||
extern color_t *palette;
|
||||
|
||||
string keyname(int k);
|
||||
|
||||
@ -1691,15 +1696,15 @@ namespace dialog {
|
||||
void addBoolItem(string body, bool value, int key);
|
||||
void addBigItem(string body, int key);
|
||||
void addColorItem(string body, int value, int key);
|
||||
void openColorDialog(unsigned int& col, unsigned int *pal = palette);
|
||||
void openColorDialog(color_t& col, color_t *pal = palette);
|
||||
void addHelp(string body);
|
||||
void addInfo(string body, int color = 0xC0C0C0);
|
||||
void addInfo(string body, color_t color = 0xC0C0C0);
|
||||
void addItem(string body, int key);
|
||||
int addBreak(int val);
|
||||
void addTitle(string body, int color, int scale);
|
||||
void addTitle(string body, color_t color, int scale);
|
||||
|
||||
void init();
|
||||
void init(string title, int color = 0xE8E8E8, int scale = 150, int brk = 60);
|
||||
void init(string title, color_t color = 0xE8E8E8, int scale = 150, int brk = 60);
|
||||
void display();
|
||||
|
||||
void editNumber(ld& x, ld vmin, ld vmax, ld step, ld dft, string title, string help);
|
||||
@ -1709,8 +1714,8 @@ namespace dialog {
|
||||
void handleNavigation(int &sym, int &uni);
|
||||
|
||||
namespace zoom {
|
||||
bool displayfr(int x, int y, int b, int size, const string &s, int color, int align);
|
||||
bool displayfr_highlight(int x, int y, int b, int size, const string &s, int color, int align, int hicolor = 0xFFFF00);
|
||||
bool displayfr(int x, int y, int b, int size, const string &s, color_t color, int align);
|
||||
bool displayfr_highlight(int x, int y, int b, int size, const string &s, color_t color, int align, int hicolor = 0xFFFF00);
|
||||
}
|
||||
|
||||
bool editingDetail();
|
||||
@ -1721,7 +1726,7 @@ namespace dialog {
|
||||
extern bool sidedialog;
|
||||
extern int dialogflags;
|
||||
extern int dcenter;
|
||||
int displaycolor(unsigned col);
|
||||
int displaycolor(color_t col);
|
||||
|
||||
void openFileDialog(string& filename, string fcap, string ext, bool_reaction_t action);
|
||||
|
||||
@ -1744,11 +1749,11 @@ void clearMessages();
|
||||
void resetGeometry();
|
||||
|
||||
namespace svg {
|
||||
void circle(int x, int y, int size, int col);
|
||||
void polygon(int *polyx, int *polyy, int polyi, int col, int outline, double linewidth);
|
||||
void text(int x, int y, int size, const string& str, bool frame, int col, int align);
|
||||
void circle(int x, int y, int size, color_t col);
|
||||
void polygon(int *polyx, int *polyy, int polyi, color_t col, int outline, double linewidth);
|
||||
void text(int x, int y, int size, const string& str, bool frame, color_t col, int align);
|
||||
extern bool in;
|
||||
extern const string *link;
|
||||
extern string link;
|
||||
void render(const char *fname = NULL, const function<void()>& what = drawfullmap);
|
||||
}
|
||||
|
||||
@ -1770,7 +1775,7 @@ extern bool ivoryz;
|
||||
#define SHADOW_SL 0x18
|
||||
#define SHADOW_MON 0x30
|
||||
|
||||
bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, int col, double footphase);
|
||||
bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, color_t col, double footphase);
|
||||
|
||||
void drawPlayerEffects(const transmatrix& V, cell *c, bool onPlayer);
|
||||
|
||||
@ -1868,7 +1873,7 @@ inline PPR operator - (PPR x, int y) { return PPR(int(x) - y); }
|
||||
inline int operator - (PPR x, PPR y) { return int(x) - int(y); }
|
||||
|
||||
namespace mapeditor {
|
||||
bool drawUserShape(const transmatrix& V, eShapegroup group, int id, int color, cell *c, PPR prio = PPR::DEFAULT);
|
||||
bool drawUserShape(const transmatrix& V, eShapegroup group, int id, color_t color, cell *c, PPR prio = PPR::DEFAULT);
|
||||
}
|
||||
|
||||
void ShadowV(const transmatrix& V, const struct hpcshape& bp, PPR prio = PPR::MONSTER_SHADOW);
|
||||
@ -1970,7 +1975,7 @@ void setcameraangle(bool b);
|
||||
|
||||
#define MODELCOUNT ((int) mdGUARD)
|
||||
|
||||
void drawShape(pair<ld,ld>* coords, int qty, int color);
|
||||
void drawShape(pair<ld,ld>* coords, int qty, color_t color);
|
||||
|
||||
extern eModel pmodel;
|
||||
|
||||
@ -2149,10 +2154,10 @@ namespace linepatterns {
|
||||
};
|
||||
|
||||
void clearAll();
|
||||
void setColor(ePattern id, int col);
|
||||
void setColor(ePattern id, color_t col);
|
||||
void drawAll();
|
||||
void showMenu();
|
||||
void switchAlpha(ePattern id, int col);
|
||||
void switchAlpha(ePattern id, color_t col);
|
||||
};
|
||||
|
||||
transmatrix ddspin(cell *c, int d, ld bonus = 0);
|
||||
@ -2371,7 +2376,7 @@ bool inmirror(eLand l);
|
||||
bool inmirror(cell *c);
|
||||
bool inmirror(const cellwalker& cw);
|
||||
|
||||
void queuemarkerat(const transmatrix& V, int col);
|
||||
void queuemarkerat(const transmatrix& V, color_t col);
|
||||
|
||||
void check_total_victory();
|
||||
void applyBoxNum(int& i, string name = "");
|
||||
@ -2380,7 +2385,7 @@ extern int hinttoshow;
|
||||
bool isShmupLifeOrb(eItem it);
|
||||
int orbcharges(eItem it);
|
||||
|
||||
int gradient(int c0, int c1, ld v0, ld v, ld v1);
|
||||
color_t gradient(color_t c0, color_t c1, ld v0, ld v, ld v1);
|
||||
|
||||
struct hint {
|
||||
time_t last;
|
||||
@ -2405,10 +2410,10 @@ extern bool longclick;
|
||||
extern bool useRangedOrb;
|
||||
#endif
|
||||
|
||||
void addaura(const hyperpoint& h, int col, int fd);
|
||||
void addauraspecial(const hyperpoint& h, int col, int dir);
|
||||
void addaura(const hyperpoint& h, color_t col, int fd);
|
||||
void addauraspecial(const hyperpoint& h, color_t col, int dir);
|
||||
|
||||
void drawBug(const cellwalker& cw, int col);
|
||||
void drawBug(const cellwalker& cw, color_t col);
|
||||
|
||||
void mainloop();
|
||||
void mainloopiter();
|
||||
@ -2525,7 +2530,17 @@ struct textureinfo {
|
||||
int current_type, symmetries;
|
||||
};
|
||||
|
||||
struct qpoly {
|
||||
struct drawqueueitem {
|
||||
PPR prio;
|
||||
color_t color;
|
||||
virtual void draw() = 0;
|
||||
virtual void draw_back() {}
|
||||
virtual void draw_pre() {}
|
||||
virtual ~drawqueueitem() {}
|
||||
void draw_darker();
|
||||
};
|
||||
|
||||
struct dqi_poly : drawqueueitem {
|
||||
transmatrix V;
|
||||
const vector<glvertex> *tab;
|
||||
int offset, cnt;
|
||||
@ -2533,50 +2548,40 @@ struct qpoly {
|
||||
double linewidth;
|
||||
int flags;
|
||||
textureinfo *tinf;
|
||||
void draw();
|
||||
void gldraw();
|
||||
void draw_back();
|
||||
};
|
||||
|
||||
struct qline {
|
||||
struct dqi_line : drawqueueitem {
|
||||
hyperpoint H1, H2;
|
||||
int prf;
|
||||
double width;
|
||||
void draw();
|
||||
void draw_back();
|
||||
};
|
||||
|
||||
#define MAXQCHR 64
|
||||
|
||||
struct qchr {
|
||||
char str[MAXQCHR];
|
||||
struct dqi_string : drawqueueitem {
|
||||
string str;
|
||||
int x, y, shift, size, frame;
|
||||
int align;
|
||||
void draw();
|
||||
};
|
||||
|
||||
struct qcir {
|
||||
struct dqi_circle : drawqueueitem {
|
||||
int x, y, size;
|
||||
bool boundary;
|
||||
void draw();
|
||||
};
|
||||
|
||||
// set a link for SVG
|
||||
struct qlink {
|
||||
const string *link;
|
||||
struct dqi_boundary_circle : dqi_circle {
|
||||
int x, y, size;
|
||||
void draw_pre();
|
||||
};
|
||||
|
||||
enum eKind { pkPoly, pkLine, pkString, pkCircle, pkShape, pkResetModel, pkSpecial, pkLink };
|
||||
|
||||
union polyunion {
|
||||
qpoly poly;
|
||||
qline line;
|
||||
qchr chr;
|
||||
qcir cir;
|
||||
double dvalue;
|
||||
qlink link;
|
||||
polyunion() {}
|
||||
};
|
||||
|
||||
struct polytodraw {
|
||||
eKind kind;
|
||||
PPR prio;
|
||||
int col;
|
||||
polyunion u;
|
||||
polytodraw() {}
|
||||
struct dqi_action : drawqueueitem {
|
||||
reaction_t action;
|
||||
dqi_action(const reaction_t& a) : action(a) {}
|
||||
void draw() { action(); }
|
||||
};
|
||||
|
||||
extern int emeraldtable[100][7];
|
||||
@ -2952,7 +2957,7 @@ int emeraldval(cell *c);
|
||||
int inpair(cell *c, int colorpair);
|
||||
int snake_pair(cell *c);
|
||||
|
||||
extern const unsigned int nestcolors[8];
|
||||
extern const color_t nestcolors[8];
|
||||
|
||||
#if CAP_TEXTURE
|
||||
namespace texture {
|
||||
@ -2967,13 +2972,13 @@ namespace texture {
|
||||
|
||||
texture_data() { textureid = 0; twidth = 2048; }
|
||||
|
||||
vector<unsigned> texture_pixels;
|
||||
vector<color_t> texture_pixels;
|
||||
|
||||
unsigned& get_texture_pixel(int x, int y) {
|
||||
color_t& get_texture_pixel(int x, int y) {
|
||||
return texture_pixels[(y&(twidth-1))*twidth+(x&(twidth-1))];
|
||||
}
|
||||
|
||||
vector<pair<unsigned*, unsigned>> undos;
|
||||
vector<pair<color_t*, color_t>> undos;
|
||||
vector<tuple<cell*, hyperpoint, int> > pixels_to_draw;
|
||||
|
||||
bool loadTextureGL();
|
||||
@ -2989,22 +2994,22 @@ namespace texture {
|
||||
struct texture_config {
|
||||
string texturename;
|
||||
string configname;
|
||||
unsigned paint_color;
|
||||
color_t paint_color;
|
||||
eTextureState tstate;
|
||||
eTextureState tstate_max;
|
||||
|
||||
transmatrix itt;
|
||||
|
||||
unsigned grid_color;
|
||||
unsigned mesh_color;
|
||||
unsigned master_color;
|
||||
unsigned slave_color;
|
||||
color_t grid_color;
|
||||
color_t mesh_color;
|
||||
color_t master_color;
|
||||
color_t slave_color;
|
||||
|
||||
int color_alpha;
|
||||
|
||||
int gsplits;
|
||||
|
||||
int recolor(int col);
|
||||
int recolor(color_t col);
|
||||
|
||||
typedef tuple<eGeometry, eVariation, char, int, eModel, ld, ld> texture_parameters;
|
||||
texture_parameters orig_texture_parameters;
|
||||
@ -3016,7 +3021,7 @@ namespace texture {
|
||||
string texture_tuner;
|
||||
vector<hyperpoint*> tuned_vertices;
|
||||
|
||||
bool apply(cell *c, const transmatrix &V, int col);
|
||||
bool apply(cell *c, const transmatrix &V, color_t col);
|
||||
void mark_triangles();
|
||||
|
||||
void clear_texture_map();
|
||||
@ -3062,11 +3067,11 @@ namespace texture {
|
||||
|
||||
void showMenu();
|
||||
|
||||
void drawPixel(cell *c, hyperpoint h, int col);
|
||||
void drawPixel(cell *c, hyperpoint h, color_t col);
|
||||
extern cell *where;
|
||||
// compute 'c' automatically, based on the hint in 'where'
|
||||
void drawPixel(hyperpoint h, int col);
|
||||
void drawLine(hyperpoint h1, hyperpoint h2, int col, int steps = 10);
|
||||
void drawPixel(hyperpoint h, color_t col);
|
||||
void drawLine(hyperpoint h1, hyperpoint h2, color_t col, int steps = 10);
|
||||
|
||||
extern bool texturesym;
|
||||
|
||||
@ -3077,15 +3082,17 @@ namespace texture {
|
||||
}
|
||||
#endif
|
||||
|
||||
void queueline(const hyperpoint& H1, const hyperpoint& H2, int col, int prf = 0, PPR prio = PPR::LINE);
|
||||
void queuelink(const string *link, PPR prio);
|
||||
dqi_line& queueline(const hyperpoint& H1, const hyperpoint& H2, color_t col, int prf = 0, PPR prio = PPR::LINE);
|
||||
|
||||
dqi_action& queueaction(PPR prio, const reaction_t& action);
|
||||
void queuereset(eModel m, PPR prio);
|
||||
|
||||
|
||||
extern ld tessf, crossf, hexf, hcrossf, hexhexdist, hexvdist, hepvdist, rhexf;
|
||||
|
||||
extern ld scalefactor, orbsize, floorrad0, floorrad1, zhexf;
|
||||
|
||||
unsigned char& part(int& col, int i);
|
||||
unsigned char& part(unsigned& col, int i);
|
||||
unsigned char& part(color_t& col, int i);
|
||||
|
||||
transmatrix applyPatterndir(cell *c, const patterns::patterninfo& si);
|
||||
|
||||
@ -3172,7 +3179,7 @@ struct renderbuffer {
|
||||
renderbuffer(int x, int y, bool gl);
|
||||
~renderbuffer();
|
||||
void enable();
|
||||
void clear(int col);
|
||||
void clear(color_t col);
|
||||
};
|
||||
|
||||
struct resetbuffer {
|
||||
@ -3283,7 +3290,7 @@ extern void initializeCLI();
|
||||
|
||||
static const int max_vec = (1<<14);
|
||||
|
||||
string helptitle(string s, int col);
|
||||
string helptitle(string s, color_t col);
|
||||
pair<int, int> cell_to_pair(cell *c);
|
||||
extern bool nohud, nofps, nomap;
|
||||
|
||||
@ -3296,7 +3303,7 @@ ld hypot3(const hyperpoint& h);
|
||||
|
||||
extern const hyperpoint Hypc;
|
||||
ld det(const transmatrix& T);
|
||||
void queuechr(const hyperpoint& h, int size, char chr, int col, int frame = 0);
|
||||
void queuechr(const hyperpoint& h, int size, char chr, color_t col, int frame = 0);
|
||||
|
||||
string fts(float x);
|
||||
bool model_needs_depth();
|
||||
@ -3494,7 +3501,7 @@ template<> struct saver<ld> : dsaver<ld> {
|
||||
};
|
||||
|
||||
#endif
|
||||
extern vector<polytodraw> ptds;
|
||||
extern vector<unique_ptr<drawqueueitem>> ptds;
|
||||
extern ld intval(const hyperpoint &h1, const hyperpoint &h2);
|
||||
extern ld intvalxy(const hyperpoint &h1, const hyperpoint &h2);
|
||||
transmatrix euscalezoom(hyperpoint h);
|
||||
@ -3520,7 +3527,7 @@ namespace glhr {
|
||||
|
||||
void set_depthtest(bool b);
|
||||
glmatrix translate(ld x, ld y, ld z);
|
||||
void color2(int color, ld part = 1);
|
||||
void color2(color_t color, ld part = 1);
|
||||
void be_textured();
|
||||
void set_modelview(const glmatrix& m);
|
||||
hyperpoint gltopoint(const glvertex& t);
|
||||
@ -3563,10 +3570,9 @@ namespace glhr {
|
||||
void prepare(vector<ct_vertex>& v);
|
||||
}
|
||||
|
||||
void prettypoly(const vector<hyperpoint>& t, int fillcol, int linecol, int lev);
|
||||
polytodraw& lastptd();
|
||||
void queuepolyat(const transmatrix& V, const hpcshape& h, int col, PPR prio);
|
||||
void queuetable(const transmatrix& V, const vector<glvertex>& f, int cnt, int linecol, int fillcol, PPR prio);
|
||||
void prettypoly(const vector<hyperpoint>& t, color_t fillcol, color_t linecol, int lev);
|
||||
dqi_poly& queuepolyat(const transmatrix& V, const hpcshape& h, color_t col, PPR prio);
|
||||
dqi_poly& queuetable(const transmatrix& V, const vector<glvertex>& f, int cnt, color_t linecol, color_t fillcol, PPR prio);
|
||||
|
||||
struct floorshape;
|
||||
|
||||
@ -3593,9 +3599,9 @@ int fix6(int a);
|
||||
int fix7(int a);
|
||||
int fixdir(int a, cell *c);
|
||||
cell *newCell(int type, heptagon *master);
|
||||
extern int qpixel_pixel_outside;
|
||||
extern color_t qpixel_pixel_outside;
|
||||
|
||||
void queuechr(int x, int y, int shift, int size, char chr, int col, int frame = 0, int align = 8);
|
||||
void queuechr(int x, int y, int shift, int size, char chr, color_t col, int frame = 0, int align = 8);
|
||||
|
||||
int zebra3(cell *c);
|
||||
int geosupport_threecolor();
|
||||
@ -3717,11 +3723,11 @@ namespace gp {
|
||||
|
||||
extern bool debug_geometry;
|
||||
|
||||
void queuepoly(const transmatrix& V, const hpcshape& h, int col);
|
||||
void queuepolyat(const transmatrix& V, const hpcshape& h, int col, PPR prio);
|
||||
dqi_poly& queuepoly(const transmatrix& V, const hpcshape& h, color_t col);
|
||||
dqi_poly& queuepolyat(const transmatrix& V, const hpcshape& h, color_t col, PPR prio);
|
||||
|
||||
void queuestr(const hyperpoint& h, int size, const string& chr, int col, int frame = 0);
|
||||
void queuechr(const transmatrix& V, double size, char chr, int col, int frame = 0);
|
||||
void queuestr(const hyperpoint& h, int size, const string& chr, color_t col, int frame = 0);
|
||||
void queuechr(const transmatrix& V, double size, char chr, color_t col, int frame = 0);
|
||||
|
||||
extern bool just_gmatrix;
|
||||
void drawrec(const heptspin& hs, hstate s, const transmatrix& V);
|
||||
@ -3868,12 +3874,12 @@ namespace geom3 {
|
||||
extern ld BODY;
|
||||
}
|
||||
|
||||
void queuestr(const transmatrix& V, double size, const string& chr, int col, int frame = 0, int align = 8);
|
||||
void queuestr(int x, int y, int shift, int size, string str, int col, int frame = 0, int align = 8);
|
||||
void queuestr(const transmatrix& V, double size, const string& chr, color_t col, int frame = 0, int align = 8);
|
||||
void queuestr(int x, int y, int shift, int size, string str, color_t col, int frame = 0, int align = 8);
|
||||
|
||||
ld frac(ld x);
|
||||
|
||||
extern int poly_outline;
|
||||
extern color_t poly_outline;
|
||||
|
||||
extern hpcshape shDisk, shTriangle, shHeptaMarker, shSnowball, shDiskT, shDiskS, shDiskSq, shDiskM;
|
||||
|
||||
|
@ -544,7 +544,7 @@ namespace hr { namespace inv {
|
||||
eLand pl = getPrizeLand();
|
||||
eOrbLandRelation olr = getOLR(which, pl);
|
||||
|
||||
int col = 0;
|
||||
color_t col = 0;
|
||||
const char *fmsg = NULL;
|
||||
if(olr == olrDangerous)
|
||||
col = 0xC00000,
|
||||
|
@ -898,7 +898,7 @@ namespace mapeditor {
|
||||
|
||||
int dslayer;
|
||||
bool coloring;
|
||||
unsigned int colortouse = 0xC0C0C0FFu;
|
||||
color_t colortouse = 0xC0C0C0FFu;
|
||||
// fake key sent to change the color
|
||||
static const int COLORKEY = (-10000);
|
||||
|
||||
@ -1180,20 +1180,20 @@ namespace mapeditor {
|
||||
initShape(sg, id);
|
||||
|
||||
for(int i=0; i<isize(ptds); i++) {
|
||||
auto& ptd = ptds[i];
|
||||
if(ptd.kind != pkPoly) continue;
|
||||
auto pp = dynamic_cast<dqi_poly*> (&*ptds[i]);
|
||||
if(!pp) continue;
|
||||
auto& ptd = *pp;
|
||||
|
||||
auto& p = ptd.u.poly;
|
||||
int cnt = p.cnt;
|
||||
int cnt = ptd.cnt;
|
||||
|
||||
usershapelayer *dsCur = &usershapes[sg][id]->d[layer];
|
||||
dsCur->list.clear();
|
||||
dsCur->color = ptd.col;
|
||||
dsCur->color = ptd.color;
|
||||
dsCur->sym = false;
|
||||
dsCur->rots = 1;
|
||||
|
||||
for(auto& v: symmetriesAt)
|
||||
if(v[0] == p.offset) {
|
||||
if(v[0] == ptd.offset) {
|
||||
dsCur->rots = v[1];
|
||||
dsCur->sym = v[2] == 2;
|
||||
}
|
||||
@ -1201,7 +1201,7 @@ namespace mapeditor {
|
||||
int d = dsCur->rots * (dsCur->sym ? 2 : 1);
|
||||
|
||||
for(int i=0; i < cnt/d; i++)
|
||||
dsCur->list.push_back(p.V * glhr::gltopoint((*p.tab)[i+p.offset]));
|
||||
dsCur->list.push_back(ptd.V * glhr::gltopoint((*ptd.tab)[i+ptd.offset]));
|
||||
|
||||
layer++;
|
||||
if(layer == USERLAYERS) break;
|
||||
@ -1699,7 +1699,7 @@ namespace mapeditor {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool drawUserShape(const transmatrix& V, eShapegroup group, int id, int color, cell *c, PPR prio) {
|
||||
bool drawUserShape(const transmatrix& V, eShapegroup group, int id, color_t color, cell *c, PPR prio) {
|
||||
#if !CAP_EDIT
|
||||
return false;
|
||||
#else
|
||||
|
@ -73,7 +73,7 @@ void showOverview() {
|
||||
eLand l = landlist[lstart + i];
|
||||
int xr = vid.xres / 64;
|
||||
int i0 = 56 + vid.fsize + i * vf;
|
||||
int col;
|
||||
color_t col;
|
||||
if(landUnlocked(l)) col = linf[l].color; else col = 0x404040;
|
||||
if(l == curland)
|
||||
displayfrZ(1, i0, 1, vf-4, "*", forecolor, 0);
|
||||
|
@ -674,9 +674,9 @@ void wandering() {
|
||||
}
|
||||
}
|
||||
|
||||
void generateSnake(cell *c, int i, int color) {
|
||||
void generateSnake(cell *c, int i, int snakecolor) {
|
||||
c->monst = moHexSnake;
|
||||
c->hitpoints = color;
|
||||
c->hitpoints = snakecolor;
|
||||
int cpair = (1<<pattern_threecolor(c)) | (1<<pattern_threecolor(c->move(i)));
|
||||
preventbarriers(c);
|
||||
int len = BITRUNCATED ? ROCKSNAKELENGTH : 2;
|
||||
@ -691,7 +691,7 @@ void generateSnake(cell *c, int i, int color) {
|
||||
cell *c3 = c2->move(i);
|
||||
if(c3->monst || c3->bardir != NODIR || c3->wall) break;
|
||||
c2 = c3;
|
||||
c2->monst = moHexSnakeTail; c2->hitpoints = color;
|
||||
c2->monst = moHexSnakeTail; c2->hitpoints = snakecolor;
|
||||
i = (j + (c2->type%4 == 0 ? c2->type/2 : (len%2 ? 2 : c2->type - 2))) % c2->type;
|
||||
createMov(c2, i);
|
||||
if(!inpair(c2->move(i), cpair)) {
|
||||
|
14
netgen.cpp
14
netgen.cpp
@ -213,13 +213,13 @@ namespace hr { namespace netgen {
|
||||
// Simple graphical functions
|
||||
//============================
|
||||
|
||||
void blackline(vec v1, vec v2, int col = 0x000000FF) {
|
||||
void blackline(vec v1, vec v2, color_t col = 0x000000FF) {
|
||||
#if CAP_SDLGFX==1
|
||||
aalineColor(s, int(v1.x), int(v1.y), int(v2.x), int(v2.y), col);
|
||||
#endif
|
||||
}
|
||||
|
||||
void drawtriangle(vec v1, vec v2, vec v3, int col) {
|
||||
void drawtriangle(vec v1, vec v2, vec v3, color_t col) {
|
||||
#if CAP_SDLGFX==1
|
||||
polyx[0] = int(v1.x);
|
||||
polyx[1] = int(v2.x);
|
||||
@ -231,7 +231,7 @@ namespace hr { namespace netgen {
|
||||
#endif
|
||||
}
|
||||
|
||||
void blackcircle(vec v, int r, int col = 0x000000FF) {
|
||||
void blackcircle(vec v, int r, color_t col = 0x000000FF) {
|
||||
#if CAP_SDLGFX
|
||||
aacircleColor(s, int(v.x), int(v.y), r, col);
|
||||
#endif
|
||||
@ -257,7 +257,7 @@ namespace hr { namespace netgen {
|
||||
|
||||
SDL_Surface *net, *hqsurface;
|
||||
|
||||
int& hqpixel(hyperpoint h) {
|
||||
color_t& hqpixel(hyperpoint h) {
|
||||
int hx, hy, hs;
|
||||
getcoord0(h, hx, hy, hs);
|
||||
return qpixel(hqsurface, hx, hy);
|
||||
@ -388,7 +388,7 @@ namespace hr { namespace netgen {
|
||||
"!@#$%^&*+=~:;<>?/|\"., [{(\\]})" [(pateks++) % 85];
|
||||
}
|
||||
|
||||
int col = 0xFFFFFFFF;
|
||||
color_t col = 0xFFFFFFFF;
|
||||
int p = patek[i][e];
|
||||
col -= 0x8000 * (p&1); p /= 2;
|
||||
col -= 0x800000 * (p&1); p /= 2;
|
||||
@ -520,7 +520,7 @@ namespace hr { namespace netgen {
|
||||
if(i == bei && e == bee) cedist = norm(v3-mousepos);
|
||||
}
|
||||
|
||||
int col =
|
||||
color_t col =
|
||||
i == bei && e == bee ? 0x40FF40FF:
|
||||
i == nei[bei][bee] && nei[i][e] == bei ? 0x40FF40FF :
|
||||
nei[i][e] == glued[i] ? 0x303030FF :
|
||||
@ -640,7 +640,7 @@ namespace hr { namespace netgen {
|
||||
int t = ct[i];
|
||||
int ofs = t == 7 ? 0 : 5;
|
||||
for(int e=0; e<t; e++) {
|
||||
int col =
|
||||
color_t col =
|
||||
nei[i][e] == glued[i] && glued[i] >= 0 ? 0x303030 :
|
||||
nei[i][e] >= 0 && glued[nei[i][e]] == i ? 0x303030 :
|
||||
nei[i][e] >= 0 ? 0x808080 :
|
||||
|
34
pattern2.cpp
34
pattern2.cpp
@ -1327,12 +1327,12 @@ namespace patterns {
|
||||
if(whichCanvas == 'r')
|
||||
return hrand(0xFFFFFF + 1);
|
||||
if(whichCanvas == 'e') {
|
||||
static unsigned int fcol[4] = { 0x404040, 0x800000, 0x008000, 0x000080 };
|
||||
static color_t fcol[4] = { 0x404040, 0x800000, 0x008000, 0x000080 };
|
||||
int fv = emeraldval(c);
|
||||
return fcol[fv&3];
|
||||
}
|
||||
if(whichCanvas == 'a') {
|
||||
static unsigned int fcol8[8] = {
|
||||
static color_t fcol8[8] = {
|
||||
0x800000,
|
||||
0x503000,
|
||||
0x206000,
|
||||
@ -1344,32 +1344,32 @@ namespace patterns {
|
||||
};
|
||||
|
||||
if(c->wall == waNone) {
|
||||
int col = fcol8[land50(c)];
|
||||
color_t col = fcol8[land50(c)];
|
||||
if(polara50(c)) col += 0x181818;
|
||||
return col;
|
||||
}
|
||||
}
|
||||
if(whichCanvas == 'b') {
|
||||
static unsigned int fcol[4] = { 0x404040, 0x800000, 0x008000, 0x000080 };
|
||||
static color_t fcol[4] = { 0x404040, 0x800000, 0x008000, 0x000080 };
|
||||
return fcol[polara50(c) + 2 * polarb50(c)];
|
||||
}
|
||||
if(whichCanvas == 'z') {
|
||||
static unsigned int fcol[4] = { 0xC0C0C0, 0xE0E0E0, 0x404040, 0x606060 };
|
||||
static color_t fcol[4] = { 0xC0C0C0, 0xE0E0E0, 0x404040, 0x606060 };
|
||||
int fv = zebra40(c);
|
||||
return fcol[fv&3];
|
||||
}
|
||||
if(whichCanvas == 't') {
|
||||
static unsigned int fcol[4] = { 0x804040, 0x408040, 0x404080, 0x808040 };
|
||||
static color_t fcol[4] = { 0x804040, 0x408040, 0x404080, 0x808040 };
|
||||
int fv = zebra40(c);
|
||||
if(fv/4 == 4 || fv/4 == 6 || fv/4 == 5 || fv/4 == 10) fv ^= 2;
|
||||
return fcol[fv&3];
|
||||
}
|
||||
if(whichCanvas == 'x') {
|
||||
static unsigned int fcol[4] = { 0xC0C0C0, 0x800000, 0x008000, 0x000080 };
|
||||
static color_t fcol[4] = { 0xC0C0C0, 0x800000, 0x008000, 0x000080 };
|
||||
return fcol[zebra3(c)];
|
||||
}
|
||||
if(whichCanvas == 'w') {
|
||||
static unsigned int fcol[2] = { 0x303030, 0xC0C0C0 };
|
||||
static color_t fcol[2] = { 0x303030, 0xC0C0C0 };
|
||||
return fcol[randpattern(c, subcanvas) ? 1 : 0];
|
||||
}
|
||||
if(whichCanvas == 'l') {
|
||||
@ -1935,16 +1935,16 @@ bool is_master(cell *c) {
|
||||
|
||||
namespace linepatterns {
|
||||
|
||||
int lessalpha(int col, int m) {
|
||||
color_t lessalpha(color_t col, int m) {
|
||||
part(col, 0) /= m;
|
||||
return col;
|
||||
}
|
||||
|
||||
int lessalphaif(int col, bool b) {
|
||||
color_t lessalphaif(color_t col, bool b) {
|
||||
return b?lessalpha(col, 4):col;
|
||||
}
|
||||
|
||||
int lessalphaif(int col, bool b1, bool b2) {
|
||||
color_t lessalphaif(color_t col, bool b1, bool b2) {
|
||||
if(b1) col = lessalpha(col, 2);
|
||||
if(b2) col = lessalpha(col, 2);
|
||||
return col;
|
||||
@ -1953,7 +1953,7 @@ namespace linepatterns {
|
||||
struct {
|
||||
int id;
|
||||
const char *lpname;
|
||||
unsigned int color;
|
||||
color_t color;
|
||||
} patterns[] = {
|
||||
|
||||
{patTriNet, "triangle grid: not rings", 0xFFFFFF00},
|
||||
@ -1987,17 +1987,17 @@ namespace linepatterns {
|
||||
return false;
|
||||
}
|
||||
|
||||
void setColor(ePattern id, int col) {
|
||||
void setColor(ePattern id, color_t col) {
|
||||
for(int k=0; patterns[k].lpname; k++)
|
||||
if(patterns[k].id == id) patterns[k].color = col;
|
||||
}
|
||||
|
||||
void switchAlpha(ePattern id, int col) {
|
||||
void switchAlpha(ePattern id, color_t col) {
|
||||
for(int k=0; patterns[k].lpname; k++)
|
||||
if(patterns[k].id == id) patterns[k].color ^= col;
|
||||
}
|
||||
|
||||
void queuelinef(const hyperpoint& h1, const hyperpoint& h2, int col, int par) {
|
||||
void queuelinef(const hyperpoint& h1, const hyperpoint& h2, color_t col, int par) {
|
||||
if(!elliptic)
|
||||
queueline(h1, h2, col, par);
|
||||
else {
|
||||
@ -2012,7 +2012,7 @@ namespace linepatterns {
|
||||
}
|
||||
}
|
||||
|
||||
void drawPattern(int id, int col, cell *c, const transmatrix& V) {
|
||||
void drawPattern(int id, color_t col, cell *c, const transmatrix& V) {
|
||||
|
||||
switch(id) {
|
||||
|
||||
@ -2212,7 +2212,7 @@ namespace linepatterns {
|
||||
transmatrix& V = it->second;
|
||||
|
||||
for(int k=0; patterns[k].lpname; k++) {
|
||||
int col = patterns[k].color;
|
||||
color_t col = patterns[k].color;
|
||||
if(!(col & 255)) continue;
|
||||
int id = patterns[k].id;
|
||||
|
||||
|
@ -14,7 +14,7 @@ int style = 3;
|
||||
struct state50 {
|
||||
bool polarity1;
|
||||
bool polarity2;
|
||||
int color, color2, wc2;
|
||||
color_t color, color2, wc2;
|
||||
};
|
||||
|
||||
void progress(cell *c, state50 s);
|
||||
@ -173,7 +173,7 @@ void patternFiftyAt(cell *c) {
|
||||
int sgn = s.polarity2 ? 1 : -1;
|
||||
int sgn1 = s.polarity1 ? 1 : -1;
|
||||
|
||||
int col2 = s.color2, sw = s.wc2;
|
||||
color_t col2 = s.color2, sw = s.wc2;
|
||||
|
||||
while(col2 != 7-s.color) {
|
||||
sw += (s.polarity1?1:-1); sw %= 7;
|
||||
|
633
polygons.cpp
633
polygons.cpp
File diff suppressed because it is too large
Load Diff
@ -184,7 +184,7 @@ renderbuffer::~renderbuffer() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void renderbuffer::clear(int col) {
|
||||
void renderbuffer::clear(color_t col) {
|
||||
#if CAP_GL
|
||||
if(FramebufferName) {
|
||||
setGLProjection(0);
|
||||
|
@ -288,11 +288,6 @@ ld alphaof(hyperpoint h) {
|
||||
return atan2(h[1], h[0]);
|
||||
}
|
||||
|
||||
struct bantar_special {
|
||||
polytodraw *actual;
|
||||
ld xpos, ypos;
|
||||
};
|
||||
|
||||
#define ForInfos for(auto& cci: infos)
|
||||
|
||||
void bantar_frame() {
|
||||
@ -308,7 +303,7 @@ void bantar_frame() {
|
||||
calcparam();
|
||||
stereo::set_projection(0);
|
||||
|
||||
vector<polytodraw> subscr[4];
|
||||
vector<unique_ptr<drawqueueitem>> subscr[4];
|
||||
|
||||
compute_graphical_distance();
|
||||
|
||||
@ -399,14 +394,14 @@ void bantar_frame() {
|
||||
subscr[i] = move(ptds);
|
||||
}
|
||||
|
||||
map<int, map<int, vector<polytodraw>>> xptds;
|
||||
map<int, map<int, vector<unique_ptr<drawqueueitem>>>> xptds;
|
||||
for(int i=0; i<4; i++) for(auto& p: subscr[i])
|
||||
xptds[int(p.prio)][i].push_back(p);
|
||||
xptds[int(p->prio)][i].push_back(move(p));
|
||||
|
||||
for(auto& sm: xptds) for(auto& sm2: sm.second) {
|
||||
int i = sm2.first;
|
||||
ptds.clear();
|
||||
for(auto& p: sm2.second) ptds.push_back(p);
|
||||
for(auto& p: sm2.second) ptds.push_back(move(p));
|
||||
|
||||
vid.scale = .5;
|
||||
vid.xposition = (!(i&2)) ? xdst : -xdst;
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
namespace rogueviz { namespace kohonen {
|
||||
|
||||
int cols;
|
||||
int columns;
|
||||
|
||||
typedef vector<double> kohvec;
|
||||
|
||||
@ -28,7 +28,7 @@ struct neuron {
|
||||
cell *where;
|
||||
double udist;
|
||||
int lpbak;
|
||||
int col;
|
||||
color_t col;
|
||||
int allsamples, drawn_samples, csample, bestsample, max_group_here;
|
||||
neuron() { drawn_samples = allsamples = bestsample = 0; max_group_here = max_group; }
|
||||
};
|
||||
@ -41,7 +41,7 @@ vector<neuron> net;
|
||||
|
||||
int neuronId(neuron& n) { return &n - &(net[0]); }
|
||||
|
||||
void alloc(kohvec& k) { k.resize(cols); }
|
||||
void alloc(kohvec& k) { k.resize(columns); }
|
||||
|
||||
bool neurons_indexed = false;
|
||||
|
||||
@ -53,7 +53,7 @@ vector<neuron*> whowon;
|
||||
|
||||
void normalize() {
|
||||
alloc(weights);
|
||||
for(int k=0; k<cols; k++) {
|
||||
for(int k=0; k<columns; k++) {
|
||||
double sum = 0, sqsum = 0;
|
||||
for(sample& s: data)
|
||||
sum += s.val[k],
|
||||
@ -65,7 +65,7 @@ void normalize() {
|
||||
|
||||
double vnorm(kohvec& a, kohvec& b) {
|
||||
double diff = 0;
|
||||
for(int k=0; k<cols; k++) diff += sqr((a[k]-b[k]) * weights[k]);
|
||||
for(int k=0; k<columns; k++) diff += sqr((a[k]-b[k]) * weights[k]);
|
||||
return diff;
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ void loadsamples(const string& fname) {
|
||||
fprintf(stderr, "Could not load samples: %s\n", fname.c_str());
|
||||
return;
|
||||
}
|
||||
if(fscanf(f, "%d", &cols) != 1) {
|
||||
if(fscanf(f, "%d", &columns) != 1) {
|
||||
printf("Bad format: %s\n", fname.c_str());
|
||||
fclose(f); return;
|
||||
}
|
||||
@ -92,7 +92,7 @@ void loadsamples(const string& fname) {
|
||||
bool shown = false;
|
||||
alloc(s.val);
|
||||
if(feof(f)) break;
|
||||
for(int i=0; i<cols; i++)
|
||||
for(int i=0; i<columns; i++)
|
||||
if(fscanf(f, "%lf", &s.val[i]) != 1) { goto bigbreak; }
|
||||
fgetc(f);
|
||||
while(true) {
|
||||
@ -109,8 +109,8 @@ void loadsamples(const string& fname) {
|
||||
fclose(f);
|
||||
samples = isize(data);
|
||||
normalize();
|
||||
colnames.resize(cols);
|
||||
for(int i=0; i<cols; i++) colnames[i] = "Column " + its(i);
|
||||
colnames.resize(columns);
|
||||
for(int i=0; i<columns; i++) colnames[i] = "Column " + its(i);
|
||||
uninit(0); sominit(1);
|
||||
}
|
||||
|
||||
@ -184,8 +184,9 @@ void coloring() {
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0; i<cells; i++)
|
||||
part(net[i].where->landparam, pid) = part(vdata[net[i].bestsample].cp.color1, pid+1);
|
||||
for(int i=0; i<cells; i++) {
|
||||
part(net[i].where->landparam_color, pid) = part(vdata[net[i].bestsample].cp.color1, pid+1);
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
@ -220,7 +221,7 @@ void coloring() {
|
||||
if(maxl-minl < 1e-3) maxl = minl+1e-3;
|
||||
|
||||
for(int i=0; i<cells; i++)
|
||||
part(net[i].where->landparam, pid) = (255 * (listing[i] - minl)) / (maxl - minl);
|
||||
part(net[i].where->landparam_color, pid) = (255 * (listing[i] - minl)) / (maxl - minl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -534,7 +535,7 @@ void step() {
|
||||
// nu *= exp(-t*(double)maxdist/perdist);
|
||||
// nu *= exp(-t/t2);
|
||||
nu *= exp(-sqr(d/sigma));
|
||||
for(int k=0; k<cols; k++)
|
||||
for(int k=0; k<columns; k++)
|
||||
n2.net[k] += nu * (irisdata[id][k] - n2.net[k]);
|
||||
} */
|
||||
|
||||
@ -555,7 +556,7 @@ void step() {
|
||||
else
|
||||
nu *= *(it++);
|
||||
|
||||
for(int k=0; k<cols; k++)
|
||||
for(int k=0; k<columns; k++)
|
||||
n2->net[k] += nu * (data[id].val[k] - n2->net[k]);
|
||||
}
|
||||
|
||||
@ -659,7 +660,7 @@ void sominit(int initto) {
|
||||
net[i].where->land = laCanvas;
|
||||
alloc(net[i].net);
|
||||
|
||||
for(int k=0; k<cols; k++)
|
||||
for(int k=0; k<columns; k++)
|
||||
for(int z=0; z<initdiv; z++)
|
||||
net[i].net[k] += data[hrand(samples)].val[k] / initdiv;
|
||||
}
|
||||
@ -720,7 +721,7 @@ void describe_cell(cell *c) {
|
||||
neuron *n = getNeuronSlow(c);
|
||||
if(!n) return;
|
||||
help += "cell number: " + its(neuronId(*n)) + " (" + its(n->allsamples) + ")\n";
|
||||
help += "parameters:"; for(int k=0; k<cols; k++) help += " " + fts(n->net[k]);
|
||||
help += "parameters:"; for(int k=0; k<columns; k++) help += " " + fts(n->net[k]);
|
||||
help += ", u-matrix = " + fts(n->udist);
|
||||
help += "\n";
|
||||
vector<pair<double, int>> v;
|
||||
@ -731,7 +732,7 @@ void describe_cell(cell *c) {
|
||||
for(int i=0; i<isize(v) && i<20; i++) {
|
||||
int s = v[i].second;
|
||||
help += "sample "+its(s)+":";
|
||||
for(int k=0; k<cols; k++) help += " " + fts(data[s].val[k]);
|
||||
for(int k=0; k<columns; k++) help += " " + fts(data[s].val[k]);
|
||||
help += " "; help += data[s].name; help += "\n";
|
||||
}
|
||||
}
|
||||
@ -740,7 +741,7 @@ namespace levelline {
|
||||
|
||||
struct levelline {
|
||||
int column, qty;
|
||||
unsigned int color;
|
||||
color_t color;
|
||||
vector<double> values;
|
||||
bool modified;
|
||||
};
|
||||
@ -751,7 +752,7 @@ namespace levelline {
|
||||
|
||||
void create() {
|
||||
int xlalpha = part(default_edgetype.color, 0);
|
||||
for(int i=0; i<cols; i++) {
|
||||
for(int i=0; i<columns; i++) {
|
||||
levellines.emplace_back();
|
||||
levelline& lv = levellines.back();
|
||||
lv.column = i;
|
||||
@ -874,7 +875,7 @@ void ksave(const string& fname) {
|
||||
}
|
||||
fprintf(f, "%d %d\n", cells, t);
|
||||
for(neuron& n: net) {
|
||||
for(int k=0; k<cols; k++)
|
||||
for(int k=0; k<columns; k++)
|
||||
fprintf(f, "%.9lf ", n.net[k]);
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
@ -899,7 +900,7 @@ void kload(const string& fname) {
|
||||
exit(1);
|
||||
}
|
||||
for(neuron& n: net) {
|
||||
for(int k=0; k<cols; k++) if(fscanf(f, "%lf", &n.net[k]) != 1) return;
|
||||
for(int k=0; k<columns; k++) if(fscanf(f, "%lf", &n.net[k]) != 1) return;
|
||||
}
|
||||
fclose(f);
|
||||
analyze();
|
||||
@ -913,7 +914,7 @@ void ksavew(const string& fname) {
|
||||
return;
|
||||
}
|
||||
printf("Saving the network to %s...\n", fname.c_str());
|
||||
for(int i=0; i<cols; i++)
|
||||
for(int i=0; i<columns; i++)
|
||||
fprintf(f, "%s=%.9lf\n", colnames[i].c_str(), weights[i]);
|
||||
fclose(f);
|
||||
}
|
||||
@ -925,7 +926,7 @@ void kloadw(const string& fname) {
|
||||
fprintf(stderr, "Could not load the weights\n");
|
||||
return;
|
||||
}
|
||||
for(int i=0; i<cols; i++) {
|
||||
for(int i=0; i<columns; i++) {
|
||||
string s1, s2;
|
||||
char kind = 0;
|
||||
while(true) {
|
||||
@ -1122,12 +1123,12 @@ void klistsamples(const string& fname_samples, bool best, bool colorformat) {
|
||||
fprintf(f, "%s;+#%d\n", data[id].name.c_str(), neu);
|
||||
}
|
||||
else {
|
||||
for(int k=0; k<cols; k++)
|
||||
for(int k=0; k<columns; k++)
|
||||
fprintf(f, "%.4lf ", data[id].val[k]);
|
||||
fprintf(f, "!%s\n", data[id].name.c_str());
|
||||
}
|
||||
};
|
||||
if(!colorformat) fprintf(f, "%d\n", cols);
|
||||
if(!colorformat) fprintf(f, "%d\n", columns);
|
||||
if(best)
|
||||
for(int n=0; n<cells; n++) {
|
||||
if(!net[n].allsamples && !net[n].drawn_samples) { if(!colorformat) fprintf(f, "\n"); continue; }
|
||||
@ -1188,7 +1189,7 @@ bool handleMenu(int sym, int uni) {
|
||||
if(uni >= '1' && uni <= '3') {
|
||||
int i = uni - '1';
|
||||
whattodraw[i]++;
|
||||
if(whattodraw[i] == cols) whattodraw[i] = -5;
|
||||
if(whattodraw[i] == columns) whattodraw[i] = -5;
|
||||
coloring();
|
||||
return true;
|
||||
}
|
||||
|
21
rogueviz.cpp
21
rogueviz.cpp
@ -1056,14 +1056,14 @@ void queuedisk(const transmatrix& V, const colorpair& cp, bool legend, const str
|
||||
int p = poly_outline; poly_outline = OUTLINE_TRANS;
|
||||
queuepolyat(V, sh, 0x80, PPR::MONSTER_SHADOW);
|
||||
poly_outline = p;
|
||||
if(info) queuelink(info, PPR::MONSTER_HEAD);
|
||||
if(info) queueaction(PPR::MONSTER_HEAD, [info] () { svg::link = *info; });
|
||||
queuepolyat(V1 = mscale(V, geom3::BODY), sh, cp.color1, PPR::MONSTER_HEAD);
|
||||
if(info) queuelink(NULL, PPR::MONSTER_HEAD);
|
||||
if(info) queueaction(PPR::MONSTER_HEAD, [info] () { svg::link = ""; });
|
||||
}
|
||||
else {
|
||||
if(info) queuelink(info, sh.prio);
|
||||
if(info) queueaction(PPR::MONSTER_HEAD, [info] () { svg::link = *info; });
|
||||
queuepoly(V1 = V, sh, cp.color1);
|
||||
if(info) queuelink(NULL, sh.prio);
|
||||
if(info) queueaction(PPR::MONSTER_HEAD, [info] () { svg::link = ""; });
|
||||
}
|
||||
if(cp.shade == 't') queuepoly(V1, shDiskT, cp.color2);
|
||||
if(cp.shade == 's') queuepoly(V1, shDiskS, cp.color2);
|
||||
@ -1116,7 +1116,7 @@ bool drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
|
||||
if(ei->lastdraw < frameid || multidraw) {
|
||||
ei->lastdraw = frameid;
|
||||
|
||||
int col = ei->type->color;
|
||||
color_t col = ei->type->color;
|
||||
auto& alpha = part(col, 0);
|
||||
|
||||
if(kind == kSAG) {
|
||||
@ -1173,14 +1173,12 @@ bool drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
|
||||
hyperpoint l1 = T*tC0(spiral::at(1+ei->i));
|
||||
for(int z=1; z<=prec; z++) {
|
||||
hyperpoint l2 = T*tC0(spiral::at(1+ei->i+(ei->j-ei->i) * z / (prec+.0)));
|
||||
queueline(l1, l2, col, vid.linequality);
|
||||
queueline(l1, l2, col, vid.linequality).prio = PPR::STRUCT0;
|
||||
l1 = l2;
|
||||
lastptd().prio = PPR::STRUCT0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
queueline(h1, h2, col, 2 + vid.linequality);
|
||||
lastptd().prio = PPR::STRUCT0;
|
||||
queueline(h1, h2, col, 2 + vid.linequality).prio = PPR::STRUCT0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1233,9 +1231,10 @@ bool drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
|
||||
hyperpoint h = tC0(V * m->at);
|
||||
transmatrix V2 = rgpushxto0(h) * ypush(PURE ? .3 : .2); // todo-variation
|
||||
if(doshow && !behindsphere(V2)) {
|
||||
if(vd.info) queuelink(vd.info, PPR::TEXT);
|
||||
auto info = vd.info;
|
||||
if(info) queueaction(PPR::MONSTER_HEAD, [info] () { svg::link = *info; });
|
||||
queuestr(V2, (svg::in ? .28 : .2) * crossf / hcrossf, vd.name, backcolor ? 0x000000 : 0xFFFF00, svg::in ? 0 : 1);
|
||||
if(vd.info) queuelink(NULL, PPR::TEXT);
|
||||
if(info) queueaction(PPR::MONSTER_HEAD, [info] () { svg::link = ""; });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,9 +32,9 @@ namespace rogueviz {
|
||||
};
|
||||
|
||||
struct colorpair {
|
||||
int color1, color2;
|
||||
color_t color1, color2;
|
||||
char shade;
|
||||
colorpair(int col = 0xC0C0C0FF) { shade = 0; color1 = col; }
|
||||
colorpair(color_t col = 0xC0C0C0FF) { shade = 0; color1 = col; }
|
||||
};
|
||||
|
||||
struct vertexdata {
|
||||
|
@ -202,7 +202,7 @@ void show() {
|
||||
for(int i=0; i<POSSCORE; i++) S.box[i] = savebox[i];
|
||||
S.box[0] = S.box[65];
|
||||
}
|
||||
int col = cur ? 0xFFD500 : 0xC0C0C0;
|
||||
color_t col = cur ? 0xFFD500 : 0xC0C0C0;
|
||||
|
||||
|
||||
rank++;
|
||||
|
@ -15,13 +15,13 @@ namespace svg {
|
||||
FILE *f;
|
||||
bool in = false;
|
||||
|
||||
ld cta(int col) {
|
||||
ld cta(color_t col) {
|
||||
// col >>= 24;
|
||||
col &= 0xFF;
|
||||
return col / 255.0;
|
||||
}
|
||||
|
||||
bool invisible(int col) { return (col & 0xFF) == 0; }
|
||||
bool invisible(color_t col) { return (col & 0xFF) == 0; }
|
||||
|
||||
ld gamma = .5;
|
||||
|
||||
@ -71,7 +71,7 @@ namespace svg {
|
||||
return buf;
|
||||
}
|
||||
|
||||
void circle(int x, int y, int size, int col) {
|
||||
void circle(int x, int y, int size, color_t col) {
|
||||
int ba = (backcolor << 8) + 0xFF;
|
||||
if(!invisible(col)) {
|
||||
if(vid.stretch == 1)
|
||||
@ -83,19 +83,19 @@ namespace svg {
|
||||
}
|
||||
}
|
||||
|
||||
const string *link;
|
||||
string link;
|
||||
|
||||
void startstring() {
|
||||
if(link) fprintf(f, "<a xlink:href=\"%s\" xlink:show=\"replace\">", link->c_str());
|
||||
if(link != "") fprintf(f, "<a xlink:href=\"%s\" xlink:show=\"replace\">", link.c_str());
|
||||
}
|
||||
|
||||
void stopstring() {
|
||||
if(link) fprintf(f, "</a>");
|
||||
if(link != "") fprintf(f, "</a>");
|
||||
}
|
||||
|
||||
string font = "Times";
|
||||
|
||||
void text(int x, int y, int size, const string& str, bool frame, int col, int align) {
|
||||
void text(int x, int y, int size, const string& str, bool frame, color_t col, int align) {
|
||||
|
||||
double dfc = (x - vid.xcenter) * (x - vid.xcenter) +
|
||||
(y - vid.ycenter) * (y - vid.ycenter);
|
||||
@ -136,7 +136,7 @@ namespace svg {
|
||||
}
|
||||
}
|
||||
|
||||
void polygon(int *polyx, int *polyy, int polyi, int col, int outline, double linewidth) {
|
||||
void polygon(int *polyx, int *polyy, int polyi, color_t col, int outline, double linewidth) {
|
||||
|
||||
if(invisible(col) && invisible(outline)) return;
|
||||
if(polyi < 2) return;
|
||||
@ -297,7 +297,7 @@ void saveHighQualityShot(const char *fname, const char *caption, int fade) {
|
||||
if(fade < 255)
|
||||
for(int y=0; y<vid.yres; y++)
|
||||
for(int x=0; x<vid.xres; x++) {
|
||||
int& p = qpixel(s, x, y);
|
||||
color_t& p = qpixel(s, x, y);
|
||||
for(int i=0; i<3; i++) {
|
||||
part(p,i) = (part(p,i) * fade + 127) / 255;
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ void id_modelview() {
|
||||
|
||||
#endif
|
||||
|
||||
void color2(int color, ld part) {
|
||||
void color2(color_t color, ld part) {
|
||||
unsigned char *c = (unsigned char*) (&color);
|
||||
GLfloat cols[4];
|
||||
for(int i=0; i<4; i++) cols[i] = c[3-i] / 255.0 * part;
|
||||
@ -312,7 +312,7 @@ void color2(int color, ld part) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void colorClear(int color) {
|
||||
void colorClear(color_t color) {
|
||||
unsigned char *c = (unsigned char*) (&color);
|
||||
glClearColor(c[3] / 255.0, c[2] / 255.0, c[1]/255.0, c[0] / 255.0);
|
||||
}
|
||||
|
@ -3202,7 +3202,7 @@ bool drawMonster(const transmatrix& V, cell *c, const transmatrix*& Vboat, trans
|
||||
|
||||
break;
|
||||
case moBullet: {
|
||||
int col;
|
||||
color_t col;
|
||||
cpid = m->pid;
|
||||
if(m->parenttype == moPlayer)
|
||||
col = getcs().swordcolor;
|
||||
@ -3249,7 +3249,7 @@ bool drawMonster(const transmatrix& V, cell *c, const transmatrix*& Vboat, trans
|
||||
|
||||
default:
|
||||
if(m->inBoat) m->footphase = 0;
|
||||
int col = minf[m->type].color;
|
||||
color_t col = minf[m->type].color;
|
||||
if(m->type == moMimic)
|
||||
col = mirrorcolor(det(view) < 0);
|
||||
if(m->type == moSlime) {
|
||||
|
34
textures.cpp
34
textures.cpp
@ -49,7 +49,7 @@ template<class T, class U> void scale_colorarray(int origdim, int targetdim, con
|
||||
|
||||
while(tx < targetdim) {
|
||||
int fv = min(omissing, tmissing);
|
||||
int c = src(ox);
|
||||
color_t c = src(ox);
|
||||
for(int p=0; p<4; p++)
|
||||
partials[p] += part(c, p) * fv;
|
||||
omissing -= fv; tmissing -= fv;
|
||||
@ -57,7 +57,7 @@ template<class T, class U> void scale_colorarray(int origdim, int targetdim, con
|
||||
ox++; omissing = targetdim;
|
||||
}
|
||||
if(tmissing == 0) {
|
||||
int target;
|
||||
color_t target;
|
||||
for(int p=0; p<4; p++) {
|
||||
part(target, p) = partials[p] / origdim;
|
||||
partials[p] = 0;
|
||||
@ -151,7 +151,7 @@ bool texture_data::readtexture(string tn) {
|
||||
// read png
|
||||
vector<png_bytep> row_pointers(ty);
|
||||
|
||||
vector<int> origpixels(ty * tx);
|
||||
vector<color_t> origpixels(ty * tx);
|
||||
|
||||
for(int y = 0; y < ty; y++)
|
||||
row_pointers[y] = (png_bytep) & origpixels[y * tx];
|
||||
@ -163,7 +163,7 @@ bool texture_data::readtexture(string tn) {
|
||||
swap(part(origpixels[i], 0), part(origpixels[i], 2));
|
||||
|
||||
auto pix = [&] (int x, int y) {
|
||||
if(x<0 || y<0 || x >= tx || y >= ty) return 0;
|
||||
if(x<0 || y<0 || x >= tx || y >= ty) return (color_t) 0;
|
||||
return origpixels[y*tx + x];
|
||||
};
|
||||
|
||||
@ -316,7 +316,7 @@ void texture_config::mapTexture2(textureinfo& mi) {
|
||||
mapTextureTriangle(mi, t.v, t.tv);
|
||||
}
|
||||
|
||||
int texture_config::recolor(int col) {
|
||||
int texture_config::recolor(color_t col) {
|
||||
if(color_alpha == 0) return col;
|
||||
for(int i=1; i<4; i++)
|
||||
part(col, i) = color_alpha + ((255-color_alpha) * part(col,i) + 127) / 255;
|
||||
@ -329,15 +329,15 @@ bool using_aura() {
|
||||
return texture_aura && config.tstate == texture::tsActive;
|
||||
}
|
||||
|
||||
bool texture_config::apply(cell *c, const transmatrix &V, int col) {
|
||||
bool texture_config::apply(cell *c, const transmatrix &V, color_t col) {
|
||||
if(config.tstate == tsOff || !correctly_mapped) return false;
|
||||
|
||||
using namespace patterns;
|
||||
auto si = getpatterninfo0(c);
|
||||
|
||||
if(config.tstate == tsAdjusting) {
|
||||
dynamicval<color_t> d(poly_outline, slave_color);
|
||||
draw_floorshape(c, V, shFullFloor, 0, PPR::LINE);
|
||||
lastptd().u.poly.outline = slave_color;
|
||||
|
||||
curvepoint(V * C0);
|
||||
for(int i=0; i<c->type; i++)
|
||||
@ -354,8 +354,8 @@ bool texture_config::apply(cell *c, const transmatrix &V, int col) {
|
||||
qfi.spin = applyPatterndir(c, si);
|
||||
|
||||
if(grid_color) {
|
||||
dynamicval<color_t> d(poly_outline, grid_color);
|
||||
draw_floorshape(c, V, shFullFloor, 0, PPR::FLOOR);
|
||||
lastptd().u.poly.outline = grid_color;
|
||||
}
|
||||
|
||||
if(using_aura()) {
|
||||
@ -472,8 +472,8 @@ void texture_config::finish_mapping() {
|
||||
|
||||
void texture_config::saveFullTexture(string tn) {
|
||||
addMessage(XLAT("Saving full texture to %1...", tn));
|
||||
dynamicval<unsigned> dd(grid_color, 0);
|
||||
dynamicval<unsigned> dm(mesh_color, 0);
|
||||
dynamicval<color_t> dd(grid_color, 0);
|
||||
dynamicval<color_t> dm(mesh_color, 0);
|
||||
dynamicval<ld> dx(vid.xposition, 0);
|
||||
dynamicval<ld> dy(vid.yposition, 0);
|
||||
dynamicval<ld> dvs(vid.scale, (pmodel == mdDisk && !euclid) ? 1 : vid.scale);
|
||||
@ -1339,7 +1339,7 @@ void texture_data::undoLock() {
|
||||
undos.emplace_back(nullptr, 1);
|
||||
}
|
||||
|
||||
void filltriangle(const array<hyperpoint, 3>& v, const array<point, 3>& p, int col, int lev) {
|
||||
void filltriangle(const array<hyperpoint, 3>& v, const array<point, 3>& p, color_t col, int lev) {
|
||||
|
||||
int d2 = texture_distance(p[0], p[1]), d1 = texture_distance(p[0], p[2]), d0 = texture_distance(p[1], p[2]);
|
||||
|
||||
@ -1363,7 +1363,7 @@ void filltriangle(const array<hyperpoint, 3>& v, const array<point, 3>& p, int c
|
||||
filltriangle(make_array(v[c], v[b], v3), make_array(p[c], p[b], p3), col, lev+1);
|
||||
}
|
||||
|
||||
void splitseg(const transmatrix& A, const array<ld, 2>& angles, const array<hyperpoint, 2>& h, const array<point, 2>& p, int col, int lev) {
|
||||
void splitseg(const transmatrix& A, const array<ld, 2>& angles, const array<hyperpoint, 2>& h, const array<point, 2>& p, color_t col, int lev) {
|
||||
ld newangle = (angles[0] + angles[1]) / 2;
|
||||
hyperpoint nh = A * xspinpush0(newangle, penwidth);
|
||||
auto np = ptc(nh);
|
||||
@ -1377,7 +1377,7 @@ void splitseg(const transmatrix& A, const array<ld, 2>& angles, const array<hype
|
||||
}
|
||||
}
|
||||
|
||||
void fillcircle(hyperpoint h, int col) {
|
||||
void fillcircle(hyperpoint h, color_t col) {
|
||||
transmatrix A = rgpushxto0(h);
|
||||
|
||||
ld step = M_PI * 2/3;
|
||||
@ -1396,7 +1396,7 @@ void fillcircle(hyperpoint h, int col) {
|
||||
|
||||
bool texturesym = false;
|
||||
|
||||
void actDrawPixel(cell *c, hyperpoint h, int col) {
|
||||
void actDrawPixel(cell *c, hyperpoint h, color_t col) {
|
||||
try {
|
||||
transmatrix M = gmatrix.at(c);
|
||||
auto si = patterns::getpatterninfo0(c);
|
||||
@ -1411,13 +1411,13 @@ void actDrawPixel(cell *c, hyperpoint h, int col) {
|
||||
catch(out_of_range&) {}
|
||||
}
|
||||
|
||||
void drawPixel(cell *c, hyperpoint h, int col) {
|
||||
void drawPixel(cell *c, hyperpoint h, color_t col) {
|
||||
config.data.pixels_to_draw.emplace_back(c, h, col);
|
||||
}
|
||||
|
||||
cell *where;
|
||||
|
||||
void drawPixel(hyperpoint h, int col) {
|
||||
void drawPixel(hyperpoint h, color_t col) {
|
||||
try {
|
||||
again:
|
||||
transmatrix g0 = gmatrix[where];
|
||||
@ -1439,7 +1439,7 @@ void drawPixel(hyperpoint h, int col) {
|
||||
catch(out_of_range&) {}
|
||||
}
|
||||
|
||||
void drawLine(hyperpoint h1, hyperpoint h2, int col, int steps) {
|
||||
void drawLine(hyperpoint h1, hyperpoint h2, color_t col, int steps) {
|
||||
if(steps > 0 && hdist(h1, h2) > penwidth / 3) {
|
||||
hyperpoint h3 = mid(h1, h2);
|
||||
drawLine(h1, h3, col, steps-1);
|
||||
|
@ -702,7 +702,7 @@ namespace tactic {
|
||||
eLand l = landlist[i1];
|
||||
|
||||
int i0 = 56 + i * vf;
|
||||
int col;
|
||||
color_t col;
|
||||
|
||||
int ch = chances(l);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user