// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movq 0x18(%rdi), %rdi
movl $0x2, %esi
callq 0x4d10
movq %r14, %rdi
movq %rax, %rsi
callq 0x4626
testb %al, %al
je 0x3473
movq 0x9bf5(%rip), %r14      # 0xcfd0
leaq 0x4fb4(%rip), %rsi      # 0x8396
movl $0x37, %edx
movq %r14, %rdi
callq 0x2180
callq 0x60c4
movl %eax, %ebp
movsbl %al, %esi
movq %rbx, %rdi
callq 0x31b6
testb %al, %al
je 0x3459
leaq 0x4fc2(%rip), %r15      # 0x83ce
movl $0x33, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2180
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
callq 0x60c4
movl %eax, %ebp
movsbl %al, %esi
movq %rbx, %rdi
callq 0x31b6
testb %al, %al
jne 0x340c
cmpb $0x73, %bpl
je 0x34bd
movzbl %bpl, %eax
cmpl $0x77, %eax
jne 0x34c6
movq 0x8(%rbx), %rdi
callq 0x434a
jmp 0x34c6
movq 0x9b56(%rip), %rbx      # 0xcfd0
leaq 0x4ef5(%rip), %rsi      # 0x8376
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x2180
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x20e0
movq 0x8(%rbx), %rdi
callq 0x4342
movq %rbx, %rdi
callq 0x25a6
movsbl %bpl, %esi
movq %rbx, %rdi
callq 0x330c
leaq 0x4f21(%rip), %rsi      # 0x8402
movl $0x3a, %edx
movq %r14, %rdi
callq 0x2180
leaq 0x4ed9(%rip), %r15      # 0x83ce
callq 0x5f74
movl %eax, %r12d
movsbl %al, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x31b6
testb %al, %al
jne 0x351c
movq %rbx, %rdi
movl %ebp, %esi
callq 0x323c
testb %al, %al
je 0x3555
movl $0x33, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2180
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
jmp 0x34f5
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
cmpb $0x64, %r12b
je 0x3596
movzbl %r12b, %eax
cmpl $0x61, %eax
jne 0x359f
movq 0x8(%rbx), %rdi
callq 0x434e
jmp 0x359f
movq 0x8(%rbx), %rdi
callq 0x4346
movq %rbx, %rdi
callq 0x25a6
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %r15
movq 0x18(%rbx), %rdi
movl $0x3, %esi
callq 0x4d10
movq %rax, %r12
movq 0x18(%rbx), %rdi
movl $0x2, %esi
callq 0x4d10
movq (%r15), %r8
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rax, %rcx
callq *0x10(%r8)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x330c
movq 0x18(%rbx), %rdi
callq 0x57aa
decl (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop