mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-06-19 06:44:08 +00:00
settings for dS (also are now separate from adS)
This commit is contained in:
parent
a775a74bb2
commit
a84a9c94dd
@ -51,7 +51,7 @@ void restart() {
|
|||||||
gen_terrain(vctr, ci_at[vctr], -2);
|
gen_terrain(vctr, ci_at[vctr], -2);
|
||||||
forCellEx(c1, vctr) ci_at[c1].type = wtNone;
|
forCellEx(c1, vctr) ci_at[c1].type = wtNone;
|
||||||
ci_at[vctr].type = wtNone;
|
ci_at[vctr].type = wtNone;
|
||||||
invincibility_pt = how_much_invincibility;
|
invincibility_pt = ads_how_much_invincibility;
|
||||||
|
|
||||||
paused = false;
|
paused = false;
|
||||||
ship_pt = 0;
|
ship_pt = 0;
|
||||||
@ -108,14 +108,14 @@ void run_ads_game_std() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void change_scale(ld s) {
|
void change_scale(ld s) {
|
||||||
scale *= s;
|
ads_scale *= s;
|
||||||
rock_density /= (s * s);
|
rock_density /= (s * s);
|
||||||
rock_max_rapidity *= s;
|
rock_max_rapidity *= s;
|
||||||
simspeed *= s;
|
ads_simspeed *= s;
|
||||||
pconf.scale /= s;
|
pconf.scale /= s;
|
||||||
how_much_invincibility *= s;
|
ads_how_much_invincibility *= s;
|
||||||
max_pdata.oxygen *= s;
|
ads_max_pdata.oxygen *= s;
|
||||||
tank_pdata.oxygen *= s;
|
ads_tank_pdata.oxygen *= s;
|
||||||
crash_particle_life *= s;
|
crash_particle_life *= s;
|
||||||
fuel_particle_life *= s;
|
fuel_particle_life *= s;
|
||||||
}
|
}
|
||||||
@ -126,18 +126,32 @@ auto shot_hooks =
|
|||||||
+ arg::add3("-ads-scale", [] { arg::shift(); ld s = arg::argf(); change_scale(s); })
|
+ arg::add3("-ads-scale", [] { arg::shift(); ld s = arg::argf(); change_scale(s); })
|
||||||
+ arg::add3("-ads-restart", restart)
|
+ arg::add3("-ads-restart", restart)
|
||||||
+ addHook(hooks_configfile, 100, [] {
|
+ addHook(hooks_configfile, 100, [] {
|
||||||
param_f(how_much_invincibility, "ads_invinc")
|
param_f(ads_how_much_invincibility, "ads_invinc")
|
||||||
-> editable(0, TAU, TAU/4, "invincibility time", "How long does the period of invincibility after crashing last, in absolute units.", 'i');
|
-> editable(0, TAU, TAU/4, "AdS invincibility time", "How long does the period of invincibility after crashing last, in absolute units.", 'i');
|
||||||
|
param_f(ds_how_much_invincibility, "ads_invinc")
|
||||||
|
-> editable(0, TAU, TAU/4, "dS invincibility time", "How long does the period of invincibility after crashing last, in absolute units.", 'i');
|
||||||
param_b(auto_angle, "ads_auto_angle")
|
param_b(auto_angle, "ads_auto_angle")
|
||||||
-> editable("automatically rotate the projection", 'a');
|
-> editable("automatically rotate the projection", 'a');
|
||||||
param_f(simspeed, "ads_game_simspeed")
|
param_f(ads_simspeed, "ads_game_simspeed")
|
||||||
-> editable(0, 2*TAU, TAU/4, "game speed", "Controls the speed of the game.", 's');
|
-> editable(0, 2*TAU, TAU/4, "AdS game speed", "Controls the speed of the game.", 's');
|
||||||
param_f(scale, "ads_game_scale")
|
param_f(ds_simspeed, "ads_game_simspeed")
|
||||||
-> editable(0, 2, 0.1, "game scale", "Controls the scaling of game objects.", 'c');
|
-> editable(0, 2*TAU, TAU/4, "dS game speed", "Controls the speed of the game.", 's');
|
||||||
param_f(accel, "ads_game_accel")
|
param_f(ads_scale, "ads_game_scale")
|
||||||
-> editable(0, 30, 1, "acceleration", "Controls the speed of your ship's acceleration.", 'a');
|
-> editable(0, 2, 0.1, "AdS game scale", "Controls the scaling of game objects.", 'c');
|
||||||
param_f(time_unit, "ads_time_unit")
|
param_f(ds_scale, "ds_game_scale")
|
||||||
-> editable(0, 2*TAU, 1, "time unit",
|
-> 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');
|
||||||
|
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"
|
||||||
|
"It takes tau(=2π) units to go the full circle, so the default time unit is tau. You can also use the absolute units (1).\n\n"
|
||||||
|
"Times in settings are always specified in absolute units."
|
||||||
|
, 'a');
|
||||||
|
param_f(ds_time_unit, "ds_time_unit")
|
||||||
|
-> editable(0, 2*TAU, 1, "dS time unit",
|
||||||
"Controls the unit used when the 'display the proper times' option is on.\n\n"
|
"Controls the unit used when the 'display the proper times' option is on.\n\n"
|
||||||
"It takes tau(=2π) units to go the full circle, so the default time unit is tau. You can also use the absolute units (1).\n\n"
|
"It takes tau(=2π) units to go the full circle, so the default time unit is tau. You can also use the absolute units (1).\n\n"
|
||||||
"Times in settings are always specified in absolute units."
|
"Times in settings are always specified in absolute units."
|
||||||
@ -148,8 +162,10 @@ 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")
|
param_f(ads_missile_rapidity, "ads_missile_rapidity")
|
||||||
-> editable(0, 5, 0.05, "missile rapidity", "how fast should the missiles go relative to the ship", 'm');
|
-> editable(0, 5, 0.05, "AdS missile rapidity", "how fast should the missiles go relative to the ship", 'm');
|
||||||
|
param_f(ds_missile_rapidity, "ds_missile_rapidity")
|
||||||
|
-> editable(0, 5, 0.05, "dS 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")
|
||||||
@ -173,6 +189,13 @@ auto shot_hooks =
|
|||||||
param_i(draw_per_frame, "ads_draw_per_frame")
|
param_i(draw_per_frame, "ads_draw_per_frame")
|
||||||
-> editable(0, 3000, 0.1, "tiles to draw per frame", "reduce if the framerate is low", 'D');
|
-> editable(0, 3000, 0.1, "tiles to draw per frame", "reduce if the framerate is low", 'D');
|
||||||
|
|
||||||
|
param_i(XSCALE, "ds_xscale")
|
||||||
|
-> editable(4, 512, 16, "x precision of Earth-de Sitter", "", 'x');
|
||||||
|
param_i(YSCALE, "ds_yscale")
|
||||||
|
-> editable(4, 512, 16, "y precision of Earth-de Sitter", "", 'y');
|
||||||
|
param_i(talpha, "ds_talpha")
|
||||||
|
-> editable(0, 255, 16, "dS texture intensity", "", 't');
|
||||||
|
|
||||||
rsrc_config();
|
rsrc_config();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -11,7 +11,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, missile_rapidity);
|
ads_matrix S1 = S0 * lorentz(0, 2, ads_missile_rapidity);
|
||||||
|
|
||||||
auto& ro = ci_at[c].rocks;
|
auto& ro = ci_at[c].rocks;
|
||||||
auto r = std::make_unique<ads_object> (oMissile, c, S1, rsrc_color[rtAmmo]);
|
auto r = std::make_unique<ads_object> (oMissile, c, S1, rsrc_color[rtAmmo]);
|
||||||
@ -161,7 +161,7 @@ bool ads_turn(int idelta) {
|
|||||||
if(true) {
|
if(true) {
|
||||||
|
|
||||||
/* proper time passed */
|
/* proper time passed */
|
||||||
ld pt = delta * simspeed;
|
ld pt = delta * ads_simspeed;
|
||||||
|
|
||||||
ld mul = read_movement();
|
ld mul = read_movement();
|
||||||
|
|
||||||
@ -169,11 +169,11 @@ bool ads_turn(int idelta) {
|
|||||||
current = ads_matrix(spin(ang*degree) * xpush(mul*delta*-pause_speed) * spin(-ang*degree), 0) * current;
|
current = ads_matrix(spin(ang*degree) * xpush(mul*delta*-pause_speed) * spin(-ang*degree), 0) * current;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
apply_lorentz(spin(ang*degree) * lorentz(0, 2, -delta*accel*mul) * spin(-ang*degree));
|
apply_lorentz(spin(ang*degree) * lorentz(0, 2, -delta*ads_accel*mul) * spin(-ang*degree));
|
||||||
|
|
||||||
if(!paused) {
|
if(!paused) {
|
||||||
pdata.fuel -= delta*accel*mul;
|
pdata.fuel -= delta*ads_accel*mul;
|
||||||
gen_particles(rpoisson(delta*accel*mul*fuel_particle_qty), vctr, ads_inverse(current * vctrV) * spin(ang*degree+M_PI) * rots::uxpush(0.06 * scale), rsrc_color[rtFuel], fuel_particle_rapidity, fuel_particle_life, 0.02);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
ld tc = 0;
|
ld tc = 0;
|
||||||
|
@ -90,7 +90,7 @@ void draw_game_cell(const cell_to_draw& cd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(view_proper_times) {
|
if(view_proper_times) {
|
||||||
string str = format(tformat, cd.center.shift / time_unit);
|
string str = format(tformat, cd.center.shift / ads_time_unit);
|
||||||
queuestr(shiftless(rgpushxto0(cd.center.h)), .1, str, 0xFF4040, 8);
|
queuestr(shiftless(rgpushxto0(cd.center.h)), .1, str, 0xFF4040, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ void draw_game_cell(const cell_to_draw& cd) {
|
|||||||
auto& shape = *rock.shape;
|
auto& shape = *rock.shape;
|
||||||
for(int i=0; i<isize(shape); i += 2) {
|
for(int i=0; i<isize(shape); i += 2) {
|
||||||
hybrid::in_actual([&]{
|
hybrid::in_actual([&]{
|
||||||
auto h = V * rock.at * rots::uxpush(shape[i] * scale) * rots::uypush(shape[i+1] * scale);
|
auto h = V * rock.at * rots::uxpush(shape[i] * ads_scale) * rots::uypush(shape[i+1] * ads_scale);
|
||||||
cross_result f = cross0(current * h);
|
cross_result f = cross0(current * h);
|
||||||
rock.pts.push_back(f);
|
rock.pts.push_back(f);
|
||||||
});
|
});
|
||||||
@ -129,7 +129,7 @@ void draw_game_cell(const cell_to_draw& cd) {
|
|||||||
0x000000FF, rock.col, obj_prio[rock.type]);
|
0x000000FF, rock.col, obj_prio[rock.type]);
|
||||||
|
|
||||||
if(view_proper_times && rock.type != oParticle) {
|
if(view_proper_times && rock.type != oParticle) {
|
||||||
string str = format(tformat, rock.pt_main.shift / time_unit);
|
string str = format(tformat, rock.pt_main.shift / ads_time_unit);
|
||||||
queuestr(shiftless(rgpushxto0(rock.pt_main.h)), .1, str, 0xFFFFFF, 8);
|
queuestr(shiftless(rgpushxto0(rock.pt_main.h)), .1, str, 0xFFFFFF, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ void draw_game_cell(const cell_to_draw& cd) {
|
|||||||
auto& shape = shape_ship;
|
auto& shape = shape_ship;
|
||||||
for(int i=0; i<isize(shape); i += 2) {
|
for(int i=0; i<isize(shape); i += 2) {
|
||||||
hybrid::in_actual([&]{
|
hybrid::in_actual([&]{
|
||||||
auto h = V * rock.at * rgpushxto0(normalize(hyperpoint(shape[i] * scale, shape[i+1] * scale, 1, 0)));
|
auto h = V * rock.at * rgpushxto0(normalize(hyperpoint(shape[i] * ads_scale, shape[i+1] * ads_scale, 1, 0)));
|
||||||
pts.push_back(cross0(current * h).h);
|
pts.push_back(cross0(current * h).h);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ void draw_game_cell(const cell_to_draw& cd) {
|
|||||||
curvepoint(pts[0]);
|
curvepoint(pts[0]);
|
||||||
queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::MONSTER_FOOT);
|
queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::MONSTER_FOOT);
|
||||||
|
|
||||||
string str = format(tformat, (cr.shift + rock.start) / time_unit);
|
string str = format(tformat, (cr.shift + rock.start) / ads_time_unit);
|
||||||
queuestr(shiftless(rgpushxto0(cr.h)), .1, str, 0xC0C0C0, 8);
|
queuestr(shiftless(rgpushxto0(cr.h)), .1, str, 0xC0C0C0, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ void view_ads_game() {
|
|||||||
for(int u=0; u<30; u++) {
|
for(int u=0; u<30; u++) {
|
||||||
auto bcurrent = current;
|
auto bcurrent = current;
|
||||||
|
|
||||||
transmatrix T = spin(12*degree*u) * xpush(0.5);
|
transmatrix T = rgpushxto0( spin(12*degree*u) * xpush0(0.5) );
|
||||||
|
|
||||||
current.T = current.T * T;
|
current.T = current.T * T;
|
||||||
auto base1 = findflat(ads_point(C0, 0));
|
auto base1 = findflat(ads_point(C0, 0));
|
||||||
@ -275,20 +275,20 @@ void view_ads_game() {
|
|||||||
if(!game_over && !paused) {
|
if(!game_over && !paused) {
|
||||||
poly_outline = 0xFF;
|
poly_outline = 0xFF;
|
||||||
if(ship_pt < invincibility_pt) {
|
if(ship_pt < invincibility_pt) {
|
||||||
ld u = (invincibility_pt-ship_pt) / how_much_invincibility;
|
ld u = (invincibility_pt-ship_pt) / ads_how_much_invincibility;
|
||||||
poly_outline = gradient(shipcolor, rsrc_color[rtHull], 0, 0.5 + cos(5*u*TAU), 1);
|
poly_outline = gradient(shipcolor, rsrc_color[rtHull], 0, 0.5 + cos(5*u*TAU), 1);
|
||||||
}
|
}
|
||||||
queuepolyat(shiftless(spin(ang*degree) * Id), shShip, shipcolor, PPR::MONSTER_HAIR);
|
queuepolyat(shiftless(spin(ang*degree) * Id), shShip, shipcolor, PPR::MONSTER_HAIR);
|
||||||
poly_outline = 0xFF;
|
poly_outline = 0xFF;
|
||||||
|
|
||||||
if(view_proper_times) {
|
if(view_proper_times) {
|
||||||
string str = format(tformat, ship_pt / time_unit);
|
string str = format(tformat, ship_pt / ads_time_unit);
|
||||||
queuestr(shiftless(Id), .1, str, 0xFFFFFF, 8);
|
queuestr(shiftless(Id), .1, str, 0xFFFFFF, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(paused && view_proper_times) {
|
if(paused && view_proper_times) {
|
||||||
string str = format(tformat, view_pt / time_unit);
|
string str = format(tformat, view_pt / ads_time_unit);
|
||||||
queuestr(shiftless(Id), .1, str, 0xFFFF00, 8);
|
queuestr(shiftless(Id), .1, str, 0xFFFF00, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,6 @@ void set_default_keys();
|
|||||||
|
|
||||||
vector<unique_ptr<ads_object>> rocks;
|
vector<unique_ptr<ads_object>> rocks;
|
||||||
|
|
||||||
int ds_rocks = 500;
|
|
||||||
bool mark_origin = false;
|
|
||||||
|
|
||||||
struct rock_generator {
|
struct rock_generator {
|
||||||
ld cshift;
|
ld cshift;
|
||||||
|
|
||||||
@ -30,7 +27,7 @@ struct rock_generator {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void report(string s) {
|
void report(string s) {
|
||||||
println(hlog, lalign(10, format(tformat, cshift/time_unit)), ": ", s);
|
println(hlog, lalign(10, format(tformat, cshift/ds_time_unit)), ": ", s);
|
||||||
};
|
};
|
||||||
|
|
||||||
ld rand_range(ld a, ld b) { return lerp(a, b, randd()); };
|
ld rand_range(ld a, ld b) { return lerp(a, b, randd()); };
|
||||||
@ -135,7 +132,7 @@ struct rock_generator {
|
|||||||
report("Rack");
|
report("Rack");
|
||||||
int qty = 3 + rand() % 4;
|
int qty = 3 + rand() % 4;
|
||||||
ld rapidity = rand_range(1, 3);
|
ld rapidity = rand_range(1, 3);
|
||||||
ld step = rand_range(.45, .75);
|
ld step = rand_range(.45, .75) * ds_scale;
|
||||||
ld alpha = rand_range(0, TAU);
|
ld alpha = rand_range(0, TAU);
|
||||||
ld spinv = rand_range(0, TAU);
|
ld spinv = rand_range(0, TAU);
|
||||||
for(int i=0; i<qty; i++) {
|
for(int i=0; i<qty; i++) {
|
||||||
@ -149,8 +146,8 @@ struct rock_generator {
|
|||||||
void hyperboloid() {
|
void hyperboloid() {
|
||||||
report("Hyperboloid");
|
report("Hyperboloid");
|
||||||
ld alpha = randd() * TAU;
|
ld alpha = randd() * TAU;
|
||||||
ld range1 = rand_range(0.15, 0.25);
|
ld range1 = rand_range(0.15, 0.25) * ds_scale;
|
||||||
ld range2 = rand_range(0.35, 0.45);
|
ld range2 = rand_range(0.35, 0.45) * ds_scale;
|
||||||
cshift += rand_range(2, 3);
|
cshift += rand_range(2, 3);
|
||||||
ld rapidity = rand_range(-3, 3);
|
ld rapidity = rand_range(-3, 3);
|
||||||
int qty = 20 + rand() % 10;
|
int qty = 20 + rand() % 10;
|
||||||
@ -173,7 +170,7 @@ struct rock_generator {
|
|||||||
|
|
||||||
void add_random() {
|
void add_random() {
|
||||||
|
|
||||||
int r = rand() % 1000;
|
int r = rand() % 150;
|
||||||
|
|
||||||
#define Chance(q) if(r < 0) return; r -= (q); if(r < 0)
|
#define Chance(q) if(r < 0) return; r -= (q); if(r < 0)
|
||||||
Chance(10) death_cross(4);
|
Chance(10) death_cross(4);
|
||||||
@ -236,8 +233,8 @@ void init_ds_game() {
|
|||||||
/* also create shape_disk */
|
/* also create shape_disk */
|
||||||
shape_disk.clear();
|
shape_disk.clear();
|
||||||
for(int d=0; d<=360; d += 15) {
|
for(int d=0; d<=360; d += 15) {
|
||||||
shape_disk.push_back(sin(d*degree) * 0.1 * scale);
|
shape_disk.push_back(sin(d*degree) * 0.1 * ds_scale);
|
||||||
shape_disk.push_back(cos(d*degree) * 0.1 * scale);
|
shape_disk.push_back(cos(d*degree) * 0.1 * ds_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
rockgen.cshift += 2;
|
rockgen.cshift += 2;
|
||||||
@ -295,7 +292,7 @@ void ds_handle_crashes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!game_over) for(int i=0; i<isize(shape_ship); i+=2) {
|
if(!game_over) for(int i=0; i<isize(shape_ship); i+=2) {
|
||||||
hyperpoint h = spin(ang*degree) * hpxyz(shape_ship[i] * scale, shape_ship[i+1] * scale, 1);
|
hyperpoint h = spin(ang*degree) * hpxyz(shape_ship[i] * ds_scale, shape_ship[i+1] * ds_scale, 1);
|
||||||
for(auto r: drocks) {
|
for(auto r: drocks) {
|
||||||
if(pointcrash(h, r->pts)) ds_crash_ship();
|
if(pointcrash(h, r->pts)) ds_crash_ship();
|
||||||
}
|
}
|
||||||
@ -315,7 +312,7 @@ void ds_fire() {
|
|||||||
|
|
||||||
transmatrix S0 = inverse(current.T) * spin(ang*degree);
|
transmatrix S0 = inverse(current.T) * spin(ang*degree);
|
||||||
|
|
||||||
transmatrix S1 = S0 * lorentz(0, 3, missile_rapidity);
|
transmatrix S1 = S0 * lorentz(0, 3, ads_missile_rapidity);
|
||||||
|
|
||||||
auto r = std::make_unique<ads_object> (oMissile, nullptr, ads_matrix(S1, current.shift), rsrc_color[rtAmmo]);
|
auto r = std::make_unique<ads_object> (oMissile, nullptr, ads_matrix(S1, current.shift), rsrc_color[rtAmmo]);
|
||||||
r->shape = &shape_missile;
|
r->shape = &shape_missile;
|
||||||
@ -354,19 +351,19 @@ bool ds_turn(int idelta) {
|
|||||||
if(true) {
|
if(true) {
|
||||||
dynamicval<eGeometry> g(geometry, gSpace435);
|
dynamicval<eGeometry> g(geometry, gSpace435);
|
||||||
|
|
||||||
ld pt = delta * simspeed;
|
ld pt = delta * ds_simspeed;
|
||||||
ld mul = read_movement();
|
ld mul = read_movement();
|
||||||
|
|
||||||
if(paused && a[16+11]) {
|
if(paused && a[16+11]) {
|
||||||
current.T = spin(ang*degree) * cspin(0, 2, mul*delta*-pause_speed) * spin(-ang*degree) * current.T;
|
current.T = spin(ang*degree) * cspin(0, 2, mul*delta*-pause_speed) * spin(-ang*degree) * current.T;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
current.T = spin(ang*degree) * lorentz(0, 3, -delta*accel*mul) * spin(-ang*degree) * current.T;
|
current.T = spin(ang*degree) * lorentz(0, 3, -delta*ds_accel*mul) * spin(-ang*degree) * current.T;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!paused) {
|
if(!paused) {
|
||||||
pdata.fuel -= delta*accel*mul;
|
pdata.fuel -= delta*ds_accel*mul;
|
||||||
ds_gen_particles(rpoisson(delta*accel*mul*fuel_particle_qty), inverse(current.T) * spin(ang*degree+M_PI) * rots::uxpush(0.06 * scale), current.shift, rsrc_color[rtFuel], fuel_particle_rapidity, fuel_particle_life, 0.02);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
ld tc = 0;
|
ld tc = 0;
|
||||||
@ -445,7 +442,7 @@ cross_result ds_cross0_light(transmatrix T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
transmatrix tpt(ld x, ld y) {
|
transmatrix tpt(ld x, ld y) {
|
||||||
return cspin(0, 2, x * scale) * cspin(1, 2, y * scale);
|
return cspin(0, 2, x * ds_scale) * cspin(1, 2, y * ds_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void view_ds_game() {
|
void view_ds_game() {
|
||||||
@ -501,7 +498,7 @@ void view_ds_game() {
|
|||||||
if(view_proper_times && rock.type != oParticle) {
|
if(view_proper_times && rock.type != oParticle) {
|
||||||
ld t = rock.pt_main.shift;
|
ld t = rock.pt_main.shift;
|
||||||
if(rock.type == oMainRock) t += current.shift;
|
if(rock.type == oMainRock) t += current.shift;
|
||||||
string str = format(tformat, t / time_unit);
|
string str = format(tformat, t / ds_time_unit);
|
||||||
queuestr(shiftless(rgpushxto0(rock.pt_main.h)), .1, str, 0xFFFF00, 8);
|
queuestr(shiftless(rgpushxto0(rock.pt_main.h)), .1, str, 0xFFFF00, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,7 +530,7 @@ void view_ds_game() {
|
|||||||
queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::MONSTER_FOOT);
|
queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::MONSTER_FOOT);
|
||||||
|
|
||||||
if(view_proper_times) {
|
if(view_proper_times) {
|
||||||
string str = format(tformat, (cr.shift + ss.start) / time_unit);
|
string str = format(tformat, (cr.shift + ss.start) / ds_time_unit);
|
||||||
queuestr(shiftless(rgpushxto0(cr.h)), .1, str, 0xC0C0C0, 8);
|
queuestr(shiftless(rgpushxto0(cr.h)), .1, str, 0xC0C0C0, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -541,20 +538,20 @@ void view_ds_game() {
|
|||||||
if(!game_over && !paused) {
|
if(!game_over && !paused) {
|
||||||
poly_outline = 0xFF;
|
poly_outline = 0xFF;
|
||||||
if(ship_pt < invincibility_pt) {
|
if(ship_pt < invincibility_pt) {
|
||||||
ld u = (invincibility_pt-ship_pt) / how_much_invincibility;
|
ld u = (invincibility_pt-ship_pt) / ds_how_much_invincibility;
|
||||||
poly_outline = gradient(shipcolor, rsrc_color[rtHull], 0, 0.5 + cos(5*u*TAU), 1);
|
poly_outline = gradient(shipcolor, rsrc_color[rtHull], 0, 0.5 + cos(5*u*TAU), 1);
|
||||||
}
|
}
|
||||||
queuepolyat(shiftless(spin(ang*degree) * Id), shShip, shipcolor, PPR::MONSTER_HAIR);
|
queuepolyat(shiftless(spin(ang*degree) * Id), shShip, shipcolor, PPR::MONSTER_HAIR);
|
||||||
poly_outline = 0xFF;
|
poly_outline = 0xFF;
|
||||||
|
|
||||||
if(view_proper_times) {
|
if(view_proper_times) {
|
||||||
string str = format(tformat, ship_pt / time_unit);
|
string str = format(tformat, ship_pt / ds_time_unit);
|
||||||
queuestr(shiftless(Id), .1, str, 0xFFFFFF, 8);
|
queuestr(shiftless(Id), .1, str, 0xFFFFFF, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(paused && view_proper_times) {
|
if(paused && view_proper_times) {
|
||||||
string str = format(tformat, view_pt / time_unit);
|
string str = format(tformat, view_pt / ds_time_unit);
|
||||||
queuestr(shiftless(Id), .1, str, 0xFFFF00, 8);
|
queuestr(shiftless(Id), .1, str, 0xFFFF00, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,7 +584,8 @@ void run_ds_game() {
|
|||||||
|
|
||||||
if(true) {
|
if(true) {
|
||||||
dynamicval<eGeometry> g(geometry, gSpace435);
|
dynamicval<eGeometry> g(geometry, gSpace435);
|
||||||
current = cspin(0, 2, 0.2);
|
current = cspin(0, 2, 0.2 * ds_scale);
|
||||||
|
invincibility_pt = ds_how_much_invincibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
ship_pt = 0;
|
ship_pt = 0;
|
||||||
@ -603,11 +601,11 @@ void run_ds_game() {
|
|||||||
|
|
||||||
void ds_record() {
|
void ds_record() {
|
||||||
ld full = anims::period;
|
ld full = anims::period;
|
||||||
anims::period = full * history.back().start / simspeed;
|
anims::period = full * history.back().start / ds_simspeed;
|
||||||
anims::noframes = anims::period * 60 / 1000;
|
anims::noframes = anims::period * 60 / 1000;
|
||||||
dynamicval<bool> b(paused, true);
|
dynamicval<bool> b(paused, true);
|
||||||
int a = addHook(anims::hooks_anim, 100, [&] {
|
int a = addHook(anims::hooks_anim, 100, [&] {
|
||||||
view_pt = (ticks / full) * simspeed;
|
view_pt = (ticks / full) * ds_simspeed;
|
||||||
for(auto& ss: history)
|
for(auto& ss: history)
|
||||||
if(ss.start + ss.duration > view_pt) {
|
if(ss.start + ss.duration > view_pt) {
|
||||||
if(sphere) {
|
if(sphere) {
|
||||||
@ -633,8 +631,7 @@ void ds_record() {
|
|||||||
|
|
||||||
auto ds_hooks =
|
auto ds_hooks =
|
||||||
arg::add3("-ds-game", run_ds_game)
|
arg::add3("-ds-game", run_ds_game)
|
||||||
+ arg::add3("-ds-record", ds_record)
|
+ arg::add3("-ds-record", ds_record);
|
||||||
;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,7 @@ ld smoothstep(ld x) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void draw_texture(texture_to_use& tu) {
|
void draw_texture(texture_to_use& tu) {
|
||||||
|
if(!talpha) return;
|
||||||
auto& et = *tu.tx;
|
auto& et = *tu.tx;
|
||||||
auto& tex = et.tex;
|
auto& tex = et.tex;
|
||||||
|
|
||||||
|
@ -3,16 +3,21 @@ namespace hr {
|
|||||||
namespace ads_game {
|
namespace ads_game {
|
||||||
|
|
||||||
/** simulation speed */
|
/** simulation speed */
|
||||||
ld simspeed = TAU;
|
ld ads_simspeed = TAU;
|
||||||
|
ld ds_simspeed = M_PI;
|
||||||
|
|
||||||
|
#define DS_(x) (main_rock ? ds_##x : ads_##x)
|
||||||
|
|
||||||
/** by how much do WAS keys accelerate */
|
/** by how much do WAS keys accelerate */
|
||||||
ld accel = 6;
|
ld ads_accel = 6;
|
||||||
|
ld ds_accel = 15;
|
||||||
|
|
||||||
/** cursor movement speed while paused */
|
/** cursor movement speed while paused */
|
||||||
ld pause_speed = 5;
|
ld pause_speed = 5;
|
||||||
|
|
||||||
/** time unit for time display */
|
/** time unit for time display */
|
||||||
ld time_unit = TAU;
|
ld ads_time_unit = TAU;
|
||||||
|
ld ds_time_unit = 1;
|
||||||
|
|
||||||
/** transform world coordinates to current view coordinates */
|
/** transform world coordinates to current view coordinates */
|
||||||
ads_matrix current;
|
ads_matrix current;
|
||||||
@ -61,7 +66,8 @@ void change_scale(ld s);
|
|||||||
vector<struct ads_object*> displayed;
|
vector<struct ads_object*> displayed;
|
||||||
|
|
||||||
/** how much should be the objects scaled */
|
/** how much should be the objects scaled */
|
||||||
ld scale = 1;
|
ld ads_scale = 1;
|
||||||
|
ld ds_scale = 1;
|
||||||
|
|
||||||
color_t missile_color = 0xFF0000FF;
|
color_t missile_color = 0xFF0000FF;
|
||||||
|
|
||||||
@ -75,16 +81,18 @@ struct player_data {
|
|||||||
ld oxygen;
|
ld oxygen;
|
||||||
};
|
};
|
||||||
|
|
||||||
ld how_much_invincibility = TAU / 4;
|
ld ads_how_much_invincibility = TAU / 4;
|
||||||
|
ld ds_how_much_invincibility = TAU / 4;
|
||||||
|
|
||||||
player_data pdata, max_pdata, tank_pdata;
|
player_data pdata, ads_max_pdata, ads_tank_pdata, ds_max_pdata, ds_tank_pdata;
|
||||||
|
|
||||||
bool auto_angle = true;
|
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 ads_missile_rapidity = 3; // speed is tanh(3) = about 0.95c
|
||||||
|
ld ds_missile_rapidity = 3; // speed is tanh(3) = about 0.95c
|
||||||
|
|
||||||
ld crash_particle_rapidity = 1;
|
ld crash_particle_rapidity = 1;
|
||||||
ld crash_particle_qty = 8;
|
ld crash_particle_qty = 8;
|
||||||
@ -101,8 +109,6 @@ int draw_per_frame = 1000;
|
|||||||
|
|
||||||
/* for DS */
|
/* for DS */
|
||||||
|
|
||||||
ld ds_split_speed = 0.1;
|
|
||||||
|
|
||||||
ads_object *main_rock;
|
ads_object *main_rock;
|
||||||
|
|
||||||
int XSCALE = 64;
|
int XSCALE = 64;
|
||||||
|
@ -230,7 +230,7 @@ bool pointcrash(hyperpoint h, const vector<cross_result>& vf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void common_crash_ship() {
|
void common_crash_ship() {
|
||||||
invincibility_pt = ship_pt + how_much_invincibility;
|
invincibility_pt = ship_pt + DS_(how_much_invincibility);
|
||||||
pdata.hitpoints--;
|
pdata.hitpoints--;
|
||||||
if(pdata.hitpoints <= 0) game_over = true;
|
if(pdata.hitpoints <= 0) game_over = true;
|
||||||
}
|
}
|
||||||
@ -271,7 +271,7 @@ void handle_crashes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!game_over) for(int i=0; i<isize(shape_ship); i+=2) {
|
if(!game_over) for(int i=0; i<isize(shape_ship); i+=2) {
|
||||||
hyperpoint h = spin(ang*degree) * hpxyz(shape_ship[i] * scale, shape_ship[i+1] * scale, 1);
|
hyperpoint h = spin(ang*degree) * hpxyz(shape_ship[i] * ads_scale, shape_ship[i+1] * ads_scale, 1);
|
||||||
for(auto r: rocks) {
|
for(auto r: rocks) {
|
||||||
if(pointcrash(h, r->pts)) ads_crash_ship();
|
if(pointcrash(h, r->pts)) ads_crash_ship();
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,9 @@ namespace hr {
|
|||||||
namespace ads_game {
|
namespace ads_game {
|
||||||
|
|
||||||
void adjust_for_scale() {
|
void adjust_for_scale() {
|
||||||
if(scale < 0.3) max_gen_per_frame = 1, draw_per_frame = 30, missile_rapidity = 1;
|
if(ads_scale < 0.3) max_gen_per_frame = 1, draw_per_frame = 30, ads_missile_rapidity = 1;
|
||||||
else if(scale < 0.8) max_gen_per_frame = 2, draw_per_frame = 100, missile_rapidity = 1;
|
else if(ads_scale < 0.8) max_gen_per_frame = 2, draw_per_frame = 100, ads_missile_rapidity = 1;
|
||||||
else max_gen_per_frame = 3, draw_per_frame = 1000, missile_rapidity = 3;
|
else max_gen_per_frame = 3, draw_per_frame = 1000, ads_missile_rapidity = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void edit_difficulty() {
|
void edit_difficulty() {
|
||||||
@ -13,20 +13,25 @@ void edit_difficulty() {
|
|||||||
gamescreen();
|
gamescreen();
|
||||||
|
|
||||||
dialog::init(XLAT("AdS game parameters"), 0xC0C0FFFF, 150, 100);
|
dialog::init(XLAT("AdS game parameters"), 0xC0C0FFFF, 150, 100);
|
||||||
add_edit(simspeed);
|
add_edit(DS_(simspeed));
|
||||||
add_edit(accel);
|
add_edit(DS_(accel));
|
||||||
add_edit(how_much_invincibility);
|
add_edit(DS_(how_much_invincibility));
|
||||||
|
add_edit(DS_(scale));
|
||||||
|
|
||||||
|
if(!main_rock) {
|
||||||
|
dialog::addBreak(100);
|
||||||
add_edit(rock_max_rapidity);
|
add_edit(rock_max_rapidity);
|
||||||
add_edit(rock_density);
|
add_edit(rock_density);
|
||||||
add_edit(scale);
|
|
||||||
|
|
||||||
dialog::addBreak(100);
|
dialog::addBreak(100);
|
||||||
add_edit(max_gen_per_frame);
|
add_edit(max_gen_per_frame);
|
||||||
add_edit(draw_per_frame);
|
add_edit(draw_per_frame);
|
||||||
|
}
|
||||||
|
|
||||||
dialog::addBreak(100);
|
dialog::addBreak(100);
|
||||||
edit_rsrc();
|
edit_rsrc();
|
||||||
|
|
||||||
|
if(!main_rock) {
|
||||||
dialog::addBreak(100);
|
dialog::addBreak(100);
|
||||||
dialog::addItem(XLAT("scale everything :2"), '!');
|
dialog::addItem(XLAT("scale everything :2"), '!');
|
||||||
dialog::add_action([] {
|
dialog::add_action([] {
|
||||||
@ -40,6 +45,8 @@ void edit_difficulty() {
|
|||||||
adjust_for_scale();
|
adjust_for_scale();
|
||||||
restart();
|
restart();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
dialog::addBack();
|
dialog::addBack();
|
||||||
dialog::display();
|
dialog::display();
|
||||||
}
|
}
|
||||||
@ -48,7 +55,7 @@ void edit_particles() {
|
|||||||
cmode = sm::SIDE | sm::MAYDARK;
|
cmode = sm::SIDE | sm::MAYDARK;
|
||||||
gamescreen();
|
gamescreen();
|
||||||
|
|
||||||
dialog::init(XLAT("AdS particle settings"), 0xC0C0FFFF, 150, 100);
|
dialog::init(XLAT("particle/texture settings"), 0xC0C0FFFF, 150, 100);
|
||||||
|
|
||||||
add_edit(crash_particle_rapidity);
|
add_edit(crash_particle_rapidity);
|
||||||
add_edit(crash_particle_qty);
|
add_edit(crash_particle_qty);
|
||||||
@ -57,6 +64,13 @@ void edit_particles() {
|
|||||||
add_edit(fuel_particle_qty);
|
add_edit(fuel_particle_qty);
|
||||||
add_edit(fuel_particle_life);
|
add_edit(fuel_particle_life);
|
||||||
|
|
||||||
|
if(main_rock) {
|
||||||
|
dialog::addBreak(100);
|
||||||
|
add_edit(XSCALE);
|
||||||
|
add_edit(YSCALE);
|
||||||
|
add_edit(talpha);
|
||||||
|
}
|
||||||
|
|
||||||
dialog::addBreak(100);
|
dialog::addBreak(100);
|
||||||
dialog::addBack();
|
dialog::addBack();
|
||||||
dialog::display();
|
dialog::display();
|
||||||
@ -73,11 +87,11 @@ void game_menu() {
|
|||||||
|
|
||||||
add_edit(pause_speed);
|
add_edit(pause_speed);
|
||||||
add_edit(view_proper_times);
|
add_edit(view_proper_times);
|
||||||
add_edit(time_unit);
|
add_edit(DS_(time_unit));
|
||||||
add_edit(auto_rotate);
|
if(!main_rock) add_edit(auto_rotate);
|
||||||
add_edit(auto_angle);
|
if(!main_rock) add_edit(auto_angle);
|
||||||
|
|
||||||
dialog::addItem(XLAT("particle settings"), 'p');
|
dialog::addItem(XLAT("particle/texture settings"), 'p');
|
||||||
dialog::add_action_push(edit_particles);
|
dialog::add_action_push(edit_particles);
|
||||||
|
|
||||||
dialog::addItem(XLAT("restart game"), 'r');
|
dialog::addItem(XLAT("restart game"), 'r');
|
||||||
|
@ -10,17 +10,29 @@ color_t rsrc_color[6] = { 0x404040FF, 0x40C0C0FF, 0xFFD500FF, 0xFF0000FF, 0x00FF
|
|||||||
vector<ld>* rsrc_shape[6] = { &shape_particle, &shape_heart, &shape_gold, &shape_weapon, &shape_fuel, &shape_airtank };
|
vector<ld>* rsrc_shape[6] = { &shape_particle, &shape_heart, &shape_gold, &shape_weapon, &shape_fuel, &shape_airtank };
|
||||||
|
|
||||||
void rsrc_config() {
|
void rsrc_config() {
|
||||||
max_pdata.hitpoints = 3;
|
ads_max_pdata.hitpoints = 3;
|
||||||
max_pdata.score = 0;
|
ads_max_pdata.score = 0;
|
||||||
max_pdata.ammo = 50;
|
ads_max_pdata.ammo = 50;
|
||||||
max_pdata.fuel = 12 * TAU;
|
ads_max_pdata.fuel = 12 * TAU;
|
||||||
max_pdata.oxygen = 20 * TAU;
|
ads_max_pdata.oxygen = 20 * TAU;
|
||||||
|
|
||||||
tank_pdata.hitpoints = 1;
|
ads_tank_pdata.hitpoints = 1;
|
||||||
tank_pdata.score = 1;
|
ads_tank_pdata.score = 1;
|
||||||
tank_pdata.ammo = 20;
|
ads_tank_pdata.ammo = 20;
|
||||||
tank_pdata.fuel = 4 * TAU;
|
ads_tank_pdata.fuel = 4 * TAU;
|
||||||
tank_pdata.oxygen = 5 * TAU;
|
ads_tank_pdata.oxygen = 5 * TAU;
|
||||||
|
|
||||||
|
ds_max_pdata.hitpoints = 5;
|
||||||
|
ds_max_pdata.score = 0;
|
||||||
|
ds_max_pdata.ammo = 10;
|
||||||
|
ds_max_pdata.fuel = 12 * TAU;
|
||||||
|
ds_max_pdata.oxygen = 20 * TAU;
|
||||||
|
|
||||||
|
ds_tank_pdata.hitpoints = 1;
|
||||||
|
ds_tank_pdata.score = 1;
|
||||||
|
ds_tank_pdata.ammo = 2;
|
||||||
|
ds_tank_pdata.fuel = 8 * TAU;
|
||||||
|
ds_tank_pdata.oxygen = 15 * TAU;
|
||||||
|
|
||||||
auto all = [] (player_data& d, string s, string t, string u) {
|
auto all = [] (player_data& d, string s, string t, string u) {
|
||||||
param_i(d.hitpoints, s+"hp")
|
param_i(d.hitpoints, s+"hp")
|
||||||
@ -33,8 +45,10 @@ void rsrc_config() {
|
|||||||
->editable(0, 10, 3, t + (": oxygen"), u + ("Oxygen is drained whenever continuously."), '1');
|
->editable(0, 10, 3, t + (": oxygen"), u + ("Oxygen is drained whenever continuously."), '1');
|
||||||
};
|
};
|
||||||
|
|
||||||
all(max_pdata, "ads_max_", "maximum", "These control the maximum and initial values of your resources. ");
|
all(ads_max_pdata, "ads_max_", "AdS maximum", "These control the maximum and initial values of your resources. ");
|
||||||
all(tank_pdata, "ads_tank_", "bonus", "These control the amount of resource in a bonus tank. ");
|
all(ads_tank_pdata, "ads_tank_", "AdS bonus", "These control the amount of resource in a bonus tank. ");
|
||||||
|
all(ds_max_pdata, "ads_max_", "dS maximum", "These control the maximum and initial values of your resources. ");
|
||||||
|
all(ds_tank_pdata, "ads_tank_", "dS bonus", "These control the amount of resource in a bonus tank. ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void edit_rsrc() {
|
void edit_rsrc() {
|
||||||
@ -44,12 +58,12 @@ void edit_rsrc() {
|
|||||||
add_edit(d.fuel);
|
add_edit(d.fuel);
|
||||||
add_edit(d.oxygen);
|
add_edit(d.oxygen);
|
||||||
};
|
};
|
||||||
all(max_pdata);
|
all(DS_(max_pdata));
|
||||||
all(tank_pdata);
|
all(DS_(tank_pdata));
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_rsrc() {
|
void init_rsrc() {
|
||||||
pdata = max_pdata;
|
pdata = DS_(max_pdata);
|
||||||
game_over = false;
|
game_over = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +141,7 @@ bool display_rsrc() {
|
|||||||
initquickqueue();
|
initquickqueue();
|
||||||
check_cgi(); cgi.require_shapes();
|
check_cgi(); cgi.require_shapes();
|
||||||
|
|
||||||
#define D(id, y, field, unit) display(id, y, pdata.field, max_pdata.field, tank_pdata.field, unit)
|
#define D(id, y, field, unit) display(id, y, pdata.field, DS_(max_pdata).field, DS_(tank_pdata).field, unit)
|
||||||
D(1, 1, hitpoints, 1);
|
D(1, 1, hitpoints, 1);
|
||||||
D(3, 2, ammo, 1);
|
D(3, 2, ammo, 1);
|
||||||
D(4, 3, fuel, TAU);
|
D(4, 3, fuel, TAU);
|
||||||
@ -140,6 +154,8 @@ bool display_rsrc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void gain_resource(eResourceType rsrc) {
|
void gain_resource(eResourceType rsrc) {
|
||||||
|
auto& tank_pdata = DS_(tank_pdata);
|
||||||
|
auto& max_pdata = DS_(max_pdata);
|
||||||
#define D(id, field) if(rsrc == id) { pdata.field += tank_pdata.field; if(max_pdata.field && pdata.field > max_pdata.field) pdata.field = max_pdata.field; }
|
#define D(id, field) if(rsrc == id) { pdata.field += tank_pdata.field; if(max_pdata.field && pdata.field > max_pdata.field) pdata.field = max_pdata.field; }
|
||||||
println(hlog, "gain resource ", int(rsrc));
|
println(hlog, "gain resource ", int(rsrc));
|
||||||
D(1, hitpoints)
|
D(1, hitpoints)
|
||||||
|
@ -17,6 +17,7 @@ vector<ld> shape_airtank = {-0.101054, 0.0134738, -0.0904219, 0.014429, -0.07790
|
|||||||
vector<ld> shape_ship = { 0.0699706, 0, 0.0509304, 0.019032, 0.0056909, 0.023788, 0.0318813, 0.0309258, 0.0330715, 0.0368693, 0.00331668, 0.0380512, -0.0630665, 0.0699568, -0.0619577, 0.041535, -0.0678691, 0.0415233, -0.0678946, 0.0261072, -0.0572505, 0.0237463, -0.0572505, -0.0237463, -0.0678946, -0.0261072, -0.0678691, -0.0415233, -0.0619577, -0.041535, -0.0630665, -0.0699568, 0.00331668, -0.0380512, 0.0330715, -0.0368693, 0.0318813, -0.0309258, 0.0056909, -0.023788, 0.0509304, -0.019032 };
|
vector<ld> shape_ship = { 0.0699706, 0, 0.0509304, 0.019032, 0.0056909, 0.023788, 0.0318813, 0.0309258, 0.0330715, 0.0368693, 0.00331668, 0.0380512, -0.0630665, 0.0699568, -0.0619577, 0.041535, -0.0678691, 0.0415233, -0.0678946, 0.0261072, -0.0572505, 0.0237463, -0.0572505, -0.0237463, -0.0678946, -0.0261072, -0.0678691, -0.0415233, -0.0619577, -0.041535, -0.0630665, -0.0699568, 0.00331668, -0.0380512, 0.0330715, -0.0368693, 0.0318813, -0.0309258, 0.0056909, -0.023788, 0.0509304, -0.019032 };
|
||||||
|
|
||||||
void make_shape() {
|
void make_shape() {
|
||||||
|
auto scale = DS_(scale);
|
||||||
if(made_scale == scale) return;
|
if(made_scale == scale) return;
|
||||||
made_scale = scale;
|
made_scale = scale;
|
||||||
cgi.bshape(shShip, PPR::MONSTER_BODY);
|
cgi.bshape(shShip, PPR::MONSTER_BODY);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user