Routines |
Prev: 63898 | Up: Map | Next: 63996 |
|
||||||||
63915 | LD B,84 | 84: water fired from the pistol, phase 1 (facing left) | ||||||
63917 | LD L,0 | Point HL at byte 0 of ERIC's buffer | ||||||
63919 | LD A,(HL) | A=ERIC's animatory state | ||||||
63920 | INC L | L=1 | ||||||
63921 | RLCA | Is ERIC facing left? | ||||||
63922 | JR NC,63926 | Jump if so | ||||||
63924 | LD B,212 | 212: water fired from the pistol, phase 1 (facing right) | ||||||
63926 | SBC A,A | Set A=-2 if ERIC's facing left, 2 if he's facing right | ||||||
63927 | ADD A,A | |||||||
63928 | CPL | |||||||
63929 | ADD A,A | |||||||
63930 | ADD A,(HL) | Add ERIC's x-coordinate to get the initial x-coordinate of the water | ||||||
63931 | CP 191 | Is ERIC too close to (and facing) the far left wall of the boys' skool or the far right wall of the girls' skool? | ||||||
63933 | RET NC | Return if so | ||||||
63934 | LD E,A | Copy the water's initial x-coordinate to E | ||||||
63935 | INC L | L=2 | ||||||
63936 | LD D,(HL) | D=ERIC's y-coordinate | ||||||
63937 | DEC D | Subtract 2 to get the initial y-coordinate of the water | ||||||
63938 | DEC D | |||||||
63939 | LD A,B | A=initial animatory state of the water | ||||||
63940 | PUSH AF | Save the water's initial animatory state briefly | ||||||
63941 | PUSH DE | Save the water's initial coordinates briefly | ||||||
63942 | CALL 63864 | Make a water pistol sound effect | ||||||
63945 | LD A,136 | Message 136: NO WATERPISTOLS | ||||||
63947 | CALL 63640 | Give ERIC lines if any teacher is nearby | ||||||
63950 | POP DE | Restore the water's initial coordinates to DE | ||||||
63951 | POP AF | Restore the water's initial animatory state to A | ||||||
63952 | LD HL,54803 | Point HL at byte 19 of the water's buffer | ||||||
63955 | LD (HL),151 | Initialise the water animation phase identifier | ||||||
63957 | CALL 30534 | Place address 63960 (below) into bytes 17 and 18 of the water's buffer and update the SRB for the water's appearance | ||||||
The address of this entry point is placed into bytes 17 and 18 of the water's buffer by the instruction above just after the water has been fired from the pistol, and is used throughout the water's lifespan. First, check whether the water has hit a cup, a plant, or the floor.
|
||||||||
63960 | LD L,19 | Increment the water animation phase identifier (which starts off at 151) held in byte 19 of the buffer | ||||||
63962 | INC (HL) | |||||||
63963 | LD B,(HL) | Pick up this identifier (152-156) in B | ||||||
63964 | LD C,255 | Point BC at the appropriate entry in the water animation table (see below) | ||||||
63966 | LD A,(BC) | Pick up the entry in A | ||||||
63967 | AND A | Deal with the water at phase 3 (when it can hit a cup), 6 (when it can hit a plant) or 7+ (when it hits the floor) | ||||||
63968 | CALL NZ,64077 | |||||||
Next, determine the water's new animatory state and coordinates as it moves through the air. For this we use the water animation table, which comprises five 4-byte entries located in bytes 252-255 of pages 152-156, corresponding to the phases of animation of the water as it flies from the pistol to the ground. Each entry contains the animatory state (AS), the x-coordinate increment (x+), the y-coordinate increment (y+), and a parameter (P) that is passed to the routine at 64077 when non-zero. When P=1, the water is at the right phase to fill a cup; when P=2, the water may have hit a plant or the ground.
|
||||||||
63971 | DEC C | C=254 | ||||||
63972 | PUSH BC | Save the water animation table pointer | ||||||
63973 | CALL 25012 | Update the SRB for the water's current animatory state and location | ||||||
63976 | LD A,D | A=water's current y-coordinate | ||||||
63977 | POP HL | Restore the water animation table pointer to HL | ||||||
63978 | ADD A,(HL) | Add the entry from the table to obtain the water's new y-coordinate | ||||||
63979 | LD D,A | Copy this to D | ||||||
63980 | DEC L | L=253 | ||||||
63981 | LD C,(HL) | Pick up the x-coordinate increment in C | ||||||
63982 | DEC L | L=252 | ||||||
63983 | LD A,(HL) | A=water's new animatory state (facing left) | ||||||
63984 | LD HL,54784 | Point HL at byte 0 of the water's buffer | ||||||
63987 | RL (HL) | Set the carry flag if the water's travelling to the right | ||||||
63989 | RLA | Copy the carry flag into the 'direction' bit (bit 7) of the animatory state | ||||||
63990 | RRCA | |||||||
63991 | LD B,A | B=water's new animatory state (facing the correct way) | ||||||
63992 | LD A,E | A=water's current x-coordinate | ||||||
63993 | JP 64057 | Jump over the data table at 64000 to continue this routine |
Prev: 63898 | Up: Map | Next: 63996 |