geometry specifics in mode code

This commit is contained in:
Zeno Rogue 2018-12-14 19:24:27 +01:00
parent 8a677c28fa
commit db69276264
2 changed files with 28 additions and 3 deletions

View File

@ -1472,7 +1472,7 @@ bool isAlchAny(eWall w);
bool isAlchAny(cell *c);
#define YDIST 101
#define MODECODES 255
#define MODECODES (1ll<<61)
extern cellwalker cwt; // player character position
@ -1481,7 +1481,7 @@ extern array<int, motypes> kills;
extern int explore[10], exploreland[10][landtypes], landcount[landtypes];
typedef int modecode_t;
typedef flagtype modecode_t;
extern map<modecode_t, array<int, ittypes> > hiitems;
extern eLand firstland, specialland;
@ -3832,7 +3832,7 @@ enum eOrbLandRelation {
namespace torusconfig {
extern int sdx, sdy;
enum eTorusMode {
enum eTorusMode : char {
tmSingleHex,
tmSingle,
tmSlantedHex,

View File

@ -955,6 +955,31 @@ int modecode() {
mct += irr::density_code() << 21; // 8 bits
}
// 32 bits [29..61) for geometry specifics
if(torus) {
mct += ll(torusconfig::dx) << 29;
mct += ll(torusconfig::dy) << 37;
mct += ll(torusconfig::qty) << 45;
mct += ll(torusconfig::torusmode) << 53;
}
if(geometry == gQuotient) {
mct += ll(current_extra) << 29;
mct += ll(fgeomextras[current_extra].current_prime_id) << 37;
}
if(geometry == gCrystal) {
mct += ll(ginf[geometry].sides) << 29;
mct += ll(ginf[geometry].vertices) << 37;
}
if(geometry == gArchimedean) {
unsigned res = 7;
for(char c: arcm::current.symbol) res = res * 157 + c;
mct += ll(res) << 29;
if(PURE) mct ^= (1<<29);
}
return mct;
}