Further narrow the scope of VERB.
This commit is contained in:
parent
cc618146e8
commit
0e3456069f
2 changed files with 17 additions and 18 deletions
29
actions1.c
29
actions1.c
|
@ -12,10 +12,9 @@
|
||||||
|
|
||||||
/* Analyse a verb. Remember what it was, go back for object if second word
|
/* Analyse a verb. Remember what it was, go back for object if second word
|
||||||
* unless verb is "say", which snarfs arbitrary second word.
|
* unless verb is "say", which snarfs arbitrary second word.
|
||||||
* FIXME: Takes K and VERB as additional inputs.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int action(FILE *input, long STARTAT, long obj) {
|
int action(FILE *input, long STARTAT, long verb, long obj) {
|
||||||
switch(STARTAT) {
|
switch(STARTAT) {
|
||||||
case 4000: goto L4000;
|
case 4000: goto L4000;
|
||||||
case 4090: goto L4090;
|
case 4090: goto L4090;
|
||||||
|
@ -23,15 +22,15 @@ int action(FILE *input, long STARTAT, long obj) {
|
||||||
}
|
}
|
||||||
BUG(99);
|
BUG(99);
|
||||||
|
|
||||||
L4000: VERB=K;
|
L4000:
|
||||||
SPK=ACTSPK[VERB];
|
SPK=ACTSPK[verb];
|
||||||
if(WD2 > 0 && VERB != SAY) return(2800);
|
if(WD2 > 0 && verb != SAY) return(2800);
|
||||||
if(VERB == SAY)obj=WD2;
|
if(verb == SAY)obj=WD2;
|
||||||
if(obj > 0) goto L4090;
|
if(obj > 0) goto L4090;
|
||||||
|
|
||||||
/* Analyse an intransitive verb (ie, no object given yet). */
|
/* Analyse an intransitive verb (ie, no object given yet). */
|
||||||
|
|
||||||
switch (VERB-1) {
|
switch (verb-1) {
|
||||||
case 0: goto L8010; /* CARRY */
|
case 0: goto L8010; /* CARRY */
|
||||||
case 1: return(8000); /* DROP */
|
case 1: return(8000); /* DROP */
|
||||||
case 2: return(8000); /* SAY */
|
case 2: return(8000); /* SAY */
|
||||||
|
@ -71,7 +70,7 @@ L4000: VERB=K;
|
||||||
|
|
||||||
/* Analyse a transitive verb. */
|
/* Analyse a transitive verb. */
|
||||||
|
|
||||||
L4090: switch (VERB-1) {
|
L4090: switch (verb-1) {
|
||||||
case 0: goto L9010; /* CARRY */
|
case 0: goto L9010; /* CARRY */
|
||||||
case 1: goto L9020; /* DROP */
|
case 1: goto L9020; /* DROP */
|
||||||
case 2: goto L9030; /* SAY */
|
case 2: goto L9030; /* SAY */
|
||||||
|
@ -118,7 +117,7 @@ L4090: switch (VERB-1) {
|
||||||
L5000: obj=K;
|
L5000: obj=K;
|
||||||
if(!HERE(K)) goto L5100;
|
if(!HERE(K)) goto L5100;
|
||||||
L5010: if(WD2 > 0) return(2800);
|
L5010: if(WD2 > 0) return(2800);
|
||||||
if(VERB != 0) goto L4090;
|
if(verb != 0) goto L4090;
|
||||||
SETPRM(1,WD1,WD1X);
|
SETPRM(1,WD1,WD1X);
|
||||||
RSPEAK(255);
|
RSPEAK(255);
|
||||||
return(2600);
|
return(2600);
|
||||||
|
@ -142,7 +141,7 @@ L5130: if(obj != KNIFE || game.knfloc != game.loc) goto L5140;
|
||||||
L5140: if(obj != ROD || !HERE(ROD2)) goto L5190;
|
L5140: if(obj != ROD || !HERE(ROD2)) goto L5190;
|
||||||
obj=ROD2;
|
obj=ROD2;
|
||||||
goto L5010;
|
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);
|
SETPRM(1,WD1,WD1X);
|
||||||
RSPEAK(256);
|
RSPEAK(256);
|
||||||
return(2012);
|
return(2012);
|
||||||
|
@ -209,7 +208,7 @@ L9040: if(obj == CLAM || obj == OYSTER) goto L9046;
|
||||||
|
|
||||||
L9043: K=34+game.prop[GRATE];
|
L9043: K=34+game.prop[GRATE];
|
||||||
game.prop[GRATE]=1;
|
game.prop[GRATE]=1;
|
||||||
if(VERB == LOCK)game.prop[GRATE]=0;
|
if(verb == LOCK)game.prop[GRATE]=0;
|
||||||
K=K+2*game.prop[GRATE];
|
K=K+2*game.prop[GRATE];
|
||||||
return(2010);
|
return(2010);
|
||||||
|
|
||||||
|
@ -219,7 +218,7 @@ L9046: K=0;
|
||||||
SPK=124+K;
|
SPK=124+K;
|
||||||
if(TOTING(obj))SPK=120+K;
|
if(TOTING(obj))SPK=120+K;
|
||||||
if(!TOTING(TRIDNT))SPK=122+K;
|
if(!TOTING(TRIDNT))SPK=122+K;
|
||||||
if(VERB == LOCK)SPK=61;
|
if(verb == LOCK)SPK=61;
|
||||||
if(SPK != 124) return(2011);
|
if(SPK != 124) return(2011);
|
||||||
DSTROY(CLAM);
|
DSTROY(CLAM);
|
||||||
DROP(OYSTER,game.loc);
|
DROP(OYSTER,game.loc);
|
||||||
|
@ -227,7 +226,7 @@ L9046: K=0;
|
||||||
return(2011);
|
return(2011);
|
||||||
|
|
||||||
/* Chain. */
|
/* Chain. */
|
||||||
L9048: if(VERB == LOCK) goto L9049;
|
L9048: if(verb == LOCK) goto L9049;
|
||||||
SPK=171;
|
SPK=171;
|
||||||
if(game.prop[BEAR] == 0)SPK=41;
|
if(game.prop[BEAR] == 0)SPK=41;
|
||||||
if(game.prop[CHAIN] == 0)SPK=37;
|
if(game.prop[CHAIN] == 0)SPK=37;
|
||||||
|
@ -310,7 +309,7 @@ L9094: DROP(JADE,game.loc);
|
||||||
|
|
||||||
/* Attack also moved into separate module. */
|
/* Attack also moved into separate module. */
|
||||||
|
|
||||||
L9120: return(attack(input, obj, VERB));
|
L9120: return(attack(input, obj, verb));
|
||||||
|
|
||||||
/* Pour. If no object, or object is bottle, assume contents of bottle.
|
/* Pour. If no object, or object is bottle, assume contents of bottle.
|
||||||
* special tests for pouring water or oil on plant or rusty door. */
|
* 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. */
|
/* Throw moved into separate module. */
|
||||||
|
|
||||||
L9170: return(throw(input, obj, VERB));
|
L9170: return(throw(input, obj, verb));
|
||||||
|
|
||||||
/* Quit. Intransitive only. Verify intent and exit if that's what he wants. */
|
/* Quit. Intransitive only. Verify intent and exit if that's what he wants. */
|
||||||
|
|
||||||
|
|
6
main.c
6
main.c
|
@ -36,7 +36,7 @@ lcg_state lcgstate;
|
||||||
|
|
||||||
extern void initialise();
|
extern void initialise();
|
||||||
extern void score(long);
|
extern void score(long);
|
||||||
extern int action(FILE *, long, long);
|
extern int action(FILE *, long, long, long);
|
||||||
|
|
||||||
void sig_handler(int signo)
|
void sig_handler(int signo)
|
||||||
{
|
{
|
||||||
|
@ -471,11 +471,11 @@ L3000: SETPRM(1,WD1,WD1X);
|
||||||
|
|
||||||
/* Verb and object analysis moved to separate module. */
|
/* Verb and object analysis moved to separate module. */
|
||||||
|
|
||||||
L4000: I=4000; goto Laction;
|
L4000: I=4000; VERB=K; goto Laction;
|
||||||
L4090: I=4090; goto Laction;
|
L4090: I=4090; goto Laction;
|
||||||
L5000: I=5000;
|
L5000: I=5000;
|
||||||
Laction:
|
Laction:
|
||||||
switch (action(cmdin, I, obj)) {
|
switch (action(cmdin, I, VERB, obj)) {
|
||||||
case 2: return true;
|
case 2: return true;
|
||||||
case 8: goto L8;
|
case 8: goto L8;
|
||||||
case 2000: goto L2000;
|
case 2000: goto L2000;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue