GithubHelp home page GithubHelp logo

davidkinder / windows-agility Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 5.0 1.14 MB

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

C 87.48% C++ 6.37% CSS 0.02% HTML 5.97% Batchfile 0.03% Shell 0.13%

windows-agility's People

Contributors

davidkinder avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

windows-agility's Issues

Flag nouns are not fully implemented

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.

Menu mode needs 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.

Turn on smart disambiguation by default for Master's Edition

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.

Some synonyms not working in Shades of Gray

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".

Support IBM_CHAR option in Windows port

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".

When asking for a number, the result should be a signed 16-bit quantity

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.

Load of misaligned address undefined behavior in Generic/util.c

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

Command re-direction in pre-Masters Edition 1.5 variants do not handle $...$ words (e.g. "$NOUN$")

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".

Built-in verb synonyms take precedence over meta commands for the same input

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.

Write a test script for Shades of Gray

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.

Substitutions don't work in messages from the main execution loop

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.