Notes on Building NH3.2 with Think C

In General

	What is different between MPW and Think C?

	Think C does not have a shell, :-(.  MPW does.  Ugh.  The lack of
shell requires the cumbersome task of building the pieces by hand.
We build NetHack in the top directory but all files are placed in a result
directory.  The final executable will need to be moved to this result
directory.  Eventually we hope to modify NetHack to look for its files
in its resources.

	Life without a shell also requires the NetHack resource file to 
be put together by hand.  This is one area that Think C 6.0 has improved our
lives.  Under 6.0, we can now add E.rsrc and E.r files as source to the
project.  Dot rsrc files will be added to the project rsrc file directly and
dot r files will be compiled and then added.  For those who are without Think
6.0, good luck.  The best approach is to use the resource compiler to compile
the dot r file, and name the result as the projects rsrc file.

	Makedefs is another story.  When run, a command window pops up.  Hit return
to perform all options.  Otherwise, type in the options you require.

	Needless to say, all of the above stuff that we must do because of
the lack of shell also implies no Makefile, so we must be aware of what
files that we have modified and which files are dependent upon these modified
files.  In other words, we must constantly ask ourselves "gee, do we need to
run Makedefs again?".  Life is tough; this is to help you get used to it.

	What follows are most of the steps that we take in compiling NH3.2 using
Think C 6.  If you find something left out, or think a little more detail is
needed, send us some mail.  We can be reached at nethack-bugs@linc.cis.upenn.edu

The Steps

	-2. Read the Think C manuals.  Know your compiler and your
	    environment.  They are your friends and you are stuck with them.
	
	-1. Get Think Reference or buy a bunch of books that cover
	    Macintosh programming (the correct number of books can be
	    determined when you start seeing the same stuff over and over
	    again -- or you run out of cash).
		
	0. Learn C and the standard io library.
	
	From here, we will assume that you know how to build and compile
projects, how file names are resolved, what a project's resource file is
for, and how the resource compiler works.  If you don't, repeat the above
steps.
	
	1. Grab the sources, maintaining the directory structure.  We will
refer to the top most directory as 'top'.

	2. Move the project files in :sys:mac to top.  The projects are MakeDefs.proj,
DgnComp.proj, LevComp.proj and NetHack.proj.
	
	3. Delete (or rename) 'sys:mac:hack.h'.  It is used in the MPW
build and will interfere with the Think C compile.

	4. Create a directory "lib" at the top level.

	5. Build and run MakeDefs.

		You will be presented with a list of options.  Initially choose them all (the
		default).  Later you may wish to only run a few of them.  The options are
		"odemvpqrhz", each of which makes a file:

				-o creates :include:onames.h
				-p creates :include:pm.h
				-z creates :src:vis_tab.c
				-m creates :src:monstr.c
				-e creates :dat:dundeon.pdf
				-v creates :lib:options
				-d creates :lib:data
				-r creates :lib:rumors
				-h creates :lib:oracles
				-q creates :lib:quest.dat

	6. Make a precompiled header.  This step is optional.  If you do it, you
	   will speed up your compile, but it adds complexity.  If you change any
	   header, you will need to redo this step.  Change the following files:

		include:hack.h
			a. this file should be renamed 'include:realhack.h'.
			b. create a new file 'sys:mac:NetHack Headers.c'
			   with a single line:
				#include 'realhack.h'
			c. precompile this new file and save the precompile output
			   as 'include:hack.h'
	
		sys:share:lev_lex.c, sys:share:lev_yacc.c, util:lev_main.c
			a. change inclusion of 'hack.h' to 'realhack.h'

	7. Copy the following files.  You may want to change News or NHDeflts.

		a. copy ':sys:mac:MacHelp' to ':lib:MacHelp'
		b. copy ':sys:mac:News' to ':lib:News'
		c. copy ':sys:mac:NHDeflts' to ':lib:NetHack Defaults'

	8. Build and run DgnComp.
		This will create a file "dungeon" in the lib directory.

	9. Build and run LevComp.
		This will build the level files (*.lev) in the lib directory.

	10. Build NetHack.
		Move NetHack in the lib directory.



Appendix

A. Futures

	1.	Modify NetHack to look for data files in the folder 'data'.
	2.	Take advantage of the new scripting abilities of Think C 6.0.

B. Project Contents

All projects should have both far code and far data set.  Set the
application size of NetHack.proj to a couple of megs.

Set the application size of LevComp.proj to a meg (We suspect that there is a
memory leak in there somewhere).  All projects should contain the libraries
MacTraps, ANSI, and unix.
		
		MakeDefs.proj should contain the following source files:
		
			objects.c
			monst.c
			MakeDefs.c
			
		DgnComp.proj should contain the following source files:
			
			dgn_lex.c
			dgn_main.c
			dgn_yacc.c
			alloc.c
			panic.c

		LevComp.proj should contain the following source files:
		
			monst.c
			objects.c
			drawing.c
			alloc.c
			panic.c
			lev_lex.c
			lev_yacc.c
			macerrs.c
			macfile.c
			decl.c
			lev_main.c
			
			add #define SPEC_LEV to prefix
			
		NetHack.proj should contain the following source files:

			allmain.c
			alloc.c
			apply.c
			artifact.c
			attrib.c
			ball.c
			bones.c
			botl.c
			cmd.c
			dbridge.c
			decl.c
			detect.c
			display.c
			do.c
			do_name.c
			do_wear.c
			dog.c
			dogmove.c
			dokick.c
			dothrow.c
			drawing.c
			dungeon.c
			eat.c
			end.c
			engrave.c
			exper.c
			explode.c
			extralev.c
			files.c
			fountain.c
			hack.c
			hacklib.c
			invent.c
			light.c
			lock.c
			maccurs.c
			macerrs.c
			macfile.c
			macmain.c
			macmenu.c
			macsnd.c
			macunix.c
			macwin.c
			makemon.c
			mcastu.c
			mgetline.c
			mhitm.c
			mhitu.c
			minion.c
			mklev.c
			mkmap.c
			mkmaze.c
			mkobj.c
			mkroom.c
			mmodal.c
			mon.c
			mondata.c
			monmove.c
			monst.c
			monstr.c NOTE: created by MakeDefs -m, so add it later
			mplayer.c
			mstring.c
			mthrowu.c
			muse.c
			music.c
			o_init.c
			objects.c
			objnam.c
			options.c
			pager.c
			pickup.c
			pline.c
			polyself.c
			potion.c
			pray.c
			priest.c
			quest.c
			questpgr.c
			random.c
			read.c
			rect.c
			restore.c
			rip.c
			rnd.c
			rumors.c
			save.c
			shk.c
			shknam.c
			sit.c
			sounds.c
			sp_lev.c
			spell.c
			steal.c
			timeout.c
			mactopl.c
			topten.c
			track.c
			trap.c
			u_init.c
			uhitm.c
			vault.c
			version.c
			vision.c
			vis_tab.c	NOTE: generated by Makedefs -z
			weapon.c
			were.c
			wield.c
			windows.c
			wizard.c
			worm.c
			worn.c
			write.c
			zap.c
			getline.c
			topl.c
			wintty.c
			mactty.c
			mttymain.c
			dprintf.c
