EtchedPixels / TaylorMade

Game Interpreter for later Adventure International games
GNU General Public License v2.0
5 stars 1 forks source link

Questprobe 3 support #3

Closed angstsmurf closed 1 year ago

angstsmurf commented 2 years ago

Update: It seems to be working now. Just needs more testing.

EDIT: It now is completable.

This is just the bare minimum to get it up and running. Not very well tested, but enough to know that there are serious bugs.

The Questprobe 3 game format is substantially different from the other games, almost enough to consider it a different engine.

None of the detection code for the other games works as-is, so Questprobe 3-specific detection has been added to all of the data-finding functions.

Strings have different end markers (0x1f and 0x18 instead of 0x7e and 0x5e), and all token text is offset by 0x7b, which the code uses to tell whether a character is a token or plain text ascii.

The "system messages" are at the end rather than the beginning, and in a somewhat different order than the later games, so a translating function, SysMessage(), has been added.

The game uses flags in a different way. Flag 0 is the location of the currently active hero, while flag 1 is the location of the other one. In the same manner, flag 2 is the value of everything the current character carries, while flag 3 holds the "carry room value" for everything the other one is holding. So when you switch, flags 0 and 1, and 2 and 3, switch values (0<->1, 2<->3). Flag 31 is set if the player currently is Thing, and clear if the player is The Human Flame. Darkness is marked by flag 43 instead of 1, and the game does not seem to have any concept of worn objects or an inventory limit.

The first four flags are not considered flags at all by the conditions and actions, so all references to flags must be offset by 4 in ExecuteLineCode() and related functions. This is done in the AdjustQuestprobeConditions() and AdjustQuestprobeActions() functions.

The conditions and actions are also different. The conditions are simply a subset of those in later games, but a couple of custom actions have been added to deal with the swapping of main character and displaying the watch status message. There is also an action responsible for drawing "overlay" images on top of the room image. The arrays Q3Condition[] and Q3Action[] are used to translate these into the latter-game order of conditions and actions, with the new actions tacked-on at the end. The code that deals with skipping action lines and counting parameters is adapted to account for this.

In the automatics table, every line begins with two 0x7e where the actions have their verb and noun.

The original has hardcoded routines to update certain flags every turn, implemented here in the function UpdateQ3Flags().

EtchedPixels commented 1 year ago

I think this does indeed belong in another interpreter. The main reason being the current one is intended to play the games in under 48K of RAM on 8/16bit machines.

angstsmurf commented 1 year ago

So how much more memory does this use? Seems like it shouldn't be impossible to reduce it a bit.

If you haven't seen it already, there is an expanded version of this code included in Gargoyle. Might be of interest as reference for anyone rewriting this or creating a Questprobe 3-specific version. There are a couple of fixes that perhaps should be ported over.

EDIT: In particular, it has is a kludge to make Temple of Terror completable, and another to prevent Questprobe 3 from softlocking if you do the final moves in the wrong order.

EDIT 2: To run TaylorMade games in Gargoyle, you will probably have to rename the game files to give them a ".tay" extension.