diff --git a/rogueviz/ads/ads-game.cpp b/rogueviz/ads/ads-game.cpp index 74298dda..df5cfdbd 100644 --- a/rogueviz/ads/ads-game.cpp +++ b/rogueviz/ads/ads-game.cpp @@ -51,7 +51,7 @@ void restart() { gen_terrain(vctr, ci_at[vctr], -2); forCellEx(c1, vctr) ci_at[c1].type = wtNone; ci_at[vctr].type = wtNone; - invincibility_pt = how_much_invincibility; + invincibility_pt = ads_how_much_invincibility; paused = false; ship_pt = 0; @@ -108,14 +108,14 @@ void run_ads_game_std() { } void change_scale(ld s) { - scale *= s; + ads_scale *= s; rock_density /= (s * s); rock_max_rapidity *= s; - simspeed *= s; + ads_simspeed *= s; pconf.scale /= s; - how_much_invincibility *= s; - max_pdata.oxygen *= s; - tank_pdata.oxygen *= s; + ads_how_much_invincibility *= s; + ads_max_pdata.oxygen *= s; + ads_tank_pdata.oxygen *= s; crash_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-restart", restart) + addHook(hooks_configfile, 100, [] { - param_f(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'); + param_f(ads_how_much_invincibility, "ads_invinc") + -> 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") -> editable("automatically rotate the projection", 'a'); - param_f(simspeed, "ads_game_simspeed") - -> editable(0, 2*TAU, TAU/4, "game speed", "Controls the speed of the game.", 's'); - param_f(scale, "ads_game_scale") - -> editable(0, 2, 0.1, "game scale", "Controls the scaling of game objects.", 'c'); - param_f(accel, "ads_game_accel") - -> editable(0, 30, 1, "acceleration", "Controls the speed of your ship's acceleration.", 'a'); - param_f(time_unit, "ads_time_unit") - -> editable(0, 2*TAU, 1, "time unit", + 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'); + 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'); + 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" "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." @@ -148,8 +162,10 @@ auto shot_hooks = -> editable(0, 5, 0.05, "rock density", "how many rocks to generate", 'd'); 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'); - 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_f(ads_missile_rapidity, "ads_missile_rapidity") + -> 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") -> editable("automatically rotate the screen", 'r'); param_b(view_proper_times, "ads_display") @@ -173,6 +189,13 @@ auto shot_hooks = 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'); + 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(); }); diff --git a/rogueviz/ads/control.cpp b/rogueviz/ads/control.cpp index c70a1683..4b0dcd74 100644 --- a/rogueviz/ads/control.cpp +++ b/rogueviz/ads/control.cpp @@ -11,7 +11,7 @@ void fire() { 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 r = std::make_unique (oMissile, c, S1, rsrc_color[rtAmmo]); @@ -161,7 +161,7 @@ bool ads_turn(int idelta) { if(true) { /* proper time passed */ - ld pt = delta * simspeed; + ld pt = delta * ads_simspeed; 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; } 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) { - pdata.fuel -= delta*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); + 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); } ld tc = 0; diff --git a/rogueviz/ads/display.cpp b/rogueviz/ads/display.cpp index 165cd9b3..632e0a72 100644 --- a/rogueviz/ads/display.cpp +++ b/rogueviz/ads/display.cpp @@ -90,7 +90,7 @@ void draw_game_cell(const cell_to_draw& cd) { } 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); } @@ -115,7 +115,7 @@ void draw_game_cell(const cell_to_draw& cd) { auto& shape = *rock.shape; for(int i=0; i> rocks; -int ds_rocks = 500; -bool mark_origin = false; - struct rock_generator { ld cshift; @@ -30,7 +27,7 @@ struct rock_generator { }; 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()); }; @@ -135,7 +132,7 @@ struct rock_generator { report("Rack"); int qty = 3 + rand() % 4; 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 spinv = rand_range(0, TAU); for(int i=0; ipts)) ds_crash_ship(); } @@ -315,7 +312,7 @@ void ds_fire() { 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 (oMissile, nullptr, ads_matrix(S1, current.shift), rsrc_color[rtAmmo]); r->shape = &shape_missile; @@ -354,19 +351,19 @@ bool ds_turn(int idelta) { if(true) { dynamicval g(geometry, gSpace435); - ld pt = delta * simspeed; + ld pt = delta * ds_simspeed; ld mul = read_movement(); 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*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) { - pdata.fuel -= delta*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); + 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); } ld tc = 0; @@ -445,7 +442,7 @@ cross_result ds_cross0_light(transmatrix T) { } 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() { @@ -501,7 +498,7 @@ void view_ds_game() { if(view_proper_times && rock.type != oParticle) { ld t = rock.pt_main.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); } @@ -533,7 +530,7 @@ void view_ds_game() { queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::MONSTER_FOOT); 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); } } @@ -541,20 +538,20 @@ void view_ds_game() { if(!game_over && !paused) { poly_outline = 0xFF; 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); } queuepolyat(shiftless(spin(ang*degree) * Id), shShip, shipcolor, PPR::MONSTER_HAIR); poly_outline = 0xFF; 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); } } 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); } @@ -587,7 +584,8 @@ void run_ds_game() { if(true) { dynamicval 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; @@ -603,11 +601,11 @@ void run_ds_game() { void ds_record() { 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; dynamicval b(paused, true); int a = addHook(anims::hooks_anim, 100, [&] { - view_pt = (ticks / full) * simspeed; + view_pt = (ticks / full) * ds_simspeed; for(auto& ss: history) if(ss.start + ss.duration > view_pt) { if(sphere) { @@ -633,8 +631,7 @@ void ds_record() { auto ds_hooks = arg::add3("-ds-game", run_ds_game) -+ arg::add3("-ds-record", ds_record) -; ++ arg::add3("-ds-record", ds_record); } } diff --git a/rogueviz/ads/ds-texture.cpp b/rogueviz/ads/ds-texture.cpp index 501bafed..951f1602 100644 --- a/rogueviz/ads/ds-texture.cpp +++ b/rogueviz/ads/ds-texture.cpp @@ -74,6 +74,7 @@ ld smoothstep(ld x) { } void draw_texture(texture_to_use& tu) { + if(!talpha) return; auto& et = *tu.tx; auto& tex = et.tex; diff --git a/rogueviz/ads/globals.cpp b/rogueviz/ads/globals.cpp index 304262bb..d8422e0a 100644 --- a/rogueviz/ads/globals.cpp +++ b/rogueviz/ads/globals.cpp @@ -3,16 +3,21 @@ namespace hr { namespace ads_game { /** 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 */ -ld accel = 6; +ld ads_accel = 6; +ld ds_accel = 15; /** cursor movement speed while paused */ ld pause_speed = 5; /** 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 */ ads_matrix current; @@ -61,7 +66,8 @@ void change_scale(ld s); vector displayed; /** how much should be the objects scaled */ -ld scale = 1; +ld ads_scale = 1; +ld ds_scale = 1; color_t missile_color = 0xFF0000FF; @@ -75,16 +81,18 @@ struct player_data { 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; ld rock_density = 0.25; 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_qty = 8; @@ -101,8 +109,6 @@ int draw_per_frame = 1000; /* for DS */ -ld ds_split_speed = 0.1; - ads_object *main_rock; int XSCALE = 64; diff --git a/rogueviz/ads/map.cpp b/rogueviz/ads/map.cpp index f55d4545..c364f661 100644 --- a/rogueviz/ads/map.cpp +++ b/rogueviz/ads/map.cpp @@ -230,7 +230,7 @@ bool pointcrash(hyperpoint h, const vector& vf) { } void common_crash_ship() { - invincibility_pt = ship_pt + how_much_invincibility; + invincibility_pt = ship_pt + DS_(how_much_invincibility); pdata.hitpoints--; if(pdata.hitpoints <= 0) game_over = true; } @@ -271,7 +271,7 @@ void handle_crashes() { } } if(!game_over) for(int i=0; ipts)) ads_crash_ship(); } diff --git a/rogueviz/ads/menu.cpp b/rogueviz/ads/menu.cpp index 8d17d496..8999e0e2 100644 --- a/rogueviz/ads/menu.cpp +++ b/rogueviz/ads/menu.cpp @@ -3,9 +3,9 @@ namespace hr { namespace ads_game { void adjust_for_scale() { - if(scale < 0.3) max_gen_per_frame = 1, draw_per_frame = 30, missile_rapidity = 1; - else if(scale < 0.8) max_gen_per_frame = 2, draw_per_frame = 100, missile_rapidity = 1; - else max_gen_per_frame = 3, draw_per_frame = 1000, missile_rapidity = 3; + if(ads_scale < 0.3) max_gen_per_frame = 1, draw_per_frame = 30, ads_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, ads_missile_rapidity = 3; } void edit_difficulty() { @@ -13,33 +13,40 @@ void edit_difficulty() { gamescreen(); dialog::init(XLAT("AdS game parameters"), 0xC0C0FFFF, 150, 100); - add_edit(simspeed); - add_edit(accel); - add_edit(how_much_invincibility); - add_edit(rock_max_rapidity); - add_edit(rock_density); - add_edit(scale); + add_edit(DS_(simspeed)); + add_edit(DS_(accel)); + add_edit(DS_(how_much_invincibility)); + add_edit(DS_(scale)); - dialog::addBreak(100); - add_edit(max_gen_per_frame); - add_edit(draw_per_frame); + if(!main_rock) { + dialog::addBreak(100); + add_edit(rock_max_rapidity); + add_edit(rock_density); + + dialog::addBreak(100); + add_edit(max_gen_per_frame); + add_edit(draw_per_frame); + } dialog::addBreak(100); edit_rsrc(); - dialog::addBreak(100); - dialog::addItem(XLAT("scale everything :2"), '!'); - dialog::add_action([] { - change_scale(1/2.); - adjust_for_scale(); - restart(); - }); - dialog::addItem(XLAT("scale everything *2"), '@'); - dialog::add_action([] { - change_scale(2.); - adjust_for_scale(); - restart(); - }); + if(!main_rock) { + dialog::addBreak(100); + dialog::addItem(XLAT("scale everything :2"), '!'); + dialog::add_action([] { + change_scale(1/2.); + adjust_for_scale(); + restart(); + }); + dialog::addItem(XLAT("scale everything *2"), '@'); + dialog::add_action([] { + change_scale(2.); + adjust_for_scale(); + restart(); + }); + } + dialog::addBack(); dialog::display(); } @@ -48,7 +55,7 @@ void edit_particles() { cmode = sm::SIDE | sm::MAYDARK; 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_qty); @@ -57,6 +64,13 @@ void edit_particles() { add_edit(fuel_particle_qty); add_edit(fuel_particle_life); + if(main_rock) { + dialog::addBreak(100); + add_edit(XSCALE); + add_edit(YSCALE); + add_edit(talpha); + } + dialog::addBreak(100); dialog::addBack(); dialog::display(); @@ -73,11 +87,11 @@ void game_menu() { add_edit(pause_speed); add_edit(view_proper_times); - add_edit(time_unit); - add_edit(auto_rotate); - add_edit(auto_angle); + add_edit(DS_(time_unit)); + if(!main_rock) add_edit(auto_rotate); + 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::addItem(XLAT("restart game"), 'r'); diff --git a/rogueviz/ads/resources.cpp b/rogueviz/ads/resources.cpp index 42867d63..8b468074 100644 --- a/rogueviz/ads/resources.cpp +++ b/rogueviz/ads/resources.cpp @@ -10,17 +10,29 @@ color_t rsrc_color[6] = { 0x404040FF, 0x40C0C0FF, 0xFFD500FF, 0xFF0000FF, 0x00FF vector* rsrc_shape[6] = { &shape_particle, &shape_heart, &shape_gold, &shape_weapon, &shape_fuel, &shape_airtank }; void rsrc_config() { - max_pdata.hitpoints = 3; - max_pdata.score = 0; - max_pdata.ammo = 50; - max_pdata.fuel = 12 * TAU; - max_pdata.oxygen = 20 * TAU; + ads_max_pdata.hitpoints = 3; + ads_max_pdata.score = 0; + ads_max_pdata.ammo = 50; + ads_max_pdata.fuel = 12 * TAU; + ads_max_pdata.oxygen = 20 * TAU; - tank_pdata.hitpoints = 1; - tank_pdata.score = 1; - tank_pdata.ammo = 20; - tank_pdata.fuel = 4 * TAU; - tank_pdata.oxygen = 5 * TAU; + ads_tank_pdata.hitpoints = 1; + ads_tank_pdata.score = 1; + ads_tank_pdata.ammo = 20; + ads_tank_pdata.fuel = 4 * 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) { 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'); }; - all(max_pdata, "ads_max_", "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_max_pdata, "ads_max_", "AdS maximum", "These control the maximum and initial values of your resources. "); + 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() { @@ -44,12 +58,12 @@ void edit_rsrc() { add_edit(d.fuel); add_edit(d.oxygen); }; - all(max_pdata); - all(tank_pdata); + all(DS_(max_pdata)); + all(DS_(tank_pdata)); } void init_rsrc() { - pdata = max_pdata; + pdata = DS_(max_pdata); game_over = false; } @@ -127,7 +141,7 @@ bool display_rsrc() { initquickqueue(); 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(3, 2, ammo, 1); D(4, 3, fuel, TAU); @@ -140,6 +154,8 @@ bool display_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; } println(hlog, "gain resource ", int(rsrc)); D(1, hitpoints) diff --git a/rogueviz/ads/shapes.cpp b/rogueviz/ads/shapes.cpp index 89adb9a1..24cdc693 100644 --- a/rogueviz/ads/shapes.cpp +++ b/rogueviz/ads/shapes.cpp @@ -17,6 +17,7 @@ vector shape_airtank = {-0.101054, 0.0134738, -0.0904219, 0.014429, -0.07790 vector 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() { + auto scale = DS_(scale); if(made_scale == scale) return; made_scale = scale; cgi.bshape(shShip, PPR::MONSTER_BODY);