Support loud locations.
This commit is contained in:
parent
f47dc9f447
commit
1e8c3a4a1d
3 changed files with 14 additions and 5 deletions
|
@ -675,9 +675,11 @@ static int listen(void)
|
|||
int spk = ALL_SILENT;
|
||||
k = locations[game.loc].sound;
|
||||
if (k != SILENT) {
|
||||
rspeak(labs(k));
|
||||
if (k < 0) return GO_CLEAROBJ;
|
||||
spk = NO_MESSAGE;
|
||||
rspeak(k);
|
||||
if (locations[game.loc].loud)
|
||||
return GO_CLEAROBJ;
|
||||
else
|
||||
spk = NO_MESSAGE;
|
||||
}
|
||||
for (int i = 1; i <= NOBJECTS; i++) {
|
||||
if (!HERE(i) || OBJSND[i] == 0 || game.prop[i] < 0)
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
# The optional hints field is a list of YAML references to hints
|
||||
# that may be available at this location. (This is why locations
|
||||
# has to follow hints.) The "sound" attribute, if present, is s
|
||||
# label for a location sound.
|
||||
# label for a location sound. If there is a "loud" attribute and
|
||||
# it is true, object sounds are drowned out at this location.
|
||||
#
|
||||
# arbitrary_messages: These are arguments to rspeak(). Some spans of
|
||||
# these messages need to be kept adjacent and ordered (for now).
|
||||
|
@ -829,6 +830,7 @@ locations: !!omap
|
|||
conditions: {NOARRR: true, LIT: true, DEEP: true}
|
||||
hints: [*jade]
|
||||
sound: TOTAL_ROAR
|
||||
loud: true
|
||||
- LOC_BOULDERS2:
|
||||
description:
|
||||
long: 'You are in a small chamber filled with large boulders. The walls are\nvery warm, causing the air in the room to be almost stifling from the\nheat. The only exit is a crawl heading west, through which is coming\na low rumbling.'
|
||||
|
@ -1064,6 +1066,7 @@ locations: !!omap
|
|||
short: 'You''re at bottom of reservoir.'
|
||||
conditions: {FLUID: true, DEEP: true}
|
||||
sound: TOTAL_ROAR
|
||||
loud: true
|
||||
- LOC_RESNORTH:
|
||||
description:
|
||||
long: 'You are at the northern edge of the reservoir. A northwest passage\nleads sharply up from here.'
|
||||
|
|
|
@ -13,6 +13,7 @@ h_template = """/* Generated from adventure.yaml - do not hand-hack! */
|
|||
#define NEWDB_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define SILENT -1 /* no sound */
|
||||
|
||||
|
@ -29,6 +30,7 @@ typedef struct {{
|
|||
typedef struct {{
|
||||
descriptions_t description;
|
||||
const long sound;
|
||||
const bool loud;
|
||||
}} location_t;
|
||||
|
||||
typedef struct {{
|
||||
|
@ -193,6 +195,7 @@ def get_locations(loc):
|
|||
.big = {},
|
||||
}},
|
||||
.sound = {},
|
||||
.loud = {},
|
||||
}},
|
||||
"""
|
||||
loc_str = ""
|
||||
|
@ -200,7 +203,8 @@ def get_locations(loc):
|
|||
short_d = make_c_string(item[1]["description"]["short"])
|
||||
long_d = make_c_string(item[1]["description"]["long"])
|
||||
sound = item[1].get("sound", "SILENT")
|
||||
loc_str += template.format(short_d, long_d, sound)
|
||||
loud = "true" if item[1].get("loud") else "false"
|
||||
loc_str += template.format(short_d, long_d, sound, loud)
|
||||
loc_str = loc_str[:-1] # trim trailing newline
|
||||
return loc_str
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue