PDA

View Full Version : Adding a new menu?


jeremyosborne
12-18-2010, 01:32 PM
If I want to add a whole new menu to the game, that uses a different name, do I override the systems.gdb->UISystem object?

For example, located in some file that I create:

PartyMember overrides UISystem
{
// Recognize a PartyMember0 UI menu
GameMenu PartyMember0
}


What I really want to do is modularize my code into smaller files and more menus. My real concern is:

Is there some sort of MNU_MAX that I need to worry about?

jeremyosborne
12-19-2010, 01:24 AM
In terms of just getting this to work, I believe I've answered my own question. Here's the example .gdb override the worked for me, and figuring this out also helped explain why certain menu files I created just never seemed to be visible in game:


PartyMemberMenuChanges overrides UISystem
{
// NOTE: We appear to need to write in every menu that will
// appear if we are going to override the UISystem::GameMenu
// settings.

GameMenu Game
GameMenu Player
GameMenu TimedEvent
GameMenu SelectedEntity
// Recognize the PartyMemberN container.
GameMenu PartyMembers
// Recognize a PartyMember0 UI menu
GameMenu PartyMember0
GameMenu PartyMember1
GameMenu PartyMember2
GameMenu PartyMember3
GameMenu PartyMember4
GameMenu PartyMember5
GameMenu PartyMember6
GameMenu PartyMember7
GameMenu PartyMember8
GameMenu PartyMember9
GameMenu PartyMember10
GameMenu Client1
GameMenu Client2
GameMenu Client3
GameMenu Client4
GameMenu Client5
GameMenu Client6
GameMenu Client7
GameMenu Client8

}

Shadow
12-20-2010, 12:11 PM
There shouldn't be any max files limit.

Those GameMenu lines are only needed if you make a new menu that needs to automatically show up on the main game screen.

In this case it would be better to use addsTo instead of override, so you can do something like this:

PartyMemberMenuChanges addsTo UISystem
{
GameMenu PartyMembers
}

Most of the time you want to use overrides, but if you just want to add some things that can have multiple lines and you want to keep all of the old ones, addsTo works better.

jeremyosborne
12-20-2010, 12:16 PM
I didn't know addsTo existed. NICE!

Thanks Shadow!

jeremyosborne
12-20-2010, 12:24 PM
And thanks for the clarification about the GameMenu parameter. That solves the mystery why I was able to place my invisible PartyMembers menu into the game in my tests without declaring it in GameMenu: it never needed to be visible, it just needed to be positioned. However, my new PartyMemberN, like PartyMember0, status menus wouldn't show up, so I guess they fall into the need to show up automatically category and need to be declared as GameMenu properties.

I'll clean up my mod and use your suggestion.