mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-21 04:39:45 +00:00
Change all CRLF-text files to LF-text files
to match H'uru for patching
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -1,46 +1,46 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifdef PLASMA_CCR_RELEASE
|
||||
#error Adjust this to where the real pfCCRConsoleCommands.cpp lives and submit a pull request!
|
||||
#include "pfCCRConsoleCommandsReal.cpp"
|
||||
#endif // PLASMA_CCR_RELEASE
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifdef PLASMA_CCR_RELEASE
|
||||
#error Adjust this to where the real pfCCRConsoleCommands.cpp lives and submit a pull request!
|
||||
#include "pfCCRConsoleCommandsReal.cpp"
|
||||
#endif // PLASMA_CCR_RELEASE
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,165 +1,165 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfConsole Header //
|
||||
// //
|
||||
// 9.21.2001 mcn - Added pfLogDisplays. These are classes that represent //
|
||||
// a scrolling buffer, much like the console, for on- //
|
||||
// screen display of error logs and the such. Currently //
|
||||
// managed by the console, but hopefully once we have //
|
||||
// a general manager for dialogs/menus (debug or //
|
||||
// otherwise), that manager will take the displays over. //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _pfConsole_h
|
||||
#define _pfConsole_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "../pnKeyedObject/hsKeyedObject.h"
|
||||
|
||||
|
||||
class plPipeline;
|
||||
|
||||
//// Class Definition ////////////////////////////////////////////////////////
|
||||
|
||||
class pfConsoleEngine;
|
||||
class plKeyEventMsg;
|
||||
class pfConsoleInputInterface;
|
||||
|
||||
class pfConsole : public hsKeyedObject
|
||||
{
|
||||
friend class pfConsoleInputInterface;
|
||||
|
||||
protected:
|
||||
|
||||
enum Konstants
|
||||
{
|
||||
kNumHistoryItems = 16,
|
||||
kModeHidden = 0,
|
||||
kModeSingleLine = 1,
|
||||
kModeFull = 2,
|
||||
kEffectDivisions = 1000,
|
||||
kMaxCharsWide = 80,
|
||||
kHelpDelay = 32,
|
||||
kCursorBlinkRate = 16,
|
||||
kMsgHintTimeout = 64,
|
||||
kWorkingLineSize = 256
|
||||
};
|
||||
|
||||
|
||||
UInt32 fNumDisplayLines;
|
||||
|
||||
Int32 fEffectCounter;
|
||||
float fLastTime;
|
||||
UInt32 fHelpTimer;
|
||||
char fLastHelpMsg[ kWorkingLineSize ];
|
||||
UInt8 fMode; // 0 - invisible, 1 - single line, 2 - full
|
||||
hsBool fInited, fHelpMode, fPythonMode, fPythonFirstTime, fFXEnabled;
|
||||
UInt32 fPythonMultiLines;
|
||||
short fCursorTicks;
|
||||
UInt32 fMsgTimeoutTimer;
|
||||
|
||||
char fHistory[ kNumHistoryItems ][ kMaxCharsWide ];
|
||||
UInt32 fHistoryCursor, fHistoryRecallCursor;
|
||||
char *fDisplayBuffer;
|
||||
char fWorkingLine[ kWorkingLineSize ];
|
||||
UInt32 fWorkingCursor;
|
||||
|
||||
pfConsoleInputInterface *fInputInterface;
|
||||
|
||||
pfConsoleEngine *fEngine;
|
||||
|
||||
void IHandleKey( plKeyEventMsg *msg );
|
||||
char IKeyEventToChar( plKeyEventMsg *msg );
|
||||
|
||||
static UInt32 fConsoleTextColor;
|
||||
static pfConsole *fTheConsole;
|
||||
static void _cdecl IAddLineCallback( const char *string );
|
||||
|
||||
static plPipeline *fPipeline;
|
||||
|
||||
void IAddLine( const char *string, short leftMargin = 0 );
|
||||
void IAddParagraph( const char *string, short margin = 0 );
|
||||
void IClear( void );
|
||||
|
||||
void ISetMode( UInt8 mode );
|
||||
void IEnableFX( hsBool e ) { fFXEnabled = e; }
|
||||
hsBool IFXEnabled( void ) { return fFXEnabled; }
|
||||
|
||||
void IPrintSomeHelp( void );
|
||||
void IUpdateTooltip( void );
|
||||
|
||||
public:
|
||||
|
||||
pfConsole();
|
||||
~pfConsole();
|
||||
|
||||
CLASSNAME_REGISTER( pfConsole );
|
||||
GETINTERFACE_ANY( pfConsole, plReceiver );
|
||||
|
||||
static pfConsole * GetInstance ();
|
||||
|
||||
virtual hsBool MsgReceive( plMessage *msg );
|
||||
|
||||
void Init( pfConsoleEngine *engine );
|
||||
void Draw( plPipeline *p );
|
||||
|
||||
static void AddLine( const char *string ) { fTheConsole->IAddParagraph( string ); }
|
||||
static void AddLineF(const char * fmt, ...);
|
||||
static void Clear( void ) { fTheConsole->IClear(); }
|
||||
static void Hide( void ) { fTheConsole->ISetMode(kModeHidden); }
|
||||
|
||||
static void EnableEffects( hsBool enable ) { fTheConsole->IEnableFX( enable ); }
|
||||
static hsBool AreEffectsEnabled( void ) { return fTheConsole->IFXEnabled(); }
|
||||
static void SetTextColor( UInt32 color ) { fConsoleTextColor = color; }
|
||||
static UInt32 GetTextColor() { return fConsoleTextColor; }
|
||||
|
||||
static void SetPipeline( plPipeline *pipe ) { fPipeline = pipe; }
|
||||
static plPipeline *GetPipeline( void ) { return fPipeline; }
|
||||
|
||||
static void RunCommandAsync (const char cmd[]);
|
||||
};
|
||||
|
||||
#endif //_pfConsole_h
|
||||
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfConsole Header //
|
||||
// //
|
||||
// 9.21.2001 mcn - Added pfLogDisplays. These are classes that represent //
|
||||
// a scrolling buffer, much like the console, for on- //
|
||||
// screen display of error logs and the such. Currently //
|
||||
// managed by the console, but hopefully once we have //
|
||||
// a general manager for dialogs/menus (debug or //
|
||||
// otherwise), that manager will take the displays over. //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _pfConsole_h
|
||||
#define _pfConsole_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "../pnKeyedObject/hsKeyedObject.h"
|
||||
|
||||
|
||||
class plPipeline;
|
||||
|
||||
//// Class Definition ////////////////////////////////////////////////////////
|
||||
|
||||
class pfConsoleEngine;
|
||||
class plKeyEventMsg;
|
||||
class pfConsoleInputInterface;
|
||||
|
||||
class pfConsole : public hsKeyedObject
|
||||
{
|
||||
friend class pfConsoleInputInterface;
|
||||
|
||||
protected:
|
||||
|
||||
enum Konstants
|
||||
{
|
||||
kNumHistoryItems = 16,
|
||||
kModeHidden = 0,
|
||||
kModeSingleLine = 1,
|
||||
kModeFull = 2,
|
||||
kEffectDivisions = 1000,
|
||||
kMaxCharsWide = 80,
|
||||
kHelpDelay = 32,
|
||||
kCursorBlinkRate = 16,
|
||||
kMsgHintTimeout = 64,
|
||||
kWorkingLineSize = 256
|
||||
};
|
||||
|
||||
|
||||
UInt32 fNumDisplayLines;
|
||||
|
||||
Int32 fEffectCounter;
|
||||
float fLastTime;
|
||||
UInt32 fHelpTimer;
|
||||
char fLastHelpMsg[ kWorkingLineSize ];
|
||||
UInt8 fMode; // 0 - invisible, 1 - single line, 2 - full
|
||||
hsBool fInited, fHelpMode, fPythonMode, fPythonFirstTime, fFXEnabled;
|
||||
UInt32 fPythonMultiLines;
|
||||
short fCursorTicks;
|
||||
UInt32 fMsgTimeoutTimer;
|
||||
|
||||
char fHistory[ kNumHistoryItems ][ kMaxCharsWide ];
|
||||
UInt32 fHistoryCursor, fHistoryRecallCursor;
|
||||
char *fDisplayBuffer;
|
||||
char fWorkingLine[ kWorkingLineSize ];
|
||||
UInt32 fWorkingCursor;
|
||||
|
||||
pfConsoleInputInterface *fInputInterface;
|
||||
|
||||
pfConsoleEngine *fEngine;
|
||||
|
||||
void IHandleKey( plKeyEventMsg *msg );
|
||||
char IKeyEventToChar( plKeyEventMsg *msg );
|
||||
|
||||
static UInt32 fConsoleTextColor;
|
||||
static pfConsole *fTheConsole;
|
||||
static void _cdecl IAddLineCallback( const char *string );
|
||||
|
||||
static plPipeline *fPipeline;
|
||||
|
||||
void IAddLine( const char *string, short leftMargin = 0 );
|
||||
void IAddParagraph( const char *string, short margin = 0 );
|
||||
void IClear( void );
|
||||
|
||||
void ISetMode( UInt8 mode );
|
||||
void IEnableFX( hsBool e ) { fFXEnabled = e; }
|
||||
hsBool IFXEnabled( void ) { return fFXEnabled; }
|
||||
|
||||
void IPrintSomeHelp( void );
|
||||
void IUpdateTooltip( void );
|
||||
|
||||
public:
|
||||
|
||||
pfConsole();
|
||||
~pfConsole();
|
||||
|
||||
CLASSNAME_REGISTER( pfConsole );
|
||||
GETINTERFACE_ANY( pfConsole, plReceiver );
|
||||
|
||||
static pfConsole * GetInstance ();
|
||||
|
||||
virtual hsBool MsgReceive( plMessage *msg );
|
||||
|
||||
void Init( pfConsoleEngine *engine );
|
||||
void Draw( plPipeline *p );
|
||||
|
||||
static void AddLine( const char *string ) { fTheConsole->IAddParagraph( string ); }
|
||||
static void AddLineF(const char * fmt, ...);
|
||||
static void Clear( void ) { fTheConsole->IClear(); }
|
||||
static void Hide( void ) { fTheConsole->ISetMode(kModeHidden); }
|
||||
|
||||
static void EnableEffects( hsBool enable ) { fTheConsole->IEnableFX( enable ); }
|
||||
static hsBool AreEffectsEnabled( void ) { return fTheConsole->IFXEnabled(); }
|
||||
static void SetTextColor( UInt32 color ) { fConsoleTextColor = color; }
|
||||
static UInt32 GetTextColor() { return fConsoleTextColor; }
|
||||
|
||||
static void SetPipeline( plPipeline *pipe ) { fPipeline = pipe; }
|
||||
static plPipeline *GetPipeline( void ) { return fPipeline; }
|
||||
|
||||
static void RunCommandAsync (const char cmd[]);
|
||||
};
|
||||
|
||||
#endif //_pfConsole_h
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,288 +1,288 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfConsoleCmd Header //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _pfConsoleCmd_h
|
||||
#define _pfConsoleCmd_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "hsBiExpander.h"
|
||||
|
||||
|
||||
//// pfConsoleCmdGroup Class Definition //////////////////////////////////////
|
||||
|
||||
class pfConsoleCmd;
|
||||
class pfConsoleCmdIterator;
|
||||
|
||||
|
||||
class pfConsoleCmdGroup
|
||||
{
|
||||
protected:
|
||||
|
||||
static pfConsoleCmdGroup *fBaseCmdGroup;
|
||||
static UInt32 fBaseCmdGroupRef;
|
||||
|
||||
char fName[ 128 ];
|
||||
|
||||
pfConsoleCmdGroup *fNext;
|
||||
pfConsoleCmdGroup **fPrevPtr;
|
||||
|
||||
pfConsoleCmdGroup *fSubGroups;
|
||||
pfConsoleCmd *fCommands;
|
||||
|
||||
pfConsoleCmdGroup *fParentGroup;
|
||||
|
||||
public:
|
||||
|
||||
enum FindFlags {
|
||||
kFindPartial = 0x01
|
||||
};
|
||||
|
||||
pfConsoleCmdGroup( char *name, char *parent );
|
||||
~pfConsoleCmdGroup();
|
||||
|
||||
void AddCommand( pfConsoleCmd *cmd );
|
||||
void AddSubGroup( pfConsoleCmdGroup *group );
|
||||
|
||||
void Link( pfConsoleCmdGroup **prevPtr );
|
||||
void Unlink( void );
|
||||
|
||||
pfConsoleCmdGroup *GetNext( void ) { return fNext; }
|
||||
char *GetName( void ) { return fName; }
|
||||
pfConsoleCmdGroup *GetParent( void ) { return fParentGroup; }
|
||||
|
||||
static pfConsoleCmdGroup *GetBaseGroup( void );
|
||||
|
||||
pfConsoleCmd *FindCommand( char *name );
|
||||
pfConsoleCmd *FindCommandNoCase( char *name, UInt8 flags = 0, pfConsoleCmd *start = nil );
|
||||
pfConsoleCmd *FindNestedPartialCommand( char *name, UInt32 *counter );
|
||||
|
||||
pfConsoleCmdGroup *FindSubGroup( char *name );
|
||||
pfConsoleCmdGroup *FindSubGroupNoCase( char *name, UInt8 flags = 0, pfConsoleCmdGroup *start = nil );
|
||||
|
||||
pfConsoleCmd *GetFirstCommand( void ) { return fCommands; }
|
||||
pfConsoleCmdGroup *GetFirstSubGroup( void ) { return fSubGroups; }
|
||||
|
||||
int IterateCommands(pfConsoleCmdIterator*, int depth=0);
|
||||
|
||||
static pfConsoleCmdGroup *FindSubGroupRecurse( const char *name );
|
||||
static void DecBaseCmdGroupRef( void );
|
||||
|
||||
static void Dummy( void );
|
||||
static void DummyJunior( void );
|
||||
static void DummyNet( void );
|
||||
static void DummyAvatar( void );
|
||||
static void DummyCCR( void );
|
||||
};
|
||||
|
||||
//// pfConsoleCmdParam Class Definition //////////////////////////////////////
|
||||
|
||||
class pfConsoleCmdParam
|
||||
{
|
||||
protected:
|
||||
|
||||
UInt8 fType;
|
||||
|
||||
typedef char *CharPtr;
|
||||
|
||||
union
|
||||
{
|
||||
int i;
|
||||
float f;
|
||||
bool b;
|
||||
CharPtr s;
|
||||
char c;
|
||||
} fValue;
|
||||
|
||||
const int &IToInt( void ) const;
|
||||
const float &IToFloat( void ) const;
|
||||
const bool &IToBool( void ) const;
|
||||
const CharPtr &IToString( void ) const;
|
||||
const char &IToChar( void ) const;
|
||||
|
||||
public:
|
||||
|
||||
enum Types
|
||||
{
|
||||
kInt = 0,
|
||||
kFloat,
|
||||
kBool,
|
||||
kString,
|
||||
kChar,
|
||||
kAny,
|
||||
kNone = 0xff
|
||||
};
|
||||
|
||||
operator int() const { return IToInt(); }
|
||||
operator float() const { return IToFloat(); }
|
||||
operator bool() const { return IToBool(); }
|
||||
operator const CharPtr() const { return IToString(); }
|
||||
operator char() const { return IToChar(); }
|
||||
|
||||
UInt8 GetType( void ) { return fType; }
|
||||
|
||||
void SetInt( int i ) { fValue.i = i; fType = kInt; }
|
||||
void SetFloat( float f ) { fValue.f = f; fType = kFloat; }
|
||||
void SetBool( bool b ) { fValue.b = b; fType = kBool; }
|
||||
void SetString( CharPtr s ) { fValue.s = s; fType = kString; }
|
||||
void SetChar( char c ) { fValue.c = c; fType = kChar; }
|
||||
void SetAny( CharPtr s ) { fValue.s = s; fType = kAny; }
|
||||
void SetNone( void ) { fType = kNone; }
|
||||
};
|
||||
|
||||
//// pfConsoleCmd Class Definition ///////////////////////////////////////////
|
||||
|
||||
typedef void (*pfConsoleCmdPtr)( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) );
|
||||
|
||||
class pfConsoleCmd
|
||||
{
|
||||
protected:
|
||||
char fName[ 128 ];
|
||||
char *fHelpString;
|
||||
|
||||
pfConsoleCmdPtr fFunction;
|
||||
hsBool fLocalOnly;
|
||||
|
||||
pfConsoleCmd *fNext;
|
||||
pfConsoleCmd **fPrevPtr;
|
||||
|
||||
pfConsoleCmdGroup *fParentGroup;
|
||||
|
||||
hsExpander<UInt8> fSignature;
|
||||
hsExpander<char *> fSigLabels;
|
||||
|
||||
void ICreateSignature( char *paramList );
|
||||
|
||||
public:
|
||||
|
||||
enum ParamTypes
|
||||
{
|
||||
kInt = 0,
|
||||
kFloat,
|
||||
kBool,
|
||||
kString,
|
||||
kChar,
|
||||
kAny,
|
||||
kEtc,
|
||||
kNumTypes,
|
||||
kNone = 0xff
|
||||
};
|
||||
|
||||
static char fSigTypes[ kNumTypes ][ 8 ];
|
||||
|
||||
|
||||
pfConsoleCmd( char *group, char *name, char *paramList, char *help, pfConsoleCmdPtr func, hsBool localOnly = false );
|
||||
~pfConsoleCmd();
|
||||
|
||||
void Register( char *group, char *name );
|
||||
void Unregister();
|
||||
void Execute( Int32 numParams, pfConsoleCmdParam *params, void (*PrintFn)( const char * ) = nil );
|
||||
|
||||
void Link( pfConsoleCmd **prevPtr );
|
||||
void Unlink( void );
|
||||
|
||||
pfConsoleCmd *GetNext( void ) { return fNext; }
|
||||
char *GetName( void ) { return fName; }
|
||||
char *GetHelp( void ) { return fHelpString; }
|
||||
const char *GetSignature( void );
|
||||
|
||||
pfConsoleCmdGroup *GetParent( void ) { return fParentGroup; }
|
||||
|
||||
UInt8 GetSigEntry( UInt8 i );
|
||||
};
|
||||
|
||||
|
||||
|
||||
class pfConsoleCmdIterator
|
||||
{
|
||||
public:
|
||||
virtual void ProcessCmd(pfConsoleCmd*, int ) {}
|
||||
virtual bool ProcessGroup(pfConsoleCmdGroup *, int) {return true;}
|
||||
};
|
||||
|
||||
|
||||
//// pfConsoleCmd Creation Macro /////////////////////////////////////////////
|
||||
//
|
||||
// This expands into 3 things:
|
||||
// - A prototype for the function.
|
||||
// - A declaration of a pfConsoleCmd object, which takes in that function
|
||||
// as a parameter
|
||||
// - The start of the function itself, so that the {} after the macro
|
||||
// define the body of that function.
|
||||
//
|
||||
// PF_LOCAL_CONSOLE_CMD is identical, only it passes true for the localOnly flag.
|
||||
// This isn't used currently and is here only for legacy.
|
||||
|
||||
// PF_CONSOLE_BASE_CMD doesn't belong to a group; it creates a global console function.
|
||||
|
||||
|
||||
#define PF_CONSOLE_BASE_CMD( name, p, help ) \
|
||||
void pfConsoleCmd_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ); \
|
||||
pfConsoleCmd conCmd_##name( nil, #name, p, help, pfConsoleCmd_##name##_proc ); \
|
||||
void pfConsoleCmd_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) )
|
||||
|
||||
#define PF_CONSOLE_CMD( grp, name, p, help ) \
|
||||
void pfConsoleCmd_##grp##_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ); \
|
||||
pfConsoleCmd conCmd_##grp##_##name( #grp, #name, p, help, pfConsoleCmd_##grp##_##name##_proc ); \
|
||||
void pfConsoleCmd_##grp##_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) )
|
||||
|
||||
#define PF_LOCAL_CONSOLE_CMD( grp, name, p, help ) \
|
||||
void pfConsoleCmd_##grp##_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ); \
|
||||
pfConsoleCmd conCmd_##grp##_##name( #grp, #name, p, help, pfConsoleCmd_##grp##_##name##_proc, true ); \
|
||||
void pfConsoleCmd_##grp##_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) )
|
||||
|
||||
//// pfConsoleCmdGroup Creation Macro ////////////////////////////////////////
|
||||
|
||||
#define PF_CONSOLE_GROUP( name ) \
|
||||
pfConsoleCmdGroup conGroup_##name( #name, nil );
|
||||
|
||||
#define PF_CONSOLE_SUBGROUP( parent, name ) \
|
||||
pfConsoleCmdGroup conGroup_##parent##_##name( #name, #parent );
|
||||
|
||||
|
||||
|
||||
#endif //_pfConsoleCmd_h
|
||||
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfConsoleCmd Header //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _pfConsoleCmd_h
|
||||
#define _pfConsoleCmd_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "hsBiExpander.h"
|
||||
|
||||
|
||||
//// pfConsoleCmdGroup Class Definition //////////////////////////////////////
|
||||
|
||||
class pfConsoleCmd;
|
||||
class pfConsoleCmdIterator;
|
||||
|
||||
|
||||
class pfConsoleCmdGroup
|
||||
{
|
||||
protected:
|
||||
|
||||
static pfConsoleCmdGroup *fBaseCmdGroup;
|
||||
static UInt32 fBaseCmdGroupRef;
|
||||
|
||||
char fName[ 128 ];
|
||||
|
||||
pfConsoleCmdGroup *fNext;
|
||||
pfConsoleCmdGroup **fPrevPtr;
|
||||
|
||||
pfConsoleCmdGroup *fSubGroups;
|
||||
pfConsoleCmd *fCommands;
|
||||
|
||||
pfConsoleCmdGroup *fParentGroup;
|
||||
|
||||
public:
|
||||
|
||||
enum FindFlags {
|
||||
kFindPartial = 0x01
|
||||
};
|
||||
|
||||
pfConsoleCmdGroup( char *name, char *parent );
|
||||
~pfConsoleCmdGroup();
|
||||
|
||||
void AddCommand( pfConsoleCmd *cmd );
|
||||
void AddSubGroup( pfConsoleCmdGroup *group );
|
||||
|
||||
void Link( pfConsoleCmdGroup **prevPtr );
|
||||
void Unlink( void );
|
||||
|
||||
pfConsoleCmdGroup *GetNext( void ) { return fNext; }
|
||||
char *GetName( void ) { return fName; }
|
||||
pfConsoleCmdGroup *GetParent( void ) { return fParentGroup; }
|
||||
|
||||
static pfConsoleCmdGroup *GetBaseGroup( void );
|
||||
|
||||
pfConsoleCmd *FindCommand( char *name );
|
||||
pfConsoleCmd *FindCommandNoCase( char *name, UInt8 flags = 0, pfConsoleCmd *start = nil );
|
||||
pfConsoleCmd *FindNestedPartialCommand( char *name, UInt32 *counter );
|
||||
|
||||
pfConsoleCmdGroup *FindSubGroup( char *name );
|
||||
pfConsoleCmdGroup *FindSubGroupNoCase( char *name, UInt8 flags = 0, pfConsoleCmdGroup *start = nil );
|
||||
|
||||
pfConsoleCmd *GetFirstCommand( void ) { return fCommands; }
|
||||
pfConsoleCmdGroup *GetFirstSubGroup( void ) { return fSubGroups; }
|
||||
|
||||
int IterateCommands(pfConsoleCmdIterator*, int depth=0);
|
||||
|
||||
static pfConsoleCmdGroup *FindSubGroupRecurse( const char *name );
|
||||
static void DecBaseCmdGroupRef( void );
|
||||
|
||||
static void Dummy( void );
|
||||
static void DummyJunior( void );
|
||||
static void DummyNet( void );
|
||||
static void DummyAvatar( void );
|
||||
static void DummyCCR( void );
|
||||
};
|
||||
|
||||
//// pfConsoleCmdParam Class Definition //////////////////////////////////////
|
||||
|
||||
class pfConsoleCmdParam
|
||||
{
|
||||
protected:
|
||||
|
||||
UInt8 fType;
|
||||
|
||||
typedef char *CharPtr;
|
||||
|
||||
union
|
||||
{
|
||||
int i;
|
||||
float f;
|
||||
bool b;
|
||||
CharPtr s;
|
||||
char c;
|
||||
} fValue;
|
||||
|
||||
const int &IToInt( void ) const;
|
||||
const float &IToFloat( void ) const;
|
||||
const bool &IToBool( void ) const;
|
||||
const CharPtr &IToString( void ) const;
|
||||
const char &IToChar( void ) const;
|
||||
|
||||
public:
|
||||
|
||||
enum Types
|
||||
{
|
||||
kInt = 0,
|
||||
kFloat,
|
||||
kBool,
|
||||
kString,
|
||||
kChar,
|
||||
kAny,
|
||||
kNone = 0xff
|
||||
};
|
||||
|
||||
operator int() const { return IToInt(); }
|
||||
operator float() const { return IToFloat(); }
|
||||
operator bool() const { return IToBool(); }
|
||||
operator const CharPtr() const { return IToString(); }
|
||||
operator char() const { return IToChar(); }
|
||||
|
||||
UInt8 GetType( void ) { return fType; }
|
||||
|
||||
void SetInt( int i ) { fValue.i = i; fType = kInt; }
|
||||
void SetFloat( float f ) { fValue.f = f; fType = kFloat; }
|
||||
void SetBool( bool b ) { fValue.b = b; fType = kBool; }
|
||||
void SetString( CharPtr s ) { fValue.s = s; fType = kString; }
|
||||
void SetChar( char c ) { fValue.c = c; fType = kChar; }
|
||||
void SetAny( CharPtr s ) { fValue.s = s; fType = kAny; }
|
||||
void SetNone( void ) { fType = kNone; }
|
||||
};
|
||||
|
||||
//// pfConsoleCmd Class Definition ///////////////////////////////////////////
|
||||
|
||||
typedef void (*pfConsoleCmdPtr)( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) );
|
||||
|
||||
class pfConsoleCmd
|
||||
{
|
||||
protected:
|
||||
char fName[ 128 ];
|
||||
char *fHelpString;
|
||||
|
||||
pfConsoleCmdPtr fFunction;
|
||||
hsBool fLocalOnly;
|
||||
|
||||
pfConsoleCmd *fNext;
|
||||
pfConsoleCmd **fPrevPtr;
|
||||
|
||||
pfConsoleCmdGroup *fParentGroup;
|
||||
|
||||
hsExpander<UInt8> fSignature;
|
||||
hsExpander<char *> fSigLabels;
|
||||
|
||||
void ICreateSignature( char *paramList );
|
||||
|
||||
public:
|
||||
|
||||
enum ParamTypes
|
||||
{
|
||||
kInt = 0,
|
||||
kFloat,
|
||||
kBool,
|
||||
kString,
|
||||
kChar,
|
||||
kAny,
|
||||
kEtc,
|
||||
kNumTypes,
|
||||
kNone = 0xff
|
||||
};
|
||||
|
||||
static char fSigTypes[ kNumTypes ][ 8 ];
|
||||
|
||||
|
||||
pfConsoleCmd( char *group, char *name, char *paramList, char *help, pfConsoleCmdPtr func, hsBool localOnly = false );
|
||||
~pfConsoleCmd();
|
||||
|
||||
void Register( char *group, char *name );
|
||||
void Unregister();
|
||||
void Execute( Int32 numParams, pfConsoleCmdParam *params, void (*PrintFn)( const char * ) = nil );
|
||||
|
||||
void Link( pfConsoleCmd **prevPtr );
|
||||
void Unlink( void );
|
||||
|
||||
pfConsoleCmd *GetNext( void ) { return fNext; }
|
||||
char *GetName( void ) { return fName; }
|
||||
char *GetHelp( void ) { return fHelpString; }
|
||||
const char *GetSignature( void );
|
||||
|
||||
pfConsoleCmdGroup *GetParent( void ) { return fParentGroup; }
|
||||
|
||||
UInt8 GetSigEntry( UInt8 i );
|
||||
};
|
||||
|
||||
|
||||
|
||||
class pfConsoleCmdIterator
|
||||
{
|
||||
public:
|
||||
virtual void ProcessCmd(pfConsoleCmd*, int ) {}
|
||||
virtual bool ProcessGroup(pfConsoleCmdGroup *, int) {return true;}
|
||||
};
|
||||
|
||||
|
||||
//// pfConsoleCmd Creation Macro /////////////////////////////////////////////
|
||||
//
|
||||
// This expands into 3 things:
|
||||
// - A prototype for the function.
|
||||
// - A declaration of a pfConsoleCmd object, which takes in that function
|
||||
// as a parameter
|
||||
// - The start of the function itself, so that the {} after the macro
|
||||
// define the body of that function.
|
||||
//
|
||||
// PF_LOCAL_CONSOLE_CMD is identical, only it passes true for the localOnly flag.
|
||||
// This isn't used currently and is here only for legacy.
|
||||
|
||||
// PF_CONSOLE_BASE_CMD doesn't belong to a group; it creates a global console function.
|
||||
|
||||
|
||||
#define PF_CONSOLE_BASE_CMD( name, p, help ) \
|
||||
void pfConsoleCmd_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ); \
|
||||
pfConsoleCmd conCmd_##name( nil, #name, p, help, pfConsoleCmd_##name##_proc ); \
|
||||
void pfConsoleCmd_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) )
|
||||
|
||||
#define PF_CONSOLE_CMD( grp, name, p, help ) \
|
||||
void pfConsoleCmd_##grp##_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ); \
|
||||
pfConsoleCmd conCmd_##grp##_##name( #grp, #name, p, help, pfConsoleCmd_##grp##_##name##_proc ); \
|
||||
void pfConsoleCmd_##grp##_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) )
|
||||
|
||||
#define PF_LOCAL_CONSOLE_CMD( grp, name, p, help ) \
|
||||
void pfConsoleCmd_##grp##_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) ); \
|
||||
pfConsoleCmd conCmd_##grp##_##name( #grp, #name, p, help, pfConsoleCmd_##grp##_##name##_proc, true ); \
|
||||
void pfConsoleCmd_##grp##_##name##_proc( Int32 numParams, pfConsoleCmdParam *params, void (*PrintString)( const char * ) )
|
||||
|
||||
//// pfConsoleCmdGroup Creation Macro ////////////////////////////////////////
|
||||
|
||||
#define PF_CONSOLE_GROUP( name ) \
|
||||
pfConsoleCmdGroup conGroup_##name( #name, nil );
|
||||
|
||||
#define PF_CONSOLE_SUBGROUP( parent, name ) \
|
||||
pfConsoleCmdGroup conGroup_##parent##_##name( #name, #parent );
|
||||
|
||||
|
||||
|
||||
#endif //_pfConsoleCmd_h
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,292 +1,292 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfConsoleContext //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "pfConsoleContext.h"
|
||||
|
||||
|
||||
//// Static Root Context /////////////////////////////////////////////////////
|
||||
|
||||
pfConsoleContext pfConsoleContext::fRootContext( "global" );
|
||||
|
||||
pfConsoleContext &pfConsoleContext::GetRootContext( void )
|
||||
{
|
||||
return fRootContext;
|
||||
}
|
||||
|
||||
//// Constructor/Destructor //////////////////////////////////////////////////
|
||||
|
||||
pfConsoleContext::pfConsoleContext( const char *name )
|
||||
{
|
||||
fName = ( name != nil ) ? hsStrcpy( name ) : nil;
|
||||
fAddWhenNotFound = true;
|
||||
}
|
||||
|
||||
pfConsoleContext::~pfConsoleContext()
|
||||
{
|
||||
Clear();
|
||||
delete [] fName;
|
||||
}
|
||||
|
||||
//// Clear ///////////////////////////////////////////////////////////////////
|
||||
|
||||
void pfConsoleContext::Clear( void )
|
||||
{
|
||||
Int32 idx;
|
||||
|
||||
|
||||
for( idx = fVarValues.GetCount() - 1; idx >= 0; idx-- )
|
||||
RemoveVar( idx );
|
||||
}
|
||||
|
||||
//// Getters /////////////////////////////////////////////////////////////////
|
||||
|
||||
UInt32 pfConsoleContext::GetNumVars( void ) const
|
||||
{
|
||||
hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" );
|
||||
return fVarValues.GetCount();
|
||||
}
|
||||
|
||||
const char *pfConsoleContext::GetVarName( UInt32 idx ) const
|
||||
{
|
||||
hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" );
|
||||
|
||||
if( idx >= fVarNames.GetCount() )
|
||||
{
|
||||
hsAssert( false, "GetVarName() index out of range for console context" );
|
||||
return nil;
|
||||
}
|
||||
|
||||
return fVarNames[ idx ];
|
||||
}
|
||||
|
||||
pfConsoleCmdParam &pfConsoleContext::GetVarValue( UInt32 idx ) const
|
||||
{
|
||||
hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" );
|
||||
hsAssert( idx < fVarValues.GetCount(), "GetVarValue() index out of range for console context" );
|
||||
|
||||
return fVarValues[ idx ];
|
||||
}
|
||||
|
||||
|
||||
//// FindVar /////////////////////////////////////////////////////////////////
|
||||
|
||||
Int32 pfConsoleContext::FindVar( const char *name ) const
|
||||
{
|
||||
UInt32 idx;
|
||||
|
||||
|
||||
hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" );
|
||||
|
||||
for( idx = 0; idx < fVarNames.GetCount(); idx++ )
|
||||
{
|
||||
if( stricmp( name, fVarNames[ idx ] ) == 0 )
|
||||
{
|
||||
return (Int32)idx;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//// RemoveVar ///////////////////////////////////////////////////////////////
|
||||
|
||||
void pfConsoleContext::RemoveVar( UInt32 idx )
|
||||
{
|
||||
hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" );
|
||||
|
||||
if( idx >= fVarValues.GetCount() )
|
||||
{
|
||||
hsAssert( false, "RemoveVar() index out of range for console context" );
|
||||
return;
|
||||
}
|
||||
|
||||
delete [] fVarNames[ idx ];
|
||||
if( fVarValues[ idx ].GetType() == pfConsoleCmdParam::kString )
|
||||
// Necessary because the params won't delete the data themselves
|
||||
delete [] ( (char *)fVarValues[ idx ] );
|
||||
|
||||
fVarNames.Remove( idx );
|
||||
fVarValues.Remove( idx );
|
||||
}
|
||||
|
||||
//// AddVar Variants /////////////////////////////////////////////////////////
|
||||
|
||||
void pfConsoleContext::IAddVar( const char *name, const pfConsoleCmdParam &value )
|
||||
{
|
||||
fVarNames.Append( hsStrcpy( name ) );
|
||||
fVarValues.Append( value );
|
||||
|
||||
// Remember, params won't know any better, since by default they don't own a copy of their string
|
||||
UInt32 idx = fVarValues.GetCount() - 1;
|
||||
if( fVarValues[ idx ].GetType() == pfConsoleCmdParam::kString )
|
||||
fVarValues[ idx ].SetString( hsStrcpy( fVarValues[ idx ] ) );
|
||||
}
|
||||
|
||||
void pfConsoleContext::AddVar( const char *name, const pfConsoleCmdParam &value )
|
||||
{
|
||||
Int32 idx = FindVar( name );
|
||||
if( idx != -1 )
|
||||
{
|
||||
hsAssert( false, "AddVar() failed because variable already in console context" );
|
||||
return;
|
||||
}
|
||||
|
||||
IAddVar( name, value );
|
||||
}
|
||||
|
||||
void pfConsoleContext::AddVar( const char *name, int value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetInt( value );
|
||||
AddVar( name, param );
|
||||
}
|
||||
|
||||
void pfConsoleContext::AddVar( const char *name, float value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetFloat( value );
|
||||
AddVar( name, param );
|
||||
}
|
||||
|
||||
void pfConsoleContext::AddVar( const char *name, const char *value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetString( (char *)value ); // It's ok, we'll be copying it soon 'nuf
|
||||
AddVar( name, param );
|
||||
}
|
||||
|
||||
void pfConsoleContext::AddVar( const char *name, char value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetChar( value );
|
||||
AddVar( name, param );
|
||||
}
|
||||
|
||||
void pfConsoleContext::AddVar( const char *name, bool value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetBool( value );
|
||||
AddVar( name, param );
|
||||
}
|
||||
|
||||
//// SetVar Variants /////////////////////////////////////////////////////////
|
||||
|
||||
hsBool pfConsoleContext::SetVar( UInt32 idx, const pfConsoleCmdParam &value )
|
||||
{
|
||||
hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" );
|
||||
if( idx >= fVarValues.GetCount() )
|
||||
{
|
||||
hsAssert( false, "SetVar() index out of range for console context" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( fVarValues[ idx ].GetType() == pfConsoleCmdParam::kString )
|
||||
{
|
||||
// Remember, params won't know any better, since by default they don't own a copy of their string
|
||||
delete [] ( (char *)fVarValues[ idx ] );
|
||||
}
|
||||
|
||||
fVarValues[ idx ] = value;
|
||||
if( fVarValues[ idx ].GetType() == pfConsoleCmdParam::kString )
|
||||
fVarValues[ idx ].SetString( hsStrcpy( fVarValues[ idx ] ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool pfConsoleContext::SetVar( const char *name, const pfConsoleCmdParam &value )
|
||||
{
|
||||
Int32 idx = FindVar( name );
|
||||
if( idx == -1 )
|
||||
{
|
||||
if( fAddWhenNotFound )
|
||||
{
|
||||
// Don't panic, just add
|
||||
IAddVar( name, value );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return SetVar( idx, value );
|
||||
}
|
||||
|
||||
hsBool pfConsoleContext::SetVar( const char *name, int value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetInt( value );
|
||||
return SetVar( name, param );
|
||||
}
|
||||
|
||||
hsBool pfConsoleContext::SetVar( const char *name, float value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetFloat( value );
|
||||
return SetVar( name, param );
|
||||
}
|
||||
|
||||
hsBool pfConsoleContext::SetVar( const char *name, const char *value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetString( (char *)value ); // Don't worry, we'll be copying it soon 'nuf
|
||||
return SetVar( name, param );
|
||||
}
|
||||
|
||||
hsBool pfConsoleContext::SetVar( const char *name, char value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetChar( value );
|
||||
return SetVar( name, param );
|
||||
}
|
||||
|
||||
hsBool pfConsoleContext::SetVar( const char *name, bool value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetBool( value );
|
||||
return SetVar( name, param );
|
||||
}
|
||||
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfConsoleContext //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "pfConsoleContext.h"
|
||||
|
||||
|
||||
//// Static Root Context /////////////////////////////////////////////////////
|
||||
|
||||
pfConsoleContext pfConsoleContext::fRootContext( "global" );
|
||||
|
||||
pfConsoleContext &pfConsoleContext::GetRootContext( void )
|
||||
{
|
||||
return fRootContext;
|
||||
}
|
||||
|
||||
//// Constructor/Destructor //////////////////////////////////////////////////
|
||||
|
||||
pfConsoleContext::pfConsoleContext( const char *name )
|
||||
{
|
||||
fName = ( name != nil ) ? hsStrcpy( name ) : nil;
|
||||
fAddWhenNotFound = true;
|
||||
}
|
||||
|
||||
pfConsoleContext::~pfConsoleContext()
|
||||
{
|
||||
Clear();
|
||||
delete [] fName;
|
||||
}
|
||||
|
||||
//// Clear ///////////////////////////////////////////////////////////////////
|
||||
|
||||
void pfConsoleContext::Clear( void )
|
||||
{
|
||||
Int32 idx;
|
||||
|
||||
|
||||
for( idx = fVarValues.GetCount() - 1; idx >= 0; idx-- )
|
||||
RemoveVar( idx );
|
||||
}
|
||||
|
||||
//// Getters /////////////////////////////////////////////////////////////////
|
||||
|
||||
UInt32 pfConsoleContext::GetNumVars( void ) const
|
||||
{
|
||||
hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" );
|
||||
return fVarValues.GetCount();
|
||||
}
|
||||
|
||||
const char *pfConsoleContext::GetVarName( UInt32 idx ) const
|
||||
{
|
||||
hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" );
|
||||
|
||||
if( idx >= fVarNames.GetCount() )
|
||||
{
|
||||
hsAssert( false, "GetVarName() index out of range for console context" );
|
||||
return nil;
|
||||
}
|
||||
|
||||
return fVarNames[ idx ];
|
||||
}
|
||||
|
||||
pfConsoleCmdParam &pfConsoleContext::GetVarValue( UInt32 idx ) const
|
||||
{
|
||||
hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" );
|
||||
hsAssert( idx < fVarValues.GetCount(), "GetVarValue() index out of range for console context" );
|
||||
|
||||
return fVarValues[ idx ];
|
||||
}
|
||||
|
||||
|
||||
//// FindVar /////////////////////////////////////////////////////////////////
|
||||
|
||||
Int32 pfConsoleContext::FindVar( const char *name ) const
|
||||
{
|
||||
UInt32 idx;
|
||||
|
||||
|
||||
hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" );
|
||||
|
||||
for( idx = 0; idx < fVarNames.GetCount(); idx++ )
|
||||
{
|
||||
if( stricmp( name, fVarNames[ idx ] ) == 0 )
|
||||
{
|
||||
return (Int32)idx;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//// RemoveVar ///////////////////////////////////////////////////////////////
|
||||
|
||||
void pfConsoleContext::RemoveVar( UInt32 idx )
|
||||
{
|
||||
hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" );
|
||||
|
||||
if( idx >= fVarValues.GetCount() )
|
||||
{
|
||||
hsAssert( false, "RemoveVar() index out of range for console context" );
|
||||
return;
|
||||
}
|
||||
|
||||
delete [] fVarNames[ idx ];
|
||||
if( fVarValues[ idx ].GetType() == pfConsoleCmdParam::kString )
|
||||
// Necessary because the params won't delete the data themselves
|
||||
delete [] ( (char *)fVarValues[ idx ] );
|
||||
|
||||
fVarNames.Remove( idx );
|
||||
fVarValues.Remove( idx );
|
||||
}
|
||||
|
||||
//// AddVar Variants /////////////////////////////////////////////////////////
|
||||
|
||||
void pfConsoleContext::IAddVar( const char *name, const pfConsoleCmdParam &value )
|
||||
{
|
||||
fVarNames.Append( hsStrcpy( name ) );
|
||||
fVarValues.Append( value );
|
||||
|
||||
// Remember, params won't know any better, since by default they don't own a copy of their string
|
||||
UInt32 idx = fVarValues.GetCount() - 1;
|
||||
if( fVarValues[ idx ].GetType() == pfConsoleCmdParam::kString )
|
||||
fVarValues[ idx ].SetString( hsStrcpy( fVarValues[ idx ] ) );
|
||||
}
|
||||
|
||||
void pfConsoleContext::AddVar( const char *name, const pfConsoleCmdParam &value )
|
||||
{
|
||||
Int32 idx = FindVar( name );
|
||||
if( idx != -1 )
|
||||
{
|
||||
hsAssert( false, "AddVar() failed because variable already in console context" );
|
||||
return;
|
||||
}
|
||||
|
||||
IAddVar( name, value );
|
||||
}
|
||||
|
||||
void pfConsoleContext::AddVar( const char *name, int value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetInt( value );
|
||||
AddVar( name, param );
|
||||
}
|
||||
|
||||
void pfConsoleContext::AddVar( const char *name, float value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetFloat( value );
|
||||
AddVar( name, param );
|
||||
}
|
||||
|
||||
void pfConsoleContext::AddVar( const char *name, const char *value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetString( (char *)value ); // It's ok, we'll be copying it soon 'nuf
|
||||
AddVar( name, param );
|
||||
}
|
||||
|
||||
void pfConsoleContext::AddVar( const char *name, char value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetChar( value );
|
||||
AddVar( name, param );
|
||||
}
|
||||
|
||||
void pfConsoleContext::AddVar( const char *name, bool value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetBool( value );
|
||||
AddVar( name, param );
|
||||
}
|
||||
|
||||
//// SetVar Variants /////////////////////////////////////////////////////////
|
||||
|
||||
hsBool pfConsoleContext::SetVar( UInt32 idx, const pfConsoleCmdParam &value )
|
||||
{
|
||||
hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" );
|
||||
if( idx >= fVarValues.GetCount() )
|
||||
{
|
||||
hsAssert( false, "SetVar() index out of range for console context" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( fVarValues[ idx ].GetType() == pfConsoleCmdParam::kString )
|
||||
{
|
||||
// Remember, params won't know any better, since by default they don't own a copy of their string
|
||||
delete [] ( (char *)fVarValues[ idx ] );
|
||||
}
|
||||
|
||||
fVarValues[ idx ] = value;
|
||||
if( fVarValues[ idx ].GetType() == pfConsoleCmdParam::kString )
|
||||
fVarValues[ idx ].SetString( hsStrcpy( fVarValues[ idx ] ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
hsBool pfConsoleContext::SetVar( const char *name, const pfConsoleCmdParam &value )
|
||||
{
|
||||
Int32 idx = FindVar( name );
|
||||
if( idx == -1 )
|
||||
{
|
||||
if( fAddWhenNotFound )
|
||||
{
|
||||
// Don't panic, just add
|
||||
IAddVar( name, value );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return SetVar( idx, value );
|
||||
}
|
||||
|
||||
hsBool pfConsoleContext::SetVar( const char *name, int value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetInt( value );
|
||||
return SetVar( name, param );
|
||||
}
|
||||
|
||||
hsBool pfConsoleContext::SetVar( const char *name, float value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetFloat( value );
|
||||
return SetVar( name, param );
|
||||
}
|
||||
|
||||
hsBool pfConsoleContext::SetVar( const char *name, const char *value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetString( (char *)value ); // Don't worry, we'll be copying it soon 'nuf
|
||||
return SetVar( name, param );
|
||||
}
|
||||
|
||||
hsBool pfConsoleContext::SetVar( const char *name, char value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetChar( value );
|
||||
return SetVar( name, param );
|
||||
}
|
||||
|
||||
hsBool pfConsoleContext::SetVar( const char *name, bool value )
|
||||
{
|
||||
pfConsoleCmdParam param;
|
||||
param.SetBool( value );
|
||||
return SetVar( name, param );
|
||||
}
|
||||
|
||||
|
@ -1,111 +1,111 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfConsoleContext Header //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _pfConsoleContext_h
|
||||
#define _pfConsoleContext_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "pfConsoleCmd.h"
|
||||
|
||||
|
||||
//// Class Definition ////////////////////////////////////////////////////////
|
||||
|
||||
class pfConsoleContext
|
||||
{
|
||||
protected:
|
||||
|
||||
hsBool fAddWhenNotFound; // Controls whether we add variables on Set() calls if they're not found
|
||||
|
||||
char *fName;
|
||||
|
||||
hsTArray<char *> fVarNames;
|
||||
hsTArray<pfConsoleCmdParam> fVarValues;
|
||||
|
||||
void IAddVar( const char *name, const pfConsoleCmdParam &value );
|
||||
|
||||
static pfConsoleContext fRootContext;
|
||||
|
||||
public:
|
||||
|
||||
pfConsoleContext( const char *name );
|
||||
virtual ~pfConsoleContext();
|
||||
|
||||
void Clear( void );
|
||||
|
||||
UInt32 GetNumVars( void ) const;
|
||||
const char *GetVarName( UInt32 idx ) const;
|
||||
pfConsoleCmdParam &GetVarValue( UInt32 idx ) const;
|
||||
|
||||
Int32 FindVar( const char *name ) const;
|
||||
void RemoveVar( UInt32 idx );
|
||||
|
||||
void AddVar( const char *name, const pfConsoleCmdParam &value );
|
||||
void AddVar( const char *name, int value );
|
||||
void AddVar( const char *name, float value );
|
||||
void AddVar( const char *name, const char *value );
|
||||
void AddVar( const char *name, char value );
|
||||
void AddVar( const char *name, bool value );
|
||||
|
||||
hsBool SetVar( UInt32 idx, const pfConsoleCmdParam &value );
|
||||
|
||||
hsBool SetVar( const char *name, const pfConsoleCmdParam &value );
|
||||
hsBool SetVar( const char *name, int value );
|
||||
hsBool SetVar( const char *name, float value );
|
||||
hsBool SetVar( const char *name, const char *value );
|
||||
hsBool SetVar( const char *name, char value );
|
||||
hsBool SetVar( const char *name, bool value );
|
||||
|
||||
// Decide whether Sets() on nonexistant variables will fail or add a new variable
|
||||
void SetAddWhenNotFound( hsBool f ) { fAddWhenNotFound = f; }
|
||||
hsBool GetAddWhenNotFound( void ) const { return fAddWhenNotFound; }
|
||||
|
||||
static pfConsoleContext &GetRootContext( void );
|
||||
};
|
||||
|
||||
|
||||
#endif //_pfConsoleContext_h
|
||||
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfConsoleContext Header //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _pfConsoleContext_h
|
||||
#define _pfConsoleContext_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "pfConsoleCmd.h"
|
||||
|
||||
|
||||
//// Class Definition ////////////////////////////////////////////////////////
|
||||
|
||||
class pfConsoleContext
|
||||
{
|
||||
protected:
|
||||
|
||||
hsBool fAddWhenNotFound; // Controls whether we add variables on Set() calls if they're not found
|
||||
|
||||
char *fName;
|
||||
|
||||
hsTArray<char *> fVarNames;
|
||||
hsTArray<pfConsoleCmdParam> fVarValues;
|
||||
|
||||
void IAddVar( const char *name, const pfConsoleCmdParam &value );
|
||||
|
||||
static pfConsoleContext fRootContext;
|
||||
|
||||
public:
|
||||
|
||||
pfConsoleContext( const char *name );
|
||||
virtual ~pfConsoleContext();
|
||||
|
||||
void Clear( void );
|
||||
|
||||
UInt32 GetNumVars( void ) const;
|
||||
const char *GetVarName( UInt32 idx ) const;
|
||||
pfConsoleCmdParam &GetVarValue( UInt32 idx ) const;
|
||||
|
||||
Int32 FindVar( const char *name ) const;
|
||||
void RemoveVar( UInt32 idx );
|
||||
|
||||
void AddVar( const char *name, const pfConsoleCmdParam &value );
|
||||
void AddVar( const char *name, int value );
|
||||
void AddVar( const char *name, float value );
|
||||
void AddVar( const char *name, const char *value );
|
||||
void AddVar( const char *name, char value );
|
||||
void AddVar( const char *name, bool value );
|
||||
|
||||
hsBool SetVar( UInt32 idx, const pfConsoleCmdParam &value );
|
||||
|
||||
hsBool SetVar( const char *name, const pfConsoleCmdParam &value );
|
||||
hsBool SetVar( const char *name, int value );
|
||||
hsBool SetVar( const char *name, float value );
|
||||
hsBool SetVar( const char *name, const char *value );
|
||||
hsBool SetVar( const char *name, char value );
|
||||
hsBool SetVar( const char *name, bool value );
|
||||
|
||||
// Decide whether Sets() on nonexistant variables will fail or add a new variable
|
||||
void SetAddWhenNotFound( hsBool f ) { fAddWhenNotFound = f; }
|
||||
hsBool GetAddWhenNotFound( void ) const { return fAddWhenNotFound; }
|
||||
|
||||
static pfConsoleContext &GetRootContext( void );
|
||||
};
|
||||
|
||||
|
||||
#endif //_pfConsoleContext_h
|
||||
|
||||
|
@ -1,52 +1,52 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef pfConsoleCreatable_inc
|
||||
#define pfConsoleCreatable_inc
|
||||
|
||||
#include "../pnFactory/plCreator.h"
|
||||
|
||||
#include "pfConsole.h"
|
||||
|
||||
REGISTER_CREATABLE( pfConsole );
|
||||
|
||||
#endif // pfConsoleCreatable_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef pfConsoleCreatable_inc
|
||||
#define pfConsoleCreatable_inc
|
||||
|
||||
#include "../pnFactory/plCreator.h"
|
||||
|
||||
#include "pfConsole.h"
|
||||
|
||||
REGISTER_CREATABLE( pfConsole );
|
||||
|
||||
#endif // pfConsoleCreatable_inc
|
||||
|
@ -1,165 +1,165 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfConsoleDirSrc Functions //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pfConsoleDirSrc.h"
|
||||
|
||||
#include "hsExceptions.h"
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
|
||||
#define WIN32_EXTRA_LEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#ifndef _WINDOWS_H_ // redundant include guard to minimize compile times
|
||||
#define _WINDOWS_H_
|
||||
#include <windows.h>
|
||||
#endif // _WINDOWS_H_
|
||||
|
||||
#include <winbase.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
//// ParseDirectory //////////////////////////////////////////////////////////
|
||||
|
||||
hsBool pfConsoleDirSrc::ParseDirectory(const std::string& path, const std::string& mask /* = "*.*" */)
|
||||
{
|
||||
wchar* wPath = hsStringToWString(path.c_str());
|
||||
wchar* wMask = hsStringToWString(mask.c_str());
|
||||
hsBool ret = ParseDirectory(wPath, wMask);
|
||||
delete [] wPath;
|
||||
delete [] wMask;
|
||||
return ret;
|
||||
}
|
||||
|
||||
hsBool pfConsoleDirSrc::ParseDirectory(const std::wstring& path, const std::wstring& mask /* = L"*.*" */)
|
||||
{
|
||||
std::wstringstream search;
|
||||
std::wstring file;
|
||||
WIN32_FIND_DATAW findInfo;
|
||||
HANDLE handle;
|
||||
|
||||
hsAssert( fEngine != nil, "Cannot do a dir execute without an engine!" );
|
||||
|
||||
search << path << L"\\" << mask;
|
||||
handle = FindFirstFileW(search.str().c_str(), &findInfo);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
|
||||
do
|
||||
{
|
||||
if (!( findInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
std::wstringstream fileAndPath;
|
||||
fileAndPath << path << L"\\" << findInfo.cFileName;
|
||||
if (AlreadyProcessedFile(path, findInfo.cFileName))
|
||||
continue;
|
||||
AddProcessedFile(path, findInfo.cFileName);
|
||||
if (!fEngine->ExecuteFile(fileAndPath.str().c_str()))
|
||||
{
|
||||
// Change the following line once we have a better way of reporting
|
||||
// errors in the parsing
|
||||
std::wstringstream error;
|
||||
std::wstringstream caption;
|
||||
wchar* errorMsg = hsStringToWString(fEngine->GetErrorMsg());
|
||||
wchar* errorLine = hsStringToWString(fEngine->GetLastErrorLine());
|
||||
|
||||
caption << L"Error parsing " << findInfo.cFileName;
|
||||
error << errorMsg << L":\n\nCommand: '" << errorLine << L"'\n\nPress OK to continue parsing files.";
|
||||
|
||||
hsMessageBox(error.str().c_str(), caption.str().c_str(), hsMessageBoxNormal);
|
||||
|
||||
delete [] errorMsg;
|
||||
delete [] errorLine;
|
||||
|
||||
FindClose(handle);
|
||||
SetCheckProcessedFiles(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} while (FindNextFileW(handle, &findInfo) != 0);
|
||||
|
||||
FindClose(handle);
|
||||
SetCheckProcessedFiles(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error This needs to be implemented for this platform!!!!
|
||||
|
||||
#endif
|
||||
|
||||
void pfConsoleDirSrc::ResetProcessedFiles()
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<fProcessedFiles.size(); i++)
|
||||
delete fProcessedFiles[i];
|
||||
fProcessedFiles.clear();
|
||||
}
|
||||
|
||||
//
|
||||
// note: this n^2 linear search should be replaced with something
|
||||
// faster if we have lots of init files and turn on the checkProcessing option.
|
||||
//
|
||||
hsBool pfConsoleDirSrc::AlreadyProcessedFile(const std::wstring& path, const std::wstring& file)
|
||||
{
|
||||
if (fCheckProcessedFiles)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<fProcessedFiles.size(); i++)
|
||||
{
|
||||
if (file == fProcessedFiles[i]->fFile && path == fProcessedFiles[i]->fPath)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void pfConsoleDirSrc::AddProcessedFile(const std::wstring& path, const std::wstring& file)
|
||||
{
|
||||
fProcessedFiles.push_back(TRACKED_NEW FileName(path, file));
|
||||
}
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfConsoleDirSrc Functions //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pfConsoleDirSrc.h"
|
||||
|
||||
#include "hsExceptions.h"
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
|
||||
#define WIN32_EXTRA_LEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#ifndef _WINDOWS_H_ // redundant include guard to minimize compile times
|
||||
#define _WINDOWS_H_
|
||||
#include <windows.h>
|
||||
#endif // _WINDOWS_H_
|
||||
|
||||
#include <winbase.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
//// ParseDirectory //////////////////////////////////////////////////////////
|
||||
|
||||
hsBool pfConsoleDirSrc::ParseDirectory(const std::string& path, const std::string& mask /* = "*.*" */)
|
||||
{
|
||||
wchar* wPath = hsStringToWString(path.c_str());
|
||||
wchar* wMask = hsStringToWString(mask.c_str());
|
||||
hsBool ret = ParseDirectory(wPath, wMask);
|
||||
delete [] wPath;
|
||||
delete [] wMask;
|
||||
return ret;
|
||||
}
|
||||
|
||||
hsBool pfConsoleDirSrc::ParseDirectory(const std::wstring& path, const std::wstring& mask /* = L"*.*" */)
|
||||
{
|
||||
std::wstringstream search;
|
||||
std::wstring file;
|
||||
WIN32_FIND_DATAW findInfo;
|
||||
HANDLE handle;
|
||||
|
||||
hsAssert( fEngine != nil, "Cannot do a dir execute without an engine!" );
|
||||
|
||||
search << path << L"\\" << mask;
|
||||
handle = FindFirstFileW(search.str().c_str(), &findInfo);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
|
||||
do
|
||||
{
|
||||
if (!( findInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
std::wstringstream fileAndPath;
|
||||
fileAndPath << path << L"\\" << findInfo.cFileName;
|
||||
if (AlreadyProcessedFile(path, findInfo.cFileName))
|
||||
continue;
|
||||
AddProcessedFile(path, findInfo.cFileName);
|
||||
if (!fEngine->ExecuteFile(fileAndPath.str().c_str()))
|
||||
{
|
||||
// Change the following line once we have a better way of reporting
|
||||
// errors in the parsing
|
||||
std::wstringstream error;
|
||||
std::wstringstream caption;
|
||||
wchar* errorMsg = hsStringToWString(fEngine->GetErrorMsg());
|
||||
wchar* errorLine = hsStringToWString(fEngine->GetLastErrorLine());
|
||||
|
||||
caption << L"Error parsing " << findInfo.cFileName;
|
||||
error << errorMsg << L":\n\nCommand: '" << errorLine << L"'\n\nPress OK to continue parsing files.";
|
||||
|
||||
hsMessageBox(error.str().c_str(), caption.str().c_str(), hsMessageBoxNormal);
|
||||
|
||||
delete [] errorMsg;
|
||||
delete [] errorLine;
|
||||
|
||||
FindClose(handle);
|
||||
SetCheckProcessedFiles(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} while (FindNextFileW(handle, &findInfo) != 0);
|
||||
|
||||
FindClose(handle);
|
||||
SetCheckProcessedFiles(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#error This needs to be implemented for this platform!!!!
|
||||
|
||||
#endif
|
||||
|
||||
void pfConsoleDirSrc::ResetProcessedFiles()
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<fProcessedFiles.size(); i++)
|
||||
delete fProcessedFiles[i];
|
||||
fProcessedFiles.clear();
|
||||
}
|
||||
|
||||
//
|
||||
// note: this n^2 linear search should be replaced with something
|
||||
// faster if we have lots of init files and turn on the checkProcessing option.
|
||||
//
|
||||
hsBool pfConsoleDirSrc::AlreadyProcessedFile(const std::wstring& path, const std::wstring& file)
|
||||
{
|
||||
if (fCheckProcessedFiles)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<fProcessedFiles.size(); i++)
|
||||
{
|
||||
if (file == fProcessedFiles[i]->fFile && path == fProcessedFiles[i]->fPath)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void pfConsoleDirSrc::AddProcessedFile(const std::wstring& path, const std::wstring& file)
|
||||
{
|
||||
fProcessedFiles.push_back(TRACKED_NEW FileName(path, file));
|
||||
}
|
||||
|
@ -1,105 +1,105 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfConsoleDirSrc Header //
|
||||
// //
|
||||
//// Description /////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Simple wrapper for parsing an entire directory of files and executing //
|
||||
// each one through the pfConsoleEngine object given. //
|
||||
// I.E. the source for the console commmands is a directory of files, //
|
||||
// hence it's a Console Directory Source, or ConsoleDirSrc. :) //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _pfConsoleDirSrc_h
|
||||
#define _pfConsoleDirSrc_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "hsStlUtils.h"
|
||||
#include "pfConsoleEngine.h"
|
||||
|
||||
//// pfConsoleDirSrc Class Definition ////////////////////////////////////////
|
||||
|
||||
class pfConsoleDirSrc
|
||||
{
|
||||
protected:
|
||||
pfConsoleEngine *fEngine;
|
||||
struct FileName
|
||||
{
|
||||
std::wstring fPath;
|
||||
std::wstring fFile;
|
||||
FileName() : fPath(L""), fFile(L"") {}
|
||||
FileName(const std::wstring& p, const std::wstring& f) : fPath(p), fFile(f) {}
|
||||
};
|
||||
std::vector<FileName*> fProcessedFiles; // list of init files we've already executed
|
||||
hsBool fCheckProcessedFiles; // set to check and skip files init files we've already executed
|
||||
public:
|
||||
pfConsoleDirSrc(pfConsoleEngine *engine) : fCheckProcessedFiles(false) { fEngine = engine; }
|
||||
pfConsoleDirSrc(pfConsoleEngine *engine, const std::string& path, const std::string& mask = "*.ini") :
|
||||
fCheckProcessedFiles(false)
|
||||
{
|
||||
fEngine = engine;
|
||||
ParseDirectory(path, mask);
|
||||
}
|
||||
pfConsoleDirSrc(pfConsoleEngine *engine, const std::wstring& path, const std::wstring& mask = L"*.ini") :
|
||||
fCheckProcessedFiles(false)
|
||||
{
|
||||
fEngine = engine;
|
||||
ParseDirectory(path, mask);
|
||||
}
|
||||
|
||||
~pfConsoleDirSrc() { ResetProcessedFiles(); }
|
||||
|
||||
// Steps through the given directory and executes all files with the console engine
|
||||
hsBool ParseDirectory(const std::string& path, const std::string& mask = "*.*");
|
||||
hsBool ParseDirectory(const std::wstring& path, const std::wstring& mask = L"*.*");
|
||||
|
||||
void ResetProcessedFiles();
|
||||
hsBool AlreadyProcessedFile(const std::wstring& path, const std::wstring& file);
|
||||
void AddProcessedFile(const std::wstring& path, const std::wstring& file);
|
||||
void SetCheckProcessedFiles(hsBool c) { fCheckProcessedFiles=c; }
|
||||
};
|
||||
|
||||
|
||||
#endif //_pfConsoleDirSrc_h
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfConsoleDirSrc Header //
|
||||
// //
|
||||
//// Description /////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Simple wrapper for parsing an entire directory of files and executing //
|
||||
// each one through the pfConsoleEngine object given. //
|
||||
// I.E. the source for the console commmands is a directory of files, //
|
||||
// hence it's a Console Directory Source, or ConsoleDirSrc. :) //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _pfConsoleDirSrc_h
|
||||
#define _pfConsoleDirSrc_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "hsStlUtils.h"
|
||||
#include "pfConsoleEngine.h"
|
||||
|
||||
//// pfConsoleDirSrc Class Definition ////////////////////////////////////////
|
||||
|
||||
class pfConsoleDirSrc
|
||||
{
|
||||
protected:
|
||||
pfConsoleEngine *fEngine;
|
||||
struct FileName
|
||||
{
|
||||
std::wstring fPath;
|
||||
std::wstring fFile;
|
||||
FileName() : fPath(L""), fFile(L"") {}
|
||||
FileName(const std::wstring& p, const std::wstring& f) : fPath(p), fFile(f) {}
|
||||
};
|
||||
std::vector<FileName*> fProcessedFiles; // list of init files we've already executed
|
||||
hsBool fCheckProcessedFiles; // set to check and skip files init files we've already executed
|
||||
public:
|
||||
pfConsoleDirSrc(pfConsoleEngine *engine) : fCheckProcessedFiles(false) { fEngine = engine; }
|
||||
pfConsoleDirSrc(pfConsoleEngine *engine, const std::string& path, const std::string& mask = "*.ini") :
|
||||
fCheckProcessedFiles(false)
|
||||
{
|
||||
fEngine = engine;
|
||||
ParseDirectory(path, mask);
|
||||
}
|
||||
pfConsoleDirSrc(pfConsoleEngine *engine, const std::wstring& path, const std::wstring& mask = L"*.ini") :
|
||||
fCheckProcessedFiles(false)
|
||||
{
|
||||
fEngine = engine;
|
||||
ParseDirectory(path, mask);
|
||||
}
|
||||
|
||||
~pfConsoleDirSrc() { ResetProcessedFiles(); }
|
||||
|
||||
// Steps through the given directory and executes all files with the console engine
|
||||
hsBool ParseDirectory(const std::string& path, const std::string& mask = "*.*");
|
||||
hsBool ParseDirectory(const std::wstring& path, const std::wstring& mask = L"*.*");
|
||||
|
||||
void ResetProcessedFiles();
|
||||
hsBool AlreadyProcessedFile(const std::wstring& path, const std::wstring& file);
|
||||
void AddProcessedFile(const std::wstring& path, const std::wstring& file);
|
||||
void SetCheckProcessedFiles(hsBool c) { fCheckProcessedFiles=c; }
|
||||
};
|
||||
|
||||
|
||||
#endif //_pfConsoleDirSrc_h
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,116 +1,116 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfConsoleEngine Header //
|
||||
// //
|
||||
//// Description /////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// The engine is where parsing and execution of console commands takes //
|
||||
// place. It takes place independently of the interface, so that the //
|
||||
// execution can happen from an INI file, from a screen-based console or //
|
||||
// even a GUI interface. //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _pfConsoleEngine_h
|
||||
#define _pfConsoleEngine_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "hsUtils.h"
|
||||
|
||||
|
||||
//// pfConsoleEngine Class Definition ////////////////////////////////////////
|
||||
|
||||
class pfConsoleCmdParam;
|
||||
class pfConsoleCmdGroup;
|
||||
class pfConsoleEngine
|
||||
{
|
||||
private:
|
||||
|
||||
static const Int32 fMaxNumParams;
|
||||
static const char fTokenSeparators[];
|
||||
static const char fTokenGrpSeps[];
|
||||
|
||||
hsBool IConvertToParam( UInt8 type, char *string, pfConsoleCmdParam *param );
|
||||
|
||||
char fErrorMsg[ 128 ];
|
||||
char fLastErrorLine[ 512 ];
|
||||
|
||||
void ISetErrorMsg( char *msg ) { hsStrncpy( fErrorMsg, msg, sizeof( fErrorMsg ) ); }
|
||||
|
||||
// Recursive function to build a string of the groups a command is in
|
||||
void IBuildCmdNameRecurse( pfConsoleCmdGroup *group, char *string );
|
||||
|
||||
public:
|
||||
|
||||
pfConsoleEngine();
|
||||
~pfConsoleEngine();
|
||||
|
||||
// Gets the signature for the command given (NO groups!)
|
||||
const char *GetCmdSignature( char *name );
|
||||
|
||||
// Prints out the help for a given command (or group)
|
||||
hsBool PrintCmdHelp( char *name, void (*PrintFn)( const char * ) );
|
||||
|
||||
// Breaks the given line into a command and parameters and runs the command
|
||||
hsBool RunCommand( char *line, void (*PrintFn)( const char * ) );
|
||||
|
||||
// Executes the given file as a sequence of console commands
|
||||
hsBool ExecuteFile( const char *fileName );
|
||||
hsBool ExecuteFile( const wchar *fileName );
|
||||
|
||||
// Get the last reported error
|
||||
const char *GetErrorMsg( void ) { return fErrorMsg; }
|
||||
|
||||
// Get the line for which the last reported error was for
|
||||
const char *GetLastErrorLine( void ) { return fLastErrorLine; }
|
||||
|
||||
// Does command completion on a partially-complete console line
|
||||
hsBool FindPartialCmd( char *line, hsBool findAgain = false, hsBool perserveParams = false );
|
||||
|
||||
// Does command completion without restrictions to any group, skipping the number of matches given
|
||||
hsBool FindNestedPartialCmd( char *line, UInt32 numToSkip, hsBool perserveParams = false );
|
||||
};
|
||||
|
||||
|
||||
#endif //_pfConsoleEngine_h
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfConsoleEngine Header //
|
||||
// //
|
||||
//// Description /////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// The engine is where parsing and execution of console commands takes //
|
||||
// place. It takes place independently of the interface, so that the //
|
||||
// execution can happen from an INI file, from a screen-based console or //
|
||||
// even a GUI interface. //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _pfConsoleEngine_h
|
||||
#define _pfConsoleEngine_h
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "hsUtils.h"
|
||||
|
||||
|
||||
//// pfConsoleEngine Class Definition ////////////////////////////////////////
|
||||
|
||||
class pfConsoleCmdParam;
|
||||
class pfConsoleCmdGroup;
|
||||
class pfConsoleEngine
|
||||
{
|
||||
private:
|
||||
|
||||
static const Int32 fMaxNumParams;
|
||||
static const char fTokenSeparators[];
|
||||
static const char fTokenGrpSeps[];
|
||||
|
||||
hsBool IConvertToParam( UInt8 type, char *string, pfConsoleCmdParam *param );
|
||||
|
||||
char fErrorMsg[ 128 ];
|
||||
char fLastErrorLine[ 512 ];
|
||||
|
||||
void ISetErrorMsg( char *msg ) { hsStrncpy( fErrorMsg, msg, sizeof( fErrorMsg ) ); }
|
||||
|
||||
// Recursive function to build a string of the groups a command is in
|
||||
void IBuildCmdNameRecurse( pfConsoleCmdGroup *group, char *string );
|
||||
|
||||
public:
|
||||
|
||||
pfConsoleEngine();
|
||||
~pfConsoleEngine();
|
||||
|
||||
// Gets the signature for the command given (NO groups!)
|
||||
const char *GetCmdSignature( char *name );
|
||||
|
||||
// Prints out the help for a given command (or group)
|
||||
hsBool PrintCmdHelp( char *name, void (*PrintFn)( const char * ) );
|
||||
|
||||
// Breaks the given line into a command and parameters and runs the command
|
||||
hsBool RunCommand( char *line, void (*PrintFn)( const char * ) );
|
||||
|
||||
// Executes the given file as a sequence of console commands
|
||||
hsBool ExecuteFile( const char *fileName );
|
||||
hsBool ExecuteFile( const wchar *fileName );
|
||||
|
||||
// Get the last reported error
|
||||
const char *GetErrorMsg( void ) { return fErrorMsg; }
|
||||
|
||||
// Get the line for which the last reported error was for
|
||||
const char *GetLastErrorLine( void ) { return fLastErrorLine; }
|
||||
|
||||
// Does command completion on a partially-complete console line
|
||||
hsBool FindPartialCmd( char *line, hsBool findAgain = false, hsBool perserveParams = false );
|
||||
|
||||
// Does command completion without restrictions to any group, skipping the number of matches given
|
||||
hsBool FindNestedPartialCmd( char *line, UInt32 numToSkip, hsBool perserveParams = false );
|
||||
};
|
||||
|
||||
|
||||
#endif //_pfConsoleEngine_h
|
||||
|
@ -1,329 +1,329 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTimer.h"
|
||||
#include "pfDispatchLog.h"
|
||||
#include "../plStatusLog/plStatusLog.h"
|
||||
#include "../pnMessage/plMessage.h"
|
||||
#include "../pnKeyedObject/plKey.h"
|
||||
#include "hsWindows.h"
|
||||
|
||||
bool DumpSpecificMsgInfo(plMessage* msg, std::string& info);
|
||||
|
||||
plDispatchLog::plDispatchLog() :
|
||||
fLog(nil),
|
||||
fStartTicks(hsTimer::GetFullTickCount())
|
||||
{
|
||||
fLog = plStatusLogMgr::GetInstance().CreateStatusLog(20, "Dispatch.log", plStatusLog::kAlignToTop | plStatusLog::kFilledBackground | plStatusLog::kRawTimeStamp);
|
||||
fIncludeTypes.SetSize(plFactory::GetNumClasses());
|
||||
}
|
||||
|
||||
plDispatchLog::~plDispatchLog()
|
||||
{
|
||||
delete fLog;
|
||||
}
|
||||
|
||||
void plDispatchLog::InitInstance()
|
||||
{
|
||||
static plDispatchLog dispatchLog;
|
||||
fInstance = &dispatchLog;
|
||||
}
|
||||
|
||||
void plDispatchLog::LogStatusBarChange(const char* name, const char* action)
|
||||
{
|
||||
fLog->AddLineF("----- Status bar '%s' %s -----", name, action);
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
MEMORYSTATUS ms;
|
||||
GlobalMemoryStatus(&ms);
|
||||
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
memset(&mbi, 0, sizeof(MEMORY_BASIC_INFORMATION));
|
||||
|
||||
// Note: this will return shared mem too on Win9x. There's a way to catch that, but it's too slow -Colin
|
||||
UInt32 processMemUsed = 0;
|
||||
void* curAddress = 0;
|
||||
while (VirtualQuery(curAddress, &mbi, sizeof(MEMORY_BASIC_INFORMATION)) == sizeof(MEMORY_BASIC_INFORMATION))
|
||||
{
|
||||
if (mbi.State == MEM_COMMIT && mbi.Type == MEM_PRIVATE)
|
||||
processMemUsed += mbi.RegionSize;
|
||||
curAddress = ((BYTE*)mbi.BaseAddress) + mbi.RegionSize;
|
||||
}
|
||||
|
||||
#define ToMB(mem) float(mem) / (1024.f*1024.f)
|
||||
fLog->AddLineF("# Mem stats");
|
||||
fLog->AddLineF("# Physical: %.1f MB used %.1f MB free", ToMB(ms.dwTotalPhys-ms.dwAvailPhys), ToMB(ms.dwAvailPhys));
|
||||
fLog->AddLineF("# Virtual: %.1f MB used %.1f MB free", ToMB(ms.dwTotalVirtual-ms.dwAvailVirtual), ToMB(ms.dwAvailVirtual));
|
||||
fLog->AddLineF("# Pagefile: %.1f MB used %.1f MB free", ToMB(ms.dwTotalPageFile-ms.dwAvailPageFile), ToMB(ms.dwAvailPageFile));
|
||||
fLog->AddLineF("# Process: %.1f MB used", ToMB(processMemUsed));
|
||||
#endif // HS_BUILD_FOR_WIN32
|
||||
}
|
||||
|
||||
void plDispatchLog::LogLongReceive(const char* keyname, const char* className, UInt32 clonePlayerID, plMessage* msg, float ms)
|
||||
{
|
||||
std::string info;
|
||||
if (DumpSpecificMsgInfo(msg, info))
|
||||
fLog->AddLineF("%-30s[%7u](%-20s) took %6.1f ms to receive %s[%s]\n", keyname, clonePlayerID, className, ms, msg->ClassName(), info.c_str());
|
||||
else
|
||||
fLog->AddLineF("%-30s[%7u](%-20s) took %6.1f ms to receive %s\n", keyname, clonePlayerID, className, ms, msg->ClassName());
|
||||
}
|
||||
|
||||
void plDispatchLog::DumpMsg(plMessage* msg, int numReceivers, int sendTimeMs, Int32 indent)
|
||||
{
|
||||
if (!msg)
|
||||
return;
|
||||
|
||||
hsBool found=fIncludeTypes.IsBitSet(msg->ClassIndex());
|
||||
if (found && !hsCheckBits(fFlags, plDispatchLogBase::kInclude))
|
||||
// it's an exclude list and we found it
|
||||
return;
|
||||
if (!found && hsCheckBits(fFlags, plDispatchLogBase::kInclude))
|
||||
// it's an include list and we didn't find it
|
||||
return;
|
||||
|
||||
static hsScalar lastTime=0;
|
||||
hsScalar curTime = (hsScalar)hsTimer::GetSysSeconds();
|
||||
|
||||
if (lastTime!=curTime)
|
||||
{
|
||||
// add linebreak for new frame
|
||||
fLog->AddLine("\n");
|
||||
}
|
||||
|
||||
float sendTime = hsTimer::FullTicksToMs(hsTimer::GetFullTickCount() - fStartTicks);
|
||||
|
||||
char indentStr[50];
|
||||
indent = hsMinimum(indent, sizeof(indentStr)-1);
|
||||
memset(indentStr, ' ', indent);
|
||||
indentStr[indent] = '\0';
|
||||
|
||||
fLog->AddLineF("%sDispatched (%d) %d ms: time=%d CName=%s, sndr=%s, rcvr(%d)=%s, flags=0x%lx, tstamp=%f\n",
|
||||
indentStr, numReceivers, sendTimeMs,
|
||||
int(sendTime), msg->ClassName(), msg->fSender?msg->fSender->GetName():"nil",
|
||||
msg->GetNumReceivers(), msg->GetNumReceivers() && msg->GetReceiver(0)
|
||||
? msg->GetReceiver(0)->GetName():"nil",
|
||||
msg->fBCastFlags, msg->fTimeStamp);
|
||||
|
||||
lastTime=curTime;
|
||||
}
|
||||
|
||||
void plDispatchLog::AddFilterType(UInt16 hClass)
|
||||
{
|
||||
if (hClass>=plFactory::GetNumClasses())
|
||||
return;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < plFactory::GetNumClasses(); i++ )
|
||||
{
|
||||
if( plFactory::DerivesFrom(hClass, i) )
|
||||
AddFilterExactType(i);
|
||||
}
|
||||
}
|
||||
|
||||
void plDispatchLog::AddFilterExactType(UInt16 type)
|
||||
{
|
||||
if (type<plFactory::GetNumClasses())
|
||||
fIncludeTypes.SetBit(type);
|
||||
}
|
||||
|
||||
void plDispatchLog::RemoveFilterType(UInt16 hClass)
|
||||
{
|
||||
if (hClass>=plFactory::GetNumClasses())
|
||||
return;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < plFactory::GetNumClasses(); i++ )
|
||||
{
|
||||
if( plFactory::DerivesFrom(hClass, i) )
|
||||
RemoveFilterExactType(i);
|
||||
}
|
||||
}
|
||||
|
||||
void plDispatchLog::RemoveFilterExactType(UInt16 type)
|
||||
{
|
||||
if (type<plFactory::GetNumClasses())
|
||||
fIncludeTypes.ClearBit(type);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "../pnMessage/plClientMsg.h"
|
||||
#include "../pfMessage/pfKIMsg.h"
|
||||
#include "../pnKeyedObject/hsKeyedObject.h"
|
||||
#include "../plResMgr/plKeyFinder.h"
|
||||
#include "../plResMgr/plPageInfo.h"
|
||||
|
||||
static bool DumpSpecificMsgInfo(plMessage* msg, std::string& info)
|
||||
{
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE // Don't bloat up the external release with all these strings
|
||||
pfKIMsg* kiMsg = pfKIMsg::ConvertNoRef(msg);
|
||||
if (kiMsg)
|
||||
{
|
||||
const char* typeName = "(unknown)";
|
||||
#define PrintKIType(type) if (kiMsg->GetCommand() == pfKIMsg::##type) typeName = #type;
|
||||
PrintKIType(kHACKChatMsg); // send chat message via pfKIMsg
|
||||
PrintKIType(kEnterChatMode); // toggle chat mode
|
||||
PrintKIType(kSetChatFadeDelay); // set the chat delay
|
||||
PrintKIType(kSetTextChatAdminMode); // set the chat admin mode... not used (see CCR)
|
||||
PrintKIType(kDisableKIandBB); // disable KI and blackbar (for things like AvaCusta)
|
||||
PrintKIType(kEnableKIandBB); // re-enable the KI and blackbar
|
||||
PrintKIType(kYesNoDialog); // display a Yes/No dialog
|
||||
PrintKIType(kAddPlayerDevice); // add a device player list); such as imager
|
||||
PrintKIType(kRemovePlayerDevice); // remove a device from player list
|
||||
PrintKIType(kUpgradeKILevel); // upgrade the KI to higher level
|
||||
PrintKIType(kDowngradeKILevel); // downgrade KI to next lower level
|
||||
PrintKIType(kRateIt); // display the "RateIt"(tm) dialog
|
||||
PrintKIType(kSetPrivateChatChannel); // set the private chat channel (for private rooms)
|
||||
PrintKIType(kUnsetPrivateChatChannel); // unset private chat channel
|
||||
PrintKIType(kStartBookAlert); // blink the book image on the blackbar
|
||||
PrintKIType(kMiniBigKIToggle); // shortcut to toggling the miniKI/bigKI
|
||||
PrintKIType(kKIPutAway); // shortcut to hiding all of the KI
|
||||
PrintKIType(kChatAreaPageUp); // shortcut to paging up the chat area
|
||||
PrintKIType(kChatAreaPageDown); // shortcut to paging down the chat area
|
||||
PrintKIType(kChatAreaGoToBegin); // shortcut to going to the beginning of the chat area
|
||||
PrintKIType(kChatAreaGoToEnd); // shortcut to going to the end of the chat area
|
||||
PrintKIType(kKITakePicture); // shortcut to taking a picture in the KI
|
||||
PrintKIType(kKICreateJournalNote); // shortcut to creating a journal note in the KI
|
||||
PrintKIType(kKIToggleFade); // shortcut to toggle fade mode
|
||||
PrintKIType(kKIToggleFadeEnable); // shortcut to toggling fade enabled
|
||||
PrintKIType(kKIChatStatusMsg); // display status message in chat window
|
||||
PrintKIType(kKILocalChatStatusMsg); // display status message in chat window
|
||||
PrintKIType(kKIUpSizeFont); // bump up the size of the chat area font
|
||||
PrintKIType(kKIDownSizeFont); // down size the font of the chat area
|
||||
PrintKIType(kKIOpenYeehsaBook); // open the playerbook if not already open
|
||||
PrintKIType(kKIOpenKI); // open up in degrees the KI
|
||||
PrintKIType(kKIShowCCRHelp); // show the CCR help dialog
|
||||
PrintKIType(kKICreateMarker); // create a marker
|
||||
PrintKIType(kKICreateMarkerFolder); // create a marker folder in the current Age's journal folder
|
||||
PrintKIType(kKILocalChatErrorMsg); // display error message in chat window
|
||||
PrintKIType(kKIPhasedAllOn); // turn on all the phased KI functionality
|
||||
PrintKIType(kKIPhasedAllOff); // turn off all the phased KI functionality
|
||||
PrintKIType(kKIOKDialog); // display an OK dialog box (localized)
|
||||
PrintKIType(kDisableYeeshaBook); // don't allow linking with the Yeesha book (gameplay)
|
||||
PrintKIType(kEnableYeeshaBook); // re-allow linking with the Yeesha book
|
||||
PrintKIType(kQuitDialog); // put up quit dialog
|
||||
PrintKIType(kTempDisableKIandBB); // temp disable KI and blackbar (done by av system)
|
||||
PrintKIType(kTempEnableKIandBB); // temp re-enable the KI and blackbar (done by av system)
|
||||
PrintKIType(kDisableEntireYeeshaBook); // disable the entire Yeeshabook); not for gameplay); but prevent linking
|
||||
PrintKIType(kEnableEntireYeeshaBook);
|
||||
PrintKIType(kKIOKDialogNoQuit); // display OK dialog in the KI without quiting afterwards
|
||||
PrintKIType(kGZUpdated); // the GZ game was updated
|
||||
PrintKIType(kGZInRange); // a GZ marker is in range
|
||||
PrintKIType(kGZOutRange); // GZ markers are out of range
|
||||
PrintKIType(kUpgradeKIMarkerLevel); // upgrade the KI Marker level (current 0 and 1)
|
||||
PrintKIType(kKIShowMiniKI); // force the miniKI up
|
||||
PrintKIType(kGZFlashUpdate); // flash an update without saving (for animation of GZFill in)
|
||||
PrintKIType(kNoCommand);
|
||||
|
||||
info = xtl::format("Type: %s Str: %s User: %s(%d) Delay: %f Int: %d",
|
||||
typeName,
|
||||
kiMsg->GetString() != "" ? kiMsg->GetString().c_str() : "(nil)",
|
||||
kiMsg->GetUser() ? kiMsg->GetUser() : "(nil)",
|
||||
kiMsg->GetPlayerID(),
|
||||
kiMsg->GetDelay(),
|
||||
kiMsg->GetIntValue());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
plClientMsg* clientMsg = plClientMsg::ConvertNoRef(msg);
|
||||
if (clientMsg)
|
||||
{
|
||||
#define PrintType(type) if (clientMsg->GetClientMsgFlag() == plClientMsg::##type) info = #type;
|
||||
PrintType(kLoadRoom);
|
||||
PrintType(kLoadRoomHold);
|
||||
PrintType(kUnloadRoom);
|
||||
PrintType(kLoadNextRoom);
|
||||
PrintType(kInitComplete);
|
||||
PrintType(kDisableRenderScene);
|
||||
PrintType(kEnableRenderScene);
|
||||
PrintType(kQuit);
|
||||
PrintType(kLoadAgeKeys);
|
||||
PrintType(kReleaseAgeKeys);
|
||||
|
||||
switch (clientMsg->GetClientMsgFlag())
|
||||
{
|
||||
case plClientMsg::kLoadRoom:
|
||||
case plClientMsg::kLoadRoomHold:
|
||||
case plClientMsg::kUnloadRoom:
|
||||
{
|
||||
info += " - Pages: ";
|
||||
|
||||
const std::vector<plLocation>& locs = clientMsg->GetRoomLocs();
|
||||
for (int i = 0; i < locs.size(); i++)
|
||||
{
|
||||
const plLocation& loc = locs[i];
|
||||
const plPageInfo* pageInfo = plKeyFinder::Instance().GetLocationInfo(loc);
|
||||
|
||||
if (pageInfo)
|
||||
info += xtl::format("%s-%s ", pageInfo->GetAge(), pageInfo->GetPage());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case plClientMsg::kLoadAgeKeys:
|
||||
case plClientMsg::kReleaseAgeKeys:
|
||||
info += xtl::format(" - Age: %s", clientMsg->GetAgeName());
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
plRefMsg* refMsg = plRefMsg::ConvertNoRef(msg);
|
||||
if (refMsg)
|
||||
{
|
||||
const char* typeName = nil;
|
||||
#define GetType(type) if (refMsg->GetContext() == plRefMsg::##type) typeName = #type;
|
||||
GetType(kOnCreate);
|
||||
GetType(kOnDestroy);
|
||||
GetType(kOnRequest);
|
||||
GetType(kOnRemove);
|
||||
GetType(kOnReplace);
|
||||
xtl::format(info, "Obj: %s RefType: %s", refMsg->GetRef()->GetKeyName(), typeName);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // PLASMA_EXTERNAL_RELEASE
|
||||
|
||||
return false;
|
||||
}
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTimer.h"
|
||||
#include "pfDispatchLog.h"
|
||||
#include "../plStatusLog/plStatusLog.h"
|
||||
#include "../pnMessage/plMessage.h"
|
||||
#include "../pnKeyedObject/plKey.h"
|
||||
#include "hsWindows.h"
|
||||
|
||||
bool DumpSpecificMsgInfo(plMessage* msg, std::string& info);
|
||||
|
||||
plDispatchLog::plDispatchLog() :
|
||||
fLog(nil),
|
||||
fStartTicks(hsTimer::GetFullTickCount())
|
||||
{
|
||||
fLog = plStatusLogMgr::GetInstance().CreateStatusLog(20, "Dispatch.log", plStatusLog::kAlignToTop | plStatusLog::kFilledBackground | plStatusLog::kRawTimeStamp);
|
||||
fIncludeTypes.SetSize(plFactory::GetNumClasses());
|
||||
}
|
||||
|
||||
plDispatchLog::~plDispatchLog()
|
||||
{
|
||||
delete fLog;
|
||||
}
|
||||
|
||||
void plDispatchLog::InitInstance()
|
||||
{
|
||||
static plDispatchLog dispatchLog;
|
||||
fInstance = &dispatchLog;
|
||||
}
|
||||
|
||||
void plDispatchLog::LogStatusBarChange(const char* name, const char* action)
|
||||
{
|
||||
fLog->AddLineF("----- Status bar '%s' %s -----", name, action);
|
||||
|
||||
#ifdef HS_BUILD_FOR_WIN32
|
||||
MEMORYSTATUS ms;
|
||||
GlobalMemoryStatus(&ms);
|
||||
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
memset(&mbi, 0, sizeof(MEMORY_BASIC_INFORMATION));
|
||||
|
||||
// Note: this will return shared mem too on Win9x. There's a way to catch that, but it's too slow -Colin
|
||||
UInt32 processMemUsed = 0;
|
||||
void* curAddress = 0;
|
||||
while (VirtualQuery(curAddress, &mbi, sizeof(MEMORY_BASIC_INFORMATION)) == sizeof(MEMORY_BASIC_INFORMATION))
|
||||
{
|
||||
if (mbi.State == MEM_COMMIT && mbi.Type == MEM_PRIVATE)
|
||||
processMemUsed += mbi.RegionSize;
|
||||
curAddress = ((BYTE*)mbi.BaseAddress) + mbi.RegionSize;
|
||||
}
|
||||
|
||||
#define ToMB(mem) float(mem) / (1024.f*1024.f)
|
||||
fLog->AddLineF("# Mem stats");
|
||||
fLog->AddLineF("# Physical: %.1f MB used %.1f MB free", ToMB(ms.dwTotalPhys-ms.dwAvailPhys), ToMB(ms.dwAvailPhys));
|
||||
fLog->AddLineF("# Virtual: %.1f MB used %.1f MB free", ToMB(ms.dwTotalVirtual-ms.dwAvailVirtual), ToMB(ms.dwAvailVirtual));
|
||||
fLog->AddLineF("# Pagefile: %.1f MB used %.1f MB free", ToMB(ms.dwTotalPageFile-ms.dwAvailPageFile), ToMB(ms.dwAvailPageFile));
|
||||
fLog->AddLineF("# Process: %.1f MB used", ToMB(processMemUsed));
|
||||
#endif // HS_BUILD_FOR_WIN32
|
||||
}
|
||||
|
||||
void plDispatchLog::LogLongReceive(const char* keyname, const char* className, UInt32 clonePlayerID, plMessage* msg, float ms)
|
||||
{
|
||||
std::string info;
|
||||
if (DumpSpecificMsgInfo(msg, info))
|
||||
fLog->AddLineF("%-30s[%7u](%-20s) took %6.1f ms to receive %s[%s]\n", keyname, clonePlayerID, className, ms, msg->ClassName(), info.c_str());
|
||||
else
|
||||
fLog->AddLineF("%-30s[%7u](%-20s) took %6.1f ms to receive %s\n", keyname, clonePlayerID, className, ms, msg->ClassName());
|
||||
}
|
||||
|
||||
void plDispatchLog::DumpMsg(plMessage* msg, int numReceivers, int sendTimeMs, Int32 indent)
|
||||
{
|
||||
if (!msg)
|
||||
return;
|
||||
|
||||
hsBool found=fIncludeTypes.IsBitSet(msg->ClassIndex());
|
||||
if (found && !hsCheckBits(fFlags, plDispatchLogBase::kInclude))
|
||||
// it's an exclude list and we found it
|
||||
return;
|
||||
if (!found && hsCheckBits(fFlags, plDispatchLogBase::kInclude))
|
||||
// it's an include list and we didn't find it
|
||||
return;
|
||||
|
||||
static hsScalar lastTime=0;
|
||||
hsScalar curTime = (hsScalar)hsTimer::GetSysSeconds();
|
||||
|
||||
if (lastTime!=curTime)
|
||||
{
|
||||
// add linebreak for new frame
|
||||
fLog->AddLine("\n");
|
||||
}
|
||||
|
||||
float sendTime = hsTimer::FullTicksToMs(hsTimer::GetFullTickCount() - fStartTicks);
|
||||
|
||||
char indentStr[50];
|
||||
indent = hsMinimum(indent, sizeof(indentStr)-1);
|
||||
memset(indentStr, ' ', indent);
|
||||
indentStr[indent] = '\0';
|
||||
|
||||
fLog->AddLineF("%sDispatched (%d) %d ms: time=%d CName=%s, sndr=%s, rcvr(%d)=%s, flags=0x%lx, tstamp=%f\n",
|
||||
indentStr, numReceivers, sendTimeMs,
|
||||
int(sendTime), msg->ClassName(), msg->fSender?msg->fSender->GetName():"nil",
|
||||
msg->GetNumReceivers(), msg->GetNumReceivers() && msg->GetReceiver(0)
|
||||
? msg->GetReceiver(0)->GetName():"nil",
|
||||
msg->fBCastFlags, msg->fTimeStamp);
|
||||
|
||||
lastTime=curTime;
|
||||
}
|
||||
|
||||
void plDispatchLog::AddFilterType(UInt16 hClass)
|
||||
{
|
||||
if (hClass>=plFactory::GetNumClasses())
|
||||
return;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < plFactory::GetNumClasses(); i++ )
|
||||
{
|
||||
if( plFactory::DerivesFrom(hClass, i) )
|
||||
AddFilterExactType(i);
|
||||
}
|
||||
}
|
||||
|
||||
void plDispatchLog::AddFilterExactType(UInt16 type)
|
||||
{
|
||||
if (type<plFactory::GetNumClasses())
|
||||
fIncludeTypes.SetBit(type);
|
||||
}
|
||||
|
||||
void plDispatchLog::RemoveFilterType(UInt16 hClass)
|
||||
{
|
||||
if (hClass>=plFactory::GetNumClasses())
|
||||
return;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < plFactory::GetNumClasses(); i++ )
|
||||
{
|
||||
if( plFactory::DerivesFrom(hClass, i) )
|
||||
RemoveFilterExactType(i);
|
||||
}
|
||||
}
|
||||
|
||||
void plDispatchLog::RemoveFilterExactType(UInt16 type)
|
||||
{
|
||||
if (type<plFactory::GetNumClasses())
|
||||
fIncludeTypes.ClearBit(type);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "../pnMessage/plClientMsg.h"
|
||||
#include "../pfMessage/pfKIMsg.h"
|
||||
#include "../pnKeyedObject/hsKeyedObject.h"
|
||||
#include "../plResMgr/plKeyFinder.h"
|
||||
#include "../plResMgr/plPageInfo.h"
|
||||
|
||||
static bool DumpSpecificMsgInfo(plMessage* msg, std::string& info)
|
||||
{
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE // Don't bloat up the external release with all these strings
|
||||
pfKIMsg* kiMsg = pfKIMsg::ConvertNoRef(msg);
|
||||
if (kiMsg)
|
||||
{
|
||||
const char* typeName = "(unknown)";
|
||||
#define PrintKIType(type) if (kiMsg->GetCommand() == pfKIMsg::##type) typeName = #type;
|
||||
PrintKIType(kHACKChatMsg); // send chat message via pfKIMsg
|
||||
PrintKIType(kEnterChatMode); // toggle chat mode
|
||||
PrintKIType(kSetChatFadeDelay); // set the chat delay
|
||||
PrintKIType(kSetTextChatAdminMode); // set the chat admin mode... not used (see CCR)
|
||||
PrintKIType(kDisableKIandBB); // disable KI and blackbar (for things like AvaCusta)
|
||||
PrintKIType(kEnableKIandBB); // re-enable the KI and blackbar
|
||||
PrintKIType(kYesNoDialog); // display a Yes/No dialog
|
||||
PrintKIType(kAddPlayerDevice); // add a device player list); such as imager
|
||||
PrintKIType(kRemovePlayerDevice); // remove a device from player list
|
||||
PrintKIType(kUpgradeKILevel); // upgrade the KI to higher level
|
||||
PrintKIType(kDowngradeKILevel); // downgrade KI to next lower level
|
||||
PrintKIType(kRateIt); // display the "RateIt"(tm) dialog
|
||||
PrintKIType(kSetPrivateChatChannel); // set the private chat channel (for private rooms)
|
||||
PrintKIType(kUnsetPrivateChatChannel); // unset private chat channel
|
||||
PrintKIType(kStartBookAlert); // blink the book image on the blackbar
|
||||
PrintKIType(kMiniBigKIToggle); // shortcut to toggling the miniKI/bigKI
|
||||
PrintKIType(kKIPutAway); // shortcut to hiding all of the KI
|
||||
PrintKIType(kChatAreaPageUp); // shortcut to paging up the chat area
|
||||
PrintKIType(kChatAreaPageDown); // shortcut to paging down the chat area
|
||||
PrintKIType(kChatAreaGoToBegin); // shortcut to going to the beginning of the chat area
|
||||
PrintKIType(kChatAreaGoToEnd); // shortcut to going to the end of the chat area
|
||||
PrintKIType(kKITakePicture); // shortcut to taking a picture in the KI
|
||||
PrintKIType(kKICreateJournalNote); // shortcut to creating a journal note in the KI
|
||||
PrintKIType(kKIToggleFade); // shortcut to toggle fade mode
|
||||
PrintKIType(kKIToggleFadeEnable); // shortcut to toggling fade enabled
|
||||
PrintKIType(kKIChatStatusMsg); // display status message in chat window
|
||||
PrintKIType(kKILocalChatStatusMsg); // display status message in chat window
|
||||
PrintKIType(kKIUpSizeFont); // bump up the size of the chat area font
|
||||
PrintKIType(kKIDownSizeFont); // down size the font of the chat area
|
||||
PrintKIType(kKIOpenYeehsaBook); // open the playerbook if not already open
|
||||
PrintKIType(kKIOpenKI); // open up in degrees the KI
|
||||
PrintKIType(kKIShowCCRHelp); // show the CCR help dialog
|
||||
PrintKIType(kKICreateMarker); // create a marker
|
||||
PrintKIType(kKICreateMarkerFolder); // create a marker folder in the current Age's journal folder
|
||||
PrintKIType(kKILocalChatErrorMsg); // display error message in chat window
|
||||
PrintKIType(kKIPhasedAllOn); // turn on all the phased KI functionality
|
||||
PrintKIType(kKIPhasedAllOff); // turn off all the phased KI functionality
|
||||
PrintKIType(kKIOKDialog); // display an OK dialog box (localized)
|
||||
PrintKIType(kDisableYeeshaBook); // don't allow linking with the Yeesha book (gameplay)
|
||||
PrintKIType(kEnableYeeshaBook); // re-allow linking with the Yeesha book
|
||||
PrintKIType(kQuitDialog); // put up quit dialog
|
||||
PrintKIType(kTempDisableKIandBB); // temp disable KI and blackbar (done by av system)
|
||||
PrintKIType(kTempEnableKIandBB); // temp re-enable the KI and blackbar (done by av system)
|
||||
PrintKIType(kDisableEntireYeeshaBook); // disable the entire Yeeshabook); not for gameplay); but prevent linking
|
||||
PrintKIType(kEnableEntireYeeshaBook);
|
||||
PrintKIType(kKIOKDialogNoQuit); // display OK dialog in the KI without quiting afterwards
|
||||
PrintKIType(kGZUpdated); // the GZ game was updated
|
||||
PrintKIType(kGZInRange); // a GZ marker is in range
|
||||
PrintKIType(kGZOutRange); // GZ markers are out of range
|
||||
PrintKIType(kUpgradeKIMarkerLevel); // upgrade the KI Marker level (current 0 and 1)
|
||||
PrintKIType(kKIShowMiniKI); // force the miniKI up
|
||||
PrintKIType(kGZFlashUpdate); // flash an update without saving (for animation of GZFill in)
|
||||
PrintKIType(kNoCommand);
|
||||
|
||||
info = xtl::format("Type: %s Str: %s User: %s(%d) Delay: %f Int: %d",
|
||||
typeName,
|
||||
kiMsg->GetString() != "" ? kiMsg->GetString().c_str() : "(nil)",
|
||||
kiMsg->GetUser() ? kiMsg->GetUser() : "(nil)",
|
||||
kiMsg->GetPlayerID(),
|
||||
kiMsg->GetDelay(),
|
||||
kiMsg->GetIntValue());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
plClientMsg* clientMsg = plClientMsg::ConvertNoRef(msg);
|
||||
if (clientMsg)
|
||||
{
|
||||
#define PrintType(type) if (clientMsg->GetClientMsgFlag() == plClientMsg::##type) info = #type;
|
||||
PrintType(kLoadRoom);
|
||||
PrintType(kLoadRoomHold);
|
||||
PrintType(kUnloadRoom);
|
||||
PrintType(kLoadNextRoom);
|
||||
PrintType(kInitComplete);
|
||||
PrintType(kDisableRenderScene);
|
||||
PrintType(kEnableRenderScene);
|
||||
PrintType(kQuit);
|
||||
PrintType(kLoadAgeKeys);
|
||||
PrintType(kReleaseAgeKeys);
|
||||
|
||||
switch (clientMsg->GetClientMsgFlag())
|
||||
{
|
||||
case plClientMsg::kLoadRoom:
|
||||
case plClientMsg::kLoadRoomHold:
|
||||
case plClientMsg::kUnloadRoom:
|
||||
{
|
||||
info += " - Pages: ";
|
||||
|
||||
const std::vector<plLocation>& locs = clientMsg->GetRoomLocs();
|
||||
for (int i = 0; i < locs.size(); i++)
|
||||
{
|
||||
const plLocation& loc = locs[i];
|
||||
const plPageInfo* pageInfo = plKeyFinder::Instance().GetLocationInfo(loc);
|
||||
|
||||
if (pageInfo)
|
||||
info += xtl::format("%s-%s ", pageInfo->GetAge(), pageInfo->GetPage());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case plClientMsg::kLoadAgeKeys:
|
||||
case plClientMsg::kReleaseAgeKeys:
|
||||
info += xtl::format(" - Age: %s", clientMsg->GetAgeName());
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
plRefMsg* refMsg = plRefMsg::ConvertNoRef(msg);
|
||||
if (refMsg)
|
||||
{
|
||||
const char* typeName = nil;
|
||||
#define GetType(type) if (refMsg->GetContext() == plRefMsg::##type) typeName = #type;
|
||||
GetType(kOnCreate);
|
||||
GetType(kOnDestroy);
|
||||
GetType(kOnRequest);
|
||||
GetType(kOnRemove);
|
||||
GetType(kOnReplace);
|
||||
xtl::format(info, "Obj: %s RefType: %s", refMsg->GetRef()->GetKeyName(), typeName);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // PLASMA_EXTERNAL_RELEASE
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1,75 +1,75 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef pfDispatchLog_inc
|
||||
#define pfDispatchLog_inc
|
||||
|
||||
#include "../pnDispatch/plDispatchLogBase.h"
|
||||
#include "hsBitVector.h"
|
||||
|
||||
class plStatusLog;
|
||||
|
||||
class plDispatchLog : public plDispatchLogBase
|
||||
{
|
||||
private:
|
||||
hsBitVector fIncludeTypes; // include/exclude list
|
||||
UInt64 fStartTicks;
|
||||
plStatusLog* fLog;
|
||||
|
||||
public:
|
||||
plDispatchLog();
|
||||
~plDispatchLog();
|
||||
|
||||
static void InitInstance();
|
||||
|
||||
void AddFilterType(UInt16 type);
|
||||
void AddFilterExactType(UInt16 type);
|
||||
|
||||
void RemoveFilterType(UInt16 type);
|
||||
void RemoveFilterExactType(UInt16 type);
|
||||
|
||||
void LogStatusBarChange(const char* name, const char* action);
|
||||
void LogLongReceive(const char* keyname, const char* className, UInt32 clonePlayerID, plMessage* msg, float ms);
|
||||
|
||||
void DumpMsg(plMessage* msg, int numReceivers, int sendTimeMs, Int32 indent);
|
||||
};
|
||||
|
||||
#endif // pfDispatchLog_inc
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef pfDispatchLog_inc
|
||||
#define pfDispatchLog_inc
|
||||
|
||||
#include "../pnDispatch/plDispatchLogBase.h"
|
||||
#include "hsBitVector.h"
|
||||
|
||||
class plStatusLog;
|
||||
|
||||
class plDispatchLog : public plDispatchLogBase
|
||||
{
|
||||
private:
|
||||
hsBitVector fIncludeTypes; // include/exclude list
|
||||
UInt64 fStartTicks;
|
||||
plStatusLog* fLog;
|
||||
|
||||
public:
|
||||
plDispatchLog();
|
||||
~plDispatchLog();
|
||||
|
||||
static void InitInstance();
|
||||
|
||||
void AddFilterType(UInt16 type);
|
||||
void AddFilterExactType(UInt16 type);
|
||||
|
||||
void RemoveFilterType(UInt16 type);
|
||||
void RemoveFilterExactType(UInt16 type);
|
||||
|
||||
void LogStatusBarChange(const char* name, const char* action);
|
||||
void LogLongReceive(const char* keyname, const char* className, UInt32 clonePlayerID, plMessage* msg, float ms);
|
||||
|
||||
void DumpMsg(plMessage* msg, int numReceivers, int sendTimeMs, Int32 indent);
|
||||
};
|
||||
|
||||
#endif // pfDispatchLog_inc
|
||||
|
@ -1,467 +1,467 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfGameConsoleCommands //
|
||||
// //
|
||||
// Set of console commands that are actually meant for implementing //
|
||||
// gameplay. Simpler than Python, easier to implement for programmers, and //
|
||||
// far lower level, but should be used with extreme caution. //
|
||||
// //
|
||||
// Why? Because unlike normal console commands, which will eventually be //
|
||||
// disabled in the shipping product (thus no danger of any fan cracking //
|
||||
// them), these WILL be in the finished product. Debugging hacks and temp //
|
||||
// workarounds to new features are NOT to be implemented here. //
|
||||
// //
|
||||
// Because of their nature, all Game. console commands should be approved //
|
||||
// by Brice before checkin. //
|
||||
// //
|
||||
// Preferred method of adding Game. commands: //
|
||||
// 1. Implement in normal console command groups (Debug. if nothing //
|
||||
// else) //
|
||||
// 2. Get the command approved //
|
||||
// 3. Once command is tested and approved and deemed both worthy and //
|
||||
// bug-free, cut-and-paste the command into the Game. group //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef PLASMA_EXTERNAL_RELEASE
|
||||
#define LIMIT_CONSOLE_COMMANDS 1
|
||||
#endif
|
||||
|
||||
|
||||
#include "pfConsoleCmd.h"
|
||||
#include "pfConsole.h"
|
||||
|
||||
#include "plPipeline.h"
|
||||
#include "plgDispatch.h"
|
||||
#include "../plGImage/plMipmap.h"
|
||||
#include "../plGImage/plTGAWriter.h"
|
||||
#include "../pfMessage/pfGameGUIMsg.h"
|
||||
#include "../../NucleusLib/inc/hsResMgr.h"
|
||||
#include "../pfGameGUIMgr/pfGUICtrlGenerator.h"
|
||||
#include "../plAvatar/plAvatarMgr.h"
|
||||
#include "../plAvatar/plAnimStage.h"
|
||||
#include "../plAvatar/plAvBrainGeneric.h"
|
||||
#include "../plAvatar/plAvBrainHuman.h"
|
||||
#include "../plMessage/plAvatarMsg.h"
|
||||
#include "../pnKeyedObject/plFixedKey.h"
|
||||
|
||||
|
||||
#define PF_SANITY_CHECK( cond, msg ) { if( !( cond ) ) { PrintString( msg ); return; } }
|
||||
|
||||
//// DO NOT REMOVE!!!!
|
||||
//// This is here so Microsoft VC won't decide to "optimize" this file out
|
||||
//// DO NOT REMOVE!!!!
|
||||
void pfConsoleCmdGroup::DummyJunior( void )
|
||||
{
|
||||
}
|
||||
//// DO NOT REMOVE!!!!
|
||||
|
||||
|
||||
//// plDoesFileExist //////////////////////////////////////////////////////////
|
||||
// Utility function to determine whether the given file exists
|
||||
|
||||
static hsBool plDoesFileExist( const char *path )
|
||||
{
|
||||
hsUNIXStream stream;
|
||||
|
||||
|
||||
if( !stream.Open( path, "rb" ) )
|
||||
return false;
|
||||
|
||||
stream.Close();
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//// Game Group Commands /////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PF_CONSOLE_GROUP( Game )
|
||||
|
||||
#ifndef LIMIT_CONSOLE_COMMANDS
|
||||
PF_CONSOLE_CMD( Game, TakeScreenshot, "...", "Takes a shot of the current frame and saves it to the given file" )
|
||||
{
|
||||
hsAssert( pfConsole::GetPipeline() != nil, "Cannot use this command before pipeline initialization" );
|
||||
|
||||
plMipmap myMipmap;
|
||||
char fileName[ 512 ];
|
||||
UInt32 uniqueNumber;
|
||||
|
||||
|
||||
if( numParams > 1 )
|
||||
{
|
||||
PrintString( "Too many parameters to TakeScreenshot" );
|
||||
return;
|
||||
}
|
||||
else if( numParams == 1 )
|
||||
strcpy( fileName, (char *)params[ 0 ] );
|
||||
else
|
||||
{
|
||||
// Think up a filename
|
||||
for( uniqueNumber = 1; uniqueNumber < 1000; uniqueNumber++ )
|
||||
{
|
||||
sprintf( fileName, "screen%03d.tga", uniqueNumber );
|
||||
if( !plDoesFileExist( fileName ) )
|
||||
break;
|
||||
}
|
||||
if( uniqueNumber == 1000 )
|
||||
{
|
||||
PrintString( "Out of filenames for TakeScreenshot" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( !pfConsole::GetPipeline()->CaptureScreen( &myMipmap ) )
|
||||
PrintString( "Error capturing screenshot" );
|
||||
else
|
||||
{
|
||||
char str[ 512 ];
|
||||
|
||||
|
||||
plTGAWriter::Instance().WriteMipmap( fileName, &myMipmap );
|
||||
sprintf( str, "Screenshot written to '%s'.", fileName );
|
||||
PrintString( str );
|
||||
}
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, LoadDialog, "string dlgName", "Loads the given GUI dialog into memory" )
|
||||
{
|
||||
plUoid lu( kGameGUIMgr_KEY );
|
||||
plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu );
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kLoadDialog );
|
||||
msg->SetString( params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, LoadLocalDialog, "string ageName, string dlgName", "Loads the given GUI dialog into memory" )
|
||||
{
|
||||
plUoid lu( kGameGUIMgr_KEY );
|
||||
plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu );
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kLoadDialog );
|
||||
msg->SetString( params[ 1 ] );
|
||||
msg->SetAge( params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, ShowDialog, "string dlgName", "Shows the given GUI dialog" )
|
||||
{
|
||||
plUoid lu( kGameGUIMgr_KEY );
|
||||
plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu );
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kShowDialog );
|
||||
msg->SetString( params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, HideDialog, "string dlgName", "Hides the given GUI dialog" )
|
||||
{
|
||||
plUoid lu( kGameGUIMgr_KEY );
|
||||
plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu );
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kHideDialog );
|
||||
msg->SetString( params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
PF_CONSOLE_CMD( Game, SwitchDialog, "string olddlgName, string newdlgName", "Hide olddlg and show newdlg" )
|
||||
{
|
||||
plUoid lu( kGameGUIMgr_KEY );
|
||||
plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu );
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kHideDialog );
|
||||
msg->SetString( params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
|
||||
pfGameGUIMsg *msg2 = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kShowDialog );
|
||||
msg2->SetString( params[ 1 ] );
|
||||
plgDispatch::MsgSend( msg2 );
|
||||
}
|
||||
}
|
||||
|
||||
PF_CONSOLE_SUBGROUP( Game, GUI )
|
||||
|
||||
#include "../pfGameGUIMgr/pfGUICtrlGenerator.h"
|
||||
|
||||
static hsColorRGBA sDynCtrlColor = hsColorRGBA().Set( 1, 1, 1, 1 ), sDynCtrlTextColor = hsColorRGBA().Set( 0, 0, 0, 1 );
|
||||
|
||||
PF_CONSOLE_CMD( Game_GUI, SetDynamicCtrlColor, "float bgRed, float bgGreen, float bgBlue, float textRed, float textGreen, float textBlue", "" )
|
||||
{
|
||||
sDynCtrlColor.Set( params[ 0 ], params[ 1 ], params[ 2 ], 1.f );
|
||||
sDynCtrlTextColor.Set( params[ 3 ], params[ 4 ], params[ 5 ], 1.f );
|
||||
}
|
||||
|
||||
|
||||
PF_CONSOLE_CMD( Game_GUI, CreateRectButton, "string title, float x, float y, float width, float height, string command", "" )
|
||||
{
|
||||
pfGUICtrlGenerator::Instance().GenerateRectButton( params[ 0 ], params[ 1 ], params[ 2 ],
|
||||
params[ 3 ], params[ 4 ],
|
||||
params[ 5 ],
|
||||
sDynCtrlColor, sDynCtrlTextColor );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_GUI, CreateRoundButton, "float x, float y, float radius, string command", "" )
|
||||
{
|
||||
pfGUICtrlGenerator::Instance().GenerateSphereButton( params[ 0 ], params[ 1 ], params[ 2 ],
|
||||
params[ 3 ],
|
||||
sDynCtrlColor );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_GUI, CreateDragBar, "float x, float y, float width, float height", "")
|
||||
{
|
||||
pfGUICtrlGenerator::Instance().GenerateDragBar( params[ 0 ], params[ 1 ], params[ 2 ], params[ 3 ], sDynCtrlColor );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_GUI, CreateDialog, "string name", "" )
|
||||
{
|
||||
pfGUICtrlGenerator::Instance().GenerateDialog( params[ 0 ] );
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//#include "../pfKI/pfKI.h"
|
||||
#include "../pfMessage/pfKIMsg.h"
|
||||
|
||||
PF_CONSOLE_CMD( Game, EnterChatMode, "", "Enters in-game chat mode" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kEnterChatMode);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIToggleMini, "", "Toggle between mini and big KI" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kMiniBigKIToggle);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIPutAway, "", "Put KI completely away" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIPutAway);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIChatPageUp, "", "Scroll chat display one page up" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kChatAreaPageUp);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIChatPageDown, "", "Scroll chat display one page down" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kChatAreaPageDown);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIChatToStart, "", "Scroll chat display to top of buffer" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kChatAreaGoToBegin);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIChatToEnd, "", "Scroll chat display to bottom of buffer" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kChatAreaGoToEnd);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KITakePicture, "", "Take picture with KI" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKITakePicture);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KICreateJournal, "", "Create journal note entry" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKICreateJournalNote);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIChatToggleFaded, "", "Toggle fade of chat display" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIToggleFade);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIChatToggleFadeEnable, "", "Toggle enable of chat fade" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIToggleFadeEnable);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIUpSizeFont, "", "Up size the KI font (chatarea)" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIUpSizeFont);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIDownSizeFont, "", "Down size the KI font (chatarea)" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIDownSizeFont);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIOpenYeeshaBook, "", "Open the player's Yeesha book" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIOpenYeehsaBook);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIOpenKI, "", "Open the KI a little at a time" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIOpenKI);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIHelp, "", "Open the CCR help dialog" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIShowCCRHelp);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KICreateMarker, "", "Create marker in the working marker folder" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKICreateMarker);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KICreateMarkerFolder, "", "Create marker folder in current Age's journal folder" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKICreateMarkerFolder);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, SetChatFadeDelay, "float delayInSecs", "Sets the time in seconds before the chat text disappears" )
|
||||
{
|
||||
// pfKI::GetInstance()->SetChatFadeDelay( params[ 0 ] );
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kSetChatFadeDelay);
|
||||
msg->SetDelay( params[0] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
#include "../plAvatar/plArmatureMod.h"
|
||||
|
||||
PF_CONSOLE_CMD( Game, LimitAvatarLOD, "int newLOD", "Zero is (always) highest detail; 2 is (currently) lowest." )
|
||||
{
|
||||
int newLOD = params[0];
|
||||
|
||||
if(newLOD >= 0 && newLOD <= 2)
|
||||
plArmatureLODMod::fMinLOD = newLOD;
|
||||
}
|
||||
|
||||
|
||||
PF_CONSOLE_SUBGROUP( Game, Emote) // Game.Emote.Shakefist
|
||||
|
||||
void Emote(const char *emotion, float fadeIn = 2.0, float fadeOut = 2.0)
|
||||
{
|
||||
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
|
||||
AvatarEmote(avatar, emotion);
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_Emote, Wave, "", "")
|
||||
{
|
||||
Emote("Wave", 4.0, 1.0);
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_Emote, Sneeze, "", "")
|
||||
{
|
||||
Emote("Sneeze");
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_Emote, Dance, "", "")
|
||||
{
|
||||
Emote("Dance");
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_Emote, Laugh, "", "")
|
||||
{
|
||||
Emote("Laugh");
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_Emote, Clap, "", "")
|
||||
{
|
||||
Emote("Clap", 4.0, 3.0);
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_Emote, Talk, "", "")
|
||||
{
|
||||
Emote("Talk");
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_Emote, Sit, "", "")
|
||||
{
|
||||
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
|
||||
PushSimpleMultiStage(avatar, "SitDownGround", "SitIdleGround", "SitStandGround", true, true, plAGAnim::kBodyLower, plAvBrainGeneric::kSitOnGround);
|
||||
}
|
||||
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
PF_CONSOLE_CMD( Game, SetLocalClientAsAdmin, "bool enable", "Makes chat messages from this client appear as admin messages" )
|
||||
{
|
||||
// pfKI::GetInstance()->SetTextChatAdminMode( (bool)params[ 0 ] );
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kSetTextChatAdminMode);
|
||||
msg->SetFlags( params[0] ? pfKIMsg::kAdminMsg : 0 );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "../pfConditional/plObjectInBoxConditionalObject.h"
|
||||
|
||||
PF_CONSOLE_CMD( Game, BreakVolumeSensors, "bool break", "reverts to old broken volume sensor logic" )
|
||||
{
|
||||
bool b = params[ 0 ];
|
||||
plVolumeSensorConditionalObject::makeBriceHappyVar = !b;
|
||||
}
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// pfGameConsoleCommands //
|
||||
// //
|
||||
// Set of console commands that are actually meant for implementing //
|
||||
// gameplay. Simpler than Python, easier to implement for programmers, and //
|
||||
// far lower level, but should be used with extreme caution. //
|
||||
// //
|
||||
// Why? Because unlike normal console commands, which will eventually be //
|
||||
// disabled in the shipping product (thus no danger of any fan cracking //
|
||||
// them), these WILL be in the finished product. Debugging hacks and temp //
|
||||
// workarounds to new features are NOT to be implemented here. //
|
||||
// //
|
||||
// Because of their nature, all Game. console commands should be approved //
|
||||
// by Brice before checkin. //
|
||||
// //
|
||||
// Preferred method of adding Game. commands: //
|
||||
// 1. Implement in normal console command groups (Debug. if nothing //
|
||||
// else) //
|
||||
// 2. Get the command approved //
|
||||
// 3. Once command is tested and approved and deemed both worthy and //
|
||||
// bug-free, cut-and-paste the command into the Game. group //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef PLASMA_EXTERNAL_RELEASE
|
||||
#define LIMIT_CONSOLE_COMMANDS 1
|
||||
#endif
|
||||
|
||||
|
||||
#include "pfConsoleCmd.h"
|
||||
#include "pfConsole.h"
|
||||
|
||||
#include "plPipeline.h"
|
||||
#include "plgDispatch.h"
|
||||
#include "../plGImage/plMipmap.h"
|
||||
#include "../plGImage/plTGAWriter.h"
|
||||
#include "../pfMessage/pfGameGUIMsg.h"
|
||||
#include "../../NucleusLib/inc/hsResMgr.h"
|
||||
#include "../pfGameGUIMgr/pfGUICtrlGenerator.h"
|
||||
#include "../plAvatar/plAvatarMgr.h"
|
||||
#include "../plAvatar/plAnimStage.h"
|
||||
#include "../plAvatar/plAvBrainGeneric.h"
|
||||
#include "../plAvatar/plAvBrainHuman.h"
|
||||
#include "../plMessage/plAvatarMsg.h"
|
||||
#include "../pnKeyedObject/plFixedKey.h"
|
||||
|
||||
|
||||
#define PF_SANITY_CHECK( cond, msg ) { if( !( cond ) ) { PrintString( msg ); return; } }
|
||||
|
||||
//// DO NOT REMOVE!!!!
|
||||
//// This is here so Microsoft VC won't decide to "optimize" this file out
|
||||
//// DO NOT REMOVE!!!!
|
||||
void pfConsoleCmdGroup::DummyJunior( void )
|
||||
{
|
||||
}
|
||||
//// DO NOT REMOVE!!!!
|
||||
|
||||
|
||||
//// plDoesFileExist //////////////////////////////////////////////////////////
|
||||
// Utility function to determine whether the given file exists
|
||||
|
||||
static hsBool plDoesFileExist( const char *path )
|
||||
{
|
||||
hsUNIXStream stream;
|
||||
|
||||
|
||||
if( !stream.Open( path, "rb" ) )
|
||||
return false;
|
||||
|
||||
stream.Close();
|
||||
return true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//// Game Group Commands /////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PF_CONSOLE_GROUP( Game )
|
||||
|
||||
#ifndef LIMIT_CONSOLE_COMMANDS
|
||||
PF_CONSOLE_CMD( Game, TakeScreenshot, "...", "Takes a shot of the current frame and saves it to the given file" )
|
||||
{
|
||||
hsAssert( pfConsole::GetPipeline() != nil, "Cannot use this command before pipeline initialization" );
|
||||
|
||||
plMipmap myMipmap;
|
||||
char fileName[ 512 ];
|
||||
UInt32 uniqueNumber;
|
||||
|
||||
|
||||
if( numParams > 1 )
|
||||
{
|
||||
PrintString( "Too many parameters to TakeScreenshot" );
|
||||
return;
|
||||
}
|
||||
else if( numParams == 1 )
|
||||
strcpy( fileName, (char *)params[ 0 ] );
|
||||
else
|
||||
{
|
||||
// Think up a filename
|
||||
for( uniqueNumber = 1; uniqueNumber < 1000; uniqueNumber++ )
|
||||
{
|
||||
sprintf( fileName, "screen%03d.tga", uniqueNumber );
|
||||
if( !plDoesFileExist( fileName ) )
|
||||
break;
|
||||
}
|
||||
if( uniqueNumber == 1000 )
|
||||
{
|
||||
PrintString( "Out of filenames for TakeScreenshot" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( !pfConsole::GetPipeline()->CaptureScreen( &myMipmap ) )
|
||||
PrintString( "Error capturing screenshot" );
|
||||
else
|
||||
{
|
||||
char str[ 512 ];
|
||||
|
||||
|
||||
plTGAWriter::Instance().WriteMipmap( fileName, &myMipmap );
|
||||
sprintf( str, "Screenshot written to '%s'.", fileName );
|
||||
PrintString( str );
|
||||
}
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, LoadDialog, "string dlgName", "Loads the given GUI dialog into memory" )
|
||||
{
|
||||
plUoid lu( kGameGUIMgr_KEY );
|
||||
plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu );
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kLoadDialog );
|
||||
msg->SetString( params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, LoadLocalDialog, "string ageName, string dlgName", "Loads the given GUI dialog into memory" )
|
||||
{
|
||||
plUoid lu( kGameGUIMgr_KEY );
|
||||
plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu );
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kLoadDialog );
|
||||
msg->SetString( params[ 1 ] );
|
||||
msg->SetAge( params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, ShowDialog, "string dlgName", "Shows the given GUI dialog" )
|
||||
{
|
||||
plUoid lu( kGameGUIMgr_KEY );
|
||||
plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu );
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kShowDialog );
|
||||
msg->SetString( params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, HideDialog, "string dlgName", "Hides the given GUI dialog" )
|
||||
{
|
||||
plUoid lu( kGameGUIMgr_KEY );
|
||||
plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu );
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kHideDialog );
|
||||
msg->SetString( params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
PF_CONSOLE_CMD( Game, SwitchDialog, "string olddlgName, string newdlgName", "Hide olddlg and show newdlg" )
|
||||
{
|
||||
plUoid lu( kGameGUIMgr_KEY );
|
||||
plKey mgrKey = hsgResMgr::ResMgr()->FindKey( lu );
|
||||
if( mgrKey )
|
||||
{
|
||||
pfGameGUIMsg *msg = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kHideDialog );
|
||||
msg->SetString( params[ 0 ] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
|
||||
pfGameGUIMsg *msg2 = TRACKED_NEW pfGameGUIMsg( mgrKey, pfGameGUIMsg::kShowDialog );
|
||||
msg2->SetString( params[ 1 ] );
|
||||
plgDispatch::MsgSend( msg2 );
|
||||
}
|
||||
}
|
||||
|
||||
PF_CONSOLE_SUBGROUP( Game, GUI )
|
||||
|
||||
#include "../pfGameGUIMgr/pfGUICtrlGenerator.h"
|
||||
|
||||
static hsColorRGBA sDynCtrlColor = hsColorRGBA().Set( 1, 1, 1, 1 ), sDynCtrlTextColor = hsColorRGBA().Set( 0, 0, 0, 1 );
|
||||
|
||||
PF_CONSOLE_CMD( Game_GUI, SetDynamicCtrlColor, "float bgRed, float bgGreen, float bgBlue, float textRed, float textGreen, float textBlue", "" )
|
||||
{
|
||||
sDynCtrlColor.Set( params[ 0 ], params[ 1 ], params[ 2 ], 1.f );
|
||||
sDynCtrlTextColor.Set( params[ 3 ], params[ 4 ], params[ 5 ], 1.f );
|
||||
}
|
||||
|
||||
|
||||
PF_CONSOLE_CMD( Game_GUI, CreateRectButton, "string title, float x, float y, float width, float height, string command", "" )
|
||||
{
|
||||
pfGUICtrlGenerator::Instance().GenerateRectButton( params[ 0 ], params[ 1 ], params[ 2 ],
|
||||
params[ 3 ], params[ 4 ],
|
||||
params[ 5 ],
|
||||
sDynCtrlColor, sDynCtrlTextColor );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_GUI, CreateRoundButton, "float x, float y, float radius, string command", "" )
|
||||
{
|
||||
pfGUICtrlGenerator::Instance().GenerateSphereButton( params[ 0 ], params[ 1 ], params[ 2 ],
|
||||
params[ 3 ],
|
||||
sDynCtrlColor );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_GUI, CreateDragBar, "float x, float y, float width, float height", "")
|
||||
{
|
||||
pfGUICtrlGenerator::Instance().GenerateDragBar( params[ 0 ], params[ 1 ], params[ 2 ], params[ 3 ], sDynCtrlColor );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_GUI, CreateDialog, "string name", "" )
|
||||
{
|
||||
pfGUICtrlGenerator::Instance().GenerateDialog( params[ 0 ] );
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//#include "../pfKI/pfKI.h"
|
||||
#include "../pfMessage/pfKIMsg.h"
|
||||
|
||||
PF_CONSOLE_CMD( Game, EnterChatMode, "", "Enters in-game chat mode" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kEnterChatMode);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIToggleMini, "", "Toggle between mini and big KI" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kMiniBigKIToggle);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIPutAway, "", "Put KI completely away" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIPutAway);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIChatPageUp, "", "Scroll chat display one page up" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kChatAreaPageUp);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIChatPageDown, "", "Scroll chat display one page down" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kChatAreaPageDown);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIChatToStart, "", "Scroll chat display to top of buffer" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kChatAreaGoToBegin);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIChatToEnd, "", "Scroll chat display to bottom of buffer" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kChatAreaGoToEnd);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KITakePicture, "", "Take picture with KI" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKITakePicture);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KICreateJournal, "", "Create journal note entry" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKICreateJournalNote);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIChatToggleFaded, "", "Toggle fade of chat display" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIToggleFade);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIChatToggleFadeEnable, "", "Toggle enable of chat fade" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIToggleFadeEnable);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIUpSizeFont, "", "Up size the KI font (chatarea)" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIUpSizeFont);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIDownSizeFont, "", "Down size the KI font (chatarea)" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIDownSizeFont);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIOpenYeeshaBook, "", "Open the player's Yeesha book" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIOpenYeehsaBook);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIOpenKI, "", "Open the KI a little at a time" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIOpenKI);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KIHelp, "", "Open the CCR help dialog" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKIShowCCRHelp);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KICreateMarker, "", "Create marker in the working marker folder" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKICreateMarker);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, KICreateMarkerFolder, "", "Create marker folder in current Age's journal folder" )
|
||||
{
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kKICreateMarkerFolder);
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game, SetChatFadeDelay, "float delayInSecs", "Sets the time in seconds before the chat text disappears" )
|
||||
{
|
||||
// pfKI::GetInstance()->SetChatFadeDelay( params[ 0 ] );
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kSetChatFadeDelay);
|
||||
msg->SetDelay( params[0] );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
|
||||
#include "../plAvatar/plArmatureMod.h"
|
||||
|
||||
PF_CONSOLE_CMD( Game, LimitAvatarLOD, "int newLOD", "Zero is (always) highest detail; 2 is (currently) lowest." )
|
||||
{
|
||||
int newLOD = params[0];
|
||||
|
||||
if(newLOD >= 0 && newLOD <= 2)
|
||||
plArmatureLODMod::fMinLOD = newLOD;
|
||||
}
|
||||
|
||||
|
||||
PF_CONSOLE_SUBGROUP( Game, Emote) // Game.Emote.Shakefist
|
||||
|
||||
void Emote(const char *emotion, float fadeIn = 2.0, float fadeOut = 2.0)
|
||||
{
|
||||
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
|
||||
AvatarEmote(avatar, emotion);
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_Emote, Wave, "", "")
|
||||
{
|
||||
Emote("Wave", 4.0, 1.0);
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_Emote, Sneeze, "", "")
|
||||
{
|
||||
Emote("Sneeze");
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_Emote, Dance, "", "")
|
||||
{
|
||||
Emote("Dance");
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_Emote, Laugh, "", "")
|
||||
{
|
||||
Emote("Laugh");
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_Emote, Clap, "", "")
|
||||
{
|
||||
Emote("Clap", 4.0, 3.0);
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_Emote, Talk, "", "")
|
||||
{
|
||||
Emote("Talk");
|
||||
}
|
||||
|
||||
PF_CONSOLE_CMD( Game_Emote, Sit, "", "")
|
||||
{
|
||||
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
|
||||
PushSimpleMultiStage(avatar, "SitDownGround", "SitIdleGround", "SitStandGround", true, true, plAGAnim::kBodyLower, plAvBrainGeneric::kSitOnGround);
|
||||
}
|
||||
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
PF_CONSOLE_CMD( Game, SetLocalClientAsAdmin, "bool enable", "Makes chat messages from this client appear as admin messages" )
|
||||
{
|
||||
// pfKI::GetInstance()->SetTextChatAdminMode( (bool)params[ 0 ] );
|
||||
pfKIMsg* msg = TRACKED_NEW pfKIMsg(pfKIMsg::kSetTextChatAdminMode);
|
||||
msg->SetFlags( params[0] ? pfKIMsg::kAdminMsg : 0 );
|
||||
plgDispatch::MsgSend( msg );
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "../pfConditional/plObjectInBoxConditionalObject.h"
|
||||
|
||||
PF_CONSOLE_CMD( Game, BreakVolumeSensors, "bool break", "reverts to old broken volume sensor logic" )
|
||||
{
|
||||
bool b = params[ 0 ];
|
||||
plVolumeSensorConditionalObject::makeBriceHappyVar = !b;
|
||||
}
|
||||
|
Reference in New Issue
Block a user