![]() |
Routines |
| Prev: 50313 | Up: Map | Next: 50479 |
|
Used by the routine at StartGame.
Sets the attributes of the items in the inventory tube. Each item is a block of two by two attributes. Items 1 to 4 flash in the colours of items 5 to 8 when the player is within five cells of the monster that they belong to.
|
||||
|
Colour each place in the inventory tube.
|
||||
| ColourInventoryItems | 50396 | LD BC,50479 | Point at the table of colours, and at the lowest item at 23234 (in the attribute buffer). | |
| 50399 | LD HL,23234 | |||
| 50402 | EXX | Switch to the shadow registers, point at the inventory and set a counter for the eleven places in it. | ||
| 50403 | LD DE,48131 | |||
| 50406 | LD B,11 | |||
| ColourInventoryItems_Loop | 50408 | LD A,(DE) | Fetch the item, and return if there are no more items. | |
| 50409 | AND A | |||
| 50410 | RET Z | |||
| 50411 | CP 5 | Jump to ColourInventoryItems_Monster if the item is one of the four that belong to monsters. | ||
| 50413 | JR C,ColourInventoryItems_Monster | |||
| ColourInventoryItems_Colour | 50415 | EXX | Look up the colour of the item in the table of colours. | |
| 50416 | EX DE,HL | |||
| 50417 | LD L,A | |||
| 50418 | LD H,0 | |||
| 50420 | ADD HL,BC | |||
| 50421 | LD A,(HL) | |||
| 50422 | EX DE,HL | |||
| 50423 | LD (HL),A | Colour the top two attributes of the item. | ||
| 50424 | INC HL | |||
| 50425 | LD (HL),A | |||
| 50426 | LD DE,65503 | Move to the row of attributes above. | ||
| 50429 | ADD HL,DE | |||
| 50430 | LD (HL),A | Colour the bottom two attributes of the item. | ||
| 50431 | INC HL | |||
| 50432 | LD (HL),A | |||
| 50433 | ADD HL,DE | Move up one more row, to the next item. | ||
| 50434 | EXX | Swap back to the main registers. | ||
| 50435 | INC DE | Move on to the next place in the inventory, and loop back until all eleven have been coloured. | ||
| 50436 | DJNZ ColourInventoryItems_Loop | |||
| 50438 | RET | Return. | ||
|
Items 1 to 4 belong to the monsters. Find out whether the monster is near the player.
|
||||
| ColourInventoryItems_Monster | 50439 | PUSH AF | Keep the item and the pointer to the inventory. | |
| 50440 | PUSH DE | |||
| 50441 | CPL | Turn the number of the item into the number of the monster, from 3 to 0. | ||
| 50442 | ADD A,5 | |||
| 50444 | ADD A,A | Multiply it by sixteen, to get the distance to the object of the monster. | ||
| 50445 | ADD A,A | |||
| 50446 | ADD A,A | |||
| 50447 | ADD A,A | |||
| 50448 | LD E,A | Put the distance in DE. | ||
| 50449 | LD D,0 | |||
| 50451 | LD IX,48478 | Start with the first monster. | ||
| 50455 | ADD IX,DE | Add the distance, to point at the right monster. | ||
| 50457 | LD C,5 | Set the distance to 5 cells. | ||
| 50459 | CALL CheckPlayerClose | Check whether the monster is close to the player. | ||
| 50462 | JR C,ColourInventoryItems_Flash | Jump to ColourInventoryItems_Flash to make the item flash if the player is within five cells of the monster. | ||
| 50464 | POP DE | Get the item and the pointer to the inventory back. | ||
| 50465 | POP AF | |||
| 50466 | JR ColourInventoryItems_Colour | Jump to ColourInventoryItems_Colour to give the item its usual colour. | ||
| ColourInventoryItems_Flash | 50468 | POP DE | Get the item and the pointer to the inventory back. | |
| 50469 | POP AF | |||
| 50470 | LD A,(48050) | Use the lowest two bits of the frame counter, plus five, as the colour of the item, so that it flashes. | ||
| 50473 | AND 3 | |||
| 50475 | ADD A,5 | |||
| 50477 | JR ColourInventoryItems_Colour | Jump to ColourInventoryItems_Colour to colour the item. | ||
| Prev: 50313 | Up: Map | Next: 50479 |