mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-20 23:50:27 +00:00
3d::racing:: 3d racing (partial)
This commit is contained in:
parent
2b307f5e4a
commit
0d795e60bf
@ -1042,6 +1042,7 @@ void centerpc(ld aspd) {
|
|||||||
if(shmup::on && DIM == 3 && vid.sspeed > -5) {
|
if(shmup::on && DIM == 3 && vid.sspeed > -5) {
|
||||||
transmatrix at = ggmatrix(shmup::pc[0]->base) * shmup::pc[0]->at * cpush(2, -vid.yshift);
|
transmatrix at = ggmatrix(shmup::pc[0]->base) * shmup::pc[0]->at * cpush(2, -vid.yshift);
|
||||||
View = inverse(at) * View;
|
View = inverse(at) * View;
|
||||||
|
if(racing::on) racing::set_view();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
racing.cpp
15
racing.cpp
@ -426,19 +426,19 @@ void generate_track() {
|
|||||||
|
|
||||||
for(cell *sc: track) {
|
for(cell *sc: track) {
|
||||||
straight = calc_relative_matrix(sc, track[0], C0);
|
straight = calc_relative_matrix(sc, track[0], C0);
|
||||||
if(straight[2][2] > 1e8) break;
|
if(straight[DIM][DIM] > 1e8) break;
|
||||||
}
|
}
|
||||||
straight = rspintox(straight * C0);
|
straight = rspintox(straight * C0);
|
||||||
|
|
||||||
ld& a = start_line_width;
|
ld& a = start_line_width;
|
||||||
for(a=0; a<10; a += .1) {
|
if(DIM == 2) for(a=0; a<10; a += .1) {
|
||||||
hyperpoint h = straight * parabolic1(a) * C0;
|
hyperpoint h = straight * parabolic1(a) * C0;
|
||||||
cell *at = s;
|
cell *at = s;
|
||||||
virtualRebase(at, h, true);
|
virtualRebase(at, h, true);
|
||||||
if(!rti_id.count(at) || get_info(at).from_track >= TWIDTH) break;
|
if(!rti_id.count(at) || get_info(at).from_track >= TWIDTH) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(ld cleaner=0; cleaner<a*.75; cleaner += .2) for(int dir=-1; dir<=1; dir+=2) {
|
if(DIM == 2) for(ld cleaner=0; cleaner<a*.75; cleaner += .2) for(int dir=-1; dir<=1; dir+=2) {
|
||||||
transmatrix T = straight * parabolic1(cleaner * dir);
|
transmatrix T = straight * parabolic1(cleaner * dir);
|
||||||
cell *at = s;
|
cell *at = s;
|
||||||
virtualRebase(at, T, true);
|
virtualRebase(at, T, true);
|
||||||
@ -469,6 +469,9 @@ void generate_track() {
|
|||||||
// this is intentionally not hrand
|
// this is intentionally not hrand
|
||||||
|
|
||||||
for(int j=0; j<100; j++) {
|
for(int j=0; j<100; j++) {
|
||||||
|
if(DIM == 3)
|
||||||
|
who->at = Id; // straight * cspin(0, 2, rand() % 360) * cspin(1, 2, rand() % 360);
|
||||||
|
else
|
||||||
who->at = straight * parabolic1(start_line_width * (rand() % 20000 - 10000) / 40000) * spin(rand() % 360);
|
who->at = straight * parabolic1(start_line_width * (rand() % 20000 - 10000) / 40000) * spin(rand() % 360);
|
||||||
who->base = s;
|
who->base = s;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
@ -638,6 +641,7 @@ int current_player;
|
|||||||
void set_view() {
|
void set_view() {
|
||||||
|
|
||||||
if(race_start_tick == 0) race_start_tick = ticks + 5000;
|
if(race_start_tick == 0) race_start_tick = ticks + 5000;
|
||||||
|
if(DIM == 3) return;
|
||||||
|
|
||||||
if(subscreen_split(set_view)) return;
|
if(subscreen_split(set_view)) return;
|
||||||
|
|
||||||
@ -1247,6 +1251,7 @@ void draw_ghost_state(ghost& ghost) {
|
|||||||
void drawStats() {
|
void drawStats() {
|
||||||
|
|
||||||
if(!racing::on) return;
|
if(!racing::on) return;
|
||||||
|
if(DIM == 3) return;
|
||||||
|
|
||||||
initquickqueue();
|
initquickqueue();
|
||||||
|
|
||||||
@ -1272,13 +1277,13 @@ void drawStats() {
|
|||||||
|
|
||||||
void markers() {
|
void markers() {
|
||||||
if(!racing::on) return;
|
if(!racing::on) return;
|
||||||
if(guiding) for(int i=0; i<multi::players; i++) {
|
if(guiding && DIM == 2) for(int i=0; i<multi::players; i++) {
|
||||||
shmup::monster *m = shmup::pc[i];
|
shmup::monster *m = shmup::pc[i];
|
||||||
if(!m) continue;
|
if(!m) continue;
|
||||||
for(int j=0; j<5; j++)
|
for(int j=0; j<5; j++)
|
||||||
queueline(m->pat * xpush0(j), m->pat * xpush0(j+1), multi::scs[i].uicolor, 2);
|
queueline(m->pat * xpush0(j), m->pat * xpush0(j+1), multi::scs[i].uicolor, 2);
|
||||||
}
|
}
|
||||||
if(racing::player_relative || racing::standard_centering) {
|
if(racing::player_relative || racing::standard_centering || DIM == 3) {
|
||||||
using namespace racing;
|
using namespace racing;
|
||||||
cell *goal = NULL;
|
cell *goal = NULL;
|
||||||
for(cell *c: track) if(inscreenrange(c)) goal = c;
|
for(cell *c: track) if(inscreenrange(c)) goal = c;
|
||||||
|
24
shmup.cpp
24
shmup.cpp
@ -1648,11 +1648,13 @@ void movePlayer(monster *m, int delta) {
|
|||||||
|
|
||||||
#if CAP_RACING
|
#if CAP_RACING
|
||||||
if(racing::on) {
|
if(racing::on) {
|
||||||
|
if(DIM == 2) {
|
||||||
if(abs(mdy) > abs(mgo)) mgo = -mdy;
|
if(abs(mdy) > abs(mgo)) mgo = -mdy;
|
||||||
if(abs(mdx) > abs(mturn)) mturn = -mdx;
|
if(abs(mdx) > abs(mturn)) mturn = -mdx;
|
||||||
mdx = mdy = 0;
|
mdx = mdy = 0;
|
||||||
|
}
|
||||||
facemouse = shotkey = dropgreen = false;
|
facemouse = shotkey = dropgreen = false;
|
||||||
if(ticks < racing::race_start_tick || !racing::race_start_tick) mgo = 0;
|
if(ticks < racing::race_start_tick || !racing::race_start_tick) (DIM == 2 ? mgo : mdy) = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1702,10 +1704,11 @@ void movePlayer(monster *m, int delta) {
|
|||||||
if(rosedist(m->base) == 1)
|
if(rosedist(m->base) == 1)
|
||||||
roseCurrents(nat, m, delta);
|
roseCurrents(nat, m, delta);
|
||||||
|
|
||||||
if(mgo > 1) mgo = 1;
|
|
||||||
if(mgo < -1) mgo = -1;
|
|
||||||
if(!canmove) mgo = 0;
|
if(!canmove) mgo = 0;
|
||||||
|
|
||||||
|
if(DIM == 2) {
|
||||||
|
if(mgo > 1) mgo = 1;
|
||||||
|
if(mgo < -1) mgo = -1;
|
||||||
if(racing::on) {
|
if(racing::on) {
|
||||||
// braking is more efficient
|
// braking is more efficient
|
||||||
if(m->vel * mgo < 0) mgo *= 3;
|
if(m->vel * mgo < 0) mgo *= 3;
|
||||||
@ -1716,10 +1719,23 @@ void movePlayer(monster *m, int delta) {
|
|||||||
else {
|
else {
|
||||||
playergo[cpid] = mgo * SCALE * delta / 600;
|
playergo[cpid] = mgo * SCALE * delta / 600;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(DIM == 3) {
|
else if(DIM == 3) {
|
||||||
|
if(mdy > 1) mdy = 1;
|
||||||
|
if(mdy < -1) mdy = -1;
|
||||||
|
if(mdx > 1) mdx = 1;
|
||||||
|
if(mdx < -1) mdx = -1;
|
||||||
|
if(racing::on) {
|
||||||
|
if(m->vel * -mdy < 0) mdy *= 3;
|
||||||
|
m->vel += -mdy * delta / 600;
|
||||||
|
playergo[cpid] = m->vel * SCALE * delta / 600;
|
||||||
|
playerstrafe[cpid] = m->vel * mdx * SCALE * delta / 600;
|
||||||
|
}
|
||||||
|
else {
|
||||||
playergo[cpid] = -mdy * SCALE * delta / 600;
|
playergo[cpid] = -mdy * SCALE * delta / 600;
|
||||||
playerstrafe[cpid] = mdx * SCALE * delta / 600;
|
playerstrafe[cpid] = mdx * SCALE * delta / 600;
|
||||||
|
}
|
||||||
playerturn[cpid] = mgo * SCALE * delta / 200;
|
playerturn[cpid] = mgo * SCALE * delta / 200;
|
||||||
playerturny[cpid] = mturn * SCALE * delta / 200;
|
playerturny[cpid] = mturn * SCALE * delta / 200;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user