Patterns: Add delayed instructions

Certain BulletML nodes like <changeSpeed> require the pattern author
to indicate when that change should take place.  This means we do not
want to place the instruction to change speed into the queue
immediately, but instead delay it until the appropriate time.  This
patch introduces a new property of the Pattern class called
‘delayedInstructions’ which will store such instructions.

Since the code for adding an instruction and a delayed instruction is
practically identical we also take this time to factor out the common
code into a local function called makeInstruction().
Patterns: Add a node and instruction handler for <changeSpeed>

This does not execute the instruction however.
Patterns: Fix a bug in addDelayedInstruction()

We must make sure that ‘delayeInstructions[when]’ is a table before
calling table.insert() or otherwise we will crash the game by trying
to insert something into a nil value.
Patterns: Execute delayed instructions

This patch modifies Pattern:execute() to check for any delayed
instructions and to execute them if they exist.  This will allow
things like ‘change-speed’ to work.  The patch includes a new test
pattern with <changeSpeed> nodes to make sure the engine behaves as
expected.
Bullets: Do not draw lines around dot type bullets

This makes them look worse.
Bullets: Make draw() easier to read

This patch makes no logic changes.  It only affects whitespace.
Bullets: Record which <action> fired each bullet

BulletML nodes like <changeSpeed> should only affect the bullets that
are fired from the <action> node in which the <changeSpeed> appears.
Currently we cannot implement this behavior because we keep no track
of the action which fires bullets.  This patch adds thhe necessary
properties to both the Bullet and Pattern classes, as well as
modifying the processing of <action> nodes and ‘fire’ instructions, so
that we associate bullets with their parent actions.

In order to help debugging we also modify the string representation of
Bullet objects to display their parent action.
Bullets: Try to apply <changeSpeed> to proper bullets only

This patch attempts to fix the problem where <changeSpeed> affects all
bullets instead of only those fired within the <action> in which the
<changeSpeed> node appears.  We try to do this by affecting those
bullets which only match the current action in the pattern.

The patch provides a test pattern but currently it does not behave as
expected, indicating that there is a mistake in this approach.  It
brings us closer to the desired behavior, but bugs remain.
Patterns: print() delayed instructions for debugging
Patterns: Pass current action as a property for ‘change-speed’

By the time we execute the delayed instruction the
‘Pattern.currentAction’ property may have changed to an incorrect
value.  So when we process a <changeSpeed> node we make a copy of the
current action at the time so that when processing a ‘change-speed’
instruction we know the correct parent action.

However this patch still does not cause ‘test-10.xml’ to work as it is
expected to.
Patterns: Store delayed instruction keys as strings

Even though we use numbers for keys we do not want to give the false
impression that the table is an array.  This patch also adds a
‘return’ to Pattern:execute() whenever it runs any number of delayed
instructions.  That way we do not run too many instructions in a
single tick.
Patterns: Pass an ‘action’ property to ‘fire’ instructions

If we access Pattern.currentAction when processing a ‘fire’
instruction then the odds are that action is different from the one in
which the original <fire> node appeared.  So when we process the
<fire> node we pass the current, and correct action as an additional
property to the instruction.  That way the ‘fire’ instruction can
assign the proper value to the bullets it spawns.

This patch comes even closer to making ‘test-10.xml’ work properly.
However, the bullets fired to the right in that pattern still do not
change their speed properly.  Debugging shows that this is because
there could be a problem in the timing in which we assign the parent
action of a bullet object.
Patterns: Increase the timer at half the rate

This leads to more fair bullet distribution.
Patterns: Removed delayed instructions once executed

This prevents us from trying to execute them a second time, since the
next time we call Pattern:execute() the value for Pattern.timer will
still match the last time for the last delayed instruction.
Patterns: Specify that the keys for delayedInstructions are strings

We use numbers as keys, but it is important to note we store them as
strings to avoid accidentally treating the table like an array.
Bullets: Store the bullet origin as a property

In order to implement certain bullet behavior in patterns we will need
to know where on screen the bullet spawned.  We could use
Pattern.origin but this information is not always available.  So when
we spawn a bullet we will copy the coordinates in Pattern.origin into
the Bullet object itself.  This will help implement such things as
lasers, bullets that move backwards to the original position, circle
around their spawn point, and other devious shit.
Patterns: Add a test pattern for lasers

Support for this type of bullet is currently unimplement.  This patch
provides the test first, with the implementation to follow.
Bullets: Give ‘circle’ type bullets a smoother look
Patterns: Support <shape>image</shape> for bullets

This allows the engine to draw bullets as from images.  Currently
there is no support for properly rotating them or anything like that.
This patch implements only the basic support to load them and render
them to screen.
Patterns: Add a test case for using images for bullets