Fix grenades going backwards when the player is moving.
authorGuus Sliepen <guus@debian.org>
Sun, 9 Aug 2015 18:19:31 +0000 (20:19 +0200)
committerGuus Sliepen <guus@debian.org>
Sun, 9 Aug 2015 18:19:31 +0000 (20:19 +0200)
commitacf6c1044be2667ee799327e350f0d890bd55fb8
tree7ae1dc23e56acebdd68fa39ba4b4b059afe9d3d1
parent128d4058a4e0d37b7bef394ccde7277391e4ae0e
Fix grenades going backwards when the player is moving.

Most weapon bullets have a speed which is much higher than the player
can move, but grenades are relatively slow. Since Bob started moving
faster many versions ago, grenades were actually slower than Bob
himself. Since there was no concept of bullets inheriting the speed of
the entity shooting them, that meant that when Bob was moving forward
and tried to throw a grenade, the grenade would actually move backwards
relative to Bob.

We fix that now by making grenades inherit the velocity of the entity
throwing them. Unfortunately, a player that is on a moving platform is
considered not to have any velocity, even if the platform is moving. In
stead of rewriting everything to track the actual velocity of entities
on platforms, we just check if the grenade throwing entity is on a
platform, and if so add the platform's velocity to the grenade.

With the old starting velocity of grenades plus Bob's own speed,
grenades could actually be thrown very fast. Compensate that by making
the starting velocity of grenades much lower. It might make some puzzles
involving grenades a bit harder.
data/weapons
src/bullets.cpp
src/bullets.h
src/trains.cpp