Unify monster gender setting
This commit is contained in:
@@ -1308,6 +1308,7 @@ E boolean FDECL(hideunder, (struct monst*));
|
|||||||
E void FDECL(hide_monst, (struct monst *));
|
E void FDECL(hide_monst, (struct monst *));
|
||||||
E void FDECL(mon_animal_list, (BOOLEAN_P));
|
E void FDECL(mon_animal_list, (BOOLEAN_P));
|
||||||
E int FDECL(select_newcham_form, (struct monst *));
|
E int FDECL(select_newcham_form, (struct monst *));
|
||||||
|
E void FDECL(mgender_from_permonts, (struct monst *, struct permonst *));
|
||||||
E int FDECL(newcham, (struct monst *,struct permonst *,BOOLEAN_P,BOOLEAN_P));
|
E int FDECL(newcham, (struct monst *,struct permonst *,BOOLEAN_P,BOOLEAN_P));
|
||||||
E int FDECL(can_be_hatched, (int));
|
E int FDECL(can_be_hatched, (int));
|
||||||
E int FDECL(egg_type_from_parent, (int,BOOLEAN_P));
|
E int FDECL(egg_type_from_parent, (int,BOOLEAN_P));
|
||||||
|
|||||||
@@ -2745,6 +2745,20 @@ int mndx;
|
|||||||
return polyok(mdat) ? mdat : 0;
|
return polyok(mdat) ? mdat : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mgender_from_permonst(mtmp, mdat)
|
||||||
|
struct monst *mtmp;
|
||||||
|
struct permonst *mdat;
|
||||||
|
{
|
||||||
|
if(is_male(mdat)) {
|
||||||
|
if(mtmp->female) mtmp->female = FALSE;
|
||||||
|
} else if (is_female(mdat)) {
|
||||||
|
if(!mtmp->female) mtmp->female = TRUE;
|
||||||
|
} else if (!is_neuter(mdat)) {
|
||||||
|
if(!rn2(10)) mtmp->female = !mtmp->female;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* make a chameleon take on another shape, or a polymorph target
|
/* make a chameleon take on another shape, or a polymorph target
|
||||||
(possibly self-infliced) become a different monster;
|
(possibly self-infliced) become a different monster;
|
||||||
returns 1 if it actually changes form */
|
returns 1 if it actually changes form */
|
||||||
@@ -2784,13 +2798,7 @@ boolean msg; /* "The oldmon turns into a newmon!" */
|
|||||||
} else if (mvitals[monsndx(mdat)].mvflags & G_GENOD)
|
} else if (mvitals[monsndx(mdat)].mvflags & G_GENOD)
|
||||||
return(0); /* passed in mdat is genocided */
|
return(0); /* passed in mdat is genocided */
|
||||||
|
|
||||||
if(is_male(mdat)) {
|
mgender_from_permonst(mtmp, mdat);
|
||||||
if(mtmp->female) mtmp->female = FALSE;
|
|
||||||
} else if (is_female(mdat)) {
|
|
||||||
if(!mtmp->female) mtmp->female = TRUE;
|
|
||||||
} else if (!is_neuter(mdat)) {
|
|
||||||
if(!rn2(10)) mtmp->female = !mtmp->female;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (In_endgame(&u.uz) && is_mplayer(olddata) && has_mname(mtmp)) {
|
if (In_endgame(&u.uz) && is_mplayer(olddata) && has_mname(mtmp)) {
|
||||||
/* mplayers start out as "Foo the Bar", but some of the
|
/* mplayers start out as "Foo the Bar", but some of the
|
||||||
|
|||||||
+2
-8
@@ -1499,14 +1499,8 @@ struct mkroom *croom;
|
|||||||
if ((mndx != NON_PM) && (&mons[mndx] != mtmp->data)) {
|
if ((mndx != NON_PM) && (&mons[mndx] != mtmp->data)) {
|
||||||
struct permonst *mdat = &mons[mndx];
|
struct permonst *mdat = &mons[mndx];
|
||||||
struct permonst *olddata = mtmp->data;
|
struct permonst *olddata = mtmp->data;
|
||||||
/* this code duplicated from newcham() */
|
|
||||||
if(is_male(mdat)) {
|
mgender_from_permonst(mtmp, mdat);
|
||||||
if(mtmp->female) mtmp->female = FALSE;
|
|
||||||
} else if (is_female(mdat)) {
|
|
||||||
if(!mtmp->female) mtmp->female = TRUE;
|
|
||||||
} else if (!is_neuter(mdat)) {
|
|
||||||
if(!rn2(10)) mtmp->female = !mtmp->female;
|
|
||||||
}
|
|
||||||
set_mon_data(mtmp, mdat, 0);
|
set_mon_data(mtmp, mdat, 0);
|
||||||
if (emits_light(olddata) != emits_light(mtmp->data)) {
|
if (emits_light(olddata) != emits_light(mtmp->data)) {
|
||||||
/* used to give light, now doesn't, or vice versa,
|
/* used to give light, now doesn't, or vice versa,
|
||||||
|
|||||||
Reference in New Issue
Block a user