Routines |
Prev: 41633 | Up: Map | Next: 41961 |
Used by the routine at 41211.
|
||||
41767 | CALL 41961 | Update state of cannon's projectile | ||
41770 | LD IX,45508 | Load IX with address of complex state data for cannon (level 4) | ||
41774 | BIT 2,(IX+9) | If cannon's just-loaded flag is reset... | ||
41778 | JR Z,41805 | ...then skip ahead to 41805 | ||
41780 | DEC (IX+12) | Decrease cannon's fire timer... | ||
41783 | JR Z,41791 | ...and if now zero then skip ahead to 41791 | ||
41785 | LD BC,42519 | Set cannon's graphic layout data address to point to graphic layout data for cannon (rocking) and return... | ||
41788 | JP 42512 | ... | ||
41791 | RES 2,(IX+9) | Reset cannon's just-loaded flag | ||
41795 | LD (IX+12),50 | Set cannon's fire timer to 50 | ||
41799 | LD BC,42530 | Set cannon's graphic layout data address to point to graphic layout data for cannon (dormant) and return... | ||
41802 | JP 42512 | ... | ||
Cannon's just-loaded flag is reset, so cannon has finished its rocking phase.
|
||||
41805 | LD A,(34209) | If cannon has no ammunition... | ||
41808 | OR A | ... | ||
41809 | JR Z,41799 | ...then jump to 41799 (cannon dormant) | ||
41811 | BIT 5,(IX+10) | If cannon has its is-being-carried flag set... | ||
41815 | JR NZ,41799 | ...then jump to 41799 (cannon dormant) | ||
41817 | LD IY,(34240) | Load IY with address of current level's complex state data for Berk | ||
41821 | LD A,(IX+0) | If Berk's current room is the same as the cannon's room... | ||
41824 | CP (IY+0) | ... | ||
41827 | JR Z,41833 | ...then skip ahead to 41833 | ||
41829 | JR C,41860 | If index of Berk's current room is greater than the index of the cannon's room then skip ahead to 41860 | ||
41831 | JR 41871 | Skip ahead to 41871 | ||
Berk and cannon in same room
|
||||
41833 | LD A,(IX+7) | If x-coordinate of cannon's right side is smaller than x-coordinate of Berk's left side (i.e. cannon is to left of Berk)... | ||
41836 | CP (IY+5) | ... | ||
41839 | JR C,41860 | ...then skip ahead to 41860 | ||
41841 | LD A,(IY+7) | If x-coordinate of Berk's right side is smaller than x-coordinate of cannon's left side (i.e. cannon is to right of Berk)... | ||
41844 | CP (IX+5) | ... | ||
41847 | JR C,41871 | ...then skip ahead to 41871 | ||
Berk and cannon overlapping horizontally
|
||||
41849 | LD E,1 | Load E with 1 (as projectile will appear one character to the right of the cannon's coordinate position) | ||
41851 | LD (IX+9),0 | Prepare to set projectile's state to zero (fired vertically) | ||
41855 | LD BC,42530 | Load BC with graphic layout data address for cannon (upright) | ||
41858 | JR 41880 | Skip ahead to 41880 | ||
Berk is to the right of the cannon
|
||||
41860 | LD (IX+9),1 | Prepare to set projectile's state to 1 (fired left) | ||
41864 | LD E,2 | Load E with 2 (as projectile will appear two characters to the right of the cannon's coordinate position) | ||
41866 | LD BC,42556 | Load BC with graphic layout data address for cannon (tilted right) | ||
41869 | JR 41880 | Skip ahead to 41880 | ||
Berk is to the left of the cannon
|
||||
41871 | LD (IX+9),2 | Prepare to set projectile's state to 2 (fired right) | ||
41875 | LD BC,42594 | Load BC with graphic layout data address for cannon (tilted left) | ||
41878 | LD E,0 | Load E with 0 (as projectile will appear at the same x-coordinate as in the cannon's coordinate position) | ||
41880 | CALL 42512 | Set cannon's graphic layout data address to value in BC | ||
41883 | LD A,(IX+1) | If cannon's depth is 2... | ||
41886 | CP 2 | ... | ||
41888 | RET Z | ...then return (cannon won't fire if it is placed behind Berk) | ||
41889 | LD A,(IX+12) | If cannon's fire timer is at zero... | ||
41892 | OR A | ... | ||
41893 | JR Z,41899 | ...then skip ahead to 41899 | ||
41895 | DEC (IX+12) | Decrease cannon's fire timer | ||
41898 | RET | Return | ||
Cannon's fire timer is at zero
|
||||
41899 | LD HL,34209 | Decrease ammunition level of cannon (level 4) by one... | ||
41902 | DEC (HL) | ... | ||
41903 | LD (IX+12),50 | Set cannon's fire timer to 50 | ||
41907 | LD IY,45599 | Load IY with address of complex state data for cannon's projectile | ||
41911 | LD A,(IX+5) | Set x-coordinate of projectile's left and right sides to E plus x-coordinate of cannon's left side... | ||
41914 | ADD A,E | ... | ||
41915 | LD (IY+5),A | ... | ||
41918 | LD (IY+7),A | ... | ||
41921 | LD A,(IX+4) | Set y-coordinates of top and bottom of projectile to be one less than cannon's top y-coordinate... | ||
41924 | DEC A | ... | ||
41925 | LD (IY+4),A | ... | ||
41928 | LD (IY+6),A | ... | ||
41931 | LD A,(IX+0) | Set projectile's room to same as cannon's room... | ||
41934 | LD (IY+0),A | ... | ||
41937 | LD (IY+1),1 | Set projectile's depth to 1 | ||
41941 | LD A,(IX+9) | Set projectile's state to value prepared previously... | ||
41944 | LD (IY+9),A | ... | ||
41947 | LD (IY+12),251 | Set projectile's y-velocity to -5 | ||
41951 | LD BC,51483 | Set projectile's graphic layout data address to that for explosion (Bubo's projectile / fallen drips, level 4)... | ||
41954 | LD (IY+2),C | ...as projectile is launched from cannon in an explosion... | ||
41957 | LD (IY+3),B | ... | ||
41960 | RET | Return |
Prev: 41633 | Up: Map | Next: 41961 |