![]() |
Routines |
| Prev: 34406 | Up: Map | Next: 34852 |
|
Used by the routine at GameInitialise.
|
||||
| Handler_LocationChoice | 34633 | LD A,(30737) | A=*TemporaryScreenLocation. | |
| 34636 | OR %00001000 | Set bit 3. | ||
| 34638 | LD C,A | C=A. | ||
| 34639 | LD A,136 | Initialise *TemporaryScreenLocation with 136. | ||
| 34641 | LD (30737),A | |||
| 34644 | PUSH BC | Stash BC on the stack. | ||
| 34645 | CALL Print_ArrowSymbol | Call Print_ArrowSymbol. | ||
| 34648 | CALL PauseCheck | Call PauseCheck. | ||
|
Loop round until player input is detected.
|
||||
| Handler_LocationChoice_InputLoop | 34651 | LD B,10 | Call 32853 with a count of 10. | |
| 34653 | CALL 32853 | |||
| 34656 | CALL Handler_Controls | Call Handler_Controls. | ||
| 34659 | LD A,E | Jump to ProcessLocationChoiceInput_Up if "up" was pressed. | ||
| 34660 | CP 24 | |||
| 34662 | JP Z,ProcessLocationChoiceInput_Up | |||
| 34665 | CP 8 | Jump to ProcessLocationChoiceInput_Down if "down" was pressed. | ||
| 34667 | JP Z,ProcessLocationChoiceInput_Down | |||
| 34670 | CP 32 | Jump to Handler_LocationChoice_InputLoop if anything other than "fire" was pressed. | ||
| 34672 | JR NZ,Handler_LocationChoice_InputLoop | |||
|
Process the player pressing "fire".
|
||||
| 34674 | LD IX,(61426) | IX=*Pointer_ActivePlayer. | ||
| 34678 | LD L,(IX+8) | Fetch the players current location and store it in HL. | ||
| 34681 | LD H,(IX+9) | |||
| 34684 | LD BC,4 | Set the increment between destinations in BC. | ||
| 34687 | LD A,(30737) | Set the selected position from *TemporaryScreenLocation in E. | ||
| 34690 | LD E,A | |||
| 34691 | LD A,136 | Set the position of the top destination in A. | ||
|
With the selected position being in E, start with A being the position of the top entry (136) and check if the values match, if they don't - loop back round adding 32 to the checking value in A until a a match is found (and the destination will be in HL).
|
||||
| CalculateSelectedDestination_Loop | 34693 | ADD HL,BC | Move HL to the next destination. | |
| 34694 | CP E | Jump to FoundSelectedDestination if A is equal to the selected position. | ||
| 34695 | JR Z,FoundSelectedDestination | |||
| 34697 | ADD A,32 | Move down one line. | ||
| 34699 | JR CalculateSelectedDestination_Loop | Jump to CalculateSelectedDestination_Loop. | ||
|
Destination has been found.
|
||||
| FoundSelectedDestination | 34701 | LD C,(HL) | C=*HL. | |
| 34702 | INC HL | Increment HL by one. | ||
| 34703 | LD A,96 | Jump to Handler_SubGame if *HL is lower than 96. | ||
| 34705 | CP (HL) | |||
| 34706 | JP NC,Handler_SubGame | |||
| 34709 | LD B,(HL) | B=*HL. | ||
| 34710 | INC HL | Increment HL by one. | ||
| 34711 | LD E,(HL) | Stash the pointer to the cost on the stack. | ||
| 34712 | PUSH HL | |||
| 34713 | INC HL | Load the cost of this trip into DE. | ||
| 34714 | LD D,(HL) | |||
| 34715 | LD L,(IX+13) | Load the players cash balance into HL. | ||
| 34718 | LD H,(IX+14) | |||
| 34721 | AND A | Jump to NotEnoughMoneyToFly if the players cash balance is lower than the cost of this trip. | ||
| 34722 | SBC HL,DE | |||
| 34724 | JR C,NotEnoughMoneyToFly | |||
|
The player can afford the trip, so continue.
|
||||
| 34726 | LD (IX+8),C | Update the players current destination with the new destination. | ||
| 34729 | LD (IX+9),B | |||
| 34732 | LD HL,2 | Move HL to point to the co-ordinates of the destination. | ||
| 34735 | ADD HL,BC | |||
| 34736 | LD C,(HL) | Load the map co-ordinates into BC. | ||
| 34737 | INC HL | |||
| 34738 | LD B,(HL) | |||
| 34739 | LD (30727),BC | Write the map co-ordinates to *DestinationLocationCoordinates. | ||
|
Spent the money on the air fare.
|
||||
| 34743 | LD HL,(61426) | Store a pointer to the players cash balance in DE. | ||
| 34746 | LD DE,13 | |||
| 34749 | ADD HL,DE | |||
| 34750 | EX DE,HL | |||
| 34751 | POP HL | Restore the pointer to the cost of this trip from the stack into HL. | ||
| 34752 | LD B,2 | Call SpendMoney with 2 digits to process. | ||
| 34754 | CALL SpendMoney | |||
|
Print the updated cash balance to the screen.
|
||||
| 34757 | DEC DE | Decrease the cash balance pointer by one to point to the correct starting position (the print call moved it). Move this to HL. | ||
| 34758 | EX DE,HL | |||
| 34759 | LD DE,16443 | DE=16443 (screen buffer location). | ||
| 34762 | LD BC,514 | BC=0514. | ||
| 34765 | CALL PrintNumbers | Call PrintNumbers. | ||
| 34768 | POP HL | Restore HL from the stack (housekeeping, this is immediately thrown away). | ||
| 34769 | LD HL,61434 | Set bit 7 ("Flying To New Destination") of *GameState_1. | ||
| 34772 | SET 7,(HL) | |||
| 34774 | CALL Messaging_GenerateTicker | Call Messaging_GenerateTicker. | ||
| 34777 | CALL ClearMenuScreenAreas | Call ClearMenuScreenAreas. | ||
| 34780 | JP CalculateFlightPath | Jump to CalculateFlightPath. | ||
|
Prints "No DiscountsAllowed".
|
||||
| NotEnoughMoneyToFly | 34783 | POP DE | Restore DE from the stack (housekeeping, this is immediately thrown away). | |
|
Prints "No ".
|
||||
| 34784 | LD HL,35856 | HL=Messaging_No. | ||
| 34787 | LD DE,20643 | DE=20643 (screen buffer location). | ||
| 34790 | CALL Print_String | Call Print_String. | ||
|
Prints "Discounts".
|
||||
| 34793 | LD DE,20672 | DE=20672 (screen buffer location). | ||
| 34796 | CALL Print_String | Call Print_String. | ||
|
Prints "Allowed".
|
||||
| 34799 | LD DE,20705 | DE=20705 (screen buffer location). | ||
| 34802 | CALL Print_String | Call Print_String. | ||
| 34805 | JP Handler_LocationChoice_InputLoop | Jump to Handler_LocationChoice_InputLoop. | ||
|
Process the player pressing "up".
|
||||
| ProcessLocationChoiceInput_Up | 34808 | CALL Erase_ArrowSymbol | Call Erase_ArrowSymbol. | |
| 34811 | POP BC | Restore BC from the stack. | ||
| 34812 | LD A,(30737) | Jump to LocationChoice_MoveChoice if *TemporaryScreenLocation is equal to with 136. | ||
| 34815 | CP 136 | |||
| 34817 | JR Z,LocationChoice_MoveChoice | |||
| 34819 | SUB 32 | A-=32. | ||
| UpdateDestinationChoice | 34821 | LD (30737),A | Write A to *TemporaryScreenLocation. | |
| 34824 | PUSH BC | Stash BC on the stack. | ||
| 34825 | CALL Print_ArrowSymbol | Call Print_ArrowSymbol. | ||
| 34828 | JP Handler_LocationChoice_InputLoop | Jump to Handler_LocationChoice_InputLoop. | ||
|
Process the player pressing "down".
|
||||
| ProcessLocationChoiceInput_Down | 34831 | CALL Erase_ArrowSymbol | Call Erase_ArrowSymbol. | |
| 34834 | POP BC | Restore BC from the stack. | ||
| 34835 | LD A,(30737) | Jump to LocationChoice_BackToTop if *TemporaryScreenLocation is equal to C. | ||
| 34838 | CP C | |||
| 34839 | JR Z,LocationChoice_BackToTop | |||
| 34841 | ADD A,32 | A+=32. | ||
| 34843 | JR UpdateDestinationChoice | Jump to UpdateDestinationChoice. | ||
|
Set the cursor position back to the initial "top" choice.
|
||||
| LocationChoice_BackToTop | 34845 | LD A,136 | A=136. | |
| 34847 | JR UpdateDestinationChoice | Jump to UpdateDestinationChoice. | ||
| LocationChoice_MoveChoice | 34849 | LD A,C | A=C. | |
| 34850 | JR UpdateDestinationChoice | Jump to UpdateDestinationChoice. | ||
| Prev: 34406 | Up: Map | Next: 34852 |