Skip to content

Commit 1da6607

Browse files
committed
Fix TFTD dogfight images
1 parent 325d570 commit 1da6607

3 files changed

Lines changed: 29 additions & 24 deletions

File tree

‎bin/standard/xcom1/interfaces.rul‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,15 @@ interfaces:
347347
color2: 7
348348
- id: disabledAmmo
349349
color: 24
350+
- id: previewTop
351+
pos: [0, 96]
352+
size: [160, 15]
353+
- id: previewBot
354+
pos: [0, 111]
355+
size: [160, 29]
356+
- id: previewMid
357+
pos: [0, 140]
358+
size: [160, 52]
350359
- type: baseNaming
351360
elements:
352361
- id: palette

‎src/Geoscape/DogfightState.cpp‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -298,36 +298,39 @@ DogfightState::DogfightState(Globe *globe, Craft *craft, Ufo *ufo) : _globe(glob
298298
_btnUfo->invalidate(false);
299299

300300
// Set up objects
301+
RuleInterface *dogfightInterface = _game->getRuleset()->getInterface("dogfight");
302+
301303
Surface *graphic;
302304
graphic = _game->getResourcePack()->getSurface("INTERWIN.DAT");
303305
graphic->setX(0);
304306
graphic->setY(0);
305307
graphic->getCrop()->x = 0;
306308
graphic->getCrop()->y = 0;
307-
graphic->getCrop()->w = 160;
308-
graphic->getCrop()->h = 96;
309+
graphic->getCrop()->w = _window->getWidth();
310+
graphic->getCrop()->h = _window->getHeight();
309311
_window->drawRect(graphic->getCrop(), 15);
310312
graphic->blit(_window);
311313

312314
_preview->drawRect(graphic->getCrop(), 15);
313-
graphic->getCrop()->y = 96;
314-
graphic->getCrop()->h = 15;
315+
graphic->getCrop()->y = dogfightInterface->getElement("previewTop")->y;
316+
graphic->getCrop()->h = dogfightInterface->getElement("previewTop")->h;
315317
graphic->blit(_preview);
316-
graphic->setY(67);
317-
graphic->getCrop()->y = 111;
318-
graphic->getCrop()->h = 29;
318+
graphic->setY(_window->getHeight() - dogfightInterface->getElement("previewBot")->h);
319+
graphic->getCrop()->y = dogfightInterface->getElement("previewBot")->y;
320+
graphic->getCrop()->h = dogfightInterface->getElement("previewBot")->h;
319321
graphic->blit(_preview);
320322
if (ufo->getRules()->getModSprite().empty())
321323
{
322-
graphic->setY(15);
323-
graphic->getCrop()->y = 140 + 52 * _ufo->getRules()->getSprite();
324-
graphic->getCrop()->h = 52;
324+
graphic->setX(dogfightInterface->getElement("previewTop")->x);
325+
graphic->setY(dogfightInterface->getElement("previewTop")->y);
326+
graphic->getCrop()->y = dogfightInterface->getElement("previewMid")->y + dogfightInterface->getElement("previewMid")->h * _ufo->getRules()->getSprite();
327+
graphic->getCrop()->h = dogfightInterface->getElement("previewMid")->h;
325328
}
326329
else
327330
{
328331
graphic = _game->getResourcePack()->getSurface(ufo->getRules()->getModSprite());
329332
graphic->setX(0);
330-
graphic->setY(15);
333+
graphic->setY(0);
331334
}
332335
graphic->blit(_preview);
333336
_preview->setVisible(false);
@@ -378,7 +381,6 @@ DogfightState::DogfightState(Globe *globe, Craft *craft, Ufo *ufo) : _globe(glob
378381
_txtInterceptionNumber->setText(ss1.str());
379382
_txtInterceptionNumber->setVisible(false);
380383

381-
RuleInterface *dogfightInterface = _game->getRuleset()->getInterface("dogfight");
382384
// define the colors to be used
383385
_colors[CRAFT_MIN] = dogfightInterface->getElement("craftRange")->color;
384386
_colors[CRAFT_MAX] = dogfightInterface->getElement("craftRange")->color2;

‎src/Ufopaedia/ArticleStateUfo.cpp‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,21 @@ namespace OpenXcom
6363
_image = new Surface(160, 52, 160, 6);
6464
add(_image);
6565

66+
RuleInterface *dogfightInterface = _game->getRuleset()->getInterface("dogfight");
6667
Surface *graphic = _game->getResourcePack()->getSurface("INTERWIN.DAT");
6768
graphic->setX(0);
6869
graphic->setY(0);
6970
graphic->getCrop()->x = 0;
7071
graphic->getCrop()->y = 0;
71-
graphic->getCrop()->w = 160;
72-
graphic->getCrop()->h = 52;
72+
graphic->getCrop()->w = _image->getWidth();
73+
graphic->getCrop()->h = _image->getHeight();
7374
_image->drawRect(graphic->getCrop(), 15);
74-
/*
75-
graphic->getCrop()->y = 96;
76-
graphic->getCrop()->h = 15;
77-
graphic->blit(_image);
78-
graphic->setY(67);
79-
graphic->getCrop()->y = 111;
80-
graphic->getCrop()->h = 29;
8175
graphic->blit(_image);
82-
*/
76+
8377
if (ufo->getModSprite().empty())
8478
{
85-
graphic->getCrop()->y = 140 + 52 * ufo->getSprite();
86-
graphic->getCrop()->h = 52;
79+
graphic->getCrop()->y = dogfightInterface->getElement("previewMid")->y + dogfightInterface->getElement("previewMid")->h * ufo->getSprite();
80+
graphic->getCrop()->h = dogfightInterface->getElement("previewMid")->h;
8781
}
8882
else
8983
{

0 commit comments

Comments
 (0)