Decoded: Sopwith (1984) by David L. Clark
Source file: SWINIT.C
Beginner friendly, line-by-line code walkthrough by MaiZure

SWINIT.C includes the primary initialization routine called on start up. It also includes object creation code for all game objects.

Original code:
http://davidlclark.com/page/sopwith-source-code

Original code with line numbers
http://www.maizure.org/projects/decoded-sopwith/SWINIT_linenum.txt

1     COMMENT
2     COMMENT
3     BLANK
4     COMMENT
5     COMMENT
6     COMMENT
7     COMMENT
8     COMMENT
9     COMMENT
10    COMMENT
11    COMMENT
12    COMMENT
13    COMMENT
14    BLANK
15    COMMENT
16    COMMENT
17    COMMENT
18    COMMENT
19    COMMENT
20    COMMENT
21    COMMENT
22    COMMENT
23    COMMENT
24    COMMENT
25    COMMENT
26    COMMENT
27    COMMENT
28    COMMENT
29    COMMENT
30    COMMENT
31    COMMENT
32    COMMENT
33    COMMENT
34    COMMENT
35    COMMENT
36    COMMENT
37    COMMENT
38    COMMENT
39    COMMENT
40    COMMENT
41    COMMENT
42    Includes the main game header (sw.h)
43    BLANK
44    BLANK
45    Imports the system type defined in SWMAIN
46    Imports play mode defined in SWMAIN and defined at run time by the user
47    Imports current game array declared in SWMAIN
48    Imports the current ground height array declared in SWGROUND and defined
      at run time
49    Imports original ground height array declared and defined in SWGROUND
50    BLANK
51    BLANK
52    Imports multiplayer buffer declared in SWMAIN
53    BLANK
54    Imports the high resolution flag declard in SWMAIN
55    Imports the title display flag declared in SWMAIN
56    Imports the display position flag declared in SWMAIN
57    Imports the keydelay flag declared and defined in SWMAIN
58    Imports the sound flag declared and defined in SWMAIN
59    Imports the report stats debug flag defined in SWMAIN
60    Imports the joystick flag declared and defined in SWMAIN
61    Imports the IBM keyboard flag declared in SWMAIN
62    Imports the multiuser tick flag declared in SWMAIN
63    Imports the game in progress flag declared and defined in SWMAIN
64    Imports the keyboard override flag declared and defined in SWMAIN
65    Imports the missile usage flag declared in SWMAIN
66    BLANK
67    Imports the current game number declared in SWMAIN
68    Imports the game speed ranges declared in SWMAIN
69    Imports the firing range amount declared in SWMAIN
70    BLANK
71    Imports the display position variables declared in SWMAIN
72    Imports the display buffer declared in SWMAIN
73    Imports the display initialized flag delcared in SWMAIN
74    Imports the history pointers declared in SWMAIN
75    BLANK
76    Imports the object pool pointer declared in SWMAIN
77    Imports the object pool structure declared in SWMAIN
78    Imports the object pool boundary pointers declared in SWMAIN
79    Imports the free object point declared in SWMAIN
80    Imports other object pointers declared in SWMAIN
81    Imports the target status array declared in SWMAIN
82    Imports the target counter array declared in SWMAIN
83    Imports the player reference declared in SWMAIN
84    Imports the old object references declared in SWMAIN
85    Imports the player plane active flag declared in SWMAIN
86    Imports the computer plane active flag declared in SWMAIN
87    Imports the object index declared in SWMAIN
88    Imports the object display status declared in SWMAIN
89    Imports the splattered ox on screen flag declared in SWMAIN
90    Imports the splattered ox world flag declared in SWMAIN
91    Imports the delay counters declared in SWMAIN
92    BLANK

The follow series of imports (externs) are functions defined in other C files.
Since most source files don't have prototype headers (.h files), we have to
forward declare the functions in this way to resolve at link time. Not a normal
approach today where everything gets a header and guard.

93    Imports the display computer function defined in SWDISP
94    Imports the move computer function defined in SWMOVE
95    Imports the display player function defined in SWDISP
96    Imports the move player function defined in SWMOVE
97    Imports the move shots function defined in SWMOVE
98    Imports the display bombs function defined in SWDISP
99    Imports the move bombs function defined in SWMOVE
100   Imports the move object function defined in SWMOVE
101   Imports the display object function defined in SWDISP
102   Imports the move explosion function defined in SWMOVE
103   Imports the display explosion function defined in SWDISP
104   Imports the move smoke function defined in SWMOVE
105   Imports the move birds function defined in SWMOVE
106   Imports the display birds function defined in SWDISP
107   Imports the move flock of birds function defined in SWMOVE
108   Imports the display flock of birds function defined in SWDISP
109   Imports the moveox function defined in SWMOVE (wait...they move?)
110   Imports the move missile function defined in SWMOVE
111   Imports the display missile function defined in SWDISP
112   Imports the move starburst function defined in SWMOVE
113   Imports the display starburst function defined in SWDISP
114   BLANK
115   Imports the object allocator function defined in SWOBJECT
116   BLANK
117   Imports custom interrupt handlers defined in SWUTIL.ASM
118   Imports performance counters declared in SWMAIN
119   BLANK
120   BLANK
121   Imports the sine table declared and defined in SWMAIN
122   BLANK
123   Imports the environment jump buffer declared and defined in SWMAIN
124   COMMENT
125   BLANK
126   Imports the game stats array declared in SWMAIN
127   Imports the end game sequence counter declared in SWMAIN
128   Imports the winning end game flag declared in SWMAIN
129   Imports the target array declared in SWMAIN
130   Imports the random seed for explosions declared in SWMAIN
131   BLANK
132   Imports the muliplayer comm file declared in SWMULTIO
133   Imports the command file declared in SWMULTIO
134   Imports the diso IO address port declared and defined in SWMAIN
135   COMMENT
136   BLANK
137   Imports the number of lives declared in SWMAIN
138   BLANK
139   Imports the ctrl-break in progress flag declared in SWUTIL.ASM
140   BLANK
141   Declares a global for the player's score
142   Declares a global for the display of a ghost player
143   BLANK
144   BLOCK START - Help screen text definition array
145   Defines a line of help text
146   Defines a line of help text
147   Defines a line of help text
148   Defines a line of help text
149   Defines a line of help text
150   Defines a line of help text
151   Defines a line of help text
152   Defines a line of help text
153   Defines a line of help text
154   Defines a line of help text
155   Defines a line of help text
156   Defines a line of help text
157   Defines a line of help text
158   Defines a line of help text
159   Defines a line of help text
160   Defines a line of help text
161   Defines a line of help text
162   Defines a line of help text
163   Defines a line of help text
164   Defines a line of help text
165   COMMENT
166   COMMENT
167   COMMENT
168   Defines a line of help text
169   Defines a line of help text
170   Defines a line of help text
171   Defines a line of help text
172   Defines a line of help text
173   COMMENT
174   COMMENT
175   COMMENT
176   Defines a line of help text
177   COMMENT
178   COMMENT
179   COMMENT
180   COMMENT
181   COMMENT
182   COMMENT
183   Defines a line of help text
184   Defines a line of help text
185   Defines the end of text
186   BLOCK END - Help screen text definition array
187   BLANK
188   BLANK
189   BLANK

INITIALIZE THE GAME
190   Defines the initialization procedure with the command line arguments
191   Argument 1 is the element count
192   Argument 2 is the character vector of elements
193   BLOCK START - swinit, Sopwith Initialization
194   Sets the game reset flag to false (Default is new game session)
195   Sets the novice difficulty flag to false
196   Sets the single player flag to false
197   Sets the computer player flag to false
198   Sets the multiplayer flag to false (multiplayer not available)
199   Sets the async game flag to false
200   Sets the keyboard flag to false
201   Declares mode and keyboard settings to initialized shortly
202   Declares an empty string for the communication device
203   BLANK
204   BLANK
205   Gets and parses the command line arguments and checks for validity. Multiline
      statement continues on line 220.
206   COMMENT
207   COMMENT
208   COMMENT
209   COMMENT
210   COMMENT
211   COMMENT
212   COMMENT
213   COMMENT
214   COMMENT
215   COMMENT
216   COMMENT
217   COMMENT
218   COMMENT
219   COMMENT
220   Provides the argument format for getflags (see BMBLIB.C for more info)
221   Passes references to previously declared variables to hold flags
222   Final flags argument is the missile availability (never in this version)
223   Checks if the mode has more than one valid setting.
224   Checks for invalid input settings.
225   If argument parsing or other checks failed then...
226   Print out the help (we're still in console at this point)
227   and exit the application with an error code 1
228   BLANK
229   Toggles sound flag
230   If the game mode and the input settings have some input...
231   Then set the display title flag to true
232   BLANK
233   Sets the engine cycle delay tick to 15
234   Prepares the random seed value
235   Records the game seed for future posterity (debugging yay!)
236   Initialize sound (See SWSOUND.C)
237   Disable maskable interrupts because we're about to override them
238   Override the ctrl-break DOS interrupt on vector 0x1B with the swbreak
      procedure in SWUTIL.ASM. Note that _intsetup is passed 4 arguments but the function
      is defined with only the first two. The 3rd and 4th arguments are ignored by
      the intended compiler (most compilers will error/warning this today). Otherwise,
      the ignored functions returned the indicated segment value.
239   Override the DOS timer interrupt on vector 0x1C with the swtick procedure
      in SWUTIL.ASM. This interrupt is itself invoked by IRQ0 (int 0x08) from hardware
      (8253 timer chip on the IBM PC motherboard).
240   Initializes the ground heights to default starting value
241   Displays the title screen
242   Enables interrupts
243   BLANK
244   Checks if the mode was set at the command line
245   If not, check the novice flag and set
246   Otherwise, check the single player flag and set
247   Otherwise, check the computer flag and set
248   Otherwise check for multiplayer (not in this build)
249   If no mode is set...
250   Show the player the options and wait for input
251   BLANK
252   If not input method was set on the command line...
253   Display options and wait for player input
254   BLANK
255   If this is a multiplayer game (disabled in this build)...
256   Double the number of player lives
257   If this is a multiplayer game via file on the OS...
258   Set up the device and find other play
259   Otherwise this is an asnychonous game so...
260   Set up the game and find another player over network
261   Initialize the ground...again...?
262   Initialize object arrays
263   If playmode is multiple...
264   Then run the 2nd half of the connection init
265   Otherwise it's async..
266   So run the 2nd half of the async init
267   Initialize targets
268   Checks for a valid game function...
269   And executes it (always appears NULL in this build?)
270   Initialize the display for a new game session (NO == not reset)
271   Check if there's any key delay (default true on start up)
272   Set the keyboard frame delay to 1
273   BLOCK START - Set up a single player game
274   Check if there's any key delay (default true on start up)
275   Set the keyboard frame delay to 1
276   Sets lives to base value
277   Points current game to starting game struct
278   Clears player input
279   Initialize object arrays
280   Initializes the player (NULL forces allocation of new object)
281   Initializes a computer AI
282   Initializes a computer AI
283   Initializes a computer AI
284   Initializes ground targets
285   Checks for game specific functions (again this always seems NULL)
286   Executes that function
287   Initialize the display for a new game session (NO == not reset)
288   BLOCK END - Set up a single player game
289   BLANK
290   Initialize bird flocks (See line 1331)
291   Initialize oxen (See line 1398)
292   BLANK
293   Initialize game difficulty settings (See line 388)
294   BLANK
295   Disable interrupts
296   Override the print screen interrupt with swshfprt (See SWUTIL.ASM)
297   Override and save the keyboard interrupt (See SWUTIL.ASM)
298   Set the flag saying we're currently playing the same
299   Enable interrupts
300   BLOCK END - swinit, Sopwith Initialization
301   BLANK
302   BLANK
303   BLANK

DISPLAYS HELP AT CONSOLE DURING FAILED STARTUP
304   Declares a local function to display the help screen with 1 argument
305   Argument is a pointer to a char array (each line of the help text)
306   BLOCK START - disphelp, displays the help screen
307   Declares a another double pointer that should be retained in a register
      for many upcoming references.
308   BLANK
309   Point to the first element in the help array
310   Go to the next line (/r/n is canonical DOS format: CR/LF)
311   BLOCK START - Printing help, while the pointers derefs non-null data
312   Print the line and increment pointer
313   Go to the next line
314   BLOCK END - Printing help
315   BLOCK END - disphelp, displays the help screen
316   BLANK
317   BLANK
318   BLANK
319   BLANK
320   BLANK
321   Declares and defines initseed with no arguments
322   BLOCK START - initseed, sets a random number seed by reading io ports
323   If we're using an IBM PC (yes this build is configured for only this)
324   BLOCK START - Get random seed if there is no random seed set...
325   Writes 0 to the PIT mode select. Sets R/W on channel 0 so we can...
326   Read the data on channel 0 and store the first byte in the random seed
327   Read the data on channel 0 and OR the second byte of the random seed
328   BLOCK END - Get random seed
329   End case for IBM PC
330   If we're using an Atari (No we're not)
331   Declares an atari interrupt vector
332   BLANK
333   Sets the random seed based on the time in the Atari XBIOS. Function 17
      returns the datetime from the system clock.
334   End case for Atari
335   BLOCK END - initseed, sets a random number seed by reading io ports
336   BLANK
337   BLANK
338   BLANK
339   BLANK
340   BLANK


RESTART THE GAME AFTER WINNING OR LOSING
341   Declares and defines swrestart with no arguments
342   BLOCK START - swrestart, restarts/reinitializes a new game
343   Declare a local pointer to an object
344   Declare delay and accumulator variable
345   BLANK
346   If the player won...
347   Find the player object
348   initialize incrementor to 0
349   BLOCK START - Update scores for each player life
350   Add to players score accumulating 25 points (1st = 25, 2nd = 50, etc)
351   Sets the primary video memory as the target
352   Updates the player life counter (ticks down)
353   Update the score display (adds score to screen)
354   Disables interrupts
355   Sets the delay wait timer
356   Resets the delay tick counter
357   Enables interrupts
358   Delay the game 5 ticks for each life processed
359   Increment the game number for the next round
360   BLOCK END - Update scores for each player life
361   Saves the score from this game
362   BLOCK START - Player lost
363   Next game will be game 0
364   No score to save
365   BLOCK END - Player lost
366   BLANK
367   Initialize sound for the new game
368   Initialize the ground to default height
369   Initialize object arrays
370   Initialize player
371   Initialize computer AI
372   Initialize computer AI
373   Initialize computer AI
374   Initialize computer AI
375   If there is a game specific function (there never is..)
376   Execute that function
377   BLANK
378   Initialize the display without reset
379   Initialize bird flocks
380   Initialize oxen
381   Initialize game difficulty
382   BLANK
383   Super goto: back to main
384   BLOCK END - swrestart, restarts/reinitializes a new game
385   BLANK
386   BLANK
387   BLANK

SET GAME DIFFICULTY
388   Declares and defines initgdep with no arguments
389   BLOCK START - initgdep, sets up difficulty scaling based on game number
390   BLANK
391   Increase plane max speed by number of wins (base max speed is 8)
392   Increase plane min speed by number of wins (base min speed is 4)
393   BLANK
394   Sets initial target range to 150
395   If fewer than 6 games have been won...
396   Subtract 15 per game
397   Squares maximum shot range based on game (base game is 360)
398   BLOCK END - initgdep, sets up difficulty scaling based on game number
399   BLANK
400   BLANK
401   BLANK
402   BLANK
403   BLANK
404   BLANK

CLEARS THE INPUT PROMPT
405   Declares and defines clrprmpt with no arguments
406   BLOCK START - clrprmpt, removes user input from display
407   If this is a PC (and it always is)...
408   Declare a local interator
409   Declare a register access structure.
410   BLANK
411   BLOCK START - Loop across cursor positions
412   Sets the cursor position, for this loop thats from (0,20) to (0, 23)
413   Sets the AX register to 0xA20, this means AH=0x0A, and AL=0x20. We're
      about to invoke x86 interrupt 0x10, which reads AH and AL to determine the specific
      instruction. This AH means write the character in AL (space) at the cursor position.
414   Sets the BX register to 0 to target the first page with no attributes
415   Sets CX to the width of the row. CX is used for the number of times to
      write that character on the line (CX = counter for write loop)
416   Invoke interrupt 0x10 (Write character at current positon)
417   BLOCK END - Loop across cursor positions
418   Set cursor to (0,20)
419   End case for PC
420   BLANK
421   If this is an Atari (and it never is)...
422   Declares a local interator
423   BLANK
424   BLOCK START - Loop across cursor positions
425   Sets the cursor position, for this loop thats from (0,20) to (0, 23)
426   Writes \33K to (0,20) - clear to end of line escape sequence in VT-52
427   BLOCK END - Loop across cursor positions
428   Set cursor to (0,20)
429   End case for Atari
430   BLOCK END - clrprmpt, removes user input from display
431   BLANK
432   BLANK
433   BLANK
434   BLANK

GET THE DESIRED INPUT DEVICE
435   Declares and defines getkey with no arguments
436   BLOCK START - getkey, sets up user input method
437   Declares a local variable to hold user input choice
438   BLANK
439   COMMENT
440   COMMENT
441   COMMENT
442   COMMENT
443   COMMENT
444   COMMENT
445   COMMENT
446   COMMENT
447   COMMENT
448   COMMENT
449   COMMENT
450   COMMENT
451   COMMENT
452   COMMENT
453   COMMENT
454   COMMENT
455   COMMENT
456   Clears prompt for upcoming input (cursor now sits at 0,20)
457   Writes the keyboard input option to the screen
458   Writes the joystick and keyboard option to the screen
459   BLOCK START - Busy-wait for user input
460   If user pressed ctrl-break...
461   End the game with no exit message
462   If the users first byte of input didn't match K after uppercase coercion
463   or didn't match the upper-coerced J then...
464   Repeat this loop, waiting for more input
465   Sets global joystick variable if input key matched J
466   IBM keyboard is always true in this version regardless of input
467   End function
468   BLOCK END - Busy-wait for user input
469   BLOCK END - getkey, sets up user input method
470   BLANK
471   BLANK
472   BLANK
473   BLANK
474   BLANK

GET THE GAME MODE
475   Declares and defines getmode with no arguments
476   BLOCK START - getmode, procedure to set up game with user input
477   Clears the prompt, leaving cursor at position (0,20)
478   Prints option for single player
479   Prints option for single player vs computer
480   BLOCK START - If systype matches DOS
481   COMMENT
482   COMMENT
483   COMMENT
484   Print option for async multiplayer
485   BLOCK END - If systype matches DOS
486   BLOCK START - Busy-wait for user input
487   If user pressed ctrl-break...
488   Then end the game with no output message
489   SWITCH - Check user input
490   CASE User chose single player
491   Clear the prompt
492   Print option for novice difficulty
493   Print option for expert difficulty
494   BLOCK START - Busy-wait again for user input
495   If user pressed ctrl-break...
496   Then end the game without output
497   SWITCH - Check user 2nd choice...
498   Masked for first byte only
499   CASE User chose novice
500   Set for novice mode
501   End entire function
502   CASE User chose expert mode
503   Set for standard single player
504   End entire function
505   END SWITCH on user 2nd choice
506   BLOCK END - Busy-wait again for user input
507   CASE User chose multiplayer
508   COMMENT
509   COMMENT
510   COMMENT
511   COMMENT
512   COMMENT
513   COMMENT
514   Do nothing because multipler was removed. Get mode loop repeated
515   CASE User chose to player versus computer
516   Set global play mode to computer
517   End get mode
518   CASE User chose async multiplayer
519   BLOCK START - Playing under DOS
520   Set global play mode to async
521   End get mode
522   BLOCK END - Playing under DOS
523   END CASE
524   For all other cases..
525   Do nothing
526   END SWITCH on user's choice
527   BLOCK START - Busy-wait for user input
528   BLOCK END - getmode, procedure to set up game with user input
529   BLANK
530   BLANK
531   BLANK
532   BLANK

GETS A MULTIPLAYER GAME (dead code)
533   Declares and defines getgame with no arguments
534   BLOCK START - getgame, reads input and returns a game from file slot
535   Declares local variable for game number
536   BLANK
537   Clears the prompt (cursor now at [0,20])
538   Prints prompt for a game number
539   BLOCK START - Busy-wait on user input
540   Checks if ctrl-break was pressed...
541   Ends the game
542   If the entered game number is greater than 0... (subtracting character
      '0' is like subtracting 48, where as a user input of '2' is 50, 50-48=2)
