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.
|
5. Run `./advent` to play.
|
||||||
|
|
||||||
6. If you want to buld the documentation you will need asciidoctor.
|
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:
|
||||||
@-pylint --score=n *.py */*.py
|
@-pylint --score=n *.py */*.py
|
||||||
|
|
||||||
check: advent cheat pylint cppcheck
|
check: advent cheat pylint cppcheck spellcheck
|
||||||
cd tests; $(MAKE) --quiet
|
cd tests; $(MAKE) --quiet
|
||||||
|
|
||||||
|
spellcheck:
|
||||||
|
@batchspell adventure.yaml advent.adoc
|
||||||
|
|
||||||
reflow:
|
reflow:
|
||||||
@clang-format --style="{IndentWidth: 8, UseTab: ForIndentation}" -i $$(find . -name "*.[ch]")
|
@clang-format --style="{IndentWidth: 8, UseTab: ForIndentation}" -i $$(find . -name "*.[ch]")
|
||||||
@black --quiet *.py
|
@black --quiet *.py
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
|
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
|
||||||
// SPDX-License-Identifier: CC-BY-4.0
|
// SPDX-License-Identifier: CC-BY-4.0
|
||||||
|
|
||||||
Repository head::
|
1.20: 2024-09-23::
|
||||||
Make oldstyle correctly suppress line editing.
|
Make oldstyle correctly suppress line editing.
|
||||||
|
|
||||||
1.19: 2024-06-27::
|
1.19: 2024-06-27::
|
||||||
|
|
|
@ -676,7 +676,7 @@ static phase_codes_t extinguish(verb_t verb, obj_t obj) {
|
||||||
break;
|
break;
|
||||||
case LAMP:
|
case LAMP:
|
||||||
state_change(LAMP, LAMP_DARK);
|
state_change(LAMP, LAMP_DARK);
|
||||||
rspeak(DARK(game.loc) ? PITCH_DARK : NO_MESSAGE);
|
rspeak(IS_DARK_HERE() ? PITCH_DARK : NO_MESSAGE);
|
||||||
break;
|
break;
|
||||||
case DRAGON:
|
case DRAGON:
|
||||||
case VOLCANO:
|
case VOLCANO:
|
||||||
|
@ -1155,12 +1155,12 @@ static phase_codes_t read(command_t command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (command.obj > NOBJECTS || command.obj == NO_OBJECT ||
|
if (command.obj > NOBJECTS || command.obj == NO_OBJECT ||
|
||||||
DARK(game.loc)) {
|
IS_DARK_HERE()) {
|
||||||
return GO_UNKNOWN;
|
return GO_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DARK(game.loc)) {
|
if (IS_DARK_HERE()) {
|
||||||
sspeak(NO_SEE, command.word[0].raw);
|
sspeak(NO_SEE, command.word[0].raw);
|
||||||
} else if (command.obj == OYSTER) {
|
} else if (command.obj == OYSTER) {
|
||||||
if (!TOTING(OYSTER) || !game.closed) {
|
if (!TOTING(OYSTER) || !game.closed) {
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
|
// SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
|
||||||
// SPDX-License-Identifier: CC-BY-4.0
|
// 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 ==
|
== NAME ==
|
||||||
advent - Colossal Cave Adventure
|
advent - Colossal Cave Adventure
|
||||||
|
|
||||||
|
|
6
advent.h
6
advent.h
|
@ -66,6 +66,8 @@
|
||||||
* the cave starts to close. Only seems to be significant for the bird
|
* the cave starts to close. Only seems to be significant for the bird
|
||||||
* and readable objects, notably the clam/oyster - but the code around
|
* and readable objects, notably the clam/oyster - but the code around
|
||||||
* those tests is difficult to read.
|
* 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_NOTFOUND(obj) (game.objects[obj].prop == STATE_NOTFOUND)
|
||||||
#define OBJECT_IS_FOUND(obj) (game.objects[obj].prop == STATE_FOUND)
|
#define OBJECT_IS_FOUND(obj) (game.objects[obj].prop == STATE_FOUND)
|
||||||
|
@ -92,7 +94,7 @@
|
||||||
* LIQUID() = object number of liquid in bottle
|
* LIQUID() = object number of liquid in bottle
|
||||||
* LIQLOC(LOC) = object number of liquid (if any) at LOC
|
* LIQLOC(LOC) = object number of liquid (if any) at LOC
|
||||||
* FORCED(LOC) = true if LOC moves without asking for input (COND=2)
|
* FORCED(LOC) = true if LOC moves without asking for input (COND=2)
|
||||||
* DARK(LOC) = true if location "LOC" is dark
|
* IS_DARK_HERE() = true if location "LOC" is dark
|
||||||
* PCT(N) = true N% of the time (N integer from 0 to 100)
|
* PCT(N) = true N% of the time (N integer from 0 to 100)
|
||||||
* GSTONE(OBJ) = true if OBJ is a gemstone
|
* GSTONE(OBJ) = true if OBJ is a gemstone
|
||||||
* FOREST(LOC) = true if LOC is part of the forest
|
* FOREST(LOC) = true if LOC is part of the forest
|
||||||
|
@ -118,7 +120,7 @@
|
||||||
(CNDBIT((LOC), COND_FLUID) ? CNDBIT((LOC), COND_OILY) ? OIL : WATER \
|
(CNDBIT((LOC), COND_FLUID) ? CNDBIT((LOC), COND_OILY) ? OIL : WATER \
|
||||||
: NO_OBJECT)
|
: NO_OBJECT)
|
||||||
#define FORCED(LOC) CNDBIT(LOC, COND_FORCED)
|
#define FORCED(LOC) CNDBIT(LOC, COND_FORCED)
|
||||||
#define DARK(DUMMY) \
|
#define IS_DARK_HERE() \
|
||||||
(!CNDBIT(game.loc, COND_LIT) && \
|
(!CNDBIT(game.loc, COND_LIT) && \
|
||||||
(game.objects[LAMP].prop == LAMP_DARK || !HERE(LAMP)))
|
(game.objects[LAMP].prop == LAMP_DARK || !HERE(LAMP)))
|
||||||
#define PCT(N) (randrange(100) < (N))
|
#define PCT(N) (randrange(100) < (N))
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
# SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
|
# SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
|
||||||
# SPDX-License-Identifier: BSD-2-Clause
|
# 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
|
# This YAML file gets processed into a collection of data structures and
|
||||||
# variable initializers describing Colossal Cave. It replaces an ad-hoc
|
# variable initializers describing Colossal Cave. It replaces an ad-hoc
|
||||||
# text database shipped with Adventure versions up to 2.5. The format
|
# 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.'
|
- 'There are a few recent issues of "Spelunker Today" magazine here.'
|
||||||
texts:
|
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."
|
cover you see, "Please leave the magazines at the construction site."
|
||||||
- DWARF:
|
- DWARF:
|
||||||
words: ['dwarf', 'dwarv']
|
words: ['dwarf', 'dwarv']
|
||||||
|
@ -3940,11 +3944,13 @@ obituaries:
|
||||||
Oh dear, you seem to have gotten yourself killed. I might be able to
|
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
|
help you out, but I've never really done this before. Do you want me
|
||||||
to try to reincarnate you?
|
to try to reincarnate you?
|
||||||
|
# batchspell: add wr
|
||||||
yes_response: |-
|
yes_response: |-
|
||||||
All right. But don't blame me if something goes wr......
|
All right. But don't blame me if something goes wr......
|
||||||
--- POOF!! ---
|
--- POOF!! ---
|
||||||
You are engulfed in a cloud of orange smoke. Coughing and gasping,
|
You are engulfed in a cloud of orange smoke. Coughing and gasping,
|
||||||
you emerge from the smoke and find....
|
you emerge from the smoke and find....
|
||||||
|
# batchspell: remove wr
|
||||||
- query: |-
|
- query: |-
|
||||||
You clumsy oaf, you've done it again! I don't know how long I can
|
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?
|
keep this up. Do you want me to try reincarnating you again?
|
||||||
|
@ -4226,7 +4232,7 @@ actions: !!omap
|
||||||
message: |-
|
message: |-
|
||||||
There is a puff of orange smoke; within it, fiery runes spell out:
|
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']
|
words: ['versi']
|
||||||
noaction: true
|
noaction: true
|
||||||
|
|
||||||
|
|
8
main.c
8
main.c
|
@ -534,7 +534,7 @@ static void describe_location(void) {
|
||||||
msg = locations[game.loc].description.big;
|
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];
|
msg = arbitrary_messages[PITCH_DARK];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1047,7 +1047,7 @@ static void listobjects(void) {
|
||||||
* Similarly for chain; game.prop is initially CHAINING_BEAR (locked to
|
* Similarly for chain; game.prop is initially CHAINING_BEAR (locked to
|
||||||
* bear). These hacks are because game.prop=0 is needed to
|
* bear). These hacks are because game.prop=0 is needed to
|
||||||
* get full score. */
|
* get full score. */
|
||||||
if (!DARK(game.loc)) {
|
if (!IS_DARK_HERE()) {
|
||||||
++game.locs[game.loc].abbrev;
|
++game.locs[game.loc].abbrev;
|
||||||
for (int i = game.locs[game.loc].atloc; i != 0;
|
for (int i = game.locs[game.loc].atloc; i != 0;
|
||||||
i = game.link[i]) {
|
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
|
/* The easiest way to get killed is to fall into a pit in
|
||||||
* pitch darkness. */
|
* pitch darkness. */
|
||||||
if (!FORCED(game.loc) && DARK(game.loc) && game.wzdark &&
|
if (!FORCED(game.loc) && IS_DARK_HERE() && game.wzdark &&
|
||||||
PCT(PIT_KILL_PROB)) {
|
PCT(PIT_KILL_PROB)) {
|
||||||
rspeak(PIT_FALL);
|
rspeak(PIT_FALL);
|
||||||
game.oldlc2 = game.loc;
|
game.oldlc2 = game.loc;
|
||||||
|
@ -1283,7 +1283,7 @@ static bool do_command(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check to see if the room is dark. */
|
/* 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.
|
/* If the knife is not here it permanently disappears.
|
||||||
* Possibly this should fire if the knife is here but
|
* 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
|
gratefully acknowledged. Petr Voropaev contributed fuzz testing and
|
||||||
code cleanups. Aaron Traas did a lot of painstaking work to improve
|
code cleanups. Aaron Traas did a lot of painstaking work to improve
|
||||||
test coverage, and factored out the last handful of gotos. Ryan
|
test coverage, and factored out the last handful of gotos. Ryan
|
||||||
Sarson nudged us into fixing a longstannding minor bug in the
|
Sarson nudged us into fixing a longstanding minor bug in the
|
||||||
handling of incorrect magic-word sequebcesm,
|
handling of incorrect magic-word sequences,
|
||||||
|
|
||||||
== Nomenclature ==
|
== Nomenclature ==
|
||||||
|
|
||||||
|
@ -75,7 +75,8 @@ Bug fixes:
|
||||||
|
|
||||||
* A few minor typos have been corrected: absence of capitalization on
|
* A few minor typos have been corrected: absence of capitalization on
|
||||||
"Swiss" and "Persian", inconsistent spelling of "imbedded" vs. "embedded",
|
"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
|
* Under odd circumstances (dropping rug or vase outdoors) the game could
|
||||||
formerly say "floor" when it should say "ground" (or "dirt", or
|
formerly say "floor" when it should say "ground" (or "dirt", or
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue