define COLOR_CYCLING_SPEED_MAX

This commit is contained in:
Thomas Bernard 2018-12-15 20:19:29 +01:00
parent 9c2cd926f1
commit 5a6333e5e8
5 changed files with 27 additions and 16 deletions

View File

@ -1596,11 +1596,13 @@ void Load_IFF(T_IO_Context * context)
}
else
{
word speed;
context->Cycle_range[context->Color_cycles].Start=min_col;
context->Cycle_range[context->Color_cycles].End=max_col;
context->Cycle_range[context->Color_cycles].Inverse=(flags&2)?1:0;
context->Cycle_range[context->Color_cycles].Speed=(flags&1) ? rate/78 : 0;
speed = (flags&1) ? rate/78 : 0;
context->Cycle_range[context->Color_cycles].Speed = (speed > COLOR_CYCLING_SPEED_MAX) ? COLOR_CYCLING_SPEED_MAX : speed;
context->Color_cycles++;
}
}
@ -1680,8 +1682,10 @@ void Load_IFF(T_IO_Context * context)
context->Cycle_range[context->Color_cycles].End = end;
if (direction != 0)
{
dword speed;
context->Cycle_range[context->Color_cycles].Inverse = (~direction >> 15) & 1;
context->Cycle_range[context->Color_cycles].Speed = 3501400 / (seconds * 1000000 + microseconds);
speed = 3501400 / (seconds * 1000000 + microseconds);
context->Cycle_range[context->Color_cycles].Speed = (speed > COLOR_CYCLING_SPEED_MAX) ? COLOR_CYCLING_SPEED_MAX : speed;
}
else
{
@ -4503,7 +4507,10 @@ void Load_GIF(T_IO_Context * context)
&& Read_byte(GIF_file,&(IDB.Indicator))
&& IDB.Image_width && IDB.Image_height)
{
GFX2_Log(GFX2_DEBUG, "GIF Image descriptor %u Pos (%u,%u) %ux%u %s%slocal palette %ubpp\n",
number_LID, IDB.Pos_X, IDB.Pos_Y, IDB.Image_width, IDB.Image_height,
(IDB.Indicator & 0x40) ? "interlaced " : "", (IDB.Indicator & 0x80) ? "" : "no ",
(IDB.Indicator & 7) + 1);
// Palette locale dispo = (IDB.Indicator and $80)
// Image entrelacée = (IDB.Indicator and $40)
// Ordre de classement = (IDB.Indicator and $20)

View File

@ -1200,9 +1200,11 @@ static const T_Help_table helptable_grad_rect[] =
HELP_TEXT ("")
HELP_TEXT ("These options allow you to use animation of")
HELP_TEXT ("colors: Grafx2 will shift palette entries")
HELP_TEXT ("at real-time. Note that only the IFF file")
HELP_TEXT ("format can record these settings, and very")
HELP_TEXT ("few image viewers will play it back.")
HELP_TEXT ("at real-time. We save theses data in IFF,")
HELP_TEXT ("NEO and Degas Elite formats. Also in non")
HELP_TEXT ("standard extension of PNG and GIF files.")
HELP_TEXT ("But very few image viewers will play them")
HELP_TEXT ("back.")
HELP_TEXT ("")
HELP_TEXT ("- Cycling: Activates or desactivates the")
HELP_TEXT ("cycling of colors when you're in the editor.")

View File

@ -48,7 +48,7 @@ typedef struct
byte Start; ///< First color
byte End; ///< Last color
byte Inverse; ///< Boolean, true if the gradient goes in descending order
byte Speed; ///< Frequency of cycling, from 1 (slow) to 64 (fast)
byte Speed; ///< Frequency of cycling, from 1 (slow) to COLOR_CYCLING_SPEED_MAX (fast)
} T_Color_cycle;
typedef struct

View File

@ -1578,12 +1578,12 @@ static void PI1_load_ranges(T_IO_Context * context, const byte * buffer, int siz
// Sanity checks
if (min_col < 256 && max_col < 256 && direction < 3 && (direction == 1 || delay < 128))
{
int speed = 105;
int speed = 1;
if (delay < 128)
speed = 210/(128-delay);
// Grafx2's slider has a limit of 105
if (speed>105)
speed = 105;
// Grafx2's slider has a limit of COLOR_CYCLING_SPEED_MAX
if (speed > COLOR_CYCLING_SPEED_MAX)
speed = COLOR_CYCLING_SPEED_MAX;
context->Cycle_range[context->Color_cycles].Start=min_col;
context->Cycle_range[context->Color_cycles].End=max_col;
context->Cycle_range[context->Color_cycles].Inverse= (direction==0);
@ -2359,9 +2359,9 @@ void Load_NEO(T_IO_Context * context)
if (color_cycling_delay != 0)
context->Cycle_range[context->Color_cycles].Speed = 175 / color_cycling_delay;
else
context->Cycle_range[context->Color_cycles].Speed = 64; // fastest
if (context->Cycle_range[context->Color_cycles].Speed > 64)
context->Cycle_range[context->Color_cycles].Speed = 64;
context->Cycle_range[context->Color_cycles].Speed = COLOR_CYCLING_SPEED_MAX; // fastest
if (context->Cycle_range[context->Color_cycles].Speed > COLOR_CYCLING_SPEED_MAX)
context->Cycle_range[context->Color_cycles].Speed = COLOR_CYCLING_SPEED_MAX;
}
else
context->Cycle_range[context->Color_cycles].Speed = 0; // cycling off

View File

@ -268,9 +268,11 @@ typedef struct
dword Inverse; ///< Boolean, true if the gradient goes in descending order
dword Mix; ///< Amount of randomness to add to the mix (0-255)
dword Technique;///< Gradient technique: 0 (no pattern) 1 (dithering), or 2 (big dithering)
byte Speed; ///< Speed of cycling. 0 for disabled, 1-64 otherwise. 1=>0.2856Hz, 64=>18.28Hz
byte Speed; ///< Speed of cycling. 0 for disabled, max value COLOR_CYCLING_SPEED_MAX. 1=>0.2856Hz, 64=>18.28Hz
} T_Gradient_range;
#define COLOR_CYCLING_SPEED_MAX 250
/// Data for a full set of gradients.
typedef struct
{