/[cuyo]/cuyo/data/breakout.ld
ViewVC logotype

Diff of /cuyo/data/breakout.ld

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by caeles, Sun Nov 27 02:57:04 2005 UTC revision 1.8 by caeles, Mon Nov 28 20:22:10 2005 UTC
# Line 38  BreakOut = { Line 38  BreakOut = {
38        #           0: Ball ist draußen        #           0: Ball ist draußen
39      var schlaeger_richt;      var schlaeger_richt;
40                 # Ausrichtung: 0=nach rechts, dann im Uhrzeigersinn                 # Ausrichtung: 0=nach rechts, dann im Uhrzeigersinn
41                 # Im global-blop: nur 0 oder 1                 # Im semiglobal-blop: nur 0 oder 1
42                 #   (Äquivalenzklassen waagerecht/senkrecht)                 #   (Äquivalenzklassen waagerecht/senkrecht)
43      var straf_x = -1;      var straf_x = -1;
44      var schlaeger_x1, schlaeger_y1, schlaeger_x2, schlaeger_y2,      var schlaeger_x1, schlaeger_y1, schlaeger_x2, schlaeger_y2,
# Line 54  BreakOut = { Line 54  BreakOut = {
54                 # *_richt*: In 15 Grad Schritten im Uhrzeigersinn,                 # *_richt*: In 15 Grad Schritten im Uhrzeigersinn,
55                 #   dabei 0: waagerecht, mit Innerem unten                 #   dabei 0: waagerecht, mit Innerem unten
56                 # *_stein: Stein in der Umgebung: 1=oben, dann im Uhrzeigersinn                 # *_stein: Stein in der Umgebung: 1=oben, dann im Uhrzeigersinn
57        var mal_x, mal_y;
58      var frei,farbe;      var frei,farbe;
59      var getroffen;  # Wurde Gras/Schläger vom Ball getroffen      var getroffen;  # Wurde Gras/Schläger vom Ball getroffen
60      var ggT;      var ggT;
61    
62    
     global = {  
       if ball_richt_zurueck==0 -> {   # Ball ist raus: soll wieder rein  
         ball_x = 9+rnd(2);  
         ball_y = 18;  
         ball_richt = (rnd(5)+10)%12+1;  
         straf_x = rnd(10);  
       } else  
         ball_richt = ball_richt_zurueck;  
       ball_richt_zurueck = 0; # Wir behaupten, der Ball ist weg.  
                               # Wer ihn findet, wird uns das schon mitteilen  
                               # (und seine eigentliche Richtung kennen).  
     };  
   
