rph@nancy (Richard Hughey) (12/09/87)
Some bug fixes.... First, the dog bug in fight.c: attack() changed to work better. Second, with the expanded endgame, there were some dependencies on MAXLEVEL being 40 instead of being MAXLEVEL. These problems occur when a new shape for a chameleon is being selected. The code changes are to: mon.c: newcham(): modified so that second (mdat) arg = 0 has the routine pick a random shape based on current dungeon level. and to calls in: makemon.c:makemon(), monmove.c:dochug(), spell.c:docast(). The diff's are below. 'old<fname>' is the 2.2 distribution version. Many thanks to Mike Stephenson for putting it all together: it looks great! -- Richard ------------------------------------------------------------------------ *** oldmon.c Tue Dec 8 17:29:55 1987 --- mon.c Tue Dec 8 18:45:31 1987 *************** *** 679,684 **** --- 679,685 ---- } #endif + newcham(mtmp,mdat) /* make a chameleon look like a new monster */ /* returns 1 if the monster actually changed */ register struct monst *mtmp; *************** *** 685,691 **** register struct permonst *mdat; { register mhp, hpn, hpd; ! if(mdat == mtmp->data) return(0); /* still the same monster */ #ifndef NOWORM if(mtmp->wormno) wormdead(mtmp); /* throw tail away */ --- 686,700 ---- register struct permonst *mdat; { register mhp, hpn, hpd; ! #ifdef RPH ! /* mdat = 0 -> caller wants a random monster shape */ ! if (mdat == 0) { ! /* ie. minimum shape is mons[15], minimum random range */ ! /* is 3, and randomness tails off as you descend into the */ ! /* depths max shape is mons[CMNUM-1] */ ! mdat = &mons[CMNUM-1-rn2((CMNUM-17) - (CMNUM-20)*dlevel/MAXLEVEL)]; ! } ! #endif if(mdat == mtmp->data) return(0); /* still the same monster */ #ifndef NOWORM if(mtmp->wormno) wormdead(mtmp); /* throw tail away */ *** oldmakemon.c Tue Dec 8 17:29:48 1987 --- makemon.c Tue Dec 8 18:11:36 1987 *************** *** 40,46 **** boolean anything = (!ptr); int zlevel = dlevel; #ifdef BVH ! if(has_amulet()) zlevel = 40; #endif /* if a monster already exists at the position, return */ if(x != 0 || y != 0) if(m_at(x,y)) return((struct monst *) 0); --- 40,46 ---- boolean anything = (!ptr); int zlevel = dlevel; #ifdef BVH ! if(has_amulet()) zlevel = MAXLEVEL; #endif /* if a monster already exists at the position, return */ if(x != 0 || y != 0) if(m_at(x,y)) return((struct monst *) 0); *************** *** 137,148 **** --- 137,156 ---- mtmp->cham = 0; else { mtmp->cham = 1; + #ifndef RPH (void) newcham(mtmp, &mons[zlevel+14+rn2(CMNUM-14-zlevel)]); + #else + (void) newcham(mtmp,0); + #endif } #else mtmp->cham = 1; + #ifndef RPH (void) newcham(mtmp, &mons[zlevel+14+rn2(CMNUM-14-zlevel)]); + #else + (void) newcham(mtmp, 0); + #endif #endif } if(ptr->mlet == 'I' || ptr->mlet == ';') *** oldspell.c Tue Dec 8 18:10:04 1987 --- spell.c Tue Dec 8 18:11:35 1987 *************** *** 305,311 **** --- 305,315 ---- mtmp = makedog(); if(mtmp) { /* make it into something else */ + #ifndef RPH (void) newcham(mtmp, &mons[dlevel+14+rn2(CMNUM-14-dlevel)]); + #else + (void) newcham(mtmp,0); + #endif if(confused) mtmp->mtame = mtmp->mpeaceful = 0; } *** oldfight.c Tue Dec 8 19:13:07 1987 --- fight.c Tue Dec 8 19:12:28 1987 *************** *** 466,475 **** --- 466,484 ---- char *dname; /* added by Janet Walz (walz@mimsy) */ mtmp->mflee = 1; mtmp->mfleetim = rnd(6); + #ifndef RPH if (dname = NAME(mtmp)) pline("You stop to avoid hitting %s.",dname); else pline("You stop to avoid hitting your dog."); + #else + dname = NAME(mtmp); + if (dname == 0 || dname[0] == '\0') + pline("You stop to avoid hitting your dog."); + else + pline("You stop to avoid hitting %s.",dname); + #endif + return(TRUE); } if (flags.confirm && (mtmp->mpeaceful || mtmp->mtame) && ! Confusion *** oldmonmove.c Tue Dec 8 17:30:26 1987 --- monmove.c Tue Dec 8 18:11:35 1987 *************** *** 31,37 **** --- 31,41 ---- register tmp, nearby, scared, onscary; if(mtmp->cham && !rn2(6)) + #ifndef RPH (void) newcham(mtmp, &mons[dlevel+14+rn2(CMNUM-14-dlevel)]); + #else + (void) newcham(mtmp, 0); + #endif mdat = mtmp->data; if(mdat->mlevel < 0) panic("bad monster %c (%d)",mdat->mlet,mdat->mlevel); ------------------------------ Richard Hughey CSNET: rph%cs.brown.edu@relay.cs.net Brown University BITNET: rph@browncs (decvax, ihnp4, allegra)!brunix!rph