Prev: 48355 Up: Map Next: 48434
48403: Reset Map
Used by the routine at DrawGameScreen.
Puts every cell of the map back to its initial type, by copying the upper four bits of each cell into the lower four bits.
ResetMap 48403 LD HL,54101 Point HL at the end of the map.
48406 LD BC,50453 Point BC at Map.
48409 AND A Find the size of the map...
48410 SBC HL,BC
48412 LD B,H ...and keep it in BC.
48413 LD C,L
48414 LD HL,50453 Point HL at Map.
ResetMap_Cell 48417 LD A,(HL) Fetch a cell.
48418 AND 240 Keep the initial type.
48420 LD D,A
48421 RRA Move it into the lower four bits...
48422 RRA
48423 RRA
48424 RRA
48425 OR D ...and combine it with the original.
48426 LD (HL),A Store the cell.
48427 INC HL Move on to the next cell.
48428 DEC BC Count down the size.
48429 LD A,C Loop back until every cell has been reset.
48430 OR B
48431 JR NZ,ResetMap_Cell
48433 RET Return.
Prev: 48355 Up: Map Next: 48434