STAR CADRE: COMBAT CLASS - GAME DESIGN

This document has been written before playtesting has begun. The
findings of playtesting might therefore result in variations between
this document and the eventual game. Some variations are anticipated
at the time of writing:

* Multiple means of grading difficulty have been provided in the
  knowledge that the effects of combining them all might be too
  great, e.g. making the hardest level impossible or the easiest no
  challenge to a beginner. Some of those distinctions may be erased in
  the final game.

* Many of the rules have been formulated for initial playtesting using
  six sided dice. Some of these methods may be streamlined in the
  final game for efficiency of speed, memory or development time,
  e.g. the skill tables.


The Game Rules

A game of Star Cadre: Combat Class (SCCC) consists of the following
elements, expanded upon later:

* A team - four units to be controlled by the player.

* A mission - a single level map with enemy units, furniture, items
  and an objective.

* A state - aspects of the current state of the game not represented
  in the mission data or in the team stats, including things like turn
  number and user interface context.


Unit Generation: the Team

A unit has a name and a class. The name is generated at random, but
can be freely edited by the player. It can be up to 12 characters long
and contain printable characters from the standard ASCII character
set.

The class is chosen at random, but can also be picked by the player
prior to generating the rest of the character's stats. The character
classes are as follows:

* Medic (Med): uses a light firearm and/or blade for defence, and
  carries a medikit in order to heal themselves and other units. May
  or may not wear a helmet and body armour. Possesses skills in
  Medicine, Unarmed Combat and their chosen weapon.

* Scout (Sco): uses a blade for defence. Does not wear a helmet or
  body armour. Possesses skills of Unarmed and Blade Combat and
  Stealth.

* Auxiliary (Aux): uses a laser pistol and possibly a blade for
  defence. May or may not wear a helmet and or body armour. Possesses
  skills in Light Firearms and Blade and Unarmed Combat.

* Infantry (Inf): uses a laser rifle and possibly a laser pistol
  and/or a blade for defence. Will always wear a helmet and body
  armour. Possesses skills in Heavy Firearms, Light Firearms, Blade
  Combat and Unarmed Combat.

The way in which the class affects the generation of stats and skills
is described later. The main character stats are strength, agility and
endurance. The stats are generated by initialising them with
class-specific values from the following table:

		Str	Agi	End
	Med	2	2	7
	Sco	2	7	2
	Aux	5	5	5
	Inf	7	2	2

The stats are then repeatedly incremented at random till the total of
all the stats reaches 21, with no single stat exceeding 12. The stats
have the following purposes:

* Strength: helps to determine the unit's maximum health, and how much
  a unit can carry before affecting their action points.

* Agility: helps to determine how many action points a unit can start
  with each turn.

* Endurance: helps to determine the unit's maximum health points, and
  their overall resistance to damage.

With the stats decided, the maximum status stats are calculated. These
are as follows:

* Action points: these are calculated by adding 14 to the player's
  agility. They are restored to this maximum each turn, minus any
  burden due to items carried.

* Health points: These are calculated by adding 7 to the player's
  endurance and strength. Damage not absorbed by armour and natural
  endurance will be subtracted from Health.

Once these stats are calculated, the skills are generated. First, the
unit is given 4 points in their primary skill as indicated in the
following table:

	Med:	Medicine (Med)
	Sco:	Stealth (Stl)
	Aux:	Light Firearms (LtF)
	Inf:	Heavy Firearms (HvF)

Then four more points are allocated to the primary and secondary
skills, by rolling two six-sided dice (2D6) four times, each time
consulting the following table:

	Roll	Chance	Med	Sco	Aux	Inf	3ry
	2	1/36	Med	Stl	LtF	HvF	Stl
	3	2/36	Med	Stl	LtF	HvF	UnC
	4	3/36	Med	Stl	LtF	HvF	Bld
	5	4/36	LtF	Stl	LtF	LtF	UnC
	6	5/36	LtF	Bld	Bld	LtF	Stl
	7	6/36	Bld	Bld	Bld	Bld	Med
	8	5/36	UnC	UnC	UnC	UnC	LtF
	9	4/36	UnC	UnC	UnC	UnC	HvF
	10	3/36	Bld	UnC	UnC	Bld	Bld
	11	2/36	Med	Stl	LtF	HvF	HvF
	12	1/36	Med	Bld	Bld	HvF	LtF

The skill listed in the column of the unit's class (Med, Sco, Aux,
Inf) is increased by one point each time, with the following
limitation:

* No skill can exceed six points.

So if the primary skill is already at 6, the roll would have to be
retaken so that the point is given to a secondary skill. Once the
secondary skills are allocated, four more points are allocated to
tertiary skills in the same way, except that the "3ry" column will be
consulted instead of the column for the unit's class. The previous
limitation (level 6 maximum) still applies, as well as the following
limitations:

* A unit will have no more than four separate skills.

* No secondary skill can exceed the value of the primary skill.

* No tertiary skill can exceed the value of a secondary skill.

As before, if allocating the skill point would violate any of these
rules, the dice are rolled again.

The result of this process is that a unit will have good skills
appropriate to their class, and possibly a bonus skill or two that
will come in useful during the mission. There will be twelve skill
points in total. Now would be a good time to enumerate the game's
skills and what they mean.

* Medicine (Med): the level at which, with the aid of a medikit, a
  unit can heal themselves or other units. Higher levels of this skill
  indicate a higher chance of success in healing.

* Stealth (StL): the level at which a character can move in the
  vicinity of an enemy without being detected. Higher levels of this
  skill allow a unit to move closer to an enemy without being
  detected.

* Heavy Firearms: the accuracy with which a unit can make use of heavy
  firearms, which in SCCC means the laser rifle.

* Light Firearms: the accuracy with which a unit can make use of light
  irearms, which in SCCC means the laser pistol.

* Blade Combat: the facility with which a unit can fight with a
  blade. Higher levels give a higher chance of a successful slash or
  stab.

* Unarmed Combat: the facility with which a unit can fight without a
  weapon. Higher levels give a higher chance of landing a successful
  blow.

The exact manner in which these skills work is described in the
sections on combat and other actions. Once the skills have been
allocated, the units will be given equipment according to their class
and skills. Initially, defensive equipment is allocated according to
rolls on a single die:

		Helmet	Armour
	Medic	5-6	5-6
	Scout	never	never
	Aux	3-6	3-6
	Sold	always	always

Then weaponry is allocated. The unit will automatically receive a
weapon that corresponds to their highest weapon skill: units with
Blade get a blade, units with Light Firearms get a laser pistol, units
with Heavy Firearms get a laser rifle.

Finally, any unit with a skill of Medic:4 or greater will receive a
medikit. Units with Medic:1-3 will have to find a medikit at the
mission location, or borrow the medikit of a comrade, to give medical
attention.


Mission Generation

A mission consists of the following aspects: an objective, a
difficulty level, a map, and a group of enemy units. The objective is
either chosen by the player, or chosen at random, and can be one of
the following:

* Assassination: take out a particular enemy unit. The mission ends
  successfully when a particular enemy unit has been taken out, and
  the player units have all left the mission location.

* Annihilation: take out all the enemy units. The mission ends
  successfully when no more enemy units remain. 

* Hostage: find a hostage and bring them to safety. The mission ends
  successfully when the hostage leaves the mission location.

* Rescue: free as many hostages as possible. The mission ends
  successfully when at least one hostage leaves the mission location,
  along with the surviving player units.

* Retrieval: find and retrieve some important data. The mission ends
  successfully when a player unit leaves the mission location carrying
  the data card.

* Heist: find as many data cards as possible and leave the mission
  location. The mission ends successfully when at least one data card
  is found, and the surviving player units have left the mission
  location.

When chosen at random, the mission will be chosen on a roll of 1D6,
consulting the following table:

	Roll	Mission
	1	Assassination
	2	Annihilation
	3	Hostage
	4	Rescue
	5	Retrieval
	6	Heist

The difficulty level is set by the player. In the initial game the
level of difficulty is set to Easy, but can otherwise be set to one of
the following:

* Easy: enemy units are allocated 2 skill points instead of 4 in each
  phase of the unit generation process.

* Fair: enemy units are allocated 3 skill points instead of 4 in each
  phase of the unit generation process.

* Hard: enemy units are allocated 4 skill points in each phase of the
  unit generation process, just like the player's units.

