From 5fbdeaa89d320a1fdfeedf837574f6563fd720de Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 11 May 2019 20:15:30 +0200 Subject: [PATCH] 2d3d:: inertia movement now takes rotation into account --- shmup.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/shmup.cpp b/shmup.cpp index 651aebb0..71c5aa5c 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -1786,8 +1786,16 @@ void movePlayer(monster *m, int delta) { avg_inertia = m->inertia; ld coef = m->base->land == laWestWall ? 0.65 : falling ? 0.15 : 1; coef /= 1000; - m->inertia[frontdir()] += coef * playergo[cpid]; - avg_inertia[frontdir()] += coef * playergo[cpid] / 2; + if(WDIM == 3) { + m->inertia[frontdir()] += coef * playergo[cpid]; + avg_inertia[frontdir()] += coef * playergo[cpid] / 2; + } + else { + m->inertia[0] += cos(godir[cpid]) * coef * playergo[cpid]; + avg_inertia[0] += cos(godir[cpid]) * coef * playergo[cpid] / 2; + m->inertia[1] -= sin(godir[cpid]) * coef * playergo[cpid]; + avg_inertia[1] -= sin(godir[cpid]) * coef * playergo[cpid] / 2; + } if(falling) { vector below; manual_celllister mcl;