// File: Jacobious52[P]Tanks/GameView.cpp
// Function: GameView::update(int)
void GameView::update(int t)
{
    // bullet needs firing
    DebugView::shared_view()->watch("terrain count", _terrain->get_children()->get_count());

    View::update(t);

    // check if bullet is inside tank1
    if (_bullet->get_position().x >= _tank1->get_position().x
        && _bullet->get_position().x <= _tank1->get_position().x + _tank1->get_size().x
        && _bullet->get_position().y > _tank1->get_position().y
        && _bullet->get_position().y <= _tank1->get_position().y + _tank1->get_size().y)
    {
        _winner = _tank2->get_name();
        ConsoleTools::play_music("boom.wav");
        _should_remove_from_parent = true;
        return;
    }
    // check if bullet is inside tank2
    else if (_bullet->get_position().x >= _tank2->get_position().x
        && _bullet->get_position().x <= _tank2->get_position().x + _tank2->get_size().x
        && _bullet->get_position().y > _tank2->get_position().y
        && _bullet->get_position().y <= _tank2->get_position().y + _tank2->get_size().y)
    {
        _winner = _tank1->get_name();
        ConsoleTools::play_music("boom.wav");
        _should_remove_from_parent = true;
        return;
    }
    // bullet has hit. next turn
    if (_bullet->get_launched() == false || _bullet->should_remove_from_parent() == true)
    {
        _terrain->shuffle_wind_speed();
        DebugView::shared_view()->watch("wind speed", _terrain->get_wind_speed());
        draw();
       _get_input();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1b8(%rbp)
callq 0x70a0
movq %rax, -0x1b0(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x45f0
movq -0x1a8(%rbp), %rdx
leaq 0xd989(%rip), %rsi      # 0x14100
leaq -0x30(%rbp), %rdi
callq 0x4490
jmp 0x6782
movq -0x1b8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x10400
movq %rax, -0x1c0(%rbp)
jmp 0x679b
movq -0x1c0(%rbp), %rdi
callq 0x7680
movq %rax, -0x1c8(%rbp)
jmp 0x67b0
movq -0x1c8(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x1d0(%rbp)
testq %rax, %rax
movss %xmm0, -0x1cc(%rbp)
js 0x67f8
movss -0x1d0(%rbp), %xmm0
movss %xmm0, -0x1cc(%rbp)
movq -0x1b0(%rbp), %rdi
movss -0x1cc(%rbp), %xmm0
leaq -0x30(%rbp), %rsi
callq 0x10cc0
jmp 0x6812
leaq -0x30(%rbp), %rdi
callq 0x4200
jmp 0x681d
leaq -0x31(%rbp), %rdi
callq 0x4400
movq -0x1b8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x10500
movq -0x1b8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0x4c(%rbp)
movl -0x4c(%rbp), %ecx
movl %ecx, -0x1d4(%rbp)
movq 0x40(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movl -0x1d4(%rbp), %eax
movq %rcx, -0x54(%rbp)
cmpl -0x54(%rbp), %eax
jl 0x6ae5
movq -0x1b8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0x5c(%rbp)
movl -0x5c(%rbp), %ecx
movl %ecx, -0x1d8(%rbp)
movq 0x40(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0x64(%rbp)
movl -0x64(%rbp), %ecx
movl %ecx, -0x1dc(%rbp)
movq 0x40(%rax), %rdi
callq 0x106a0
movl -0x1dc(%rbp), %ecx
movq %rax, %rdx
movl -0x1d8(%rbp), %eax
movq %rdx, -0x6c(%rbp)
addl -0x6c(%rbp), %ecx
cmpl %ecx, %eax
jg 0x6ae5
movq -0x1b8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0x74(%rbp)
movl -0x70(%rbp), %ecx
movl %ecx, -0x1e0(%rbp)
movq 0x40(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movl -0x1e0(%rbp), %eax
movq %rcx, -0x7c(%rbp)
cmpl -0x78(%rbp), %eax
jle 0x6ae5
movq -0x1b8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0x84(%rbp)
movl -0x80(%rbp), %ecx
movl %ecx, -0x1e4(%rbp)
movq 0x40(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0x8c(%rbp)
movl -0x88(%rbp), %ecx
movl %ecx, -0x1e8(%rbp)
movq 0x40(%rax), %rdi
callq 0x106a0
movl -0x1e8(%rbp), %ecx
movq %rax, %rdx
movl -0x1e4(%rbp), %eax
movq %rdx, -0x94(%rbp)
addl -0x90(%rbp), %ecx
cmpl %ecx, %eax
jg 0x6ae5
movq -0x1b8(%rbp), %rax
movq 0x48(%rax), %rsi
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x10b80
movq -0x1b8(%rbp), %rdi
movq -0x1f0(%rbp), %rsi
addq $0x68, %rdi
callq 0x4060
jmp 0x69e3
leaq -0xb8(%rbp), %rdi
callq 0x4200
leaq -0xd9(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x45f0
movq -0x1f8(%rbp), %rdx
leaq 0xd6fe(%rip), %rsi      # 0x1410e
leaq -0xd8(%rbp), %rdi
callq 0x4490
jmp 0x6a1e
leaq -0xd8(%rbp), %rdi
callq 0x4d20
jmp 0x6a2c
leaq -0xd8(%rbp), %rdi
callq 0x4200
jmp 0x6a3a
leaq -0xd9(%rbp), %rdi
callq 0x4400
movq -0x1b8(%rbp), %rax
movb $0x1, 0x30(%rax)
jmp 0x6eb6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6a7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x4200
jmp 0x6a7b
jmp 0x6a7d
leaq -0x31(%rbp), %rdi
callq 0x4400
jmp 0x6ebf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x4200
jmp 0x6aa5
jmp 0x6ebf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6ad4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x4200
jmp 0x6ad2
jmp 0x6ad4
leaq -0xd9(%rbp), %rdi
callq 0x4400
jmp 0x6ebf
movq -0x1b8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0xe4(%rbp)
movl -0xe4(%rbp), %ecx
movl %ecx, -0x1fc(%rbp)
movq 0x48(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movl -0x1fc(%rbp), %eax
movq %rcx, -0xec(%rbp)
cmpl -0xec(%rbp), %eax
jl 0x6d8d
movq -0x1b8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0xf4(%rbp)
movl -0xf4(%rbp), %ecx
movl %ecx, -0x200(%rbp)
movq 0x48(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0xfc(%rbp)
movl -0xfc(%rbp), %ecx
movl %ecx, -0x204(%rbp)
movq 0x48(%rax), %rdi
callq 0x106a0
movl -0x204(%rbp), %ecx
movq %rax, %rdx
movl -0x200(%rbp), %eax
movq %rdx, -0x104(%rbp)
addl -0x104(%rbp), %ecx
cmpl %ecx, %eax
jg 0x6d8d
movq -0x1b8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0x10c(%rbp)
movl -0x108(%rbp), %ecx
movl %ecx, -0x208(%rbp)
movq 0x48(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movl -0x208(%rbp), %eax
movq %rcx, -0x114(%rbp)
cmpl -0x110(%rbp), %eax
jle 0x6d8d
movq -0x1b8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0x11c(%rbp)
movl -0x118(%rbp), %ecx
movl %ecx, -0x20c(%rbp)
movq 0x48(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0x124(%rbp)
movl -0x120(%rbp), %ecx
movl %ecx, -0x210(%rbp)
movq 0x48(%rax), %rdi
callq 0x106a0
movl -0x210(%rbp), %ecx
movq %rax, %rdx
movl -0x20c(%rbp), %eax
movq %rdx, -0x12c(%rbp)
addl -0x128(%rbp), %ecx
cmpl %ecx, %eax
jg 0x6d8d
movq -0x1b8(%rbp), %rax
movq 0x40(%rax), %rsi
leaq -0x150(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x10b80
movq -0x1b8(%rbp), %rdi
movq -0x218(%rbp), %rsi
addq $0x68, %rdi
callq 0x4060
jmp 0x6cc0
leaq -0x150(%rbp), %rdi
callq 0x4200
leaq -0x171(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x45f0
movq -0x220(%rbp), %rdx
leaq 0xd421(%rip), %rsi      # 0x1410e
leaq -0x170(%rbp), %rdi
callq 0x4490
jmp 0x6cfb
leaq -0x170(%rbp), %rdi
callq 0x4d20
jmp 0x6d09
leaq -0x170(%rbp), %rdi
callq 0x4200
jmp 0x6d17
leaq -0x171(%rbp), %rdi
callq 0x4400
movq -0x1b8(%rbp), %rax
movb $0x1, 0x30(%rax)
jmp 0x6eb6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x4200
jmp 0x6d4d
jmp 0x6ebf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6d7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x4200
jmp 0x6d7a
jmp 0x6d7c
leaq -0x171(%rbp), %rdi
callq 0x4400
jmp 0x6ebf
jmp 0x6d8f
movq -0x1b8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0xedb0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x6dc7
movq -0x1b8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x105d0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x6eb6
movq -0x1b8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0xc600
callq 0x70a0
movq %rax, -0x230(%rbp)
leaq -0x199(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x45f0
movq -0x228(%rbp), %rdx
leaq 0xd313(%rip), %rsi      # 0x14117
leaq -0x198(%rbp), %rdi
callq 0x4490
jmp 0x6e12
movq -0x1b8(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0xcb90
movss %xmm0, -0x234(%rbp)
jmp 0x6e2c
movss -0x234(%rbp), %xmm0
movq -0x230(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x10cc0
jmp 0x6e49
leaq -0x198(%rbp), %rdi
callq 0x4200
jmp 0x6e57
leaq -0x199(%rbp), %rdi
callq 0x4400
movq -0x1b8(%rbp), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movq -0x1b8(%rbp), %rdi
callq 0x5bf0
jmp 0x6eb6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6ea8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x4200
jmp 0x6ea6
jmp 0x6ea8
leaq -0x199(%rbp), %rdi
callq 0x4400
jmp 0x6ebf
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x45e0
movq %rax, %rdi
callq 0x4ec0