davidkinder / windows-agility Goto Github PK
View Code? Open in Web Editor NEWWindows port of Robert Masenten's AGiliTY AGT interpreter.
Home Page: http://www.davidkinder.co.uk/agility.html
License: GNU General Public License v2.0
Windows port of Robert Masenten's AGiliTY AGT interpreter.
Home Page: http://www.davidkinder.co.uk/agility.html
License: GNU General Public License v2.0
In the Multi-Dimensional Thief, from the start enter: E. E. S. PUT HOLE ON FLOOR
Interestingly, "PUT HOLE ON WALL" does seem to be interpreted correctly. Looking at the game data, the last two objects in the game are "ROOM'S FLOOR" and "ROOM'S CEILING" which is how this is supposed to work.
The Master's Edition of AGT included a "menu" mode which acts a bit like the later Legend games, allowing the input command to be built up from menus. AgiliTy's support for this doesn't seem to be quite right: at least, comparing AGiliTy running the Multi-Dimensional Thief and running the original shows differences, which should be investigated. In particular some objects and creatures are flagged with "flag nouns" which affect the menus.
In the Justice card section, when Robin Hood appears, the interpreter prints
GAME ERROR: Invalid argument to metacommand token
It looks like the smart disambiguation option in AGiliTy (configuration PURE_DISAMBIG=0) best matches the behaviour of the Master's Edition of AGT, and the "pre-Masters" 1.5 variants, so should probably be turned on by default in these cases. It should still be possible to over-ride this with a configuration file.
At the start Shades of Gray, HOWL works, but SCREAM does not. In the original either end the intro section.
Later on in Shades of Gray, in the Sherwood Forest section, HAIL works, but SIGNAL does not. Both should be synonyms for "PUT GLASS ON WINDOW".
If IBM_CHAR is set in the configuration file, support it by using the appropriate glyphs for characters in the original IBM PC DOS charset. This will give better versions of ASCII art in games, e.g. the tarot card layout in Shades of Gray. Consider setting this on by default in "agil.cfg".
The source of the Multi-Dimensional Thief contains this
COMMAND ORDER
PrintMessage 225
GetNumberInput
Not NumberEquals 55748761
But when run, entering 55748761 does not work, the NumberEquals test fails. The problem is that AGT represents the number in the condition as a signed 16-bit quantity, and values outside of this range just become the lowest 16-bits of the value, as a signed integer.
Spatterlight uses agt2agx to convert AGT games from D$$ format to AGX.
The Clang Undefined Behavior Sanitizer gives me warnings about load of misaligned address at lines 1056-1059 in util.c.
case FT_UINT32:
filedata[0]=v(long)&0xFF;
filedata[1]=(v(long)>>8)&0xFF;
filedata[2]=(v(long)>>16)&0xFF;
filedata[3]=(v(long)>>24)&0xFF;
This code uses the macro v(t)
which expands to (*(t*)(rec_desc->ptr))
:
filedata[0] = (*(long *)(rec_desc->ptr))&0xFF;
filedata[1] = ((*(long *)(rec_desc->ptr))>>8)&0xFF;
filedata[2] = ((*(long *)(rec_desc->ptr))>>16)&0xFF;
filedata[3] = ((*(long *)(rec_desc->ptr))>>24)&0xFF;
The warnings look like this:
~/spatterlight/terps/agility/util.c:1056:14: runtime error: load of misaligned address
0x7fb3bd80ce0c for type 'long', which requires 8 byte alignment
0x7fb3bd80ce0c: note: pointer points here
00 00 00 00 00 00 00 00 96 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00
^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
This is all a little outside my understanding of C and pointers, but I have a hunch that if I knew more, a solution could be found here:
https://stackoverflow.com/questions/28893303/is-a-misaligned-load-due-to-a-cast-undefined-behavior
or perhaps here:
https://dev.gnupg.org/rC92fa5f16d69707e302c0f85b2e5e80af8dc037f1
In the source code for The Multi-Dimensional Thief, the canonical command for entering the hole is "STEP THROUGH HOLE" (which works). "HOLE" redirects to "STEP THROUGH HOLE" (which also works). However, "ENTER HOLE" and "JUMP THROUGH HOLE" do not work. In the MDF source these both redirect to "STEP THROUGH $NOUN$".
With AGiliTy's tracing turned on, the interpreter redirects the forms that work to "climb through hole", but redirects the forms that do not work to "climb through noun".
In the Multi-Dimensional Thief, a creature called "OUT" is defined so that "GET OUT" is a valid command, and the game includes a meta command to process this in one location (in the water at the waterfall). But AGiliTy defines "GET OUT" as a synonym for "OUT", so by the time it gets to the meta command processing stage, the input "GET OUT" has already been rewritten to "OUT", so the game's meta command for "GET OUT" is never run.
A good test of AGiliTy would be to be able to finish Shades of Gray. One complication of this is that SoG uses the random number generator a lot. AGiliTy needs a mode that uses a fixed random number generator that always produces the same sequence, regardless of the compiler used for AGiliTy.
When the interpreter's main execution loop calls gen_sysmsg()
with context==MSG_MAIN
, substitutions like "$You$" are not being handled, even though they clearly should be.
If the game's data doesn't redefine the message, the message is processed and for "$You$" we'll end up calling wordcode_match()
with context==MSG_MAIN
. At the bottom of this function there is code that is clearly meant to handle this case:
if (pronoun_mode && match_str(pvarname,"YOU$"))
youme("I","you");
but the interpreter never gets that far, as before that there is this line
if (context==MSG_MAIN) return 0;
That doesn't look right. The above line is immediately before some substitutions that can't apply to MSG_MAIN messages, like "$NOUN$" and "$VERB$". It looks like the intention of that check is to skip the substitutions that don't apply to MSG_MAIN, but as a result some that do apply are ignored.
The most likely correct fix is to remove the above line, and make sure that the block of code immediately after it doesn't run in the MSG_MAIN case, but the final block that handles pronouns does run.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.