
;***********************************************************************************************
;
;***********************************************************************************************
jogar PROC NEAR

      call fase1
      call fase
      call telaIntervalo1
      call fase22
      call fase
      cmp vitoriasPedro, 2
      je chamarRecordes
      cmp vitoriasBino, 2
      je chamarRecordes
      call telaIntervalo2
      call fase3
      call fase
chamarRecordes:
      call Final
      call geraRecordes
      jmp volta_menu_principal
      ret


jogar ENDP


fase1 PROC NEAR

           ;carrega_paleta painel_pal, paleta_buffer
            mov faseUm, 1
            ;carrega_paleta fase2_pal, paleta_buffer
            ler_arquivo fase2, buffer_painel, 64000
            ler_arquivo mascF1, buffer_mascara, 64000
            ler_arquivo m2Item, buffer_masc2, 64000
            ler_arquivo m2Item, buffer_masc3, 64000
           ;ler_arquivo mascara, buffer_mascara, 64000

           ;ler_arquivo painel, buffer_painel, 64000
           ;ler_arquivo masc2, buffer_masc2, 64000
           ;ler_arquivo masc3, buffer_masc3, 64000

           call geraConfronto               ;gera a palavra "CONFRONTO 1"
           ret


fase1 ENDP


fase22 PROC NEAR
           mov faseUm, 0
           call inicializar_fases
           ler_arquivo mascara, buffer_mascara, 64000
           ler_arquivo painel, buffer_painel, 64000
           call geraConfronto2               ;gera a palavra "CONFRONTO 2"

           ler_arquivo vitoria, buffer_vitoria, 16

           cmp vitoriasPedro,1
           jne vitBino
               carregar_figura2 buffer_vitoria, 5, 28, 4, 4
           jmp resto

        vitBino:
                carregar_figura2 buffer_vitoria, 311, 167, 4, 4

        resto:
              ler_arquivo masc2, buffer_masc2, 64000
              ler_arquivo masc3, buffer_masc3, 64000


            ret


fase22 ENDP


;
;Carrega as figuras relacionadas a terceira fase
;
fase3 PROC NEAR

        call inicializar_fases
        ler_arquivo mascara, buffer_mascara, 64000
        ler_arquivo painel, buffer_painel, 64000
        call geraConfronto3               ;gera a palavra "CONFRONTO 3"
        ler_arquivo vitoria, buffer_vitoria, 16
        carregar_figura2 buffer_vitoria, 5, 28, 4, 4
        carregar_figura2 buffer_vitoria, 311, 167, 4, 4
        ler_arquivo masc2, buffer_masc2, 64000
        ler_arquivo masc3, buffer_masc3, 64000


        ret


fase3 ENDP


;****************************************************************************************************
;******************************************** FASE 1 ************************************************
;****************************************************************************************************

fase PROC NEAR

      call Item                        ;gera as posições iniciais das duas estrelas
      mov SEC, 0

      game:

           cmp boom, 1                 ;se for igual chama a tela de recordes
           ;je telaRecords
           je sairFase

           call deslocamento
           desenhar                    ;desenha tanques, caminhões, estrelas e balas
           call carregaVidasPedro
           call carregaVidasBino
           call carregaBalasBino
           call carregaBalasPedro
           recarregarMunicao
           recarregarMunicao2
           call explosoes

           call imprimir_tudo
           call Delay

;*************PARTE MODIFICADA******************************
           cmp ds:[varF1], 1                    ;apertou a tecla secreta pra ganhar com pedro
           je pedroGanhouRobando
           cmp ds:[varF2], 1
           je binoGanhouRobando                 ;apertou a tecla secreta pra ganhar com bino
;**************************************************************

           cmp ds:[varEsc], 1
           jnz game
           call ResetarInt15                    ;reseta a interrupção quando o usuario sai do jogo
           call ResetarInt1C
           jmp volta_menu_principal

pedroGanhouRobando:                             ;quando f1 é pressionado

             inc vitoriasPedro
             add ptsPedro, 100
             jmp sairFase

binoGanhouRobando:                              ;quando f2 é pressionado

             inc vitoriasBino
             add ptsBino, 100
             jmp sairFase

      sairFase:

           mov SEC, 0

      esperaSair:
                  cmp SEC, 2
                 jne esperaSair

fase ENDP

;***********************************************************************************************
;É chamado pra imprimir as vidas de Pedro
;******************************************************************************************
carregaVidasPedro PROC NEAR

        cmp vidasTank, 3
        je carregaTresVidas
        cmp vidasTank, 2
        je carregaDuasVidas
        cmp vidasTank, 1
        je carregaUmaVida
        jmp sairCarregaVidas

        carregaTresVidas:

                         carregar_figura buffer_fot, 2, 2, 10h, 10h
                         carregar_figura buffer_fot, 22, 2, 10h, 10h
                         carregar_figura buffer_fot, 44, 2, 10h, 10h

       carregaDuasVidas:

                         carregar_figura buffer_fot, 2, 2, 10h, 10h
                         carregar_figura buffer_fot, 22, 2, 10h, 10h

       carregaUmaVida:

                         carregar_figura buffer_fot, 2, 2, 10h, 10h
       sairCarregaVidas:

            ret

carregaVidasPedro ENDP

;***********************************************************************************************
;É chamado pra imprimir as vidas de Bino
;******************************************************************************************
carregaVidasBino PROC NEAR

        cmp vidasTank2, 3
        je carregaTresVidas2
        cmp vidasTank2, 2
        je carregaDuasVidas2
        cmp vidasTank2, 1
        je carregaUmaVida2
        jmp sairCarregaVidas2

        carregaTresVidas2:

                         carregar_figura buffer_bino, 260, 180, 10h, 10h
                         carregar_figura buffer_bino, 280, 180, 10h, 10h
                         carregar_figura buffer_bino, 300, 180, 10h, 10h

       carregaDuasVidas2:

                         carregar_figura buffer_bino, 280, 180, 10h, 10h
                         carregar_figura buffer_bino, 300, 180, 10h, 10h

       carregaUmaVida2:

                         carregar_figura buffer_bino, 300, 180, 10h, 10h

       sairCarregaVidas2:

            ret

carregaVidasBino ENDP

;***********************************************************************************************
;É chamado pra imprimir as Balas de Bino
;******************************************************************************************
carregaBalasBino PROC NEAR

                 push cx ax

                 mov cx, 1
                 mov ax, 5

                 loopBalas:                      ;loop que imprime o número certo de balas de Bino
                           cmp cx, balasTank
                           jg sairCarregarBalasBino
                           carregar_figura buffer_tiro, ax, 20, 5h, 2h
                           add cx, 1
                           add ax, 4
                           jmp loopBalas

                 sairCarregarBalasBino:
                           pop ax cx
                           ret
carregaBalasBino ENDP

;***********************************************************************************************
;É chamado pra imprimir as Balas de Pedro
;******************************************************************************************
carregaBalasPedro PROC NEAR

                 push cx ax

                 mov cx, 1
                 mov ax, 312

                 loopBalas2:                           ;loop que imprime o número certo de balas de Pedro
                           cmp cx, balasTank2
                           jg sairCarregarBalasPedro
                           carregar_figura buffer_tiro, ax, 174, 5h, 2h
                           add cx, 1
                           sub ax, 4
                           jmp loopBalas2

                 sairCarregarBalasPedro:
                           pop ax cx
                           ret
carregaBalasPedro ENDP