The map is generated by the LevelMap library. The following parameters
are given to LevelMap to make the maps suitable for the type of
locations in SCCC:

* Width and height are left at their default randomised state. This
  allows maps of up to 256 squares, in dimensions ranging from 9x28
  through 16x16 to 28x9.

* Corridor chances are reduced to 0%. This ensures that walls between
  areas are a maximum of one square thick.

* Combined chambers are left at the default 50% chance. This gives a
  fair chance of larger chambers on the level, reducing the grid-like
  appearance and providing some variety.

* Minimum cell size is reduced to 1 square, which creates de-facto
  corridors between larger rooms while ensuring that there are doors
  at regular intervals (adjacent "real" corridors in LevelMap are not
  separated by doors).

Upon generation of the level, walls are connected to suit the
aesthetic style of the game. One square along the edge of the map will
be designated as the level entrance and exit, and will have a door
inserted. This will be the square with the least visibility, so that
the player's units will not be shot at, nor discover their objective,
immediately on entering the game. To be eligible, a square will need
to satisfy the following:

* It must be orthogonally adjacent to an empty square to guarantee
  access to and from the level.

Furniture is then added to the level. The types of furniture are as
follows:

* Cabinets can contain items, and players may also crouch behind them
  to avoid notice of enemies. They block movement.

* Tables also allow players to crouch behind or under them to avoid
  notice of enemies. A player may only occupy the space of a table
  when crouched.

* Chairs can also hide crouched players. They do not block movement of
  players crouched or otherwise, but a crouched player in the space
  occupied by a chair is not protected by it.

Note that furniture may only be placed in a square that satisfies the
following conditions:

* No item of furniture can be played orthogonally adjacent to a door.

* No table or cabinet can be placed orthogonally between two walls, or
  between a wall and another table or cabinet.

* A cabinet will be adjacent to at least one wall.

This ensures that a piece or group of furniture cannot block the path
of players. The number of pieces of furniture on a map is determined
by rolling 3D6; the highest two dice are added together to determine
the quantity of furniture. This will yield a number between 2 and 12
but will favour higher numbers to provide visual interest to the map.

If there are hostages, they will then be distributed around the
map. The number and location of hostages is determined according to
the mission:

* A "Hostage" mission will have one hostage. They will be placed in
  the empty square furthest from the player units, excluding any
  squares that the player units can see from the deployment position.

* A "Rescue" mission will have between 2 and 12 hostages, decided by
  2D6. They will be placed randomly in empty squares, but none within
  four squares of the map entrance point.

* Other missions may have surprise hostages. A roll of 6 on 1D6
  indicates an unknown hostage is present, who will be placed in any
  empty square unseen by the player units at the deployment
  position. Upon placement of this hostage, another roll is given,
  these rolls continuing until a 1-5 is rolled.

The enemy units are then generated. The number of enemies is between
7 and 12, and is decided depending on the difficulty level:

* Easy: 1D6 is rolled and six is added to the roll to give the total
  number of enemy units.

* Fair: 2D6 are rolled, and the higher of the two dice is added to six
  to give the total number of enemy units.

* Hard: 3D6 are rolled, and six is added to the highest of the three
  dice to give the total number of enemy units.

The units are generated in the same way as player units, with
randomised names and classes, except that skill points are limited as
described earlier. Weapons, armour and medikits are distributed to
enemy units in the same way as for player units.

These units are placed randomly around the map, but not within sight
of the player units' deployment positions. In an assassination
mission, the furthest enemy unit from the players will be the
designated target.

Once the units are placed, items can be generated. All missions will
have a spare medikit. On a 1D6 roll of 1-3, this will be in a cabinet
(if present). Data cards will be distributed according to the mission.

In a "Retrieve" mission, the card will be placed according to the roll
of 1D6, consulting this table:

	1: in a cabinet,
	2: in a cabinet,
	3: in a cabinet,
	4: in an empty square,
	5: in an empty square,
	6: in the inventory of an enemy unit.

In all cases the card, or the unit or furniture that carries it, will
be out of sight of the player units when initially deployed. In a
"Heist" mission, there will be between 2 and 12 cards, decided on a
roll of 2D6. Each card will be distributed according to the same rules
as the single card in a "Retrieve" mission.


Player Unit Deployment and Movement

