1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-09-03 11:17:56 +00:00

Merge branch 'master' into hooks-naming

This commit is contained in:
Zeno Rogue
2020-04-19 13:39:07 +02:00
committed by GitHub
62 changed files with 3910 additions and 2984 deletions

View File

@@ -65,7 +65,6 @@ struct texture_data {
struct texture_config {
string texturename;
string configname;
color_t paint_color;
eTextureState tstate;
eTextureState tstate_max;
@@ -121,7 +120,6 @@ struct texture_config {
texturename = "textures/hyperrogue-texture.png";
configname = "textures/hyperrogue.txc";
itt = Id;
paint_color = 0x000000FF;
grid_color = 0;
mesh_color = 0;
master_color = 0xFFFFFF30;
@@ -355,7 +353,7 @@ hyperpoint texture_config::texture_coordinates(hyperpoint h) {
hyperpoint inmodel;
applymodel(h, inmodel);
inmodel[0] *= current_display->radius * 1. / current_display->scrsize;
inmodel[1] *= current_display->radius * vid.stretch / current_display->scrsize;
inmodel[1] *= current_display->radius * pconf.stretch / current_display->scrsize;
inmodel[2] = 1;
inmodel = itt * inmodel;
inmodel[0] = (inmodel[0] + 1) / 2;
@@ -531,7 +529,7 @@ void texture_config::mark_triangles() {
}
}
static const auto current_texture_parameters = tie(geometry, variation, patterns::whichPattern, patterns::subpattern_flags, pmodel, vid.scale, vid.alpha);
static const auto current_texture_parameters = tie(geometry, variation, patterns::whichPattern, patterns::subpattern_flags, pmodel, pconf.scale, pconf.alpha);
void texture_config::clear_texture_map() {
texture_map.clear();
@@ -624,9 +622,9 @@ void texture_config::saveFullTexture(string tn) {
addMessage(XLAT("Saving full texture to %1...", tn));
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);
dynamicval<ld> dx(pconf.xposition, 0);
dynamicval<ld> dy(pconf.yposition, 0);
dynamicval<ld> dvs(pconf.scale, (pmodel == mdDisk && !euclid) ? 1 : pconf.scale);
dynamicval<bool> dro(rug::rugged, false);
dynamicval<bool> dnh(nohud, true);
texture::saving = true;
@@ -741,9 +739,9 @@ struct magic_param {
void apply(ld delta) {
if(have_mp(mpProjection))
vid.alpha *= exp(delta * proj);
pconf.alpha *= exp(delta * proj);
if(have_mp(mpScale))
vid.scale *= exp(delta * scale);
pconf.scale *= exp(delta * scale);
if(do_spin) {
if(have_mp(mpRotate))
@@ -853,7 +851,7 @@ void mousemovement() {
// do not zoom in portrait!
if(nonzero && !newmove) {
View = inverse(spintox(mouseeu)) * spintox(lastmouse) * View;
vid.scale = vid.scale * sqhypot_d(2, mouseeu) / sqhypot_d(2, lastmouse);
pconf.scale = pconf.scale * sqhypot_d(2, mouseeu) / sqhypot_d(2, lastmouse);
config.perform_mapping();
}
if(nonzero) lastmouse = mouseeu;
@@ -863,7 +861,7 @@ void mousemovement() {
case tpsProjection: {
if(nonzero && !newmove) {
vid.alpha = vid.alpha * sqhypot_d(2, mouseeu) / sqhypot_d(2, lastmouse);
pconf.alpha = pconf.alpha * sqhypot_d(2, mouseeu) / sqhypot_d(2, lastmouse);
}
if(nonzero) lastmouse = mouseeu;
newmove = false;
@@ -958,9 +956,9 @@ void init_textureconfig() {
addsaverenum(targetgeometry, "geometry", gNormal);
addsaverenum(pmodel, "used model", mdDisk);
addsaver(vid.yshift, "Y shift", 0);
addsaver(vid.yposition, "Y position", 0);
addsaver(vid.xposition, "X position", 0);
addsaver(vid.camera_angle, "camera angle", 0);
addsaver(pconf.yposition, "Y position", 0);
addsaver(pconf.xposition, "X position", 0);
addsaver(pconf.camera_angle, "camera angle", 0);
addsaverenum(targetvariation, "bitruncated", eVariation::bitruncated);
// ... geometry parameters
@@ -977,9 +975,9 @@ void init_textureconfig() {
addsaver(config.color_alpha, "alpha color", 0);
addsaver(config.mesh_color, "mesh color", 0);
addsaver(vid.alpha, "projection", 1);
addsaver(vid.scale, "scale", 1);
addsaver(vid.stretch, "stretch", 1);
addsaver(pconf.alpha, "projection", 1);
addsaver(pconf.scale, "scale", 1);
addsaver(pconf.stretch, "stretch", 1);
addsaver(vid.binary_width, "binary-tiling-width", 1);
addsaver(config.texturename, "texture filename", "");
@@ -1449,8 +1447,6 @@ array<point, 3> ptc(const array<hyperpoint, 3>& h) {
return make_array(ptc(h[0]), ptc(h[1]), ptc(h[2]));
}
EX ld penwidth = .02;
int texture_distance(pair<int, int> p1, pair<int, int> p2) {
return max(abs(p1.first-p2.first), abs(p1.second - p2.second));
}
@@ -1521,7 +1517,7 @@ void filltriangle(const array<hyperpoint, 3>& v, const array<point, 3>& p, color
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);
hyperpoint nh = A * xspinpush0(newangle, mapeditor::dtwidth);
auto np = ptc(nh);
filltriangle(make_array(h[0],h[1],nh), make_array(p[0],p[1],np), col, lev);
@@ -1538,7 +1534,7 @@ void fillcircle(hyperpoint h, color_t col) {
ld step = M_PI * 2/3;
array<hyperpoint, 3> mh = make_array(A * xpush0(penwidth), A * xspinpush0(step, penwidth), A * xspinpush0(-step, penwidth));
array<hyperpoint, 3> mh = make_array(A * xpush0(mapeditor::dtwidth), A * xspinpush0(step, mapeditor::dtwidth), A * xspinpush0(-step, mapeditor::dtwidth));
auto mp = ptc(mh);
filltriangle(mh, mp, col, 0);
@@ -1596,7 +1592,7 @@ EX void drawPixel(hyperpoint h, color_t col) {
}
EX void drawLine(hyperpoint h1, hyperpoint h2, color_t col, int steps IS(10)) {
if(steps > 0 && hdist(h1, h2) > penwidth / 3) {
if(steps > 0 && hdist(h1, h2) > mapeditor::dtwidth / 3) {
hyperpoint h3 = mid(h1, h2);
drawLine(h1, h3, col, steps-1);
drawLine(h3, h2, col, steps-1);