Prev: AD46 Up: Map Next: ADBE
AD48: Place an object for this pass and set up its new image
Used by the routines at place_object, move_missile and update_ground_objects.
Works out where the object is on the screen (place_on_screen); if it is visible, sets up its new image for the compositor: its graphic clipped (new_sprite_header), its row routine (set_new_sprite), and its colour for colour_sprite (the third byte of colour_patch), one of the two in +$0D on alternate passes (bit 0 of the pass counter in pass_counter): on odd passes ink bits 0-2 with BRIGHT from bit 3, on even passes ink bits 4-6 with BRIGHT from bit 7, always on black paper, so an object can flicker between two colours.
A dissolving object (bit 3 of +$17) counts its step in bits 0-2 of +$17 and passes it to dissolve_sprite in dissolve_step; at the eighth step it is freed instead.
Input
IX The record
prepare_draw AD48 LD (current_object),IX Keep the record; not dissolving yet
AD4C XOR A
AD4D LD (dissolve_step),A
AD50 CALL object_graphic Its graphic; place it on the screen
AD53 PUSH DE
AD54 CALL place_on_screen
AD57 POP DE
AD58 BIT 3,(IX+$17) Dissolving?
AD5C JR Z,prepare_draw_1
AD5E LD A,(IX+$17) Count the step
AD61 AND $07
AD63 INC A
AD64 LD B,A
AD65 CP $08
AD67 JR NZ,prepare_draw_0
AD69 LD (IX+$00),$FF The eighth: free the record, and draw nothing
AD6D RES 7,(IX+$10)
AD71 JR prepare_draw_1
prepare_draw_0 AD73 LD A,(IX+$17) Keep the step, and pass it to the dissolve
AD76 AND $F0
AD78 OR B
AD79 OR $08
AD7B LD (IX+$17),A
AD7E LD A,B
AD7F OR $80
AD81 LD (dissolve_step),A
prepare_draw_1 AD84 LD A,(IX+$10) Not visible: nothing to draw
AD87 LD (edge_flags),A
AD8A BIT 7,A
AD8C RET Z
AD8D LD C,(IX+$0D) Its colours: which one this pass?
AD90 LD A,(pass_counter)
AD93 AND $01
AD95 JR Z,prepare_draw_2
AD97 LD A,C Odd passes: BRIGHT from bit 3, ink from bits 0-2
AD98 AND $08
AD9A ADD A,A
AD9B ADD A,A
AD9C ADD A,A
AD9D LD B,A
AD9E LD A,C
AD9F AND $07
ADA1 JR prepare_draw_3
prepare_draw_2 ADA3 LD A,C Even passes: BRIGHT from bit 7, ink from bits 4-6
ADA4 AND $70
ADA6 SRL A
ADA8 SRL A
ADAA SRL A
ADAC SRL A
ADAE LD B,A
ADAF LD A,C
ADB0 AND $80
ADB2 SRL A
prepare_draw_3 ADB4 OR B The colour for the patch
ADB5 LD ($AF03),A
ADB8 CALL new_sprite_header Clip the new image and choose its row routine
ADBB JP set_new_sprite
Prev: AD46 Up: Map Next: ADBE