X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=main.c;h=6f21554de079a5dc3c73b774ccd4fb9c6889bcf8;hb=b0eb54b125c952cd23d71f58238bcb0460d90fb8;hp=2b831f2fe3ecd7662e6ac4c5e0d074023cedb5cf;hpb=5535c509ebeba58eaa7a521a923fa3c6fa59ca6c;p=open-adventure.git diff --git a/main.c b/main.c index 2b831f2..6f21554 100644 --- a/main.c +++ b/main.c @@ -41,8 +41,6 @@ long AMBER, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, URN, VASE, VEND, VOLCAN, WATER; long WD1, WD1X, WD2, WD2X; -static int K; /* information leak, should go away */ - FILE *logfp; bool oldstyle = false; lcg_state lcgstate; @@ -492,9 +490,9 @@ static void croak(FILE *cmdin) * him, so we need game.oldlc2, which is the last place he was * safe.) */ -static bool playermove(FILE *cmdin, token_t verb) +static bool playermove(FILE *cmdin, token_t verb, int motion) { - int LL, K2, KK=KEY[game.loc], motion = K; + int LL, K2, KK=KEY[game.loc]; game.newloc=game.loc; if (KK == 0) BUG(26); @@ -676,8 +674,9 @@ static bool playermove(FILE *cmdin, token_t verb) static bool do_command(FILE *cmdin) { long KQ, VERB, KK, V1, V2; - long obj, i; - static long IGO = 0; + long i, k, KMOD; + static long igo = 0; + static long obj = 0; enum speechpart part; /* Can't leave cave once it's closing (except by main office). */ @@ -728,7 +727,7 @@ L2000: if (game.loc == 0) } if (TOTING(BEAR))RSPEAK(141); newspeak(msg); - K=1; + KMOD=1; if (FORCED(game.loc)) { goto L8; } @@ -825,8 +824,12 @@ L2607: game.foobar=(game.foobar>0 ? -game.foobar : 0); if (game.trndex <= TRNVLS) game.thresh=MOD(TRNVAL[game.trndex],100000)+1; } - if (VERB == SAY && WD2 > 0)VERB=0; - if (VERB == SAY) goto L4090; + if (VERB == SAY && WD2 > 0) + VERB=0; + if (VERB == SAY) { + part=transitive; + goto Laction; + } if (game.tally == 0 && INDEEP(game.loc) && game.loc != 33) --game.clock1; @@ -969,12 +972,12 @@ L2607: game.foobar=(game.foobar>0 ? -game.foobar : 0); RSPEAK(spk); } } -L19999: K=43; - if (LIQLOC(game.loc) == WATER)K=70; +L19999: k=43; + if (LIQLOC(game.loc) == WATER)k=70; V1=VOCAB(WD1,-1); V2=VOCAB(WD2,-1); if (V1 == ENTER && (V2 == STREAM || V2 == 1000+WATER)) { - RSPEAK(K); + RSPEAK(k); goto L2012; } if (V1 == ENTER && WD2 > 0) { @@ -996,7 +999,7 @@ L2620: if (WD1 == MAKEWD(23051920)) { RSPEAK(17); } if (WD1 == MAKEWD( 715) && WD2 != 0) { - if (++IGO == 10) + if (++igo == 10) RSPEAK(276); } L2630: @@ -1009,26 +1012,21 @@ L2630: RSPEAK(254); goto L2600; } - K=MOD(i,1000); + KMOD=MOD(i,1000); KQ=i/1000+1; switch (KQ-1) { case 0: goto L8; - case 1: goto L5000; - case 2: goto L4000; - case 3: RSPEAK(K); goto L2012; + case 1: part=unknown; obj = KMOD; break; + case 2: part=intransitive; VERB = KMOD; break; + case 3: RSPEAK(KMOD); goto L2012; + default: BUG(22); } - BUG(22); - -/* Verb and object analysis moved to separate module. */ -L4000: part=intransitive; VERB=K; goto Laction; -L4090: part=transitive; goto Laction; -L5000: part=unknown; obj = K; Laction: switch (action(cmdin, part, VERB, obj)) { case 2: return true; - case 8: K=NUL; goto L8; + case 8: KMOD=NUL; goto L8; case 2000: goto L2000; case 2012: goto L2012; case 2600: goto L2600; @@ -1052,11 +1050,14 @@ Laction: RSPEAK(136); score(0); return true; + default: + BUG(99); } - BUG(99); + /* no fallthrough here */ + /* Figure out the new location */ -L8: if (playermove(cmdin, VERB)) +L8: if (playermove(cmdin, VERB, KMOD)) return true; else goto L2000;