@@ -55,39 +55,46 @@ void CMessageBoxVort::initVorticonBackground()
5555}
5656
5757
58- // This function is used in your Ship need those parts.
58+ // This function is used in "Your ship need those parts" .
5959// This special Messagebox can hold up to 4 images
60- void CMessageBoxVort::addTileAt (Uint16 tile, Uint16 x, Uint16 y)
60+ void CMessageBoxVort::addTileAt (const Uint16 tile, const Uint16 x, const Uint16 y)
6161{
6262 GsTilemap &tilemap = gGraphics .getTileMap (1 );
6363
6464 const int tileDim = tilemap.getDimension ();
6565
66+ auto &vidDrv = gVideoDriver ;
67+
6668 // now we'll create a new surface on which the Tile will be printed.
67- SDL_Rect rect ;
68- rect .x = rect .y = 0 ;
69- rect .w = rect .h = tileDim;
69+ SDL_Rect tileRect ;
70+ tileRect .x = tileRect .y = 0 ;
71+ tileRect .w = tileRect .h = tileDim;
7072
7173
72- GsSurface bmpSfc ;
73- bmpSfc .createRGBSurface (rect );
74- bmpSfc .makeBlitCompatible ();
74+ GsSurface bmpSfcTile ;
75+ bmpSfcTile .createRGBSurface (tileRect );
76+ bmpSfcTile .makeBlitCompatible ();
7577
76- bmpSfc .fillRGBA (0xFF , 0x00 , 0xFF , 0xFF );
78+ bmpSfcTile .fillRGBA (0xFF , 0x00 , 0xFF , 0xFF );
7779
78- tilemap.drawTile (bmpSfc .getSDLSurface (), 0 , 0 , tile);
80+ tilemap.drawTile (bmpSfcTile .getSDLSurface (), 0 , 0 , tile);
7981
80- rect .x = x+40 ; rect .y = y+24 ;
82+ tileRect .x = x+40 ; tileRect .y = y+24 ;
8183
82- GsRect<float > fRect (rect );
84+ GsRect<float > fRect (tileRect );
8385
8486 GsRect<float > scaleRect = getRect ();
8587
86- GsRect<float > gameRect = gVideoDriver .getGameResolution ();
87- fRect .transformInverse (gameRect);
88+ GsRect<float > gameRect = vidDrv.getGameResolution ();
89+
90+ fRect .transformInverse (gameRect);
91+
92+ fRect .dim .x /= scaleRect.dim .x ;
93+ fRect .dim .y /= scaleRect.dim .y ;
94+ fRect .pos .x += (scaleRect.pos .x *scaleRect.dim .x );
95+ fRect .pos .y += (scaleRect.pos .y *scaleRect.dim .y );
8896
89- fRect .transformInverse (scaleRect);
9097
91- std::shared_ptr<GsBitmap> bmpShared (new GsBitmap (bmpSfc ));
98+ std::shared_ptr<GsBitmap> bmpShared (new GsBitmap (bmpSfcTile ));
9299 add ( new GsBitmapBox (bmpShared,fRect ) );
93100}
0 commit comments