Author Topic: Implementing New Graphics?  (Read 8777 times)

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Implementing New Graphics?
« on: November 09, 2012, 05:24:42 pm »
How do we want to approach adding graphics to the game? One of the suggestions was to allow TU reservation for kneeling. There isn't such a button within UFO:EU for that. I also want to add XCOM:Apoc style "aggressiveness" options, which dictate more a fight or flight response on aliens.

Would I need to create a PCK (or whatever the graphics pack is) or should I just create a BMP file or something? or should I just try a different method (use a normal "button" and apply text instead of icons)?

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Implementing New Graphics?
« Reply #1 on: November 09, 2012, 06:55:14 pm »
https://www.ufopaedia.org/index.php?title=ICONS.PCK

my approach would be along these lines:

shrink the reserve TU buttons horizontally by approximately 33% each
this would make space for a third set of buttons.
one could be the "reserve for kneel" button
the other could contain maybe a "no reaction fire" button or a slider or something.
then i'd fiddle with source to alter the bounds of the buttons and so on.

of course, this would be my approach as a MODDER.

i'm guessing you're looking at adding this as an "optional feature" in vanilla OpenXcom, plus you care about copyright.
my suggestion in this case would be:
make a new .pck file (that's not a copyrighted format, right?) that contains ONLY the shrunk down/modified buttons, superimpose it over the vanilla buttons and have an alternate set of boundaries, if "extra time unit reservation options" is enabled in the menu.

i'll throw something together and post a link here.

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: Implementing New Graphics?
« Reply #2 on: November 09, 2012, 07:00:02 pm »
Well, the updated UI was just the "current" example really. I suppose going forward as we add more new (optional) features, this will become more prevalent. In which case, do we really need to be drawing out graphics and creating PCKs for them when SDL can load BMPs without any issue etc.?

What tools are there for creating and editing PCK/SPK/etc.?

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Implementing New Graphics?
« Reply #3 on: November 09, 2012, 07:26:15 pm »
this is true, there is no real NEED to use .pck or spk files, i'm just spitballing.

as for what tools... i use BombBloke's toolkit, because it works. no idea what else might be out there.

in any case, here's the files as they are.

https://dl.dropbox.com/u/47596892/extraicons.pck

shouldn't be terribly hard to get it in and working

as for the how to implement part: how about something akin to rulesets for custom GUIs?
dump in a gif/bmp to the data folder somewhere, define in the "gui ruleset" the on-screen boundaries of each button. add in a few extra functions (codewise) for things like "reserve for kneel" and "don't shoot" and whatever else we can come up with, but only have them accessible via the "expanded/custom gui" option, and ship the final product with a fully pimped out custom GUI with everything represented and a 20x20 area in which to view the battlescape.

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Implementing New Graphics?
« Reply #4 on: November 09, 2012, 09:07:19 pm »
Well, the updated UI was just the "current" example really. I suppose going forward as we add more new (optional) features, this will become more prevalent. In which case, do we really need to be drawing out graphics and creating PCKs for them when SDL can load BMPs without any issue etc.?
The problem isn't that SDL can't handle funky new formats (although suggesting BMPs is a dangerous game :P), there's just no way to point OpenXcom at them, they're all hardcoded. I plan on tackling this in 0.5.

Volutar

  • Guest
Re: Implementing New Graphics?
« Reply #5 on: November 09, 2012, 09:12:41 pm »
there should be ability to load PNG sprites instead of PCK, where it needed.

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: Implementing New Graphics?
« Reply #6 on: November 09, 2012, 09:29:14 pm »
as for what tools... i use BombBloke's toolkit, because it works. no idea what else might be out there.
Hmmmmm... Java :( I refuse to have Java on this PC, might run it though a VM or find a java compiler or something


in any case, here's the files as they are.
Thanks

as for the how to implement part: how about something akin to rulesets for custom GUIs?
Depends on to what extent you allowed skinning. Just repositioning, resizing and selecting new graphics should be quite easy.

The problem isn't that SDL can't handle funky new formats (although suggesting BMPs is a dangerous game :P)
I know that :) And what's wrong with bitmaps?  ;D

there's just no way to point OpenXcom at them, they're all hardcoded. I plan on tackling this in 0.5.
Well, as v0.4.5 is out and we're on the road to v0.5, "What's the plan, Dan?"

and how does the ImageButton work? I'm looking at the BattlescapeStage, it creates the reserve buttons as ImageButtons, but I can't find where it sets the image?! Am I going blind?

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Implementing New Graphics?
« Reply #7 on: November 09, 2012, 09:50:23 pm »
Well, as v0.4.5 is out and we're on the road to v0.5, "What's the plan, Dan?"
The plan is for me to take some really hard medicine before I can deal with all this. :P My plans for 0.5 are only "do something about missions" and "do something about resources" so far, it's not like I've had any time to actually think about them lately. :P
and how does the ImageButton work? I'm looking at the BattlescapeStage, it creates the reserve buttons as ImageButtons, but I can't find where it sets the image?! Am I going blind?
The ImageButton on its own has no graphic, you have to draw it yourself (eg. by copying it from ICONS.PCK like the Battlescape reserve buttons do) and it will treat it like a button (inverting it when pressed etc). If you just copy one of the existing ImageButtons and position it appropriately it should automatically work as expected.

Mind you I can't include any such changes into the game itself since "modified original graphics" is an ambigious area, but if you just keep it on the forums I'll look another way. ;)

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: Implementing New Graphics?
« Reply #8 on: November 09, 2012, 11:02:28 pm »
The plan is for me to take some really hard medicine before I can deal with all this. :P My plans for 0.5 are only "do something about missions" and "do something about resources" so far, it's not like I've had any time to actually think about them lately. :P
Okay. I might as well wait and see what you decide

The ImageButton on its own has no graphic, you have to draw it yourself (eg. by copying it from ICONS.PCK like the Battlescape reserve buttons do) and it will treat it like a button (inverting it when pressed etc). If you just copy one of the existing ImageButtons and position it appropriately it should automatically work as expected.
That's confusing, but I think I understand it now

Mind you I can't include any such changes into the game itself since "modified original graphics" is an ambigious area, but if you just keep it on the forums I'll look another way. ;)
TBH, I was going to create some new ones.