hyperrogue/rogueviz/ads/globals.cpp

151 lines
3.3 KiB
C++
Raw Normal View History

2022-09-11 10:16:50 +00:00
namespace hr {
namespace ads_game {
/** simulation speed */
ld ads_simspeed = TAU / 10;
ld ds_simspeed = M_PI / 10;
#define DS_(x) (main_rock ? ds_##x : ads_##x)
2022-09-11 10:16:50 +00:00
/** by how much do WAS keys accelerate */
ld ads_accel = 6 * ads_simspeed;
ld ds_accel = 15 * ds_simspeed;
2022-09-11 10:16:50 +00:00
2022-09-18 08:22:13 +00:00
/** cursor movement speed while paused */
ld pause_speed = 0.5;
2022-09-18 08:22:13 +00:00
/** time unit for time display */
ld ads_time_unit = TAU;
ld ds_time_unit = 1;
2022-09-18 08:22:13 +00:00
/** transform world coordinates to current view coordinates */
2022-09-11 10:16:50 +00:00
ads_matrix current;
/** transform world coordinates to ship coordinates (used when paused) */
ads_matrix current_ship;
/** hyperbolic cell closest to the current view/ship */
cell *vctr, *new_vctr, *vctr_ship;
2022-09-11 10:16:50 +00:00
/** world coordinates of vctr -- technically, this is a shiftmatrix */
ads_matrix vctrV, new_vctrV, vctrV_ship;
2022-09-11 10:16:50 +00:00
/** how far is vctr from the ship */
ld vctr_dist;
/** how is the ship shape rotated */
ld ang = 0;
/** ship's current proper time */
ld ship_pt;
/** paused camera's current proper time */
ld view_pt;
2022-09-12 10:57:52 +00:00
/** until when is the ship invincible */
ld invincibility_pt;
2022-09-11 10:16:50 +00:00
/** is the game paused */
bool paused;
/** auto-rotate the screen */
bool auto_rotate = false;
/** should we display the proper times of all objects */
bool view_proper_times = false;
/** format for displaying time */
const char *tformat = "%.2f";
void game_menu();
2022-09-18 08:22:25 +00:00
void restart();
2022-09-18 11:45:45 +00:00
void change_scale(ld s);
2022-09-11 10:16:50 +00:00
2022-09-11 11:42:51 +00:00
/** all the missiles and objects currently displayed */
2022-09-11 11:43:44 +00:00
vector<struct ads_object*> displayed;
2022-09-11 11:42:51 +00:00
2022-09-18 11:03:14 +00:00
/** how much should be the objects scaled */
ld ads_scale = 1;
ld ds_scale = 1;
2022-09-18 11:03:14 +00:00
2022-09-11 11:42:51 +00:00
color_t missile_color = 0xFF0000FF;
2022-09-12 10:57:52 +00:00
bool game_over;
2022-09-12 10:24:18 +00:00
struct player_data {
int hitpoints;
int score;
int ammo;
ld fuel;
ld oxygen;
};
ld ads_how_much_invincibility = TAU / 4;
ld ds_how_much_invincibility = TAU / 4;
2022-09-12 10:57:52 +00:00
player_data pdata, ads_max_pdata, ads_tank_pdata, ds_max_pdata, ds_tank_pdata;
2022-09-12 10:24:18 +00:00
bool auto_angle = true;
2022-09-18 10:58:18 +00:00
ld rock_density = 0.25;
ld rock_max_rapidity = 1.5;
ld ads_missile_rapidity = 3; // speed is tanh(3) = about 0.95c
ld ds_missile_rapidity = 3; // speed is tanh(3) = about 0.95c
2022-09-18 11:14:46 +00:00
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;
2022-09-18 08:22:13 +00:00
cell *starting_point;
2022-09-18 11:34:30 +00:00
int max_gen_per_frame = 3;
int draw_per_frame = 1000;
2022-09-20 10:29:19 +00:00
/* for DS */
2022-09-28 19:26:43 +00:00
ads_object *main_rock;
2022-09-29 10:11:50 +00:00
extern string copyright_shown;
2023-08-08 10:05:18 +00:00
extern local_parameter_set lps_relhell, lps_relhell_space, lps_relhell_ads_spacetime, lps_relhell_ds_spacetime_pers, lps_relhell_ds_spacetime_klein;
2023-08-07 15:15:50 +00:00
int XSCALE = 48;
int YSCALE = 48;
2022-09-28 17:18:04 +00:00
int talpha = 32;
void init_textures();
void pick_textures();
void draw_textures();
void reset_textures();
void ds_restart();
void run_ads_game_std();
void run_ds_game();
2023-08-07 15:15:50 +00:00
void run_ds_game_std();
2022-10-09 11:15:57 +00:00
/** in the replay mode */
2023-02-03 14:28:37 +00:00
bool rev_replay;
2022-10-09 11:15:57 +00:00
bool in_replay;
void switch_replay();
2022-10-15 12:22:09 +00:00
void switch_pause();
2022-10-13 23:01:50 +00:00
void replay_animation();
2022-10-15 12:26:12 +00:00
bool in_spacetime();
void switch_spacetime();
void switch_spacetime_to(bool);
2022-10-13 23:01:50 +00:00
bool ads_draw_cell(cell *c, const shiftmatrix& V);
2022-10-15 12:23:53 +00:00
extern transmatrix Duality;
extern int use_duality;
2022-10-09 11:15:57 +00:00
ld spacetime_step = 0.1;
int spacetime_qty = 30;
color_t ghost_color = 0x800080FF;
2022-09-11 10:16:50 +00:00
}}