void pawsNpcDialogWindow::HandleMessage( MsgEntry* me ) { if ( me->GetType() == MSGTYPE_DIALOG_MENU ) { psDialogMenuMessage mesg(me); Debug2(LOG_QUESTS, 0,"Got psDialogMenuMessage: %s\n", mesg.xml.GetDataSafe() ); responseList->Clear(); SelfPopulateXML(mesg.xml); AdjustForPromptWindow(); Show(); } }
void pawsNpcDialogWindow::HandleMessage(MsgEntry* me) { if(me->GetType() == MSGTYPE_DIALOG_MENU) { psDialogMenuMessage mesg(me); Debug2(LOG_QUESTS, 0,"Got psDialogMenuMessage: %s\n", mesg.xml.GetDataSafe()); responseList->Clear(); SelfPopulateXML(mesg.xml); if(useBubbles) { speechBubble->Hide(); // hide previous npc say response LoadQuest(mesg.xml); AdjustForPromptWindow(); // should be done before DisplayQuestBubbles DisplayQuestBubbles(displayIndex); gotNewMenu = true; } else { AdjustForPromptWindow(); } Show(); } else if(me->GetType() == MSGTYPE_CHAT) { psChatMessage chatMsg(me); Debug2(LOG_QUESTS, 0,"Got Chat message from NPC: %s\n", (const char*)chatMsg.sText); GEMClientActor* actor = dynamic_cast<GEMClientActor*>(psengine->GetCelClient()->FindObject(chatMsg.actor)); if(!actor) return; // handle the basic action types, in the future we could play an animation as well csString inText ; switch(chatMsg.iChatType) { case CHAT_NPC_ME: { inText.Format("(%s %s)", (const char*)chatMsg.sPerson, ((const char*)chatMsg.sText)); break; } case CHAT_NPC_MY: { inText.Format("(%s's %s)", (const char*)chatMsg.sPerson, ((const char*)chatMsg.sText)); break; } case CHAT_NPC_NARRATE: { inText.Format("(%s)", (const char*)chatMsg.sText); break; } default: inText = chatMsg.sText; } NpcSays(inText, actor); //checks if the NPC Dialogue is displayed, in this case don't show the normal overhead bubble if(IsVisible()) return; } else if(me->GetType() == MSGTYPE_REMOVE_OBJECT) { psRemoveObject mesg(me); //if the current target is being removed hide this window if(IsVisible() && targetEID.IsValid() && mesg.objectEID.IsValid() && mesg.objectEID == targetEID) { Hide(); //In these cases something might have gone wrong with the camera //eg: the character is being teleported. So we need to have it reset //correctly. psengine->GetPSCamera()->ResetCameraPositioning(); } } }