Prev: 39366 Up: Map Next: 39553
39393: Finalise room drawing, draw objects and characters, and animate the arrival of any new characters
Used by the routine at 39047.
Input
IX Current position in room layout data
IY 23610
Output
A Index of Magic Knight's current room
39393 LD A,(23452) If drawing-layout-data-fragment flag is zero (reset)...
39396 OR A ...
39397 JR Z,39410 ...then skip ahead to 39410
39399 XOR A Set drawing-layout-data-fragment flag to zero (reset)...
39400 LD (23452),A ...
39403 LD IX,(23453) Load IX with previously stored position in room layout data
39407 JP 39067 Process next room layout instruction (jump to 39067 to paint attribute and terrain interaction data)
39410 LD A,(IX+1) Load A with floor UDG code...
39413 LD (63306),A ...and store at 63306
39416 LD A,(IX+2) Load floor attribute into A...
39419 LD (23695),A ...and store at 23695
39422 LD HL,20704 Load HL with display file address corresponding to (0, 23) (characters)...
39425 LD (63018),HL ...and move bitmap virtual text cursor here
39428 CALL 63488 Update character printing routine to use base address of floor character set graphics
39431 LD HL,32 Draw run of 32 characters (i.e. draw the room's floor)...
39434 CALL 63302 ...
39437 CALL 63472 Update character printing routine to use base address of text character set graphics
39440 PUSH IX Transfer current position in room layout data from IX...
39442 POP HL ...to HL
39443 INC HL Advance HL by two bytes, to attribute parameter...
39444 INC HL ...
39445 CALL 41459 Read glowing character block definitions and add to current room
39448 CALL 39578 Print Magic Knight's current room's name at top of screen
39451 CALL 46784 Draw axe(s) to screen if Magic Knight is in an axe room
39454 CALL 39655 Prepare to execute room-specific routine for Magic Knight's current room
39457 CALL 48164 Draw all objects in Magic Knight's current room
39460 CALL 39795 Draw all characters in Magic Knight's current room
39463 LD A,(23702) Flag Magic Knight's current room as visited for scoring purposes...
39466 LD E,A ...
39467 LD D,0 ...
39469 LD HL,23488 ...
39472 ADD HL,DE ...
39473 LD (HL),1 ...
39475 LD A,7 Set stored border colour to 7 (black)...
39477 LD (23624),A ...
39480 XOR A Set border to black and reset speaker state...
39481 OUT (254),A ...
39483 LD A,71 Store 71 (white INK, black PAPER, BRIGHT) at 23695...
39485 LD (23695),A ...
39488 LD A,(23480) If animate-puff-of-smoke flag is reset...
39491 OR A ...
39492 JR Z,39525 ...then skip ahead to 39525
39494 LD A,(24840) Load Magic Knight's current x-coordinate into A
39497 RRCA Divide x-coordinate by eight, rounding down to nearest integer...
39498 RRCA ...
39499 RRCA ...
39500 AND 31 ...
39502 LD C,A Copy x-coordinate (characters) into C
39503 LD A,(24841) Load Magic Knight's current y-coordinate into A
39506 RRCA Divide y-coordinate by eight, rounding down to nearest integer...
39507 RRCA ...
39508 RRCA ...
39509 AND 31 ...
39511 LD B,A Copy y-coordinate (characters) into B
39512 LD IX,23296 Store Magic Knight's current character coordinates at #23296...
39516 LD (IX+1),C ...
39519 LD (IX+2),B ...
39522 CALL 39958 Animate puff of smoke at Magic Knight's current coordinates
39525 CALL 61860 Store background attributes if appropriate, then draw Magic Knight to display without drawing axes
39528 XOR A Reset animate-puff-of-smoke flag...
39529 LD (23480),A ...
39532 CALL 39829 Animate arrival of any new character if in Magic Knight's current room
39535 CALL 39553 If a character has arrived then redraw Magic Knight and all characters in room
39538 CALL 46183 Set Magic Knight's available action flags
39541 RES 1,(IY+65) Reset characters-movement-unrestricted flag / disable-in-game-glow flag
39545 RES 2,(IY+65) Reset characters-can't-move flag
39549 LD A,(23702) Load A with index of Magic Knight's current room
39552 RET Return
Prev: 39366 Up: Map Next: 39553