RigsOfRods / rigs-of-rods

Main development repository for Rigs of Rods soft-body physics simulator
https://www.rigsofrods.org
GNU General Public License v3.0
1.01k stars 175 forks source link

AIR and AIR_PURGE Triggers Are Opposite #445

Closed graysonk95 closed 8 years ago

graysonk95 commented 8 years ago

In the original Soundscript documentation it says the two triggers should behave as follows: air : active air suspension activation _airpurge : compressed air purge http://www.rigsofrods.com/wiki/pages/Soundscript_files

The two triggers are currently reversed in their behavior. "Air_purge" should be the air dryer, whereas "air" should be triggered by the depreciated shocks2 l/r flags or the depreciated wheels2 pressure adjustment feature (Issue https://github.com/RigsOfRods/rigs-of-rods/issues/446).

As it stands AIR_PURGE plays with the air suspension (l/r flags) and AIR plays as the truck's air dryer.

ohlidalp commented 8 years ago

Sound triggers

I searched through the codebase for usage of the triggers.

definitions and parsing

SS_TRIG_AIR: https://github.com/only-a-ptr/rigs-of-rods/blob/editor-python-dirty/source/main/audio/SoundScriptManager.h#L50

Trigger source: air: https://github.com/only-a-ptr/rigs-of-rods/blob/editor-python-dirty/source/main/audio/SoundScriptManager.cpp#L533

SS_TRIG_AIR_PURGE: https://github.com/only-a-ptr/rigs-of-rods/blob/editor-python-dirty/source/main/audio/SoundScriptManager.h#L60

Trigger source: air_purge: https://github.com/only-a-ptr/rigs-of-rods/blob/editor-python-dirty/source/main/audio/SoundScriptManager.cpp#L543

no error here.

Usage of SS_TRIG_AIR in code.

RoRFrameListener.cpp:

Pressure control logic: https://github.com/only-a-ptr/rigs-of-rods/blob/editor-python-dirty/source/main/gameplay/RoRFrameListener.cpp#L749

EV_COMMON_PRESSURE_LESS >> trigStart(SS_TRIG_AIR); EV_COMMON_PRESSURE_MORE >> trigStart(SS_TRIG_AIR); none pressed >> trigStop(SS_TRIG_AIR);

MainThread.cpp:

OnChangedVehicle() https://github.com/only-a-ptr/rigs-of-rods/blob/editor-python-dirty/source/main/main_sim/MainThread.cpp#L1284

trigStop(previous_vehicle, SS_TRIG_AIR); https://github.com/only-a-ptr/rigs-of-rods/blob/editor-python-dirty/source/main/main_sim/MainThread.cpp#L1357

BeamForcesEuler.cpp:

CalcShocks() + stability code https://github.com/only-a-ptr/rigs-of-rods/blob/editor-python-dirty/source/main/physics/BeamForcesEuler.cpp#L1077

trigStart/trigStop(SS_TRIG_AIR);
https://github.com/only-a-ptr/rigs-of-rods/blob/editor-python-dirty/source/main/physics/BeamForcesEuler.cpp#L1129

Usage of SS_TRIG_AIR_PURGE in code.

BeamEngine.cpp (section engine/engoption/engturbo in Truckfile) https://github.com/only-a-ptr/rigs-of-rods/blob/editor-python-dirty/source/main/gameplay/BeamEngine.cpp#L159

The code contains a pressure counter which slowly increases. After reaching a threshold, air_purge sound is triggered. https://github.com/only-a-ptr/rigs-of-rods/blob/editor-python-dirty/source/main/gameplay/BeamEngine.cpp#L166

graysonk95 commented 8 years ago

Neat, I didn't know that air pressure was something that was calculated realistically. With no type of air gauge, the sound always seemed random to me. It makes me wonder why air command beams, actual air brakes, air suspension, or even just an air tank gauge were never implemented... Correct me if I'm wrong, but the all of the code for the "apressure" calculation seems to be there just for the air_purge sound? Is apressure used anywhere else?

Also, I just did a test where I replaced the sounds with voice recordings and lo and behold they are correct. I was mistaken in thinking they were switched. This ticket can be closed.

ohlidalp commented 8 years ago

@graysonk95/airpressure: It's only there for the sound, really.