RUBY, RUG, SAPPH, SAY, SIGN, SNAKE,
STEPS, STREAM, THROW, TRIDENT, TROLL, TROLL2,
URN, VASE, VEND, VOLCANO, WATER;
RUBY, RUG, SAPPH, SAY, SIGN, SNAKE,
STEPS, STREAM, THROW, TRIDENT, TROLL, TROLL2,
URN, VASE, VEND, VOLCANO, WATER;
-long WD1, WD1X, WD2, WD2X;
+token_t WD1, WD1X, WD2, WD2X;
- while ((ch = getopt(argc, argv, "l:or:s")) != EOF) {
+#ifndef ADVENT_NOSAVE
+ const char* opts = "l:or:s";
+ const char* usage = "Usage: %s [-l logfilename] [-o] [-r restorefilename] [-s] \n";
+#else
+ const char* opts = "l:os";
+ const char* usage = "Usage: %s [-l logfilename] [-o] [-s] \n";
+#endif
+ while ((ch = getopt(argc, argv, opts)) != EOF) {
- /* Logical variables:
- *
- * game.closed says whether we're all the way closed
- * game.closng says whether it's closing time yet
- * game.clshnt says whether he's read the clue in the endgame
- * game.lmwarn says whether he's been warned about lamp going dim
- * game.novice says whether he asked for instructions at start-up
- * game.panic says whether he's found out he's trapped in the cave
- * game.wzdark says whether the loc he's leaving was dark */
-
if (!rfp) {
game.novice = YES(arbitrary_messages[WELCOME_YOU], arbitrary_messages[CAVE_NEARBY], arbitrary_messages[NO_MESSAGE]);
if (!rfp) {
game.novice = YES(arbitrary_messages[WELCOME_YOU], arbitrary_messages[CAVE_NEARBY], arbitrary_messages[NO_MESSAGE]);
-/* Check if this loc is eligible for any hints. If been here
- * long enough, branch to help section (on later page). Hints
- * all come back here eventually to finish the loop. Ignore
- * "HINTS" < 4 (special stuff, see database notes).
- */
+/* Check if this loc is eligible for any hints. If been here long
+ * enough, display. Ignore "HINTS" < 4 (special stuff, see database
+ * notes). */
/* The pirate's spotted him. He leaves him alone once we've
* found chest. K counts if a treasure is here. If not, and
* tally=1 for an unseen chest, let the pirate be spotted. Note
/* The pirate's spotted him. He leaves him alone once we've
* found chest. K counts if a treasure is here. If not, and
* tally=1 for an unseen chest, let the pirate be spotted. Note
* it to the troll, but in that case he's seen the chest
* (game.prop=0). */
if (game.loc == game.chloc || game.prop[CHEST] >= 0)
* it to the troll, but in that case he's seen the chest
* (game.prop=0). */
if (game.loc == game.chloc || game.prop[CHEST] >= 0)
- * lamp give out. When it gets close, we come here to warn
- * him. First following ar, if the lamp and fresh batteries are
+ * lamp give out. When it gets close, we come here to warn him.
+ * First following arm checks if the lamp and fresh batteries are
- * Second is for other cases of lamp dying. 12400 is when it
- * goes out. Even then, he can explore outside for a while
- * if desired. */
+ * Second is for other cases of lamp dying. Eve after it goes
+ * out, he can explore outside for a while if desired. */
if (game.limit <= WARNTIME && HERE(BATTERY) && game.prop[BATTERY] == 0 && HERE(LAMP)) {
RSPEAK(REPLACE_BATTERIES);
game.prop[BATTERY] = 1;
if (TOTING(BATTERY))
DROP(BATTERY, game.loc);
if (game.limit <= WARNTIME && HERE(BATTERY) && game.prop[BATTERY] == 0 && HERE(LAMP)) {
RSPEAK(REPLACE_BATTERIES);
game.prop[BATTERY] = 1;
if (TOTING(BATTERY))
DROP(BATTERY, game.loc);
/* Can't leave cave once it's closing (except by main office). */
if (OUTSID(game.newloc) && game.newloc != 0 && game.closng) {
/* Can't leave cave once it's closing (except by main office). */
if (OUTSID(game.newloc) && game.newloc != 0 && game.closng) {
- if (game.turns == game.thresh) {
- speak(turn_threshold_messages[game.trndex]);
- game.trnluz = game.trnluz + TRNVAL[game.trndex] / 100000;
- ++game.trndex;
- game.thresh = -1;
- if (game.trndex <= TRNVLS)
- game.thresh = MOD(TRNVAL[game.trndex], 100000) + 1;
- }
- if (verb == SAY && WD2 > 0)
- verb = 0;
- if (verb == SAY) {
- part = transitive;
+
+ /* If a turn threshold has been met, apply penalties and tell
+ * the player about it. */
+ for (int i = turn_threshold_count; i >= 0; --i)
+ {
+ if (game.turns == turn_thresholds[i].threshold + 1)
+ {
+ game.trnluz += turn_thresholds[i].point_loss;
+ speak(turn_thresholds[i].message);
+ }
+ }
+
+ if (command.verb == SAY && WD2 > 0)
+ command.verb = 0;
+ if (command.verb == SAY) {
+ command.part = transitive;