]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - larn/savelev.c
2 static char rcsid
[] = "$Id: savelev.c,v 1.2 1993/08/02 17:20:18 mycroft Exp $";
5 /* savelev.c Larn is copyrighted 1986 by Noah Morgan. */
7 extern struct cel
*cell
;
10 * routine to save the present level into storage
14 register struct cel
*pcel
;
15 register char *pitem
,*pknow
,*pmitem
;
16 register short *phitp
,*piarg
;
17 register struct cel
*pecel
;
18 pcel
= &cell
[level
*MAXX
*MAXY
]; /* pointer to this level's cells */
19 pecel
= pcel
+ MAXX
*MAXY
; /* pointer to past end of this level's cells */
20 pitem
=item
[0]; piarg
=iarg
[0]; pknow
=know
[0]; pmitem
=mitem
[0]; phitp
=hitp
[0];
23 pcel
->mitem
= *pmitem
++;
24 pcel
->hitp
= *phitp
++;
25 pcel
->item
= *pitem
++;
26 pcel
->know
= *pknow
++;
27 pcel
++->iarg
= *piarg
++;
32 * routine to restore a level from storage
36 register struct cel
*pcel
;
37 register char *pitem
,*pknow
,*pmitem
;
38 register short *phitp
,*piarg
;
39 register struct cel
*pecel
;
40 pcel
= &cell
[level
*MAXX
*MAXY
]; /* pointer to this level's cells */
41 pecel
= pcel
+ MAXX
*MAXY
; /* pointer to past end of this level's cells */
42 pitem
=item
[0]; piarg
=iarg
[0]; pknow
=know
[0]; pmitem
=mitem
[0]; phitp
=hitp
[0];
45 *pmitem
++ = pcel
->mitem
;
46 *phitp
++ = pcel
->hitp
;
47 *pitem
++ = pcel
->item
;
48 *pknow
++ = pcel
->know
;
49 *piarg
++ = pcel
++->iarg
;