From 65f07aa30a052a5d7f60e2c427454f8b9f1d8f72 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 18 Nov 2018 01:44:13 +0100 Subject: [PATCH] racing:: efficient braking, stop when hit wall --- shmup.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shmup.cpp b/shmup.cpp index 1bfaa20e..df83b8b4 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -1625,6 +1625,8 @@ void movePlayer(monster *m, int delta) { if(!canmove) mgo = 0; if(racing::on) { + // braking is more efficient + if(m->vel * mgo < 0) mgo *= 3; m->vel += mgo * delta / 600; playergo[cpid] = m->vel * SCALE * delta / 600; printf("vel = %lf go = %lf\n", m->vel, playergo[cpid]); @@ -1895,6 +1897,10 @@ void movePlayer(monster *m, int delta) { goto nextstep; } } + + #if CAP_RACING + if(!go && racing::on) m->vel = 0; + #endif if(shotkey && canmove && curtime >= m->nextshot) {