Prev: 57291 Up: Map Next: 57432
57299: All Treasure Collected
Used by the routine at InitialiseGame.
Restore the default ZX Spectrum font.
AllTreasureCollected 57299 LD HL,15360 Write 15360 (CHARSET-256) to *CHARS.
57302 LD (23606),HL
Set the attributes.
57305 LD A,16 Set INK: WHITE (7).
57307 RST 16
57308 LD A,7
57310 RST 16
57311 LD A,17 Set PAPER: *ActiveRoom_PaperColour.
57313 RST 16
57314 LD A,(23505)
57317 RST 16
Don't decrease *TimerGoldenKey every frame, we track a count of the frames and only decrease it every 20th frame.
57318 LD BC,(23546) Decrease *TimerGoldenKey_FrameSkip by one.
57322 DEC BC
57323 LD (23546),BC
57327 LD A,B Skip to DisplayGoldenKeyTimer if *TimerGoldenKey_FrameSkip is not yet zero.
57328 OR C
57329 JR NZ,DisplayGoldenKeyTimer
20 frames have passed, so decrease the actual timer and check that it hasn't expired yet.
57331 LD BC,20 Reset *TimerGoldenKey_FrameSkip back to 0020.
57334 LD (23546),BC
57338 LD A,(23551) Decrease *TimerGoldenKey by one.
57341 DEC A
57342 LD (23551),A
Player lives don't matter with the Golden Key section of the game, once the timer expires it's Game Over.
57345 JP Z,ForceGameOver Jump to ForceGameOver if *TimerGoldenKey is zero.
Display the Golden Key timer.
DisplayGoldenKeyTimer 57348 LD C,12 Set up the screen buffer location 12/2 using CL_SET.
57350 LD B,2
57352 CALL 3545
Store *TimerGoldenKey in BC so we can use OUT_NUM_1 to print it to the screen.
57355 LD B,0 BC=*TimerGoldenKey.
57357 LD A,(23551)
57360 LD C,A
57361 CALL 6683 Call OUT_NUM_1.
The ASCII space after the timer acts to clear "extra" digits when the timer transitions to being single digit.
57364 LD A,32 A=ASCII "space" (32).
57366 CALL PrintColourCharacter Call PrintColourCharacter.
Is the Golden Key in the current room?
57369 LD A,(23507) Return if *CurrentRoom is not equal to *GoldenKeyRoom.
57372 LD HL,23548
57375 CP (HL)
57376 RET NZ
It is in this room, so display it.
57377 LD BC,(23549) BC=*PositionGoldenKey.
57381 LD HL,57019 Write 57019 (Graphics_GoldenKey) to *CHARS.
57384 LD (23606),HL
57387 LD A,16 Set INK: YELLOW (6).
57389 RST 16
57390 LD A,6
57392 RST 16
57393 LD A,32 A=32 (base sprite ID).
57395 LD DE,513 DE=Set the sprite width/ height (2/ 1).
57398 CALL PrintSprite Call PrintSprite.
Handle player collision with the Golden Key.
57401 LD IX,62001 IX=TablePlayerAttributes.
57405 LD BC,(23549) BC=*PositionGoldenKey.
57409 LD A,(IX+0) Return if the players horizontal co-ordinate is not equal to the Golden Key horizontal co-ordinate.
57412 CP C
57413 RET NZ
57414 LD A,(IX+1) Return if the players vertical co-ordinate is not equal to the Golden Key vertical co-ordinate.
57417 CP B
57418 RET NZ
The player has collected the Golden Key!
Hilariously, just beep at the player and restart the game. Zero fanfare!
57419 LD DE,200 DE=0200.
57422 LD HL,200 HL=0200.
57425 CALL 949 Call BEEPER.
57428 POP BC Restore BC from the stack.
57429 JP InitialiseGameStates Jump to InitialiseGameStates.
Prev: 57291 Up: Map Next: 57432