Prev: 55516 Up: Map Next: 55616
55525: Move all falling entities down by distances appropriate to their current velocity factors
If an entity's "velocity factor" is equal to its height in characters plus 3 (a proxy for its mass), then it has reached its terminal velocity.
Used by the routine at 34438.
55525 LD IX,(34238) Load IX with start address of current level's complex state data
55529 LD DE,13 Load DE with 13 (as entries in complex state data are 13 bytes wide)
55532 LD A,(IX+0) If first byte of entry is 255 (i.e. end marker)...
55535 CP 255 ...
55537 RET Z ...then return
55538 BIT 6,(IX+10) If current entity's can-fall flag is reset...
55542 JR Z,55592 ...then skip ahead to 55592 (advance to next entity)
Current entity's can-fall flag is set
55544 PUSH DE Store DE
55545 CALL 53848 Store room size data for current entity's current room
55548 POP DE Restore DE
55549 LD A,(IX+6) Load C with height (of entity defined by entry) + 3...
55552 SUB (IX+4) ...
55555 ADD A,4 ...
55557 LD C,A ...
55558 LD A,(IX+12) Load B with velocity factor...
55561 LD B,A ...
55562 CP C If C is less than or equal to this (i.e. "terminal velocity" reached)...
55563 JR NC,55569 ...then skip ahead to 55569
55565 INC A Increase velocity factor by one and store for next pass (i.e. acceleration)...
55566 LD (IX+12),A ...
55569 SRL B Divide current (i.e. not increased) velocity factor by 2
55571 LD A,(IX+6) If sum of y-coordinate of entity's bottom and entity's depth is 122...
55574 ADD A,(IX+1) ...(i.e. entity is at ground-level)...
55577 CP 122 ...
55579 JR Z,55596 ...then skip ahead to 55596
55581 INC (IX+4) Move entity down by one character...
55584 INC (IX+6) ...
55587 CALL 55616 Change entity's room down one if appropriate
55590 DJNZ 55571 Decrease B (current velocity factor, i.e. remaining number of characters to drop entity) and if non-zero, loop back to 55571
55592 ADD IX,DE Advance IX by 13 bytes to next entry
55594 JR 55532 Loop back to 55532
Entity's position is such that sum of y-coordinate of bottom + depth = 122 (i.e. at ground-level)
55596 CALL 54768 Check entity at IX for collision with another entity at same depth whose interaction-(11,6) flag is set...
55599 JR C,55610 ...and if no collision occurred, then skip ahead to 55610
55601 CP 129 If collision was with entity of class 129 (causes other entities to start falling)...
55603 JR Z,55581 ...then jump to 55581 (entity may fall down into next room)
Collision was not with entity of class 129, so need to resume collision check from current position in entities list, i.e. entity that character did collide with
55605 CALL 54871 Resume checking entity for collision with another entity at same depth whose interaction-(11,6) flag is set...
55608 JR 55599 ...
Entity has landed (i.e. is at ground-level and has not collided with a marker of class 129)
55610 RES 6,(IX+10) Reset entity's can-fall flag as entity has landed
55614 JR 55592 Loop back for next entity
Prev: 55516 Up: Map Next: 55616