mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-30 21:42:59 +00:00 
			
		
		
		
	missile rapidity and particle settings
This commit is contained in:
		| @@ -125,10 +125,26 @@ auto shot_hooks = | |||||||
|     -> editable(0, 5, 0.05, "rock density", "how many rocks to generate", 'd'); |     -> editable(0, 5, 0.05, "rock density", "how many rocks to generate", 'd'); | ||||||
|     param_f(rock_max_rapidity, "ads_rock_rapidity") |     param_f(rock_max_rapidity, "ads_rock_rapidity") | ||||||
|     -> editable(0, 5, 0.05, "rock rapidity", "how fast should the rocks be relative to the map", 'w'); |     -> editable(0, 5, 0.05, "rock rapidity", "how fast should the rocks be relative to the map", 'w'); | ||||||
|  |     param_f(missile_rapidity, "ads_missile_rapidity") | ||||||
|  |     -> editable(0, 5, 0.05, "missile rapidity", "how fast should the missiles go relative to the ship", 'm'); | ||||||
|     param_b(auto_rotate, "ads_auto_rotate") |     param_b(auto_rotate, "ads_auto_rotate") | ||||||
|     -> editable("automatically rotate the screen", 'r'); |     -> editable("automatically rotate the screen", 'r'); | ||||||
|     param_b(view_proper_times, "ads_display") |     param_b(view_proper_times, "ads_display") | ||||||
|     -> editable("display the proper times", 't'); |     -> editable("display the proper times", 't'); | ||||||
|  |  | ||||||
|  |     param_f(crash_particle_rapidity, "ads_crash_rapidity") | ||||||
|  |     -> editable(0, 5, 0.1, "crash particle rapidity", "how fast should the crash particles be", 'r'); | ||||||
|  |     param_f(crash_particle_qty, "ads_crash_qty") | ||||||
|  |     -> editable(0, 5, 0.1, "crash particle quantity", "how many crash particles", 'q'); | ||||||
|  |     param_f(crash_particle_life, "ads_crash_life") | ||||||
|  |     -> editable(0, 5, 0.1, "crash particle lifetime", "how long should the crash particles live", 'l'); | ||||||
|  |     param_f(fuel_particle_rapidity, "ads_fuel_rapidity") | ||||||
|  |     -> editable(0, 5, 0.1, "fuel particle rapidity", "how fast should the fuel particles be", 'R'); | ||||||
|  |     param_f(fuel_particle_qty, "ads_fuel_qty") | ||||||
|  |     -> editable(0, 5, 0.1, "fuel particle quantity", "how many fuel particles", 'Q'); | ||||||
|  |     param_f(fuel_particle_life, "ads_fuel_life") | ||||||
|  |     -> editable(0, 5, 0.1, "fuel particle lifetime", "how long should the fuel particles live", 'L'); | ||||||
|  |  | ||||||
|     rsrc_config(); |     rsrc_config(); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ void fire() { | |||||||
|  |  | ||||||
|   ads_matrix S0 = ads_inverse(current * vctrV) * spin(ang*degree); |   ads_matrix S0 = ads_inverse(current * vctrV) * spin(ang*degree); | ||||||
|  |  | ||||||
|   ads_matrix S1 = S0 * lorentz(0, 2, 3); // 0.995c |   ads_matrix S1 = S0 * lorentz(0, 2, missile_rapidity); | ||||||
|    |    | ||||||
|   auto& ro = ci_at[c].rocks; |   auto& ro = ci_at[c].rocks; | ||||||
|   auto r = std::make_unique<ads_object> (oMissile, c, S1, 0xC0C0FFFF); |   auto r = std::make_unique<ads_object> (oMissile, c, S1, 0xC0C0FFFF); | ||||||
| @@ -173,7 +173,7 @@ bool ads_turn(int idelta) { | |||||||
|     if(!paused) { |     if(!paused) { | ||||||
|       pdata.fuel -= delta*accel*mul; |       pdata.fuel -= delta*accel*mul; | ||||||
|       cell *c = hybrid::get_where(vctr).first; |       cell *c = hybrid::get_where(vctr).first; | ||||||
|       gen_particles(rpoisson(delta*accel*mul*20), c, ads_inverse(current * vctrV) * spin(ang*degree+M_PI) * rots::uxpush(0.06), rsrc_color[rtFuel], 0.15, 0.02); |       gen_particles(rpoisson(delta*accel*mul*fuel_particle_qty), c, ads_inverse(current * vctrV) * spin(ang*degree+M_PI) * rots::uxpush(0.06), rsrc_color[rtFuel], fuel_particle_rapidity, fuel_particle_life, 0.02); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|     ld tc = 0; |     ld tc = 0; | ||||||
|   | |||||||
| @@ -86,6 +86,16 @@ bool auto_angle = true; | |||||||
| ld rock_density = 0.25; | ld rock_density = 0.25; | ||||||
| ld rock_max_rapidity = 1.5; | ld rock_max_rapidity = 1.5; | ||||||
|  |  | ||||||
|  | ld missile_rapidity = 3; // speed is tanh(3) = about 0.95c | ||||||
|  |  | ||||||
|  | ld crash_particle_rapidity = 1; | ||||||
|  | ld crash_particle_qty = 8; | ||||||
|  | ld crash_particle_life = .5; | ||||||
|  |  | ||||||
|  | ld fuel_particle_rapidity = 1; | ||||||
|  | ld fuel_particle_qty = 20; | ||||||
|  | ld fuel_particle_life = .15; | ||||||
|  |  | ||||||
| cell *starting_point; | cell *starting_point; | ||||||
|  |  | ||||||
| }} | }} | ||||||
|   | |||||||
| @@ -181,10 +181,10 @@ void gen_rocks(cell *c, cellinfo& ci, int radius) { | |||||||
|   ci.rock_dist = radius; |   ci.rock_dist = radius; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| void gen_particles(int qty, cell *c, shiftmatrix from, color_t col, ld t, ld spread = 1) { | void gen_particles(int qty, cell *c, shiftmatrix from, color_t col, ld spd, ld t, ld spread = 1) { | ||||||
|   auto& ro = ci_at[c].rocks; |   auto& ro = ci_at[c].rocks; | ||||||
|   for(int i=0; i<qty; i++) { |   for(int i=0; i<qty; i++) { | ||||||
|     auto r = std::make_unique<ads_object>(oParticle, c, from * spin(randd() * TAU * spread) * lorentz(0, 2, 1 + randd()), col ); |     auto r = std::make_unique<ads_object>(oParticle, c, from * spin(randd() * TAU * spread) * lorentz(0, 2, (.5 + randd() * .5) * spd), col ); | ||||||
|     r->shape = &shape_particle; |     r->shape = &shape_particle; | ||||||
|     r->life_end = randd() * t; |     r->life_end = randd() * t; | ||||||
|     r->life_start = 0; |     r->life_start = 0; | ||||||
| @@ -222,7 +222,7 @@ void crash_ship() { | |||||||
|   if(pdata.hitpoints <= 0) game_over = true; |   if(pdata.hitpoints <= 0) game_over = true; | ||||||
|   hybrid::in_actual([&] { |   hybrid::in_actual([&] { | ||||||
|     cell *c = hybrid::get_where(vctr).first; |     cell *c = hybrid::get_where(vctr).first; | ||||||
|     gen_particles(16, c, ads_inverse(current * vctrV) * spin(ang*degree), rsrc_color[rtHull], 0.5); |     gen_particles(rpoisson(crash_particle_qty * 2), c, ads_inverse(current * vctrV) * spin(ang*degree), rsrc_color[rtHull], crash_particle_rapidity, crash_particle_life); | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -247,8 +247,8 @@ void handle_crashes() { | |||||||
|           m->life_end = m->pt_main.shift; |           m->life_end = m->pt_main.shift; | ||||||
|           r->life_end = r->pt_main.shift; |           r->life_end = r->pt_main.shift; | ||||||
|           hybrid::in_actual([&] { |           hybrid::in_actual([&] { | ||||||
|             gen_particles(8, m->owner, m->at * ads_matrix(Id, m->life_end), missile_color, 0.1); |             gen_particles(rpoisson(crash_particle_qty), m->owner, m->at * ads_matrix(Id, m->life_end), missile_color, crash_particle_rapidity, crash_particle_life); | ||||||
|             gen_particles(8, r->owner, r->at * ads_matrix(Id, r->life_end), r->col, 0.5); |             gen_particles(rpoisson(crash_particle_qty), r->owner, r->at * ads_matrix(Id, r->life_end), r->col, crash_particle_rapidity, crash_particle_life); | ||||||
|             gen_resource(r->owner, r->at * ads_matrix(Id, r->life_end), r->resource); |             gen_resource(r->owner, r->at * ads_matrix(Id, r->life_end), r->resource); | ||||||
|             }); |             }); | ||||||
|           } |           } | ||||||
|   | |||||||
| @@ -21,6 +21,24 @@ void edit_difficulty() { | |||||||
|   dialog::display(); |   dialog::display(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | void edit_particles() { | ||||||
|  |   cmode = sm::SIDE | sm::MAYDARK; | ||||||
|  |   gamescreen(); | ||||||
|  |  | ||||||
|  |   dialog::init(XLAT("AdS particle settings"), 0xC0C0FFFF, 150, 100); | ||||||
|  |  | ||||||
|  |   add_edit(crash_particle_rapidity); | ||||||
|  |   add_edit(crash_particle_qty); | ||||||
|  |   add_edit(crash_particle_life); | ||||||
|  |   add_edit(fuel_particle_rapidity); | ||||||
|  |   add_edit(fuel_particle_qty); | ||||||
|  |   add_edit(fuel_particle_life); | ||||||
|  |  | ||||||
|  |   dialog::addBreak(100); | ||||||
|  |   dialog::addBack(); | ||||||
|  |   dialog::display(); | ||||||
|  |   } | ||||||
|  |  | ||||||
| void game_menu() { | void game_menu() { | ||||||
|   cmode = sm::SIDE | sm::MAYDARK; |   cmode = sm::SIDE | sm::MAYDARK; | ||||||
|   gamescreen(); |   gamescreen(); | ||||||
| @@ -36,6 +54,9 @@ void game_menu() { | |||||||
|   add_edit(auto_rotate); |   add_edit(auto_rotate); | ||||||
|   add_edit(auto_angle); |   add_edit(auto_angle); | ||||||
|  |  | ||||||
|  |   dialog::addItem(XLAT("particle settings"), 'p'); | ||||||
|  |   dialog::add_action_push(edit_particles); | ||||||
|  |  | ||||||
|   dialog::addItem(XLAT("restart game"), 'r'); |   dialog::addItem(XLAT("restart game"), 'r'); | ||||||
|   dialog::add_action([] { ads_game::restart(); popScreen(); }); |   dialog::add_action([] { ads_game::restart(); popScreen(); }); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue