1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-10-31 19:36:16 +00:00

adjusted bringris to use mproduct and mhybrid

This commit is contained in:
Zeno Rogue 2023-01-03 20:51:29 +01:00
parent 016b0a95bc
commit a55ed32fa1

View File

@ -386,7 +386,7 @@ int down_dir() { return nil ? 4 : sol ? 0 : cwt.at->type-1; }
int up_dir() { return nil ? 1 : sol ? 6 : cwt.at->type-2; } int up_dir() { return nil ? 1 : sol ? 6 : cwt.at->type-2; }
cell *get_at(cell *lev, int z) { cell *get_at(cell *lev, int z) {
if(prod) if(mproduct)
return hybrid::get_at(lev, z); return hybrid::get_at(lev, z);
else { else {
// auto co = nilv::get_coord(lev->master); // auto co = nilv::get_coord(lev->master);
@ -400,7 +400,7 @@ cell *get_at(cell *lev, int z) {
} }
int get_z(cell* c) { int get_z(cell* c) {
if(prod) if(mproduct)
return hybrid::get_where(c).second; return hybrid::get_where(c).second;
else if(nil) else if(nil)
return nilv::get_coord(c->master)[1]; return nilv::get_coord(c->master)[1];
@ -411,7 +411,7 @@ int get_z(cell* c) {
} }
pair<cell*, int> get_where(cell *what) { pair<cell*, int> get_where(cell *what) {
if(prod) if(mproduct)
return hybrid::get_where(what); return hybrid::get_where(what);
else { else {
int z = get_z(what); int z = get_z(what);
@ -444,12 +444,12 @@ cellwalker flatspin(cellwalker cw, int i) {
if(solnil) if(solnil)
cw.spin = i; cw.spin = i;
else else
cw.spin = gmod(cw.spin + (cw.mirrored ? -i : i), cw.at->type - (hybri ? 2 : 0)); cw.spin = gmod(cw.spin + (cw.mirrored ? -i : i), cw.at->type - (mhybrid ? 2 : 0));
return cw; return cw;
} }
int add_dir(cellwalker orig, int i, int sym = 0) { int add_dir(cellwalker orig, int i, int sym = 0) {
if(prod) { if(mproduct) {
if(i >= orig.at->type-2) { if(i >= orig.at->type-2) {
if(sym&2) i ^= (orig.at->type-1) ^ (orig.at->type-2); if(sym&2) i ^= (orig.at->type-1) ^ (orig.at->type-2);
return i; return i;
@ -463,7 +463,7 @@ int add_dir(cellwalker orig, int i, int sym = 0) {
} }
cellwalker add(cellwalker orig, int i, int sym = 0) { cellwalker add(cellwalker orig, int i, int sym = 0) {
if(prod) { if(mproduct) {
if(i >= orig.at->type-2) { if(i >= orig.at->type-2) {
if(sym&2) i ^= (orig.at->type-1) ^ (orig.at->type-2); if(sym&2) i ^= (orig.at->type-1) ^ (orig.at->type-2);
orig.at = orig.at->cmove(i); orig.at = orig.at->cmove(i);
@ -496,7 +496,7 @@ vector<transmatrix> build_shape_matrices(const code_t& code, cellwalker start, i
int penalty(const vector<cellwalker>& shape, const code_t& code) { int penalty(const vector<cellwalker>& shape, const code_t& code) {
int p = 0; int p = 0;
if(prod) { if(mproduct) {
int bad = shape[0].at->type-1; int bad = shape[0].at->type-1;
for(auto co: code) if(co.second == bad) for(auto co: code) if(co.second == bad)
p += 1000; p += 1000;
@ -530,7 +530,7 @@ int penalty(const vector<cellwalker>& shape, const code_t& code) {
bool builds(const vector<cellwalker>& shape, const code_t& code, int sym = 0, int eliminate = -1) { bool builds(const vector<cellwalker>& shape, const code_t& code, int sym = 0, int eliminate = -1) {
if(isize(shape) != isize(code)+1) return false; if(isize(shape) != isize(code)+1) return false;
int ori = (solnil) ? 1 : prod ? shape[0].at->type-2 : shape[0].at->type; int ori = (solnil) ? 1 : mproduct ? shape[0].at->type-2 : shape[0].at->type;
for(auto sh: shape) for(int i=0; i<ori; i++) { for(auto sh: shape) for(int i=0; i<ori; i++) {
vector<cellwalker> shape2 = build_from(code, cellwalker(sh.at, i), sym); vector<cellwalker> shape2 = build_from(code, cellwalker(sh.at, i), sym);
if(eliminate != -1) seen_blocks.emplace(as_set(shape2), eliminate); if(eliminate != -1) seen_blocks.emplace(as_set(shape2), eliminate);
@ -958,7 +958,7 @@ cell *shift_block_target(int dir) {
void shift_block(int dir, bool camera_only) { void shift_block(int dir, bool camera_only) {
int t = currentmap->gamestart()->type; int t = currentmap->gamestart()->type;
if(prod) t -= 2; if(mproduct) t -= 2;
if(!camera_only) remove_shape(); if(!camera_only) remove_shape();
@ -1025,7 +1025,7 @@ void create_matrices() {
cell *c1 = c->cmove(i); cell *c1 = c->cmove(i);
dq::enqueue_by_matrix_c(c1, optimized_shift(V * currentmap->adj(c, i))); dq::enqueue_by_matrix_c(c1, optimized_shift(V * currentmap->adj(c, i)));
}; };
if(prod) { if(mproduct) {
for(int i=0; i<c->type-2; i++) go(i); for(int i=0; i<c->type-2; i++) go(i);
} }
else if(sol) { else if(sol) {
@ -1937,7 +1937,7 @@ void create_game() {
out_level.clear(); out_level.clear();
well_center = nullptr; well_center = nullptr;
if(!prod && !solnil) { if(!mproduct && !solnil) {
println(hlog, "need product or Solnil geometry"); println(hlog, "need product or Solnil geometry");
exit(1); exit(1);
} }