Prev: C369 Up: Map Next: C394
C377: End the transformation
Used by the routine at transform_step.
Flips bit 5 of the saved type, which swaps a knight's legs (types 16 to 29) for the matching werewolf's (48 to 61) or back, and puts the top half back as that type plus 16. $5BB1 is cleared, so nothing is pending until the next sunrise or sunset.
The drawing offset is set here too, one pixel lower for the werewolf, which is what the new type's own handler (upd_16_to_21_24_to_29 or upd_48_to_53_56_to_61) will set on the next frame anyway; setting it now keeps the first frame in the right place.
Input
IX the player's bottom record
finish_transform C377 LD A,($5BB1) knight to werewolf or werewolf to knight
C37A XOR $20
C37C LD (IX+$00),A
C37F ADD A,$10 the top half is the bottom's type plus 16
C381 LD (IX+$20),A
C384 XOR A no transformation pending
C385 LD ($5BB1),A
C388 CALL adj_m6_m12 X -12, Y -6: the knight's legs
C38B BIT 5,(IX+$00) Y -7 for the werewolf's
C38F JR Z,transform_done_draw
C391 DEC (IX+$13)
Prev: C369 Up: Map Next: C394