void DialogueSupervisor::BeginDialogue(MapSprite* sprite) { if (sprite == NULL) { IF_PRINT_WARNING(MAP_DEBUG) << "NULL argument passed to function" << endl; return; } if (sprite->HasAvailableDialogue() == false) { IF_PRINT_WARNING(MAP_DEBUG) << "sprite argument had no available dialogue" << endl; return; } MapDialogue* next_dialogue = GetDialogue(sprite->GetNextDialogueID()); if (next_dialogue == NULL) { IF_PRINT_WARNING(MAP_DEBUG) << "the next dialogue referenced by the sprite argument was invalid" << endl; return; } if (next_dialogue->IsAvailable() == false) { IF_PRINT_WARNING(MAP_DEBUG) << "the next dialogue referenced by the sprite was not available" << endl; return; } // Prepare the state of the sprite and map camera for the dialogue sprite->SaveState(); sprite->moving = false; sprite->SetDirection(CalculateOppositeDirection(MapMode::CurrentInstance()->GetCamera()->GetDirection())); sprite->IncrementNextDialogue(); // TODO: Is the line below necessary to do? Shouldn't the camera stop on its own (if its pointing to the player's character)? MapMode::CurrentInstance()->GetCamera()->moving = false; BeginDialogue(next_dialogue->GetDialogueID()); }
void WindowWorld::OnLoad() { Window::OnLoad(); System::RegisterWorldContext(this); BeginDialogue(); }