static int listen(void)
/* Listen. Intransitive only. Print stuff based on objsnd/locsnd. */
{
- int k;
+ long k;
int spk = ALL_SILENT;
- k = LOCSND[game.loc];
- if (k != 0) {
+ k = locations[game.loc].sound;
+ if (k != SILENT) {
rspeak(labs(k));
if (k < 0) return GO_CLEAROBJ;
spk = NO_MESSAGE;
long OBJSND[NOBJECTS + 1];
long OBJTXT[NOBJECTS + 1];
long KEY[LOCSIZ + 1];
-long LOCSND[LOCSIZ + 1];
long LINES[LINSIZ + 1];
long TRAVEL[TRVSIZ + 1];
long KTAB[TABSIZ + 1];
}
}
-/* Read the sound/text info, store in OBJSND, OBJTXT, LOCSND. */
+/* Read the sound/text info, store in OBJSND, OBJTXT */
static void read_sound_text(FILE* database)
{
long K;
OBJTXT[K] = (I > 0 ? I : 0);
continue;
}
-
- LOCSND[K] = KK;
}
}
}
for (int I = 1; I <= LOCSIZ; I++) {
KEY[I] = 0;
- LOCSND[I] = 0;
}
LINUSE = 1;
write_1d(header_file, OBJSND, NOBJECTS + 1, "OBJSND");
write_1d(header_file, OBJTXT, NOBJECTS + 1, "OBJTXT");
write_1d(header_file, KEY, LOCSIZ + 1, "KEY");
- write_1d(header_file, LOCSND, LOCSIZ + 1, "LOCSND");
write_1d(header_file, TRAVEL, TRVSIZ + 1, "TRAVEL");
write_1d(header_file, KTAB, TABSIZ + 1, "KTAB");
write_1d(header_file, ATAB, TABSIZ + 1, "ATAB");
* 12600 words of message text (LINES, LINSIZ).
* 885 travel options (TRAVEL, TRVSIZ).
* 330 vocabulary words (KTAB, ATAB, TABSIZ).
- * 185 locations (KEY, COND, game.abbrev, game.atloc, LOCSND, LOCSIZ).
+ * 185 locations (KEY, COND, game.abbrev, game.atloc, LOCSIZ).
* 100 objects (PLAC, game.place, FIXD, game.fixed, game.link (twice),
* ogame.prop, OBJSND, OBJTXT).
* 35 "action" verbs (ACTSPK, VRBSIZ).
#include <stdio.h>
+#define SILENT -1 /* no sound */
+
typedef struct {{
const char* inventory;
const char** longs;
typedef struct {{
descriptions_t description;
+ const long sound;
}} location_t;
typedef struct {{
.small = {},
.big = {},
}},
+ .sound = {},
}},
"""
loc_str = ""
for item in loc:
short_d = make_c_string(item[1]["description"]["short"])
long_d = make_c_string(item[1]["description"]["long"])
- loc_str += template.format(short_d, long_d)
+ sound = item[1].get("sound", "SILENT")
+ loc_str += template.format(short_d, long_d, sound)
loc_str = loc_str[:-1] # trim trailing newline
return loc_str