From: Eric S. Raymond Date: Wed, 5 Jul 2017 06:34:36 +0000 (-0400) Subject: Under oldstyle, mangled echoed unknown text to simulate old behavior. X-Git-Tag: takebird~18 X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=commitdiff_plain;h=df87c596fb94eed31616a827289b1a30fe83cf87 Under oldstyle, mangled echoed unknown text to simulate old behavior. --- diff --git a/advent.adoc b/advent.adoc index 01dded4..c95758e 100644 --- a/advent.adoc +++ b/advent.adoc @@ -43,7 +43,8 @@ There have been no gameplay changes. -r:: Restore game from specified file -o:: Old-style. Restores original interface, no prompt or line editing. - Also ignores new-school one-letter commands l, x, g, z, i. + Also ignores new-school one-letter commands l, x, g, z, i. Also + case-smashes and truncates unrecognized text when echoed. == BUGS == diff --git a/misc.c b/misc.c index 36deef4..d1c68ab 100644 --- a/misc.c +++ b/misc.c @@ -102,6 +102,28 @@ void tokenize(char* raw, struct command_t *cmd) // pack the substrings cmd->wd1 = token_to_packed(cmd->raw1); cmd->wd2 = token_to_packed(cmd->raw2); + + /* (ESR) In oldstyle mode, simulate the uppercasing and truncating + * effect on raw tokens of packing them into sixbit characters, 5 + * to a 32-bit word. This is something the FORTRAN version did + * becuse archaic FORTRAN had no string types. Don Wood's + * mechanical translation of 2.5 to C retained the packing and + * thus this misfeature. + * + * It's philosophically questionable whether this is the right + * thing to do even in oldstyle mode. On one hand, the text + * mangling was not authorial intent, but a result of limitations + * in their tools. On the other, not simulating this misbehavior + * goes against the goal of making oldstyle as accurate as + * possible an emulation of the original UI. + */ + if (settings.oldstyle) { + cmd->raw1[TOKLEN+TOKLEN] = cmd->raw1[TOKLEN+TOKLEN] = '\0'; + for (int i = 0; i < strlen(cmd->raw1); i++) + cmd->raw1[i] = toupper(cmd->raw1[i]); + for (int i = 0; i < strlen(cmd->raw2); i++) + cmd->raw2[i] = toupper(cmd->raw2[i]); + } } /* Hide the fact that wods are corrently packed longs */ diff --git a/notes.adoc b/notes.adoc index c993f91..9981a12 100644 --- a/notes.adoc +++ b/notes.adoc @@ -31,7 +31,7 @@ with the BSD Games version. Extreme care has been taken not to make changes that would alter the logic of the game as we received it from Don Woods, except to fix glitches that were clearly bugs. By policy, all user-visible -changes must be revertible with the -o (oldstyle) option. +changes to gameplay must be revertible with the -o (oldstyle) option. It is a goal of this project to exactly preserve the *intended behavior* of 430-point Adventure, but the implementation of it is fair @@ -53,7 +53,8 @@ Bug fixes: * Attempting to extinguish an unlit urn caused it to lose its oil. * Unrecognized words are no longer truncated to 5 characters and - uppercased when they are echoed. + uppercased when they are echoed. (This behavior is restored by the + oldstyle switch.) * "A crystal bridge now spans the fissure." (progressive present) was incorrect most places it appeared and has been replaced by "A crystal diff --git a/tests/oldstyle.chk b/tests/oldstyle.chk index 5deb6f2..d8aa9bb 100644 --- a/tests/oldstyle.chk +++ b/tests/oldstyle.chk @@ -10,19 +10,19 @@ down a gully. i -Sorry, I don't know the word "i". +Sorry, I don't know the word "I". l -Sorry, I don't know the word "l". +Sorry, I don't know the word "L". x -Sorry, I don't know the word "x". +Sorry, I don't know the word "X". z -Sorry, I don't know the word "z". +Sorry, I don't know the word "Z". quit