Home » Archimedes archive » Acorn User » AU 1997-01 B.adf » Features » Arcade/!Popcorn/c/LoadProto

Arcade/!Popcorn/c/LoadProto

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 1997-01 B.adf » Features
Filename: Arcade/!Popcorn/c/LoadProto
Read OK:
File size: 176E bytes
Load address: 0000
Exec address: 0000
File contents
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "Popcorn:h.Popcorn"

os_error err_returned;

os_error *err(char *msg, int line, FILE *handle)
{
  sprintf(err_returned.errmess, "LoadPrototype: %s (line %d).", msg, line);
  if (handle != NULL) fclose(handle);
  return(&err_returned);
}

os_error *Popcorn_LoadPrototypes(char *proto_filename)
{
  FILE                *handle, *sprite_handle;
  char		      line[1024], filename[256], *variable = line, *value,
  		      *chk;
  int		      c, current_frame = 0, next_id = 0, frames = 0,
  		      line_num = 0, sx, sy, cx, cy, auto_centre;
  struct prototype    *cp = NULL;
  struct
  {
    int height, width;
  } sprite_header;


  handle = fopen(proto_filename, "rb");

  if (handle == NULL)
  {
    return(err("Couldn't open prototypes file", 0, NULL));
  }

  while (!feof(handle))
  {

/* Get string from file, change LF terminator to zero byte */

    chk = fgets(line, 1024, handle);

    line_num++;
    for(c=0; line[c]>31; c++);
    line[c]=0;

 /* Sort out 'variable' and 'value', skip spaces and things... */

    if (line[0] != '#' && line[0] > 31 && chk != NULL)
    {
      c=0;
      while (line[c] != ' ') c++;
      line[c] = 0;
      while (line[c] != '=') c++;
      c++;
      while (line[c] == ' ') c++;
      value = &line[c];

      if (strcmp(variable, "id") == 0)
      {
        if (current_frame != frames )
        {
          return(err("New prototype started without finishing all the frames of previous one", line_num, handle));
        }
        sscanf(value, "%s %d", &next_id, &frames); current_frame = 0;

/*         printf("%X %d frames\n", next_id, frames); */
        if ( (prototype[prototype_free] = malloc(sizeof(struct prototype) + (sizeof(struct frame_data)*(frames-1)))) == NULL)
        {
          return(err("Couldn't allocate memory for prototype", line_num, handle));
        }
        cp = prototype[prototype_free]; /* Just shorthand... */
        prototype_free++;
        cp->id      = next_id; next_id = 0;
        cp->handler = NULL; cp->flags.word = 0;
        cp->animation.frames = frames;
        for (c=0; c!=frames; c++)
          cp->animation.frame[c].sprite_anchor = NULL;
      }

      if (strcmp(variable, "handler") == 0)
      {
        cp->handler = Popcorn_FindSymbol(value);
/*         printf("handler: %X\n", cp->handler); */
      }

      if (strcmp(variable, "objflags") == 0)
      {
        if (strstr(value,"std_plot")!=0)     cp->flags.bits.std_plot     = TRUE;
        if (strstr(value,"animate")!=0)      cp->flags.bits.animate      = TRUE;
        if (strstr(value,"collide")!=0)      cp->flags.bits.collide      = TRUE;
        if (strstr(value,"velocities")!=0)   cp->flags.bits.velocities   = TRUE;
        if (strstr(value,"gravity")!=0)      cp->flags.bits.gravity      = TRUE;
        if (strstr(value,"attn_every")!=0)   cp->flags.bits.attn_every   = TRUE;
        if (strstr(value,"attn_plot")!=0)    cp->flags.bits.attn_plot    = TRUE;
        if (strstr(value,"attn_timer")!=0)   cp->flags.bits.attn_timer   = TRUE;
        if (strstr(value,"attn_plotout")!=0) cp->flags.bits.attn_plotout = TRUE;
        if (strstr(value,"attn_gameout")!=0) cp->flags.bits.attn_gameout = TRUE;
        if (strstr(value,"attn_userout")!=0) cp->flags.bits.attn_userout = TRUE;
        if (strstr(value,"kill_timer")!=0)   cp->flags.bits.kill_timer   = TRUE;
        if (strstr(value,"kill_plotout")!=0) cp->flags.bits.kill_plotout = TRUE;
        if (strstr(value,"kill_gameout")!=0) cp->flags.bits.kill_gameout = TRUE;
        if (strstr(value,"kill_userout")!=0) cp->flags.bits.kill_userout = TRUE;
        if (strstr(value,"yoyo")!=0)         cp->flags.bits.yoyo         = TRUE;
/*         printf("flags: %X\n", cp->flags.word); */
      }

      if (strcmp(variable, "frame") == 0)
      {
        if (current_frame == frames)
        {
          return(err("Too many frames", line_num, handle));
        }

        auto_centre = sx = sy = cx = cy = -1;
        if (strstr(value, "S@") != 0)
          sscanf(strstr(value, "S@"), "S@%d,%d", &sx, &sy);
        if (strstr(value, "C@") != 0)
          sscanf(strstr(value, "C@"), "C@%d,%d", &cx, &cy);
        if (strstr(value, "auto_centre") != 0)
          sscanf(strstr(value, "auto_centre"), "auto_centre@%d", &auto_centre);

        sscanf(value, "%s ", filename);

        if (sx == -1)
        {
/*           printf("trying: %s\n", filename); */
          sprite_handle = fopen(filename, "rb");
          if (sprite_handle == NULL)
          {
            return(err("Couldn't open sprite file", line_num, handle));
          }
          fread(&sprite_header, 4, 2, sprite_handle);
          fclose(sprite_handle);
          sx = sprite_header.width  - 1;
          sy = sprite_header.height - 1;
        }

        if (cx == -1 && auto_centre == -1)
          auto_centre = 5;

        switch (auto_centre)
        {
          case 1 : cx=0; cy=0; break;
          case 2 : cx=(sx+1)>>1; cy=0; break;
          case 3 : cx=sx; cy=0; break;
          case 4 : cx=0; cy=(sy+1)>>1; break;
          case 5 : cx=(sx+1)>>1; cy=(sy+1)>>1; break;
          case 6 : cx=sx; cy=(sy+1)>>1; break;
          case 7 : cx=0; cy=sy; break;
          case 8 : cx=(sx+1)>>1; cy=sy; break;
          case 9 : cx=sx; cy=sy;
        }

        cp->animation.frame[current_frame].centre_x = cx;
        cp->animation.frame[current_frame].centre_y = cy;
        cp->animation.frame[current_frame].size_x = sx;
        cp->animation.frame[current_frame].size_y = sy;
        cp->animation.frame[current_frame].sprite_anchor = Popcorn_FindResource(filename);
/*         if (*(cp->animation.frame[current_frame].sprite_anchor) == NULL) */
/*           printf("NULL %s\n", filename); */

/*         printf("frame %d: S@%d,%d C@%d,%d %08X %s\n", current_frame, sx, sy, cx, cy, cp->animation.frame[current_frame].sprite_anchor, filename); */

        current_frame++;
      }
    }
  }
  fclose(handle);
  return(NULL);
}
00000000  23 69 6e 63 6c 75 64 65  20 3c 73 74 64 6c 69 62  |#include <stdlib|
00000010  2e 68 3e 0a 23 69 6e 63  6c 75 64 65 20 3c 73 74  |.h>.#include <st|
00000020  64 69 6f 2e 68 3e 0a 23  69 6e 63 6c 75 64 65 20  |dio.h>.#include |
00000030  3c 73 74 72 69 6e 67 2e  68 3e 0a 0a 23 69 6e 63  |<string.h>..#inc|
00000040  6c 75 64 65 20 22 50 6f  70 63 6f 72 6e 3a 68 2e  |lude "Popcorn:h.|
00000050  50 6f 70 63 6f 72 6e 22  0a 0a 6f 73 5f 65 72 72  |Popcorn"..os_err|
00000060  6f 72 20 65 72 72 5f 72  65 74 75 72 6e 65 64 3b  |or err_returned;|
00000070  0a 0a 6f 73 5f 65 72 72  6f 72 20 2a 65 72 72 28  |..os_error *err(|
00000080  63 68 61 72 20 2a 6d 73  67 2c 20 69 6e 74 20 6c  |char *msg, int l|
00000090  69 6e 65 2c 20 46 49 4c  45 20 2a 68 61 6e 64 6c  |ine, FILE *handl|
000000a0  65 29 0a 7b 0a 20 20 73  70 72 69 6e 74 66 28 65  |e).{.  sprintf(e|
000000b0  72 72 5f 72 65 74 75 72  6e 65 64 2e 65 72 72 6d  |rr_returned.errm|
000000c0  65 73 73 2c 20 22 4c 6f  61 64 50 72 6f 74 6f 74  |ess, "LoadProtot|
000000d0  79 70 65 3a 20 25 73 20  28 6c 69 6e 65 20 25 64  |ype: %s (line %d|
000000e0  29 2e 22 2c 20 6d 73 67  2c 20 6c 69 6e 65 29 3b  |).", msg, line);|
000000f0  0a 20 20 69 66 20 28 68  61 6e 64 6c 65 20 21 3d  |.  if (handle !=|
00000100  20 4e 55 4c 4c 29 20 66  63 6c 6f 73 65 28 68 61  | NULL) fclose(ha|
00000110  6e 64 6c 65 29 3b 0a 20  20 72 65 74 75 72 6e 28  |ndle);.  return(|
00000120  26 65 72 72 5f 72 65 74  75 72 6e 65 64 29 3b 0a  |&err_returned);.|
00000130  7d 0a 0a 6f 73 5f 65 72  72 6f 72 20 2a 50 6f 70  |}..os_error *Pop|
00000140  63 6f 72 6e 5f 4c 6f 61  64 50 72 6f 74 6f 74 79  |corn_LoadPrototy|
00000150  70 65 73 28 63 68 61 72  20 2a 70 72 6f 74 6f 5f  |pes(char *proto_|
00000160  66 69 6c 65 6e 61 6d 65  29 0a 7b 0a 20 20 46 49  |filename).{.  FI|
00000170  4c 45 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |LE              |
00000180  20 20 2a 68 61 6e 64 6c  65 2c 20 2a 73 70 72 69  |  *handle, *spri|
00000190  74 65 5f 68 61 6e 64 6c  65 3b 0a 20 20 63 68 61  |te_handle;.  cha|
000001a0  72 09 09 20 20 20 20 20  20 6c 69 6e 65 5b 31 30  |r..      line[10|
000001b0  32 34 5d 2c 20 66 69 6c  65 6e 61 6d 65 5b 32 35  |24], filename[25|
000001c0  36 5d 2c 20 2a 76 61 72  69 61 62 6c 65 20 3d 20  |6], *variable = |
000001d0  6c 69 6e 65 2c 20 2a 76  61 6c 75 65 2c 0a 20 20  |line, *value,.  |
000001e0  09 09 20 20 20 20 20 20  2a 63 68 6b 3b 0a 20 20  |..      *chk;.  |
000001f0  69 6e 74 09 09 20 20 20  20 20 20 63 2c 20 63 75  |int..      c, cu|
00000200  72 72 65 6e 74 5f 66 72  61 6d 65 20 3d 20 30 2c  |rrent_frame = 0,|
00000210  20 6e 65 78 74 5f 69 64  20 3d 20 30 2c 20 66 72  | next_id = 0, fr|
00000220  61 6d 65 73 20 3d 20 30  2c 0a 20 20 09 09 20 20  |ames = 0,.  ..  |
00000230  20 20 20 20 6c 69 6e 65  5f 6e 75 6d 20 3d 20 30  |    line_num = 0|
00000240  2c 20 73 78 2c 20 73 79  2c 20 63 78 2c 20 63 79  |, sx, sy, cx, cy|
00000250  2c 20 61 75 74 6f 5f 63  65 6e 74 72 65 3b 0a 20  |, auto_centre;. |
00000260  20 73 74 72 75 63 74 20  70 72 6f 74 6f 74 79 70  | struct prototyp|
00000270  65 20 20 20 20 2a 63 70  20 3d 20 4e 55 4c 4c 3b  |e    *cp = NULL;|
00000280  0a 20 20 73 74 72 75 63  74 0a 20 20 7b 0a 20 20  |.  struct.  {.  |
00000290  20 20 69 6e 74 20 68 65  69 67 68 74 2c 20 77 69  |  int height, wi|
000002a0  64 74 68 3b 0a 20 20 7d  20 73 70 72 69 74 65 5f  |dth;.  } sprite_|
000002b0  68 65 61 64 65 72 3b 0a  0a 0a 20 20 68 61 6e 64  |header;...  hand|
000002c0  6c 65 20 3d 20 66 6f 70  65 6e 28 70 72 6f 74 6f  |le = fopen(proto|
000002d0  5f 66 69 6c 65 6e 61 6d  65 2c 20 22 72 62 22 29  |_filename, "rb")|
000002e0  3b 0a 0a 20 20 69 66 20  28 68 61 6e 64 6c 65 20  |;..  if (handle |
000002f0  3d 3d 20 4e 55 4c 4c 29  0a 20 20 7b 0a 20 20 20  |== NULL).  {.   |
00000300  20 72 65 74 75 72 6e 28  65 72 72 28 22 43 6f 75  | return(err("Cou|
00000310  6c 64 6e 27 74 20 6f 70  65 6e 20 70 72 6f 74 6f  |ldn't open proto|
00000320  74 79 70 65 73 20 66 69  6c 65 22 2c 20 30 2c 20  |types file", 0, |
00000330  4e 55 4c 4c 29 29 3b 0a  20 20 7d 0a 0a 20 20 77  |NULL));.  }..  w|
00000340  68 69 6c 65 20 28 21 66  65 6f 66 28 68 61 6e 64  |hile (!feof(hand|
00000350  6c 65 29 29 0a 20 20 7b  0a 0a 2f 2a 20 47 65 74  |le)).  {../* Get|
00000360  20 73 74 72 69 6e 67 20  66 72 6f 6d 20 66 69 6c  | string from fil|
00000370  65 2c 20 63 68 61 6e 67  65 20 4c 46 20 74 65 72  |e, change LF ter|
00000380  6d 69 6e 61 74 6f 72 20  74 6f 20 7a 65 72 6f 20  |minator to zero |
00000390  62 79 74 65 20 2a 2f 0a  0a 20 20 20 20 63 68 6b  |byte */..    chk|
000003a0  20 3d 20 66 67 65 74 73  28 6c 69 6e 65 2c 20 31  | = fgets(line, 1|
000003b0  30 32 34 2c 20 68 61 6e  64 6c 65 29 3b 0a 0a 20  |024, handle);.. |
000003c0  20 20 20 6c 69 6e 65 5f  6e 75 6d 2b 2b 3b 0a 20  |   line_num++;. |
000003d0  20 20 20 66 6f 72 28 63  3d 30 3b 20 6c 69 6e 65  |   for(c=0; line|
000003e0  5b 63 5d 3e 33 31 3b 20  63 2b 2b 29 3b 0a 20 20  |[c]>31; c++);.  |
000003f0  20 20 6c 69 6e 65 5b 63  5d 3d 30 3b 0a 0a 20 2f  |  line[c]=0;.. /|
00000400  2a 20 53 6f 72 74 20 6f  75 74 20 27 76 61 72 69  |* Sort out 'vari|
00000410  61 62 6c 65 27 20 61 6e  64 20 27 76 61 6c 75 65  |able' and 'value|
00000420  27 2c 20 73 6b 69 70 20  73 70 61 63 65 73 20 61  |', skip spaces a|
00000430  6e 64 20 74 68 69 6e 67  73 2e 2e 2e 20 2a 2f 0a  |nd things... */.|
00000440  0a 20 20 20 20 69 66 20  28 6c 69 6e 65 5b 30 5d  |.    if (line[0]|
00000450  20 21 3d 20 27 23 27 20  26 26 20 6c 69 6e 65 5b  | != '#' && line[|
00000460  30 5d 20 3e 20 33 31 20  26 26 20 63 68 6b 20 21  |0] > 31 && chk !|
00000470  3d 20 4e 55 4c 4c 29 0a  20 20 20 20 7b 0a 20 20  |= NULL).    {.  |
00000480  20 20 20 20 63 3d 30 3b  0a 20 20 20 20 20 20 77  |    c=0;.      w|
00000490  68 69 6c 65 20 28 6c 69  6e 65 5b 63 5d 20 21 3d  |hile (line[c] !=|
000004a0  20 27 20 27 29 20 63 2b  2b 3b 0a 20 20 20 20 20  | ' ') c++;.     |
000004b0  20 6c 69 6e 65 5b 63 5d  20 3d 20 30 3b 0a 20 20  | line[c] = 0;.  |
000004c0  20 20 20 20 77 68 69 6c  65 20 28 6c 69 6e 65 5b  |    while (line[|
000004d0  63 5d 20 21 3d 20 27 3d  27 29 20 63 2b 2b 3b 0a  |c] != '=') c++;.|
000004e0  20 20 20 20 20 20 63 2b  2b 3b 0a 20 20 20 20 20  |      c++;.     |
000004f0  20 77 68 69 6c 65 20 28  6c 69 6e 65 5b 63 5d 20  | while (line[c] |
00000500  3d 3d 20 27 20 27 29 20  63 2b 2b 3b 0a 20 20 20  |== ' ') c++;.   |
00000510  20 20 20 76 61 6c 75 65  20 3d 20 26 6c 69 6e 65  |   value = &line|
00000520  5b 63 5d 3b 0a 0a 20 20  20 20 20 20 69 66 20 28  |[c];..      if (|
00000530  73 74 72 63 6d 70 28 76  61 72 69 61 62 6c 65 2c  |strcmp(variable,|
00000540  20 22 69 64 22 29 20 3d  3d 20 30 29 0a 20 20 20  | "id") == 0).   |
00000550  20 20 20 7b 0a 20 20 20  20 20 20 20 20 69 66 20  |   {.        if |
00000560  28 63 75 72 72 65 6e 74  5f 66 72 61 6d 65 20 21  |(current_frame !|
00000570  3d 20 66 72 61 6d 65 73  20 29 0a 20 20 20 20 20  |= frames ).     |
00000580  20 20 20 7b 0a 20 20 20  20 20 20 20 20 20 20 72  |   {.          r|
00000590  65 74 75 72 6e 28 65 72  72 28 22 4e 65 77 20 70  |eturn(err("New p|
000005a0  72 6f 74 6f 74 79 70 65  20 73 74 61 72 74 65 64  |rototype started|
000005b0  20 77 69 74 68 6f 75 74  20 66 69 6e 69 73 68 69  | without finishi|
000005c0  6e 67 20 61 6c 6c 20 74  68 65 20 66 72 61 6d 65  |ng all the frame|
000005d0  73 20 6f 66 20 70 72 65  76 69 6f 75 73 20 6f 6e  |s of previous on|
000005e0  65 22 2c 20 6c 69 6e 65  5f 6e 75 6d 2c 20 68 61  |e", line_num, ha|
000005f0  6e 64 6c 65 29 29 3b 0a  20 20 20 20 20 20 20 20  |ndle));.        |
00000600  7d 0a 20 20 20 20 20 20  20 20 73 73 63 61 6e 66  |}.        sscanf|
00000610  28 76 61 6c 75 65 2c 20  22 25 73 20 25 64 22 2c  |(value, "%s %d",|
00000620  20 26 6e 65 78 74 5f 69  64 2c 20 26 66 72 61 6d  | &next_id, &fram|
00000630  65 73 29 3b 20 63 75 72  72 65 6e 74 5f 66 72 61  |es); current_fra|
00000640  6d 65 20 3d 20 30 3b 0a  0a 2f 2a 20 20 20 20 20  |me = 0;../*     |
00000650  20 20 20 20 70 72 69 6e  74 66 28 22 25 58 20 25  |    printf("%X %|
00000660  64 20 66 72 61 6d 65 73  5c 6e 22 2c 20 6e 65 78  |d frames\n", nex|
00000670  74 5f 69 64 2c 20 66 72  61 6d 65 73 29 3b 20 2a  |t_id, frames); *|
00000680  2f 0a 20 20 20 20 20 20  20 20 69 66 20 28 20 28  |/.        if ( (|
00000690  70 72 6f 74 6f 74 79 70  65 5b 70 72 6f 74 6f 74  |prototype[protot|
000006a0  79 70 65 5f 66 72 65 65  5d 20 3d 20 6d 61 6c 6c  |ype_free] = mall|
000006b0  6f 63 28 73 69 7a 65 6f  66 28 73 74 72 75 63 74  |oc(sizeof(struct|
000006c0  20 70 72 6f 74 6f 74 79  70 65 29 20 2b 20 28 73  | prototype) + (s|
000006d0  69 7a 65 6f 66 28 73 74  72 75 63 74 20 66 72 61  |izeof(struct fra|
000006e0  6d 65 5f 64 61 74 61 29  2a 28 66 72 61 6d 65 73  |me_data)*(frames|
000006f0  2d 31 29 29 29 29 20 3d  3d 20 4e 55 4c 4c 29 0a  |-1)))) == NULL).|
00000700  20 20 20 20 20 20 20 20  7b 0a 20 20 20 20 20 20  |        {.      |
00000710  20 20 20 20 72 65 74 75  72 6e 28 65 72 72 28 22  |    return(err("|
00000720  43 6f 75 6c 64 6e 27 74  20 61 6c 6c 6f 63 61 74  |Couldn't allocat|
00000730  65 20 6d 65 6d 6f 72 79  20 66 6f 72 20 70 72 6f  |e memory for pro|
00000740  74 6f 74 79 70 65 22 2c  20 6c 69 6e 65 5f 6e 75  |totype", line_nu|
00000750  6d 2c 20 68 61 6e 64 6c  65 29 29 3b 0a 20 20 20  |m, handle));.   |
00000760  20 20 20 20 20 7d 0a 20  20 20 20 20 20 20 20 63  |     }.        c|
00000770  70 20 3d 20 70 72 6f 74  6f 74 79 70 65 5b 70 72  |p = prototype[pr|
00000780  6f 74 6f 74 79 70 65 5f  66 72 65 65 5d 3b 20 2f  |ototype_free]; /|
00000790  2a 20 4a 75 73 74 20 73  68 6f 72 74 68 61 6e 64  |* Just shorthand|
000007a0  2e 2e 2e 20 2a 2f 0a 20  20 20 20 20 20 20 20 70  |... */.        p|
000007b0  72 6f 74 6f 74 79 70 65  5f 66 72 65 65 2b 2b 3b  |rototype_free++;|
000007c0  0a 20 20 20 20 20 20 20  20 63 70 2d 3e 69 64 20  |.        cp->id |
000007d0  20 20 20 20 20 3d 20 6e  65 78 74 5f 69 64 3b 20  |     = next_id; |
000007e0  6e 65 78 74 5f 69 64 20  3d 20 30 3b 0a 20 20 20  |next_id = 0;.   |
000007f0  20 20 20 20 20 63 70 2d  3e 68 61 6e 64 6c 65 72  |     cp->handler|
00000800  20 3d 20 4e 55 4c 4c 3b  20 63 70 2d 3e 66 6c 61  | = NULL; cp->fla|
00000810  67 73 2e 77 6f 72 64 20  3d 20 30 3b 0a 20 20 20  |gs.word = 0;.   |
00000820  20 20 20 20 20 63 70 2d  3e 61 6e 69 6d 61 74 69  |     cp->animati|
00000830  6f 6e 2e 66 72 61 6d 65  73 20 3d 20 66 72 61 6d  |on.frames = fram|
00000840  65 73 3b 0a 20 20 20 20  20 20 20 20 66 6f 72 20  |es;.        for |
00000850  28 63 3d 30 3b 20 63 21  3d 66 72 61 6d 65 73 3b  |(c=0; c!=frames;|
00000860  20 63 2b 2b 29 0a 20 20  20 20 20 20 20 20 20 20  | c++).          |
00000870  63 70 2d 3e 61 6e 69 6d  61 74 69 6f 6e 2e 66 72  |cp->animation.fr|
00000880  61 6d 65 5b 63 5d 2e 73  70 72 69 74 65 5f 61 6e  |ame[c].sprite_an|
00000890  63 68 6f 72 20 3d 20 4e  55 4c 4c 3b 0a 20 20 20  |chor = NULL;.   |
000008a0  20 20 20 7d 0a 0a 20 20  20 20 20 20 69 66 20 28  |   }..      if (|
000008b0  73 74 72 63 6d 70 28 76  61 72 69 61 62 6c 65 2c  |strcmp(variable,|
000008c0  20 22 68 61 6e 64 6c 65  72 22 29 20 3d 3d 20 30  | "handler") == 0|
000008d0  29 0a 20 20 20 20 20 20  7b 0a 20 20 20 20 20 20  |).      {.      |
000008e0  20 20 63 70 2d 3e 68 61  6e 64 6c 65 72 20 3d 20  |  cp->handler = |
000008f0  50 6f 70 63 6f 72 6e 5f  46 69 6e 64 53 79 6d 62  |Popcorn_FindSymb|
00000900  6f 6c 28 76 61 6c 75 65  29 3b 0a 2f 2a 20 20 20  |ol(value);./*   |
00000910  20 20 20 20 20 20 70 72  69 6e 74 66 28 22 68 61  |      printf("ha|
00000920  6e 64 6c 65 72 3a 20 25  58 5c 6e 22 2c 20 63 70  |ndler: %X\n", cp|
00000930  2d 3e 68 61 6e 64 6c 65  72 29 3b 20 2a 2f 0a 20  |->handler); */. |
00000940  20 20 20 20 20 7d 0a 0a  20 20 20 20 20 20 69 66  |     }..      if|
00000950  20 28 73 74 72 63 6d 70  28 76 61 72 69 61 62 6c  | (strcmp(variabl|
00000960  65 2c 20 22 6f 62 6a 66  6c 61 67 73 22 29 20 3d  |e, "objflags") =|
00000970  3d 20 30 29 0a 20 20 20  20 20 20 7b 0a 20 20 20  |= 0).      {.   |
00000980  20 20 20 20 20 69 66 20  28 73 74 72 73 74 72 28  |     if (strstr(|
00000990  76 61 6c 75 65 2c 22 73  74 64 5f 70 6c 6f 74 22  |value,"std_plot"|
000009a0  29 21 3d 30 29 20 20 20  20 20 63 70 2d 3e 66 6c  |)!=0)     cp->fl|
000009b0  61 67 73 2e 62 69 74 73  2e 73 74 64 5f 70 6c 6f  |ags.bits.std_plo|
000009c0  74 20 20 20 20 20 3d 20  54 52 55 45 3b 0a 20 20  |t     = TRUE;.  |
000009d0  20 20 20 20 20 20 69 66  20 28 73 74 72 73 74 72  |      if (strstr|
000009e0  28 76 61 6c 75 65 2c 22  61 6e 69 6d 61 74 65 22  |(value,"animate"|
000009f0  29 21 3d 30 29 20 20 20  20 20 20 63 70 2d 3e 66  |)!=0)      cp->f|
00000a00  6c 61 67 73 2e 62 69 74  73 2e 61 6e 69 6d 61 74  |lags.bits.animat|
00000a10  65 20 20 20 20 20 20 3d  20 54 52 55 45 3b 0a 20  |e      = TRUE;. |
00000a20  20 20 20 20 20 20 20 69  66 20 28 73 74 72 73 74  |       if (strst|
00000a30  72 28 76 61 6c 75 65 2c  22 63 6f 6c 6c 69 64 65  |r(value,"collide|
00000a40  22 29 21 3d 30 29 20 20  20 20 20 20 63 70 2d 3e  |")!=0)      cp->|
00000a50  66 6c 61 67 73 2e 62 69  74 73 2e 63 6f 6c 6c 69  |flags.bits.colli|
00000a60  64 65 20 20 20 20 20 20  3d 20 54 52 55 45 3b 0a  |de      = TRUE;.|
00000a70  20 20 20 20 20 20 20 20  69 66 20 28 73 74 72 73  |        if (strs|
00000a80  74 72 28 76 61 6c 75 65  2c 22 76 65 6c 6f 63 69  |tr(value,"veloci|
00000a90  74 69 65 73 22 29 21 3d  30 29 20 20 20 63 70 2d  |ties")!=0)   cp-|
00000aa0  3e 66 6c 61 67 73 2e 62  69 74 73 2e 76 65 6c 6f  |>flags.bits.velo|
00000ab0  63 69 74 69 65 73 20 20  20 3d 20 54 52 55 45 3b  |cities   = TRUE;|
00000ac0  0a 20 20 20 20 20 20 20  20 69 66 20 28 73 74 72  |.        if (str|
00000ad0  73 74 72 28 76 61 6c 75  65 2c 22 67 72 61 76 69  |str(value,"gravi|
00000ae0  74 79 22 29 21 3d 30 29  20 20 20 20 20 20 63 70  |ty")!=0)      cp|
00000af0  2d 3e 66 6c 61 67 73 2e  62 69 74 73 2e 67 72 61  |->flags.bits.gra|
00000b00  76 69 74 79 20 20 20 20  20 20 3d 20 54 52 55 45  |vity      = TRUE|
00000b10  3b 0a 20 20 20 20 20 20  20 20 69 66 20 28 73 74  |;.        if (st|
00000b20  72 73 74 72 28 76 61 6c  75 65 2c 22 61 74 74 6e  |rstr(value,"attn|
00000b30  5f 65 76 65 72 79 22 29  21 3d 30 29 20 20 20 63  |_every")!=0)   c|
00000b40  70 2d 3e 66 6c 61 67 73  2e 62 69 74 73 2e 61 74  |p->flags.bits.at|
00000b50  74 6e 5f 65 76 65 72 79  20 20 20 3d 20 54 52 55  |tn_every   = TRU|
00000b60  45 3b 0a 20 20 20 20 20  20 20 20 69 66 20 28 73  |E;.        if (s|
00000b70  74 72 73 74 72 28 76 61  6c 75 65 2c 22 61 74 74  |trstr(value,"att|
00000b80  6e 5f 70 6c 6f 74 22 29  21 3d 30 29 20 20 20 20  |n_plot")!=0)    |
00000b90  63 70 2d 3e 66 6c 61 67  73 2e 62 69 74 73 2e 61  |cp->flags.bits.a|
00000ba0  74 74 6e 5f 70 6c 6f 74  20 20 20 20 3d 20 54 52  |ttn_plot    = TR|
00000bb0  55 45 3b 0a 20 20 20 20  20 20 20 20 69 66 20 28  |UE;.        if (|
00000bc0  73 74 72 73 74 72 28 76  61 6c 75 65 2c 22 61 74  |strstr(value,"at|
00000bd0  74 6e 5f 74 69 6d 65 72  22 29 21 3d 30 29 20 20  |tn_timer")!=0)  |
00000be0  20 63 70 2d 3e 66 6c 61  67 73 2e 62 69 74 73 2e  | cp->flags.bits.|
00000bf0  61 74 74 6e 5f 74 69 6d  65 72 20 20 20 3d 20 54  |attn_timer   = T|
00000c00  52 55 45 3b 0a 20 20 20  20 20 20 20 20 69 66 20  |RUE;.        if |
00000c10  28 73 74 72 73 74 72 28  76 61 6c 75 65 2c 22 61  |(strstr(value,"a|
00000c20  74 74 6e 5f 70 6c 6f 74  6f 75 74 22 29 21 3d 30  |ttn_plotout")!=0|
00000c30  29 20 63 70 2d 3e 66 6c  61 67 73 2e 62 69 74 73  |) cp->flags.bits|
00000c40  2e 61 74 74 6e 5f 70 6c  6f 74 6f 75 74 20 3d 20  |.attn_plotout = |
00000c50  54 52 55 45 3b 0a 20 20  20 20 20 20 20 20 69 66  |TRUE;.        if|
00000c60  20 28 73 74 72 73 74 72  28 76 61 6c 75 65 2c 22  | (strstr(value,"|
00000c70  61 74 74 6e 5f 67 61 6d  65 6f 75 74 22 29 21 3d  |attn_gameout")!=|
00000c80  30 29 20 63 70 2d 3e 66  6c 61 67 73 2e 62 69 74  |0) cp->flags.bit|
00000c90  73 2e 61 74 74 6e 5f 67  61 6d 65 6f 75 74 20 3d  |s.attn_gameout =|
00000ca0  20 54 52 55 45 3b 0a 20  20 20 20 20 20 20 20 69  | TRUE;.        i|
00000cb0  66 20 28 73 74 72 73 74  72 28 76 61 6c 75 65 2c  |f (strstr(value,|
00000cc0  22 61 74 74 6e 5f 75 73  65 72 6f 75 74 22 29 21  |"attn_userout")!|
00000cd0  3d 30 29 20 63 70 2d 3e  66 6c 61 67 73 2e 62 69  |=0) cp->flags.bi|
00000ce0  74 73 2e 61 74 74 6e 5f  75 73 65 72 6f 75 74 20  |ts.attn_userout |
00000cf0  3d 20 54 52 55 45 3b 0a  20 20 20 20 20 20 20 20  |= TRUE;.        |
00000d00  69 66 20 28 73 74 72 73  74 72 28 76 61 6c 75 65  |if (strstr(value|
00000d10  2c 22 6b 69 6c 6c 5f 74  69 6d 65 72 22 29 21 3d  |,"kill_timer")!=|
00000d20  30 29 20 20 20 63 70 2d  3e 66 6c 61 67 73 2e 62  |0)   cp->flags.b|
00000d30  69 74 73 2e 6b 69 6c 6c  5f 74 69 6d 65 72 20 20  |its.kill_timer  |
00000d40  20 3d 20 54 52 55 45 3b  0a 20 20 20 20 20 20 20  | = TRUE;.       |
00000d50  20 69 66 20 28 73 74 72  73 74 72 28 76 61 6c 75  | if (strstr(valu|
00000d60  65 2c 22 6b 69 6c 6c 5f  70 6c 6f 74 6f 75 74 22  |e,"kill_plotout"|
00000d70  29 21 3d 30 29 20 63 70  2d 3e 66 6c 61 67 73 2e  |)!=0) cp->flags.|
00000d80  62 69 74 73 2e 6b 69 6c  6c 5f 70 6c 6f 74 6f 75  |bits.kill_plotou|
00000d90  74 20 3d 20 54 52 55 45  3b 0a 20 20 20 20 20 20  |t = TRUE;.      |
00000da0  20 20 69 66 20 28 73 74  72 73 74 72 28 76 61 6c  |  if (strstr(val|
00000db0  75 65 2c 22 6b 69 6c 6c  5f 67 61 6d 65 6f 75 74  |ue,"kill_gameout|
00000dc0  22 29 21 3d 30 29 20 63  70 2d 3e 66 6c 61 67 73  |")!=0) cp->flags|
00000dd0  2e 62 69 74 73 2e 6b 69  6c 6c 5f 67 61 6d 65 6f  |.bits.kill_gameo|
00000de0  75 74 20 3d 20 54 52 55  45 3b 0a 20 20 20 20 20  |ut = TRUE;.     |
00000df0  20 20 20 69 66 20 28 73  74 72 73 74 72 28 76 61  |   if (strstr(va|
00000e00  6c 75 65 2c 22 6b 69 6c  6c 5f 75 73 65 72 6f 75  |lue,"kill_userou|
00000e10  74 22 29 21 3d 30 29 20  63 70 2d 3e 66 6c 61 67  |t")!=0) cp->flag|
00000e20  73 2e 62 69 74 73 2e 6b  69 6c 6c 5f 75 73 65 72  |s.bits.kill_user|
00000e30  6f 75 74 20 3d 20 54 52  55 45 3b 0a 20 20 20 20  |out = TRUE;.    |
00000e40  20 20 20 20 69 66 20 28  73 74 72 73 74 72 28 76  |    if (strstr(v|
00000e50  61 6c 75 65 2c 22 79 6f  79 6f 22 29 21 3d 30 29  |alue,"yoyo")!=0)|
00000e60  20 20 20 20 20 20 20 20  20 63 70 2d 3e 66 6c 61  |         cp->fla|
00000e70  67 73 2e 62 69 74 73 2e  79 6f 79 6f 20 20 20 20  |gs.bits.yoyo    |
00000e80  20 20 20 20 20 3d 20 54  52 55 45 3b 0a 2f 2a 20  |     = TRUE;./* |
00000e90  20 20 20 20 20 20 20 20  70 72 69 6e 74 66 28 22  |        printf("|
00000ea0  66 6c 61 67 73 3a 20 25  58 5c 6e 22 2c 20 63 70  |flags: %X\n", cp|
00000eb0  2d 3e 66 6c 61 67 73 2e  77 6f 72 64 29 3b 20 2a  |->flags.word); *|
00000ec0  2f 0a 20 20 20 20 20 20  7d 0a 0a 20 20 20 20 20  |/.      }..     |
00000ed0  20 69 66 20 28 73 74 72  63 6d 70 28 76 61 72 69  | if (strcmp(vari|
00000ee0  61 62 6c 65 2c 20 22 66  72 61 6d 65 22 29 20 3d  |able, "frame") =|
00000ef0  3d 20 30 29 0a 20 20 20  20 20 20 7b 0a 20 20 20  |= 0).      {.   |
00000f00  20 20 20 20 20 69 66 20  28 63 75 72 72 65 6e 74  |     if (current|
00000f10  5f 66 72 61 6d 65 20 3d  3d 20 66 72 61 6d 65 73  |_frame == frames|
00000f20  29 0a 20 20 20 20 20 20  20 20 7b 0a 20 20 20 20  |).        {.    |
00000f30  20 20 20 20 20 20 72 65  74 75 72 6e 28 65 72 72  |      return(err|
00000f40  28 22 54 6f 6f 20 6d 61  6e 79 20 66 72 61 6d 65  |("Too many frame|
00000f50  73 22 2c 20 6c 69 6e 65  5f 6e 75 6d 2c 20 68 61  |s", line_num, ha|
00000f60  6e 64 6c 65 29 29 3b 0a  20 20 20 20 20 20 20 20  |ndle));.        |
00000f70  7d 0a 0a 20 20 20 20 20  20 20 20 61 75 74 6f 5f  |}..        auto_|
00000f80  63 65 6e 74 72 65 20 3d  20 73 78 20 3d 20 73 79  |centre = sx = sy|
00000f90  20 3d 20 63 78 20 3d 20  63 79 20 3d 20 2d 31 3b  | = cx = cy = -1;|
00000fa0  0a 20 20 20 20 20 20 20  20 69 66 20 28 73 74 72  |.        if (str|
00000fb0  73 74 72 28 76 61 6c 75  65 2c 20 22 53 40 22 29  |str(value, "S@")|
00000fc0  20 21 3d 20 30 29 0a 20  20 20 20 20 20 20 20 20  | != 0).         |
00000fd0  20 73 73 63 61 6e 66 28  73 74 72 73 74 72 28 76  | sscanf(strstr(v|
00000fe0  61 6c 75 65 2c 20 22 53  40 22 29 2c 20 22 53 40  |alue, "S@"), "S@|
00000ff0  25 64 2c 25 64 22 2c 20  26 73 78 2c 20 26 73 79  |%d,%d", &sx, &sy|
00001000  29 3b 0a 20 20 20 20 20  20 20 20 69 66 20 28 73  |);.        if (s|
00001010  74 72 73 74 72 28 76 61  6c 75 65 2c 20 22 43 40  |trstr(value, "C@|
00001020  22 29 20 21 3d 20 30 29  0a 20 20 20 20 20 20 20  |") != 0).       |
00001030  20 20 20 73 73 63 61 6e  66 28 73 74 72 73 74 72  |   sscanf(strstr|
00001040  28 76 61 6c 75 65 2c 20  22 43 40 22 29 2c 20 22  |(value, "C@"), "|
00001050  43 40 25 64 2c 25 64 22  2c 20 26 63 78 2c 20 26  |C@%d,%d", &cx, &|
00001060  63 79 29 3b 0a 20 20 20  20 20 20 20 20 69 66 20  |cy);.        if |
00001070  28 73 74 72 73 74 72 28  76 61 6c 75 65 2c 20 22  |(strstr(value, "|
00001080  61 75 74 6f 5f 63 65 6e  74 72 65 22 29 20 21 3d  |auto_centre") !=|
00001090  20 30 29 0a 20 20 20 20  20 20 20 20 20 20 73 73  | 0).          ss|
000010a0  63 61 6e 66 28 73 74 72  73 74 72 28 76 61 6c 75  |canf(strstr(valu|
000010b0  65 2c 20 22 61 75 74 6f  5f 63 65 6e 74 72 65 22  |e, "auto_centre"|
000010c0  29 2c 20 22 61 75 74 6f  5f 63 65 6e 74 72 65 40  |), "auto_centre@|
000010d0  25 64 22 2c 20 26 61 75  74 6f 5f 63 65 6e 74 72  |%d", &auto_centr|
000010e0  65 29 3b 0a 0a 20 20 20  20 20 20 20 20 73 73 63  |e);..        ssc|
000010f0  61 6e 66 28 76 61 6c 75  65 2c 20 22 25 73 20 22  |anf(value, "%s "|
00001100  2c 20 66 69 6c 65 6e 61  6d 65 29 3b 0a 0a 20 20  |, filename);..  |
00001110  20 20 20 20 20 20 69 66  20 28 73 78 20 3d 3d 20  |      if (sx == |
00001120  2d 31 29 0a 20 20 20 20  20 20 20 20 7b 0a 2f 2a  |-1).        {./*|
00001130  20 20 20 20 20 20 20 20  20 20 20 70 72 69 6e 74  |           print|
00001140  66 28 22 74 72 79 69 6e  67 3a 20 25 73 5c 6e 22  |f("trying: %s\n"|
00001150  2c 20 66 69 6c 65 6e 61  6d 65 29 3b 20 2a 2f 0a  |, filename); */.|
00001160  20 20 20 20 20 20 20 20  20 20 73 70 72 69 74 65  |          sprite|
00001170  5f 68 61 6e 64 6c 65 20  3d 20 66 6f 70 65 6e 28  |_handle = fopen(|
00001180  66 69 6c 65 6e 61 6d 65  2c 20 22 72 62 22 29 3b  |filename, "rb");|
00001190  0a 20 20 20 20 20 20 20  20 20 20 69 66 20 28 73  |.          if (s|
000011a0  70 72 69 74 65 5f 68 61  6e 64 6c 65 20 3d 3d 20  |prite_handle == |
000011b0  4e 55 4c 4c 29 0a 20 20  20 20 20 20 20 20 20 20  |NULL).          |
000011c0  7b 0a 20 20 20 20 20 20  20 20 20 20 20 20 72 65  |{.            re|
000011d0  74 75 72 6e 28 65 72 72  28 22 43 6f 75 6c 64 6e  |turn(err("Couldn|
000011e0  27 74 20 6f 70 65 6e 20  73 70 72 69 74 65 20 66  |'t open sprite f|
000011f0  69 6c 65 22 2c 20 6c 69  6e 65 5f 6e 75 6d 2c 20  |ile", line_num, |
00001200  68 61 6e 64 6c 65 29 29  3b 0a 20 20 20 20 20 20  |handle));.      |
00001210  20 20 20 20 7d 0a 20 20  20 20 20 20 20 20 20 20  |    }.          |
00001220  66 72 65 61 64 28 26 73  70 72 69 74 65 5f 68 65  |fread(&sprite_he|
00001230  61 64 65 72 2c 20 34 2c  20 32 2c 20 73 70 72 69  |ader, 4, 2, spri|
00001240  74 65 5f 68 61 6e 64 6c  65 29 3b 0a 20 20 20 20  |te_handle);.    |
00001250  20 20 20 20 20 20 66 63  6c 6f 73 65 28 73 70 72  |      fclose(spr|
00001260  69 74 65 5f 68 61 6e 64  6c 65 29 3b 0a 20 20 20  |ite_handle);.   |
00001270  20 20 20 20 20 20 20 73  78 20 3d 20 73 70 72 69  |       sx = spri|
00001280  74 65 5f 68 65 61 64 65  72 2e 77 69 64 74 68 20  |te_header.width |
00001290  20 2d 20 31 3b 0a 20 20  20 20 20 20 20 20 20 20  | - 1;.          |
000012a0  73 79 20 3d 20 73 70 72  69 74 65 5f 68 65 61 64  |sy = sprite_head|
000012b0  65 72 2e 68 65 69 67 68  74 20 2d 20 31 3b 0a 20  |er.height - 1;. |
000012c0  20 20 20 20 20 20 20 7d  0a 0a 20 20 20 20 20 20  |       }..      |
000012d0  20 20 69 66 20 28 63 78  20 3d 3d 20 2d 31 20 26  |  if (cx == -1 &|
000012e0  26 20 61 75 74 6f 5f 63  65 6e 74 72 65 20 3d 3d  |& auto_centre ==|
000012f0  20 2d 31 29 0a 20 20 20  20 20 20 20 20 20 20 61  | -1).          a|
00001300  75 74 6f 5f 63 65 6e 74  72 65 20 3d 20 35 3b 0a  |uto_centre = 5;.|
00001310  0a 20 20 20 20 20 20 20  20 73 77 69 74 63 68 20  |.        switch |
00001320  28 61 75 74 6f 5f 63 65  6e 74 72 65 29 0a 20 20  |(auto_centre).  |
00001330  20 20 20 20 20 20 7b 0a  20 20 20 20 20 20 20 20  |      {.        |
00001340  20 20 63 61 73 65 20 31  20 3a 20 63 78 3d 30 3b  |  case 1 : cx=0;|
00001350  20 63 79 3d 30 3b 20 62  72 65 61 6b 3b 0a 20 20  | cy=0; break;.  |
00001360  20 20 20 20 20 20 20 20  63 61 73 65 20 32 20 3a  |        case 2 :|
00001370  20 63 78 3d 28 73 78 2b  31 29 3e 3e 31 3b 20 63  | cx=(sx+1)>>1; c|
00001380  79 3d 30 3b 20 62 72 65  61 6b 3b 0a 20 20 20 20  |y=0; break;.    |
00001390  20 20 20 20 20 20 63 61  73 65 20 33 20 3a 20 63  |      case 3 : c|
000013a0  78 3d 73 78 3b 20 63 79  3d 30 3b 20 62 72 65 61  |x=sx; cy=0; brea|
000013b0  6b 3b 0a 20 20 20 20 20  20 20 20 20 20 63 61 73  |k;.          cas|
000013c0  65 20 34 20 3a 20 63 78  3d 30 3b 20 63 79 3d 28  |e 4 : cx=0; cy=(|
000013d0  73 79 2b 31 29 3e 3e 31  3b 20 62 72 65 61 6b 3b  |sy+1)>>1; break;|
000013e0  0a 20 20 20 20 20 20 20  20 20 20 63 61 73 65 20  |.          case |
000013f0  35 20 3a 20 63 78 3d 28  73 78 2b 31 29 3e 3e 31  |5 : cx=(sx+1)>>1|
00001400  3b 20 63 79 3d 28 73 79  2b 31 29 3e 3e 31 3b 20  |; cy=(sy+1)>>1; |
00001410  62 72 65 61 6b 3b 0a 20  20 20 20 20 20 20 20 20  |break;.         |
00001420  20 63 61 73 65 20 36 20  3a 20 63 78 3d 73 78 3b  | case 6 : cx=sx;|
00001430  20 63 79 3d 28 73 79 2b  31 29 3e 3e 31 3b 20 62  | cy=(sy+1)>>1; b|
00001440  72 65 61 6b 3b 0a 20 20  20 20 20 20 20 20 20 20  |reak;.          |
00001450  63 61 73 65 20 37 20 3a  20 63 78 3d 30 3b 20 63  |case 7 : cx=0; c|
00001460  79 3d 73 79 3b 20 62 72  65 61 6b 3b 0a 20 20 20  |y=sy; break;.   |
00001470  20 20 20 20 20 20 20 63  61 73 65 20 38 20 3a 20  |       case 8 : |
00001480  63 78 3d 28 73 78 2b 31  29 3e 3e 31 3b 20 63 79  |cx=(sx+1)>>1; cy|
00001490  3d 73 79 3b 20 62 72 65  61 6b 3b 0a 20 20 20 20  |=sy; break;.    |
000014a0  20 20 20 20 20 20 63 61  73 65 20 39 20 3a 20 63  |      case 9 : c|
000014b0  78 3d 73 78 3b 20 63 79  3d 73 79 3b 0a 20 20 20  |x=sx; cy=sy;.   |
000014c0  20 20 20 20 20 7d 0a 0a  20 20 20 20 20 20 20 20  |     }..        |
000014d0  63 70 2d 3e 61 6e 69 6d  61 74 69 6f 6e 2e 66 72  |cp->animation.fr|
000014e0  61 6d 65 5b 63 75 72 72  65 6e 74 5f 66 72 61 6d  |ame[current_fram|
000014f0  65 5d 2e 63 65 6e 74 72  65 5f 78 20 3d 20 63 78  |e].centre_x = cx|
00001500  3b 0a 20 20 20 20 20 20  20 20 63 70 2d 3e 61 6e  |;.        cp->an|
00001510  69 6d 61 74 69 6f 6e 2e  66 72 61 6d 65 5b 63 75  |imation.frame[cu|
00001520  72 72 65 6e 74 5f 66 72  61 6d 65 5d 2e 63 65 6e  |rrent_frame].cen|
00001530  74 72 65 5f 79 20 3d 20  63 79 3b 0a 20 20 20 20  |tre_y = cy;.    |
00001540  20 20 20 20 63 70 2d 3e  61 6e 69 6d 61 74 69 6f  |    cp->animatio|
00001550  6e 2e 66 72 61 6d 65 5b  63 75 72 72 65 6e 74 5f  |n.frame[current_|
00001560  66 72 61 6d 65 5d 2e 73  69 7a 65 5f 78 20 3d 20  |frame].size_x = |
00001570  73 78 3b 0a 20 20 20 20  20 20 20 20 63 70 2d 3e  |sx;.        cp->|
00001580  61 6e 69 6d 61 74 69 6f  6e 2e 66 72 61 6d 65 5b  |animation.frame[|
00001590  63 75 72 72 65 6e 74 5f  66 72 61 6d 65 5d 2e 73  |current_frame].s|
000015a0  69 7a 65 5f 79 20 3d 20  73 79 3b 0a 20 20 20 20  |ize_y = sy;.    |
000015b0  20 20 20 20 63 70 2d 3e  61 6e 69 6d 61 74 69 6f  |    cp->animatio|
000015c0  6e 2e 66 72 61 6d 65 5b  63 75 72 72 65 6e 74 5f  |n.frame[current_|
000015d0  66 72 61 6d 65 5d 2e 73  70 72 69 74 65 5f 61 6e  |frame].sprite_an|
000015e0  63 68 6f 72 20 3d 20 50  6f 70 63 6f 72 6e 5f 46  |chor = Popcorn_F|
000015f0  69 6e 64 52 65 73 6f 75  72 63 65 28 66 69 6c 65  |indResource(file|
00001600  6e 61 6d 65 29 3b 0a 2f  2a 20 20 20 20 20 20 20  |name);./*       |
00001610  20 20 69 66 20 28 2a 28  63 70 2d 3e 61 6e 69 6d  |  if (*(cp->anim|
00001620  61 74 69 6f 6e 2e 66 72  61 6d 65 5b 63 75 72 72  |ation.frame[curr|
00001630  65 6e 74 5f 66 72 61 6d  65 5d 2e 73 70 72 69 74  |ent_frame].sprit|
00001640  65 5f 61 6e 63 68 6f 72  29 20 3d 3d 20 4e 55 4c  |e_anchor) == NUL|
00001650  4c 29 20 2a 2f 0a 2f 2a  20 20 20 20 20 20 20 20  |L) */./*        |
00001660  20 20 20 70 72 69 6e 74  66 28 22 4e 55 4c 4c 20  |   printf("NULL |
00001670  25 73 5c 6e 22 2c 20 66  69 6c 65 6e 61 6d 65 29  |%s\n", filename)|
00001680  3b 20 2a 2f 0a 0a 2f 2a  20 20 20 20 20 20 20 20  |; */../*        |
00001690  20 70 72 69 6e 74 66 28  22 66 72 61 6d 65 20 25  | printf("frame %|
000016a0  64 3a 20 53 40 25 64 2c  25 64 20 43 40 25 64 2c  |d: S@%d,%d C@%d,|
000016b0  25 64 20 25 30 38 58 20  25 73 5c 6e 22 2c 20 63  |%d %08X %s\n", c|
000016c0  75 72 72 65 6e 74 5f 66  72 61 6d 65 2c 20 73 78  |urrent_frame, sx|
000016d0  2c 20 73 79 2c 20 63 78  2c 20 63 79 2c 20 63 70  |, sy, cx, cy, cp|
000016e0  2d 3e 61 6e 69 6d 61 74  69 6f 6e 2e 66 72 61 6d  |->animation.fram|
000016f0  65 5b 63 75 72 72 65 6e  74 5f 66 72 61 6d 65 5d  |e[current_frame]|
00001700  2e 73 70 72 69 74 65 5f  61 6e 63 68 6f 72 2c 20  |.sprite_anchor, |
00001710  66 69 6c 65 6e 61 6d 65  29 3b 20 2a 2f 0a 0a 20  |filename); */.. |
00001720  20 20 20 20 20 20 20 63  75 72 72 65 6e 74 5f 66  |       current_f|
00001730  72 61 6d 65 2b 2b 3b 0a  20 20 20 20 20 20 7d 0a  |rame++;.      }.|
00001740  20 20 20 20 7d 0a 20 20  7d 0a 20 20 66 63 6c 6f  |    }.  }.  fclo|
00001750  73 65 28 68 61 6e 64 6c  65 29 3b 0a 20 20 72 65  |se(handle);.  re|
00001760  74 75 72 6e 28 4e 55 4c  4c 29 3b 0a 7d 0a        |turn(NULL);.}.|
0000176e