[net.sources.games] Phantasia 3.3.1+ Part 4 of 4

nonh@utzoo.UUCP (Chris Robertson) (10/09/85)

: This is a shell archive.  Remove everything up to this line, save the rest
# in a file and then type "/bin/sh file" to extract the following files:
# map.c convert.c
if test -s "map.c"
	then
	echo Will not overwrite existing 'map.c'
else
	sed -e "s/^X//" > map.c << 'TiDDleYwiNKs'
X#define	minusminus	plusplus
X#define	minusplus	plusminus
X
Xmain()
X{
X	/* Set up */
X
X	openpl();
X	space(-1400, -1000, 1200, 1200);
X
X	/* Big box */
X
X	move(-1400, -1000);
X	cont(-1400, 1000);
X	cont(600, 1000);
X	cont(600, -1000);
X	cont(-1400, -1000);
X
X	/* Grid -- horizontal lines every 200 */
X
X	linemod("dotted");
X	line(600, -800, -1400, -800);
X	line(-1400, -600, 600, -600);
X	line(600, -400, -1400, -400);
X	line(-1400, -200, 600, -200);
X	linemod("solid");
X	line(600, 0, -1400, 0);
X	linemod("dotted");
X	line(-1400, 200, 600, 200);
X	line(600, 400, -1400, 400);
X	line(-1400, 600, 600, 600);
X	line(600, 800, -1400, 800);
X
X	/* Grid -- vertical lines every 200 */
X
X	line(-1200, 1000, -1200, -1000);
X	line(-1000, 1000, -1000, -1000);
X	line(-800, 1000, -800, -1000);
X	line(-600, 1000, -600, -1000);
X	linemod("solid");
X	line(-400, 1000, -400, -1000);
X	linemod("dotted");
X	line(-200, 1000, -200, -1000);
X	line(0, 1000, 0, -1000);
X	line(200, 1000, 200, -1000);
X	line(400, 1000, 400, -1000);
X
X	/* Circles radius +250 on "center" */
X
X	linemod("solid");
X	circle(-400, 0, 250);
X	circle(-400, 0, 500);
X	circle(-400, 0, 750);
X	circle(-400, 0, 1000);
X
X	/* A few labels */
X
X	move(-670, 1075);
X	label("- THE PHANTASIA UNIVERSE -");
X	line(-630,1045,-115,1045);
X	move(-360,80);
X	label("Lorien");
X	move(-385,-100);
X	label("Ithilien");
X	move(-560,80);
X	label("Rohan");
X	move(-580,-100);
X	label("Anorien");
X	plusplus("Rovanion",-250,320);
X	plusplus("The Iron Hills",-100,560);
X	plusplus("Rhun",250,570);
X	minusplus("Dunland",-700,160);
X	minusplus("Eriador",-920,300);
X	minusplus("The Northern Waste",-1240,320);
X	minusminus("Gondor",-720,-180);
X	minusminus("South Gondor",-940,-270);
X	minusminus("Far Harad",-1100,-500);
X	plusminus("Mordor",-180,-300);
X	plusminus("Khand",0,-500);
X	plusminus("Near Harad",40,-780);
X	move(340,900);
X	label("The Moors");
X	move(300,840);
X	label("Adventurous");
X	move(340,-840);
X	label("The Moors");
X	move(300,-900);
X	label("Adventurous");
X	move(-1340,900);
X	label("The Moors");
X	move(-1340,840);
X	label("Adventurous");
X	move(-1340,-840);
X	label("The Moors");
X	move(-1340,-900);
X	label("Adventurous");
X	move(-1200,0);
X	label("*");
X	move(400,0);
X	label("*");
X	move(700,1000);
X	label("OUTER CIRCLES:");
X	line(690,970,1000,970);
X	move(700,900);
X	label("> 9:  The Outer Waste");
X	move(700,800);
X	label("> 20: The Dead Marshes");
X	move(700,700);
X	label("> 35: Kennaquhair");
X	move(700,600);
X	label("> 55: Morannon");
X	move(700,300);
X	label("(0,0): The Lord's Chamber");
X	move(700,0);
X	label("*  Wormholes");
X
X	move(700,-400);
X	label("Grid squares are 100 x 100");
X	move(700,-800);
X	label("Created by Ted Estes");
X	move(700,-860);
X	label("Plotted by Chris Robertson");
X	move(700,-920);
X	label(" c  1985");
X	circle(723,-923,20);
X
X	/* Close down */
X
X	closepl();
X	exit(0);
X}
X
Xplusplus(s,x,y)		/* draw strings in plus plus quadrant */
X
Xchar	*s;
Xint		x,y;
X{
X	char	s1[2];
X	while (*s)
X	{
X		move(x,y);
X		s1[0] = *s++;
X		s1[1] = '\0';
X		label(s1);
X		x += 25;
X		y -= 30;
X	}
X}
X
Xplusminus(s,x,y)		/* draw strings in plus minus quadrant */
X
Xchar	*s;
Xint		x,y;
X{
X	char	s1[2];
X	while (*s)
X	{
X		move(x,y);
X		s1[0] = *s++;
X		s1[1] = '\0';
X		label(s1);
X		x += 25;
X		y += 30;
X	}
X}
TiDDleYwiNKs
	size="`wc -c map.c`"
	size=`set - $size;echo $1`
echo "x - map.c, $size characters"

	if test "$size" != "3153"
		then
		echo "Warning: error in transmitting 'map.c';  should have 3153 characters."
	fi
fi
if test -s "convert.c"
	then
	echo Will not overwrite existing 'convert.c'
else
	sed -e "s/^X//" > convert.c << 'TiDDleYwiNKs'
X/*
X *	Convert Phantasia 3.3.1 characs file format to 3.3.1+
X *
X *	Written by Chris Robertson, 1985
X */
X
X#include	<stdio.h>
X
Xmain()
X{
X	struct	stats	    	/* player stats -- old format */
X	{
X		char    name[21];	/* name */
X		char    pswd[9];	/* password */
X		char    login[10];	/* login */
X		double  x;	    	/* x coord */
X		double  y;	    	/* y coord */
X		double  exp;		/* experience */
X		int 	lvl;	   	/* level */
X		short   quk;		/* quick */
X		double  str;		/* strength */
X		double  sin;		/* sin */
X		double  man;		/* mana */
X		double  gld;		/* gold */
X		double  nrg;		/* energy */
X		double  mxn;		/* max. energy */
X		double  mag;		/* magic level */
X		double  brn;		/* brains */
X		short   crn;		/* crowns */
X		struct
X		{
X			short	type;
X			short	duration;
X		}   rng;	    	/* ring stuff */
X		char    pal;		/* palantir */
X		double  psn;		/* poison */
X		short   hw;	     	/* holy water */
X		short   amu;		/* amulets */
X		char    bls;		/* blessing */
X		short   chm;		/* charms */
X		double  gem;		/* gems */
X		short   quks;		/* quicksilver */
X		double  swd;		/* sword */
X		double  shd;		/* shield */
X		short   typ;		/* character type */
X		char    vrg;		/* virgin */
X		short   lastused;	/* day of year last used */
X		short   status;		/* playing, cloaked, etc. */
X		short   tampered;	/* decree'd, etc. flag */
X		double  scratch1, scratch2; /* var's for above */
X		char    blind;		/* blindness */
X		int		wormhole;  	/* # of wormhole, 0 = none */
X		long    age;		/* age in seconds */
X		short   degen;		/* age/2500 last degenerated */
X		short   istat;		/* used for inter-terminal battle */
X	} stat;
X
X	struct	nstats    	/* player stats -- new format */
X	{
X		char    nname[21];	/* name */
X		char    npswd[9];	/* password */
X		char    nlogin[10];	/* login */
X		double  nx;	    	/* x coord */
X		double  ny;	    	/* y coord */
X		double  nexp;		/* experience */
X		int 	nlvl;	   	/* level */
X		short   nquk;		/* quick */
X		double  nstr;		/* strength */
X		double  nsin;		/* sin */
X		double  nman;		/* mana */
X		double  ngld;		/* gold */
X		double  nnrg;		/* energy */
X		double  nmxn;		/* max. energy */
X		double  nmag;		/* magic level */
X		double  nbrn;		/* brains */
X		short   ncrn;		/* crowns */
X		struct
X		{
X			short	ntype;
X			short	nduration;
X		}   nrng;	    	/* ring stuff */
X		char    npal;		/* palantir */
X		double  npsn;		/* poison */
X		short   nhw;	     	/* holy water */
X		short   namu;		/* amulets */
X		char    nbls;		/* blessing */
X		short   nchm;		/* charms */
X		double  ngem;		/* gems */
X		short   nquks;		/* quicksilver */
X		double  nswd;		/* sword */
X		double  nshd;		/* shield */
X		short   ntyp;		/* character type */
X		char    nvrg;		/* virgin */
X		short   nlastused;	/* day of year last used */
X		short   nstatus;		/* playing, cloaked, etc. */
X		short   ntampered;	/* decree'd, etc. flag */
X		double  nscr1, nscratch2; /* var's for above */
X		char    nblind;		/* blindness */
X		int		nwormhole;  	/* # of wormhole, 0 = none */
X		long    nage;		/* age in seconds */
X		short   ndegen;		/* age/2500 last degenerated */
X		short   nistat;		/* used for inter-terminal battle */
X		short	lives;		/* number of lives lived */
X	} newstat;
X
X	FILE	*oldcharac, *newcharac;
X
X	char	oldpfile[100];
X	char	newpfile[100];
X
X	strcpy(oldpfile,PATH/characs");
X	strcpy(newpfile,PATH/newcharacs");
X	if((oldcharac = fopen(oldpfile,"r")) == NULL)
X	{
X		fprintf(stderr,"Cannot open original character file!\n");
X		exit(1);
X	}
X	if((newcharac = fopen(newpfile,"w")) == NULL)
X	{
X		fprintf(stderr,"Cannot create new character file!\n");
X		exit(1);
X	}
X	while (fread((char *) &stat,sizeof(stat),1,oldcharac))
X	{
X		strcpy (newstat.nname, stat.name);
X		strcpy (newstat.npswd, stat.pswd);
X		strcpy (newstat.nlogin, stat.login);
X		newstat.nx = stat.x;
X		newstat.ny = stat.y;
X		newstat.nexp = stat.exp;
X		newstat.nlvl = stat.lvl;
X		newstat.nquk = stat.quk;
X		newstat.nstr = stat.str;
X		newstat.nsin = stat.sin;
X		newstat.nman = stat.man;
X		newstat.ngld = stat.gld;
X		newstat.nnrg = stat.nrg;
X		newstat.nmxn = stat.mxn;
X		newstat.nmag = stat.mag;
X		newstat.nbrn = stat.brn;
X		newstat.ncrn = stat.crn;
X		newstat.nrng.ntype = stat.rng.type;
X		newstat.nrng.nduration = stat.rng.duration;
X		newstat.npal = stat.pal;
X		newstat.npsn = stat.psn;
X		newstat.nhw = stat.hw;
X		newstat.namu = stat.amu;
X		newstat.nbls = stat.bls;
X		newstat.nchm = stat.chm;
X		newstat.ngem = stat.gem;
X		newstat.nquks = stat.quks;
X		newstat.nswd = stat.swd;
X		newstat.nshd = stat.shd;
X		newstat.ntyp = stat.typ;
X		newstat.nvrg = stat.vrg;
X		newstat.nlastused = stat.lastused;
X		newstat.nstatus = stat.status;
X		newstat.ntampered = stat.tampered;
X		newstat.nscr1 = stat.scratch1;
X		newstat.nscratch2 = stat.scratch2;
X		newstat.nblind = stat.blind;
X		newstat.nwormhole = stat.wormhole;
X		newstat.nage = stat.age;
X		newstat.ndegen = stat.degen;
X		newstat.nistat = stat.istat;
X		newstat.lives = 0;
X		fwrite((char *) &newstat,sizeof(newstat),1,newcharac);
X	}
X	fclose(oldcharac);
X	fclose(newcharac);
X}
TiDDleYwiNKs
	size="`wc -c convert.c`"
	size=`set - $size;echo $1`
echo "x - convert.c, $size characters"

	if test "$size" != "4919"
		then
		echo "Warning: error in transmitting 'convert.c';  should have 4919 characters."
	fi
fi