63    
64    
65      spiel_spiegel = {      spiel_spiegel = {
# Line 265  BreakOut = { Line 253  BreakOut = {
253        # Schläger        # Schläger
254    
255        spiegel_stein=-1;        spiegel_stein=-1;
256        if schlaeger_richt@ != -1 -> {        if schlaeger_richt@@ != -1 -> {
257          spiegel_schlaeger = 1;          spiegel_schlaeger = 1;
258          ball_dxx -= schlaeger_xx-schlaeger_xx_alt;          ball_dxx -= schlaeger_xx-schlaeger_xx_alt;
259          ball_dyy -= schlaeger_yy-schlaeger_yy_alt;          ball_dyy -= schlaeger_yy-schlaeger_yy_alt;
# Line 347  BreakOut = { Line 335  BreakOut = {
335        ball_t_bisher_nenner = erstes_t_nenner;        ball_t_bisher_nenner = erstes_t_nenner;
336      };      };
337    
338      spiel = {      semiglobal = {
339        if loc_y==19 && loc_x==straf_x@ ->        if ball_richt==0 -> {   # Ball ist raus: soll wieder rein
340          {kind=gras; farbe=3; frei=0; straf_x@=-1;};          ball_x = 9+rnd(2);
341            ball_y = 18;
342        if (getroffen@@0 || getroffen@@1)          ball_richt = (rnd(5)+10)%12+1;
           && loc_x+loc_x@@0==8..10 && loc_y+loc_y@@0<=19  
           && loc_y<=17 && frei ->  
         kind=stuetze;  
   
       if (loc_x==ball_x@/2) && (loc_y==ball_y@/2) -> {  
                  # Ich muß mich um den Ball kümmern  
   
         #  
         # Variablen abholen  
         #  
   
         ball_x=ball_x@;  
         ball_y=ball_y@;  
         ball_richt=ball_richt@;  
         schlaeger_xx_alt = schlaeger_xx_alt@@0;  
         schlaeger_yy_alt = schlaeger_yy_alt@@0;  
   
         #  
         # Bewegen und kollidieren mit Schläger  
         #  
   
         schlaeger_xx = (loc_xx@@0+loc_xx@@1)/2;  
         schlaeger_yy = (loc_yy@@0+loc_yy@@1)/2;  
         if schlaeger_xx_alt == -1 -> {  
           schlaeger_xx_alt = schlaeger_xx;  
           schlaeger_yy_alt = schlaeger_yy;  
         };  
343    
344          if schlaeger_richt@@0==0 # Schläger ist waagerecht          straf_x = rnd(10);
345            -> switch {          kind@@(straf_x,19)=gras;
346              turn@@0 == 0 -> {          farbe@@(straf_x,19)=3;
347                schlaeger_x1 = loc_xx@@0+5;          frei@@(straf_x,19)=0;
348                schlaeger_y1 = loc_yy@@0+16;        };
349                schlaeger_x2 = loc_xx@@0+32;  
350                schlaeger_y2 = loc_yy@@0+23;        schlaeger_xx_alt = schlaeger_xx_alt@@0;
351                schlaeger_x3 = loc_xx@@1+27;        schlaeger_yy_alt = schlaeger_yy_alt@@0;
               schlaeger_y3 = loc_yy@@1+16;  
               schlaeger_x4 = loc_xx@@1+0;  
               schlaeger_y4 = loc_yy@@1+9;  
               schlaeger_richt = 23;  
             };  
             turn@@0 == 1 -> {  
               schlaeger_x1 = loc_xx@@0+10;  
               schlaeger_y1 = loc_yy@@0+6;  
               schlaeger_x2 = loc_xx@@1+1;  
               schlaeger_y2 = loc_yy@@1+6;  
               schlaeger_x3 = loc_xx@@1+22;  
               schlaeger_y3 = loc_yy@@1+26;  
               schlaeger_x4 = loc_xx@@0+31;  
               schlaeger_y4 = loc_yy@@0+26;  
               schlaeger_richt = 20;  
             };  
             turn@@0 == 2 -> {  
               schlaeger_x1 = loc_xx@@0+6;  
               schlaeger_y1 = loc_yy@@0+10;  
               schlaeger_x2 = loc_xx@@0+26;  
               schlaeger_y2 = loc_yy@@0+31;  
               schlaeger_x3 = loc_xx@@1+26;  
               schlaeger_y3 = loc_yy@@1+22;  
               schlaeger_x4 = loc_xx@@1+6;  
               schlaeger_y4 = loc_yy@@1+1;  
               schlaeger_richt = 22;  
             };  
           }  
           else switch {  
             turn@@0 == 0 -> {  
               schlaeger_x1 = loc_xx@@1+16;  
               schlaeger_y1 = loc_yy@@1+27;  
               schlaeger_x2 = loc_xx@@1+23;  
               schlaeger_y2 = loc_yy@@1+0;  
               schlaeger_x3 = loc_xx@@0+16;  
               schlaeger_y3 = loc_yy@@0+5;  
               schlaeger_x4 = loc_xx@@0+9;  
               schlaeger_y4 = loc_yy@@0+32;  
               schlaeger_richt = 5;  
             };  
             turn@@0 == 1 -> {  
               schlaeger_x1 = loc_xx@@1+6;  
               schlaeger_y1 = loc_yy@@1+22;  
               schlaeger_x2 = loc_xx@@0+6;  
               schlaeger_y2 = loc_yy@@0+31;  
               schlaeger_x3 = loc_xx@@0+26;  
               schlaeger_y3 = loc_yy@@0+10;  
               schlaeger_x4 = loc_xx@@1+26;  
               schlaeger_y4 = loc_yy@@1+1;  
               schlaeger_richt = 2;  
             };  
             turn@@0 == 2 -> {  
               schlaeger_x1 = loc_xx@@1+10;  
               schlaeger_y1 = loc_yy@@1+26;  
               schlaeger_x2 = loc_xx@@1+31;  
               schlaeger_y2 = loc_yy@@1+6;  
               schlaeger_x3 = loc_xx@@0+22;  
               schlaeger_y3 = loc_yy@@0+6;  
               schlaeger_x4 = loc_xx@@0+1;  
               schlaeger_y4 = loc_yy@@0+26;  
               schlaeger_richt = 4;  
             };  
           };  
352    
353          ball_xx_zaehler = 312-ball_x*16;        #
354          ball_yy_zaehler = 632-ball_y*16;        # Bewegen und kollidieren mit Schläger
355          ball_xxyy_nenner = 1;        #
356          ball_t_bisher_zaehler = 0;  
357          ball_t_bisher_nenner = 1;        schlaeger_xx = (loc_xx@@0+loc_xx@@1)/2;
358          schlaeger_yy = (loc_yy@@0+loc_yy@@1)/2;
359          spiel_ball_richtung;        if schlaeger_xx_alt == -1 -> {
360          spiel_spiegel_alle;          schlaeger_xx_alt = schlaeger_xx;
361          spiel_bewege_ball;          schlaeger_yy_alt = schlaeger_yy;
362          spiel_ball_richtung;        };
363          spiel_spiegel_alle;  
364          spiel_bewege_ball;        if schlaeger_richt@@0==0 # Schläger ist waagerecht
365          spiel_ball_richtung;          -> switch {
366          spiel_spiegel_alle;            turn@@0 == 0 -> {
367          spiel_bewege_ball;              schlaeger_x1 = loc_xx@@0+5;
368          spiel_ball_richtung;              schlaeger_y1 = loc_yy@@0+16;
369          spiel_spiegel_alle;              schlaeger_x2 = loc_xx@@0+32;
370          spiel_bewege_ball;              schlaeger_y2 = loc_yy@@0+23;
371          spiel_ball_richtung;              schlaeger_x3 = loc_xx@@1+27;
372          spiel_kein_spiegel;              schlaeger_y3 = loc_yy@@1+16;
373          spiel_bewege_ball;              schlaeger_x4 = loc_xx@@1+0;
374                schlaeger_y4 = loc_yy@@1+9;
375          ball_x = (320*ball_xxyy_nenner-ball_xx_zaehler)/(16*ball_xxyy_nenner);              schlaeger_richt = 23;
         ball_y = (640*ball_xxyy_nenner-ball_yy_zaehler)/(16*ball_xxyy_nenner);  
   
         #  
         # Malen  
         #  
   
         switch {  
           ball_y==2*loc_y-2 -> switch {  
             ball_x==2*loc_x-2 -> {C*@(1,-2); D*@(2,-2); G*@(1,-1); H*@(2,-1)};  
             ball_x==2*loc_x-1 -> {A*@(0,-2); B*@(1,-2); E*@(0,-1); F*@(1,-1)};  
             ball_x==2*loc_x-0 -> {C*@(0,-2); D*@(1,-2); G*@(0,-1); H*@(1,-1)};  
             ball_x==2*loc_x+1 -> {A*@(-1,-2); B*@(0,-2); E*@(-1,-1); F*@(0,-1)};  
             ball_x==2*loc_x+2 -> {C*@(-1,-2); D*@(0,-2); G*@(-1,-1); H*@(0,-1)};  
             ball_x==2*loc_x+3 -> {A*@(-2,-2); B*@(-1,-2); E*@(-2,-1); F*@(-1,-1)};  
376            };            };
377            ball_y==2*loc_y-1 -> switch {            turn@@0 == 1 -> {
378              ball_x==2*loc_x-2 -> {K*@(1,-1); L*@(2,-1); O*@(1,0); P*@(2,0)};              schlaeger_x1 = loc_xx@@0+10;
379              ball_x==2*loc_x-1 -> {I*@(0,-1); J*@(1,-1); M*@(0,0); N*@(1,0)};              schlaeger_y1 = loc_yy@@0+6;
380              ball_x==2*loc_x-0 -> {K*@(0,-1); L*@(1,-1); O*@(0,0); P*@(1,0)};              schlaeger_x2 = loc_xx@@1+1;
381              ball_x==2*loc_x+1 -> {I*@(-1,-1); J*@(0,-1); M*@(-1,0); N*@(0,0)};              schlaeger_y2 = loc_yy@@1+6;
382              ball_x==2*loc_x+2 -> {K*@(-1,-1); L*@(0,-1); O*@(-1,0); P*@(0,0)};              schlaeger_x3 = loc_xx@@1+22;
383              ball_x==2*loc_x+3 -> {I*@(-2,-1); J*@(-1,-1); M*@(-2,0); N*@(-1,0)};              schlaeger_y3 = loc_yy@@1+26;
384                schlaeger_x4 = loc_xx@@0+31;
385                schlaeger_y4 = loc_yy@@0+26;
386                schlaeger_richt = 20;
387            };            };
388            ball_y==2*loc_y-0 -> switch {            turn@@0 == 2 -> {
389              ball_x==2*loc_x-2 -> {C*@(1,-1); D*@(2,-1); G*@(1,0); H*@(2,0)};              schlaeger_x1 = loc_xx@@0+6;
390              ball_x==2*loc_x-1 -> {A*@(0,-1); B*@(1,-1); E*@(0,0); F*@(1,0)};              schlaeger_y1 = loc_yy@@0+10;
391              ball_x==2*loc_x-0 -> {C*@(0,-1); D*@(1,-1); G*@(0,0); H*@(1,0)};              schlaeger_x2 = loc_xx@@0+26;
392              ball_x==2*loc_x+1 -> {A*@(-1,-1); B*@(0,-1); E*@(-1,0); F*@(0,0)};              schlaeger_y2 = loc_yy@@0+31;
393              ball_x==2*loc_x+2 -> {C*@(-1,-1); D*@(0,-1); G*@(-1,0); H*@(0,0)};              schlaeger_x3 = loc_xx@@1+26;
394              ball_x==2*loc_x+3 -> {A*@(-2,-1); B*@(-1,-1); E*@(-2,0); F*@(-1,0)};              schlaeger_y3 = loc_yy@@1+22;
395                schlaeger_x4 = loc_xx@@1+6;
396                schlaeger_y4 = loc_yy@@1+1;
397                schlaeger_richt = 22;
398            };            };
399            ball_y==2*loc_y+1 -> switch {          }
400              ball_x==2*loc_x-2 -> {K*@(1,0); L*@(2,0); O*@(1,1); P*@(2,1)};          else switch {
401              ball_x==2*loc_x-1 -> {I*@(0,0); J*@(1,0); M*@(0,1); N*@(1,1)};            turn@@0 == 0 -> {
402              ball_x==2*loc_x-0 -> {K*@(0,0); L*@(1,0); O*@(0,1); P*@(1,1)};              schlaeger_x1 = loc_xx@@1+16;
403              ball_x==2*loc_x+1 -> {I*@(-1,0); J*@(0,0); M*@(-1,1); N*@(0,1)};              schlaeger_y1 = loc_yy@@1+27;
404              ball_x==2*loc_x+2 -> {K*@(-1,0); L*@(0,0); O*@(-1,1); P*@(0,1)};              schlaeger_x2 = loc_xx@@1+23;
405              ball_x==2*loc_x+3 -> {I*@(-2,0); J*@(-1,0); M*@(-2,1); N*@(-1,1)};              schlaeger_y2 = loc_yy@@1+0;
406                schlaeger_x3 = loc_xx@@0+16;
407                schlaeger_y3 = loc_yy@@0+5;
408                schlaeger_x4 = loc_xx@@0+9;
409                schlaeger_y4 = loc_yy@@0+32;
410                schlaeger_richt = 5;
411            };            };
412            ball_y==2*loc_y+2 -> switch {            turn@@0 == 1 -> {
413              ball_x==2*loc_x-2 -> {C*@(1,0); D*@(2,0); G*@(1,1); H*@(2,1)};              schlaeger_x1 = loc_xx@@1+6;
414              ball_x==2*loc_x-1 -> {A*@(0,0); B*@(1,0); E*@(0,1); F*@(1,1)};              schlaeger_y1 = loc_yy@@1+22;
415              ball_x==2*loc_x-0 -> {C*@(0,0); D*@(1,0); G*@(0,1); H*@(1,1)};              schlaeger_x2 = loc_xx@@0+6;
416              ball_x==2*loc_x+1 -> {A*@(-1,0); B*@(0,0); E*@(-1,1); F*@(0,1)};              schlaeger_y2 = loc_yy@@0+31;
417              ball_x==2*loc_x+2 -> {C*@(-1,0); D*@(0,0); G*@(-1,1); H*@(0,1)};              schlaeger_x3 = loc_xx@@0+26;
418              ball_x==2*loc_x+3 -> {A*@(-2,0); B*@(-1,0); E*@(-2,1); F*@(-1,1)};              schlaeger_y3 = loc_yy@@0+10;
419                schlaeger_x4 = loc_xx@@1+26;
420                schlaeger_y4 = loc_yy@@1+1;
421                schlaeger_richt = 2;
422            };            };
423            ball_y==2*loc_y+3 -> switch {            turn@@0 == 2 -> {
424              ball_x==2*loc_x-2 -> {K*@(1,1); L*@(2,1); O*@(1,2); P*@(2,2)};              schlaeger_x1 = loc_xx@@1+10;
425              ball_x==2*loc_x-1 -> {I*@(0,1); J*@(1,1); M*@(0,2); N*@(1,2)};              schlaeger_y1 = loc_yy@@1+26;
426              ball_x==2*loc_x-0 -> {K*@(0,1); L*@(1,1); O*@(0,2); P*@(1,2)};              schlaeger_x2 = loc_xx@@1+31;
427              ball_x==2*loc_x+1 -> {I*@(-1,1); J*@(0,1); M*@(-1,2); N*@(0,2)};              schlaeger_y2 = loc_yy@@1+6;
428              ball_x==2*loc_x+2 -> {K*@(-1,1); L*@(0,1); O*@(-1,2); P*@(0,2)};              schlaeger_x3 = loc_xx@@0+22;
429              ball_x==2*loc_x+3 -> {I*@(-2,1); J*@(-1,1); M*@(-2,2); N*@(-1,2)};              schlaeger_y3 = loc_yy@@0+6;
430                schlaeger_x4 = loc_xx@@0+1;
431                schlaeger_y4 = loc_yy@@0+26;
432                schlaeger_richt = 4;
433            };            };
434          };          };
435    
436          #        ball_xx_zaehler = 312-ball_x*16;
437          # Variablen zurückgeben        ball_yy_zaehler = 632-ball_y*16;
438          #        ball_xxyy_nenner = 1;
439          ball_t_bisher_zaehler = 0;
440          schlaeger_xx_alt@@0=schlaeger_xx;        ball_t_bisher_nenner = 1;
441          schlaeger_yy_alt@@0=schlaeger_yy;  
442          schlaeger_xx_alt@@1=schlaeger_xx;        spiel_ball_richtung;
443          schlaeger_yy_alt@@1=schlaeger_yy;        spiel_spiegel_alle;
444          spiel_bewege_ball;
445          ball_x@=ball_x;        spiel_ball_richtung;
446          ball_y@=ball_y;        spiel_spiegel_alle;
447          ball_richt_zurueck@=ball_richt;        spiel_bewege_ball;
448        };        spiel_ball_richtung;
449          spiel_spiegel_alle;
450          spiel_bewege_ball;
451          spiel_ball_richtung;
452          spiel_spiegel_alle;
453          spiel_bewege_ball;
454          spiel_ball_richtung;
455          spiel_kein_spiegel;
456          spiel_bewege_ball;
457    
458          ball_x = (320*ball_xxyy_nenner-ball_xx_zaehler)/(16*ball_xxyy_nenner);
459          ball_y = (640*ball_xxyy_nenner-ball_yy_zaehler)/(16*ball_xxyy_nenner);
460    
461          #
462          # Malen
463          #
464    
465          mal_x=(ball_x+1)/2;
466          mal_y=(ball_y+1)/2;
467          pos=2+8*(ball_y%2)-2*(ball_x%2);
468          *@@(mal_x,mal_y);
469          pos+=1;
470          *@@(mal_x+1,mal_y);
471          pos+=3;
472          *@@(mal_x,mal_y+1);
473          pos+=1;
474          *@@(mal_x+1,mal_y+1);
475    
476          #
477          # Variablen zurückgeben
478          #
479    
480          schlaeger_xx_alt@@0=schlaeger_xx;
481          schlaeger_yy_alt@@0=schlaeger_yy;
482          schlaeger_xx_alt@@1=schlaeger_xx;
483          schlaeger_yy_alt@@1=schlaeger_yy;
484    
485      };      };
486    
487    
488    
489      schlaeger_init = {      schlaeger_init = {
490        schlaeger_richt@=0;        schlaeger_richt@@=0;
491        schlaeger_xx_alt = -1;        schlaeger_xx_alt = -1;
492        if loc_x==4        if loc_x==4
493          -> schlaeger_richt=0          -> schlaeger_richt=0
# Line 558  BreakOut = { Line 497  BreakOut = {
497      nichts_init={frei=1;};      nichts_init={frei=1;};
498    >>    >>
499    
500      semiglobal = {
501        pics = mbrBall.xpm
502      }
503    
504    gras = {    gras = {
505      pics = mbrBall.xpm, mbrStein.xpm      pics = mbrStein.xpm
506      <<      <<
507        gras = {        gras = {
508          if getroffen -> {farbe-=1; getroffen=0;};          if getroffen -> {farbe-=1; getroffen=0;};
509          pos=farbe; 1*; 0;          pos=farbe; *;
510          if farbe==0 -> {kind=stuetze; frei=1;};          if farbe==0 -> {kind=stuetze; frei=1;};
         spiel;  
511        };        };
512    
513        gras.init = {farbe=version};        gras.init = {farbe=version};
# Line 573  BreakOut = { Line 515  BreakOut = {
515    }    }
516    
517    stuetze = {    stuetze = {
     pics = mbrBall.xpm  
518      <<      <<
519        stuetze = {        stuetze = {
520          if kind@(0,1)==nichts || kind@(0,1)==outside -> kind=nichts;          if kind@(0,1)==nichts || kind@(0,1)==outside -> kind=nichts;
         spiel;  
521        };        };
522    
523        stuetze.init = {kind=schlaeger; schlaeger_init;};        stuetze.init = {kind=schlaeger; schlaeger_init;};
# Line 586  BreakOut = { Line 526  BreakOut = {
526    
527    schlaeger = {    schlaeger = {
528      numexplode=2      numexplode=2
529      pics = mbrBall.xpm, mbrSchlaeger.xpm      pics = mbrSchlaeger.xpm
530      <<      <<
531        schlaeger = {        schlaeger = {
532          if falling          if falling
533          -> {1;pos=schlaeger_richt+4*turn;*;}            -> {pos=schlaeger_richt+4*turn;*;};
         else spiel;  
534        };        };
535    
536        schlaeger.land = {        schlaeger.land = {
537          if getroffen -> bonus(1);          if getroffen -> bonus(1);
538          schlaeger_richt@=-1;          schlaeger_richt@@=-1;
539          kind = stuetze;          kind = stuetze;
540          frei = 1;          frei = 1;
541        };        };
# Line 604  BreakOut = { Line 543  BreakOut = {
543        schlaeger.init = {schlaeger_init;};        schlaeger.init = {schlaeger_init;};
544    
545        schlaeger.turn = {        schlaeger.turn = {
546          schlaeger_richt@=1-schlaeger_richt@;          schlaeger_richt@@=1-schlaeger_richt@@;
547          schlaeger_richt=(schlaeger_richt+1)%4;          schlaeger_richt=(schlaeger_richt+1)%4;
548        };        };
549      >>      >>
550    }    }
551    
552    nichts = {    nichts = {
     pics = mbrBall.xpm  
553      <<      <<
554        nichts = spiel;        nichts = {
555            if (getroffen@@0 || getroffen@@1)
556                && loc_x+loc_x@@0==8..10 && loc_y+loc_y@@0<=19
557                && loc_y<=17 && frei ->
558              kind=stuetze;
559          };
560        nichts.init = nichts_init;        nichts.init = nichts_init;
561      >>      >>
562    }    }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26