static void state_change(long obj, long state)
{
game.prop[obj] = state;
- pspeak(obj, change, state);
+ pspeak(obj, change, state, true);
}
static int attack(struct command_t *command)
if (game.loc == objects[EGGS].plac)
k = EGGS_HERE;
move(EGGS, objects[EGGS].plac);
- pspeak(EGGS, look, k);
+ pspeak(EGGS, look, k, true);
return GO_CLEAROBJ;
}
}
} else if (obj == COINS && HERE(VEND)) {
DESTROY(COINS);
drop(BATTERY, game.loc);
- pspeak(BATTERY, look, FRESH_BATTERIES);
+ pspeak(BATTERY, look, FRESH_BATTERIES, true);
return GO_CLEAROBJ;
} else if (obj == BIRD && AT(DRAGON) && game.prop[DRAGON] == DRAGON_BARS) {
rspeak(BIRD_BURNT);
game.prop[VASE] = VASE_BROKEN;
if (AT(PILLOW))
game.prop[VASE] = VASE_WHOLE;
- pspeak(VASE, look, game.prop[VASE] + 1);
+ pspeak(VASE, look, game.prop[VASE] + 1, true);
if (game.prop[VASE] != VASE_WHOLE)
game.fixed[VASE] = -1;
}
if (game.prop[URN] != URN_EMPTY) {
state_change(URN, URN_DARK);
} else {
- pspeak(URN, change, URN_DARK);
+ pspeak(URN, change, URN_DARK, true);
}
} else if (obj == LAMP) {
continue;
if (spk == NO_CARRY)
rspeak(NOW_HOLDING);
- game.blklin = false;
- pspeak(i, touch, -1);
- game.blklin = true;
+ pspeak(i, touch, -1, false);
spk = NO_MESSAGE;
}
if (TOTING(BEAR))
if (i == BIRD)
mi += 3 * game.blooded;
long packed_zzword = token_to_packed(game.zzword);
- pspeak(i, hear, mi, packed_zzword);
+ pspeak(i, hear, mi, true, packed_zzword);
spk = NO_MESSAGE;
/* FIXME: Magic number, sensitive to bird state logic */
if (i == BIRD && game.prop[i] == 5)
rspeak(spk);
return GO_CLEAROBJ;
}
- pspeak(PLANT, look, game.prop[PLANT] + 3);
+ pspeak(PLANT, look, game.prop[PLANT] + 3, true);
game.prop[PLANT] = MOD(game.prop[PLANT] + 1, 3);
game.prop[PLANT2] = game.prop[PLANT];
return GO_MOVE;
} else if (objects[command.obj].texts[0] == NULL || game.prop[command.obj] < 0) {
rspeak(actions[command.verb].message);
} else
- pspeak(command.obj, study, game.prop[command.obj]);
+ pspeak(command.obj, study, game.prop[command.obj], true);
return GO_CLEAROBJ;
}
rspeak(NOTHING_HAPPENS);
return GO_CLEAROBJ;
} else {
- pspeak(RESER, look, game.prop[RESER] + 1);
+ pspeak(RESER, look, game.prop[RESER] + 1, true);
game.prop[RESER] = 1 - game.prop[RESER];
if (AT(RESER))
return GO_CLEAROBJ;
if (HERE(BIRD))
rspeak(spk);
game.prop[FISSURE] = 1 - game.prop[FISSURE];
- pspeak(FISSURE, look, 2 - game.prop[FISSURE]);
+ pspeak(FISSURE, look, 2 - game.prop[FISSURE], true);
return GO_CLEAROBJ;
}
}
struct game_t {
unsigned long lcg_a, lcg_c, lcg_m, lcg_x;
long abbnum; // How often to print non-abbreviated descriptions
- long blklin;
long bonus;
long chloc;
long chloc2;
extern void packed_to_token(long, char token[]);
extern long token_to_packed(const char token[6]);
extern void tokenize(char*, long tokens[4]);
-extern void vspeak(const char*, va_list);
+extern void vspeak(const char*, bool, va_list);
extern bool wordeq(token_t, token_t);
extern bool wordempty(token_t);
extern void wordclear(token_t *);
extern void speak(const char*, ...);
-extern void pspeak(vocab_t, enum speaktype, int, ...);
+extern void pspeak(vocab_t, enum speaktype, int, bool, ...);
extern void rspeak(vocab_t, ...);
extern void echo_input(FILE*, const char*, const char*);
extern int word_count(char*);
.abbnum = 5,
.clock1 = WARNTIME,
.clock2 = FLASHTIME,
- .blklin = true,
.newloc = LOC_START,
.loc = LOC_START,
.limit = GAMELIMIT,
* entries check for game.prop(TROLL)=0.) Special
* stuff for bear. */
if (game.prop[TROLL] == TROLL_PAIDONCE) {
- pspeak(TROLL, look, TROLL_PAIDONCE);
+ pspeak(TROLL, look, TROLL_PAIDONCE, true);
game.prop[TROLL] = TROLL_UNPAID;
move(TROLL2, 0);
move(TROLL2 + NOBJECTS, 0);
int kk = game.prop[obj];
if (obj == STEPS && game.loc == game.fixed[STEPS])
kk = 1;
- pspeak(obj, look, kk);
+ pspeak(obj, look, kk, true);
}
}
}
* tick game.clock1 unless well into cave (and not at Y2). */
if (game.closed) {
if (game.prop[OYSTER] < 0 && TOTING(OYSTER))
- pspeak(OYSTER, look, 1);
+ pspeak(OYSTER, look, 1, true);
for (size_t i = 1; i <= NOBJECTS; i++) {
if (TOTING(i) && game.prop[i] < 0)
game.prop[i] = -1 - game.prop[i];
/* I/O routines (speak, pspeak, rspeak, get_input, yes) */
-void vspeak(const char* msg, va_list ap)
+void vspeak(const char* msg, bool blank, va_list ap)
{
// Do nothing if we got a null pointer.
if (msg == NULL)
if (strlen(msg) == 0)
return;
- // Print a newline if the global game.blklin says to.
- if (game.blklin == true)
- printf("\n");
+ if (blank == true)
+ printf("\n");
int msglen = strlen(msg);
{
va_list ap;
va_start(ap, msg);
- vspeak(msg, ap);
+ vspeak(msg, true, ap);
va_end(ap);
}
-void pspeak(vocab_t msg, enum speaktype mode, int skip, ...)
+void pspeak(vocab_t msg, enum speaktype mode, int skip, bool blank, ...)
/* Find the skip+1st message from msg and print it. Modes are:
* feel = for inventory, what you can touch
* look = the long description for the state the object is in
* study = text on the object. */
{
va_list ap;
- va_start(ap, skip);
+ va_start(ap, blank);
switch (mode) {
case touch:
- vspeak(objects[msg].inventory, ap);
+ vspeak(objects[msg].inventory, blank, ap);
break;
case look:
- vspeak(objects[msg].descriptions[skip], ap);
+ vspeak(objects[msg].descriptions[skip], blank, ap);
break;
case hear:
- vspeak(objects[msg].sounds[skip], ap);
+ vspeak(objects[msg].sounds[skip], blank, ap);
break;
case study:
- vspeak(objects[msg].texts[skip], ap);
+ vspeak(objects[msg].texts[skip], blank, ap);
break;
case change:
- vspeak(objects[msg].changes[skip], ap);
+ vspeak(objects[msg].changes[skip], blank, ap);
break;
}
va_end(ap);
{
va_list ap;
va_start(ap, i);
- vspeak(arbitrary_messages[i], ap);
+ vspeak(arbitrary_messages[i], true, ap);
va_end(ap);
}
if (!settings.prompt)
input_prompt[0] = '\0';
- // Print a blank line if game.blklin tells us to.
- if (game.blklin == true)
- printf("\n");
+ // Print a blank line
+ printf("\n");
char* input;
while (true) {