#include "common.h"
#include "npc.h"

API_CALLABLE(N(UnkFunc12)) {
    PlayerStatus* playerStatus = &gPlayerStatus;
    f32 posX, posY, posZ, hitDepth;

    if (script->varTable[5] == 0) {
        playerStatus->position.x = script->varTable[0];
    } else {
        playerStatus->position.z = script->varTable[0];
    }

    posX = playerStatus->position.x;
    posY = playerStatus->position.y + 10.0f;
    posZ = playerStatus->position.z;
    hitDepth = 40.0f;
    
    npc_raycast_down_sides(0, &posX, &posY, &posZ, &hitDepth);

    playerStatus->position.x = posX;
    playerStatus->position.y = posY;
    playerStatus->position.z = posZ;

    return ApiStatus_DONE2;
}
