![]() |
Routines |
| Prev: 35151 | Up: Map | Next: 35228 |
|
Used by the routine at Handler_LocationChoice.
|
||||
| CalculateFlightPath | 35180 | LD HL,(30725) | HL=*CurrentLocationCoordinates. | |
| 35183 | LD DE,(30727) | DE=*DestinationLocationCoordinates. | ||
|
Calculate X movement vector.
|
||||
| 35187 | LD A,L | A=current X - destination X. | ||
| 35188 | SUB E | |||
| 35189 | LD E,255 | Assume moving left (negative X direction). | ||
| 35191 | JP P,StoreAbsolute_X_Difference | If the result is positive, skip negation and jump to StoreAbsolute_X_Difference. | ||
| 35194 | NEG | Negate A if it's negative. | ||
| 35196 | LD E,1 | Moving right (positive X direction). | ||
| StoreAbsolute_X_Difference | 35198 | LD C,A | Store absolute X difference in C. | |
|
Calculate Y movement vector.
|
||||
| 35199 | LD A,H | A=current Y - destination Y. | ||
| 35200 | SUB D | |||
| 35201 | LD D,255 | Assume moving up (negative Y direction). | ||
| 35203 | JR NC,StoreAbsolute_Y_Difference | If result is non-negative, skip negation and jump to StoreAbsolute_Y_Difference. | ||
| 35205 | NEG | Negate A if it's negative. | ||
| 35207 | LD D,1 | Moving down (positive Y direction). | ||
| StoreAbsolute_Y_Difference | 35209 | LD B,A | Store absolute Y difference in B. | |
|
Store calculated vectors and flags.
|
||||
| 35210 | LD (30721),BC | Write BC to *Flightpath_X_MovementVector. | ||
| 35214 | LD (30729),BC | Write BC to *Flightpath_Minimum_Y_Coordinate. | ||
| 35218 | LD (30723),DE | Write DE to *Flightpath_Y_MovementVector. | ||
| 35222 | LD HL,61435 | Set bit 1 ("Flightpath In-Progress") of *GameState_2. | ||
| 35225 | SET 1,(HL) | |||
| 35227 | RET | Return. | ||
| Prev: 35151 | Up: Map | Next: 35228 |