R809 - newcham message reorganization
Add a param to newcham() to let it print "The oldmon turns into a newmon!" rather than always printing this externally. Should ensure a good ordering of the messages. Also put some special name handling in one place and catch a couple cases where "saddled" was printed, resulting in funny messages.
This commit is contained in:
@@ -1107,7 +1107,7 @@ E void NDECL(rescham);
|
||||
E void NDECL(restartcham);
|
||||
E void FDECL(restore_cham, (struct monst *));
|
||||
E void FDECL(mon_animal_list, (BOOLEAN_P));
|
||||
E int FDECL(newcham, (struct monst *,struct permonst *,BOOLEAN_P));
|
||||
E int FDECL(newcham, (struct monst *,struct permonst *,BOOLEAN_P,BOOLEAN_P));
|
||||
E int FDECL(can_be_hatched, (int));
|
||||
E int FDECL(egg_type_from_parent, (int,BOOLEAN_P));
|
||||
E boolean FDECL(dead_species, (int,BOOLEAN_P));
|
||||
|
||||
@@ -191,23 +191,8 @@ boolean devour;
|
||||
delobj(obj);
|
||||
|
||||
if (poly) {
|
||||
char oldpet[BUFSZ];
|
||||
#ifdef STEED
|
||||
long mw = mtmp->misc_worn_check;
|
||||
|
||||
mtmp->misc_worn_check &= ~W_SADDLE;
|
||||
#endif
|
||||
Strcpy(oldpet, Monnam(mtmp));
|
||||
#ifdef STEED
|
||||
mtmp->misc_worn_check = mw;
|
||||
#endif
|
||||
if (newcham(mtmp, (struct permonst *)0, FALSE) &&
|
||||
cansee(mtmp->mx, mtmp->my)) {
|
||||
uchar save_mnamelth = mtmp->mnamelth;
|
||||
mtmp->mnamelth = 0;
|
||||
pline("%s turns into %s!", oldpet, a_monnam(mtmp));
|
||||
mtmp->mnamelth = save_mnamelth;
|
||||
}
|
||||
(void) newcham(mtmp, (struct permonst *)0, FALSE,
|
||||
cansee(mtmp->mx, mtmp->my));
|
||||
}
|
||||
/* limit "instant" growth to prevent potential abuse */
|
||||
if (grow && (int) mtmp->m_lev < (int)mtmp->data->mlevel + 15) {
|
||||
|
||||
@@ -955,7 +955,7 @@ register int mmflags;
|
||||
mtmp->cham = CHAM_ORDINARY;
|
||||
else {
|
||||
mtmp->cham = mcham;
|
||||
(void) newcham(mtmp, rndmonst(), FALSE);
|
||||
(void) newcham(mtmp, rndmonst(), FALSE, FALSE);
|
||||
}
|
||||
} else if (mndx == PM_WIZARD_OF_YENDOR) {
|
||||
mtmp->iswiz = TRUE;
|
||||
|
||||
@@ -1072,8 +1072,7 @@ label2: if (mdef->mhp > 0) return 0;
|
||||
mdef->data != &mons[PM_FIRE_ELEMENTAL] &&
|
||||
mdef->data != &mons[PM_SALAMANDER] &&
|
||||
mdef->data != &mons[PM_GREEN_SLIME]) {
|
||||
if (vis) pline("%s turns into slime.", Monnam(mdef));
|
||||
(void) newcham(mdef, &mons[PM_GREEN_SLIME], FALSE);
|
||||
(void) newcham(mdef, &mons[PM_GREEN_SLIME], FALSE, vis);
|
||||
mdef->mstrategy &= ~STRAT_WAITFORU;
|
||||
tmp = 0;
|
||||
}
|
||||
|
||||
37
src/mon.c
37
src/mon.c
@@ -462,7 +462,7 @@ mcalcdistress()
|
||||
|
||||
/* possibly polymorph shapechangers and lycanthropes */
|
||||
if (mtmp->cham && !rn2(6))
|
||||
(void) newcham(mtmp, (struct permonst *)0, FALSE);
|
||||
(void) newcham(mtmp, (struct permonst *)0, FALSE, FALSE);
|
||||
were_change(mtmp);
|
||||
|
||||
/* gradually time out temporary problems */
|
||||
@@ -642,7 +642,8 @@ meatmetal(mtmp)
|
||||
delobj(otmp);
|
||||
ptr = mtmp->data;
|
||||
if (poly) {
|
||||
if (newcham(mtmp, (struct permonst *)0, FALSE))
|
||||
if (newcham(mtmp, (struct permonst *)0,
|
||||
FALSE, FALSE))
|
||||
ptr = mtmp->data;
|
||||
} else if (grow) {
|
||||
ptr = grow_up(mtmp, (struct monst *)0);
|
||||
@@ -727,7 +728,8 @@ meatobj(mtmp) /* for gelatinous cubes */
|
||||
delobj(otmp); /* munch */
|
||||
ptr = mtmp->data;
|
||||
if (poly) {
|
||||
if (newcham(mtmp, (struct permonst *)0, FALSE)) ptr = mtmp->data;
|
||||
if (newcham(mtmp, (struct permonst *)0, FALSE, FALSE))
|
||||
ptr = mtmp->data;
|
||||
} else if (grow) {
|
||||
ptr = grow_up(mtmp, (struct monst *)0);
|
||||
} else if (heal) {
|
||||
@@ -1803,7 +1805,7 @@ mon_to_stone(mtmp)
|
||||
/* it's a golem, and not a stone golem */
|
||||
if(canseemon(mtmp))
|
||||
pline("%s solidifies...", Monnam(mtmp));
|
||||
if (newcham(mtmp, &mons[PM_STONE_GOLEM], FALSE)) {
|
||||
if (newcham(mtmp, &mons[PM_STONE_GOLEM], FALSE, FALSE)) {
|
||||
if(canseemon(mtmp))
|
||||
pline("Now it's %s.", an(mtmp->data->mname));
|
||||
} else {
|
||||
@@ -2091,7 +2093,8 @@ rescham()
|
||||
mcham = (int) mtmp->cham;
|
||||
if (mcham) {
|
||||
mtmp->cham = CHAM_ORDINARY;
|
||||
(void) newcham(mtmp, &mons[cham_to_pm[mcham]], FALSE);
|
||||
(void) newcham(mtmp, &mons[cham_to_pm[mcham]],
|
||||
FALSE, FALSE);
|
||||
}
|
||||
if(is_were(mtmp->data) && mtmp->data->mlet != S_HUMAN)
|
||||
new_were(mtmp);
|
||||
@@ -2134,7 +2137,7 @@ struct monst *mon;
|
||||
mcham = (int) mon->cham;
|
||||
if (mcham) {
|
||||
mon->cham = CHAM_ORDINARY;
|
||||
(void) newcham(mon, &mons[cham_to_pm[mcham]], FALSE);
|
||||
(void) newcham(mon, &mons[cham_to_pm[mcham]], FALSE, FALSE);
|
||||
} else if (is_were(mon->data) && !is_human(mon->data)) {
|
||||
new_were(mon);
|
||||
}
|
||||
@@ -2254,14 +2257,23 @@ struct monst *mon;
|
||||
|
||||
/* make a chameleon look like a new monster; returns 1 if it actually changed */
|
||||
int
|
||||
newcham(mtmp, mdat, polyspot)
|
||||
newcham(mtmp, mdat, polyspot, msg)
|
||||
struct monst *mtmp;
|
||||
struct permonst *mdat;
|
||||
boolean polyspot; /* change is the result of wand or spell of polymorph */
|
||||
boolean msg; /* "The oldmon turns into a newmon!" */
|
||||
{
|
||||
int mhp, hpn, hpd;
|
||||
int mndx, tryct;
|
||||
struct permonst *olddata = mtmp->data;
|
||||
char oldname[BUFSZ];
|
||||
|
||||
if (msg) {
|
||||
/* like Monnam() but never mention saddle */
|
||||
Strcpy(oldname, x_monnam(mtmp, ARTICLE_THE, (char *)0,
|
||||
SUPPRESS_SADDLE, FALSE));
|
||||
oldname[0] = highc(oldname[0]);
|
||||
}
|
||||
|
||||
/* mdat = 0 -> caller wants a random monster shape */
|
||||
tryct = 0;
|
||||
@@ -2393,6 +2405,15 @@ boolean polyspot; /* change is the result of wand or spell of polymorph */
|
||||
|
||||
newsym(mtmp->mx,mtmp->my);
|
||||
|
||||
if (msg) {
|
||||
uchar save_mnamelth = mtmp->mnamelth;
|
||||
mtmp->mnamelth = 0;
|
||||
pline("%s turns into %s!", oldname,
|
||||
mdat == &mons[PM_GREEN_SLIME] ? "slime" :
|
||||
x_monnam(mtmp, ARTICLE_A, (char*)0, SUPPRESS_SADDLE, FALSE));
|
||||
mtmp->mnamelth = save_mnamelth;
|
||||
}
|
||||
|
||||
mon_break_armor(mtmp, polyspot);
|
||||
if (!(mtmp->misc_worn_check & W_ARMG))
|
||||
mselftouch(mtmp, "No longer petrify-resistant, ",
|
||||
@@ -2543,7 +2564,7 @@ kill_genocided_monsters()
|
||||
mndx = monsndx(mtmp->data);
|
||||
if ((mvitals[mndx].mvflags & G_GENOD) || kill_cham[mtmp->cham]) {
|
||||
if (mtmp->cham && !kill_cham[mtmp->cham])
|
||||
(void) newcham(mtmp, (struct permonst *)0, FALSE);
|
||||
(void) newcham(mtmp, (struct permonst *)0, FALSE, FALSE);
|
||||
else
|
||||
mondead(mtmp);
|
||||
}
|
||||
|
||||
@@ -1783,13 +1783,13 @@ skipmsg:
|
||||
case MUSE_WAN_POLYMORPH:
|
||||
mzapmsg(mtmp, otmp, TRUE);
|
||||
otmp->spe--;
|
||||
(void) newcham(mtmp, muse_newcham_mon(mtmp), TRUE);
|
||||
(void) newcham(mtmp, muse_newcham_mon(mtmp), TRUE, FALSE);
|
||||
if (oseen) makeknown(WAN_POLYMORPH);
|
||||
return 2;
|
||||
case MUSE_POT_POLYMORPH:
|
||||
mquaffmsg(mtmp, otmp);
|
||||
if (vismon) pline("%s suddenly mutates!", Monnam(mtmp));
|
||||
(void) newcham(mtmp, muse_newcham_mon(mtmp), FALSE);
|
||||
(void) newcham(mtmp, muse_newcham_mon(mtmp), FALSE, FALSE);
|
||||
if (oseen) makeknown(POT_POLYMORPH);
|
||||
m_useup(mtmp, otmp);
|
||||
return 2;
|
||||
@@ -1807,7 +1807,7 @@ skipmsg:
|
||||
if (mtmp->wormno) worm_move(mtmp);
|
||||
newsym(trapx, trapy);
|
||||
|
||||
(void) newcham(mtmp, (struct permonst *)0, FALSE);
|
||||
(void) newcham(mtmp, (struct permonst *)0, FALSE, FALSE);
|
||||
return 2;
|
||||
case MUSE_BULLWHIP:
|
||||
/* attempt to disarm hero */
|
||||
|
||||
@@ -1090,7 +1090,8 @@ struct obj *otmp;
|
||||
case POLY_TRAP:
|
||||
if (!resists_magm(mtmp)) {
|
||||
if (!resist(mtmp, WAND_CLASS, 0, NOTELL)) {
|
||||
(void) newcham(mtmp, (struct permonst *)0, FALSE);
|
||||
(void) newcham(mtmp, (struct permonst *)0,
|
||||
FALSE, FALSE);
|
||||
if (!can_saddle(mtmp) || !can_ride(mtmp)) {
|
||||
dismount_steed(DISMOUNT_POLY);
|
||||
} else {
|
||||
@@ -1888,7 +1889,8 @@ glovecheck: target = which_armor(mtmp, W_ARMG);
|
||||
if (resists_magm(mtmp)) {
|
||||
shieldeff(mtmp->mx, mtmp->my);
|
||||
} else if (!resist(mtmp, WAND_CLASS, 0, NOTELL)) {
|
||||
(void) newcham(mtmp, (struct permonst *)0, FALSE);
|
||||
(void) newcham(mtmp, (struct permonst *)0,
|
||||
FALSE, FALSE);
|
||||
if (in_sight) seetrap(trap);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1453,7 +1453,7 @@ register struct attack *mattk;
|
||||
mdef->data != &mons[PM_SALAMANDER] &&
|
||||
mdef->data != &mons[PM_GREEN_SLIME]) {
|
||||
You("turn %s into slime.", mon_nam(mdef));
|
||||
(void) newcham(mdef, &mons[PM_GREEN_SLIME], FALSE);
|
||||
(void) newcham(mdef, &mons[PM_GREEN_SLIME], FALSE, FALSE);
|
||||
tmp = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -191,7 +191,7 @@ struct obj *otmp;
|
||||
/* no corpse after system shock */
|
||||
xkilled(mtmp, 3);
|
||||
} else if (newcham(mtmp, (struct permonst *)0,
|
||||
(otyp != POT_POLYMORPH))) {
|
||||
(otyp != POT_POLYMORPH), FALSE)) {
|
||||
if (!Hallucination && canspotmon(mtmp))
|
||||
makeknown(otyp);
|
||||
}
|
||||
@@ -293,7 +293,7 @@ struct obj *otmp;
|
||||
if (monsndx(mtmp->data) == PM_STONE_GOLEM) {
|
||||
char *name = Monnam(mtmp);
|
||||
/* turn into flesh golem */
|
||||
if (newcham(mtmp, &mons[PM_FLESH_GOLEM], FALSE)) {
|
||||
if (newcham(mtmp, &mons[PM_FLESH_GOLEM], FALSE, FALSE)) {
|
||||
if (canseemon(mtmp))
|
||||
pline("%s turns to flesh!", name);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user