|
|
@ -39,43 +39,62 @@ static TQString getSavePath(void)
|
|
|
|
return dirs.saveLocation("data", "noatun/") + "tylerstates";
|
|
|
|
return dirs.saveLocation("data", "noatun/") + "tylerstates";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void save_effect(t_effect *effect)
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQFile file(getSavePath());
|
|
|
|
KDE_EXPORT void save_effect(t_effect *effect)
|
|
|
|
if(!file.open(IO_WriteOnly))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
TQFile file(getSavePath());
|
|
|
|
|
|
|
|
if(!file.open(IO_WriteOnly))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for(unsigned i = 0; i < sizeof(t_effect); i++)
|
|
|
|
for(unsigned i = 0; i < sizeof(t_effect); i++)
|
|
|
|
file.putch( *((byte *)effect + i) );
|
|
|
|
{
|
|
|
|
|
|
|
|
file.putch( *((byte *)effect + i) );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
t_effect effects[100];
|
|
|
|
t_effect effects[100];
|
|
|
|
int nb_effects=0;
|
|
|
|
int nb_effects=0;
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void load_effects()
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQFile file(getDataPath());
|
|
|
|
KDE_EXPORT void load_effects()
|
|
|
|
if(!file.open(IO_ReadOnly))
|
|
|
|
|
|
|
|
exit(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
nb_effects = 0;
|
|
|
|
|
|
|
|
while(!file.atEnd())
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
byte* ptr_effect = (byte *)&effects[nb_effects++];
|
|
|
|
TQFile file(getDataPath());
|
|
|
|
for(i = 0; i < sizeof(t_effect); i++)
|
|
|
|
if(!file.open(IO_ReadOnly))
|
|
|
|
ptr_effect[i] = file.getch();
|
|
|
|
{
|
|
|
|
|
|
|
|
exit(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
nb_effects = 0;
|
|
|
|
|
|
|
|
while(!file.atEnd())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
byte* ptr_effect = (byte *)&effects[nb_effects++];
|
|
|
|
|
|
|
|
for(i = 0; i < sizeof(t_effect); i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ptr_effect[i] = file.getch();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void load_random_effect(t_effect *effect)
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(nb_effects > 0)
|
|
|
|
KDE_EXPORT void load_random_effect(t_effect *effect)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int num_effect = rand() % nb_effects;
|
|
|
|
if(nb_effects > 0)
|
|
|
|
unsigned int i;
|
|
|
|
{
|
|
|
|
|
|
|
|
int num_effect = rand() % nb_effects;
|
|
|
|
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
|
|
|
|
for(i = 0; i < sizeof(t_effect) ; i++)
|
|
|
|
for(i = 0; i < sizeof(t_effect) ; i++)
|
|
|
|
*((byte*)effect+i)=*((byte*)(&effects[num_effect])+i);
|
|
|
|
{
|
|
|
|
|
|
|
|
*((byte*)effect+i) = *((byte*)(&effects[num_effect])+i);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|