@@ -1193,49 +1193,51 @@ public void DrawTechnoRangeIndicators(TechnoBase techno)
11931193 double range = techno . GetWeaponRange ( ) ;
11941194 if ( range > 0.0 )
11951195 {
1196- DrawRangeIndicator ( techno . Position , range , techno . Owner . XNAColor ) ;
1196+ DrawRangeIndicator ( techno , range , techno . Owner . XNAColor ) ;
11971197 }
11981198
11991199 range = techno . GetGuardRange ( ) ;
12001200 if ( range > 0.0 )
12011201 {
1202- DrawRangeIndicator ( techno . Position , range , techno . Owner . XNAColor * 0.25f ) ;
1202+ DrawRangeIndicator ( techno , range , techno . Owner . XNAColor * 0.25f ) ;
12031203 }
12041204
12051205 range = techno . GetGapGeneratorRange ( ) ;
12061206 if ( range > 0.0 )
12071207 {
1208- DrawRangeIndicator ( techno . Position , range , Color . Black * 0.75f ) ;
1208+ DrawRangeIndicator ( techno , range , Color . Black * 0.75f ) ;
12091209 }
12101210
12111211 range = techno . GetCloakGeneratorRange ( ) ;
12121212 if ( range > 0.0 )
12131213 {
1214- DrawRangeIndicator ( techno . Position , range , techno . GetRadialColor ( ) ) ;
1214+ DrawRangeIndicator ( techno , range , techno . GetRadialColor ( ) ) ;
12151215 }
12161216
12171217 range = techno . GetSensorArrayRange ( ) ;
12181218 if ( range > 0.0 )
12191219 {
1220- DrawRangeIndicator ( techno . Position , range , techno . GetRadialColor ( ) ) ;
1220+ DrawRangeIndicator ( techno , range , techno . GetRadialColor ( ) ) ;
12211221 }
12221222 }
12231223
1224- private void DrawRangeIndicator ( Point2D cellCoords , double range , Color color )
1224+ private void DrawRangeIndicator ( TechnoBase techno , double range , Color color )
12251225 {
12261226 Point2D center = EditorState . Is2DMode ?
1227- CellMath . CellCenterPointFromCellCoords ( cellCoords , Map ) :
1228- CellMath . CellCenterPointFromCellCoords_3D ( cellCoords , Map ) ;
1227+ CellMath . CellCenterPointFromCellCoords ( techno . Position , Map ) :
1228+ CellMath . CellCenterPointFromCellCoords_3D ( techno . Position , Map ) ;
1229+
1230+ int bridgeHeightOffset = techno . IsOnBridge ( ) ? ( Constants . CellHeight * Constants . HighBridgeHeight ) : 0 ;
12291231
12301232 // Range is specified in "tile edge lengths",
12311233 // so we need a bit of trigonometry
12321234 double horizontalPixelRange = Constants . CellSizeX / Math . Sqrt ( 2.0 ) ;
12331235 double verticalPixelRange = Constants . CellSizeY / Math . Sqrt ( 2.0 ) ;
12341236
12351237 int startX = center . X - ( int ) ( range * horizontalPixelRange ) ;
1236- int startY = center . Y - ( int ) ( range * verticalPixelRange ) ;
1238+ int startY = center . Y - bridgeHeightOffset - ( int ) ( range * verticalPixelRange ) ;
12371239 int endX = center . X + ( int ) ( range * horizontalPixelRange ) ;
1238- int endY = center . Y + ( int ) ( range * verticalPixelRange ) ;
1240+ int endY = center . Y - bridgeHeightOffset + ( int ) ( range * verticalPixelRange ) ;
12391241
12401242 // startX = Camera.ScaleIntWithZoom(startX - Camera.TopLeftPoint.X);
12411243 // startY = Camera.ScaleIntWithZoom(startY - Camera.TopLeftPoint.Y);
@@ -1283,15 +1285,23 @@ public void DrawOnTileUnderCursor(MapTile tileUnderCursor, CursorAction cursorAc
12831285
12841286 if ( startCell != null )
12851287 {
1286- startDrawPoint -= new Point2D ( 0 , startCell . Level * Constants . CellHeight ) ;
1288+ if ( ! EditorState . Is2DMode )
1289+ startDrawPoint -= new Point2D ( 0 , startCell . Level * Constants . CellHeight ) ;
1290+
1291+ if ( draggedOrRotatedObject . IsOnBridge ( ) )
1292+ startDrawPoint -= new Point2D ( 0 , Constants . HighBridgeHeight * Constants . CellHeight ) ;
12871293
12881294 if ( draggedOrRotatedObject . WhatAmI ( ) == RTTIType . Infantry )
12891295 startDrawPoint += CellMath . GetSubCellOffset ( ( ( Infantry ) draggedOrRotatedObject ) . SubCell ) - new Point2D ( 0 , Constants . CellHeight / 2 ) ;
12901296 }
12911297
12921298 Point2D endDrawPoint = CellMath . CellTopLeftPointFromCellCoords ( tileUnderCursor . CoordsToPoint ( ) , Map ) + cameraAndCellCenterOffset ;
12931299
1294- endDrawPoint -= new Point2D ( 0 , tileUnderCursor . Level * Constants . CellHeight ) ;
1300+ if ( ! EditorState . Is2DMode )
1301+ endDrawPoint -= new Point2D ( 0 , tileUnderCursor . Level * Constants . CellHeight ) ;
1302+
1303+ if ( draggedOrRotatedObject . IsOnBridge ( ) )
1304+ endDrawPoint -= new Point2D ( 0 , Constants . HighBridgeHeight * Constants . CellHeight ) ;
12951305
12961306 startDrawPoint = startDrawPoint . ScaleBy ( Camera . ZoomLevel ) ;
12971307 endDrawPoint = endDrawPoint . ScaleBy ( Camera . ZoomLevel ) ;
@@ -1313,15 +1323,23 @@ public void DrawOnTileUnderCursor(MapTile tileUnderCursor, CursorAction cursorAc
13131323
13141324 if ( startCell != null )
13151325 {
1316- startDrawPoint -= new Point2D ( 0 , Map . GetTile ( draggedOrRotatedObject . Position ) . Level * Constants . CellHeight ) ;
1326+ if ( ! EditorState . Is2DMode )
1327+ startDrawPoint -= new Point2D ( 0 , Map . GetTile ( draggedOrRotatedObject . Position ) . Level * Constants . CellHeight ) ;
1328+
1329+ if ( draggedOrRotatedObject . IsOnBridge ( ) )
1330+ startDrawPoint -= new Point2D ( 0 , Constants . HighBridgeHeight * Constants . CellHeight ) ;
13171331
13181332 if ( draggedOrRotatedObject . WhatAmI ( ) == RTTIType . Infantry )
13191333 startDrawPoint += CellMath . GetSubCellOffset ( ( ( Infantry ) draggedOrRotatedObject ) . SubCell ) - new Point2D ( 0 , Constants . CellHeight / 2 ) ;
13201334 }
13211335
13221336 Point2D endDrawPoint = CellMath . CellTopLeftPointFromCellCoords ( tileUnderCursor . CoordsToPoint ( ) , Map ) + cameraAndCellCenterOffset ;
13231337
1324- endDrawPoint -= new Point2D ( 0 , tileUnderCursor . Level * Constants . CellHeight ) ;
1338+ if ( ! EditorState . Is2DMode )
1339+ endDrawPoint -= new Point2D ( 0 , tileUnderCursor . Level * Constants . CellHeight ) ;
1340+
1341+ if ( draggedOrRotatedObject . IsOnBridge ( ) )
1342+ endDrawPoint -= new Point2D ( 0 , Constants . HighBridgeHeight * Constants . CellHeight ) ;
13251343
13261344 startDrawPoint = startDrawPoint . ScaleBy ( Camera . ZoomLevel ) ;
13271345 endDrawPoint = endDrawPoint . ScaleBy ( Camera . ZoomLevel ) ;
@@ -1361,7 +1379,16 @@ private void DrawTileCursor(MapTile tileUnderCursor)
13611379 Color lineColor = new Color ( 96 , 168 , 96 , 128 ) ;
13621380 Point2D cellTopLeftPoint = CellMath . CellTopLeftPointFromCellCoords ( new Point2D ( tileUnderCursor . X , tileUnderCursor . Y ) , Map ) - Camera . TopLeftPoint ;
13631381
1364- int height = EditorState . Is2DMode ? 0 : tileUnderCursor . Level * Constants . CellHeight ;
1382+ int height = 0 ;
1383+
1384+ if ( ! EditorState . Is2DMode )
1385+ {
1386+ height = tileUnderCursor . Level * Constants . CellHeight ;
1387+
1388+ var techno = tileUnderCursor . GetTechno ( ) ;
1389+ if ( techno != null && techno . IsOnBridge ( ) )
1390+ height += Constants . HighBridgeHeight * Constants . CellHeight ;
1391+ }
13651392
13661393 cellTopLeftPoint = new Point2D ( ( int ) ( cellTopLeftPoint . X * Camera . ZoomLevel ) , ( int ) ( ( cellTopLeftPoint . Y - height ) * Camera . ZoomLevel ) ) ;
13671394
0 commit comments