45const std::array<const GoomState,STATES_NB>
kStates {{
46 {1,0,0,1,4, 000, 100},
47 {1,0,0,1,1, 101, 140},
48 {1,0,0,1,2, 141, 200},
49 {0,1,0,1,2, 201, 260},
50 {0,1,0,1,0, 261, 330},
51 {0,1,1,1,4, 331, 400},
52 {0,0,1,1,5, 401, 450},
64void choose_a_goom_line (
float *param1,
float *param2,
int *couleur,
int *mode,
float *amplitude,
int far);
66void goom_init (uint32_t resx, uint32_t resy,
int cinemascope) {
68 printf (
"GOOM: init (%d, %d);\n", resx, resy);
82 pixel = (uint32_t *) malloc ((
buffsize *
sizeof (uint32_t)) + 128);
83 back = (uint32_t *) malloc ((
buffsize *
sizeof (uint32_t)) + 128);
87 p1 = (uint32_t *) ((1 + ((uintptr_t) (
pixel)) / 128) * 128);
88 p2 = (uint32_t *) ((1 + ((uintptr_t) (
back)) / 128) * 128);
116 pixel = (uint32_t *) malloc ((
buffsize *
sizeof (uint32_t)) + 128);
118 back = (uint32_t *) malloc ((
buffsize *
sizeof (uint32_t)) + 128);
120 p1 = (uint32_t *) ((1 + ((uintptr_t) (
pixel)) / 128) * 128);
121 p2 = (uint32_t *) ((1 + ((uintptr_t) (
back)) / 128) * 128);
130 static int s_lockVar = 0;
131 static int s_totalGoom = 0;
132 static int s_aGoom = 0;
133 static int s_aBigGoom = 0;
134 static int s_speedVar = 0;
137 static constexpr int DRAWLINES { 80 };
138 static int s_lineMode = DRAWLINES;
139 static int s_nombreCddc = 0;
140 static int s_accelVar=0;
141 static int s_stopLines = 0;
144 static int s_ifsIncr = 1;
145 static int s_decayIfs = 0;
146 static int s_recayIfs = 0;
148 static constexpr float SWITCHMULT { 29.0F/30.0F };
149 static constexpr int SWITCHINCR { 0x7f };
150 static float s_switchMult = 1.0F;
151 static int s_switchIncr = SWITCHINCR;
153 static char s_goomLimit = 2;
157 0, 0,
false,
false, 0
163 uint32_t pointWidth = (
resolx * 2) / 5;
164 uint32_t pointHeight = ((
c_resoly) * 2) / 5;
168 for (
int i = 0; i < 512; i++) {
169 incvar = std::max<int>(incvar, data[0][i]);
173 s_accelVar = incvar / 1000;
175 if (s_speedVar > 5) {
179 s_speedVar = std::min(s_speedVar, 40);
186 s_speedVar += (s_speedVar + (i/2));
188 if ((s_speedVar) && (
cycle%9==0)) {
191 if ((s_speedVar) && (
cycle%5==0)) {
192 s_speedVar = (s_speedVar*7)/8;
201 float largfactor = ((float) s_speedVar / 40.0F + (
float) incvar / 50000.0F) / 1.5F;
202 largfactor = std::min(largfactor, 1.5F);
214 if ((s_recayIfs == 0)&&(s_ifsIncr<=0))
222 for (i = 1; i * 15 <= s_speedVar + 15; i++) {
223 static int s_loopVar = 0;
224 s_loopVar += (s_speedVar*2/3) + 1;
227 (((pointWidth - 6.0F) * largfactor) + 5.0F),
228 (((pointHeight - 6.0F) * largfactor) + 5.0F),
229 i * 152.0F, 128.0F, s_loopVar + (i * 2032));
231 (((pointWidth / 2.0F) * largfactor) / i) + (10.0F * i),
232 (((pointHeight / 2.0F) * largfactor) / i) + (10.0F * i),
233 96.0F, i * 80.0F, s_loopVar / i);
235 (((pointHeight / 3.0F + 5.0F) * largfactor) / i) + (10.0F * i),
236 (((pointHeight / 3.0F + 5.0F) * largfactor) / i) + (10.0F * i),
237 i + 122.0F, 134.0F, s_loopVar / i);
239 (((pointHeight / 3.0F) * largfactor) + 20.0F),
240 (((pointHeight / 3.0F) * largfactor) + 20.0F),
241 58.0F, i * 66.0F, s_loopVar / i);
243 (pointHeight * largfactor + 10.0F * i) / i,
244 (pointHeight * largfactor + 10.0F * i) / i,
245 66.0F, 74.0F, s_loopVar + (i * 500)); }
255 if (forceMode != 0) {
256 printf (
"forcemode = %d\n", forceMode);
274 if (--s_aBigGoom < 0)
277 if ((!s_aBigGoom) && (s_speedVar > 4) && (s_goomLimit > 4) &&
278 ((s_accelVar > (s_goomLimit*9/8)+7)||(s_accelVar < (-s_goomLimit*9/8)-7))) {
279 static int s_couleur =
286 for (
int j=0;j<size;j++)
291 if ((s_accelVar > s_goomLimit) || (s_accelVar < -s_goomLimit) || (forceMode > 0)
386 if (s_lockVar == 0) {
389 if ((s_accelVar > s_goomLimit) || (s_accelVar < -s_goomLimit)) {
390 static int s_rndn = 0;
391 static int s_blocker = 0;
404 auto goodstate = [&](
auto state)
405 {
return (s_rndn >= state.m_rangeMin) &&
406 (s_rndn <= state.m_rangeMax); };
422 s_lineMode = DRAWLINES;
428 uint32_t newvit =
STOP_SPEED + 1 - (4.0F * log10f(s_speedVar+1));
531 if (newvit < (uint32_t)s_zfd.
vitesse)
547 if (s_lockVar > 150) {
548 s_switchIncr = SWITCHINCR;
559 s_switchIncr = SWITCHINCR;
594 if ((forceMode > 0) && (forceMode <=
NB_FX)) {
596 pzfd->
mode = forceMode - 1;
599 if (forceMode == -1) {
606 if (pzfd !=
nullptr) {
607 static int s_exvit = 128;
611 s_switchIncr = SWITCHINCR;
613 int dif = s_zfd.
vitesse - s_exvit;
618 s_switchIncr *= (dif + 2) / 2;
623 if (((s_accelVar > s_goomLimit) && (s_totalGoom < 2)) || (forceMode > 0)) {
625 s_switchMult = SWITCHMULT;
641 printf (
"GOOM: pzfd->mode = %d\n", pzfd->
mode);
718 float amplitude = NAN;
727 s_stopLines &= 0x0fff;
733 if (s_lineMode != DRAWLINES) {
735 if (s_lineMode == -1)
744 if ((
cycle % 120 == 0)
748 s_lineMode = DRAWLINES;
749 else if (s_lineMode == DRAWLINES) {
752 float amplitude = NAN;
760 couleur2 = 5-couleur1;
775 if ((s_lineMode != 0) || (s_aGoom > 15)) {
782 && ((s_lineMode == 0) || (s_lineMode == DRAWLINES))) {
785 float amplitude = NAN;
791 couleur2 = 5-couleur1;
803 uint32_t *return_val =
p1;
816 if (s_totalGoom > 4) {
819 if (s_totalGoom > 7) {
823 if ((s_totalGoom == 0) && (s_goomLimit > 1))
825 if ((s_totalGoom == 1) && (s_goomLimit > 1))
833 if (
pixel !=
nullptr)
845void choose_a_goom_line (
float *param1,
float *param2,
int *couleur,
int *mode,
float *amplitude,
int far) {
851 *param1 = *param2 = 0.47F;
856 *param1 = *param2 = 0;
864 *param1 = *param2 =
c_resoly * 0.35F;
873 *param1 = *param2 =
c_resoly / 2.0F;
880 *param2 = 6.0F *
resolx / 7.0F;
883 *param1 = *param2 =
resolx / 2.0F;
void zoomFilterFastRGB(unsigned int *pix1, unsigned int *pix2, ZoomFilterData *zf, unsigned int resx, unsigned int resy, int switchIncr, float switchMult)
void pointFilter(unsigned int *pix1, Color c, float t1, float t2, float t3, float t4, unsigned int cycle)
#define CRYSTAL_BALL_MODE
uint32_t * goom_update(GoomDualData &data, int forceMode)
void goom_init(uint32_t resx, uint32_t resy, int cinemascope)
void goom_set_resolution(uint32_t resx, uint32_t resy, int cinemascope)
static constexpr size_t STATES_NB
static constexpr int16_t TIME_BTW_CHG
const GoomState * curGState
void choose_a_goom_line(float *param1, float *param2, int *couleur, int *mode, float *amplitude, int far)
const std::array< const GoomState, STATES_NB > kStates
static constexpr int32_t STOP_SPEED
static constexpr uint16_t STATES_RANGEMAX
static uint32_t * pixel
--------------------------------------------------—**
std::array< GoomSingleData, 2 > GoomDualData
#define ROUGE
position des composantes
void init_ifs(int width, int height)
void ifs_update(uint32_t *data, const uint32_t *back, int width, int height, int increment)
void goom_lines_set_res(GMLine *gml, int rx, int ry)
GMLine * goom_lines_init(int rx, int ry, int IDsrc, float paramS, int coulS, int IDdest, float paramD, int coulD)
void goom_lines_switch_to(GMLine *gml, int IDdest, float param, float amplitude, int col)
void goom_lines_draw(GMLine *line, const GoomSingleData &data, unsigned int *p)
void goom_lines_free(GMLine **l)
Convenience inline random number generator functions.
int MythRandomTriangularInt(int x)
Generate a random signed int over a symmetric triangular distribution with a minimum of -x,...
int MythRandomInt(int min, int max)
generate a uniformly distributed random signed int in the closed interval [min, max].
uint32_t MythRandom()
generate 32 random bits
bool rand_bool(uint32_t chance=2)
return a random bool with P(true) = 1/chance
static eu8 clamp(eu8 value, eu8 low, eu8 high)
void tentacle_update(int *buf, int *back, int W, int H, GoomDualData &data, float rapport, int drawit)