Prev: 34078 Up: Map Next: 34152
34109: Remap Alien Sprite
Used by the routines at FetchSprite and FetchActorSprite.
On odd levels, FetchSprite and FetchActorSprite pass the sprite ID here so four alien families can be drawn from Sprite_Band_Table instead of SpritesTable. Any other ID is returned unchanged, and the caller keeps SpritesTable.
Sprite IDs Family Sprite_Band_Table Index
64-71 Brella 1-8
72-79 Blob 9-16
136-143 Block 17-24
176-181 Spinner 25-30
Input
A Sprite ID
Output
A Sprite ID, or a 1-based index into Sprite_Band_Table
BC Sprite_Band_Table when the ID is one of the remapped families
Test the four odd-level alien ID ranges.
MapSpriteBand 34109 LD L,A Stash the original sprite ID.
34110 SUB 64 Drop 64 and test for brella IDs 64-71.
34112 CP 8
34114 LD H,0 Jump to MapSpriteBand_Matched with table offset 0 if it matches.
34116 JR C,MapSpriteBand_Matched
34118 SUB 8 Drop another 8.
34120 LD H,8 Set the table offset to 8.
34122 CP 8 Jump to MapSpriteBand_Matched if it is now a blob ID 72-79.
34124 JR C,MapSpriteBand_Matched
34126 SUB 64 Drop 64 and test for block IDs 136-143.
34128 CP 8
34130 LD H,16 Jump to MapSpriteBand_Matched with table offset 16 if it matches.
34132 JR C,MapSpriteBand_Matched
34134 SUB 40 Drop 40 and test for spinner IDs 176-181.
34136 CP 6
34138 LD H,24 Jump to MapSpriteBand_Matched with table offset 24 if it matches.
34140 JR C,MapSpriteBand_Matched
34142 LD A,L Return the original sprite ID if no family matched.
34143 RET
Build the Sprite_Band_Table index and return that table pointer.
MapSpriteBand_Matched 34144 AND %00000111 Keep only the frame within the family.
34146 ADD A,H Add the table offset and make the index 1-based.
34147 INC A
34148 LD BC,61050 Point BC at Sprite_Band_Table.
34151 RET Return.
Prev: 34078 Up: Map Next: 34152