1 /* GemRB - Infinity Engine Emulator 2 * Copyright (C) 2003 The GemRB Project 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 * 18 * 19 */ 20 21 #ifndef DIALOG_H 22 #define DIALOG_H 23 24 #include "exports.h" 25 #include "globals.h" 26 27 #include <vector> 28 29 namespace GemRB { 30 31 #define IE_DLG_TR_TEXT 0x01 32 #define IE_DLG_TR_TRIGGER 0x02 33 #define IE_DLG_TR_ACTION 0x04 34 #define IE_DLG_TR_FINAL 0x08 35 #define IE_DLG_TR_JOURNAL 0x10 36 // unknown 0x20 ("Interrupt is an interjection"; only [so far] visible result is duplication of responses) 37 #define IE_DLG_UNSOLVED 0x40 38 #define IE_DLG_ADDJOURNAL 0x80 // Add Journal note (works implicitly — bg2Sections[0] is the default) 39 #define IE_DLG_SOLVED 0x100 40 #define IE_DLG_IMMEDIATE 0x200 // 1=Immediate execution of script actions, 0=Delayed execution of script actions (BGEE) 41 // TODO: implement EE extensions 42 // bit 10: Clear actions (BGEE) 43 44 #define IE_DLG_QUEST_GROUP 0x4000 // this is a GemRB extension 45 46 class Condition; 47 class Action; 48 49 struct DialogTransition { 50 ieDword Flags; 51 ieStrRef textStrRef; 52 ieStrRef journalStrRef; 53 Condition* condition; 54 std::vector<Action*> actions; 55 ieResRef Dialog; 56 ieDword stateIndex; 57 }; 58 59 struct DialogState { 60 ieStrRef StrRef; 61 DialogTransition** transitions; 62 unsigned int transitionsCount; 63 Condition* condition; 64 unsigned int weight; 65 }; 66 67 class GEM_EXPORT Dialog { 68 public: 69 Dialog(void); 70 ~Dialog(void); 71 private: 72 void FreeDialogState(DialogState* ds); 73 public: 74 void AddState(DialogState* ds); 75 DialogState* GetState(unsigned int index); 76 int FindFirstState(Scriptable* target); 77 int FindRandomState(Scriptable* target); 78 Release()79 void Release() 80 { 81 delete this; 82 } 83 public: 84 ieResRef ResRef; 85 ieDword Flags; //freeze flags (bg2) 86 unsigned int TopLevelCount; 87 ieDword* Order; 88 DialogState** initialStates; 89 }; 90 91 } 92 93 #endif 94