LDR R8, [R11, #xCamera] \ Set R0 = R0 - xCamera SUB R0, R0, R8 \ = x - xCamera \ \ So R0 contains the x-coordinate of the \ particle relative to the camera LDR R8, [R11, #zCamera] \ Set R2 = R2 - zCamera SUB R2, R2, R8 \ \ So R2 contains the z-coordinate of the \ particle relative to the camera ADD R2, R2, #LANDSCAPE_Z \ Move the coordinate back by the landscape \ offset, so (R0, R2) contains the \ coordinate of the particle relative to the \ back-centre point of the landscape LDR R8, [R11, #yCamera] \ Set R1 = R1 - yCamera SUB R1, R1, R8 \ = y - yCamera \ \ So R1 contains the y-coordinate of the \ particle relative to the camera CMP R2, #LANDSCAPE_Z \ If the z-coordinate of the particle in R2 BHS dpar1 \ is further into the screen than the \ landscape offset in LANDSCAPE_Z, then it \ is beyond the back of the visible \ landscape, so jump to dpar1 to move on to \ the next particle in the buffer CMP R2, #LANDSCAPE_Z_FRONT \ If the z-coordinate of the particle in R2 BLO dpar1 \ is closer to us than LANDSCAPE_Z_FRONT, \ then it is closer than the front of the \ visible landscape, so jump to dpar1 to \ move on to the next particle in the buffer MOVS R14, R0 \ Set R14 = |R0| RSBMI R14, R0, #0 \ = |particle x-coordinate| CMP R14, #LANDSCAPE_X_HALF \ If the x-coordinate of the particle in R14 BHS dpar1 \ is more than half the x-axis width of the \ landscape to the left or right, then it is \ past the edge of the landscape and is too \ far to be drawn, so jump to dpar1 to move \ on to the next particle in the buffer TST R7, #&00020000 \ If bit 17 of the particle flags is clear BEQ dpar4 \ then this is not a rock, so jump to dpar4 \ to draw the particle and its shadow into \ the graphics buffers in part 4 \ Otherwise this is a rock, so fall through \ into part 3 to process collisionsName: MoveAndDrawParticles (Part 2 of 4) [Show more] Type: Subroutine Category: Particles Summary: Draw particles (including rocks) into the graphics buffers Deep dive: Particles and particle cloudsContext: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
[X]
Configuration variable LANDSCAPE_X_HALF = TILE_SIZE * HALF_TILES_X
The width of half the number of tiles from left to right in the landscape in x-coordinates
[X]
Configuration variable LANDSCAPE_Z = LANDSCAPE_Z_DEPTH + (10 * TILE_SIZE)
The z-coordinate of the landscape offset, which is set to push the landscape away from the viewer by ten tile sizes
[X]
Configuration variable LANDSCAPE_Z_FRONT = LANDSCAPE_Z - LANDSCAPE_Z_DEPTH
The z-coordinate of the front of the visible landscape
[X]
Entry point dpar1 in subroutine MoveAndDrawParticles (Part 1 of 4) (category: Particles)
The start of the main particle-processing loop
[X]
Label dpar4 in subroutine MoveAndDrawParticles (Part 4 of 4)
[X]
Configuration variable xCamera = &13C
The 3D x-coordinate of the camera position (though note that the camera position is actually at the back of the on-screen landscape, not the front)
[X]
Configuration variable yCamera = &140
The 3D y-coordinate of the camera position (though note that the camera position is actually at the back of the on-screen landscape, not the front)
[X]
Configuration variable zCamera = &144
The 3D z-coordinate of the camera position (though note that the camera position is actually at the back of the on-screen landscape, not the front, so the camera's z-coordinate is larger than it would be for a more traditional camera position; it is more like the camera's focal point than position, in a sense)