;****************************************************************************************************
;Procedimento que produz a explosão dos tanques
;****************************************************************************************************
explosoes PROC NEAR

         cmp vidasTank, -1
         je explodeTank1
         jmp exploTank2

         explodeTank1:

                ;                         ;bonus na pontuação por vencer a fase
                 ;mov boom, 1                             ;flag para indicar que a partida acabou
                 cmp explosaoTank2 , 0
                 jg exploTank2
                 cmp explosaoTank1, 0
                 je explode1
                 cmp explosaoTank1, 1
                 je explode2
                 cmp explosaoTank1, 2
                 je explode3
                 cmp explosaoTank1, 3
                 je explode4
                 cmp explosaoTank1, 4
                 je explode5
                 cmp explosaoTank1, 5
                 je explode6
                 cmp explosaoTank1, 6
                 je explode7
                 cmp explosaoTank1, 7
                 je explode8
                 jmp exploTank2

         explode1:

                 carregar_figura buffer_fogo0, posX_tank, posY_tank, 0dh, 0eh
                 mov explosaoTank1 , 1
                 mov naoImprimir, 1
                 mov explodiu, 1       ;quer dizer que o tanque1 explodiu
                 mov tempoConfrontos, 0
                 jmp exploTank2

         explode2:

                 carregar_figura buffer_fogo, posX_tank, posY_tank, 10h, 10h
                 mov explosaoTank1 , 2
                 call somExplodiu     ;som do tanque explodindo
                 jmp exploTank2

         explode3:

                 carregar_figura buffer_fogo2, posX_tank, posY_tank, 12h, 13h
                 mov explosaoTank1 , 3
                 jmp exploTank2

         explode4:
                 carregar_figura buffer_fogo3, posX_tank, posY_tank, 15h, 16h
                 mov explosaoTank1 , 4
                 jmp exploTank2

         explode5:

                 carregar_figura buffer_fogo3, posX_tank, posY_tank, 15h, 15h
                 mov explosaoTank1 , 5
                 jmp exploTank2

         explode6:

                 carregar_figura buffer_fogo2, posX_tank, posY_tank, 12h, 13h
                 mov explosaoTank1 , 6
                 jmp exploTank2

         explode7:

                 carregar_figura buffer_fogo, posX_tank, posY_tank, 10h, 10h
                  mov explosaoTank1 , 7
                 jmp exploTank2

         explode8:

                 carregar_figura buffer_fogo0, posX_tank, posY_tank, 0dh, 0eh
                 cmp tempoConfrontos, 10
                 jl  explodeTank1
                 mov boom, 1
                 mov tempoConfrontos, 0
                 add ptsBino, 100
                 inc vitoriasBino
                 jmp exploTank2

         exploTank2:

                   cmp vidasTank2, -1
                   je explodeTank2
                   jmp sairExplosoes

         explodeTank2:

                ;                       ;bonus na pontuação por vencer a fase
                 ;mov boom, 1                            ;flag para avisar que a partida acabou
                 cmp explosaoTank1, 0
                 jg sairExplosoes
                 cmp explosaoTank2, 0
                 je explode9
                 cmp explosaoTank2, 1
                 je explode10
                 cmp explosaoTank2, 2
                 je explode11
                 cmp explosaoTank2, 3
                 je explode12
                 cmp explosaoTank2, 4
                 je explode13
                 cmp explosaoTank2, 5
                 je explode14
                 cmp explosaoTank2, 6
                 je explode15
                 cmp explosaoTank2, 7
                 je explode16
                 jmp sairExplosoes

         explode9:

                 carregar_figura buffer_fogo0, posX_tank2, posY_tank2, 0dh, 0eh
                 mov explosaoTank2 , 1
                 mov naoImprimir, 1
                 mov explodiu, 1       ;quer dizer que o tanque2 explodiu
                 mov tempoConfrontos, 0
                 jmp sairExplosoes

         explode10:

                 carregar_figura buffer_fogo, posX_tank2, posY_tank2, 10h, 10h
                 mov explosaoTank2 , 2
                 call somExplodiu     ;som do tanque explodindo
                 jmp sairExplosoes

         explode11:

                 carregar_figura buffer_fogo2, posX_tank2, posY_tank2, 12h, 13h
                  mov explosaoTank2 , 3
                 jmp sairExplosoes

         explode12:

                 carregar_figura buffer_fogo3, posX_tank2, posY_tank2, 15h, 16h
                 mov explosaoTank2 , 4
                 jmp sairExplosoes

          explode13:

                 carregar_figura buffer_fogo3, posX_tank2, posY_tank2, 15h, 16h
                 mov explosaoTank2 , 5
                 mov naoImprimir, 1
                 jmp sairExplosoes

         explode14:

                 carregar_figura buffer_fogo2, posX_tank2, posY_tank2, 12h, 13h
                 mov explosaoTank2 , 6
                 jmp sairExplosoes

         explode15:

                 carregar_figura buffer_fogo, posX_tank2, posY_tank2, 10h, 10h
                 mov explosaoTank2 , 7
                 jmp sairExplosoes

         explode16:

                 carregar_figura buffer_fogo0, posX_tank2, posY_tank2, 0dh, 0eh
                 cmp tempoConfrontos, 10
                 jl  explodeTank2
                 mov tempoConfrontos, 0
                 mov boom, 1
                 add ptsPedro, 100
                 inc vitoriasPedro
                 mov alguemVenceu, 1
                 jmp sairExplosoes

         sairExplosoes:
                  ret

explosoes ENDP

;***********************************************************************************************************
;Procedimento que gera a palavra "CONFRONTO 1".
;***********************************************************************************************************
confronto PROC NEAR

              cmp confrontos, 0
              jne verificaConfronto
              jmp confronto0

              verificaConfronto:

                           cmp confrontos, 1
                           je confronto1
                           cmp confrontos, 2
                           je confronto2
                           cmp confrontos, 3
                           je confronto3
                           cmp confrontos, 4
                           je confronto4
                           cmp confrontos, 5
                           je confronto5
                           cmp confrontos, 6
                           je confronto6
                           cmp confrontos, 7
                           je confronto7
                           cmp confrontos, 8
                           je confronto8
                           cmp confrontos, 9
                           je confronto9
                           cmp confrontos, 10
                           je confronto10
                           cmp confrontos, 11
                           je confronto11
                           cmp confrontos, 12
                           je confronto12
                           cmp confrontos, 13
                           je confronto13
                           jmp sairConfronto

              confronto0:

                         ler_arquivo confro0, buffer_confronto, 4144
                         carregar_figura buffer_confronto, 80, 60, 1ch, 94h
                         cmp tempoConfrontos, 18
                         jl sairConfronto
                         add confrontos, 1
                         jmp sairConfronto

              confronto1:

                         ler_arquivo confro1, buffer_confronto, 4144
                         carregar_figura buffer_confronto, 80, 60, 1ch, 94h
                         cmp tempoConfrontos, 22
                         jl sairConfronto
                         add confrontos, 1
                         jmp sairConfronto

              confronto2:

                         ler_arquivo confro2, buffer_confronto, 4144
                         carregar_figura buffer_confronto, 80, 60, 1ch, 94h
                         cmp tempoConfrontos, 26
                         jl sairConfronto
                         add confrontos, 1
                         jmp sairConfronto

              confronto3:

                         ler_arquivo confro3, buffer_confronto,4144
                         carregar_figura buffer_confronto, 80, 60, 1ch, 94h
                         cmp tempoConfrontos, 30
                         jl sairConfronto
                         add confrontos, 1
                         jmp sairConfronto

              confronto4:

                         ler_arquivo confro4, buffer_confronto, 4144
                         carregar_figura buffer_confronto, 80, 60, 1ch, 94h
                         cmp tempoConfrontos, 34
                         jl sairConfronto
                         add confrontos, 1
                         jmp sairConfronto

              confronto5:

                         ler_arquivo confro5, buffer_confronto, 4144
                         carregar_figura buffer_confronto, 80, 60, 1ch, 94h
                         cmp tempoConfrontos, 38
                         jl sairConfronto
                         add confrontos, 1
                         jmp sairConfronto

              confronto6:

                         ler_arquivo confro6, buffer_confronto, 4144
                         carregar_figura buffer_confronto, 80, 60, 1ch, 94h
                         cmp tempoConfrontos, 42
                         jl sairConfronto
                         add confrontos, 1
                         jmp sairConfronto

              confronto7:

                         ler_arquivo confro7, buffer_confronto, 4144
                         carregar_figura buffer_confronto, 80, 60, 1ch, 94h
                         cmp tempoConfrontos, 46
                         jl sairConfronto
                         add confrontos, 1
                         jmp sairConfronto

              confronto8:

                         ler_arquivo confro8, buffer_confronto, 4144
                         carregar_figura buffer_confronto, 80, 60, 1ch, 94h
                         cmp tempoConfrontos, 50
                         jl sairConfronto
                         add confrontos, 1
                         jmp sairConfronto

              confronto9:

                         ler_arquivo confro9, buffer_confronto, 4144
                         carregar_figura buffer_confronto, 80, 60, 1ch, 94h
                         cmp tempoConfrontos, 54
                         jl sairConfronto
                         add confrontos, 1
                         jmp sairConfronto

              confronto10:

                         ler_arquivo confro10, buffer_confronto, 4144
                         carregar_figura buffer_confronto, 80, 60, 1ch, 94h
                         cmp tempoConfrontos, 58
                         jl sairConfronto
                         add confrontos, 1
                         jmp sairConfronto

              confronto11:

                         ler_arquivo confro11, buffer_confronto, 4144
                         carregar_figura buffer_confronto, 80, 60, 1ch, 94h
                         cmp tempoConfrontos, 60
                         jl sairConfronto
                         add confrontos, 1
                         jmp sairConfronto

              confronto12:

                         ler_arquivo confro12, buffer_confronto,4144
                         carregar_figura buffer_confronto, 80, 60, 1ch, 94h
                         cmp tempoConfrontos, 62
                         jl sairConfronto
                         add confrontos, 1
                         jmp sairConfronto

              confronto13:

                         ler_arquivo confro13, buffer_confronto, 4144
                         carregar_figura buffer_confronto, 80, 60, 1ch, 94h
                         cmp tempoConfrontos, 70
                         jl sairConfronto
                         add confrontos, 1
                         mov SEC, 0
                         jmp sairConfronto

              sairConfronto:

                            ret

