mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
better cellcounting
This commit is contained in:
parent
6635810f35
commit
36fe8dd1d0
1
cell.cpp
1
cell.cpp
@ -21,7 +21,6 @@ void initcell(cell *c); // from game.cpp
|
|||||||
|
|
||||||
cell *newCell(int type, heptagon *master) {
|
cell *newCell(int type, heptagon *master) {
|
||||||
cell *c = new cell;
|
cell *c = new cell;
|
||||||
cellcount++;
|
|
||||||
c->type = type;
|
c->type = type;
|
||||||
c->master = master;
|
c->master = master;
|
||||||
for(int i=0; i<MAX_EDGE; i++) c->mov[i] = NULL;
|
for(int i=0; i<MAX_EDGE; i++) c->mov[i] = NULL;
|
||||||
|
32
hyper.h
32
hyper.h
@ -57,6 +57,8 @@ inline transmatrix operator * (const transmatrix& T, const transmatrix& U) {
|
|||||||
return R;
|
return R;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int cellcount, heptacount;
|
||||||
|
|
||||||
// cell information for the game
|
// cell information for the game
|
||||||
|
|
||||||
struct gcell {
|
struct gcell {
|
||||||
@ -106,6 +108,9 @@ struct gcell {
|
|||||||
} fi;
|
} fi;
|
||||||
|
|
||||||
} LHU;
|
} LHU;
|
||||||
|
|
||||||
|
gcell() { cellcount++; }
|
||||||
|
~gcell() { cellcount--; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define landparam LHU.landpar
|
#define landparam LHU.landpar
|
||||||
@ -160,6 +165,8 @@ struct heptagon {
|
|||||||
// functions
|
// functions
|
||||||
heptagon*& modmove(int i) { return move[fixrot(i)]; }
|
heptagon*& modmove(int i) { return move[fixrot(i)]; }
|
||||||
unsigned char gspin(int i) { return spin(fixrot(i)); }
|
unsigned char gspin(int i) { return spin(fixrot(i)); }
|
||||||
|
heptagon () { heptacount++; }
|
||||||
|
~heptagon () { heptacount--; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct heptspin {
|
struct heptspin {
|
||||||
@ -587,6 +594,7 @@ struct videopar {
|
|||||||
// paramaters calculated from the above
|
// paramaters calculated from the above
|
||||||
int xcenter, ycenter;
|
int xcenter, ycenter;
|
||||||
int radius;
|
int radius;
|
||||||
|
int scrsize;
|
||||||
ld alphax, beta;
|
ld alphax, beta;
|
||||||
|
|
||||||
bool grid;
|
bool grid;
|
||||||
@ -1573,6 +1581,7 @@ namespace sm {
|
|||||||
static const int ZOOMABLE = 4096;
|
static const int ZOOMABLE = 4096;
|
||||||
static const int TORUSCONFIG = 8192;
|
static const int TORUSCONFIG = 8192;
|
||||||
static const int MAYDARK = 16384;
|
static const int MAYDARK = 16384;
|
||||||
|
static const int DIALOG_STRICT_X = 32768; // do not interpret dialog clicks outside of the X region
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace linepatterns {
|
namespace linepatterns {
|
||||||
@ -1956,6 +1965,10 @@ struct textureinfo {
|
|||||||
int texture_id;
|
int texture_id;
|
||||||
vector<GLfloat> vertices;
|
vector<GLfloat> vertices;
|
||||||
vector<GLfloat> tvertices;
|
vector<GLfloat> tvertices;
|
||||||
|
cell *c;
|
||||||
|
|
||||||
|
// these are required to adjust to geometry changes
|
||||||
|
int current_geometry, current_type, symmetries, current_trunc;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct qpoly {
|
struct qpoly {
|
||||||
@ -2320,8 +2333,6 @@ void display(const transmatrix& T);
|
|||||||
transmatrix rgpushxto0(const hyperpoint& H);
|
transmatrix rgpushxto0(const hyperpoint& H);
|
||||||
char *display(const hyperpoint& H);
|
char *display(const hyperpoint& H);
|
||||||
|
|
||||||
extern int cellcount, heptacount;
|
|
||||||
|
|
||||||
string its(int i);
|
string its(int i);
|
||||||
|
|
||||||
double hdist0(const hyperpoint& mh);
|
double hdist0(const hyperpoint& mh);
|
||||||
@ -2358,8 +2369,15 @@ int snake_pair(cell *c);
|
|||||||
|
|
||||||
extern const unsigned int nestcolors[8];
|
extern const unsigned int nestcolors[8];
|
||||||
|
|
||||||
extern bool texture_on;
|
namespace texture {
|
||||||
void showTextureMenu();
|
enum eTextureState {
|
||||||
|
tsOff, tsAdjusting, tsActive
|
||||||
|
};
|
||||||
|
|
||||||
|
extern eTextureState tstate;
|
||||||
|
|
||||||
|
void showMenu();
|
||||||
|
}
|
||||||
|
|
||||||
void queueline(const hyperpoint& H1, const hyperpoint& H2, int col, int prf = 0, int prio = PPR_LINE);
|
void queueline(const hyperpoint& H1, const hyperpoint& H2, int col, int prf = 0, int prio = PPR_LINE);
|
||||||
|
|
||||||
@ -2372,3 +2390,9 @@ transmatrix applyPatterndir(cell *c, const patterns::patterninfo& si);
|
|||||||
int pattern_threecolor(cell *c);
|
int pattern_threecolor(cell *c);
|
||||||
int fiftyval200(cell *c);
|
int fiftyval200(cell *c);
|
||||||
|
|
||||||
|
// T * C0, optimized
|
||||||
|
inline hyperpoint tC0(const transmatrix &T) {
|
||||||
|
hyperpoint z;
|
||||||
|
z[0] = T[0][2]; z[1] = T[1][2]; z[2] = T[2][2];
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user