Prev: 34553 Up: Map Next: 34731
34667: Set Level Graphics
Used by the routines at SwitchPlayer and RunGame.
Sets up the level which is being played using the table of levels at LevelSettings, which has eight bytes for each level. The colour for the level and the number of bottles to collect are stored, and four of the addresses in the table at TileTable are replaced for the level.
SetLevelGraphics 34667 LD HL,34731 Point HL at the table of levels.
34670 LD A,(57055) Fetch the number of the current level from LevelNumber.
34673 ADD A,A Multiply it by eight.
34674 ADD A,A
34675 ADD A,A
34676 CALL AddToAddress Add it to HL to find the entry of the level.
34679 LD A,(HL) Fetch the colour of the level.
34680 LD (57630),A Store it in the attribute of the rectangle at 57630.
34683 INC HL Move onto the next byte of the entry.
34684 LD A,(HL) Fetch the number of bottles to collect.
34685 LD (57056),A Store it in BottlesLeft.
34688 INC HL Move onto the next byte of the entry.
34689 LD E,(HL) Fetch the low byte of the first address.
34690 INC HL Move onto the high byte.
34691 LD D,(HL) Fetch the high byte.
34692 INC HL Move onto the next word of the entry.
34693 LD (26222),DE Store it in the first entry of the table at TileTable.
34697 LD E,(HL) Fetch the low byte of the second address.
34698 INC HL Move onto the high byte.
34699 LD D,(HL) Fetch the high byte.
34700 INC HL Move onto the next word of the entry.
34701 LD (26268),DE Store it in the last entry of the table at 26268.
34705 LD E,(HL) Fetch the low byte of the third address.
34706 INC HL Move onto the high byte.
34707 LD D,(HL) Fetch the high byte.
34708 LD (26224),DE Store it in the third entry of the table at 26224.
34712 LD HL,32645 HL is 32645.
34715 AND A Clear the carry flag.
34716 SBC HL,DE Compare the third address with 32645.
34718 LD DE,32839 DE is 32839 the fourth address when the third address is 32645.
34721 JR Z,SetLevelGraphics_Store Jump to SetLevelGraphics_Store if it is 32645.
34723 LD DE,32936 DE is 32936 the fourth address otherwise.
SetLevelGraphics_Store 34726 LD (26226),DE Store it in the fourth entry of the table at 26226.
34730 RET Return.
Prev: 34553 Up: Map Next: 34731