confronto ENDP

;-----------------------------------------------------------------------------------------------------------
;Fim confronto
;-----------------------------------------------------------------------------------------------------------

;*****************************************************************************************************************
;Procedimento que gera o efeito de desaparecer da palavra "CONFRONTO 1"
;*****************************************************************************************************************
geraConfronto PROC NEAR

                       cmp confrontos, 14
                       jne loopConfronto

                       loopConfronto:

                                     copiar_buffer buffer_painel, buffer, 64000
                                     call confronto
                                     call imprimir_tudo
                                     cmp confrontos, 14
                                     jne loopConfronto
                                     jmp sairGeraConfronto

                       sairGeraConfronto:

                                         ret

geraConfronto ENDP

;--------------------------------------------------------------------------------------------------------
;Fim geraConfronto
;--------------------------------------------------------------------------------------------------------


;***********************************************************************************************************
;Procedimento que gera a palavra "CONFRONTO 2".
;***********************************************************************************************************
Confronto2 PROC NEAR

              cmp confrontos2, 0
              jne verificaConfronto2
              jmp confronto20

              verificaConfronto2:

                           cmp confrontos2, 1
                           je confronto21
                           cmp confrontos2, 2
                           je confronto22
                           cmp confrontos2, 3
                           je confronto23
                           cmp confrontos2, 4
                           je confronto24
                           cmp confrontos2, 5
                           je confronto25
                           cmp confrontos2, 6
                           je confronto26
                           cmp confrontos2, 7
                           je confronto27
                           cmp confrontos2, 8
                           je confronto28
                           cmp confrontos2, 9
                           je confronto29
                           cmp confrontos2, 10
                           je confronto210
                           cmp confrontos2, 11
                           je confronto211
                           cmp confrontos2, 12
                           je confronto212
                           jmp sairConfronto2

              confronto20:

                         ;mov tempoConfrontos, 0        ;zera contador do tempo
                         ler_arquivo confro20, buffer_confronto2, 4200;3969
                         carregar_figura buffer_confronto2, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 18
                         jl sairConfronto2
                         add confrontos2, 1
                         jmp sairConfronto2

              confronto21:

                         ler_arquivo confro21, buffer_confronto2, 4200
                         carregar_figura buffer_confronto2, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 22
                         jl sairConfronto2
                         add confrontos2, 1
                         jmp sairConfronto2

              confronto22:

                         ler_arquivo confro22, buffer_confronto2, 4200
                         carregar_figura buffer_confronto2, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 26
                         jl sairConfronto2
                         add confrontos2, 1
                         jmp sairConfronto2

              confronto23:

                         ler_arquivo confro23, buffer_confronto2,4200
                         carregar_figura buffer_confronto2, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 30
                         jl sairConfronto2
                         add confrontos2, 1
                         jmp sairConfronto2

              confronto24:

                         ler_arquivo confro24, buffer_confronto2, 4200
                         carregar_figura buffer_confronto2, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 34
                         jl sairConfronto2
                         add confrontos2, 1
                         jmp sairConfronto2

              confronto25:

                         ler_arquivo confro25, buffer_confronto2, 4200
                         carregar_figura buffer_confronto2, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 38
                         jl sairConfronto2
                         add confrontos2, 1
                         jmp sairConfronto2

              confronto26:

                         ler_arquivo confro26, buffer_confronto2, 4200
                         carregar_figura buffer_confronto2, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 42
                         jl sairConfronto2
                         add confrontos2, 1
                         jmp sairConfronto2

              confronto27:

                         ler_arquivo confro27, buffer_confronto2, 4200
                         carregar_figura buffer_confronto2, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 46
                         jl sairConfronto2
                         add confrontos2, 1
                         jmp sairConfronto2

              confronto28:

                         ler_arquivo confro28, buffer_confronto2, 4200
                         carregar_figura buffer_confronto2, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 50
                         jl sairConfronto2
                         add confrontos2, 1
                         jmp sairConfronto2

              confronto29:

                         ler_arquivo confro29, buffer_confronto2, 4200
                         carregar_figura buffer_confronto2, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 54
                         jl sairConfronto2
                         add confrontos2, 1
                         jmp sairConfronto2

              confronto210:

                         ler_arquivo confro210, buffer_confronto2, 4200
                         carregar_figura buffer_confronto2, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 58
                         jl sairConfronto2
                         add confrontos2, 1
                         jmp sairConfronto2

              confronto211:

                         ler_arquivo confro211, buffer_confronto2, 4200
                         carregar_figura buffer_confronto2, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 60
                         jl sairConfronto2
                         add confrontos2, 1
                         jmp sairConfronto2

              confronto212:

                         ler_arquivo confro212, buffer_confronto2, 4200
                         carregar_figura buffer_confronto2, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 62
                         jl sairConfronto2
                         add confrontos2, 1
                         mov SEC, 0
                         jmp sairConfronto2

             sairConfronto2:

                            ret

Confronto2 ENDP

;---------------------------------------------------------------------------------------------------------------
;Fim Confronto2
;---------------------------------------------------------------------------------------------------------------

;*****************************************************************************************************************
;Procedimento que gera o efeito de desaparecer da palavra "CONFRONTO 2"
;*****************************************************************************************************************
geraConfronto2 PROC NEAR

                       cmp confrontos2, 13
                       jne loopConfronto2

                       loopConfronto2:

                                     copiar_buffer buffer_painel, buffer, 64000
                                     call Confronto2
                                     call imprimir_tudo
                                     cmp confrontos2, 13
                                     jne loopConfronto2
                                     jmp sairGeraConfronto2

                       sairGeraConfronto2:
                       
                                         ret

geraConfronto2 ENDP

;----------------------------------------------------------------------------------------------------------
;Fim geraConfronto2
;-----------------------------------------------------------------------------------------------------------


;***********************************************************************************************************
;Procedimento que gera a palavra "CONFRONTO 3".
;***********************************************************************************************************
Confronto3 PROC NEAR

              cmp confrontos3, 0
              jne verificaConfronto3
              jmp confronto30

              verificaConfronto3:

                           cmp confrontos3, 1
                           je confronto31
                           cmp confrontos3, 2
                           je confronto32
                           cmp confrontos3, 3
                           je confronto33
                           cmp confrontos3, 4
                           je confronto34
                           cmp confrontos3, 5
                           je confronto35
                           cmp confrontos3, 6
                           je confronto36
                           cmp confrontos3, 7
                           je confronto37
                           cmp confrontos3, 8
                           je confronto38
                           cmp confrontos3, 9
                           je confronto39
                           cmp confrontos3, 10
                           je confronto310
                           cmp confrontos3, 11
                           je confronto311
                           cmp confrontos3, 12
                           je confronto312
                           jmp sairConfronto3

              confronto30:

                         ;mov tempoConfrontos, 0        ;zera contador do tempo
                         ler_arquivo confro30, buffer_confronto3, 4200;3969
                         carregar_figura buffer_confronto3, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 18
                         jl sairConfronto3
                         add confrontos3, 1
                         jmp sairConfronto3

              confronto31:

                         ler_arquivo confro31, buffer_confronto3, 4200
                         carregar_figura buffer_confronto3, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 22
                         jl sairConfronto3
                         add confrontos3, 1
                         jmp sairConfronto3

              confronto32:

                         ler_arquivo confro32, buffer_confronto3, 4200
                         carregar_figura buffer_confronto3, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 26
                         jl sairConfronto3
                         add confrontos3, 1
                         jmp sairConfronto3

              confronto33:

                         ler_arquivo confro33, buffer_confronto3,4200
                         carregar_figura buffer_confronto3, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 30
                         jl sairConfronto3
                         add confrontos3, 1
                         jmp sairConfronto3

              confronto34:

                         ler_arquivo confro34, buffer_confronto3, 4200
                         carregar_figura buffer_confronto3, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 34
                         jl sairConfronto3
                         add confrontos3, 1
                         jmp sairConfronto3

              confronto35:

                         ler_arquivo confro35, buffer_confronto3, 4200
                         carregar_figura buffer_confronto3, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 38
                         jl sairConfronto3
                         add confrontos3, 1
                         jmp sairConfronto3

              confronto36:

                         ler_arquivo confro36, buffer_confronto3, 4200
                         carregar_figura buffer_confronto3, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 42
                         jl sairConfronto3
                         add confrontos3, 1
                         jmp sairConfronto3

              confronto37:

                         ler_arquivo confro37, buffer_confronto3, 4200
                         carregar_figura buffer_confronto3, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 46
                         jl sairConfronto3
                         add confrontos3, 1
                         jmp sairConfronto3

              confronto38:

                         ler_arquivo confro38, buffer_confronto3, 4200
                         carregar_figura buffer_confronto3, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 50
                         jl sairConfronto3
                         add confrontos3, 1
                         jmp sairConfronto3

              confronto39:

                         ler_arquivo confro39, buffer_confronto3, 4200
                         carregar_figura buffer_confronto3, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 54
                         jl sairConfronto3
                         add confrontos3, 1
                         jmp sairConfronto3

              confronto310:

                         ler_arquivo confro310, buffer_confronto3, 4200
                         carregar_figura buffer_confronto3, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 58
                         jl sairConfronto3
                         add confrontos3, 1
                         jmp sairConfronto3

              confronto311:

                         ler_arquivo confro311, buffer_confronto3, 4200
                         carregar_figura buffer_confronto3, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 60
                         jl sairConfronto3
                         add confrontos3, 1
                         jmp sairConfronto3

              confronto312:

                         ler_arquivo confro312, buffer_confronto3, 4200
                         carregar_figura buffer_confronto3, 80, 60, 1ch, 96h
                         cmp tempoConfrontos, 62
                         jl sairConfronto3
                         add confrontos3, 1
                         mov SEC, 0
                         jmp sairConfronto2

             sairConfronto3:

                            ret

Confronto3 ENDP

;---------------------------------------------------------------------------------------------------------------
;Fim Confronto3
;---------------------------------------------------------------------------------------------------------------

;*****************************************************************************************************************
;Procedimento que gera o efeito de desaparecer da palavra "CONFRONTO 3"
;*****************************************************************************************************************
geraConfronto3 PROC NEAR

                       cmp confrontos3, 13
                       jne loopConfronto3

                       loopConfronto3:

                                     copiar_buffer buffer_painel, buffer, 64000
                                     call Confronto3
                                     call imprimir_tudo
                                     cmp confrontos3, 13
                                     jne loopConfronto3
                                     jmp sairGeraConfronto3

                       sairGeraConfronto3:

                                         ret

geraConfronto3 ENDP

;----------------------------------------------------------------------------------------------------------
;Fim geraConfronto3
;-----------------------------------------------------------------------------------------------------------

geraRecordes PROC NEAR

           call ResetarInt15               ;é necessario chamar a int15 original para que o usuário possa digitar o nome
           call ResetarInt1C
           
        ;espera o usuario digitar enter para continuar

;esperaPressionarEnter:

 ;           mov AX, 0800h
 ;          int 21h
 ;         cmp al, tecla_enter
 ;        jne esperaPressionarEnter

           call CheckHighScore

           call EscreveNoArquivo
           carrega_paleta tela_recordes_pal, paleta_buffer        ;thiago colocou isso aqui

           imprimir_tela tela_recordes_dat
           call imprimeTodos
           xor AX, AX
           int 16h
           ret

