@@ -9004,30 +9004,34 @@ uint16_t mode_particlegalaxy(void) {
90049004 PartSys->particleMoveUpdate (PartSys->sources [0 ].source , PartSys->sources [0 ].sourceFlags , &sourcesettings);
90059005
90069006 // move alive particles in a spiral motion (or almost straight in fast starfield mode)
9007+ int32_t centerx = PartSys->maxX >> 1 ; // center of matrix in subpixel coordinates
9008+ int32_t centery = PartSys->maxY >> 1 ;
9009+ if (SEGMENT.check2 ) { // starfield mode
9010+ PartSys->setKillOutOfBounds (true );
9011+ PartSys->sources [0 ].var = 7 ; // emiting variation
9012+ PartSys->sources [0 ].source .x = centerx; // set emitter to center
9013+ PartSys->sources [0 ].source .y = centery;
9014+ }
9015+ else {
9016+ PartSys->setKillOutOfBounds (false );
9017+ PartSys->sources [0 ].var = 1 ; // emiting variation
9018+ }
90079019 for (uint32_t i = 0 ; i < PartSys->usedParticles ; i++) { // check all particles
90089020 if (PartSys->particles [i].ttl == 0 ) continue ; // skip dead particles
9009-
9010- int32_t centerx = PartSys->maxX >> 1 ; // center of matrix in subpixel coordinates
9011- int32_t centery = PartSys->maxY >> 1 ;
90129021 // (dx/dy): vector pointing from particle to center
9013- int32_t dx = centerx - PartSys->particles [i].x ;
9014- int32_t dy = centery - PartSys->particles [i].y ;
9022+ int32_t dx = centerx - PartSys->particles [i].x ;
9023+ int32_t dy = centery - PartSys->particles [i].y ;
90159024 // speed towards center:
9016- int32_t distance = sqrt32_bw (dx * dx + dy * dy); // absolute distance to center
9025+ int32_t distance = sqrt32_bw (dx * dx + dy * dy); // absolute distance to center
90179026 if (distance < 20 ) distance = 20 ; // avoid division by zero, keep a minimum
9018- int32_t speedfactor;
9027+ int32_t speedfactor;
90199028 if (SEGMENT.check2 ) { // starfield mode
9020- PartSys->setKillOutOfBounds (true );
9021- PartSys->sources [0 ].var = 7 ; // emiting variation
9022- PartSys->sources [0 ].source .x = PartSys->maxX >> 1 ; // set emitter to center
9023- PartSys->sources [0 ].source .y = PartSys->maxY >> 1 ;
90249029 speedfactor = 1 + (1 + (SEGMENT.speed >> 1 )) * distance; // speed increases towards edge
9030+ // apply velocity
90259031 PartSys->particles [i].x += (-speedfactor * dx) / 400000 - (dy >> 6 );
90269032 PartSys->particles [i].y += (-speedfactor * dy) / 400000 + (dx >> 6 );
90279033 }
90289034 else {
9029- PartSys->setKillOutOfBounds (false );
9030- PartSys->sources [0 ].var = 1 ; // emiting variation
90319035 speedfactor = 2 + (((50 + SEGMENT.speed ) << 6 ) / distance); // speed increases towards center
90329036 // rotate clockwise
90339037 int32_t tempVx = (-speedfactor * dy); // speed is orthogonal to center vector
0 commit comments