@@ -50,6 +50,9 @@ class AttitudeDisplay(computers: ComputerBus) : Display(computers) {
5050 if (FAConfig .display.showAttitude == DisplayOptions .AttitudeDisplayMode .HORIZON_AND_LADDER ) {
5151 renderPitchBars()
5252 renderPitchLimits()
53+ drawPitchReferenceMark(47.5f )
54+ drawPitchReferenceMark(- 2.2f )
55+ drawPitchReferenceMark(- 38.5f )
5356 }
5457 if (! FAConfig .display.drawPitchOutsideFrame) {
5558 disableScissor()
@@ -122,18 +125,23 @@ class AttitudeDisplay(computers: ComputerBus) : Display(computers) {
122125 }
123126 }
124127
128+ private fun GuiGraphics.drawPitchReferenceMark (pitch : Float ) {
129+ val y = ScreenSpace .getY(pitch) ? : return
130+
131+ val color: Int = getPitchBarColor(pitch)
132+ val leftXEnd: Int = (centerXF - halfWidth * 0.025f ).toInt()
133+ val leftXStart: Int = (leftXEnd - halfWidth * 0.05f ).toInt()
134+ hLineDashed(leftXStart, leftXEnd, y, 2 , color)
135+
136+ val rightXStart: Int = (centerXF + halfWidth * 0.025f ).toInt()
137+ val rightXEnd: Int = (rightXStart + halfWidth * 0.05f ).toInt()
138+ hLineDashed(rightXStart, rightXEnd, y, 2 , color)
139+ }
140+
125141 private fun GuiGraphics.drawPitchBar (pitch : Int , y : Int ) {
126142 if (pitch == 0 ) return
127143
128- val min: ControlInput ? = computers.pitch.minimumPitch
129- val max: ControlInput ? = computers.pitch.maximumPitch
130- val color: Int =
131- if (max != null && pitch > max.target)
132- if (max.status == ControlInput .Status .ACTIVE ) warningColor else cautionColor
133- else if (min != null && pitch < min.target)
134- if (min.status == ControlInput .Status .ACTIVE ) warningColor else cautionColor
135- else
136- primaryColor
144+ val color: Int = getPitchBarColor(pitch.toFloat())
137145
138146 val leftXEnd: Int = (centerXF - halfWidth * 0.05f ).toInt()
139147 val leftXStart: Int = (leftXEnd - halfWidth * 0.075f ).toInt()
@@ -148,6 +156,17 @@ class AttitudeDisplay(computers: ComputerBus) : Display(computers) {
148156 drawString(pitch.toString(), rightXEnd + 4 , if (pitch > 0 ) y else y - 4 , color)
149157 }
150158
159+ private fun getPitchBarColor (pitch : Float ): Int {
160+ val min: ControlInput ? = computers.pitch.minimumPitch
161+ val max: ControlInput ? = computers.pitch.maximumPitch
162+ return if (max != null && pitch > max.target)
163+ if (max.status == ControlInput .Status .ACTIVE ) warningColor else cautionColor
164+ else if (min != null && pitch < min.target)
165+ if (min.status == ControlInput .Status .ACTIVE ) warningColor else cautionColor
166+ else
167+ primaryColor
168+ }
169+
151170 private fun GuiGraphics.renderPitchTarget (x : Int , y : Int ) {
152171 val active: AutoFlightComputer .VerticalMode ? = computers.autoflight.activeVerticalMode
153172 if (computers.autoflight.getPitchInput() != null && active is AutoFlightComputer .FollowsPitchMode ) {
0 commit comments