The first turn is taken by the player. Initially, there will be none
of the player's units on the map. The player is able to explore the
map using the map cursor, seeing walls, doors and furniture, but not
enemy units nor items out in the open.

In the unit panel of the screen will be one of the player's units,
considered as the "current" unit. The player may page through the
other units. There is a control that flips the display between the
unit's inventory and its skill set, so the player can examine their
units before deciding who to deploy first.

A unit may be deployed by dropping it at the entrance door. It may
then be moved or other actions taken. Only one unit may occupy a space
at any one time, so the first unit must be moved from the doorway
before the second can be deployed. Not all units need to be deployed
in the first turn, and units who leave the level may also return. The
mission is deemed to be over if, at the end of the player's turn, no
player units are deployed on the map.

A selected unit is moved by selecting an adjacent accessible square
with the map cursor. Orthogonal movement costs 2 action points;
diagonal movement costs 3 action points. Not all of a unit's action
points need to be spent at once. In deployment, for instance, it is
possible to move a unit from the door, deploy other units, and return
to the first unit and move it further. The full range of a unit's
movement options are listed below, preceded by their costs:

	Cost	Action
	2	Crouch
	2	Stand
	2	Orthogonal movement while standing
	3	Diagonal movement while standing
	4	Orthogonal movement while crouching
	6	Diagonal movement while crouching

Crouching allows a unit to move under tables, something not possible
while standing. It also helps to obscure the unit, as discussed later
in the section on combat. It does double the cost of movement, however.
Doors block movement, but an adjacent door is easily opened or closed
at the cost of a single action point.


Unit Inventory Actions

Standard inventory actions cost an action point, and consist of the
following:

* Open a filing cabinet
* Search a body
* Interact with a comrade (for item exhange)
* Pick an item up into an empty hand
* Put an item down from a hand

The user interface will provide some shortcuts to streamline inventory
management, but the costs will be added up as if the individual items
were taken. For example, swapping an item on the ground with that in
the hand will cost 2 action points.


Skills-based Actions

Some actions, described more fully later, are dependent on a level of
skill. Giving medical attention or making an attack are
examples. These actions are all performed in a similar manner,
described here.

First, 2D6 are rolled, their scores being considered
individually. These values may have modifiers applied due to certain
circumstances. If either one of the dice shows a number equal to or
less than the relevant skill, then the action is considered
successful: medical aid was rendered, a blow was landed on the
enemy.

If the unit has no skill, then a double 1 also counts as success. This
allows situations where an untrained unit can succeed occasionally due
to pure luck, and may help in desperate situations.

If a unit has a skill of 6, then a roll of 1 on either die allows the
action to have an augmented effect, and this is dependent on the
skill. So damage may be doubled, for instance, or the effect may
succeed without the usual cost in action points. On the other hand, a
double 6 counts as failure.


Giving Medical Attention

Medical attention can revive an unconscious unit and restore one point
of health. It takes six action points and is subject to a skill
check. If a unit with Medicine:6 skill rolls a 1, the operation takes
no action points.


Surprise and Stealth

When a unit surprises an opposing unit, the opposing unit is
momentarily flustered and unable to attack. Upon each initial
encounter (an opposing unit becoming visible) a 2D6 roll is made. If a
unit is wearing a helmet then 3D6 is rolled and the highest two dice
are counted. If the total is greater than the friendly unit's agility
then the unit is surprised. A surprised unit cannot immediately
attack, yielding the following effects:

* A unit surprised during its own turn is momentarily unable to attack
  an opponent it has encountered; it must wait until surprise is
  broken.

* A unit surprised during its opponent's turn is momentarily unable to
  make an opportunity attack; it must wait until surprise is broken.

Surprise is broken by the unit whose turn it is performing an action
within sight of the other (regardless of which unit is surprised). It
is possible for both units to be surprised by an encounter, and for
both units' surprise to be broken by a further action. A unit's
susceptibility to surprise is broken if:

* the unit hears a shot fired by either side;

* the unit hears a unit of either side die.

However, a unit can become susceptible to surprise again during its
own turn under the following circumstances:

* it performs any inventory action;

* it gives or receives medical attention;

* it is revived from unconsciousness.

