UWindows for Mutator Options. Author: mek Date: 27 October 1999 A few quick notes on Uwindows for mutator authors, written by Jack 'mek' Porter, the architect of UT's GUI.

Mutators with configuration options should make their own UWindow subclasses for configuration, and insert themselves into the (usually invisible) Mods menu, instead of using advanced options. Here is a really basic outline of how you'd go about it. I haven't compiled this code but it's pretty much everthing you should need to do. (JbP: I've since compiled the code. It works :) When I get some time I hope to document the uwindow classes so it's a bit more obvious where to start doing stuff like this.

MyMutatorConfigWindow

class MyMutatorConfigWindow expands UWindowFramedWindow;

function Created()
{

> Super.Created();
> SetSize(150, 100);
> WinLeft = (Root.WinWidth - WinWidth) / 2;
> WinTop = (Root.WinHeight - WinHeight) / 2;

}

defaultproperties
{

> ClientClass=class'MyMutatorConfigClient'
> WindowTitle="UDamageArena Configuration!"

}

MyMutatorConfigClient

class MyMutatorConfigClient expands UWindowDialogClientWindow;

var UWindowCheckBox SomeCheck;

function Created()
{

> Super.Created();
> SomeCheck = UWindowCheckBox(CreateControl(class'UWindowCheckBox', 10, 10, 100, 1));
> SomeCheck.SetText("Some Option");
> SomeCheck.SetFont(F_Normal);
> SomeCheck.Align = TA_Left;
> SomeCheck.bChecked = class'MyMutatorClass'.default.bSomeOption;

> // You could of course add heaps of controls in here.
> // See the UMenu and UTMenu for a billion examples.

}

function Notify(UWindowDialogControl C, byte E)
{

> switch(E)
> {

> > case DE_Change:
> > switch(C)
> > {

> > > case SomeCheck:
> > > class'MyMutatorClass'.default.bSomeOption = SomeCheck.bChecked;
> > > class'MyMutatorClass'.static.StaticSaveConfig();
> > > break;

> > }

> break;

> }

}

MyMutatorMenuItem

class MyMutatorMenuItem expands UMenuModMenuItem;

function Execute()
{

> MenuItem.Owner.Root.CreateWindow(class'MyMutatorConfigWindow', 10, 10, 150, 100);

}

defaultproperties
{

> MenuCaption="&UDamageArena Configuration"
> MenuHelp="Configure the UDamageArena mutator! Make ALL your pickups UDamages!!!!"

}

The int file

Finally, you need to add this to your mutator's .int file to add yourself into the menus.

[Public]
Object=(Name=MyMutatorPkg.MyMutatorMenuItem,Class=Class,MetaClass=UMenu.UMenuModMenuItem)

-------------------------------------------------

JbP's Notes:

1) The int file has a reference to MyMutatorPkg. This should be changed to the name of your package.

2) To compile the above directly, you will need to create the mutator which these classes reference. It is called MyMutatorClass:

> class MyMutatorClass expands Mutator;

> var bool bSomeOption;

3) If you've never used ucc to compile uc classes before, the 'defaultproperties' sections above will be unfamiliar to you. They won't compile inside UnrealEd. You will need to compile the above using ucc. Heres the simple explanation:

1. Go into your UnrealTournament.ini file and find the section containing the EditPackages= statements. There should be about 10 of them. Add EditPackages=MyMutatorPkg at the end of this list.
2. Make a sub-directory of your UT directory called MyMutatorPkg. Make a sub-directory of this, called Classes.
3. Save each class as a .uc file in the classes directory. You should have four text files, called MyMutatorMenuItem.uc, MyMutatorClass.uc, etc. The name of the uc file should be the name of the class.
4. Open up a dos prompt, cd to your UT\System directory, and type ucc make. It should eventually either compile your code or return an error, indicating you need to check your code or your files setup. Warnings will result in compiled code, but if you ignore warnings be prepared for buggy mods.

4) Thanks, Mek!