![]() |
Routines |
| Prev: 43668 | Up: Map | Next: 43928 |
|
Used by the routine at UpdateMapObjects.
Checks whether the ship can pick up an object. A type 30 object can only be picked up when its item number is the one that is wanted at 62978; objects with an item number of 10 can never be picked up. CheckItemPickup_Touch does the pick up if the ship is touching the object.
|
||||||||
| CheckItemPickup | 43735 | LD A,(IX+0) | The type. | |||||
| 43738 | CP 30 | Jump to CheckItemPickup_Kind if A is not 30. | ||||||
| 43740 | JR NZ,CheckItemPickup_Kind | |||||||
| 43742 | LD A,(62958) | The first part flag. | ||||||
| 43745 | AND A | Return if A is zero. | ||||||
| 43746 | RET Z | |||||||
| 43747 | LD A,(IX+19) | The state. | ||||||
| 43750 | AND %00001111 | Keep the bits of A that are set in 15. | ||||||
| 43752 | LD B,A | B=A. | ||||||
| 43753 | LD A,(62978) | The crystal count. | ||||||
| 43756 | CP B | Return if A is not B. | ||||||
| 43757 | RET NZ | |||||||
| 43758 | LD (IX+13),250 | Store 250 at offset 13 of IX. | ||||||
| CheckItemPickup_Kind | 43762 | LD A,(IX+19) | The state. | |||||
| 43765 | AND %00001111 | Keep the bits of A that are set in 15. | ||||||
| 43767 | CP 10 | Return if A is 10. | ||||||
| 43769 | RET Z | |||||||
| 43770 | CP 9 | Jump to CheckItemPickup_Touch if A is not 9. | ||||||
| 43772 | JR NZ,CheckItemPickup_Touch | |||||||
| 43774 | LD A,(62966) | The ninth part flag. | ||||||
| 43777 | AND A | Return if A is zero. | ||||||
| 43778 | RET Z | |||||||
|
Test whether the ship is touching the object, and give up if the object is not on the screen.
|
||||||||
| CheckItemPickup_Touch | 43779 | LD A,(41431) | The rows of the first sprite. | |||||
| 43782 | AND A | Return if A is zero. | ||||||
| 43783 | RET Z | |||||||
| 43784 | LD (43943),A | The height of the collision box. | ||||||
| 43787 | LD HL,(41427) | Fetch the word at SpritePositions into HL. | ||||||
| 43790 | LD A,H | A=H. | ||||||
| 43791 | CP 40 | Return if A is less than 40. | ||||||
| 43793 | RET C | |||||||
| 43794 | LD A,L | A=L. | ||||||
| 43795 | CP 48 | Return if A is less than 48. | ||||||
| 43797 | RET C | |||||||
| 43798 | CP 144 | Return if A is 144 or more. | ||||||
| 43800 | RET NC | |||||||
| 43801 | LD (43940),HL | Update the collision box. | ||||||
| 43804 | LD A,(23592) | The sprite width in bytes. | ||||||
| 43807 | ADD A,A | Double A. | ||||||
| 43808 | ADD A,A | Double A. | ||||||
| 43809 | ADD A,A | Double A. | ||||||
| 43810 | LD (43942),A | The width of the collision box. | ||||||
| 43813 | LD HL,(51458) | Fetch the word at 51458 into HL. | ||||||
| 43816 | LD L,112 | L=112. | ||||||
| 43818 | LD D,16 | D=16. | ||||||
| 43820 | LD A,(49577) | The height of the ship. | ||||||
| 43823 | SUB 10 | Subtract 10 from A. | ||||||
| 43825 | LD E,A | E=A. | ||||||
|
Test the box of the object against a box around the ship.
|
||||||||
| 43826 | CALL TestBoxAgainstShip | Call TestBoxAgainstShip. | ||||||
| 43829 | LD A,(23580) | The hit flag. | ||||||
| 43832 | AND A | Return if A is zero. | ||||||
| 43833 | RET Z | |||||||
|
The ship has picked the object up: play a sound, score 1000 points, then record the item that is now carried.
|
||||||||
| 43834 | CALL PlayPickUpSound | Call PlayPickUpSound. | ||||||
| 43837 | LD BC,4096 | BC=4096. | ||||||
| 43840 | CALL AddToScore | Call AddToScore. | ||||||
| 43843 | LD A,(IX+0) | The type. | ||||||
| 43846 | CP 30 | Jump to CheckItemPickup_Site if A is not 30. | ||||||
| 43848 | JR NZ,CheckItemPickup_Site | |||||||
| 43850 | LD A,(IX+19) | The state. | ||||||
| 43853 | AND %00001111 | Keep the bits of A that are set in 15. | ||||||
| 43855 | OR %11000000 | Set the bits of A that are set in 192. | ||||||
| 43857 | LD (51460),A | Update the item the ship is about to pick up. | ||||||
| 43860 | LD HL,63024 | The twelfth item site. | ||||||
| 43863 | AND %00001111 | Keep the bits of A that are set in 15. | ||||||
| 43865 | LD (62977),A | Update the carried item. | ||||||
| 43868 | JR CheckItemPickup_Record | Jump to CheckItemPickup_Record. | ||||||
|
The object is not type 30: the item is recorded in the table of item sites at ItemSites and the carried item at 51460 is set to its number.
|
||||||||
| CheckItemPickup_Site | 43870 | LD A,(IX+19) | The state. | |||||
| 43873 | INC A | Advance A. | ||||||
| 43874 | LD (51460),A | Update the item the ship is about to pick up. | ||||||
| 43877 | DEC A | Step A back. | ||||||
| 43878 | LD HL,62980 | The item sites. | ||||||
|
Set bit 7 of the record for the item, remove the object from the screen and free its slot.
|
||||||||
| CheckItemPickup_Record | 43881 | ADD A,A | Double A. | |||||
| 43882 | ADD A,A | Double A. | ||||||
| 43883 | CALL AddAToHL | Call AddAToHL. | ||||||
| 43886 | SET 7,(HL) | Set bit 7 of the byte at the address in HL. | ||||||
| 43888 | SET 4,(IX+16) | Set bit 4 of offset 16 of IX. | ||||||
| 43892 | LD (IX+0),255 | Store 255 at offset 0 of IX. | ||||||
| 43896 | LD A,(IX+19) | The state. | ||||||
| 43899 | CP 9 | Return if A is not 9. | ||||||
| 43901 | RET NZ | |||||||
|
Item number 9 is special.
|
||||||||
| CheckItemPickup_Special | 43902 | XOR A | Clear A. | |||||
| 43903 | LD (51460),A | Update the item the ship is about to pick up. | ||||||
| 43906 | LD (49785),A | The pieces beside the ship are cleared. | ||||||
| 43909 | LD A,9 | A=9. | ||||||
| 43911 | LD (62967),A | Update the flag set when item 9 has been picked up. | ||||||
| 43914 | LD A,(43165) | Bit 4 of the sixth map object's flags. | ||||||
| 43917 | OR %00010000 | Set the bits of A that are set in 16. | ||||||
| 43919 | LD (43165),A | Bit 4 of the sixth map object's flags. | ||||||
| 43922 | LD HL,63020 | The eleventh item site. | ||||||
| 43925 | SET 7,(HL) | Set bit 7 of the byte at the address in HL. | ||||||
| 43927 | RET | Return. | ||||||
| Prev: 43668 | Up: Map | Next: 43928 |