mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-05-03 15:54:06 +00:00
bringris:: abstracted enable_bgeom
This commit is contained in:
parent
b49e0eb6e7
commit
87918fcb4b
@ -63,6 +63,40 @@ int last_adjust, when_t;
|
|||||||
transmatrix tView, pView;
|
transmatrix tView, pView;
|
||||||
cell* ncenter;
|
cell* ncenter;
|
||||||
|
|
||||||
|
cell *well_center;
|
||||||
|
|
||||||
|
vector<cell*> level;
|
||||||
|
|
||||||
|
vector<cell*> out_level;
|
||||||
|
|
||||||
|
bool pro_game;
|
||||||
|
|
||||||
|
int well_size = 10;
|
||||||
|
int camera = 3;
|
||||||
|
|
||||||
|
int facing_mod = 0;
|
||||||
|
|
||||||
|
int shape_id, next_shape_id;
|
||||||
|
|
||||||
|
cellwalker at;
|
||||||
|
|
||||||
|
int move_started;
|
||||||
|
int move_at;
|
||||||
|
|
||||||
|
int completed;
|
||||||
|
int bricks, cubes;
|
||||||
|
|
||||||
|
ld score;
|
||||||
|
|
||||||
|
bool paused;
|
||||||
|
bool explore;
|
||||||
|
|
||||||
|
enum eState {
|
||||||
|
tsPreGame, tsFalling, tsBetween, tsCollect, tsGameover
|
||||||
|
};
|
||||||
|
|
||||||
|
eState state = tsPreGame;
|
||||||
|
|
||||||
vector<bgeometry> bgeoms = {
|
vector<bgeometry> bgeoms = {
|
||||||
{"Bring surface", "the original Bringris geometry", [] {
|
{"Bring surface", "the original Bringris geometry", [] {
|
||||||
using namespace fieldpattern;
|
using namespace fieldpattern;
|
||||||
@ -226,6 +260,21 @@ vector<bgeometry> bgeoms = {
|
|||||||
rotate_allowed = false;
|
rotate_allowed = false;
|
||||||
}},
|
}},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void create_game();
|
||||||
|
|
||||||
|
void enable_bgeom() {
|
||||||
|
stop_game_and_switch_mode(rg::nothing);
|
||||||
|
bgeoms[bgeom].create();
|
||||||
|
start_game();
|
||||||
|
create_game();
|
||||||
|
state = tsPreGame;
|
||||||
|
}
|
||||||
|
|
||||||
|
void enable_bgeom(int b) {
|
||||||
|
bgeom = b;
|
||||||
|
enable_bgeom();
|
||||||
|
}
|
||||||
|
|
||||||
using code_t = vector<pair<int, int>>;
|
using code_t = vector<pair<int, int>>;
|
||||||
|
|
||||||
@ -439,40 +488,6 @@ void list_all() {
|
|||||||
// for(auto sh: piecelist) println(hlog, "multi=", sh.multi, " penalty=", sh.penalty, " syms=", sh.symmetries, " => ", sh.code);
|
// for(auto sh: piecelist) println(hlog, "multi=", sh.multi, " penalty=", sh.penalty, " syms=", sh.symmetries, " => ", sh.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
cell *well_center;
|
|
||||||
|
|
||||||
vector<cell*> level;
|
|
||||||
|
|
||||||
vector<cell*> out_level;
|
|
||||||
|
|
||||||
bool pro_game;
|
|
||||||
|
|
||||||
int well_size = 10;
|
|
||||||
int camera = 3;
|
|
||||||
|
|
||||||
int facing_mod = 0;
|
|
||||||
|
|
||||||
int shape_id, next_shape_id;
|
|
||||||
|
|
||||||
cellwalker at;
|
|
||||||
|
|
||||||
int move_started;
|
|
||||||
int move_at;
|
|
||||||
|
|
||||||
int completed;
|
|
||||||
int bricks, cubes;
|
|
||||||
|
|
||||||
ld score;
|
|
||||||
|
|
||||||
enum eState {
|
|
||||||
tsPreGame, tsFalling, tsBetween, tsCollect, tsGameover
|
|
||||||
};
|
|
||||||
|
|
||||||
bool paused;
|
|
||||||
bool explore;
|
|
||||||
|
|
||||||
eState state = tsPreGame;
|
|
||||||
|
|
||||||
void water_shape() {
|
void water_shape() {
|
||||||
auto shape = build_from(piecelist[shape_id].code, at);
|
auto shape = build_from(piecelist[shape_id].code, at);
|
||||||
for(auto c: shape)
|
for(auto c: shape)
|
||||||
@ -1083,12 +1098,7 @@ void geometry_menu() {
|
|||||||
dialog::addTitle(bgeoms[i].name, i == bgeom ? 0xFF00 : 0xFF0000, 150);
|
dialog::addTitle(bgeoms[i].name, i == bgeom ? 0xFF00 : 0xFF0000, 150);
|
||||||
dialog::items.back().key = 'a' + i;
|
dialog::items.back().key = 'a' + i;
|
||||||
dialog::add_action([i] {
|
dialog::add_action([i] {
|
||||||
stop_game_and_switch_mode(rg::nothing);
|
enable_bgeom(i);
|
||||||
bgeom = i;
|
|
||||||
bgeoms[bgeom].create();
|
|
||||||
start_game();
|
|
||||||
create_game();
|
|
||||||
state = tsPreGame;
|
|
||||||
});
|
});
|
||||||
dialog::addInfo(bgeoms[i].cap);
|
dialog::addInfo(bgeoms[i].cap);
|
||||||
dialog::items.back().key = 'a' + i;
|
dialog::items.back().key = 'a' + i;
|
||||||
@ -1446,10 +1456,7 @@ void create_game() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void init_all() {
|
void init_all() {
|
||||||
stop_game_and_switch_mode(rg::nothing);
|
enable_bgeom();
|
||||||
bgeoms[bgeom].create();
|
|
||||||
start_game();
|
|
||||||
create_game();
|
|
||||||
vid.texture_step = 8;
|
vid.texture_step = 8;
|
||||||
showstartmenu = false;
|
showstartmenu = false;
|
||||||
pushScreen(run);
|
pushScreen(run);
|
||||||
@ -1476,11 +1483,8 @@ int args() {
|
|||||||
|
|
||||||
else if(argis("-bgeo")) {
|
else if(argis("-bgeo")) {
|
||||||
PHASEFROM(2);
|
PHASEFROM(2);
|
||||||
stop_game_and_switch_mode(rg::nothing);
|
shift();
|
||||||
shift(); bgeom = argi();
|
enable_bgeom(argi());
|
||||||
bgeoms[bgeom].create();
|
|
||||||
start_game();
|
|
||||||
create_game();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(argis("-bringris"))
|
else if(argis("-bringris"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user