/*
 * MKSoft SnakePit  Copyright (c) 1988  by Michael Sinz
 *
 * MAIN startup program...
 */

/*
 *                                  SnakePit
 *                                     by
 *                                Michael Sinz
 *
 *                  Copyright (c) 1988 - MKSoft Development
 *
 * SnakePit is a simple and yet addictive game in which you must get the
 * snake (you) off of the screen.  There are, however, some rough spots
 * and some obstacles that may need to be overcome.
 *
 * This game was written as an example of how to do a game that is as
 * system friendly as possible.  During development, there was joystick
 * control of the snake and I was able to have my little brother play it
 * in the top-half of a 400-line screen while I was working on code in the
 * bottom half.  Since this is a quick (1-week) hack that was done back in
 * 1988 and since it was written in pre-ANSI Manx days, the code looks a
 * bit ugly.  I hope you can understand.
 *
 * If you come up with some good screens for SnakePit, please send them
 * to me.
 *
 * ************************************************************************
 *
 * 	   Reading legal mush can turn your brain into guacamole!
 *
 * 		   So here is some of that legal mush:
 *
 * Permission is hereby granted to distribute this program's source,
 * executable, and documentation for non-commercial purposes, so long as
 * the copyright notices are not removed from the sources, executable or
 * documentation.  This program may not be distributed for a profit
 * without the express written consent of the author Michael Sinz.
 *
 * This program is not in the public domain.
 *
 * Fred Fish is expressly granted permission to distribute this program's
 * source and executable as part of the "Fred Fish freely redistributable
 * Amiga software library."
 *
 * Permission is expressly granted for this program and it's source to be
 * distributed as part of the Amicus Amiga software disks, and the First
 * Amiga User Group's Hot Mix disks.
 *
 * ************************************************************************
 *
 * If you have any comments or suggestions (or bug reports :-(), you can
 * contact MKSoft Development via
 *
 * 	BIX:		"msinz"
 * or	USENET:		"rutgers!cbmvax!mks"
 * or	INTERNET:	"mks@cbmvax.commodore.com"
 *
 * or via USnail at the address below.
 *
 * If you enjoy this program, and would like to see more quality software
 * for the Amiga, please help "feed the programmer" For only $20 you will
 * get a disk with the latest and greatest of MKSoft Development.
 *
 * 		MKSoft Development
 * 		163 Appledore Drive
 * 		Downingtown, PA 19335
 *
 * ************************************************************************
 */

#include	"Snake.h"

struct	IntuitionBase	*IntuitionBase;
struct	GfxBase		*GfxBase;
	char		*Save_File;

main(argc,argv)	int	argc;
		char	*argv[];
{
register	struct	WBStartup	*WBenchMsg;
register	struct	WBArg		*p;
register		BPTR		lock;

	if (argc) Save_File=argv[argc-1];
	else
	{
		WBenchMsg=(struct WBStartup *)argv;
		p=WBenchMsg->sm_ArgList;
		if (WBenchMsg->sm_NumArgs>1L) p++;
		Save_File=p->wa_Name;
		if (p->wa_Lock) lock=(BPTR)CurrentDir(p->wa_Lock);
	}

	if (IntuitionBase=OpenLibrary("intuition.library",33L))
	{
		if (GfxBase=OpenLibrary("graphics.library",33L))
		{

			Init_Sound();
			Sound_Dead();

/* Now, let's call our normal MAIN... */
			MyMain();

			Stop_Sound();

			CloseLibrary(GfxBase);
		}
		CloseLibrary(IntuitionBase);
	}

/* Return to old CurrentDir */
	if (!argc) if (p->wa_Lock) lock=(BPTR)CurrentDir(lock);
}
