🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.sources.games
Article #866

hack mods (6 of 6)

#866
From: sshefter
Date: Mon, 30 Mar 1987 20:57
245 lines
8544 bytes
From yale!husc6!panda!genrad!decvax!ucbvax!jade!zircon.berkeley.edu!marcp Sat Dec 13 18:54:39 EST 1986

[ That dead line-eater tasted terrible! ]

Well, hopefully everyone who can is using "Dr. Pain"'s improvements to
hack by now.  I know that I've certainly enjoyed the variety.  Unfortunately,
I'm the kind of person who gets annoyed by the most trivial of things, so
I changed some of my source to make myself feel better.  Thought I'd share
them with you.

DISCLAIMERS:  I am NOT a "hacker", but I do know C fairly well.  I've played
with my changes extensively, and have yet to die from unnatural (ie. segmenta-
tion fault) causes.  This does not mean, of course, that I haven't screwed
up somewhere.  Please post or mail me if you have problems.

MORE DISCLAIMERS:  This is not meant to denigrate "Dr. Pain" in any way.
Remember, any fool (like me) can modify someone else's work, but the real
credit goes to the author of the original.

To start off with, I remember someone mentioning that fire resistance should
be proof against magic traps.  I agree.  Near the end of hack.trap.c, in
the middle of domagictrap(), it should look like this:

	 switch (fate) {
	    case 10:
	    case 11:
		     /* sometimes nothing happens */
		       break;
	    case 12:
		     /* a flash of fire */
		     {
		       register int num = rnd(6);
		       pline("A tower of flame bursts from the floor!");
			if (Fire_resistance) {
				pline("You are uninjured");
			} else {
				u.uhpmax--;
				losehp(num,"a burst of flame");
			}
		       break;
		     }
	    /* odd feelings */
	    case 13:   pline("A shiver runs up and down your spine!");


It always annoyed me that I couldn't run, and automatically stop on fountains,
like I could on stairs.

Around line 265 in hack.c, change the code to look like this:

	u.ux += u.dx;
	u.uy += u.dy;
	if(flags.run) {
		if(tmpr->typ == DOOR ||
		(xupstair == u.ux && yupstair == u.uy) ||
#ifdef FOUNTAINS
		(tmpr->typ == FOUNTAIN) ||
#endif FOUNTAINS
		(xdnstair == u.ux && ydnstair == u.uy))
			nomul(0);
	}

It'll let you run, and stop on fountains.


Something that REALLY got to me was how, because of changes in creating Kops
and rockmoles, monsters started coming on earlier levels.  I dunno, I always
liked having two levels to find eyes before I started getting blinded on
level 3.  And I always liked to read my scrolls on seven, hoping to genocide
cockatrices before I met any face to face.  Surprise!  Anyway, here's a
couple changes that seem to correct it.  If you don't mind the new faces,
then don't use them.

Change the top of hack.monst.c to look like this:

struct permonst mons[CMNUM+2] = {
#ifdef KOPS
      { "Keystone Kop",       'K',1,6,7,1,4,0 },
#else KOPS
	{ "kobold",             'K',1,6,7,1,4,0 },
#endif KOPS
#ifndef ROCKMOLE
	{ "giant rat",          'r',0,12,7,1,3,0 },
#endif ROCKMOLE
	{ "bat",                'B',1,22,8,1,4,0 },
	{ "gnome",              'G',1,6,5,1,6,0 },
	{ "hobgoblin",          'H',1,9,5,1,8,0 },
	{ "jackal",             'J',0,12,7,1,2,0 },
	{ "leprechaun",         'L',5,15,8,1,2,0 },
	{ "acid blob",          'a',2,3,8,0,0,0 },
	{ "floating eye",       'E',2,1,9,0,0,0 },
	{ "homunculus",         'h',2,6,6,1,3,0 },
	{ "imp",                'i',2,6,2,1,4,0 },
	{ "orc",                'O',2,9,6,1,8,0 },
	{ "yellow light",       'y',3,15,0,0,0,0 },
	{ "zombie",             'Z',2,6,8,1,8,0 },
	{ "giant ant",          'A',3,18,3,1,6,0 },
#ifdef ROCKMOLE
      { "rock mole",          'r',3,3,0,1,6,0 },
#endif ROCKMOLE
	{ "fog cloud",          'f',3,1,0,1,6,0 },
	{ "nymph",              'N',6,12,9,1,2,0 },


Then, around line 30 in hack.makemon.c, change the code to look like this:

	} else {
		ct = CMNUM - strlen(fut_geno);
		if(index(fut_geno, 'm')) ct++;  /* make only 1 minotaur */
		if(index(fut_geno, '@')) ct++;
		if(ct <= 0) return(0);            /* no more monsters! */
		tmp = 7;
#ifdef KOPS
		tmp--;
#endif KOPS
#ifdef ROCKMOLE
		if(dlevel<4)tmp--;
#endif ROCKMOLE
		tmp = rn2(ct*dlevel/24 + tmp);
		if(tmp < dlevel - 4) tmp = rn2(ct*dlevel/24 + 12);
		if(tmp >= ct) tmp = rn1(ct - ct/2, ct/2);
		ct = 0;
#ifdef KOPS
		ct++;
#endif KOPS
		for(; ct < CMNUM; ct++){
			ptr = &mons[ct];
			if(index(fut_geno, ptr->mlet))
				continue;
			if(!tmp--) goto gotmon;
		}
		panic("makemon?");
	}
gotmon:

These changes should have makemon() making monsters on the same
levels that they used to be coming in at, instead of things like imps
and homunculi on level one.

Finally, something I was having a lot of problems with, but no one else
mentioned was hassles with two traps that I have, but "Dr. Pain" doesn't:
namely, the spiked pit and level teleporter traps.  This fouled up the
identification of webs, and even crashed occasionally.  For those others
out there who have these traps, the rest of the article is for you.  Those
of you who don't just need one more thing:  in hack.trap.c, the first name
in the list of trap names should be "".  This corresponds to NO_TRAP, which
is 0.  If this is confusing, read on.

This change to hack.trap.c will prevent any seg faults when you
try to identify a web trap.  You MUST have that ' "", ' in the
beginning, regardless of whether you have any new traps or if
you only have 7 or 8.

   char *traps[] = {
	   "",
	   " bear trap",
	   "n arrow trap",
	   " dart trap",
	   " trapdoor",
	   " teleportation trap",
	   " level teleportation trap",
	   " pit",
	   " spiked pit",
	   " sleeping gas trap",
#ifdef NEWTRAPS
	  " magic trap",
	  " squeaky board",
	   " piercer",
	   " mimic",
#ifdef SPIDERS
	  " web"
#endif SPIDERS
#else NEWTRAPS
	   " piercer",
	   " mimic",
#ifdef SPIDERS
	  " web"
#endif SPIDERS
#endif NEWTRAPS
   };

If you don't have the spiked pit and level teleporter, there's no need to
read any further.  I don't think you'll have any problems.

This is what my def.trap.h file looks like with everything:

/* various kinds of traps */
#define NO_TRAP         0
#define BEAR_TRAP       1
#define ARROW_TRAP      2
#define DART_TRAP       3
#define TRAPDOOR        4
#define TELEP_TRAP      5
#define LEVEL_TELEP     6
#define PIT             7
#define SPIKED_PIT      8
#define SLP_GAS_TRAP    9
#ifdef NEWTRAPS
#define MGTRP          10
#define SQBRD          11
#define PIERC          12
#define MIMIC          13       /* used only in mklev.c */
#ifdef SPIDERS
#define WEB            14
#define TRAPNUM       15      /* if not less than 32, change sizeof(ttyp) */
#else SPIDERS
#define TRAPNUM        14
#endif SPIDERS
#else NEWTRAPS
#define PIERC          10
#define MIMIC          11
#ifdef SPIDERS
#define WEB            12
#define TRAPNUM        13
#else SPIDERS
#define TRAPNUM        12
#endif SPIDERS
#endif NEWTRAPS
			       /* see also mtrapseen (bit map) */

I had a bad time with an unpredictable seg fault for a while, but was able
to trace it down to some bitwise operations.  Changing hack.mfndpos.h took
care of it ( I just increased all the numbers).  It should look like this:

#define ALLOW_TRAPS     07777
#define ALLOW_U         010000
#define ALLOW_M         020000
#define ALLOW_TM        040000
#define ALLOW_ALL       (ALLOW_U | ALLOW_M | ALLOW_TM | ALLOW_TRAPS)
#define ALLOW_SSM       0100000
#define ALLOW_ROCK      0200000
#define        ALLOW_WALL      02000000
#define NOTONL          0400000
#define NOGARLIC        01000000

If you don't feel like changing all these numbers, I would recommend killing
your dog immediately and not taming any other monsters for the rest of the
game.

That's it!  Hope this makes your playing different but not too different.

						Marc M. Pack

p.s.  Would someone out there be kind enough to mail me the source to ARC,
for unix and/or the pc? (preferable both)
Technical Details
Message-ID: <2637@yale-celed.yale.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!yale!sshefter
References: <2633@yale-celed.yale.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!yale!sshefter
From: sshefter@yale.UUCP
Newsgroups: net.sources.games
Subject: hack mods (6 of 6)
Message-ID: <2637@yale-celed.yale.UUCP>
Date: Mon, 30-Mar-87 15:57:58 EST
Article-I.D.: yale-cel.2637
Posted: Mon Mar 30 15:57:58 1987
Date-Received: Wed, 1-Apr-87 00:47:32 EST
References: <2633@yale-celed.yale.UUCP>
Reply-To: sshefter@yale-celed.UUCP (Bret A. Shefter)
Distribution: world
Organization: Yale University Computer Science Dept, New Haven CT
Lines: 245