1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-18 11:19:59 +00:00

camera_speed and camera_rot_speed configurable from menu, also they work where they should now

This commit is contained in:
Zeno Rogue 2020-09-16 21:03:00 +02:00
parent 5aaa7f2b27
commit b37d7b9808
2 changed files with 22 additions and 2 deletions

View File

@ -686,6 +686,9 @@ EX void initConfig() {
addsaver(berger_limit, "berger_limit");
addsaverenum(centering, "centering");
addsaver(camera_speed, "camera-speed", 1);
addsaver(camera_rot_speed, "camera-rot-speed", 1);
callhooks(hooks_configfile);
@ -1109,6 +1112,19 @@ EX void showGraphConfig() {
#endif
dialog::addSelItem(XLAT("scrolling speed"), fts(vid.sspeed), 'a');
dialog::addSelItem(XLAT("camera movement speed"), fts(camera_speed), 'c');
dialog::add_action([] {
dialog::editNumber(camera_speed, -10, 10, 0.1, 1, XLAT("camera movement speed"),
"This affects:\n\nin 2D: scrolling with arrow keys and Wheel Up\n\nin 3D: camera movement with Home/End."
);
});
dialog::addSelItem(XLAT("camera rotation speed"), fts(camera_rot_speed), 'r');
dialog::add_action([] {
dialog::editNumber(camera_rot_speed, -10, 10, 0.1, 1, XLAT("camera rotation speed"),
"This affects view rotation with Page Up/Down, and in 3D, camera rotation with arrow keys or mouse."
);
});
dialog::addSelItem(XLAT("movement animation speed"), fts(vid.mspeed), 'm');
@ -2708,6 +2724,8 @@ EX unordered_map<string, ld&> params = {
{"loxidromic", pconf.loximuthal_parameter},
{"miller", pconf.miller_parameter},
{"winkel", pconf.winkel_parameter},
{"camspd", camera_speed},
{"camrot", camera_rot_speed},
{"levellines", levellines},
#endif
};

View File

@ -329,6 +329,7 @@ EX void full_forward_camera(ld t) {
EX void full_rotate_camera(int dir, ld val) {
if(rug::rug_control() && lshiftclick) {
val *= camera_rot_speed;
hyperpoint h;
if(nonisotropic) {
transmatrix T2 = eupush( tC0(view_inverse(View)) );
@ -350,6 +351,7 @@ EX void full_rotate_camera(int dir, ld val) {
crystal::apply_rotation(cspin(dir, 2, val * camera_rot_speed));
#endif
else if(GDIM == 3) {
val *= camera_rot_speed;
if(keep_vertical()) {
hyperpoint vv = vertical_vector();
ld alpha = -atan2(vv[2], vv[1]);
@ -372,7 +374,7 @@ EX void full_rotate_camera(int dir, ld val) {
EX void full_rotate_view(ld h, ld v) {
if(history::on && !rug::rug_control())
models::rotation += h;
models::rotation += h * camera_rot_speed;
else {
rotate_view(spin(v * camera_rot_speed));
didsomething = true;
@ -413,7 +415,7 @@ EX void handlePanning(int sym, int uni) {
ld jx = (mousex - current_display->xcenter - .0) / current_display->radius / 10;
ld jy = (mousey - current_display->ycenter - .0) / current_display->radius / 10;
playermoved = false;
rotate_view(gpushxto0(hpxy(jx, jy)));
rotate_view(gpushxto0(hpxy(jx * camera_speed, jy * camera_speed)));
sym = 1;
}
}