.dpar4 \ If we get here then we draw the particle \ and its shadow into the graphics buffers STMFD R13!, {R0-R2, R7} \ Store R0, R1, R2 and R7 on the stack so \ they don't get corrupted by the following \ calls LDR R14, [R11, #yCamera] \ Set R1 = R9 - yCamera SUB R1, R9, R14 \ = landscape altitude - yCamera \ \ We set R9 in part 1 to the altitude of the \ landscape below the particle, so this sets \ R1 to the y-coordinate of the particle's \ shadow relative to the camera MOV R8, R2 \ Set R8 to the z-coordinate of the particle \ relative to the camera BL ProjectParticleOntoScreen \ Project the coordinates of the particle's \ shadow in (R0, R1, R2) onto the screen, \ returning the results in (R0, R1) \ \ This also clears the C flag if the \ particle coordinates are on-screen BLCC DrawParticleShadowToBuffer \ If the projected coordinates fit onto the \ screen, draw the particle's projected \ shadow into the graphics buffers LDMFD R13!, {R0-R2, R7} \ Retrieve the values of R0, R1, R2 and R7 \ that we stored above MOV R8, R2 \ Set R8 to the z-coordinate of the particle \ relative to the camera BL ProjectParticleOntoScreen \ Project the coordinates of the particle in \ (R0, R1, R2) onto the screen, returning \ the results in (R0, R1) \ \ This also clears the C flag if the \ particle coordinates are on-screen BLCC DrawParticleToBuffer \ If the projected coordinates fit onto the \ screen, draw the projected particle into \ the graphics buffers LDMIA R10, {R0-R7} \ Fetch the eight words of particle data \ for the next particle from the particle \ data buffer at R10 CMP R7, #0 \ If the last word of the data is not zero BNE dpar2 \ then this is a valid particle rather than \ a null terminator, so loop back to dpar2 \ to process the next particle LDMFD R13!, {R10, R12, PC} \ Retrieve the registers that we stored on \ the stack and return from the subroutineName: MoveAndDrawParticles (Part 4 of 4) [Show more] Type: Subroutine Category: Particles Summary: Draw particles 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]
Subroutine DrawParticleShadowToBuffer (category: Particles)
Draw a small black particle into the correct graphics buffer, according to its distance
[X]
Subroutine DrawParticleToBuffer (category: Particles)
Draw a large coloured particle into a slightly nearer graphics, buffer according to its distance
[X]
Subroutine ProjectParticleOntoScreen (category: Maths (Geometry))
Project a 3D particle coordinate onto the screen
[X]
Label dpar2 in subroutine MoveAndDrawParticles (Part 1 of 4)
[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)