projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Gut and rebuild YES() with cleaner approach that doesn't rely on packing.
[open-adventure.git]
/
actions.c
diff --git
a/actions.c
b/actions.c
index 59f9942b6715acf1959362b8a1b9413d7ce1aea6..5348d3d80033b1494e701806f6de8c02a6dceef2 100644
(file)
--- a/
actions.c
+++ b/
actions.c
@@
-21,9
+21,8
@@
static int attack(FILE *input, long verb, token_t obj)
* enemies, or no enemies but 2 others. */
{
int spk = ACTSPK[verb];
* enemies, or no enemies but 2 others. */
{
int spk = ACTSPK[verb];
- int d = ATDWRF(game.loc);
- if (obj == 0) {
- if (d > 0)
+ if (obj == 0 || obj == INTRANSITIVE) {
+ if (ATDWRF(game.loc) > 0)
obj = DWARF;
if (HERE(SNAKE))obj = obj * NOBJECTS + SNAKE;
if (AT(DRAGON) && game.prop[DRAGON] == 0)obj = obj * NOBJECTS + DRAGON;
obj = DWARF;
if (HERE(SNAKE))obj = obj * NOBJECTS + SNAKE;
if (AT(DRAGON) && game.prop[DRAGON] == 0)obj = obj * NOBJECTS + DRAGON;
@@
-65,7
+64,7
@@
static int attack(FILE *input, long verb, token_t obj)
if (obj == DRAGON)spk = ALREADY_DEAD;
if (obj == TROLL)spk = ROCKY_TROLL;
if (obj == OGRE)spk = OGRE_DODGE;
if (obj == DRAGON)spk = ALREADY_DEAD;
if (obj == TROLL)spk = ROCKY_TROLL;
if (obj == OGRE)spk = OGRE_DODGE;
- if (obj == OGRE &&
d
> 0) {
+ if (obj == OGRE &&
ATDWRF(game.loc)
> 0) {
RSPEAK(spk);
RSPEAK(KNIFE_THROWN);
DESTROY(OGRE);
RSPEAK(spk);
RSPEAK(KNIFE_THROWN);
DESTROY(OGRE);
@@
-177,7
+176,7
@@
static void blast(void)
if (HERE(ROD2))
game.bonus = SPLATTER_MESSAGE;
RSPEAK(game.bonus);
if (HERE(ROD2))
game.bonus = SPLATTER_MESSAGE;
RSPEAK(game.bonus);
-
scor
e(endgame);
+
terminat
e(endgame);
}
}
}
}
@@
-558,7
+557,7
@@
int fill(token_t verb, token_t obj)
spk = URN_NOPOUR;
if (LIQUID() != 0)
spk = BOTTLE_FULL;
spk = URN_NOPOUR;
if (LIQUID() != 0)
spk = BOTTLE_FULL;
- if (spk ==
107
) {
+ if (spk ==
BOTTLED_WATER
) {
game.prop[BOTTLE] = MOD(COND[game.loc], 4) / 2 * 2;
k = LIQUID();
if (TOTING(BOTTLE))
game.prop[BOTTLE] = MOD(COND[game.loc], 4) / 2 * 2;
k = LIQUID();
if (TOTING(BOTTLE))
@@
-711,7
+710,7
@@
static int lock(token_t verb, token_t obj)
if (AT(GRATE))obj = GRATE;
if (obj != 0 && HERE(CHAIN)) return GO_UNKNOWN;
if (HERE(CHAIN))obj = CHAIN;
if (AT(GRATE))obj = GRATE;
if (obj != 0 && HERE(CHAIN)) return GO_UNKNOWN;
if (HERE(CHAIN))obj = CHAIN;
- if (obj == 0) {
+ if (obj == 0
|| obj == INTRANSITIVE
) {
RSPEAK(spk);
return GO_CLEAROBJ;
}
RSPEAK(spk);
return GO_CLEAROBJ;
}
@@
-732,7
+731,7
@@
static int lock(token_t verb, token_t obj)
return chain(verb);
if (game.closng) {
spk = EXIT_CLOSED;
return chain(verb);
if (game.closng) {
spk = EXIT_CLOSED;
- if (!game.panic)game.clock2 =
15
;
+ if (!game.panic)game.clock2 =
PANICTIME
;
game.panic = true;
} else {
spk = game.prop[GRATE] ? GRATE_LOCKED : ALREADY_LOCKED;
game.panic = true;
} else {
spk = game.prop[GRATE] ? GRATE_LOCKED : ALREADY_LOCKED;
@@
-793,8
+792,8
@@
static int pour(token_t verb, token_t obj)
static int quit(FILE *input)
/* Quit. Intransitive only. Verify intent and exit if that's what he wants. */
{
static int quit(FILE *input)
/* Quit. Intransitive only. Verify intent and exit if that's what he wants. */
{
- if (YES(
input,
REALLY_QUIT, OK_MAN, OK_MAN))
-
scor
e(quitgame);
+ if (YES(REALLY_QUIT, OK_MAN, OK_MAN))
+
terminat
e(quitgame);
return GO_CLEAROBJ;
}
return GO_CLEAROBJ;
}
@@
-821,7
+820,7
@@
static int read(FILE *input, token_t verb, token_t obj)
return GO_CLEAROBJ;
}
if (obj == OYSTER && !game.clshnt) {
return GO_CLEAROBJ;
}
if (obj == OYSTER && !game.clshnt) {
- game.clshnt = YES(
input,
CLUE_QUERY, WAYOUT_CLUE, OK_MAN);
+ game.clshnt = YES(CLUE_QUERY, WAYOUT_CLUE, OK_MAN);
return GO_CLEAROBJ;
}
PSPEAK(obj, OBJTXT[obj] + game.prop[obj]);
return GO_CLEAROBJ;
}
PSPEAK(obj, OBJTXT[obj] + game.prop[obj]);
@@
-951,13
+950,6
@@
static int throw (FILE *cmdin, long verb, token_t obj)
return throw_support((++game.dkill == 1) ? DWARF_SMOKE : KILLED_DWARF);
}
return throw_support((++game.dkill == 1) ? DWARF_SMOKE : KILLED_DWARF);
}
-static int vscore(void)
-/* Score. Call scoring routine but tell it to return. */
-{
- score(scoregame);
- return GO_CLEAROBJ;
-}
-
static int wake(token_t verb, token_t obj)
/* Wake. Only use is to disturb the dwarves. */
{
static int wake(token_t verb, token_t obj)
/* Wake. Only use is to disturb the dwarves. */
{
@@
-982,7
+974,7
@@
static int wave(token_t verb, token_t obj)
return GO_CLEAROBJ;
}
if (HERE(BIRD))spk = FREE_FLY + MOD(game.prop[BIRD], 2);
return GO_CLEAROBJ;
}
if (HERE(BIRD))spk = FREE_FLY + MOD(game.prop[BIRD], 2);
- if (spk ==
206
&& game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
+ if (spk ==
FREE_FLY
&& game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
DROP(JADE, game.loc);
game.prop[JADE] = 0;
--game.tally;
DROP(JADE, game.loc);
game.prop[JADE] = 0;
--game.tally;
@@
-1121,7
+1113,8
@@
int action(FILE *input, enum speechpart part, long verb, token_t obj)
blast();
return GO_CLEAROBJ;
case 23: /* SCOR */
blast();
return GO_CLEAROBJ;
case 23: /* SCOR */
- return vscore();
+ score(scoregame);
+ return GO_CLEAROBJ;
case 24: /* FOO */
return bigwords(WD1);
case 25: /* BRIEF */
case 24: /* FOO */
return bigwords(WD1);
case 25: /* BRIEF */