Prev: 8600 Up: Map Next: 8749
8666: Choose Location Or Take Job
Used by the routine at GameInitialise.
choose-location
ChooseLocationOrTakeJob 8666 LD B,$01 Call 8055 with a count of 01.
8668 CALL $8055
866B LD HL,$EFFB Jump to ChooseLocationOrTakeJob if bit 0 ("Ticker On/ Off") of *GameState_2 is set.
866E BIT 0,(HL)
8670 JR NZ,ChooseLocationOrTakeJob
8672 CALL ClearMenuScreenAreas Call ClearMenuScreenAreas.
Prints "Destination Fare".
8675 LD HL,$8C68 HL=Messaging_TravelHeader.
8678 LD DE,$504A DE=504A (screen buffer location).
867B CALL Print_String Call Print_String.
867E LD HL,$506A HL=506A (screen buffer location).
8681 LD B,$0B Underline the header with 0B character blocks of FF.
8683 CALL Underline
8686 LD HL,$5078 HL=5078 (screen buffer location).
8689 LD B,$04 Underline the header with 04 character blocks of FF.
868B CALL Underline
868E LD A,$80 Initialise *TemporaryScreenLocation to 80.
8690 LD ($7811),A
8693 LD IX,($EFF2) Loads the active players current location into BC (using either *1UP_Location or *2UP_Location).
8697 LD C,(IX+$08)
869A LD B,(IX+$09)
869D PUSH BC Stash the active players current location on the stack.
869E LD IX,$0002 Move the pointer in IX by 0002.
86A2 ADD IX,BC
86A4 LD L,(IX+$00) Load the current locations map co-ordinates into HL.
86A7 LD H,(IX+$01)
86AA LD ($7805),HL Write the current locations map co-ordinates to *CurrentLocationCoordinates.
Prints each destination (and cost) to the screen.
86AD LD BC,$0002 Set the increment value in BC so IX will point to the first flight destination from where the player is located.
PrintDestinations_Loop 86B0 ADD IX,BC Move the pointer in IX by the increment value in BC.
86B2 LD L,(IX+$00) Fetch the destination and store it in HL.
86B5 LD H,(IX+$01)
86B8 LD A,$60 Jump to AllDestinationsPrinted if all destinations have been printed.
86BA CP H
86BB JR NC,AllDestinationsPrinted
86BD LD DE,$0011 Move the pointer in HL to the destination name, the data before the name string is always 0011 bytes.
86C0 ADD HL,DE
Load the screen position for printing into DE.
86C1 LD D,$50 D=50.
86C3 LD A,($7811) A=*TemporaryScreenLocation.
86C6 OR %00001001 Set bits 0 and 3.
86C8 LD E,A E=A.
Print the destination location name to the screen.
86C9 CALL Print_String Call Print_String.
Calculate where to print the cost.
86CC LD A,E A=E.
86CD AND %11100000 Keep only bits 5-7.
86CF OR %00011000 Set bits 3-4.
86D1 LD E,A E=A.
86D2 AND %11100000 Keep only bits 5-7.
86D4 ADD A,$20 A+=20.
86D6 LD ($7811),A Write A to *TemporaryScreenLocation.
86D9 PUSH IX Stash IX on the stack.
86DB PUSH IX HL=IX (using the stack).
86DD POP HL
86DE INC HL Move HL to the last digit of the cost, ready for printing.
86DF INC HL
86E0 INC HL
86E1 LD BC,$0202 Set the number format in BC.
86E4 CALL PrintNumbers Call PrintNumbers.
86E7 POP IX Restore IX from the stack.
86E9 LD HL,$FFFC Move the printing position in DE back to the start of the cost.
86EC ADD HL,DE
86ED EX DE,HL
Now print "£".
86EE LD HL,$8C26 HL=Messaging_£.
86F1 CALL Print_String Call Print_String.
86F4 LD BC,$0004 Set the increment in BC to point to the next destination.
86F7 JR PrintDestinations_Loop Jump to PrintDestinations_Loop.
Now deduce if the current location has a playable game or not.
AllDestinationsPrinted 86F9 POP HL Restore the current location into HL (from the stack).
86FA LD DE,$0010 Move HL to this locations "state" and load the state into A.
86FD ADD HL,DE
86FE LD A,(HL)
86FF AND A Jump to ShiftLocationState if *Pointer_ActivePlayer is pointing to 1UP_Name (is this player one?)
8700 LD HL,($EFF2)
8703 LD DE,$8C28
8706 SBC HL,DE
8708 JR Z,ShiftLocationState
This is player two, so shift the location state right through two positions.
870A RRCA Set the carry flag if 2UP has completed the sub-game at this location.
ShiftLocationState 870B RRCA Set the carry flag if 1UP has completed the sub-game at this destination).
870C LD B,$E0 B=E0.
Decide which message to print; "Job completed" or "Accept job offered".
870E LD HL,$8C7A HL=Messaging_JobComplete.
8711 JR C,PrintJobMessaging Jump to PrintJobMessaging if the game at this location has already been completed.
8713 LD B,$00 B=00.
8715 LD HL,$8C87 HL=Messaging_AcceptJobOffered.
Calculate where to print the messaging.
PrintJobMessaging 8718 LD A,($7811) A=*TemporaryScreenLocation.
871B OR %00001010 Set bits 1 and 3.
871D LD E,A E=A.
871E LD D,$50 D=50.
8720 AND %11100000 Keep only bits 5-7.
8722 ADD A,B A+=B.
8723 LD ($7811),A Write A to *TemporaryScreenLocation.
8726 PUSH BC Stash BC on the stack.
Print either "Job completed" or "Accept job offered" to the screen.
8727 CALL Print_String Call Print_String.
872A POP AF Restore AF from the stack.
872B CP $00 Return if A is equal to 00.
872D RET Z
872E LD IX,($EFF2) IX=Pointer_ActivePlayer.
8732 CALL Check_AffordToFly Call Check_AffordToFly.
8735 RET NC Return if the player can afford the "cheapest" destination.
The active player can't afford to fly anywhere.
8736 RES 7,(IX+$0F) Reset bit 7 of *IX+0F.
873A LD B,$64 Call 8055 with a count of 64.
873C CALL $8055
873F CALL ClearMenuScreenAreas Call ClearMenuScreenAreas.
8742 CALL Messaging_GenerateTicker Call Messaging_GenerateTicker.
8745 POP HL Restore HL from the stack.
8746 JP Handler_SubGame_6 Jump to Handler_SubGame_6.
Prev: 8600 Up: Map Next: 8749