mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-19 02:39:19 +02:00
multiplayer: replicate the machinery you hear, not only the machinery you set
A bystander heard nothing of somebody else's converter, compressors, brake air or relays. Two different reasons for that, and they need two different answers. The devices whose sound runs for as long as they do - the converter, the main compressor, the pantograph compressor, the releaser - are outputs of a physics that a peer only half runs for a vehicle it does not own. Their running flags travel now, alongside the permits that were already going. The clicks and hisses are a harder case: MoverParameters::SoundFlag is raised and wiped inside a single frame, so sampling it when an update happens to be put together would catch almost none of them. They are collected as the vehicle finishes with them, just before it clears the field, and the accumulation rides along with the next update. On arrival they are added to whatever the receiving peer's own physics produced, and its sound handling plays them once and wipes the lot, exactly as it does for its own.
This commit is contained in:
@@ -23,6 +23,8 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "utilities/Globals.h"
|
||||
#include "utilities/Timer.h"
|
||||
#include "utilities/Logs.h"
|
||||
#include "network/entities.h"
|
||||
#include "network/snapshot.h"
|
||||
#include "utilities/glmHelpers.h"
|
||||
#include "Console.h"
|
||||
#include "world/Traction.h"
|
||||
@@ -5116,6 +5118,12 @@ void TDynamicObject::RenderSounds() {
|
||||
coupler.sounds = 0;
|
||||
}
|
||||
|
||||
if( true == network::is_multiplayer() ) {
|
||||
// relays clicking and air hissing are set and cleared inside a single frame, so
|
||||
// they have to be picked up here to have any chance of reaching the other peers
|
||||
network::note_sound_events( name(), MoverParameters->SoundFlag );
|
||||
}
|
||||
|
||||
MoverParameters->SoundFlag = 0;
|
||||
// McZapkie! - koniec obslugi dzwiekow z mover.pas
|
||||
|
||||
|
||||
Reference in New Issue
Block a user