-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditpan2.c
executable file
·137 lines (137 loc) · 4.63 KB
/
editpan2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#include "SOUREDIT/EDITSOUR.H"
#include "SOUREDIT/EDITGRAP.H"
#include "SOUREDIT/EDITPANN.H"
#include "SOUREDIT/EDITTABL.H"
#include "SOUREDIT/EDITONGL.H"
void Rechercher_Portes (void);
extern OCTET buftab1_sans_cadre [BUFSIZE_SANS_CADRE];
OCTET new_numero_pastille;
OCTET old_numero_pastille;
OCTET backup_new_numero_pastille;
OCTET Numero_Pastille (void)
{
return (new_numero_pastille);
}
void Panneau_2 (void)
{
short nbpastilles;
OCTET page;
Lire_Tableau (Lire_Tableau_Encours());
Lire_Buftab_Sans_Cadre (buftab1_sans_cadre);
Save_Undo ();
Load_Undo ();
Ecrire_Panneau_Encours (Lire_Panneau_Demande () );
Ecrire_Panneau_Demande (0);
page = (Lire_Page () == 0) ? 1 : 0;
Afficher_Onglet (page,ONGLET2);
Afficher_Nombre (page,BOB_CHIFFRE,2,0,310,13,MASK_OFF);
Afficher_Nombre (page,BOB_CHIFFRE,2,0,310,20,MASK_OFF);
Changer_Page (page);
Activer_Zone_Croix (5,31,305,393);
Afficher_Cases (buftab1_sans_cadre,BOB_PASTILLE-1,1,1,43,33);
new_numero_pastille = 1;
old_numero_pastille = 1;
Selection_Pastille (new_numero_pastille,ON);
Initialiser_Outils ();
do
{
if ( Test_Clic_Zone (X_Fleche (),Y_Fleche (),3,14,306,26) == ON)
{
new_numero_pastille = (X_Fleche () + 5 ) / 8;
if (new_numero_pastille != old_numero_pastille)
{
if ( (new_numero_pastille >=1) & (new_numero_pastille <= MAX_PASTILLE) )
{
Selection_Pastille (old_numero_pastille,OFF);
Selection_Pastille (new_numero_pastille,ON);
old_numero_pastille = new_numero_pastille;
WAIT_NO_CLIC;
Ecrire_Panneau_Demande (0);
}
else
new_numero_pastille = old_numero_pastille;
}
}
if ( Test_Clic_Zone (X_Fleche (),Y_Fleche (),5,31,305,393) == ON)
{
Appeler_Outils ();
}
if ( Test_Zone (X_Fleche (),Y_Fleche (),5,31,305,393) == ON)
{
if (Clic_Souris () == CLIC_DROITE)
{
backup_new_numero_pastille = new_numero_pastille;
new_numero_pastille = 0;
Appeler_Outils ();
new_numero_pastille = backup_new_numero_pastille;
}
}
if ( Test_Clic_Zone (X_Fleche (),Y_Fleche (),309,28,319,397) == ON )
{
Traiter_Outils ();
}
if (X_Case () != 0)
Afficher_Nombre (Lire_Page(),BOB_CHIFFRE,2,X_Case (),310,13,MASK_OFF);
if (Y_Case () != 0)
Afficher_Nombre (Lire_Page(),BOB_CHIFFRE,2,Y_Case (),310,20,MASK_OFF);
}
while (Lire_Panneau_Demande () == 0);
Desactiver_Zone_Croix ();
Ecrire_Buftab_Sans_Cadre (buftab1_sans_cadre);
Verifier_Corriger_Dessin ();
Rechercher_Portes ();
nbpastilles = Totaliser_Pastilles (OBST_BOULE_BLEU);
Ecrire_Nombre_Pastille (nbpastilles);
Convertir_Structure_Buffer ();
Rechercher_Conflit_Serpents_Bord ();
Convertir_Buffer_Structure ();
Sauver_Tableau (Lire_Tableau_Encours ());
}
void Rechercher_Portes (void)
{
OCTET cpt_x;
OCTET cpt_y;
OCTET pastille;
short nb_porte;
Ecrire_Nbporterouge (0);
Ecrire_Nbporteverte (0);
Ecrire_Nbportebleue (0);
for (cpt_y = 1;
cpt_y <= 33;
cpt_y ++)
{
for (cpt_x = 1;
cpt_x <= 43;
cpt_x ++)
{
pastille = Lire_Case (buftab1_sans_cadre,cpt_x,cpt_y);
if ( (pastille == OBST_PORTE_ROUGE_FERMEE ) |
(pastille == OBST_PORTE_ROUGE_OUVERTE) )
{
nb_porte = Lire_Nbporterouge ();
Ecrire_Xporterouge (nb_porte,cpt_x);
Ecrire_Yporterouge (nb_porte,cpt_y);
nb_porte ++;
Ecrire_Nbporterouge (nb_porte);
}
if ( (pastille == OBST_PORTE_VERTE_FERMEE ) |
(pastille == OBST_PORTE_VERTE_OUVERTE) )
{
nb_porte = Lire_Nbporteverte ();
Ecrire_Xporteverte (nb_porte,cpt_x);
Ecrire_Yporteverte (nb_porte,cpt_y);
nb_porte ++;
Ecrire_Nbporteverte (nb_porte);
}
if ( (pastille == OBST_PORTE_BLEU_FERMEE ) |
(pastille == OBST_PORTE_BLEU_OUVERTE) )
{
nb_porte = Lire_Nbportebleue ();
Ecrire_Xportebleue (nb_porte,cpt_x);
Ecrire_Yportebleue (nb_porte,cpt_y);
nb_porte ++;
Ecrire_Nbportebleue (nb_porte);
}
}
}
}