Skip to navigation

Elite on the BBC Micro

Main loop: Main flight loop (Part 5 of 16) [Master version]

Name: Main flight loop (Part 5 of 16) [Show more] Type: Subroutine Category: Main loop Summary: For each nearby ship: If an energy bomb has been set off, potentially kill this ship Deep dive: Program flow of the main game loop
Context: See this subroutine in context in the source code Variations: See code variations for this subroutine in the different versions References: No direct references to this subroutine in this source file

The main flight loop covers most of the flight-specific aspects of Elite. This section covers the following: * Continue looping through all the ships in the local bubble, and for each one: * If an energy bomb has been set off and this ship can be killed, kill it and increase the kill tally
LDA BOMB \ If we set off our energy bomb (see MA24 above), then BPL MA21 \ BOMB is now negative, so this skips to MA21 if our \ energy bomb is not going off CPY #2*SST \ If the ship in Y is the space station, jump to BA21 BEQ MA21 \ as energy bombs are useless against space stations CPY #2*THG \ If the ship in Y is a Thargoid, jump to BA21 as energy BEQ MA21 \ bombs have no effect against Thargoids CPY #2*CON \ If the ship in Y is the Constrictor, jump to BA21 BCS MA21 \ as energy bombs are useless against the Constrictor \ (the Constrictor is the target of mission 1, and it \ would be too easy if it could just be blown out of \ the sky with a single key press) LDA INWK+31 \ If the ship we are checking has bit 5 set in its ship AND #%00100000 \ byte #31, then it is already exploding, so jump to BNE MA21 \ BA21 as ships can't explode more than once ASL INWK+31 \ The energy bomb is killing this ship, so set bit 7 of SEC \ the ship byte #31 to indicate that it has now been ROR INWK+31 \ killed LDX TYPE \ Set X to the type of the ship that was killed so the \ following call to EXNO2 can award us the correct \ number of fractional kill points JSR EXNO2 \ Call EXNO2 to process the fact that we have killed a \ ship (so increase the kill tally, make an explosion \ sound and possibly display "RIGHT ON COMMANDER!")