FieldCutscene::FieldCutsceneOrient::FieldCutsceneOrient(XmlReader *pReader)
{
    pCharacter = NULL;

    pReader->StartElement("FieldCutsceneOrient");
    millisecondDelayBeforeBegin = pReader->ReadIntElement("MillisecondDelayBeforeBegin");
    characterId = pReader->ReadTextElement("CharacterId");
    direction = StringToCharacterDirection(pReader->ReadTextElement("Direction"));
    spriteDirection = StringToFieldCharacterDirection(pReader->ReadTextElement("SpriteDirection"));
    pReader->EndElement();
}
FieldCharacter::FieldCharacter(XmlReader *pReader)
{
    for (int i = 0; i < FieldCharacterDirectionCount; i++)
    {
        characterStandingAnimationIds[i] = "";
        characterWalkingAnimationIds[i] = "";
        characterRunningAnimationIds[i] = "";

        pCharacterStandingAnimations[i] = NULL;
        pCharacterWalkingAnimations[i] = NULL;
        pCharacterRunningAnimations[i] = NULL;
    }

    isBegun = false;
    state = FieldCharacterStateNone;
    pCurrentAnimation = NULL;

    pClickEncounter = NULL;
    pClickCutscene = NULL;

    extraHeight = 0;

    id = "";
    name = "";
    position = Vector2(0, 0);
    pHitBox = NULL;
    direction = CharacterDirectionLeft;
    spriteDirection = FieldCharacterDirectionSide;
    anchorPosition = 0;
    clickEncounterId = "";
    clickCutsceneId = "";
    isMouseOver = false;
    isClicked = false;
    pCondition = NULL;

    pReader->StartElement("FieldCharacter");
    id = pReader->ReadTextElement("Id");
    name = pReader->ReadTextElement("Name");

    pReader->StartElement("CharacterStandingAnimationIds");
    pReader->StartList("Entry");

    while (pReader->MoveToNextListItem())
    {
        FieldCharacterDirection direction = StringToFieldCharacterDirection(pReader->ReadTextElement("Direction"));
        characterStandingAnimationIds[(int)direction] = pReader->ReadTextElement("Id");
    }

    pReader->EndElement();

    pReader->StartElement("CharacterWalkingAnimationIds");
    pReader->StartList("Entry");

    while (pReader->MoveToNextListItem())
    {
        FieldCharacterDirection direction = StringToFieldCharacterDirection(pReader->ReadTextElement("Direction"));
        characterWalkingAnimationIds[(int)direction] = pReader->ReadTextElement("Id");
    }

    pReader->EndElement();

    pReader->StartElement("CharacterRunningAnimationIds");
    pReader->StartList("Entry");

    while (pReader->MoveToNextListItem())
    {
        FieldCharacterDirection direction = StringToFieldCharacterDirection(pReader->ReadTextElement("Direction"));
        characterRunningAnimationIds[(int)direction] = pReader->ReadTextElement("Id");
    }

    pReader->EndElement();

    pReader->StartElement("Position");
    position = Vector2(pReader);
    pReader->EndElement();

    pHitBox = new HitBox(pReader);
    direction = StringToCharacterDirection(pReader->ReadTextElement("Direction"));
    spriteDirection = StringToFieldCharacterDirection(pReader->ReadTextElement("SpriteDirection"));
    anchorPosition = pReader->ReadIntElement("AnchorPosition");

    pReader->StartElement("ClickRect");
    clickRect = RectangleWH(pReader);
    pReader->EndElement();

    if (pReader->ElementExists("ClickEncounterId"))
    {
        clickEncounterId = pReader->ReadTextElement("ClickEncounterId");
    }

    if (pReader->ElementExists("ClickCutsceneId"))
    {
        clickCutsceneId = pReader->ReadTextElement("ClickCutsceneId");
    }

    if (pReader->ElementExists("InteractionLocation"))
    {
        pReader->StartElement("InteractionLocation");
        interactionLocation = Vector2(pReader);
        pReader->EndElement();
    }
    else
    {
        interactionLocation = Vector2(-1, -1);
    }

    interactFromAnywhere = pReader->ReadBooleanElement("InteractFromAnywhere");

    if (pReader->ElementExists("Condition"))
    {
        pReader->StartElement("Condition");
        pCondition = new Condition(pReader);
        pReader->EndElement();
    }

    pReader->EndElement();
}