diff --git a/graph.cpp b/graph.cpp index 4fae76e6..d184a433 100644 --- a/graph.cpp +++ b/graph.cpp @@ -19,7 +19,8 @@ int detaillevel = 0; bool first_cell_to_draw = true; bool hide_player() { - return DIM == 3 && playermoved && vid.yshift == 0 && vid.sspeed > -5 && pmodel == mdPerspective && first_cell_to_draw && (WDIM == 3 || geom3::camera == 0) && !inmirrorcount; + return DIM == 3 && playermoved && vid.yshift == 0 && vid.sspeed > -5 && pmodel == mdPerspective && first_cell_to_draw && (WDIM == 3 || geom3::camera == 0) && !inmirrorcount + && !(racing::on && !racing::standard_centering && !racing::player_relative); } hookset *hooks_handleKey; diff --git a/hypgraph.cpp b/hypgraph.cpp index 5597685c..2afecf98 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -1090,6 +1090,10 @@ void centerpc(ld aspd) { if(geometry == gCrystal) crystal::centerrug(aspd); #endif + + #if CAP_RACING + if(racing::on && racing::set_view()) return; + #endif #if MAXMDIM >= 4 if(shmup::on && vid.sspeed > -5 && DIM == 3) { diff --git a/racing.cpp b/racing.cpp index 55551b58..365c584c 100644 --- a/racing.cpp +++ b/racing.cpp @@ -651,7 +651,7 @@ bool inrec = false; ld race_angle = 90; -void set_view() { +bool set_view() { multi::cpid = subscreens::in ? subscreens::current_player : 0; @@ -672,12 +672,13 @@ void set_view() { }); } - if(DIM == 3) return; + if(standard_centering) return false; transmatrix at = ypush(-vid.yshift) * ggmatrix(who->base) * who->at; - if(racing::player_relative || quotient) - View = spin(race_angle * degree) * inverse(at) * View; + if(racing::player_relative || quotient) { + View = inverse(at) * View; + } else { int z = get_info(who->base).completion; int steps = euclid ? 1000 : 20; @@ -687,13 +688,17 @@ void set_view() { transmatrix T2 = ypush(-vid.yshift) * ggmatrix(c2); transmatrix T = spintox(inverse(T1) * T2 * C0); hyperpoint h = T * inverse(T1) * at * C0; - ld y = asin_auto(h[1]); + ld y = GDIM == 2 ? asin_auto(h[1]) : asin_auto(hypot(h[1], h[2])); ld x = asin_auto(h[0] / cos_auto(y)); x += race_advance; // printf("%d %lf\n", z, x); transmatrix Z = T1 * inverse(T) * xpush(x); - View = spin(race_angle * degree) * inverse(Z) * View; + View = inverse(Z) * View; } + if(GDIM == 3 && WDIM == 2) + View = cspin(0, 1, M_PI) * cspin(2, 1, M_PI/2 + shmup::playerturny[multi::cpid]) * spin(-M_PI/2) * View; + else View = spin(race_angle * degree) * View; + return true; } #if CAP_COMMANDLINE @@ -928,7 +933,7 @@ void race_projection() { vid.smart_range_detail = 3; }); - if(pmodel == mdDisk) { + if(true) { dialog::addSelItem(XLAT("point of view"), XLAT(player_relative ? "player" : "track"), 'p'); if(quotient || racing::standard_centering) dialog::lastItem().value = XLAT("N/A"); @@ -942,12 +947,14 @@ void race_projection() { } else dialog::addBreak(100); - dialog::addSelItem(XLAT("race angle"), fts(race_angle), 'a'); - dialog::add_action([] () { - dialog::editNumber(race_angle, 0, 360, 15, 90, XLAT("race angle"), ""); - int q = conformal::model_orientation - race_angle; - dialog::reaction = [q] () { conformal::model_orientation = race_angle + q; }; - }); + if(DIM == 2) { + dialog::addSelItem(XLAT("race angle"), fts(race_angle), 'a'); + dialog::add_action([] () { + dialog::editNumber(race_angle, 0, 360, 15, 90, XLAT("race angle"), ""); + int q = conformal::model_orientation - race_angle; + dialog::reaction = [q] () { conformal::model_orientation = race_angle + q; }; + }); + } dialog::addSelItem(XLAT("show more in front"), fts(race_advance), 'A'); dialog::add_action([] () {