![]() |
Routines |
| Prev: EC75 | Up: Map | Next: ED47 |
|
The author's SRP (named by its call in the leftover source text's pick-up code). Draws the object whose record is at HL where it now stands -- or rubs it out, if it has been carried off or is gone (bit 5 of +16) -- together with every other object whose sprite overlaps it on the screen, each in front of or behind it as their places say, and puts the result on the screen. The record's first twelve bytes are copied to the variables from IY+$64 on (the room drawing's points, which it is finished with), and the box to redraw is the sprite's, with three rows more at the top and three at the bottom.
The work is done in the compositor's planes. The first (BUFFER_D800) is cleared; then either the object's sprite is drawn into them (DRAW_SPRITE, with $80) or the second (BUFFER_D900) is filled, which lets the clean copy of the room show through where it was. Then every record from the knight's (the seventh) to the last in use, but this one, goes to CULL_OBJECT, which lists at BUFFER_DA00 those that overlap the box (IY+$7F counts them, less one) and compares each one's depth with the corner of this object's box (FAR_CORNER). If any of them needs drawing, SORT_AND_DRAW_BEHIND sorts them and draws them into the planes, and at the end COMPOSITE_TO_SCREEN puts the box onto the screen.
Used when a thing is picked up (PICK_UP_LOOK_ON, to rub it out), as objects move (ANIMATE_AND_MOVE, OBJECTS_MEET), and when a room is entered (DRAW_STILL_THINGS draws each object that stays put into the picture before it becomes the clean copy; bit 4 of IY+$17 is set then, and nothing is rubbed out).
|
||||||||
| REDRAW_OBJECT | ECBD | LD DE,POINT | the record's first twelve bytes to IY+$64 on; IX the record | |||||
| ECC0 | PUSH HL | |||||||
| ECC1 | POP IX | |||||||
| ECC3 | LD BC,$000C | |||||||
| ECC6 | LDIR | |||||||
| ECC8 | LD A,(WORK_SPRITE) | no sprite: nothing to draw | ||||||
| ECCB | OR (IX+OBJ_SPRITE+$01) | |||||||
| ECCE | RET Z | |||||||
| ECCF | LD HL,BUFFER_D900 | the first plane cleared | ||||||
| ECD2 | CALL CLEAR_256_BELOW | |||||||
| ECD5 | LD (IY+RIDE_DIRECTION-V),$FF | none listed yet | ||||||
| ECD9 | LD (IY+WORK_BEHAVIOUR-V),$00 | |||||||
| ECDD | LD A,(SECOND_POINT) | the width in bytes | ||||||
| ECE0 | SRL A | |||||||
| ECE2 | SRL A | |||||||
| ECE4 | SRL A | |||||||
| ECE6 | LD (DRAW_WIDTH),A | |||||||
| ECE9 | BIT 4,(IY+GAME_FLAGS-V) | carried or gone, and the room not being entered? | ||||||
| ECED | JR NZ,REDRAW_OBJECT_0 | |||||||
| ECEF | BIT 5,(IX+OBJ_WEIGHT) | |||||||
| ECF3 | JR Z,REDRAW_OBJECT_0 | |||||||
| ECF5 | LD HL,BUFFER_DA00 | then the clean copy shows through: the second plane all set | ||||||
| ECF8 | LD DE,$FFFF | |||||||
| ECFB | LD B,$20 | |||||||
| ECFD | CALL FILL_BELOW | |||||||
| ED00 | JR REDRAW_OBJECT_1 | |||||||
| REDRAW_OBJECT_0 | ED02 | LD A,$80 | else its sprite into the planes | |||||
| ED04 | CALL DRAW_SPRITE | |||||||
| REDRAW_OBJECT_1 | ED07 | CALL FAR_CORNER | the corner of its box that depths are compared with | |||||
| ED0A | LD A,(SECOND_POINT_ROW) | three rows more above and below | ||||||
| ED0D | ADD A,$06 | |||||||
| ED0F | LD (SECOND_POINT_ROW),A | |||||||
| ED12 | LD A,(POINT_ROW) | |||||||
| ED15 | ADD A,$03 | |||||||
| ED17 | LD (POINT_ROW),A | |||||||
| ED1A | LD IX,KNIGHT | from the knight's record, the seventh; nothing to merge yet | ||||||
| ED1E | XOR A | |||||||
| ED1F | LD (WORK_DIRECTION),A | |||||||
| ED22 | LD A,$06 | |||||||
| REDRAW_OBJECT_2 | ED24 | INC A | each record but this one: does it overlap? | |||||
| ED25 | LD (DRAW_INDEX),A | |||||||
| ED28 | CP (IY+THIS_RECORD-V) | |||||||
| ED2B | CALL NZ,CULL_OBJECT | |||||||
| ED2E | EXX | the next record, keeping DE | ||||||
| ED2F | LD DE,$0014 | |||||||
| ED32 | ADD IX,DE | |||||||
| ED34 | EXX | |||||||
| ED35 | LD A,(DRAW_INDEX) | up to the last in use | ||||||
| ED38 | CP (IY+OBJECT_COUNT-V) | |||||||
| ED3B | JR NZ,REDRAW_OBJECT_2 | |||||||
| ED3D | BIT 1,(IY+WORK_DIRECTION-V) | sort and draw those that must be | ||||||
| ED41 | CALL NZ,SORT_AND_DRAW_BEHIND | |||||||
| ED44 | JP COMPOSITE_TO_SCREEN | onto the screen | ||||||
| Prev: EC75 | Up: Map | Next: ED47 |