// File: Jacobious52[P]Tanks/Sprite.cpp
// Function: Sprite::draw()
void Sprite::draw()
{
    vstring lines = StringTools::split(get_texture(), "\n");
    for (int i = 0; i < lines.get_count(); ++i)
    {
        // draw relative to parent
        Point<int> parent_pos;
        if (get_parent() != 0)
        {
            parent_pos = get_parent()->get_position();
        }
        else
        {
            parent_pos = Point<int>::zero();
        }

        // set position
        ConsoleTools::set_cursor(parent_pos.x + get_position().x, parent_pos.y + get_position().y + i);
        // set color
        ConsoleTools::set_color(get_fcolor(), get_bcolor());
        // draw
        printf("%s\n", lines[i].c_str());
        // end color
        ConsoleTools::end_color();
    }

    View::draw();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, -0xd8(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xa6d0
leaq -0x69(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x45f0
movq -0xd0(%rbp), %rdx
leaq 0x9a3a(%rip), %rsi      # 0x141db
leaq -0x68(%rbp), %rdi
callq 0x4490
jmp 0xa7ac
leaq -0x28(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x68(%rbp), %rdx
callq 0xada0
jmp 0xa7bf
leaq -0x68(%rbp), %rdi
callq 0x4200
jmp 0xa7ca
leaq -0x69(%rbp), %rdi
callq 0x4400
leaq -0x48(%rbp), %rdi
callq 0x4200
movl $0x0, -0x80(%rbp)
movslq -0x80(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xaa90
movq %rax, -0xe0(%rbp)
jmp 0xa800
movq -0xe8(%rbp), %rax
movq -0xe0(%rbp), %rcx
cmpq %rcx, %rax
jae 0xaa50
leaq -0x88(%rbp), %rdi
callq 0x7a30
jmp 0xa825
movq -0xd8(%rbp), %rdi
callq 0x103c0
movq %rax, -0xf0(%rbp)
jmp 0xa83a
movq -0xf0(%rbp), %rax
cmpq $0x0, %rax
je 0xa8e4
movq -0xd8(%rbp), %rdi
callq 0x103c0
movq %rax, -0xf8(%rbp)
jmp 0xa860
movq -0xf8(%rbp), %rdi
callq 0x10660
movq %rax, -0x100(%rbp)
jmp 0xa875
movq -0x100(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0xa90e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xa8ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x4200
jmp 0xa8b8
jmp 0xa8ba
leaq -0x69(%rbp), %rdi
callq 0x4400
leaq -0x48(%rbp), %rdi
callq 0x4200
jmp 0xa8ce
jmp 0xaa7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xaa70
callq 0x7110
movq %rax, -0x108(%rbp)
jmp 0xa8f2
movq -0x108(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0xd8(%rbp), %rdi
movl -0x88(%rbp), %eax
movl %eax, -0x114(%rbp)
callq 0x10660
movq %rax, -0x110(%rbp)
jmp 0xa92f
movq -0xd8(%rbp), %rdi
movl -0x114(%rbp), %eax
movq -0x110(%rbp), %rcx
movq %rcx, -0xa0(%rbp)
movl -0xa0(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x128(%rbp)
movl -0x84(%rbp), %eax
movl %eax, -0x124(%rbp)
callq 0x10660
movq %rax, -0x120(%rbp)
jmp 0xa972
movl -0x128(%rbp), %edi
movl -0x124(%rbp), %esi
movq -0x120(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl -0xa4(%rbp), %eax
addl %eax, %esi
movl -0x80(%rbp), %eax
addl %eax, %esi
callq 0x4c00
jmp 0xa9a0
movq -0xd8(%rbp), %rdi
callq 0xa650
movq -0xd8(%rbp), %rdi
movl %eax, -0x12c(%rbp)
callq 0xa690
movl -0x12c(%rbp), %edi
movl %eax, %esi
callq 0x4b50
jmp 0xa9cd
movslq -0x80(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xaab0
jmp 0xa9e3
leaq -0xc8(%rbp), %rdi
callq 0x4180
movq %rax, -0x138(%rbp)
jmp 0xa9f8
movq -0x138(%rbp), %rsi
leaq 0x996d(%rip), %rdi      # 0x14373
xorl %eax, %eax
callq 0x4070
jmp 0xaa0f
leaq -0xc8(%rbp), %rdi
callq 0x4200
jmp 0xaa1d
callq 0x4b80
jmp 0xaa24
jmp 0xaa26
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0xa7e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x4200
jmp 0xaa4e
jmp 0xaa70
movq -0xd8(%rbp), %rdi
callq 0x105f0
jmp 0xaa5e
leaq -0x28(%rbp), %rdi
callq 0xaaf0
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0xaaf0
jmp 0xaa7b
jmp 0xaa7d
movq -0x78(%rbp), %rdi
callq 0x45e0
movq %rax, %rdi
callq 0x4ec0
nop