Animated and transitioning menus?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Animated and transitioning menus?

Postby Major Cooke » Sun Nov 01, 2020 9:14 am

I'm currently trying to search through the source code to find information about how to animate and transition menus. What new functions were introduced and how do they operate?
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: Animated and transitioning menus?

Postby Player701 » Mon Nov 02, 2020 2:44 am

Check this MENUDEF out with the Doom II IWAD:

Code: Select allExpand view
AddListMenu "MainMenu"
{
    animatedtransition
}

AddListMenu "Skillmenu"
{
    animatedtransition
}

This implements animated transitions between the main menu and the skill selection menu.

The Menu class also has a field called Animated, though it's not used in ZScript code. In C++, there is a function called M_IsAnimated, which references this field, but the function itself doesn't seem to be used anywhere. I guess animations themselves are supposed to be implemented in user code, and the menu should set Animated to true to indicate that it uses animations (though, like I said, it doesn't seem to be necessary at the moment, since M_IsAnimated is not called from anywhere).
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Animated and transitioning menus?

Postby Graf Zahl » Mon Nov 02, 2020 4:42 am

M_IsAnimated should be used to disable the frame rate cap when outside the game. Looks like I forgot to add that piece of code. If a menu plays animations not limited by the tic rate the Animated field should be set.

If you want to play actual animations on the menu, they will have to be implemented by the menu, of course. None of the stock controls implements such a thing.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Animated and transitioning menus?

Postby Player701 » Thu Nov 05, 2020 1:26 am

Graf Zahl wrote:M_IsAnimated should be used to disable the frame rate cap when outside the game. Looks like I forgot to add that piece of code. If a menu plays animations not limited by the tic rate the Animated field should be set.

Question: Suppose I have a menu that can show animations depending on user input but does not show them by default. Will it be OK to set Animated to true at any time during the lifetime of the menu, or will the engine only check for it once during Init?
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Animated and transitioning menus?

Postby Player701 » Mon Nov 23, 2020 8:19 am

Since there hasn't been an answer for some time, I've gone ahead and checked the Raze repository myself. This is where M_IsAnimated is called. I have transplanted that part of code onto GZDoom's sources, and everything seems to work just fine. Considering that the function (TryRunTics) M_IsAnimated is called from is not related to menu switching, it should be OK to change the value of Animated at any point during the menu's lifetime.
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest