![]() |
Routines |
| Prev: 45164 | Up: Map | Next: 45490 |
|
Draws every item in the sorted draw list at SortedDrawList, in order. The flag in each item selects what is drawn: 1 is an entity, 2 is one of the extra records (which is first copied into the temporary entity at TemporaryEntity) and 3 is one of the 20-byte records.
For a 20-byte record, the items drawn before it that overlap it are collected into the table at 45491 and then the record is drawn with DrawBlock. An extra record is drawn with DrawEntityItem after its column, row, frame, width and height have been copied into the temporary entity.
|
||||
| DrawItems | 45166 | LD HL,44943 | Take the sorted draw list. | |
| DrawItems_Next | 45169 | LD A,(HL) | Read the kind of the next item. | |
| 45170 | AND %01111111 | Keep the kind of the item. | ||
| 45172 | RET Z | Return at the end of the list. | ||
| 45173 | INC HL | Read the address of the record and step to the next item. | ||
| 45174 | LD E,(HL) | |||
| 45175 | INC HL | |||
| 45176 | LD D,(HL) | |||
| 45177 | INC HL | |||
| 45178 | PUSH DE | Take that record. | ||
| 45179 | POP IX | |||
| 45181 | PUSH HL | Remember the next item. | ||
| 45182 | DEC A | Draw an entity with DrawEntityItem. | ||
| 45183 | JP Z,DrawEntityItem | |||
| 45186 | CP 2 | Draw a 20-byte record at DrawItems_Record. | ||
| 45188 | JP Z,DrawItems_Record | |||
| DrawItems_Extra | 45191 | BIT 7,(IX+9) | Jump to DrawItems_NextItem to skip an extra record that is not in use. | |
| 45195 | JR Z,DrawItems_NextItem | |||
| 45197 | LD L,(IX+0) | Copy the column and the row into the temporary entity. | ||
| 45200 | LD H,(IX+1) | |||
| 45203 | LD (47026),HL | |||
| 45206 | LD L,(IX+8) | Copy fields 8 and 9 of the extra record into the screen address of the temporary entity. | ||
| 45209 | LD H,(IX+9) | |||
| 45212 | LD (47036),HL | |||
| 45215 | LD A,(IX+11) | Fetch the frame and the width. | ||
| 45218 | LD B,A | |||
| 45219 | AND %00001111 | Keep the width. | ||
| 45221 | LD (47034),A | Store the width in the temporary entity. | ||
| 45224 | LD A,(IX+12) | Fetch the height byte. | ||
| 45227 | AND %00111111 | Keep the height. | ||
| 45229 | LD (47035),A | Store the height in the temporary entity. | ||
| 45232 | LD A,B | Move the frame down from the high nibble. | ||
| 45233 | RRA | |||
| 45234 | RRA | |||
| 45235 | RRA | |||
| 45236 | RRA | |||
| 45237 | AND %00001111 | Keep the frame. | ||
| 45239 | LD (47013),A | Store the frame in the temporary entity. | ||
| 45242 | LD IX,47012 | Use the temporary entity. | ||
| 45246 | JP DrawEntityItem | Draw it. | ||
|
This entry point is used by the routine at DrawEntityItem.
|
||||
| DrawItems_NextItem | 45249 | POP HL | Restore the next item. | |
| 45250 | JR DrawItems_Next | Take the next item. | ||
|
Look back through the items drawn before this 20-byte record. The alternate C counts the ones that overlap it, and the alternate HL walks the overlap table.
|
||||
| DrawItems_Record | 45252 | EXX | Switch to the alternate registers. | |
| 45253 | LD C,0 | Clear the overlap count. | ||
| 45255 | LD HL,45491 | Use the overlap table. | ||
| 45258 | EXX | Switch back. | ||
| 45259 | PUSH IX | Keep this record aside. | ||
| 45261 | POP IY | |||
| 45263 | DEC HL | Step back to this item. | ||
| 45264 | DEC HL | |||
| 45265 | DEC HL | |||
| DrawItems_Previous | 45266 | DEC HL | Read the previous item. | |
| 45267 | LD D,(HL) | |||
| 45268 | DEC HL | |||
| 45269 | LD E,(HL) | |||
| 45270 | DEC HL | |||
| 45271 | LD A,(HL) | |||
| 45272 | CP 255 | Stop at the start of the list. | ||
| 45274 | JR Z,DrawItems_Collected | |||
| 45276 | CP 3 | Skip another 20-byte record. | ||
| 45278 | JR Z,DrawItems_Continue | |||
| 45280 | PUSH DE | Take the previous item. | ||
| 45281 | POP IX | |||
| 45283 | PUSH HL | Remember the place in the list. | ||
| 45284 | DEC A | Test an entity now. | ||
| 45285 | JR Z,DrawItems_Test | |||
| 45287 | LD L,(IX+0) | Copy the column and the row of the extra record into the temporary entity. | ||
| 45290 | LD H,(IX+1) | |||
| 45293 | LD (47026),HL | |||
| 45296 | LD L,(IX+2) | Copy the adjusted x coordinate into the temporary entity. | ||
| 45299 | LD H,(IX+3) | |||
| 45302 | LD (47014),HL | |||
| 45305 | LD L,(IX+4) | Copy the adjusted y coordinate into the temporary entity. | ||
| 45308 | LD H,(IX+5) | |||
| 45311 | LD (47017),HL | |||
| 45314 | LD L,(IX+6) | Copy the adjusted z coordinate into the temporary entity. | ||
| 45317 | LD H,(IX+7) | |||
| 45320 | LD (47020),HL | |||
| 45323 | LD A,(IX+11) | Fetch the frame and the width. | ||
| 45326 | AND %00001111 | Keep the width. | ||
| 45328 | LD (47034),A | Store the width in the temporary entity. | ||
| 45331 | LD A,(IX+12) | Fetch the height byte. | ||
| 45334 | AND %00111111 | Keep the height. | ||
| 45336 | LD (47035),A | Store the height in the temporary entity. | ||
| 45339 | LD IX,47012 | Use the temporary entity. | ||
| DrawItems_Test | 45343 | CALL TestRecordOverlap | Test this item against the record. | |
| 45346 | BIT 7,(IY+10) | Test whether the record still has to collect this item. | ||
| 45350 | RES 7,(IY+10) | Mark the record as having been tested against this item. | ||
| 45354 | CALL NZ,CollectOverlappingItem | Collect the item when it overlaps the record. | ||
| 45357 | POP HL | Restore the place in the list. | ||
| DrawItems_Continue | 45358 | JR DrawItems_Previous | Look at the previous item. | |
|
Patch the drawing routines with this record, then draw the block. A record whose byte 10 is 17 or 18 keeps the default details 4112.
|
||||
| DrawItems_Collected | 45360 | EXX | Switch to the alternate registers. | |
| 45361 | LD A,C | Test the overlap count. | ||
| 45362 | AND A | |||
| 45363 | JP Z,DrawItems_NextItem | Leave a record that nothing overlaps. | ||
| 45366 | LD (45490),A | Remember how many items overlap the record. | ||
| 45369 | LD (50771),A | Give that count to the overlapped-block routine. | ||
| 45372 | LD A,(23792) | Fetch the drawing flags. | ||
| 45375 | AND %00000111 | Keep the low three drawing flags. | ||
| 45377 | LD (50781),A | Give the drawing flags to the overlapped-block routine. | ||
| 45380 | LD A,(IY+10) | Fetch byte 10 of the record. | ||
| 45383 | LD (49662),A | Give that byte to the block routine. | ||
| 45386 | LD H,A | Build an instruction that loads three times that byte. | ||
| 45387 | LD L,62 | |||
| 45389 | ADD A,A | |||
| 45390 | ADD A,A | |||
| 45391 | SUB H | |||
| 45392 | LD H,A | |||
| 45393 | LD (49568),HL | Patch that instruction into 49568. | ||
| 45396 | LD A,195 | Take the opcode of a jump. | ||
| 45398 | LD (51037),A | Patch it into 51037. | ||
| 45401 | LD HL,51116 | Take DrawBlockSection. | ||
| 45404 | LD (51038),HL | Patch the jump so that it enters DrawBlockSection. | ||
| 45407 | LD DE,(23783) | Fetch the view origin. | ||
| 45411 | LD B,(IY+0) | Fetch the first two bytes of the record. | ||
| 45414 | LD C,(IY+1) | |||
| 45417 | LD HL,0 | Start from zero. | ||
| 45420 | XOR A | Subtract the view origin and add the first two bytes of the record. | ||
| 45421 | SBC HL,DE | |||
| 45423 | ADD HL,BC | |||
| 45424 | LD (48031),HL | Store the result in the drawing variables. | ||
| 45427 | LD H,(IY+14) | Fetch the screen position saved in the record. | ||
| 45430 | LD L,(IY+15) | |||
| 45433 | LD (48033),HL | Store it in the drawing variables. | ||
| 45436 | LD HL,4112 | Take the default record details. | ||
| 45439 | LD A,(IY+10) | Fetch byte 10 of the record. | ||
| 45442 | CP 17 | Keep the default details when the byte is 17. | ||
| 45444 | JR Z,DrawItems_Details | |||
| 45446 | CP 18 | Keep the default details when the byte is 18. | ||
| 45448 | JR Z,DrawItems_Details | |||
| 45450 | LD H,(IY+12) | Take fields 11 and 12 of the record as the details. | ||
| 45453 | LD L,(IY+11) | |||
| DrawItems_Details | 45456 | LD (23795),HL | Store the details. | |
| 45459 | LD A,(IY+13) | Fetch byte 13 of the record. | ||
| 45462 | LD (23797),A | Store the third detail byte. | ||
| 45465 | LD HL,50758 | Take the overlapped-block routine. | ||
| 45468 | LD (50136),HL | Patch DrawBlockShape so that it uses DrawOverlappedBlock. | ||
| 45471 | LD A,26 | Take the value 26. | ||
| 45473 | LD (46384),A | Patch it into 46384. | ||
| 45476 | CALL DrawBlock | Draw the block. | ||
| 45479 | LD A,8 | Take the row step 8. | ||
| 45481 | LD (51092),A | Restore it in 51092. | ||
| 45484 | LD (51110),A | Restore it in 51110. | ||
| 45487 | JP DrawItems_NextItem | Take the next item. | ||
| Prev: 45164 | Up: Map | Next: 45490 |