Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
|
7d848c89e1 | ||
|
7bbf994fce | ||
|
3e989aec53 | ||
|
9df69fe034 | ||
|
a2bb39dc7e |
9 changed files with 50 additions and 33 deletions
|
@ -23,3 +23,5 @@ You can also use pip to install PyYAML: `pip3 install PyYAML`.
|
|||
5. Run `./advent` to play.
|
||||
|
||||
6. If you want to buld the documentation you will need asciidoctor.
|
||||
|
||||
7. Running the regression tests requires batchspell
|
||||
|
|
5
Makefile
5
Makefile
|
@ -72,9 +72,12 @@ cppcheck:
|
|||
pylint:
|
||||
@-pylint --score=n *.py */*.py
|
||||
|
||||
check: advent cheat pylint cppcheck
|
||||
check: advent cheat pylint cppcheck spellcheck
|
||||
cd tests; $(MAKE) --quiet
|
||||
|
||||
spellcheck:
|
||||
@batchspell adventure.yaml advent.adoc
|
||||
|
||||
reflow:
|
||||
@clang-format --style="{IndentWidth: 8, UseTab: ForIndentation}" -i $$(find . -name "*.[ch]")
|
||||
@black --quiet *.py
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
|
||||
// SPDX-License-Identifier: CC-BY-4.0
|
||||
|
||||
Repository head::
|
||||
1.20: 2024-09-23::
|
||||
Make oldstyle correctly suppress line editing.
|
||||
|
||||
1.19: 2024-06-27::
|
||||
|
|
|
@ -676,7 +676,7 @@ static phase_codes_t extinguish(verb_t verb, obj_t obj) {
|
|||
break;
|
||||
case LAMP:
|
||||
state_change(LAMP, LAMP_DARK);
|
||||
rspeak(DARK(game.loc) ? PITCH_DARK : NO_MESSAGE);
|
||||
rspeak(IS_DARK_HERE() ? PITCH_DARK : NO_MESSAGE);
|
||||
break;
|
||||
case DRAGON:
|
||||
case VOLCANO:
|
||||
|
@ -1155,12 +1155,12 @@ static phase_codes_t read(command_t command)
|
|||
}
|
||||
}
|
||||
if (command.obj > NOBJECTS || command.obj == NO_OBJECT ||
|
||||
DARK(game.loc)) {
|
||||
IS_DARK_HERE()) {
|
||||
return GO_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
if (DARK(game.loc)) {
|
||||
if (IS_DARK_HERE()) {
|
||||
sspeak(NO_SEE, command.word[0].raw);
|
||||
} else if (command.obj == OYSTER) {
|
||||
if (!TOTING(OYSTER) || !game.closed) {
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
|
||||
// SPDX-License-Identifier: CC-BY-4.0
|
||||
|
||||
// batchspell: add advent logfile savefile roleplaying Gillogly PDP Ctrl-D
|
||||
// batchspell: add EOF autosave endianness wumpus zork nethack
|
||||
|
||||
== NAME ==
|
||||
advent - Colossal Cave Adventure
|
||||
|
||||
|
|
40
advent.h
40
advent.h
|
@ -66,6 +66,8 @@
|
|||
* the cave starts to close. Only seems to be significant for the bird
|
||||
* and readable objects, notably the clam/oyster - but the code around
|
||||
* those tests is difficult to read.
|
||||
*
|
||||
* All tests of the prop member are done with either these macros or ==.
|
||||
*/
|
||||
#define OBJECT_IS_NOTFOUND(obj) (game.objects[obj].prop == STATE_NOTFOUND)
|
||||
#define OBJECT_IS_FOUND(obj) (game.objects[obj].prop == STATE_FOUND)
|
||||
|
@ -83,24 +85,24 @@
|
|||
#define PROMPT "> "
|
||||
|
||||
/*
|
||||
* DESTROY(N) = Get rid of an item by putting it in LOC_NOWHERE
|
||||
* MOD(N,M) = Arithmetic modulus
|
||||
* TOTING(OBJ) = true if the OBJ is being carried
|
||||
* AT(OBJ) = true if on either side of two-placed object
|
||||
* HERE(OBJ) = true if the OBJ is at "LOC" (or is being carried)
|
||||
* CNDBIT(L,N) = true if COND(L) has bit n set (bit 0 is units bit)
|
||||
* LIQUID() = object number of liquid in bottle
|
||||
* LIQLOC(LOC) = object number of liquid (if any) at LOC
|
||||
* FORCED(LOC) = true if LOC moves without asking for input (COND=2)
|
||||
* DARK(LOC) = true if location "LOC" is dark
|
||||
* PCT(N) = true N% of the time (N integer from 0 to 100)
|
||||
* GSTONE(OBJ) = true if OBJ is a gemstone
|
||||
* FOREST(LOC) = true if LOC is part of the forest
|
||||
* OUTSIDE(LOC) = true if location not in the cave
|
||||
* INSIDE(LOC) = true if location is in the cave or the building at the
|
||||
* beginning of the game
|
||||
* INDEEP(LOC) = true if location is in the Hall of Mists or deeper
|
||||
* BUG(X) = report bug and exit
|
||||
* DESTROY(N) = Get rid of an item by putting it in LOC_NOWHERE
|
||||
* MOD(N,M) = Arithmetic modulus
|
||||
* TOTING(OBJ) = true if the OBJ is being carried
|
||||
* AT(OBJ) = true if on either side of two-placed object
|
||||
* HERE(OBJ) = true if the OBJ is at "LOC" (or is being carried)
|
||||
* CNDBIT(L,N) = true if COND(L) has bit n set (bit 0 is units bit)
|
||||
* LIQUID() = object number of liquid in bottle
|
||||
* LIQLOC(LOC) = object number of liquid (if any) at LOC
|
||||
* FORCED(LOC) = true if LOC moves without asking for input (COND=2)
|
||||
* IS_DARK_HERE() = true if location "LOC" is dark
|
||||
* PCT(N) = true N% of the time (N integer from 0 to 100)
|
||||
* GSTONE(OBJ) = true if OBJ is a gemstone
|
||||
* FOREST(LOC) = true if LOC is part of the forest
|
||||
* OUTSIDE(LOC) = true if location not in the cave
|
||||
* INSIDE(LOC) = true if location is in the cave or the building at the
|
||||
* beginning of the game
|
||||
* INDEEP(LOC) = true if location is in the Hall of Mists or deeper
|
||||
* BUG(X) = report bug and exit
|
||||
*/
|
||||
#define DESTROY(N) move(N, LOC_NOWHERE)
|
||||
#define MOD(N, M) ((N) % (M))
|
||||
|
@ -118,7 +120,7 @@
|
|||
(CNDBIT((LOC), COND_FLUID) ? CNDBIT((LOC), COND_OILY) ? OIL : WATER \
|
||||
: NO_OBJECT)
|
||||
#define FORCED(LOC) CNDBIT(LOC, COND_FORCED)
|
||||
#define DARK(DUMMY) \
|
||||
#define IS_DARK_HERE() \
|
||||
(!CNDBIT(game.loc, COND_LIT) && \
|
||||
(game.objects[LAMP].prop == LAMP_DARK || !HERE(LAMP)))
|
||||
#define PCT(N) (randrange(100) < (N))
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
# SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# batchspell: add XYZZY Twopit Bedquilt ne se sw nw dwarves dwarvish gouts
|
||||
# batchspell: add Crowther add axe pinin Har har meself Hmmm Adventuredom
|
||||
# batchspell: add Tsk gameplay bugfixes
|
||||
#
|
||||
# This YAML file gets processed into a collection of data structures and
|
||||
# variable initializers describing Colossal Cave. It replaces an ad-hoc
|
||||
# text database shipped with Adventure versions up to 2.5. The format
|
||||
|
@ -3432,7 +3436,7 @@ objects: !!omap
|
|||
- 'There are a few recent issues of "Spelunker Today" magazine here.'
|
||||
texts:
|
||||
- |-
|
||||
I'm afraid the magazine is written in dwarvish. But pencilled on one
|
||||
I'm afraid the magazine is written in dwarvish. But penciled on one
|
||||
cover you see, "Please leave the magazines at the construction site."
|
||||
- DWARF:
|
||||
words: ['dwarf', 'dwarv']
|
||||
|
@ -3940,11 +3944,13 @@ obituaries:
|
|||
Oh dear, you seem to have gotten yourself killed. I might be able to
|
||||
help you out, but I've never really done this before. Do you want me
|
||||
to try to reincarnate you?
|
||||
# batchspell: add wr
|
||||
yes_response: |-
|
||||
All right. But don't blame me if something goes wr......
|
||||
--- POOF!! ---
|
||||
You are engulfed in a cloud of orange smoke. Coughing and gasping,
|
||||
you emerge from the smoke and find....
|
||||
# batchspell: remove wr
|
||||
- query: |-
|
||||
You clumsy oaf, you've done it again! I don't know how long I can
|
||||
keep this up. Do you want me to try reincarnating you again?
|
||||
|
@ -4226,7 +4232,7 @@ actions: !!omap
|
|||
message: |-
|
||||
There is a puff of orange smoke; within it, fiery runes spell out:
|
||||
|
||||
\tOpen Adventure %V - http://www.catb.org/esr/open-adventure/
|
||||
Open Adventure %V - http://www.catb.org/esr/open-adventure/
|
||||
words: ['versi']
|
||||
noaction: true
|
||||
|
||||
|
|
8
main.c
8
main.c
|
@ -534,7 +534,7 @@ static void describe_location(void) {
|
|||
msg = locations[game.loc].description.big;
|
||||
}
|
||||
|
||||
if (!FORCED(game.loc) && DARK(game.loc)) {
|
||||
if (!FORCED(game.loc) && IS_DARK_HERE()) {
|
||||
msg = arbitrary_messages[PITCH_DARK];
|
||||
}
|
||||
|
||||
|
@ -1047,7 +1047,7 @@ static void listobjects(void) {
|
|||
* Similarly for chain; game.prop is initially CHAINING_BEAR (locked to
|
||||
* bear). These hacks are because game.prop=0 is needed to
|
||||
* get full score. */
|
||||
if (!DARK(game.loc)) {
|
||||
if (!IS_DARK_HERE()) {
|
||||
++game.locs[game.loc].abbrev;
|
||||
for (int i = game.locs[game.loc].atloc; i != 0;
|
||||
i = game.link[i]) {
|
||||
|
@ -1229,7 +1229,7 @@ static bool do_move(void) {
|
|||
|
||||
/* The easiest way to get killed is to fall into a pit in
|
||||
* pitch darkness. */
|
||||
if (!FORCED(game.loc) && DARK(game.loc) && game.wzdark &&
|
||||
if (!FORCED(game.loc) && IS_DARK_HERE() && game.wzdark &&
|
||||
PCT(PIT_KILL_PROB)) {
|
||||
rspeak(PIT_FALL);
|
||||
game.oldlc2 = game.loc;
|
||||
|
@ -1283,7 +1283,7 @@ static bool do_command(void) {
|
|||
}
|
||||
|
||||
/* Check to see if the room is dark. */
|
||||
game.wzdark = DARK(game.loc);
|
||||
game.wzdark = IS_DARK_HERE();
|
||||
|
||||
/* If the knife is not here it permanently disappears.
|
||||
* Possibly this should fire if the knife is here but
|
||||
|
|
|
@ -16,8 +16,8 @@ of Peje Nilsson in restructuring some particularly grotty gotos is
|
|||
gratefully acknowledged. Petr Voropaev contributed fuzz testing and
|
||||
code cleanups. Aaron Traas did a lot of painstaking work to improve
|
||||
test coverage, and factored out the last handful of gotos. Ryan
|
||||
Sarson nudged us into fixing a longstannding minor bug in the
|
||||
handling of incorrect magic-word sequebcesm,
|
||||
Sarson nudged us into fixing a longstanding minor bug in the
|
||||
handling of incorrect magic-word sequences,
|
||||
|
||||
== Nomenclature ==
|
||||
|
||||
|
@ -75,7 +75,8 @@ Bug fixes:
|
|||
|
||||
* A few minor typos have been corrected: absence of capitalization on
|
||||
"Swiss" and "Persian", inconsistent spelling of "imbedded" vs. "embedded",
|
||||
"eying" for "eyeing", "thresholds" for "threshholds".
|
||||
"eying" for "eyeing", "thresholds" for "threshholds", "pencilled"
|
||||
for "penciled".
|
||||
|
||||
* Under odd circumstances (dropping rug or vase outdoors) the game could
|
||||
formerly say "floor" when it should say "ground" (or "dirt", or
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue