extern void store_savefileinfo(NHFILE *);
extern void store_savefileinfo(NHFILE *);
extern int nhdatatypes_size(void);
+#if 0
extern void assignlog(char *, char*, int);
extern FILE *getlog(NHFILE *);
extern void closelog(NHFILE *);
+#endif
/* ### sfstruct.c ### */
*/
enum soundlib_ids {
- soundlib_unassigned = 0,
+ soundlib_nosound,
#ifdef SND_LIB_QTSOUND
soundlib_qtsound,
#endif
#ifdef SND_LIB_WINDSOUND
soundlib_windsound,
#endif
- soundlib_nosound
+#ifdef SND_LIB_MACSOUND
+ soundlib_macsound
+#endif
};
struct sound_procs {
extern struct sound_procs sndprocs;
-#define SOUNDID(soundname) #soundname, soundlib_##soundname
+#define SOUNDID(soundname) #soundname, ((enum soundlib_ids) soundlib_##soundname)
/*
* SOUNDCAP
|| defined(SND_LIB_OPENAL) || defined(SND_LIB_SDL_MIXER) \
|| defined(SND_LIB_MINIAUDIO) || defined(SND_LIB_FMOD) \
|| defined(SND_LIB_SOUND_ESCCODES) || defined(SND_LIB_VISSOUND) \
- || defined(SND_LIB_WINDSOUND)
+ || defined(SND_LIB_WINDSOUND) || defined(SND_LIB_MACSOUND)
#define SND_LIB_INTEGRATED /* shortcut for conditional code in other files */
--- /dev/null
+/* macsound.m */
+/* Copyright Michael Allison, 2023 */
+/* NetHack may be freely redistributed. See license for details. */
+
+#include "hack.h"
+
+#ifdef DEBUG
+#undef DEBUG
+#endif
+
+/* #import <Foundation/Foundation.h> */
+#import <AppKit/AppKit.h>
+
+/*
+ * Sample sound interface for NetHack
+ *
+ * Replace 'macsound' with your soundlib name in this template file.
+ * Should be placed in ../sound/macsound/.
+ */
+
+#define soundlib_macsound soundlib_nosound + 1
+
+static void macsound_init_nhsound(void);
+static void macsound_exit_nhsound(const char *);
+static void macsound_achievement(schar, schar, int32_t);
+static void macsound_soundeffect(char *, int32_t, int32_t);
+static void macsound_hero_playnotes(int32_t, const char *, int32_t);
+static void macsound_play_usersound(char *, int32_t, int32_t);
+static int affiliate(int32_t seid, const char *soundname);
+
+struct sound_procs macsound_procs = {
+ SOUNDID(macsound),
+// SNDCAP_USERSOUNDS | SNDCAP_HEROMUSIC
+// | SNDCAP_ACHIEVEMENTS |SNDCAP_SOUNDEFFECTS,
+ SNDCAP_USERSOUNDS | SNDCAP_HEROMUSIC | SNDCAP_SOUNDEFFECTS,
+ macsound_init_nhsound,
+ macsound_exit_nhsound,
+ macsound_achievement,
+ macsound_soundeffect,
+ macsound_hero_playnotes,
+ macsound_play_usersound,
+};
+
+/*
+ *
+ * Types of potential sound supports (all are optionally implemented):
+ *
+ * SNDCAP_USERSOUNDS User-specified sounds that play based on config
+ * file entries that identify a regular expression
+ * to match against message window text, and identify
+ * an external sound file to load in response.
+ * The sound interface function pointer used to invoke
+ * it:
+ *
+ * void (*sound_play_usersound)(char *filename,
+ * int32_t volume, int32_t idx);
+ *
+ * SNDCAP_HEROMUSIC Invoked by the core when the in-game hero is
+ * playing a tune on an instrument. The sound
+ * interface function pointer used to invoke it:
+ *
+ * void (*sound_hero_playnotes)(int32_t instrument,
+ * char *str, int32_t volume);
+ *
+ * SNDCAP_ACHIEVEMENTS Invoked by the core when an in-game achievement
+ * is reached. The soundlib routines could play
+ * appropriate theme or mood music in response.
+ * There would need to be a way to map the
+ * achievements to external user-specified sounds.
+ * The sound interface function pointer used to
+ * invoke it:
+ *
+ * void (*sound_achievement)(schar, schar,
+ * int32_t);
+ *
+ * SNDCAP_SOUNDEFFECTS Invoked by the core when something
+ * sound-producing happens in the game. The soundlib
+ * routines could play an appropriate sound effect
+ * in response. They can be public-domain or
+ * suitably-licensed stock sounds included with the
+ * game source and made available during the build
+ * process, or (not-yet-implemented) a way to
+ * tie particular sound effects to a user-specified
+ * sound macsounds in a config file. The sound
+ * interface function pointer used to invoke it:
+ *
+ * void (*sound_soundeffect)(char *desc, int32_t,
+ * int32_t volume);
+ *
+ * The routines below would call into your sound library.
+ * to fulfill the functionality.
+ */
+
+static void
+macsound_init_nhsound(void)
+{
+ /* Initialize external sound library */
+}
+
+static void
+macsound_exit_nhsound(const char *reason UNUSED)
+{
+ /* Close / Terminate external sound library */
+
+}
+
+/* fulfill SNDCAP_ACHIEVEMENTS */
+static void
+macsound_achievement(schar ach1 UNUSED, schar ach2 UNUSED, int32_t repeat UNUSED)
+{
+
+
+}
+
+/* magic number 40 is the current number of sound_ files to include */
+#define EXTRA_SOUNDS 40
+
+static int32_t affiliation[number_of_se_entries + EXTRA_SOUNDS] = { 0 };
+static NSString *soundstring[number_of_se_entries + EXTRA_SOUNDS];
+static NSSound *seSound[number_of_se_entries + EXTRA_SOUNDS];
+
+/* fulfill SNDCAP_SOUNDEFFECTS */
+static void
+macsound_soundeffect(char *desc UNUSED, int32_t seid, int volume UNUSED)
+{
+#ifdef SND_SOUNDEFFECTS_AUTOMAP
+
+ /* Supposedly, the following locations are searched in this order:
+ * 1. the application’s main bundle
+ * 2. ~/Library/Sounds
+ * 3. /Library/Sounds
+ * 4. /Network/Library/Sounds
+ * 5. /System/Library/Sounds
+ */
+
+ char buf[1024];
+ const char *soundname;
+
+ if (seid <= se_zero_invalid || seid >= number_of_se_entries)
+ return;
+ if (!affiliation[seid]) {
+ soundname = get_sound_effect_filename(seid, buf, sizeof buf, 1);
+ if (soundname) {
+ affiliate(seid, soundname);
+ }
+ }
+ if (affiliation[seid]) {
+ if ([seSound[seid] isPlaying])
+ [seSound[seid] stop];
+ [seSound[seid] play];
+ }
+#endif
+}
+
+#define WAVEMUSIC_SOUNDS
+
+/*
+ 0 sound_Bell.wav
+ 1 sound_Drum_Of_Earthquake.wav
+ 2 sound_Fire_Horn.wav
+ 3 sound_Frost_Horn.wav
+ 4 sound_Leather_Drum.wav
+ 5 sound_Bugle_A.wav
+ 6 sound_Bugle_B.wav
+ 7 sound_Bugle_C.wav
+ 8 sound_Bugle_D.wav
+ 9 sound_Bugle_E.wav
+10 sound_Bugle_F.wav
+11 sound_Bugle_G.wav
+12 sound_Magic_Harp_A.wav
+13 sound_Magic_Harp_B.wav
+14 sound_Magic_Harp_C.wav
+15 sound_Magic_Harp_D.wav
+16 sound_Magic_Harp_E.wav
+17 sound_Magic_Harp_F.wav
+18 sound_Magic_Harp_G.wav
+19 sound_Tooled_Horn_A.wav
+20 sound_Tooled_Horn_B.wav
+21 sound_Tooled_Horn_C.wav
+22 sound_Tooled_Horn_D.wav
+23 sound_Tooled_Horn_E.wav
+24 sound_Tooled_Horn_F.wav
+25 sound_Tooled_Horn_G.wav
+26 sound_Wooden_Flute_A.wav
+27 sound_Wooden_Flute_B.wav
+28 sound_Wooden_Flute_C.wav
+29 sound_Wooden_Flute_D.wav
+30 sound_Wooden_Flute_E.wav
+31 sound_Wooden_Flute_F.wav
+32 sound_Wooden_Flute_G.wav
+33 sound_Wooden_Harp_A.wav
+34 sound_Wooden_Harp_B.wav
+35 sound_Wooden_Harp_C.wav
+36 sound_Wooden_Harp_D.wav
+37 sound_Wooden_Harp_E.wav
+38 sound_Wooden_Harp_F.wav
+39 sound_Wooden_Harp_G.wav
+*/
+
+
+/* fulfill SNDCAP_HEROMUSIC */
+static void macsound_hero_playnotes(int32_t instrument,
+ const char *str, int32_t vol UNUSED)
+{
+#ifdef WAVEMUSIC_SOUNDS
+ uint32_t pseudo_seid;
+ boolean has_note_variations = FALSE;
+ char resourcename[120], *end_of_res = 0;
+ const char *c = 0;
+
+ if (!str)
+ return;
+ resourcename[0] = '\0';
+ switch(instrument) {
+ case ins_tinkle_bell:
+ Strcpy(resourcename, "sound_Bell");
+ pseudo_seid = 0;
+ break;
+ case ins_taiko_drum: /* DRUM_OF_EARTHQUAKE */
+ Strcpy(resourcename, "sound_Drum_Of_Earthquake");
+ pseudo_seid = 1;
+ break;
+ case ins_baritone_sax: /* FIRE_HORN */
+ Strcpy(resourcename, "sound_Fire_Horn");
+ pseudo_seid = 2;
+ break;
+ case ins_french_horn: /* FROST_HORN */
+ Strcpy(resourcename, "sound_Frost_Horn");
+ pseudo_seid = 3;
+ break;
+ case ins_melodic_tom: /* LEATHER_DRUM */
+ Strcpy(resourcename, "sound_Leather_Drum");
+ pseudo_seid = 4;
+ break;
+ case ins_trumpet: /* BUGLE */
+ Strcpy(resourcename, "sound_Bugle");
+ has_note_variations = TRUE;
+ pseudo_seid = 5;
+ break;
+ case ins_cello: /* MAGIC_HARP */
+ Strcpy(resourcename, "sound_Magic_Harp");
+ has_note_variations = TRUE;
+ pseudo_seid = 12;
+ case ins_english_horn: /* TOOLED_HORN */
+ Strcpy(resourcename, "sound_Tooled_Horn");
+ has_note_variations = TRUE;
+ pseudo_seid = 19;
+ break;
+ case ins_flute: /* WOODEN_FLUTE */
+ Strcpy(resourcename, "sound_Wooden_Flute");
+ has_note_variations = TRUE;
+ pseudo_seid = 26;
+ break;
+ case ins_orchestral_harp: /* WOODEN_HARP */
+ Strcpy(resourcename, "sound_Wooden_Harp");
+ has_note_variations = TRUE;
+ pseudo_seid = 33;
+ break;
+ case ins_pan_flute: /* MAGIC_FLUTE */
+ /* wav files for sound_Magic_Flute not added yet */
+ Strcpy(resourcename, "sound_Wooden_Flute");
+ has_note_variations = TRUE;
+ pseudo_seid = 26;
+ break;
+ }
+ pseudo_seid += number_of_se_entries; /* get past se_ entries */
+
+ if (has_note_variations) {
+ int i, idx = 0, notecount = strlen(str);
+ static const char *const note_suffixes[]
+ = { "_A", "_B", "_C", "_D", "_E", "_F", "_G" };
+
+ end_of_res = eos(resourcename);
+ c = str;
+ for (i = 0; i < notecount; ++i) {
+ if (*c >= 'A' && *c <= 'G') {
+ idx = (*c) - 'A';
+ pseudo_seid += idx;
+ if (pseudo_seid >= SIZE(affiliation))
+ break;
+ Strcpy(end_of_res, note_suffixes[idx]);
+ if (!affiliation[pseudo_seid]) {
+ affiliate(pseudo_seid, resourcename);
+ }
+ if (affiliation[pseudo_seid]) {
+ if ([seSound[pseudo_seid] isPlaying])
+ [seSound[pseudo_seid] stop];
+ [seSound[pseudo_seid] play];
+ }
+ }
+ c++;
+ }
+ } else {
+ if (!affiliation[pseudo_seid]) {
+ affiliate(pseudo_seid, resourcename);
+ }
+ if (affiliation[pseudo_seid]) {
+ if ([seSound[pseudo_seid] isPlaying])
+ [seSound[pseudo_seid] stop];
+ [seSound[pseudo_seid] play];
+ }
+ }
+#endif
+}
+
+/* fulfill SNDCAP_USERSOUNDS */
+static void
+macsound_play_usersound(char *filename UNUSED, int volume UNUSED, int idx UNUSED)
+{
+
+}
+
+static int
+affiliate(int32_t seid, const char *soundname)
+{
+ if (!soundname || seid <= se_zero_invalid || seid >= SIZE(affiliation))
+ return 0;
+
+ if (!affiliation[seid]) {
+ affiliation[seid] = seid;
+ soundstring[seid] = [NSString stringWithUTF8String:soundname];
+ seSound[seid] = [NSSound soundNamed:soundstring[seid]];
+ }
+ return 1;
+}
+/* end of macsound.m */
+
&& invocation_pos(u.ux, u.uy)
&& !On_stairs(u.ux, u.uy));
+ Hero_playnotes(obj_to_instr(obj), "C", 100);
You("ring %s.", the(xname(obj)));
if (Underwater || (u.uswallow && ordinary)) {
/* shk.c */
FALSE, /* auto_credit */
/* sounds.c */
- soundlib_unassigned, /* enum soundlib_ids active_soundlib */
+ soundlib_nosound, /* enum soundlib_ids active_soundlib */
/* trap.c */
{ 0, 0, FALSE }, /* acid_ctx */
itmp.otyp -= 1;
mundane = TRUE;
}
- Hero_playnotes(obj_to_instr(&itmp), "C", 50);
#define PLAY_NORMAL 0x00
#define PLAY_STUNNED 0x01
case MAGIC_FLUTE: /* Make monster fall asleep */
consume_obj_charge(instr, TRUE);
+ Hero_playnotes(obj_to_instr(&itmp), "C", 50);
You("%sproduce %s music.", !Deaf ? "" : "seem to ",
Hallucination ? "piped" : "soft");
put_monsters_to_sleep(u.ulevel * 5);
break;
case WOODEN_FLUTE: /* May charm snakes */
do_spec &= (rn2(ACURR(A_DEX)) + u.ulevel > 25);
+ Hero_playnotes(obj_to_instr(&itmp), "C", 50);
if (!Deaf)
pline("%s.", Tobjnam(instr, do_spec ? "trill" : "toot"));
else
if ((damage = zapyourself(instr, TRUE)) != 0) {
char buf[BUFSZ];
+ Hero_playnotes(obj_to_instr(&itmp), "C", 50);
Sprintf(buf, "using a magical horn on %sself", uhim());
losehp(damage, buf, KILLED_BY); /* fire or frost damage */
}
} else {
int type = BZ_OFS_AD((instr->otyp == FROST_HORN) ? AD_COLD : AD_FIRE);
+ Hero_playnotes(obj_to_instr(&itmp), "C", 50);
if (!Blind)
pline("A %s blasts out of the horn!", flash_str(type, FALSE));
ubuzz(BZ_U_WAND(type), rn1(6, 6));
makeknown(instr->otyp);
break;
case TOOLED_HORN: /* Awaken or scare monsters */
+ Hero_playnotes(obj_to_instr(&itmp), "C", 50);
if (!Deaf)
You("produce a frightful, grave sound.");
else
exercise(A_WIS, FALSE);
break;
case BUGLE: /* Awaken & attract soldiers */
+ Hero_playnotes(obj_to_instr(&itmp), "C", 50);
if (!Deaf)
You("extract a loud noise from %s.", yname(instr));
else
case MAGIC_HARP: /* Charm monsters */
consume_obj_charge(instr, TRUE);
+ Hero_playnotes(obj_to_instr(&itmp), "C", 50);
if (!Deaf)
pline("%s very attractive music.", Tobjnam(instr, "produce"));
else
break;
case WOODEN_HARP: /* May calm Nymph */
do_spec &= (rn2(ACURR(A_DEX)) + u.ulevel > 25);
+ Hero_playnotes(obj_to_instr(&itmp), "C", 50);
if (!Deaf)
pline("%s %s.", Yname2(instr),
do_spec ? "produces a lilting melody" : "twangs");
mundane is flagged */
consume_obj_charge(instr, TRUE);
+ Hero_playnotes(obj_to_instr(&itmp), "C", 50);
You("produce a heavy, thunderous rolling!");
pline_The("entire %s is shaking around you!", generic_lvl_desc());
do_earthquake((u.ulevel - 1) / 3 + 1);
break;
case LEATHER_DRUM: /* Awaken monsters */
if (!mundane) {
+ Hero_playnotes(obj_to_instr(&itmp), "C", 50);
if (!Deaf) {
You("beat a deafening row!");
incr_itimeout(&HDeaf, rn1(20, 30));
}
exercise(A_WIS, FALSE);
} else
+ /* TODO maybe: sound effects for these riffs */
+ Hero_playnotes(obj_to_instr(&itmp), "C", 50);
You("%s %s.",
rn2(2) ? "butcher" : rn2(2) ? "manage" : "pull off",
an(beats[rn2(SIZE(beats))]));
break;
case MAGIC_HARP:
ret_instr = ins_cello;
+ break;
case BELL:
case BELL_OF_OPENING:
ret_instr = ins_tinkle_bell;
#ifdef SND_LIB_WINDSOUND
extern struct sound_procs windsound_procs;
#endif
-extern struct sound_procs nosound_procs;
+#ifdef SND_LIB_MACSOUND
+extern struct sound_procs macsound_procs;
+#endif
+
+struct sound_procs nosound_procs = {
+ SOUNDID(nosound),
+ 0L,
+ (void (*)(void)) 0, /* init_nhsound */
+ (void (*)(const char *)) 0, /* exit_nhsound */
+ (void (*)(schar, schar, int32_t)) 0, /* achievement */
+ (void (*)(char *, int32_t, int32_t)) 0, /* sound effect */
+ (void (*)(int32_t, const char *, int32_t)) 0, /* hero_playnotes */
+ (void (*)(char *, int32_t, int32_t)) 0, /* play_usersound */
+};
/* The order of these array entries must match the
order of the enum soundlib_ids in sndprocs.h */
static struct sound_choices {
struct sound_procs *sndprocs;
} soundlib_choices[] = {
- { (struct sound_procs *) 0 },
+ { &nosound_procs }, /* default, built-in */
#ifdef SND_LIB_QTSOUND
{ &qtsound_procs },
#endif
#ifdef SND_LIB_SOUND_ESCCODES
{ &esccodes_procs },
#endif
+#ifdef SND_LIB_VISSOUND
+ { &vissound_procs },
+#endif
#ifdef SND_LIB_WINDSOUND
{ &windsound_procs },
#endif
-#ifdef SND_LIB_VISSOUND
- { &vissound_procs },
+#ifdef SND_LIB_MACSOUND
+ { &macsound_procs },
#endif
- { &nosound_procs }, /* default, built-in */
};
void
{
enum soundlib_ids idx = gc.chosen_soundlib;
- if (idx <= soundlib_unassigned || idx > soundlib_nosound)
+ if (idx < soundlib_nosound || idx >= SIZE(soundlib_choices))
idx = soundlib_nosound;
- if (ga.active_soundlib != soundlib_unassigned
- || ga.active_soundlib != idx) {
+ if (ga.active_soundlib != soundlib_nosound || idx != soundlib_nosound) {
if (soundprocs.sound_exit_nhsound)
(*soundprocs.sound_exit_nhsound)("assigning a new sound library");
- ga.active_soundlib = soundlib_unassigned;
}
soundprocs = *soundlib_choices[idx].sndprocs;
if (soundprocs.sound_init_nhsound)
(*soundprocs.sound_init_nhsound)();
ga.active_soundlib = soundprocs.soundlib_id;
+ gc.chosen_soundlib = ga.active_soundlib;
}
void
assign_soundlib(int idx)
{
- if (idx <= soundlib_unassigned || idx > soundlib_nosound)
+ if (idx < soundlib_nosound || idx >= SIZE(soundlib_choices))
idx = soundlib_nosound;
- if (ga.active_soundlib != soundlib_unassigned) {
- if (soundprocs.sound_exit_nhsound)
- (*soundprocs.sound_exit_nhsound)("assigning a new sound library");
- ga.active_soundlib = soundlib_unassigned;
- }
- gc.chosen_soundlib = soundlib_choices[idx].sndprocs->soundlib_id;
+ gc.chosen_soundlib = (uint32_t) soundlib_choices[idx].sndprocs->soundlib_id;
}
#if 0
const char *src;
idx = ga.active_soundlib;
- if (idx > soundlib_unassigned && idx <= soundlib_nosound) {
+ if (idx >= soundlib_nosound && idx < SIZE(soundlib_choices)) {
src = soundlib_choices[idx].sndprocs->soundname;
for (count = 1; count < maxlen; count++) {
if (*src == ',' || *src == '\0')
static void nosound_achievement(schar, schar, int32_t);
static void nosound_soundeffect(int32_t, int32_t);
static void nosound_play_usersound(char *, int32_t, int32_t);
-#endif
-struct sound_procs nosound_procs = {
- SOUNDID(nosound),
- 0L,
- (void (*)(void)) 0, /* init_nhsound */
- (void (*)(const char *)) 0, /* exit_nhsound */
- (void (*)(schar, schar, int32_t)) 0, /* achievement */
- (void (*)(char *, int32_t, int32_t)) 0, /* sound effect */
- (void (*)(int32_t, const char *, int32_t)) 0, /* hero_playnotes */
- (void (*)(char *, int32_t, int32_t)) 0, /* play_usersound */
-};
-
-#if 0
static void
nosound_init_nhsound(void)
{
{
}
+static void
+nosound_hero_playnotes(int32_t instr, const char *notes, int32_t vol)
+{
+}
+
static void
nosound_play_usersound(char *filename, int volume, int idx)
{
*/
#ifndef lint
-static char sccsid[] = "@(#)uudecode.c 5.5 (Berkeley) 7/6/88";
+/* static char sccsid[] = "@(#)uudecode.c 5.5 (Berkeley) 7/6/88"; */
#endif /* not lint */
#ifdef __MSDOS__ /* For Turbo C */
#endif
#endif
+#if __APPLE__
+#include "config.h"
+#endif
+
/*
* uudecode [input]
*
}
(void) sscanf(buf, "begin %o %s", &mode, dest);
-#if !defined(MSDOS) && !defined(VMS) && !defined(WIN32)
+#if !defined(MSDOS) && !defined(VMS) && !defined(WIN32) && !defined(MACOS)
/* handle ~user/file format */
if (dest[0] == '~') {
char *sl;
struct passwd *getpwnam();
struct passwd *user;
- char dnbuf[100], *index(), *strcat(), *strcpy();
+ char dnbuf[100], *strchr(), *strcat(), *strcpy();
sl = strchr(dest, '/');
if (sl == NULL) {
putc(c3, f);
}
-#if !defined(MSDOS) && !defined(VMS) && !defined(WIN32)
+#if !defined(MSDOS) && !defined(VMS) && !defined(WIN32) && !defined(MACOS)
/*
* Return the ptr in sp at which the character c appears;
* NULL if not found
micro.h mkroom.h monattk.h mondata.h monflag.h monst.h monsters.h \
obj.h objects.h objclass.h optlist.h patchlevel.h pcconf.h \
permonst.h prop.h rect.h region.h sym.h defsym.h rm.h sp_lev.h \
- spell.h sys.h system.h tcap.h timeout.h tradstdc.h trap.h unixconf.h \
- vision.h vmsconf.h wintty.h wincurs.h winX.h winprocs.h wintype.h \
- you.h youprop.h
+ spell.h sndprocs.h sys.h system.h tcap.h timeout.h tradstdc.h \
+ trap.h unixconf.h vision.h vmsconf.h wintty.h wincurs.h winX.h \
+ winprocs.h wintype.h you.h youprop.h
HSOURCES = $(HACKINCL) dgn_file.h
$(TARGETPFX)were.o $(TARGETPFX)wield.o $(TARGETPFX)windows.o \
$(TARGETPFX)wizard.o $(TARGETPFX)worm.o $(TARGETPFX)worn.o \
$(TARGETPFX)write.o $(TARGETPFX)zap.o \
- $(REGEXOBJ) $(RANDOBJ) $(SYSOBJ) $(WINOBJ) $(HINTOBJ) \
+ $(REGEXOBJ) $(RANDOBJ) $(SYSOBJ) $(WINOBJ) $(HINTOBJ) $(SNDLIBOBJ) \
$(TARGETPFX)version.o
#
DATE_O = $(TARGETPFX)date.o
pregame:
$(PREGAME)
-$(GAME): pregame $(MAKEDEFS) $(LUALIB) $(SYSTEM)
+$(GAME): pregame $(MAKEDEFS) $(LUALIB) $(WAVS) $(SYSTEM)
@echo "$(GAME) is up to date."
Sysunix: $(HOSTOBJ) $(HOBJ) $(DATE_O) $(BUILDMORE) Makefile
../include/obj.h ../include/engrave.h ../include/you.h \
../include/attrib.h ../include/monst.h ../include/mextra.h \
../include/skills.h ../include/timeout.h ../include/flag.h \
- ../include/winprocs.h ../include/sys.h
+ ../include/winprocs.h ../include/sndprocs.h ../include/sys.h
touch $(HACK_H)
#
$(TARGETPFX)pcmain.o: ../sys/share/pcmain.c $(HACK_H) ../include/dlb.h
31B8A46121A26AF60055BD01 /* panic.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A42721A267E60055BD01 /* panic.c */; };
31B8A46221A26B020055BD01 /* alloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A36521A238040055BD01 /* alloc.c */; };
5439B3BC275AADC600B8FB2F /* date.c in Sources */ = {isa = PBXBuildFile; fileRef = 5439B3BB275AADC600B8FB2F /* date.c */; };
+ 543ECF6C297EEF3800A13155 /* macsound.m in Sources */ = {isa = PBXBuildFile; fileRef = 54AEB885297EE7C4005F1B13 /* macsound.m */; };
54435B52247999CB00804CB3 /* nhlobj.c in Sources */ = {isa = PBXBuildFile; fileRef = 54435B51247999CB00804CB3 /* nhlobj.c */; };
544768AB239949FA004B9739 /* sfstruct.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768A8239949FA004B9739 /* sfstruct.c */; };
544768AE23994A17004B9739 /* nhlsel.c in Sources */ = {isa = PBXBuildFile; fileRef = 544768AC23994A17004B9739 /* nhlsel.c */; };
544768B523995488004B9739 /* nhlua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = nhlua.h; path = ../../include/nhlua.h; sourceTree = "<group>"; };
544768B923995BB7004B9739 /* liblua.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblua.a; path = ../../lib/lua/liblua.a; sourceTree = "<group>"; };
5462D14723E7B19200969423 /* insight.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = insight.c; path = ../../src/insight.c; sourceTree = "<group>"; };
+ 548FB9F9297F2B03000D04CF /* sndprocs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = sndprocs.h; path = ../../include/sndprocs.h; sourceTree = "<group>"; };
+ 548FB9FA297F2BBD000D04CF /* optlist.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = optlist.h; path = ../../include/optlist.h; sourceTree = "<group>"; };
+ 548FB9FB297F2BBD000D04CF /* hacklib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = hacklib.h; path = ../../include/hacklib.h; sourceTree = "<group>"; };
+ 548FB9FC297F2BBD000D04CF /* warnings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = warnings.h; path = ../../include/warnings.h; sourceTree = "<group>"; };
+ 548FB9FD297F2BBD000D04CF /* defsym.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = defsym.h; path = ../../include/defsym.h; sourceTree = "<group>"; };
+ 548FB9FE297F2BBD000D04CF /* fnamesiz.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = fnamesiz.h; path = ../../include/fnamesiz.h; sourceTree = "<group>"; };
+ 548FB9FF297F2BBD000D04CF /* objects.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = objects.h; path = ../../include/objects.h; sourceTree = "<group>"; };
+ 548FBA00297F2BBD000D04CF /* tile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = tile.h; path = ../../include/tile.h; sourceTree = "<group>"; };
+ 548FBA01297F2BBD000D04CF /* monsters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = monsters.h; path = ../../include/monsters.h; sourceTree = "<group>"; };
54A3D3EB282C55A900143F8C /* utf8map.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = utf8map.c; path = ../../src/utf8map.c; sourceTree = "<group>"; };
+ 54AEB885297EE7C4005F1B13 /* macsound.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = macsound.m; path = ../../sound/macsound/macsound.m; sourceTree = "<group>"; };
54FB2B4A246310A600397C0E /* symbols.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = symbols.c; path = ../../src/symbols.c; sourceTree = "<group>"; };
54FCE8282223261F00F393C8 /* isaac64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = isaac64.c; path = ../../src/isaac64.c; sourceTree = "<group>"; };
BAE8010A27B97760002B3786 /* libnhlua.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libnhlua.a; sourceTree = BUILT_PRODUCTS_DIR; };
3189576821A1FCC100FB2ABE = {
isa = PBXGroup;
children = (
+ 54AEB886297EE7E9005F1B13 /* sound */,
+ 54AEB885297EE7C4005F1B13 /* macsound.m */,
BAE8015827B99D44002B3786 /* nhlualib */,
2A953FB221A3F404007906E5 /* XCode.xcconfig */,
31B8A3F821A23E490055BD01 /* win */,
3189579621A2046700FB2ABE /* include */ = {
isa = PBXGroup;
children = (
+ 548FB9FD297F2BBD000D04CF /* defsym.h */,
+ 548FB9FE297F2BBD000D04CF /* fnamesiz.h */,
+ 548FB9FB297F2BBD000D04CF /* hacklib.h */,
+ 548FBA01297F2BBD000D04CF /* monsters.h */,
+ 548FB9FF297F2BBD000D04CF /* objects.h */,
+ 548FB9FA297F2BBD000D04CF /* optlist.h */,
+ 548FBA00297F2BBD000D04CF /* tile.h */,
+ 548FB9FC297F2BBD000D04CF /* warnings.h */,
+ 548FB9F9297F2B03000D04CF /* sndprocs.h */,
544768B523995488004B9739 /* nhlua.h */,
544768B423995447004B9739 /* isaac64.h */,
3186A3B721A4B0FD0052BF02 /* align.h */,
name = Frameworks;
sourceTree = "<group>";
};
+ 54AEB886297EE7E9005F1B13 /* sound */ = {
+ isa = PBXGroup;
+ children = (
+ );
+ path = sound;
+ sourceTree = "<group>";
+ };
BAE8015827B99D44002B3786 /* nhlualib */ = {
isa = PBXGroup;
children = (
544768AB239949FA004B9739 /* sfstruct.c in Sources */,
31B8A3A721A238060055BD01 /* minion.c in Sources */,
31B8A3F021A23D420055BD01 /* unixtty.c in Sources */,
+ 543ECF6C297EEF3800A13155 /* macsound.m in Sources */,
31B8A37F21A238060055BD01 /* extralev.c in Sources */,
31B8A39B21A238060055BD01 /* dogmove.c in Sources */,
54A3D3EC282C55A900143F8C /* utf8map.c in Sources */,
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++98";
CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = NO;
+ CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
+ DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
"-DHACKDIR=\\\"$(NH_INSTALL_DIR)\\\"",
"-DSECURE",
"-DCURSES_GRAPHICS",
+ "-DSND_LIB_MACSOUND",
+ "-DSND_SOUNDEFFECTS_AUTOMAP",
+ "-DUSER_SOUNDS",
);
SDKROOT = macosx;
};
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++98";
CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = NO;
+ CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
+ DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
+ DEAD_CODE_STRIPPING = YES;
GCC_C_LANGUAGE_STANDARD = c99;
INSTALL_PATH = "$(NH_INSTALL_DIR)";
+ MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
"OTHER_LDFLAGS[arch=*]" = "-L${NH_LIB_DIR}/lua";
PRODUCT_NAME = "$(TARGET_NAME)";
};
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
+ DEAD_CODE_STRIPPING = YES;
GCC_C_LANGUAGE_STANDARD = c99;
INSTALL_PATH = "$(NH_INSTALL_DIR)";
+ MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
"OTHER_LDFLAGS[arch=*]" = "-L${NH_LIB_DIR}/lua";
PRODUCT_NAME = "$(TARGET_NAME)";
};
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
+ DEAD_CODE_STRIPPING = YES;
+ MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
+ DEAD_CODE_STRIPPING = YES;
+ MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
+ DEAD_CODE_STRIPPING = YES;
+ MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
+ DEAD_CODE_STRIPPING = YES;
+ MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
+ DEAD_CODE_STRIPPING = YES;
+ MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
+ DEAD_CODE_STRIPPING = YES;
+ MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_STYLE = Automatic;
+ DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 6978C4Q2VB;
EXECUTABLE_PREFIX = lib;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
OTHER_CFLAGS = (
"-DNOMAIL",
"-DNOTPARMDECL",
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CODE_SIGN_STYLE = Automatic;
+ DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 6978C4Q2VB;
EXECUTABLE_PREFIX = lib;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
OTHER_CFLAGS = (
"-DNOMAIL",
"-DNOTPARMDECL",
WINCFLAGS += -DQT_GRAPHICS
WINSRC += $(WINQTSRC)
WINOBJ0 += $(WINQTOBJ)
-SNDCFLAGS += -DSND_LIB_QTSOUND -DUSER_SOUNDS
+SNDCFLAGS += -DSND_LIB_QTSOUND
+HAVE_SNDLIB = 1 # Indicates a sndlib, so USER_SOUNDS gets defined later
XTRASRC += tile.c
XTRAOBJ += $(TARGETPFX)tile.o
#
endif #HAVE_NCURSESW
endif #WANT_WIN_CURSES
+# HAVE_SNDLIB could have been set in multiw-2 for Qt.
+# If it is set, add USER_SOUNDS
+ifeq "$(HAVE_SNDLIB)" "1"
+SNDCFLAGS+= -DUSER_SOUNDS
+endif
+
CFLAGS+= $(WINCFLAGS) #WINCFLAGS set from multiw-2.370
CFLAGS+= $(SNDCFLAGS) #SNDCFLAGS set from multiw-2.370
CFLAGS+= $(NHCFLAGS)
endif #CURSES_UNIODE=sys
endif #MAKEFILE_SRC
+ifdef WANT_MACSOUND
+HAVE_SNDLIB = 1
+SNDCFLAGS+= -DSND_LIB_MACSOUND -DSND_SOUNDEFFECTS_AUTOMAP
+SNDLIBSRC = ../sound/macsound/macsound.m
+SNDLIBOBJ = macsound.o
+LFLAGS += -framework AppKit
+endif
+
+# HAVE_SNDLIB could have been set just above, or it could
+# have been set in multiw-2 for Qt. Either way, if it is
+# set, add USER_SOUNDS
+ifeq "$(HAVE_SNDLIB)" "1"
+SNDCFLAGS+= -DUSER_SOUNDS
+endif
+
CFLAGS+= $(PKGCFLAGS) $(WINCFLAGS) #WINCFLAGS set from multiw-2.370
CFLAGS+= $(SNDCFLAGS) #SNDCFLAGS set from multiw-2.370
CFLAGS+= $(NHCFLAGS)
#
#-INCLUDE gbdates-pre.370
#
+ifdef WANT_MACSOUND
+WAVDIR = ../sound/wav
+SNDWAVS = se_squeak_A se_squeak_B se_squeak_B_flat se_squeak_C se_squeak_D \
+ se_squeak_D_flat se_squeak_E se_squeak_E_flat se_squeak_F \
+ se_squeak_F_sharp se_squeak_G se_squeak_G_sharp sound_Bell \
+ sound_Bugle_A sound_Bugle_B sound_Bugle_C sound_Bugle_D \
+ sound_Bugle_E sound_Bugle_F sound_Bugle_G \
+ sound_Drum_Of_Earthquake sound_Fire_Horn sound_Frost_Horn \
+ sound_Leather_Drum sound_Magic_Harp_A sound_Magic_Harp_B \
+ sound_Magic_Harp_C sound_Magic_Harp_D sound_Magic_Harp_E \
+ sound_Magic_Harp_F sound_Magic_Harp_G sound_Tooled_Horn_A \
+ sound_Tooled_Horn_B sound_Tooled_Horn_C sound_Tooled_Horn_D \
+ sound_Tooled_Horn_E sound_Tooled_Horn_F sound_Tooled_Horn_G \
+ sound_Wooden_Flute_A sound_Wooden_Flute_B sound_Wooden_Flute_C \
+ sound_Wooden_Flute_D sound_Wooden_Flute_E sound_Wooden_Flute_F \
+ sound_Wooden_Flute_G sound_Wooden_Harp_A sound_Wooden_Harp_B \
+ sound_Wooden_Harp_C sound_Wooden_Harp_D sound_Wooden_Harp_E \
+ sound_Wooden_Harp_F sound_Wooden_Harp_G
+
+WAVS = $(addprefix $(WAVDIR)/, $(addsuffix .wav, $(SNDWAVS)))
+endif
+
#-POST
#
#-INCLUDE gbdates-post.370
#
+ifdef WANT_MACSOUND
+$(TARGETPFX)$(SNDLIBOBJ): $(SNDLIBSRC) $(HACK_H)
+ $(CC) $(CFLAGS) -c -o$@ $(SNDLIBSRC)
+$(WAVDIR)/%.wav: ../util/uudecode $(WAVDIR)/%.uu
+ $^
+ mv $(notdir $@) $@
+
+../util/uudecode: uudecode.o
+ $(CC) $(LFLAGS) uudecode.o -o $@
+
+uudecode.o: ../sys/share/uudecode.c
+ $(CC) $(CFLAGS) -c -o $@ ../sys/share/uudecode.c
+endif # WANT_MACSOUND
+
ifdef WANT_LIBNH
$(TARGETPFX)libnh.a: $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a
$(AR) rcs $@ $(HOBJ) $(LIBNHSYSOBJ) ../lib/lua/liblua.a
choose_windows(DEFAULT_WINDOW_SYS);
+#ifdef SND_LIB_INTEGRATED
+ /* One of the soundlib interfaces was integrated on build.
+ * We can leave a hint here for activate_chosen_soundlib later.
+ * assign_soundlib() just sets an indicator, it doesn't initialize
+ * any soundlib, and the indicator could be overturned before
+ * activate_chosen_soundlib() gets called.
+ */
+#if defined(SND_LIB_MACSOUND) && !defined(SND_LIB_QTSOUND)
+ assign_soundlib(soundlib_macsound);
+#endif
+#endif
+
#ifdef CHDIR /* otherwise no chdir() */
/*
* See if we must change directory to the playground.