mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-30 13:32:59 +00:00 
			
		
		
		
	matrix dialog now used for models::rotation
This commit is contained in:
		| @@ -430,7 +430,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 * camera_rot_speed; | ||||
|     models::rotation = spin(h * camera_rot_speed) * models::rotation; | ||||
|   else { | ||||
|     rotate_view(cspin(0, 1, v * camera_rot_speed)); | ||||
|     didsomething = true; | ||||
|   | ||||
| @@ -453,7 +453,7 @@ EX namespace history { | ||||
|     if(1) { | ||||
|       // block for RAII | ||||
|       dynamicval<videopar> dv(vid, vid); | ||||
|       dynamicval<ld> dr(models::rotation, 0); | ||||
|       dynamicval<trans23> dr(models::rotation, Id); | ||||
|       dynamicval<bool> di(inHighQual, true); | ||||
|        | ||||
|       renderbuffer glbuf(bandfull, bandfull, vid.usingGL); | ||||
|   | ||||
| @@ -221,6 +221,10 @@ struct trans23 { | ||||
|     dim = 4; t.v3 = v3 * T.v3; | ||||
|     return t; | ||||
|     } | ||||
|   friend trans23 operator * (transmatrix M, trans23 T) { | ||||
|     trans23 t(M); | ||||
|     return M * T; | ||||
|     } | ||||
|   }; | ||||
|  | ||||
| /** mirror image */ | ||||
|   | ||||
| @@ -2073,10 +2073,10 @@ EX void spinEdge(ld aspd) { | ||||
|     } | ||||
|   else if(keep_vertical()) { | ||||
|     hyperpoint h = vertical_vector(); | ||||
|     downspin = -atan2(h[0], h[1]); | ||||
|     if(ds.qty && GDIM == 2) { | ||||
|       downspin += models::rotation * degree; | ||||
|       h = rot_inverse(models::rotation.get()) * h; | ||||
|       } | ||||
|     downspin = -atan2(h[0], h[1]); | ||||
|     if(ds.qty) { | ||||
|       cyclefix(downspin, 0);       | ||||
|       downspin = downspin * min(ds.speed, (double)1); | ||||
|   | ||||
| @@ -363,6 +363,13 @@ int read_legacy_args() { | ||||
|     shift(); println(hlog, "-ballangle not implemented"); | ||||
|     // shift_arg_formula(vpconf.ballangle); | ||||
|     } | ||||
|   else if(argis("-crot")) { | ||||
|     PHASEFROM(2); | ||||
|     shift(); shift(); shift(); println(hlog, "-crot not implemented"); | ||||
|     /* shift_arg_formula(models::rotation); | ||||
|     if(GDIM == 3) shift_arg_formula(models::rotation_xz); | ||||
|     if(GDIM == 3) shift_arg_formula(models::rotation_xy2); */ | ||||
|     } | ||||
|   else return 1; | ||||
|   return 0; | ||||
|   } | ||||
|   | ||||
							
								
								
									
										62
									
								
								models.cpp
									
									
									
									
									
								
							
							
						
						
									
										62
									
								
								models.cpp
									
									
									
									
									
								
							| @@ -142,9 +142,7 @@ projection_configuration::projection_configuration() { | ||||
|  | ||||
| EX namespace models { | ||||
|  | ||||
|   EX ld rotation = 0; | ||||
|   EX ld rotation_xz = 90; | ||||
|   EX ld rotation_xy2 = 90; | ||||
|   EX trans23 rotation; | ||||
|   EX int do_rotate = 1; | ||||
|   EX bool model_straight, model_straight_yz; | ||||
|  | ||||
| @@ -157,8 +155,8 @@ EX namespace models { | ||||
|   EX void scr_to_ori(transmatrix& h) { if(!model_straight) h = iso_inverse(pconf.mori().get()) * h; } | ||||
|  | ||||
|   EX transmatrix rotmatrix() { | ||||
|     if(GDIM == 2 || gproduct) return spin(rotation * degree); | ||||
|     return spin(rotation_xy2 * degree) * cspin(0, 2, -rotation_xz * degree) * spin(rotation * degree); | ||||
|     if(gproduct) return rotation.v2; | ||||
|     return rotation.get(); | ||||
|     } | ||||
|    | ||||
|   int spiral_id = 7; | ||||
| @@ -356,30 +354,6 @@ EX namespace models { | ||||
|       }; | ||||
|     } | ||||
|    | ||||
|   EX void edit_rotation(ld& which) { | ||||
|     dialog::editNumber(which, 0, 360, 90, 0, XLAT("rotation"),  | ||||
|       "This controls the automatic rotation of the world. " | ||||
|       "It affects the line animation in the history mode, and " | ||||
|       "lands which have a special direction. Note that if finding this special direction is a part of the puzzle, " | ||||
|       "it works only in the cheat mode."); | ||||
|     dialog::get_di().dialogflags |= sm::CENTER; | ||||
|     dialog::get_di().extra_options = [] () { | ||||
|       dialog::addBreak(100); | ||||
|       dialog::addBoolItem_choice("line animation only", models::do_rotate, 0, 'N'); | ||||
|       dialog::addBoolItem_choice("gravity lands", models::do_rotate, 1, 'G'); | ||||
|       dialog::addBoolItem_choice("all directional lands", models::do_rotate, 2, 'D'); | ||||
|       if(GDIM == 3) { | ||||
|         dialog::addBreak(100); | ||||
|         dialog::addSelItem(XLAT("XY plane"), fts(models::rotation) + "°", 'A'); | ||||
|         dialog::add_action([] { popScreen(); edit_rotation(models::rotation); }); | ||||
|         dialog::addSelItem(XLAT("XZ plane"), fts(models::rotation_xz) + "°", 'B'); | ||||
|         dialog::add_action([] { popScreen(); edit_rotation(models::rotation_xz); }); | ||||
|         dialog::addSelItem(XLAT("XY plane #2"), fts(models::rotation_xy2) + "°", 'C'); | ||||
|         dialog::add_action([] { popScreen(); edit_rotation(models::rotation_xy2); }); | ||||
|         } | ||||
|       }; | ||||
|     } | ||||
|  | ||||
|   EX void model_list() { | ||||
|     cmode = sm::SIDE | sm::MAYDARK | sm::CENTER; | ||||
|     gamescreen(); | ||||
| @@ -456,14 +430,10 @@ EX namespace models { | ||||
|     if(nonisotropic && !sl2) | ||||
|       dialog::addBoolItem_action(XLAT("geodesic movement in Sol/Nil"), nisot::geodesic_movement, 'G'); | ||||
|  | ||||
|     dialog::addBoolItem(XLAT("rotation"), do_rotate == 2, 'r'); | ||||
|     if(do_rotate == 0) dialog::lastItem().value = XLAT("NEVER"); | ||||
|     if(GDIM == 2) | ||||
|       dialog::lastItem().value += " " + its(rotation) + "°"; | ||||
|     else | ||||
|       dialog::lastItem().value += " " + its(rotation) + "°" + its(rotation_xz) + "°" + its(rotation_xy2) + "°"; | ||||
|     dialog::add_action([] { edit_rotation(rotation); }); | ||||
|      | ||||
|     add_edit((GDIM == 2 || gproduct) ? rotation.v2 : rotation.v3); | ||||
|     if(do_rotate == 0) { dialog::lastItem().value = XLAT("NEVER"); dialog::lastItem().type = dialog::diItem; } | ||||
|     else { dialog::lastItem().value = ONOFF(do_rotate == 2); } | ||||
|  | ||||
|     bool vr_settings = vrhr::active() && set_vr_settings; | ||||
|  | ||||
|     if(vrhr::active()) { | ||||
| @@ -870,12 +840,6 @@ EX namespace models { | ||||
|       PHASEFROM(2);  | ||||
|       shift_arg_formula(vpconf.rotational_nil); | ||||
|       } | ||||
|     else if(argis("-crot")) {  | ||||
|       PHASEFROM(2);  | ||||
|       shift_arg_formula(models::rotation); | ||||
|       if(GDIM == 3) shift_arg_formula(models::rotation_xz); | ||||
|       if(GDIM == 3) shift_arg_formula(models::rotation_xy2); | ||||
|       } | ||||
|     else if(argis("-clip")) {  | ||||
|       PHASEFROM(2);  | ||||
|       shift_arg_formula(vpconf.clip_min); | ||||
| @@ -968,9 +932,15 @@ EX namespace models { | ||||
|       addsaver(polygonal::coefi[i], "polynomial "+its(i)+".imag"); | ||||
|       } | ||||
|  | ||||
|     param_f(models::rotation, "rotation", "conformal rotation"); | ||||
|     addsaver(models::rotation_xz, "conformal rotation_xz"); | ||||
|     addsaver(models::rotation_xy2, "conformal rotation_2"); | ||||
|     auto setrot = [] { | ||||
|       dialog::addBreak(100); | ||||
|       dialog::addBoolItem_choice("line animation only", models::do_rotate, 0, 'N'); | ||||
|       dialog::addBoolItem_choice("gravity lands", models::do_rotate, 1, 'G'); | ||||
|       dialog::addBoolItem_choice("all directional lands", models::do_rotate, 2, 'D'); | ||||
|       }; | ||||
|  | ||||
|     param_matrix(models::rotation.v2, "rotation", 2)->editable("conformal rotation", "", 'r')->set_extra(setrot); | ||||
|     param_matrix(models::rotation.v3, "rotation3", 3)->editable("conformal rotation in 3D", "", 'r')->set_extra(setrot); | ||||
|     addsaver(models::do_rotate, "conformal rotation mode", 1); | ||||
|  | ||||
|     param_f(pconf.halfplane_scale, "hp", "halfplane scale", 1); | ||||
|   | ||||
							
								
								
									
										4
									
								
								quit.cpp
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								quit.cpp
									
									
									
									
									
								
							| @@ -236,9 +236,9 @@ EX hint hints[] = { | ||||
|       popScreen(); | ||||
|       auto m = pmodel; | ||||
|       pmodel = mdBand; | ||||
|       int r = models::rotation; | ||||
|       auto r = models::rotation; | ||||
|       bool h = history::includeHistory; | ||||
|       models::rotation = 0; | ||||
|       models::rotation = Id; | ||||
|       history::includeHistory = true; | ||||
|       history::create_playerpath(); | ||||
|       cancel = [m,r,h] () {  | ||||
|   | ||||
							
								
								
									
										6
									
								
								tour.cpp
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								tour.cpp
									
									
									
									
									
								
							| @@ -829,8 +829,8 @@ EX slide default_slides[] = { | ||||
|       if(mode == 1)  | ||||
|         pmodel = mdHalfplane, smart = vid.use_smart_range, vid.use_smart_range = 2; | ||||
|       if(mode == 2)  | ||||
|         models::rotation = cwt.at->land == laDungeon ? 0 : 2; | ||||
|       if(mode == 3) pmodel = mdDisk, models::rotation = 0, vid.use_smart_range = smart; | ||||
|         models::rotation = cwt.at->land == laDungeon ? Id : spin(M_PI); | ||||
|       if(mode == 3) pmodel = mdDisk, models::rotation = Id, vid.use_smart_range = smart; | ||||
|       } | ||||
|     }, | ||||
|   {"Curvature", 29, LEGAL::ANY, | ||||
| @@ -978,7 +978,7 @@ EX slide default_slides[] = { | ||||
|     "memory.", | ||||
|     [] (presmode mode) { | ||||
|       static int smart; | ||||
|       if(mode == 1) pmodel = mdBand, history::create_playerpath(), models::rotation = 0, | ||||
|       if(mode == 1) pmodel = mdBand, history::create_playerpath(), models::rotation = Id, | ||||
|         smart = vid.use_smart_range, vid.use_smart_range = 2; | ||||
|       if(mode == 3) { | ||||
|         history::clear(), pmodel = mdDisk; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue