Home » Archimedes archive » Acorn User » AU 1996-Xmas.adf » Features » Arcade/!Popcorn/h/Popcorn

Arcade/!Popcorn/h/Popcorn

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1996-Xmas.adf » Features
Filename: Arcade/!Popcorn/h/Popcorn
Read OK:
File size: 32A7 bytes
Load address: 0000
Exec address: 0000
File contents
/* Popcorn header file; #include this in your C source, and link with
** o.Popcorn to use.
**
** (c) 1996 Matthew Bloch, Digital Soup Kitchen
**
** Header file help may not be in English; sentences may have had articles,
** subjects and verbs taken out so the comments fit on one line.  No
** responsibility will be taken for any mental disorders arising from
** attempts at comprehension of this file.
**
** Specifically, typedefs are NOT used, except in the case of the object
** handler.  This is because the word 'struct' shows up in a different colour
** and typedefs don't, and also because I'm inconsistent.  Popcorn works fine
** from the outside; play with the insides at your own risk.
*/

#include "DeskLib:h.Core"

/* Constants which will satisfy most games, but feel free to mess with them */
#define MAX_RESOURCES 256
#define MAX_PROTOTYPES 100

#define TABLE_HEADER_WORD 0x544A424F /* OBJT */

struct window {
  int x0, y0, x1, y1;
};

union object_flags {
  struct {
    unsigned int std_plot      : 1; /* Use standard sprite plotter */
    unsigned int animate       : 1; /* plot_id points to animation block */
    unsigned int collide       : 1; /* Include object in collision tables */
    unsigned int velocities    : 1; /* Apply velocity to object's position */
    unsigned int gravity       : 1; /* Apply table gravity on processing */
    unsigned int attn_every    : 1; /* Attention on every process pass */
    unsigned int attn_plot     : 1; /* Attention for plot */
    unsigned int attn_timer    : 1; /* Attention when timer runs down */
    unsigned int attn_plotout  : 1; /* Attention when outisde plot window */
    unsigned int attn_gameout  : 1; /* Attention when outside game window */
    unsigned int attn_userout  : 1; /* Attention when outside user window */
    unsigned int kill_timer    : 1; /* Kill when timer runs down */
    unsigned int kill_plotout  : 1; /* Kill when outisde plot window */
    unsigned int kill_gameout  : 1; /* Kill when outside game window */
    unsigned int kill_userout  : 1; /* Kill when outside user window */
    unsigned int yoyo          : 1; /* Signifies yoyo animation */
    unsigned int yoyo_dec      : 1; /* Used with above to show direction */
    unsigned int animate_skip  : 1; /* For 'every other frame' animation */
  } bits;
  int word; /* So we can zero all the flags easily */
};

/* object_handler
**
**   A typedef for a Popcorn object handler, surprisingly.
*/
typedef void (*object_handler) (struct game_object*, union object_flags, void*);

/* struct resource
**
**   This structure represents one resource; each resource has a group
**   associated with it for mass loading / deleting.  It also contains
**   the resource's size (bytes), filename, and address in memory.
**   An address of 0 means the resource isn't loaded.
**
**   This structure is used internally; you don't need to know how the
**   resource manager works because it's boring :-)
*/
struct resource {
  int  group;
  char *file;
  void *addr;
  int  size;
};

/* struct frame_data
**
**   Lists of these are kept inside 'struct animate_block's, for each frame
**   of an animation.  Each one contains a sprite anchor (usually a pointer
**   to a *addr in a 'struct resource', and the centering and size info
**   for each frame.
*/
struct frame_data {
  void **sprite_anchor;
  int  centre_x, centre_y;
  int  size_x, size_y;
};

/* struct animate_block
**
**   If an object's plot_id points to one of these, and the 'animate' bit is
**   set in its flags, the object is animated according to the list of frames.
*/
struct animate_block {
  int                 frames;
  struct frame_data   frame[1]; /* Open-ended structure (no fixed size) */
};

/* struct prototype
**
**   Popcorn maintains a master list of prototypes which are represented
**   by these data structures.  Each prototype has a unique id, a handler
**   associated with it and a set of object flags.  There's also an animation
**   block attached, whether the object is animated or not.  There can be
**   ANY number of frames in this animation block (0 or 1 included).
*/
struct prototype {
  int                   id;
  object_handler        handler;
  union object_flags    flags;
  struct animate_block  animation;
};

/* struct game_object
**
**   Each object in the game is represented by one of these structs;
**   it contains the position and speed of the object within the playing
**   area, along with the 'handler' function.  This is called whenever the
**   object requires 'attention', which is set by the flags explained above.
**
*/

struct game_object {
  int object_id;                   /* Solely for the object handler */
  union {
    void		 **sprite_anchor;
    struct animate_block  *animation;
  } plot_id;                       /* Passed in R0 to sprite plotter */
  object_handler handler;
  int  frame;
  union object_flags     flags;
  int x, y, xv, yv;	           /* Object co-ordinates and velocity */
  struct {
    unsigned int value        : 16;
    unsigned int decrement    : 16;
  } timer;
  struct {
    unsigned int x            : 16;
    unsigned int y	      : 16;
  } size;
  struct {
    unsigned int x            : 16;
    unsigned int y	      : 16;
  } plot_offset;
  void *user_data;
};

/* struct collision_object
**
**   This is used mainly for internal use, so that the collision detection
**   routines can work as fast as possible.  It contains the bounding box
**   of each object, plus a reference back to the objects handler in case
**   any collisions happen.  A table of these structs is built up at the
**   head of each table, so that these tables can be cross-referenced easily.
**
**   Checking 50 objects against 50 other objects requires 2500 checks, so
**   we need to work as quickly as possible.
*/

/* struct collision_object
**
**   Minimal information for faster collision detection.
*/
struct collision_object
{
  int x0, y0, x1, y1;
  struct game_object *back_ptr;
};

/* struct collision_table
**
**   A smaller version of 'struct object_table', below, but contains only
**   the information necessary for collision detection.
*/
struct collision_table
{
  int                     entries;
  struct collision_object collision[1];
};

/* struct object_table
**
**   This is the header to a table of game_object structs, as defined above.
**   It contains the number of entries used so far; when this reaches the
**   maximum number for that table, it starts looking for holes in it to
**   fill with new objects.  Regular use of Popcorn_Tidy will minimise
**   these holes.
*/

struct object_table
{
  int                      header;
  int                      max_objects, next_free;
  int			   grav_x, grav_y;
  struct collision_table   *collisions;
  struct game_object       object[1];
};

/* Popcorn_CollisionCheck
**
**   Call this to check whether objects in two tables have collided.  Only
**   objects for which the collide flag has been set will be checked.
**   If a collision is found, the handlers in table1 ONLY will be called.
*/
extern void Popcorn_CollisionCheck(struct object_table* table1, struct object_table* table2);

/* Popcorn_ClearScreen
**
**   Clears the screen memory to a particular colour.
*/
void	 Popcorn_ClearScreen(int colour);

/*
** Popcorn_DeleteObject
**
**   Only needs to be a macro, this one: it just sets the object_id to
**   zero, and the processing function sees it as a hole in the table.
*/
#define Popcorn_DeleteObject(o) (o)->object_id = 0;

/* Popcorn_FindResource
**
**   This call will return an address pointer for the resource specified in
**   'res_name', providing you have called Popcorn_LoadResourceFile earlier
**   and the resource has been loaded.  Otherwise a NULL pointer is returned.
*/
void    **Popcorn_FindResource(char *res_name);

/* Popcorn_FindSymbol
**
**   Call which finds the address of a symbol in a program; it returns the
**   object_handler type because this is its main use.  Before calling this,
**   you must set 'symbol_table_filename' to be the filename of the symbol
**   table produced by the linker.
*/
object_handler Popcorn_FindSymbol(char *name);

/* Popcorn_LoadGroup
**
**   This call finds all the resources with a specified ID, and loads them
**   into memory.  An error is returned if all of them have not been loaded.
*/
os_error *Popcorn_LoadGroup(int id);

/* Popcorn_LoadPrototypes
**
**   Should only be called at once, to load the global list of prototypes
**   for an application.
*/
os_error *Popcorn_LoadPrototypes(char *filename);

/* Popcorn_LoadResourceFile
**
**   This function initialises the resource managing routines; all the
**   file should contain is a list of group/resource pairs.  None of the
**   resources will be loaded into memory until Popcorn_LoadGroup() is
**   called with a valid ID.
*/
os_error *Popcorn_LoadResourceFile(char *filename);

/* Popcorn_LoseGroup
**
**   This call deletes (i.e. frees the memory used by) all the resources
**   with a specified group ID.
*/
void Popcorn_LoseGroup(int id);

/* Popcorn_NewObject
**
**   This function finds a space in a specified table for a new object,
**   returning NULL if the table is full.
*/
extern struct game_object* Popcorn_NewObject(struct object_table *table);

/* Popcorn_NewPrototype
**
**   This function creates an object with Popcorn_NewObject then fills
**   in the flags and animation details from the specified prototype
**   name.  The velocities and timer are zeroed, and should be filled in
**   by the program if necessary.
*/
extern struct game_object* Popcorn_NewPrototype(struct object_table *table,
       	      		   			 int    prototype_id,
       	      		   			 int	x,
       	      		   			 int	y);

/* Popcorn_NewTable
**
**   This function allocates space for a new object table, allowing for
**   a maximum of max_objects and allowing for collision detection on
**   the table only if (collisions == TRUE).
*/
extern struct object_table* Popcorn_NewTable(int max_objects,
					     BOOL collisions);

/* Popcorn_Outside
**
**   Returns TRUE if a given object (with co-ordinates shifted << 12, remember)
**   is outside a certain window (co-ordinates specified as screen pixels).
**   Internal use, but you might want it.
*/
BOOL Popcorn_Outside(struct game_object *obj, struct window *win);

/* Popcorn_PlotBackdrop
**
**   Copies the specified area of memory to the screen memory as quickly
**   as possible.
*/
void	 Popcorn_PlotBackdrop(char *backdrop);

/* Popcorn_PlotSprite
**
**   *sprite should be a pointer to a Popcorn sprite file in memory; x and y
**   can be -ve, or off the screen and the sprite will be clipped according
**   to plot_window (see below).
*/
void	 Popcorn_PlotSprite(char *sprite, signed int x, signed int y);

/* Popcorn_Process
**
**   This is the function that does all the work :-)  Call this every
**   frame on each of your tables to plot all the objects, move them
**   on, call their handlers if necessary and add them to the collision
**   tables (i.e. you must call this before Popcorn_CollisionCheck)
*/
extern void Popcorn_Process(struct object_table* table,
       	    		     BOOL plot, int moves);

/* Popcorn_ReadScreenDetails
**
**   Call once on every mode change so that the display routines can sort
**   themselves out; also sets the 'plot' bank to 0 and the 'display' bank to
**   1, or t'other way around... see the source code if you're that bothered.
*/
void     Popcorn_ReadScreenDetails(void);

/* Popcorn_SwapBanks
**
**   Swaps the 'display' and 'plot' banks around; usually used after
**   OS_Byte 19 for smooth animation.
*/
void	 Popcorn_SwapBanks(void);

/* Popcorn_Tidy
**
**   Call this whenever possible to push all the objects in a table
**   towards the top, and free up spaces at the end, making creation
**   of new objects quicker.  It can be slow, so only use when the
**   game is paused or between levels.
**
**   DON'T use this call when objects rely on finding other objects in certain
**   positions in the object table, otherwise they may move and run into
**   trouble.
*/
extern void Popcorn_Tidy(struct object_table* table);

/* plot_window, game_window, user_window
**
**   Three windows which objects can be inside or outside; plot_window affects
**   sprite clipping, but the others two are unused for any other purpose.
*/
extern struct window       plot_window;
extern struct window	   game_window;
extern struct window	   user_window;

/* resource and prototype arrays
**
**   Used internally; look at the source if you're bothered.
*/
extern struct resource     *resource[MAX_RESOURCES];
extern struct prototype    *prototype[MAX_PROTOTYPES];
extern int    		   resource_free, prototype_free;

/* symbol_table_filename
**
**   To find symbols at run-time, this must contain the filename of a symbol
**   table produced by the linker.  Add '-symbols <filename>' when you call
**   the linker to produce one.
*/
extern char                symbol_table_filename[255];
00000000  2f 2a 20 50 6f 70 63 6f  72 6e 20 68 65 61 64 65  |/* Popcorn heade|
00000010  72 20 66 69 6c 65 3b 20  23 69 6e 63 6c 75 64 65  |r file; #include|
00000020  20 74 68 69 73 20 69 6e  20 79 6f 75 72 20 43 20  | this in your C |
00000030  73 6f 75 72 63 65 2c 20  61 6e 64 20 6c 69 6e 6b  |source, and link|
00000040  20 77 69 74 68 0a 2a 2a  20 6f 2e 50 6f 70 63 6f  | with.** o.Popco|
00000050  72 6e 20 74 6f 20 75 73  65 2e 0a 2a 2a 0a 2a 2a  |rn to use..**.**|
00000060  20 28 63 29 20 31 39 39  36 20 4d 61 74 74 68 65  | (c) 1996 Matthe|
00000070  77 20 42 6c 6f 63 68 2c  20 44 69 67 69 74 61 6c  |w Bloch, Digital|
00000080  20 53 6f 75 70 20 4b 69  74 63 68 65 6e 0a 2a 2a  | Soup Kitchen.**|
00000090  0a 2a 2a 20 48 65 61 64  65 72 20 66 69 6c 65 20  |.** Header file |
000000a0  68 65 6c 70 20 6d 61 79  20 6e 6f 74 20 62 65 20  |help may not be |
000000b0  69 6e 20 45 6e 67 6c 69  73 68 3b 20 73 65 6e 74  |in English; sent|
000000c0  65 6e 63 65 73 20 6d 61  79 20 68 61 76 65 20 68  |ences may have h|
000000d0  61 64 20 61 72 74 69 63  6c 65 73 2c 0a 2a 2a 20  |ad articles,.** |
000000e0  73 75 62 6a 65 63 74 73  20 61 6e 64 20 76 65 72  |subjects and ver|
000000f0  62 73 20 74 61 6b 65 6e  20 6f 75 74 20 73 6f 20  |bs taken out so |
00000100  74 68 65 20 63 6f 6d 6d  65 6e 74 73 20 66 69 74  |the comments fit|
00000110  20 6f 6e 20 6f 6e 65 20  6c 69 6e 65 2e 20 20 4e  | on one line.  N|
00000120  6f 0a 2a 2a 20 72 65 73  70 6f 6e 73 69 62 69 6c  |o.** responsibil|
00000130  69 74 79 20 77 69 6c 6c  20 62 65 20 74 61 6b 65  |ity will be take|
00000140  6e 20 66 6f 72 20 61 6e  79 20 6d 65 6e 74 61 6c  |n for any mental|
00000150  20 64 69 73 6f 72 64 65  72 73 20 61 72 69 73 69  | disorders arisi|
00000160  6e 67 20 66 72 6f 6d 0a  2a 2a 20 61 74 74 65 6d  |ng from.** attem|
00000170  70 74 73 20 61 74 20 63  6f 6d 70 72 65 68 65 6e  |pts at comprehen|
00000180  73 69 6f 6e 20 6f 66 20  74 68 69 73 20 66 69 6c  |sion of this fil|
00000190  65 2e 0a 2a 2a 0a 2a 2a  20 53 70 65 63 69 66 69  |e..**.** Specifi|
000001a0  63 61 6c 6c 79 2c 20 74  79 70 65 64 65 66 73 20  |cally, typedefs |
000001b0  61 72 65 20 4e 4f 54 20  75 73 65 64 2c 20 65 78  |are NOT used, ex|
000001c0  63 65 70 74 20 69 6e 20  74 68 65 20 63 61 73 65  |cept in the case|
000001d0  20 6f 66 20 74 68 65 20  6f 62 6a 65 63 74 0a 2a  | of the object.*|
000001e0  2a 20 68 61 6e 64 6c 65  72 2e 20 20 54 68 69 73  |* handler.  This|
000001f0  20 69 73 20 62 65 63 61  75 73 65 20 74 68 65 20  | is because the |
00000200  77 6f 72 64 20 27 73 74  72 75 63 74 27 20 73 68  |word 'struct' sh|
00000210  6f 77 73 20 75 70 20 69  6e 20 61 20 64 69 66 66  |ows up in a diff|
00000220  65 72 65 6e 74 20 63 6f  6c 6f 75 72 0a 2a 2a 20  |erent colour.** |
00000230  61 6e 64 20 74 79 70 65  64 65 66 73 20 64 6f 6e  |and typedefs don|
00000240  27 74 2c 20 61 6e 64 20  61 6c 73 6f 20 62 65 63  |'t, and also bec|
00000250  61 75 73 65 20 49 27 6d  20 69 6e 63 6f 6e 73 69  |ause I'm inconsi|
00000260  73 74 65 6e 74 2e 20 20  50 6f 70 63 6f 72 6e 20  |stent.  Popcorn |
00000270  77 6f 72 6b 73 20 66 69  6e 65 0a 2a 2a 20 66 72  |works fine.** fr|
00000280  6f 6d 20 74 68 65 20 6f  75 74 73 69 64 65 3b 20  |om the outside; |
00000290  70 6c 61 79 20 77 69 74  68 20 74 68 65 20 69 6e  |play with the in|
000002a0  73 69 64 65 73 20 61 74  20 79 6f 75 72 20 6f 77  |sides at your ow|
000002b0  6e 20 72 69 73 6b 2e 0a  2a 2f 0a 0a 23 69 6e 63  |n risk..*/..#inc|
000002c0  6c 75 64 65 20 22 44 65  73 6b 4c 69 62 3a 68 2e  |lude "DeskLib:h.|
000002d0  43 6f 72 65 22 0a 0a 2f  2a 20 43 6f 6e 73 74 61  |Core"../* Consta|
000002e0  6e 74 73 20 77 68 69 63  68 20 77 69 6c 6c 20 73  |nts which will s|
000002f0  61 74 69 73 66 79 20 6d  6f 73 74 20 67 61 6d 65  |atisfy most game|
00000300  73 2c 20 62 75 74 20 66  65 65 6c 20 66 72 65 65  |s, but feel free|
00000310  20 74 6f 20 6d 65 73 73  20 77 69 74 68 20 74 68  | to mess with th|
00000320  65 6d 20 2a 2f 0a 23 64  65 66 69 6e 65 20 4d 41  |em */.#define MA|
00000330  58 5f 52 45 53 4f 55 52  43 45 53 20 32 35 36 0a  |X_RESOURCES 256.|
00000340  23 64 65 66 69 6e 65 20  4d 41 58 5f 50 52 4f 54  |#define MAX_PROT|
00000350  4f 54 59 50 45 53 20 31  30 30 0a 0a 23 64 65 66  |OTYPES 100..#def|
00000360  69 6e 65 20 54 41 42 4c  45 5f 48 45 41 44 45 52  |ine TABLE_HEADER|
00000370  5f 57 4f 52 44 20 30 78  35 34 34 41 34 32 34 46  |_WORD 0x544A424F|
00000380  20 2f 2a 20 4f 42 4a 54  20 2a 2f 0a 0a 73 74 72  | /* OBJT */..str|
00000390  75 63 74 20 77 69 6e 64  6f 77 20 7b 0a 20 20 69  |uct window {.  i|
000003a0  6e 74 20 78 30 2c 20 79  30 2c 20 78 31 2c 20 79  |nt x0, y0, x1, y|
000003b0  31 3b 0a 7d 3b 0a 0a 75  6e 69 6f 6e 20 6f 62 6a  |1;.};..union obj|
000003c0  65 63 74 5f 66 6c 61 67  73 20 7b 0a 20 20 73 74  |ect_flags {.  st|
000003d0  72 75 63 74 20 7b 0a 20  20 20 20 75 6e 73 69 67  |ruct {.    unsig|
000003e0  6e 65 64 20 69 6e 74 20  73 74 64 5f 70 6c 6f 74  |ned int std_plot|
000003f0  20 20 20 20 20 20 3a 20  31 3b 20 2f 2a 20 55 73  |      : 1; /* Us|
00000400  65 20 73 74 61 6e 64 61  72 64 20 73 70 72 69 74  |e standard sprit|
00000410  65 20 70 6c 6f 74 74 65  72 20 2a 2f 0a 20 20 20  |e plotter */.   |
00000420  20 75 6e 73 69 67 6e 65  64 20 69 6e 74 20 61 6e  | unsigned int an|
00000430  69 6d 61 74 65 20 20 20  20 20 20 20 3a 20 31 3b  |imate       : 1;|
00000440  20 2f 2a 20 70 6c 6f 74  5f 69 64 20 70 6f 69 6e  | /* plot_id poin|
00000450  74 73 20 74 6f 20 61 6e  69 6d 61 74 69 6f 6e 20  |ts to animation |
00000460  62 6c 6f 63 6b 20 2a 2f  0a 20 20 20 20 75 6e 73  |block */.    uns|
00000470  69 67 6e 65 64 20 69 6e  74 20 63 6f 6c 6c 69 64  |igned int collid|
00000480  65 20 20 20 20 20 20 20  3a 20 31 3b 20 2f 2a 20  |e       : 1; /* |
00000490  49 6e 63 6c 75 64 65 20  6f 62 6a 65 63 74 20 69  |Include object i|
000004a0  6e 20 63 6f 6c 6c 69 73  69 6f 6e 20 74 61 62 6c  |n collision tabl|
000004b0  65 73 20 2a 2f 0a 20 20  20 20 75 6e 73 69 67 6e  |es */.    unsign|
000004c0  65 64 20 69 6e 74 20 76  65 6c 6f 63 69 74 69 65  |ed int velocitie|
000004d0  73 20 20 20 20 3a 20 31  3b 20 2f 2a 20 41 70 70  |s    : 1; /* App|
000004e0  6c 79 20 76 65 6c 6f 63  69 74 79 20 74 6f 20 6f  |ly velocity to o|
000004f0  62 6a 65 63 74 27 73 20  70 6f 73 69 74 69 6f 6e  |bject's position|
00000500  20 2a 2f 0a 20 20 20 20  75 6e 73 69 67 6e 65 64  | */.    unsigned|
00000510  20 69 6e 74 20 67 72 61  76 69 74 79 20 20 20 20  | int gravity    |
00000520  20 20 20 3a 20 31 3b 20  2f 2a 20 41 70 70 6c 79  |   : 1; /* Apply|
00000530  20 74 61 62 6c 65 20 67  72 61 76 69 74 79 20 6f  | table gravity o|
00000540  6e 20 70 72 6f 63 65 73  73 69 6e 67 20 2a 2f 0a  |n processing */.|
00000550  20 20 20 20 75 6e 73 69  67 6e 65 64 20 69 6e 74  |    unsigned int|
00000560  20 61 74 74 6e 5f 65 76  65 72 79 20 20 20 20 3a  | attn_every    :|
00000570  20 31 3b 20 2f 2a 20 41  74 74 65 6e 74 69 6f 6e  | 1; /* Attention|
00000580  20 6f 6e 20 65 76 65 72  79 20 70 72 6f 63 65 73  | on every proces|
00000590  73 20 70 61 73 73 20 2a  2f 0a 20 20 20 20 75 6e  |s pass */.    un|
000005a0  73 69 67 6e 65 64 20 69  6e 74 20 61 74 74 6e 5f  |signed int attn_|
000005b0  70 6c 6f 74 20 20 20 20  20 3a 20 31 3b 20 2f 2a  |plot     : 1; /*|
000005c0  20 41 74 74 65 6e 74 69  6f 6e 20 66 6f 72 20 70  | Attention for p|
000005d0  6c 6f 74 20 2a 2f 0a 20  20 20 20 75 6e 73 69 67  |lot */.    unsig|
000005e0  6e 65 64 20 69 6e 74 20  61 74 74 6e 5f 74 69 6d  |ned int attn_tim|
000005f0  65 72 20 20 20 20 3a 20  31 3b 20 2f 2a 20 41 74  |er    : 1; /* At|
00000600  74 65 6e 74 69 6f 6e 20  77 68 65 6e 20 74 69 6d  |tention when tim|
00000610  65 72 20 72 75 6e 73 20  64 6f 77 6e 20 2a 2f 0a  |er runs down */.|
00000620  20 20 20 20 75 6e 73 69  67 6e 65 64 20 69 6e 74  |    unsigned int|
00000630  20 61 74 74 6e 5f 70 6c  6f 74 6f 75 74 20 20 3a  | attn_plotout  :|
00000640  20 31 3b 20 2f 2a 20 41  74 74 65 6e 74 69 6f 6e  | 1; /* Attention|
00000650  20 77 68 65 6e 20 6f 75  74 69 73 64 65 20 70 6c  | when outisde pl|
00000660  6f 74 20 77 69 6e 64 6f  77 20 2a 2f 0a 20 20 20  |ot window */.   |
00000670  20 75 6e 73 69 67 6e 65  64 20 69 6e 74 20 61 74  | unsigned int at|
00000680  74 6e 5f 67 61 6d 65 6f  75 74 20 20 3a 20 31 3b  |tn_gameout  : 1;|
00000690  20 2f 2a 20 41 74 74 65  6e 74 69 6f 6e 20 77 68  | /* Attention wh|
000006a0  65 6e 20 6f 75 74 73 69  64 65 20 67 61 6d 65 20  |en outside game |
000006b0  77 69 6e 64 6f 77 20 2a  2f 0a 20 20 20 20 75 6e  |window */.    un|
000006c0  73 69 67 6e 65 64 20 69  6e 74 20 61 74 74 6e 5f  |signed int attn_|
000006d0  75 73 65 72 6f 75 74 20  20 3a 20 31 3b 20 2f 2a  |userout  : 1; /*|
000006e0  20 41 74 74 65 6e 74 69  6f 6e 20 77 68 65 6e 20  | Attention when |
000006f0  6f 75 74 73 69 64 65 20  75 73 65 72 20 77 69 6e  |outside user win|
00000700  64 6f 77 20 2a 2f 0a 20  20 20 20 75 6e 73 69 67  |dow */.    unsig|
00000710  6e 65 64 20 69 6e 74 20  6b 69 6c 6c 5f 74 69 6d  |ned int kill_tim|
00000720  65 72 20 20 20 20 3a 20  31 3b 20 2f 2a 20 4b 69  |er    : 1; /* Ki|
00000730  6c 6c 20 77 68 65 6e 20  74 69 6d 65 72 20 72 75  |ll when timer ru|
00000740  6e 73 20 64 6f 77 6e 20  2a 2f 0a 20 20 20 20 75  |ns down */.    u|
00000750  6e 73 69 67 6e 65 64 20  69 6e 74 20 6b 69 6c 6c  |nsigned int kill|
00000760  5f 70 6c 6f 74 6f 75 74  20 20 3a 20 31 3b 20 2f  |_plotout  : 1; /|
00000770  2a 20 4b 69 6c 6c 20 77  68 65 6e 20 6f 75 74 69  |* Kill when outi|
00000780  73 64 65 20 70 6c 6f 74  20 77 69 6e 64 6f 77 20  |sde plot window |
00000790  2a 2f 0a 20 20 20 20 75  6e 73 69 67 6e 65 64 20  |*/.    unsigned |
000007a0  69 6e 74 20 6b 69 6c 6c  5f 67 61 6d 65 6f 75 74  |int kill_gameout|
000007b0  20 20 3a 20 31 3b 20 2f  2a 20 4b 69 6c 6c 20 77  |  : 1; /* Kill w|
000007c0  68 65 6e 20 6f 75 74 73  69 64 65 20 67 61 6d 65  |hen outside game|
000007d0  20 77 69 6e 64 6f 77 20  2a 2f 0a 20 20 20 20 75  | window */.    u|
000007e0  6e 73 69 67 6e 65 64 20  69 6e 74 20 6b 69 6c 6c  |nsigned int kill|
000007f0  5f 75 73 65 72 6f 75 74  20 20 3a 20 31 3b 20 2f  |_userout  : 1; /|
00000800  2a 20 4b 69 6c 6c 20 77  68 65 6e 20 6f 75 74 73  |* Kill when outs|
00000810  69 64 65 20 75 73 65 72  20 77 69 6e 64 6f 77 20  |ide user window |
00000820  2a 2f 0a 20 20 20 20 75  6e 73 69 67 6e 65 64 20  |*/.    unsigned |
00000830  69 6e 74 20 79 6f 79 6f  20 20 20 20 20 20 20 20  |int yoyo        |
00000840  20 20 3a 20 31 3b 20 2f  2a 20 53 69 67 6e 69 66  |  : 1; /* Signif|
00000850  69 65 73 20 79 6f 79 6f  20 61 6e 69 6d 61 74 69  |ies yoyo animati|
00000860  6f 6e 20 2a 2f 0a 20 20  20 20 75 6e 73 69 67 6e  |on */.    unsign|
00000870  65 64 20 69 6e 74 20 79  6f 79 6f 5f 64 65 63 20  |ed int yoyo_dec |
00000880  20 20 20 20 20 3a 20 31  3b 20 2f 2a 20 55 73 65  |     : 1; /* Use|
00000890  64 20 77 69 74 68 20 61  62 6f 76 65 20 74 6f 20  |d with above to |
000008a0  73 68 6f 77 20 64 69 72  65 63 74 69 6f 6e 20 2a  |show direction *|
000008b0  2f 0a 20 20 20 20 75 6e  73 69 67 6e 65 64 20 69  |/.    unsigned i|
000008c0  6e 74 20 61 6e 69 6d 61  74 65 5f 73 6b 69 70 20  |nt animate_skip |
000008d0  20 3a 20 31 3b 20 2f 2a  20 46 6f 72 20 27 65 76  | : 1; /* For 'ev|
000008e0  65 72 79 20 6f 74 68 65  72 20 66 72 61 6d 65 27  |ery other frame'|
000008f0  20 61 6e 69 6d 61 74 69  6f 6e 20 2a 2f 0a 20 20  | animation */.  |
00000900  7d 20 62 69 74 73 3b 0a  20 20 69 6e 74 20 77 6f  |} bits;.  int wo|
00000910  72 64 3b 20 2f 2a 20 53  6f 20 77 65 20 63 61 6e  |rd; /* So we can|
00000920  20 7a 65 72 6f 20 61 6c  6c 20 74 68 65 20 66 6c  | zero all the fl|
00000930  61 67 73 20 65 61 73 69  6c 79 20 2a 2f 0a 7d 3b  |ags easily */.};|
00000940  0a 0a 2f 2a 20 6f 62 6a  65 63 74 5f 68 61 6e 64  |../* object_hand|
00000950  6c 65 72 0a 2a 2a 0a 2a  2a 20 20 20 41 20 74 79  |ler.**.**   A ty|
00000960  70 65 64 65 66 20 66 6f  72 20 61 20 50 6f 70 63  |pedef for a Popc|
00000970  6f 72 6e 20 6f 62 6a 65  63 74 20 68 61 6e 64 6c  |orn object handl|
00000980  65 72 2c 20 73 75 72 70  72 69 73 69 6e 67 6c 79  |er, surprisingly|
00000990  2e 0a 2a 2f 0a 74 79 70  65 64 65 66 20 76 6f 69  |..*/.typedef voi|
000009a0  64 20 28 2a 6f 62 6a 65  63 74 5f 68 61 6e 64 6c  |d (*object_handl|
000009b0  65 72 29 20 28 73 74 72  75 63 74 20 67 61 6d 65  |er) (struct game|
000009c0  5f 6f 62 6a 65 63 74 2a  2c 20 75 6e 69 6f 6e 20  |_object*, union |
000009d0  6f 62 6a 65 63 74 5f 66  6c 61 67 73 2c 20 76 6f  |object_flags, vo|
000009e0  69 64 2a 29 3b 0a 0a 2f  2a 20 73 74 72 75 63 74  |id*);../* struct|
000009f0  20 72 65 73 6f 75 72 63  65 0a 2a 2a 0a 2a 2a 20  | resource.**.** |
00000a00  20 20 54 68 69 73 20 73  74 72 75 63 74 75 72 65  |  This structure|
00000a10  20 72 65 70 72 65 73 65  6e 74 73 20 6f 6e 65 20  | represents one |
00000a20  72 65 73 6f 75 72 63 65  3b 20 65 61 63 68 20 72  |resource; each r|
00000a30  65 73 6f 75 72 63 65 20  68 61 73 20 61 20 67 72  |esource has a gr|
00000a40  6f 75 70 0a 2a 2a 20 20  20 61 73 73 6f 63 69 61  |oup.**   associa|
00000a50  74 65 64 20 77 69 74 68  20 69 74 20 66 6f 72 20  |ted with it for |
00000a60  6d 61 73 73 20 6c 6f 61  64 69 6e 67 20 2f 20 64  |mass loading / d|
00000a70  65 6c 65 74 69 6e 67 2e  20 20 49 74 20 61 6c 73  |eleting.  It als|
00000a80  6f 20 63 6f 6e 74 61 69  6e 73 0a 2a 2a 20 20 20  |o contains.**   |
00000a90  74 68 65 20 72 65 73 6f  75 72 63 65 27 73 20 73  |the resource's s|
00000aa0  69 7a 65 20 28 62 79 74  65 73 29 2c 20 66 69 6c  |ize (bytes), fil|
00000ab0  65 6e 61 6d 65 2c 20 61  6e 64 20 61 64 64 72 65  |ename, and addre|
00000ac0  73 73 20 69 6e 20 6d 65  6d 6f 72 79 2e 0a 2a 2a  |ss in memory..**|
00000ad0  20 20 20 41 6e 20 61 64  64 72 65 73 73 20 6f 66  |   An address of|
00000ae0  20 30 20 6d 65 61 6e 73  20 74 68 65 20 72 65 73  | 0 means the res|
00000af0  6f 75 72 63 65 20 69 73  6e 27 74 20 6c 6f 61 64  |ource isn't load|
00000b00  65 64 2e 0a 2a 2a 0a 2a  2a 20 20 20 54 68 69 73  |ed..**.**   This|
00000b10  20 73 74 72 75 63 74 75  72 65 20 69 73 20 75 73  | structure is us|
00000b20  65 64 20 69 6e 74 65 72  6e 61 6c 6c 79 3b 20 79  |ed internally; y|
00000b30  6f 75 20 64 6f 6e 27 74  20 6e 65 65 64 20 74 6f  |ou don't need to|
00000b40  20 6b 6e 6f 77 20 68 6f  77 20 74 68 65 0a 2a 2a  | know how the.**|
00000b50  20 20 20 72 65 73 6f 75  72 63 65 20 6d 61 6e 61  |   resource mana|
00000b60  67 65 72 20 77 6f 72 6b  73 20 62 65 63 61 75 73  |ger works becaus|
00000b70  65 20 69 74 27 73 20 62  6f 72 69 6e 67 20 3a 2d  |e it's boring :-|
00000b80  29 0a 2a 2f 0a 73 74 72  75 63 74 20 72 65 73 6f  |).*/.struct reso|
00000b90  75 72 63 65 20 7b 0a 20  20 69 6e 74 20 20 67 72  |urce {.  int  gr|
00000ba0  6f 75 70 3b 0a 20 20 63  68 61 72 20 2a 66 69 6c  |oup;.  char *fil|
00000bb0  65 3b 0a 20 20 76 6f 69  64 20 2a 61 64 64 72 3b  |e;.  void *addr;|
00000bc0  0a 20 20 69 6e 74 20 20  73 69 7a 65 3b 0a 7d 3b  |.  int  size;.};|
00000bd0  0a 0a 2f 2a 20 73 74 72  75 63 74 20 66 72 61 6d  |../* struct fram|
00000be0  65 5f 64 61 74 61 0a 2a  2a 0a 2a 2a 20 20 20 4c  |e_data.**.**   L|
00000bf0  69 73 74 73 20 6f 66 20  74 68 65 73 65 20 61 72  |ists of these ar|
00000c00  65 20 6b 65 70 74 20 69  6e 73 69 64 65 20 27 73  |e kept inside 's|
00000c10  74 72 75 63 74 20 61 6e  69 6d 61 74 65 5f 62 6c  |truct animate_bl|
00000c20  6f 63 6b 27 73 2c 20 66  6f 72 20 65 61 63 68 20  |ock's, for each |
00000c30  66 72 61 6d 65 0a 2a 2a  20 20 20 6f 66 20 61 6e  |frame.**   of an|
00000c40  20 61 6e 69 6d 61 74 69  6f 6e 2e 20 20 45 61 63  | animation.  Eac|
00000c50  68 20 6f 6e 65 20 63 6f  6e 74 61 69 6e 73 20 61  |h one contains a|
00000c60  20 73 70 72 69 74 65 20  61 6e 63 68 6f 72 20 28  | sprite anchor (|
00000c70  75 73 75 61 6c 6c 79 20  61 20 70 6f 69 6e 74 65  |usually a pointe|
00000c80  72 0a 2a 2a 20 20 20 74  6f 20 61 20 2a 61 64 64  |r.**   to a *add|
00000c90  72 20 69 6e 20 61 20 27  73 74 72 75 63 74 20 72  |r in a 'struct r|
00000ca0  65 73 6f 75 72 63 65 27  2c 20 61 6e 64 20 74 68  |esource', and th|
00000cb0  65 20 63 65 6e 74 65 72  69 6e 67 20 61 6e 64 20  |e centering and |
00000cc0  73 69 7a 65 20 69 6e 66  6f 0a 2a 2a 20 20 20 66  |size info.**   f|
00000cd0  6f 72 20 65 61 63 68 20  66 72 61 6d 65 2e 0a 2a  |or each frame..*|
00000ce0  2f 0a 73 74 72 75 63 74  20 66 72 61 6d 65 5f 64  |/.struct frame_d|
00000cf0  61 74 61 20 7b 0a 20 20  76 6f 69 64 20 2a 2a 73  |ata {.  void **s|
00000d00  70 72 69 74 65 5f 61 6e  63 68 6f 72 3b 0a 20 20  |prite_anchor;.  |
00000d10  69 6e 74 20 20 63 65 6e  74 72 65 5f 78 2c 20 63  |int  centre_x, c|
00000d20  65 6e 74 72 65 5f 79 3b  0a 20 20 69 6e 74 20 20  |entre_y;.  int  |
00000d30  73 69 7a 65 5f 78 2c 20  73 69 7a 65 5f 79 3b 0a  |size_x, size_y;.|
00000d40  7d 3b 0a 0a 2f 2a 20 73  74 72 75 63 74 20 61 6e  |};../* struct an|
00000d50  69 6d 61 74 65 5f 62 6c  6f 63 6b 0a 2a 2a 0a 2a  |imate_block.**.*|
00000d60  2a 20 20 20 49 66 20 61  6e 20 6f 62 6a 65 63 74  |*   If an object|
00000d70  27 73 20 70 6c 6f 74 5f  69 64 20 70 6f 69 6e 74  |'s plot_id point|
00000d80  73 20 74 6f 20 6f 6e 65  20 6f 66 20 74 68 65 73  |s to one of thes|
00000d90  65 2c 20 61 6e 64 20 74  68 65 20 27 61 6e 69 6d  |e, and the 'anim|
00000da0  61 74 65 27 20 62 69 74  20 69 73 0a 2a 2a 20 20  |ate' bit is.**  |
00000db0  20 73 65 74 20 69 6e 20  69 74 73 20 66 6c 61 67  | set in its flag|
00000dc0  73 2c 20 74 68 65 20 6f  62 6a 65 63 74 20 69 73  |s, the object is|
00000dd0  20 61 6e 69 6d 61 74 65  64 20 61 63 63 6f 72 64  | animated accord|
00000de0  69 6e 67 20 74 6f 20 74  68 65 20 6c 69 73 74 20  |ing to the list |
00000df0  6f 66 20 66 72 61 6d 65  73 2e 0a 2a 2f 0a 73 74  |of frames..*/.st|
00000e00  72 75 63 74 20 61 6e 69  6d 61 74 65 5f 62 6c 6f  |ruct animate_blo|
00000e10  63 6b 20 7b 0a 20 20 69  6e 74 20 20 20 20 20 20  |ck {.  int      |
00000e20  20 20 20 20 20 20 20 20  20 20 20 66 72 61 6d 65  |           frame|
00000e30  73 3b 0a 20 20 73 74 72  75 63 74 20 66 72 61 6d  |s;.  struct fram|
00000e40  65 5f 64 61 74 61 20 20  20 66 72 61 6d 65 5b 31  |e_data   frame[1|
00000e50  5d 3b 20 2f 2a 20 4f 70  65 6e 2d 65 6e 64 65 64  |]; /* Open-ended|
00000e60  20 73 74 72 75 63 74 75  72 65 20 28 6e 6f 20 66  | structure (no f|
00000e70  69 78 65 64 20 73 69 7a  65 29 20 2a 2f 0a 7d 3b  |ixed size) */.};|
00000e80  0a 0a 2f 2a 20 73 74 72  75 63 74 20 70 72 6f 74  |../* struct prot|
00000e90  6f 74 79 70 65 0a 2a 2a  0a 2a 2a 20 20 20 50 6f  |otype.**.**   Po|
00000ea0  70 63 6f 72 6e 20 6d 61  69 6e 74 61 69 6e 73 20  |pcorn maintains |
00000eb0  61 20 6d 61 73 74 65 72  20 6c 69 73 74 20 6f 66  |a master list of|
00000ec0  20 70 72 6f 74 6f 74 79  70 65 73 20 77 68 69 63  | prototypes whic|
00000ed0  68 20 61 72 65 20 72 65  70 72 65 73 65 6e 74 65  |h are represente|
00000ee0  64 0a 2a 2a 20 20 20 62  79 20 74 68 65 73 65 20  |d.**   by these |
00000ef0  64 61 74 61 20 73 74 72  75 63 74 75 72 65 73 2e  |data structures.|
00000f00  20 20 45 61 63 68 20 70  72 6f 74 6f 74 79 70 65  |  Each prototype|
00000f10  20 68 61 73 20 61 20 75  6e 69 71 75 65 20 69 64  | has a unique id|
00000f20  2c 20 61 20 68 61 6e 64  6c 65 72 0a 2a 2a 20 20  |, a handler.**  |
00000f30  20 61 73 73 6f 63 69 61  74 65 64 20 77 69 74 68  | associated with|
00000f40  20 69 74 20 61 6e 64 20  61 20 73 65 74 20 6f 66  | it and a set of|
00000f50  20 6f 62 6a 65 63 74 20  66 6c 61 67 73 2e 20 20  | object flags.  |
00000f60  54 68 65 72 65 27 73 20  61 6c 73 6f 20 61 6e 20  |There's also an |
00000f70  61 6e 69 6d 61 74 69 6f  6e 0a 2a 2a 20 20 20 62  |animation.**   b|
00000f80  6c 6f 63 6b 20 61 74 74  61 63 68 65 64 2c 20 77  |lock attached, w|
00000f90  68 65 74 68 65 72 20 74  68 65 20 6f 62 6a 65 63  |hether the objec|
00000fa0  74 20 69 73 20 61 6e 69  6d 61 74 65 64 20 6f 72  |t is animated or|
00000fb0  20 6e 6f 74 2e 20 20 54  68 65 72 65 20 63 61 6e  | not.  There can|
00000fc0  20 62 65 0a 2a 2a 20 20  20 41 4e 59 20 6e 75 6d  | be.**   ANY num|
00000fd0  62 65 72 20 6f 66 20 66  72 61 6d 65 73 20 69 6e  |ber of frames in|
00000fe0  20 74 68 69 73 20 61 6e  69 6d 61 74 69 6f 6e 20  | this animation |
00000ff0  62 6c 6f 63 6b 20 28 30  20 6f 72 20 31 20 69 6e  |block (0 or 1 in|
00001000  63 6c 75 64 65 64 29 2e  0a 2a 2f 0a 73 74 72 75  |cluded)..*/.stru|
00001010  63 74 20 70 72 6f 74 6f  74 79 70 65 20 7b 0a 20  |ct prototype {. |
00001020  20 69 6e 74 20 20 20 20  20 20 20 20 20 20 20 20  | int            |
00001030  20 20 20 20 20 20 20 69  64 3b 0a 20 20 6f 62 6a  |       id;.  obj|
00001040  65 63 74 5f 68 61 6e 64  6c 65 72 20 20 20 20 20  |ect_handler     |
00001050  20 20 20 68 61 6e 64 6c  65 72 3b 0a 20 20 75 6e  |   handler;.  un|
00001060  69 6f 6e 20 6f 62 6a 65  63 74 5f 66 6c 61 67 73  |ion object_flags|
00001070  20 20 20 20 66 6c 61 67  73 3b 0a 20 20 73 74 72  |    flags;.  str|
00001080  75 63 74 20 61 6e 69 6d  61 74 65 5f 62 6c 6f 63  |uct animate_bloc|
00001090  6b 20 20 61 6e 69 6d 61  74 69 6f 6e 3b 0a 7d 3b  |k  animation;.};|
000010a0  0a 0a 2f 2a 20 73 74 72  75 63 74 20 67 61 6d 65  |../* struct game|
000010b0  5f 6f 62 6a 65 63 74 0a  2a 2a 0a 2a 2a 20 20 20  |_object.**.**   |
000010c0  45 61 63 68 20 6f 62 6a  65 63 74 20 69 6e 20 74  |Each object in t|
000010d0  68 65 20 67 61 6d 65 20  69 73 20 72 65 70 72 65  |he game is repre|
000010e0  73 65 6e 74 65 64 20 62  79 20 6f 6e 65 20 6f 66  |sented by one of|
000010f0  20 74 68 65 73 65 20 73  74 72 75 63 74 73 3b 0a  | these structs;.|
00001100  2a 2a 20 20 20 69 74 20  63 6f 6e 74 61 69 6e 73  |**   it contains|
00001110  20 74 68 65 20 70 6f 73  69 74 69 6f 6e 20 61 6e  | the position an|
00001120  64 20 73 70 65 65 64 20  6f 66 20 74 68 65 20 6f  |d speed of the o|
00001130  62 6a 65 63 74 20 77 69  74 68 69 6e 20 74 68 65  |bject within the|
00001140  20 70 6c 61 79 69 6e 67  0a 2a 2a 20 20 20 61 72  | playing.**   ar|
00001150  65 61 2c 20 61 6c 6f 6e  67 20 77 69 74 68 20 74  |ea, along with t|
00001160  68 65 20 27 68 61 6e 64  6c 65 72 27 20 66 75 6e  |he 'handler' fun|
00001170  63 74 69 6f 6e 2e 20 20  54 68 69 73 20 69 73 20  |ction.  This is |
00001180  63 61 6c 6c 65 64 20 77  68 65 6e 65 76 65 72 20  |called whenever |
00001190  74 68 65 0a 2a 2a 20 20  20 6f 62 6a 65 63 74 20  |the.**   object |
000011a0  72 65 71 75 69 72 65 73  20 27 61 74 74 65 6e 74  |requires 'attent|
000011b0  69 6f 6e 27 2c 20 77 68  69 63 68 20 69 73 20 73  |ion', which is s|
000011c0  65 74 20 62 79 20 74 68  65 20 66 6c 61 67 73 20  |et by the flags |
000011d0  65 78 70 6c 61 69 6e 65  64 20 61 62 6f 76 65 2e  |explained above.|
000011e0  0a 2a 2a 0a 2a 2f 0a 0a  73 74 72 75 63 74 20 67  |.**.*/..struct g|
000011f0  61 6d 65 5f 6f 62 6a 65  63 74 20 7b 0a 20 20 69  |ame_object {.  i|
00001200  6e 74 20 6f 62 6a 65 63  74 5f 69 64 3b 20 20 20  |nt object_id;   |
00001210  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001220  2f 2a 20 53 6f 6c 65 6c  79 20 66 6f 72 20 74 68  |/* Solely for th|
00001230  65 20 6f 62 6a 65 63 74  20 68 61 6e 64 6c 65 72  |e object handler|
00001240  20 2a 2f 0a 20 20 75 6e  69 6f 6e 20 7b 0a 20 20  | */.  union {.  |
00001250  20 20 76 6f 69 64 09 09  20 2a 2a 73 70 72 69 74  |  void.. **sprit|
00001260  65 5f 61 6e 63 68 6f 72  3b 0a 20 20 20 20 73 74  |e_anchor;.    st|
00001270  72 75 63 74 20 61 6e 69  6d 61 74 65 5f 62 6c 6f  |ruct animate_blo|
00001280  63 6b 20 20 2a 61 6e 69  6d 61 74 69 6f 6e 3b 0a  |ck  *animation;.|
00001290  20 20 7d 20 70 6c 6f 74  5f 69 64 3b 20 20 20 20  |  } plot_id;    |
000012a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000012b0  20 20 20 2f 2a 20 50 61  73 73 65 64 20 69 6e 20  |   /* Passed in |
000012c0  52 30 20 74 6f 20 73 70  72 69 74 65 20 70 6c 6f  |R0 to sprite plo|
000012d0  74 74 65 72 20 2a 2f 0a  20 20 6f 62 6a 65 63 74  |tter */.  object|
000012e0  5f 68 61 6e 64 6c 65 72  20 68 61 6e 64 6c 65 72  |_handler handler|
000012f0  3b 0a 20 20 69 6e 74 20  20 66 72 61 6d 65 3b 0a  |;.  int  frame;.|
00001300  20 20 75 6e 69 6f 6e 20  6f 62 6a 65 63 74 5f 66  |  union object_f|
00001310  6c 61 67 73 20 20 20 20  20 66 6c 61 67 73 3b 0a  |lags     flags;.|
00001320  20 20 69 6e 74 20 78 2c  20 79 2c 20 78 76 2c 20  |  int x, y, xv, |
00001330  79 76 3b 09 20 20 20 20  20 20 20 20 20 20 20 2f  |yv;.           /|
00001340  2a 20 4f 62 6a 65 63 74  20 63 6f 2d 6f 72 64 69  |* Object co-ordi|
00001350  6e 61 74 65 73 20 61 6e  64 20 76 65 6c 6f 63 69  |nates and veloci|
00001360  74 79 20 2a 2f 0a 20 20  73 74 72 75 63 74 20 7b  |ty */.  struct {|
00001370  0a 20 20 20 20 75 6e 73  69 67 6e 65 64 20 69 6e  |.    unsigned in|
00001380  74 20 76 61 6c 75 65 20  20 20 20 20 20 20 20 3a  |t value        :|
00001390  20 31 36 3b 0a 20 20 20  20 75 6e 73 69 67 6e 65  | 16;.    unsigne|
000013a0  64 20 69 6e 74 20 64 65  63 72 65 6d 65 6e 74 20  |d int decrement |
000013b0  20 20 20 3a 20 31 36 3b  0a 20 20 7d 20 74 69 6d  |   : 16;.  } tim|
000013c0  65 72 3b 0a 20 20 73 74  72 75 63 74 20 7b 0a 20  |er;.  struct {. |
000013d0  20 20 20 75 6e 73 69 67  6e 65 64 20 69 6e 74 20  |   unsigned int |
000013e0  78 20 20 20 20 20 20 20  20 20 20 20 20 3a 20 31  |x            : 1|
000013f0  36 3b 0a 20 20 20 20 75  6e 73 69 67 6e 65 64 20  |6;.    unsigned |
00001400  69 6e 74 20 79 09 20 20  20 20 20 20 3a 20 31 36  |int y.      : 16|
00001410  3b 0a 20 20 7d 20 73 69  7a 65 3b 0a 20 20 73 74  |;.  } size;.  st|
00001420  72 75 63 74 20 7b 0a 20  20 20 20 75 6e 73 69 67  |ruct {.    unsig|
00001430  6e 65 64 20 69 6e 74 20  78 20 20 20 20 20 20 20  |ned int x       |
00001440  20 20 20 20 20 3a 20 31  36 3b 0a 20 20 20 20 75  |     : 16;.    u|
00001450  6e 73 69 67 6e 65 64 20  69 6e 74 20 79 09 20 20  |nsigned int y.  |
00001460  20 20 20 20 3a 20 31 36  3b 0a 20 20 7d 20 70 6c  |    : 16;.  } pl|
00001470  6f 74 5f 6f 66 66 73 65  74 3b 0a 20 20 76 6f 69  |ot_offset;.  voi|
00001480  64 20 2a 75 73 65 72 5f  64 61 74 61 3b 0a 7d 3b  |d *user_data;.};|
00001490  0a 0a 2f 2a 20 73 74 72  75 63 74 20 63 6f 6c 6c  |../* struct coll|
000014a0  69 73 69 6f 6e 5f 6f 62  6a 65 63 74 0a 2a 2a 0a  |ision_object.**.|
000014b0  2a 2a 20 20 20 54 68 69  73 20 69 73 20 75 73 65  |**   This is use|
000014c0  64 20 6d 61 69 6e 6c 79  20 66 6f 72 20 69 6e 74  |d mainly for int|
000014d0  65 72 6e 61 6c 20 75 73  65 2c 20 73 6f 20 74 68  |ernal use, so th|
000014e0  61 74 20 74 68 65 20 63  6f 6c 6c 69 73 69 6f 6e  |at the collision|
000014f0  20 64 65 74 65 63 74 69  6f 6e 0a 2a 2a 20 20 20  | detection.**   |
00001500  72 6f 75 74 69 6e 65 73  20 63 61 6e 20 77 6f 72  |routines can wor|
00001510  6b 20 61 73 20 66 61 73  74 20 61 73 20 70 6f 73  |k as fast as pos|
00001520  73 69 62 6c 65 2e 20 20  49 74 20 63 6f 6e 74 61  |sible.  It conta|
00001530  69 6e 73 20 74 68 65 20  62 6f 75 6e 64 69 6e 67  |ins the bounding|
00001540  20 62 6f 78 0a 2a 2a 20  20 20 6f 66 20 65 61 63  | box.**   of eac|
00001550  68 20 6f 62 6a 65 63 74  2c 20 70 6c 75 73 20 61  |h object, plus a|
00001560  20 72 65 66 65 72 65 6e  63 65 20 62 61 63 6b 20  | reference back |
00001570  74 6f 20 74 68 65 20 6f  62 6a 65 63 74 73 20 68  |to the objects h|
00001580  61 6e 64 6c 65 72 20 69  6e 20 63 61 73 65 0a 2a  |andler in case.*|
00001590  2a 20 20 20 61 6e 79 20  63 6f 6c 6c 69 73 69 6f  |*   any collisio|
000015a0  6e 73 20 68 61 70 70 65  6e 2e 20 20 41 20 74 61  |ns happen.  A ta|
000015b0  62 6c 65 20 6f 66 20 74  68 65 73 65 20 73 74 72  |ble of these str|
000015c0  75 63 74 73 20 69 73 20  62 75 69 6c 74 20 75 70  |ucts is built up|
000015d0  20 61 74 20 74 68 65 0a  2a 2a 20 20 20 68 65 61  | at the.**   hea|
000015e0  64 20 6f 66 20 65 61 63  68 20 74 61 62 6c 65 2c  |d of each table,|
000015f0  20 73 6f 20 74 68 61 74  20 74 68 65 73 65 20 74  | so that these t|
00001600  61 62 6c 65 73 20 63 61  6e 20 62 65 20 63 72 6f  |ables can be cro|
00001610  73 73 2d 72 65 66 65 72  65 6e 63 65 64 20 65 61  |ss-referenced ea|
00001620  73 69 6c 79 2e 0a 2a 2a  0a 2a 2a 20 20 20 43 68  |sily..**.**   Ch|
00001630  65 63 6b 69 6e 67 20 35  30 20 6f 62 6a 65 63 74  |ecking 50 object|
00001640  73 20 61 67 61 69 6e 73  74 20 35 30 20 6f 74 68  |s against 50 oth|
00001650  65 72 20 6f 62 6a 65 63  74 73 20 72 65 71 75 69  |er objects requi|
00001660  72 65 73 20 32 35 30 30  20 63 68 65 63 6b 73 2c  |res 2500 checks,|
00001670  20 73 6f 0a 2a 2a 20 20  20 77 65 20 6e 65 65 64  | so.**   we need|
00001680  20 74 6f 20 77 6f 72 6b  20 61 73 20 71 75 69 63  | to work as quic|
00001690  6b 6c 79 20 61 73 20 70  6f 73 73 69 62 6c 65 2e  |kly as possible.|
000016a0  0a 2a 2f 0a 0a 2f 2a 20  73 74 72 75 63 74 20 63  |.*/../* struct c|
000016b0  6f 6c 6c 69 73 69 6f 6e  5f 6f 62 6a 65 63 74 0a  |ollision_object.|
000016c0  2a 2a 0a 2a 2a 20 20 20  4d 69 6e 69 6d 61 6c 20  |**.**   Minimal |
000016d0  69 6e 66 6f 72 6d 61 74  69 6f 6e 20 66 6f 72 20  |information for |
000016e0  66 61 73 74 65 72 20 63  6f 6c 6c 69 73 69 6f 6e  |faster collision|
000016f0  20 64 65 74 65 63 74 69  6f 6e 2e 0a 2a 2f 0a 73  | detection..*/.s|
00001700  74 72 75 63 74 20 63 6f  6c 6c 69 73 69 6f 6e 5f  |truct collision_|
00001710  6f 62 6a 65 63 74 0a 7b  0a 20 20 69 6e 74 20 78  |object.{.  int x|
00001720  30 2c 20 79 30 2c 20 78  31 2c 20 79 31 3b 0a 20  |0, y0, x1, y1;. |
00001730  20 73 74 72 75 63 74 20  67 61 6d 65 5f 6f 62 6a  | struct game_obj|
00001740  65 63 74 20 2a 62 61 63  6b 5f 70 74 72 3b 0a 7d  |ect *back_ptr;.}|
00001750  3b 0a 0a 2f 2a 20 73 74  72 75 63 74 20 63 6f 6c  |;../* struct col|
00001760  6c 69 73 69 6f 6e 5f 74  61 62 6c 65 0a 2a 2a 0a  |lision_table.**.|
00001770  2a 2a 20 20 20 41 20 73  6d 61 6c 6c 65 72 20 76  |**   A smaller v|
00001780  65 72 73 69 6f 6e 20 6f  66 20 27 73 74 72 75 63  |ersion of 'struc|
00001790  74 20 6f 62 6a 65 63 74  5f 74 61 62 6c 65 27 2c  |t object_table',|
000017a0  20 62 65 6c 6f 77 2c 20  62 75 74 20 63 6f 6e 74  | below, but cont|
000017b0  61 69 6e 73 20 6f 6e 6c  79 0a 2a 2a 20 20 20 74  |ains only.**   t|
000017c0  68 65 20 69 6e 66 6f 72  6d 61 74 69 6f 6e 20 6e  |he information n|
000017d0  65 63 65 73 73 61 72 79  20 66 6f 72 20 63 6f 6c  |ecessary for col|
000017e0  6c 69 73 69 6f 6e 20 64  65 74 65 63 74 69 6f 6e  |lision detection|
000017f0  2e 0a 2a 2f 0a 73 74 72  75 63 74 20 63 6f 6c 6c  |..*/.struct coll|
00001800  69 73 69 6f 6e 5f 74 61  62 6c 65 0a 7b 0a 20 20  |ision_table.{.  |
00001810  69 6e 74 20 20 20 20 20  20 20 20 20 20 20 20 20  |int             |
00001820  20 20 20 20 20 20 20 20  65 6e 74 72 69 65 73 3b  |        entries;|
00001830  0a 20 20 73 74 72 75 63  74 20 63 6f 6c 6c 69 73  |.  struct collis|
00001840  69 6f 6e 5f 6f 62 6a 65  63 74 20 63 6f 6c 6c 69  |ion_object colli|
00001850  73 69 6f 6e 5b 31 5d 3b  0a 7d 3b 0a 0a 2f 2a 20  |sion[1];.};../* |
00001860  73 74 72 75 63 74 20 6f  62 6a 65 63 74 5f 74 61  |struct object_ta|
00001870  62 6c 65 0a 2a 2a 0a 2a  2a 20 20 20 54 68 69 73  |ble.**.**   This|
00001880  20 69 73 20 74 68 65 20  68 65 61 64 65 72 20 74  | is the header t|
00001890  6f 20 61 20 74 61 62 6c  65 20 6f 66 20 67 61 6d  |o a table of gam|
000018a0  65 5f 6f 62 6a 65 63 74  20 73 74 72 75 63 74 73  |e_object structs|
000018b0  2c 20 61 73 20 64 65 66  69 6e 65 64 20 61 62 6f  |, as defined abo|
000018c0  76 65 2e 0a 2a 2a 20 20  20 49 74 20 63 6f 6e 74  |ve..**   It cont|
000018d0  61 69 6e 73 20 74 68 65  20 6e 75 6d 62 65 72 20  |ains the number |
000018e0  6f 66 20 65 6e 74 72 69  65 73 20 75 73 65 64 20  |of entries used |
000018f0  73 6f 20 66 61 72 3b 20  77 68 65 6e 20 74 68 69  |so far; when thi|
00001900  73 20 72 65 61 63 68 65  73 20 74 68 65 0a 2a 2a  |s reaches the.**|
00001910  20 20 20 6d 61 78 69 6d  75 6d 20 6e 75 6d 62 65  |   maximum numbe|
00001920  72 20 66 6f 72 20 74 68  61 74 20 74 61 62 6c 65  |r for that table|
00001930  2c 20 69 74 20 73 74 61  72 74 73 20 6c 6f 6f 6b  |, it starts look|
00001940  69 6e 67 20 66 6f 72 20  68 6f 6c 65 73 20 69 6e  |ing for holes in|
00001950  20 69 74 20 74 6f 0a 2a  2a 20 20 20 66 69 6c 6c  | it to.**   fill|
00001960  20 77 69 74 68 20 6e 65  77 20 6f 62 6a 65 63 74  | with new object|
00001970  73 2e 20 20 52 65 67 75  6c 61 72 20 75 73 65 20  |s.  Regular use |
00001980  6f 66 20 50 6f 70 63 6f  72 6e 5f 54 69 64 79 20  |of Popcorn_Tidy |
00001990  77 69 6c 6c 20 6d 69 6e  69 6d 69 73 65 0a 2a 2a  |will minimise.**|
000019a0  20 20 20 74 68 65 73 65  20 68 6f 6c 65 73 2e 0a  |   these holes..|
000019b0  2a 2f 0a 0a 73 74 72 75  63 74 20 6f 62 6a 65 63  |*/..struct objec|
000019c0  74 5f 74 61 62 6c 65 0a  7b 0a 20 20 69 6e 74 20  |t_table.{.  int |
000019d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000019e0  20 20 20 20 20 68 65 61  64 65 72 3b 0a 20 20 69  |     header;.  i|
000019f0  6e 74 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |nt              |
00001a00  20 20 20 20 20 20 20 20  6d 61 78 5f 6f 62 6a 65  |        max_obje|
00001a10  63 74 73 2c 20 6e 65 78  74 5f 66 72 65 65 3b 0a  |cts, next_free;.|
00001a20  20 20 69 6e 74 09 09 09  20 20 20 67 72 61 76 5f  |  int...   grav_|
00001a30  78 2c 20 67 72 61 76 5f  79 3b 0a 20 20 73 74 72  |x, grav_y;.  str|
00001a40  75 63 74 20 63 6f 6c 6c  69 73 69 6f 6e 5f 74 61  |uct collision_ta|
00001a50  62 6c 65 20 20 20 2a 63  6f 6c 6c 69 73 69 6f 6e  |ble   *collision|
00001a60  73 3b 0a 20 20 73 74 72  75 63 74 20 67 61 6d 65  |s;.  struct game|
00001a70  5f 6f 62 6a 65 63 74 20  20 20 20 20 20 20 6f 62  |_object       ob|
00001a80  6a 65 63 74 5b 31 5d 3b  0a 7d 3b 0a 0a 2f 2a 20  |ject[1];.};../* |
00001a90  50 6f 70 63 6f 72 6e 5f  43 6f 6c 6c 69 73 69 6f  |Popcorn_Collisio|
00001aa0  6e 43 68 65 63 6b 0a 2a  2a 0a 2a 2a 20 20 20 43  |nCheck.**.**   C|
00001ab0  61 6c 6c 20 74 68 69 73  20 74 6f 20 63 68 65 63  |all this to chec|
00001ac0  6b 20 77 68 65 74 68 65  72 20 6f 62 6a 65 63 74  |k whether object|
00001ad0  73 20 69 6e 20 74 77 6f  20 74 61 62 6c 65 73 20  |s in two tables |
00001ae0  68 61 76 65 20 63 6f 6c  6c 69 64 65 64 2e 20 20  |have collided.  |
00001af0  4f 6e 6c 79 0a 2a 2a 20  20 20 6f 62 6a 65 63 74  |Only.**   object|
00001b00  73 20 66 6f 72 20 77 68  69 63 68 20 74 68 65 20  |s for which the |
00001b10  63 6f 6c 6c 69 64 65 20  66 6c 61 67 20 68 61 73  |collide flag has|
00001b20  20 62 65 65 6e 20 73 65  74 20 77 69 6c 6c 20 62  | been set will b|
00001b30  65 20 63 68 65 63 6b 65  64 2e 0a 2a 2a 20 20 20  |e checked..**   |
00001b40  49 66 20 61 20 63 6f 6c  6c 69 73 69 6f 6e 20 69  |If a collision i|
00001b50  73 20 66 6f 75 6e 64 2c  20 74 68 65 20 68 61 6e  |s found, the han|
00001b60  64 6c 65 72 73 20 69 6e  20 74 61 62 6c 65 31 20  |dlers in table1 |
00001b70  4f 4e 4c 59 20 77 69 6c  6c 20 62 65 20 63 61 6c  |ONLY will be cal|
00001b80  6c 65 64 2e 0a 2a 2f 0a  65 78 74 65 72 6e 20 76  |led..*/.extern v|
00001b90  6f 69 64 20 50 6f 70 63  6f 72 6e 5f 43 6f 6c 6c  |oid Popcorn_Coll|
00001ba0  69 73 69 6f 6e 43 68 65  63 6b 28 73 74 72 75 63  |isionCheck(struc|
00001bb0  74 20 6f 62 6a 65 63 74  5f 74 61 62 6c 65 2a 20  |t object_table* |
00001bc0  74 61 62 6c 65 31 2c 20  73 74 72 75 63 74 20 6f  |table1, struct o|
00001bd0  62 6a 65 63 74 5f 74 61  62 6c 65 2a 20 74 61 62  |bject_table* tab|
00001be0  6c 65 32 29 3b 0a 0a 2f  2a 20 50 6f 70 63 6f 72  |le2);../* Popcor|
00001bf0  6e 5f 43 6c 65 61 72 53  63 72 65 65 6e 0a 2a 2a  |n_ClearScreen.**|
00001c00  0a 2a 2a 20 20 20 43 6c  65 61 72 73 20 74 68 65  |.**   Clears the|
00001c10  20 73 63 72 65 65 6e 20  6d 65 6d 6f 72 79 20 74  | screen memory t|
00001c20  6f 20 61 20 70 61 72 74  69 63 75 6c 61 72 20 63  |o a particular c|
00001c30  6f 6c 6f 75 72 2e 0a 2a  2f 0a 76 6f 69 64 09 20  |olour..*/.void. |
00001c40  50 6f 70 63 6f 72 6e 5f  43 6c 65 61 72 53 63 72  |Popcorn_ClearScr|
00001c50  65 65 6e 28 69 6e 74 20  63 6f 6c 6f 75 72 29 3b  |een(int colour);|
00001c60  0a 0a 2f 2a 0a 2a 2a 20  50 6f 70 63 6f 72 6e 5f  |../*.** Popcorn_|
00001c70  44 65 6c 65 74 65 4f 62  6a 65 63 74 0a 2a 2a 0a  |DeleteObject.**.|
00001c80  2a 2a 20 20 20 4f 6e 6c  79 20 6e 65 65 64 73 20  |**   Only needs |
00001c90  74 6f 20 62 65 20 61 20  6d 61 63 72 6f 2c 20 74  |to be a macro, t|
00001ca0  68 69 73 20 6f 6e 65 3a  20 69 74 20 6a 75 73 74  |his one: it just|
00001cb0  20 73 65 74 73 20 74 68  65 20 6f 62 6a 65 63 74  | sets the object|
00001cc0  5f 69 64 20 74 6f 0a 2a  2a 20 20 20 7a 65 72 6f  |_id to.**   zero|
00001cd0  2c 20 61 6e 64 20 74 68  65 20 70 72 6f 63 65 73  |, and the proces|
00001ce0  73 69 6e 67 20 66 75 6e  63 74 69 6f 6e 20 73 65  |sing function se|
00001cf0  65 73 20 69 74 20 61 73  20 61 20 68 6f 6c 65 20  |es it as a hole |
00001d00  69 6e 20 74 68 65 20 74  61 62 6c 65 2e 0a 2a 2f  |in the table..*/|
00001d10  0a 23 64 65 66 69 6e 65  20 50 6f 70 63 6f 72 6e  |.#define Popcorn|
00001d20  5f 44 65 6c 65 74 65 4f  62 6a 65 63 74 28 6f 29  |_DeleteObject(o)|
00001d30  20 28 6f 29 2d 3e 6f 62  6a 65 63 74 5f 69 64 20  | (o)->object_id |
00001d40  3d 20 30 3b 0a 0a 2f 2a  20 50 6f 70 63 6f 72 6e  |= 0;../* Popcorn|
00001d50  5f 46 69 6e 64 52 65 73  6f 75 72 63 65 0a 2a 2a  |_FindResource.**|
00001d60  0a 2a 2a 20 20 20 54 68  69 73 20 63 61 6c 6c 20  |.**   This call |
00001d70  77 69 6c 6c 20 72 65 74  75 72 6e 20 61 6e 20 61  |will return an a|
00001d80  64 64 72 65 73 73 20 70  6f 69 6e 74 65 72 20 66  |ddress pointer f|
00001d90  6f 72 20 74 68 65 20 72  65 73 6f 75 72 63 65 20  |or the resource |
00001da0  73 70 65 63 69 66 69 65  64 20 69 6e 0a 2a 2a 20  |specified in.** |
00001db0  20 20 27 72 65 73 5f 6e  61 6d 65 27 2c 20 70 72  |  'res_name', pr|
00001dc0  6f 76 69 64 69 6e 67 20  79 6f 75 20 68 61 76 65  |oviding you have|
00001dd0  20 63 61 6c 6c 65 64 20  50 6f 70 63 6f 72 6e 5f  | called Popcorn_|
00001de0  4c 6f 61 64 52 65 73 6f  75 72 63 65 46 69 6c 65  |LoadResourceFile|
00001df0  20 65 61 72 6c 69 65 72  0a 2a 2a 20 20 20 61 6e  | earlier.**   an|
00001e00  64 20 74 68 65 20 72 65  73 6f 75 72 63 65 20 68  |d the resource h|
00001e10  61 73 20 62 65 65 6e 20  6c 6f 61 64 65 64 2e 20  |as been loaded. |
00001e20  20 4f 74 68 65 72 77 69  73 65 20 61 20 4e 55 4c  | Otherwise a NUL|
00001e30  4c 20 70 6f 69 6e 74 65  72 20 69 73 20 72 65 74  |L pointer is ret|
00001e40  75 72 6e 65 64 2e 0a 2a  2f 0a 76 6f 69 64 20 20  |urned..*/.void  |
00001e50  20 20 2a 2a 50 6f 70 63  6f 72 6e 5f 46 69 6e 64  |  **Popcorn_Find|
00001e60  52 65 73 6f 75 72 63 65  28 63 68 61 72 20 2a 72  |Resource(char *r|
00001e70  65 73 5f 6e 61 6d 65 29  3b 0a 0a 2f 2a 20 50 6f  |es_name);../* Po|
00001e80  70 63 6f 72 6e 5f 46 69  6e 64 53 79 6d 62 6f 6c  |pcorn_FindSymbol|
00001e90  0a 2a 2a 0a 2a 2a 20 20  20 43 61 6c 6c 20 77 68  |.**.**   Call wh|
00001ea0  69 63 68 20 66 69 6e 64  73 20 74 68 65 20 61 64  |ich finds the ad|
00001eb0  64 72 65 73 73 20 6f 66  20 61 20 73 79 6d 62 6f  |dress of a symbo|
00001ec0  6c 20 69 6e 20 61 20 70  72 6f 67 72 61 6d 3b 20  |l in a program; |
00001ed0  69 74 20 72 65 74 75 72  6e 73 20 74 68 65 0a 2a  |it returns the.*|
00001ee0  2a 20 20 20 6f 62 6a 65  63 74 5f 68 61 6e 64 6c  |*   object_handl|
00001ef0  65 72 20 74 79 70 65 20  62 65 63 61 75 73 65 20  |er type because |
00001f00  74 68 69 73 20 69 73 20  69 74 73 20 6d 61 69 6e  |this is its main|
00001f10  20 75 73 65 2e 20 20 42  65 66 6f 72 65 20 63 61  | use.  Before ca|
00001f20  6c 6c 69 6e 67 20 74 68  69 73 2c 0a 2a 2a 20 20  |lling this,.**  |
00001f30  20 79 6f 75 20 6d 75 73  74 20 73 65 74 20 27 73  | you must set 's|
00001f40  79 6d 62 6f 6c 5f 74 61  62 6c 65 5f 66 69 6c 65  |ymbol_table_file|
00001f50  6e 61 6d 65 27 20 74 6f  20 62 65 20 74 68 65 20  |name' to be the |
00001f60  66 69 6c 65 6e 61 6d 65  20 6f 66 20 74 68 65 20  |filename of the |
00001f70  73 79 6d 62 6f 6c 0a 2a  2a 20 20 20 74 61 62 6c  |symbol.**   tabl|
00001f80  65 20 70 72 6f 64 75 63  65 64 20 62 79 20 74 68  |e produced by th|
00001f90  65 20 6c 69 6e 6b 65 72  2e 0a 2a 2f 0a 6f 62 6a  |e linker..*/.obj|
00001fa0  65 63 74 5f 68 61 6e 64  6c 65 72 20 50 6f 70 63  |ect_handler Popc|
00001fb0  6f 72 6e 5f 46 69 6e 64  53 79 6d 62 6f 6c 28 63  |orn_FindSymbol(c|
00001fc0  68 61 72 20 2a 6e 61 6d  65 29 3b 0a 0a 2f 2a 20  |har *name);../* |
00001fd0  50 6f 70 63 6f 72 6e 5f  4c 6f 61 64 47 72 6f 75  |Popcorn_LoadGrou|
00001fe0  70 0a 2a 2a 0a 2a 2a 20  20 20 54 68 69 73 20 63  |p.**.**   This c|
00001ff0  61 6c 6c 20 66 69 6e 64  73 20 61 6c 6c 20 74 68  |all finds all th|
00002000  65 20 72 65 73 6f 75 72  63 65 73 20 77 69 74 68  |e resources with|
00002010  20 61 20 73 70 65 63 69  66 69 65 64 20 49 44 2c  | a specified ID,|
00002020  20 61 6e 64 20 6c 6f 61  64 73 20 74 68 65 6d 0a  | and loads them.|
00002030  2a 2a 20 20 20 69 6e 74  6f 20 6d 65 6d 6f 72 79  |**   into memory|
00002040  2e 20 20 41 6e 20 65 72  72 6f 72 20 69 73 20 72  |.  An error is r|
00002050  65 74 75 72 6e 65 64 20  69 66 20 61 6c 6c 20 6f  |eturned if all o|
00002060  66 20 74 68 65 6d 20 68  61 76 65 20 6e 6f 74 20  |f them have not |
00002070  62 65 65 6e 20 6c 6f 61  64 65 64 2e 0a 2a 2f 0a  |been loaded..*/.|
00002080  6f 73 5f 65 72 72 6f 72  20 2a 50 6f 70 63 6f 72  |os_error *Popcor|
00002090  6e 5f 4c 6f 61 64 47 72  6f 75 70 28 69 6e 74 20  |n_LoadGroup(int |
000020a0  69 64 29 3b 0a 0a 2f 2a  20 50 6f 70 63 6f 72 6e  |id);../* Popcorn|
000020b0  5f 4c 6f 61 64 50 72 6f  74 6f 74 79 70 65 73 0a  |_LoadPrototypes.|
000020c0  2a 2a 0a 2a 2a 20 20 20  53 68 6f 75 6c 64 20 6f  |**.**   Should o|
000020d0  6e 6c 79 20 62 65 20 63  61 6c 6c 65 64 20 61 74  |nly be called at|
000020e0  20 6f 6e 63 65 2c 20 74  6f 20 6c 6f 61 64 20 74  | once, to load t|
000020f0  68 65 20 67 6c 6f 62 61  6c 20 6c 69 73 74 20 6f  |he global list o|
00002100  66 20 70 72 6f 74 6f 74  79 70 65 73 0a 2a 2a 20  |f prototypes.** |
00002110  20 20 66 6f 72 20 61 6e  20 61 70 70 6c 69 63 61  |  for an applica|
00002120  74 69 6f 6e 2e 0a 2a 2f  0a 6f 73 5f 65 72 72 6f  |tion..*/.os_erro|
00002130  72 20 2a 50 6f 70 63 6f  72 6e 5f 4c 6f 61 64 50  |r *Popcorn_LoadP|
00002140  72 6f 74 6f 74 79 70 65  73 28 63 68 61 72 20 2a  |rototypes(char *|
00002150  66 69 6c 65 6e 61 6d 65  29 3b 0a 0a 2f 2a 20 50  |filename);../* P|
00002160  6f 70 63 6f 72 6e 5f 4c  6f 61 64 52 65 73 6f 75  |opcorn_LoadResou|
00002170  72 63 65 46 69 6c 65 0a  2a 2a 0a 2a 2a 20 20 20  |rceFile.**.**   |
00002180  54 68 69 73 20 66 75 6e  63 74 69 6f 6e 20 69 6e  |This function in|
00002190  69 74 69 61 6c 69 73 65  73 20 74 68 65 20 72 65  |itialises the re|
000021a0  73 6f 75 72 63 65 20 6d  61 6e 61 67 69 6e 67 20  |source managing |
000021b0  72 6f 75 74 69 6e 65 73  3b 20 61 6c 6c 20 74 68  |routines; all th|
000021c0  65 0a 2a 2a 20 20 20 66  69 6c 65 20 73 68 6f 75  |e.**   file shou|
000021d0  6c 64 20 63 6f 6e 74 61  69 6e 20 69 73 20 61 20  |ld contain is a |
000021e0  6c 69 73 74 20 6f 66 20  67 72 6f 75 70 2f 72 65  |list of group/re|
000021f0  73 6f 75 72 63 65 20 70  61 69 72 73 2e 20 20 4e  |source pairs.  N|
00002200  6f 6e 65 20 6f 66 20 74  68 65 0a 2a 2a 20 20 20  |one of the.**   |
00002210  72 65 73 6f 75 72 63 65  73 20 77 69 6c 6c 20 62  |resources will b|
00002220  65 20 6c 6f 61 64 65 64  20 69 6e 74 6f 20 6d 65  |e loaded into me|
00002230  6d 6f 72 79 20 75 6e 74  69 6c 20 50 6f 70 63 6f  |mory until Popco|
00002240  72 6e 5f 4c 6f 61 64 47  72 6f 75 70 28 29 20 69  |rn_LoadGroup() i|
00002250  73 0a 2a 2a 20 20 20 63  61 6c 6c 65 64 20 77 69  |s.**   called wi|
00002260  74 68 20 61 20 76 61 6c  69 64 20 49 44 2e 0a 2a  |th a valid ID..*|
00002270  2f 0a 6f 73 5f 65 72 72  6f 72 20 2a 50 6f 70 63  |/.os_error *Popc|
00002280  6f 72 6e 5f 4c 6f 61 64  52 65 73 6f 75 72 63 65  |orn_LoadResource|
00002290  46 69 6c 65 28 63 68 61  72 20 2a 66 69 6c 65 6e  |File(char *filen|
000022a0  61 6d 65 29 3b 0a 0a 2f  2a 20 50 6f 70 63 6f 72  |ame);../* Popcor|
000022b0  6e 5f 4c 6f 73 65 47 72  6f 75 70 0a 2a 2a 0a 2a  |n_LoseGroup.**.*|
000022c0  2a 20 20 20 54 68 69 73  20 63 61 6c 6c 20 64 65  |*   This call de|
000022d0  6c 65 74 65 73 20 28 69  2e 65 2e 20 66 72 65 65  |letes (i.e. free|
000022e0  73 20 74 68 65 20 6d 65  6d 6f 72 79 20 75 73 65  |s the memory use|
000022f0  64 20 62 79 29 20 61 6c  6c 20 74 68 65 20 72 65  |d by) all the re|
00002300  73 6f 75 72 63 65 73 0a  2a 2a 20 20 20 77 69 74  |sources.**   wit|
00002310  68 20 61 20 73 70 65 63  69 66 69 65 64 20 67 72  |h a specified gr|
00002320  6f 75 70 20 49 44 2e 0a  2a 2f 0a 76 6f 69 64 20  |oup ID..*/.void |
00002330  50 6f 70 63 6f 72 6e 5f  4c 6f 73 65 47 72 6f 75  |Popcorn_LoseGrou|
00002340  70 28 69 6e 74 20 69 64  29 3b 0a 0a 2f 2a 20 50  |p(int id);../* P|
00002350  6f 70 63 6f 72 6e 5f 4e  65 77 4f 62 6a 65 63 74  |opcorn_NewObject|
00002360  0a 2a 2a 0a 2a 2a 20 20  20 54 68 69 73 20 66 75  |.**.**   This fu|
00002370  6e 63 74 69 6f 6e 20 66  69 6e 64 73 20 61 20 73  |nction finds a s|
00002380  70 61 63 65 20 69 6e 20  61 20 73 70 65 63 69 66  |pace in a specif|
00002390  69 65 64 20 74 61 62 6c  65 20 66 6f 72 20 61 20  |ied table for a |
000023a0  6e 65 77 20 6f 62 6a 65  63 74 2c 0a 2a 2a 20 20  |new object,.**  |
000023b0  20 72 65 74 75 72 6e 69  6e 67 20 4e 55 4c 4c 20  | returning NULL |
000023c0  69 66 20 74 68 65 20 74  61 62 6c 65 20 69 73 20  |if the table is |
000023d0  66 75 6c 6c 2e 0a 2a 2f  0a 65 78 74 65 72 6e 20  |full..*/.extern |
000023e0  73 74 72 75 63 74 20 67  61 6d 65 5f 6f 62 6a 65  |struct game_obje|
000023f0  63 74 2a 20 50 6f 70 63  6f 72 6e 5f 4e 65 77 4f  |ct* Popcorn_NewO|
00002400  62 6a 65 63 74 28 73 74  72 75 63 74 20 6f 62 6a  |bject(struct obj|
00002410  65 63 74 5f 74 61 62 6c  65 20 2a 74 61 62 6c 65  |ect_table *table|
00002420  29 3b 0a 0a 2f 2a 20 50  6f 70 63 6f 72 6e 5f 4e  |);../* Popcorn_N|
00002430  65 77 50 72 6f 74 6f 74  79 70 65 0a 2a 2a 0a 2a  |ewPrototype.**.*|
00002440  2a 20 20 20 54 68 69 73  20 66 75 6e 63 74 69 6f  |*   This functio|
00002450  6e 20 63 72 65 61 74 65  73 20 61 6e 20 6f 62 6a  |n creates an obj|
00002460  65 63 74 20 77 69 74 68  20 50 6f 70 63 6f 72 6e  |ect with Popcorn|
00002470  5f 4e 65 77 4f 62 6a 65  63 74 20 74 68 65 6e 20  |_NewObject then |
00002480  66 69 6c 6c 73 0a 2a 2a  20 20 20 69 6e 20 74 68  |fills.**   in th|
00002490  65 20 66 6c 61 67 73 20  61 6e 64 20 61 6e 69 6d  |e flags and anim|
000024a0  61 74 69 6f 6e 20 64 65  74 61 69 6c 73 20 66 72  |ation details fr|
000024b0  6f 6d 20 74 68 65 20 73  70 65 63 69 66 69 65 64  |om the specified|
000024c0  20 70 72 6f 74 6f 74 79  70 65 0a 2a 2a 20 20 20  | prototype.**   |
000024d0  6e 61 6d 65 2e 20 20 54  68 65 20 76 65 6c 6f 63  |name.  The veloc|
000024e0  69 74 69 65 73 20 61 6e  64 20 74 69 6d 65 72 20  |ities and timer |
000024f0  61 72 65 20 7a 65 72 6f  65 64 2c 20 61 6e 64 20  |are zeroed, and |
00002500  73 68 6f 75 6c 64 20 62  65 20 66 69 6c 6c 65 64  |should be filled|
00002510  20 69 6e 0a 2a 2a 20 20  20 62 79 20 74 68 65 20  | in.**   by the |
00002520  70 72 6f 67 72 61 6d 20  69 66 20 6e 65 63 65 73  |program if neces|
00002530  73 61 72 79 2e 0a 2a 2f  0a 65 78 74 65 72 6e 20  |sary..*/.extern |
00002540  73 74 72 75 63 74 20 67  61 6d 65 5f 6f 62 6a 65  |struct game_obje|
00002550  63 74 2a 20 50 6f 70 63  6f 72 6e 5f 4e 65 77 50  |ct* Popcorn_NewP|
00002560  72 6f 74 6f 74 79 70 65  28 73 74 72 75 63 74 20  |rototype(struct |
00002570  6f 62 6a 65 63 74 5f 74  61 62 6c 65 20 2a 74 61  |object_table *ta|
00002580  62 6c 65 2c 0a 20 20 20  20 20 20 20 09 20 20 20  |ble,.       .   |
00002590  20 20 20 09 09 20 20 20  09 09 09 20 69 6e 74 20  |   ..   ... int |
000025a0  20 20 20 70 72 6f 74 6f  74 79 70 65 5f 69 64 2c  |   prototype_id,|
000025b0  0a 20 20 20 20 20 20 20  09 20 20 20 20 20 20 09  |.       .      .|
000025c0  09 20 20 20 09 09 09 20  69 6e 74 09 78 2c 0a 20  |.   ... int.x,. |
000025d0  20 20 20 20 20 20 09 20  20 20 20 20 20 09 09 20  |      .      .. |
000025e0  20 20 09 09 09 20 69 6e  74 09 79 29 3b 0a 0a 2f  |  ... int.y);../|
000025f0  2a 20 50 6f 70 63 6f 72  6e 5f 4e 65 77 54 61 62  |* Popcorn_NewTab|
00002600  6c 65 0a 2a 2a 0a 2a 2a  20 20 20 54 68 69 73 20  |le.**.**   This |
00002610  66 75 6e 63 74 69 6f 6e  20 61 6c 6c 6f 63 61 74  |function allocat|
00002620  65 73 20 73 70 61 63 65  20 66 6f 72 20 61 20 6e  |es space for a n|
00002630  65 77 20 6f 62 6a 65 63  74 20 74 61 62 6c 65 2c  |ew object table,|
00002640  20 61 6c 6c 6f 77 69 6e  67 20 66 6f 72 0a 2a 2a  | allowing for.**|
00002650  20 20 20 61 20 6d 61 78  69 6d 75 6d 20 6f 66 20  |   a maximum of |
00002660  6d 61 78 5f 6f 62 6a 65  63 74 73 20 61 6e 64 20  |max_objects and |
00002670  61 6c 6c 6f 77 69 6e 67  20 66 6f 72 20 63 6f 6c  |allowing for col|
00002680  6c 69 73 69 6f 6e 20 64  65 74 65 63 74 69 6f 6e  |lision detection|
00002690  20 6f 6e 0a 2a 2a 20 20  20 74 68 65 20 74 61 62  | on.**   the tab|
000026a0  6c 65 20 6f 6e 6c 79 20  69 66 20 28 63 6f 6c 6c  |le only if (coll|
000026b0  69 73 69 6f 6e 73 20 3d  3d 20 54 52 55 45 29 2e  |isions == TRUE).|
000026c0  0a 2a 2f 0a 65 78 74 65  72 6e 20 73 74 72 75 63  |.*/.extern struc|
000026d0  74 20 6f 62 6a 65 63 74  5f 74 61 62 6c 65 2a 20  |t object_table* |
000026e0  50 6f 70 63 6f 72 6e 5f  4e 65 77 54 61 62 6c 65  |Popcorn_NewTable|
000026f0  28 69 6e 74 20 6d 61 78  5f 6f 62 6a 65 63 74 73  |(int max_objects|
00002700  2c 0a 09 09 09 09 09 20  20 20 20 20 42 4f 4f 4c  |,......     BOOL|
00002710  20 63 6f 6c 6c 69 73 69  6f 6e 73 29 3b 0a 0a 2f  | collisions);../|
00002720  2a 20 50 6f 70 63 6f 72  6e 5f 4f 75 74 73 69 64  |* Popcorn_Outsid|
00002730  65 0a 2a 2a 0a 2a 2a 20  20 20 52 65 74 75 72 6e  |e.**.**   Return|
00002740  73 20 54 52 55 45 20 69  66 20 61 20 67 69 76 65  |s TRUE if a give|
00002750  6e 20 6f 62 6a 65 63 74  20 28 77 69 74 68 20 63  |n object (with c|
00002760  6f 2d 6f 72 64 69 6e 61  74 65 73 20 73 68 69 66  |o-ordinates shif|
00002770  74 65 64 20 3c 3c 20 31  32 2c 20 72 65 6d 65 6d  |ted << 12, remem|
00002780  62 65 72 29 0a 2a 2a 20  20 20 69 73 20 6f 75 74  |ber).**   is out|
00002790  73 69 64 65 20 61 20 63  65 72 74 61 69 6e 20 77  |side a certain w|
000027a0  69 6e 64 6f 77 20 28 63  6f 2d 6f 72 64 69 6e 61  |indow (co-ordina|
000027b0  74 65 73 20 73 70 65 63  69 66 69 65 64 20 61 73  |tes specified as|
000027c0  20 73 63 72 65 65 6e 20  70 69 78 65 6c 73 29 2e  | screen pixels).|
000027d0  0a 2a 2a 20 20 20 49 6e  74 65 72 6e 61 6c 20 75  |.**   Internal u|
000027e0  73 65 2c 20 62 75 74 20  79 6f 75 20 6d 69 67 68  |se, but you migh|
000027f0  74 20 77 61 6e 74 20 69  74 2e 0a 2a 2f 0a 42 4f  |t want it..*/.BO|
00002800  4f 4c 20 50 6f 70 63 6f  72 6e 5f 4f 75 74 73 69  |OL Popcorn_Outsi|
00002810  64 65 28 73 74 72 75 63  74 20 67 61 6d 65 5f 6f  |de(struct game_o|
00002820  62 6a 65 63 74 20 2a 6f  62 6a 2c 20 73 74 72 75  |bject *obj, stru|
00002830  63 74 20 77 69 6e 64 6f  77 20 2a 77 69 6e 29 3b  |ct window *win);|
00002840  0a 0a 2f 2a 20 50 6f 70  63 6f 72 6e 5f 50 6c 6f  |../* Popcorn_Plo|
00002850  74 42 61 63 6b 64 72 6f  70 0a 2a 2a 0a 2a 2a 20  |tBackdrop.**.** |
00002860  20 20 43 6f 70 69 65 73  20 74 68 65 20 73 70 65  |  Copies the spe|
00002870  63 69 66 69 65 64 20 61  72 65 61 20 6f 66 20 6d  |cified area of m|
00002880  65 6d 6f 72 79 20 74 6f  20 74 68 65 20 73 63 72  |emory to the scr|
00002890  65 65 6e 20 6d 65 6d 6f  72 79 20 61 73 20 71 75  |een memory as qu|
000028a0  69 63 6b 6c 79 0a 2a 2a  20 20 20 61 73 20 70 6f  |ickly.**   as po|
000028b0  73 73 69 62 6c 65 2e 0a  2a 2f 0a 76 6f 69 64 09  |ssible..*/.void.|
000028c0  20 50 6f 70 63 6f 72 6e  5f 50 6c 6f 74 42 61 63  | Popcorn_PlotBac|
000028d0  6b 64 72 6f 70 28 63 68  61 72 20 2a 62 61 63 6b  |kdrop(char *back|
000028e0  64 72 6f 70 29 3b 0a 0a  2f 2a 20 50 6f 70 63 6f  |drop);../* Popco|
000028f0  72 6e 5f 50 6c 6f 74 53  70 72 69 74 65 0a 2a 2a  |rn_PlotSprite.**|
00002900  0a 2a 2a 20 20 20 2a 73  70 72 69 74 65 20 73 68  |.**   *sprite sh|
00002910  6f 75 6c 64 20 62 65 20  61 20 70 6f 69 6e 74 65  |ould be a pointe|
00002920  72 20 74 6f 20 61 20 50  6f 70 63 6f 72 6e 20 73  |r to a Popcorn s|
00002930  70 72 69 74 65 20 66 69  6c 65 20 69 6e 20 6d 65  |prite file in me|
00002940  6d 6f 72 79 3b 20 78 20  61 6e 64 20 79 0a 2a 2a  |mory; x and y.**|
00002950  20 20 20 63 61 6e 20 62  65 20 2d 76 65 2c 20 6f  |   can be -ve, o|
00002960  72 20 6f 66 66 20 74 68  65 20 73 63 72 65 65 6e  |r off the screen|
00002970  20 61 6e 64 20 74 68 65  20 73 70 72 69 74 65 20  | and the sprite |
00002980  77 69 6c 6c 20 62 65 20  63 6c 69 70 70 65 64 20  |will be clipped |
00002990  61 63 63 6f 72 64 69 6e  67 0a 2a 2a 20 20 20 74  |according.**   t|
000029a0  6f 20 70 6c 6f 74 5f 77  69 6e 64 6f 77 20 28 73  |o plot_window (s|
000029b0  65 65 20 62 65 6c 6f 77  29 2e 0a 2a 2f 0a 76 6f  |ee below)..*/.vo|
000029c0  69 64 09 20 50 6f 70 63  6f 72 6e 5f 50 6c 6f 74  |id. Popcorn_Plot|
000029d0  53 70 72 69 74 65 28 63  68 61 72 20 2a 73 70 72  |Sprite(char *spr|
000029e0  69 74 65 2c 20 73 69 67  6e 65 64 20 69 6e 74 20  |ite, signed int |
000029f0  78 2c 20 73 69 67 6e 65  64 20 69 6e 74 20 79 29  |x, signed int y)|
00002a00  3b 0a 0a 2f 2a 20 50 6f  70 63 6f 72 6e 5f 50 72  |;../* Popcorn_Pr|
00002a10  6f 63 65 73 73 0a 2a 2a  0a 2a 2a 20 20 20 54 68  |ocess.**.**   Th|
00002a20  69 73 20 69 73 20 74 68  65 20 66 75 6e 63 74 69  |is is the functi|
00002a30  6f 6e 20 74 68 61 74 20  64 6f 65 73 20 61 6c 6c  |on that does all|
00002a40  20 74 68 65 20 77 6f 72  6b 20 3a 2d 29 20 20 43  | the work :-)  C|
00002a50  61 6c 6c 20 74 68 69 73  20 65 76 65 72 79 0a 2a  |all this every.*|
00002a60  2a 20 20 20 66 72 61 6d  65 20 6f 6e 20 65 61 63  |*   frame on eac|
00002a70  68 20 6f 66 20 79 6f 75  72 20 74 61 62 6c 65 73  |h of your tables|
00002a80  20 74 6f 20 70 6c 6f 74  20 61 6c 6c 20 74 68 65  | to plot all the|
00002a90  20 6f 62 6a 65 63 74 73  2c 20 6d 6f 76 65 20 74  | objects, move t|
00002aa0  68 65 6d 0a 2a 2a 20 20  20 6f 6e 2c 20 63 61 6c  |hem.**   on, cal|
00002ab0  6c 20 74 68 65 69 72 20  68 61 6e 64 6c 65 72 73  |l their handlers|
00002ac0  20 69 66 20 6e 65 63 65  73 73 61 72 79 20 61 6e  | if necessary an|
00002ad0  64 20 61 64 64 20 74 68  65 6d 20 74 6f 20 74 68  |d add them to th|
00002ae0  65 20 63 6f 6c 6c 69 73  69 6f 6e 0a 2a 2a 20 20  |e collision.**  |
00002af0  20 74 61 62 6c 65 73 20  28 69 2e 65 2e 20 79 6f  | tables (i.e. yo|
00002b00  75 20 6d 75 73 74 20 63  61 6c 6c 20 74 68 69 73  |u must call this|
00002b10  20 62 65 66 6f 72 65 20  50 6f 70 63 6f 72 6e 5f  | before Popcorn_|
00002b20  43 6f 6c 6c 69 73 69 6f  6e 43 68 65 63 6b 29 0a  |CollisionCheck).|
00002b30  2a 2f 0a 65 78 74 65 72  6e 20 76 6f 69 64 20 50  |*/.extern void P|
00002b40  6f 70 63 6f 72 6e 5f 50  72 6f 63 65 73 73 28 73  |opcorn_Process(s|
00002b50  74 72 75 63 74 20 6f 62  6a 65 63 74 5f 74 61 62  |truct object_tab|
00002b60  6c 65 2a 20 74 61 62 6c  65 2c 0a 20 20 20 20 20  |le* table,.     |
00002b70  20 20 09 20 20 20 20 09  09 20 20 20 20 20 42 4f  |  .    ..     BO|
00002b80  4f 4c 20 70 6c 6f 74 2c  20 69 6e 74 20 6d 6f 76  |OL plot, int mov|
00002b90  65 73 29 3b 0a 0a 2f 2a  20 50 6f 70 63 6f 72 6e  |es);../* Popcorn|
00002ba0  5f 52 65 61 64 53 63 72  65 65 6e 44 65 74 61 69  |_ReadScreenDetai|
00002bb0  6c 73 0a 2a 2a 0a 2a 2a  20 20 20 43 61 6c 6c 20  |ls.**.**   Call |
00002bc0  6f 6e 63 65 20 6f 6e 20  65 76 65 72 79 20 6d 6f  |once on every mo|
00002bd0  64 65 20 63 68 61 6e 67  65 20 73 6f 20 74 68 61  |de change so tha|
00002be0  74 20 74 68 65 20 64 69  73 70 6c 61 79 20 72 6f  |t the display ro|
00002bf0  75 74 69 6e 65 73 20 63  61 6e 20 73 6f 72 74 0a  |utines can sort.|
00002c00  2a 2a 20 20 20 74 68 65  6d 73 65 6c 76 65 73 20  |**   themselves |
00002c10  6f 75 74 3b 20 61 6c 73  6f 20 73 65 74 73 20 74  |out; also sets t|
00002c20  68 65 20 27 70 6c 6f 74  27 20 62 61 6e 6b 20 74  |he 'plot' bank t|
00002c30  6f 20 30 20 61 6e 64 20  74 68 65 20 27 64 69 73  |o 0 and the 'dis|
00002c40  70 6c 61 79 27 20 62 61  6e 6b 20 74 6f 0a 2a 2a  |play' bank to.**|
00002c50  20 20 20 31 2c 20 6f 72  20 74 27 6f 74 68 65 72  |   1, or t'other|
00002c60  20 77 61 79 20 61 72 6f  75 6e 64 2e 2e 2e 20 73  | way around... s|
00002c70  65 65 20 74 68 65 20 73  6f 75 72 63 65 20 63 6f  |ee the source co|
00002c80  64 65 20 69 66 20 79 6f  75 27 72 65 20 74 68 61  |de if you're tha|
00002c90  74 20 62 6f 74 68 65 72  65 64 2e 0a 2a 2f 0a 76  |t bothered..*/.v|
00002ca0  6f 69 64 20 20 20 20 20  50 6f 70 63 6f 72 6e 5f  |oid     Popcorn_|
00002cb0  52 65 61 64 53 63 72 65  65 6e 44 65 74 61 69 6c  |ReadScreenDetail|
00002cc0  73 28 76 6f 69 64 29 3b  0a 0a 2f 2a 20 50 6f 70  |s(void);../* Pop|
00002cd0  63 6f 72 6e 5f 53 77 61  70 42 61 6e 6b 73 0a 2a  |corn_SwapBanks.*|
00002ce0  2a 0a 2a 2a 20 20 20 53  77 61 70 73 20 74 68 65  |*.**   Swaps the|
00002cf0  20 27 64 69 73 70 6c 61  79 27 20 61 6e 64 20 27  | 'display' and '|
00002d00  70 6c 6f 74 27 20 62 61  6e 6b 73 20 61 72 6f 75  |plot' banks arou|
00002d10  6e 64 3b 20 75 73 75 61  6c 6c 79 20 75 73 65 64  |nd; usually used|
00002d20  20 61 66 74 65 72 0a 2a  2a 20 20 20 4f 53 5f 42  | after.**   OS_B|
00002d30  79 74 65 20 31 39 20 66  6f 72 20 73 6d 6f 6f 74  |yte 19 for smoot|
00002d40  68 20 61 6e 69 6d 61 74  69 6f 6e 2e 0a 2a 2f 0a  |h animation..*/.|
00002d50  76 6f 69 64 09 20 50 6f  70 63 6f 72 6e 5f 53 77  |void. Popcorn_Sw|
00002d60  61 70 42 61 6e 6b 73 28  76 6f 69 64 29 3b 0a 0a  |apBanks(void);..|
00002d70  2f 2a 20 50 6f 70 63 6f  72 6e 5f 54 69 64 79 0a  |/* Popcorn_Tidy.|
00002d80  2a 2a 0a 2a 2a 20 20 20  43 61 6c 6c 20 74 68 69  |**.**   Call thi|
00002d90  73 20 77 68 65 6e 65 76  65 72 20 70 6f 73 73 69  |s whenever possi|
00002da0  62 6c 65 20 74 6f 20 70  75 73 68 20 61 6c 6c 20  |ble to push all |
00002db0  74 68 65 20 6f 62 6a 65  63 74 73 20 69 6e 20 61  |the objects in a|
00002dc0  20 74 61 62 6c 65 0a 2a  2a 20 20 20 74 6f 77 61  | table.**   towa|
00002dd0  72 64 73 20 74 68 65 20  74 6f 70 2c 20 61 6e 64  |rds the top, and|
00002de0  20 66 72 65 65 20 75 70  20 73 70 61 63 65 73 20  | free up spaces |
00002df0  61 74 20 74 68 65 20 65  6e 64 2c 20 6d 61 6b 69  |at the end, maki|
00002e00  6e 67 20 63 72 65 61 74  69 6f 6e 0a 2a 2a 20 20  |ng creation.**  |
00002e10  20 6f 66 20 6e 65 77 20  6f 62 6a 65 63 74 73 20  | of new objects |
00002e20  71 75 69 63 6b 65 72 2e  20 20 49 74 20 63 61 6e  |quicker.  It can|
00002e30  20 62 65 20 73 6c 6f 77  2c 20 73 6f 20 6f 6e 6c  | be slow, so onl|
00002e40  79 20 75 73 65 20 77 68  65 6e 20 74 68 65 0a 2a  |y use when the.*|
00002e50  2a 20 20 20 67 61 6d 65  20 69 73 20 70 61 75 73  |*   game is paus|
00002e60  65 64 20 6f 72 20 62 65  74 77 65 65 6e 20 6c 65  |ed or between le|
00002e70  76 65 6c 73 2e 0a 2a 2a  0a 2a 2a 20 20 20 44 4f  |vels..**.**   DO|
00002e80  4e 27 54 20 75 73 65 20  74 68 69 73 20 63 61 6c  |N'T use this cal|
00002e90  6c 20 77 68 65 6e 20 6f  62 6a 65 63 74 73 20 72  |l when objects r|
00002ea0  65 6c 79 20 6f 6e 20 66  69 6e 64 69 6e 67 20 6f  |ely on finding o|
00002eb0  74 68 65 72 20 6f 62 6a  65 63 74 73 20 69 6e 20  |ther objects in |
00002ec0  63 65 72 74 61 69 6e 0a  2a 2a 20 20 20 70 6f 73  |certain.**   pos|
00002ed0  69 74 69 6f 6e 73 20 69  6e 20 74 68 65 20 6f 62  |itions in the ob|
00002ee0  6a 65 63 74 20 74 61 62  6c 65 2c 20 6f 74 68 65  |ject table, othe|
00002ef0  72 77 69 73 65 20 74 68  65 79 20 6d 61 79 20 6d  |rwise they may m|
00002f00  6f 76 65 20 61 6e 64 20  72 75 6e 20 69 6e 74 6f  |ove and run into|
00002f10  0a 2a 2a 20 20 20 74 72  6f 75 62 6c 65 2e 0a 2a  |.**   trouble..*|
00002f20  2f 0a 65 78 74 65 72 6e  20 76 6f 69 64 20 50 6f  |/.extern void Po|
00002f30  70 63 6f 72 6e 5f 54 69  64 79 28 73 74 72 75 63  |pcorn_Tidy(struc|
00002f40  74 20 6f 62 6a 65 63 74  5f 74 61 62 6c 65 2a 20  |t object_table* |
00002f50  74 61 62 6c 65 29 3b 0a  0a 2f 2a 20 70 6c 6f 74  |table);../* plot|
00002f60  5f 77 69 6e 64 6f 77 2c  20 67 61 6d 65 5f 77 69  |_window, game_wi|
00002f70  6e 64 6f 77 2c 20 75 73  65 72 5f 77 69 6e 64 6f  |ndow, user_windo|
00002f80  77 0a 2a 2a 0a 2a 2a 20  20 20 54 68 72 65 65 20  |w.**.**   Three |
00002f90  77 69 6e 64 6f 77 73 20  77 68 69 63 68 20 6f 62  |windows which ob|
00002fa0  6a 65 63 74 73 20 63 61  6e 20 62 65 20 69 6e 73  |jects can be ins|
00002fb0  69 64 65 20 6f 72 20 6f  75 74 73 69 64 65 3b 20  |ide or outside; |
00002fc0  70 6c 6f 74 5f 77 69 6e  64 6f 77 20 61 66 66 65  |plot_window affe|
00002fd0  63 74 73 0a 2a 2a 20 20  20 73 70 72 69 74 65 20  |cts.**   sprite |
00002fe0  63 6c 69 70 70 69 6e 67  2c 20 62 75 74 20 74 68  |clipping, but th|
00002ff0  65 20 6f 74 68 65 72 73  20 74 77 6f 20 61 72 65  |e others two are|
00003000  20 75 6e 75 73 65 64 20  66 6f 72 20 61 6e 79 20  | unused for any |
00003010  6f 74 68 65 72 20 70 75  72 70 6f 73 65 2e 0a 2a  |other purpose..*|
00003020  2f 0a 65 78 74 65 72 6e  20 73 74 72 75 63 74 20  |/.extern struct |
00003030  77 69 6e 64 6f 77 20 20  20 20 20 20 20 70 6c 6f  |window       plo|
00003040  74 5f 77 69 6e 64 6f 77  3b 0a 65 78 74 65 72 6e  |t_window;.extern|
00003050  20 73 74 72 75 63 74 20  77 69 6e 64 6f 77 09 20  | struct window. |
00003060  20 20 67 61 6d 65 5f 77  69 6e 64 6f 77 3b 0a 65  |  game_window;.e|
00003070  78 74 65 72 6e 20 73 74  72 75 63 74 20 77 69 6e  |xtern struct win|
00003080  64 6f 77 09 20 20 20 75  73 65 72 5f 77 69 6e 64  |dow.   user_wind|
00003090  6f 77 3b 0a 0a 2f 2a 20  72 65 73 6f 75 72 63 65  |ow;../* resource|
000030a0  20 61 6e 64 20 70 72 6f  74 6f 74 79 70 65 20 61  | and prototype a|
000030b0  72 72 61 79 73 0a 2a 2a  0a 2a 2a 20 20 20 55 73  |rrays.**.**   Us|
000030c0  65 64 20 69 6e 74 65 72  6e 61 6c 6c 79 3b 20 6c  |ed internally; l|
000030d0  6f 6f 6b 20 61 74 20 74  68 65 20 73 6f 75 72 63  |ook at the sourc|
000030e0  65 20 69 66 20 79 6f 75  27 72 65 20 62 6f 74 68  |e if you're both|
000030f0  65 72 65 64 2e 0a 2a 2f  0a 65 78 74 65 72 6e 20  |ered..*/.extern |
00003100  73 74 72 75 63 74 20 72  65 73 6f 75 72 63 65 20  |struct resource |
00003110  20 20 20 20 2a 72 65 73  6f 75 72 63 65 5b 4d 41  |    *resource[MA|
00003120  58 5f 52 45 53 4f 55 52  43 45 53 5d 3b 0a 65 78  |X_RESOURCES];.ex|
00003130  74 65 72 6e 20 73 74 72  75 63 74 20 70 72 6f 74  |tern struct prot|
00003140  6f 74 79 70 65 20 20 20  20 2a 70 72 6f 74 6f 74  |otype    *protot|
00003150  79 70 65 5b 4d 41 58 5f  50 52 4f 54 4f 54 59 50  |ype[MAX_PROTOTYP|
00003160  45 53 5d 3b 0a 65 78 74  65 72 6e 20 69 6e 74 20  |ES];.extern int |
00003170  20 20 20 09 09 20 20 20  72 65 73 6f 75 72 63 65  |   ..   resource|
00003180  5f 66 72 65 65 2c 20 70  72 6f 74 6f 74 79 70 65  |_free, prototype|
00003190  5f 66 72 65 65 3b 0a 0a  2f 2a 20 73 79 6d 62 6f  |_free;../* symbo|
000031a0  6c 5f 74 61 62 6c 65 5f  66 69 6c 65 6e 61 6d 65  |l_table_filename|
000031b0  0a 2a 2a 0a 2a 2a 20 20  20 54 6f 20 66 69 6e 64  |.**.**   To find|
000031c0  20 73 79 6d 62 6f 6c 73  20 61 74 20 72 75 6e 2d  | symbols at run-|
000031d0  74 69 6d 65 2c 20 74 68  69 73 20 6d 75 73 74 20  |time, this must |
000031e0  63 6f 6e 74 61 69 6e 20  74 68 65 20 66 69 6c 65  |contain the file|
000031f0  6e 61 6d 65 20 6f 66 20  61 20 73 79 6d 62 6f 6c  |name of a symbol|
00003200  0a 2a 2a 20 20 20 74 61  62 6c 65 20 70 72 6f 64  |.**   table prod|
00003210  75 63 65 64 20 62 79 20  74 68 65 20 6c 69 6e 6b  |uced by the link|
00003220  65 72 2e 20 20 41 64 64  20 27 2d 73 79 6d 62 6f  |er.  Add '-symbo|
00003230  6c 73 20 3c 66 69 6c 65  6e 61 6d 65 3e 27 20 77  |ls <filename>' w|
00003240  68 65 6e 20 79 6f 75 20  63 61 6c 6c 0a 2a 2a 20  |hen you call.** |
00003250  20 20 74 68 65 20 6c 69  6e 6b 65 72 20 74 6f 20  |  the linker to |
00003260  70 72 6f 64 75 63 65 20  6f 6e 65 2e 0a 2a 2f 0a  |produce one..*/.|
00003270  65 78 74 65 72 6e 20 63  68 61 72 20 20 20 20 20  |extern char     |
00003280  20 20 20 20 20 20 20 20  20 20 20 73 79 6d 62 6f  |           symbo|
00003290  6c 5f 74 61 62 6c 65 5f  66 69 6c 65 6e 61 6d 65  |l_table_filename|
000032a0  5b 32 35 35 5d 3b 0a                              |[255];.|
000032a7