Routines |
Prev: 51892 | Up: Map | Next: 52044 |
Used by the routine at 51359.
|
||||
Deal with any objects from the room item table at 26512 that are present in the room. These are 'non-scenery' objects that Maroc or the servant can interact with.
This routine determines if an item is stationary (sitting on the floor of the room), carried by the servant, or falling/flying after being dropped by the servant.
|
||||
51968 | LD HL,(60228) | Get item's data pointer for the room item table at 29551 | ||
51971 | CALL 56959 | Check room object table at 29551 to see if any items are in this room. If so, copy the item data into working buffer at 60293. | ||
51974 | LD A,(60304) | For visible room objects, this is the graphic number (offset for address table at 38851) | ||
51977 | CP 124 | Byte value 124 = the object is not visible (yet),e.g. a key inside a chest | ||
51979 | JR Z,51989 | |||
Object is visible on screen - get object's colour
|
||||
51981 | LD A,(60299) | Get the colour attribute of the object | ||
51984 | AND 15 | Keep the INK colour (0-7), and bit 3, which is set for objects that flash (change colour) | ||
51986 | LD (60072),A | ...and store | ||
Check if item is being carried by the servant
|
||||
51989 | LD A,(60238) | Item properties byte | ||
51992 | LD C,A | Temp store in C register | ||
51993 | AND 16 | Check if this item is carried by the servant - bit 4 (16) set | ||
51995 | JR NZ,52005 | If so, check/calculate item position based on servant's X/Y co-ordinates | ||
Item is not being carried by the servant
|
||||
51997 | LD A,C | Retrieve item properties byte | ||
51998 | AND 8 | If bit 3 is set, this item is moving/falling (e.g. after being thrown/dropped by the servant) | ||
52000 | JR NZ,52059 | Item is moving/falling - jump out to 52059 | ||
52002 | JP 52136 | Item is stationary - jump out to 52136 | ||
Item is currently held by the servant
|
||||
52005 | LD A,(60140) | Get active spell number | ||
52008 | CP 1 | Check is the servant spell still active? | ||
52010 | JR NZ,52044 | If not, servant spell has just been deactivated, so the item is now falling/flying | ||
52012 | CALL 56008 | If active, run routine calculating/checking item's vertical position on screen. Adjusted vertical boundary returned in E register ready for room boundary check at 52031 | ||
Servant is carrying the object, so use the servant's horizontal/vertical speed to calculate that of the object (multiplied x4 as servant speed is stored on a smaller scale):
|
||||
52015 | LD A,(60161) | Get servant's horizontal movement rate/offset | ||
52018 | ADD A,A | Multiply by 4 | ||
52019 | ADD A,A | |||
52020 | LD (60236),A | ...and store as item's horizontal movement rate/offset | ||
52023 | LD A,(60162) | Get servant's vertical movement rate/offset | ||
52026 | ADD A,A | Multiply by 4 | ||
52027 | ADD A,A | |||
52028 | LD (60237),A | ...and store as item's vertical movement rate/offset | ||
52031 | CALL 57401 | Check room boundary and adjust item's position accordingly | ||
52034 | LD A,(60337) | |||
52037 | CP 2 | This carried object status byte was set to 2 once an item has been retrieved from Maroc's backpack by the servant | ||
52039 | JR Z,52118 | If this is the case, do a collision check to identify if the servant has moved outside Maroc's backpack area 'hit box' (to prevent auto-cycling through inventory objects). If so, change the byte value (60337) to 1 |
||
52041 | JP 52263 |
Prev: 51892 | Up: Map | Next: 52044 |