Inside this document:
procedure ScanPreRockford(in positionType currentScanPosition;
in integer preRockfordStage;
in integer TimeTilBirth)
# If it's time for Rockford to be born, we morph stages 1-3 to stages 2-4,
# or morph stage 4 into a real Rockford. Otherwise do nothing.
ASSERT(TimeTilBirth >= 0);
ASSERT(preRockfordStage in {1, 2, 3, 4});
if (TimeTilBirth == 0) then
if (preRockfordStage <= 3) then
PlacePreRockford(currentScanPosition, preRockfordStage+1);
else
PlaceRockford(currentScanPosition);
endif
endif
endprocedure ScanPreRockford
What happens is that when the cave initially starts up, Rockford doesn't yet exist, but still all the creatures will be able to move, boulders fall, explosions happen, etc. At the point where Rockford will appear is a flashing "in box" (functionally equivalent to steel wall; ie it can't be exploded by anything that explodes near by during this time). If any amoeba exists, it is silent. The status bar shows the cave code and number of lives remaining. In the C64 implementation, the "time until birth" varies a bit. Generally, it's four seconds, but it's six seconds if the game is running in two player mode with one joystick. An extra second is given if the game is playing on difficulty level 2 (I don't know why).
When this "time until birth" reaches zero, the flashing "in box" changes into a "pre-Rockford, stage 1" (also functionally equivalent to steel wall). A cracking sound is played, and at that point amoeba sound is enabled. The status bar changes to its normal display (score, number of diamonds required, etc), and the cave timer starts. During the next four scan frames, the "pre-Rockford" morphs into stages 2, 3 and 4, and finally into a real Rockford, who can finally be moved and killed.
When Rockford dies, creatures continue to move, explosions happen, time continues to run out, etc. There is no flag in the code indicating whether or not Rockford has died; the entire game just continues right along (since Rockford is not encountered during the scan routine, the joystick won't be read and the player won't be able to move). If you let it, the game will keep on going until the player runs out of time, at which point the game finally stops.
What happens is that a count is kept of the number of scan frames that have passed without encountering Rockford (which, as it happens, can only happen if Rockford dies). Once 16 scan frames have gone by without Rockford being seen, then if the player hits fire, the cave finishes. This 16 frame threshold is used to prevent the problem that the player might hit fire before realising that they have died.
procedure CheckForBonusLife()
# Check to see whether the score has passed a 500 or a 1000 point boundary
# (in other words, you get a bonus life every 500 points).
if (CurrentPlayerData.score >= CurrentPlayerData.nextBonusLifeScore) then
AddLife();
CurrentPlayerData.nextBonusLifeScore += 500;
endif
endprocedure CheckForBonusLife
##
procedure AddLife()
ASSERT(CurrentPlayerData.lives <= 9);
if (CurrentPlayerData.lives < 9) then
CurrentPlayerData.lives++;
Make space objects flash to indicate bonus life;
endif
endprocedure AddLife
procedure ScanPreOutBox(in positionType currentScanPosition;
in Boolean GotEnoughDiamonds)
# If Rockford has collected enough diamonds, we can change the
# pre-out box (ie an out box which has not yet been activated)
# into a flashing out box.
if (GotEnoughDiamonds) then
PlaceOutBox(currentScanPosition);
endif
endprocedure ScanPreOutBox
##
procedure PickUpDiamond()
# Player has picked up a diamond. Increase their score, increase their number
# of diamonds collected, and check whether they have enough diamonds now.
RequestSound(pickedUpDiamondSound);
CurrentPlayerData.score += CurrentPlayerData.currentDiamondValue;
CheckForBonusLife();
CurrentPlayerData.diamondsCollected++;
CheckEnoughDiamonds()
endprocedure PickUpDiamond
##
procedure CheckEnoughDiamonds()
if (CurrentPlayerData.diamondsCollected == CaveData.diamondsNeeded) then
CurrentPlayerData.gotEnoughDiamonds := true;
CurrentPlayerData.currentDiamondValue := CaveData.extraDiamondValue;
Update statusbar;
RequestSound(crackSound);
Request screen to flash white to indicate got enough diamonds;
endif
endprocedure CheckEnoughDiamonds