Author Topic: [DONE][Suggestion] Override default placement of elements in ufopedia item articles  (Read 3348 times)

Offline krautbernd

  • Commander
  • *****
  • Posts: 1108
    • View Profile
This is an extremely minor gripe, but the rectangle in the background image for ufopedia articles (items/weapons) used to display the BIGOB image is 2 pixels wider than the actual BIGOB image. This is fine for vanilla xcom, but some mods (x-com files for example) use it to display NPCs or other items that don't fit into that space especially well. They aren't centered or appear cut off.

While some of this is fixable by modifying the background image (see attached images), this leads to the weight indicator being drawn over the rectangle.

Would it be possible to either define a seperate background image to be used per entry and/or override the default placement of elements in ufopedia entries? Case in point, this probably concerns

_txtWeight = new Text(88, 8, 104, 55);
_image = new Surface(32, 48, 157, 5);
_game->getMod()->getSurface("BACK08.SCR")->blit(_bg);

in ArticleStateItem.cpp

Would it be possible to implement a *.rul based override for these?

« Last Edit: February 14, 2023, 09:57:12 am by Meridian »

Offline krautbernd

  • Commander
  • *****
  • Posts: 1108
    • View Profile
Re: [SUGGESTION] Override default placement of elements in ufopedia articles
« Reply #1 on: January 02, 2019, 11:41:04 pm »
On a related note, would it be possible to scale in-game windows (or the size/type of fonts) according to the number of entries they have? Case in point, the commendations mod adds a new section to the UFOpedia, so the window title now overlaps the frame.


Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Re: [SUGGESTION] Override default placement of elements in ufopedia articles
« Reply #2 on: January 02, 2019, 11:49:42 pm »
On a related note, would it be possible to scale in-game windows (or the size/type of fonts) according to the number of entries they have?

Yes, but it's not easy.

Case in point, the commendations mod adds a new section to the UFOpedia, so the window title now overlaps the frame.

If you upgrade your OXC or OXCE, both now have scrolling of pedia sections... it won't overlap anymore.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Would it be possible to either define a separate background image to be used per entry and/or override the default placement of elements in ufopedia entries? Case in point, this probably concerns

_txtWeight = new Text(88, 8, 104, 55);
_image = new Surface(32, 48, 157, 5);

The latter, via interfaces.rul.
Todolisted.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9009
    • View Profile
Done.

Sample ruleset:

Code: [Select]
interfaces:
  - type: articleItem
    elements:
      - id: image
        pos: [100, 140] # default = [157,  5]
      - id: weightText
        pos: [200, 160] # default = [104, 55]

https://github.com/MeridianOXC/OpenXcom/commit/fd8ebf1f745ec4a9e64627f1fac0d6e57b2c2af4