;huit_2 db 02,02,02,02,02,02,02,02

Effet_CubePresent:
;  call SetPaletteTunnel
  mov word [rotox],256
  mov word [rotoy],0
  mov dword [cs:Timer],0
  .loop_CubePresent:

    call RotateCube
    call CalcPerspective
    call CheckVisible

    mov es,[virt]
    xor di,di
    mov eax,0FFFFFFFFh
    mov cx,65536/4
    rep stosd

    mov fs,[mplasma]
    mov bx,5
    .Loop_affiche_cube:
      cmp [Visible+bx],byte 0
      jne .pas_face
        mov ax,bx
        push bx
        call TextPoly
        pop bx
      .pas_face:
      dec bx
    jns .Loop_affiche_cube

    mov es,[virt2]
    mov fs,[virt]
    mov gs,[enviro]
    call DoBump

    cmp word [Timer],768
    jb .pas_de_zoom
      mov word [rotox],512

    cmp word [Timer],768+128
    jb .pas_de_zoom
      mov word [rotox],1024

    cmp word [Timer],768+128+64
    jb .pas_de_zoom
      mov word [rotox],2048


    .pas_de_zoom
      mov fs,[virt2]
      mov es,[virt]
      call Zoom

      
    mov fs,[virt]
    mov es,[screen]
    call WaitVBL
    call Virt2Scr

    cmp dword [Timer],768+128+64+32
  ja .pas_loop_CubePresent
    jmp .loop_CubePresent
  .pas_loop_CubePresent:
ret

Effet_Naiade:
  mov es,[mplasma]
  xor eax,eax
  call ClearSeg

  mov di,10240
  mov si,Naiade
  mov ah,63
  call PutText
  mov es,[virt]
  mov fs,[mplasma]
  mov word [rotox],96
  mov word [rotoy],0
  call Zoom
  call Blur
  call SetPaletteFire

  mov fs,[virt]
  mov es,[screen]
  call Virt2Scr

  mov dword [Timer],0
  .loop_naiade1:
    cmp word [Timer],400
  jb .loop_naiade1


  mov dword [Timer],0
  .loop_naiade2:
    mov es,[virt]
    call DoFire
    mov fs,[virt]
    mov es,[screen]
    call WaitVBL
    call Virt2Scr
    cmp word [Timer],70
  jb .loop_naiade2
ret






Effet_Rotozoom:
;  push cs
;  pop ds

  mov es,[mplasma]
  mov ds,[plasma]
  call CopySeg
  push cs
  pop ds

  mov dword [Timer],0
  .loop_roto:
    push cs
    pop ds
    mov fs,[mplasma]
    mov es,[virt]
    call Rotozoom
    call Blur

    mov es,[screen]
    mov fs,[virt]
    call WaitVBL
    call Virt2Scr

    cmp dword [cs:Timer],1024
  jb .loop_roto
ret






Effet_Tunnel:
  mov word [rotox],256
  mov word [rotoy],0
  call SetPaletteTunnel
  push cs
  pop ds
  mov dword [Timer],0
  .loop_tunnel:
    mov es,[t_depths]
    mov fs,[plasma]
    mov gs,[virt]
    mov ds,[t_angles]
    call DoTunnel

    mov es,[cs:virt]
    mov fs,[cs:enviro]
    xor di,di
    mov cx,65536/8
    .loop_sub_enviro:
      movq mm0,[es:di]
      psubusb mm0,[fs:di]
      movq [es:di],mm0
      add di,8
    loop .loop_sub_enviro

    push cs
    pop ds

    cmp word [Timer],256
    jb .pas_de_zoom
      mov word [rotox],512

    cmp word [Timer],256+128
    jb .pas_de_zoom
      mov word [rotox],1024

    cmp word [Timer],256+128+64
    jb .pas_de_zoom
      mov word [rotox],2048

    cmp word [Timer],256+128+64+64
    jb .pas_de_zoom
      mov word [rotox],4096

    cmp word [Timer],256+128+64+64+64
    jb .pas_de_zoom
      mov word [rotox],8192

    .pas_de_zoom:
      mov fs,[virt]
      mov es,[virt2]
      call Zoom


    mov es,[screen]
    mov fs,[virt2]
    call Virt2Scr

    cmp dword [cs:Timer],256+128+64+64+64+64
  ja .pas_loop_tunnel
    jmp .loop_tunnel
  .pas_loop_tunnel:

  emms
ret




Effet_Fontaine:
  xor eax,eax
  mov es,[virt]
  call ClearSeg

  call SetPaletteParticle
  mov es,[partic]
  call InitParticles

  mov dword [Timer],0
  .loop_particles:
    push cs
    pop ds

    mov es,[partic]
    call MoveParticles
    push es
    pop fs
    mov es,[virt]
    xor eax,eax
    call ClearSeg
    call AffParticles

    mov fs,[virt]
    mov es,[screen]
    call WaitVBL
    call Virt2Scr

    cmp dword [cs:Timer],1000
  jb .loop_particles

ret
