projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Moved application settings to settings_t struct
[open-adventure.git]
/
actions.c
diff --git
a/actions.c
b/actions.c
index 33c445cc0c13f7cfd92d33c717257b68bb60ee0f..f2ec65adac01a042d5b8b7283d4e89f9bee2ca4f 100644
(file)
--- a/
actions.c
+++ b/
actions.c
@@
-123,7
+123,7
@@
static int attack(struct command_t *command)
}
state_change(DRAGON, DRAGON_DEAD);
game.prop[RUG] = RUG_FLOOR;
}
state_change(DRAGON, DRAGON_DEAD);
game.prop[RUG] = RUG_FLOOR;
- /* FIXME: Arithme
n
tic on location values */
+ /* FIXME: Arithmetic on location values */
int k = (objects[DRAGON].plac + objects[DRAGON].fixd) / 2;
move(DRAGON + NOBJECTS, -1);
move(RUG + NOBJECTS, 0);
int k = (objects[DRAGON].plac + objects[DRAGON].fixd) / 2;
move(DRAGON + NOBJECTS, -1);
move(RUG + NOBJECTS, 0);
@@
-172,11
+172,11
@@
static int bigwords(token_t foo)
* crossing. */
if (game.place[EGGS] == LOC_NOWHERE && game.place[TROLL] == LOC_NOWHERE && game.prop[TROLL] == TROLL_UNPAID)
game.prop[TROLL] = TROLL_PAIDONCE;
* crossing. */
if (game.place[EGGS] == LOC_NOWHERE && game.place[TROLL] == LOC_NOWHERE && game.prop[TROLL] == TROLL_UNPAID)
game.prop[TROLL] = TROLL_PAIDONCE;
- k =
2
;
+ k =
EGGS_DONE
;
if (HERE(EGGS))
if (HERE(EGGS))
- k =
1
;
+ k =
EGGS_VANISHED
;
if (game.loc == objects[EGGS].plac)
if (game.loc == objects[EGGS].plac)
- k =
0
;
+ k =
EGGS_HERE
;
move(EGGS, objects[EGGS].plac);
pspeak(EGGS, look, k);
return GO_CLEAROBJ;
move(EGGS, objects[EGGS].plac);
pspeak(EGGS, look, k);
return GO_CLEAROBJ;
@@
-444,15
+444,15
@@
static int discard(token_t verb, token_t obj, bool just_do_it)
move(TROLL2, objects[TROLL].plac);
move(TROLL2 + NOBJECTS, objects[TROLL].fixd);
juggle(CHASM);
move(TROLL2, objects[TROLL].plac);
move(TROLL2 + NOBJECTS, objects[TROLL].fixd);
juggle(CHASM);
- game.prop[TROLL] =
2
;
+ game.prop[TROLL] =
TROLL_GONE
;
} else if (obj != VASE || game.loc == objects[PILLOW].plac) {
rspeak(OK_MAN);
} else {
} else if (obj != VASE || game.loc == objects[PILLOW].plac) {
rspeak(OK_MAN);
} else {
- game.prop[VASE] =
2
;
+ game.prop[VASE] =
VASE_BROKEN
;
if (AT(PILLOW))
if (AT(PILLOW))
- game.prop[VASE] =
0
;
+ game.prop[VASE] =
VASE_WHOLE
;
pspeak(VASE, look, game.prop[VASE] + 1);
pspeak(VASE, look, game.prop[VASE] + 1);
- if (game.prop[VASE] !=
0
)
+ if (game.prop[VASE] !=
VASE_WHOLE
)
game.fixed[VASE] = -1;
}
}
game.fixed[VASE] = -1;
}
}
@@
-523,25
+523,33
@@
static int eat(token_t verb, token_t obj)
static int extinguish(token_t verb, int obj)
/* Extinguish. Lamp, urn, dragon/volcano (nice try). */
{
static int extinguish(token_t verb, int obj)
/* Extinguish. Lamp, urn, dragon/volcano (nice try). */
{
- int spk = actions[verb].message;
if (obj == INTRANSITIVE) {
if (HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT)
obj = LAMP;
if (obj == INTRANSITIVE) {
if (HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT)
obj = LAMP;
- if (HERE(URN) && game.prop[URN] == 2)
- obj = obj * NOBJECTS + URN;
- if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS)
+ if (HERE(URN) && game.prop[URN] == URN_LIT)
+ obj = URN;
+ if (obj == INTRANSITIVE ||
+ HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT &&
+ HERE(URN) && game.prop[URN] == URN_LIT)
return GO_UNKNOWN;
}
if (obj == URN) {
return GO_UNKNOWN;
}
if (obj == URN) {
- game.prop[URN] = game.prop[URN] / 2;
- spk = URN_DARK;
+ if (game.prop[URN] != URN_EMPTY) {
+ state_change(URN, URN_DARK);
+ } else {
+ pspeak(URN, change, URN_DARK);
+ }
+
} else if (obj == LAMP) {
state_change(LAMP, LAMP_DARK);
} else if (obj == LAMP) {
state_change(LAMP, LAMP_DARK);
- spk = DARK(game.loc) ? PITCH_DARK : NO_MESSAGE;
- } else if (obj == DRAGON || obj == VOLCANO)
- spk = BEYOND_POWER;
- rspeak(spk);
+ rspeak(DARK(game.loc) ? PITCH_DARK : NO_MESSAGE);
+ } else if (obj == DRAGON || obj == VOLCANO) {
+ rspeak(BEYOND_POWER);
+
+ } else {
+ rspeak(actions[verb].message);
+ }
return GO_CLEAROBJ;
}
return GO_CLEAROBJ;
}
@@
-605,7
+613,7
@@
int fill(token_t verb, token_t obj)
return GO_CLEAROBJ;
}
rspeak(SHATTER_VASE);
return GO_CLEAROBJ;
}
rspeak(SHATTER_VASE);
- game.prop[VASE] =
2
;
+ game.prop[VASE] =
VASE_BROKEN
;
game.fixed[VASE] = -1;
return (discard(verb, obj, true));
} else if (obj == URN) {
game.fixed[VASE] = -1;
return (discard(verb, obj, true));
} else if (obj == URN) {
@@
-728,32
+736,27
@@
static int inven(void)
static int light(token_t verb, token_t obj)
/* Light. Applicable only to lamp and urn. */
{
static int light(token_t verb, token_t obj)
/* Light. Applicable only to lamp and urn. */
{
- int spk = actions[verb].message;
if (obj == INTRANSITIVE) {
if (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0)
obj = LAMP;
if (obj == INTRANSITIVE) {
if (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0)
obj = LAMP;
- if (HERE(URN) && game.prop[URN] == 1)
- obj = obj * NOBJECTS + URN;
- if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS)
+ if (HERE(URN) && game.prop[URN] == URN_DARK)
+ obj = URN;
+ if (obj == INTRANSITIVE ||
+ HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0 &&
+ HERE(URN) && game.prop[URN] == URN_DARK)
return GO_UNKNOWN;
}
if (obj == URN) {
return GO_UNKNOWN;
}
if (obj == URN) {
- if (game.prop[URN] == 0) {
- rspeak(URN_EMPTY);
- } else {
- game.prop[URN] = 2;
- rspeak(URN_LIT);
- }
+ state_change(URN, game.prop[URN] == URN_EMPTY ? URN_EMPTY : URN_LIT);
return GO_CLEAROBJ;
} else {
if (obj != LAMP) {
return GO_CLEAROBJ;
} else {
if (obj != LAMP) {
- rspeak(
spk
);
+ rspeak(
actions[verb].message
);
return GO_CLEAROBJ;
}
return GO_CLEAROBJ;
}
- spk = LAMP_OUT;
if (game.limit < 0) {
if (game.limit < 0) {
- rspeak(
spk
);
+ rspeak(
LAMP_OUT
);
return GO_CLEAROBJ;
}
state_change(LAMP, LAMP_BRIGHT);
return GO_CLEAROBJ;
}
state_change(LAMP, LAMP_BRIGHT);
@@
-888,11
+891,7
@@
static int pour(token_t verb, token_t obj)
game.prop[PLANT2] = game.prop[PLANT];
return GO_MOVE;
} else {
game.prop[PLANT2] = game.prop[PLANT];
return GO_MOVE;
} else {
- game.prop[DOOR] = 0;
- if (obj == OIL)
- game.prop[DOOR] = 1;
- spk = RUSTED_HINGES + game.prop[DOOR];
- rspeak(spk);
+ state_change(DOOR, (obj == OIL) ? DOOR_UNRUSTED : DOOR_RUSTED);
return GO_CLEAROBJ;
}
}
return GO_CLEAROBJ;
}
}
@@
-1086,7
+1085,7
@@
static int wave(token_t verb, token_t obj)
rspeak(spk);
return GO_CLEAROBJ;
}
rspeak(spk);
return GO_CLEAROBJ;
}
- /* FIXME: Arithemetic on proprty values */
+ /* FIXME: Arithemetic on prop
e
rty values */
if (HERE(BIRD))
spk = FREE_FLY + MOD(game.prop[BIRD], 2);
if (spk == FREE_FLY && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
if (HERE(BIRD))
spk = FREE_FLY + MOD(game.prop[BIRD], 2);
if (spk == FREE_FLY && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {