// File: JacobLCarter[P]2D-Portal/game.cpp
// Function: Game::moveThroughPortal()
void Game::moveThroughPortal()
{
    //exit if the user does not have the Portal Gun
    if (!checkForPortalGun())
    {
        std::cout << "You do not have the Portal Gun!" << std::endl;
        return;
    }

    char userDirectionInput;

    std::cout << "Would you like to move up(w), down(s), or neither(n)?: ";
    
    //get the user's chosen direction on the vertical plane
    userDirectionInput = getVerticalChar(); 
   
    //re-prompt if the move would place the player out of bounds
    while (isOutOfBounds(userDirectionInput))
    {
        std::cout << "Seriously? You clearly can't go that way. Try again" << std::endl;
        userDirectionInput = getVerticalChar(); 
    }

    //switch to change the player's coordinates based on chosen direction
    switch (userDirectionInput)
    {
        case 'w': testSubject->decrementCurrentX();
                  break;
        case 's': testSubject->incrementCurrentX();
                  break;
        case 'n': break;
    }
   
    //set the player space based on new coordinates
    setPlayerSpace();

    showPosition(userDirectionInput);

    std::cout << "Would you like to move left(a), right(d), or neither(n)?: ";
    
    //get the user's chosen direction on the vertical plane
    userDirectionInput = getHorizontalChar(); 
    
    //re-prompt if the move would place the player out of bounds or on an obstacle
    while (isOutOfBounds(userDirectionInput) || isObstacle(userDirectionInput))
    {
        std::cout << "Seriously? You clearly can't go that way. Try again" << std::endl;
        userDirectionInput = getHorizontalChar(); 
    }
    std::cout << std::endl;

    //switch to change the player's coordinates based on chosen direction
    switch (userDirectionInput)
    {
        case 'a': testSubject->decrementCurrentY();
                  break;
        case 'd': testSubject->incrementCurrentY();
                  break;
        case 'n': break;
    }
    
    //set the player space based on new coordinates
    setPlayerSpace();
    
    //check for a special space type interaction
    playerSpace->spaceTypeSpecialInteraction(testSubject, map->getItem(3), map->getItem(2));
      
    //print the player's character on the map
    showPosition(userDirectionInput);

    //show the map
    map->showMap();
   
    //remove one turn from the total allowed
    turnCounter--;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
callq 0x4e90
testb $0x1, %al
jne 0x4c84
movq 0xe36c(%rip), %rdi      # 0x12fd0
leaq 0x8823(%rip), %rsi      # 0xd48e
callq 0x3210
movq %rax, %rdi
movq 0xe346(%rip), %rsi      # 0x12fc0
callq 0x3240
jmp 0x4e82
movq 0xe345(%rip), %rdi      # 0x12fd0
leaq 0x881c(%rip), %rsi      # 0xd4ae
callq 0x3210
callq 0xa1f0
movb %al, -0x9(%rbp)
movq -0x18(%rbp), %rdi
movsbl -0x9(%rbp), %esi
callq 0x48e0
testb $0x1, %al
jne 0x4cb2
jmp 0x4cde
movq 0xe317(%rip), %rdi      # 0x12fd0
leaq 0x8826(%rip), %rsi      # 0xd4e6
callq 0x3210
movq %rax, %rdi
movq 0xe2f1(%rip), %rsi      # 0x12fc0
callq 0x3240
callq 0xa1f0
movb %al, -0x9(%rbp)
jmp 0x4c9f
movsbl -0x9(%rbp), %eax
movl %eax, -0x1c(%rbp)
subl $0x6e, %eax
je 0x4d1e
jmp 0x4cec
movl -0x1c(%rbp), %eax
subl $0x73, %eax
je 0x4d0f
jmp 0x4cf6
movl -0x1c(%rbp), %eax
subl $0x77, %eax
jne 0x4d20
jmp 0x4d00
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x6680
jmp 0x4d20
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x6640
jmp 0x4d20
jmp 0x4d20
movq -0x18(%rbp), %rdi
callq 0x3840
movq -0x18(%rbp), %rdi
movsbl -0x9(%rbp), %esi
callq 0x4b40
movq 0xe293(%rip), %rdi      # 0x12fd0
leaq 0x87d6(%rip), %rsi      # 0xd51a
callq 0x3210
callq 0xa0e0
movb %al, -0x9(%rbp)
movq -0x18(%rbp), %rdi
movsbl -0x9(%rbp), %esi
callq 0x48e0
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x1d(%rbp)
jne 0x4d7a
movq -0x18(%rbp), %rdi
movsbl -0x9(%rbp), %esi
callq 0x49d0
movb %al, -0x1d(%rbp)
movb -0x1d(%rbp), %al
testb $0x1, %al
jne 0x4d83
jmp 0x4daf
movq 0xe246(%rip), %rdi      # 0x12fd0
leaq 0x8755(%rip), %rsi      # 0xd4e6
callq 0x3210
movq %rax, %rdi
movq 0xe220(%rip), %rsi      # 0x12fc0
callq 0x3240
callq 0xa0e0
movb %al, -0x9(%rbp)
jmp 0x4d51
movq 0xe21a(%rip), %rdi      # 0x12fd0
movq 0xe203(%rip), %rsi      # 0x12fc0
callq 0x3240
movsbl -0x9(%rbp), %eax
movl %eax, -0x24(%rbp)
subl $0x61, %eax
je 0x4de4
jmp 0x4dd0
movl -0x24(%rbp), %eax
subl $0x64, %eax
je 0x4df3
jmp 0x4dda
movl -0x24(%rbp), %eax
subl $0x6e, %eax
je 0x4e02
jmp 0x4e04
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x66a0
jmp 0x4e04
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x6660
jmp 0x4e04
jmp 0x4e04
movq -0x18(%rbp), %rdi
callq 0x3840
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movq %rcx, -0x40(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x18(%rax), %rdi
movl $0x3, %esi
callq 0x8840
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, -0x30(%rbp)
movq 0x18(%rax), %rdi
movl $0x2, %esi
callq 0x8840
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq %rax, %rcx
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x18(%rbp), %rdi
movsbl -0x9(%rbp), %esi
callq 0x4b40
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x9880
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)