OpenAL printing
```
AL lib: (WW) FreeContext: (0x614000052440) Deleting 22 Sources
AL lib: (WW) FreeDevice: (0x62d0001f4400) Deleting 22 Buffers
```
at program shutdown is actually a warning that not all sources and
buffers were deleted.
Included suggestions from @ShFil119
Vehicles have a tendency to move on their own when they are stopped, due
to their interactions with other surfaces that result in a non-zero
velocity.
Since we have a threshold with the isStopped() method, fix this situation
by setting the linear velocity and wheels rotation (that otherwise also
rotate on their own) to zero vectors.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
A constant friction slip for all vehicles does not seem to work very
well and most are rather hard to steer with. This introduces a somewhat
empirical formula to get a rather sane friction slip value based on
handling data, where coefficients are used in a way compatible with the
required friction slip value for most vehicles.
This is by far not a perfect approach and the steering on some vehicles
still feels out of line with the realistic expected behaviour, but most
remain fairly drivable.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
The current roll influence value makes it much too easy to flip vehicles
upside down. More generally, the vehicles tend to not stick to the ground
enough as they are too easily moved around when hit with another vehicle.
Reduce the roll influence value for vehicles to make them stick more to
the ground.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
This introduces a linear reduction of the engine force when braking is
applied. The division factor increases with the steering angle to
max steering angle ratio, reducing the engine force by a factor of
up to 1.25.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
This introduces a coefficient to adapt the nominal engine force to our
physics and ensure that top speed is not reached too fast.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Most vehicles are still slow to start and manoeuvre. For instance, it is
rather hard to precisely park in a parking space. In order to make
vehicles more reactive when starting (either forward or backward), the
engine force is increased at first and progressively decreased to its
nominal force, following the velocity increase up to half the maximum
velocity.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Since heavy vehicles have more inertia, they require more engine force
to be moved sufficiently fast. Without this extra force, many heavy
vehicles are unbearably slow to drive. Reuse the mass coefficient that
was introduced to increase the engine force accordingly.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
This implements proper braking by detecting a brake condition with a
negative throttle and a positive forward velocity. Under this condition,
the engine is stopped and brake is applied. A mass coefficient is
introduced to quantify how heavy a vehicle is, so that more braking can
be applied to heavy vehicles, that have higher inertia.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
A specific coefficient is introduced to adapt the value to the physics
engine, since converting the value from km/h gives an unrealisticly high
maximum speed.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
It lets complier to make extra optimization.
See:
https://gcc.godbolt.org/#compilers:!((compiler:g6,options:'-O2+-Wall++-
xc%2B%2B+-
std%3Dc%2B%2B11',sourcez:MYGwhgzhAECC0G8BQAHArgIxAS2ALiWiOgDdsAnAFzTBFIHtsATaAMwAoBKaAXmgAYA3EgC%2BwpKEgwAQtDzR0WXHESpMOfIWIlGLDt1bYAdrWj0SAU3LlmF4WKQTwUaAGE5C9cvjJFGgsQMzGxcZpbWtvbiOsGs9PTs0gBk0BjcyIEYAHT69o4xLBhg5OyuKcDpWkTAOVz2QAA%3D%3D)),filterAsm:
(commentOnly:!t,directives:!t,intel:!t,labels:!t),version:3
- make FileIndex const correct (std::map::operator[] modifies the std::map)
- use a single map
- keys are paths relative in the game data directory + filenames
(so paths like "data/main.scm" can be found twice in the map)
- normalization of the file paths is done inside FileIndex,
so there shouldn't be any ::tolower's anymore.
- added a normalizer helper function "normalizeFilePath"
- added Documentation
This is caused by different handling of formatted input in the C++
standard library on macOS than on a linux box.
On linux, characters after a number are ignored (such as 'f' in this
case), on macOS this leads to an error on the stream.
Fixed: mission timer
Timer was going crazy due to missing 02d9 opcode, update timer 25 times per second
Fixed: mission timer
Don't beep on every timer update
Fixes #519
==13884==ERROR: AddressSanitizer: heap-use-after-free on address 0x607000b3d954 at pc 0x0000008ba469 bp 0x7ffd7c8f9ab0 sp 0x7ffd7c8f9aa0
READ of size 4 at 0x607000b3d954 thread T0
#0 0x8ba468 in PlayerController::isTalkingOnPayphone() const /home/maarten/programming/openrw/rwengine/src/ai/PlayerController.cpp:315
#1 0xa148eb in CharacterObject::updateMovementAnimation(float) /home/maarten/programming/openrw/rwengine/src/objects/CharacterObject.cpp:128
#2 0xa185d9 in CharacterObject::updateCharacter(float) /home/maarten/programming/openrw/rwengine/src/objects/CharacterObject.cpp:356
#3 0xa17735 in CharacterObject::tick(float) /home/maarten/programming/openrw/rwengine/src/objects/CharacterObject.cpp:297
#4 0x7c7731 in RWGame::tick(float) /home/maarten/programming/openrw/rwgame/RWGame.cpp:541
#5 0x7c6abb in RWGame::run() /home/maarten/programming/openrw/rwgame/RWGame.cpp:447
#6 0x793b45 in main /home/maarten/programming/openrw/rwgame/main.cpp:17
#7 0x7f154c17e18a in __libc_start_main (/lib64/libc.so.6+0x2318a)
#8 0x793839 in _start (/home/maarten/programming/openrw/build/build/rwgame/rwgame+0x793839)
Fixes this warning:
/home/maarten/programming/openrw/rwengine/src/objects/CharacterObject.cpp:202:54: runtime error: downcast of address 0x00000ae11d00 which does not point to an object of type 'PlayerController'
0x00000ae11d00: note: object is of type 'DefaultAIController'
00 00 00 00 58 91 ca 00 00 00 00 00 e0 2e 90 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'DefaultAIController'
/home/maarten/programming/openrw/rwengine/src/objects/CharacterObject.cpp:202:75: runtime error: member call on address 0x00000ae11d00 which does not point to an object of type 'PlayerController'
0x00000ae11d00: note: object is of type 'DefaultAIController'
00 00 00 00 58 91 ca 00 00 00 00 00 e0 2e 90 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'DefaultAIController'
/home/maarten/programming/openrw/rwengine/src/ai/PlayerController.hpp:66:16: runtime error: member access within address 0x00000ae11d00 which does not point to an object of type 'PlayerController'
0x00000ae11d00: note: object is of type 'DefaultAIController'
00 00 00 00 58 91 ca 00 00 00 00 00 e0 2e 90 0b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^~~~~~~~~~~~~~~~~~~~~~~
vptr for 'DefaultAIController'