Routines |
Prev: 54983 | Up: Map | Next: 55068 |
Used by the routine at 54524.
|
||||
This routine uses the cyclical game timer at 60074 to generate the left and right walls of the tunnel.
|
||||
54994 | LD A,0 | Reset current horizontal & vertical speeds back to zero | ||
54996 | LD (60237),A | |||
54999 | LD (60236),A | |||
55002 | LD A,(60074) | Game timer | ||
55005 | LD C,A | |||
55006 | AND 1 | Every other game timer frame, decide whether to generate a left/right tunnel boundary wall | ||
55008 | JP NZ,55068 | |||
55011 | LD A,(60286) | Incremental tunnel counter | ||
55014 | INC A | Add 1 | ||
55015 | CP 20 | Check if >=20 (this determines the limit to how many boundary wall sections can be generated on screen) | ||
55017 | JP NC,55188 | If it's >=20, skip out of this routine. The most that will realistically fit on screen is 10, so this limit shouldn't normally be reached. | ||
55020 | LD (60286),A | Counter is <20. Restore incremented counter | ||
Use the game timer to create left/right tunnel border sections:
|
||||
55023 | LD A,C | Retrieve game timer | ||
55024 | AND 2 | Check bit 2 - 50/50 set/unset. Will go in a sequence of 11-00-11-00-11 | ||
55026 | JR Z,55036 | The 50/50 is used to create either a left-hand or right-hand tunnel boundary graphic. In this sequence this creates a 'staggered' effect for the tunnel walls. | ||
Right tunnel boundary wall:
|
||||
55028 | LD A,1 | Graphic offset = 1 (no offset - use graphic at 41114) | ||
55030 | LD C,16 | Horizontal movement speed/direction = +16 (moving right) | ||
55032 | LD E,4 | Horizontal movement position offset - in half-character/4-pixel steps (2 character squares to the right) | ||
55034 | JR 55042 | |||
Left tunnel boundary wall:
|
||||
55036 | LD A,2 | Graphic offset = 2 (a mirrored version of the tunnel graphic at 41114 will be created and the graphics address stored at 38929) | ||
55038 | LD C,240 | Horizontal movement speed/direction = -16 (moving left) | ||
55040 | LD E,252 | Horizontal movement position offset - in half-character/4-pixel steps (2 character squares to the left) | ||
Store calculated boundary attributes:
|
||||
55042 | LD (60230),A | 1 = Right boundary, 2 = Left boundary (mirror version) | ||
55045 | LD (60240),A | Graphic frame offset (1 = no offset or 2 = mirrored) | ||
55048 | LD A,14 | Graphic type = Tunnel object | ||
55050 | LD (60227),A | |||
55053 | LD A,C | Retrieve horizontal position/movement offset | ||
55054 | LD (60236),A | ...and store | ||
55057 | LD A,(60574) | Get horizontal graphic position (in 4-pixel/half-character steps) | ||
55060 | ADD A,E | Add the offset (+ or - 2 character squares) | ||
55061 | LD (60232),A | ...and store as graphic's horizontal screen position | ||
55064 | LD A,39 | Graphic number for tunnel boundary graphic address pointer at 38927 | ||
55066 | JR 55165 | Set up the tunnel wall graphic |
Prev: 54983 | Up: Map | Next: 55068 |