mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	ads-game:: speeds and acceleration are now given in absolute units (no dep on animperiod)
This commit is contained in:
		| @@ -159,17 +159,17 @@ auto shot_hooks = | ||||
|     param_b(auto_angle, "ads_auto_angle") | ||||
|     -> editable("automatically rotate the projection", 'a'); | ||||
|     param_f(ads_simspeed, "ads_game_simspeed") | ||||
|     -> editable(0, 2*TAU, TAU/4, "AdS game speed", "Controls the speed of the game.", 's'); | ||||
|     param_f(ds_simspeed, "ads_game_simspeed") | ||||
|     -> editable(0, 2*TAU, TAU/4, "dS game speed", "Controls the speed of the game.", 's'); | ||||
|     -> editable(0, 2*TAU, TAU/4, "AdS game speed", "Controls the speed of the game, in absolute units per second.", 's'); | ||||
|     param_f(ds_simspeed, "ds_game_simspeed") | ||||
|     -> editable(0, 2*TAU, TAU/4, "dS game speed", "Controls the speed of the game, in absolute units per second.", 's'); | ||||
|     param_f(ads_scale, "ads_game_scale") | ||||
|     -> editable(0, 2, 0.1, "AdS game scale", "Controls the scaling of game objects.", 'c'); | ||||
|     param_f(ds_scale, "ds_game_scale") | ||||
|     -> editable(0, 2, 0.1, "dS game scale", "Controls the scaling of game objects.", 'c'); | ||||
|     param_f(ads_accel, "ads_game_accel") | ||||
|     -> editable(0, 30, 1, "AdS acceleration", "Controls the speed of your ship's acceleration.", 'a'); | ||||
|     param_f(ds_accel, "ads_game_accel") | ||||
|     -> editable(0, 30, 1, "dS acceleration", "Controls the speed of your ship's acceleration.", 'a'); | ||||
|     -> editable(0, 30, 1, "AdS acceleration", "Controls your ship's acceleration, in absolute units per second squared.", 'a'); | ||||
|     param_f(ds_accel, "ds_game_accel") | ||||
|     -> editable(0, 30, 1, "dS acceleration", "Controls your ship's acceleration, in absolute units per second squared.", 'a'); | ||||
|     param_f(ads_time_unit, "ads_time_unit") | ||||
|     -> editable(0, 2*TAU, 1, "AdS time unit", | ||||
|       "Controls the unit used when the 'display the proper times' option is on.\n\n" | ||||
| @@ -183,7 +183,7 @@ auto shot_hooks = | ||||
|       "Times in settings are always specified in absolute units." | ||||
|       , 'a'); | ||||
|     param_f(pause_speed, "ads_pause_speed") | ||||
|     -> editable(0, 30, 1, "movement speed while paused", "Controls the speed of camera movement while paused and holding the 'move switch' key.", 'v'); | ||||
|     -> editable(0, 30, 1, "movement speed while paused", "Controls the speed of camera movement while paused and holding the 'move switch' key. Absolute units per second.", 'v'); | ||||
|     param_f(rock_density, "ads_rock_density") | ||||
|     -> editable(0, 5, 0.05, "rock density", "how many rocks to generate", 'd'); | ||||
|     param_f(rock_max_rapidity, "ads_rock_rapidity") | ||||
|   | ||||
| @@ -127,7 +127,7 @@ ld read_movement() { | ||||
|  | ||||
| bool ads_turn(int idelta) { | ||||
|   multi::handleInput(idelta); | ||||
|   ld delta = idelta / anims::period; | ||||
|   ld delta = idelta / 1000.; | ||||
|    | ||||
|   if(!(cmode & sm::NORMAL)) return false; | ||||
|    | ||||
| @@ -165,16 +165,17 @@ bool ads_turn(int idelta) { | ||||
|     ld pt = delta * ads_simspeed; | ||||
|      | ||||
|     ld mul = read_movement(); | ||||
|     ld dv = pt * ads_accel * mul; | ||||
|  | ||||
|     if(paused && a[16+11]) { | ||||
|       current = ads_matrix(spin(ang*degree) * xpush(mul*delta*-pause_speed) * spin(-ang*degree), 0) * current; | ||||
|       } | ||||
|     else | ||||
|       apply_lorentz(spin(ang*degree) * lorentz(0, 2, -delta*ads_accel*mul) * spin(-ang*degree)); | ||||
|       apply_lorentz(spin(ang*degree) * lorentz(0, 2, -dv) * spin(-ang*degree)); | ||||
|      | ||||
|     if(!paused) { | ||||
|       pdata.fuel -= delta*ads_accel*mul; | ||||
|       gen_particles(rpoisson(delta*ads_accel*mul*fuel_particle_qty), vctr, ads_inverse(current * vctrV) * spin(ang*degree+M_PI) * rots::uxpush(0.06 * ads_scale), rsrc_color[rtFuel], fuel_particle_rapidity, fuel_particle_life, 0.02); | ||||
|       pdata.fuel -= dv; | ||||
|       gen_particles(rpoisson(dv*fuel_particle_qty), vctr, ads_inverse(current * vctrV) * spin(ang*degree+M_PI) * rots::uxpush(0.06 * ads_scale), rsrc_color[rtFuel], fuel_particle_rapidity, fuel_particle_life, 0.02); | ||||
|       } | ||||
|  | ||||
|     ld tc = 0; | ||||
|   | ||||
| @@ -323,7 +323,7 @@ void ds_fire() { | ||||
|  | ||||
| bool ds_turn(int idelta) { | ||||
|   multi::handleInput(idelta); | ||||
|   ld delta = idelta / anims::period; | ||||
|   ld delta = idelta / 1000.; | ||||
|    | ||||
|   if(!(cmode & sm::NORMAL)) return false; | ||||
|  | ||||
| @@ -347,23 +347,24 @@ bool ds_turn(int idelta) { | ||||
|   if(a[16+6] && !la[16+6]) view_proper_times = !view_proper_times; | ||||
|   if(a[16+7] && !la[16+7]) auto_rotate = !auto_rotate; | ||||
|   if(a[16+8] && !la[16+8]) pushScreen(game_menu); | ||||
|  | ||||
|    | ||||
|   if(true) { | ||||
|     dynamicval<eGeometry> g(geometry, gSpace435); | ||||
|      | ||||
|     ld pt = delta * ds_simspeed; | ||||
|     ld mul = read_movement(); | ||||
|     ld dv = pt * ds_accel * mul; | ||||
|  | ||||
|     if(paused && a[16+11]) { | ||||
|       current.T = spin(ang*degree) * cspin(0, 2, mul*delta*-pause_speed) * spin(-ang*degree) * current.T; | ||||
|       } | ||||
|     else { | ||||
|       current.T = spin(ang*degree) * lorentz(0, 3, -delta*ds_accel*mul) * spin(-ang*degree) * current.T; | ||||
|       current.T = spin(ang*degree) * lorentz(0, 3, -dv) * spin(-ang*degree) * current.T; | ||||
|       } | ||||
|      | ||||
|     if(!paused) { | ||||
|       pdata.fuel -= delta*ds_accel*mul; | ||||
|       ds_gen_particles(rpoisson(delta*ds_accel*mul*fuel_particle_qty), inverse(current.T) * spin(ang*degree+M_PI) * rots::uxpush(0.06 * ds_scale), current.shift, rsrc_color[rtFuel], fuel_particle_rapidity, fuel_particle_life, 0.02); | ||||
|       pdata.fuel -= dv; | ||||
|       ds_gen_particles(rpoisson(dv*fuel_particle_qty), inverse(current.T) * spin(ang*degree+M_PI) * rots::uxpush(0.06 * ds_scale), current.shift, rsrc_color[rtFuel], fuel_particle_rapidity, fuel_particle_life, 0.02); | ||||
|       } | ||||
|  | ||||
|     ld tc = 0; | ||||
| @@ -611,7 +612,7 @@ void run_ds_game() { | ||||
|   } | ||||
|  | ||||
| void ds_record() { | ||||
|   ld full = anims::period; | ||||
|   ld full = 1000; | ||||
|   anims::period = full * history.back().start / ds_simspeed; | ||||
|   anims::noframes = anims::period * 60 / 1000; | ||||
|   dynamicval<bool> b(paused, true); | ||||
|   | ||||
| @@ -3,17 +3,17 @@ namespace hr { | ||||
| namespace ads_game { | ||||
|  | ||||
| /** simulation speed */ | ||||
| ld ads_simspeed = TAU; | ||||
| ld ds_simspeed = M_PI; | ||||
| ld ads_simspeed = TAU / 10; | ||||
| ld ds_simspeed = M_PI / 10; | ||||
|  | ||||
| #define DS_(x) (main_rock ? ds_##x : ads_##x) | ||||
|  | ||||
| /** by how much do WAS keys accelerate */ | ||||
| ld ads_accel = 6; | ||||
| ld ds_accel = 15; | ||||
| ld ads_accel = 6 * ads_simspeed; | ||||
| ld ds_accel = 15 * ds_simspeed; | ||||
|  | ||||
| /** cursor movement speed while paused */ | ||||
| ld pause_speed = 5; | ||||
| ld pause_speed = 0.5; | ||||
|  | ||||
| /** time unit for time display */ | ||||
| ld ads_time_unit = TAU; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue