home *** CD-ROM | disk | FTP | other *** search
/ Supremacy 1 / Supremacy-1.iso / DEMOS / S-T / TOXIC11.ZIP / PROGRAMS / CODING / MORPHING.ZIP / MORPHING / SOURCES / PLAYBACK.S < prev   
Encoding:
Text File  |  1996-02-10  |  10.0 KB  |  445 lines

  1.     FORMAT    0-,1-
  2.  
  3.     LIST
  4. *********************************
  5. *                               *
  6. *   EXEMPLE D'UTILISATION DES   *
  7. *  TABLES PRECALCULEES D'OBJETS *
  8. *       MORPHEES EN GFA         *
  9. *                               *
  10. *    SUPERNOVA - DECEMBRE 95    *
  11. *             POUR TOXIC MAG 11 *
  12. *                               *
  13. *********************************
  14.     NOLIST
  15.  
  16. *********************************
  17. *     BASE  PAGE        *
  18. *********************************
  19.  
  20.     move.l    a7,a5
  21.     lea.l    pile,a7
  22.     move.l    4(a5),a5
  23.     move.l    12(a5),d0
  24.     add.l    20(a5),d0
  25.     add.l    28(a5),d0
  26.     add.l    #$100,d0
  27.     move.l    d0,-(sp)
  28.     move.l    a5,-(sp)
  29.     move    #0,-(sp)
  30.     move    #74,-(sp)
  31.     trap    #1
  32.     lea    12(a7),a7
  33.  
  34. ******************* SUPERVISEUR *************
  35.     
  36.     PEA    PILE
  37.     MOVE.W     #$20,-(SP)
  38.     TRAP     #1    
  39.     ADDQ.L     #6,SP
  40.     
  41. ******************* ON SAUVE LA PALETTE ACTUELLE
  42.     
  43.     move    #7,d0
  44.     lea    $ffff8240.w,a0
  45.     lea    savcol,a1
  46. couleurs
  47.     move.l    (a0)+,(a1)+
  48.     dbf    d0,couleurs
  49.  
  50. ******* ON MET NOTRE PALETTE **********
  51. ****** ET NOTRE ENVIRONNEMENT *********
  52.  
  53.     move.l    #palette,$45a
  54.  
  55.     dc.w    $a00a
  56.     clr.b    $484.w
  57.  
  58.     move.w    #4,-(sp)
  59.     trap    #14
  60.     addq.l    #2,sp
  61.     
  62.     move.w    d0,savres
  63.     cmp.w    #0,d0
  64.     beq.s    lowres
  65.  
  66.     move.w    #0,-(sp)
  67.     move.l    #-1,-(sp)
  68.     move.l    #-1,-(sp)
  69.     move.w    #5,-(sp)
  70.     trap    #14
  71.     add.l    #12,sp
  72.  
  73. *********** ON ITINITIALISE LES POINTEURS ********
  74.  
  75. lowres
  76.     bsr    clear_screen
  77.     
  78.     LEA    SCRIPT,A0                LES ADRESSES DES MORPHING PRECALCULEES
  79.     
  80.     MOVE.L    A0,POINTEUR_SCRIPT    SONT POINTEES PAR POINTEUR_SCRIPT
  81.     
  82.     MOVE.L    (A0)+,LIENS
  83.     MOVE.L    (A0),BUFFER
  84.  
  85.     MOVE    #1,NB_TRANSITIONS    ON MET NB_TRANSITION A 1 POUR SIMULER LA FIN
  86.                                 *DU MORPHING DU PREMIER OBJET ET AINSI POUR
  87.                                 *SAUTER DIRECTEMENT A LA ROUTINE D'ATTENTE
  88.                                 *AFIN D'AVOIR LE TEMPS DE VOIR LE 1er OBJET 
  89.                                 *AVANT QU'IL NE MORPHE.
  90.  
  91. vroom    
  92.     cmp    #0,nb_transitions        *ON A FINI DE MORPHE L'OBJET EN COURS?
  93.     beq    NEXT_MORPHING
  94.  
  95.     bsr        wvbl
  96.     bsr        efface_man                ON EFFACE LA PORTION D'ECRAN
  97.     move    #$700,$ffff8240
  98.     
  99.     move.l    liens,a1            POINTE SUR LA TABLE DES LIAISONS 
  100.                                 *ENTRE LES POINTS
  101.     move    (a1)+,d6
  102.     sub        #1,d6                NOMBRE DE LIGNES QUI COMPOSENT L'OBJET A TRACER
  103.     move    (a1)+,distance        NOMBRES DE TRANSITIONS ENTRE LE POINT SOURCE ET DEST.
  104.     
  105.     move.l    buffer,a0            POINTE SUR LES COORDONNES DES POINTS
  106.     
  107. PT    
  108.     move    (a1)+,d0            ON CALCULE LES OFFSET ENTRES LES POINTS
  109.                                 *EN MULTIPLIANT LE NOMBRE DE POINTS INTERMEDIAIRES
  110.     move    distance,d2            PAR LE NO DU POINT ACTUEL. AINSI, ON POINTERA
  111.     mulu    d2,d0                TOUJOURS SUR LA BONNE POSITION.
  112.     movem    0(a0,d0),d0/d1        X1/Y1
  113.     move    (a1)+,d3
  114.     mulu    d2,d3
  115.     movem    0(a0,d3),d2/d3        X2/Y2
  116.     BSR    DRAW_LINE            GO TO DRAW!
  117.     DBF    D6,PT                ON FAIT DE MEME POUR TOUS LES POINTS
  118.     clr    $ffff8240        COMPOSANT L'OBJET
  119.     
  120.     sub    #1,nb_transitions        ON PASSE A LA TRANSITION SUIVANTE
  121.     ADD.W    #4,a0                ON N'OUBLE PAS DE DECALER LA TABLE DES
  122.     move.l    a0,buffer            COORDONNEES.
  123.     cmp.b    #$39,$fffffc02.w    APPUI TOUCHE?
  124.     bne    vroom
  125.  
  126.  
  127. fin    move.b    #7,$484.w            MOUSE AND BIIIIP!
  128.     dc.w    $a009
  129.  
  130.     bsr    clear_screen    
  131.  
  132.     cmp.w    #0,savres
  133.     beq.s    bibi 
  134.     move.w    savres,-(sp)
  135.     move.l    #-1,-(sp)            RESTORE SCREEN
  136.     move.l    #-1,-(sp)
  137.     move.w    #5,-(sp)
  138.     trap    #14
  139.     add.l    #12,sp
  140.     
  141. bibi    lea    savcol,a0
  142.     lea    $ffff8240.w,a1
  143.     move    #7,d0
  144. recol    move.l    (a0)+,(a1)+
  145.     dbf    d0,recol
  146.  
  147.     MOVE.W    #0,-(SP)    et hasta la vista baby...
  148.     TRAP    #1    
  149.  
  150.     
  151.     ***************************
  152.  
  153. NEXT_morphing                *ARRIVE ICI, ON VA PASSER AU MORPHING
  154.                             *DE L'OBJET SUIVANT DANS LA LISTE
  155.     sub    #1,waitz            MAIS AVANT, ON DECREMENTE UN COMPTEUR POUR
  156.     cmp    #0,waitz            AVOIR LE TEMPS DE VOIR L'OBJET 
  157.     bne    vroom                
  158.     move    #50000,waitz    ON REMET LE COMPTEUR POUR LE PROCHAIN OBJET
  159.                             *50000...IMAGINEZ LE TEMPS MACHINE GASPILLE!!!
  160.                             *ARGHHH! LE REMORD ME RONGE...
  161.  
  162. NEXT_FIGURE    
  163.     MOVE.L    POINTEUR_SCRIPT,A0    AU SUIVANT...
  164.     MOVE.L    (A0)+,LIENS            NOUVELLE TABLE DE LIENS.
  165.     CMP.L    #$FFFFFFFF,LIENS    C'EST LA FIN DU SCRIPT?
  166.     BEQ    DO_AGAIN                ALORS ON REBOUCLE
  167.     MOVE.L    (A0)+,BUFFER        
  168.     MOVE.L    A0,POINTEUR_SCRIPT    ON SAUVE LE POINTEUR DE SCRIPT
  169.     
  170.     move.l    liens,A0
  171.     add.l    #2,a0                
  172.     moveq    #0,d0                ON CALCULE L'OFFSET ENTRE
  173.     move    (a0),d0                DEUX POINTS.
  174.     divu    #4,d0                UNE BONNE FOIS POUR TOUTES.
  175.     move    d0,nb_transitions    
  176.     bra    vroom                    ET ON MORPHE...
  177.                 
  178. DO_AGAIN
  179.     LEA    SCRIPT,A0                ON RESET LE POINTEUR PRINCIPAL
  180.     MOVE.L    A0,POINTEUR_SCRIPT
  181.     BRA    NEXT_FIGURE
  182.     
  183.     
  184. ************ ROUTINE QUI EFFACE UNE PORTION D'ECRAN
  185. ************ EXTRAITE DE LA TRANSBEAUCE DEMO II TBC.
  186. ************ OULALA COMME C'EST VIEUX!!!
  187. ************ ON PEUT BIEN SUR UTILISER LE BLITTER MAIS
  188. ************ CE N'EST PLUS COMPATIBLE STF.
  189. ************ A VOUS DE L'AMELIORER POUR EFFACER DES OBJETS
  190. ************ PLUS GRAND PAR EXEMPLE...
  191.     
  192. efface_man
  193.     movem.l    d0-a6,-(sp)
  194.     move.l    $44e,a0        * a0 = ecran
  195.     lea    (160*50)+48(a0),a0    * on se positionne bien
  196.     move.w    #120,d0            * 88 lignes à effacer
  197.     move.w    #0,d1            * motif de remplissage
  198. ef    
  199.  
  200. i    set    6            * 3eme plan
  201.     rept    8            * 14 mots par lignes
  202.     move.w    d1,i(a0)        * efface
  203. i    set    i+8            * mot suivant
  204.     endr
  205.     lea    160(a0),a0        * ligne suivante
  206.     dbf    d0,ef
  207.     movem.l    (sp)+,d0-a6
  208.     rts
  209.  
  210.  
  211. * ----------------------------------------------------------------
  212. * ENCORE EXTRAITE DE LA DEMO TBC.
  213. * COMME LE DISAIT DOCPROF... TO BE IMPROVED...
  214.  
  215. * Routine de tracé de ligne.
  216. * D0 = X1 Coordonnée X point de départ.
  217. * D1 = Y1         Y
  218. * D2 = X2 Coordonnée X point d'arrivée.
  219. * D3 = Y2            Y
  220.  
  221. Draw_line
  222.  
  223.         movem.l    d0-d7/a0-a6,-(a7)
  224.         move.w    d2,a2
  225.         move.w    d3,a3
  226.         move.w    d0,d2            <- ne hurlez pas !
  227.         move.w    d1,d3
  228.         move.l    #0,a5
  229.     
  230. * --------------------------------------------------------------
  231. * Trace de droite
  232. * --------------------------------------------------------------
  233.  
  234. * Initialisation
  235.     
  236. Trace_droite:
  237.  
  238. *    Initialisation droite
  239.  
  240.         move.w     a2,d6               * d6 = x1
  241.         sub.w     d2,d6                * d6 = x1-x0 = pente de la droite en X
  242.         blt.s     ouga                  * si la droite monte en X -> dxpos
  243.     exg.l    D2,A2
  244.     exg.l    D3,A3
  245.     neg.w    D6
  246. ouga    neg.w     d6                   * d6 = -dx donc d6>0 (la pente X est positive)
  247.     
  248.     move.w    d6,d0            * d6=x1-x0
  249.     lsr.w    #1,d0    
  250.     move.w    d0,A1            * repetion droite
  251.     add.w    a2,d0            * d0 = X centre 
  252.  
  253. *    C'EST CE CAS LA
  254.     
  255.     move.w     a3,d7               * d7 = y1
  256.      sub.w     d3,d7                * d7 = y1-y0  = pente en Y
  257.      blt.s     ouga2                   * dy > 0 alors on dessine
  258.     move.w    d7,d5            * d7 = y1-y0
  259.     lsr.w    #1,d5            
  260.     move.w    d5,a2            * a2 nombre de repetitions
  261.     add.w    d3,d5            * d5=y
  262.     move.w    #160,a5            * offset Y = 160 -> A5
  263.     bra.s    dur     
  264.      
  265. ouga2     neg.w     d7                   * sinon d7 = -dy donc d7>0 (la pente est positive)
  266.     
  267.     move.w    d7,d5
  268.     lsr.w    #1,d5
  269.     move.w    d5,a2
  270.     add.w    a3,d5
  271.     move.w    #-160,a5        * on descent : offset = -160
  272.  
  273.     * no, no... no !!!!!
  274.     
  275. dur:    moveq.w    #0,D4
  276.  
  277. *    on calcule la position en mot sur l'écran du centre
  278.  
  279. *    Initialisation Y
  280.  
  281.     move.l    $44e,a0        * a0 = ecranx
  282.     lea    ordonnee,a3        * a1 = tableau ordonnee
  283.     lsl.w    #1,d3            * mulu #2,d5
  284.     add.w    (a3,d3.W),a0        * on se positionne sur le screen
  285.  
  286.     move.l    $44e,a6        * a0 = ecranx
  287.     lsl.w    #1,d5            * mulu #2,d5
  288.     add.w    (a3,d5.w),A6        * on se positionne sur le screen
  289.  
  290. *    Initialisation X
  291.  
  292.     lea    abscisse,a3        * a3 = tableau des abscisses
  293.     lsl.w    #2,d2            * mulu #4,d1
  294.     add.w    (a3,d2.W),a0        * on se positionne sur le mot
  295.     move.w    2(a3,d2.W),d2        * d2 = motif de bits 
  296.     
  297.     lsl.w    #2,d0            * mulu #4,d1
  298.     add.w    (a3,d0.w),A6        * on se positionne sur le mot
  299.     move.w  2(A3,D0.w),D0
  300.  
  301. suite_merde
  302.  
  303. *    ici l'on trace !  /  on choisit la routine...
  304.     
  305.     move.w     a1,d5
  306.     cmp.w    D7,D6
  307.     bge.s    non
  308.     move.w     a2,d5
  309.     bra.s    nony
  310.     
  311. * Trace de la droite (to be improved)
  312.  
  313. *    Incrementation X
  314.  
  315. non    add.w    D2,D2
  316.     bcc.s    lou2
  317.     moveq.w    #1,D2
  318.     subq.w    #8,a0            * a4= offset_x
  319. lou2    or.w    d2,6(a0)
  320.     add.w    d0,d0
  321.     bcc.s    lou3
  322.     moveq.w    #1,D0
  323.     subq.w    #8,A6
  324. lou3    or.w    d0,6(a6)
  325.     add.w    d7,d4            * d4=(dy/dx)-(ay/ax)
  326.     ble.s    lou4
  327.     adda.w    a5,a0            * on passe a la ligne suivante
  328.         adda.w    a5,a6            * A5=OFFSET_Y
  329.         sub.w     d6,d4                * E=E-DX SOIT D4=D4-D6
  330. lou4    Dbf.w    D5,non
  331.     movem.l    (a7)+,d0-d7/a0-a6
  332.     rts
  333.  
  334. * Routine 2
  335.  
  336. *    Incrementation Y
  337.  
  338. nony:      
  339.     add.w    a5,a0        * on passe a la ligne suivante
  340.         add.w    a5,a6
  341.     or.w    d2,6(a0)
  342.     or.w    d0,6(a6)
  343.     sub.w     d6,d4                * E=E-DX SOIT D4=D4-D6
  344.     bge.s    liou
  345.     add.w    d7,d4            * d4=(dy/dx)-(ay/ax)
  346.     add.w    d2,d2
  347.     bcc.s    codes
  348.     moveq.w    #1,D2
  349.     subq.w    #8,a0
  350. codes    add.w    d0,d0
  351.     bcc.s    liou
  352.     moveq.w    #1,D0
  353.     subq.w    #8,A6
  354. liou    Dbf.w    D5,nony
  355.     movem.l    (a7)+,d0-d7/a0-a6
  356.     rts
  357.  
  358. wvbl    
  359.     MOVE.W    $468,D1
  360. VSYNC    CMP    $468,D1
  361.     BEQ    VSYNC
  362.     rts
  363.     
  364.  
  365. clear_screen            *NO COMMENTS...
  366.     move.l    $44e.w,a1
  367.     move.w    #7999,d0
  368. cls    clr.l    (a1)+
  369.     dbf    d0,cls
  370.     rts
  371.  
  372. ********************** DONNEE CONCERNANT LE MORPHING
  373.  
  374. ordonnee:
  375. i        set    0
  376.         rept    201
  377.         dc.w    i
  378. i        set    i+160
  379.         endr
  380.  
  381. abscisse
  382. i        set    0
  383.         rept    25
  384.         dc.w    i,32768,i,16384,i,8192,i,4096,i,2048,i,1024,i,512
  385.         dc.w    i,256,i,128,i,64,i,32,i,16,i,8,i,4,i,2,i,1
  386. i        set    i+8
  387.         endr
  388.  
  389. carre_triangle.dat
  390.     incbin    a:\morphing\precalc\carretri.dat
  391.     even
  392. carre_triangle.xy
  393.     incbin    a:\morphing\precalc\carretri.xy
  394.     even
  395. triangle_sablier.dat
  396.     incbin    a:\morphing\precalc\trisabli.dat
  397.     even
  398. triangle_sablier.xy
  399.     incbin    a:\morphing\precalc\trisabli.xy
  400.     even
  401. sablier_fleche.xy
  402.     incbin    a:\morphing\precalc\sablifle.xy
  403.     even
  404. sablier_fleche.dat
  405.     incbin    a:\morphing\precalc\sablifle.dat
  406.     even
  407. fleche_carre.xy
  408.     incbin    a:\morphing\precalc\flecarre.xy
  409. fleche_carre.dat
  410.     incbin    a:\morphing\precalc\flecarre.dat    
  411.     
  412. waitz    dc.w    50000
  413.  
  414.  
  415. ******** LE SCRIPT EST COMPOSE COMME SUIT:
  416. **
  417. **     DC.L    ADRESSE_DES_COORDONNEES_DE_L'OBJET,ADRESSE_DE_LA_TABLE_DES_LIENS_CORRESPONDANT.
  418. **    DC.L    ADRESSE_DES_COORDONNEES_DE_L'OBJET,ADRESSE_DE_LA_TABLE_DES_LIENS_CORRESPONDANT.
  419. **    DC.L    ...
  420. **     DC.L    $FFFFFFFF    FIN DU SCRIPT
  421.     
  422. SCRIPT    
  423.     DC.L    CARRE_TRIANGLE.DAT,CARRE_TRIANGLE.XY
  424.     DC.L    TRIANGLE_SABLIER.DAT,TRIANGLE_SABLIER.XY
  425.     DC.L    SABLIER_FLECHE.DAT,SABLIER_FLECHE.XY
  426.     DC.L    FLECHE_CARRE.DAT,FLECHE_CARRE.XY
  427.     DC.L    $FFFFFFFF
  428.  
  429. palette    ds.w    1
  430.     dcb.w    15,$777
  431.  
  432. *******************************
  433.     BSS
  434.  
  435. POINTEUR_SCRIPT    DS.L    1
  436. savcol    ds.l    8
  437. savres    ds.w    1
  438. distance    ds.w    1
  439. liens    ds.l    1
  440. buffer    ds.l    1
  441. nb_transitions    ds.w    1
  442.     ds.l    200
  443. pile    ds.w    1
  444.  
  445.