@@ -17,7 +17,7 @@ import DropdownButtonControl from "./dropdownButton";
1717const windowId = "ride-vehicle-editor" ;
1818const windowStart = 18 ;
1919const windowWidth = 375 ;
20- const windowHeight = 248 ;
20+ const windowHeight = 285 ;
2121const widgetLineHeight = 14 ;
2222const groupboxMargin = 5 ;
2323const groupboxItemMargin = ( groupboxMargin + 5 ) ;
@@ -55,6 +55,7 @@ export default class VehicleEditorWindow
5555 readonly powAccelerationSpinner : SpinnerControl ;
5656 readonly powMaxSpeedSpinner : SpinnerControl ;
5757 readonly massSpinner : SpinnerControl ;
58+ readonly soundRangeList : DropdownControl ;
5859
5960 readonly locateButton : ButtonControl ;
6061 readonly pickerButton : ButtonControl ;
@@ -284,6 +285,29 @@ export default class VehicleEditorWindow
284285 } ) ;
285286 editor . mass . subscribe ( v => this . massSpinner . set ( v ) ) ;
286287
288+ // soundRange ID of the selected vehicle.
289+ this . soundRangeList = new DropdownControl ( {
290+ name : "rve-soundRange-list" ,
291+ tooltip : "Pick from available soundRange IDs." ,
292+ disabledMessage : "No soundRange IDs available." ,
293+ items : [ "ID 0 - Screams 1 and 8" , "ID 1 - Screams 1-7" , "ID 2 - Screams 1 and 6" , "ID 3 - Whistle" , "ID 4 - Bell" , "ID 255 - No Sound" ] ,
294+ disableSingleItem : false ,
295+ x : groupboxMargin + viewportSize + 5 + ( controlsSize * controlLabelPart ) ,
296+ y : ( editorStartY + 1 + controlHeight * 5 ) ,
297+ width : ( controlsSize * ( 1 - controlLabelPart ) ) ,
298+ height : widgetLineHeight ,
299+ onSelect : ( v ) : void => editor . setSoundrange ( v ) ,
300+ } ) ;
301+ editor . soundRange . subscribe ( v =>
302+ {
303+ if ( v == 255 )
304+ {
305+ v = 6 ;
306+ }
307+ this . soundRangeList . set ( v ) ;
308+ }
309+ ) ;
310+
287311 // Powered acceleration of the selected vehicle.
288312 this . powAccelerationSpinner = new SpinnerControl ( {
289313 name : "rve-powered-acceleration-spinner" ,
@@ -293,7 +317,7 @@ export default class VehicleEditorWindow
293317 minimum : 0 ,
294318 maximum : 256 ,
295319 x : ( groupboxMargin + viewportSize + 5 ) + ( controlsSize * controlLabelPart ) ,
296- y : ( editorStartY + 1 + controlHeight * 5 ) ,
320+ y : ( editorStartY + 1 + controlHeight * 6 ) ,
297321 width : ( controlsSize * ( 1 - controlLabelPart ) ) ,
298322 height : widgetLineHeight ,
299323 onChange : ( v ) : void => editor . setPoweredAcceleration ( v )
@@ -309,7 +333,7 @@ export default class VehicleEditorWindow
309333 minimum : 0 ,
310334 maximum : 256 ,
311335 x : ( groupboxMargin + viewportSize + 5 ) + ( controlsSize * controlLabelPart ) ,
312- y : ( editorStartY + 1 + controlHeight * 6 ) ,
336+ y : ( editorStartY + 1 + controlHeight * 7 ) ,
313337 width : ( controlsSize * ( 1 - controlLabelPart ) ) ,
314338 height : widgetLineHeight ,
315339 onChange : ( v ) : void => editor . setPoweredMaximumSpeed ( v )
@@ -390,7 +414,7 @@ export default class VehicleEditorWindow
390414 { text : "Apply this to all trains" , onClick : ( ) : void => this . applyToAllTrains ( ) }
391415 ] ,
392416 x : ( groupboxMargin + viewportSize + 5 ) ,
393- y : ( editorStartY + controlHeight * 7 ) + 2 ,
417+ y : ( editorStartY + controlHeight * 8 ) + 2 ,
394418 width : 211 ,
395419 height : ( widgetLineHeight + 1 ) ,
396420 } ) ;
@@ -401,7 +425,7 @@ export default class VehicleEditorWindow
401425 tooltip : "Multiplies all spinner controls by the specified amount" ,
402426 items : [ "x1" , "x10" , "x100" ] ,
403427 x : ( windowWidth - ( groupboxMargin + 45 ) ) ,
404- y : ( editorStartY + controlHeight * 7 ) + 2 ,
428+ y : ( editorStartY + controlHeight * 8 ) + 2 ,
405429 width : 45 ,
406430 height : widgetLineHeight ,
407431 onSelect : ( i ) : void => this . updateMultiplier ( i )
@@ -503,12 +527,24 @@ export default class VehicleEditorWindow
503527 } ,
504528 this . massSpinner . createWidget ( ) ,
505529
530+ // soundRange
531+ < LabelWidget > {
532+ tooltip : this . soundRangeList . params . tooltip ,
533+ type : "label" ,
534+ x : ( groupboxMargin + viewportSize + 5 ) ,
535+ y : ( editorStartY + controlHeight * 5 ) + 2 ,
536+ width : ( controlsSize * controlLabelPart ) ,
537+ height : widgetLineHeight ,
538+ text : "soundRange:"
539+ } ,
540+ this . soundRangeList . createWidget ( ) ,
541+
506542 // Powered acceleration
507543 < LabelWidget > {
508544 tooltip : this . powAccelerationSpinner . params . tooltip ,
509545 type : "label" ,
510546 x : ( groupboxMargin + viewportSize + 5 ) ,
511- y : ( editorStartY + controlHeight * 5 ) + 2 ,
547+ y : ( editorStartY + controlHeight * 6 ) + 2 ,
512548 width : ( controlsSize * controlLabelPart ) ,
513549 height : widgetLineHeight ,
514550 text : "Acceleration:"
@@ -520,7 +556,7 @@ export default class VehicleEditorWindow
520556 tooltip : this . powMaxSpeedSpinner . params . tooltip ,
521557 type : "label" ,
522558 x : ( groupboxMargin + viewportSize + 5 ) ,
523- y : ( editorStartY + controlHeight * 6 ) + 2 ,
559+ y : ( editorStartY + controlHeight * 7 ) + 2 ,
524560 width : ( controlsSize * controlLabelPart ) ,
525561 height : widgetLineHeight ,
526562 text : "Max. speed:"
@@ -649,6 +685,7 @@ export default class VehicleEditorWindow
649685 this . trackProgressSpinner . active ( toggle ) ;
650686 this . seatCountSpinner . active ( toggle ) ;
651687 this . massSpinner . active ( toggle ) ;
688+ this . soundRangeList . active ( toggle ) ;
652689
653690 // Buttons
654691 this . applyToOthersButton . active ( toggle ) ;
0 commit comments