Author Topic: Soldier stats menu in base glitch [SOLVED]  (Read 1799 times)

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Soldier stats menu in base glitch [SOLVED]
« on: July 23, 2022, 10:57:44 am »
Made a new menu (uses the Base palette, which seems the correct one).
Bet ingame I get some visual glitches.

  - type: BACK06.SCR
    singleImage: true
    width: 320
    height: 200
    files:
      0: Resources/apoc/BACK_SCR/BACK06_SCR.png

Any idea why?
« Last Edit: July 23, 2022, 12:09:22 pm by robin »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9104
    • View Profile
Re: Soldier stats menu in base glitch
« Reply #1 on: July 23, 2022, 11:15:38 am »
It's because we process the image.

The OG original has only 10 rows and OXC/OXCE version has 11 or 12 rows (for melee accuracy and mana pool).

Here's how we process it:

Code: [Select]
// we create extra rows on the soldier stat screens by shrinking them all down one pixel/two pixels.
int rowHeight = _manaEnabled ? 10 : 11;
bool moveOnePixelUp = _manaEnabled ? false : true;

// first, let's do the base info screen
// erase the old lines, copying from a +2 offset to account for the dithering
for (int y = 91; y < 199; y += 12)
for (int x = 0; x < 149; ++x)
_surfaces["BACK06.SCR"]->setPixel(x, y, _surfaces["BACK06.SCR"]->getPixel(x, y + 2));
// drawn new lines, use the bottom row of pixels as a basis
for (int y = 89; y < 199; y += rowHeight)
for (int x = 0; x < 149; ++x)
_surfaces["BACK06.SCR"]->setPixel(x, y, _surfaces["BACK06.SCR"]->getPixel(x, 199));
// finally, move the top of the graph up by one pixel, offset for the last iteration again due to dithering.
if (moveOnePixelUp)
{
for (int y = 72; y < 80; ++y)
for (int x = 0; x < 320; ++x)
{
_surfaces["BACK06.SCR"]->setPixel(x, y, _surfaces["BACK06.SCR"]->getPixel(x, y + (y == 79 ? 2 : 1)));
}
}

You can either make it compatible with that; or I could implement an option to skip processing the source image (easy to do).
« Last Edit: July 23, 2022, 11:19:12 am by Meridian »

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: Soldier stats menu in base glitch
« Reply #2 on: July 23, 2022, 12:09:10 pm »
Made it compatible, thanks!