Skip to navigation


3D geometry: SetObjectCoords (Part 6 of 11)

Name: SetObjectCoords (Part 6 of 11) [Show more] Type: Subroutine Category: 3D geometry Summary: Pre-process dormant aliens (object group 30) 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 30 LDA themeStatus \ If themeStatus is non-zero then either the Theme is BNE objc8 \ not enabled, or it is enabled but we haven't yet added \ all eight aliens to the current wave, so jump to \ objc8 to return from the subroutine LDA #8 \ Set objCount = 8 to act as a counter in the loop STA objCount \ below, so we work through all eight aliens in this \ group \ As we loop through the following, alienSlot gets \ incremented so we work our way through all the aliens \ in the slot .objc4 LDX alienSlot \ Fetch the contents of the slot for alien 30, so X now \ contains the number of the alien in that slot (0 to 7) LDA alienState,X \ If the alien's state is non-zero, jump to objc11 via BNE objc7 \ objc7 to move on to the next alien in the group, as \ the alien is feeding LDA alienObjectId,X \ Set A to the object ID for the alien BPL objc5 \ If A is positive, jump to objc5... which has no \ effect, as that's the next instruction anyway .objc5 TAX \ Copy the alien's x-coordinate to the current object's LDA xObjectHi,X \ x-coordinate STA xObjectHi,Y LDA zObjectHi,X \ Copy the alien's z-coordinate to the current object's STA zObjectHi,Y \ x-coordinate JMP objc9 \ Jump to objc9 to process this object, after which we \ return to the above from part 10 to process the next \ alien (with alienSlot incremented)