1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

removed function fixdir

This commit is contained in:
Zeno Rogue 2019-08-09 14:39:21 +02:00
parent b57c4c8d4e
commit f4eda1d76e
7 changed files with 14 additions and 17 deletions

View File

@ -12,8 +12,6 @@ int dirdiff(int dd, int t) {
return dd;
}
int fixdir(int a, cell *c) { a %= c->type; if(a<0) a += c->type; return a; }
int cellcount = 0;
void initcell(cell *c); // from game.cpp

View File

@ -142,13 +142,13 @@ void calcMousedest() {
for(int i=0; i<cwt.at->type; i++) if(dists[i] < mousedist) {
mousedist = dists[i];
mousedest.d = fixdir(i - cwt.spin, cwt.at);
mousedest.d = cwt.at->c.fix(i - cwt.spin);
mousedest.subdir =
dists[(i+1)%cwt.at->type] < dists[(i+cwt.at->type-1)%cwt.at->type] ? 1 : -1;
dists[cwt.at->c.fix(i+1)] < dists[cwt.at->c.fix(i-1)] ? 1 : -1;
if(cwt.mirrored)
mousedest.d = fixdir(-mousedest.d, cwt.at),
mousedest.d = cwt.at->c.fix(-mousedest.d),
mousedest.subdir = -mousedest.subdir;
}

View File

@ -346,8 +346,8 @@ void geometry_information::generate_floorshapes_for(int id, cell *c, int siid, i
for(int i=0; i<cor; i++) {
int ri = i;
if((i&1) == ((sidir+siid)&1)) ri--;
ri = fixdir(ri, c);
cornerlist.push_back(mid(get_corner_position(c, ri, 3.1), get_corner_position(c, (ri+1) % c->type, 3.1)));
ri = c->c.fix(ri);
cornerlist.push_back(mid(get_corner_position(c, ri, 3.1), get_corner_position(c, c->c.fix(ri+1), 3.1)));
}
}
}
@ -360,7 +360,7 @@ void geometry_information::generate_floorshapes_for(int id, cell *c, int siid, i
for(int i=0; i<cor; i++) {
int ri = i;
if((i&1) != ((sidir+siid)&1)) ri--;
ri = fixdir(ri, c);
ri = c->c.fix(ri);
hyperpoint nc = nearcorner(c, ri);
cornerlist.push_back(mid_at(hpxy(0,0), nc, .94));
}
@ -701,8 +701,8 @@ namespace gp {
siid = si.id>>2;
// if(siid == 2) si.dir++;
// if(siid != pattern_threecolor(c)) printf("threecolor mismatch\n");
// if(pattern_threecolor(createMov(c, fixdir(si.dir, c))) != (siid+1)%3) printf("threecolor mismatch direction\n");
sidir = fixdir(si.dir, c);
// if(pattern_threecolor(createMov(c, c->fixd(si.dir))) != (siid+1)%3) printf("threecolor mismatch direction\n");
sidir = c->c.fix(si.dir);
}
else if(geosupport_football() == 2) {
siid = !pseudohept(c);

View File

@ -232,8 +232,8 @@ namespace hr { namespace gp {
}
// c move 0 equals c' move spin(0)
extend_map(c, d);
extend_map(c, fixdir(d-1, c));
extend_map(c, fixdir(d+1, c));
extend_map(c, c->c.fix(d-1));
extend_map(c, c->c.fix(d+1));
if(S3 == 4 && !c->move(d))
for(int i=0; i<S7; i++)
for(int j=0; j<S7; j++)
@ -837,7 +837,7 @@ namespace hr { namespace gp {
auto dmain = master_function(cm);
auto d0 = master_function(createStep(cm->master, i)->c7);
auto d1 = master_function(createStep(cm->master, fixdir(i+1, cm))->c7);
auto d1 = master_function(createStep(cm->master, cm->c.fix(i+1))->c7);
if(S3 == 4) {
heptspin hs(cm->master, i);

View File

@ -4131,7 +4131,6 @@ struct hpcshape {
extern vector<hpcshape> shPlainWall3D, shWireframe3D, shWall3D, shMiniWall3D;
#endif
int fixdir(int a, cell *c);
cell *newCell(int type, heptagon *master);
extern color_t qpixel_pixel_outside;

View File

@ -895,7 +895,7 @@ namespace mapeditor {
for(cell* c2: cl.lst) {
auto si2 = patterns::getpatterninfo0(c2);
if(si2.id == si.id) {
editAt(cellwalker(c2, cdir>=0 ? fixdir(cdir + si2.dir, c2) : -1), cl);
editAt(cellwalker(c2, cdir>=0 ? cdir + si2.dir : -1), cl);
modelcell[si2.id] = c2;
}
}

View File

@ -921,8 +921,8 @@ namespace patterns {
#endif
#if CAP_GP
else if(GOLDBERG) {
if(c == c->master->c7) si.id += (fixdir(si.dir, c) << 8);
else si.id += (get_code(gp::get_local_info(c)) << 16) | (fixdir(si.dir, c) << 8);
if(c == c->master->c7) si.id += (c->c.fix(si.dir) << 8);
else si.id += (get_code(gp::get_local_info(c)) << 16) | (c->c.fix(si.dir) << 8);
}
#endif
return si;