You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bugfixes and added more color modes to PS Fireworks 1D
- fixed inconsitencies in size rendering
- fixed palette being wrapped in color by position and color by age modes
- Fixed bug in memory layout: for some unknown reason, if flags come before particles, last flag is sometimes overwritten, changing memory laout seems to fix that
PartSys->particleMoveUpdate(PartSys->sources[0].source, PartSys->sources[0].sourceFlags); // increase speed by calling the move function twice, also ages twice
9367
+
PartSys->particleMoveUpdate(PartSys->sources[0].source, PartSys->sources[0].sourceFlags); // increase rocket speed by calling the move function twice, also ages twice
for (uint32_t e = 0; e < explosionsize; e++) { // emit explosion particles
9387
-
if (SEGMENT.check1) // colorful mode
9388
-
PartSys->sources[0].source.hue = hw_random16(); //random color for each particle
9389
-
PartSys->sprayEmit(PartSys->sources[0]); // emit a particle
9384
+
int idx = PartSys->sprayEmit(PartSys->sources[0]); // emit a particle
9385
+
if(SEGMENT.custom3 > 23) {
9386
+
if(SEGMENT.custom3 == 31) { // highest slider value
9387
+
PartSys->setColorByAge(SEGMENT.check1); // color by age if colorful mode is enabled
9388
+
PartSys->setColorByPosition(!SEGMENT.check1); // color by position otherwise
9389
+
}
9390
+
else { // if custom3 is set to high value (but not highest), set particle color by initial speed
9391
+
PartSys->particles[idx].hue = map(abs(PartSys->particles[idx].vx), 0, PartSys->sources[0].var, 0, 16 + hw_random16(200)); // set hue according to speed, use random amount of palette width
9392
+
PartSys->particles[idx].hue += PartSys->sources[0].source.hue; // add hue offset of the rocket (random starting color)
9393
+
}
9394
+
}
9395
+
else {
9396
+
if (SEGMENT.check1) // colorful mode
9397
+
PartSys->sources[0].source.hue = hw_random16(); //random color for each particle
9398
+
}
9390
9399
}
9391
9400
}
9392
9401
}
9393
-
if ((SEGMENT.call & 0x01) == 0 && PartSys->sources[0].sourceFlags.custom1 == false) // every second frame and not in standby
9402
+
if ((SEGMENT.call & 0x01) == 0 && PartSys->sources[0].sourceFlags.custom1 == false && PartSys->sources[0].source.ttl > 50) // every second frame and not in standby and not about to explode
if (PartSys->particles[i].ttl > 10) PartSys->particles[i].ttl -= 10; //ttl is linked to brightness, this allows to use higher brightness but still a short spark lifespan
// a pointer MUST be 4 byte aligned. sizeof() in a struct/class is always aligned to the largest element. if it contains a 32bit, it will be padded to 4 bytes, 16bit is padded to 2byte alignment.
969
977
// The PS is aligned to 4 bytes, a PSparticle is aligned to 2 and a struct containing only byte sized variables is not aligned at all and may need to be padded when dividing the memoryblock.
970
978
// by making sure that the number of sources and particles is a multiple of 4, padding can be skipped here as alignent is ensured, independent of struct sizes.
particleFlags[emitIndex].collide = emitter.sourceFlags.collide;// TODO: could just set all flags (asByte) but need to check if that breaks any of the FX
// a pointer MUST be 4 byte aligned. sizeof() in a struct/class is always aligned to the largest element. if it contains a 32bit, it will be padded to 4 bytes, 16bit is padded to 2byte alignment.
1737
1750
// The PS is aligned to 4 bytes, a PSparticle is aligned to 2 and a struct containing only byte sized variables is not aligned at all and may need to be padded when dividing the memoryblock.
1738
1751
// by making sure that the number of sources and particles is a multiple of 4, padding can be skipped here as alignent is ensured, independent of struct sizes.
PSdataEnd = reinterpret_cast<uint8_t *>(advPartProps + numParticles);// since numParticles is a multiple of 4, this is always aligned to 4 bytes. No need to add padding bytes here
0 commit comments