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

Arcade/!Popcorn/c/NewObjZ

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/NewObjZ
Read OK:
File size: 0130 bytes
Load address: 0000
Exec address: 0000
File contents
#include "Popcorn:h.Popcorn"

struct game_object *Popcorn_NewObjectZeroed(struct object_table* table)
{
  struct game_object *r;
  char	 	     *z;

  r = Popcorn_NewObject(table);

  if (r == NULL)
    return(r);

  z = (char*) r;

  for (;z!=z+sizeof(struct game_object); z++)
    *z=0;

  return(r);
}
00000000  23 69 6e 63 6c 75 64 65  20 22 50 6f 70 63 6f 72  |#include "Popcor|
00000010  6e 3a 68 2e 50 6f 70 63  6f 72 6e 22 0a 0a 73 74  |n:h.Popcorn"..st|
00000020  72 75 63 74 20 67 61 6d  65 5f 6f 62 6a 65 63 74  |ruct game_object|
00000030  20 2a 50 6f 70 63 6f 72  6e 5f 4e 65 77 4f 62 6a  | *Popcorn_NewObj|
00000040  65 63 74 5a 65 72 6f 65  64 28 73 74 72 75 63 74  |ectZeroed(struct|
00000050  20 6f 62 6a 65 63 74 5f  74 61 62 6c 65 2a 20 74  | object_table* t|
00000060  61 62 6c 65 29 0a 7b 0a  20 20 73 74 72 75 63 74  |able).{.  struct|
00000070  20 67 61 6d 65 5f 6f 62  6a 65 63 74 20 2a 72 3b  | game_object *r;|
00000080  0a 20 20 63 68 61 72 09  20 09 20 20 20 20 20 2a  |.  char. .     *|
00000090  7a 3b 0a 0a 20 20 72 20  3d 20 50 6f 70 63 6f 72  |z;..  r = Popcor|
000000a0  6e 5f 4e 65 77 4f 62 6a  65 63 74 28 74 61 62 6c  |n_NewObject(tabl|
000000b0  65 29 3b 0a 0a 20 20 69  66 20 28 72 20 3d 3d 20  |e);..  if (r == |
000000c0  4e 55 4c 4c 29 0a 20 20  20 20 72 65 74 75 72 6e  |NULL).    return|
000000d0  28 72 29 3b 0a 0a 20 20  7a 20 3d 20 28 63 68 61  |(r);..  z = (cha|
000000e0  72 2a 29 20 72 3b 0a 0a  20 20 66 6f 72 20 28 3b  |r*) r;..  for (;|
000000f0  7a 21 3d 7a 2b 73 69 7a  65 6f 66 28 73 74 72 75  |z!=z+sizeof(stru|
00000100  63 74 20 67 61 6d 65 5f  6f 62 6a 65 63 74 29 3b  |ct game_object);|
00000110  20 7a 2b 2b 29 0a 20 20  20 20 2a 7a 3d 30 3b 0a  | z++).    *z=0;.|
00000120  0a 20 20 72 65 74 75 72  6e 28 72 29 3b 0a 7d 0a  |.  return(r);.}.|
00000130