Index: MUSHclient.cpp =================================================================== RCS file: /cvs/mushclient/MUSHclient.cpp,v retrieving revision 1.86 retrieving revision 1.88 diff -c -r1.86 -r1.88 *** MUSHclient.cpp 11 Jun 2008 01:13:03 -0000 1.86 --- MUSHclient.cpp 19 Jun 2008 08:33:24 -0000 1.88 *************** *** 304,309 **** --- 304,312 ---- m_bEscapeSequences = false; m_bCallFunction = false; + m_pDirectSoundObject = NULL; + m_pDirectSoundPrimaryBuffer = NULL; + // Initialize OLE libraries if (!bWine) if (!AfxOleInit()) // not needed? *************** *** 434,440 **** // check for configuration name collisions #ifdef _DEBUG ! for (int i = 0; AlphaOptionsTable [i].pName; i++) for (int j = 0; OptionsTable [j].pName; j++) if (strcmp (AlphaOptionsTable [i].pName, OptionsTable [j].pName) == 0) ::UMessageBox (TFormat ("Internal MUSHclient error, config name collision: %s", --- 437,444 ---- // check for configuration name collisions #ifdef _DEBUG ! int i; ! for (i = 0; AlphaOptionsTable [i].pName; i++) for (int j = 0; OptionsTable [j].pName; j++) if (strcmp (AlphaOptionsTable [i].pName, OptionsTable [j].pName) == 0) ::UMessageBox (TFormat ("Internal MUSHclient error, config name collision: %s", *************** *** 489,494 **** --- 493,517 ---- if (!bWine) CoInitialize (NULL); + // try to set up for DirectSound + if (FAILED (DirectSoundCreate (NULL, &m_pDirectSoundObject, NULL))) + m_pDirectSoundObject = NULL; + // set sound cooperation level + if (FAILED (m_pDirectSoundObject->SetCooperativeLevel (pMainFrame->m_hWnd, DSSCL_NORMAL))) + m_pDirectSoundObject = NULL; // no DirectSound + + DSBUFFERDESC bd; + + memset (&bd, 0, sizeof (DSBUFFERDESC)); + bd.dwSize = sizeof (DSBUFFERDESC); + bd.dwFlags = DSBCAPS_PRIMARYBUFFER; + bd.dwBufferBytes = 0; //must be 0 for primary buffer + bd.lpwfxFormat = NULL; //must be null for primary buffer + + if (FAILED (m_pDirectSoundObject->CreateSoundBuffer (&bd, &m_pDirectSoundPrimaryBuffer, NULL))) + m_pDirectSoundObject = NULL; // no DirectSound + + // see which OS we are using OSVERSIONINFO ver; memset(&ver, 0, sizeof(ver)); *************** *** 1013,1018 **** --- 1036,1045 ---- if (m_Translator_Lua) lua_close (m_Translator_Lua); m_Translator_Lua = NULL; + + // release sound buffer if allocated + if (m_pDirectSoundPrimaryBuffer) + m_pDirectSoundPrimaryBuffer->Release (); // free the resources DLL FreeLibrary (m_hInstDLL); Index: MUSHclient.dsp =================================================================== RCS file: /cvs/mushclient/MUSHclient.dsp,v retrieving revision 1.98 retrieving revision 1.99 diff -c -r1.98 -r1.99 *** MUSHclient.dsp 11 Jun 2008 01:13:03 -0000 1.98 --- MUSHclient.dsp 21 Jun 2008 04:43:53 -0000 1.99 *************** *** 51,57 **** LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 # SUBTRACT BASE LINK32 /pdb:none ! # ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 # SUBTRACT LINK32 /profile !ELSEIF "$(CFG)" == "MUSHclient - Win32 Release" --- 51,57 ---- LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 # SUBTRACT BASE LINK32 /pdb:none ! # ADD LINK32 dsound.lib /nologo /subsystem:windows /debug /machine:I386 # SUBTRACT LINK32 /profile !ELSEIF "$(CFG)" == "MUSHclient - Win32 Release" *************** *** 77,83 **** LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 # SUBTRACT BASE LINK32 /pdb:none ! # ADD LINK32 /nologo /subsystem:windows /machine:I386 # SUBTRACT LINK32 /pdb:none /debug !ENDIF --- 77,83 ---- LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 # SUBTRACT BASE LINK32 /pdb:none ! # ADD LINK32 dsound.lib /nologo /subsystem:windows /machine:I386 # SUBTRACT LINK32 /pdb:none /debug !ENDIF *************** *** 1475,1483 **** # End Source File # End Target # End Project - # Section MUSHclient : {00000000-0001-0000-0000-000000000000} - # 1:23:CG_IDR_POPUP_MAIN_FRAME:126 - # End Section # Section MUSHclient : {F3B13065-16CC-11D0-B7D0-00A0247B3BFD} # 0:8:TipDlg.h:D:\SOURCE\MUSHclient\TipDlg.h # 0:10:TipDlg.cpp:D:\SOURCE\MUSHclient\TipDlg.cpp --- 1475,1480 ---- *************** *** 1524,1527 **** --- 1521,1527 ---- # End Section # Section MUSHclient : {00000000-000C-0000-0C00-00004944445F} # 1:26:CG_IDR_POPUP_ACTIVITY_VIEW:127 + # End Section + # Section MUSHclient : {00000000-0001-0000-0000-000000000000} + # 1:23:CG_IDR_POPUP_MAIN_FRAME:126 # End Section Index: MUSHclient.h =================================================================== RCS file: /cvs/mushclient/MUSHclient.h,v retrieving revision 1.55 retrieving revision 1.57 diff -c -r1.55 -r1.57 *** MUSHclient.h 11 Jun 2008 01:13:03 -0000 1.55 --- MUSHclient.h 19 Jun 2008 08:33:24 -0000 1.57 *************** *** 12,17 **** --- 12,23 ---- #include "scripting.h" #include "othertypes.h" + #define DIRECTSOUND_VERSION 5 + + #include + #include + #include + ///////////////////////////////////////////////////////////////////////////// // CMUSHclientApp: // See MUSHclient.cpp for the implementation of this class *************** *** 19,24 **** --- 25,33 ---- #define MAX_SPELL_ERRORS 10 + // how many sounds we can play at once + #define MAX_SOUND_BUFFERS 10 + // flags for m_nParenMatchFlags #define PAREN_NEST_BRACES 0x0001 // do braces nest? eg. ( [)] ) #define PAREN_SINGLE_QUOTES 0x0002 // handle single quotes eg. 'nick' *************** *** 103,108 **** --- 112,120 ---- CString m_strTranslatorFile; // eg. (MUSHclient executable)\locale\EN.lua HINSTANCE m_hInstDLL; // resources file - all dialogs etc., loaded in application startup + + LPDIRECTSOUND m_pDirectSoundObject; // for DirectSound output + LPDIRECTSOUNDBUFFER m_pDirectSoundPrimaryBuffer; // global preferences Index: MUSHclient.rc =================================================================== RCS file: /cvs/mushclient/MUSHclient.rc,v retrieving revision 1.218 retrieving revision 1.219 diff -c -r1.218 -r1.219 *** MUSHclient.rc 11 Jun 2008 01:13:03 -0000 1.218 --- MUSHclient.rc 19 Jun 2008 07:15:55 -0000 1.219 *************** *** 75,82 **** // VS_VERSION_INFO VERSIONINFO ! FILEVERSION 4,0,27,0 ! PRODUCTVERSION 4,0,27,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L --- 75,82 ---- // VS_VERSION_INFO VERSIONINFO ! FILEVERSION 4,0,28,0 ! PRODUCTVERSION 4,0,28,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L *************** *** 94,107 **** VALUE "Comments", "MUSHclient - a client program for playing MUD games\0" VALUE "CompanyName", "Gammon Software Solutions\0" VALUE "FileDescription", "MUSHclient\0" ! VALUE "FileVersion", "4.27\0" VALUE "InternalName", "MUSHCLIENT\0" VALUE "LegalCopyright", "Copyright © 2008 Gammon Software Solutions\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "MUSHCLIENT.EXE\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "MUSHclient\0" ! VALUE "ProductVersion", "4.27\0" VALUE "SpecialBuild", "\0" END END --- 94,107 ---- VALUE "Comments", "MUSHclient - a client program for playing MUD games\0" VALUE "CompanyName", "Gammon Software Solutions\0" VALUE "FileDescription", "MUSHclient\0" ! VALUE "FileVersion", "4.28\0" VALUE "InternalName", "MUSHCLIENT\0" VALUE "LegalCopyright", "Copyright © 2008 Gammon Software Solutions\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "MUSHCLIENT.EXE\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "MUSHclient\0" ! VALUE "ProductVersion", "4.28\0" VALUE "SpecialBuild", "\0" END END Index: configuration.cpp =================================================================== RCS file: /cvs/mushclient/configuration.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -c -r1.49 -r1.50 *** configuration.cpp 30 Jul 2007 00:06:52 -0000 1.49 --- configuration.cpp 21 Jun 2008 04:43:53 -0000 1.50 *************** *** 594,611 **** --- 594,614 ---- page16.m_iColWidth [CPrefsP16::eColumnContents] = 100; page16.m_iColWidth [CPrefsP16::eColumnLabel] = 50; page16.m_iColWidth [CPrefsP16::eColumnGroup] = 50; + page16.m_iColWidth [CPrefsP16::eColumnNext] = 80; page16.m_iColJust [CPrefsP16::eColumnType] = LVCFMT_LEFT; page16.m_iColJust [CPrefsP16::eColumnWhen] = LVCFMT_LEFT; page16.m_iColJust [CPrefsP16::eColumnContents] = LVCFMT_LEFT; page16.m_iColJust [CPrefsP16::eColumnLabel] = LVCFMT_LEFT; page16.m_iColJust [CPrefsP16::eColumnGroup] = LVCFMT_LEFT; + page16.m_iColJust [CPrefsP16::eColumnNext] = LVCFMT_LEFT; page16.m_strColumnHeadings [CPrefsP16::eColumnType] = TranslateHeading ("Type"); page16.m_strColumnHeadings [CPrefsP16::eColumnWhen] = TranslateHeading ("When"); page16.m_strColumnHeadings [CPrefsP16::eColumnContents] = TranslateHeading ("Send"); page16.m_strColumnHeadings [CPrefsP16::eColumnLabel] = TranslateHeading ("Label"); page16.m_strColumnHeadings [CPrefsP16::eColumnGroup] = TranslateHeading ("Group"); + page16.m_strColumnHeadings [CPrefsP16::eColumnNext] = TranslateHeading ("Next"); } // end of CMUSHclientDoc::LoadPrefsP16 void CMUSHclientDoc:: LoadPrefsP17 (CPrefsP17 &page17) Index: doc.cpp =================================================================== RCS file: /cvs/mushclient/doc.cpp,v retrieving revision 1.223 retrieving revision 1.228 diff -c -r1.223 -r1.228 *** doc.cpp 11 Jun 2008 01:13:03 -0000 1.223 --- doc.cpp 21 Jun 2008 04:43:53 -0000 1.228 *************** *** 503,508 **** --- 503,512 ---- DISP_FUNCTION(CMUSHclientDoc, "GetPluginAliasOption", GetPluginAliasOption, VT_VARIANT, VTS_BSTR VTS_BSTR VTS_BSTR) DISP_FUNCTION(CMUSHclientDoc, "GetPluginTimerOption", GetPluginTimerOption, VT_VARIANT, VTS_BSTR VTS_BSTR VTS_BSTR) DISP_FUNCTION(CMUSHclientDoc, "AcceleratorTo", AcceleratorTo, VT_I4, VTS_BSTR VTS_BSTR VTS_I2) + DISP_FUNCTION(CMUSHclientDoc, "StopSound", StopSound, VT_I4, VTS_I2) + DISP_FUNCTION(CMUSHclientDoc, "GetSoundStatus", GetSoundStatus, VT_I4, VTS_I2) + DISP_FUNCTION(CMUSHclientDoc, "PlaySound", PlaySound, VT_I4, VTS_I2 VTS_BSTR VTS_BOOL VTS_R8 VTS_R8) + DISP_FUNCTION(CMUSHclientDoc, "SetCommandWindowHeight", SetCommandWindowHeight, VT_I4, VTS_I2) DISP_PROPERTY_PARAM(CMUSHclientDoc, "NormalColour", GetNormalColour, SetNormalColour, VT_I4, VTS_I2) DISP_PROPERTY_PARAM(CMUSHclientDoc, "BoldColour", GetBoldColour, SetBoldColour, VT_I4, VTS_I2) DISP_PROPERTY_PARAM(CMUSHclientDoc, "CustomColourText", GetCustomColourText, SetCustomColourText, VT_I4, VTS_I2) *************** *** 742,747 **** --- 746,763 ---- } // end of CMUSHclientDoc::SetUpOutputWindow + bool CMUSHclientDoc::SeeIfHandlerCanExecute (const CString & strName) + { + if (!strName.IsEmpty () && strName [0] == '!') + { + Execute (strName.Mid (1)); + return false; + } + + return true; // go ahead and call normal script + + } // end of SeeIfHandlerCanExecute + BOOL CMUSHclientDoc::OpenSession (void) { *************** *** 756,771 **** // execute "open" script if (m_ScriptEngine) { - DISPPARAMS params = { NULL, NULL, 0, 0 }; - long nInvocationCount = 0; ! ExecuteScript (m_dispidWorldOpen, ! m_strWorldOpen, ! eWorldAction, ! "world open", ! "opening world", ! params, ! nInvocationCount); } // end of executing open script if (App.m_bAutoConnectWorlds) --- 772,791 ---- // execute "open" script if (m_ScriptEngine) { ! if (SeeIfHandlerCanExecute (m_strWorldOpen)) ! { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! ! ExecuteScript (m_dispidWorldOpen, ! m_strWorldOpen, ! eWorldAction, ! "world open", ! "opening world", ! params, ! nInvocationCount); ! } } // end of executing open script if (App.m_bAutoConnectWorlds) *************** *** 1971,1977 **** case '\r': // return - ignore, or clear line content ! if (m_bCarriageReturnClearsLine && !(flags & NOTE_OR_COMMAND)) { // delete existing styles list --- 1991,1997 ---- case '\r': // return - ignore, or clear line content ! if (m_bCarriageReturnClearsLine && !(flags & NOTE_OR_COMMAND) && p [1] != '\n') { // delete existing styles list *************** *** 4439,4446 **** sparams, timer_item->nInvocationCount); timer_item->bExecutingScript = false; // can be deleted now if (bResult) ! return; // error in script, bail out } // end of Lua else { --- 4459,4468 ---- sparams, timer_item->nInvocationCount); timer_item->bExecutingScript = false; // can be deleted now + /* version 4.28 -- removed this - one-shot timers weren't being deleted if (bResult) ! return; // error in script, bail out ! */ } // end of Lua else { *************** *** 4469,4476 **** --- 4491,4500 ---- timer_item->nInvocationCount); timer_item->bExecutingScript = false; // can be deleted now + /* version 4.28 -- removed this - one-shot timers weren't being deleted if (bResult) return; // error in script, bail out + */ } // not Lua } // end of having a dispatch ID *************** *** 4632,4647 **** // execute "close" script if (m_bWorldClosing && m_ScriptEngine) { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! ExecuteScript (m_dispidWorldClose, ! m_strWorldClose, ! eWorldAction, ! "world close", ! "closing world", ! params, ! nInvocationCount); } // end of executing close script return m_bWorldClosing; --- 4656,4674 ---- // execute "close" script if (m_bWorldClosing && m_ScriptEngine) { ! if (SeeIfHandlerCanExecute (m_strWorldClose)) ! { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! ExecuteScript (m_dispidWorldClose, ! m_strWorldClose, ! eWorldAction, ! "world close", ! "closing world", ! params, ! nInvocationCount); ! } } // end of executing close script return m_bWorldClosing; *************** *** 4703,4718 **** // execute "save" script if (m_ScriptEngine) { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! ExecuteScript (m_dispidWorldSave, ! m_strWorldSave, ! eWorldAction, ! "world save", ! "saving world", ! params, ! nInvocationCount); } // end of executing save script return CDocument::DoSave (newName, bReplace); --- 4730,4749 ---- // execute "save" script if (m_ScriptEngine) { ! if (SeeIfHandlerCanExecute (m_strWorldSave)) ! { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! ! ExecuteScript (m_dispidWorldSave, ! m_strWorldSave, ! eWorldAction, ! "world save", ! "saving world", ! params, ! nInvocationCount); ! } } // end of executing save script return CDocument::DoSave (newName, bReplace); *************** *** 5398,5404 **** --- 5429,5439 ---- { // let them know if they are foolishly trying to send to a closed connection + // no reconnecting while we are trying to disconnect + if (m_iConnectPhase == eConnectDisconnecting) + return true; + // if no socket, ask if they want one if (m_iConnectPhase != eConnectConnectedToMud || !m_pSocket) { // forget it for this address *************** *** 7021,7036 **** // execute "connect" script if (m_ScriptEngine) { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! ExecuteScript (m_dispidWorldConnect, ! m_strWorldConnect, ! eWorldAction, ! "world connect", ! "connecting to world", ! params, ! nInvocationCount); } // end of executing open script // tell each plugin we have connected --- 7056,7075 ---- // execute "connect" script if (m_ScriptEngine) { ! if (SeeIfHandlerCanExecute (m_strWorldConnect)) ! { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! ! ExecuteScript (m_dispidWorldConnect, ! m_strWorldConnect, ! eWorldAction, ! "world connect", ! "connecting to world", ! params, ! nInvocationCount); ! } } // end of executing open script // tell each plugin we have connected *************** *** 7758,7763 **** --- 7797,7803 ---- // default sound-cancel mechanism Frame.CancelSound (); + StopSound (0); // also DirectSound } *************** *** 7786,7789 **** --- 7826,7830 ---- putontoclipboard (QuoteForumCodes (strContents)); } + Index: doc.h =================================================================== RCS file: /cvs/mushclient/doc.h,v retrieving revision 1.237 retrieving revision 1.242 diff -c -r1.237 -r1.242 *** doc.h 11 Jun 2008 01:13:04 -0000 1.237 --- doc.h 21 Jun 2008 04:43:53 -0000 1.242 *************** *** 21,28 **** // New versions - things to change ! #define THISVERSION 427 // Step 1. ! const CString MUSHCLIENT_VERSION = "4.27"; // Step 2. // Step 3. Don't forget VERSION resource in Resources tab // Step 4. Remember: README.TXT --- 21,28 ---- // New versions - things to change ! #define THISVERSION 428 // Step 1. ! const CString MUSHCLIENT_VERSION = "4.28"; // Step 2. // Step 3. Don't forget VERSION resource in Resources tab // Step 4. Remember: README.TXT *************** *** 152,157 **** --- 152,158 ---- eConnectAwaitingProxyResponse2, // 6: sent SOCKS username/password, awaiting confirmation eConnectAwaitingProxyResponse3, // 7: sent SOCKS connect details, awaiting confirmation eConnectConnectedToMud, // 8: connected, we can play now + eConnectDisconnecting, // 9: in process of disconnecting, don't attempt to reconnect }; // values for m_iSocksProcessing - type of proxy server *************** *** 1179,1184 **** --- 1180,1188 ---- */ + // for DirectSound + LPDIRECTSOUNDBUFFER m_pDirectSoundSecondaryBuffer [MAX_SOUND_BUFFERS]; + WORD m_nextAcceleratorCommand; // next free command map m_AcceleratorToCommandMap; // command to send for accelerator *************** *** 1681,1686 **** --- 1685,1695 ---- const CString & strType, const CString & strLabel, CString & strErrorMessage); + DISPID GetProcedureDispidHelper (const CString & strName, + const CString & strType, + const CString & strLabel, + CString & strErrorMessage); + bool SeeIfHandlerCanExecute (const CString & strName); bool FindAllEntryPoints (void); void FindGlobalEntryPoints (CString & strErrorMessage); *************** *** 2406,2411 **** --- 2415,2424 ---- afx_msg VARIANT GetPluginAliasOption(LPCTSTR PluginID, LPCTSTR AliasName, LPCTSTR OptionName); afx_msg VARIANT GetPluginTimerOption(LPCTSTR PluginID, LPCTSTR TimerName, LPCTSTR OptionName); afx_msg long AcceleratorTo(LPCTSTR Key, LPCTSTR Send, short SendTo); + afx_msg long StopSound(short Buffer); + afx_msg long GetSoundStatus(short Buffer); + afx_msg long PlaySound(short Buffer, LPCTSTR FileName, BOOL Loop, double Volume, double Pan); + afx_msg long SetCommandWindowHeight(short Height); afx_msg long GetNormalColour(short WhichColour); afx_msg void SetNormalColour(short WhichColour, long nNewValue); afx_msg long GetBoldColour(short WhichColour); Index: doc_construct.cpp =================================================================== RCS file: /cvs/mushclient/doc_construct.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -c -r1.26 -r1.27 *** doc_construct.cpp 11 Jun 2008 01:13:04 -0000 1.26 --- doc_construct.cpp 19 Jun 2008 08:33:24 -0000 1.27 *************** *** 132,137 **** --- 132,141 ---- m_iMXP_previousMode = eMXP_open; m_code = 0; + // sound buffers + for (i = 0; i < MAX_SOUND_BUFFERS; i++) + m_pDirectSoundSecondaryBuffer [i] = NULL; + /*--------------------------------------------------------- I want to be able to time speed walking delays (for pulling things out of the list, so I need a window that can take timer events, however *************** *** 416,421 **** --- 420,437 ---- CMUSHclientDoc::~CMUSHclientDoc() { int i; + + // stop sounds playing, release sound buffers + for (i = 0; i < MAX_SOUND_BUFFERS; i++) + if (m_pDirectSoundSecondaryBuffer [i]) + { + DWORD iStatus; + if (SUCCEEDED (m_pDirectSoundSecondaryBuffer [i]->GetStatus (&iStatus)) && + (iStatus & DSBSTATUS_PLAYING)) + m_pDirectSoundSecondaryBuffer [i]->Stop (); + + m_pDirectSoundSecondaryBuffer [i]->Release (); + } if (m_pTimerWnd) { Index: functionlist.cpp =================================================================== RCS file: /cvs/mushclient/functionlist.cpp,v retrieving revision 1.29 retrieving revision 1.32 diff -c -r1.29 -r1.32 *** functionlist.cpp 11 Jun 2008 02:15:37 -0000 1.29 --- functionlist.cpp 21 Jun 2008 04:43:53 -0000 1.32 *************** *** 191,197 **** "GetSelectionEndLine", "GetSelectionStartColumn", "GetSelectionStartLine", ! "GetSentBytes", "GetStyleInfo", "GetSysColor", "GetSystemMetrics", --- 191,198 ---- "GetSelectionEndLine", "GetSelectionStartColumn", "GetSelectionStartLine", ! "GetSentBytes", ! "GetSoundStatus", "GetStyleInfo", "GetSysColor", "GetSystemMetrics", *************** *** 265,271 **** "OpenLog", "PasteCommand", "Pause", ! "PickColour", "PluginSupports", "PushCommand", "Queue", --- 266,273 ---- "OpenLog", "PasteCommand", "Pause", ! "PickColour", ! "PlaySound", "PluginSupports", "PushCommand", "Queue", *************** *** 286,292 **** "Save", "SaveNotepad", "SaveState", ! "SelectCommand", "Send", "SendImmediate", "SendNoEcho", --- 288,295 ---- "Save", "SaveNotepad", "SaveState", ! "SelectCommand", ! "SetCommandWindowHeight", "Send", "SendImmediate", "SendNoEcho", *************** *** 318,324 **** "SpellCheck", "SpellCheckCommand", "SpellCheckDlg", ! "StripANSI", "Tell", "Trace", "TraceOut", --- 321,328 ---- "SpellCheck", "SpellCheckCommand", "SpellCheckDlg", ! "StripANSI", ! "StopSound", "Tell", "Trace", "TraceOut", *************** *** 357,363 **** // scan backwards from cursor while (nStartChar >= 0 && strWord.GetLength () < 20 && ! (isalnum (strSelection [nStartChar]) || strSelection [nStartChar] == '.' || strSelection [nStartChar] == '_') ) { strWord = strSelection.Mid (nStartChar, 1) + strWord; --- 361,369 ---- // scan backwards from cursor while (nStartChar >= 0 && strWord.GetLength () < 20 && ! (isalnum (strSelection [nStartChar]) || ! strSelection [nStartChar] == '.' || ! strSelection [nStartChar] == '_') ) { strWord = strSelection.Mid (nStartChar, 1) + strWord; *************** *** 369,375 **** // scan forwards from cursor while (nEndChar < strSelection.GetLength () && strWord.GetLength () < 20 && ! isalnum (strSelection [nEndChar]) ) { strWord = strWord + strSelection.Mid (nEndChar, 1); --- 375,383 ---- // scan forwards from cursor while (nEndChar < strSelection.GetLength () && strWord.GetLength () < 20 && ! (isalnum (strSelection [nEndChar]) || ! strSelection [nEndChar] == '.' || ! strSelection [nEndChar] == '_') ) { strWord = strWord + strSelection.Mid (nEndChar, 1); Index: globaloptions.cpp =================================================================== RCS file: /cvs/mushclient/globaloptions.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -c -r1.28 -r1.29 *** globaloptions.cpp 25 Jul 2007 05:02:19 -0000 1.28 --- globaloptions.cpp 19 Jun 2008 07:15:55 -0000 1.29 *************** *** 72,78 **** { "f1_is_macro", false, O(m_bF1macro)}, { "smooth_scrolling", false, O(m_bSmoothScrolling)}, { "smoother_scrolling", false, O(m_bSmootherScrolling)}, ! { "timer_interval", 1, O(m_nTimerInterval), 0, 120}, { "tray_icon", 0, O(m_iTrayIcon), 0, 9}, { "window_tabs_style", 0, O(m_iWindowTabsStyle), 0, 2}, --- 72,78 ---- { "f1_is_macro", false, O(m_bF1macro)}, { "smooth_scrolling", false, O(m_bSmoothScrolling)}, { "smoother_scrolling", false, O(m_bSmootherScrolling)}, ! { "timer_interval", 0, O(m_nTimerInterval), 0, 120}, { "tray_icon", 0, O(m_iTrayIcon), 0, 9}, { "window_tabs_style", 0, O(m_iWindowTabsStyle), 0, 2}, *************** *** 805,811 **** m_nPrinterLinesPerPage = GetProfileInt ("Global prefs", "PrinterLinesPerPage", 60); m_bAutoLogWorld = GetProfileInt ("Global prefs", "AutoLogWorld", 0); m_bAppendToLogFiles = GetProfileInt ("Global prefs", "AppendToLogFiles", 0); ! m_nTimerInterval = GetProfileInt ("Global prefs", "TimerInterval", 1); m_strPrinterFont = GetProfileString ("Global prefs", "PrinterFont", "Courier"); m_strDefaultLogFileDirectory = GetProfileString ("Global prefs", "DefaultLogFileDirectory", ".\\logs\\"); m_strDefaultWorldFileDirectory = GetProfileString ("Global prefs", "DefaultWorldFileDirectory", ".\\worlds\\"); --- 805,811 ---- m_nPrinterLinesPerPage = GetProfileInt ("Global prefs", "PrinterLinesPerPage", 60); m_bAutoLogWorld = GetProfileInt ("Global prefs", "AutoLogWorld", 0); m_bAppendToLogFiles = GetProfileInt ("Global prefs", "AppendToLogFiles", 0); ! m_nTimerInterval = GetProfileInt ("Global prefs", "TimerInterval", 0); m_strPrinterFont = GetProfileString ("Global prefs", "PrinterFont", "Courier"); m_strDefaultLogFileDirectory = GetProfileString ("Global prefs", "DefaultLogFileDirectory", ".\\logs\\"); m_strDefaultWorldFileDirectory = GetProfileString ("Global prefs", "DefaultWorldFileDirectory", ".\\worlds\\"); Index: globalregistryoptions.cpp =================================================================== RCS file: /cvs/mushclient/globalregistryoptions.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -c -r1.17 -r1.18 *** globalregistryoptions.cpp 9 Aug 2007 01:20:55 -0000 1.17 --- globalregistryoptions.cpp 19 Jun 2008 07:15:55 -0000 1.18 *************** *** 63,69 **** { GLB_OPT (m_nPrinterLeftMargin ), "PrinterLeftMargin", 15 }, { GLB_OPT (m_nPrinterLinesPerPage ), "PrinterLinesPerPage", 60 }, { GLB_OPT (m_nPrinterTopMargin ), "PrinterTopMargin", 15 }, ! { GLB_OPT (m_nTimerInterval ), "TimerInterval", 1 }, { GLB_OPT (m_iFixedPitchFontSize ), "FixedPitchFontSize", 9 }, {NULL} // end of table marker --- 63,69 ---- { GLB_OPT (m_nPrinterLeftMargin ), "PrinterLeftMargin", 15 }, { GLB_OPT (m_nPrinterLinesPerPage ), "PrinterLinesPerPage", 60 }, { GLB_OPT (m_nPrinterTopMargin ), "PrinterTopMargin", 15 }, ! { GLB_OPT (m_nTimerInterval ), "TimerInterval", 0 }, { GLB_OPT (m_iFixedPitchFontSize ), "FixedPitchFontSize", 9 }, {NULL} // end of table marker Index: lua_methods.cpp =================================================================== RCS file: /cvs/mushclient/lua_methods.cpp,v retrieving revision 1.82 retrieving revision 1.87 diff -c -r1.82 -r1.87 *** lua_methods.cpp 11 Jun 2008 02:15:37 -0000 1.82 --- lua_methods.cpp 21 Jun 2008 04:43:53 -0000 1.87 *************** *** 2839,2844 **** --- 2839,2854 ---- } // end of L_GetSentBytes + //---------------------------------------- + // world.GetSoundStatus + //---------------------------------------- + static int L_GetSoundStatus (lua_State *L) + { + lua_pushnumber (L, doc (L)->GetSoundStatus (my_checknumber (L, 1))); + return 1; // number of result fields + } // end of L_GetSoundStatus + + static bool DoStyle (lua_State *L, CMUSHclientDoc *pDoc, CLine * pLine, *************** *** 3976,3981 **** --- 3986,4006 ---- return 0; // number of result fields } // end of L_Pause + //---------------------------------------- + // world.PlaySound + //---------------------------------------- + static int L_PlaySound (lua_State *L) + { + CMUSHclientDoc * pDoc = doc (L); // must do this first + lua_pushnumber (L, pDoc->PlaySound ( + my_checknumber (L, 1), // Buffer + my_optstring (L, 2, ""), // Filename + optboolean (L, 3, 0), // Repeat + my_optnumber (L, 4, 0), // Volume + my_optnumber (L, 5, 0)) // Pan + ); + return 1; // number of result fields + } // end of L_PlaySound //---------------------------------------- // world.PluginSupports *************** *** 4410,4415 **** --- 4435,4450 ---- } // end of L_SetCommand //---------------------------------------- + // world.SetCommandWindowHeight + //---------------------------------------- + static int L_SetCommandWindowHeight (lua_State *L) + { + CMUSHclientDoc *pDoc = doc (L); + lua_pushnumber (L, pDoc->SetCommandWindowHeight (my_checknumber (L, 1))); + return 1; // number of result fields + } // end of L_SetCommandWindowHeight + + //---------------------------------------- // world.SetCustomColourName //---------------------------------------- static int L_SetCustomColourName (lua_State *L) *************** *** 4654,4659 **** --- 4689,4703 ---- return 1; // number of result fields } // end of L_StripANSI + //---------------------------------------- + // world.StopSound + //---------------------------------------- + static int L_StopSound (lua_State *L) + { + CMUSHclientDoc * pDoc = doc (L); // must do this first + lua_pushnumber (L, pDoc->StopSound (my_optnumber (L, 1, 0))); // Buffer + return 1; // number of result fields + } // end of L_StopSound //---------------------------------------- // world.Tell *************** *** 5027,5032 **** --- 5071,5077 ---- {"GetSelectionStartColumn", L_GetSelectionStartColumn}, {"GetSelectionStartLine", L_GetSelectionStartLine}, {"GetSentBytes", L_GetSentBytes}, + {"GetSoundStatus", L_GetSoundStatus}, {"GetStyleInfo", L_GetStyleInfo}, {"GetSysColor", L_GetSysColor}, {"GetSystemMetrics", L_GetSystemMetrics}, *************** *** 5105,5110 **** --- 5150,5156 ---- {"PasteCommand", L_PasteCommand}, {"Pause", L_Pause}, {"PickColour", L_PickColour}, + {"PlaySound", L_PlaySound}, {"PluginSupports", L_PluginSupports}, {"PushCommand", L_PushCommand}, {"Queue", L_Queue}, *************** *** 5140,5145 **** --- 5186,5192 ---- {"SetChanged", L_SetChanged}, {"SetClipboard", L_SetClipboard}, {"SetCommand", L_SetCommand}, + {"SetCommandWindowHeight", L_SetCommandWindowHeight}, {"SetCustomColourName", L_SetCustomColourName}, {"SetEntity", L_SetEntity}, {"SetInputFont", L_SetInputFont}, *************** *** 5160,5165 **** --- 5207,5213 ---- {"SpellCheckCommand", L_SpellCheckCommand}, {"SpellCheckDlg", L_SpellCheckDlg}, {"StripANSI", L_StripANSI}, + {"StopSound", L_StopSound}, {"Tell", L_Tell}, {"GetTrace", L_GetTrace}, {"SetTrace", L_SetTrace}, Index: lua_scripting.cpp =================================================================== RCS file: /cvs/mushclient/lua_scripting.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -c -r1.42 -r1.43 *** lua_scripting.cpp 11 Jun 2008 02:15:37 -0000 1.42 --- lua_scripting.cpp 21 Jun 2008 04:43:53 -0000 1.43 *************** *** 210,215 **** --- 210,223 ---- // preliminary sand-box stuff ParseLua (App.m_strLuaScript, "Sandbox"); + // this is so useful I am adding it in (see check.lua) + ParseLua ( \ + "function check (result) \ + if result ~= error_code.eOK then\ + error (error_desc [result] or \ + string.format (\"Unknown error code: %i\", result), 2) end; end", + "Check function"); + m_pDoc->m_iCurrentActionSource = eUnknownActionSource; lua_settop(L, 0); // clear stack Index: methods.cpp =================================================================== RCS file: /cvs/mushclient/methods.cpp,v retrieving revision 1.208 retrieving revision 1.214 diff -c -r1.208 -r1.214 *** methods.cpp 11 Jun 2008 01:13:04 -0000 1.208 --- methods.cpp 21 Jun 2008 04:43:53 -0000 1.214 *************** *** 335,341 **** long CMUSHclientDoc::Disconnect() { ! if (m_iConnectPhase != eConnectNotConnected) { OnConnectionDisconnect (); return eOK; --- 335,342 ---- long CMUSHclientDoc::Disconnect() { ! if (m_iConnectPhase != eConnectNotConnected && ! m_iConnectPhase != eConnectDisconnecting) { OnConnectionDisconnect (); return eOK; *************** *** 11562,11567 **** --- 11563,11990 ---- VARIANT CMUSHclientDoc::GetGlobalOptionList() { return App.GetGlobalOptionList (); + } + + + // start playing sound FileName in buffer Buffer + // If not a fully-qualified path, prepend mushclient.exe directory followed by "sounds\" + // Loop when finished if Loop is true + // Play at volume 'Volume' (percent) - 0 is full volume, -100 is -100 db + // (3 db each time halves the volume, so 97 would be half volume, and 94 would be quarter volume) + // Pan at Pan -100 to +100 percent where -100 is fully left and +100 is fully right (and zero is centered) + // If Buffer is nonzero, and FileName is "" then adjust the volume, pan and loop flag for an existing, playing, sound, if possible + // If Buffer zero then try to take an unused buffer. If that fails, take a non-playing buffer. If that fails, take buffer 1 + // Buffer should be zero (for any free buffer) or 1 to MAX_SOUND_BUFFERS (currently 10) + + // Sound files must be .WAV files, 16-bit, 22.05KHz, PCM, Mono or stereo + + // test: /print (PlaySound (9, "/Program Files/Mushclient/sounds/battle/battle01.wav", true, 100)) + + long CMUSHclientDoc::PlaySound(short Buffer, LPCTSTR FileName, BOOL Loop, double Volume, double Pan) + { + + // no sound object? can't do it + if (!App.m_pDirectSoundObject || !App.m_pDirectSoundPrimaryBuffer) + return eCannotPlaySound ; + + // -------------------------- convert volume from percent into db * 100 ---------------------------- + + // Force volume into range + if (Volume > 0 || Volume < (-100.0)) + Volume = 0.0; + + long iVolume = - (Volume / 100) * DSBVOLUME_MIN; + + + // -------------------------- convert pan from percent into +/- db * 100 ---------------------------- + + // Force Pan into range + if (Pan > 100.0 || Pan < (-100)) + Pan = 0; + + long iPan = (Pan / 100) * DSBPAN_RIGHT; + + + // ---------------------- if no filename, attempt to adjust existing sound --------------------- + + if (Buffer >= 1 && Buffer <= MAX_SOUND_BUFFERS && strlen (FileName) == 0) + { + Buffer--; // make zero-relative + + // can't if not there + if (m_pDirectSoundSecondaryBuffer [Buffer] == NULL) + return eBadParameter; + + // don't if not playing + DWORD iStatus; + if (FAILED (m_pDirectSoundSecondaryBuffer [Buffer]->GetStatus (&iStatus)) || + (iStatus & DSBSTATUS_PLAYING) == 0) + return eCannotPlaySound; + + // set requested panning + m_pDirectSoundSecondaryBuffer [Buffer]->SetPan (iPan); + // set requested volume + m_pDirectSoundSecondaryBuffer [Buffer]->SetVolume (iVolume); + // set requested looping + m_pDirectSoundSecondaryBuffer [Buffer]->Play( 0, 0, Loop ? DSBPLAY_LOOPING : 0); + + return eOK; + + } + + // no file name AND no buffer number? can't do much + if (strlen (FileName) < 2) // later I test the 1st and 2nd characters + return eBadParameter; + + // ------------------- we have filename, get on with it ----------------------------- + + // ---------------- if Buffer is zero, first try to find a free one ----------------- + + if (Buffer == 0) + { + int i; + for (i = 0; i < MAX_SOUND_BUFFERS; i++) + if (m_pDirectSoundSecondaryBuffer [i] == NULL) + { + Buffer = i + 1; + break; + } // end of found an unused slot + } // end of no buffer specifed + + + // no free buffers, but is there one that is not playing right now? + if (Buffer == 0) + { + int i; + for (i = 0; i < MAX_SOUND_BUFFERS; i++) + if (m_pDirectSoundSecondaryBuffer [i]) + { + DWORD iStatus; + if (SUCCEEDED (m_pDirectSoundSecondaryBuffer [i]->GetStatus (&iStatus)) && + (iStatus & DSBSTATUS_PLAYING) == 0) + { + Buffer = i + 1; // this one will do + break; + } + } // end of found a used slot + } // end of no buffer specifed + + // no free buffers? re-use buffer #1 + if (Buffer == 0) + Buffer = 1; + + // Make buffer zero-relative + Buffer--; + + // Buffer must be in range + if (Buffer < 0 || Buffer >= MAX_SOUND_BUFFERS) + return eBadParameter; + + // ------------------- we have a buffer now ------------------------------- + + // ---------- if not absolute path, use MUSHclient.exe / sounds / filename + + CString strName = FileName; + + strName.Replace ("/", "\\"); // convert forward to backslash + + // without a full pathname, assume in sounds directory under MUSHclient.exe + if (!( + isalpha ((unsigned char) strName [0]) && + strName [1] == ':' // eg. c: blah + ) && + strName [0] != '\\') // eg. \mydir\blah or \\server\blah + strName = ExtractDirectory (App.m_strMUSHclientFileName) + "sounds\\" + strName; + + if (strName.GetLength () > 127) + return eBadParameter; + + char sFilename [128]; + strcpy (sFilename, strName); // make not const + + // ---------- open multimedia file ---------------------------- + + HMMIO mmioWave ; + MMCKINFO mmckinfoParent, mmckinfoSubchunk ; + WAVEFORMATEX wfPCM ; + + // Open the wave data using the mm functions + mmioWave = mmioOpen(sFilename, NULL, MMIO_READ) ; + if ( !mmioWave ) + return eFileNotFound; + + // now that we know we have a file there, release the sound buffer if possible + + // buffer currently in use? release it + if (m_pDirectSoundSecondaryBuffer [Buffer]) + { + DWORD iStatus; + if (SUCCEEDED (m_pDirectSoundSecondaryBuffer [Buffer]->GetStatus (&iStatus)) && + (iStatus & DSBSTATUS_PLAYING)) + m_pDirectSoundSecondaryBuffer [Buffer]->Stop (); + + m_pDirectSoundSecondaryBuffer [Buffer]->Release (); + m_pDirectSoundSecondaryBuffer [Buffer] = NULL; + } + + // Descend to find a "WAVE" block, if this fails then the data is not + // WAV data. + mmckinfoParent.fccType = mmioFOURCC( 'W', 'A', 'V', 'E' ) ; + if ( mmioDescend( mmioWave, &mmckinfoParent, NULL, MMIO_FINDRIFF ) ) + { + mmioClose( mmioWave, 0 ) ; + return eCannotPlaySound ; + } + + // Descend again to the "fmt " block and retrieve the format information + mmckinfoSubchunk.ckid = mmioFOURCC( 'f', 'm', 't', ' ' ) ; + if ( mmioDescend( mmioWave, &mmckinfoSubchunk, &mmckinfoParent, + MMIO_FINDCHUNK ) ) + { + mmioClose( mmioWave, 0 ) ; + return eCannotPlaySound ; + } + + // This line actually reads the data from the "fmt " chunk, this data + // should be in the form of a WAVEFORMATEX structure + if ( mmioRead( mmioWave, (char *) &wfPCM, mmckinfoSubchunk.cksize ) == -1 ) + { + mmioClose( mmioWave, 0 ) ; + return eCannotPlaySound ; + } + + // Step out a layer... think of the mm functions as step in and out of + // hierarchies of "chunks" of information + mmioAscend( mmioWave, &mmckinfoSubchunk, 0 ) ; + + // Find the "data" subchunk + mmckinfoSubchunk.ckid = mmioFOURCC( 'd', 'a', 't', 'a' ) ; + if ( mmioDescend( mmioWave, &mmckinfoSubchunk, &mmckinfoParent, + MMIO_FINDCHUNK ) ) + { + mmioClose( mmioWave, 0 ) ; + return eCannotPlaySound ; + } + + HRESULT hr ; + LPBYTE lpvAudio1 ; + LPBYTE lpvAudio2 ; + DWORD dwWriteBytes1 ; + DWORD dwWriteBytes2 ; + DSBUFFERDESC bd ; + + // At this point we have succedded in finding the data for the WAV file so + // we need to create a DirectSoundBuffer + // Set up bd structure for a static secondary buffer. + bd.dwSize = sizeof( bd ) ; + bd.dwFlags = DSBCAPS_CTRLDEFAULT | DSBCAPS_STATIC ; + // Buffer size retrieved from the mmckinfo structure for the data + // portion of the wav + bd.dwBufferBytes = mmckinfoSubchunk.cksize ; + bd.dwReserved = 0 ; + bd.lpwfxFormat = &wfPCM ; + + // Create buffer. + if ( FAILED( App.m_pDirectSoundObject->CreateSoundBuffer( &bd, + &m_pDirectSoundSecondaryBuffer [Buffer], NULL ) ) ) + { + mmioClose( mmioWave, 0 ) ; + return eCannotPlaySound ; + } + + #define WRAP_UP_FAILED_SOUND \ + m_pDirectSoundSecondaryBuffer [Buffer]->Release (); \ + m_pDirectSoundSecondaryBuffer [Buffer] = NULL; \ + mmioClose( mmioWave, 0 ) ; \ + return eCannotPlaySound; + + // make copy to save a bit of typing + LPDIRECTSOUNDBUFFER lpdsBuffer = m_pDirectSoundSecondaryBuffer [Buffer]; + + // Lock the buffer for the DirectSoundBuffer object + hr = lpdsBuffer->Lock( 0, 0, (void **) &lpvAudio1, &dwWriteBytes1, + (void **) &lpvAudio2, &dwWriteBytes2, DSBLOCK_ENTIREBUFFER ) ; + if ( hr == DSERR_BUFFERLOST ) + { + // If the buffer was lost try restoring it and lock again + lpdsBuffer->Restore() ; + hr = lpdsBuffer->Lock( 0, 0, (void **) &lpvAudio1, &dwWriteBytes1, + (void **) &lpvAudio2, &dwWriteBytes2, DSBLOCK_ENTIREBUFFER ) ; + } + + if ( FAILED( hr ) ) + { + WRAP_UP_FAILED_SOUND; // lock failed + } + + if ( dwWriteBytes1 != mmckinfoSubchunk.cksize ) + { + lpdsBuffer->Unlock( (void *) lpvAudio1, dwWriteBytes1, + (void *) lpvAudio2, dwWriteBytes2 ); + WRAP_UP_FAILED_SOUND; // wrong number of bytes + } + + // Read the data directly into the locked buffer + if ( mmioRead( mmioWave, ( char* ) lpvAudio1, mmckinfoSubchunk.cksize ) + == -1 ) + { + lpdsBuffer->Unlock( (void *) lpvAudio1, dwWriteBytes1, + (void *) lpvAudio2, dwWriteBytes2 ); + WRAP_UP_FAILED_SOUND; // couldn't read + } + + // Unlock the buffer + if ( FAILED( lpdsBuffer->Unlock( (void *) lpvAudio1, dwWriteBytes1, + (void *) lpvAudio2, dwWriteBytes2 ) ) ) + { + WRAP_UP_FAILED_SOUND; // couldn't unlock + } + + // Close the multimedia object + mmioClose( mmioWave, 0 ) ; + + // set requested panning + lpdsBuffer->SetPan (iPan); + // set requested volume + lpdsBuffer->SetVolume (iVolume); + + if (FAILED (lpdsBuffer->Play( 0, 0, Loop ? DSBPLAY_LOOPING : 0) )) + { + m_pDirectSoundSecondaryBuffer [Buffer]->Release (); + m_pDirectSoundSecondaryBuffer [Buffer] = NULL; + return eCannotPlaySound; + } + + return eOK; + } + + // stop the sound in the numbered Buffer from playing + // if Buffer is zero, stop all sounds + long CMUSHclientDoc::StopSound(short Buffer) + { + // buffer of zero means all + if (Buffer == 0) + { + // stop sounds playing, release sound buffers + int i; + for (i = 0; i < MAX_SOUND_BUFFERS; i++) + if (m_pDirectSoundSecondaryBuffer [i]) + { + DWORD iStatus; + if (SUCCEEDED (m_pDirectSoundSecondaryBuffer [i]->GetStatus (&iStatus)) && + (iStatus & DSBSTATUS_PLAYING)) + m_pDirectSoundSecondaryBuffer [i]->Stop (); + + m_pDirectSoundSecondaryBuffer [i]->Release (); + m_pDirectSoundSecondaryBuffer [i] = NULL; + + } + return eOK; + } + + // Make buffer zero-relative + Buffer--; + + // Buffer must be in range + if (Buffer < 0 || Buffer >= MAX_SOUND_BUFFERS) + return eBadParameter; + + // buffer currently in use? release it + if (m_pDirectSoundSecondaryBuffer [Buffer]) + { + DWORD iStatus; + if (SUCCEEDED (m_pDirectSoundSecondaryBuffer [Buffer]->GetStatus (&iStatus)) && + (iStatus & DSBSTATUS_PLAYING)) + m_pDirectSoundSecondaryBuffer [Buffer]->Stop (); + + m_pDirectSoundSecondaryBuffer [Buffer]->Release (); + m_pDirectSoundSecondaryBuffer [Buffer] = NULL; + } + + return eOK; + } + + // set the status of the sound buffer + // -1 means buffer number out of range (1 to MAX_SOUND_BUFFERS) + // -2 means that the buffer is free + // -3 means sound system is not initialized (eg. Windows NT) + // 0 means the sound is NOT playing + // 1 means the sound is playing but not looping + // 2 means the sound is playing AND looping + + long CMUSHclientDoc::GetSoundStatus(short Buffer) + { + + // no sound object? can't do it + if (!App.m_pDirectSoundObject || !App.m_pDirectSoundPrimaryBuffer) + return -3; + + // Make buffer zero-relative + Buffer--; + + // Buffer must be in range + if (Buffer < 0 || Buffer >= MAX_SOUND_BUFFERS) + return -1; + + if (!m_pDirectSoundSecondaryBuffer [Buffer]) + return -2; + + DWORD iStatus = 0; + + if (FAILED (m_pDirectSoundSecondaryBuffer [Buffer]->GetStatus (&iStatus))) + return 0; // can't get status, presume no sound + + if (iStatus & DSBSTATUS_PLAYING) + return 1; + + if (iStatus & DSBSTATUS_LOOPING ) + return 2; + + return 0; // not playing + } + + long CMUSHclientDoc::SetCommandWindowHeight(short Height) + { + + if (Height < 0) + return eBadParameter; + + CChildFrame * pFrame; + + if (m_pActiveCommandView) + pFrame = m_pActiveCommandView->m_owner_frame; + else + pFrame = m_pActiveOutputView->m_owner_frame; + + CRect rectInside; + pFrame->m_wndSplitter.GetClientRect(rectInside); + rectInside.InflateRect(-9, -9); // allow for borders and splitter bar + + // we have to root around like this, because recalclayout lays out the top + // view first, and allocates the rest (possibly nothing) to the bottom view. + // I don't really want this, the important thing is that you can see where + // you are going to type. Thus I work out how much the maxmimum top view + // can be. + + int iRoom = rectInside.bottom - rectInside.top - Height + + 7; // 7 pixels for the splitter bar + + int cyCurTop = iRoom; + + if (cyCurTop < 20) + return eBadParameter; // too small, want to see a line at least + + // set the info for the top view + pFrame->m_wndSplitter.SetRowInfo (OUTPUT_PANE, cyCurTop, 20); + + // set the info for the bottom view + pFrame->m_wndSplitter.SetRowInfo (COMMAND_PANE, Height, 9); + + // recalculate it all + pFrame->m_wndSplitter.RecalcLayout (); + + + return eOK; } Index: mushclient.clw =================================================================== RCS file: /cvs/mushclient/mushclient.clw,v retrieving revision 1.339 diff -c -r1.339 mushclient.clw *** mushclient.clw 11 Jun 2008 01:13:04 -0000 1.339 --- mushclient.clw 21 Jun 2008 05:53:29 -0000 *************** *** 480,486 **** ImplementationFile=mainfrm.cpp Filter=T VirtualFilter=fWC ! LastObject=ID_GAME_FUNCTIONSLIST [CLS:CMapCommentDlg] Type=0 --- 480,486 ---- ImplementationFile=mainfrm.cpp Filter=T VirtualFilter=fWC ! LastObject=CMainFrame [CLS:CMapCommentDlg] Type=0 *************** *** 540,557 **** --- 540,560 ---- BaseClass=CDialog HeaderFile=MXPscriptRoutinesDlg.h ImplementationFile=MXPscriptRoutinesDlg.cpp + LastObject=CMXPscriptRoutinesDlg [CLS:CMySplitterWnd] Type=0 BaseClass=CSplitterWnd HeaderFile=MySplitterWnd.h ImplementationFile=MySplitterWnd.cpp + LastObject=CMySplitterWnd [CLS:CPasswordDialog] Type=0 BaseClass=CDialog HeaderFile=password.h ImplementationFile=password.cpp + LastObject=CPasswordDialog [CLS:CPluginsDlg] Type=0 *************** *** 560,566 **** ImplementationFile=PluginsDlg.cpp Filter=D VirtualFilter=dWC ! LastObject=IDC_ENABLE [CLS:CPluginWizardPage1] Type=0 --- 563,569 ---- ImplementationFile=PluginsDlg.cpp Filter=D VirtualFilter=dWC ! LastObject=CPluginsDlg [CLS:CPluginWizardPage1] Type=0 *************** *** 576,623 **** --- 579,634 ---- BaseClass=CPropertyPage HeaderFile=PluginWizard.h ImplementationFile=PluginWizard.cpp + LastObject=CPluginWizardPage2 [CLS:CPluginWizardPage3] Type=0 BaseClass=CPropertyPage HeaderFile=PluginWizard.h ImplementationFile=PluginWizard.cpp + LastObject=CPluginWizardPage3 [CLS:CPluginWizardPage4] Type=0 BaseClass=CPropertyPage HeaderFile=PluginWizard.h ImplementationFile=PluginWizard.cpp + LastObject=CPluginWizardPage4 [CLS:CPluginWizardPage5] Type=0 BaseClass=CPropertyPage HeaderFile=PluginWizard.h ImplementationFile=PluginWizard.cpp + LastObject=CPluginWizardPage5 [CLS:CPluginWizardPage6] Type=0 BaseClass=CPropertyPage HeaderFile=PluginWizard.h ImplementationFile=PluginWizard.cpp + LastObject=CPluginWizardPage6 [CLS:CPluginWizardPage7] Type=0 BaseClass=CPropertyPage HeaderFile=PluginWizard.h ImplementationFile=PluginWizard.cpp + LastObject=CPluginWizardPage7 [CLS:CPluginWizardPage8] Type=0 BaseClass=CPropertyPage HeaderFile=PluginWizard.h ImplementationFile=PluginWizard.cpp + LastObject=CPluginWizardPage8 [CLS:CPluginWizardSheet] Type=0 BaseClass=CPropertySheet HeaderFile=PluginWizardSheet.h ImplementationFile=PluginWizardSheet.cpp + LastObject=CPluginWizardSheet [CLS:CPrefsP1] Type=0 *************** *** 626,631 **** --- 637,643 ---- ImplementationFile=prefspropertypages.cpp Filter=D VirtualFilter=idWC + LastObject=CPrefsP1 [CLS:CPrefsP2] Type=0 *************** *** 695,700 **** --- 707,713 ---- BaseClass=CPropertyPage HeaderFile=prefspropertypages.h ImplementationFile=prefspropertypages.cpp + LastObject=CPrefsP10 [CLS:CPrefsP11] Type=0 *************** *** 789,794 **** --- 802,808 ---- BaseClass=CPropertyPage HeaderFile=prefspropertypages.h ImplementationFile=prefspropertypages.cpp + LastObject=CPrefsP0 [CLS:CPrefsP22] Type=0 *************** *** 1210,1216 **** ImplementationFile=PaneView.cpp BaseClass=CView Filter=C ! LastObject=ID_TEST_START VirtualFilter=VWC [CLS:CPaneChildWnd] --- 1224,1230 ---- ImplementationFile=PaneView.cpp BaseClass=CView Filter=C ! LastObject=CPaneView VirtualFilter=VWC [CLS:CPaneChildWnd] Index: mushclient.cnt =================================================================== RCS file: /cvs/mushclient/mushclient.cnt,v retrieving revision 1.31 retrieving revision 1.34 diff -c -r1.31 -r1.34 *** mushclient.cnt 11 Jun 2008 01:13:04 -0000 1.31 --- mushclient.cnt 21 Jun 2008 04:43:53 -0000 1.34 *************** *** 338,343 **** --- 338,344 ---- 3 GetSelectionStartColumn=FNC_GetSelectionStartColumn 3 GetSelectionStartLine=FNC_GetSelectionStartLine 3 GetSentBytes=FNC_GetSentBytes + 3 GetSoundStatus=FNC_GetSoundStatus 3 GetStyleInfo=FNC_GetStyleInfo 3 GetSysColor=FNC_GetSysColor 3 GetSystemMetrics=FNC_GetSystemMetrics *************** *** 411,416 **** --- 412,418 ---- 3 PasteCommand=FNC_PasteCommand 3 Pause=FNC_Pause 3 PickColour=FNC_PickColour + 3 PlaySound=FNC_PlaySound 3 PluginSupports=FNC_PluginSupports 3 PushCommand=FNC_PushCommand 3 Queue=FNC_Queue *************** *** 445,450 **** --- 447,453 ---- 3 SetChatOption=FNC_SetChatOption 3 SetClipboard=FNC_SetClipboard 3 SetCommand=FNC_SetCommand + 3 SetCommandWindowHeight=FNC_SetCommandWindowHeight 3 SetCustomColourName=FNC_SetCustomColourName 3 SetEntity=FNC_SetEntity 3 SetInputFont=FNC_SetInputFont *************** *** 464,469 **** --- 467,473 ---- 3 SpellCheckCommand=FNC_SpellCheckCommand 3 SpellCheckDlg=FNC_SpellCheckDlg 3 StripANSI=FNC_StripANSI + 3 StopSound=FNC_StopSound 3 Tell=FNC_Tell 3 Trace=FNC_Trace 3 TraceOut=FNC_TraceOut Index: mushclient.hlp =================================================================== RCS file: /cvs/mushclient/mushclient.hlp,v retrieving revision 1.93 retrieving revision 1.94 diff -c -r1.93 -r1.94 Binary files /tmp/cvsdOraG6 and /tmp/cvscdgBZz differ Index: mushclient.odl =================================================================== RCS file: /cvs/mushclient/mushclient.odl,v retrieving revision 1.108 retrieving revision 1.113 diff -c -r1.108 -r1.113 *** mushclient.odl 11 Jun 2008 01:13:04 -0000 1.108 --- mushclient.odl 21 Jun 2008 04:44:03 -0000 1.113 *************** *** 70,83 **** [id(44)] long SetCommand(BSTR Message); [id(45)] BSTR GetNotes(); [id(46)] void SetNotes(BSTR Message); ! [id(319), propget] long NormalColour(short WhichColour); ! [id(319), propput] void NormalColour(short WhichColour, long nNewValue); ! [id(320), propget] long BoldColour(short WhichColour); ! [id(320), propput] void BoldColour(short WhichColour, long nNewValue); ! [id(321), propget] long CustomColourText(short WhichColour); ! [id(321), propput] void CustomColourText(short WhichColour, long nNewValue); ! [id(322), propget] long CustomColourBackground(short WhichColour); ! [id(322), propput] void CustomColourBackground(short WhichColour, long nNewValue); [id(47)] void Redraw(); [id(48)] long ResetTimer(BSTR TimerName); [id(49)] void SetOutputFont(BSTR FontName, short PointSize); --- 70,83 ---- [id(44)] long SetCommand(BSTR Message); [id(45)] BSTR GetNotes(); [id(46)] void SetNotes(BSTR Message); ! [id(323), propget] long NormalColour(short WhichColour); ! [id(323), propput] void NormalColour(short WhichColour, long nNewValue); ! [id(324), propget] long BoldColour(short WhichColour); ! [id(324), propput] void BoldColour(short WhichColour, long nNewValue); ! [id(325), propget] long CustomColourText(short WhichColour); ! [id(325), propput] void CustomColourText(short WhichColour, long nNewValue); ! [id(326), propget] long CustomColourBackground(short WhichColour); ! [id(326), propput] void CustomColourBackground(short WhichColour, long nNewValue); [id(47)] void Redraw(); [id(48)] long ResetTimer(BSTR TimerName); [id(49)] void SetOutputFont(BSTR FontName, short PointSize); *************** *** 350,355 **** --- 350,359 ---- [id(316)] VARIANT GetPluginAliasOption(BSTR PluginID, BSTR AliasName, BSTR OptionName); [id(317)] VARIANT GetPluginTimerOption(BSTR PluginID, BSTR TimerName, BSTR OptionName); [id(318)] long AcceleratorTo(BSTR Key, BSTR Send, short SendTo); + [id(319)] long StopSound(short Buffer); + [id(320)] long GetSoundStatus(short Buffer); + [id(321)] long PlaySound(short Buffer, BSTR FileName, BOOL Loop, double Volume, double Pan); + [id(322)] long SetCommandWindowHeight(short Height); //}}AFX_ODL_METHOD }; Index: mushview.cpp =================================================================== RCS file: /cvs/mushclient/mushview.cpp,v retrieving revision 1.89 retrieving revision 1.90 diff -c -r1.89 -r1.90 *** mushview.cpp 11 Jun 2008 01:13:04 -0000 1.89 --- mushview.cpp 19 Jun 2008 07:15:55 -0000 1.90 *************** *** 2601,2616 **** { if (pDoc->m_ScriptEngine) { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! pDoc->ExecuteScript (pDoc->m_dispidWorldGetFocus, ! pDoc->m_strWorldGetFocus, ! eWorldAction, ! "world get focus", ! "getting focus", ! params, ! nInvocationCount); } // end of executing get focus script if (!pDoc->m_bWorldClosing) --- 2601,2620 ---- { if (pDoc->m_ScriptEngine) { ! if (pDoc->SeeIfHandlerCanExecute (pDoc->m_strWorldGetFocus)) ! { ! ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! pDoc->ExecuteScript (pDoc->m_dispidWorldGetFocus, ! pDoc->m_strWorldGetFocus, ! eWorldAction, ! "world get focus", ! "getting focus", ! params, ! nInvocationCount); ! } } // end of executing get focus script if (!pDoc->m_bWorldClosing) *************** *** 2651,2666 **** { if (pDoc->m_ScriptEngine) { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! pDoc->ExecuteScript (pDoc->m_dispidWorldLoseFocus, ! pDoc->m_strWorldLoseFocus, ! eWorldAction, ! "world lose focus", ! "losing focus", ! params, ! nInvocationCount); } // end of executing lose focus script if (!pDoc->m_bWorldClosing) --- 2655,2673 ---- { if (pDoc->m_ScriptEngine) { ! if (pDoc->SeeIfHandlerCanExecute (pDoc->m_strWorldLoseFocus)) ! { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! pDoc->ExecuteScript (pDoc->m_dispidWorldLoseFocus, ! pDoc->m_strWorldLoseFocus, ! eWorldAction, ! "world lose focus", ! "losing focus", ! params, ! nInvocationCount); ! } } // end of executing lose focus script if (!pDoc->m_bWorldClosing) Index: mxpOnOff.cpp =================================================================== RCS file: /cvs/mushclient/mxpOnOff.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -c -r1.9 -r1.10 *** mxpOnOff.cpp 13 Jun 2007 17:57:28 -0000 1.9 --- mxpOnOff.cpp 19 Jun 2008 07:15:55 -0000 1.10 *************** *** 67,82 **** // execute "close" script if (m_dispidOnMXP_Stop != DISPID_UNKNOWN) { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! ! ExecuteScript (m_dispidOnMXP_Stop, ! m_strOnMXP_Stop, ! eWorldAction, ! "MXP shutdown", ! "stopping MXP", ! params, ! nInvocationCount); } // end of executing close script // tell each plugin we have connected --- 67,85 ---- // execute "close" script if (m_dispidOnMXP_Stop != DISPID_UNKNOWN) { ! if (SeeIfHandlerCanExecute (m_strOnMXP_Stop)) ! { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! ! ExecuteScript (m_dispidOnMXP_Stop, ! m_strOnMXP_Stop, ! eWorldAction, ! "MXP shutdown", ! "stopping MXP", ! params, ! nInvocationCount); ! } } // end of executing close script // tell each plugin we have connected *************** *** 109,124 **** // execute "open" script if (m_dispidOnMXP_Start != DISPID_UNKNOWN) { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! ExecuteScript (m_dispidOnMXP_Start, ! m_strOnMXP_Start, ! eWorldAction, ! "MXP startup", ! "starting MXP", ! params, ! nInvocationCount); } // end of executing open script // tell each plugin MXP is starting --- 112,131 ---- // execute "open" script if (m_dispidOnMXP_Start != DISPID_UNKNOWN) { ! if (SeeIfHandlerCanExecute (m_strOnMXP_Start)) ! { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! ! ExecuteScript (m_dispidOnMXP_Start, ! m_strOnMXP_Start, ! eWorldAction, ! "MXP startup", ! "starting MXP", ! params, ! nInvocationCount); ! } } // end of executing open script // tell each plugin MXP is starting Index: prefspropertypages.cpp =================================================================== RCS file: /cvs/mushclient/prefspropertypages.cpp,v retrieving revision 1.106 retrieving revision 1.107 diff -c -r1.106 -r1.107 *** prefspropertypages.cpp 3 Jun 2008 03:50:03 -0000 1.106 --- prefspropertypages.cpp 21 Jun 2008 04:44:03 -0000 1.107 *************** *** 6146,6151 **** --- 6146,6158 ---- if (iResult) break; case eColumnLabel: iResult = timer1->strLabel.CompareNoCase (timer2->strLabel); break; + case eColumnNext: + if (timer1->tFireTime < timer2->tFireTime) + iResult = -1; + else + if (timer1->tFireTime > timer2->tFireTime) + iResult = 1; + break; default: iResult = 0; } // end of switch *************** *** 6267,6272 **** --- 6274,6283 ---- Replace (timer_item->strContents, ENDLINE, "\\n", true)); m_ctlTimerList.SetItemText (nItem, eColumnLabel, timer_item->strLabel); m_ctlTimerList.SetItemText (nItem, eColumnGroup, timer_item->strGroup); + m_ctlTimerList.SetItemText (nItem, eColumnNext, CFormat ("%02i:%02i:%02i", + timer_item->tFireTime.GetHour (), + timer_item->tFireTime.GetMinute (), + timer_item->tFireTime.GetSecond ())); return nItem; Index: prefspropertypages.h =================================================================== RCS file: /cvs/mushclient/prefspropertypages.h,v retrieving revision 1.51 retrieving revision 1.52 diff -c -r1.51 -r1.52 *** prefspropertypages.h 26 Apr 2007 00:28:56 -0000 1.51 --- prefspropertypages.h 21 Jun 2008 04:44:03 -0000 1.52 *************** *** 1273,1278 **** --- 1273,1279 ---- eColumnContents, eColumnLabel, eColumnGroup, + eColumnNext, eColumnCount // this must be last! }; Index: scripting.cpp =================================================================== RCS file: /cvs/mushclient/scripting.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -c -r1.32 -r1.33 *** scripting.cpp 18 Mar 2008 06:02:24 -0000 1.32 --- scripting.cpp 19 Jun 2008 07:15:55 -0000 1.33 *************** *** 103,143 **** { // find entry point for world open, close, connect, disconnect ! m_dispidWorldOpen = GetProcedureDispid (m_strWorldOpen, "world open", "", strErrorMessage); ! m_dispidWorldClose = GetProcedureDispid (m_strWorldClose, "world close", "", strErrorMessage); ! m_dispidWorldSave = GetProcedureDispid (m_strWorldSave, "world save", "", strErrorMessage); ! m_dispidWorldConnect = GetProcedureDispid (m_strWorldConnect, "world connect", "", strErrorMessage); ! m_dispidWorldDisconnect = GetProcedureDispid (m_strWorldDisconnect, "world disconnect", "", strErrorMessage); ! m_dispidWorldGetFocus = GetProcedureDispid (m_strWorldGetFocus, "world get focus", "", strErrorMessage); ! m_dispidWorldLoseFocus = GetProcedureDispid (m_strWorldLoseFocus, "world lose focus", "", strErrorMessage); // MXP ones ! m_dispidOnMXP_Start = GetProcedureDispid (m_strOnMXP_Start, "MXP startup", "", strErrorMessage); ! m_dispidOnMXP_Stop = GetProcedureDispid (m_strOnMXP_Stop, "MXP shutdown", "", strErrorMessage); --- 103,143 ---- { // find entry point for world open, close, connect, disconnect ! m_dispidWorldOpen = GetProcedureDispidHelper (m_strWorldOpen, "world open", "", strErrorMessage); ! m_dispidWorldClose = GetProcedureDispidHelper (m_strWorldClose, "world close", "", strErrorMessage); ! m_dispidWorldSave = GetProcedureDispidHelper (m_strWorldSave, "world save", "", strErrorMessage); ! m_dispidWorldConnect = GetProcedureDispidHelper (m_strWorldConnect, "world connect", "", strErrorMessage); ! m_dispidWorldDisconnect = GetProcedureDispidHelper (m_strWorldDisconnect, "world disconnect", "", strErrorMessage); ! m_dispidWorldGetFocus = GetProcedureDispidHelper (m_strWorldGetFocus, "world get focus", "", strErrorMessage); ! m_dispidWorldLoseFocus = GetProcedureDispidHelper (m_strWorldLoseFocus, "world lose focus", "", strErrorMessage); // MXP ones ! m_dispidOnMXP_Start = GetProcedureDispidHelper (m_strOnMXP_Start, "MXP startup", "", strErrorMessage); ! m_dispidOnMXP_Stop = GetProcedureDispidHelper (m_strOnMXP_Stop, "MXP shutdown", "", strErrorMessage); *************** *** 451,456 **** --- 451,473 ---- return DISPID_UNKNOWN; } // end of CMUSHclientDoc::GetProcedureDispid + + DISPID CMUSHclientDoc::GetProcedureDispidHelper (const CString & strName, + const CString & strType, + const CString & strLabel, + CString & strErrorMessage) + { + // !name will be treated as "send to execute" + if (!strName.IsEmpty () && strName [0] == '!') + return DISPID_UNKNOWN; + + // otherwise normal processing + return GetProcedureDispid (strName, + strType, + strLabel, + strErrorMessage); + + } bool CMUSHclientDoc::ExecuteScript (DISPID & dispid, // dispatch ID, will be zeroed on an error LPCTSTR szProcedure, // eg. ON_TRIGGER_XYZ Index: sendvw.cpp =================================================================== RCS file: /cvs/mushclient/sendvw.cpp,v retrieving revision 1.83 retrieving revision 1.84 diff -c -r1.83 -r1.84 *** sendvw.cpp 11 Jun 2008 01:13:04 -0000 1.83 --- sendvw.cpp 19 Jun 2008 07:15:55 -0000 1.84 *************** *** 2026,2031 **** --- 2026,2033 ---- if (pDoc->m_bLowerCaseTabCompletion) sReplacement.MakeLower (); + sReplacement += " "; // add a space + CPlugin * pSavedPlugin = pDoc->m_CurrentPlugin; // tell each plugin what we are doing Index: worldsock.cpp =================================================================== RCS file: /cvs/mushclient/worldsock.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -c -r1.8 -r1.9 *** worldsock.cpp 12 Jun 2007 04:02:02 -0000 1.8 --- worldsock.cpp 19 Jun 2008 07:15:55 -0000 1.9 *************** *** 80,86 **** TRACE1 ("CWorldSocket::OnClose, error code %i\n", nErrorCode); ! m_pDoc->m_iConnectPhase = eConnectNotConnected; m_pDoc->UpdateAllViews (NULL); --- 80,86 ---- TRACE1 ("CWorldSocket::OnClose, error code %i\n", nErrorCode); ! m_pDoc->m_iConnectPhase = eConnectDisconnecting; m_pDoc->UpdateAllViews (NULL); *************** *** 94,109 **** // execute "disconnect" script if (m_pDoc->m_ScriptEngine) { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! ! m_pDoc->ExecuteScript (m_pDoc->m_dispidWorldDisconnect, ! m_pDoc->m_strWorldDisconnect, ! eWorldAction, ! "world disconnect", ! "disconnecting from world", ! params, ! nInvocationCount); } // end of executing disconnect script // tell each plugin we have disconnected --- 94,112 ---- // execute "disconnect" script if (m_pDoc->m_ScriptEngine) { ! if (m_pDoc->SeeIfHandlerCanExecute (m_pDoc->m_strWorldDisconnect)) ! { ! DISPPARAMS params = { NULL, NULL, 0, 0 }; ! long nInvocationCount = 0; ! ! m_pDoc->ExecuteScript (m_pDoc->m_dispidWorldDisconnect, ! m_pDoc->m_strWorldDisconnect, ! eWorldAction, ! "world disconnect", ! "disconnecting from world", ! params, ! nInvocationCount); ! } } // end of executing disconnect script // tell each plugin we have disconnected *************** *** 163,168 **** --- 166,172 ---- } else Frame.SetStatusMessage (str); + m_pDoc->m_iConnectPhase = eConnectNotConnected; } // end of OnClose Index: install/mushclient.nsi =================================================================== RCS file: /cvs/mushclient/install/mushclient.nsi,v retrieving revision 1.58 retrieving revision 1.61 diff -c -r1.58 -r1.61 *** install/mushclient.nsi 11 Jun 2008 03:45:17 -0000 1.58 --- install/mushclient.nsi 21 Jun 2008 05:53:01 -0000 1.61 *************** *** 94,100 **** File "..\tips.txt" File "..\Example_Filters.lua" File "..\names.txt" ! File /oname="license.txt" "..\..\mushclient_resources\text\agreement.txt" ; Write the installation path into the registry WriteRegStr HKCU "Software\Gammon Software Solutions\MUSHclient\General Options" "InstallDir" $INSTDIR --- 94,100 ---- File "..\tips.txt" File "..\Example_Filters.lua" File "..\names.txt" ! File /oname=license.txt "..\..\mushclient_resources\text\agreement.txt" ; Write the installation path into the registry WriteRegStr HKCU "Software\Gammon Software Solutions\MUSHclient\General Options" "InstallDir" $INSTDIR *************** *** 155,161 **** File "..\locale_notes.txt" SetOutPath $INSTDIR ! ; ; directory for name generation files ; --- 155,166 ---- File "..\locale_notes.txt" SetOutPath $INSTDIR ! ! ; ! ; put sounds here, hint hint ! ; ! CreateDirectory "$INSTDIR\sounds" ! ; ; directory for name generation files ; *************** *** 173,179 **** File "..\names\Felana.nam" File "..\names\GALLER.NAM" File "..\names\HOBER.NAM" - File "..\names\MALL.NAM" File "..\names\ORC1.NAM" File "..\names\ORC2.NAM" File "..\names\albion1.nam" --- 178,183 ---- *************** *** 299,304 **** --- 303,309 ---- File "..\lua\copytable.lua" File "..\lua\strict.lua" File "..\lua\commas.lua" + File "..\lua\getworld.lua" ; Set output path to the scripts subdirectory. SetOutPath $INSTDIR\scripts *************** *** 317,327 **** Section "Plugins" ; Which section type it is in SectionIn 1 2 ; typical, full ! ! ReadRegStr $1 HKCU "Software\Gammon Software Solutions\MUSHclient\Global prefs" "PluginsDirectory" ! ! ; Set output path to the installation subdirectory. ! SetOutPath $1 ; Put files there File "..\plugins\constants.vbs" --- 322,329 ---- Section "Plugins" ; Which section type it is in SectionIn 1 2 ; typical, full ! ! SetOutPath $INSTDIR\worlds\plugins ; Put files there File "..\plugins\constants.vbs" *************** *** 429,435 **** Delete "$INSTDIR\lua\copytable.lua" Delete "$INSTDIR\lua\strict.lua" Delete "$INSTDIR\lua\commas.lua" ! ; spell checker stuff Delete "$INSTDIR\spellchecker.lua" Delete "$INSTDIR\spell\english-words.10" --- 431,438 ---- Delete "$INSTDIR\lua\copytable.lua" Delete "$INSTDIR\lua\strict.lua" Delete "$INSTDIR\lua\commas.lua" ! Delete "$INSTDIR\lua\getworld.lua" ! ; spell checker stuff Delete "$INSTDIR\spellchecker.lua" Delete "$INSTDIR\spell\english-words.10" *************** *** 517,523 **** Delete "$INSTDIR\names\Felana.nam" Delete "$INSTDIR\names\GALLER.NAM" Delete "$INSTDIR\names\HOBER.NAM" - Delete "$INSTDIR\names\MALL.NAM" Delete "$INSTDIR\names\ORC1.NAM" Delete "$INSTDIR\names\ORC2.NAM" Delete "$INSTDIR\names\albion1.nam" --- 520,525 ---- Index: install/readme.txt =================================================================== RCS file: /cvs/mushclient/install/readme.txt,v retrieving revision 1.166 retrieving revision 1.168 diff -c -r1.166 -r1.168 *** install/readme.txt 11 Jun 2008 01:13:04 -0000 1.166 --- install/readme.txt 21 Jun 2008 04:44:03 -0000 1.168 *************** *** 1,7 **** ! MUSHclient version 4.27 ======================= ! Wednesday, 11th June 2008 Author: Nick Gammon Web support: http://www.gammon.com.au/forum/ --- 1,7 ---- ! MUSHclient version 4.28 ======================= ! Saturday, 21st June 2008 Author: Nick Gammon Web support: http://www.gammon.com.au/forum/ Index: lua/wait.lua =================================================================== RCS file: /cvs/mushclient/lua/wait.lua,v retrieving revision 1.3 retrieving revision 1.4 diff -c -r1.3 -r1.4 *** lua/wait.lua 8 Sep 2006 00:57:53 -0000 1.3 --- lua/wait.lua 20 Jun 2008 05:44:22 -0000 1.4 *************** *** 44,50 **** local thread = threads [name] if thread then threads [name] = nil ! assert (coroutine.resume (thread)) end -- if end -- function timer_resume --- 44,55 ---- local thread = threads [name] if thread then threads [name] = nil ! local ok, err = coroutine.resume (thread) ! if not ok then ! ColourNote ("deeppink", "black", "Error raised in timer function (in wait module).") ! ColourNote ("darkorange", "black", debug.traceback (thread)) ! error (err) ! end -- if end -- if end -- function timer_resume *************** *** 57,63 **** local thread = threads [name] if thread then threads [name] = nil ! assert (coroutine.resume (thread, line, wildcards, styles)) end -- if end -- function trigger_resume --- 62,73 ---- local thread = threads [name] if thread then threads [name] = nil ! local ok, err = coroutine.resume (thread, line, wildcards, styles) ! if not ok then ! ColourNote ("deeppink", "black", "Error raised in trigger function (in wait module)") ! ColourNote ("darkorange", "black", debug.traceback (thread)) ! error (err) ! end -- if end -- if end -- function trigger_resume *************** *** 142,145 **** assert (GetOption ("enable_timers") == 1, "Timers not enabled") assert (GetOption ("enable_triggers") == 1, "Triggers not enabled") coroutine.wrap (f) () -- make coroutine, resume it ! end -- make \ No newline at end of file --- 152,155 ---- assert (GetOption ("enable_timers") == 1, "Timers not enabled") assert (GetOption ("enable_triggers") == 1, "Triggers not enabled") coroutine.wrap (f) () -- make coroutine, resume it ! end -- make