MCPcopy Create free account
hub / github.com/NetHack/NetHack / improvised_notes

Function improvised_notes

src/music.c:732–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

730}
731
732staticfn char *
733improvised_notes(boolean *same_as_last_time)
734{
735 static const char notes[7] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G' };
736 /* target buffer has to be in svc.context, otherwise saving game
737 * between improvised recitals would not be able to maintain
738 * the same_as_last_time context. */
739
740 /* You can change your tune, usually */
741 if (!(Unchanging && svc.context.jingle[0] != '\0')) {
742 int i, notecount = rnd(SIZE(svc.context.jingle) - 1); /* 1 - 5 */
743
744 for (i = 0; i < notecount; ++i) {
745 svc.context.jingle[i] = ROLL_FROM(notes);
746 }
747 svc.context.jingle[notecount] = '\0';
748 *same_as_last_time = FALSE;
749 } else {
750 *same_as_last_time = TRUE;
751 }
752 return svc.context.jingle;
753}
754
755/*
756 * So you want music...

Callers 1

do_improvisationFunction · 0.85

Calls 1

rndFunction · 0.85

Tested by

no test coverage detected