***********************************************
	Warma's Grouping Mod
***********************************************

This mod splits grouping into two layers. Subgroups and supergroups. It also contains some additional functions for manipulating the subgroups and automatically selecting supergroups or subgroups. Also automatic cycling through subgroups and individual units of subgroups and superroups is supported.

Conflicts: The mod is a half-rewrite (as opposed to full rewrite) of AdmiralZeech's Tiered Grouping mod for FA, and thus conflicts with similar mods and the original. Do not use it at the same time as Goom's Advanced Groups mod or AdmiralZeech's Tiered Grouping Mod.

Anti-Conflicts: This mod WORKS with AZUI, which many people prefer to reduce the interface lag present in some situations. I typically have this mod, AZUI and GAZ_UI enabled for maximum FA UI perfection.

Requirements: The mod REQUIRES AdmiralZeech's GAZ_UI to bind keys to any of the new functions, without which it is completely useless. The only reason the mod isn't integrated to GAZ_UI is that Zeech preferred to keep them separate for upkeep and patching reasons.

	************
	* Overview *
	************

Think of the supergroups as the old groups. From now on, every group you create is divided to subgroups, typically by unit type and optionally by unit amount.

	********************
	* Onscreen Display *
	********************

On the top right of your screen, on the left side of the player-score window, is the grouping display. It shows your currently selected Supergroup and Subgroup in the format:

Supergroup : Subgroup

You will always have a current Supergroup. However, sometimes you wont have a current Subgroup, in which case the Subgroup indicator will show "X", or in some cases "B".

	*************************************
	* Automatic selection functionality *
	*************************************

When you push down the Alt-key and click on an unit, the group that the unit belongs in, will be selected. You do not need to define any automatic selection groups, as this function operates on the same groups you define by other means. 

In the options, you can select whether this will be the Supergroup or Subgroup of that unit, or if the feature should be completely disabled.

	*************************
	* Key and Function List *
	*************************

I will list the keys in the form they are bindable in GAZ_UI. First the general keys.

	(Grouping) Filter selection to current supergroup

Select those units of the units selected that belong to the current supergroup.

	(Grouping) Select factories in current supergroup

When selecting a supergroup, factories are not selected by default if there are units other than factories in the group (typical). This will select the factories in your current supergroup.

	(Grouping) Next unit in supergroup - Select

Select the next unit in the current supergroup. If no unit is selected, the first unit is selected. Order is believed to be that of the unit creation timestamp.

	(Grouping) Next unit in supergroup - Add to selection

Same as previous, except that you now add the next unit to selection.

	(Grouping) Next subgroup in supergroup - Select

Select the next subgroup in the current supergroup. If no subgroup is selected, the first subgroup is selected.

	(Grouping) Next subgroup in supergroup - Add to selection

As previous, except that you now add the next subgroup to selection.

	(Grouping) Selection to new supergroup, divide by type

Reform the current supergroup out of the selected units, divide units into subgroups by type.

	(Grouping) Selection to new supergroup, divide by amount

Reform the current supergroup out of the selected units, divide units into three subgroups by unit amount. Each subgroup gets the same amount of each different unit.
Note that I don't really see why these keys are useful, but somebody wanted them.

	(Grouping) Set units to return fire
	(Grouping) Set units to hold fire
	
Self-evident. These didn't have boundable keys by default.

	(Grouping) Cascade fire with 1 sec intervals
	(Grouping) Cascade fire with 2 sec intervals
	
This is Zeech's functionality. Select a supergroup and hit one of these keys to put them all on hold fire. Then, in one- or two-second intervals, the subgroups of this supergroup are set to return fire. Essentially the point of this is to allow artillery or other slow-firing high-overkill units to overkill a bit less. I've never used it but somebody liked it too.

	(Grouping) Toggle autoselect inversion behavior

By default, pressing Alt while clicking an unit performs automatic selection and you can set this in interface options. This key toggles the behavior and autoselects by default, so that if you hold Alt, autoselection will not be performed.
The point of this functionality is that some users prefer not to use Alt at all, but repeatedly toggle the behavior to get the results they want. For most people, the default functionality is best and they won't need to bind this key at all.
Do note that using this key will NOT save its changes - when you begin a game, the behavior will always be as it was the last time you touched interface options.

	(Grouping) Select subgroup 1-10
	(Grouping) Select supergroup 1-10

Self-evident. However, tapping the selection key when a supergroup is selected will select the first subgroup of that supergroup. Repressing the key will then select the next and cycle through the rest of the subgroups. In subgroup selection, the same works for individual units.
To be able to select the whole supergroup or subgroup again, just click on empty space or select an unit from outside that group.

	(Grouping) Add subgroup 1-10 to selection
	(Grouping) Add supergroup 1-10 to selection

Self-evident. Repressing these keys has no effect as they are simply meant to perform group unions.

	(Grouping) Create subgroup 1-10
	(Grouping) Create supergroup 1-10

