Prev: 48791 Up: Map Next: 48920
48850: Have Berk hold an entity, and position it appropriately between his hands
The instruction blocks 48872-48894 and 48897-48916 move the entity that Berk is carrying into position (i.e. between Berk's hands), at a horizontal or vertical position appropriate to the height / width of that entity. These instructions result in the following x- or y-coordinates (left or top of carried entity relative to left or top of carrier, i.e. Berk):
Height / width Offset (characters)
1 2
2 2
3 1
For example, an entity with height 2 characters (e.g. a mushroom from level 2) will have its offset value calculated to be 2 characters, and will therefore be positioned vertically two characters below Berk's top character row.
For the special case of the weight on level 3, see trivia.
Used by the routines at 36638 and 48148.
Input
IX Address of complex state data (current level) for Berk
IY (entry at 48897) Address of complex state data for an entity carried by Berk
Output
IY Address of complex state data for entity held by Berk
48850 LD IY,(34256) Load IY with address of complex state data for entity to be held by Berk...
48854 LD (34260),IY ...and store at 34260 as address of state data for entity held by Berk
48858 SET 5,(IY+10) Set the entity's is-being-carried flag
48862 SET 4,(IX+9) Set Berk's carrying-something flag
48866 LD A,(IY+8) Set class of entity held by Berk to be this entity's class...
48869 LD (34221),A ...
48872 LD A,(IY+7) Load A with the width of the entity, minus 1...
48875 SUB (IY+5) ...
48878 LD (34272),A ...and store at 34272
48881 LD E,A Load E with width of entity, minus 1
48882 SRL A Move entity defined at IY into horizontal position appropriate to its height (see notes above)...
48884 XOR 1 ...
48886 INC A ...
48887 ADD A,(IX+5) ...
48890 LD (IY+5),A ...
48893 ADD A,E ...
48894 LD (IY+7),A ...
This entry point is used by the routine at 48760.
48897 LD A,(IY+6) Move entity defined at IY into vertical position appropriate to its height (see notes above)...
48900 SUB (IY+4) ...
48903 LD E,A ...
48904 SRL A ...
48906 XOR 1 ...
48908 INC A ...
48909 ADD A,(IX+4) ...
48912 LD (IY+4),A ...
48915 ADD A,E ...
48916 LD (IY+6),A ...
48919 RET Return
Prev: 48791 Up: Map Next: 48920