mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-06-16 10:19:58 +00:00
refactored switch_* functions (fpp/tpp/always3)
This commit is contained in:
parent
5ab7249afd
commit
2acfd99d17
65
config.cpp
65
config.cpp
|
@ -1187,11 +1187,7 @@ void show3D() {
|
||||||
|
|
||||||
if(WDIM == 2) {
|
if(WDIM == 2) {
|
||||||
dialog::addBoolItem(XLAT("use the full 3D models"), geom3::always3, 'U');
|
dialog::addBoolItem(XLAT("use the full 3D models"), geom3::always3, 'U');
|
||||||
dialog::add_action([] {
|
dialog::add_action(geom3::switch_always3);
|
||||||
geom3::always3 = !geom3::always3;
|
|
||||||
need_reset_geometry = true;
|
|
||||||
callhooks(hooks_swapdim);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vid.use_smart_range == 0 && DIM == 2) {
|
if(vid.use_smart_range == 0 && DIM == 2) {
|
||||||
|
@ -1283,49 +1279,12 @@ void show3D() {
|
||||||
#endif
|
#endif
|
||||||
if(GDIM == 2) {
|
if(GDIM == 2) {
|
||||||
dialog::addBoolItem(XLAT("configure TPP automatically"), pmodel == mdDisk && vid.camera_angle, 'T');
|
dialog::addBoolItem(XLAT("configure TPP automatically"), pmodel == mdDisk && vid.camera_angle, 'T');
|
||||||
dialog::add_action([] () {
|
dialog::add_action(geom3::switch_tpp);
|
||||||
if(pmodel == mdDisk && vid.camera_angle) {
|
|
||||||
vid.yshift = 0;
|
|
||||||
vid.camera_angle = 0;
|
|
||||||
vid.xposition = 0;
|
|
||||||
vid.yposition = 0;
|
|
||||||
vid.scale = 1;
|
|
||||||
vid.fixed_facing = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
vid.yshift = -0.3;
|
|
||||||
vid.camera_angle = -45;
|
|
||||||
vid.scale = 18/16. * vid.xres / vid.yres / multi::players;
|
|
||||||
vid.xposition = 0;
|
|
||||||
vid.yposition = -0.9;
|
|
||||||
vid.fixed_facing = true;
|
|
||||||
vid.fixed_facing_dir = 90;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(WDIM == 2) {
|
if(WDIM == 2) {
|
||||||
dialog::addBoolItem(XLAT("configure FPP automatically"), DIM == 3, 'F');
|
dialog::addBoolItem(XLAT("configure FPP automatically"), DIM == 3, 'F');
|
||||||
dialog::add_action([] {
|
dialog::add_action(geom3::switch_fpp);
|
||||||
if(!geom3::always3) {
|
|
||||||
geom3::always3 = true;
|
|
||||||
geom3::wall_height = 1.5;
|
|
||||||
geom3::human_wall_ratio = 0.8;
|
|
||||||
geom3::camera = 0;
|
|
||||||
if(pmodel == mdDisk) pmodel = mdPerspective;
|
|
||||||
need_reset_geometry = true;
|
|
||||||
callhooks(hooks_swapdim);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
geom3::always3 = false;
|
|
||||||
geom3::wall_height = .3;
|
|
||||||
geom3::human_wall_ratio = .7;
|
|
||||||
geom3::camera = 1;
|
|
||||||
if(pmodel == mdPerspective) pmodel = mdDisk;
|
|
||||||
need_reset_geometry = true;
|
|
||||||
callhooks(hooks_swapdim);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(0);
|
if(0);
|
||||||
|
@ -1932,15 +1891,17 @@ int read_config_args() {
|
||||||
PHASEFROM(2);
|
PHASEFROM(2);
|
||||||
nomenukey = true;
|
nomenukey = true;
|
||||||
}
|
}
|
||||||
else if(argis("-al3")) {
|
else if(argis("-switch-fpp")) {
|
||||||
PHASEFROM(2);
|
PHASEFROM(2);
|
||||||
geom3::always3 = true;
|
geom3::switch_fpp();
|
||||||
geom3::wall_height = 1.5;
|
}
|
||||||
geom3::human_wall_ratio = 0.8;
|
else if(argis("-switch-tpp")) {
|
||||||
geom3::camera = 0;
|
PHASEFROM(2);
|
||||||
if(pmodel == mdDisk) pmodel = mdPerspective;
|
geom3::switch_tpp();
|
||||||
need_reset_geometry = true;
|
}
|
||||||
callhooks(hooks_swapdim);
|
else if(argis("-switch-3d")) {
|
||||||
|
PHASEFROM(2);
|
||||||
|
geom3::switch_always3();
|
||||||
}
|
}
|
||||||
else if(argis("-nohelp")) {
|
else if(argis("-nohelp")) {
|
||||||
PHASEFROM(2);
|
PHASEFROM(2);
|
||||||
|
|
48
geometry.cpp
48
geometry.cpp
|
@ -383,6 +383,54 @@ namespace geom3 {
|
||||||
BOTTOM = lev_to_factor(-lake_bottom);
|
BOTTOM = lev_to_factor(-lake_bottom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void switch_always3() {
|
||||||
|
geom3::always3 = !geom3::always3;
|
||||||
|
need_reset_geometry = true;
|
||||||
|
callhooks(hooks_swapdim);
|
||||||
|
}
|
||||||
|
|
||||||
|
void switch_tpp() {
|
||||||
|
if(pmodel == mdDisk && vid.camera_angle) {
|
||||||
|
vid.yshift = 0;
|
||||||
|
vid.camera_angle = 0;
|
||||||
|
vid.xposition = 0;
|
||||||
|
vid.yposition = 0;
|
||||||
|
vid.scale = 1;
|
||||||
|
vid.fixed_facing = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vid.yshift = -0.3;
|
||||||
|
vid.camera_angle = -45;
|
||||||
|
vid.scale = 18/16. * vid.xres / vid.yres / multi::players;
|
||||||
|
vid.xposition = 0;
|
||||||
|
vid.yposition = -0.9;
|
||||||
|
vid.fixed_facing = true;
|
||||||
|
vid.fixed_facing_dir = 90;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void switch_fpp() {
|
||||||
|
if(!geom3::always3) {
|
||||||
|
geom3::always3 = true;
|
||||||
|
geom3::wall_height = 1.5;
|
||||||
|
geom3::human_wall_ratio = 0.8;
|
||||||
|
geom3::camera = 0;
|
||||||
|
if(pmodel == mdDisk) pmodel = mdPerspective;
|
||||||
|
need_reset_geometry = true;
|
||||||
|
callhooks(hooks_swapdim);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
geom3::always3 = false;
|
||||||
|
geom3::wall_height = .3;
|
||||||
|
geom3::human_wall_ratio = .7;
|
||||||
|
geom3::camera = 1;
|
||||||
|
if(pmodel == mdPerspective) pmodel = mdDisk;
|
||||||
|
need_reset_geometry = true;
|
||||||
|
callhooks(hooks_swapdim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void initgeo() {
|
void initgeo() {
|
||||||
|
|
3
hyper.h
3
hyper.h
|
@ -4338,6 +4338,9 @@ namespace gamestack {
|
||||||
namespace geom3 {
|
namespace geom3 {
|
||||||
extern ld BODY;
|
extern ld BODY;
|
||||||
extern ld depth, camera, wall_height, creature_scale, height_width;
|
extern ld depth, camera, wall_height, creature_scale, height_width;
|
||||||
|
void switch_always3();
|
||||||
|
void switch_fpp();
|
||||||
|
void switch_tpp();
|
||||||
}
|
}
|
||||||
|
|
||||||
void queuestr(const transmatrix& V, double size, const string& chr, color_t col, int frame = 0, int align = 8);
|
void queuestr(const transmatrix& V, double size, const string& chr, color_t col, int frame = 0, int align = 8);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user