X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=blobdiff_plain;f=main.c;h=00a4d890e17ea25d7e450a88dcc536b8a750f237;hp=15e723086487d0cebcf23de6c84653ef274c45d1;hb=ddb0df85b315cf60c529d0566254beb2c42cab2b;hpb=9714c9fc2a9a81436bd654427b7e681ec43dd4ff diff --git a/main.c b/main.c index 15e7230..00a4d89 100644 --- a/main.c +++ b/main.c @@ -41,7 +41,6 @@ long AMBER, AXE, BACK, BATTERY, BEAR, BIRD, BLOOD, RUBY, RUG, SAPPH, SAY, SIGN, SNAKE, STEPS, STREAM, THROW, TRIDENT, TROLL, TROLL2, URN, VASE, VEND, VOLCANO, WATER; -token_t WD1, WD1X, WD2, WD2X; FILE *logfp = NULL, *rfp = NULL; bool oldstyle = false; @@ -198,7 +197,7 @@ static void checkhints(void) ++game.hintlc[hint]; /* Come here if he's been long enough at required loc(s) for some * unused hint. */ - if (game.hintlc[hint] >= HINTS[hint][1]) { + if (game.hintlc[hint] >= hints[hint-1].turns) { int i; switch (hint - 1) { @@ -264,13 +263,13 @@ static void checkhints(void) /* Fall through to hint display */ game.hintlc[hint] = 0; - if (!YES(arbitrary_messages[HINTS[hint][3]], arbitrary_messages[NO_MESSAGE], arbitrary_messages[OK_MAN])) + if (!YES(hints[hint-1].question, arbitrary_messages[NO_MESSAGE], arbitrary_messages[OK_MAN])) return; - SETPRM(1, HINTS[hint][2], HINTS[hint][2]); + SETPRM(1, hints[hint-1].penalty, hints[hint-1].penalty); RSPEAK(HINT_COST); - game.hinted[hint] = YES(arbitrary_messages[WANT_HINT], arbitrary_messages[HINTS[hint][4]], arbitrary_messages[OK_MAN]); + game.hinted[hint] = YES(arbitrary_messages[WANT_HINT], hints[hint-1].hint, arbitrary_messages[OK_MAN]); if (game.hinted[hint] && game.limit > WARNTIME) - game.limit += WARNTIME * HINTS[hint][2]; + game.limit += WARNTIME * hints[hint-1].penalty; } } } @@ -1015,7 +1014,7 @@ L2600: game.knfloc = 0; /* This is where we get a new command from the user */ - if (!GETIN(cmdin, &WD1, &WD1X, &WD2, &WD2X)) + if (!GETIN(cmdin, &command.wd1, &command.wd1x, &command.wd2, &command.wd2x)) return false; /* Every input, check "game.foobar" flag. If zero, nothing's @@ -1036,7 +1035,7 @@ L2607: } } - if (command.verb == SAY && WD2 > 0) + if (command.verb == SAY && command.wd2 > 0) command.verb = 0; if (command.verb == SAY) { command.part = transitive; @@ -1048,8 +1047,8 @@ L2607: } else lampcheck(); - V1 = VOCAB(WD1, -1); - V2 = VOCAB(WD2, -1); + V1 = VOCAB(command.wd1, -1); + V2 = VOCAB(command.wd2, -1); if (V1 == ENTER && (V2 == STREAM || V2 == 1000 + WATER)) { if (LIQLOC(game.loc) == WATER) { RSPEAK(FEET_WET); @@ -1058,37 +1057,37 @@ L2607: } goto L2012; } - if (V1 == ENTER && WD2 > 0) { - WD1 = WD2; - WD1X = WD2X; - wordclear(&WD2); + if (V1 == ENTER && command.wd2 > 0) { + command.wd1 = command.wd2; + command.wd1x = command.wd2x; + wordclear(&command.wd2); } else { /* FIXME: Magic numbers */ if (!((V1 != 1000 + WATER && V1 != 1000 + OIL) || (V2 != 1000 + PLANT && V2 != 1000 + DOOR))) { if (AT(V2 - 1000)) - WD2 = MAKEWD(WORD_POUR); + command.wd2 = MAKEWD(WORD_POUR); } if (V1 == 1000 + CAGE && V2 == 1000 + BIRD && HERE(CAGE) && HERE(BIRD)) - WD1 = MAKEWD(WORD_CATCH); + command.wd1 = MAKEWD(WORD_CATCH); } L2620: - if (wordeq(WD1, MAKEWD(WORD_WEST))) { + if (wordeq(command.wd1, MAKEWD(WORD_WEST))) { ++game.iwest; if (game.iwest == 10) RSPEAK(W_IS_WEST); } - if (wordeq(WD1, MAKEWD(WORD_GO)) && !wordempty(WD2)) { + if (wordeq(command.wd1, MAKEWD(WORD_GO)) && !wordempty(command.wd2)) { if (++igo == 10) RSPEAK(GO_UNNEEDED); } Lookup: - defn = VOCAB(WD1, -1); + defn = VOCAB(command.wd1, -1); if (defn == -1) { /* Gee, I don't understand. */ if (fallback_handler(rawbuf)) continue; - SETPRM(1, WD1, WD1X); + SETPRM(1, command.wd1, command.wd1x); RSPEAK(DONT_KNOW); goto L2600; } @@ -1115,7 +1114,7 @@ Lookup: } Laction: - switch (action(cmdin, command)) { + switch (action(cmdin, &command)) { case GO_TERMINATE: return true; case GO_MOVE: @@ -1133,14 +1132,14 @@ Laction: goto Lookup; case GO_WORD2: /* Get second word for analysis. */ - WD1 = WD2; - WD1X = WD2X; - wordclear(&WD2); + command.wd1 = command.wd2; + command.wd1x = command.wd2x; + wordclear(&command.wd2); goto L2620; case GO_UNKNOWN: /* Random intransitive verbs come here. Clear obj just in case * (see attack()). */ - SETPRM(1, WD1, WD1X); + SETPRM(1, command.wd1, command.wd1x); RSPEAK(DO_WHAT); command.obj = 0; goto L2600;