More manual translations, to make the bulk process easier

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@683 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-03-17 19:09:43 +00:00
parent 66f9154548
commit f69cf6b8f7
44 changed files with 954 additions and 959 deletions

22
aide.c
View File

@ -243,7 +243,7 @@ void Afficher_aide(void)
short Repeat_Menu_Facteur_Y;
short Pos_Reel_X;
short Pos_Reel_Y;
byte * Curseur;
byte * char_pixel;
short Largeur; // Largeur physique d'une ligne de texte
char TypeLigne; // N: Normale, T: Titre, S: Sous-titre
// -: Ligne inférieur de sous-titre
@ -310,32 +310,32 @@ void Afficher_aide(void)
if (TypeLigne=='T')
{
if (Ligne[Indice_de_caractere/2]>'_' || Ligne[Indice_de_caractere/2]<' ')
Curseur=&(Fonte_help_norm['!'][0][0]); // Caractère pas géré
char_pixel=&(Fonte_help_norm['!'][0][0]); // Caractère pas géré
else if (Indice_de_caractere & 1)
Curseur=&(Fonte_help_t2[(unsigned char)(Ligne[Indice_de_caractere/2])-' '][0][0]);
char_pixel=&(Fonte_help_t2[(unsigned char)(Ligne[Indice_de_caractere/2])-' '][0][0]);
else
Curseur=&(Fonte_help_t1[(unsigned char)(Ligne[Indice_de_caractere/2])-' '][0][0]);
char_pixel=&(Fonte_help_t1[(unsigned char)(Ligne[Indice_de_caractere/2])-' '][0][0]);
}
else if (TypeLigne=='-')
{
if (Ligne[Indice_de_caractere/2]>'_' || Ligne[Indice_de_caractere/2]<' ')
Curseur=&(Fonte_help_norm['!'][0][0]); // Caractère pas géré
char_pixel=&(Fonte_help_norm['!'][0][0]); // Caractère pas géré
else if (Indice_de_caractere & 1)
Curseur=&(Fonte_help_t4[(unsigned char)(Ligne[Indice_de_caractere/2])-' '][0][0]);
char_pixel=&(Fonte_help_t4[(unsigned char)(Ligne[Indice_de_caractere/2])-' '][0][0]);
else
Curseur=&(Fonte_help_t3[(unsigned char)(Ligne[Indice_de_caractere/2])-' '][0][0]);
char_pixel=&(Fonte_help_t3[(unsigned char)(Ligne[Indice_de_caractere/2])-' '][0][0]);
}
else if (TypeLigne=='S')
Curseur=&(Fonte_help_bold[(unsigned char)(Ligne[Indice_de_caractere])][0][0]);
char_pixel=&(Fonte_help_bold[(unsigned char)(Ligne[Indice_de_caractere])][0][0]);
else if (TypeLigne=='N' || TypeLigne=='K')
Curseur=&(Fonte_help_norm[(unsigned char)(Ligne[Indice_de_caractere])][0][0]);
char_pixel=&(Fonte_help_norm[(unsigned char)(Ligne[Indice_de_caractere])][0][0]);
else
Curseur=&(Fonte_help_norm['!'][0][0]); // Un garde-fou en cas de probleme
char_pixel=&(Fonte_help_norm['!'][0][0]); // Un garde-fou en cas de probleme
for (X=0;X<6;X++)
for (Repeat_Menu_Facteur_X=0;Repeat_Menu_Facteur_X<Menu_Facteur_X;Repeat_Menu_Facteur_X++)
{
byte Couleur = *(Curseur+X+Y*6);
byte Couleur = *(char_pixel+X+Y*6);
byte Repetition = Pixel_width-1;
// Surlignement pour liens
if (TypeLigne=='K' && Indice_de_caractere>=Position_lien

104
boutons.c
View File

@ -530,7 +530,7 @@ void Bouton_Clear_colore(void)
}
//---------- Menu dans lequel on tagge des couleurs (genre Stencil) ----------
void Menu_Tag_couleurs(char * En_tete, byte * Table, byte * Mode, byte Cancel, const char *Section_aide)
void Menu_Tag_couleurs(char * En_tete, byte * Table, byte * Mode, byte can_cancel, const char *Section_aide)
{
short Bouton_clicke;
byte Backup_table[256];
@ -540,7 +540,7 @@ void Menu_Tag_couleurs(char * En_tete, byte * Table, byte * Mode, byte Cancel, c
byte Ancien_Mouse_K;
byte Couleur_taggee;
byte Couleur;
byte Click;
byte click;
Ouvrir_fenetre(176,150,En_tete);
@ -548,7 +548,7 @@ void Menu_Tag_couleurs(char * En_tete, byte * Table, byte * Mode, byte Cancel, c
Fenetre_Definir_bouton_palette(6,38); // 1
Fenetre_Definir_bouton_normal( 7, 19,78,14,"Clear" ,1,1,SDLK_c); // 2
Fenetre_Definir_bouton_normal(91, 19,78,14,"Invert",1,1,SDLK_i); // 3
if (Cancel)
if (can_cancel)
{
Fenetre_Definir_bouton_normal(91,129,78,14,"OK" ,0,1,SDLK_RETURN); // 4
Fenetre_Definir_bouton_normal( 7,129,78,14,"Cancel",0,1,TOUCHE_ESC); // 5
@ -610,13 +610,13 @@ void Menu_Tag_couleurs(char * En_tete, byte * Table, byte * Mode, byte Cancel, c
{
case SDLK_BACKQUOTE : // Récupération d'une couleur derrière le menu
case SDLK_COMMA :
Recuperer_couleur_derriere_fenetre(&Couleur,&Click);
if (Click)
Recuperer_couleur_derriere_fenetre(&Couleur,&click);
if (click)
{
Effacer_curseur();
Couleur_taggee=Couleur;
Table[Couleur_taggee]=(Click==A_GAUCHE);
Stencil_Tagger_couleur(Couleur_taggee,(Click==A_GAUCHE)?CM_Noir:CM_Clair);
Table[Couleur_taggee]=(click==A_GAUCHE);
Stencil_Tagger_couleur(Couleur_taggee,(click==A_GAUCHE)?CM_Noir:CM_Clair);
Stencil_Actualiser_couleur(Couleur_taggee);
Afficher_curseur();
Attendre_fin_de_click();
@ -687,7 +687,7 @@ void Bouton_Mask_Menu(void)
//------------------------------- Paramètres ---------------------------------
void Settings_Afficher_config(struct S_Config * Conf)
void Settings_Afficher_config(T_Config * Conf)
#define YES "YES"
#define NO " NO"
{
@ -749,7 +749,7 @@ void Settings_Afficher_config(struct S_Config * Conf)
Afficher_curseur();
}
void Settings_Sauver_config(struct S_Config * Conf)
void Settings_Sauver_config(T_Config * Conf)
{
if (Sauver_CFG())
Erreur(0);
@ -758,7 +758,7 @@ void Settings_Sauver_config(struct S_Config * Conf)
Erreur(0);
}
void Settings_Charger_config(struct S_Config * Conf)
void Settings_Charger_config(T_Config * Conf)
{
if (Charger_CFG(0))
Erreur(0);
@ -772,7 +772,7 @@ void Bouton_Settings(void)
int Sensibilite_X;
int Sensibilite_Y;
short Bouton_clicke;
struct S_Config Config_choisie;
T_Config Config_choisie;
char Chaine[3];
byte On_a_recharge_la_config=0;
@ -1888,7 +1888,7 @@ void Bouton_Degrades(void)
byte Premiere_couleur;
byte Derniere_couleur;
byte Couleur;
byte Click;
byte click;
Traiter_pixel_de_degrade=Pixel;
@ -2046,8 +2046,8 @@ void Bouton_Degrades(void)
{
case SDLK_BACKQUOTE : // Récupération d'une couleur derrière le menu
case SDLK_COMMA :
Recuperer_couleur_derriere_fenetre(&Couleur,&Click);
if (Click)
Recuperer_couleur_derriere_fenetre(&Couleur,&click);
if (click)
{
Effacer_curseur();
Couleur_temporaire=Couleur;
@ -2392,7 +2392,7 @@ char * Nom_correspondant_le_mieux_a(char * Nom)
char * Pointeur_Meilleur_nom;
Element_de_liste_de_fileselect * Element_courant;
byte Lettres_identiques=0;
byte Compteur;
byte counter;
strcpy(FFF_Meilleur_nom,Principal_Nom_fichier);
Pointeur_Meilleur_nom=NULL;
@ -2403,10 +2403,10 @@ char * Nom_correspondant_le_mieux_a(char * Nom)
|| (Config.Find_file_fast==(Element_courant->Type+1)) )
{
// On compare et si c'est mieux, on stocke dans Meilleur_nom
for (Compteur=0; Nom[Compteur]!='\0' && tolower(Element_courant->NomComplet[Compteur])==tolower(Nom[Compteur]); Compteur++);
if (Compteur>Lettres_identiques)
for (counter=0; Nom[counter]!='\0' && tolower(Element_courant->NomComplet[counter])==tolower(Nom[counter]); counter++);
if (counter>Lettres_identiques)
{
Lettres_identiques=Compteur;
Lettres_identiques=counter;
strcpy(FFF_Meilleur_nom,Element_courant->NomComplet);
Pointeur_Meilleur_nom=Element_courant->NomComplet;
}
@ -2864,12 +2864,12 @@ byte Bouton_Load_ou_Save(byte Load, byte Image)
if (Config.Bookmark_directory[Bouton_clicke-10])
{
// On enlève les "..." avant l'édition
char Bookmark_label[8+1];
strcpy(Bookmark_label, Config.Bookmark_label[Bouton_clicke-10]);
if (Bookmark_label[7]==CARACTERE_SUSPENSION)
Bookmark_label[7]='\0';
if (Readline_ex(Dropdown_bookmark[Bouton_clicke-10]->Pos_X+3+10,Dropdown_bookmark[Bouton_clicke-10]->Pos_Y+2,Bookmark_label,8,8,0))
strcpy(Config.Bookmark_label[Bouton_clicke-10],Bookmark_label);
char bookmark_label[8+1];
strcpy(bookmark_label, Config.Bookmark_label[Bouton_clicke-10]);
if (bookmark_label[7]==CARACTERE_SUSPENSION)
bookmark_label[7]='\0';
if (Readline_ex(Dropdown_bookmark[Bouton_clicke-10]->Pos_X+3+10,Dropdown_bookmark[Bouton_clicke-10]->Pos_Y+2,bookmark_label,8,8,0))
strcpy(Config.Bookmark_label[Bouton_clicke-10],bookmark_label);
Afficher_bookmark(Dropdown_bookmark[Bouton_clicke-10],Bouton_clicke-10);
Afficher_curseur();
}
@ -3517,11 +3517,11 @@ void Bouton_Reload(void)
void Nom_fichier_backup(char * Nom, char * Nom_backup)
{
short Curseur;
short i;
strcpy(Nom_backup,Nom);
for (Curseur=strlen(Nom)-strlen(Principal_Nom_fichier); Nom_backup[Curseur]!='.'; Curseur++);
Nom_backup[Curseur+1]='\0';
for (i=strlen(Nom)-strlen(Principal_Nom_fichier); Nom_backup[i]!='.'; i++);
Nom_backup[i+1]='\0';
strcat(Nom_backup,"BAK");
}
@ -4362,7 +4362,7 @@ byte Smooth_Matrice_defaut[4][3][3]=
void Bouton_Smooth_Menu(void)
{
short Bouton_clicke;
short X,Y,I,J;
short X,Y,i,j;
byte Matrice_choisie[3][3];
T_Bouton_special * Matrice_Zone_saisie[3][3];
char Chaine[3];
@ -4376,18 +4376,18 @@ void Bouton_Smooth_Menu(void)
for (X=11,Y=0; Y<4; X+=31,Y++)
{
Fenetre_Definir_bouton_normal(X,22,27,27,"",0,1,SDLK_LAST); // 3,4,5,6
for (J=0; J<3; J++)
for (I=0; I<3; I++)
Print_char_dans_fenetre(X+2+(I<<3),24+(J<<3),'0'+Smooth_Matrice_defaut[Y][I][J],CM_Noir,CM_Clair);
for (j=0; j<3; j++)
for (i=0; i<3; i++)
Print_char_dans_fenetre(X+2+(i<<3),24+(j<<3),'0'+Smooth_Matrice_defaut[Y][i][j],CM_Noir,CM_Clair);
}
Fenetre_Afficher_cadre(6,58, 69,45);
for (J=0; J<3; J++)
for (I=0; I<3; I++)
for (j=0; j<3; j++)
for (i=0; i<3; i++)
{
Matrice_Zone_saisie[I][J]=Fenetre_Definir_bouton_saisie(10+(I*21),62+(J*13),2); // 7..15
Num2str(Matrice_choisie[I][J]=Smooth_Matrice[I][J],Chaine,2);
Fenetre_Contenu_bouton_saisie(Matrice_Zone_saisie[I][J],Chaine);
Matrice_Zone_saisie[i][j]=Fenetre_Definir_bouton_saisie(10+(i*21),62+(j*13),2); // 7..15
Num2str(Matrice_choisie[i][j]=Smooth_Matrice[i][j],Chaine,2);
Fenetre_Contenu_bouton_saisie(Matrice_Zone_saisie[i][j],Chaine);
}
Display_Window(142,109);
@ -4403,17 +4403,17 @@ void Bouton_Smooth_Menu(void)
{
memcpy(Matrice_choisie,Smooth_Matrice_defaut[Bouton_clicke-3],sizeof(Matrice_choisie));
Effacer_curseur();
for (J=0; J<3; J++)
for (I=0; I<3; I++)
for (j=0; j<3; j++)
for (i=0; i<3; i++)
{
Num2str(Matrice_choisie[I][J],Chaine,2);
Fenetre_Contenu_bouton_saisie(Matrice_Zone_saisie[I][J],Chaine);
Num2str(Matrice_choisie[i][j],Chaine,2);
Fenetre_Contenu_bouton_saisie(Matrice_Zone_saisie[i][j],Chaine);
}
Afficher_curseur();
}
else
{
I=Bouton_clicke-7; X=I%3; Y=I/3;
i=Bouton_clicke-7; X=i%3; Y=i/3;
Num2str(Matrice_choisie[X][Y],Chaine,2);
Readline(Matrice_Zone_saisie[X][Y]->Pos_X+2,
Matrice_Zone_saisie[X][Y]->Pos_Y+2,
@ -4776,7 +4776,7 @@ void Bouton_Spray_Menu(void)
word Ancien_Mouse_Y;
byte Ancien_Mouse_K;
byte Couleur;
byte Click;
byte click;
memcpy(Old_Spray_Multi_flow,Spray_Multi_flow,256);
@ -5030,15 +5030,15 @@ void Bouton_Spray_Menu(void)
{
case SDLK_BACKQUOTE : // Récupération d'une couleur derrière le menu
case SDLK_COMMA :
Recuperer_couleur_derriere_fenetre(&Couleur,&Click);
if (Click)
Recuperer_couleur_derriere_fenetre(&Couleur,&click);
if (click)
{
Effacer_curseur();
Stencil_Tagger_couleur(Couleur_selectionnee,(Spray_Multi_flow[Couleur_selectionnee])?CM_Noir:CM_Clair);
Stencil_Actualiser_couleur(Couleur_selectionnee);
// Mettre la couleur sélectionnée à jour suivant le click
Couleur_selectionnee=Couleur;
if (Click==2)
if (click==2)
Spray_Multi_flow[Couleur_selectionnee]=0;
else
if (Spray_Multi_flow[Couleur_selectionnee]==0)
@ -5669,7 +5669,7 @@ void Bouton_Effets(void)
Afficher_sprite_effet(3,154,96);
Afficher_etat_effets();
Print_dans_fenetre(12,117,"Click: Left:Switch / Right:Edit",CM_Fonce,CM_Clair);
Print_dans_fenetre(12,117,"click: Left:Switch / Right:Edit",CM_Fonce,CM_Clair);
Display_Window(270,152);
Afficher_curseur();
@ -5934,7 +5934,7 @@ void Bouton_Texte()
{
static char Chaine[256]="";
static int Taille_police=32;
static int AntiAlias=1;
static int antialias=1;
static short Debut_liste=0; // Indice de le premiere fonte dans le selector
static short Position_curseur=0; // Indice de la ligne active dans le selector
static short Style_Bold=0;
@ -5964,7 +5964,7 @@ void Bouton_Texte()
Fenetre_Afficher_cadre_creux(182,34,100,68);
Print_dans_fenetre(199,31,"TrueType", CM_Fonce, CM_Clair);
// AA
Fenetre_Definir_bouton_normal(188,58,13,11,AntiAlias?"X":" ",0,1,SDLK_a); // 2
Fenetre_Definir_bouton_normal(188,58,13,11,antialias?"X":" ",0,1,SDLK_a); // 2
Print_dans_fenetre(206,60,"AntiAlias", CM_Fonce, CM_Clair);
// Bold
Fenetre_Definir_bouton_normal(188,72,13,11,Style_Bold?"X":" ",0,1,SDLK_b); // 3
@ -6023,7 +6023,7 @@ void Bouton_Texte()
Bouton_preview->Largeur*Menu_Facteur_X,
Bouton_preview->Hauteur*Menu_Facteur_Y,
CM_Clair);
Nouvelle_Brosse = Rendu_Texte(Chaine_preview, Position_curseur+Debut_liste, Taille_police, AntiAlias, Style_Bold, Style_Italic, &Nouvelle_Largeur, &Nouvelle_Hauteur);
Nouvelle_Brosse = Rendu_Texte(Chaine_preview, Position_curseur+Debut_liste, Taille_police, antialias, Style_Bold, Style_Italic, &Nouvelle_Largeur, &Nouvelle_Hauteur);
if (Nouvelle_Brosse)
{
Affiche_brosse(
@ -6203,9 +6203,9 @@ void Bouton_Texte()
break;
case 2: // AA
AntiAlias = (AntiAlias==0);
antialias = (antialias==0);
Effacer_curseur();
Print_dans_fenetre(191,60,AntiAlias?"X":" ", CM_Noir, CM_Clair);
Print_dans_fenetre(191,60,antialias?"X":" ", CM_Noir, CM_Clair);
A_previsionner=1;
break;
@ -6308,7 +6308,7 @@ void Bouton_Texte()
// On passe en brosse:
Afficher_curseur();
if (AntiAlias || !TrueType_fonte(Position_curseur+Debut_liste))
if (antialias || !TrueType_fonte(Position_curseur+Debut_liste))
Changer_la_forme_du_pinceau(FORME_PINCEAU_BROSSE_COULEUR);
else
Changer_la_forme_du_pinceau(FORME_PINCEAU_BROSSE_MONOCHROME);

View File

@ -622,7 +622,7 @@ void Save_picture(byte Image);
/*!
Generic color tagging menu, for various effects.
*/
void Menu_Tag_couleurs(char * En_tete, byte * Table, byte * Mode, byte Cancel, const char *Section_aide);
void Menu_Tag_couleurs(char * En_tete, byte * Table, byte * Mode, byte can_cancel, const char *Section_aide);
/*!

12
brush.c
View File

@ -1566,7 +1566,7 @@ void Calculer_quad_texture(int X1,int Y1,int Xt1,int Yt1,
void Tourner_brosse(float Angle)
void Tourner_brosse(float angle)
{
byte * New_Brosse;
int New_Brosse_Largeur; // Largeur de la nouvelle brosse
@ -1575,8 +1575,8 @@ void Tourner_brosse(float Angle)
short X1,Y1,X2,Y2,X3,Y3,X4,Y4;
int Debut_X,Fin_X,Debut_Y,Fin_Y;
int Xmin,Xmax,Ymin,Ymax;
float cosA=cos(Angle);
float sinA=sin(Angle);
float cosA=cos(angle);
float sinA=sin(angle);
// Calcul des coordonnées des 4 coins:
// 1 2
@ -1725,12 +1725,12 @@ void Dessiner_quad_texture_preview(int X1,int Y1,int Xt1,int Yt1,
}
void Tourner_brosse_preview(float Angle)
void Tourner_brosse_preview(float angle)
{
short X1,Y1,X2,Y2,X3,Y3,X4,Y4;
int Debut_X,Fin_X,Debut_Y,Fin_Y;
float cosA=cos(Angle);
float sinA=sin(Angle);
float cosA=cos(angle);
float sinA=sin(angle);
// Calcul des coordonnées des 4 coins:
// 1 2

View File

@ -51,13 +51,13 @@ void Etirer_brosse_preview(short X1, short Y1, short X2, short Y2);
/*!
Rotates the brush to the right from the given angle.
*/
void Tourner_brosse(float Angle);
void Tourner_brosse(float angle);
/*!
Stretch the brush to fit the given rectangle.
Uses fast approximation for the preview while changing the angle.
*/
void Tourner_brosse_preview(float Angle);
void Tourner_brosse_preview(float angle);
/*!
Remap the brush palette to the nearest color in the picture one.

View File

@ -343,7 +343,7 @@ void Set_mouse_position(void)
void Remplacer_toutes_les_couleurs_dans_limites(byte * Table_de_remplacement)
{
int Ligne;
int Compteur;
int counter;
byte* Adresse;
byte Ancien;
@ -352,9 +352,9 @@ void Remplacer_toutes_les_couleurs_dans_limites(byte * Table_de_remplacement)
for(Ligne = Limite_Haut;Ligne <= Limite_Bas; Ligne++)
{
// Pour chaque pixel sur la ligne :
for (Compteur = Limite_Gauche;Compteur <= Limite_Droite;Compteur ++)
for (counter = Limite_Gauche;counter <= Limite_Droite;counter ++)
{
Adresse = Principal_Ecran+Ligne*Principal_Largeur_image+Compteur;
Adresse = Principal_Ecran+Ligne*Principal_Largeur_image+counter;
Ancien=*Adresse;
*Adresse = Table_de_remplacement[Ancien];
}
@ -599,14 +599,14 @@ void Zoomer_une_ligne(byte* Ligne_originale, byte* Ligne_zoomee,
word Facteur, word Largeur
)
{
byte Color;
byte color;
word X;
// Pour chaque pixel
for(X=0;X<Largeur;X++){
Color = *Ligne_originale;
color = *Ligne_originale;
memset(Ligne_zoomee,Color,Facteur);
memset(Ligne_zoomee,color,Facteur);
Ligne_zoomee+=Facteur;
Ligne_originale++;
@ -673,15 +673,15 @@ unsigned long Memoire_libre(void)
// Transformer un nombre (entier naturel) en chaîne
void Num2str(dword Nombre,char * Chaine,byte Taille)
void Num2str(dword number,char * Chaine,byte Taille)
{
int Indice;
for (Indice=Taille-1;Indice>=0;Indice--)
{
Chaine[Indice]=(Nombre%10)+'0';
Nombre/=10;
if (Nombre==0)
Chaine[Indice]=(number%10)+'0';
number/=10;
if (number==0)
for (Indice--;Indice>=0;Indice--)
Chaine[Indice]=' ';
}
@ -727,15 +727,15 @@ short Round_div_max(short Numerateur,short Diviseur)
}
// Retourne le minimum entre deux nombres
int Min(int A,int B)
int Min(int a,int b)
{
return (A<B)?A:B;
return (a<b)?a:b;
}
// Retourne le maximum entre deux nombres
int Max(int A,int B)
int Max(int a,int b)
{
return (A>B)?A:B;
return (a>b)?a:b;
}

View File

@ -70,9 +70,6 @@ byte Pixel_dans_cercle(void);
// Cercle_Curseur_Y<0 = en haut) du centre se trouve dans le cercle en
// cours.
byte Bit(byte Octet, byte Rang);
// Extrait un bit d'un certain rang à partir d'un octet.
// Gestion du chrono dans les fileselects
void Initialiser_chrono(dword Delai);
void Tester_chrono(void);
@ -103,15 +100,15 @@ byte Nouvelle_preview; // Bool
unsigned long Memoire_libre(void);
void Num2str(dword Nombre,char * Chaine,byte Taille);
void Num2str(dword number,char * Chaine,byte Taille);
int Str2num(char * Chaine);
short Round(float Valeur);
short Round_max(short Numerateur,short Diviseur);
short Round_div_max(short Numerateur,short Diviseur);
int Min(int A,int B);
int Max(int A,int B);
int Min(int a,int b);
int Max(int a,int b);
char* Libelle_mode(int Mode);
int Conversion_argument_mode(const char *Argument);

View File

@ -27,6 +27,6 @@
#define UNTESTED printf("%s %d %s à tester !\n",__FILE__,__LINE__,__func__);
void Erreur_fonction(int, const char *, int, const char *);
void Erreur_fonction(int error_code, const char *Nom_fichier, int Numero_ligne, const char *Nom_fonction);
#define Erreur(n) Erreur_fonction(n, __FILE__,__LINE__,__func__)

44
files.c
View File

@ -102,7 +102,7 @@ void Detruire_liste_du_fileselect(void)
char * Nom_formate(char * Nom, int Type)
{
static char Resultat[13];
int Curseur;
int c;
int Autre_curseur;
int Pos_DernierPoint;
@ -114,34 +114,34 @@ char * Nom_formate(char * Nom, int Type)
{
// Fichiers ".quelquechose" ou lecteurs: Calé à gauche sur 12 caractères maximum.
strcpy(Resultat," ");
for (Curseur=0;Nom[Curseur]!='\0' && Curseur < 12;Curseur++)
Resultat[Curseur]=Nom[Curseur];
for (c=0;Nom[c]!='\0' && c < 12;c++)
Resultat[c]=Nom[c];
// Un caractère spécial pour indiquer que l'affichage est tronqué
if (Curseur >= 12)
if (c >= 12)
Resultat[11]=CARACTERE_SUSPENSION;
}
else
{
strcpy(Resultat," . ");
// On commence par recopier la partie précédent le point:
for (Curseur=0;( (Nom[Curseur]!='.') && (Nom[Curseur]!='\0') );Curseur++)
for (c=0;( (Nom[c]!='.') && (Nom[c]!='\0') );c++)
{
if (Curseur < 8)
Resultat[Curseur]=Nom[Curseur];
if (c < 8)
Resultat[c]=Nom[c];
}
// Un caractère spécial pour indiquer que l'affichage est tronqué
if (Curseur > 8)
if (c > 8)
Resultat[7]=CARACTERE_SUSPENSION;
// On recherche le dernier point dans le reste du nom
for (Pos_DernierPoint = Curseur; Nom[Curseur]!='\0'; Curseur++)
if (Nom[Curseur]=='.')
Pos_DernierPoint = Curseur;
for (Pos_DernierPoint = c; Nom[c]!='\0'; c++)
if (Nom[c]=='.')
Pos_DernierPoint = c;
// Ensuite on recopie la partie qui suit le point (si nécessaire):
if (Nom[Pos_DernierPoint])
{
for (Curseur = Pos_DernierPoint+1,Autre_curseur=9;Nom[Curseur]!='\0' && Autre_curseur < 12;Curseur++,Autre_curseur++)
Resultat[Autre_curseur]=Nom[Curseur];
for (c = Pos_DernierPoint+1,Autre_curseur=9;Nom[c]!='\0' && Autre_curseur < 12;c++,Autre_curseur++)
Resultat[Autre_curseur]=Nom[c];
}
}
return Resultat;
@ -176,28 +176,28 @@ void Ajouter_element_a_la_liste(char * Nom, int Type)
int VerifieExtension(const char *NomFichier, char * Filtre)
{
int Pos_DernierPoint = -1;
int Curseur = 0;
int c = 0;
if (Filtre[0] == '*')
return 1;
// On recherche la position du dernier . dans le nom
for (Curseur = 0; NomFichier[Curseur]!='\0'; Curseur++)
if (NomFichier[Curseur]=='.')
Pos_DernierPoint = Curseur;
for (c = 0; NomFichier[c]!='\0'; c++)
if (NomFichier[c]=='.')
Pos_DernierPoint = c;
// Fichier sans extension (ca arrive)
if (Pos_DernierPoint == -1)
return (Filtre[0] == '\0');
// Vérification caractère par caractère, case-insensitive.
Curseur = 0;
c = 0;
do
{
if (Filtre[Curseur] != '?' &&
tolower(Filtre[Curseur]) != tolower(NomFichier[Pos_DernierPoint + 1 + Curseur]))
if (Filtre[c] != '?' &&
tolower(Filtre[c]) != tolower(NomFichier[Pos_DernierPoint + 1 + c]))
return 0;
Curseur++;
} while (Filtre[Curseur++] != '\0');
c++;
} while (Filtre[c++] != '\0');
return 1;
}

View File

@ -42,50 +42,7 @@
#include <SDL.h>
#include "struct.h"
GFX2_GLOBAL struct S_Config
{
byte Fonte;
int Lire_les_fichiers_caches;
int Lire_les_repertoires_caches;
// int Lire_les_repertoires_systemes;
byte Afficher_limites_image;
byte Curseur;
byte Maximize_preview;
byte Auto_set_res;
byte Coords_rel;
byte Backup;
byte Adjust_brush_pick;
byte Auto_save;
byte Nb_pages_Undo;
byte Indice_Sensibilite_souris_X;
byte Indice_Sensibilite_souris_Y;
byte Mouse_Facteur_de_correction_X;
byte Mouse_Facteur_de_correction_Y;
byte Mouse_Merge_movement;
byte Valeur_tempo_jauge_gauche;
byte Valeur_tempo_jauge_droite;
long Chrono_delay;
Composantes Coul_menu_pref[4];
int Nb_max_de_vertex_par_polygon;
byte Clear_palette;
byte Set_resolution_according_to;
byte Ratio;
byte Fast_zoom;
byte Find_file_fast;
byte Couleurs_separees;
word Palette_Cells_X;
word Palette_Cells_Y;
byte FX_Feedback;
byte Safety_colors;
byte Opening_message;
byte Clear_with_stencil;
byte Auto_discontinuous;
byte Taille_ecran_dans_GIF;
byte Auto_nb_used;
byte Resolution_par_defaut;
char *Bookmark_directory[NB_BOOKMARKS]; // independant malloc of adaptive size
char Bookmark_label[NB_BOOKMARKS][8+1];
} Config;
GFX2_GLOBAL T_Config Config;
// Tableau des touches spéciales
GFX2_GLOBAL word Config_Touche[NB_TOUCHES_SPECIALES][2];

154
graph.c
View File

@ -1225,15 +1225,13 @@ void Rectifier_coordonnees_a_45_degres(short AX, short AY, short* BX, short* BY)
else if ( tan > 0.4142 && tan < 2.4142)
{
// Cas 2 : dy=dx
int nBY = AY - dx;
*BY = (*BY + nBY)/2;
*BY = (*BY + AY - dx)/2;
*BX = AX + AY - *BY;
}
else if (tan < -0.4142 && tan >= -2.4142)
{
// Cas 8 : dy = -dx
int nBY = AY + dx;
*BY = (*BY + nBY)/2;
*BY = (*BY + AY + dx)/2;
*BX = AX - AY + *BY;
}
else
@ -1321,27 +1319,27 @@ void Tracer_ligne_General(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y, b
void Tracer_ligne_Definitif(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y, byte Couleur)
{
int L = Fin_X-Debut_X, H = Fin_Y - Debut_Y;
int w = Fin_X-Debut_X, h = Fin_Y - Debut_Y;
Pixel_figure=Pixel_figure_Definitif;
Tracer_ligne_General(Debut_X,Debut_Y,Fin_X,Fin_Y,Couleur);
Mettre_Ecran_A_Jour((Debut_X<Fin_X)?Debut_X:Fin_X,(Debut_Y<Fin_Y)?Debut_Y:Fin_Y,abs(L)+1,abs(H)+1);
Mettre_Ecran_A_Jour((Debut_X<Fin_X)?Debut_X:Fin_X,(Debut_Y<Fin_Y)?Debut_Y:Fin_Y,abs(w)+1,abs(h)+1);
}
// -- Tracer la preview d'une ligne --
void Tracer_ligne_Preview(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y,byte Couleur)
{
int L = Fin_X-Debut_X, H = Fin_Y - Debut_Y;
int w = Fin_X-Debut_X, h = Fin_Y - Debut_Y;
Pixel_figure=Pixel_figure_Preview;
Tracer_ligne_General(Debut_X,Debut_Y,Fin_X,Fin_Y,Couleur);
Mettre_Ecran_A_Jour((Debut_X<Fin_X)?Debut_X:Fin_X,(Debut_Y<Fin_Y)?Debut_Y:Fin_Y,abs(L)+1,abs(H)+1);
Mettre_Ecran_A_Jour((Debut_X<Fin_X)?Debut_X:Fin_X,(Debut_Y<Fin_Y)?Debut_Y:Fin_Y,abs(w)+1,abs(h)+1);
}
// -- Tracer la preview d'une ligne en xor --
void Tracer_ligne_Preview_xor(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y,byte Couleur)
{
int L, H;
int w, h;
Pixel_figure=Pixel_figure_Preview_xor;
Tracer_ligne_General(Debut_X,Debut_Y,Fin_X,Fin_Y,Couleur);
if (Debut_X<0)
@ -1352,29 +1350,29 @@ void Tracer_ligne_Preview_xor(short Debut_X,short Debut_Y,short Fin_X,short Fin_
Fin_X=0;
if (Fin_Y<0)
Fin_Y=0;
L = Fin_X-Debut_X;
H = Fin_Y-Debut_Y;
Mettre_Ecran_A_Jour((Debut_X<Fin_X)?Debut_X:Fin_X,(Debut_Y<Fin_Y)?Debut_Y:Fin_Y,abs(L)+1,abs(H)+1);
w = Fin_X-Debut_X;
h = Fin_Y-Debut_Y;
Mettre_Ecran_A_Jour((Debut_X<Fin_X)?Debut_X:Fin_X,(Debut_Y<Fin_Y)?Debut_Y:Fin_Y,abs(w)+1,abs(h)+1);
}
// -- Tracer la preview d'une ligne en xor additif --
void Tracer_ligne_Preview_xorback(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y,byte Couleur)
{
int L = Fin_X-Debut_X, H = Fin_Y - Debut_Y;
int w = Fin_X-Debut_X, h = Fin_Y - Debut_Y;
Pixel_figure=Pixel_figure_Preview_xorback;
Tracer_ligne_General(Debut_X,Debut_Y,Fin_X,Fin_Y,Couleur);
Mettre_Ecran_A_Jour((Debut_X<Fin_X)?Debut_X:Fin_X,(Debut_Y<Fin_Y)?Debut_Y:Fin_Y,abs(L)+1,abs(H)+1);
Mettre_Ecran_A_Jour((Debut_X<Fin_X)?Debut_X:Fin_X,(Debut_Y<Fin_Y)?Debut_Y:Fin_Y,abs(w)+1,abs(h)+1);
}
// -- Effacer la preview d'une ligne --
void Effacer_ligne_Preview(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y)
{
int L = Fin_X-Debut_X, H = Fin_Y - Debut_Y;
int w = Fin_X-Debut_X, h = Fin_Y - Debut_Y;
Pixel_figure=Pixel_figure_Effacer_preview;
Tracer_ligne_General(Debut_X,Debut_Y,Fin_X,Fin_Y,0);
Mettre_Ecran_A_Jour((Debut_X<Fin_X)?Debut_X:Fin_X,(Debut_Y<Fin_Y)?Debut_Y:Fin_Y,abs(L)+1,abs(H)+1);
Mettre_Ecran_A_Jour((Debut_X<Fin_X)?Debut_X:Fin_X,(Debut_Y<Fin_Y)?Debut_Y:Fin_Y,abs(w)+1,abs(h)+1);
}
@ -1469,7 +1467,7 @@ void Tracer_courbe_General(short X1, short Y1,
short X4, short Y4,
byte Couleur)
{
float Delta,T,T2,T3;
float Delta,t,t2,t3;
short X,Y,Old_X,Old_Y;
word i;
int CX[4];
@ -1490,12 +1488,12 @@ void Tracer_courbe_General(short X1, short Y1,
Old_Y=Y1;
Pixel_figure(Old_X,Old_Y,Couleur);
Delta=0.05; // 1.0/20
T=0;
t=0;
for (i=1; i<=20; i++)
{
T=T+Delta; T2=T*T; T3=T2*T;
X=Round(T3*CX[0] + T2*CX[1] + T*CX[2] + CX[3]);
Y=Round(T3*CY[0] + T2*CY[1] + T*CY[2] + CY[3]);
t=t+Delta; t2=t*t; t3=t2*t;
X=Round(t3*CX[0] + t2*CX[1] + t*CX[2] + CX[3]);
Y=Round(t3*CY[0] + t2*CY[1] + t*CY[2] + CY[3]);
Tracer_ligne_General(Old_X,Old_Y,X,Y,Couleur);
Old_X=X;
Old_Y=Y;
@ -2111,7 +2109,7 @@ POLYGON_EDGE * remove_edge(POLYGON_EDGE *list, POLYGON_EDGE *edge)
* number of vertices, then an array containing a series of x, y points
* (a total of vertices*2 values).
*/
void Polyfill_General(int Vertices, short * Points, int Color)
void Polyfill_General(int Vertices, short * Points, int color)
{
short c;
short top = 0x7FFF;
@ -2176,7 +2174,7 @@ void Polyfill_General(int Vertices, short * Points, int Color)
if (Fin_X>Limite_Droite)
Fin_X=Limite_Droite;
for (; Pos_X<=Fin_X; Pos_X++)
Pixel_figure(Pos_X,c,Color);
Pixel_figure(Pos_X,c,color);
edge = edge->next->next;
}
}
@ -2216,12 +2214,12 @@ void Polyfill_General(int Vertices, short * Points, int Color)
}
void Polyfill(int Vertices, short * Points, int Color)
void Polyfill(int Vertices, short * Points, int color)
{
int Indice;
byte *FX_Feedback_Ecran_avant_remplissage;
Pixel_clippe(Points[0],Points[1],Color);
Pixel_clippe(Points[0],Points[1],color);
if (Vertices==1)
{
Mettre_Ecran_A_Jour(Points[0],Points[1],1,1);
@ -2234,7 +2232,7 @@ void Polyfill(int Vertices, short * Points, int Color)
FX_Feedback_Ecran=Ecran_backup;
Pixel_figure=Pixel_clippe;
Polyfill_General(Vertices,Points,Color);
Polyfill_General(Vertices,Points,color);
// Remarque: pour dessiner la bordure avec la brosse en cours au lieu
// d'un pixel de couleur premier-plan, il suffit de mettre ici:
@ -2242,8 +2240,8 @@ void Polyfill(int Vertices, short * Points, int Color)
// Dessin du contour
for (Indice=0; Indice<Vertices-1;Indice+=1)
Tracer_ligne_General(Points[Indice*2],Points[Indice*2+1],Points[Indice*2+2],Points[Indice*2+3],Color);
Tracer_ligne_General(Points[0],Points[1],Points[Indice*2],Points[Indice*2+1],Color);
Tracer_ligne_General(Points[Indice*2],Points[Indice*2+1],Points[Indice*2+2],Points[Indice*2+3],color);
Tracer_ligne_General(Points[0],Points[1],Points[Indice*2],Points[Indice*2+1],color);
// restore de l'etat du FX Feedback
FX_Feedback_Ecran=FX_Feedback_Ecran_avant_remplissage;
@ -2383,7 +2381,7 @@ byte Effet_Shade(word X,word Y,__attribute__((unused)) byte Couleur)
byte Effet_Quick_shade(word X,word Y,byte Couleur)
{
int C=Couleur=Lit_pixel_dans_ecran_feedback(X,Y);
int color=Couleur=Lit_pixel_dans_ecran_feedback(X,Y);
int Sens=(Fore_color<=Back_color);
byte Debut,Fin;
int Largeur;
@ -2399,33 +2397,33 @@ byte Effet_Quick_shade(word X,word Y,byte Couleur)
Fin =Fore_color;
}
if ((C>=Debut) && (C<=Fin) && (Debut!=Fin))
if ((color>=Debut) && (color<=Fin) && (Debut!=Fin))
{
Largeur=1+Fin-Debut;
if ( ((Shade_Table==Shade_Table_gauche) && Sens) || ((Shade_Table==Shade_Table_droite) && (!Sens)) )
C-=Quick_shade_Step%Largeur;
color-=Quick_shade_Step%Largeur;
else
C+=Quick_shade_Step%Largeur;
color+=Quick_shade_Step%Largeur;
if (C<Debut)
if (color<Debut)
switch (Quick_shade_Loop)
{
case MODE_SHADE_NORMAL : return Debut;
case MODE_SHADE_BOUCLE : return (Largeur+C);
case MODE_SHADE_BOUCLE : return (Largeur+color);
default : return Couleur;
}
if (C>Fin)
if (color>Fin)
switch (Quick_shade_Loop)
{
case MODE_SHADE_NORMAL : return Fin;
case MODE_SHADE_BOUCLE : return (C-Largeur);
case MODE_SHADE_BOUCLE : return (color-Largeur);
default : return Couleur;
}
}
return C;
return color;
}
// -- Effet de Tiling --
@ -2440,95 +2438,95 @@ byte Effet_Tiling(word X,word Y,__attribute__((unused)) byte Couleur)
byte Effet_Smooth(word X,word Y,__attribute__((unused)) byte Couleur)
{
int R,V,B;
byte C;
int r,g,b;
byte color;
int Poids,Poids_total;
byte X2=((X+1)<Principal_Largeur_image);
byte Y2=((Y+1)<Principal_Hauteur_image);
// On commence par le pixel central
C=Lit_pixel_dans_ecran_feedback(X,Y);
color=Lit_pixel_dans_ecran_feedback(X,Y);
Poids_total=Smooth_Matrice[1][1];
R=Poids_total*Principal_Palette[C].R;
V=Poids_total*Principal_Palette[C].V;
B=Poids_total*Principal_Palette[C].B;
r=Poids_total*Principal_Palette[color].R;
g=Poids_total*Principal_Palette[color].V;
b=Poids_total*Principal_Palette[color].B;
if (X)
{
C=Lit_pixel_dans_ecran_feedback(X-1,Y);
color=Lit_pixel_dans_ecran_feedback(X-1,Y);
Poids_total+=(Poids=Smooth_Matrice[0][1]);
R+=Poids*Principal_Palette[C].R;
V+=Poids*Principal_Palette[C].V;
B+=Poids*Principal_Palette[C].B;
r+=Poids*Principal_Palette[color].R;
g+=Poids*Principal_Palette[color].V;
b+=Poids*Principal_Palette[color].B;
if (Y)
{
C=Lit_pixel_dans_ecran_feedback(X-1,Y-1);
color=Lit_pixel_dans_ecran_feedback(X-1,Y-1);
Poids_total+=(Poids=Smooth_Matrice[0][0]);
R+=Poids*Principal_Palette[C].R;
V+=Poids*Principal_Palette[C].V;
B+=Poids*Principal_Palette[C].B;
r+=Poids*Principal_Palette[color].R;
g+=Poids*Principal_Palette[color].V;
b+=Poids*Principal_Palette[color].B;
if (Y2)
{
C=Lit_pixel_dans_ecran_feedback(X-1,Y+1);
color=Lit_pixel_dans_ecran_feedback(X-1,Y+1);
Poids_total+=(Poids=Smooth_Matrice[0][2]);
R+=Poids*Principal_Palette[C].R;
V+=Poids*Principal_Palette[C].V;
B+=Poids*Principal_Palette[C].B;
r+=Poids*Principal_Palette[color].R;
g+=Poids*Principal_Palette[color].V;
b+=Poids*Principal_Palette[color].B;
}
}
}
if (X2)
{
C=Lit_pixel_dans_ecran_feedback(X+1,Y);
color=Lit_pixel_dans_ecran_feedback(X+1,Y);
Poids_total+=(Poids=Smooth_Matrice[2][1]);
R+=Poids*Principal_Palette[C].R;
V+=Poids*Principal_Palette[C].V;
B+=Poids*Principal_Palette[C].B;
r+=Poids*Principal_Palette[color].R;
g+=Poids*Principal_Palette[color].V;
b+=Poids*Principal_Palette[color].B;
if (Y)
{
C=Lit_pixel_dans_ecran_feedback(X+1,Y-1);
color=Lit_pixel_dans_ecran_feedback(X+1,Y-1);
Poids_total+=(Poids=Smooth_Matrice[2][0]);
R+=Poids*Principal_Palette[C].R;
V+=Poids*Principal_Palette[C].V;
B+=Poids*Principal_Palette[C].B;
r+=Poids*Principal_Palette[color].R;
g+=Poids*Principal_Palette[color].V;
b+=Poids*Principal_Palette[color].B;
if (Y2)
{
C=Lit_pixel_dans_ecran_feedback(X+1,Y+1);
color=Lit_pixel_dans_ecran_feedback(X+1,Y+1);
Poids_total+=(Poids=Smooth_Matrice[2][2]);
R+=Poids*Principal_Palette[C].R;
V+=Poids*Principal_Palette[C].V;
B+=Poids*Principal_Palette[C].B;
r+=Poids*Principal_Palette[color].R;
g+=Poids*Principal_Palette[color].V;
b+=Poids*Principal_Palette[color].B;
}
}
}
if (Y)
{
C=Lit_pixel_dans_ecran_feedback(X,Y-1);
color=Lit_pixel_dans_ecran_feedback(X,Y-1);
Poids_total+=(Poids=Smooth_Matrice[1][0]);
R+=Poids*Principal_Palette[C].R;
V+=Poids*Principal_Palette[C].V;
B+=Poids*Principal_Palette[C].B;
r+=Poids*Principal_Palette[color].R;
g+=Poids*Principal_Palette[color].V;
b+=Poids*Principal_Palette[color].B;
}
if (Y2)
{
C=Lit_pixel_dans_ecran_feedback(X,Y+1);
color=Lit_pixel_dans_ecran_feedback(X,Y+1);
Poids_total+=(Poids=Smooth_Matrice[1][2]);
R+=Poids*Principal_Palette[C].R;
V+=Poids*Principal_Palette[C].V;
B+=Poids*Principal_Palette[C].B;
r+=Poids*Principal_Palette[color].R;
g+=Poids*Principal_Palette[color].V;
b+=Poids*Principal_Palette[color].B;
}
return (Poids_total)? // On regarde s'il faut éviter le 0/0.
Meilleure_couleur(Round_div(R,Poids_total),
Round_div(V,Poids_total),
Round_div(B,Poids_total)):
Meilleure_couleur(Round_div(r,Poids_total),
Round_div(g,Poids_total),
Round_div(b,Poids_total)):
Lit_pixel_dans_ecran_courant(X,Y); // C'est bien l'écran courant et pas
// l'écran feedback car il s'agit de ne
} // pas modifier l'écran courant.

View File

@ -89,8 +89,8 @@ void Tracer_cercle_degrade (short Centre_X,short Centre_Y,short Rayon,short Ecl
void Tracer_ellipse_degradee(short Centre_X,short Centre_Y,short Rayon_horizontal,short Rayon_vertical,short Eclairage_X,short Eclairage_Y);
void Tracer_rectangle_degrade(short RAX,short RAY,short RBX,short RBY,short VAX,short VAY, short VBX, short VBY);
void Polyfill_General(int Vertices, short * Points, int Color);
void Polyfill(int Vertices, short * Points, int Color);
void Polyfill_General(int Vertices, short * Points, int color);
void Polyfill(int Vertices, short * Points, int color);
// Gestion des backups:
void Download_infos_page_principal(S_Page * Page);

136
init.c
View File

@ -76,7 +76,7 @@ void bstrtostr( BSTR in, STRPTR out, TEXT max );
#endif
// Fonctions de lecture dans la skin de l'interface graphique
void Chercher_bas(SDL_Surface *GUI, int *Debut_X, int *Debut_Y, byte Couleur_neutre,char * Section)
void Chercher_bas(SDL_Surface *gui, int *Debut_X, int *Debut_Y, byte Couleur_neutre,char * Section)
{
byte Couleur;
int Y;
@ -84,21 +84,21 @@ void Chercher_bas(SDL_Surface *GUI, int *Debut_X, int *Debut_Y, byte Couleur_neu
*Debut_X=0;
do
{
Couleur=Sdl_Get_pixel_8(GUI,*Debut_X,Y);
Couleur=Sdl_Get_pixel_8(gui,*Debut_X,Y);
if (Couleur!=Couleur_neutre)
{
*Debut_Y=Y;
return;
}
Y++;
} while (Y<GUI->h);
} while (Y<gui->h);
printf("Error in skin file: Was looking down from %d,%d for a '%s', and reached the end of the image\n",
*Debut_X, *Debut_Y, Section);
Erreur(ERREUR_GUI_CORROMPU);
}
void Chercher_droite(SDL_Surface *GUI, int *Debut_X, int Debut_Y, byte Couleur_neutre, char * Section)
void Chercher_droite(SDL_Surface *gui, int *Debut_X, int Debut_Y, byte Couleur_neutre, char * Section)
{
byte Couleur;
int X;
@ -106,21 +106,21 @@ void Chercher_droite(SDL_Surface *GUI, int *Debut_X, int Debut_Y, byte Couleur_n
do
{
Couleur=Sdl_Get_pixel_8(GUI,X,Debut_Y);
Couleur=Sdl_Get_pixel_8(gui,X,Debut_Y);
if (Couleur!=Couleur_neutre)
{
*Debut_X=X;
return;
}
X++;
} while (X<GUI->w);
} while (X<gui->w);
printf("Error in skin file: Was looking right from %d,%d for a '%s', and reached the edege of the image\n",
*Debut_X, Debut_Y, Section);
Erreur(ERREUR_GUI_CORROMPU);
}
void Lire_bloc(SDL_Surface *GUI, int Debut_X, int Debut_Y, void *Dest, int Largeur, int Hauteur, char * Section, int Type)
void Lire_bloc(SDL_Surface *gui, int Debut_X, int Debut_Y, void *Dest, int Largeur, int Hauteur, char * Section, int Type)
{
// Type: 0 = normal GUI element, only 4 colors allowed
// Type: 1 = mouse cursor, 4 colors allowed + transparent
@ -132,7 +132,7 @@ void Lire_bloc(SDL_Surface *GUI, int Debut_X, int Debut_Y, void *Dest, int Large
byte Couleur;
// Verification taille
if (Debut_Y+Hauteur>=GUI->h || Debut_X+Largeur>=GUI->w)
if (Debut_Y+Hauteur>=gui->h || Debut_X+Largeur>=gui->w)
{
printf("Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but it doesn't fit the image.\n",
Debut_X, Debut_Y, Hauteur, Largeur, Section);
@ -143,7 +143,7 @@ void Lire_bloc(SDL_Surface *GUI, int Debut_X, int Debut_Y, void *Dest, int Large
{
for (X=Debut_X; X<Debut_X+Largeur; X++)
{
Couleur=Sdl_Get_pixel_8(GUI,X,Y);
Couleur=Sdl_Get_pixel_8(gui,X,Y);
if (Type==0 && (Couleur != CM_Noir && Couleur != CM_Fonce && Couleur != CM_Clair && Couleur != CM_Blanc))
{
printf("Error in skin file: Was looking at %d,%d for a %d*%d object (%s) but at %d,%d a pixel was found with color %d which isn't one of the GUI colors (which were detected as %d,%d,%d,%d.\n",
@ -173,12 +173,12 @@ void Lire_bloc(SDL_Surface *GUI, int Debut_X, int Debut_Y, void *Dest, int Large
}
}
void Lire_trame(SDL_Surface *GUI, int Debut_X, int Debut_Y, word *Dest, char * Section)
void Lire_trame(SDL_Surface *gui, int Debut_X, int Debut_Y, word *Dest, char * Section)
{
byte Buffer[256];
int X,Y;
Lire_bloc(GUI, Debut_X, Debut_Y, Buffer, 16, 16, Section, 2);
Lire_bloc(gui, Debut_X, Debut_Y, Buffer, 16, 16, Section, 2);
for (Y=0; Y<16; Y++)
{
@ -196,7 +196,7 @@ void Charger_DAT(void)
{
int Indice;
char Nom_du_fichier[TAILLE_CHEMIN_FICHIER];
SDL_Surface * GUI;
SDL_Surface * gui;
SDL_Palette * SDLPal;
int i;
int Curseur_X=0,Curseur_Y=0;
@ -210,17 +210,17 @@ void Charger_DAT(void)
// Lecture du fichier "skin"
strcpy(Nom_du_fichier,Repertoire_des_donnees);
strcat(Nom_du_fichier,"gfx2gui.gif");
GUI=IMG_Load(Nom_du_fichier);
if (!GUI)
gui=IMG_Load(Nom_du_fichier);
if (!gui)
{
Erreur(ERREUR_GUI_ABSENT);
}
if (!GUI->format || GUI->format->BitsPerPixel != 8)
if (!gui->format || gui->format->BitsPerPixel != 8)
{
printf("Not a 8-bit image");
Erreur(ERREUR_GUI_CORROMPU);
}
SDLPal=GUI->format->palette;
SDLPal=gui->format->palette;
if (!SDLPal || SDLPal->ncolors!=256)
{
printf("Not a 256-color palette");
@ -235,59 +235,59 @@ void Charger_DAT(void)
}
// Carré "noir"
CM_Noir = Sdl_Get_pixel_8(GUI,Curseur_X,Curseur_Y);
CM_Noir = Sdl_Get_pixel_8(gui,Curseur_X,Curseur_Y);
do
{
if (++Curseur_X>=GUI->w)
if (++Curseur_X>=gui->w)
{
printf("Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
Erreur(ERREUR_GUI_CORROMPU);
}
Couleur=Sdl_Get_pixel_8(GUI,Curseur_X,Curseur_Y);
Couleur=Sdl_Get_pixel_8(gui,Curseur_X,Curseur_Y);
} while(Couleur==CM_Noir);
// Carré "foncé"
CM_Fonce=Couleur;
do
{
if (++Curseur_X>=GUI->w)
if (++Curseur_X>=gui->w)
{
printf("Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
Erreur(ERREUR_GUI_CORROMPU);
}
Couleur=Sdl_Get_pixel_8(GUI,Curseur_X,Curseur_Y);
Couleur=Sdl_Get_pixel_8(gui,Curseur_X,Curseur_Y);
} while(Couleur==CM_Fonce);
// Carré "clair"
CM_Clair=Couleur;
do
{
if (++Curseur_X>GUI->w)
if (++Curseur_X>gui->w)
{
printf("Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
Erreur(ERREUR_GUI_CORROMPU);
}
Couleur=Sdl_Get_pixel_8(GUI,Curseur_X,Curseur_Y);
Couleur=Sdl_Get_pixel_8(gui,Curseur_X,Curseur_Y);
} while(Couleur==CM_Clair);
// Carré "blanc"
CM_Blanc=Couleur;
do
{
if (++Curseur_X>=GUI->w)
if (++Curseur_X>=gui->w)
{
printf("Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
Erreur(ERREUR_GUI_CORROMPU);
}
Couleur=Sdl_Get_pixel_8(GUI,Curseur_X,Curseur_Y);
Couleur=Sdl_Get_pixel_8(gui,Curseur_X,Curseur_Y);
} while(Couleur==CM_Blanc);
// Carré "transparent"
CM_Trans=Couleur;
do
{
if (++Curseur_X>=GUI->w)
if (++Curseur_X>=gui->w)
{
printf("Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
Erreur(ERREUR_GUI_CORROMPU);
}
Couleur=Sdl_Get_pixel_8(GUI,Curseur_X,Curseur_Y);
Couleur=Sdl_Get_pixel_8(gui,Curseur_X,Curseur_Y);
} while(Couleur==CM_Trans);
// Reste : couleur neutre
CM_Neutre=Couleur;
@ -295,10 +295,10 @@ void Charger_DAT(void)
Curseur_X=0;
Curseur_Y=1;
while ((Couleur=Sdl_Get_pixel_8(GUI,Curseur_X,Curseur_Y))==CM_Noir)
while ((Couleur=Sdl_Get_pixel_8(gui,Curseur_X,Curseur_Y))==CM_Noir)
{
Curseur_Y++;
if (Curseur_Y>=GUI->h)
if (Curseur_Y>=gui->h)
{
printf("Error in GUI skin file: should start with 5 consecutive squares for black, dark, light, white, transparent, then a neutral color\n");
Erreur(ERREUR_GUI_CORROMPU);
@ -306,18 +306,18 @@ void Charger_DAT(void)
}
// Menu
Chercher_bas(GUI, &Curseur_X, &Curseur_Y, CM_Neutre, "menu");
Lire_bloc(GUI, Curseur_X, Curseur_Y, BLOCK_MENU, LARGEUR_MENU, HAUTEUR_MENU,"menu",0);
Chercher_bas(gui, &Curseur_X, &Curseur_Y, CM_Neutre, "menu");
Lire_bloc(gui, Curseur_X, Curseur_Y, BLOCK_MENU, LARGEUR_MENU, HAUTEUR_MENU,"menu",0);
Curseur_Y+=HAUTEUR_MENU;
// Effets
for (i=0; i<NB_SPRITES_EFFETS; i++)
{
if (i==0)
Chercher_bas(GUI, &Curseur_X, &Curseur_Y, CM_Neutre, "effect sprite");
Chercher_bas(gui, &Curseur_X, &Curseur_Y, CM_Neutre, "effect sprite");
else
Chercher_droite(GUI, &Curseur_X, Curseur_Y, CM_Neutre, "effect sprite");
Lire_bloc(GUI, Curseur_X, Curseur_Y, SPRITE_EFFET[i], LARGEUR_SPRITE_MENU, HAUTEUR_SPRITE_MENU, "effect sprite",0);
Chercher_droite(gui, &Curseur_X, Curseur_Y, CM_Neutre, "effect sprite");
Lire_bloc(gui, Curseur_X, Curseur_Y, SPRITE_EFFET[i], LARGEUR_SPRITE_MENU, HAUTEUR_SPRITE_MENU, "effect sprite",0);
Curseur_X+=LARGEUR_SPRITE_MENU;
}
Curseur_Y+=HAUTEUR_SPRITE_MENU;
@ -326,10 +326,10 @@ void Charger_DAT(void)
for (i=0; i<NB_SPRITES_CURSEUR; i++)
{
if (i==0)
Chercher_bas(GUI, &Curseur_X, &Curseur_Y, CM_Neutre, "mouse cursor");
Chercher_bas(gui, &Curseur_X, &Curseur_Y, CM_Neutre, "mouse cursor");
else
Chercher_droite(GUI, &Curseur_X, Curseur_Y, CM_Neutre, "mouse cursor");
Lire_bloc(GUI, Curseur_X, Curseur_Y, SPRITE_CURSEUR[i], LARGEUR_SPRITE_CURSEUR, HAUTEUR_SPRITE_CURSEUR, "mouse cursor",1);
Chercher_droite(gui, &Curseur_X, Curseur_Y, CM_Neutre, "mouse cursor");
Lire_bloc(gui, Curseur_X, Curseur_Y, SPRITE_CURSEUR[i], LARGEUR_SPRITE_CURSEUR, HAUTEUR_SPRITE_CURSEUR, "mouse cursor",1);
Curseur_X+=LARGEUR_SPRITE_CURSEUR;
}
Curseur_Y+=HAUTEUR_SPRITE_CURSEUR;
@ -338,10 +338,10 @@ void Charger_DAT(void)
for (i=0; i<NB_SPRITES_MENU; i++)
{
if (i==0)
Chercher_bas(GUI, &Curseur_X, &Curseur_Y, CM_Neutre, "menu sprite");
Chercher_bas(gui, &Curseur_X, &Curseur_Y, CM_Neutre, "menu sprite");
else
Chercher_droite(GUI, &Curseur_X, Curseur_Y, CM_Neutre, "menu sprite");
Lire_bloc(GUI, Curseur_X, Curseur_Y, SPRITE_MENU[i], LARGEUR_SPRITE_MENU, HAUTEUR_SPRITE_MENU, "menu sprite",1);
Chercher_droite(gui, &Curseur_X, Curseur_Y, CM_Neutre, "menu sprite");
Lire_bloc(gui, Curseur_X, Curseur_Y, SPRITE_MENU[i], LARGEUR_SPRITE_MENU, HAUTEUR_SPRITE_MENU, "menu sprite",1);
Curseur_X+=LARGEUR_SPRITE_MENU;
}
Curseur_Y+=HAUTEUR_SPRITE_MENU;
@ -354,13 +354,13 @@ void Charger_DAT(void)
{
if (i!=0)
Curseur_Y+=HAUTEUR_PINCEAU;
Chercher_bas(GUI, &Curseur_X, &Curseur_Y, CM_Neutre, "brush icon");
Chercher_bas(gui, &Curseur_X, &Curseur_Y, CM_Neutre, "brush icon");
}
else
{
Chercher_droite(GUI, &Curseur_X, Curseur_Y, CM_Neutre, "brush icon");
Chercher_droite(gui, &Curseur_X, Curseur_Y, CM_Neutre, "brush icon");
}
Lire_bloc(GUI, Curseur_X, Curseur_Y, SPRITE_PINCEAU[i], LARGEUR_PINCEAU, HAUTEUR_PINCEAU, "brush icon",2);
Lire_bloc(gui, Curseur_X, Curseur_Y, SPRITE_PINCEAU[i], LARGEUR_PINCEAU, HAUTEUR_PINCEAU, "brush icon",2);
Curseur_X+=LARGEUR_PINCEAU;
}
Curseur_Y+=HAUTEUR_PINCEAU;
@ -369,10 +369,10 @@ void Charger_DAT(void)
for (i=0; i<NB_SPRITES_DRIVES; i++)
{
if (i==0)
Chercher_bas(GUI, &Curseur_X, &Curseur_Y, CM_Neutre, "sprite drive");
Chercher_bas(gui, &Curseur_X, &Curseur_Y, CM_Neutre, "sprite drive");
else
Chercher_droite(GUI, &Curseur_X, Curseur_Y, CM_Neutre, "sprite drive");
Lire_bloc(GUI, Curseur_X, Curseur_Y, SPRITE_DRIVE[i], LARGEUR_SPRITE_DRIVE, HAUTEUR_SPRITE_DRIVE, "sprite drive",1);
Chercher_droite(gui, &Curseur_X, Curseur_Y, CM_Neutre, "sprite drive");
Lire_bloc(gui, Curseur_X, Curseur_Y, SPRITE_DRIVE[i], LARGEUR_SPRITE_DRIVE, HAUTEUR_SPRITE_DRIVE, "sprite drive",1);
Curseur_X+=LARGEUR_SPRITE_DRIVE;
}
Curseur_Y+=HAUTEUR_SPRITE_DRIVE;
@ -381,18 +381,18 @@ void Charger_DAT(void)
if (!(Logo_GrafX2=(byte *)malloc(231*56)))
Erreur(ERREUR_MEMOIRE);
Chercher_bas(GUI, &Curseur_X, &Curseur_Y, CM_Neutre, "logo menu");
Lire_bloc(GUI, Curseur_X, Curseur_Y, Logo_GrafX2, 231, 56, "logo menu",3);
Chercher_bas(gui, &Curseur_X, &Curseur_Y, CM_Neutre, "logo menu");
Lire_bloc(gui, Curseur_X, Curseur_Y, Logo_GrafX2, 231, 56, "logo menu",3);
Curseur_Y+=56;
// Trames
for (i=0; i<NB_TRAMES_PREDEFINIES; i++)
{
if (i==0)
Chercher_bas(GUI, &Curseur_X, &Curseur_Y, CM_Neutre, "sieve pattern");
Chercher_bas(gui, &Curseur_X, &Curseur_Y, CM_Neutre, "sieve pattern");
else
Chercher_droite(GUI, &Curseur_X, Curseur_Y, CM_Neutre, "sieve pattern");
Lire_trame(GUI, Curseur_X, Curseur_Y, TRAME_PREDEFINIE[i],"sieve pattern");
Chercher_droite(gui, &Curseur_X, Curseur_Y, CM_Neutre, "sieve pattern");
Lire_trame(gui, Curseur_X, Curseur_Y, TRAME_PREDEFINIE[i],"sieve pattern");
Curseur_X+=16;
}
Curseur_Y+=16;
@ -405,13 +405,13 @@ void Charger_DAT(void)
{
if (i!=0)
Curseur_Y+=8;
Chercher_bas(GUI, &Curseur_X, &Curseur_Y, CM_Neutre, "system font");
Chercher_bas(gui, &Curseur_X, &Curseur_Y, CM_Neutre, "system font");
}
else
{
Chercher_droite(GUI, &Curseur_X, Curseur_Y, CM_Neutre, "system font");
Chercher_droite(gui, &Curseur_X, Curseur_Y, CM_Neutre, "system font");
}
Lire_bloc(GUI, Curseur_X, Curseur_Y, &Fonte_systeme[i*64], 8, 8, "system font",2);
Lire_bloc(gui, Curseur_X, Curseur_Y, &Fonte_systeme[i*64], 8, 8, "system font",2);
Curseur_X+=8;
}
Curseur_Y+=8;
@ -425,13 +425,13 @@ void Charger_DAT(void)
{
if (i!=0)
Curseur_Y+=8;
Chercher_bas(GUI, &Curseur_X, &Curseur_Y, CM_Neutre, "fun font");
Chercher_bas(gui, &Curseur_X, &Curseur_Y, CM_Neutre, "fun font");
}
else
{
Chercher_droite(GUI, &Curseur_X, Curseur_Y, CM_Neutre, "fun font");
Chercher_droite(gui, &Curseur_X, Curseur_Y, CM_Neutre, "fun font");
}
Lire_bloc(GUI, Curseur_X, Curseur_Y, &Fonte_fun[i*64], 8, 8, "fun font",2);
Lire_bloc(gui, Curseur_X, Curseur_Y, &Fonte_fun[i*64], 8, 8, "fun font",2);
Curseur_X+=8;
}
Curseur_Y+=8;
@ -444,13 +444,13 @@ void Charger_DAT(void)
{
if (i!=0)
Curseur_Y+=8;
Chercher_bas(GUI, &Curseur_X, &Curseur_Y, CM_Neutre, "help font (norm)");
Chercher_bas(gui, &Curseur_X, &Curseur_Y, CM_Neutre, "help font (norm)");
}
else
{
Chercher_droite(GUI, &Curseur_X, Curseur_Y, CM_Neutre, "help font (norm)");
Chercher_droite(gui, &Curseur_X, Curseur_Y, CM_Neutre, "help font (norm)");
}
Lire_bloc(GUI, Curseur_X, Curseur_Y, &(Fonte_help_norm[i][0][0]), 6, 8, "help font (norm)",0);
Lire_bloc(gui, Curseur_X, Curseur_Y, &(Fonte_help_norm[i][0][0]), 6, 8, "help font (norm)",0);
Curseur_X+=6;
}
Curseur_Y+=8;
@ -463,13 +463,13 @@ void Charger_DAT(void)
{
if (i!=0)
Curseur_Y+=8;
Chercher_bas(GUI, &Curseur_X, &Curseur_Y, CM_Neutre, "help font (bold)");
Chercher_bas(gui, &Curseur_X, &Curseur_Y, CM_Neutre, "help font (bold)");
}
else
{
Chercher_droite(GUI, &Curseur_X, Curseur_Y, CM_Neutre, "help font (bold)");
Chercher_droite(gui, &Curseur_X, Curseur_Y, CM_Neutre, "help font (bold)");
}
Lire_bloc(GUI, Curseur_X, Curseur_Y, &(Fonte_help_bold[i][0][0]), 6, 8, "help font (bold)",0);
Lire_bloc(gui, Curseur_X, Curseur_Y, &(Fonte_help_bold[i][0][0]), 6, 8, "help font (bold)",0);
Curseur_X+=6;
}
Curseur_Y+=8;
@ -483,11 +483,11 @@ void Charger_DAT(void)
{
if (i!=0)
Curseur_Y+=8;
Chercher_bas(GUI, &Curseur_X, &Curseur_Y, CM_Neutre, "help font (title)");
Chercher_bas(gui, &Curseur_X, &Curseur_Y, CM_Neutre, "help font (title)");
}
else
{
Chercher_droite(GUI, &Curseur_X, Curseur_Y, CM_Neutre, "help font (title)");
Chercher_droite(gui, &Curseur_X, Curseur_Y, CM_Neutre, "help font (title)");
}
if (i&1)
@ -501,13 +501,13 @@ void Charger_DAT(void)
else
Dest=&(Fonte_help_t1[Car_1++][0][0]);
Lire_bloc(GUI, Curseur_X, Curseur_Y, Dest, 6, 8, "help font (title)",0);
Lire_bloc(gui, Curseur_X, Curseur_Y, Dest, 6, 8, "help font (title)",0);
Curseur_X+=6;
}
Curseur_Y+=8;
// Terminé: libération de l'image skin
SDL_FreeSurface(GUI);
SDL_FreeSurface(gui);
Section_d_aide_en_cours=0;
Position_d_aide_en_cours=0;
@ -1523,7 +1523,7 @@ void Definir_mode_video(short Largeur,
if (Nb_modes_video >= MAX_MODES_VIDEO-1)
{
DEBUG("Erreur! Tentative de créer un mode de trop! Limite:", MAX_MODES_VIDEO);
DEBUG("Error! Attempt to create too many videomodes. Maximum is:", MAX_MODES_VIDEO);
return;
}
if (!Fullscreen)

28
io.c
View File

@ -65,9 +65,9 @@ int read_byte(FILE *Fichier, byte *Dest)
}
// Ecrit un octet
// Renvoie -1 si OK, 0 en cas d'erreur
int write_byte(FILE *Fichier, byte Byte)
int write_byte(FILE *Fichier, byte b)
{
return fwrite(&Byte, 1, 1, Fichier) == 1;
return fwrite(&b, 1, 1, Fichier) == 1;
}
// Lit des octets
// Renvoie -1 si OK, 0 en cas d'erreur
@ -95,12 +95,12 @@ int read_word_le(FILE *Fichier, word *Dest)
}
// Ecrit un word (little-endian)
// Renvoie -1 si OK, 0 en cas d'erreur
int write_word_le(FILE *Fichier, word Mot)
int write_word_le(FILE *Fichier, word w)
{
#if SDL_BYTEORDER != SDL_LIL_ENDIAN
Mot = SDL_Swap16(Mot);
w = SDL_Swap16(w);
#endif
return fwrite(&Mot, 1, sizeof(word), Fichier) == sizeof(word);
return fwrite(&w, 1, sizeof(word), Fichier) == sizeof(word);
}
// Lit un word (big-endian)
// Renvoie -1 si OK, 0 en cas d'erreur
@ -115,12 +115,12 @@ int read_word_be(FILE *Fichier, word *Dest)
}
// Ecrit un word (big-endian)
// Renvoie -1 si OK, 0 en cas d'erreur
int write_word_be(FILE *Fichier, word Mot)
int write_word_be(FILE *Fichier, word w)
{
#if SDL_BYTEORDER != SDL_BIG_ENDIAN
Mot = SDL_Swap16(Mot);
w = SDL_Swap16(w);
#endif
return fwrite(&Mot, 1, sizeof(word), Fichier) == sizeof(word);
return fwrite(&w, 1, sizeof(word), Fichier) == sizeof(word);
}
// Lit un dword (little-endian)
// Renvoie -1 si OK, 0 en cas d'erreur
@ -135,12 +135,12 @@ int read_dword_le(FILE *Fichier, dword *Dest)
}
// Ecrit un dword (little-endian)
// Renvoie -1 si OK, 0 en cas d'erreur
int write_dword_le(FILE *Fichier, dword Mot)
int write_dword_le(FILE *Fichier, dword dw)
{
#if SDL_BYTEORDER != SDL_LIL_ENDIAN
Mot = SDL_Swap32(Mot);
dw = SDL_Swap32(dw);
#endif
return fwrite(&Mot, 1, sizeof(dword), Fichier) == sizeof(dword);
return fwrite(&dw, 1, sizeof(dword), Fichier) == sizeof(dword);
}
// Lit un dword (big-endian)
@ -156,12 +156,12 @@ int read_dword_be(FILE *Fichier, dword *Dest)
}
// Ecrit un dword (big-endian)
// Renvoie -1 si OK, 0 en cas d'erreur
int write_dword_be(FILE *Fichier, dword Mot)
int write_dword_be(FILE *Fichier, dword dw)
{
#if SDL_BYTEORDER != SDL_BIG_ENDIAN
Mot = SDL_Swap32(Mot);
dw = SDL_Swap32(dw);
#endif
return fwrite(&Mot, 1, sizeof(dword), Fichier) == sizeof(dword);
return fwrite(&dw, 1, sizeof(dword), Fichier) == sizeof(dword);
}
// Détermine la position du dernier '/' ou '\\' dans une chaine,

10
io.h
View File

@ -23,20 +23,20 @@ word endian_magic16(word x);
dword endian_magic32(dword x);
int read_byte(FILE *Fichier, byte *Dest);
int write_byte(FILE *Fichier, byte Byte);
int write_byte(FILE *Fichier, byte b);
int read_bytes(FILE *Fichier, void *Dest, size_t Taille);
int write_bytes(FILE *Fichier, void *Dest, size_t Taille);
int read_word_le(FILE *Fichier, word *Dest);
int write_word_le(FILE *Fichier, word Mot);
int write_word_le(FILE *Fichier, word w);
int read_dword_le(FILE *Fichier, dword *Dest);
int write_dword_le(FILE *Fichier, dword Mot);
int write_dword_le(FILE *Fichier, dword dw);
int read_word_be(FILE *Fichier, word *Dest);
int write_word_be(FILE *Fichier, word Mot);
int write_word_be(FILE *Fichier, word w);
int read_dword_be(FILE *Fichier, dword *Dest);
int write_dword_be(FILE *Fichier, dword Mot);
int write_dword_be(FILE *Fichier, dword dw);
void Extraire_nom_fichier(char *Destination, const char *Source);
void Extraire_chemin(char *Destination, const char *Source);

View File

@ -243,7 +243,7 @@ fonction_afficheur_24b Pixel_Chargement_24b;
// Chargement des pixels dans le buffer 24b
void Pixel_Chargement_dans_buffer_24b(short Pos_X,short Pos_Y,byte R,byte V,byte B)
void Pixel_Chargement_dans_buffer_24b(short Pos_X,short Pos_Y,byte r,byte g,byte b)
{
int index;
@ -251,23 +251,23 @@ void Pixel_Chargement_dans_buffer_24b(short Pos_X,short Pos_Y,byte R,byte V,byte
if ((Pos_X<Principal_Largeur_image) && (Pos_Y<Principal_Hauteur_image))
{
index=(Pos_Y*Principal_Largeur_image)+Pos_X;
Buffer_image_24b[index].R=R;
Buffer_image_24b[index].V=V;
Buffer_image_24b[index].B=B;
Buffer_image_24b[index].R=r;
Buffer_image_24b[index].V=g;
Buffer_image_24b[index].B=b;
}
}
// Chargement des pixels dans la preview en 24b
void Pixel_Chargement_dans_preview_24b(short Pos_X,short Pos_Y,byte R,byte V,byte B)
void Pixel_Chargement_dans_preview_24b(short Pos_X,short Pos_Y,byte r,byte g,byte b)
{
byte Couleur;
if (((Pos_X % Preview_Facteur_X)==0) && ((Pos_Y % Preview_Facteur_Y)==0))
if ((Pos_X<Principal_Largeur_image) && (Pos_Y<Principal_Hauteur_image))
{
Couleur=((R >> 5) << 5) |
((V >> 5) << 2) |
((B >> 6));
Couleur=((r >> 5) << 5) |
((g >> 5) << 2) |
((b >> 6));
Pixel(Preview_Pos_X+(Pos_X/Preview_Facteur_X),
Preview_Pos_Y+(Pos_Y/Preview_Facteur_Y),
Couleur);
@ -1061,7 +1061,7 @@ void Load_PKM(void)
T_Header_PKM Head;
byte Couleur;
byte Octet;
word Mot;
word len;
word Indice;
dword Compteur_de_pixels;
dword Compteur_de_donnees_packees;
@ -1229,12 +1229,12 @@ void Load_PKM(void)
else // ... nombre de pixels tenant sur un word
{
Lire_octet(Fichier, &Couleur);
read_word_be(Fichier, &Mot);
for (Indice=0; Indice<Mot; Indice++)
read_word_be(Fichier, &len);
for (Indice=0; Indice<len; Indice++)
Pixel_de_chargement((Compteur_de_pixels+Indice) % Principal_Largeur_image,
(Compteur_de_pixels+Indice) / Principal_Largeur_image,
Couleur);
Compteur_de_pixels+=Mot;
Compteur_de_pixels+=len;
Compteur_de_donnees_packees+=4;
}
}
@ -1522,90 +1522,90 @@ void Test_LBM(void)
// ---------------- Adapter la palette pour les images HAM ----------------
void Adapter_Palette_HAM(void)
{
short I,J,Temp;
short i,j,Temp;
byte Couleur;
if (Image_HAM==6)
{
for (I=1; I<=14; I++)
for (i=1; i<=14; i++)
{
// On recopie a palette de base
memcpy(Principal_Palette+(I<<4),Principal_Palette,48);
memcpy(Principal_Palette+(i<<4),Principal_Palette,48);
// On modifie les teintes de cette palette
for (J=0; J<16; J++)
for (j=0; j<16; j++)
{
Couleur=(I<<4)+J;
if (I<=7)
Couleur=(i<<4)+j;
if (i<=7)
{
if (I&1)
if (i&1)
{
Temp=Principal_Palette[J].R+16;
Temp=Principal_Palette[j].R+16;
Principal_Palette[Couleur].R=(Temp<63)?Temp:63;
}
if (I&2)
if (i&2)
{
Temp=Principal_Palette[J].V+16;
Temp=Principal_Palette[j].V+16;
Principal_Palette[Couleur].V=(Temp<63)?Temp:63;
}
if (I&4)
if (i&4)
{
Temp=Principal_Palette[J].B+16;
Temp=Principal_Palette[j].B+16;
Principal_Palette[Couleur].B=(Temp<63)?Temp:63;
}
}
else
{
if ((I-7)&1)
if ((i-7)&1)
{
Temp=Principal_Palette[J].R-16;
Temp=Principal_Palette[j].R-16;
Principal_Palette[Couleur].R=(Temp>=0)?Temp:0;
}
if ((I-7)&2)
if ((i-7)&2)
{
Temp=Principal_Palette[J].V-16;
Temp=Principal_Palette[j].V-16;
Principal_Palette[Couleur].V=(Temp>=0)?Temp:0;
}
if ((I-7)&4)
if ((i-7)&4)
{
Temp=Principal_Palette[J].B-16;
Temp=Principal_Palette[j].B-16;
Principal_Palette[Couleur].B=(Temp>=0)?Temp:0;
}
}
}
}
// Ici, il reste les 16 dernières couleurs à modifier
for (I=240,J=0; J<16; I++,J++)
for (i=240,j=0; j<16; i++,j++)
{
Temp=Principal_Palette[J].R+8;
Principal_Palette[I].R=(Temp<63)?Temp:63;
Temp=Principal_Palette[J].V+8;
Principal_Palette[I].V=(Temp<63)?Temp:63;
Temp=Principal_Palette[J].B+8;
Principal_Palette[I].B=(Temp<63)?Temp:63;
Temp=Principal_Palette[j].R+8;
Principal_Palette[i].R=(Temp<63)?Temp:63;
Temp=Principal_Palette[j].V+8;
Principal_Palette[i].V=(Temp<63)?Temp:63;
Temp=Principal_Palette[j].B+8;
Principal_Palette[i].B=(Temp<63)?Temp:63;
}
}
else if (Image_HAM==8)
{
for (I=1; I<=3; I++)
for (i=1; i<=3; i++)
{
// On recopie la palette de base
memcpy(Principal_Palette+(I<<6),Principal_Palette,192);
memcpy(Principal_Palette+(i<<6),Principal_Palette,192);
// On modifie les teintes de cette palette
for (J=0; J<64; J++)
for (j=0; j<64; j++)
{
Couleur=(I<<6)+J;
switch (I)
Couleur=(i<<6)+j;
switch (i)
{
case 1 :
Temp=Principal_Palette[J].R+16;
Temp=Principal_Palette[j].R+16;
Principal_Palette[Couleur].R=(Temp<63)?Temp:63;
break;
case 2 :
Temp=Principal_Palette[J].V+16;
Temp=Principal_Palette[j].V+16;
Principal_Palette[Couleur].V=(Temp<63)?Temp:63;
break;
default:
Temp=Principal_Palette[J].B+16;
Temp=Principal_Palette[j].B+16;
Principal_Palette[Couleur].B=(Temp<63)?Temp:63;
}
}
@ -1613,12 +1613,12 @@ void Test_LBM(void)
}
else // Image 64 couleurs sauvée en 32.
{
for (I=0; I<32; I++)
for (i=0; i<32; i++)
{
J=I+32;
Principal_Palette[J].R=Principal_Palette[I].R>>1;
Principal_Palette[J].V=Principal_Palette[I].V>>1;
Principal_Palette[J].B=Principal_Palette[I].B>>1;
j=i+32;
Principal_Palette[j].R=Principal_Palette[i].R>>1;
Principal_Palette[j].V=Principal_Palette[i].V>>1;
Principal_Palette[j].B=Principal_Palette[i].B>>1;
}
}
}
@ -1758,7 +1758,7 @@ void Load_LBM(void)
dword Taille_image;
short Pos_X;
short Pos_Y;
short Compteur;
short counter;
short Taille_ligne; // Taille d'une ligne en octets
short Vraie_taille_ligne; // Taille d'une ligne en pixels
byte Couleur;
@ -1912,14 +1912,14 @@ void Load_LBM(void)
{
Lire_octet(LBM_Fichier, &Couleur);
B256=(short)(256-Octet);
for (Compteur=0; Compteur<=B256; Compteur++)
for (counter=0; counter<=B256; counter++)
if (Pos_X<Taille_ligne)
LBM_Buffer[Pos_X++]=Couleur;
else
Erreur_fichier=2;
}
else
for (Compteur=0; Compteur<=(short)(Octet); Compteur++)
for (counter=0; counter<=(short)(Octet); counter++)
if (Pos_X<Taille_ligne)
Lire_octet(LBM_Fichier, &(LBM_Buffer[Pos_X++]));
else
@ -1962,11 +1962,11 @@ void Load_LBM(void)
{
Lire_octet(LBM_Fichier, &Couleur);
B256=256-Octet;
for (Compteur=0; Compteur<=B256; Compteur++)
for (counter=0; counter<=B256; counter++)
Pixel_de_chargement(Pos_X++,Pos_Y,Couleur);
}
else
for (Compteur=0; Compteur<=Octet; Compteur++)
for (counter=0; counter<=Octet; counter++)
{
byte Lu=0;
Lire_octet(LBM_Fichier, &Lu);
@ -2302,7 +2302,7 @@ void Load_BMP(void)
short Pos_X;
short Pos_Y;
word Taille_ligne;
byte A,B,C=0;
byte a,b,c=0;
long Taille_du_fichier;
struct stat Informations_Fichier;
@ -2415,15 +2415,15 @@ void Load_BMP(void)
Pos_Y=Principal_Hauteur_image-1;
/*Init_lecture();*/
Lire_octet(Fichier, &A);
Lire_octet(Fichier, &B);
while ( (!Erreur_fichier) && ((A)||(B!=1)) )
Lire_octet(Fichier, &a);
Lire_octet(Fichier, &b);
while ( (!Erreur_fichier) && ((a)||(b!=1)) )
{
if (A) // Encoded mode
for (Indice=1; Indice<=A; Indice++)
Pixel_de_chargement(Pos_X++,Pos_Y,B);
if (a) // Encoded mode
for (Indice=1; Indice<=a; Indice++)
Pixel_de_chargement(Pos_X++,Pos_Y,b);
else // Absolute mode
switch (B)
switch (b)
{
case 0 : // End of line
Pos_X=0;
@ -2432,26 +2432,26 @@ void Load_BMP(void)
case 1 : // End of bitmap
break;
case 2 : // Delta
Lire_octet(Fichier, &A);
Lire_octet(Fichier, &B);
Pos_X+=A;
Pos_Y-=B;
Lire_octet(Fichier, &a);
Lire_octet(Fichier, &b);
Pos_X+=a;
Pos_Y-=b;
break;
default: // Nouvelle série
while (B)
while (b)
{
Lire_octet(Fichier, &A);
Lire_octet(Fichier, &C);
Pixel_de_chargement(Pos_X++,Pos_Y,A);
if (--B)
Lire_octet(Fichier, &a);
Lire_octet(Fichier, &c);
Pixel_de_chargement(Pos_X++,Pos_Y,a);
if (--c)
{
Pixel_de_chargement(Pos_X++,Pos_Y,C);
B--;
Pixel_de_chargement(Pos_X++,Pos_Y,c);
b--;
}
}
}
Lire_octet(Fichier, &A);
Lire_octet(Fichier, &B);
Lire_octet(Fichier, &a);
Lire_octet(Fichier, &b);
}
/*Close_lecture();*/
break;
@ -2461,21 +2461,21 @@ void Load_BMP(void)
Pos_Y=Principal_Hauteur_image-1;
/*Init_lecture();*/
Lire_octet(Fichier, &A);
Lire_octet(Fichier, &B);
while ( (!Erreur_fichier) && ((A)||(B!=1)) )
Lire_octet(Fichier, &a);
Lire_octet(Fichier, &b);
while ( (!Erreur_fichier) && ((a)||(b!=1)) )
{
if (A) // Encoded mode (A fois les 1/2 pixels de B)
for (Indice=1; Indice<=A; Indice++)
if (a) // Encoded mode (A fois les 1/2 pixels de B)
for (Indice=1; Indice<=a; Indice++)
{
if (Indice & 1)
Pixel_de_chargement(Pos_X,Pos_Y,B>>4);
Pixel_de_chargement(Pos_X,Pos_Y,b>>4);
else
Pixel_de_chargement(Pos_X,Pos_Y,B&0xF);
Pixel_de_chargement(Pos_X,Pos_Y,b&0xF);
Pos_X++;
}
else // Absolute mode
switch (B)
switch (b)
{
case 0 : //End of line
Pos_X=0;
@ -2484,32 +2484,32 @@ void Load_BMP(void)
case 1 : // End of bitmap
break;
case 2 : // Delta
Lire_octet(Fichier, &A);
Lire_octet(Fichier, &B);
Pos_X+=A;
Pos_Y-=B;
Lire_octet(Fichier, &a);
Lire_octet(Fichier, &b);
Pos_X+=a;
Pos_Y-=b;
break;
default: // Nouvelle série (B 1/2 pixels bruts)
for (Indice=1; ((Indice<=B) && (!Erreur_fichier)); Indice++,Pos_X++)
for (Indice=1; ((Indice<=b) && (!Erreur_fichier)); Indice++,Pos_X++)
{
if (Indice&1)
{
Lire_octet(Fichier, &C);
Pixel_de_chargement(Pos_X,Pos_Y,C>>4);
Lire_octet(Fichier, &c);
Pixel_de_chargement(Pos_X,Pos_Y,c>>4);
}
else
Pixel_de_chargement(Pos_X,Pos_Y,C&0xF);
Pixel_de_chargement(Pos_X,Pos_Y,c&0xF);
}
// On lit l'octet rendant le nombre d'octets pair, si
// nécessaire. Encore un truc de crétin "made in MS".
if ( ((B&3)==1) || ((B&3)==2) )
if ( ((b&3)==1) || ((b&3)==2) )
{
byte Dummy;
Lire_octet(Fichier, &Dummy);
}
}
Lire_octet(Fichier, &A);
Lire_octet(Fichier, &B);
Lire_octet(Fichier, &a);
Lire_octet(Fichier, &b);
}
/*Close_lecture();*/
}
@ -3234,7 +3234,7 @@ void Save_GIF(void)
byte Block_indicateur; // Code indicateur du type de bloc en cours
word Chaine_en_cours; // Code de la chaîne en cours de traitement
byte Caractere; // Caractère à coder
byte current_char; // Caractère à coder
word Indice; // Indice de recherche de chaîne
@ -3354,14 +3354,14 @@ void Save_GIF(void)
do
{
Caractere=GIF_Pixel_suivant();
current_char=GIF_Pixel_suivant();
// On regarde si dans la table on aurait pas une chaîne
// équivalente à Chaine_en_cours+Caractere
while ( (Indice<Alphabet_Free) &&
( (Chaine_en_cours!=Alphabet_Prefixe[Indice]) ||
(Caractere !=Alphabet_Suffixe[Indice]) ) )
(current_char !=Alphabet_Suffixe[Indice]) ) )
{
Descente=0;
Depart=Indice;
@ -3387,7 +3387,7 @@ void Save_GIF(void)
// On rajoute la chaîne Chaine_en_cours+Caractere à la table
Alphabet_Prefixe[Alphabet_Free ]=Chaine_en_cours;
Alphabet_Suffixe[Alphabet_Free++]=Caractere;
Alphabet_Suffixe[Alphabet_Free++]=current_char;
// On écrit le code dans le fichier
GIF_Set_code(Chaine_en_cours);
@ -3414,8 +3414,8 @@ void Save_GIF(void)
}
// On initialise la Chaine_en_cours et le reste pour la suite
Indice=Alphabet_Fille[Caractere];
Depart=Chaine_en_cours=Caractere;
Indice=Alphabet_Fille[current_char];
Depart=Chaine_en_cours=current_char;
Descente=1;
}
}
@ -3947,7 +3947,7 @@ void Save_PCX(void)
short Taille_ligne;
short Pos_X;
short Pos_Y;
byte Compteur;
byte counter;
byte Last_pixel;
byte Pixel_lu;
@ -4012,16 +4012,16 @@ void Save_PCX(void)
Pos_X++;
Last_pixel=Pixel_lu;
Pixel_lu=Lit_pixel_de_sauvegarde(Pos_X,Pos_Y);
Compteur=1;
while ( (Compteur<63) && (Pos_X<Taille_ligne) && (Pixel_lu==Last_pixel) )
counter=1;
while ( (counter<63) && (Pos_X<Taille_ligne) && (Pixel_lu==Last_pixel) )
{
Compteur++;
counter++;
Pos_X++;
Pixel_lu=Lit_pixel_de_sauvegarde(Pos_X,Pos_Y);
}
if ( (Compteur>1) || (Last_pixel>=0xC0) )
Ecrire_octet(Fichier,Compteur|0xC0);
if ( (counter>1) || (Last_pixel>=0xC0) )
Ecrire_octet(Fichier,counter|0xC0);
Ecrire_octet(Fichier,Last_pixel);
}
@ -4831,10 +4831,10 @@ void Save_SCx(void)
void PI1_8b_to_16p(byte * Src,byte * Dst)
{
int i; // Indice du pixel à calculer
word Mask; // Masque de decodage
word byte_mask; // Masque de decodage
word w0,w1,w2,w3; // Les 4 words bien ordonnés de la source
Mask=0x8000;
byte_mask=0x8000;
w0=(((word)Src[0])<<8) | Src[1];
w1=(((word)Src[2])<<8) | Src[3];
w2=(((word)Src[4])<<8) | Src[5];
@ -4844,11 +4844,11 @@ void PI1_8b_to_16p(byte * Src,byte * Dst)
// Pour décoder le pixel n°i, il faut traiter les 4 words sur leur bit
// correspondant à celui du masque
Dst[i]=((w0 & Mask)?0x01:0x00) |
((w1 & Mask)?0x02:0x00) |
((w2 & Mask)?0x04:0x00) |
((w3 & Mask)?0x08:0x00);
Mask>>=1;
Dst[i]=((w0 & byte_mask)?0x01:0x00) |
((w1 & byte_mask)?0x02:0x00) |
((w2 & byte_mask)?0x04:0x00) |
((w3 & byte_mask)?0x08:0x00);
byte_mask>>=1;
}
}
@ -4857,21 +4857,21 @@ void PI1_8b_to_16p(byte * Src,byte * Dst)
void PI1_16p_to_8b(byte * Src,byte * Dst)
{
int i; // Indice du pixel à calculer
word Mask; // Masque de codage
word byte_mask; // Masque de codage
word w0,w1,w2,w3; // Les 4 words bien ordonnés de la destination
Mask=0x8000;
byte_mask=0x8000;
w0=w1=w2=w3=0;
for (i=0;i<16;i++)
{
// Pour coder le pixel n°i, il faut modifier les 4 words sur leur bit
// correspondant à celui du masque
w0|=(Src[i] & 0x01)?Mask:0x00;
w1|=(Src[i] & 0x02)?Mask:0x00;
w2|=(Src[i] & 0x04)?Mask:0x00;
w3|=(Src[i] & 0x08)?Mask:0x00;
Mask>>=1;
w0|=(Src[i] & 0x01)?byte_mask:0x00;
w1|=(Src[i] & 0x02)?byte_mask:0x00;
w2|=(Src[i] & 0x04)?byte_mask:0x00;
w3|=(Src[i] & 0x08)?byte_mask:0x00;
byte_mask>>=1;
}
Dst[0]=w0 >> 8;
Dst[1]=w0 & 0x00FF;
@ -5208,7 +5208,7 @@ void PC1_4pb_to_1lp(byte * Src0,byte * Src1,byte * Src2,byte * Src3,byte * Dst)
{
int i,j; // Compteurs
int ip; // Indice du pixel à calculer
byte Mask; // Masque de decodage
byte byte_mask; // Masque de decodage
byte b0,b1,b2,b3; // Les 4 octets des plans bits sources
ip=0;
@ -5220,14 +5220,14 @@ void PC1_4pb_to_1lp(byte * Src0,byte * Src1,byte * Src2,byte * Src3,byte * Dst)
b2=Src2[i];
b3=Src3[i];
// Pour chacun des 8 bits des octets
Mask=0x80;
byte_mask=0x80;
for (j=0;j<8;j++)
{
Dst[ip++]=((b0 & Mask)?0x01:0x00) |
((b1 & Mask)?0x02:0x00) |
((b2 & Mask)?0x04:0x00) |
((b3 & Mask)?0x08:0x00);
Mask>>=1;
Dst[ip++]=((b0 & byte_mask)?0x01:0x00) |
((b1 & byte_mask)?0x02:0x00) |
((b2 & byte_mask)?0x04:0x00) |
((b3 & byte_mask)?0x08:0x00);
byte_mask>>=1;
}
}
}
@ -5240,7 +5240,7 @@ void PC1_1lp_to_4pb(byte * Src,byte * Dst0,byte * Dst1,byte * Dst2,byte * Dst3)
{
int i,j; // Compteurs
int ip; // Indice du pixel à calculer
byte Mask; // Masque de decodage
byte byte_mask; // Masque de decodage
byte b0,b1,b2,b3; // Les 4 octets des plans bits sources
ip=0;
@ -5248,16 +5248,16 @@ void PC1_1lp_to_4pb(byte * Src,byte * Dst0,byte * Dst1,byte * Dst2,byte * Dst3)
for (i=0;i<40;i++)
{
// Pour chacun des 8 bits des octets
Mask=0x80;
byte_mask=0x80;
b0=b1=b2=b3=0;
for (j=0;j<8;j++)
{
b0|=(Src[ip] & 0x01)?Mask:0x00;
b1|=(Src[ip] & 0x02)?Mask:0x00;
b2|=(Src[ip] & 0x04)?Mask:0x00;
b3|=(Src[ip] & 0x08)?Mask:0x00;
b0|=(Src[ip] & 0x01)?byte_mask:0x00;
b1|=(Src[ip] & 0x02)?byte_mask:0x00;
b2|=(Src[ip] & 0x04)?byte_mask:0x00;
b3|=(Src[ip] & 0x08)?byte_mask:0x00;
ip++;
Mask>>=1;
byte_mask>>=1;
}
Dst0[i]=b0;
Dst1[i]=b1;

10
main.c
View File

@ -94,13 +94,13 @@ void Afficher_syntaxe(void)
// ---------------------------- Sortie impromptue ----------------------------
void Erreur_fonction(int Code, const char *Nom_fichier, int Numero_ligne, const char *Nom_fonction)
void Erreur_fonction(int error_code, const char *Nom_fichier, int Numero_ligne, const char *Nom_fonction)
{
T_Palette Palette_temporaire;
int Indice;
printf("Error number %d occured in file %s, line %d, function %s.\n", Code, Nom_fichier,Numero_ligne,Nom_fonction);
printf("Error number %d occured in file %s, line %d, function %s.\n", error_code, Nom_fichier,Numero_ligne,Nom_fonction);
if (Code==0)
if (error_code==0)
{
// L'erreur 0 n'est pas une vraie erreur, elle fait seulement un flash rouge de l'écran pour dire qu'il y a un problème.
// Toutes les autres erreurs déclenchent toujours une sortie en catastrophe du programme !
@ -113,7 +113,7 @@ void Erreur_fonction(int Code, const char *Nom_fichier, int Numero_ligne, const
}
else
{
switch (Code)
switch (error_code)
{
case ERREUR_GUI_ABSENT : printf("Error: File gfx2gui.gif is missing!\n");
printf("This program cannot run without this file.\n");
@ -164,7 +164,7 @@ void Erreur_fonction(int Code, const char *Nom_fichier, int Numero_ligne, const
}
SDL_Quit();
exit(Code);
exit(error_code);
}
}

144
moteur.c
View File

@ -347,10 +347,10 @@ void Desenclencher_bouton(int Numero)
//-Enclenchement d'un bouton (et désenclenchement de ceux de la même famille)-
void Enclencher_bouton(int Numero,byte Click)
void Enclencher_bouton(int Numero,byte click)
{
int Famille;
int Curseur;
int b;
int Icone;
Effacer_curseur();
@ -371,7 +371,7 @@ void Enclencher_bouton(int Numero,byte Click)
Icone=16;break;
}
if (Icone!=-1)
Afficher_sprite_dans_menu(Numero,Icone+(Click==A_DROITE));
Afficher_sprite_dans_menu(Numero,Icone+(click==A_DROITE));
// On note déjà la famille du bouton (La "Famiglia" c'est sacré)
Famille=Bouton[Numero].Famille;
@ -384,36 +384,36 @@ void Enclencher_bouton(int Numero,byte Click)
case FAMILLE_INTERRUPTION: // Petit cas spécial dans la famille "Interruption":
if ((Numero!=BOUTON_LOUPE) || (!Loupe_Mode))
// Pour chaque bouton:
for (Curseur=0; Curseur<NB_BOUTONS; Curseur++)
for (b=0; b<NB_BOUTONS; b++)
// S'il est de la même famille
if (
(Curseur!=Numero) &&
(Bouton[Curseur].Famille==FAMILLE_INTERRUPTION) &&
( (Curseur!=BOUTON_LOUPE) ||
((Curseur==BOUTON_LOUPE) && (!Loupe_Mode)) )
(b!=Numero) &&
(Bouton[b].Famille==FAMILLE_INTERRUPTION) &&
( (b!=BOUTON_LOUPE) ||
((b==BOUTON_LOUPE) && (!Loupe_Mode)) )
)
// Alors on désenclenche le bouton
Desenclencher_bouton(Curseur);
Desenclencher_bouton(b);
break;
default:
// On désenclenche D'ABORD les interruptions
// Pour chaque bouton:
for (Curseur=0; Curseur<NB_BOUTONS; Curseur++)
for (b=0; b<NB_BOUTONS; b++)
// S'il est de la famille interruption
if ( (Curseur!=Numero)
&& (Bouton[Curseur].Famille==FAMILLE_INTERRUPTION)
if ( (b!=Numero)
&& (Bouton[b].Famille==FAMILLE_INTERRUPTION)
// Et que ce n'est pas la loupe, ou alors qu'on n'est pas en mode loupe
&& (!(Loupe_Mode && (Curseur==BOUTON_LOUPE))) )
&& (!(Loupe_Mode && (b==BOUTON_LOUPE))) )
// Alors on désenclenche le bouton
Desenclencher_bouton(Curseur);
Desenclencher_bouton(b);
// Pour chaque bouton:
for (Curseur=0; Curseur<NB_BOUTONS; Curseur++)
for (b=0; b<NB_BOUTONS; b++)
// S'il est de la même famille
if ( (Curseur!=Numero)
&& (Bouton[Curseur].Famille==Famille) )
if ( (b!=Numero)
&& (Bouton[b].Famille==Famille) )
// Alors on désenclenche le bouton
Desenclencher_bouton(Curseur);
Desenclencher_bouton(b);
}
// On affiche le cadre autour du bouton de façon à ce qu'il paraisse enfoncé
@ -428,7 +428,7 @@ void Enclencher_bouton(int Numero,byte Click)
Bouton[Numero].Enfonce=BOUTON_ENFONCE;
// Puis on se contente d'appeler l'action correspondant au bouton:
if (Click==1)
if (click==1)
Bouton[Numero].Gauche();
else
Bouton[Numero].Droite();
@ -1235,12 +1235,12 @@ void Fermer_fenetre(void)
//---------------- Dessiner un bouton normal dans une fenêtre ----------------
void Fenetre_Dessiner_bouton_normal(word Pos_X,word Pos_Y,word Largeur,word Hauteur,
char * Titre,byte Lettre_soulignee,byte Clickable)
char * Titre,byte Lettre_soulignee,byte clickable)
{
byte Couleur_titre;
word Pos_texte_X,Pos_texte_Y;
if (Clickable)
if (clickable)
{
Fenetre_Afficher_cadre_bombe(Pos_X,Pos_Y,Largeur,Hauteur);
Fenetre_Afficher_cadre_general(Pos_X-1,Pos_Y-1,Largeur+2,Hauteur+2,CM_Noir,CM_Noir,CM_Fonce,CM_Fonce,CM_Fonce);
@ -1434,9 +1434,9 @@ void Fenetre_Dessiner_bouton_saisie(word Pos_X,word Pos_Y,word Largeur_en_caract
//------------ Modifier le contenu (caption) d'une zone de saisie ------------
void Fenetre_Contenu_bouton_saisie(T_Bouton_special * Enreg, char * Contenu)
void Fenetre_Contenu_bouton_saisie(T_Bouton_special * Enreg, char * content)
{
Print_dans_fenetre_limite(Enreg->Pos_X+2,Enreg->Pos_Y+2,Contenu,Enreg->Largeur/8,CM_Noir,CM_Clair);
Print_dans_fenetre_limite(Enreg->Pos_X+2,Enreg->Pos_Y+2,content,Enreg->Largeur/8,CM_Noir,CM_Clair);
}
//------------ Effacer le contenu (caption) d'une zone de saisie ------------
@ -1453,13 +1453,13 @@ void Fenetre_Effacer_bouton_saisie(T_Bouton_special * Enreg)
T_Bouton_normal * Fenetre_Definir_bouton_normal(word Pos_X, word Pos_Y,
word Largeur, word Hauteur,
char * Titre, byte Lettre_soulignee,
byte Clickable, word Raccourci)
byte clickable, word Raccourci)
{
T_Bouton_normal * Temp=NULL;
Nb_boutons_fenetre++;
if (Clickable)
if (clickable)
{
Temp=(T_Bouton_normal *)malloc(sizeof(T_Bouton_normal));
Temp->Numero =Nb_boutons_fenetre;
@ -1474,7 +1474,7 @@ T_Bouton_normal * Fenetre_Definir_bouton_normal(word Pos_X, word Pos_Y,
Fenetre_Liste_boutons_normal=Temp;
}
Fenetre_Dessiner_bouton_normal(Pos_X,Pos_Y,Largeur,Hauteur,Titre,Lettre_soulignee,Clickable);
Fenetre_Dessiner_bouton_normal(Pos_X,Pos_Y,Largeur,Hauteur,Titre,Lettre_soulignee,clickable);
return Temp;
}
//------ Rajout d'un bouton à la liste de ceux présents dans la fenêtre ------
@ -1482,13 +1482,13 @@ T_Bouton_normal * Fenetre_Definir_bouton_normal(word Pos_X, word Pos_Y,
T_Bouton_normal * Fenetre_Definir_bouton_repetable(word Pos_X, word Pos_Y,
word Largeur, word Hauteur,
char * Titre, byte Lettre_soulignee,
byte Clickable, word Raccourci)
byte clickable, word Raccourci)
{
T_Bouton_normal * Temp=NULL;
Nb_boutons_fenetre++;
if (Clickable)
if (clickable)
{
Temp=(T_Bouton_normal *)malloc(sizeof(T_Bouton_normal));
Temp->Numero =Nb_boutons_fenetre;
@ -1503,7 +1503,7 @@ T_Bouton_normal * Fenetre_Definir_bouton_repetable(word Pos_X, word Pos_Y,
Fenetre_Liste_boutons_normal=Temp;
}
Fenetre_Dessiner_bouton_normal(Pos_X,Pos_Y,Largeur,Hauteur,Titre,Lettre_soulignee,Clickable);
Fenetre_Dessiner_bouton_normal(Pos_X,Pos_Y,Largeur,Hauteur,Titre,Lettre_soulignee,clickable);
return Temp;
}
@ -1575,7 +1575,7 @@ T_Bouton_special * Fenetre_Definir_bouton_saisie(word Pos_X,word Pos_Y,word Larg
return Temp;
}
T_Bouton_dropdown * Fenetre_Definir_bouton_dropdown(word Pos_X,word Pos_Y,word Largeur,word Hauteur,word Largeur_choix,char *Libelle,byte Affiche_choix,byte Affiche_centre,byte Affiche_fleche,byte Bouton_actif)
T_Bouton_dropdown * Fenetre_Definir_bouton_dropdown(word Pos_X,word Pos_Y,word Largeur,word Hauteur,word Largeur_choix,char *Libelle,byte display_choice,byte display_centered,byte display_arrow,byte active_button)
{
T_Bouton_dropdown *Temp;
@ -1585,19 +1585,19 @@ T_Bouton_dropdown * Fenetre_Definir_bouton_dropdown(word Pos_X,word Pos_Y,word L
Temp->Pos_Y =Pos_Y;
Temp->Largeur =Largeur;
Temp->Hauteur =Hauteur;
Temp->Affiche_choix =Affiche_choix;
Temp->Affiche_choix =display_choice;
Temp->Premier_choix=NULL;
Temp->Largeur_choix=Largeur_choix?Largeur_choix:Largeur;
Temp->Affiche_centre=Affiche_centre;
Temp->Affiche_fleche=Affiche_fleche;
Temp->Bouton_actif=Bouton_actif;
Temp->Affiche_centre=display_centered;
Temp->Affiche_fleche=display_arrow;
Temp->Bouton_actif=active_button;
Temp->Next=Fenetre_Liste_boutons_dropdown;
Fenetre_Liste_boutons_dropdown=Temp;
Fenetre_Dessiner_bouton_normal(Pos_X,Pos_Y,Largeur,Hauteur,"",-1,1);
if (Libelle && Libelle[0])
Print_dans_fenetre(Temp->Pos_X+2,Temp->Pos_Y+(Temp->Hauteur-7)/2,Libelle,CM_Noir,CM_Clair);
if (Affiche_fleche)
if (display_arrow)
Fenetre_Afficher_sprite_drive(Temp->Pos_X+Temp->Largeur-10,Temp->Pos_Y+(Temp->Hauteur-7)/2,6);
return Temp;
@ -1862,14 +1862,14 @@ short Attendre_click_dans_palette(T_Bouton_palette * Enreg)
// -------------- Récupération d'une couleur derrière un menu ----------------
void Recuperer_couleur_derriere_fenetre(byte * Couleur, byte * Click)
void Recuperer_couleur_derriere_fenetre(byte * Couleur, byte * click)
{
short Largeur=Fenetre_Largeur*Menu_Facteur_X;
short Hauteur=Fenetre_Hauteur*Menu_Facteur_Y;
short Ancien_X=-1;
short Ancien_Y=-1;
short Indice;
short A,B,C,D; // Variables temporaires et multitâches...
short a,b,c,d; // Variables temporaires et multitâches...
byte * Buffer;
char Chaine[25];
byte Cacher_curseur_avant_recuperation;
@ -1884,19 +1884,19 @@ void Recuperer_couleur_derriere_fenetre(byte * Couleur, byte * Click)
for (Indice=0; Indice<Hauteur; Indice++)
Lire_ligne(Fenetre_Pos_X,Fenetre_Pos_Y+Indice,Largeur,Buffer+((int)Indice*Largeur*Pixel_width));
A=Menu_Ordonnee;
a=Menu_Ordonnee;
Menu_Ordonnee=Menu_Ordonnee_avant_fenetre;
B=Menu_visible;
b=Menu_visible;
Menu_visible=Menu_visible_avant_fenetre;
Afficher_ecran();
Afficher_menu();
Menu_Ordonnee=A;
Menu_visible=B;
Menu_Ordonnee=a;
Menu_visible=b;
Forme_curseur=FORME_CURSEUR_CIBLE_PIPETTE;
B=Cacher_pinceau;
b=Cacher_pinceau;
Cacher_pinceau=1;
C=-1; // Couleur pointée: au début aucune, comme ça on initialise tout
c=-1; // Couleur pointée: au début aucune, comme ça on initialise tout
if (Menu_visible_avant_fenetre)
Print_dans_menu(TITRE_BOUTON[BOUTON_CHOIX_COL],0);
@ -1909,29 +1909,29 @@ void Recuperer_couleur_derriere_fenetre(byte * Couleur, byte * Click)
if ((Mouse_X!=Ancien_X) || (Mouse_Y!=Ancien_Y))
{
Effacer_curseur();
A=Lit_pixel(Mouse_X,Mouse_Y);
if (A!=C)
a=Lit_pixel(Mouse_X,Mouse_Y);
if (a!=c)
{
C=A; // Mise à jour de la couleur pointée
c=a; // Mise à jour de la couleur pointée
if (Menu_visible_avant_fenetre)
{
sprintf(Chaine,"%d",A);
D=strlen(Chaine);
sprintf(Chaine,"%d",a);
d=strlen(Chaine);
strcat(Chaine," (");
sprintf(Chaine+strlen(Chaine),"%d",Principal_Palette[A].R);
sprintf(Chaine+strlen(Chaine),"%d",Principal_Palette[a].R);
strcat(Chaine,",");
sprintf(Chaine+strlen(Chaine),"%d",Principal_Palette[A].V);
sprintf(Chaine+strlen(Chaine),"%d",Principal_Palette[a].V);
strcat(Chaine,",");
sprintf(Chaine+strlen(Chaine),"%d",Principal_Palette[A].B);
sprintf(Chaine+strlen(Chaine),"%d",Principal_Palette[a].B);
strcat(Chaine,")");
A=24-D;
for (Indice=strlen(Chaine); Indice<A; Indice++)
a=24-d;
for (Indice=strlen(Chaine); Indice<a; Indice++)
Chaine[Indice]=' ';
Chaine[A]=0;
Chaine[a]=0;
Print_dans_menu(Chaine,strlen(TITRE_BOUTON[BOUTON_CHOIX_COL]));
Print_general((26+((D+strlen(TITRE_BOUTON[BOUTON_CHOIX_COL]))<<3))*Menu_Facteur_X,
Menu_Ordonnee_Texte," ",0,C);
Print_general((26+((d+strlen(TITRE_BOUTON[BOUTON_CHOIX_COL]))<<3))*Menu_Facteur_X,
Menu_Ordonnee_Texte," ",0,c);
}
}
Afficher_curseur();
@ -1944,12 +1944,12 @@ void Recuperer_couleur_derriere_fenetre(byte * Couleur, byte * Click)
if (Mouse_K)
{
Effacer_curseur();
*Click=Mouse_K;
*click=Mouse_K;
*Couleur=Lit_pixel(Mouse_X,Mouse_Y);
}
else
{
*Click=0;
*click=0;
Effacer_curseur();
}
@ -1957,7 +1957,7 @@ void Recuperer_couleur_derriere_fenetre(byte * Couleur, byte * Click)
Afficher_ligne(Fenetre_Pos_X,Fenetre_Pos_Y+Indice,Largeur,Buffer+((int)Indice*Largeur));
UpdateRect(Fenetre_Pos_X, Fenetre_Pos_Y, Fenetre_Largeur*Menu_Facteur_X, Fenetre_Hauteur*Menu_Facteur_Y);
Forme_curseur=FORME_CURSEUR_FLECHE;
Cacher_pinceau=B;
Cacher_pinceau=b;
Cacher_curseur=Cacher_curseur_avant_recuperation;
Afficher_curseur();
@ -1980,8 +1980,8 @@ void Deplacer_fenetre(short Dx, short Dy)
short Ancien_Y;
short Largeur=Fenetre_Largeur*Menu_Facteur_X;
short Hauteur=Fenetre_Hauteur*Menu_Facteur_Y;
short A;
byte B;
short a;
byte b;
byte *Buffer=NULL;
Effacer_curseur();
@ -2056,14 +2056,14 @@ void Deplacer_fenetre(short Dx, short Dy)
if ((Nouveau_X!=Fenetre_Pos_X)
|| (Nouveau_Y!=Fenetre_Pos_Y))
{
A=Menu_Ordonnee;
a=Menu_Ordonnee;
Menu_Ordonnee=Menu_Ordonnee_avant_fenetre;
B=Menu_visible;
b=Menu_visible;
Menu_visible=Menu_visible_avant_fenetre;
//Afficher_ecran();
//Afficher_menu();
Menu_Ordonnee=A;
Menu_visible=B;
Menu_Ordonnee=a;
Menu_visible=b;
// Sauvegarde du contenu actuel de la fenêtre
Sauve_fond(&Buffer, Fenetre_Pos_X, Fenetre_Pos_Y, Fenetre_Largeur, Fenetre_Hauteur);
@ -2174,22 +2174,22 @@ short Fenetre_Dropdown_click(T_Bouton_dropdown *Bouton)
// Affichage des items
for(Choix=Bouton->Premier_choix,Indice_choix=0; Choix!=NULL; Choix=Choix->Next,Indice_choix++)
{
byte C1;
byte C2;
byte color_1;
byte color_2;
if (Indice_choix==Indice_selectionne)
{
C1=CM_Blanc;
C2=CM_Fonce;
color_1=CM_Blanc;
color_2=CM_Fonce;
Block(Fenetre_Pos_X+3*Menu_Facteur_X,
Fenetre_Pos_Y+((2+Indice_choix*8)*Menu_Facteur_Y),
(Bouton->Largeur_choix-5)*Menu_Facteur_X,(8)*Menu_Facteur_Y,CM_Fonce);
}
else
{
C1=CM_Noir;
C2=CM_Clair;
color_1=CM_Noir;
color_2=CM_Clair;
}
Print_dans_fenetre(3,2+Indice_choix*8,Choix->Libelle,C1,C2);
Print_dans_fenetre(3,2+Indice_choix*8,Choix->Libelle,color_1,color_2);
}
UpdateRect(Fenetre_Pos_X,Fenetre_Pos_Y,Fenetre_Largeur*Menu_Facteur_X,Fenetre_Hauteur*Menu_Facteur_Y);
Afficher_curseur();

View File

@ -22,7 +22,7 @@
void Gestion_principale (void);
void Tracer_cadre_de_bouton_du_menu(byte Numero,byte Enfonce);
void Desenclencher_bouton (int Numero);
void Enclencher_bouton (int Numero,byte Click);
void Enclencher_bouton (int Numero,byte click);
void Annuler_les_effets (void);
void Restaurer_les_effets (void);
void Ouvrir_fenetre (word Largeur,word Hauteur, char * Titre);
@ -32,7 +32,7 @@ void Ouvrir_popup (word Pos_X, word Pos_Y, word Largeur, word H
void Fermer_popup (void);
void Fenetre_Dessiner_bouton_normal(word Pos_X,word Pos_Y,word Largeur,word Hauteur,
char * Titre,byte Lettre_soulignee,byte Clickable);
char * Titre,byte Lettre_soulignee,byte clickable);
void Fenetre_Enfoncer_bouton_normal(word Pos_X,word Pos_Y,word Largeur,word Hauteur);
void Fenetre_Desenfoncer_bouton_normal(word Pos_X,word Pos_Y,word Largeur,word Hauteur);
void Fenetre_Dessiner_bouton_palette(word Pos_X,word Pos_Y);
@ -41,18 +41,18 @@ void Calculer_hauteur_curseur_jauge(T_Bouton_scroller * Enreg);
void Fenetre_Dessiner_jauge(T_Bouton_scroller * Enreg);
void Fenetre_Dessiner_bouton_scroller(T_Bouton_scroller * Enreg);
void Fenetre_Contenu_bouton_saisie(T_Bouton_special * Enreg, char * Contenu);
void Fenetre_Contenu_bouton_saisie(T_Bouton_special * Enreg, char * content);
void Fenetre_Effacer_bouton_saisie(T_Bouton_special * Enreg);
void Fenetre_Dessiner_bouton_saisie(word Pos_X,word Pos_Y,word Largeur_en_caracteres);
T_Bouton_normal * Fenetre_Definir_bouton_normal(word Pos_X, word Pos_Y,
word Largeur, word Hauteur,
char * Titre,byte Lettre_soulignee,
byte Clickable, word Raccourci);
byte clickable, word Raccourci);
T_Bouton_normal * Fenetre_Definir_bouton_repetable(word Pos_X, word Pos_Y,
word Largeur, word Hauteur,
char * Titre,byte Lettre_soulignee,
byte Clickable, word Raccourci);
byte clickable, word Raccourci);
T_Bouton_palette * Fenetre_Definir_bouton_palette(word Pos_X, word Pos_Y);
void Fenetre_Effacer_tags(void);
@ -65,12 +65,12 @@ T_Bouton_scroller * Fenetre_Definir_bouton_scroller(word Pos_X, word Pos_Y,
word Position_initiale);
T_Bouton_special * Fenetre_Definir_bouton_special(word Pos_X,word Pos_Y,word Largeur,word Hauteur);
T_Bouton_special * Fenetre_Definir_bouton_saisie(word Pos_X,word Pos_Y,word Largeur_en_caracteres);
T_Bouton_dropdown * Fenetre_Definir_bouton_dropdown(word Pos_X,word Pos_Y,word Largeur,word Hauteur,word Largeur_choix,char *Libelle,byte Affiche_choix,byte Affiche_centre,byte Affiche_fleche,byte Bouton_actif);
T_Bouton_dropdown * Fenetre_Definir_bouton_dropdown(word Pos_X,word Pos_Y,word Largeur,word Hauteur,word Largeur_choix,char *Libelle,byte display_choice,byte display_centered,byte display_arrow,byte active_button);
void Fenetre_Dropdown_choix(T_Bouton_dropdown * Dropdown, word Numero, const char *Libelle);
void Fenetre_Dropdown_vider_choix(T_Bouton_dropdown * Dropdown);
byte Fenetre_click_dans_zone(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y);
short Attendre_click_dans_palette(T_Bouton_palette * Enreg);
void Recuperer_couleur_derriere_fenetre(byte * Couleur, byte * Click);
void Recuperer_couleur_derriere_fenetre(byte * Couleur, byte * click);
short Fenetre_Bouton_clicke(void);
int Numero_bouton_sous_souris(void);

108
op_c.c
View File

@ -98,21 +98,21 @@ void RGBtoHSL(int r,int g,int b,byte * hr,byte * sr,byte* lr)
*sr = (s*255.0);
}
void HSLtoRGB(byte H,byte S,byte L, byte* R, byte* G, byte* B)
void HSLtoRGB(byte h,byte s,byte l, byte* r, byte* g, byte* b)
{
float rf =0 ,gf = 0,bf = 0;
float hf,lf,sf;
float p,q;
if(S==0)
if(s==0)
{
*R=*G=*B=L;
*r=*g=*b=l;
return;
}
hf = H / 255.0;
lf = L / 255.0;
sf = S / 255.0;
hf = h / 255.0;
lf = l / 255.0;
sf = s / 255.0;
if (lf<=0.5)
q = lf*(1+sf);
@ -158,16 +158,16 @@ void HSLtoRGB(byte H,byte S,byte L, byte* R, byte* G, byte* B)
else
bf = p;
*R = rf * (255);
*G = gf * (255);
*B = bf * (255);
*r = rf * (255);
*g = gf * (255);
*b = bf * (255);
}
/////////////////////////////////////////////////////////////////////////////
///////////////////////////// Méthodes de gestion des tables de conversion //
/////////////////////////////////////////////////////////////////////////////
Table_conversion * TC_New(int nbb_r,int nbb_v,int nbb_b)
Table_conversion * TC_New(int nbb_r,int nbb_g,int nbb_b)
{
Table_conversion * n;
int Taille;
@ -177,18 +177,18 @@ Table_conversion * TC_New(int nbb_r,int nbb_v,int nbb_b)
{
// On recopie les paramŠtres demands
n->nbb_r=nbb_r;
n->nbb_v=nbb_v;
n->nbb_g=nbb_g;
n->nbb_b=nbb_b;
// On calcule les autres
n->rng_r=(1<<nbb_r);
n->rng_v=(1<<nbb_v);
n->rng_v=(1<<nbb_g);
n->rng_b=(1<<nbb_b);
n->dec_r=nbb_v+nbb_b;
n->dec_r=nbb_g+nbb_b;
n->dec_v=nbb_b;
n->dec_b=0;
n->red_r=8-nbb_r;
n->red_v=8-nbb_v;
n->red_v=8-nbb_g;
n->red_b=8-nbb_b;
// On tente d'allouer la table
@ -251,7 +251,7 @@ void TO_Init(Table_occurence * t)
memset(t->table,0,Taille); // On initialise … 0
}
Table_occurence * TO_New(int nbb_r,int nbb_v,int nbb_b)
Table_occurence * TO_New(int nbb_r,int nbb_g,int nbb_b)
{
Table_occurence * n;
int Taille;
@ -261,18 +261,18 @@ Table_occurence * TO_New(int nbb_r,int nbb_v,int nbb_b)
{
// On recopie les paramŠtres demands
n->nbb_r=nbb_r;
n->nbb_v=nbb_v;
n->nbb_g=nbb_g;
n->nbb_b=nbb_b;
// On calcule les autres
n->rng_r=(1<<nbb_r);
n->rng_v=(1<<nbb_v);
n->rng_v=(1<<nbb_g);
n->rng_b=(1<<nbb_b);
n->dec_r=nbb_v+nbb_b;
n->dec_r=nbb_g+nbb_b;
n->dec_v=nbb_b;
n->dec_b=0;
n->red_r=8-nbb_r;
n->red_v=8-nbb_v;
n->red_v=8-nbb_g;
n->red_b=8-nbb_b;
// On tente d'allouer la table
@ -691,12 +691,12 @@ ClusterSet * CS_New(int nbmax,Table_occurence * to)
if (n!=0)
{
// On recopie les paramŠtres demands
n->nbmax=TO_Compter_couleurs(to);
n->nb_max=TO_Compter_couleurs(to);
// On vient de compter le nombre de couleurs existantes, s'il est plus grand que 256 on limit à 256 (nombre de couleurs voulu au final)
if (n->nbmax>nbmax)
if (n->nb_max>nbmax)
{
n->nbmax=nbmax;
n->nb_max=nbmax;
}
// On tente d'allouer la table
@ -793,7 +793,7 @@ void CS_Generer(ClusterSet * cs,Table_occurence * to)
Cluster Nouveau2;
// Tant qu'on a moins de 256 clusters
while (cs->nb<cs->nbmax)
while (cs->nb<cs->nb_max)
{
// On récupère le plus grand cluster
CS_Get(cs,&Courant);
@ -829,7 +829,7 @@ void CS_Trier_par_chrominance(ClusterSet * cs)
int index;
Cluster * nc;
nc=(Cluster *)malloc(cs->nbmax*sizeof(Cluster));
nc=(Cluster *)malloc(cs->nb_max*sizeof(Cluster));
// Initialisation de la table d'occurence de chaque octet
for (index=0;index<256;index++)
@ -863,7 +863,7 @@ void CS_Trier_par_luminance(ClusterSet * cs)
int index;
Cluster * nc;
nc=(Cluster *)malloc(cs->nbmax*sizeof(Cluster));
nc=(Cluster *)malloc(cs->nb_max*sizeof(Cluster));
// Initialisation de la table d'occurence de chaque octet
for (index=0;index<256;index++)
@ -914,10 +914,10 @@ void CS_Generer_TC_et_Palette(ClusterSet * cs,Table_conversion * tc,Composantes
void DS_Init(DegradeSet * ds,ClusterSet * cs)
{
ds->degrades[0].nbcouleurs=1;
ds->degrades[0].min=cs->clusters[0].h;
ds->degrades[0].max=cs->clusters[0].h;
ds->degrades[0].hue=cs->clusters[0].h;
ds->gradients[0].nb_colors=1;
ds->gradients[0].min=cs->clusters[0].h;
ds->gradients[0].max=cs->clusters[0].h;
ds->gradients[0].hue=cs->clusters[0].h;
// Et hop : le 1er ensemble de dgrads est initialis
ds->nb=1;
}
@ -930,11 +930,11 @@ DegradeSet * DS_New(ClusterSet * cs)
if (n!=NULL)
{
// On recopie les paramŠtres demands
n->nbmax=cs->nbmax;
n->nb_max=cs->nb_max;
// On tente d'allouer la table
n->degrades=(Degrade *)malloc((n->nbmax)*sizeof(Degrade));
if (n->degrades!=0)
n->gradients=(Degrade *)malloc((n->nb_max)*sizeof(Degrade));
if (n->gradients!=0)
// C'est bon! On initialise
DS_Init(n,cs);
else
@ -950,7 +950,7 @@ DegradeSet * DS_New(ClusterSet * cs)
void DS_Delete(DegradeSet * ds)
{
free(ds->degrades);
free(ds->gradients);
free(ds);
}
@ -969,7 +969,7 @@ void DS_Generer(DegradeSet * ds,ClusterSet * cs)
mdiff=99999999;
for (id=0;id<ds->nb;id++)
{
diff=abs(cs->clusters[ic].h - ds->degrades[id].hue);
diff=abs(cs->clusters[ic].h - ds->gradients[id].hue);
if ((mdiff>diff) && (diff<16))
{
mdegr=id;
@ -981,24 +981,24 @@ void DS_Generer(DegradeSet * ds,ClusterSet * cs)
if (mdegr!=-1)
{
// On met … jour le dgrad
if (cs->clusters[ic].h < ds->degrades[mdegr].min)
ds->degrades[mdegr].min=cs->clusters[ic].h;
if (cs->clusters[ic].h > ds->degrades[mdegr].max)
ds->degrades[mdegr].max=cs->clusters[ic].h;
ds->degrades[mdegr].hue=((ds->degrades[mdegr].hue*
ds->degrades[mdegr].nbcouleurs)
if (cs->clusters[ic].h < ds->gradients[mdegr].min)
ds->gradients[mdegr].min=cs->clusters[ic].h;
if (cs->clusters[ic].h > ds->gradients[mdegr].max)
ds->gradients[mdegr].max=cs->clusters[ic].h;
ds->gradients[mdegr].hue=((ds->gradients[mdegr].hue*
ds->gradients[mdegr].nb_colors)
+cs->clusters[ic].h)
/(ds->degrades[mdegr].nbcouleurs+1);
ds->degrades[mdegr].nbcouleurs++;
/(ds->gradients[mdegr].nb_colors+1);
ds->gradients[mdegr].nb_colors++;
}
else
{
// On cre un nouveau dgrad
mdegr=ds->nb;
ds->degrades[mdegr].nbcouleurs=1;
ds->degrades[mdegr].min=cs->clusters[ic].h;
ds->degrades[mdegr].max=cs->clusters[ic].h;
ds->degrades[mdegr].hue=cs->clusters[ic].h;
ds->gradients[mdegr].nb_colors=1;
ds->gradients[mdegr].min=cs->clusters[ic].h;
ds->gradients[mdegr].max=cs->clusters[ic].h;
ds->gradients[mdegr].hue=cs->clusters[ic].h;
ds->nb++;
}
cs->clusters[ic].h=mdegr;
@ -1006,7 +1006,7 @@ void DS_Generer(DegradeSet * ds,ClusterSet * cs)
// On redistribue les valeurs dans les clusters
for (ic=0;ic<cs->nb;ic++)
cs->clusters[ic].h=ds->degrades[cs->clusters[ic].h].hue;
cs->clusters[ic].h=ds->gradients[cs->clusters[ic].h].hue;
}
@ -1094,7 +1094,7 @@ void Convert_bitmap_24B_to_256_Floyd_Steinberg(Bitmap256 Dest,Bitmap24B Source,i
Bitmap24B S_moins1;
Bitmap24B Suivant;
Bitmap24B S_plus1;
Bitmap256 D;
Bitmap256 d;
int Pos_X,Pos_Y;
int Rouge,Vert,Bleu;
float ERouge,EVert,EBleu;
@ -1105,7 +1105,7 @@ void Convert_bitmap_24B_to_256_Floyd_Steinberg(Bitmap256 Dest,Bitmap24B Source,i
C_plus1 =Courant+1; // Le pixel à droite
S_moins1=Suivant-1; // Le pixel en bas à gauche
S_plus1 =Suivant+1; // Le pixel en bas à droite
D =Dest;
d =Dest;
// On parcours chaque pixel:
for (Pos_Y=0;Pos_Y<Hauteur;Pos_Y++)
@ -1118,12 +1118,12 @@ void Convert_bitmap_24B_to_256_Floyd_Steinberg(Bitmap256 Dest,Bitmap24B Source,i
Vert =Courant->V;
Bleu =Courant->B;
// Cherche la couleur correspondant dans la palette et la range dans l'image de destination
*D=TC_Get(tc,Rouge,Vert,Bleu);
*d=TC_Get(tc,Rouge,Vert,Bleu);
// Puis on calcule pour chaque composante l'erreur dûe à l'approximation
Rouge-=palette[*D].R;
Vert -=palette[*D].V;
Bleu -=palette[*D].B;
Rouge-=palette[*d].R;
Vert -=palette[*d].V;
Bleu -=palette[*d].B;
// Et dans chaque pixel voisin on propage l'erreur
// A droite:
@ -1174,7 +1174,7 @@ void Convert_bitmap_24B_to_256_Floyd_Steinberg(Bitmap256 Dest,Bitmap24B Source,i
S_moins1++;
Suivant++;
S_plus1++;
D++;
d++;
}
}

28
op_c.h
View File

@ -35,19 +35,19 @@ typedef byte * Bitmap256;
typedef struct
{
int nbb_r; // Nb de bits de précision sur les rouges
int nbb_v; // Nb de bits de précision sur les verts
int nbb_g; // Nb de bits de précision sur les verts
int nbb_b; // Nb de bits de précision sur les bleu
int rng_r; // Nb de valeurs sur les rouges (= 1<<nbb_r)
int rng_v; // Nb de valeurs sur les verts (= 1<<nbb_v)
int rng_v; // Nb de valeurs sur les verts (= 1<<nbb_g)
int rng_b; // Nb de valeurs sur les bleus (= 1<<nbb_b)
int dec_r; // Coefficient multiplicateur d'accès dans la table (= nbb_v+nbb_b)
int dec_r; // Coefficient multiplicateur d'accès dans la table (= nbb_g+nbb_b)
int dec_v; // Coefficient multiplicateur d'accès dans la table (= nbb_b)
int dec_b; // Coefficient multiplicateur d'accès dans la table (= 0)
int red_r; // Coefficient réducteur de traduction d'une couleur rouge (= 8-nbb_r)
int red_v; // Coefficient réducteur de traduction d'une couleur verte (= 8-nbb_v)
int red_v; // Coefficient réducteur de traduction d'une couleur verte (= 8-nbb_g)
int red_b; // Coefficient réducteur de traduction d'une couleur bleue (= 8-nbb_b)
byte * table;
@ -60,19 +60,19 @@ typedef struct
typedef struct
{
int nbb_r; // Nb de bits de précision sur les rouges
int nbb_v; // Nb de bits de précision sur les verts
int nbb_g; // Nb de bits de précision sur les verts
int nbb_b; // Nb de bits de précision sur les bleu
int rng_r; // Nb de valeurs sur les rouges (= 1<<nbb_r)
int rng_v; // Nb de valeurs sur les verts (= 1<<nbb_v)
int rng_v; // Nb de valeurs sur les verts (= 1<<nbb_g)
int rng_b; // Nb de valeurs sur les bleus (= 1<<nbb_b)
int dec_r; // Coefficient multiplicateur d'accès dans la table (= nbb_v+nbb_b)
int dec_r; // Coefficient multiplicateur d'accès dans la table (= nbb_g+nbb_b)
int dec_v; // Coefficient multiplicateur d'accès dans la table (= nbb_b)
int dec_b; // Coefficient multiplicateur d'accès dans la table (= 0)
int red_r; // Coefficient réducteur de traduction d'une couleur rouge (= 8-nbb_r)
int red_v; // Coefficient réducteur de traduction d'une couleur verte (= 8-nbb_v)
int red_v; // Coefficient réducteur de traduction d'une couleur verte (= 8-nbb_g)
int red_b; // Coefficient réducteur de traduction d'une couleur bleue (= 8-nbb_b)
int * table;
@ -109,7 +109,7 @@ typedef struct
typedef struct
{
int nb;
int nbmax;
int nb_max;
Cluster * clusters;
} ClusterSet;
@ -119,7 +119,7 @@ typedef struct
typedef struct
{
int nbcouleurs; // Nombre de couleurs dans le dégradé
int nb_colors; // Nombre de couleurs dans le dégradé
float min; // Chrominance minimale du dégradé
float max; // Chrominance maximale du dégradé
float hue; // Chrominance moyenne du dégradé
@ -132,8 +132,8 @@ typedef struct
typedef struct
{
int nb; // Nombre de dégradés dans l'ensemble
int nbmax; // Nombre maximum de dégradés
Degrade * degrades; // Les dégradés
int nb_max; // Nombre maximum de dégradés
Degrade * gradients; // Les dégradés
} DegradeSet;
@ -142,7 +142,7 @@ typedef struct
///////////////////////////// Méthodes de gestion des tables de conversion //
/////////////////////////////////////////////////////////////////////////////
Table_conversion * TC_New(int nbb_r,int nbb_v,int nbb_b);
Table_conversion * TC_New(int nbb_r,int nbb_g,int nbb_b);
void TC_Delete(Table_conversion * t);
byte TC_Get(Table_conversion * t,int r,int v,int b);
void TC_Set(Table_conversion * t,int r,int v,int b,byte i);
@ -156,7 +156,7 @@ void HSLtoRGB(byte h, byte s, byte l, byte* r, byte* g, byte* b);
/////////////////////////////////////////////////////////////////////////////
void TO_Init(Table_occurence * t);
Table_occurence * TO_New(int nbb_r,int nbb_v,int nbb_b);
Table_occurence * TO_New(int nbb_r,int nbb_g,int nbb_b);
void TO_Delete(Table_occurence * t);
int TO_Get(Table_occurence * t,int r,int v,int b);
void TO_Set(Table_occurence * t,int r,int v,int b,int i);

View File

@ -3181,7 +3181,7 @@ void Etirer_brosse_1_7(void)
short Largeur;
short Hauteur;
short Etat_prec;
short dX,dY,X,Y;
short dx,dy,X,Y;
Operation_POP(&Etat_prec);
Operation_POP(&Ancien_Y);
@ -3221,10 +3221,10 @@ void Etirer_brosse_1_7(void)
Y=Pinceau_Y;
if (Snap_Mode && Config.Adjust_brush_pick)
{
dX=Pinceau_X-Debut_X;
dY=Pinceau_Y-Debut_Y;
if (dX<0) X++; else {if (dX>0) X--;}
if (dY<0) Y++; else {if (dY>0) Y--;}
dx=Pinceau_X-Debut_X;
dy=Pinceau_Y-Debut_Y;
if (dx<0) X++; else {if (dx>0) X--;}
if (dy<0) Y++; else {if (dy>0) Y--;}
Etirer_brosse_preview(Debut_X,Debut_Y,X,Y);
}
else
@ -3474,8 +3474,8 @@ void Tourner_brosse_1_5(void)
short Ancien_X;
short Ancien_Y;
short Etat_prec;
float Angle;
int dX,dY;
float angle;
int dx,dy;
Operation_POP(&Etat_prec);
Operation_POP(&Ancien_Y);
@ -3485,20 +3485,20 @@ void Tourner_brosse_1_5(void)
{
if ( (Brosse_Centre_rotation_X==Pinceau_X)
&& (Brosse_Centre_rotation_Y==Pinceau_Y) )
Angle=0.0;
angle=0.0;
else
{
dX=Pinceau_X-Brosse_Centre_rotation_X;
dY=Pinceau_Y-Brosse_Centre_rotation_Y;
Angle=acos(((float)dX)/sqrt((dX*dX)+(dY*dY)));
if (dY>0) Angle=M_2PI-Angle;
dx=Pinceau_X-Brosse_Centre_rotation_X;
dy=Pinceau_Y-Brosse_Centre_rotation_Y;
angle=acos(((float)dx)/sqrt((dx*dx)+(dy*dy)));
if (dy>0) angle=M_2PI-angle;
}
if (Menu_visible)
{
if (Config.Coords_rel)
{
Num2str((int)(Angle*180.0/M_PI),Chaine,3);
Num2str((int)(angle*180.0/M_PI),Chaine,3);
Print_dans_menu(Chaine,7);
}
else
@ -3506,7 +3506,7 @@ void Tourner_brosse_1_5(void)
}
Afficher_ecran();
Tourner_brosse_preview(Angle);
Tourner_brosse_preview(angle);
Afficher_curseur();
Operation_Taille_pile-=2;
@ -3537,8 +3537,8 @@ void Tourner_brosse_0_5(void)
short Calcul_Y=0;
byte Changement_angle;
short Etat_prec;
float Angle=0.0;
int dX,dY;
float angle=0.0;
int dx,dy;
Operation_POP(&Etat_prec);
Operation_POP(&Ancien_Y);
@ -3548,20 +3548,20 @@ void Tourner_brosse_0_5(void)
{
if ( (Brosse_Centre_rotation_X==Pinceau_X)
&& (Brosse_Centre_rotation_Y==Pinceau_Y) )
Angle=0.0;
angle=0.0;
else
{
dX=Pinceau_X-Brosse_Centre_rotation_X;
dY=Pinceau_Y-Brosse_Centre_rotation_Y;
Angle=acos(((float)dX)/sqrt((dX*dX)+(dY*dY)));
if (dY>0) Angle=M_2PI-Angle;
dx=Pinceau_X-Brosse_Centre_rotation_X;
dy=Pinceau_Y-Brosse_Centre_rotation_Y;
angle=acos(((float)dx)/sqrt((dx*dx)+(dy*dy)));
if (dy>0) angle=M_2PI-angle;
}
if (Menu_visible)
{
if (Config.Coords_rel)
{
Num2str(Round(Angle*180.0/M_PI),Chaine,3);
Num2str(Round(angle*180.0/M_PI),Chaine,3);
Print_dans_menu(Chaine,7);
}
else
@ -3578,14 +3578,14 @@ void Tourner_brosse_0_5(void)
Calcul_Y=Brosse_Centre_rotation_Y;
switch (Touche_ANSI)
{
case '6': Angle= 0.0 ; Calcul_X++; break;
case '9': Angle=M_PI*0.25; Calcul_X++; Calcul_Y--; break;
case '8': Angle=M_PI*0.5 ; Calcul_Y--; break;
case '7': Angle=M_PI*0.75; Calcul_X--; Calcul_Y--; break;
case '4': Angle=M_PI ; Calcul_X--; break;
case '1': Angle=M_PI*1.25; Calcul_X--; Calcul_Y++; break;
case '2': Angle=M_PI*1.5 ; Calcul_Y++; break;
case '3': Angle=M_PI*1.75; Calcul_X++; Calcul_Y++; break;
case '6': angle= 0.0 ; Calcul_X++; break;
case '9': angle=M_PI*0.25; Calcul_X++; Calcul_Y--; break;
case '8': angle=M_PI*0.5 ; Calcul_Y--; break;
case '7': angle=M_PI*0.75; Calcul_X--; Calcul_Y--; break;
case '4': angle=M_PI ; Calcul_X--; break;
case '1': angle=M_PI*1.25; Calcul_X--; Calcul_Y++; break;
case '2': angle=M_PI*1.5 ; Calcul_Y++; break;
case '3': angle=M_PI*1.75; Calcul_X++; Calcul_Y++; break;
default :
Changement_angle=0;
}
@ -3598,7 +3598,7 @@ void Tourner_brosse_0_5(void)
{
// On efface la preview de la brosse
Afficher_ecran();
Tourner_brosse_preview(Angle);
Tourner_brosse_preview(angle);
Afficher_curseur();
Operation_Taille_pile-=2;
@ -3623,8 +3623,8 @@ void Tourner_brosse_2_5(void)
{
short Calcul_X;
short Calcul_Y;
int dX,dY;
float Angle;
int dx,dy;
float angle;
// On efface la preview de la brosse
@ -3637,17 +3637,17 @@ void Tourner_brosse_2_5(void)
// Calcul de l'angle par rapport à la dernière position calculée
if ( (Brosse_Centre_rotation_X==Calcul_X)
&& (Brosse_Centre_rotation_Y==Calcul_Y) )
Angle=0.0;
angle=0.0;
else
{
dX=Calcul_X-Brosse_Centre_rotation_X;
dY=Calcul_Y-Brosse_Centre_rotation_Y;
Angle=acos(((float)dX)/sqrt((dX*dX)+(dY*dY)));
if (dY>0) Angle=M_2PI-Angle;
dx=Calcul_X-Brosse_Centre_rotation_X;
dy=Calcul_Y-Brosse_Centre_rotation_Y;
angle=acos(((float)dx)/sqrt((dx*dx)+(dy*dy)));
if (dy>0) angle=M_2PI-angle;
}
// Et enfin on stocke pour de bon la nouvelle brosse étirée
Tourner_brosse(Angle);
Tourner_brosse(angle);
// Simuler l'appui du bouton "Dessin"
@ -3878,7 +3878,7 @@ void Cercle_degrade_0_6(void)
short Centre_X;
short Centre_Y;
short Couleur;
short Click;
short click;
short Rayon;
Operation_POP(&Tangente_Y);
@ -3887,11 +3887,11 @@ void Cercle_degrade_0_6(void)
Operation_POP(&Centre_X);
Operation_POP(&Couleur);
Operation_POP(&Click);
Operation_POP(&click);
if (Click==A_GAUCHE)
if (click==A_GAUCHE)
{
Operation_PUSH(Click);
Operation_PUSH(click);
Operation_PUSH(Couleur);
Operation_PUSH(Centre_X);
@ -4129,7 +4129,7 @@ void Ellipse_degradee_0_6(void)
short Centre_X;
short Centre_Y;
short Couleur;
short Click;
short click;
//short Rayon;
short Rayon_horizontal;
short Rayon_vertical;
@ -4140,11 +4140,11 @@ void Ellipse_degradee_0_6(void)
Operation_POP(&Centre_X);
Operation_POP(&Couleur);
Operation_POP(&Click);
Operation_POP(&click);
if (Click==A_GAUCHE)
if (click==A_GAUCHE)
{
Operation_PUSH(Click);
Operation_PUSH(click);
Operation_PUSH(Couleur);
Operation_PUSH(Centre_X);

View File

@ -66,9 +66,9 @@ void Set_Palette_RGB_Scale(int Grad)
Graduations_RGB = Grad;
}
byte Palette_Scale_Component(byte Comp)
byte Palette_Scale_Component(byte comp)
{
return ((Comp+128/Graduations_RGB)*(Graduations_RGB-1)/255*255+(Graduations_RGB&1?1:0))/(Graduations_RGB-1);
return ((comp+128/Graduations_RGB)*(Graduations_RGB-1)/255*255+(Graduations_RGB&1?1:0))/(Graduations_RGB-1);
}
// Définir les unités pour les graduationss R G B ou H S V
@ -81,10 +81,10 @@ void Unite_Composantes(int Count)
void Modifier_HSL(T_Palette Palette_depart, T_Palette Palette_arrivee, byte Couleur, short Difference_H, short Difference_S, short Difference_L)
{
byte H, S, L;
RGBtoHSL(Palette_depart[Couleur].R,Palette_depart[Couleur].V,Palette_depart[Couleur].B,&H,&S,&L);
byte h, S, l;
RGBtoHSL(Palette_depart[Couleur].R,Palette_depart[Couleur].V,Palette_depart[Couleur].B,&h,&S,&l);
// La teinte (Hue) est cyclique
H=(Difference_H+256+H);
h=(Difference_H+256+h);
// Pour les autres (Saturation, Lightness), au lieu d'additionner,
// on va faire un ratio, cela utilise mieux la plage de valeurs 0-255
if (Difference_S<0)
@ -92,10 +92,10 @@ void Modifier_HSL(T_Palette Palette_depart, T_Palette Palette_arrivee, byte Coul
else if (Difference_S>0)
S=255-(255-Difference_S)*(255-S)/255;
if (Difference_L<0)
L=(255+Difference_L)*L/255;
l=(255+Difference_L)*l/255;
else if (Difference_L>0)
L=255-(255-Difference_L)*(255-L)/255;
HSLtoRGB(H,S,L,&Palette_arrivee[Couleur].R,&Palette_arrivee[Couleur].V,&Palette_arrivee[Couleur].B);
l=255-(255-Difference_L)*(255-l)/255;
HSLtoRGB(h,S,l,&Palette_arrivee[Couleur].R,&Palette_arrivee[Couleur].V,&Palette_arrivee[Couleur].B);
}
void Modifier_Rouge(byte Couleur, short Nouvelle_teinte, T_Palette Palette)
@ -748,7 +748,7 @@ void Bouton_Palette(void)
static short Reduce_Nb_couleurs=256;
short Couleur_temporaire; // Variable pouvant reservir pour différents calculs intermédiaires
dword Temp;
byte Couleur,Click; // Variables pouvant reservir pour différents calculs intermédiaires
byte Couleur,click; // Variables pouvant reservir pour différents calculs intermédiaires
short Bouton_clicke;
word Ancien_Mouse_X;
word Ancien_Mouse_Y;
@ -1959,11 +1959,11 @@ void Bouton_Palette(void)
case SDLK_BACKQUOTE : // Récupération d'une couleur derrière le menu
case SDLK_COMMA :
Recuperer_couleur_derriere_fenetre(&Couleur,&Click);
if (Click)
Recuperer_couleur_derriere_fenetre(&Couleur,&click);
if (click)
{
Effacer_curseur();
if (Click==A_DROITE)
if (click==A_DROITE)
{
if (Back_color!=Couleur)
{

View File

@ -26,5 +26,5 @@ void Set_Palette_RGB_Scale(int);
// Scale a component (R, G or B) according to the current RGB graduations
// The resulting range is [0-255]
byte Palette_Scale_Component(byte Comp);
byte Palette_Scale_Component(byte comp);

View File

@ -63,10 +63,10 @@ void Afficher_partie_de_l_ecran_Double (word Largeur,word Hauteur,word Largeur_i
{
byte* Dest=Ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src=Principal_Decalage_Y*Largeur_image+Principal_Decalage_X+Principal_Ecran; //Coords de départ ds la source (Src)
int dx;
int y;
int dy;
for(dx=Hauteur;dx!=0;dx--)
for(y=Hauteur;y!=0;y--)
// Pour chaque ligne
{
// On fait une copie de la ligne
@ -152,13 +152,13 @@ void Display_brush_Color_Double(word Pos_X,word Pos_Y,word Decalage_X,word Decal
// Src = Position dans la brosse
byte* Src = Brosse + Decalage_Y * Largeur_brosse + Decalage_X;
word DX,CX;
word x,y;
// Pour chaque ligne
for(DX = Hauteur;DX > 0; DX--)
for(y = Hauteur;y > 0; y--)
{
// Pour chaque pixel
for(CX = Largeur;CX > 0; CX--)
for(x = Largeur;x > 0; x--)
{
// On vérifie que ce n'est pas la transparence
if(*Src != Couleur_de_transparence)
@ -187,12 +187,12 @@ void Display_brush_Mono_Double(word Pos_X, word Pos_Y,
// l'écran
byte* Src=Largeur_brosse*Decalage_Y+Decalage_X+Brosse; // Src = adr ds
// la brosse
int dx,cx;
int x,y;
for(dx=Hauteur;dx!=0;dx--)
for(y=Hauteur;y!=0;y--)
//Pour chaque ligne
{
for(cx=Largeur;cx!=0;cx--)
for(x=Largeur;x!=0;x--)
//Pour chaque pixel
{
if (*Src!=Couleur_de_transparence)
@ -214,13 +214,13 @@ void Clear_brush_Double(word Pos_X,word Pos_Y,__attribute__((unused)) word Decal
{
byte* Dest=Ecran+Pos_X*2+Pos_Y*4*Largeur_ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src = ( Pos_Y + Principal_Decalage_Y ) * Largeur_image + Pos_X + Principal_Decalage_X + Principal_Ecran; //Coords de départ ds la source (Src)
int dx;
int cx;
int y;
int x;
for(dx=Hauteur;dx!=0;dx--)
for(y=Hauteur;y!=0;y--)
// Pour chaque ligne
{
for(cx=Largeur;cx!=0;cx--)
for(x=Largeur;x!=0;x--)
//Pour chaque pixel
{
*(Dest+Largeur_ecran*2+1)=*(Dest+Largeur_ecran*2)=*(Dest+1)=*Dest=*Src;
@ -238,20 +238,20 @@ void Clear_brush_Double(word Pos_X,word Pos_Y,__attribute__((unused)) word Decal
}
// Affiche une brosse (arbitraire) à l'écran
void Affiche_brosse_Double(byte * B, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse)
void Affiche_brosse_Double(byte * brush, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse)
{
// Dest = Position à l'écran
byte* Dest = Ecran + Pos_Y * 4 * Largeur_ecran + Pos_X * 2;
// Src = Position dans la brosse
byte* Src = B + Decalage_Y * Largeur_brosse + Decalage_X;
byte* Src = brush + Decalage_Y * Largeur_brosse + Decalage_X;
word DX,CX;
word x,y;
// Pour chaque ligne
for(DX = Hauteur;DX > 0; DX--)
for(y = Hauteur;y > 0; y--)
{
// Pour chaque pixel
for(CX = Largeur;CX > 0; CX--)
for(x = Largeur;x > 0; x--)
{
// On vérifie que ce n'est pas la transparence
if(*Src != Couleur_de_transparence)
@ -273,13 +273,13 @@ void Remap_screen_Double(word Pos_X,word Pos_Y,word Largeur,word Hauteur,byte *
{
// Dest = coords a l'écran
byte* Dest = Ecran + Pos_Y * 4 * Largeur_ecran + Pos_X * 2;
int dx,cx;
int x,y;
// Pour chaque ligne
for(dx=Hauteur;dx>0;dx--)
for(y=Hauteur;y>0;y--)
{
// Pour chaque pixel
for(cx=Largeur;cx>0;cx--)
for(x=Largeur;x>0;x--)
{
*(Dest+Largeur_ecran*2+1)=*(Dest+Largeur_ecran*2)=*(Dest+1)=*Dest=
Table_de_conversion[*Dest];
@ -303,10 +303,10 @@ void Afficher_une_ligne_ecran_fast_Double(word Pos_X,word Pos_Y,word Largeur,byt
void Afficher_une_ligne_ecran_Double(word Pos_X,word Pos_Y,word Largeur,byte * Ligne)
/* On affiche une ligne de pixels en les doublant. */
{
int dx;
int x;
byte *Dest;
Dest=Ecran+Pos_X*2+Pos_Y*4*Largeur_ecran;
for(dx=Largeur;dx>0;dx--)
for(x=Largeur;x>0;x--)
{
*(Dest+Largeur_ecran*2+1)=*(Dest+Largeur_ecran*2)=*(Dest+1)=*Dest=*Ligne;
Dest+=2;
@ -320,9 +320,9 @@ void Afficher_une_ligne_transparente_mono_a_l_ecran_Double(
// Utilisé par les brosses en mode zoom
{
byte* Dest = Ecran+ Pos_Y*ZOOMX*Largeur_ecran + Pos_X*ZOOMX;
int Compteur;
int x;
// Pour chaque pixel
for(Compteur=0;Compteur<Largeur;Compteur++)
for(x=0;x<Largeur;x++)
{
if (Couleur_transparence!=*Ligne)
{
@ -350,12 +350,12 @@ void Afficher_partie_de_l_ecran_zoomee_Double(
// Pour chaque ligne à zoomer
while(1)
{
int CX;
int x;
// On éclate la ligne
Zoomer_une_ligne(Src,Buffer,Loupe_Facteur*ZOOMX,Largeur);
// On l'affiche Facteur fois, sur des lignes consécutives
CX = Loupe_Facteur/**ZOOMY*/;
x = Loupe_Facteur/**ZOOMY*/;
// Pour chaque ligne
do{
// On affiche la ligne zoomée
@ -371,8 +371,8 @@ void Afficher_partie_de_l_ecran_zoomee_Double(
Largeur*Loupe_Facteur,Hauteur);
return;
}
CX--;
}while (CX > 0);
x--;
}while (x > 0);
Src += Largeur_image;
}
// ATTENTION on n'arrive jamais ici !
@ -387,7 +387,7 @@ void Display_brush_Color_zoom_Double(word Pos_X,word Pos_Y,
byte * Buffer)
{
byte* Src = Brosse+Decalage_Y*Largeur_brosse + Decalage_X;
word DX = Pos_Y;
word y = Pos_Y;
byte bx;
// Pour chaque ligne
@ -397,11 +397,11 @@ void Display_brush_Color_zoom_Double(word Pos_X,word Pos_Y,
// On affiche facteur fois la ligne zoomée
for(bx=Loupe_Facteur;bx>0;bx--)
{
Afficher_une_ligne_transparente_a_l_ecran_Wide(Pos_X,DX*ZOOMX,Largeur*Loupe_Facteur,Buffer,Couleur_de_transparence);
Afficher_une_ligne_transparente_a_l_ecran_Wide(Pos_X,y*ZOOMX,Largeur*Loupe_Facteur,Buffer,Couleur_de_transparence);
// TODO: pas clair ici
memcpy(Ecran + (DX*ZOOMY+1)*ZOOMX*Largeur_ecran + Pos_X*ZOOMX, Ecran + DX*ZOOMX*ZOOMY*Largeur_ecran + Pos_X*ZOOMX, Largeur*ZOOMX*Loupe_Facteur);
DX++;
if(DX==Pos_Y_Fin)
memcpy(Ecran + (y*ZOOMY+1)*ZOOMX*Largeur_ecran + Pos_X*ZOOMX, Ecran + y*ZOOMX*ZOOMY*Largeur_ecran + Pos_X*ZOOMX, Largeur*ZOOMX*Loupe_Facteur);
y++;
if(y==Pos_Y_Fin)
{
return;
}
@ -422,7 +422,7 @@ void Display_brush_Mono_zoom_Double(word Pos_X, word Pos_Y,
{
byte* Src = Brosse + Decalage_Y * Largeur_brosse + Decalage_X;
int DX=Pos_Y*ZOOMY;
int y=Pos_Y*ZOOMY;
//Pour chaque ligne à zoomer :
while(1)
@ -441,13 +441,13 @@ void Display_brush_Mono_zoom_Double(word Pos_X, word Pos_Y,
{
// On affiche la ligne zoomée
Afficher_une_ligne_transparente_mono_a_l_ecran_Double(
Pos_X, DX, Largeur * Loupe_Facteur,
Pos_X, y, Largeur * Loupe_Facteur,
Buffer, Couleur_de_transparence, Couleur
);
// On passe à la ligne suivante
DX++;
y++;
// On vérifie qu'on est pas à la ligne finale
if(DX == Pos_Y_Fin*ZOOMX)
if(y == Pos_Y_Fin*ZOOMX)
{
UpdateRect( Pos_X, Pos_Y,
Largeur * Loupe_Facteur, Pos_Y_Fin - Pos_Y );
@ -467,7 +467,7 @@ void Clear_brush_zoom_Double(word Pos_X,word Pos_Y,word Decalage_X,word Decalage
// En fait on va recopier l'image non zoomée dans la partie zoomée !
byte* Src = Principal_Ecran + Decalage_Y * Largeur_image + Decalage_X;
int DX = Pos_Y;
int y = Pos_Y;
int bx;
// Pour chaque ligne à zoomer
@ -479,12 +479,12 @@ void Clear_brush_zoom_Double(word Pos_X,word Pos_Y,word Decalage_X,word Decalage
// Pour chaque ligne
do{
// TODO a verifier
Afficher_une_ligne_ecran_fast_Double(Pos_X,DX,
Afficher_une_ligne_ecran_fast_Double(Pos_X,y,
Largeur * Loupe_Facteur,Buffer);
// Ligne suivante
DX++;
if(DX==Pos_Y_Fin)
y++;
if(y==Pos_Y_Fin)
{
UpdateRect(Pos_X,Pos_Y,
Largeur*Loupe_Facteur,Pos_Y_Fin-Pos_Y);

View File

@ -39,6 +39,6 @@
void Display_brush_Color_zoom_Double (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_brosse,byte * Buffer);
void Display_brush_Mono_zoom_Double (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Pos_Y_Fin,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse,byte * Buffer);
void Clear_brush_zoom_Double (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_image,byte * Buffer);
void Affiche_brosse_Double (byte * B, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse);
void Affiche_brosse_Double (byte * brush, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse);
void Afficher_une_ligne_ecran_fast_Double (word Pos_X,word Pos_Y,word Largeur,byte * Ligne);

View File

@ -56,9 +56,9 @@ void Afficher_partie_de_l_ecran_Simple (word Largeur,word Hauteur,word Largeur_i
{
byte* Dest=Ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src=Principal_Decalage_Y*Largeur_image+Principal_Decalage_X+Principal_Ecran; //Coords de départ ds la source (Src)
int dx;
int y;
for(dx=Hauteur;dx!=0;dx--)
for(y=Hauteur;y!=0;y--)
// Pour chaque ligne
{
// On fait une copie de la ligne
@ -122,11 +122,11 @@ void Ligne_horizontale_XOR_Simple(word Pos_X,word Pos_Y,word Largeur)
void Ligne_verticale_XOR_Simple(word Pos_X,word Pos_Y,word Hauteur)
{
int i;
byte Color;
byte color;
for (i=Pos_Y;i<Pos_Y+Hauteur;i++)
{
Color=*(Ecran+Pos_X+i*Largeur_ecran);
*(Ecran+Pos_X+i*Largeur_ecran)=~Color;
color=*(Ecran+Pos_X+i*Largeur_ecran);
*(Ecran+Pos_X+i*Largeur_ecran)=~color;
}
}
@ -137,13 +137,13 @@ void Display_brush_Color_Simple(word Pos_X,word Pos_Y,word Decalage_X,word Decal
// Src = Position dans la brosse
byte* Src = Brosse + Decalage_Y * Largeur_brosse + Decalage_X;
word DX,CX;
word x,y;
// Pour chaque ligne
for(DX = Hauteur;DX > 0; DX--)
for(y = Hauteur;y > 0; y--)
{
// Pour chaque pixel
for(CX = Largeur;CX > 0; CX--)
for(x = Largeur;x > 0; x--)
{
// On vérifie que ce n'est pas la transparence
if(*Src != Couleur_de_transparence)
@ -171,12 +171,12 @@ void Display_brush_Mono_Simple(word Pos_X, word Pos_Y,
// l'écran
byte* Src=Largeur_brosse*Decalage_Y+Decalage_X+Brosse; // Src = adr ds
// la brosse
int dx,cx;
int x,y;
for(dx=Hauteur;dx!=0;dx--)
for(y=Hauteur;y!=0;y--)
//Pour chaque ligne
{
for(cx=Largeur;cx!=0;cx--)
for(x=Largeur;x!=0;x--)
//Pour chaque pixel
{
if (*Src!=Couleur_de_transparence)
@ -198,9 +198,9 @@ void Clear_brush_Simple(word Pos_X,word Pos_Y,__attribute__((unused)) word Decal
{
byte* Dest=Ecran+Pos_X+Pos_Y*Largeur_ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src = ( Pos_Y + Principal_Decalage_Y ) * Largeur_image + Pos_X + Principal_Decalage_X + Principal_Ecran; //Coords de départ ds la source (Src)
int dx;
int y;
for(dx=Hauteur;dx!=0;dx--)
for(y=Hauteur;y!=0;y--)
// Pour chaque ligne
{
// On fait une copie de la ligne
@ -214,20 +214,20 @@ void Clear_brush_Simple(word Pos_X,word Pos_Y,__attribute__((unused)) word Decal
}
// Affiche une brosse (arbitraire) à l'écran
void Affiche_brosse_Simple(byte * B, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse)
void Affiche_brosse_Simple(byte * brush, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse)
{
// Dest = Position à l'écran
byte* Dest = Ecran + Pos_Y * Largeur_ecran + Pos_X;
// Src = Position dans la brosse
byte* Src = B + Decalage_Y * Largeur_brosse + Decalage_X;
byte* Src = brush + Decalage_Y * Largeur_brosse + Decalage_X;
word DX,CX;
word x,y;
// Pour chaque ligne
for(DX = Hauteur;DX > 0; DX--)
for(y = Hauteur;y > 0; y--)
{
// Pour chaque pixel
for(CX = Largeur;CX > 0; CX--)
for(x = Largeur;x > 0; x--)
{
// On vérifie que ce n'est pas la transparence
if(*Src != Couleur_de_transparence)
@ -249,13 +249,13 @@ void Remap_screen_Simple(word Pos_X,word Pos_Y,word Largeur,word Hauteur,byte *
{
// Dest = coords a l'écran
byte* Dest = Ecran + Pos_Y * Largeur_ecran + Pos_X;
int dx,cx;
int x,y;
// Pour chaque ligne
for(dx=Hauteur;dx>0;dx--)
for(y=Hauteur;y>0;y--)
{
// Pour chaque pixel
for(cx=Largeur;cx>0;cx--)
for(x=Largeur;x>0;x--)
{
*Dest = Table_de_conversion[*Dest];
Dest ++;
@ -280,9 +280,9 @@ void Afficher_une_ligne_transparente_mono_a_l_ecran_Simple(
// Utilisé par les brosses en mode zoom
{
byte* Dest = Ecran+ Pos_Y * Largeur_ecran + Pos_X;
int Compteur;
int x;
// Pour chaque pixel
for(Compteur=0;Compteur<Largeur;Compteur++)
for(x=0;x<Largeur;x++)
{
if (Couleur_transparence!=*Ligne)
*Dest = Couleur;
@ -308,12 +308,12 @@ void Afficher_partie_de_l_ecran_zoomee_Simple(
// Pour chaque ligne à zoomer
while(1)
{
int CX;
int x;
// On éclate la ligne
Zoomer_une_ligne(Src,Buffer,Loupe_Facteur,Largeur);
// On l'affiche Facteur fois, sur des lignes consécutives
CX = Loupe_Facteur;
x = Loupe_Facteur;
// Pour chaque ligne
do{
// On affiche la ligne zoomée
@ -329,8 +329,8 @@ void Afficher_partie_de_l_ecran_zoomee_Simple(
Largeur*Loupe_Facteur,Hauteur);
return;
}
CX--;
}while (CX > 0);
x--;
}while (x > 0);
Src += Largeur_image;
}
// ATTENTION on n'arrive jamais ici !
@ -341,10 +341,10 @@ void Afficher_une_ligne_transparente_a_l_ecran_Simple(word Pos_X,word Pos_Y,word
byte* Src = Ligne;
byte* Dest = Ecran + Pos_Y * Largeur_ecran + Pos_X;
word cx;
word x;
// Pour chaque pixel de la ligne
for(cx = Largeur;cx > 0;cx--)
for(x = Largeur;x > 0;x--)
{
if(*Src!=Couleur_transparence)
*Dest = *Src;
@ -362,7 +362,7 @@ void Display_brush_Color_zoom_Simple(word Pos_X,word Pos_Y,
byte * Buffer)
{
byte* Src = Brosse+Decalage_Y*Largeur_brosse + Decalage_X;
word DX = Pos_Y;
word y = Pos_Y;
byte bx;
// Pour chaque ligne
@ -372,9 +372,9 @@ void Display_brush_Color_zoom_Simple(word Pos_X,word Pos_Y,
// On affiche facteur fois la ligne zoomée
for(bx=Loupe_Facteur;bx>0;bx--)
{
Afficher_une_ligne_transparente_a_l_ecran_Simple(Pos_X,DX,Largeur*Loupe_Facteur,Buffer,Couleur_de_transparence);
DX++;
if(DX==Pos_Y_Fin)
Afficher_une_ligne_transparente_a_l_ecran_Simple(Pos_X,y,Largeur*Loupe_Facteur,Buffer,Couleur_de_transparence);
y++;
if(y==Pos_Y_Fin)
{
return;
}
@ -395,7 +395,7 @@ void Display_brush_Mono_zoom_Simple(word Pos_X, word Pos_Y,
{
byte* Src = Brosse + Decalage_Y * Largeur_brosse + Decalage_X;
int DX=Pos_Y;
int y=Pos_Y;
//Pour chaque ligne à zoomer :
while(1)
@ -414,13 +414,13 @@ void Display_brush_Mono_zoom_Simple(word Pos_X, word Pos_Y,
{
// On affiche la ligne zoomée
Afficher_une_ligne_transparente_mono_a_l_ecran_Simple(
Pos_X, DX, Largeur * Loupe_Facteur,
Pos_X, y, Largeur * Loupe_Facteur,
Buffer, Couleur_de_transparence, Couleur
);
// On passe à la ligne suivante
DX++;
y++;
// On vérifie qu'on est pas à la ligne finale
if(DX == Pos_Y_Fin)
if(y == Pos_Y_Fin)
{
UpdateRect( Pos_X, Pos_Y,
Largeur * Loupe_Facteur, Pos_Y_Fin - Pos_Y );
@ -439,7 +439,7 @@ void Clear_brush_zoom_Simple(word Pos_X,word Pos_Y,word Decalage_X,word Decalage
{
// En fait on va recopier l'image non zoomée dans la partie zoomée !
byte* Src = Principal_Ecran + Decalage_Y * Largeur_image + Decalage_X;
int DX = Pos_Y;
int y = Pos_Y;
int bx;
// Pour chaque ligne à zoomer
@ -450,12 +450,12 @@ void Clear_brush_zoom_Simple(word Pos_X,word Pos_Y,word Decalage_X,word Decalage
// Pour chaque ligne
do{
Afficher_une_ligne_ecran_Simple(Pos_X,DX,
Afficher_une_ligne_ecran_Simple(Pos_X,y,
Largeur * Loupe_Facteur,Buffer);
// Ligne suivante
DX++;
if(DX==Pos_Y_Fin)
y++;
if(y==Pos_Y_Fin)
{
UpdateRect(Pos_X,Pos_Y,
Largeur*Loupe_Facteur,Pos_Y_Fin-Pos_Y);

View File

@ -39,7 +39,7 @@
void Display_brush_Color_zoom_Simple (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_brosse,byte * Buffer);
void Display_brush_Mono_zoom_Simple (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Pos_Y_Fin,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse,byte * Buffer);
void Clear_brush_zoom_Simple (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_image,byte * Buffer);
void Affiche_brosse_Simple (byte * B, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse);
void Affiche_brosse_Simple (byte * brush, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse);
void Afficher_une_ligne_transparente_mono_a_l_ecran_Simple(
word Pos_X, word Pos_Y, word Largeur, byte* Ligne,

View File

@ -58,9 +58,9 @@ void Afficher_partie_de_l_ecran_Tall (word Largeur,word Hauteur,word Largeur_ima
{
byte* Dest=Ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src=Principal_Decalage_Y*Largeur_image+Principal_Decalage_X+Principal_Ecran; //Coords de départ ds la source (Src)
int dx;
int y;
for(dx=Hauteur;dx!=0;dx--)
for(y=Hauteur;y!=0;y--)
// Pour chaque ligne
{
// On fait une copie de la ligne
@ -130,11 +130,11 @@ void Ligne_horizontale_XOR_Tall(word Pos_X,word Pos_Y,word Largeur)
void Ligne_verticale_XOR_Tall(word Pos_X,word Pos_Y,word Hauteur)
{
int i;
byte Color;
byte color;
for (i=Pos_Y*2;i<(Pos_Y+Hauteur)*2;i++)
{
Color=*(Ecran+Pos_X+i*Largeur_ecran);
*(Ecran+Pos_X+i*Largeur_ecran)=~Color;
color=*(Ecran+Pos_X+i*Largeur_ecran);
*(Ecran+Pos_X+i*Largeur_ecran)=~color;
}
}
@ -145,13 +145,13 @@ void Display_brush_Color_Tall(word Pos_X,word Pos_Y,word Decalage_X,word Decalag
// Src = Position dans la brosse
byte* Src = Brosse + Decalage_Y * Largeur_brosse + Decalage_X;
word DX,CX;
word x,y;
// Pour chaque ligne
for(DX = Hauteur;DX > 0; DX--)
for(y = Hauteur;y > 0; y--)
{
// Pour chaque pixel
for(CX = Largeur;CX > 0; CX--)
for(x = Largeur;x > 0; x--)
{
// On vérifie que ce n'est pas la transparence
if(*Src != Couleur_de_transparence)
@ -180,12 +180,12 @@ void Display_brush_Mono_Tall(word Pos_X, word Pos_Y,
// l'écran
byte* Src=Largeur_brosse*Decalage_Y+Decalage_X+Brosse; // Src = adr ds
// la brosse
int dx,cx;
int x,y;
for(dx=Hauteur;dx!=0;dx--)
for(y=Hauteur;y!=0;y--)
//Pour chaque ligne
{
for(cx=Largeur;cx!=0;cx--)
for(x=Largeur;x!=0;x--)
//Pour chaque pixel
{
if (*Src!=Couleur_de_transparence)
@ -210,9 +210,9 @@ void Clear_brush_Tall(word Pos_X,word Pos_Y,__attribute__((unused)) word Decalag
{
byte* Dest=Ecran+Pos_X+Pos_Y*2*Largeur_ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src = ( Pos_Y + Principal_Decalage_Y ) * Largeur_image + Pos_X + Principal_Decalage_X + Principal_Ecran; //Coords de départ ds la source (Src)
int dx;
int y;
for(dx=Hauteur;dx!=0;dx--)
for(y=Hauteur;y!=0;y--)
// Pour chaque ligne
{
// On fait une copie de la ligne
@ -228,20 +228,20 @@ void Clear_brush_Tall(word Pos_X,word Pos_Y,__attribute__((unused)) word Decalag
}
// Affiche une brosse (arbitraire) à l'écran
void Affiche_brosse_Tall(byte * B, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse)
void Affiche_brosse_Tall(byte * brush, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse)
{
// Dest = Position à l'écran
byte* Dest = Ecran + Pos_Y * 2 * Largeur_ecran + Pos_X;
// Src = Position dans la brosse
byte* Src = B + Decalage_Y * Largeur_brosse + Decalage_X;
byte* Src = brush + Decalage_Y * Largeur_brosse + Decalage_X;
word DX,CX;
word x,y;
// Pour chaque ligne
for(DX = Hauteur;DX > 0; DX--)
for(y = Hauteur;y > 0; y--)
{
// Pour chaque pixel
for(CX = Largeur;CX > 0; CX--)
for(x = Largeur;x > 0; x--)
{
// On vérifie que ce n'est pas la transparence
if(*Src != Couleur_de_transparence)
@ -264,13 +264,13 @@ void Remap_screen_Tall(word Pos_X,word Pos_Y,word Largeur,word Hauteur,byte * Ta
{
// Dest = coords a l'écran
byte* Dest = Ecran + Pos_Y * 2 * Largeur_ecran + Pos_X;
int dx,cx;
int x,y;
// Pour chaque ligne
for(dx=Hauteur*2;dx>0;dx--)
for(y=Hauteur*2;y>0;y--)
{
// Pour chaque pixel
for(cx=Largeur;cx>0;cx--)
for(x=Largeur;x>0;x--)
{
*Dest = Table_de_conversion[*Dest];
Dest ++;
@ -306,12 +306,12 @@ void Afficher_partie_de_l_ecran_zoomee_Tall(
// Pour chaque ligne à zoomer
while(1)
{
int CX;
int x;
// On éclate la ligne
Zoomer_une_ligne(Src,Buffer,Loupe_Facteur,Largeur);
// On l'affiche Facteur fois, sur des lignes consécutives
CX = Loupe_Facteur*2;
x = Loupe_Facteur*2;
// Pour chaque ligne
do{
// On affiche la ligne zoomée
@ -327,8 +327,8 @@ void Afficher_partie_de_l_ecran_zoomee_Tall(
Largeur*Loupe_Facteur,Hauteur);
return;
}
CX--;
}while (CX > 0);
x--;
}while (x > 0);
Src += Largeur_image;
}
// ATTENTION on n'arrive jamais ici !
@ -343,7 +343,7 @@ void Display_brush_Color_zoom_Tall(word Pos_X,word Pos_Y,
byte * Buffer)
{
byte* Src = Brosse+Decalage_Y*Largeur_brosse + Decalage_X;
word DX = Pos_Y;
word y = Pos_Y;
byte bx;
// Pour chaque ligne
@ -353,10 +353,10 @@ void Display_brush_Color_zoom_Tall(word Pos_X,word Pos_Y,
// On affiche facteur fois la ligne zoomée
for(bx=Loupe_Facteur;bx>0;bx--)
{
Afficher_une_ligne_transparente_a_l_ecran_Simple(Pos_X,DX*2,Largeur*Loupe_Facteur,Buffer,Couleur_de_transparence);
memcpy(Ecran + (DX*2 +1) * Largeur_ecran + Pos_X, Ecran + DX*2* Largeur_ecran + Pos_X, Largeur*Loupe_Facteur);
DX++;
if(DX==Pos_Y_Fin)
Afficher_une_ligne_transparente_a_l_ecran_Simple(Pos_X,y*2,Largeur*Loupe_Facteur,Buffer,Couleur_de_transparence);
memcpy(Ecran + (y*2 +1) * Largeur_ecran + Pos_X, Ecran + y*2* Largeur_ecran + Pos_X, Largeur*Loupe_Facteur);
y++;
if(y==Pos_Y_Fin)
{
return;
}
@ -377,7 +377,7 @@ void Display_brush_Mono_zoom_Tall(word Pos_X, word Pos_Y,
{
byte* Src = Brosse + Decalage_Y * Largeur_brosse + Decalage_X;
int DX=Pos_Y*2;
int y=Pos_Y*2;
//Pour chaque ligne à zoomer :
while(1)
@ -396,13 +396,13 @@ void Display_brush_Mono_zoom_Tall(word Pos_X, word Pos_Y,
{
// On affiche la ligne zoomée
Afficher_une_ligne_transparente_mono_a_l_ecran_Simple(
Pos_X, DX, Largeur * Loupe_Facteur,
Pos_X, y, Largeur * Loupe_Facteur,
Buffer, Couleur_de_transparence, Couleur
);
// On passe à la ligne suivante
DX++;
y++;
// On vérifie qu'on est pas à la ligne finale
if(DX == Pos_Y_Fin*2)
if(y == Pos_Y_Fin*2)
{
UpdateRect( Pos_X, Pos_Y,
Largeur * Loupe_Facteur, Pos_Y_Fin - Pos_Y );
@ -421,7 +421,7 @@ void Clear_brush_zoom_Tall(word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y
{
// En fait on va recopier l'image non zoomée dans la partie zoomée !
byte* Src = Principal_Ecran + Decalage_Y * Largeur_image + Decalage_X;
int DX = Pos_Y;
int y = Pos_Y;
int bx;
// Pour chaque ligne à zoomer
@ -432,12 +432,12 @@ void Clear_brush_zoom_Tall(word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y
// Pour chaque ligne
do{
Afficher_une_ligne_ecran_Tall(Pos_X,DX,
Afficher_une_ligne_ecran_Tall(Pos_X,y,
Largeur * Loupe_Facteur,Buffer);
// Ligne suivante
DX++;
if(DX==Pos_Y_Fin)
y++;
if(y==Pos_Y_Fin)
{
UpdateRect(Pos_X,Pos_Y,
Largeur*Loupe_Facteur,Pos_Y_Fin-Pos_Y);

View File

@ -39,4 +39,4 @@
void Display_brush_Color_zoom_Tall (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_brosse,byte * Buffer);
void Display_brush_Mono_zoom_Tall (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Pos_Y_Fin,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse,byte * Buffer);
void Clear_brush_zoom_Tall (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_image,byte * Buffer);
void Affiche_brosse_Tall (byte * B, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse);
void Affiche_brosse_Tall (byte * brush, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse);

View File

@ -57,10 +57,10 @@ void Afficher_partie_de_l_ecran_Wide (word Largeur,word Hauteur,word Largeur_ima
{
byte* Dest=Ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src=Principal_Decalage_Y*Largeur_image+Principal_Decalage_X+Principal_Ecran; //Coords de départ ds la source (Src)
int dx;
int y;
int dy;
for(dx=Hauteur;dx!=0;dx--)
for(y=Hauteur;y!=0;y--)
// Pour chaque ligne
{
// On fait une copie de la ligne
@ -129,13 +129,13 @@ void Ligne_horizontale_XOR_Wide(word Pos_X,word Pos_Y,word Largeur)
void Ligne_verticale_XOR_Wide(word Pos_X,word Pos_Y,word Hauteur)
{
int i;
byte Color;
byte color;
byte *Dest=Ecran+Pos_X*2+Pos_Y*Largeur_ecran*2;
for (i=Hauteur;i>0;i--)
{
Color=~*Dest;
*Dest=Color;
*(Dest+1)=Color;
color=~*Dest;
*Dest=color;
*(Dest+1)=color;
Dest+=Largeur_ecran*2;
}
}
@ -147,13 +147,13 @@ void Display_brush_Color_Wide(word Pos_X,word Pos_Y,word Decalage_X,word Decalag
// Src = Position dans la brosse
byte* Src = Brosse + Decalage_Y * Largeur_brosse + Decalage_X;
word DX,CX;
word x,y;
// Pour chaque ligne
for(DX = Hauteur;DX > 0; DX--)
for(y = Hauteur;y > 0; y--)
{
// Pour chaque pixel
for(CX = Largeur;CX > 0; CX--)
for(x = Largeur;x > 0; x--)
{
// On vérifie que ce n'est pas la transparence
if(*Src != Couleur_de_transparence)
@ -182,12 +182,12 @@ void Display_brush_Mono_Wide(word Pos_X, word Pos_Y,
// l'écran
byte* Src=Largeur_brosse*Decalage_Y+Decalage_X+Brosse; // Src = adr ds
// la brosse
int dx,cx;
int x,y;
for(dx=Hauteur;dx!=0;dx--)
for(y=Hauteur;y!=0;y--)
//Pour chaque ligne
{
for(cx=Largeur;cx!=0;cx--)
for(x=Largeur;x!=0;x--)
//Pour chaque pixel
{
if (*Src!=Couleur_de_transparence)
@ -209,13 +209,13 @@ void Clear_brush_Wide(word Pos_X,word Pos_Y,__attribute__((unused)) word Decalag
{
byte* Dest=Ecran+Pos_X*2+Pos_Y*2*Largeur_ecran; //On va se mettre en 0,0 dans l'écran (Dest)
byte* Src = ( Pos_Y + Principal_Decalage_Y ) * Largeur_image + Pos_X + Principal_Decalage_X + Principal_Ecran; //Coords de départ ds la source (Src)
int dx;
int cx;
int y;
int x;
for(dx=Hauteur;dx!=0;dx--)
for(y=Hauteur;y!=0;y--)
// Pour chaque ligne
{
for(cx=Largeur;cx!=0;cx--)
for(x=Largeur;x!=0;x--)
//Pour chaque pixel
{
*(Dest+1)=*Dest=*Src;
@ -233,20 +233,20 @@ void Clear_brush_Wide(word Pos_X,word Pos_Y,__attribute__((unused)) word Decalag
}
// Affiche une brosse (arbitraire) à l'écran
void Affiche_brosse_Wide(byte * B, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse)
void Affiche_brosse_Wide(byte * brush, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse)
{
// Dest = Position à l'écran
byte* Dest = Ecran + Pos_Y * 2 * Largeur_ecran + Pos_X * 2;
// Src = Position dans la brosse
byte* Src = B + Decalage_Y * Largeur_brosse + Decalage_X;
byte* Src = brush + Decalage_Y * Largeur_brosse + Decalage_X;
word DX,CX;
word x,y;
// Pour chaque ligne
for(DX = Hauteur;DX > 0; DX--)
for(y = Hauteur;y > 0; y--)
{
// Pour chaque pixel
for(CX = Largeur;CX > 0; CX--)
for(x = Largeur;x > 0; x--)
{
// On vérifie que ce n'est pas la transparence
if(*Src != Couleur_de_transparence)
@ -268,13 +268,13 @@ void Remap_screen_Wide(word Pos_X,word Pos_Y,word Largeur,word Hauteur,byte * Ta
{
// Dest = coords a l'écran
byte* Dest = Ecran + Pos_Y * 2 * Largeur_ecran + Pos_X * 2;
int dx,cx;
int x,y;
// Pour chaque ligne
for(dx=Hauteur;dx>0;dx--)
for(y=Hauteur;y>0;y--)
{
// Pour chaque pixel
for(cx=Largeur;cx>0;cx--)
for(x=Largeur;x>0;x--)
{
*(Dest+1) = *Dest = Table_de_conversion[*Dest];
Dest +=2;
@ -296,10 +296,10 @@ void Afficher_une_ligne_ecran_fast_Wide(word Pos_X,word Pos_Y,word Largeur,byte
void Afficher_une_ligne_ecran_Wide(word Pos_X,word Pos_Y,word Largeur,byte * Ligne)
/* On affiche une ligne de pixels en les doublant. */
{
int dx;
int x;
byte *Dest;
Dest=Ecran+Pos_X*2+Pos_Y*2*Largeur_ecran;
for(dx=Largeur;dx>0;dx--)
for(x=Largeur;x>0;x--)
{
*Dest=*Ligne;
Dest++;
@ -315,9 +315,9 @@ void Afficher_une_ligne_transparente_mono_a_l_ecran_Wide(
// Utilisé par les brosses en mode zoom
{
byte* Dest = Ecran+ Pos_Y*2 * Largeur_ecran + Pos_X*2;
int Compteur;
int x;
// Pour chaque pixel
for(Compteur=0;Compteur<Largeur;Compteur++)
for(x=0;x<Largeur;x++)
{
if (Couleur_transparence!=*Ligne)
{
@ -346,12 +346,12 @@ void Afficher_partie_de_l_ecran_zoomee_Wide(
// Pour chaque ligne à zoomer
while(1)
{
int CX;
int x;
// On éclate la ligne
Zoomer_une_ligne(Src,Buffer,Loupe_Facteur*2,Largeur);
// On l'affiche Facteur fois, sur des lignes consécutives
CX = Loupe_Facteur;
x = Loupe_Facteur;
// Pour chaque ligne
do{
// On affiche la ligne zoomée
@ -367,8 +367,8 @@ void Afficher_partie_de_l_ecran_zoomee_Wide(
Largeur*Loupe_Facteur,Hauteur);
return;
}
CX--;
}while (CX > 0);
x--;
}while (x > 0);
Src += Largeur_image;
}
// ATTENTION on n'arrive jamais ici !
@ -379,10 +379,10 @@ void Afficher_une_ligne_transparente_a_l_ecran_Wide(word Pos_X,word Pos_Y,word L
byte* Src = Ligne;
byte* Dest = Ecran + Pos_Y * 2 * Largeur_ecran + Pos_X * 2;
word cx;
word x;
// Pour chaque pixel de la ligne
for(cx = Largeur;cx > 0;cx--)
for(x = Largeur;x > 0;x--)
{
if(*Src!=Couleur_transparence)
{
@ -403,7 +403,7 @@ void Display_brush_Color_zoom_Wide(word Pos_X,word Pos_Y,
byte * Buffer)
{
byte* Src = Brosse+Decalage_Y*Largeur_brosse + Decalage_X;
word DX = Pos_Y;
word y = Pos_Y;
byte bx;
// Pour chaque ligne
@ -413,9 +413,9 @@ void Display_brush_Color_zoom_Wide(word Pos_X,word Pos_Y,
// On affiche facteur fois la ligne zoomée
for(bx=Loupe_Facteur;bx>0;bx--)
{
Afficher_une_ligne_transparente_a_l_ecran_Wide(Pos_X,DX,Largeur*Loupe_Facteur,Buffer,Couleur_de_transparence);
DX++;
if(DX==Pos_Y_Fin)
Afficher_une_ligne_transparente_a_l_ecran_Wide(Pos_X,y,Largeur*Loupe_Facteur,Buffer,Couleur_de_transparence);
y++;
if(y==Pos_Y_Fin)
{
return;
}
@ -436,7 +436,7 @@ void Display_brush_Mono_zoom_Wide(word Pos_X, word Pos_Y,
{
byte* Src = Brosse + Decalage_Y * Largeur_brosse + Decalage_X;
int DX=Pos_Y;
int y=Pos_Y;
//Pour chaque ligne à zoomer :
while(1)
@ -455,13 +455,13 @@ void Display_brush_Mono_zoom_Wide(word Pos_X, word Pos_Y,
{
// On affiche la ligne zoomée
Afficher_une_ligne_transparente_mono_a_l_ecran_Wide(
Pos_X, DX, Largeur * Loupe_Facteur,
Pos_X, y, Largeur * Loupe_Facteur,
Buffer, Couleur_de_transparence, Couleur
);
// On passe à la ligne suivante
DX++;
y++;
// On vérifie qu'on est pas à la ligne finale
if(DX == Pos_Y_Fin)
if(y == Pos_Y_Fin)
{
UpdateRect( Pos_X, Pos_Y,
Largeur * Loupe_Facteur, Pos_Y_Fin - Pos_Y );
@ -480,7 +480,7 @@ void Clear_brush_zoom_Wide(word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y
{
// En fait on va recopier l'image non zoomée dans la partie zoomée !
byte* Src = Principal_Ecran + Decalage_Y * Largeur_image + Decalage_X;
int DX = Pos_Y;
int y = Pos_Y;
int bx;
// Pour chaque ligne à zoomer
@ -491,12 +491,12 @@ void Clear_brush_zoom_Wide(word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y
// Pour chaque ligne
do{
Afficher_une_ligne_ecran_fast_Wide(Pos_X,DX,
Afficher_une_ligne_ecran_fast_Wide(Pos_X,y,
Largeur * Loupe_Facteur,Buffer);
// Ligne suivante
DX++;
if(DX==Pos_Y_Fin)
y++;
if(y==Pos_Y_Fin)
{
UpdateRect(Pos_X,Pos_Y,
Largeur*Loupe_Facteur,Pos_Y_Fin-Pos_Y);

View File

@ -39,7 +39,7 @@
void Display_brush_Color_zoom_Wide (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_brosse,byte * Buffer);
void Display_brush_Mono_zoom_Wide (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Pos_Y_Fin,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse,byte * Buffer);
void Clear_brush_zoom_Wide (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Pos_Y_Fin,byte Couleur_de_transparence,word Largeur_image,byte * Buffer);
void Affiche_brosse_Wide (byte * B, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse);
void Affiche_brosse_Wide (byte * brush, word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,word Largeur_brosse);
void Afficher_une_ligne_ecran_fast_Wide (word Pos_X,word Pos_Y,word Largeur,byte * Ligne);
void Afficher_une_ligne_transparente_a_l_ecran_Wide(word Pos_X,word Pos_Y,word Largeur,byte* Ligne,byte Couleur_transparence);

View File

@ -104,7 +104,7 @@ int Charger_INI_Seek_pattern(char * Buffer,char * Pattern)
int Charger_INI_Reach_group(FILE * File,char * Buffer,char * Group)
int Charger_INI_Reach_group(FILE * file,char * Buffer,char * Group)
{
int Arret;
char * Group_upper;
@ -122,7 +122,7 @@ int Charger_INI_Reach_group(FILE * File,char * Buffer,char * Group)
do
{
// On lit une ligne dans le fichier:
if (fgets(Buffer,1024,File)==0)
if (fgets(Buffer,1024,file)==0)
{
free(Buffer_upper);
free(Group_upper);
@ -146,7 +146,7 @@ int Charger_INI_Reach_group(FILE * File,char * Buffer,char * Group)
return 0;
}
int Charger_INI_Get_string(FILE * File,char * Buffer,char * Option,char * Retour)
int Charger_INI_Get_string(FILE * file,char * Buffer,char * Option,char * Retour)
{
int Arret;
char * Option_upper;
@ -165,7 +165,7 @@ int Charger_INI_Get_string(FILE * File,char * Buffer,char * Option,char * Retour
do
{
// On lit une ligne dans le fichier:
if (fgets(Buffer,1024,File)==0)
if (fgets(Buffer,1024,file)==0)
{
free(Buffer_upper);
free(Option_upper);
@ -317,7 +317,7 @@ int Charger_INI_Get_value(char * String,int * Index,int * Value)
int Charger_INI_Get_values(FILE * File,char * Buffer,char * Option,int Nb_values_expected,int * Values)
int Charger_INI_Get_values(FILE * file,char * Buffer,char * Option,int Nb_values_expected,int * Values)
{
int Arret;
char * Option_upper;
@ -337,7 +337,7 @@ int Charger_INI_Get_values(FILE * File,char * Buffer,char * Option,int Nb_values
do
{
// On lit une ligne dans le fichier:
if (fgets(Buffer,1024,File)==0)
if (fgets(Buffer,1024,file)==0)
{
free(Buffer_upper);
free(Option_upper);
@ -397,7 +397,7 @@ int Charger_INI_Get_values(FILE * File,char * Buffer,char * Option,int Nb_values
int Charger_INI(struct S_Config * Conf)
int Charger_INI(T_Config * Conf)
{
FILE * Fichier;
char * Buffer;

View File

@ -18,6 +18,6 @@
write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
int Charger_INI(struct S_Config * Conf);
int Charger_INI(T_Config * Conf);
int Charger_INI_Seek_pattern(char * Buffer,char * Pattern);
void Charger_INI_Clear_string(char * String);

View File

@ -71,7 +71,7 @@ void Inserer_caractere(char * Chaine, char Lettre, byte Position)
Chaine[Position]='\0';
}
int CaractereValide(int Caractere)
int CaractereValide(int c)
{
// Sous Linux: Seul le / est strictement interdit, mais beaucoup
// d'autres poseront des problèmes au shell, alors on évite.
@ -86,11 +86,11 @@ int CaractereValide(int Caractere)
#endif
int Position;
if (Caractere < ' ' || Caractere > 255)
if (c < ' ' || c > 255)
return 0;
for (Position=0; Position<(long)sizeof(CaracteresInterdits); Position++)
if (Caractere == CaracteresInterdits[Position])
if (c == CaracteresInterdits[Position])
return 0;
return 1;
}

View File

@ -387,7 +387,7 @@ void Sauver_INI_Flush(FILE * Old_file,FILE * New_file,char * Buffer)
int Sauver_INI(struct S_Config * Conf)
int Sauver_INI(T_Config * Conf)
{
FILE * Ancien_fichier;
FILE * Nouveau_fichier;

View File

@ -18,4 +18,4 @@
write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
int Sauver_INI(struct S_Config * Conf);
int Sauver_INI(T_Config * Conf);

58
shade.c
View File

@ -67,7 +67,7 @@ void Bouton_Quick_shade_Mode(void)
void Shade_Blocs_degrades(void)
{
word Curseur=0;
word cursor=0;
word Nb_shades=0;
short Shade_traite,Ancien_shade_traite;
word Taille_shade=0;
@ -77,17 +77,17 @@ void Shade_Blocs_degrades(void)
short Debut_X,Debut_Y,Fin_X,Fin_Y;
// On commence par compter le nombre de shades
while (Curseur<512)
while (cursor<512)
{
while ((Curseur<512) && (Shade_Liste[Shade_Actuel].Liste[Curseur]&0xFF00))
Curseur++;
while ((cursor<512) && (Shade_Liste[Shade_Actuel].Liste[cursor]&0xFF00))
cursor++;
if (Curseur<512)
if (cursor<512)
{
Nb_shades++;
while ( (Curseur<512)
&& (!(Shade_Liste[Shade_Actuel].Liste[Curseur]&0xFF00)) )
Curseur++;
while ( (cursor<512)
&& (!(Shade_Liste[Shade_Actuel].Liste[cursor]&0xFF00)) )
cursor++;
}
}
@ -101,7 +101,7 @@ void Shade_Blocs_degrades(void)
Fin_X=Debut_X+Taille_X;
Fin_Y=Debut_Y+Taille_Y;
Curseur=0;
cursor=0;
Ancien_shade_traite=-1;
for (Pos_Y=Debut_Y;Pos_Y<Fin_Y;Pos_Y++)
@ -112,13 +112,13 @@ void Shade_Blocs_degrades(void)
if (Shade_traite>Ancien_shade_traite)
{
// On commence par sauter tous les vides jusqu'au prochain shade
while ((Curseur<512) && (Shade_Liste[Shade_Actuel].Liste[Curseur]&0xFF00))
Curseur++;
Debut_shade=Curseur;
while ((cursor<512) && (Shade_Liste[Shade_Actuel].Liste[cursor]&0xFF00))
cursor++;
Debut_shade=cursor;
// puis regarde sa taille
while ((Curseur<512) && (!(Shade_Liste[Shade_Actuel].Liste[Curseur]&0xFF00)))
Curseur++;
Taille_shade=Curseur-Debut_shade;
while ((cursor<512) && (!(Shade_Liste[Shade_Actuel].Liste[cursor]&0xFF00)))
cursor++;
Taille_shade=cursor-Debut_shade;
Ancien_shade_traite=Shade_traite;
}
@ -283,7 +283,7 @@ void Supprimer_shade(word Select_Debut,word Select_Fin)
void Inserer_shade(byte Premiere_couleur, byte Derniere_couleur, word Select_Debut)
{
word Curseur,Limite;
word cursor,Limite;
word Temp;
if (Derniere_couleur<Premiere_couleur)
@ -296,13 +296,13 @@ void Inserer_shade(byte Premiere_couleur, byte Derniere_couleur, word Select_Deb
// Avant d'insérer quoi que ce soit, on efface les éventuelles couleurs que
// l'on va réinsérer:
Limite=512-Select_Debut;
for (Curseur=0; Curseur<512; Curseur++)
for (cursor=0; cursor<512; cursor++)
{
if (!(Shade_Liste[Shade_Actuel].Liste[Curseur]&0x0100))
if (!(Shade_Liste[Shade_Actuel].Liste[cursor]&0x0100))
for (Temp=Premiere_couleur; Temp<=Derniere_couleur; Temp++)
if ( (Temp-Premiere_couleur<Limite)
&& ((Shade_Liste[Shade_Actuel].Liste[Curseur]&0xFF)==Temp) )
Shade_Liste[Shade_Actuel].Liste[Curseur]=(Shade_Liste[Shade_Actuel].Liste[Curseur]&0x8000)|0x0100;
&& ((Shade_Liste[Shade_Actuel].Liste[cursor]&0xFF)==Temp) )
Shade_Liste[Shade_Actuel].Liste[cursor]=(Shade_Liste[Shade_Actuel].Liste[cursor]&0x8000)|0x0100;
}
// Voilà... Maintenant on peut y aller peinard.
@ -311,22 +311,22 @@ void Inserer_shade(byte Premiere_couleur, byte Derniere_couleur, word Select_Deb
if (Limite>=512)
Temp=512-Select_Debut;
for (Curseur=511;Curseur>=Limite;Curseur--)
Shade_Liste[Shade_Actuel].Liste[Curseur]=Shade_Liste[Shade_Actuel].Liste[Curseur-Temp];
for (cursor=511;cursor>=Limite;cursor--)
Shade_Liste[Shade_Actuel].Liste[cursor]=Shade_Liste[Shade_Actuel].Liste[cursor-Temp];
for (Curseur=Select_Debut+Temp;Select_Debut<Curseur;Select_Debut++,Premiere_couleur++)
for (cursor=Select_Debut+Temp;Select_Debut<cursor;Select_Debut++,Premiere_couleur++)
Shade_Liste[Shade_Actuel].Liste[Select_Debut]=Premiere_couleur;
}
void Inserer_case_vide_dans_shade(word Position)
{
word Curseur;
word cursor;
if (Position>=512) return;
for (Curseur=511;Curseur>Position;Curseur--)
Shade_Liste[Shade_Actuel].Liste[Curseur]=Shade_Liste[Shade_Actuel].Liste[Curseur-1];
for (cursor=511;cursor>Position;cursor--)
Shade_Liste[Shade_Actuel].Liste[cursor]=Shade_Liste[Shade_Actuel].Liste[cursor-1];
Shade_Liste[Shade_Actuel].Liste[Position]=0x0100;
}
@ -450,7 +450,7 @@ int Menu_Shade(void)
word * Buffer_Undo; // Buffer du Undo
word * Pointeur_temp;
byte Couleur;
byte Click;
byte click;
Buffer =(word *)malloc(512*sizeof(word));
@ -952,8 +952,8 @@ int Menu_Shade(void)
case SDLK_BACKQUOTE : // Récupération d'une couleur derrière le menu
case SDLK_COMMA :
Recuperer_couleur_derriere_fenetre(&Couleur,&Click);
if (Click)
Recuperer_couleur_derriere_fenetre(&Couleur,&click);
if (click)
{
Effacer_curseur();
Couleur_temporaire=Couleur;

View File

@ -204,7 +204,50 @@ typedef struct
word Touche2;
} __attribute__((__packed__)) Config_Infos_touche;
typedef struct
{
byte Fonte;
int Lire_les_fichiers_caches;
int Lire_les_repertoires_caches;
// int Lire_les_repertoires_systemes;
byte Afficher_limites_image;
byte Curseur;
byte Maximize_preview;
byte Auto_set_res;
byte Coords_rel;
byte Backup;
byte Adjust_brush_pick;
byte Auto_save;
byte Nb_pages_Undo;
byte Indice_Sensibilite_souris_X;
byte Indice_Sensibilite_souris_Y;
byte Mouse_Facteur_de_correction_X;
byte Mouse_Facteur_de_correction_Y;
byte Mouse_Merge_movement;
byte Valeur_tempo_jauge_gauche;
byte Valeur_tempo_jauge_droite;
long Chrono_delay;
Composantes Coul_menu_pref[4];
int Nb_max_de_vertex_par_polygon;
byte Clear_palette;
byte Set_resolution_according_to;
byte Ratio;
byte Fast_zoom;
byte Find_file_fast;
byte Couleurs_separees;
word Palette_Cells_X;
word Palette_Cells_Y;
byte FX_Feedback;
byte Safety_colors;
byte Opening_message;
byte Clear_with_stencil;
byte Auto_discontinuous;
byte Taille_ecran_dans_GIF;
byte Auto_nb_used;
byte Resolution_par_defaut;
char *Bookmark_directory[NB_BOOKMARKS]; // independant malloc of adaptive size
char Bookmark_label[NB_BOOKMARKS][8+1];
} T_Config;
// Structures utilisées pour les descriptions de pages et de liste de pages.
// Lorsqu'on gèrera les animations, il faudra aussi des listes de listes de

14
texte.c
View File

@ -368,7 +368,7 @@ int Support_TrueType()
#ifndef NOTTF
byte *Rendu_Texte_TTF(const char *Chaine, int Numero_fonte, int Taille, int AntiAlias, int Bold, int Italic, int *Largeur, int *Hauteur)
byte *Rendu_Texte_TTF(const char *Chaine, int Numero_fonte, int Taille, int antialias, int bold, int Italic, int *Largeur, int *Hauteur)
{
TTF_Font *Fonte;
SDL_Surface * TexteColore;
@ -390,11 +390,11 @@ byte *Rendu_Texte_TTF(const char *Chaine, int Numero_fonte, int Taille, int Anti
Style=0;
if (Italic)
Style|=TTF_STYLE_ITALIC;
if (Bold)
if (bold)
Style|=TTF_STYLE_BOLD;
TTF_SetFontStyle(Fonte, Style);
// Couleurs
if (AntiAlias)
if (antialias)
{
Couleur_Avant = Conversion_couleur_SDL(Fore_color);
Couleur_Arriere = Conversion_couleur_SDL(Back_color);
@ -407,7 +407,7 @@ byte *Rendu_Texte_TTF(const char *Chaine, int Numero_fonte, int Taille, int Anti
// Rendu du texte: crée une surface SDL RGB 24bits
if (AntiAlias)
if (antialias)
TexteColore=TTF_RenderText_Shaded(Fonte, Chaine, Couleur_Avant, Couleur_Arriere );
else
TexteColore=TTF_RenderText_Solid(Fonte, Chaine, Couleur_Avant);
@ -429,7 +429,7 @@ byte *Rendu_Texte_TTF(const char *Chaine, int Numero_fonte, int Taille, int Anti
TTF_CloseFont(Fonte);
return NULL;
}
if (!AntiAlias)
if (!antialias)
{
// Mappage des couleurs
for (Indice=0; Indice < Texte8Bit->w * Texte8Bit->h; Indice++)
@ -501,7 +501,7 @@ byte *Rendu_Texte_SFont(const char *Chaine, int Numero_fonte, int *Largeur, int
// Crée une brosse à partir des paramètres de texte demandés.
// Si cela réussit, la fonction place les dimensions dans Largeur et Hauteur,
// et retourne l'adresse du bloc d'octets.
byte *Rendu_Texte(const char *Chaine, int Numero_fonte, int Taille, int AntiAlias, int Bold, int Italic, int *Largeur, int *Hauteur)
byte *Rendu_Texte(const char *Chaine, int Numero_fonte, int Taille, int antialias, int bold, int Italic, int *Largeur, int *Hauteur)
{
T_FONTE *Fonte = Liste_fontes_debut;
int Indice=Numero_fonte;
@ -515,7 +515,7 @@ byte *Rendu_Texte(const char *Chaine, int Numero_fonte, int Taille, int AntiAlia
if (Fonte->EstTrueType)
{
#ifndef NOTTF
return Rendu_Texte_TTF(Chaine, Numero_fonte, Taille, AntiAlias, Bold, Italic, Largeur, Hauteur);
return Rendu_Texte_TTF(Chaine, Numero_fonte, Taille, antialias, bold, Italic, Largeur, Hauteur);
#else
return NULL;
#endif

View File

@ -27,7 +27,7 @@ int Support_TrueType(void);
// Ajout d'une fonte à la liste.
void Ajout_fonte(char *Nom);
// Crée une brosse à partir des paramètres de texte demandés.
byte *Rendu_Texte(const char *Chaine, int Numero_fonte, int Taille, int AntiAlias, int Bold, int Italic, int *Largeur, int *Hauteur);
byte *Rendu_Texte(const char *Chaine, int Numero_fonte, int Taille, int antialias, int bold, int Italic, int *Largeur, int *Hauteur);
// Trouve le libellé d'affichage d'une fonte par son numéro
char * Libelle_fonte(int Indice);
// Trouve le nom d'une fonte par son numéro

Binary file not shown.

126
windows.c
View File

@ -386,7 +386,7 @@ void Print_general(short X,short Y,const char * Chaine,byte Couleur_texte,byte C
word Indice;
int Pos_X;
int Pos_Y;
byte *Caractere;
byte *font_pixel;
short Reel_X;
short Reel_Y;
byte Repeat_Menu_Facteur_X;
@ -399,10 +399,10 @@ void Print_general(short X,short Y,const char * Chaine,byte Couleur_texte,byte C
for (Indice=0;Chaine[Indice]!='\0';Indice++)
{
// Pointeur sur le premier pixel du caractère
Caractere=Fonte+(((unsigned char)Chaine[Indice])<<6);
font_pixel=Fonte+(((unsigned char)Chaine[Indice])<<6);
for (Pos_X=0;Pos_X<8;Pos_X+=1)
for (Repeat_Menu_Facteur_X=0;Repeat_Menu_Facteur_X<Menu_Facteur_X*Pixel_width;Repeat_Menu_Facteur_X++)
Buffer_de_ligne_horizontale[Reel_X++]=*(Caractere+Pos_X+Pos_Y)?Couleur_texte:Couleur_fond;
Buffer_de_ligne_horizontale[Reel_X++]=*(font_pixel+Pos_X+Pos_Y)?Couleur_texte:Couleur_fond;
}
for (Repeat_Menu_Facteur_Y=0;Repeat_Menu_Facteur_Y<Menu_Facteur_Y;Repeat_Menu_Facteur_Y++)
Afficher_ligne_fast(X,Reel_Y++,Indice*Menu_Facteur_X*8,Buffer_de_ligne_horizontale);
@ -411,37 +411,37 @@ void Print_general(short X,short Y,const char * Chaine,byte Couleur_texte,byte C
// -- Afficher un caractère dans une fenêtre --
void Print_char_dans_fenetre(short Pos_X,short Pos_Y,const unsigned char Caractere,byte Couleur_texte,byte Couleur_fond)
void Print_char_dans_fenetre(short Pos_X,short Pos_Y,const unsigned char c,byte Couleur_texte,byte Couleur_fond)
{
short X,Y;
byte *Carac;
byte *pixel;
Pos_X=(Pos_X*Menu_Facteur_X)+Fenetre_Pos_X;
Pos_Y=(Pos_Y*Menu_Facteur_Y)+Fenetre_Pos_Y;
// Premier pixel du caractère
Carac=Fonte + (Caractere<<6);
pixel=Fonte + (c<<6);
for (Y=0;Y<8;Y++)
for (X=0;X<8;X++)
Block(Pos_X+(X*Menu_Facteur_X), Pos_Y+(Y*Menu_Facteur_Y),
Menu_Facteur_X, Menu_Facteur_Y,
(*(Carac++)?Couleur_texte:Couleur_fond));
(*(pixel++)?Couleur_texte:Couleur_fond));
}
// -- Afficher un caractère sans fond dans une fenêtre --
void Print_char_transparent_dans_fenetre(short Pos_X,short Pos_Y,const unsigned char Caractere,byte Couleur)
void Print_char_transparent_dans_fenetre(short Pos_X,short Pos_Y,const unsigned char c,byte Couleur)
{
short X,Y;
byte *Carac;
byte *pixel;
Pos_X=(Pos_X*Menu_Facteur_X)+Fenetre_Pos_X;
Pos_Y=(Pos_Y*Menu_Facteur_Y)+Fenetre_Pos_Y;
// Premier pixel du caractère
Carac=Fonte + (Caractere<<6);
pixel=Fonte + (c<<6);
for (Y=0;Y<8;Y++)
for (X=0;X<8;X++)
{
if (*(Carac++))
if (*(pixel++))
Block(Pos_X+(X*Menu_Facteur_X), Pos_Y+(Y*Menu_Facteur_Y),
Menu_Facteur_X, Menu_Facteur_Y, Couleur);
}
@ -549,7 +549,7 @@ void Print_compteur(short X,short Y,const char * Chaine,byte Couleur_texte,byte
#define Ob_(x) ((x & 1) | (x >> 2 & 2) | (x >> 4 & 4) | (x >> 6 & 8) | \
(x >> 8 & 16) | (x >> 10 & 32) | (x >> 12 & 64) | (x >> 14 & 128))
byte Caractere[14][8] = {
byte thin_font[14][8] = {
{ // 0
Ob(00011100),
Ob(00110110),
@ -729,7 +729,7 @@ void Print_compteur(short X,short Y,const char * Chaine,byte Couleur_texte,byte
{
for (Pos_X=0;Pos_X<6;Pos_X++)
{
byte Couleur = (Caractere[Numero_car][Pos_Y] & (1 << (6-Pos_X))) ? Couleur_texte:Couleur_fond;
byte Couleur = (thin_font[Numero_car][Pos_Y] & (1 << (6-Pos_X))) ? Couleur_texte:Couleur_fond;
Pixel_dans_fenetre(X+(Indice*6+Pos_X),Y+Pos_Y,Couleur);
}
}
@ -2138,7 +2138,7 @@ void Afficher_ecran(void)
byte Meilleure_couleur(byte R,byte V,byte B)
byte Meilleure_couleur(byte r,byte g,byte b)
{
short Coul;
int Delta_R,Delta_V,Delta_B;
@ -2150,9 +2150,9 @@ byte Meilleure_couleur(byte R,byte V,byte B)
{
if (!Exclude_color[Coul])
{
Delta_R=(int)Principal_Palette[Coul].R-R;
Delta_V=(int)Principal_Palette[Coul].V-V;
Delta_B=(int)Principal_Palette[Coul].B-B;
Delta_R=(int)Principal_Palette[Coul].R-r;
Delta_V=(int)Principal_Palette[Coul].V-g;
Delta_B=(int)Principal_Palette[Coul].B-b;
if (!(Dist=(Delta_R*Delta_R*30)+(Delta_V*Delta_V*59)+(Delta_B*Delta_B*11)))
return Coul;
@ -2341,7 +2341,7 @@ void Remapper_ecran_apres_changement_couleurs_menu(void)
void Calculer_couleurs_menu_optimales(Composantes * Palette)
{
byte Table[4];
short I,J,K;
short i,j,k;
Old_Noir =CM_Noir;
@ -2399,9 +2399,9 @@ void Calculer_couleurs_menu_optimales(Composantes * Palette)
if ( ((Palette[CM_Clair].R*30)+(Palette[CM_Clair].V*59)+(Palette[CM_Clair].B*11)) <
((Palette[CM_Fonce].R*30)+(Palette[CM_Fonce].V*59)+(Palette[CM_Fonce].B*11)) )
{
I=CM_Clair;
i=CM_Clair;
CM_Clair=CM_Fonce;
CM_Fonce=I;
CM_Fonce=i;
}
// On cherche une couleur de transparence différente des 4 autres.
@ -2416,54 +2416,54 @@ void Calculer_couleurs_menu_optimales(Composantes * Palette)
|| (CM_Trans!=Old_Trans) )
{
// Sprites du curseur
for (K=0; K<NB_SPRITES_CURSEUR; K++)
for (J=0; J<HAUTEUR_SPRITE_CURSEUR; J++)
for (I=0; I<LARGEUR_SPRITE_CURSEUR; I++)
Remap_pixel(&SPRITE_CURSEUR[K][J][I]);
for (k=0; k<NB_SPRITES_CURSEUR; k++)
for (j=0; j<HAUTEUR_SPRITE_CURSEUR; j++)
for (i=0; i<LARGEUR_SPRITE_CURSEUR; i++)
Remap_pixel(&SPRITE_CURSEUR[k][j][i]);
// Le menu
for (J=0; J<HAUTEUR_MENU; J++)
for (I=0; I<LARGEUR_MENU; I++)
Remap_pixel(&BLOCK_MENU[J][I]);
for (j=0; j<HAUTEUR_MENU; j++)
for (i=0; i<LARGEUR_MENU; i++)
Remap_pixel(&BLOCK_MENU[j][i]);
// Sprites du menu
for (K=0; K<NB_SPRITES_MENU; K++)
for (J=0; J<HAUTEUR_SPRITE_MENU; J++)
for (I=0; I<LARGEUR_SPRITE_MENU; I++)
Remap_pixel(&SPRITE_MENU[K][J][I]);
for (k=0; k<NB_SPRITES_MENU; k++)
for (j=0; j<HAUTEUR_SPRITE_MENU; j++)
for (i=0; i<LARGEUR_SPRITE_MENU; i++)
Remap_pixel(&SPRITE_MENU[k][j][i]);
// Sprites d'effets
for (K=0; K<NB_SPRITES_EFFETS; K++)
for (J=0; J<HAUTEUR_SPRITE_MENU; J++)
for (I=0; I<LARGEUR_SPRITE_MENU; I++)
Remap_pixel(&SPRITE_EFFET[K][J][I]);
for (k=0; k<NB_SPRITES_EFFETS; k++)
for (j=0; j<HAUTEUR_SPRITE_MENU; j++)
for (i=0; i<LARGEUR_SPRITE_MENU; i++)
Remap_pixel(&SPRITE_EFFET[k][j][i]);
// Fontes de l'aide
for (K=0; K<256; K++)
for (J=0; J<8; J++)
for (I=0; I<6; I++)
Remap_pixel(&Fonte_help_norm[K][I][J]);
for (K=0; K<256; K++)
for (J=0; J<8; J++)
for (I=0; I<6; I++)
Remap_pixel(&Fonte_help_bold[K][I][J]);
for (K=0; K<64; K++)
for (J=0; J<8; J++)
for (I=0; I<6; I++)
Remap_pixel(&Fonte_help_t1[K][I][J]);
for (K=0; K<64; K++)
for (J=0; J<8; J++)
for (I=0; I<6; I++)
Remap_pixel(&Fonte_help_t2[K][I][J]);
for (K=0; K<64; K++)
for (J=0; J<8; J++)
for (I=0; I<6; I++)
Remap_pixel(&Fonte_help_t3[K][I][J]);
for (K=0; K<64; K++)
for (J=0; J<8; J++)
for (I=0; I<6; I++)
Remap_pixel(&Fonte_help_t4[K][I][J]);
for (k=0; k<256; k++)
for (j=0; j<8; j++)
for (i=0; i<6; i++)
Remap_pixel(&Fonte_help_norm[k][i][j]);
for (k=0; k<256; k++)
for (j=0; j<8; j++)
for (i=0; i<6; i++)
Remap_pixel(&Fonte_help_bold[k][i][j]);
for (k=0; k<64; k++)
for (j=0; j<8; j++)
for (i=0; i<6; i++)
Remap_pixel(&Fonte_help_t1[k][i][j]);
for (k=0; k<64; k++)
for (j=0; j<8; j++)
for (i=0; i<6; i++)
Remap_pixel(&Fonte_help_t2[k][i][j]);
for (k=0; k<64; k++)
for (j=0; j<8; j++)
for (i=0; i<6; i++)
Remap_pixel(&Fonte_help_t3[k][i][j]);
for (k=0; k<64; k++)
for (j=0; j<8; j++)
for (i=0; i<6; i++)
Remap_pixel(&Fonte_help_t4[k][i][j]);
// Sprites de lecteurs (drives)
for (K=0; K<NB_SPRITES_DRIVES; K++)
for (J=0; J<HAUTEUR_SPRITE_DRIVE; J++)
for (I=0; I<LARGEUR_SPRITE_DRIVE; I++)
Remap_pixel(&SPRITE_DRIVE[K][J][I]);
for (k=0; k<NB_SPRITES_DRIVES; k++)
for (j=0; j<HAUTEUR_SPRITE_DRIVE; j++)
for (i=0; i<LARGEUR_SPRITE_DRIVE; i++)
Remap_pixel(&SPRITE_DRIVE[k][j][i]);
}
}

View File

@ -50,8 +50,8 @@ word Palette_Cells_Y(void);
void Print_general(short X,short Y,const char * Chaine,byte Couleur_texte,byte Couleur_fond);
void Print_dans_fenetre(short X,short Y,const char * Chaine,byte Couleur_texte,byte Couleur_fond);
void Print_dans_fenetre_limite(short X,short Y,const char * Chaine,byte Taille,byte Couleur_texte,byte Couleur_fond);
void Print_char_dans_fenetre(short Pos_X,short Pos_Y,const unsigned char Caractere,byte Couleur_texte,byte Couleur_fond);
void Print_char_transparent_dans_fenetre(short Pos_X,short Pos_Y,const unsigned char Caractere,byte Couleur);
void Print_char_dans_fenetre(short Pos_X,short Pos_Y,const unsigned char c,byte Couleur_texte,byte Couleur_fond);
void Print_char_transparent_dans_fenetre(short Pos_X,short Pos_Y,const unsigned char c,byte Couleur);
void Print_dans_menu(const char * Chaine, short Position);
void Print_coordonnees(void);
void Print_nom_fichier(void);