Prev: 43962 Up: Map Next: 44288
44089: Align To Rover
Use the rover position when the rover is in play, otherwise Jetman's, then convert types 112 and 120 into the linked slots at Object_Slot_3.
Input
IX Actor slot
Start from the scroll X.
AlignToRover 44089 LD HL,(24698) HL=*Jetman_Position.
44092 JR AlignToRover_TestType Jump to AlignToRover_TestType.
Prefer the rover X when its type is in the 16 rover frames 26-41.
AlignToRover_TestRoverY 44094 LD A,(24720) A=*Rover_Slot.
44097 SUB 26 Subtract 26.
44099 CP 16 Compare it with 16.
44101 JR NC,AlignToRover Jump to AlignToRover if that is not a rover frame.
44103 LD HL,(24722) HL=*Rover_Position.
Test whether this actor is in range of that X, then its type.
AlignToRover_TestType 44106 CALL Handler_Missile_FetchActorX Call Handler_Missile_FetchActorX.
44109 LD A,(IX+0) A=*IX+0.
44112 JR C,AlignToRover_Type70 Jump to AlignToRover_Type70 if carry is set.
44114 CP 120 Compare A with 120.
44116 JR Z,AlignToRover_Type78 Jump to AlignToRover_Type78 if they are equal.
44118 JP DrawCurrentActor Jump to DrawCurrentActor.
Type 112 copies AlignToRover_Target.
AlignToRover_Type70 44121 CP 112 Compare A with 112.
44123 JR Z,AlignToRover_ConvertLauncher Jump to AlignToRover_ConvertLauncher if they are equal.
44125 JP DrawCurrentActor Jump to DrawCurrentActor.
Type 120 copies AlignToRover_Target_2 and becomes 152.
AlignToRover_Type78 44128 CALL DrawCurrentActor_Draw Call DrawCurrentActor_Draw.
44131 CALL ScanObjectSlots Call ScanObjectSlots.
44134 RET NZ Return if any object slot is in use.
44135 CALL AlignToRover_CopyTarget2 Call AlignToRover_CopyTarget2.
44138 LD (IX+0),152 Write 152 to *IX+0.
44142 RET Return.
Type 112 becomes 156.
AlignToRover_ConvertLauncher 44143 CALL DrawCurrentActor_Draw Call DrawCurrentActor_Draw.
44146 CALL ScanObjectSlots Call ScanObjectSlots.
44149 RET NZ Return if any object slot is in use.
44150 CALL AlignToRover_CopyTarget Call AlignToRover_CopyTarget.
44153 LD (IX+0),156 Write 156 to *IX+0.
44157 RET Return.
Copy 48 bytes into Object_Slot_3.
AlignToRover_CopyTarget2 44158 LD HL,44240 HL=AlignToRover_Target_2.
44161 JR AlignToRover_CopyToSlot Jump to AlignToRover_CopyToSlot.
AlignToRover_CopyTarget 44163 LD HL,44192 HL=AlignToRover_Target.
AlignToRover_CopyToSlot 44166 LD DE,24888 DE=Object_Slot_3.
44169 LD BC,48 Copy 48 bytes from HL to DE.
44172 LDIR
Place the slot at this actor's world X and 16 above its Y.
44174 LD L,(IX+2) L=*IX+2.
44177 LD H,(IX+3) H=*IX+3.
44180 LD (24890),HL Write HL to Object_Slot_3_Position.
44183 LD A,(IX+4) A=*IX+4.
44186 SUB 16 A-=16.
44188 LD (24892),A Write A to Object_Slot_3_Y.
44191 RET Return.
AlignToRover_Target 44192 DEFB 132,0,0,0,0,1,255,70
44200 DEFB 0,0,0,0,0,0,0,0
44208 DEFB 0,0,0,0,0,0,0,0
44216 DEFB 134,0,0,0,0,0,0,66
44224 DEFB 0,0,0,0,0,0,0,0
44232 DEFB 0,0,0,0,0,0,0,0
AlignToRover_Target_2 44240 DEFB 128,0,0,0,0,255,255,70
44248 DEFB 0,0,0,0,0,0,0,0
44256 DEFB 0,0,0,0,0,0,0,0
44264 DEFB 130,0,0,0,0,0,0,66
44272 DEFB 0,0,0,0,0,0,0,0
44280 DEFB 0,0,0,0,0,0,0,0
Prev: 43962 Up: Map Next: 44288