X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=actions1.c;h=5de9a1f84a89f31a2b166032482353a7958565e5;hb=46cd836df0943cfab98494d8668479f7ac93b762;hp=781b996a107f5d373d2bf321e2b0a23e45f25a05;hpb=aba35733e76f78f22aee3a3d7f677c39bd32e90d;p=open-adventure.git diff --git a/actions1.c b/actions1.c index 781b996..5de9a1f 100644 --- a/actions1.c +++ b/actions1.c @@ -1,7 +1,6 @@ #include #include #include "advent.h" -#include "funcs.h" #include "database.h" /* This stuff was broken off as part of an effort to get the main program @@ -12,10 +11,10 @@ /* Analyse a verb. Remember what it was, go back for object if second word * unless verb is "say", which snarfs arbitrary second word. - * Takes K, OBJ, and VERB as inputs. */ -int action(FILE *input, long STARTAT, long obj) { +int action(FILE *input, long STARTAT, long verb, long obj) { + int kk; switch(STARTAT) { case 4000: goto L4000; case 4090: goto L4090; @@ -23,15 +22,15 @@ int action(FILE *input, long STARTAT, long obj) { } BUG(99); -L4000: VERB=K; - SPK=ACTSPK[VERB]; - if(WD2 > 0 && VERB != SAY) return(2800); - if(VERB == SAY)obj=WD2; +L4000: + SPK=ACTSPK[verb]; + if(WD2 > 0 && verb != SAY) return(2800); + if(verb == SAY)obj=WD2; if(obj > 0) goto L4090; /* Analyse an intransitive verb (ie, no object given yet). */ - switch (VERB-1) { + switch (verb-1) { case 0: goto L8010; /* CARRY */ case 1: return(8000); /* DROP */ case 2: return(8000); /* SAY */ @@ -71,7 +70,7 @@ L4000: VERB=K; /* Analyse a transitive verb. */ -L4090: switch (VERB-1) { +L4090: switch (verb-1) { case 0: goto L9010; /* CARRY */ case 1: goto L9020; /* DROP */ case 2: goto L9030; /* SAY */ @@ -118,7 +117,7 @@ L4090: switch (VERB-1) { L5000: obj=K; if(!HERE(K)) goto L5100; L5010: if(WD2 > 0) return(2800); - if(VERB != 0) goto L4090; + if(verb != 0) goto L4090; SETPRM(1,WD1,WD1X); RSPEAK(255); return(2600); @@ -142,7 +141,7 @@ L5130: if(obj != KNIFE || game.knfloc != game.loc) goto L5140; L5140: if(obj != ROD || !HERE(ROD2)) goto L5190; obj=ROD2; goto L5010; -L5190: if((VERB == FIND || VERB == INVENT) && WD2 <= 0) goto L5010; +L5190: if((verb == FIND || verb == INVENT) && WD2 <= 0) goto L5010; SETPRM(1,WD1,WD1X); RSPEAK(256); return(2012); @@ -209,7 +208,7 @@ L9040: if(obj == CLAM || obj == OYSTER) goto L9046; L9043: K=34+game.prop[GRATE]; game.prop[GRATE]=1; - if(VERB == LOCK)game.prop[GRATE]=0; + if(verb == LOCK)game.prop[GRATE]=0; K=K+2*game.prop[GRATE]; return(2010); @@ -219,7 +218,7 @@ L9046: K=0; SPK=124+K; if(TOTING(obj))SPK=120+K; if(!TOTING(TRIDNT))SPK=122+K; - if(VERB == LOCK)SPK=61; + if(verb == LOCK)SPK=61; if(SPK != 124) return(2011); DSTROY(CLAM); DROP(OYSTER,game.loc); @@ -227,7 +226,7 @@ L9046: K=0; return(2011); /* Chain. */ -L9048: if(VERB == LOCK) goto L9049; +L9048: if(verb == LOCK) goto L9049; SPK=171; if(game.prop[BEAR] == 0)SPK=41; if(game.prop[CHAIN] == 0)SPK=37; @@ -310,7 +309,7 @@ L9094: DROP(JADE,game.loc); /* Attack also moved into separate module. */ -L9120: return(attack(input, obj)); +L9120: return(attack(input, obj, verb)); /* Pour. If no object, or object is bottle, assume contents of bottle. * special tests for pouring water or oil on plant or rusty door. */ @@ -390,7 +389,7 @@ L9160: if(obj != LAMP)SPK=76; /* Throw moved into separate module. */ -L9170: return(throw(input, obj)); +L9170: return(throw(input, obj, verb)); /* Quit. Intransitive only. Verify intent and exit if that's what he wants. */ @@ -437,10 +436,7 @@ L9230: if(game.prop[ROD2] < 0 || !game.closed) return(2011); /* Score. Call scoring routine but tell it to return. */ L8240: score(-1); - SETPRM(1,SCORE,MXSCOR); - SETPRM(3,game.turns,game.turns); - RSPEAK(259); - return(2012); + return(2012); /* FEE FIE FOE FOO (AND FUM). Advance to next state if given in proper order. * Look up WD1 in section 3 of vocab to determine which word we've got. Last @@ -518,14 +514,14 @@ L8300: SPK=201; RSPEAK(260); if(!YES(input,200,54,54)) return(2012); game.saved=game.saved+5; - KK= -1; + kk= -1; /* This next part is shared with the "resume" code. The two cases are * distinguished by the value of kk (-1 for suspend, +1 for resume). */ L8305: DATIME(&I,&K); K=I+650*K; - SAVWRD(KK,K); + SAVWRD(kk,K); K=VRSION; SAVWRD(0,K); if(K != VRSION) goto L8312; @@ -540,7 +536,7 @@ L8305: DATIME(&I,&K); SAVWDS(game.knfloc,game.limit,K,game.lmwarn,game.loc,game.newloc,game.numdie); SAVWDS(K,game.oldlc2,game.oldloc,game.oldobj,game.panic,game.saved,game.setup); SAVWDS(SPK,game.tally,game.thresh,game.trndex,game.trnluz,game.turns,OBJTXT[OYSTER]); - SAVWDS(VERB,WD1,WD1X,WD2,game.wzdark,game.zzword,OBJSND[BIRD]); + SAVWDS(K,WD1,WD1X,WD2,game.wzdark,game.zzword,OBJSND[BIRD]); SAVWDS(OBJTXT[SIGN],game.clshnt,game.novice,K,K,K,K); SAVARR(game.abbrev,LOCSIZ); SAVARR(game.atloc,LOCSIZ); @@ -553,17 +549,17 @@ L8305: DATIME(&I,&K); SAVARR(game.odloc,NDWARVES); SAVARR(game.place,NOBJECTS); SAVARR(game.prop,NOBJECTS); - SAVWRD(KK,K); + SAVWRD(kk,K); if(K != 0) goto L8318; K=NUL; game.zzword=RNDVOC(3,game.zzword); - if(KK > 0) return(8); + if(kk > 0) return(8); RSPEAK(266); exit(0); /* Resume. Read a suspended game back from a file. */ -L8310: KK=1; +L8310: kk=1; if(game.loc == 1 && game.abbrev[1] == 1) goto L8305; RSPEAK(268); if(!YES(input,200,54,54)) return(2012);