Prev: AF70 Up: Map Next: AF90
AF7B: Parser: Validate Direct Object
Used by the routines at AF9F, F853, F8F2, F975, FA29, FA6A, ParseVerb_Drink, FB5D, FBB9, FBC3, FBDE, FC10, FC2F and FC4B.
In most adventure games, the structure for a command is "verb + direct object". This is usually how the player interacts with the game world. The verb describes the action, and the direct object is what the action is performed on. For example; "TAKE SHOE" uses the verb "TAKE" on the direct object "SHOE".
Output
F The carry flag is set when the command is malformed
The first token is the verb, so target the second token for the direct object.
Parser_ValidateDirectObject AF7B LD A,($A825) Fetch the second token from the user input and store it in A.
AF7E CP $FF Jump forward to DirectObject_Process if the token is anything other than the terminator character (FF).
AF80 JR NZ,DirectObject_Process
The token was the terminator character (FF), so the sentence is malformed.
E.g. They tried "TAKE" but didn't write anything after it.
AF82 CALL Response_PleaseBeMoreSpecific Call Response_PleaseBeMoreSpecific.
AF85 SCF Set the carry flag to indicate this call was a failure.
AF86 RET Return.
Process the direct object.
DirectObject_Process AF87 CALL Parser_CountItems Call Parser_CountItems.
AF8A RET NZ Return if A is not equal to FF.
AF8B CALL Response_PleaseRephraseThat Call Response_PleaseRephraseThat.
AF8E SCF Set the carry flag to indicate the command is malformed.
AF8F RET Return.
Prev: AF70 Up: Map Next: AF90