From 818d94382756decf87715a503e31b9774bec47fe Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 12 Sep 2022 14:57:47 +0200 Subject: [PATCH] ads-game:: crash with walls --- rogueviz/ads/map.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/rogueviz/ads/map.cpp b/rogueviz/ads/map.cpp index a2b7ca31..bc5e7df5 100644 --- a/rogueviz/ads/map.cpp +++ b/rogueviz/ads/map.cpp @@ -231,6 +231,25 @@ void handle_crashes() { gain_resource(r->resource); } } + + hyperpoint h1 = normalize(h); + swap(h1[2], h1[3]); + bool crashed = false; + hybrid::in_actual([&] { + ads_point rel = ads_inverse(current * vctrV) * ads_point(h1, 0); + cell *c = vctr; + virtualRebase(c, rel.h); + optimize_shift(rel); + auto w = hybrid::get_where(c); + auto& ci = ci_at[w.first]; + ld t = rel.shift + w.second * cgi.plevel; + if(ci.type == wtDestructible || ci.type == wtSolid || (ci.type == wtGate && (int(floor(t)) & 3) == 0)) { + if(!crashed && ship_pt > invincibility_pt) println(hlog, "crashed at t = ", t / TAU, " shift = ", rel.shift/TAU, " sec = ", w.second*cgi.plevel/TAU); + crashed = true; + } + }); + + if(crashed) crash_ship(); } }); }