From: <bal...@us...> - 2003-12-26 20:49:31
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/Core In directory sc8-pr-cvs1:/tmp/cvs-serv16252/gemrb/plugins/Core Modified Files: GameControl.h GameControl.cpp Log Message: GameControl.cpp / .h : Added Features: - Added Dialogs support (buggy) Index: GameControl.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GameControl.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** GameControl.h 23 Dec 2003 23:33:58 -0000 1.21 --- GameControl.h 26 Dec 2003 20:49:27 -0000 1.22 *************** *** 76,79 **** --- 76,82 ---- void ResizeAdd(Window * win, unsigned char type); unsigned char LeftCount, BottomCount, RightCount, TopCount; + DialogState * ds; + Actor * speaker, * target; + Dialog * dlg; public: void SetCutSceneMode(bool active); *************** *** 81,84 **** --- 84,89 ---- void UnhideGUI(); void InitDialog(Actor * speaker, Actor * target, Dialog * dlg); + bool Dialogue; + void DialogChoose(int choose); }; Index: GameControl.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GameControl.cpp,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** GameControl.cpp 26 Dec 2003 15:04:02 -0000 1.52 --- GameControl.cpp 26 Dec 2003 20:49:27 -0000 1.53 *************** *** 67,70 **** --- 67,71 ---- TopCount = 0; GUIEnabled = false; + Dialogue = false; } *************** *** 817,820 **** --- 818,825 ---- { DisableMouse = true; + Dialogue = true; + this->dlg = dlg; + this->speaker = speaker; + this->target = target; unsigned long index; core->GetDictionary()->Lookup("MessageWindowSize", index); *************** *** 822,825 **** --- 827,831 ---- core->GetGUIScriptEngine()->RunFunction("OnIncreaseSize"); } + else { if(index > 1) { *************** *** 827,849 **** } } if(core->GetDictionary()->Lookup("MessageWindow", index)) { Window * win = core->GetWindow(index); if(core->GetDictionary()->Lookup("MessageTextArea", index)) { TextArea * ta = (TextArea*)win->GetControl(index); ! DialogState * ds = dlg->GetState(0); char * string = core->GetString(ds->StrRef, 2); int i = ta->AppendText("[color=FF0000]", -1); ta->AppendText(speaker->LongName, i); ! ta->AppendText("[/color]: ", i); ta->AppendText(string, i); ta->AppendText("", -1); for(int x = 0; x < ds->transitionsCount; x++) { ! char * s = core->GetString(ds->transitions[x]->textStrRef); ! sprintf(string, "%d - ", x+1); ! i = ta->AppendText(string, -1); ! ta->AppendText(s, i); ! free(s); } ! free(string); } } --- 833,886 ---- } } + DialogChoose(-1); + } + + void GameControl::DialogChoose(int choose) + { + unsigned long index; if(core->GetDictionary()->Lookup("MessageWindow", index)) { Window * win = core->GetWindow(index); if(core->GetDictionary()->Lookup("MessageTextArea", index)) { TextArea * ta = (TextArea*)win->GetControl(index); ! if(choose == -1) ! ds = dlg->GetState(0); ! else { ! DialogTransition * tr = ds->transitions[choose]; ! if(tr->action) { ! for(int i = 0; i < tr->action->count; i++) { ! if(speaker->Scripts[0]) { ! speaker->Scripts[0]->ExecuteString(tr->action->strings[i]); ! } ! } ! } ! ds = dlg->GetState(tr->stateIndex); ! } char * string = core->GetString(ds->StrRef, 2); int i = ta->AppendText("[color=FF0000]", -1); ta->AppendText(speaker->LongName, i); ! ta->AppendText("[/color]: [p]", i); ta->AppendText(string, i); + ta->AppendText("[/p]", i); ta->AppendText("", -1); + free(string); for(int x = 0; x < ds->transitionsCount; x++) { ! if(ds->transitions[x]->textStrRef == 0) { ! string = (char*)malloc(29); ! sprintf(string, "[s=%d,ffffff,ff0000]Continue", x); ! i = ta->AppendText(string, -1); ! ta->AppendText("[/s]", i); ! free(string); ! } else { ! char * s = core->GetString(ds->transitions[x]->textStrRef); ! string = (char*)malloc(25); ! sprintf(string, "[s=%d,ffffff,ff0000]%d - ", x, x+1); ! i = ta->AppendText(string, -1); ! ta->AppendText(s, i); ! ta->AppendText("[/s]", i); ! free(string); ! free(s); ! } } ! ta->AppendText("", -1); } } |