aliens

Author Topic: Window popup animation  (Read 14840 times)

Offline luciderous

  • Colonel
  • ****
  • Posts: 108
  • There is no spoon...
    • View Profile
Window popup animation
« on: August 01, 2010, 09:51:09 am »
Something has been bugging me for quite a long time recently and I really didn't get what was exactly the reason. Finally, I've found the culprit - it was the window popup animation lag. I've double-checked it with the original X-Com and it was totally missing there - the windows popped up instantly!
Looking deeper into "Window.cpp" I noticed, that such a behavior seems to have been intended, while it definitely should have not. Thus I decided to make a small hack-fix. Of course, it may render some other code in the same file unnecessary, but is to SupSuper to decide.

Offline michal

  • Commander
  • *****
  • Posts: 629
    • View Profile
Re: Window popup animation
« Reply #1 on: August 01, 2010, 12:08:41 pm »
IMHO you should post such patches in "contributions" forum.

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Window popup animation
« Reply #2 on: August 02, 2010, 01:48:08 am »
Actually the window popup animation was present in the original X-Com. Every window that plays a sound when it pops up has this animation. The reason you see it "pop up instantly" in the original is because the animation is CPU-dependant, so on modern computers the animation will always play at full speed (much like stuff like the Geoscape and Battlescape scrolling are hyper-fast on modern computers). You will only see it on the DOS version running it on a properly slowed-down-emulator, or on the Windows version (example here) which was better calibrated (specially with UFO Extender), or even the PSX version.

If this is annoying to you though, I will look into adding an option in the future to disable it.

Offline Eeyoocah5Moh

  • Sergeant
  • **
  • Posts: 28
    • View Profile
Re: Window popup animation
« Reply #3 on: August 02, 2010, 01:48:43 am »
Image attached. Ufopaedia window popup both horizontally and vertically. Slow down game in dosbox and you will see it.

Offline Eeyoocah5Moh

  • Sergeant
  • **
  • Posts: 28
    • View Profile
Re: Window popup animation
« Reply #4 on: August 02, 2010, 01:53:07 am »
If this is annoying to you though, I will look into adding an option in the future to disable it.

Adding option for each thing is not good at all. Maybe just make the popup a little faster? Current speed is the same as Windows version? If not, then maybe just tweak it a little?

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Window popup animation
« Reply #5 on: August 02, 2010, 06:43:02 am »
If this is annoying to you though, I will look into adding an option in the future to disable it.

Adding option for each thing is not good at all. Maybe just make the popup a little faster? Current speed is the same as Windows version? If not, then maybe just tweak it a little?
The current window popup takes around 0.13s, any faster and it'd be gone. I imagine it's faster than the Windows version, there's no real accurate way to find out so I just went with what feels right. Plus technically you don't need to wait for the popup because the controls pop up instantly (unlike in X-Com, because I'm lazy and sloppy sometimes :P).

As for options, well as long as each thing is as simple as a line of code, I'm fine with that. Even if each thing is just a nag, I'm fine with that too. I won't take care of it post-haste, but I like to show I'm not ignoring it either. After all, that's kind of the point of this thing. That's why mods like UFO Extender are so popular, because they take care of all the options and nags that the fanbase has always wanted.

Offline luciderous

  • Colonel
  • ****
  • Posts: 108
  • There is no spoon...
    • View Profile
Re: Window popup animation
« Reply #6 on: August 02, 2010, 08:14:47 am »
Plus technically you don't need to wait for the popup because the controls pop up instantly (unlike in X-Com, because I'm lazy and sloppy sometimes :P).
That's exactly what was nagging me! ::)
I can perfectly live with the popup animation, but right now the text appears before the box does and it feels rather awkward. Perhaps syncing them will do the trick  :)

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Window popup animation
« Reply #7 on: August 02, 2010, 10:19:07 pm »
Curses, foiled again! :P Now it's no longer a single-line fix.

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: Window popup animation
« Reply #8 on: August 03, 2010, 12:27:00 pm »
Sure there is.

Code: [Select]
if( currentSize == destinationsize )
   AddControls()

 :D

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Window popup animation
« Reply #9 on: August 04, 2010, 12:59:41 am »
Sure there is.

Code: [Select]
if( currentSize == destinationsize )
   AddControls()

 :D

Damn, if only programming was that easy, I could've been done months ago!

Code: [Select]
int main(int argc, const char* argv[])
{
Xcom();
}

:D

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: Window popup animation
« Reply #10 on: August 04, 2010, 09:03:16 am »
Joking aside, it is pretty much that easy.

What I would do is
  • Add a new parameter to the Window constructor called PopupCallBack, which points to a void Callback(Window source) function
  • In Window::popup(), if PopupCallBack was provided, call it
  • Create a callback function in the screens that do popup windows, use the source variable to work out which popup is being displayed (or you could just pass different methods to the constructors), and add the necessary buttons

Edit: Would you like me to create a "demo" patch?

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Window popup animation
« Reply #11 on: August 05, 2010, 03:44:39 am »
I appreciate the idea but it's been fixed for a while (well, since Tuesday anyways) if you missed it. :P I also found some other bugs that might've been nagging users worldwide in the process, so in the end it was win-win!

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: Window popup animation
« Reply #12 on: August 05, 2010, 09:03:21 am »
Yip, I missed it, not done much programming outside of work lately  :(
I'll have to update my SVN and take a look