Prev: 37244 Up: Map Next: 37307
37278: Locate Terrain Cell
Map a world position onto TerrainData_Active and draw that column.
Input
HL World position
Map the world position onto TerrainData_Active and draw that column.
LocateTerrainCell 37278 LD DE,65416 DE=65416.
37281 ADD HL,DE HL+=DE.
37282 LD A,H A=H.
37283 AND %00011111 Keep only bits 0-4.
37285 LD H,A H=A.
Convert the position into a terrain cell pointer.
37286 LD DE,28672 DE=TerrainData_Active.
37289 SRA H Divide the world position by 8.
37291 RR L
37293 SRA H
37295 RR L
37297 SRA H
37299 RR L
37301 ADD HL,DE HL+=DE.
Aim at the leftmost screen column and draw it.
37302 LD DE,20672 DE=20672.
37305 JR DrawTerrainColumn Jump to DrawTerrainColumn.
Prev: 37244 Up: Map Next: 37307