Routines |
Prev: CBA8 | Up: Map | Next: CC72 |
'Interactions' in Avalon are based on matching event values. For example:
Items that can be affected by other actions/items have extra data in the room item table (736F). This additional data indicates the next 'state' of the item (e.g. closed chest > open chest)
Some items are hidden until another item is used (in the aforementioned case of chests holding objects).
A successful value match between the acting item, and the item acted upon, advances the state of the object to the next one.
|
||||
CC27 | LD A,($EB8F) | Event number ID to check for this item (acting on another item, e.g. a key opening its corresponding chest) | ||
CC2A | CP $00 | |||
CC2C | JR Z,$CC36 | If zero, there's nothing to check | ||
CC2E | CP $89 | |||
CC30 | JP Z,$DA88 | Special check for event/collision #137 - Maroc using CALIBURN on AVELACH. This ends the game. | ||
CC33 | CALL $E2B0 | Copy room item event data into working buffer | ||
Event/collision checking:
|
||||
CC36 | LD A,($EB8E) | Event number for items acting on this item (e.g. for a chest, which is opened by a key) | ||
CC39 | LD C,A | |||
CC3A | CP $0F | Event 15 means an item is collectible (Maroc can pick it up) | ||
CC3C | JP Z,$CC72 | If so, check if Maroc has picked up the item, either by moving over it or given it by the servant | ||
CC3F | CALL $DFCD | For all other events, run an event check for this item | ||
CC42 | CP $01 | Has a collision/event occurred? | ||
CC44 | JP NZ,$CC72 | If not, skip to the next routine | ||
EVENT/COLLISION HAS TAKEN PLACE
For the object acted upon, advance its 'state' by one, to the next state:
|
||||
CC47 | LD A,($EB8C) | Grab the byte containing the number of 'states' for the object | ||
CC4A | LD C,A | |||
CC4B | LD A,($EB89) | Current object state number (starts at 1 for default object state) | ||
CC4E | INC A | Increment object state by one | ||
CC4F | CP C | |||
CC50 | JR C,$CC56 | |||
CC52 | JR Z,$CC56 | Object state <= max states for this item, skip the next instruction | ||
CC54 | LD A,$01 | Object state > max states for this item, so reset the object state to 1 | ||
CC56 | LD HL,($EB44) | Address pointer to start of item's data set at 736F | ||
CC59 | INC HL | |||
CC5A | INC HL | |||
CC5B | INC HL | |||
CC5C | INC HL | Move to the 5th byte of set, containing the item's state number | ||
CC5D | LD (HL),A | ...and store the new state number. | ||
CC5E | CALL $DADC | Fetch object state and prepare graphics for printing | ||
Set properties for the new object state
|
||||
CC61 | LD A,($EB8D) | Get first byte of object state data | ||
CC64 | AND $F8 | Filter out bits 0-2 (values 0-7) | ||
CC66 | LD C,A | |||
CC67 | LD A,($EB4E) | Get the current item properties byte | ||
CC6A | AND $1F | Keep bits 0-4... | ||
CC6C | OR $05 | Set bits 0 (item is visible) and 2 (item is moving/will need erasing) | ||
CC6E | OR C | ...append the rest of the bits from the new-state-object... | ||
CC6F | LD ($EB4E),A | ...and re-store. |
Prev: CBA8 | Up: Map | Next: CC72 |