![]() |
Routines |
| Prev: 56908 | Up: Map | Next: 57015 |
|
||||||||
|
The fifth byte of an object's data set (held in the object buffer at 60297) holds its state, which can change. For example a chest can be closed (state = 1) and be moved to state 2 (open).
This routine identifies the state of the object and copies the 4 bytes for this state into the additional buffer at 60301.
|
||||||||
| 56959 | LD (60290),HL | Store address pointer (data at 29551) | ||||||
| 56962 | LD DE,60293 | Copy the first 8 bytes of this object's data into buffer at 60293 | ||||||
| 56965 | LD BC,8 | |||||||
| 56968 | LDIR | |||||||
| 56970 | LD A,(60297) | State number of this object. All standard object 'sets' start at 1 | ||||||
| 56973 | LD C,A | |||||||
| 56974 | CP 0 | |||||||
| 56976 | JR Z,57001 | |||||||
| 56978 | DEC A | Decrement state number | ||||||
| 56979 | CP 0 | Is this the object's current state? | ||||||
| 56981 | JR Z,56990 | |||||||
| 56983 | LD DE,4 | If so, skip 4 bytes for each state the object has advanced to | ||||||
| 56986 | LD B,A | |||||||
| 56987 | ADD HL,DE | |||||||
| 56988 | DJNZ 56987 | |||||||
|
Current object state found:
|
||||||||
| 56990 | LD B,4 | Copy the 4 data bytes for this object state into the additional buffer at 60301 | ||||||
| 56992 | LD DE,60301 | |||||||
| 56995 | LD A,(HL) | |||||||
| 56996 | LD (DE),A | |||||||
| 56997 | INC HL | |||||||
| 56998 | INC DE | |||||||
| 56999 | DJNZ 56995 | |||||||
|
Skip over any additional data sets for this object
|
||||||||
| 57001 | LD A,(60300) | Get the count of additional 4 byte data sets for this object | ||||||
| 57004 | SUB C | Subtract the current state number, whose data has already been copied over to the buffer | ||||||
| 57005 | JR Z,57014 | If zero, there's no more data for this set - jump straight to RET | ||||||
| 57007 | LD DE,4 | ...Otherwise, skip over the remaining object states | ||||||
| 57010 | LD B,A | |||||||
| 57011 | ADD HL,DE | |||||||
| 57012 | DJNZ 57011 | |||||||
|
This entry point is used by the routine at 56908.
|
||||||||
| 57014 | RET | Object set now dealt with | ||||||
| Prev: 56908 | Up: Map | Next: 57015 |