geraRecordes ENDP


;Processo que gera o final do jogo
;
Final PROC NEAR

      push SI
      push DX
      push CX

      cmp vitoriasPedro, 2                ;verifica se pedro foi o ganhador.
      je finalPedro
      jmp finalBino                       ;entra aqui se bino foi o vencendor.

finalPedro:

          imprimir_tela fimpedro_dat
          carrega_paleta fimpedro_pal, paleta_buffer
          mov si, offset fimpedro
          mov di, 12
          mov cl, 160
          mov dh, 0ffh            ;  cor
          call DesenharFrase       ;
          espera_tempo 4
          jmp fimFinalmente


finalBino:

          imprimir_tela fimbino_dat
          carrega_paleta fimbino_pal, paleta_buffer
          mov si, offset fimbino
          mov di, 12                ; pos x
          mov cl, 160               ; pos y
          mov dh, 0ffh              ;  cor
          call DesenharFrase        ;
          espera_tempo 4
          jmp fimFinalmente

fimFinalmente:

           pop CX
           pop DX
           pop SI
           RET

Final ENDP

;-----------------------------------------------------------------------------------------------------------------
;Fim Final
;-----------------------------------------------------------------------------------------------------------------

telaIntervalo1 PROC NEAR

          carrega_paleta intervalo1_pal, paleta_buffer
          imprimir_tela intervalo1_dat

          espera_tempo 2
          call CoolDown

          carrega_paleta painel_pal, paleta_buffer
          imprimir_tela painel

          ret


telaIntervalo1 ENDP


telaIntervalo2 PROC NEAR

          carrega_paleta intervalo2_pal, paleta_buffer
          imprimir_tela intervalo2_dat

          espera_tempo 2
          call CoolDown

          carrega_paleta painel_pal, paleta_buffer
          imprimir_tela painel

          ret

telaIntervalo2 ENDP


;-------------------------------------------------------------------------------------------------------------
;Fim Final
;-------------------------------------------------------------------------------------------------------------
