]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - larn/savelev.c
4419acb95092ffdf4c1e7ecf405b6488389279c8
1 /* savelev.c Larn is copyrighted 1986 by Noah Morgan. */
3 extern struct cel
*cell
;
6 * routine to save the present level into storage
10 register struct cel
*pcel
;
11 register char *pitem
,*pknow
,*pmitem
;
12 register short *phitp
,*piarg
;
13 register struct cel
*pecel
;
14 pcel
= &cell
[level
*MAXX
*MAXY
]; /* pointer to this level's cells */
15 pecel
= pcel
+ MAXX
*MAXY
; /* pointer to past end of this level's cells */
16 pitem
=item
[0]; piarg
=iarg
[0]; pknow
=know
[0]; pmitem
=mitem
[0]; phitp
=hitp
[0];
19 pcel
->mitem
= *pmitem
++;
20 pcel
->hitp
= *phitp
++;
21 pcel
->item
= *pitem
++;
22 pcel
->know
= *pknow
++;
23 pcel
++->iarg
= *piarg
++;
28 * routine to restore a level from storage
32 register struct cel
*pcel
;
33 register char *pitem
,*pknow
,*pmitem
;
34 register short *phitp
,*piarg
;
35 register struct cel
*pecel
;
36 pcel
= &cell
[level
*MAXX
*MAXY
]; /* pointer to this level's cells */
37 pecel
= pcel
+ MAXX
*MAXY
; /* pointer to past end of this level's cells */
38 pitem
=item
[0]; piarg
=iarg
[0]; pknow
=know
[0]; pmitem
=mitem
[0]; phitp
=hitp
[0];
41 *pmitem
++ = pcel
->mitem
;
42 *phitp
++ = pcel
->hitp
;
43 *pitem
++ = pcel
->item
;
44 *pknow
++ = pcel
->know
;
45 *piarg
++ = pcel
++->iarg
;