Surprise is affected by stealth. At the cost of one action point, a
unit can attempt to "act with stealth"; a skill roll is taken against
its stealth skill to determine success. Acting with stealth can be
attempted at any time, and any number of times, during a unit's turn,
and lasts until the start of its next turn. A unit acting with stealth
has the following properties:

* it is not susceptible to surprise;

* it automatically surprises any opponent that is susceptible to
  surprise;

* it can move or perform any other non-combat action in the presence
  of a surprised unit without breaking surprise;

* it can kill an opponent with a blade without being heard; i.e. the
  other opposing units will remain susceptible to surprise.

The stealth bonus for a unit with Stealth:6 rolling a 1 is "super
stealth": it can surprise a unit for which surprise or susceptibility
to surprise has already been broken.


Combat

When a unit attacks another, either during its own turn or by
opportunity attack in its opponent's turn, the nature of the attack is
determined by what the unit is holding. The following tests are
applied in this order:

* A unit holding ONLY a laser rifle, who is two or more squares from
  the target, fires the laser rifle.

* A unit holding a laser pistol fires the pistol.

* A unit holding a knife attacking an adjacent unit attacks with the
  knife.

* A unit otherwise having an empty hand attacking an adjacent unit
  attacks using unarmed combat.

* Any unit failing these tests, e.g. a unit holding a laser rifle and
  a non-weapon object, cannot attack.

The unit will then do a skills check against the appropriate combat
skill to see if the attack succeeds. A successful attack will then
cause damage according to the following table:

	Skill	Damage
	UnC	Highest 1 of 2D6
	Bld	Highest 2 of 3D6
	LtF	2D6
	HvF	3D6

If the defending unit falls below 50% of its maximum health, or
continues to fall below that value is subsequent attacks, it has to
check for unconsciousness by rolling 2D6. A roll equal to or greater
than its endurance will cause the unit to fall unconscious.
Unconscious units cannot act; they are sitting ducks for the
enemy. They can only be revived by medical attention.

A unit whose health is reduced to 0 is dead and beyond any help that
medical assistance can give. The corpse remains on the map for
colleagues or opponents to loot.


Game Scores

A game score exists for two purposes: firstly to allow the player to
track their own performance, and secondly to encourage the player to
keep playing the game.

There will be a matrix of high scores, one per mission type per
difficulty level. These scores will range from 0 to 100, and will
reflect the highest score achieved for that mission type in that
difficulty level. There will also be one average score per difficulty
level. This average will figure in the zero scores for mission types
not yet attempted or completed, in order to encourage the player to
try out different mission types.

The calculation of the score will vary for each mission type. The
score will be divided equally among a number of criteria, those
criteria being dependent upon the mission type. The following table
shows what criteria are used in each mission type:

		Ass	Kll	Hst	Rsc	Rtr	Hst
	Health	+	+	+	+	+	+
	Kills	*	+	-	-	-	-
	Freed	+	+	*	+	+	+
	Taken	-	-	-	-	*	+
	Timer	+	+	+	+	+	+

A * in the table means that this criteria is necessary for success,
and so is not directly figured into the score (otherwise every
successful mission would count as 100). A + means that the criteria is
factored into the score as discussed next. A - means that the criteria
is not factored into the score. The criteria with a + are factored in
as follows:

* Health: a share of the score is calculated as a direct proportion of
  health; so if all units are at 50% health then 50% of the points are
  awarded. The health of hostages is not included.

* Kills: a share of the score is calculated as the number of kills
  versus the number of enemy units in total, so if 4 of 8 enemies were
  killed then 50% of the score would be awarded.

* Freed: the number of hostages who were able to leave the mission
  location, the percentage of this share of the score being in
  proportion to the percentage of hostages freed.

* Taken: the number of data cards found as a percentage of those
  available.

* Timer: each mission will have a minimum and maximum number of turns
  it is expected to take. Missions completed before the minimum
  expected turns will score 100% of this share; missions taking more
  than the maximum will score 0%. Missions taking some time in between
  score proportionally.


The Computer Player

The computer moves its units according to a simple set of heuristics.
Each of the units has an order consisting of a verb and a
location. The choices are:

* Idle. The unit waits at a given location until an event distracts it
  (see later). Once the event is dealt with, the unit will return to
  idling at whatever square it ends up at.

* Patrol. The unit heads for a given location. When it gets there, it
  chooses another location in the level. If distracted by an event, it
  will resume its random patrol once the event is dealt with.

