Debian Codegraph @

src/loco.cc

raw symbols SCIP
1 // (_||_/
2 // ( )
3 // ( o 0 )
4 //-OOO°--(_)---°OOO---------------------------------------
5 // Copyright (C) 2006 By Dominique Roux-Serret
6 // .OOOo oOOO. [email protected]
7 //-( )------( )---------------------------------------
8 // ( ( ) / Copyright (C) 2023 By Johnny Jazeix
9 // (_) (_/ [email protected]
10
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 or version 3 of the License.
14
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19
20 // You should have received a copy of the GNU General Public License along
21 // with this program; if not, write to the Free Software Foundation, Inc.,
22 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23
24 #include <cmath>
25 #include <cstdlib>
26 #include "preference.h"
27 #include "loco.h"
28 #include "audio.h"
29 #include "screen.h"
30
31 #define PIQ (M_PI / 2.0)
32 #ifndef M_PI
33 #define M_PI 3.141592654
34 #endif
35
36 /*** Variables globales ***/
37 /**************************/
38 extern sNewPreference Pref;
39 extern int Horloge;
40 extern int MasqueK;
41
42 int AddDir[] = { -1, 1, -LT, LT };
43
44 /*** Construteur et Destructeur ***/
45 /**********************************/
46 Loco::Loco(Audio &audio) :
47 m_audio(audio)
48 {
49 Init(LT / 2 + HT / 2 * LT, D_Right);
50 }
51
52 /*** Initialise la locomotive ***/
53 /********************************/
54 void Loco::Init(int Pos, int Direction)
55 {
56 int i;
57 unsigned char Ar = 0;
58
59 PLoco = 0; // Pointe sur la première case
60 PInter = -1;
61 Vitesse = Reduit = Alonge = 0; // Pas d'alongement
62 Mort = -1;
63 Gagne = false;
64 Pref.EcartWagon = ECARTWAGON_MOY;
65
66 // Initialise les variables
67 for (i = 0; i < 256; i++) {
68 PosWagon[i].SprStart = 0;
69 }
70
71 // Cherche le case Avant
72 switch (Direction) {
73 case D_Top:
74 Pos += LT;
75 Ar = D_Bottom;
76 break;
77 case D_Bottom:
78 Pos -= LT;
79 Ar = D_Top;
80 break;
81 case D_Left:
82 Pos++;
83 Ar = D_Right;
84 break;
85 case D_Right:
86 Pos--;
87 Ar = D_Left;
88 break;
89 }
90
91 // Initialise le Tableau et la loco
92 D = D_Case * 1.99; // Positionne la tete presque à la fin
93
94 T[PLoco].P = Pos;
95 T[PLoco].Arrive = Ar;
96 T[PLoco].Sortie = Direction;
97 T[PLoco].D = D_Case;
98
99 // Fait avancer d'une case
100 Go(Direction);
101 Go(Direction);
102
103 // Initialise la loco et son wagon à charbon
104 NWagon = 2;
105 Wagon[0] = locomotive;
106 Wagon[1] = charbon;
107 PosWagon[0].SprStart = PosWagon[1].SprStart = N_SPR_START;
108 PosWagon[0].dx = PosWagon[0].dy = -10;
109 PosWagon[0].fx = PosWagon[0].fy = -10;
110 PosWagon[1].dx = PosWagon[1].dy = -10;
111 PosWagon[1].fx = PosWagon[1].fy = -10;
112
113 MemoDuree = 0;
114 }
115
116 /*** Affiche la locomotive ***/
117 /*****************************/
118 void Loco::Display(Screen &Ec)
119 {
120 float ltrain = 0;
121 float p1, p2, a, ar, vx, vy;
122 int x1, x2, y1, y2;
123 int i, ns = 0;
124 int cdx, cdy, cfx = 0, cfy = 0; // Points d'accroche des cables
125 float lv;
126
127 // Affiche tous les wagons
128 for (i = 0; i < NWagon; i++) {
129 // Cherche les points du wagons
130 switch (Wagon[i]) {
131 case charbon:
132 p1 = ltrain + 11;
133 p2 = ltrain + 36 - 11;
134 ltrain += 36.0;
135 lv = 18;
136 break;
137 default:
138 p1 = ltrain + 11;
139 p2 = ltrain + 40 - 11;
140 ltrain += 40.0;
141 lv = 20;
142 }
143
144 // Calcule la position des points
145 FindPoint(D - p1, x1, y1);
146 FindPoint(D - p2, x2, y2);
147
148 PosWagon[i].dx = x1; // Sauve la position des points pour test de colision futur
149 PosWagon[i].dy = y1;
150 PosWagon[i].fx = x2;
151 PosWagon[i].fy = y2;
152
153 // Calcule l'angle de rotation de la loco et le N° du Sprite
154 if (x1 <= x2) { // Angle 0 à 180 compris
155 vy = (float)(x2 - x1);
156 vx = (float)(y2 - y1);
157 if (vx != 0) {
158 a = atan(vy / vx) * 180.0 / M_PI;
159 }
160 else {
161 a = 90.0;
162 }
163 if (vx < 0) {
164 a = 180.0 + a;
165 }
166 }
167 else { // Angle 180.001 à 359.999
168 vy = (float)(x1 - x2);
169 vx = (float)(y1 - y2);
170 if (vx != 0) {
171 a = atan(vy / vx) * 180.0 / M_PI + 180.0;
172 }
173 else {
174 a = 270.0;
175 }
176 if (vx < 0) {
177 a = 180.0 + a;
178 }
179 }
180 ar = a * M_PI / 180.0;
181
182 // Prend le centre du sprite
183 x1 = (x1 + x2) / 2;
184 y1 = (y1 + y2) / 2;
185
186 // Affiche les cables de liaison
187 if (i > 0) { // Si doit afficher les cables
188 // Calcule le point d'accroche en sortie
189 cdx = x1 - (int)(sin(ar) * lv);
190 cdy = y1 - (int)(cos(ar) * lv);
191
192 // Affiche le cable
193 Ec.PrintCable(cdx, cdy, cfx, cfy);
194 }
195 // Calcule le crocher de fin pour le prochaine wagon
196 cfx = x1 - (int)(sin(ar + M_PI) * lv);
197 cfy = y1 - (int)(cos(ar + M_PI) * lv);
198
199 // Cherche le N° du Sprite
200 switch ((int)a) {
201 case 0: // En haut
202 ns = (int)(y1 + D_Case / 2) % (int)D_Case;
203 break;
204 case 180: // En bas
205 ns = (int)(y1 + D_Case / 2) % (int)D_Case + 40;
206 break;
207 case 90: // Gauche
208 ns = (int)(x1 + D_Case / 2) % (int)D_Case + 80;
209 break;
210 case 270: // Droite
211 ns = (int)(x1 + D_Case / 2) % (int)D_Case + 120;
212 break;
213 default:
214 ns = (int)(a * 160.0 / 360.0);
215 if (ns >= 160) {
216 ns = 0;
217 }
218 ns += 160;
219 }
220
221 Ec.PrintSprite(Wagon[i], ns, x1, y1);
222
223 // Si pas fini la sequence d'affiche de départ du wagon
224 if (PosWagon[i].SprStart < N_SPR_START) {
225 PosWagon[i].SprStart += MemoDuree * N_SPR_START / 750.0;
226 if (PosWagon[i].SprStart < N_SPR_START) {
227 Ec.PrintSprite(nouveau_wagon, (int)(PosWagon[i].SprStart), x1, y1);
228 }
229 }
230
231 // Met l'ecart entre les wagons
232 ltrain += Pref.EcartWagon;
233 }
234 }
235
236 /*** Test les options sur une case ***/
237 /*************************************/
238 void Loco::TestCase(float Dist, long DureeJeu, int *Tableau)
239 {
240 int i;
241 float DMoy;
242 float Ec1, vx, vy, Ec2;
243
244 // test si depasse milieu d'une case pour teste de colision
245 DMoy = (T[PLoco].D + T[PLoco - 1].D) / 2.0;
246 if (D <= DMoy && D + Dist >= DMoy) {
247 // Test si sur une option
248 switch (Tableau[T[PLoco].P]) {
249 case C_Wagon: // Une nouvelle loco
250 m_audio.Play(sWagon);
251 Tableau[T[PLoco].P] = 1; // efface l'option
252 Pref.Score += 5;
253 AddLoco(); // Ajoute une loco au azard
254
255 Gagne = true; // Test si la dernière loco
256 for (i = 0; i < LT * HT; i++) {
257 if (Tableau[i] == C_Wagon) {
258 Gagne = false;
259 }
260 }
261 if (Gagne) {
262 Mort = Horloge + DUREE_PAUSE;
263 m_audio.Play(sEnd);
264 }
265 break;
266 case C_Allonge: // Alonge la loco
267 m_audio.Play(sEtire);
268 Tableau[T[PLoco].P] = 1; // efface l'option
269 Pref.Score += 20;
270 if (Reduit > DureeJeu) {
271 Reduit = DureeJeu - 1;
272 }
273 else {
274 Alonge = DureeJeu + DUREE_ALONGE;
275 }
276 break;
277 case C_Reduit: // Si réduit la loco
278 m_audio.Play(sReduit);
279 Tableau[T[PLoco].P] = 1; // efface l'option
280 if (Alonge > DureeJeu) {
281 Alonge = DureeJeu - 1;
282 }
283 else {
284 Reduit = DureeJeu + DUREE_REDUIT;
285 }
286 break;
287 case C_Speed: // Si Vitesse
288 m_audio.Play(sSpeed);
289 Tableau[T[PLoco].P] = 1; // efface l'option
290 Pref.Score += 30;
291 Vitesse = DureeJeu + DUREE_VITESSE;
292 break;
293 case C_Live: // Si Vie
294 m_audio.Play(sLive);
295 Tableau[T[PLoco].P] = 1; // efface l'option
296 Pref.NVie++;
297 break;
298 }
299
300 // Test de colision avec un autre Wagon
301 for (i = 1; i < NWagon; i++) {
302 vx = (float)(PosWagon[i].dx - PosWagon[0].dx);
303 vy = (float)(PosWagon[i].dy - PosWagon[0].dy);
304 Ec1 = vx * vx + vy * vy;
305 vx = (float)(PosWagon[i].fx - PosWagon[0].dx);
306 vy = (float)(PosWagon[i].fy - PosWagon[0].dy);
307 Ec2 = vx * vx + vy * vy;
308
309 // Si colition le signale
310 if (Mort < Horloge && (Ec1 < RAYON_TOUCHE || Ec2 <= RAYON_TOUCHE)) {
311 m_audio.Play(sCrash);
312 Pref.NVie--;
313 Mort = Horloge + DUREE_PAUSE;
314 }
315 }
316 }
317 }
318
319 /*** Fait Avancer la locomotive ***/
320 /**********************************/
321 void Loco::Avance(int Duree, long DureeJeu, int *Touche, int *Tableau)
322 {
323 int i;
324 float Dist = Pref.VitesseMoy * (float)(Duree) / 1000.0;
325
326 MemoDuree = (float)(Duree);
327
328 TestCase(Dist, DureeJeu, Tableau);
329
330 // Test si doit Réduire le wagon
331 if (Reduit > DureeJeu) {
332 if (Pref.EcartWagon > ECARTWAGON_MIN) { // Si doit réduire
333 Pref.EcartWagon -= (float)(Duree) * (Pref.VitesseMoy * 0.8 / (float)(NWagon - 1)) / 1000.0;
334 if (Pref.EcartWagon < ECARTWAGON_MIN) {
335 Pref.EcartWagon = ECARTWAGON_MIN;
336 }
337 }
338 }
339 else { // Si temps est passé
340 if (Pref.EcartWagon < ECARTWAGON_MOY) { // Si doit ralonger le wagon
341 Pref.EcartWagon += (float)(Duree) * (Pref.VitesseMoy * 0.8 / (float)(NWagon)) / 1000.0;
342 if (Pref.EcartWagon > ECARTWAGON_MOY) {
343 Pref.EcartWagon = ECARTWAGON_MOY;
344 }
345 }
346 }
347
348 // Test si doit Ralonger le wagon
349 if (Alonge > DureeJeu) {
350 if (Pref.EcartWagon < ECARTWAGON_MAX) { // Si doit Ralonger
351 Pref.EcartWagon += (float)(Duree) * (Pref.VitesseMoy * 0.8 / (float)(NWagon)) / 1000.0;
352 if (Pref.EcartWagon > ECARTWAGON_MAX) {
353 Pref.EcartWagon = ECARTWAGON_MAX;
354 }
355 }
356 }
357 else { // Si temps est passé
358 if (Pref.EcartWagon > ECARTWAGON_MOY) { // Si doit ralonger le wagon
359 Pref.EcartWagon -= (float)(Duree) * (Pref.VitesseMoy * 0.8 / (float)(NWagon - 1)) / 1000.0;
360 if (Pref.EcartWagon < ECARTWAGON_MOY) {
361 Pref.EcartWagon = ECARTWAGON_MOY;
362 }
363 }
364 }
365
366 // Test si doit modifier la vitesse de la loco
367 if (Vitesse > DureeJeu) {
368 if (Pref.VitesseMoy < Pref.Vitesse * 2) { // Si doit accelerer
369 Pref.VitesseMoy += (float)(Duree) / 40.0;
370 if (Pref.VitesseMoy > Pref.Vitesse * 2) {
371 Pref.VitesseMoy = Pref.Vitesse * 2;
372 }
373 }
374 }
375 else {
376 if (Pref.VitesseMoy > Pref.Vitesse) { // Si doit ralentir
377 Pref.VitesseMoy -= (float)(Duree) / 40.0;
378 if (Pref.VitesseMoy < Pref.Vitesse) {
379 Pref.VitesseMoy = Pref.Vitesse;
380 }
381 }
382 }
383
384 // Tand que dépasse la case en distante
385 while (D + Dist > T[PLoco].D) {
386 Dist -= T[PLoco].D - D; // Enleve la distance restant à parcourir
387 D = T[PLoco].D;
388
389 i = 0; // Cherche la direction possible
390 while (TestDir(Touche[i], Tableau) == false) {
391 i++;
392 }
393
394 Go(Touche[i]); // Fait avancer le loco suivant le désir du joueur
395
396 DoFleche(Tableau, Touche); // Recherche la position de la futur intersection
397
398 TestCase(Dist, DureeJeu, Tableau); // Test la case au cas ou le jeu est vraiment lent
399 }
400
401 D += Dist; // Met à la bonne position finale
402
403 if (PInter == -1) {
404 DoFleche(Tableau, Touche);
405 }
406 }
407
408 /*** Recherche la position de la futur intersection ***/
409 /******************************************************/
410 void Loco::DoFleche(int *Tableau, int *Touche)
411 {
412 int Sortie = T[PLoco].Sortie;
413 int MemoS;
414 int NVoie;
415 int x, y, Tou;
416 int i = 0;
417
418 if (T[PLoco].P != PInter && PInter != -1) {
419 return; // Si pas encore arrivé sur la case de croisement
420 }
421
422 PInter = T[PLoco].P; // Prend la position de la loco
423
424 do {
425 // Vas à la nouvelle case
426 switch (Sortie) {
427 case D_Top:
428 PInter -= LT;
429 PEntree = D_Bottom;
430 break;
431 case D_Left:
432 PInter--;
433 PEntree = D_Right;
434 break;
435 case D_Bottom:
436 PInter += LT;
437 PEntree = D_Top;
438 break;
439 case D_Right:
440 PInter++;
441 PEntree = D_Left;
442 break;
443 }
444
445 // Compte les voies disponibles.
446 MemoS = Sortie;
447 x = PInter % LT;
448 y = PInter / LT;
449 NVoie = 0;
450 if (y > 0 && PEntree != D_Top && Tableau[PInter - LT] != 0) {
451 Sortie = D_Top;
452 NVoie++;
453 }
454 if (y + 1 < HT && PEntree != D_Bottom && Tableau[PInter + LT] != 0) {
455 Sortie = D_Bottom;
456 NVoie++;
457 }
458 if (x > 0 && PEntree != D_Left && Tableau[PInter - 1] != 0) {
459 Sortie = D_Left;
460 NVoie++;
461 }
462 if (x + 1 < LT && PEntree != D_Right && Tableau[PInter + 1] != 0) {
463 Sortie = D_Right;
464 NVoie++;
465 }
466
467 } while (NVoie == 1);
468
469 // Prend la direction de sortie comme direction par defaut
470 while (Touche[i] != MemoS) {
471 i++;
472 }
473 if (i > 0 && !MasqueK) { // Prend la direction de la loco comme direction par defaut
474 Tou = Touche[i];
475 while (i) {
476 Touche[i] = Touche[i - 1];
477 i--;
478 }
479 Touche[0] = Tou; // Mémorise la touche
480 }
481 }
482
483 /*** Test si une direction est possible ***/
484 /******************************************/
485 bool Loco::TestDir(int FDir, int *Tableau)
486 {
487 int PAvant = T[PLoco].P;
488 int x, y;
489
490 // Test si les directions ne sont pas opposées
491 if (T[PLoco].Sortie == D_Top && FDir == D_Bottom) {
492 return false;
493 }
494 if (T[PLoco].Sortie == D_Bottom && FDir == D_Top) {
495 return false;
496 }
497 if (T[PLoco].Sortie == D_Left && FDir == D_Right) {
498 return false;
499 }
500 if (T[PLoco].Sortie == D_Right && FDir == D_Left) {
501 return false;
502 }
503
504 PAvant += AddDir[(T[PLoco].Sortie)]; // Position dans virage
505
506 // Test si un bord
507 x = PAvant % LT;
508 y = PAvant / LT;
509 if (FDir == D_Top && y == 0) {
510 return false;
511 }
512 if (FDir == D_Bottom && y + 1 == HT) {
513 return false;
514 }
515 if (FDir == D_Left && x == 0) {
516 return false;
517 }
518 if (FDir == D_Right && x + 1 == LT) {
519 return false;
520 }
521
522 PAvant += AddDir[FDir]; // Position futur
523
524 if (Tableau[PAvant] == 0) {
525 return false; // Test si il y a un rail
526 }
527
528 return true;
529 }
530
531 /*** Deplace la locomotive ***/
532 /*****************************/
533 bool Loco::Go(int FuturDir)
534 {
535 int PTab = T[PLoco].P;
536 int const Dir = T[PLoco].Sortie;
537 int Mask;
538 int i;
539
540 // Test si risque de dépassement et enleve une bonne partie
541 if (PLoco == 255) {
542 for (i = 0; i < 256 - 50; i++) {
543 T[i].P = T[i + 50].P;
544 T[i].D = T[i + 50].D;
545 T[i].Arrive = T[i + 50].Arrive;
546 T[i].Sortie = T[i + 50].Sortie;
547 }
548 PLoco -= 50;
549 }
550
551 // Mémorise la prochaine case
552 PLoco++; // Passe à la case suivante
553
554 switch (Dir) {
555 case D_Top:
556 PTab -= LT;
557 T[PLoco].Arrive = D_Bottom;
558 break;
559 case D_Bottom:
560 PTab += LT;
561 T[PLoco].Arrive = D_Top;
562 break;
563 case D_Left:
564 PTab--;
565 T[PLoco].Arrive = D_Right;
566 break;
567 default:
568 PTab++;
569 T[PLoco].Arrive = D_Left;
570 }
571
572 // Donne futur direction et N° case avant
573 T[PLoco].P = PTab;
574 T[PLoco].Sortie = FuturDir;
575
576 // Calcule la distance
577 Mask = T[PLoco].Arrive * 4 + T[PLoco].Sortie;
578 switch (Mask) {
579 case (D_Left * 4 + D_Right): // Si vas tous droit
580 case (D_Right * 4 + D_Left):
581 case (D_Top * 4 + D_Bottom):
582 case (D_Bottom * 4 + D_Top):
583 T[PLoco].D = T[PLoco - 1].D + D_Case;
584 break;
585 default:
586 T[PLoco].D = T[PLoco - 1].D + D_CaseR;
587 return true;
588 }
589
590 return false;
591 }
592
593 /*** Recherche un point sur le parcour ***/
594 /*****************************************/
595 void Loco::FindPoint(float Dist, int &x, int &y)
596 {
597 int NP = PLoco;
598 int P;
599 float D_Rest;
600
601 // Recherche la case d'avant
602 while (T[NP - 1].D > Dist) {
603 NP--;
604 }
605 P = T[NP].P;
606
607 // Calcule les coordonnée suivant la direction
608 D_Rest = T[NP].D - Dist;
609 if (D_Rest == 0) {
610 D_Rest = D_Case / 1000.0; // Evite les erreurs de division
611 }
612
613 switch (T[NP].Arrive * 4 + T[NP].Sortie) {
614 case (D_Left * 4 + D_Right):
615 y = int(P / LT * D_Case + D_Case / 2);
616 x = int(P % LT * D_Case + D_Case - D_Rest);
617 break;
618 case (D_Left * 4 + D_Top):
619 x = int(P % LT * D_Case + cos(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
620 y = int(P / LT * D_Case + sin(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
621 break;
622 case (D_Left * 4 + D_Bottom):
623 x = int(P % LT * D_Case + cos(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
624 y = int(P / LT * D_Case + D_Case - sin(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
625 break;
626
627 case (D_Right * 4 + D_Left):
628 y = int(P / LT * D_Case + D_Case / 2);
629 x = int(P % LT * D_Case + D_Rest);
630 break;
631 case (D_Right * 4 + D_Top):
632 x = int(P % LT * D_Case + D_Case - cos(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
633 y = int(P / LT * D_Case + sin(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
634 break;
635 case (D_Right * 4 + D_Bottom):
636 x = int(P % LT * D_Case + D_Case - cos(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
637 y = int(P / LT * D_Case + D_Case - sin(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
638 break;
639
640 case (D_Bottom * 4 + D_Top):
641 x = int(P % LT * D_Case + D_Case / 2);
642 y = int(P / LT * D_Case + D_Rest);
643 break;
644 case (D_Bottom * 4 + D_Left):
645 x = int(P % LT * D_Case + sin(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
646 y = int(P / LT * D_Case + D_Case - cos(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
647 break;
648 case (D_Bottom * 4 + D_Right):
649 x = int(P % LT * D_Case + D_Case - sin(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
650 y = int(P / LT * D_Case + D_Case - cos(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
651 break;
652
653 case (D_Top * 4 + D_Bottom):
654 x = int(P % LT * D_Case + D_Case / 2);
655 y = int(P / LT * D_Case + D_Case - D_Rest);
656 break;
657 case (D_Top * 4 + D_Left):
658 x = int(P % LT * D_Case + sin(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
659 y = int(P / LT * D_Case + cos(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
660 break;
661 case (D_Top * 4 + D_Right):
662 x = int(P % LT * D_Case + D_Case - sin(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
663 y = int(P / LT * D_Case + cos(D_Rest * PIQ / D_CaseR) * (D_Case / 2.0));
664 break;
665 }
666 }
667
668 /*** Ajoute une loco au azrard ***/
669 /*********************************/
670 void Loco::AddLoco()
671 {
672 Wagon[NWagon] = (e_Sprite)(rand() % (wagon - buches) + buches);
673 if (Wagon[NWagon] == Wagon[NWagon - 1]) { // Evite 2 fois le meme wagon
674 if (Wagon[NWagon] + 1 == wagon) {
675 Wagon[NWagon] = buches;
676 }
677 else {
678 Wagon[NWagon] = (e_Sprite)(Wagon[NWagon] + 1);
679 }
680 }
681 PosWagon[NWagon].dx = PosWagon[NWagon].dy = -10;
682 PosWagon[NWagon].fx = PosWagon[NWagon].fy = -10;
683 NWagon++;
684 }