\ 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)Name: SetObjectCoords (Part 6 of 11) [Show more] Type: Subroutine Category: 3D geometry Summary: Pre-process dormant aliens (object group 30) Deep dive: 3D objectsContext: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
[X]
Variable alienObjectId (category: The Theme)
Object IDs for each of the eight aliens
[X]
Variable alienSlot (category: The Theme)
Slots for up to three aliens that are ready to start moving towards the town
[X]
Variable alienState (category: The Theme)
The state of each of the eight aliens
[X]
Variable objCount in workspace Main variable workspace
Temporary storage, used as a loop counter in the object group visibility checks (shares a memory location with the alien variable)
[X]
Label objc5 is local to this routine
[X]
Label objc7 in subroutine SetObjectCoords (Part 7 of 11)
[X]
Label objc8 in subroutine SetObjectCoords (Part 7 of 11)
[X]
Label objc9 in subroutine SetObjectCoords (Part 8 of 11)
[X]
Variable themeStatus in workspace Main variable workspace
Theme status
[X]
Variable xObjectHi (category: 3D geometry)
High byte of the x-coordinate for an object
[X]
Variable zObjectHi (category: 3D geometry)
High byte of the z-coordinate for an object