* Guard. The unit remains within sight of whatever it is guarding, and
  within four map squares. If some event draws it away, it will return
  to whatever it was guarding till the next distraction. In a hostage,
  assassination or retrieval mission, at least one unit will be
  guarding the mission objective.

* Investigate. Head for the last sighting position of an enemy, or the
  position from which gunshots were heard. Units investigating are not
  distracted by further sound of gunfire; they are only distracted
  when being attacked or when catching sight of their target
  elsewhere. When the target is eliminated, or is lost, or nothing was
  found at the site of gunfire, the unit resumes its former behaviour.

Units are distracted by the noise of gunfire, the (non-stealth) death
of a teammate, or the sight of an opposing unit. Distracted units will
remember their default order but will temporarily be set to
"investigate". Apart from gunfire, generally only one enemy will be
set to investigate each player unit, but any who see the player unit
will potentially fire upon it.

Investigation of an opposing unit will end if the unit being
investigated is killed or is lost. Investigation of gunfire will end
if another distraction is presented, or if the investigating unit
arrives at the site of gunfire and sees no opposing units, after which
it will return to its former behaviour.

Computer units use a pathfinding algorithm to plot their routes. The
orders and routes of each enemy unit are planned at the start of the
turn; only opportunity attacks are spontaneous and will be decided
upon as soon as an opposing unit is spotted.

Units will plot paths through one another, with one exception: two
units will not attempt to move through each other in opposite
directions. So if unit A has a path that passes through adjacent
squares B then C, other units will regard the path from C to B as
blocked. They may plot a path through a third adjacent square D,
however, as in C to D to B, because this would theoretically allow the
two units to pass. This allows all paths to be pre-calculated before
anything moves, and allows the movement itself to proceed smoothly
even on limited hardware.  The computer will freely swap between
different units and back again in its turn in order to try to resolve
blockages.


User Interface

The interface can be controlled entirely with four directional keys
and a fire key. Holding fire will bring up a menu, releasing fire
will activate the currently highlighted option, and moving while fire
is held will move the highlight. Menus are designed so that the most
likely wanted option is highlighted by default, so often, tapping fire
will have the desired effect.

There are a number of modes that the game operates in, but the player
will spend most of their time in Map Mode. Other modes include
Inventory Mode and the Main Menu.

In Map Mode, the map is displayed in the main window. A map cursor can
be moved using the directional controls, and the player has the
freedom to move it around the whole mission location. The map window
will scroll if the cursor is moved off the screen.

One unit is always selected as the "current" unit, and holding fire
while pointing at a map square allows the current unit to perform
some action with that square. The options that appear on this menu are
as follows:

* Cancel: releases the menu without doing anything. This is initially
  highlighted if there are no valid actions the current unit can do
  with that square.

* Move (M): moves the unit to that square. The cursor will move in the
  same direction as the unit, so that subsequent moves in the same
  direction just require a tap on the Fire key. This is initially
  highlighted if the square is adjacent to the unit and is accessible.

* Select (S): selects another unit to become the current one. This is
  initially highlighted if the cursor is positioned on a friendly unit
  other than the current one, or a freed hostage.

* Attack (A): attacks an enemy unit. This is initially highlighted if
  the cursor is positioned on a visible enemy unit.

* Open (O): open a door. This is initially highlighted if the cursor
  is positioned a closed door.

* Close (C): close an open door. This is never initially highlighted
  and must be highlighted manually (the default action with an open
  door is to move through it instead).

* Crouch/Rise (R): change the unit between a crouching and a standing
  position. This is never the initially highlighted option.

* Creep (E): attempt to enter stealth mode. This is never the
  initially highlighted option.

* Heal (H): give medical attention to another unit. This is initially
  highlighted if the cursor is pointed at an adjacent unconscious
  non-enemy unit.

* Skills/Items (K): change the "backpack" area of the unit display
  between showing items in the backpack and showing the unit's skills.

* Inventory (I): enter Inventory Mode. This is initially highlighted
  if the cursor is pointed at the current unit, at an adjacent
  cabinet, or at an adjacent unconscious enemy unit.

* Menu (Esc): enter Main Menu mode. This is the initially highlighted
  option if the mission is over.

