// File: Jacobious52[P]Tanks/Game.cpp
// Function: Game::Game(bool, float, int)
Game(bool skip, float game_time, int rain)
        : _skip_intro(skip)
    {
        ConsoleTools::play_music("music.wav");

        // clear computer.txt for writing
        if (DebugView::shared_view()->show == true)
        {
            std::ofstream file("computer.txt");
            file << "Computer 1" << std::endl << "Computer 2" << std::endl;
            file.close();
        }

        // write the seed of this game for replay
        if (ConsoleTools::replay == false)
        {
            std::ofstream file("replay.txt");
            int t = time(0);
            file << t << std::endl;
            file.close();
            srand(t);
        }
        else
        {
            printf("seed: ");
            srand(ConsoleTools::get_input<int>("int: ", Point<int>(StringTools::string_width("seed: "), 0)));
        }

        // load texture map file
        TextureTools::load_texture_file("textures.txt");

        // setup intro view
        intro_view = new IntroView();
        current_view = intro_view;
        intro_view->tag = rain;

        // switch to gameview straight away
        if (_skip_intro == true)
        {
            game_view = new GameView("Default 1", "Default 2");
            game_view->tag = rain;
            current_view = game_view;
            current_view->draw();
        }

        // : create timer and link to self
        timer = Timer(game_time, true);
        timer.set_delegate(this);

        tick_time = 0;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5d0, %rsp            # imm = 0x5D0
movb %sil, %al
movq %rdi, -0x8(%rbp)
andb $0x1, %al
movb %al, -0x9(%rbp)
movss %xmm0, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x558(%rbp)
callq 0x12cd0
movq -0x558(%rbp), %rdi
leaq 0x889b(%rip), %rax      # 0x1ad68
movq %rax, (%rdi)
addq $0x28, %rdi
movq %rdi, -0x560(%rbp)
callq 0x12cf0
movq -0x558(%rbp), %rax
movb -0x9(%rbp), %cl
andb $0x1, %cl
movb %cl, 0x4c(%rax)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x550(%rbp)
callq 0x45f0
movq -0x550(%rbp), %rdx
leaq 0x1e69(%rip), %rsi      # 0x14377
leaq -0x38(%rbp), %rdi
callq 0x4490
jmp 0x12519
leaq -0x38(%rbp), %rdi
callq 0x4d20
jmp 0x12524
leaq -0x38(%rbp), %rdi
callq 0x4200
jmp 0x1252f
leaq -0x39(%rbp), %rdi
callq 0x4400
callq 0x70a0
movq %rax, -0x568(%rbp)
jmp 0x12546
movq -0x568(%rbp), %rax
movb 0x31(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x12664
leaq 0x1b66(%rip), %rsi      # 0x140cb
leaq -0x250(%rbp), %rdi
movl $0x10, %edx
callq 0x4410
jmp 0x12578
leaq 0x1e02(%rip), %rsi      # 0x14381
leaq -0x250(%rbp), %rdi
callq 0x4390
movq %rax, -0x570(%rbp)
jmp 0x12594
movq -0x570(%rbp), %rdi
movq 0x8a26(%rip), %rsi      # 0x1afc8
callq 0x43e0
movq %rax, -0x578(%rbp)
jmp 0x125b0
movq -0x578(%rbp), %rdi
leaq 0x1dce(%rip), %rsi      # 0x1438c
callq 0x4390
movq %rax, -0x580(%rbp)
jmp 0x125cc
movq -0x580(%rbp), %rdi
movq 0x89ee(%rip), %rsi      # 0x1afc8
callq 0x43e0
jmp 0x125e1
leaq -0x250(%rbp), %rdi
callq 0x44c0
jmp 0x125ef
leaq -0x250(%rbp), %rdi
callq 0x44e0
jmp 0x125fd
jmp 0x12664
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x12626
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x4200
jmp 0x12624
jmp 0x12626
leaq -0x39(%rbp), %rdi
callq 0x4400
jmp 0x12b77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x12b77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x44e0
jmp 0x1265f
jmp 0x12b77
leaq 0x8cf7(%rip), %rax      # 0x1b362
movb (%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x1271f
leaq 0x1a67(%rip), %rsi      # 0x140e9
leaq -0x450(%rbp), %rdi
movl $0x10, %edx
callq 0x4410
jmp 0x12695
xorl %eax, %eax
movl %eax, %edi
callq 0x4350
movl %eax, -0x454(%rbp)
movl -0x454(%rbp), %esi
leaq -0x450(%rbp), %rdi
callq 0x45b0
movq %rax, -0x588(%rbp)
jmp 0x126bf
movq -0x588(%rbp), %rdi
movq 0x88fb(%rip), %rsi      # 0x1afc8
callq 0x43e0
jmp 0x126d4
leaq -0x450(%rbp), %rdi
callq 0x44c0
jmp 0x126e2
movl -0x454(%rbp), %edi
callq 0x4370
leaq -0x450(%rbp), %rdi
callq 0x44e0
jmp 0x126fb
jmp 0x12878
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x450(%rbp), %rdi
callq 0x44e0
jmp 0x1271a
jmp 0x12b77
leaq 0x1c71(%rip), %rdi      # 0x14397
xorl %eax, %eax
callq 0x4070
jmp 0x1272f
leaq -0x479(%rbp), %rdi
movq %rdi, -0x590(%rbp)
callq 0x45f0
movq -0x590(%rbp), %rdx
leaq 0x1c4e(%rip), %rsi      # 0x1439e
leaq -0x478(%rbp), %rdi
callq 0x4490
jmp 0x1275e
leaq -0x4a9(%rbp), %rdi
movq %rdi, -0x598(%rbp)
callq 0x45f0
movq -0x598(%rbp), %rdx
leaq 0x1c18(%rip), %rsi      # 0x14397
leaq -0x4a8(%rbp), %rdi
callq 0x4490
jmp 0x1278d
leaq -0x4a8(%rbp), %rdi
callq 0xaeb0
movl %eax, -0x59c(%rbp)
jmp 0x127a1
movl -0x59c(%rbp), %esi
leaq -0x484(%rbp), %rdi
xorl %edx, %edx
callq 0x4ed0
jmp 0x127b7
movq -0x484(%rbp), %rsi
leaq -0x478(%rbp), %rdi
callq 0x12d20
movl %eax, -0x5a0(%rbp)
jmp 0x127d2
movl -0x5a0(%rbp), %edi
callq 0x4370
leaq -0x4a8(%rbp), %rdi
callq 0x4200
jmp 0x127eb
leaq -0x4a9(%rbp), %rdi
callq 0x4400
leaq -0x478(%rbp), %rdi
callq 0x4200
jmp 0x12805
leaq -0x479(%rbp), %rdi
callq 0x4400
jmp 0x12878
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x12867
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1284b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x4a8(%rbp), %rdi
callq 0x4200
jmp 0x12849
jmp 0x1284b
leaq -0x4a9(%rbp), %rdi
callq 0x4400
leaq -0x478(%rbp), %rdi
callq 0x4200
jmp 0x12865
jmp 0x12867
leaq -0x479(%rbp), %rdi
callq 0x4400
jmp 0x12b77
leaq -0x4d1(%rbp), %rdi
movq %rdi, -0x5a8(%rbp)
callq 0x45f0
movq -0x5a8(%rbp), %rdx
leaq 0x1b0b(%rip), %rsi      # 0x143a4
leaq -0x4d0(%rbp), %rdi
callq 0x4490
jmp 0x128a7
leaq -0x4d0(%rbp), %rdi
callq 0xcef0
jmp 0x128b5
leaq -0x4d0(%rbp), %rdi
callq 0x4200
jmp 0x128c3
leaq -0x4d1(%rbp), %rdi
callq 0x4400
movl $0xf8, %edi
callq 0x43a0
movq %rax, -0x5b0(%rbp)
jmp 0x128e2
movq -0x5b0(%rbp), %rdi
callq 0x12e20
jmp 0x128f0
movq -0x558(%rbp), %rax
movq -0x5b0(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq 0x10(%rax), %rcx
movq %rcx, 0x8(%rax)
movl -0x14(%rbp), %edx
movq 0x10(%rax), %rcx
movl %edx, 0x8(%rcx)
movb 0x4c(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x12b04
movl $0x88, %edi
callq 0x43a0
movq %rax, -0x5b8(%rbp)
jmp 0x12938
movb $0x1, -0x522(%rbp)
leaq -0x4f9(%rbp), %rdi
movq %rdi, -0x5c0(%rbp)
callq 0x45f0
movq -0x5c0(%rbp), %rdx
leaq 0x1a51(%rip), %rsi      # 0x143b1
leaq -0x4f8(%rbp), %rdi
callq 0x4490
jmp 0x1296e
leaq -0x521(%rbp), %rdi
movq %rdi, -0x5c8(%rbp)
callq 0x45f0
movq -0x5c8(%rbp), %rdx
leaq 0x1a2c(%rip), %rsi      # 0x143bb
leaq -0x520(%rbp), %rdi
callq 0x4490
jmp 0x1299d
movq -0x5b8(%rbp), %rdi
leaq -0x4f8(%rbp), %rsi
leaq -0x520(%rbp), %rdx
callq 0x12f40
jmp 0x129b9
movq -0x558(%rbp), %rax
movq -0x5b8(%rbp), %rcx
movb $0x0, -0x522(%rbp)
movq %rcx, 0x18(%rax)
leaq -0x520(%rbp), %rdi
callq 0x4200
jmp 0x129e0
leaq -0x521(%rbp), %rdi
callq 0x4400
leaq -0x4f8(%rbp), %rdi
callq 0x4200
jmp 0x129fa
leaq -0x4f9(%rbp), %rdi
callq 0x4400
movq -0x558(%rbp), %rax
movl -0x14(%rbp), %edx
movq 0x18(%rax), %rcx
movl %edx, 0x8(%rcx)
movq 0x18(%rax), %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%rax), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
jmp 0x12a2e
jmp 0x12b04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x12a5d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x4d0(%rbp), %rdi
callq 0x4200
jmp 0x12a5b
jmp 0x12a5d
leaq -0x4d1(%rbp), %rdi
callq 0x4400
jmp 0x12b77
movq -0x5b0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
callq 0x4360
jmp 0x12b77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x12adf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x12ac3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x520(%rbp), %rdi
callq 0x4200
jmp 0x12ac1
jmp 0x12ac3
leaq -0x521(%rbp), %rdi
callq 0x4400
leaq -0x4f8(%rbp), %rdi
callq 0x4200
jmp 0x12add
jmp 0x12adf
leaq -0x4f9(%rbp), %rdi
callq 0x4400
testb $0x1, -0x522(%rbp)
jne 0x12af6
jmp 0x12b02
movq -0x5b8(%rbp), %rdi
callq 0x4360
jmp 0x12b77
movss -0x10(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq -0x548(%rbp), %rdi
movl $0x1, %esi
callq 0x13060
jmp 0x12b20
movq -0x558(%rbp), %rax
movups -0x548(%rbp), %xmm0
movups -0x53e(%rbp), %xmm1
movups %xmm1, 0x32(%rax)
movups %xmm0, 0x28(%rax)
leaq -0x548(%rbp), %rdi
callq 0xcd70
jmp 0x12b4b
movq -0x558(%rbp), %rsi
movq %rsi, %rdi
addq $0x28, %rdi
callq 0xeb80
jmp 0x12b60
movq -0x558(%rbp), %rax
movl $0x0, 0x48(%rax)
addq $0x5d0, %rsp            # imm = 0x5D0
popq %rbp
retq
movq -0x560(%rbp), %rdi
callq 0xcd70
jmp 0x12b85
jmp 0x12b87
movq -0x48(%rbp), %rdi
callq 0x45e0
movq %rax, %rdi
callq 0x4ec0
nopl (%rax,%rax)