Skip to navigation


Particles: AddRisingParticleToBuffer

Name: AddRisingParticleToBuffer [Show more] Type: Subroutine Category: Particles Summary: Add a particle to the particle data buffer that initially drifts up, with a random element to its velocity and lifespan counter Deep dive: Particles and particle clouds
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * AddSmokeParticleToBuffer calls AddRisingParticleToBuffer

Arguments: (R0, R1, R2) Particle coordinate R4 Particle velocity in the y-axis (up-down) R6 Particle lifespan counter (i.e. how many iterations around the main loop before the particle expires) R7 Particle flags: * Bits 0-7 = particle colour * Bit 16 set = colour fades white to red * Bit 17 set = particle is a rock * Bit 18 set = splash on impact with sea * Bit 19 set = bounce on hitting ground * Bit 20 set = apply gravity to particle * Bit 21 set = can destroy objects * Bit 23 set = splash size (big when set) * Bit 24 set = explode on hitting ground R8 Magnitude of the random element that's added to the velocity, with a larger figure giving a smaller random element; the actual range is +/- 2^(32 - R8) R9 Magnitude of the random element that's added to the particle lifespan, with a larger figure giving a smaller random element; the actual range is 0 to 2^(32 - R9) Stack Contains a value to restore into R8 at the end, and the return address
.AddRisingParticleToBuffer MOV R3, #0 \ Set R3 = 0 MOV R5, #0 \ Set R5 = 0 \ Fall into AddMovingParticleToBuffer with \ a velocity of (0, R4, 0)