From 82318e938f931aa12cd3a3bfc6e7d37319f658ee Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 25 Nov 2018 23:39:47 +0100 Subject: [PATCH] racing:: more space on the start line --- racing.cpp | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/racing.cpp b/racing.cpp index 9c53d751..1501e114 100644 --- a/racing.cpp +++ b/racing.cpp @@ -32,8 +32,10 @@ map rti_id; string track_code = "OFFICIAL"; +int race_try; + void apply_seed() { - int s = 0; + int s = race_try; for(char c: track_code) s = 713 * s + c; shrand(s); } @@ -161,6 +163,8 @@ race_cellinfo& get_info(cell *c) { return rti[rti_id.at(c)]; } +ld start_line_width; + void generate_track() { if(race_ghosts[{track_code, modecode()}].empty()) @@ -175,6 +179,12 @@ void generate_track() { */ cell *s = currentmap->gamestart(); + + if(specialland == laCrossroads) { + celllister cl(s, TWIDTH, 1000000, NULL); + for(cell *c: cl.lst) c->bardir = NOBARRIERS; + } + setdist(s, 6, NULL); makeEmpty(s); @@ -185,12 +195,13 @@ void generate_track() { cell *goal; int traversed = 0; - + while(true) { traversed++; if(cellbydist.empty()) { printf("reset after traversing %d\n", traversed); stop_game(); + race_try++; start_game(); return; } @@ -342,7 +353,6 @@ void generate_track() { } } - for(int i=0; i 1e8) break; + } + straight = rspintox(straight * C0); + + ld& a = start_line_width; + for(a=0; a<10; a += .1) { + hyperpoint h = straight * parabolic1(a) * C0; + cell *at = s; + virtualRebase(at, h, true); + if(!rti_id.count(at) || get_info(at).from_track >= TWIDTH) break; + } + + for(ld cleaner=0; cleanerwall != waBarrier) + makeEmpty(at); + killMonster(at, moNone, 0); + T = T * xpush(.1); + virtualRebase(at, T, true); + } + } + + for(auto s: rti) if(s.c->monst == moIvyDead) s.c->monst = moNone; + + for(int i=0; iat = straight * parabolic1(start_line_width * (rand() % 20000 - 10000) / 20000) * spin(rand() % 360); + who->base = s; + virtualRebase(who, true); + } + if(1) { manual_celllister cl; cl.add(s); @@ -380,6 +430,7 @@ void generate_track() { if(!goal) { printf("error: goal unreachable\n"); stop_game(); + race_try++; start_game(); return; } @@ -708,6 +759,7 @@ struct race_configurer { dialog::add_action([] () { stop_game(); switch_game_mode(rg::racing); + race_try = 0; start_game(); }); } @@ -803,6 +855,12 @@ void markers() { dynamicval x(getcs(), ghost.cs); drawMonsterType(moPlayer, w, gmatrix[w] * p->T, 0, p->footphase); } + + if(gmatrix.count(track[0])) { + for(ld z=-start_line_width; z<=start_line_width; z+=0.1) + curvepoint(ggmatrix(track[0]) * straight * parabolic1(z) * C0); + queuecurve(0xFFFFFFFF, 0, PPR::BFLOOR); + } } int get_percentage(int i) {