projects
/
open-adventure.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
1ca74bf
)
More action handlers. Use consistent VO order.
author
Eric S. Raymond
<esr@thyrsus.com>
Thu, 8 Jun 2017 20:18:21 +0000
(16:18 -0400)
committer
Eric S. Raymond
<esr@thyrsus.com>
Thu, 8 Jun 2017 20:18:21 +0000
(16:18 -0400)
actions1.c
patch
|
blob
|
history
actions2.c
patch
|
blob
|
history
diff --git
a/actions1.c
b/actions1.c
index e9da84e7dbf66ac5314ea77b373334f95ac535a7..1f337155361f4bad3fc6b238634545959e83029b 100644
(file)
--- a/
actions1.c
+++ b/
actions1.c
@@
-8,7
+8,25
@@
* that calls these. Absolutely nothing like the original FORTRAN
*/
* that calls these. Absolutely nothing like the original FORTRAN
*/
-static int chain(int verb)
+static int bivalve(token_t verb, token_t obj)
+/* Clam/oyster actions */
+{
+ int k=0;
+ if(obj == OYSTER)k=1;
+ SPK=124+k;
+ if(TOTING(obj))SPK=120+k;
+ if(!TOTING(TRIDNT))SPK=122+k;
+ if(verb == LOCK)SPK=61;
+ if(SPK != 124)
+ return(2011);
+ DSTROY(CLAM);
+ DROP(OYSTER,game.loc);
+ DROP(PEARL,105);
+ return(2011);
+}
+
+static int chain(token_t verb)
+/* Do something to the bear's chain */
{
if(verb != LOCK) {
SPK=171;
{
if(verb != LOCK) {
SPK=171;
@@
-32,6
+50,19
@@
static int chain(int verb)
}
}
}
}
+static int find(token_t obj)
+/* Find. Might be carrying it, or it might be here. Else give caveat. */
+{
+ if(AT(obj) ||
+ (LIQ(0) == obj && AT(BOTTLE)) ||
+ K == LIQLOC(game.loc) ||
+ (obj == DWARF && ATDWRF(game.loc) > 0))
+ SPK=94;
+ if(game.closed)SPK=138;
+ if(TOTING(obj))SPK=24;
+ return(2011);
+}
+
/* This stuff was broken off as part of an effort to get the main program
* to compile without running out of memory. We're called with a number
* that says what label the caller wanted to "goto", and we return a
/* This stuff was broken off as part of an effort to get the main program
* to compile without running out of memory. We're called with a number
* that says what label the caller wanted to "goto", and we return a
@@
-229,30
+260,20
@@
L9040: if(obj == CLAM || obj == OYSTER) goto L9046;
if(obj == GRATE || obj == CHAIN)SPK=31;
if(SPK != 31 || !HERE(KEYS)) return(2011);
if(obj == CHAIN) goto L9048;
if(obj == GRATE || obj == CHAIN)SPK=31;
if(SPK != 31 || !HERE(KEYS)) return(2011);
if(obj == CHAIN) goto L9048;
- if
(!game.closng) goto L9043;
- K=130;
- if(!game.panic)game.clock2=15;
- game.panic=true;
- return(2010);
-
-
L9043:
K=34+game.prop[GRATE];
+ if
(game.closng) {
+
K=130;
+
if(!game.panic)game.clock2=15;
+
game.panic=true;
+
return(2010);
+ }
+
K=34+game.prop[GRATE];
game.prop[GRATE]=1;
if(verb == LOCK)game.prop[GRATE]=0;
K=K+2*game.prop[GRATE];
return(2010);
/* Clam/Oyster. */
game.prop[GRATE]=1;
if(verb == LOCK)game.prop[GRATE]=0;
K=K+2*game.prop[GRATE];
return(2010);
/* Clam/Oyster. */
-L9046: K=0;
- if(obj == OYSTER)K=1;
- SPK=124+K;
- if(TOTING(obj))SPK=120+K;
- if(!TOTING(TRIDNT))SPK=122+K;
- if(verb == LOCK)SPK=61;
- if(SPK != 124) return(2011);
- DSTROY(CLAM);
- DROP(OYSTER,game.loc);
- DROP(PEARL,105);
- return(2011);
+L9046: return bivalve(verb, obj);
/* Chain. */
L9048: return chain(verb);
/* Chain. */
L9048: return chain(verb);
@@
-320,7
+341,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,
verb, obj
));
/* Pour. If no object, or object is bottle, assume contents of bottle.
* special tests for pouring water or oil on plant or rusty door. */
/* Pour. If no object, or object is bottle, assume contents of bottle.
* special tests for pouring water or oil on plant or rusty door. */
@@
-396,24
+417,17
@@
L9160: if(obj != LAMP)SPK=76;
game.tally=game.tally-1;
DROP(CAVITY,game.loc);
SPK=216;
game.tally=game.tally-1;
DROP(CAVITY,game.loc);
SPK=216;
- return(2011);
-
-/* Throw moved into separate module. */
+ return(2011);
-L9170: return(throw(input,
obj, verb
));
+L9170: return(throw(input,
verb, obj
));
/* Quit. Intransitive only. Verify intent and exit if that's what he wants. */
L8180: if(YES(input,22,54,54)) score(1);
return(2012);
/* Quit. Intransitive only. Verify intent and exit if that's what he wants. */
L8180: if(YES(input,22,54,54)) score(1);
return(2012);
-/* Find. Might be carrying it, or it might be here. Else give caveat. */
-L9190: if(AT(obj) || (LIQ(0) == obj && AT(BOTTLE)) || K == LIQLOC(game.loc) || (obj ==
- DWARF && ATDWRF(game.loc) > 0))SPK=94;
- if(game.closed)SPK=138;
- if(TOTING(obj))SPK=24;
- return(2011);
+L9190: return find(obj);
/* Inventory. If object, treat same as find. Else report on current burden. */
/* Inventory. If object, treat same as find. Else report on current burden. */
diff --git
a/actions2.c
b/actions2.c
index 2788e1a22391ef571099cd688cc751fa4604656f..5b0bd86428bc8754e6e24de8b04aa6b32283ab14 100644
(file)
--- a/
actions2.c
+++ b/
actions2.c
@@
-134,7
+134,7
@@
int discard(long obj, bool just_do_it) {
* objects fall into two categories: enemies (snake, dwarf, etc.) and others
* (bird, clam, machine). Ambiguous if 2 enemies, or no enemies but 2 others. */
* objects fall into two categories: enemies (snake, dwarf, etc.) and others
* (bird, clam, machine). Ambiguous if 2 enemies, or no enemies but 2 others. */
-int attack(FILE *input, long
obj, long verb
) {
+int attack(FILE *input, long
verb, long obj
) {
int i =ATDWRF(game.loc);
if (obj == 0) {
if (i > 0)
int i =ATDWRF(game.loc);
if (obj == 0) {
if (i > 0)
@@
-226,7
+226,7
@@
int throw_support(long spk)
return(8);
}
return(8);
}
-int throw(FILE *cmdin, long
obj, long verb
)
+int throw(FILE *cmdin, long
verb, long obj
)
/* Throw. Same as discard unless axe. Then same as attack except
* ignore bird, and if dwarf is present then one might be killed.
* (Only way to do so!) Axe also special for dragon, bear, and
/* Throw. Same as discard unless axe. Then same as attack except
* ignore bird, and if dwarf is present then one might be killed.
* (Only way to do so!) Axe also special for dragon, bear, and
@@
-276,7
+276,7
@@
int throw(FILE *cmdin, long obj, long verb)
JUGGLE(BEAR);
return(2011);
}
JUGGLE(BEAR);
return(2011);
}
- return(attack(cmdin,
0, verb
));
+ return(attack(cmdin,
verb, 0
));
}
if (randrange(NDWARVES+1) < game.dflag) {
}
if (randrange(NDWARVES+1) < game.dflag) {