Prev: ABBA Up: Map Next: AD00
AC39: Align To Rover
Use the rover position when the rover is in play, otherwise Jetman's, then convert types 70 and 78 into the linked slots at Object_Slot_3.
Input
IX Actor slot
Start from the scroll X.
AlignToRover AC39 LD HL,($607A) HL=*Jetman_Position.
AC3C JR AlignToRover_TestType Jump to AlignToRover_TestType.
Prefer the rover X when its type is in the 10 rover frames 1A-29.
AlignToRover_TestRoverY AC3E LD A,($6090) A=*Rover_Slot.
AC41 SUB $1A Subtract 1A.
AC43 CP $10 Compare it with 10.
AC45 JR NC,AlignToRover Jump to AlignToRover if that is not a rover frame.
AC47 LD HL,($6092) HL=*Rover_Position.
Test whether this actor is in range of that X, then its type.
AlignToRover_TestType AC4A CALL Handler_Missile_FetchActorX Call Handler_Missile_FetchActorX.
AC4D LD A,(IX+$00) A=*IX+00.
AC50 JR C,AlignToRover_Type70 Jump to AlignToRover_Type70 if carry is set.
AC52 CP $78 Compare A with 78.
AC54 JR Z,AlignToRover_Type78 Jump to AlignToRover_Type78 if they are equal.
AC56 JP DrawCurrentActor Jump to DrawCurrentActor.
Type 70 copies AlignToRover_Target.
AlignToRover_Type70 AC59 CP $70 Compare A with 70.
AC5B JR Z,AlignToRover_ConvertLauncher Jump to AlignToRover_ConvertLauncher if they are equal.
AC5D JP DrawCurrentActor Jump to DrawCurrentActor.
Type 78 copies AlignToRover_Target_2 and becomes 98.
AlignToRover_Type78 AC60 CALL DrawCurrentActor_Draw Call DrawCurrentActor_Draw.
AC63 CALL ScanObjectSlots Call ScanObjectSlots.
AC66 RET NZ Return if any object slot is in use.
AC67 CALL AlignToRover_CopyTarget2 Call AlignToRover_CopyTarget2.
AC6A LD (IX+$00),$98 Write 98 to *IX+00.
AC6E RET Return.
Type 70 becomes 9C.
AlignToRover_ConvertLauncher AC6F CALL DrawCurrentActor_Draw Call DrawCurrentActor_Draw.
AC72 CALL ScanObjectSlots Call ScanObjectSlots.
AC75 RET NZ Return if any object slot is in use.
AC76 CALL AlignToRover_CopyTarget Call AlignToRover_CopyTarget.
AC79 LD (IX+$00),$9C Write 9C to *IX+00.
AC7D RET Return.
Copy 30 bytes into Object_Slot_3.
AlignToRover_CopyTarget2 AC7E LD HL,$ACD0 HL=AlignToRover_Target_2.
AC81 JR AlignToRover_CopyToSlot Jump to AlignToRover_CopyToSlot.
AlignToRover_CopyTarget AC83 LD HL,$ACA0 HL=AlignToRover_Target.
AlignToRover_CopyToSlot AC86 LD DE,$6138 DE=Object_Slot_3.
AC89 LD BC,$0030 Copy 30 bytes from HL to DE.
AC8C LDIR
Place the slot at this actor's world X and 10 above its Y.
AC8E LD L,(IX+$02) L=*IX+02.
AC91 LD H,(IX+$03) H=*IX+03.
AC94 LD ($613A),HL Write HL to Object_Slot_3_Position.
AC97 LD A,(IX+$04) A=*IX+04.
AC9A SUB $10 A-=10.
AC9C LD ($613C),A Write A to Object_Slot_3_Y.
AC9F RET Return.
AlignToRover_Target ACA0 DEFB $84,$00,$00,$00,$00,$01,$FF,$46
ACA8 DEFB $00,$00,$00,$00,$00,$00,$00,$00
ACB0 DEFB $00,$00,$00,$00,$00,$00,$00,$00
ACB8 DEFB $86,$00,$00,$00,$00,$00,$00,$42
ACC0 DEFB $00,$00,$00,$00,$00,$00,$00,$00
ACC8 DEFB $00,$00,$00,$00,$00,$00,$00,$00
AlignToRover_Target_2 ACD0 DEFB $80,$00,$00,$00,$00,$FF,$FF,$46
ACD8 DEFB $00,$00,$00,$00,$00,$00,$00,$00
ACE0 DEFB $00,$00,$00,$00,$00,$00,$00,$00
ACE8 DEFB $82,$00,$00,$00,$00,$00,$00,$42
ACF0 DEFB $00,$00,$00,$00,$00,$00,$00,$00
ACF8 DEFB $00,$00,$00,$00,$00,$00,$00,$00
Prev: ABBA Up: Map Next: AD00