Macro for picking random entry from array

This commit is contained in:
Pasi Kallinen
2023-12-05 10:06:27 +02:00
parent b98a70e3ec
commit 5dc94f3d83
24 changed files with 45 additions and 42 deletions

View File

@@ -406,7 +406,7 @@ growl(register struct monst* mtmp)
/* presumably nearness and soundok checks have already been made */
if (Hallucination)
growl_verb = h_sounds[rn2(SIZE(h_sounds))];
growl_verb = ROLL_FROM(h_sounds);
else
growl_verb = growl_sound(mtmp);
if (growl_verb) {
@@ -432,7 +432,7 @@ yelp(register struct monst* mtmp)
/* presumably nearness and soundok checks have already been made */
if (Hallucination)
yelp_verb = h_sounds[rn2(SIZE(h_sounds))];
yelp_verb = ROLL_FROM(h_sounds);
else
switch (mtmp->data->msound) {
case MS_MEW:
@@ -483,7 +483,7 @@ whimper(register struct monst* mtmp)
/* presumably nearness and soundok checks have already been made */
if (Hallucination)
whimper_verb = h_sounds[rn2(SIZE(h_sounds))];
whimper_verb = ROLL_FROM(h_sounds);
else
switch (mtmp->data->msound) {
case MS_MEW:
@@ -602,7 +602,7 @@ maybe_gasp(struct monst* mon)
break;
}
if (dogasp) {
return Exclam[rn2(SIZE(Exclam))]; /* [mon->m_id % SIZE(Exclam)]; */
return ROLL_FROM(Exclam); /* [mon->m_id % SIZE(Exclam)]; */
}
return (const char *) 0;
}