Prev: 34304 Up: Map Next: 34633
34406: Choose Location Or Take Job
Used by the routine at GameInitialise.
choose-location
ChooseLocationOrTakeJob 34406 LD B,1 Call 32853 with a count of 1.
34408 CALL 32853
34411 LD HL,61435 Jump to ChooseLocationOrTakeJob if bit 0 ("Ticker On/ Off") of *GameState_2 is set.
34414 BIT 0,(HL)
34416 JR NZ,ChooseLocationOrTakeJob
34418 CALL ClearMenuScreenAreas Call ClearMenuScreenAreas.
Prints "Destination Fare".
34421 LD HL,35944 HL=Messaging_TravelHeader.
34424 LD DE,20554 DE=20554 (screen buffer location).
34427 CALL Print_String Call Print_String.
34430 LD HL,20586 HL=20586 (screen buffer location).
34433 LD B,11 Underline the header with 11 character blocks of 255.
34435 CALL Underline
34438 LD HL,20600 HL=20600 (screen buffer location).
34441 LD B,4 Underline the header with 4 character blocks of 255.
34443 CALL Underline
34446 LD A,128 Initialise *TemporaryScreenLocation to 128.
34448 LD (30737),A
34451 LD IX,(61426) Loads the active players current location into BC (using either *1UP_Location or *2UP_Location).
34455 LD C,(IX+8)
34458 LD B,(IX+9)
34461 PUSH BC Stash the active players current location on the stack.
34462 LD IX,2 Move the pointer in IX by 0002.
34466 ADD IX,BC
34468 LD L,(IX+0) Load the current locations map co-ordinates into HL.
34471 LD H,(IX+1)
34474 LD (30725),HL Write the current locations map co-ordinates to *CurrentLocationCoordinates.
Prints each destination (and cost) to the screen.
34477 LD BC,2 Set the increment value in BC so IX will point to the first flight destination from where the player is located.
PrintDestinations_Loop 34480 ADD IX,BC Move the pointer in IX by the increment value in BC.
34482 LD L,(IX+0) Fetch the destination and store it in HL.
34485 LD H,(IX+1)
34488 LD A,96 Jump to AllDestinationsPrinted if all destinations have been printed.
34490 CP H
34491 JR NC,AllDestinationsPrinted
34493 LD DE,17 Move the pointer in HL to the destination name, the data before the name string is always 0017 bytes.
34496 ADD HL,DE
Load the screen position for printing into DE.
34497 LD D,80 D=80.
34499 LD A,(30737) A=*TemporaryScreenLocation.
34502 OR %00001001 Set bits 0 and 3.
34504 LD E,A E=A.
Print the destination location name to the screen.
34505 CALL Print_String Call Print_String.
Calculate where to print the cost.
34508 LD A,E A=E.
34509 AND %11100000 Keep only bits 5-7.
34511 OR %00011000 Set bits 3-4.
34513 LD E,A E=A.
34514 AND %11100000 Keep only bits 5-7.
34516 ADD A,32 A+=32.
34518 LD (30737),A Write A to *TemporaryScreenLocation.
34521 PUSH IX Stash IX on the stack.
34523 PUSH IX HL=IX (using the stack).
34525 POP HL
34526 INC HL Move HL to the last digit of the cost, ready for printing.
34527 INC HL
34528 INC HL
34529 LD BC,514 Set the number format in BC.
34532 CALL PrintNumbers Call PrintNumbers.
34535 POP IX Restore IX from the stack.
34537 LD HL,65532 Move the printing position in DE back to the start of the cost.
34540 ADD HL,DE
34541 EX DE,HL
Now print "£".
34542 LD HL,35878 HL=Messaging_£.
34545 CALL Print_String Call Print_String.
34548 LD BC,4 Set the increment in BC to point to the next destination.
34551 JR PrintDestinations_Loop Jump to PrintDestinations_Loop.
Now deduce if the current location has a playable game or not.
AllDestinationsPrinted 34553 POP HL Restore the current location into HL (from the stack).
34554 LD DE,16 Move HL to this locations "state" and load the state into A.
34557 ADD HL,DE
34558 LD A,(HL)
34559 AND A Jump to ShiftLocationState if *Pointer_ActivePlayer is pointing to 1UP_Name (is this player one?)
34560 LD HL,(61426)
34563 LD DE,35880
34566 SBC HL,DE
34568 JR Z,ShiftLocationState
This is player two, so shift the location state right through two positions.
34570 RRCA Set the carry flag if 2UP has completed the sub-game at this location.
ShiftLocationState 34571 RRCA Set the carry flag if 1UP has completed the sub-game at this destination).
34572 LD B,224 B=224.
Decide which message to print; "Job completed" or "Accept job offered".
34574 LD HL,35962 HL=Messaging_JobComplete.
34577 JR C,PrintJobMessaging Jump to PrintJobMessaging if the game at this location has already been completed.
34579 LD B,0 B=0.
34581 LD HL,35975 HL=Messaging_AcceptJobOffered.
Calculate where to print the messaging.
PrintJobMessaging 34584 LD A,(30737) A=*TemporaryScreenLocation.
34587 OR %00001010 Set bits 1 and 3.
34589 LD E,A E=A.
34590 LD D,80 D=80.
34592 AND %11100000 Keep only bits 5-7.
34594 ADD A,B A+=B.
34595 LD (30737),A Write A to *TemporaryScreenLocation.
34598 PUSH BC Stash BC on the stack.
Print either "Job completed" or "Accept job offered" to the screen.
34599 CALL Print_String Call Print_String.
34602 POP AF Restore AF from the stack.
34603 CP 0 Return if A is equal to 0.
34605 RET Z
34606 LD IX,(61426) IX=Pointer_ActivePlayer.
34610 CALL Check_AffordToFly Call Check_AffordToFly.
34613 RET NC Return if the player can afford the "cheapest" destination.
The active player can't afford to fly anywhere.
34614 RES 7,(IX+15) Reset bit 7 of *IX+15.
34618 LD B,100 Call 32853 with a count of 100.
34620 CALL 32853
34623 CALL ClearMenuScreenAreas Call ClearMenuScreenAreas.
34626 CALL Messaging_GenerateTicker Call Messaging_GenerateTicker.
34629 POP HL Restore HL from the stack.
34630 JP Handler_SubGame_6 Jump to Handler_SubGame_6.
Prev: 34304 Up: Map Next: 34633