![]() |
Routines |
| Prev: 37278 | Up: Map | Next: 37346 |
|
Return the two terrain bytes under the current actor.
|
||||||||||||||||
|
Return the two terrain bytes under the current actor.
|
||||||||||||||||
| ReadTerrainCell | 37307 | LD H,(IX+3) | Fetch the high byte of the world X. | |||||||||||||
| 37310 | LD L,(IX+2) | Fetch the low byte of the world X. | ||||||||||||||
| 37313 | LD A,H | Fetch the high byte. | ||||||||||||||
| 37314 | AND %00011111 | Keep only bits 0-4. | ||||||||||||||
| 37316 | LD H,A | Write it back to H. | ||||||||||||||
| 37317 | SRA H | Divide the world position by 8. | ||||||||||||||
| 37319 | RR L | |||||||||||||||
| 37321 | SRA H | |||||||||||||||
| 37323 | RR L | |||||||||||||||
| 37325 | SRA H | |||||||||||||||
| 37327 | RR L | |||||||||||||||
|
Read the first terrain byte from the cell.
|
||||||||||||||||
| 37329 | PUSH HL | Stash the cell index on the stack. | ||||||||||||||
| 37330 | LD BC,28672 | Point HL at that terrain cell, offset from TerrainData_Active. | ||||||||||||||
| 37333 | ADD HL,BC | |||||||||||||||
| 37334 | LD D,(HL) | Fetch the first terrain byte. | ||||||||||||||
| 37335 | POP HL | Restore the cell index from the stack, but stash a copy of it on the stack again. | ||||||||||||||
| 37336 | PUSH HL | |||||||||||||||
|
Step to the next cell, wrapping the index, and read the second terrain byte.
|
||||||||||||||||
| 37337 | INC HL | Move onto the next cell. | ||||||||||||||
| 37338 | LD A,H | Fetch the high byte. | ||||||||||||||
| 37339 | AND %00000011 | Keep only bits 0-1. | ||||||||||||||
| 37341 | LD H,A | Write it back to H. | ||||||||||||||
| 37342 | ADD HL,BC | Point HL at that terrain cell. | ||||||||||||||
| 37343 | LD E,(HL) | Fetch the second terrain byte. | ||||||||||||||
| 37344 | POP HL | Restore the cell index from the stack. | ||||||||||||||
| 37345 | RET | Return. | ||||||||||||||
| Prev: 37278 | Up: Map | Next: 37346 |