Skip to content

Commit 4665441

Browse files
author
Gerhard Stein
committed
Tile fixes with the parts dialog
1 parent bd7f9a8 commit 4665441

File tree

3 files changed

+28
-21
lines changed

3 files changed

+28
-21
lines changed

src/engine/keen/vorticon/dialog/CMessageBoxVort.cpp

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

src/engine/keen/vorticon/dialog/CMessageBoxVort.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class CMessageBoxVort : public CMessageBox
2424
/**
2525
* \brief This will add an extra tile to the message box. Mostly used by the dialog "Ship missing" in Keen 1
2626
*/
27-
void addTileAt(Uint16 tile, Uint16 x, Uint16 y);
27+
void addTileAt(const Uint16 tile, const Uint16 x, const Uint16 y);
2828

2929
};
3030

src/engine/keen/vorticon/playgame/CPlayGameWorldMap.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ void CPlayGameVorticon::YourShipNeedsTheseParts()
182182
}
183183

184184
// draw needed parts
185-
if (!joy) MessageBox->addTileAt(321,4<<3, 4<<3);
186-
if (!bat) MessageBox->addTileAt(322,8<<3, 4<<3);
187-
if (!vac) MessageBox->addTileAt(323,12<<3,4<<3);
188-
if (!wis) MessageBox->addTileAt(324,16<<3,4<<3);
185+
if (!joy) MessageBox->addTileAt(321, 4<<3, 4<<3);
186+
if (!bat) MessageBox->addTileAt(322, 8<<3, 4<<3);
187+
if (!vac) MessageBox->addTileAt(323, 12<<3, 4<<3);
188+
if (!wis) MessageBox->addTileAt(324, 16<<3, 4<<3);
189189
mMessageBoxes.push_back(move(MessageBox));
190190
}
191191

0 commit comments

Comments
 (0)