Skip to navigation

Aviator on the BBC Micro

3D geometry: SetObjectCoords (Part 2 of 11)

Name: SetObjectCoords (Part 2 of 11) [Show more] Type: Subroutine Category: 3D geometry Summary: Pre-process the bullets (objects 12, 13, 14 or 15) Deep dive: 3D objects
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
\ If we get here then the object ID is 12, 13, 14 or 15, \ so this is a bullet object \ \ There are two bullet trails, with objects 13 and 15 at \ the head of the trail (i.e. the bullets), and objects \ 12 and 14 at the back of the bullet trail LDA #0 \ Set K = 0, so the CheckObjDistance routine always STA K \ returns 0, which means the bullet trails never get \ too far away to be hidden LDA yObjectHi,Y \ If the object's y-coordinate is positive, then the BPL objc3 \ bullet is above ground, so jump to objc3 to check the \ next range and then process the bullet TYA \ If bit 0 of the object ID is set, i.e. the object ID AND #1 \ is 13 or 15, jump to objc3 to check the next range BNE objc3 \ and then process the bullet (so objects 13 and 15 can \ be below ground while 12 and 14 are above ground, in \ which case the bullets are still in play) JMP objc10 \ The object ID is 12 or 14 (the back end of the bullet \ trail) and the object is below ground level, so jump \ to objc10 to tidy up and return from the subroutine, \ as the bullets have hit the ground