mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-23 06:20:09 +00:00
vctr is now the hyperbolic cell (similar for some variables); also invincibility on start
This commit is contained in:
parent
03a3fd14a0
commit
43305ea1cd
@ -33,10 +33,10 @@ void restart() {
|
||||
|
||||
ci_at.clear();
|
||||
|
||||
gen_terrain(c, ci_at[c], -2);
|
||||
forCellEx(c1, c) ci_at[c1].type = wtNone;
|
||||
ci_at[c].type = wtNone;
|
||||
ci_at[c].rocks.clear();
|
||||
gen_terrain(vctr, ci_at[c], -2);
|
||||
forCellEx(c1, vctr) ci_at[c1].type = wtNone;
|
||||
ci_at[vctr].type = wtNone;
|
||||
invincibility_pt = how_much_invincibility;
|
||||
}
|
||||
|
||||
void run_ads_game() {
|
||||
@ -62,7 +62,7 @@ void run_ads_game() {
|
||||
}
|
||||
start_game();
|
||||
|
||||
starting_point = cwt.at;
|
||||
starting_point = hybrid::get_where(cwt.at).first;
|
||||
|
||||
rogueviz::rv_hook(hooks_frame, 100, view_ads_game);
|
||||
rogueviz::rv_hook(hooks_prestats, 100, display_rsrc);
|
||||
|
@ -7,9 +7,7 @@ vector<string> move_names = { "acc down", "acc left", "acc up", "acc right", "fi
|
||||
void fire() {
|
||||
if(!pdata.ammo) return;
|
||||
pdata.ammo--;
|
||||
auto g = hybrid::get_where(vctr);
|
||||
auto c = g.first;
|
||||
if(g.second != 0) println(hlog, "WARNING: vctr not zeroed");
|
||||
auto c = vctr;
|
||||
|
||||
ads_matrix S0 = ads_inverse(current * vctrV) * spin(ang*degree);
|
||||
|
||||
@ -21,12 +19,12 @@ void fire() {
|
||||
r->life_start = 0;
|
||||
|
||||
ads_matrix Scell(Id, 0);
|
||||
cell *lcell = vctr;
|
||||
auto wcell = hybrid::get_where(lcell);
|
||||
cell *lcell = hybrid::get_at(vctr, 0);
|
||||
auto wcell = make_pair(vctr, 0);
|
||||
|
||||
int steps = 0;
|
||||
|
||||
compute_life(vctr, unshift(r->at), [&] (cell *c1, ld t) {
|
||||
compute_life(lcell, unshift(r->at), [&] (cell *c1, ld t) {
|
||||
if(true) for(int i=0; i<lcell->type; i++) {
|
||||
auto lcell1 = lcell->cmove(i);
|
||||
auto wcell1 = hybrid::get_where(lcell1);
|
||||
@ -118,7 +116,6 @@ bool ads_turn(int idelta) {
|
||||
current_ship = current;
|
||||
vctr_ship = vctr;
|
||||
vctrV_ship = vctrV;
|
||||
vctr_ship_base = hybrid::get_where(vctr_ship).first;
|
||||
view_pt = 0;
|
||||
}
|
||||
else {
|
||||
@ -172,8 +169,7 @@ bool ads_turn(int idelta) {
|
||||
|
||||
if(!paused) {
|
||||
pdata.fuel -= delta*accel*mul;
|
||||
cell *c = hybrid::get_where(vctr).first;
|
||||
gen_particles(rpoisson(delta*accel*mul*fuel_particle_qty), c, 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*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);
|
||||
}
|
||||
|
||||
ld tc = 0;
|
||||
@ -182,7 +178,7 @@ bool ads_turn(int idelta) {
|
||||
else if(a[16+10]) tc = -pt;
|
||||
|
||||
if(!paused && !game_over) {
|
||||
auto& v = ci_at[hybrid::get_where(vctr).first].shipstates;
|
||||
auto& v = ci_at[vctr].shipstates;
|
||||
v.emplace_back();
|
||||
v.back().at = ads_inverse(current * vctrV) * spin((ang+90)*degree);
|
||||
v.back().start = ship_pt;
|
||||
|
@ -8,10 +8,7 @@ cross_result findflat(shiftpoint h) {
|
||||
return cross0(current * rgpushxto0(h));
|
||||
}
|
||||
|
||||
void draw_game_cell(cell *cs, ads_matrix V, ld plev) {
|
||||
auto g = PIA( hybrid::get_where(cs) );
|
||||
adjust_to_zero(V, g, plev);
|
||||
auto c = g.first;
|
||||
void draw_game_cell(cell *c, ads_matrix V, ld plev) {
|
||||
|
||||
cross_result center;
|
||||
vector<cross_result> hlist;
|
||||
@ -26,7 +23,7 @@ void draw_game_cell(cell *cs, ads_matrix V, ld plev) {
|
||||
|
||||
if(1) {
|
||||
ld d = hdist0(center.h);
|
||||
if(d < vctr_dist) vctr_dist = d, new_vctr = PIA( hybrid::get_at(c, 0) ), new_vctrV = V;
|
||||
if(d < vctr_dist) vctr_dist = d, new_vctr = c, new_vctrV = V;
|
||||
}
|
||||
|
||||
auto& ci = ci_at[c];
|
||||
@ -152,7 +149,7 @@ void draw_game_cell(cell *cs, ads_matrix V, ld plev) {
|
||||
queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::LINE);
|
||||
}
|
||||
|
||||
if(paused && c == vctr_ship_base && !game_over) {
|
||||
if(paused && c == vctr_ship && !game_over) {
|
||||
vector<hyperpoint> pts;
|
||||
vector<ld> times;
|
||||
int ok = 0, bad = 0;
|
||||
@ -210,8 +207,6 @@ void view_ads_game() {
|
||||
}
|
||||
}
|
||||
);
|
||||
// current = current * gpushxto0(p);
|
||||
// vctrV = rgpushxto0(p) * vctrV;
|
||||
|
||||
if(1) {
|
||||
make_shape();
|
||||
@ -221,9 +216,8 @@ void view_ads_game() {
|
||||
auto cmp = [] (const key& a1, const key& a2) { return get<0>(a1) < get<0>(a2); };
|
||||
std::priority_queue<key, vector<key>, decltype(cmp)> dq(cmp);
|
||||
auto visit = [&] (ld t, cell *c, const ads_matrix& V) {
|
||||
auto w = hybrid::get_where(c);
|
||||
if(visited.count(w.first)) return;
|
||||
visited.insert(w.first);
|
||||
if(visited.count(c)) return;
|
||||
visited.insert(c);
|
||||
dq.emplace(t, c, V);
|
||||
};
|
||||
|
||||
@ -245,17 +239,17 @@ void view_ads_game() {
|
||||
draw_game_cell(c, V, plev);
|
||||
|
||||
hybrid::in_actual([&] {
|
||||
for(int i=0; i<c->type-2; i++) {
|
||||
cell *c2 = c->cmove(i);
|
||||
auto V1 = V * currentmap->adj(c, i);
|
||||
auto csl = hybrid::get_at(c, 0);
|
||||
for(int i=0; i<c->type; i++) {
|
||||
cell *csl2 = csl->cmove(i);
|
||||
auto V1 = V * currentmap->adj(csl, i);
|
||||
optimize_shift(V1);
|
||||
|
||||
auto g = hybrid::get_where(c2);
|
||||
auto g = hybrid::get_where(csl2);
|
||||
adjust_to_zero(V1, g, plev);
|
||||
c2 = hybrid::get_at(g.first, 0);
|
||||
auto center = findflat(V1 * C0);
|
||||
|
||||
visit(-hdist0(center.h), c2, V1);
|
||||
visit(-hdist0(center.h), g.first, V1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -20,11 +20,8 @@ ads_matrix current;
|
||||
/** transform world coordinates to ship coordinates (used when paused) */
|
||||
ads_matrix current_ship;
|
||||
|
||||
/** SL cell closest to the current view/ship */
|
||||
cell *vctr, *new_vctr, *vctr_ship;
|
||||
|
||||
/** hyperbolic cell closest to the current view/ship */
|
||||
cell *vctr_ship_base;
|
||||
cell *vctr, *new_vctr, *vctr_ship;
|
||||
|
||||
/** world coordinates of vctr -- technically, this is a shiftmatrix */
|
||||
ads_matrix vctrV, new_vctrV, vctrV_ship;
|
||||
|
@ -221,8 +221,7 @@ void crash_ship() {
|
||||
pdata.hitpoints--;
|
||||
if(pdata.hitpoints <= 0) game_over = true;
|
||||
hybrid::in_actual([&] {
|
||||
cell *c = hybrid::get_where(vctr).first;
|
||||
gen_particles(rpoisson(crash_particle_qty * 2), c, ads_inverse(current * vctrV) * spin(ang*degree), rsrc_color[rtHull], crash_particle_rapidity, crash_particle_life);
|
||||
gen_particles(rpoisson(crash_particle_qty * 2), vctr, ads_inverse(current * vctrV) * spin(ang*degree), rsrc_color[rtHull], crash_particle_rapidity, crash_particle_life);
|
||||
});
|
||||
}
|
||||
|
||||
@ -271,7 +270,7 @@ void handle_crashes() {
|
||||
hybrid::in_actual([&] {
|
||||
swap(h1[2], h1[3]);
|
||||
ads_point rel = ads_inverse(current * vctrV) * ads_point(h1, 0);
|
||||
cell *c = vctr;
|
||||
cell *c = hybrid::get_at(vctr, 0);
|
||||
virtualRebase(c, rel.h);
|
||||
optimize_shift(rel);
|
||||
auto w = hybrid::get_where(c);
|
||||
|
Loading…
x
Reference in New Issue
Block a user