543   ..and less than the maximum number of games (which is 7)
544   Return the game number
545   BLOCK END - Busy-wait on user input
546   BLOCK END - getgame, reads input and returns a game from file slot
547   BLANK
548   BLANK
549   BLANK
550   BLANK

CHECK FOR CONTROL-BREAK
551   Declares and defines ctlbreak with no arguments
552   BLOCK START - ctlbreak, returns the status of the ctrl-break flag
553   Returns status of control-break flag. Keyboard interrupt sets this flag
      if it was pressed
554   BLOCK END - ctlbreak, returns the status of the ctrl-break flag
555   BLANK
556   BLANK
557   BLANK
558   BLANK

INITIALIZES GROUND
559   Declares and defines initgrnd with no arguments
560   BLOCK START - initgrnd, initializes the ground level to starting default
561   Performs a memcopy of the original ground array to the current ground
      array
562   BLOCK END - initgrnd, initializes the ground level to starting default
563   BLANK
564   BLANK
565   BLANK
566   BLANK

INITIALIZE DISPLAY
567   Declares and defines initdisp with 1 argument
568   Argument 1 is a boolean indicating if this is a restart or a new game
569   BLOCK START - initdisp, sets up the main status bar at the screen bottom
570   Declares a local pointer to another object structure
571   Declares a local object structure
572   Imports the ghost graphic from SWSYMBOL.C
573   BLANK
574   Resets oxen variables
575   BLOCK START - If this is a new game
576   Clear the aux frame buffer
577   Set the aux frame buffer to active
578   Draw the world
579   Draw the title screen
580   Deactivate ghosts
581   BLOCK END - If this is a new game
582   Low-level copy of data between frame buffers
583   Swaps frame buffer to primary video buffer
584   Initialize world display objects
585   Initialize score
586   BLANK
587   Get the pointer to the player's plane
588   BLOCK START - If ghosts are active...
589   Set ghost to unhandled object type
590   Make ghost object 8x8
591   Set ghost color to player color
592   Set ghost symbol to correct symbol from SWSYMBOL
593   Draw the ghost
594   But if ghosts are not active...draw HUD status elements
595   Draw the fuel guage
596   Draw the bomb count
597   Draw the missile count
598   Draw the flare (starburst) count
599   Draw the ammo levels
600   Draw the lives remaining
601   BLOCK END - Ghost check
602   Assert display initialized global variable
603   BLOCK END - initdisp, sets up the main status bar at the screen bottom
604   BLANK
605   BLANK
606   BLANK

INITIALIZE SCORE
607   Declares and defines initscore with no arguments
608   BLOCK START - initscore, resets and displays the score
609   BLOCK START - If previously saved score
610   Store that score in the first object (player plane)
611   Clear saved score
612   BLOCK END - Previously saved score
613   BLANK
614   Display the saved score
615   If we're in a multiplayer game...
616   ...and there is more than one player..
617   Show the other player's score too
618   BLOCK END - initscore, resets and displays the score
619   BLANK
620   BLANK
621   BLANK
622   BLANK

