23 #define STOP_SPEED 128
25 #define TIME_BTW_CHG 300
48 #define STATES_RANGEMAX 510
49 const std::array<const GoomState,STATES_NB>
kStates {{
50 {1,0,0,1,4, 000, 100},
51 {1,0,0,1,1, 101, 140},
52 {1,0,0,1,2, 141, 200},
53 {0,1,0,1,2, 201, 260},
54 {0,1,0,1,0, 261, 330},
55 {0,1,1,1,4, 331, 400},
56 {0,0,1,1,5, 401, 450},
68 void choose_a_goom_line (
float *param1,
float *param2,
int *couleur,
int *mode,
float *amplitude,
int far);
72 printf (
"GOOM: init (%d, %d);\n", resx, resy);
89 srand ((uintptr_t)
pixel);
91 for (
int i = 0; i <
NB_RAND; i++)
140 static int s_lockVar = 0;
141 static int s_totalGoom = 0;
142 static int s_aGoom = 0;
143 static int s_aBigGoom = 0;
144 static int s_speedVar = 0;
149 static int s_nombreCddc = 0;
150 static int s_accelVar=0;
151 static int s_stopLines = 0;
154 static int s_ifsIncr = 1;
155 static int s_decayIfs = 0;
156 static int s_recayIfs = 0;
158 #define SWITCHMULT (29.0F/30.0F)
159 #define SWITCHINCR 0x7f
160 static float s_switchMult = 1.0F;
163 static char s_goomLimit = 2;
167 0, 0,
false,
false, 0
178 for (
int i = 0; i < 512; i++) {
179 if (incvar < data[0][i])
184 s_accelVar = incvar / 1000;
186 if (s_speedVar > 5) {
198 s_speedVar += (s_speedVar + i/2);
200 if ((s_speedVar) && (
cycle%9==0)) {
203 if ((s_speedVar) && (
cycle%5==0)) {
204 s_speedVar = (s_speedVar*7)/8;
216 float largfactor = ((float) s_speedVar / 40.0F + (
float) incvar / 50000.0F) / 1.5F;
217 if (largfactor > 1.5F)
230 if ((s_recayIfs == 0)&&(s_ifsIncr<=0))
238 for (i = 1; i * 15 <= s_speedVar + 15; i++) {
239 static int s_loopVar = 0;
240 s_loopVar += s_speedVar*2/3 + 1;
243 ((pointWidth - 6.0F) * largfactor + 5.0F),
244 ((pointHeight - 6.0F) * largfactor + 5.0F),
245 i * 152.0F, 128.0F, s_loopVar + i * 2032);
247 ((pointWidth / 2.0F) * largfactor) / i + 10.0F * i,
248 ((pointHeight / 2.0F) * largfactor) / i + 10.0F * i,
249 96.0F, i * 80.0F, s_loopVar / i);
251 ((pointHeight / 3.0F + 5.0F) * largfactor) / i + 10.0F * i,
252 ((pointHeight / 3.0F + 5.0F) * largfactor) / i + 10.0F * i,
253 i + 122.0F, 134.0F, s_loopVar / i);
255 ((pointHeight / 3.0F) * largfactor + 20.0F),
256 ((pointHeight / 3.0F) * largfactor + 20.0F),
257 58.0F, i * 66.0F, s_loopVar / i);
259 (pointHeight * largfactor + 10.0F * i) / i,
260 (pointHeight * largfactor + 10.0F * i) / i,
261 66.0F, 74.0F, s_loopVar + i * 500); }
271 if (forceMode != 0) {
272 printf (
"forcemode = %d\n", forceMode);
290 if (--s_aBigGoom < 0)
293 if ((!s_aBigGoom) && (s_speedVar > 4) && (s_goomLimit > 4) &&
294 ((s_accelVar > s_goomLimit*9/8+7)||(s_accelVar < -s_goomLimit*9/8-7))) {
295 static int s_couleur =
302 for (
int j=0;j<size;j++)
307 if ((s_accelVar > s_goomLimit) || (s_accelVar < -s_goomLimit) || (forceMode > 0)
320 switch (
iRAND (32)) {
326 [[clang::fallthrough]];
402 if (s_lockVar == 0) {
405 if ((s_accelVar > s_goomLimit) || (s_accelVar < -s_goomLimit)) {
406 static int s_rndn = 0;
407 static int s_blocker = 0;
410 if ((!s_blocker)&&(
iRAND(3))) {
414 else if (s_blocker) s_blocker--;
417 auto goodstate = [&](
auto state)
418 {
return (s_rndn >= state.m_rangeMin) &&
419 (s_rndn <= state.m_rangeMax); };
445 if ((s_zfd.
reverse) && (!(
cycle % 13)) && (rand () % 5 == 0)) {
450 if (
iRAND (10) == 0) {
461 switch (
iRAND (25)) {
570 if (s_lockVar > 150) {
576 if (
iRAND (700) == 0) {
617 if ((forceMode > 0) && (forceMode <=
NB_FX)) {
619 pzfd->
mode = forceMode - 1;
622 if (forceMode == -1) {
629 if (pzfd !=
nullptr) {
630 static int s_exvit = 128;
636 int dif = s_zfd.
vitesse - s_exvit;
641 s_switchIncr *= (dif + 2) / 2;
646 if (((s_accelVar > s_goomLimit) && (s_totalGoom < 2)) || (forceMode > 0)) {
662 printf (
"GOOM: pzfd->mode = %d\n", pzfd->
mode);
739 float amplitude = NAN;
748 s_stopLines &= 0x0fff;
756 if (s_lineMode == -1)
763 if ((
cycle % 120 == 0)
771 float amplitude = NAN;
779 couleur2 = 5-couleur1;
794 if ((s_lineMode != 0) || (s_aGoom > 15)) {
801 && ((s_lineMode == 0) || (s_lineMode ==
DRAWLINES))) {
804 float amplitude = NAN;
810 couleur2 = 5-couleur1;
835 if (s_totalGoom > 4) {
838 if (s_totalGoom > 7) {
842 if ((s_totalGoom == 0) && (s_goomLimit > 1))
844 if ((s_totalGoom == 1) && (s_goomLimit > 1))
852 if (
pixel !=
nullptr)
865 void choose_a_goom_line (
float *param1,
float *param2,
int *couleur,
int *mode,
float *amplitude,
int far) {
871 *param1 = *param2 = 0.47F;
875 if (
iRAND (3) == 0) {
876 *param1 = *param2 = 0;
879 else if (
iRAND (2)) {
884 *param1 = *param2 =
c_resoly * 0.35;
888 if (
iRAND (4) || far) {
893 *param1 = *param2 =
c_resoly / 2.0F;
898 if (
iRAND (3) || far) {
900 *param2 = 6.0F *
resolx / 7.0F;
903 *param1 = *param2 =
resolx / 2.0F;
909 *couleur =
iRAND (6);
979 static std::random_device rd;
980 static std::mt19937 mt(rd());