Prev: 24100 Up: Map Next: 24210
24178: Command 4: Switch Tile Set
Used by the routine at PopulateRoomBuffer.
Command 4: Switch the tile set.
The following byte selects which tile set to use; 1 for the default set at TileSet_Default, 2 for the alternate set at TileSet_Alternate.
Input
DE Tile counter
HL The room data pointer
Command04_SwitchTileSet 24178 INC HL Increment the room data pointer by one.
24179 LD A,(HL) Fetch the tile set byte.
24180 INC HL Increment the room data pointer by one to move past the command byte.
24181 CP 1 Jump to Set_DefaultTileSet if the tile set byte is equal to 1.
24183 JR Z,Set_DefaultTileSet
24185 CP 2 Jump to Raise_Table_Error if the tile set byte is not equal to 2.
24187 JP NZ,Raise_Table_Error
Tile set 2: switch to the alternate tile set.
24190 PUSH HL Stash the room data pointer on the stack temporarily.
24191 LD HL,41834 Write TileSet_Alternate to *PointerActiveTileSet.
24194 LD (24513),HL
24197 POP HL Restore the room data pointer from the stack.
24198 JR PopulateRoomBuffer_ParseByte Jump back to PopulateRoomBuffer_ParseByte to continue parsing.
Tile set 1: switch back to the default tile set.
Set_DefaultTileSet 24200 PUSH HL Stash the room data pointer on the stack temporarily.
24201 LD HL,39850 Write TileSet_Default to *PointerActiveTileSet.
24204 LD (24513),HL
24207 POP HL Restore the room data pointer from the stack.
24208 JR PopulateRoomBuffer_ParseByte Jump back to PopulateRoomBuffer_ParseByte to continue parsing.
Prev: 24100 Up: Map Next: 24210