DISPLAY LIVES COUNT
623   Declare and define dispcgge with 1 argument
624   Argument 1 is the object whose lives to display (player's plane)
625   BLOCK START - dispcgge, displays the lives remaining guage
626   Call general display drawing function on input object's properties
627   BLOCK END - dispcgge, displays the lives remaining guage
628   BLANK
629   BLANK
630   BLANK
631   BLANK

DISPLAY FUEL LEVEL
632   Declare and define dispfgge with 1 argument
633   Argument 1 is the object whose fuel to display (player's plane)
634   BLOCK START - dispfgge, displays the fuel count guage
635   Call general display drawing function on input object's properties
636   BLOCK END - dispfgge, displays the fuel count guage
637   BLANK
638   BLANK
639   BLANK
640   BLANK

DISPLAY BOMB COUNT
641   Declare and define dispbgge with 1 argument
642   Argument 1 is the object whose bombs to display (player's plane)
643   BLOCK START - dispbgge, displays the bomb count guage
644   Call general display drawing function on input object's properties
645   BLOCK END - dispbgge, displays the bomb count guage
646   BLANK
647   BLANK
648   BLANK
649   BLANK

DISPLAY AMMO LEVEL
650   Declare and define dispsgge with 1 argument
651   Argument 1 is the object whose ammo to display (player's plane)
652   BLOCK START - dispsgge, displays the ammo count guage
653   Call general display drawing function on input object's properties
654   BLOCK END - dispsgge, displays the ammo count guage
655   BLANK
656   BLANK
657   BLANK
658   BLANK

DISPLAY MISSILE COUNT
659   Declare and define dispmgge with 1 argument
660   Argument 1 is the object whose missiles to display (player's plane)
661   BLOCK START - dispmgge, displays the missile count guage
662   Call general display drawing function on input object's properties
663   BLOCK END - dispmgge, displays the missile count guage
664   BLANK
665   BLANK
666   BLANK
667   BLANK

DISPLAY FLARES COUNT
668   Declare and define dispsbgge with 1 argument
669   Argument 1 is the object whose flares to display (player's plane)
670   BLOCK START - dispsbgge, displays the flares count guage
671   Call general display drawing function on input object's properties
672   BLOCK END - dispsbgge, displays the flares count guage
673   BLANK
674   BLANK
675   BLANK
676   BLANK

DISPLAY GENERAL STAT BARS ON HUD
677   Declare and define dispgge with 4 argument
678   x is the x position, cury is the current stat level, maxy is the maximum
      level of that input, and clr is the color
679   BLOCK START - dispgge, displays an input status guage at the bottom
680   Declare a local iterator for vertical drawing levels
681   BLANK
682   If ghosts are active..
683   Don't draw HUD display
684   BLANK
685   Scale the top of the bar to 10 pixels max
686   If the current level is somehow higher than 9 pixels
687   Clip the max value to 9
688   Loop from the bottom of the bar to the current height
689   Draw the input color until we reach the current level
690   Loop for the remainder of the bar
691   Draw black until the entire bar has been drawn
692   BLOCK END - dispgge, displays an input status guage at the bottom
693   BLANK
694   BLANK
695   BLANK

DRAW THE WORLD MINIMAP
696   Declares and defines dispworld with no arguments
697   BLOCK START - dispworld, draws the world map in the bottom right
698   Declare 5 local integers
699   BLANK
700   Initialize local delta x to 0
701   Initialize screen x to the screen center, which is 152
702   BLANK
703   Initialize max height to 0
704   Initialize y to 0
705   BLOCK START - Loop across the entire world of 3000 points
706   BLANK
707   If the ground height is higher than current (always true)
708   Set max height to the current ground height at our loop position
709   BLANK
710   BLOCK START - Increment delta x and for every 19 world steps...
711   Scale the world height to 16 pixels
712   If the height is unchanged from the last iteration..
713   Draw a white pixel at the current (screen, scaled height)
714   Otherwise, we need to connect ground lines on the map
715   If we need to draw downward...
716   Loop from the incremented current height to the target height
717   Draw the white pixel
718   Otherwise we're drawing downward
719   Loop from the current height down to the draw height
720   Draw the white pixel
721   Drawing complete...set the current height to the target height
722   Draw the bottom of the map frame box (forced XOR with 11?)
723   Increment to the next minimap x position
724   Reset the delta and target for the next loop
725   BLOCK END - - Increment delta x for every 19 steps
726   BLOCK END - Loop across the entire world of 3000 points
727   Scale the map height to 16
728   BLOCK START - Draw map endpoint vertical bars
729   Draw the left bar
730   Draw the right bar
731   BLOCK END - Draw map endpoint vertical bars
732   BLANK
733   For every point on the screen...
734   Draw point for the horizontal bar to separate game play and status areas
735   BLOCK END - dispworld, draws the world map in the bottom right
736   BLANK
737   BLANK
738   BLANK
739   BLANK
740   BLANK

INITIALIZE WORLD MINIMAP OBJECTS
741   Declares and defines initwobj with no arguments
742   BLOCK START - initwobj, initializes drawing buffer for world objects
743   Declares a local x variable
744   Declares a pointer to a game object
745   Declares a pointer to a world display object
746   BLANK
747   Point to the world object display array
748   Point to the object display array (these arrays can cross-index)
749   Loop through the array pairs...
750   and clear all darwing variables
751   BLANK
752   Loop through all of the world targets
753   If the target exists, and it hasn't been destroyed..
754   Draw that object on the minimap
755   BLANK
756   BLOCK END - initwobj, initializes drawing buffer for world objects
757   BLANK
758   BLANK
759   BLANK

RESET THE VIDEO MEMORY AND COPY FROM RAM
760   Declares and defines movedisp with no arguments
761   BLOCK START - movedisp, frame buffer copy
762   If we're on an IBM PC
763   Sets 8k of the even rastor in video memory to 0
764   Sets 8k of the rastor in video memory to 0
765   Copies the 8k even raster from RAM to the video memory
766   Copies the 8k odd raster from RAM to the video memory
767   End case for IBM
768   BLANK
769   If we're on an Atari...
770   Declare a function and variable
771   BLANK
772   Traps to Atari XBIOS for the address start of video memory
773   Blanks out the 32k video memory
774   Copies the contents of the 32kb buffer in RAM
775   End case for Atari
776   BLOCK END - movedisp, frame buffer copy 
777   BLANK
778   BLANK
779   BLANK
780   BLANK

CLEAR RAM VIDEO BUFFER
781   Declares and defines clrdispa with no arguments
782   BLOCK START - clrdispa, clears the frame buffer
783   If we're on an IBM
784   Clear 16kb of aux RAM
785   End IBM case
786   BLANK
787   If we're on Atari
788   Clear 32kb of aux RAM
789   End Atari case
790   BLOCK END - clrdispa, clears the frame buffer 
791   BLANK
792   BLANK
793   BLANK
794   BLANK

INITIALIZE GAME OBJECT ARRAY
795   Declares and defines initobjs with no arguments
796   BLOCK START - initobjs, intializes the object array
797   Declares a local object pointer
798   Declares a local integer
799   BLANK
800   Sets the top object successor to the bottom (empty list)
801   Sets the bottom object predecessor to the top
802   Places the top object at the left end of the world
803   Places the top object at the right end of the world
804   BLANK
805   NULLs out our used list utility pointers (list is empty)
806   Sets the free object pointer to the global object list
807   BLANK
808   BLOCK START - Loops on all possible objects
809   Sets object successor point to the next possible object
810   Sets the index counter and increments to next object
811   BLOCK END - Loop on all possible objects
812   BLANK
813   Remove the last objects successor that was set above.
814   BLANK
815   BLOCK END - initobjs, intializes the object array
816   BLANK
817   BLANK
818   BLANK

INITIALIZE COMPUTER PLAYER
819   Declare and define initcomp with 1 argument
820   Argument 1 is a pointer to an object to initialize (an AI plane)
821   BLOCK START - initcomp, creates a computer airplane
822   Declares a local pointer to an object
823   Declares a local function pointer
824   BLANK
825   BLANK
826   Initializes the input object as a generic plane and returns the pointer
827   BLOCK START - Plane initialized
828   Sets the object's draw function to display computer
829   Sets the object's move function to move computer
830   Sets the object's color to 0x02. This will XOR to invert actual sprite
831   If this is a single player game...
832   Set this computer plane to object index 1
833   Otherwise...
834   If the object index is 1 then
835   This plane is controlled by player 2
836   Otherwise...
837   This plane is controlled by no one
838   Copy this new copy to the old object array
839   BLOCK END - Plane initialized
840   BLOCK START - Single player game
841   Then set computer planes to already destroyed...no planes in this mode
842   Remove object from the list of objects
843   BLOCK END - Single player game
844   BLOCK END - initcomp, creates a computer airplane 
845   BLANK
846   BLANK
847   BLANK

INITIALIZE PLAYER
848   Declare and define initcomp with 1 argument
849   Argument 1 is the object that becomes the player (usually object 1)
850   BLOCK START - initplyr, creates the player's airplane
851   Declares a local pointer to an object
852   Declares a local function pointer
853   BLANK
854   Initialize the input object as a generic airplane and retain the pointer
855   BLOCK START - Plane initialized
856   Sets the object's draw function to display player
857   Sets the object's move function to move player
858   Sets the object's color to what should always resolve to 1
859   Sets the owner as the player
860   Copy the new object to the global array
861   Clear the end game winning flag
862   Resets the end sequence counter
863   BLOCK END - Plane initialized
864   BLANK
865   Updates the display left column to center the player on the screen
866   Updates the display right column accordingly (left + width - 1)
867   BLANK
868   Clear the keyboard buffer
869   BLOCK END - initplyr, creates the player's airplane 
870   BLANK
871   BLANK
872   BLANK
873   Declares a local index vector for plane objects in single player
874   Declares a local index vector for plane objects when versus computer
875   Declares a local index vector for plane objects in muliplayer
876   BLANK
877   BLANK
878   BLANK
879   Declare and define initpln with 1 argument
880   Argument 1 is the object that becomes a plane
881   BLOCK START - initpln, creates an airplane
882   Declares a local pointer to an object
883   Declares several local integers for upcoming plane calculations
884   BLANK
885   If the object doesn't exist...
886   Allocate a new object
887   Otherwise
888   Out local pointer should use the input object
889   BLANK
890   SWITCH ON GAME MODE
891   If we're in single player...
892   ..and in novice mode...
893   The object should use one of the indicies from the single player vector
894   End case for single player notice
895   If we're in Multiplayer..
896   ..or in asynch multiplayer..
897   The object should use one of the indicies from the multiplayer vector
898   End case for multiplayer
899   Finally, if we're versus the computer,
900   Use one of the object indicies from the computer vector
901   End case for versus computer game mode
902   End switch on game mode
903   BLANK
904   The object is of type plane
905   BLANK
906   Set the player's location based on the game default for the object num
907   Set local x position variable to the plane's start position (left side)
908   Set another local to 20 pixels in front of the plane
909   Set temporary height to zero, we're about to find the max height
910   Loop over this space (slightly larger than the plane)
911   Check if the ground height is larger than our temporary
912   If so, set the temp height to the ground height. Height will eventually
      match the highest point under the plane
913   Set the new planes height 13 pixels heigher than the highest point.
914   Set all the the motion variables to 0
915   Sets all the missile/bomb delays to 0
916   Set the flare delay to 0
917   Sets the object's x/y motion vectors to 0
918   Sets the plane's flip direction (all these states are in SWGAMES.C)
919   Sets the planes facing direction based on flip direction. 1 == flipped,
      which means facing left so angle is 8 (recall that angles are divided in to
      16 sectors in this game. Left is halfway so 8)
920   No default targets or firing status
921   No bombing at start and plane is not headed home
922   Plane's default height is 16 pixels
923   Plane's default width is 16 pixels
924   All planes start at home
925   BLOCK START - On fresh/crashed plane init, check the status
926   Also check the ghost plane case
927   Fresh init, so max out the ammo
928   Max out the bombs
929   Max out the missiles
930   Max out the flares
931   Max out the fuel
932   BLOCK END - On fresh/crashed plane init
933   BLOCK START - On new plane init (first flight)
934   Zero out all plane scores
935   No ending status yet
936   Reset targets
937   Add the new plane to the list of objects
938   BLOCK END - On new plane init (first flight)
939   BLOCK START - Otherwise, this plane already exists, so delete it...
940   Then reinsert it in to the list
941   BLOCK END - Plane already exists
942   BLANK
943   If we're in a multiplayer game...
944   ..And we've crashed too many times.
945   The plane becomes a ghost
946   And if it's the player
947   Global ghost mode is set
948   Otherwise...
949   The plane is still flying
950   BLANK
951   Return this object to the calling function
952   BLOCK END - initpln, creates an airplane
953   BLANK
954   BLANK
955   BLANK

INITIALIZE SHOOTING BULLETS
956   Declare and define initshot with 2 Arguments
957   Both arguments are objects, shooter and target
958   BLOCK START - initshot, triggers player's gun
959   Declare two local object pointers
960   Declare several status and motion variables
961   BLANK
962   BLANK
963   If this is a player plane without a target and no ammo left
964   Return without firing
965   BLANK
966   If a new object cannot be allocated (too many objects in game?)
967   Return without firing
968   BLANK
969   Set our local pointer to the input plane
970   If we're not playing novice level...
971   Deduct ammo..apparently novices have infinite ammo!
972   BLANK
973   Set the bullet speed to the base speed (10) plus the game number
974   BLANK
975   BLOCK START - Active target. If there's an active target....
976   Set a temporary x variable 4 ticks of speed ahead of it (leading it)
977   Set a temporary y variable 4 ticks of speed ahead of it
978   Calculate the x lead distance
979   Calculate the y lead distance
980   BLOCK START - Check aim. If the result isn't valid (not positive)..
981   Deallocate the object
982   Cancel firing
983   BLOCK END - Check aim
984   Set the x vector to the calculated magnitude
985   Set the y vector to the calculated magnitude
986   Set the last movement vectors to 0
987   BLOCK END - Active Target
988   BLOCK START - No active target. Add plane's speed to base bullet speed
989   Calculate shooting plane's angle
990   Set the new bullet's vector based on the speed, x vector...
991   ..and y vector.
992   BLOCK END - No active target
993   BLANK
994   Set new object's type to bullet
995   Bullet x should originate halfway across the shooter's x position
996   Bullet y should originate halfway across the shooter's y position
997   Bullet's last x should match the shooter's last x
998   Bullet's last y should match the shooter's last y
999   BLANK
1000  BLANK
1001  The bullet's life span starts at 10 ticks
1002  Bullet originated from the shooter
1003  Bullet's color should match plane color
1004  Height and width of the bullet is 1
1005  Bullet has no built-in drawing function
1006  Bullet position is updated with moveshot function
1007  Bullet's start with no speed (uses last vectors to calculate next)
1008  BLANK
1009  Add the bullet to the list of objects
1010  BLANK
1011  BLOCK END - initshot, triggers player's gun
1012  BLANK
1013  BLANK
1014  BLANK
1015  BLANK
1016  BLANK

CALCULATES NORMALIZED RANGE
1017  Declares and defines isrange with 4 arguments
1018  Arguments are 2 xy pairs
1019  BLOCK START - isrange, range between 2 points (used for player shots)
1020  Declare local deltas and a temporary swap variable
1021  BLANK
1022  Calculate delta y
1023  Add again half of the delta
1024  If bullet is more than 100 pixels away in any direction...
1025  Range is too far (invalid)
1026  BLANK
1027  BLOCK START - Swap direction deltas
1028  Move delta x to temp
1029  Move delta y to delta x
1030  Move temp to delta y 
1031  BLOCK END - Swap direction deltas
1032  BLANK
1033  Returns a range normalized over the screen aspect ratio
1034  BLOCK END - isrange, range between 2 points (used for player shots)
1035  BLANK
1036  BLANK
1037  BLANK

INITIALIZES A BOMB
1038  Declares and defines init bomb with 1 argument
1039  Argument 1 is an object pointer to the input object (a plane)
1040  BLOCK START - initbomb, creates bombs dropping from the plane
1041  Declare two temporary object pointers
1042  Declare an angle integer
1043  BLANK
1044  Set one pointer to the input plane
1045  If the it's the player and he has no bombs, or there's a bomb delay..
1046  Cancel the bomb creation
1047  If we can't allocate the object
1048  Cancel the bomb creation
1049  BLANK
1050  If we're not in novice mode...
1051  Deduction 1 bomb from ammo
1052  BLANK
1053  Set the bomb delay to 10 ticks
1054  BLANK
1055  Set the new object type to bomb
1056  Set the bomb physics state to falling
1057  Start the bombs initial x vector to the plane's x vector at drop time
1058  Start the bombs initial y vector to the plane's y vector at drop time
1059  BLANK
1060  If the plane is flipped...
1061  Offset the bomb start position by 90 degrees
1062  Otherwise...
1063  Offset the bomb by 270 degrees
1064  Calculate the start position x location
1065  Calculate the start position y location
1066  Set all last positions to 0
1067  BLANK
1068  Set bomb life to default 5 (affects falling direction changes)
1069  Bomb owner is the plane
1070  Bomb color matches plane color
1071  Bomb width and height are 8
1072  Bomb draw function is dispbomb
1073  Bomb move function is movebomb
1074  BLANK
1075  Add the new bomb to the object list
1076  BLANK
1077  BLOCK END - initbomb, creates bombs dropping from the plane
1078  BLANK
1079  BLANK
1080  BLANK

INITIALIZE A MISSLE
1081  Declares and defines initmiss with 1 Argument
1082  Argument is an input object pointer (the shooting plane)
1083  BLOCK START - initmiss, creates missiles (not enabled in this build)
1084  Declare local pointers to objects
1085  Declare local variables for speed and angles
1086  BLANK
1087  Point to the input plane
1088  If missiles aren't allowed or there's a delay or out of missiles...
1089  Cancel missile
1090  If we cannot allocate a new object...
1091  Cancel mission
1092  BLANK
1093  If we're not in novice mode...
1094  Take away 1 missile from ammo
1095  BLANK
1096  Set the missle delay to 5 ticks
1097  BLANK
1098  Set the missile type
1099  Set the missile state to flyinh
1100  BLANK
1101  Save and match angles
1102  Start the missile a few x steps ahead of the plane's x
1103  Start the missile a few y steps ahead of the plane's y
1104  Clear the last position
1105  Make the missile 50% faster than the plane
1106  Apply the movement along the vector given angle and speed
1107  BLANK
1108  Set the missile's life to 50 ticks
1109  Set the owner as the plane
1110  Set the color to match the plane
1111  Make the missile 8x8
1112  Set the drawing function to drawmiss
1113  Draw the movement function to movemiss
1114  Set the target to true? Doesn't appear to be used
1115  Clear unused variables
1116  BLANK
1117  Add the missile to the object list
1118  BLANK
1119  BLOCK END - initmiss, creates missiles (not enabled in this build)
1120  BLANK
1121  BLANK
1122  BLANK

INITIALIZE A FLARE
1123  Declare initburst with one argument
1124  Argument 1 is a pointer to the using object (a plane)
1125  BLOCK START - initburst, creates starbusts (not enabled in this build)
1126  Declare 2 local pointers to objects
1127  Declare a local angle
1128  BLANK
1129  Set pointer to the shooting plane
1130  If missiles aren't allowed, there's a delay, or we're out of flares...
1131  Cancel flare drop
1132  If we cannot allocate a new object...
1133  Cancel flare drop
1134  BLANK
1135  Set flare delay to 5 ticks
1136  BLANK
1137  If we're not in novice mode...
1138  Take away flare ammo
1139  BLANK
1140  Set object type to starburst (flare)
1141  Set object physics to falling
1142  BLANK
1143  If the plane is flying upside down...
1144  Offset flare starting position by 135 degrees
1145  Otherwise...
1146  Offset flare starting position by 235 degrees
1147  Move along that angle vector with minimum speed
1148  Double the delta x
1149  Double the delta y
1150  BLANK
1151  Start the flare x slightly off from the plane x in the calculated angle
1152  Start the flare y slightly off from the plane y in the calculated angle
1153  Set the flare's last positions to 0
1154  BLANK
1155  Set the flare's life to 20 ticks
1156  Set the owner to the dropping plane
1157  Set the flare color to the plane's color
1158  Set the flare size to 8x8
1159  Set the draw function to dispburst
1160  Set the move function to moveburst
1161  BLANK
1162  Add flare to te object list
1163  BLANK
1164  BLOCK END - initburst, creates starbusts (not enabled in this build)
1165  BLANK
1166  BLANK
1167  BLANK

INITIALIZE A TARGET BUILDING
1168  Declares and defines inittarg with no arguments
1169  BLOCK START - inittarg, initializes bombing targets for the player
1170  Declare a local object pointer
1171  Declare a local position and interator
1172  Declare target pointers
1173  Declare local stat variables
1174  BLANK
1175  Points target x to the starting target in game state (See SWGAMES.C)
1176  Pointers target type to the starting type in game state
1177  BLANK
1178  If we're not in multiplayer...
1179  and there's only 1 player in the game...
1180  Player zero (computer) has no targets
1181  Player one has all targets but the three starting buildings
1182  Otherwise this is multiplayer...
1183  And each side has half of the targets
1184  BLANK
1185  BLOCK START - Loop through all targets
1186  Allocate an object for each target and store it in the targets array
1187  Set the starting x to the value in the game state struct
1188  Set the ending x to 15 pixels wider than the start
1189  Set minimum x to a large initial value
1190  Set maximum x to minimum value
1191  BLOCK START - Loop across target width
1192  If the ground position is higher than max so far....
1193  Set the max height to the ground height
1194  If the ground position is lower than the min so far...
1195  Set the min height to the ground height
1196  BLOCK END - Loop across target width
1197  Calculate the average height of the ground (min+max)/2
1198  BLANK
1199  While the average height is too high to fit on the screen...
1200  Reduce the average height 1 pixel
1201  BLANK
1202  Loop across the entire space again...
1203  and square out the ground to place the target
1204  BLANK
1205  Set all the usual motion variables to 0...it's a building, right?
1206  And I do mean ALL the usual suspects
1207  Object type is target
1208  Object is free standing
1209  Object type is in the game state file
1210  Object life doubles as an index
1211  BLANK
1212  If we're not in multiplayer...
1213  and there's only 1 player...
1214  Then the owner of the target depends on which index we're looking at
1215  The four buildings ending in the middle belong to the player...
1216  All others are valid targets for the player
1217  Otherwise we're in multiplayer
1218  The first half belongs to player 1 otherwise player 2
1219  Building color matches player color
1220  Buidlings are 16x16
1221  Building draw function is disptarg
1222  Building move function is movetarg (still don't remember buildings moving)
1223  BLANK
1224  Add the new building to the object list
1225  BLOCK END - Loop through all targets
1226  BLOCK END - inittarg, initializes bombing targets for the player
1227  BLANK
1228  BLANK
1229  BLANK

INITIALIZE AN EXPLOSION
1230  Declare and define initexpl with 2 arguments
1231  Argument 1 is a pointer to the exploding object
1232  Argument 2 is an integer for explosion size (plane is always big)
1233  BLOCK START - initexpl, inits explosions from plane/bomb/building collisions
1234  Declare two local object pointers
1235  Declare local interators and stats
1236  Declare six temporary object variables
1237  Declares a local boolean for simulating a dead pilot from the plane!
1238  Declares a local orientation
1239  BLANK
1240  BLANK
1241  Points to the input exploding object
1242  Offsets explode x point off by half the object size
1243  Offsets explode y point off by half the object size
1244  Cut the x parent's motion by half for the explosion
1245  Cut the y parent's motion by half for the explosion
1246  Explosion matches the parent color
1247  BLANK
1248  If the exploding object is a target...
1249  And it's direction is..?
1250  Set the explosion incrementor to 1 (lots of explosions soon!)
1251  Set the speed to min
1252  Otherwise, the exploding thing isn't a target
1253  Set the explosion incrementor based on small flag (big num = less boom)
1254  Sometimes, the explosion has low speed
1255  End case for exploding target type
1256  Check if this is a plane and a pilot body should be created
1257  Even counts for wounded planes
1258  BLANK
1259  BLOCK START - Loop to make shrapnel
1260  If we can't allocate an object
1261  Cancel explosion shrapnel
1262  BLANK
1263  Set new object type to explosion
1264  BLANK
1265  Set motion based on previously calculated speed
1266  Increment the x speed with the source object
1267  Increment the y speed with the source object
1268  BLANK
1269  Calculates a lot of entropy and noise
1270  Multiplies it by some more noise
1271  Adds shares it up some more
1272  Sets the seed!
1273  BLANK
1274  Sets the explosion lifetime
1275  Rotates orientations through each particle
1276  If there was a pilot body...
1277  Set all the movements to 0
1278  Reset the x movement
1279  Flip sleep
1280  End case for pilot body
1281  BLANK
1282  Set explosion motion variables to zero
1283  The exploding object owns the explosions
1284  Explosion color matches exploding object
1285  Explosions are 8x8
1286  Explosion drawing is dispexpl
1287  Explosion motion is moveexpl
1288  BLANK
1289  If the explosion happened...
1290  Play the sound
1291  BLANK
1292  Add the explosion to the object list
1293  BLOCK END - Loop to make shrapnel
1294  BLOCK END - initexpl, inits explosions from plane/bomb/building collisions
1295  BLANK
1296  BLANK
1297  BLANK

INITIALIZE PLANE SMOKE
1298  Declares initsmok with 1 Argument
1299  Argument 1 is the smoking object (a plane)
1300  BLOCK START - initsmok, creates the smoke trail from a plane
1301  Declares two local object pointers
1302  BLANK
1303  BLANK
1304  If we can't allocate a new object
1305  Cancel the smoke
1306  BLANK
1307  Set object physics to smoke
1308  BLANK
1309  The object's x position should equal the object plus 8 pixels
1310  The object's y position should be a little lower
1311  Smoke x follows plane x
1312  Smoke y follows plane y
1313  Smoke motion values are normally zero
1314  Smoke life is 10 ticks
1315  Owner of the plane is the owner of the smoke
1316  Smoking is only 1x1
1317  Smoke has no drawing function...it's just a point
1318  Smoke moves with movesmok function
1319  Smoke color matches the owner color
1320  BLOCK END - initsmok, creates the smoke trail from a plane
1321  BLANK
1322  BLANK
1323  BLANK
1324  BLANK

DEFINE BIRD FLOCK POSITIONS
1325  Bird flocks at x positions 370, 1370, 1630, and 2630
1326  Bird blocks are at the top of the screen
1327  Left flocks move right 2 px/tick and right flocks left at 2 px/tick
1328  BLANK
1329  BLANK
1330  BLANK

INITIALIZE A FLOCK OF BIRDS
1331  Declares and defines initflck with no arguments
1332  BLOCK START - initflck, initializes a flock of birds
1333  Declare a local point to an object
1334  Declare two local iterators
1335  BLANK
1336  If we're in novice mode...
1337  Cancel flock creation - novices can't handle birds
1338  BLANK
1339  BLOCK START - Loop through 4 bird flocks
1340  BLANK
1341  If we can't allocate a new object
1342  Cancel flock creation
1343  BLANK
1344  Set new object type to flock
1345  Set object physics to flying
1346  Set starting x to the proper index from line 1325
1347  Set starting y
1348  Set starting x motion
1349  Set all other motion variables to 0
1350  Flocks can't fly upside down
1351  Set flock life to 5 ticks (changes wing flapping)
1352  Only the flock can own the flock
1353  Flocks are 16 x 16
1354  Flock drawing function is dispflck
1355  Flock moving function is moveflck
1356  Flocks are white!
1357  Add the flock to the list of objects
1358  For each flock loop through 1 bird
1359  Initialize the bird
1360  BLOCK END - Loop through 4 bird flocks
1361  BLOCK END - initflck, initializes a flock of birds
1362  BLANK
1363  BLANK
1364  BLANK

INITIALIZE A SINGLE BIRD
1365  Declares and defines initbird with two arguments
1366  Argument 1 is the input parent object reference (a flock)
1367  Argument 2 is the reference to the bird number (used as index)
1368  BLOCK START - initbird, sets up birds when dispersed by the flock
1369  Declares two local pointers to objects
1370  Hardcodes starting x positions for eight birds
1371  Hardcodes starting y positions for eight birds
1372  Hardcodes starting x motion for eight birds
1373  Hardcodes starting y motion for eight birds
1374  BLANK
1375  BLANK
1376  If we can't allocate a new object...
1377  Cancel bird creation
1378  BLANK
1379  Set new object to type bird
1380  BLANK
1381  Offset x position to the hardcoded index (why the assignment like this,
      Dave? Comon, man!)
1382  Offset start y based on indexed lookup from parent y
1383  Set x speed to match index x motion
1384  Set y speed to match index y motion
1385  Clear all other motion variables
1386  Sets bird life to 4 ticks (used to swap wing flapping)
1387  The flock owns the bird
1388  Birds are 2 pixels tall
1389  Birds are 4 pixels width
1390  Bird drawing function is drawbird
1391  Bird moving function is movebird
1392  Birds are white, just like flocks
1393  Add the birds to the object list
1394  BLOCK END - initbird, sets up birds when dispersed by the flock
1395  BLANK
1396  BLANK
1397  BLANK

INITIALIZE OXEN
1398  Declares and defines initoxen with no arguments
1399  BLOCK START - initoxen, sets up the two oxen at start
1400  Declare a local object pointer
1401  Declare a local variable
1402  Declare 2 oxen x positions
1403  Declare 2 oxen y positions
1404  BLANK
1405  BLOCK START - Novice Oxen
1406  Loop through the two oxen
1407  There are no oxen on novice!
1408  Leave init
1409  BLOCK END - Novice Oxen
1410  BLANK
1411  BLOCK START - Loop through the two oxen
1412  If we can't allocate the oxen objects..
1413  Cancel oxen init
1414  BLANK
1415  Set the object to type oxen
1416  Set their physics to standing
1417  Match the oxen x to the hardcoded x position
1418  Match the oxen y to the hardcoded y position
1419  Disable all those useless motion variables...oxen don't move!
1420  Yeah! I said oxen don't move and I mean it!
1421  Only the oxen own the oxen
1422  Oxen are 16 pixels tall
1423  And 16 pixels wide
1424  Oxen have no draw function?
1425  Err...maybe they do move? Set oxen move function to moveox
1426  Set oxen color to player color
1427  Add oxen to the object list
1428  BLOCK END - Loop through oxen
1429  BLOCK END - initoxen, sets up the two oxen at start
1430  BLANK