Prev: 27271 Up: Map Next: 27364
27291: Handler: Player
Handles the player's car while it is being driven (entity state 1). Draws the objects and the car, then updates the radar, the terrain dots, the sidebar and the sounds.
Input
IX The player entity (Entity_Player)
HandlerPlayer 27291 PUSH IX Stash IX on the stack.
Reset the current place so that it can be set again if a place is in view.
27293 LD A,255 Write 255 to CurrentPlaceID.
27295 LD (24121),A
27298 CALL DrawObjects Call DrawObjects to draw the objects that are in view.
27301 CALL HandlerObjects Call HandlerObjects to remove the objects that are no longer in view.
27304 CALL UpdatePlayerCar Call UpdatePlayerCar to update the miles, the speed, the position, the steering and the fuel.
27307 CALL FlashPlayerMarker Call FlashPlayerMarker to flash the player marker on the map.
27310 CALL UpdateRadar Call UpdateRadar to update the radar.
27313 CALL UpdateTerrainDots Call UpdateTerrainDots to update the terrain dots.
27316 CALL SoundsCupRefuel Call SoundsCupRefuel to make the cup and refuel sounds.
27319 POP IX Restore IX from the stack.
Draw and colourise the player sprite.
27321 CALL DrawPlayer Call DrawPlayer.
27324 LD HL,22931 Point HL at the attribute buffer location of the player (22931).
27327 LD BC,514 BC=0514 (height * width in bytes).
Merge the player sprite colour in with the current background colour.
27330 LD A,(24132) Fetch the background attribute (Background_Attribute).
27333 OR %00000010 Set bit 1 (RED).
27335 LD D,A Keep the attribute to colour the car with in D.
27336 CALL ColouriseSprite_Block Colour the car using ColouriseSprite_Block.
Handles updating the dashboard values.
27339 CALL HandlerTime Call HandlerTime to update the time.
27342 CALL DisplayMiles Call DisplayMiles to display the miles and the time.
Remove the place name from the screen when no place is in view any more.
27345 LD A,(24121) Fetch the place name flag (CurrentPlaceID).
27348 AND A Return if CurrentPlaceID is zero (the name has already been removed).
27349 RET Z
27350 INC A Add one, so that 255 becomes 0.
27351 RET NZ Return if A is not zero (a place is in view; it is only zero here when the value was 255 see 27293).
27352 LD (24121),A Clear the place name flag (CurrentPlaceID) so that this is only done once.
27355 LD HL,47208 HL=47208 (pixel co-ordinates).
27358 LD DE,27364 Point DE at the blank text (Blank_Text_Attribute).
27361 JP PrintStringColour Jump to PrintStringColour to overwrite the place name with spaces.
Prev: 27271 Up: Map Next: 27364