Inventory Mode allows the player to manipulate a unit's inventory,
along with a second inventory. What that second inventory is depends
upon the map square that was highlighted when entering inventory mode:

* When highlighting an adjacent cabinet the secondary inventory is the
  contents of that cabinet.

* When highlighting an adjacent unconscious unit, or a conscious
  colleague, the secondary inventory is that unit's inventory.

* When highlighting anything else, the secondary inventory is the
  ground on which the current unit is standing.

The player may move the cursor around the two inventories. The cursor
may pass freely between the two sections of the player inventory or
the second inventory. The menu that appears when holding fire contains
the following options:

* Close: leave Inventory Mode and return to Map Mode.

* Take item (T): transfer the highlighted item from the head, torso,
  secondary inventory or backpack into an empty hand.

* Drop item (D): transfer an item from the hand into the secondary
  inventory. Items can also be dropped directly from the head, torso
  or backpack at extra cost.

* Put item away (P): transfer an item from the hand into the
  backpack. Items can also be put away directly from the head, torso
  or the secondary inventory at extra cost.

* Wear item (W): put an item in the hand on the head or torso as
  appropriate. Items can be "worn" straight from the backpack or the
  secondary inventory at extra cost. If an item is already being worn,
  the items are swapped, also at extra cost.

The Main Menu replaces the map on the display, although the mission
will be left as it is while the main menu is displayed. So entering
the Main Menu does not "quit" the game in any way.

The main menu will show the the mission type, the four characters and
their classes, and the level of play, along with the menu options:

* New Mission: abandon the current mission, if it is in progress, and
  generate a new mission using the selected mission type and
  characters. Proceed then to the Map Screen.

* Resume: resume the current mission, if there is one in progress,
  proceeding to the map screen.

* Exit: save the current mission and exit from the game. Only one
  saved game is in progress at a time.

Highlighting and altering the mission types will only affect the
settings for a new mission. If the player alters the mission type and
leaves the menu without generating a new mission, then the current
mission type will be restored when the player leaves and re-enters the
menu. It is intended that this setting is changed immediately prior to
generating a new mission.

Similarly, the names and classes of the units can be changed at this
time, but the changes will only affect a new mission, and will be
reverted if they are changed without generating a new mission. This
way, the information that is displayed when the main menu is called up
will always accurately reflect the mission currently in play.


Program Flow

The first time that the game is loaded, a team is generated
automatically, the Annihilation mission is chosen, and the player is
taken directly to Map Mode. This gets the player straight to the
action the first time that they play.

Map Mode will have options to proceed to Inventory Mode, Menu Mode, or
to exit the game. It will also proceed to Scores Mode when the game
is over.

Inventory Mode will have options to proceed to Map Mode, Menu Mode, or
exit the game.

Menu Mode will have options to proceed to Map Mode (both for new game
and continue game), Scores Mode, or to exit the game.

Scores Mode will have the option to go to Menu Mode, or to exit the
game.


Map Block Values

Levelmap itself uses the first four bits as the square type, and the
last four bits for the connected textures. It uses the values 0 to 3
in the upper 4 bits for the following:

* 0x00 = Void: an area outside the playable level area itself, or within
  gaps left by corridors. SCCC generates maps that do not include voids.

* 0x10..0x1f = Open: an open space over which units can travel
  freely. SCCC doesn't care about the connected texture value and
  shows the same floor tile for all open squares.

* 0x20..0x2f = Wall: an impassable wall. Units cannot see through these
  squares. SCCC uses the connected texture bits as expected, to
  connect wall tiles visually.

* 0x35/0x3a = Door: a door, interpreted as a closed door by
  SCCC. Levelmap only uses the connected texture values 0x5 and 0xa
  (straight line horizontally or vertically).

SCCC uses the following additional values in the upper 4 bits for
extra level information:

* 0x45/0x4a = open door. Opening a door changes its value on the map
  from 0x35/0x3a to 0x45/0x4a, closing it changes the value back to
  0x35/0x3a.

* 0x50..0x52 = furniture. These do not use connected textures, so the
  lower 4 bits identify what furniture is present.

* 0x60-0x7f not used.

* 0x80..0xff = unit or loose item present. Subtracting 0x80 from this
  value gives the value of the tile underneath the unit.