Subgroup creation is self-evident. When creating a supergroup, the different unit types are dealt to subgroups and the maximum amount of these subgroups is capped byt the "Max automatic subgroups" variable in your interface options. If there are more unit types than this value, some groups get several types of units.

Like with the default game settings, factories can be inserted into groups but they aren't selected when you select the group via the selection hotkeys. As before, you can use this to create factories that feed groups. Units born from factories will inherit both the supergroup and subgroup of their creators.

	(Grouping) Add to subgroup 1-10

This adds the selected units to the specified subgroup. This might ocassionally be useful, but there is a limited amount of sensible combinations of shift, control, alt and number keys, which makes it less smart to waste space binding this. If you need this functionality, it may be better to just add that subgroup to selection and redefine it.

	(Grouping) Divide supergroup to 1-10 subgroups

The division by unit type in group creation is used by default as it requires no input from the user. This function, however, has input in the form of how many subgroups you want, takes the currently selected units and reforms the current supergroup by divind the units evenly, type by type, to each of the subgroups.

	(Grouping) Select factories in supergroup 1-10

Exactly what it says. This function doesn't select anything else from the group in question.

	******************
	* Advanced usage *
	******************

The division by unit amount is is perhaps the most important function of this mod. It allows fast and efficient use of subroups to divide fire and attackers.

Let's emphasize this with a hypothetical scenario. You have 10 T2 bombers and the enemy ACU is hiding, unable to be sniped. However, his base is currently undefended and you have air superiority. Ordering the bombers to attack a target in the base overkills it and allows the base AA much more time to pound your bombers while they scramble to find new targets, and individually picking targets for the bombers is slow.

What if you select the bombers, press for example Ctrl-4 to put them in supergroup 4, then press Ctrl-Alt-5 to divide the supergroup into 5 subgroups, 2 bombers each. It might still be pretty slow to deal targets individually, but what if you tap 4 multiple times to select the different subgroups and deal them a target or few each. Push 4, click for target... Repeat five times and you're set. It took one doubleclick to select all the bombers, two keyboard presses to make them supergroup 4 and divide that group into 5 subgroups, and then 5 pressings of 4 and 5 mouseclicks to deal five individual targets. 7 keypresses, 7 clicks. All this WITHOUT needing to move your mouse all over the place.

Also consider the possibilities this cycling functionality has with artillery drops. You can do the same, or if you're too lazy to deal the subgroups, just bind [(Grouping) Next unit in supergroup - Select] to, for example D. When the artillery is down on your opponents base, push the group number once and mash D to quickly select and individually order your forces.

	************************************
	* Recommended example keybindindgs *
	************************************

Only the most useful keys included (these were for a finnish keyboard, if they seem nonsensical).

X			Select next unit in supergroup
Shift-X			Add next unit in supergroup to selection

Semicolon		Hold fire
Rightbracket		Return fire

[number]		Select supergroup [number]
Alt-[number]		Select subgroup [number]
Shift-[number]		Add supergroup [number] to selection
Shift-Alt-[number]	Add subgroup [number] to selection
Ctrl-[number]		Create supergroup [number]
Ctrl-Alt-[number]	Divide supergroup to [number] subgroups

I didn't include manual creation of subgroups, as it is necessary only in very rare situations. Let's also see an alternative grouping keychart from AdmiralZeech, saving screen estate and concentrating on the essential:

[6-0]			Select supergroup [6-0]
[1-5]			Select subgroup [1-5]
Shift-[6-0]		Add supergroup [6-0] to selection
Shift-[1-5]		Add subgroup [1-5] to selection
Ctrl-[6-0]		Create supergroup [6-0]
Ctrl-[1-5]		Create subgroup [1-5]
Ctrl-Alt-[1-5]		Divide supergroup to [1-5] subgroups

For this to work properly, "Max number of automatic subgroups" should be 5. The point is essentially to have better manual control of subgroups and thus, to do with a lesser amount of supergroups. The configuration only utilizes 5 supergroups and 5 subgroups and thus does not require esoteric metakey combinations. I dislike this personally, as I've never found any need to really control subgroups manually except in assault situations where cycling is good enough.

	*******************
	* Troubleshooting *
	*******************

If something doesn't seem to work, restart the mission. Any options you change through the options dialog WILL NOT TAKE EFFECT UNTIL RESTART, as the mod only reads the options upon game setup. I'm sorry for this, but that's how it goes. Due to this, it may take a while to set everything up to your liking, but it will probably be worth it.

If setting keys doesn't seem to work or the mod crashes, you're probably upgrading from a previous version and the keylist order has changed, crashing GAZ_UI as your game.prefs has an incorrect listing. If you don't know what this means, the easiest way to get around it is to get a fresh game.prefs file (delete the original) and to delete the cache files supcom keeps in the Local Settings directory. Sorry about the inconvenience.

	**********************************
	* Final words and how to contact *
	**********************************

I am open for suggestions and pleas for more advanced usage. However, if you want a key that selects the TML in your current group with the largest amount of missiles and which is not currently in the process of firing, don't expect results soon.

-Warma (warma@iki.fi)