![]() |
Routines |
| Prev: C2F9 | Up: Map | Next: C337 |
|
Used by the routine at player_controls.
The first thing the player's handler (player_controls) does each frame. The variable at $5BB1 is set to 1 by toggle_day_night at every sunrise and sunset; if it is set, and the player is neither in the settling time just after entering a room (the top nibble of +$0C) nor in the middle of a jump (bit 3 of +$0C), the change from knight to werewolf or back begins now.
Starting it replaces the rest of the player's frame: the two INC SPs throw away the return address into player_controls, so the final RET of rand_legs_sprite returns straight to the object loop and the player neither reads the keys nor moves. $5BB1 now holds the player's type, which is how the end of the transformation (finish_transform) knows which way to change. The top half of the player is erased; the bottom half becomes one of the spinning transformation sprites, types 92 to 95, handled from now on by upd_92_to_95.
|
||||||||
| chk_and_init_transform | C306 | LD A,($5BB1) | no transformation pending | |||||
| C309 | AND A | |||||||
| C30A | RET Z | |||||||
| C30B | LD A,(IX+$0C) | still settling into a new room | ||||||
| C30E | AND $F0 | |||||||
| C310 | RET NZ | |||||||
| C311 | BIT 3,(IX+$0C) | in mid-jump | ||||||
| C315 | RET NZ | |||||||
| C316 | INC SP | drop the return into the player handler | ||||||
| C317 | INC SP | |||||||
| C318 | LD A,(IX+$00) | remember the knight or werewolf type | ||||||
| C31B | LD ($5BB1),A | |||||||
| C31E | LD (IX+$10),$08 | +$10 counts eight steps of four frames each | ||||||
| C322 | PUSH IX | the top half: type 1, erase and free | ||||||
| C324 | LD DE,$0020 | |||||||
| C327 | ADD IX,DE | |||||||
| C329 | LD (IX+$00),$01 | |||||||
| C32D | CALL set_wipe_and_draw_flags | and draw that | ||||||
| C330 | POP IX | |||||||
| C332 | CALL upd_11 | the transformation sprite's drawing offset, and the first sprite | ||||||
| C335 | JR rand_legs_sprite | |||||||
| Prev: C2F9 | Up: Map | Next: C337 |